GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> FILE / V3-11-1 > file_lcp / rhel6-32
Classes | |
struct | _FILE_Upl_Info |
Typedefs | |
typedef enum _FILE_Upl_State | FILE_Upl_State |
typedef struct _FILE_Upl | FILE_Upl |
typedef struct _FILE_Upl_Info | FILE_Upl_Info |
Enumerations | |
enum | _FILE_Upl_State { FILE_UPL_STATE_START = 0, FILE_UPL_STATE_LOAD = 1, FILE_UPL_STATE_COMMIT = 2, FILE_UPL_STATE_ERROR = 3 } |
Functions | |
FILE_Upl * | FILE_uplGet (void) |
Get a pointer to the file upload state machine descriptor. | |
unsigned int | FILE_uplInit (FILE_Upl *upl, void *fileBuf, unsigned int bufSize) |
Initialize the file upload state machine. | |
unsigned int | FILE_uplPkt (FILE_Upl *upl, const void *pkt, FILE_Upl_Info *info) |
Announce the arrival of a packet to the state machine. | |
unsigned int | FILE_uplReset (FILE_Upl *upl) |
Reset the file upload state machine. | |
unsigned int | FILE_uplInfo (FILE_Upl *upl, FILE_Upl_Info *info) |
Get information about the file upload current state. | |
unsigned int | FILE_uplExit (FILE_Upl *upl) |
Shutdown the file upload state machine. | |
unsigned int | FILE_uplCommit (FILE_Upl *upl, unsigned int id, int validateOnly) |
Announce a file upload commit operation to the state machine. | |
unsigned int | FILE_uplStart (FILE_Upl *upl, unsigned int size) |
Announce a file upload start operation to the state machine. | |
unsigned int | FILE_uplData (FILE_Upl *upl, unsigned int offset, unsigned int size, const void *data) |
Announce a file upload next data operation to the state machine. | |
unsigned int | FILE_uplCancel (FILE_Upl *upl) |
Announce a file upload cancel operation to the state machine. | |
unsigned int | FILE_uplSetError (FILE_Upl *upl, unsigned int errCode) |
Set the file upload state machine error information. |
This library implements a simple state machine to help manage GLAST LAT file object uploads. The uploads arrive as a series of CCSDS telecommand packets. After initialization, the upload state machine is ready to accept packets. The state machine uses the user supplied buffer to assemble the file completely in memory. This allows for validation of the complete file data before the file is committed to storage. A File Upload Start telecommand announces the beginning of a new file upload. It also provides a byte size for the upload. A series of File Upload Data telecommands follow.
It is assumed that when FILE_uplPkt() is called, basic validation of the telecommand packet has already occured. Also, the state machine must be presented only telecommands with Application ID 0x641. The function FILE_uplPkt() will query the CCSDS packet header to get the Function Code. Only function codes 0 (File Upload Start), 1 (File Upload Cancel), 2 (File Upload Commit), and 3 (File Upload Data) are recognized.
The file to be loaded should already contain a valid LAT file object header (see constituent file_hdr). The prefixed file header is used to validate the complete file data set before allowing the upload to move from FILE_UPL_STATE_LOAD to FILE_UPL_STATE_COMMIT.
This implementation assumes that each CPU only maintains one global file upload state machine. This is reflected in the interface function FILE_uplGet(), which returns a pointer to the static instance of the state machine descriptor. No thread safety is provided internally. The one exception to this is when the FILE_Upl_Info structure is filled in. This operation is protected by a lock to allow one task to process the file upload telecommands while annother checks up on the current status.
Public descriptor for file upload state machine instance.
The typedef for _FILE_Upl_Info.
The typedef for _FILE_Upl_State.
enum _FILE_Upl_State |
Codes indicating current state of file upload.