Michael Piepers homepage
BeOS Programs
PalmBeach
PSION Link Protocol description
RFSV Protocol description

RFSV command FOPEN


Description of command

The command FOPEN used over either a file to open a file or a whole DEVICE! In order to be able to operate later thereby, a File handle will be returned the delivery, to that with further internal messages must be used.

It is to be noted that; all values, which are more greater than 8 bits in reverse order will transfer. The LOW byte sent as the first over the line and only then follows the HIGH byte!


Transmission direction (command) in the interface format

The instruction FOPEN is consequently built into the PLP:

Header PLP RFSV FOPEN Footer CRC
16 10 02 32 03 02 01 Command
00 00
Size
17 00
Mode
05 00
File name
"REM::\M:\AGN\AGENDA.AGN"
10 03 12 34

Receipt direction (result) in the interface format

A valid response takes place with the command RESPONSE and returns the delivery an error code, or a valid file descriptor. In the following an example is represented, which returns the delivery the File handle 1.

Header PLP RFSV-RESPONSE Footer CRC
16 10 02 33 02 03 01 Command
2a 00
Size
04 00
Result
00 00
File handle
01 00
10 03 12 34
boldValues represent fixed of values, which are used accurately in such a way!
italicValues represent examples, which have a different meaning on the basis the instruction.

Description of command

The command FOPEN consists of 4 information units. These have the following meanings:

Length in byte possible values Meaning
Command 2 byte 00 00 (fixed) The command identifier has always the same value!
Size 2 byte variable Since the file name with is transmitted, the value of the length of the file name, needed here, depends! The length, which is indicated here, covers the area mode + file name inclusive of the final 0-Bytes with the file name!
Mode 2 byte variable The open mode assembles itself by addition of the following values!
OPEN 00 00File open
CREATE 00 01File create again
REPLACE 00 02File replace
APPEND 00 03File attach
UNIQUE 00 04File exclusively open
FSTREAM 00 00Access to one binary file
FSTREAM_TEXT 00 10Access to a text file
FTEXT 00 20Any accesses to a text file
FDIR 00 30Any accesses to a directory
FFORMAT 00 40format a device
FDEVICE 00 50Any accesses to the DEVICES
FNODE 00 60Any accesses to a NodeNameList
FUPDATE 01 00Reading and writing permits
FRANDOM 02 00Any positioning possible
FSHARE 04 00File CAN shared
File name 1 byte or more 0-terminated string The file name is to be transmitted, which is to be opened.

Description of result

The command FOPEN is answered with RESPONSE. This returns the delivery as result an error code and in case of success a File description, to that with further accesses to the file to be used must;!

Length in byte possible values Meaning
Command 2 byte 00 2a (fixed) The command identifier has always the same value!
Size 2 byte 00 04 (fixed) Always 4 additional byte are supplied!
Result 2 Byte variable The following Values are possible:
NO_ERROR 00 00 0 no error
E_FILE_NXIST ff df -33 File dosn't exist
E_FILE_NAME ff da -38 Filename is invalid
E_FILE_DEVICE ff d7 -41 The Device is invalid
E_FILE_DIR ff d6 -42 A Folder in the Path isn't available
You can look at all defined errorvalues.
File handle 2 byte variable You get the filehandle as the result. You have to use this handle for every further access to this file.

Michael Piepers homepage
BeOS Programs
PalmBeach
PSION Link Protocol description
RFSV Protocol description

Last modification Apr 04 1999 by Michael Pieper