/* Max length of remote pathname */ #define MXRIONAME 256 /* Size of RIO chunk transferred at a time */ #define MXRIOBYTES (1024*1024) /* message types interchanged between this code and the server */ #define RIOHEADER 0x01 #define RIOCTS 0x02 #define RIODATA 0x03 #define RIOSTATUS 0x04 #define RIOACK 0x05 #define RIOPING 0x06 #define RIOEXIT 0xff /* Fixed ports to try - should be list. */ #define GMCLIENTPORT 4 #define GMSERVERPORT 5 /* A generic message for RIOCTS or RIOSTATUS. */ typedef struct { unsigned type; /* one of the above defined types */ int status; /* interpretation depends on message type */ } RioMessage_t; /* RIOHEADER message. * This information needs to be passed to the server for a write/read */ typedef struct { unsigned type; struct { int ireadwrite; unsigned nbytes; #ifdef _WIN32 __int64 offset; #else unsigned offset; #endif char name[MXRIONAME]; } rio; } RioHeader_t; /* A data message will move on the low priority channel and hence needs * no other header information... so RIODATA is untagged. */ /* This is the client/server data interchange logic: * * ============================== * write( ... node, addr, nbytes ) * * ==CLIENT== ==SERVER== * * RIOHEADER --------> open file, error check * copy first buffer * to Riobuffer * RIOCTS <-------- ready to write * send buffer ------> RIODATA * copy next write buffer to file * RIOCTS <-------- ready * send buffer ------> RIODATA * no next to copy write buffer to file * RIOSTATUS <-------- close file * return status * * ============================== * read( ... node, addr, nbytes ) * * ==CLIENT== ==SERVER== * * RIOHEADER ---------> openfile, error check * read first buffer * ready for ---------> RIOCTS * RIODATA <--------- send buffer, read next * copy buffer * to addr ---------> RIOCTS * RIODATA <--------- send buffer, no next * copy buffer to read. * to addr * finished ---------> RIOCTS * RIOSTATUS <--------- no more bytes; close file * return status * */