GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > FILE / V3-8-1

Constituent: file_hdr     Tag: mv2304


Interface   Data Structures   File List   Data Fields   Globals  

FILE_hdr.h File Reference

File object header library. More...

#include "FILE/FILE_hdr_msg.h"

Include dependency graph for FILE_hdr.h:

This graph shows which files directly or indirectly include this file:


Defines

#define FILE_HDR_NAME_SIZE   8

Typedefs

typedef enum _FILE_Hdr_Version FILE_Hdr_Version
typedef enum _FILE_Hdr_Compression_Flag FILE_Hdr_Compression_Flag

Enumerations

enum  _FILE_Hdr_Version {
  FILE_HDR_VERSION_1 = 0x2000,
  FILE_HDR_VERSION_2 = 0x4000
}
enum  _FILE_Hdr_Compression_Flag {
  FILE_HDR_UNCOMPRESSED = 0x0000,
  FILE_HDR_COMPRESSED = 0x1000
}

Functions

unsigned int FILE_hdrSizeof (void)
 Get the size of a file header.
unsigned int FILE_hdrCreate (void *buf, unsigned int length, unsigned int time, unsigned int chksum, unsigned short type, unsigned int key, FILE_Hdr_Compression_Flag compress, const char *name)
 Create a new file header.
unsigned int FILE_hdrGetLength (const void *buf, unsigned int *length)
 Get the file data size.
unsigned int FILE_hdrGetChksum (const void *buf, unsigned int *chksum)
 Get the file checksum.
unsigned int FILE_hdrGetTime (const void *buf, unsigned int *time)
 Get the file timestamp.
unsigned int FILE_hdrGetType (const void *buf, unsigned short *type)
 Get the file type.
unsigned int FILE_hdrGetKey (const void *buf, unsigned int *key)
 Get the file key.
unsigned int FILE_hdrGetCompression (const void *buf, unsigned short *compress)
 Get the file compression flag.
unsigned int FILE_hdrGetName (const void *buf, char *name)
 Get the file name string.
unsigned int FILE_hdrVerify (const void *buf)
 Verify the integrety of a file header.

Detailed Description

File object header library.

Author:
D.L. Wood
The functions in this library manuipulate the members of a standard LAT file object header. All of the functions work on a memory buffer; users are responsible for reading in the header from a file before queries and for writing the header to a file after modifications.

There is a function FILE_hdrCreate(), which will create a new file header in user memory from scratch. All header member values must be specified. For each of the header members, the functions FILE_hdrGetXXX() will selectively retrive values from an existing file header in user memory.

The LAT file headers contain two checksums: one for the header contents and one for the file data contents. It is up to the user to calculate and verify the checksums for the actual file data. The library functions simply treat the file data checksum as an opaque value. The library functions, however, will calculate and verify the header checksum value when appropriate. The header checksum is not exposed by any functions in this library. It is calculated using the ZLIB adler32() function. The value is set in FILE_hdrCreate() and verified in FILE_hdrVerify().


Define Documentation

#define FILE_HDR_NAME_SIZE   8
 

The size in bytes of the file name contained in a file header.


Typedef Documentation

FILE_Hdr_Compression_Flag
 

The typedef for _FILE_Hdr_Compression_Flag.

FILE_Hdr_Version
 

The typedef for _FILE_Hdr_Version.


Enumeration Type Documentation

enum _FILE_Hdr_Compression_Flag
 

The file header compression flag values.

Enumerator:
FILE_HDR_UNCOMPRESSED  File data is not ZLIB compressed.
FILE_HDR_COMPRESSED  File data is ZLIB compressed.

enum _FILE_Hdr_Version
 

The file header version values. Tracks the binary external format changes.

Enumerator:
FILE_HDR_VERSION_1  Original format. Obsolete
FILE_HDR_VERSION_2  Current format.


Function Documentation

unsigned int FILE_hdrCreate void *  buf,
unsigned int  length,
unsigned int  time,
unsigned int  chksum,
unsigned short  type,
unsigned int  key,
FILE_Hdr_Compression_Flag  compress,
const char *  name
 

Create a new file header.

Creates a file header in the buffer specified by buf. The user is resposible for actually writing the new header into file storage. This library only supports buffers whose total size is aligned on a 16-bit boundary. The function will fail with error #FILE_EHDRPARM if the length parameter is not correctly aligned.

Parameters:
buf A pointer to the file header buffer.
length The size in bytes of file data to follow the file header.
time The file timestamp, in seconds.
chksum The checksum of the remainder of the file header and file data.
type The file type code.
key The file key value.
compress #FILE_HDR_UNCOMPRESSED - The file data following the header is uncompressed.
#FILE_HDR_COMPRESSED The file data following the header is compressed.
name The ASCII file name. This parameter should point to a buffer containing #FILE_HDR_NAME_SIZE characters.
Returns:
A FHDR MSG value.

unsigned int FILE_hdrGetChksum const void *  buf,
unsigned int *  chksum
 

Get the file checksum.

Returns the checksum of the remainder of the file header and file data.

Parameters:
buf A pointer to the start of the file header buffer.
chksum Stores the checksum value.
Returns:
A FILE MSG value.

unsigned int FILE_hdrGetCompression const void *  buf,
unsigned short *  compress
 

Get the file compression flag.

Returns the file compression flag value.

Parameters:
buf A pointer to the start of the file header buffer.
compress Stores the compression flag value.
Returns:
A FILE MSG value.

unsigned int FILE_hdrGetKey const void *  buf,
unsigned int *  key
 

Get the file key.

Returns the file key value.

Parameters:
buf A pointer to the start of the file header buffer.
key Stores the key value.
Returns:
A FILE MSG value.

unsigned int FILE_hdrGetLength const void *  buf,
unsigned int *  length
 

Get the file data size.

Returns the size in bytes of file data following the file header.

Parameters:
buf A pointer to the start of the file header buffer.
length Stores the length value.
Returns:
A FILE MSG value.

unsigned int FILE_hdrGetName const void *  buf,
char *  name
 

Get the file name string.

Returns the file name string. The ASCII characters are copied to the user buffer indicated by name. The string is not NULL terminated after return.

Parameters:
buf A pointer to the start of the file header buffer.
name Stores the name string. Should be at least FILE_HDR_NAME_SIZE bytes in size.
Returns:
A FILE MSG value.

unsigned int FILE_hdrGetTime const void *  buf,
unsigned int *  time
 

Get the file timestamp.

Returns the file timestamp.

Parameters:
buf A pointer to the start of the file header buffer.
time Stores the timestamp value.
Returns:
A FILE MSG value.

unsigned int FILE_hdrGetType const void *  buf,
unsigned short *  type
 

Get the file type.

Returns the file type code.

Parameters:
buf A pointer to the start of the file header buffer.
type Stores the type value.
Returns:
A FILE MSG value.

unsigned int FILE_hdrSizeof void   ) 
 

Get the size of a file header.

Returns the size in bytes of a LAT file header.

Returns:
The header size.

unsigned int FILE_hdrVerify const void *  buf  ) 
 

Verify the integrety of a file header.

Verifies the format of a file header in buf. Calculates header checksum and compares it to value stored in header.

Parameters:
buf A pointer to the start of the file header buffer.
Returns:
A FILE MSG value.


Generated on Tue Oct 25 22:34:24 2005 by  doxygen 1.4.4