Implement ISOBUS File Server (FS) Interface as a Personal Project

Introduce the ISOBUS File Server (FS) interface, compatible with ISO
11783-13. The implementation utilizes the kernel's existing CAN J1939
socket support.

For testing following setup can be used:
ip link add type vcan
ip l s dev vcan0 up

j1939acd -r 64-95 -c /tmp/1122334455667788.jacd 1122334455667788 vcan0 &
j1939acd -r 96-127 -c /tmp/1122334455667789.jacd 1122334455667789 vcan0 &

sleep 1

isobusfs-srv -i vcan0 -n 1122334455667788 -v vol1:/path/to/export/
isobusfs-cli -i vcan0 -n 0x1122334455667789 -m 0x1122334455667788 -I

Interactive mode currently support following commands:
exit - exit interactive mode
quit - exit interactive mode
help - show this help
dmesg - show log buffer
selftest - run selftest
ls - list directory
ll - list directory with long listing format
cd - change directory
pwd - print name of current/working directory
get - get file

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
This commit is contained in:
Oleksij Rempel
2024-02-02 13:44:07 +01:00
committed by Oleksij Rempel
parent 6004c64f06
commit 42edaeaf52
30 changed files with 9750 additions and 0 deletions
+104
View File
@@ -0,0 +1,104 @@
#ifndef _ISOBUSFS_CMN_DH_H
#define _ISOBUSFS_CMN_DH_H
#include "isobusfs_cmn.h"
/**
* C.2.2.2 Get Current Directory Request
* struct isobusfs_dh_get_cd_req - Get Current Directory Request structure
* @fs_function: Function and command (1 byte)
* Bits 7-4: 0b0001 (Command - Directory Access, see B.1)
* Bits 3-0: 0b0000 (Function - Get Current Directory, see B.2)
* @tan: Transaction number (1 byte) (see B.8)
* @reserved: Reserved, transmit as 0xFF (6 bytes)
*
* Transmission repetition rate: On request
* Data length: 8 bytes
* Parameter group number: Client to FS, destination-specific
*/
struct isobusfs_dh_get_cd_req {
uint8_t fs_function;
uint8_t tan;
uint8_t reserved[6];
};
/**
* C.2.2.3 Get Current Directory Response
* struct isobusfs_dh_get_cd_res - Get Current Directory Response structure
* @fs_function: Function and command (1 byte)
* Bits 7-4: 0b0001 (Command - Directory Access, see B.1)
* Bits 3-0: 0b0000 (Function - Get Current Directory, see B.2)
* @tan: Transaction number (1 byte) (see B.8)
* @error_code: Error code (1 byte) (see B.9)
* @total_space: Total space (4 bytes) (in units of 512 bytes, see B.11)
* @free_space: Free space (4 bytes) (in units of 512 bytes, see B.11)
* @name_len: Path Name Length (2 bytes) (__le16, see B.12)
* @name: Path Name (variable length) (see B.13)
*
* Transmission repetition rate: In response to Get Current Directory Request message
* Data length: Variable
* Parameter group number: FS to client, destination-specific
*/
struct isobusfs_dh_get_cd_res {
uint8_t fs_function;
uint8_t tan;
uint8_t error_code;
__le32 total_space;
__le32 free_space;
__le16 name_len;
uint8_t name[];
};
/**
* C.2.3.2 Change Current Directory Request
* struct isobusfs_dh_ccd_req - Change Current Directory Request structure
* @fs_function: Function and command (1 byte)
* Bits 7-4: 0b0001 (Command - Directory Access, see B.1)
* Bits 3-0: 0b0001 (Function - Change Current Directory, see B.2)
* @tan: Transaction number (1 byte) (see B.8)
* @name_len: Path Name length (2 bytes) (__le16, see B.12)
* @name: Path Name (variable length) (see B.13)
*
* Transmission repetition rate: On request
* Data length: Variable
* Parameter group number: Client to FS, destination-specific
*/
struct isobusfs_dh_ccd_req {
uint8_t fs_function;
uint8_t tan;
__le16 name_len;
uint8_t name[];
};
/**
* C.2.3.3 Change Current Directory Response
* struct isobusfs_dh_ccd_res - Change Current Directory Response structure
* @fs_function: Function and command (1 byte)
* Bits 7-4: 0b0001 (Command - Directory Access, see B.1)
* Bits 3-0: 0b0001 (Function - Change Current Directory, see B.2)
* @tan: Transaction number (1 byte) (see B.8)
* @error_code: Error code (1 byte) (see B.9)
* 0: Success
* 1: Access denied
* 2: Invalid access
* 4: File, path or volume not found
* 7: Invalid destination name given
* 10: Media is not present
* 13: Volume is possibly not initialized
* 43: Out of memory
* 44: Any other error
* @reserved: Reserved, transmit as 0xFF (5 bytes)
*
* Transmission repetition rate: In response to Change Current Directory Request message
* Data length: 8 bytes
* Parameter group number: FS to client, destination-specific
*/
struct isobusfs_dh_ccd_res {
uint8_t fs_function;
uint8_t tan;
uint8_t error_code;
uint8_t reserved[5];
};
#endif /* _ISOBUSFS_CMN_DH_H */