File Retrieval Protocol

The file retrieval protocol allows a client program to contact and retrieve files from a machine running a PFS daemon. It is a simple two-stage protocol: First, the client sends a particular request, along with necessary data. Next, the daemon on the remote system responds with an error code and (if there is no error) data to satisfy the request. The currently supported request types are

Requests

Request messages have the following format:
ReadDirectory
1 byte 4 bytes arbitrary
0x01 namelen full virtual pathname of directory
ReadFile
1 byte 4 bytes arbitrary 4 bytes 4 bytes
0x02 namelen full virtual pathname of file first byte index last byte index + 1
FindFile
1 byte 4 bytes arbitrary 4 bytes arbitrary
0x03 namelen full virtual pathname of base directory namelen name of file to search for

Responses

Responses use the following direntry structure. The filetype is 0x01 for standard files and 0x02 for directories. Dates are in standard UNIX time_t format.

4 bytes arbitrary 1 byte 4 bytes 4 bytes
namelen filename filetype filesize date modified

Responses have the following format:

ReadDirectory & FindFile

The direntry filename field holds only the file's name itself in a ReadDirectory response. It holds a full virtual pathname in a FindFile response.

1 byte 4 bytes arbitrary arbitrary arbitrary ...
errorcode # entries direntry direntry direntry ...

ReadFile

1 byte arbitrary
errorcode raw data