Improved encode/decode routines

Version 2 (modified by walt, 17 months ago)

--

Editing Improved encode/decode routines

PVFS communicates between client and sever over a network using a specific protocol. Rather than work with data exactly as it passes over the network, the PVFS code allows requests and responses to be access using the format native to the machine where the code is running - a format that may or may not be consistent throughout the system. The code provides encode and decode routines for translating between the local format and the protocol format. This includes byte order, field size (32 versus 64 bits) and potentially floating point formats.

For every data type that is sent over the network, including scalar, vector, and struct types, there is a function defined using s set of pre-defined macros to copy data from protocol to local format (decode) and local format to protocol format (encode). Generally, each message in the protocol is declared as a single type, usually a struct. When an encode occurs, the program allocates a buffer and calls the translation function for that message, which recursively calls all of the other functions needed to perform the encoding. Decode is essentially the opposite. One flaw in the existing system is that these functions assume adequate space is provided in the buffers. This is usually true because the program can predict the largest buffer needed. If there is an unexpected program error though, it is possible for these functions to overwrite memory in such a way as to make debugging very difficult.

The goal of this project is to modify the encoding and decoding routines to pass the remaining buffer space available so that each function can stop before overwritting memory. This is a relatively easy project and could be combined with others during a summer session.