GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > QSE / V1-5-2

Constituent: qsd     Tag: sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

CCSDS_istream.h File Reference

CCSDS input stream (reader) interface. More...

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


Data Structures

struct  _CCSDS_istreamHdr
 Opaque structure reserving enough space for a CCSDS TELEM packet header, includes the 2 bytes to round it to 16 bytes. More...

Typedefs

typedef _CCSDS_istream CCSDS_istream
 Typedef for struct _CCSDS_istream.
typedef int(* CCSDS_istreamReader )(void *prm, void *buf, int nbytes, int pbytes)
 Routine to read the specified number of bytes from the input stream.
typedef int(* CCSDS_istreamTeller )(const void *prm)
 Routine to give the current position in the stream. As an example, for files, this will do an ftell.
typedef int(* CCSDS_istreamCloser )(void *prm)
 Routine to read the specified number of bytes from the input stream.
typedef _CCSDS_istreamHdr CCSDS_istreamHdr
 Typedef for struct _CCSDS_istreamHdr.
typedef enum _CCSDS_ISTREAM_SIV_S CCSDS_ISTREAM_SIV_S
 Typedef for CCSDS_ISTREAM_SIV_S.
typedef enum _CCSDS_ISTREAM_SIV_V CCSDS_ISTREAM_SIV_V
 Typedef for CCSDS_ISTREAM_SIV_V.
typedef enum _CCSDS_ISTREAM_SIV_M CCSDS_ISTREAM_SIV_M
 Typedef for CCSDS_ISTREAM_SIV_M.
typedef enum _CCSDS_ISTREAM_PKT_STATE_K CCSDS_ISTREAM_PKT_STATE_K
 Typedef for enum _CCSDS_ISTREAM_PKT_STATE_K.

Enumerations

enum  _CCSDS_ISTREAM_SIV_S {
  CCSDS_ISTREAM_SIV_S_SEQGAP = 16,
  CCSDS_ISTREAM_SIV_S_PRV_FIRST = 1,
  CCSDS_ISTREAM_SIV_S_PRV_LAST = 1,
  CCSDS_ISTREAM_SIV_S_PRV = 2,
  CCSDS_ISTREAM_SIV_S_CUR_FIRST = 1,
  CCSDS_ISTREAM_SIV_S_CUR_LAST = 1,
  CCSDS_ISTREAM_SIV_S_CUR = 2,
  CCSDS_ISTREAM_SIV_S_RSVD_20 = 1,
  CCSDS_ISTREAM_SIV_S_RSVD_21 = 1,
  CCSDS_ISTREAM_SIV_S_RSVD_22 = 1,
  CCSDS_ISTREAM_SIV_S_RSVD_23 = 1,
  CCSDS_ISTREAM_SIV_S_ERR = 8,
  CCSDS_ISTREAM_SIV_S_ERR_EOS = 1,
  CCSDS_ISTREAM_SIV_S_ERR_RDHDR = 1,
  CCSDS_ISTREAM_SIV_S_ERR_BADHDR = 1,
  CCSDS_ISTREAM_SIV_S_ERR_SEQ = 1,
  CCSDS_ISTREAM_SIV_S_ERR_SEQNUM = 1,
  CCSDS_ISTREAM_SIV_S_ERR_RDDAT = 1,
  CCSDS_ISTREAM_SIV_S_ERR_OVRRUN = 1,
  CCSDS_ISTREAM_SIV_S_ERR_SUMMARY = 1
}
 State Information Vector, bit field sizes. More...
enum  _CCSDS_ISTREAM_SIV_V {
  CCSDS_ISTREAM_SIV_V_SEQGAP = 0,
  CCSDS_ISTREAM_SIV_V_PRV_FIRST = 16,
  CCSDS_ISTREAM_SIV_V_PRV_LAST = 17,
  CCSDS_ISTREAM_SIV_V_PRV = 16,
  CCSDS_ISTREAM_SIV_V_CUR_FIRST = 18,
  CCSDS_ISTREAM_SIV_V_CUR_LAST = 19,
  CCSDS_ISTREAM_SIV_V_CUR = 18,
  CCSDS_ISTREAM_SIV_V_RSVD_20 = 20,
  CCSDS_ISTREAM_SIV_V_RSVD_21 = 21,
  CCSDS_ISTREAM_SIV_V_RSVD_22 = 22,
  CCSDS_ISTREAM_SIV_V_RSVD_23 = 23,
  CCSDS_ISTREAM_SIV_V_ERR = 24,
  CCSDS_ISTREAM_SIV_V_ERR_EOS = 24,
  CCSDS_ISTREAM_SIV_V_ERR_RDHDR = 25,
  CCSDS_ISTREAM_SIV_V_ERR_BADHDR = 26,
  CCSDS_ISTREAM_SIV_V_ERR_SEQ = 27,
  CCSDS_ISTREAM_SIV_V_ERR_SEQNUM = 28,
  CCSDS_ISTREAM_SIV_V_ERR_RDDAT = 29,
  CCSDS_ISTREAM_SIV_V_ERR_OVRRUN = 30,
  CCSDS_ISTREAM_SIV_V_ERR_SUMMARY = 31
}
 State Information Vector, right justified bit field offsets. More...
enum  _CCSDS_ISTREAM_SIV_M {
  CCSDS_ISTREAM_SIV_M_SEQGAP,
  CCSDS_ISTREAM_SIV_M_PRV_FIRST,
  CCSDS_ISTREAM_SIV_M_PRV_LAST,
  CCSDS_ISTREAM_SIV_M_PRV,
  CCSDS_ISTREAM_SIV_M_CUR_FIRST,
  CCSDS_ISTREAM_SIV_M_CUR_LAST,
  CCSDS_ISTREAM_SIV_M_CUR,
  CCSDS_ISTREAM_SIV_M_RSVD_20,
  CCSDS_ISTREAM_SIV_M_RSVD_21,
  CCSDS_ISTREAM_SIV_M_RSVD_22,
  CCSDS_ISTREAM_SIV_M_RSVD_23,
  CCSDS_ISTREAM_SIV_M_ERR_EOS,
  CCSDS_ISTREAM_SIV_M_ERR_RDHDR,
  CCSDS_ISTREAM_SIV_M_ERR_BADHDR,
  CCSDS_ISTREAM_SIV_M_ERR_SEQ,
  CCSDS_ISTREAM_SIV_M_ERR_SEQNUM,
  CCSDS_ISTREAM_SIV_M_ERR_RDDAT,
  CCSDS_ISTREAM_SIV_M_ERR_OVRRUN,
  CCSDS_ISTREAM_SIV_M_ERR_SUMMARY,
  CCSDS_ISTREAM_SIV_M_ERR
}
 State Information Vector, in place mask. More...
enum  _CCSDS_ISTREAM_PKT_STATE_K {
  CCSDS_ISTREAM_PKT_STATE_K_MID = 0,
  CCSDS_ISTREAM_PKT_STATE_K_FIRST = 1,
  CCSDS_ISTREAM_PKT_STATE_K_LAST = 2,
  CCSDS_ISTREAM_PKT_STATE_K_ONLY = 3
}
 Enumerates the values of a packet's state.
enum  _CCSDS_ISTREAM_SIV_K {
  CCSDS_ISTREAM_SIV_K_PRV_ONLY,
  CCSDS_ISTREAM_SIV_K_PRV_FIRST,
  CCSDS_ISTREAM_SIV_K_PRV_MID,
  CCSDS_ISTREAM_SIV_K_PRV_LAST,
  CCSDS_ISTREAM_SIV_K_CUR_ONLY,
  CCSDS_ISTREAM_SIV_K_CUR_FIRST,
  CCSDS_ISTREAM_SIV_K_CUR_MID,
  CCSDS_ISTREAM_SIV_K_CUR_LAST
}
 Enumerates the values of in place fields of the SIV word. These are all convenience symbols, all being derived from previously defined symbols.

Functions

int CCSDS_istreamSizeof (void)
 Returns the size, in bytes, of a CCSDS_istream structure.
CCSDS_istreamCCSDS_istreamNew (void)
 Convenience function to allocate and initialize a CCSDS_istream control structure.
int CCSDS_istreamConstruct (CCSDS_istream *istream)
 Constructs (initializes) a previously uninitialized CCSDS_istream control structure.
int CCSDS_istreamConnect (CCSDS_istream *istream, void *prm, CCSDS_istreamReader read, CCSDS_istreamCloser close, CCSDS_istreamTeller tell)
 Connects a read mechanism with the specified stream.
int CCSDS_istreamHdrRead (CCSDS_istream *istream, CCSDS_istreamHdr *hdr)
 Reads the CCSDS header.
int CCSDS_istreamDatRead (CCSDS_istream *istream, const CCSDS_istreamHdr *hdr, CCSDS_apidDsc *dsc)
 Reads the current CCSDS data payload into the buffer specified by dsc.
int CCSDS_istreamFileOpen (CCSDS_istream *istream, const char *filename, unsigned int options, unsigned char *buf, unsigned int buf_size)
 Convenience function to construct a CCSDS_istream to read from the specified named file filename.
unsigned int CCSDS_istreamTell (const CCSDS_istream *istream)
 Returns the current byte offset into the stream.
int CCSDS_istreamClose (CCSDS_istream *istream)
 Closes the input stream associated with istream.
int CCSDS_istreamDestroy (CCSDS_istream *istream)
 Destroys (i.e. returns the resources) associated with the stream.
void CCSDS_istreamHdrPrint (const CCSDS_istreamHdr *hdr)
 Prints a one-line summary of the CCSDS_istream header.
static __inline int CCSDS_istreamSivConstruct (void)
 Initializes the State Information Vector to a known and beign state.
static __inline int CCSDS_istreamSivIsError (int siv)
 Returns non-zero if State Information Vector, siv, is in error.
static __inline int CCSDS_istreamSivIsFirst (int siv)
 Returns non-zero if the current packet is the first packet, either alone or in a sequence.
static __inline int CCSDS_istreamSivIsLast (int siv)
 Returns non-zero if the current packet is the last packet, either alone or in a sequence.
static __inline int CCSDS_istreamSivIsMid (int siv)
 Returns non-zero if the current packet is the middle packet in a sequence.
static __inline int CCSDS_istreamSivIsOnly (int siv)
 Returns non-zero if the current packet is the only packet, i.e. bare packet, not a member of a sequence.

Variables

enum _CCSDS_ISTREAM_SIV_K CCSDS_ISTREAM_SIV_K
 Typedef for enum _CCSDS_ISTREAM_SIV_K.

Detailed Description

CCSDS input stream (reader) interface.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: CCSDS_istream.h,v 1.4 2006/05/08 17:47:07 russell Exp $

Typedef Documentation

CCSDS_ISTREAM_PKT_STATE_K
 

Typedef for enum _CCSDS_ISTREAM_PKT_STATE_K.

A packet's state is determined by the values of 2 bits, with bit 0 representing the 'is first packet' and bit 1 representing 'is last packet' Under these definitions

  • State = 0, neither first or last packet -> MIDDLE packet
  • State = 1, packet is first, but not last packet -> FIRST in a sequence
  • State = 2, packet is last, buf not first packet -> LAST in a sequence
  • State = 3, packet is both the first and last -> ONLY packet

int(* CCSDS_istreamCloser)(void *prm)
 

Routine to read the specified number of bytes from the input stream.

Parameters:
prm User specified parameter

int(* CCSDS_istreamReader)(void *prm, void *buf, int nbytes, int pbytes)
 

Routine to read the specified number of bytes from the input stream.

Return values:
0,All is well
-1,EOF,this should only occur when the file read is being done from CCSDS_istreamHdrRead.
>0,Any error other error. These should never occur.
Parameters:
prm User specified parameter
buf The destination buffer
nbytes The number of bytes to read
pbytes The number of pad bytes to skip at the end. This number is guaranteed to be no larger than 16 bytes.

int(* CCSDS_istreamTeller)(const void *prm)
 

Routine to give the current position in the stream. As an example, for files, this will do an ftell.

Returns:
The current position in the stream.
Parameters:
prm User specified parameter


Enumeration Type Documentation

enum _CCSDS_ISTREAM_SIV_M
 

State Information Vector, in place mask.

Enumerator:
CCSDS_ISTREAM_SIV_M_SEQGAP  The gap between successive sequence numbers + 1, that is CURRENT_SEQUENCE_NUMBER - PREVIOUS_SEQUENCE_NUMBER + 1 If all is right, this number should be 0
CCSDS_ISTREAM_SIV_M_PRV_FIRST  Previous packet is the first, either alone or in a sequence
CCSDS_ISTREAM_SIV_M_PRV_LAST  Previous packet is the last, either alone or in a sequence
CCSDS_ISTREAM_SIV_M_PRV  Convenience symbol to for the state of the previous packet
CCSDS_ISTREAM_SIV_M_CUR_FIRST  Previous packet is the first, either alone or in a sequence
CCSDS_ISTREAM_SIV_M_CUR_LAST  Previous packet is the last, either alone of in a sequence
CCSDS_ISTREAM_SIV_M_CUR  Convenience symbol to for the state of the current packet
CCSDS_ISTREAM_SIV_M_RSVD_20  Reserved
CCSDS_ISTREAM_SIV_M_RSVD_21  Reserved
CCSDS_ISTREAM_SIV_M_RSVD_22  Reserved
CCSDS_ISTREAM_SIV_M_RSVD_23  Reserved
CCSDS_ISTREAM_SIV_M_ERR_EOS  End of stream prematurely reached
CCSDS_ISTREAM_SIV_M_ERR_RDHDR  Error is getting the header
CCSDS_ISTREAM_SIV_M_ERR_BADHDR  Error, header is not properly formatted, essentially an error reported by CCSDS_pktHdr
CCSDS_ISTREAM_SIV_M_ERR_SEQ  Sequence error on the last packet
CCSDS_ISTREAM_SIV_M_ERR_SEQNUM  Sequence number error on the last packet
CCSDS_ISTREAM_SIV_M_ERR_RDDAT  Error is reading the data
CCSDS_ISTREAM_SIV_M_ERR_OVRRUN  Data packet was to large to fit in user provided buffer
CCSDS_ISTREAM_SIV_M_ERR_SUMMARY  Error Summary bit
CCSDS_ISTREAM_SIV_M_ERR  Any error

enum _CCSDS_ISTREAM_SIV_S
 

State Information Vector, bit field sizes.

Enumerator:
CCSDS_ISTREAM_SIV_S_SEQGAP  The gap between successive sequence numbers + 1, that is CURRENT_SEQUENCE_NUMBER - PREVIOUS_SEQUENCE_NUMBER + 1 If all is right, this number should be 0
CCSDS_ISTREAM_SIV_S_PRV_FIRST  Previous packet is the first, either alone or in a sequence
CCSDS_ISTREAM_SIV_S_PRV_LAST  Previous packet is the last, either alone or in a sequence
CCSDS_ISTREAM_SIV_S_PRV  Convenience symbol for the previous packet's state
CCSDS_ISTREAM_SIV_S_CUR_FIRST  Current packet is the first, either alone or in a sequence
CCSDS_ISTREAM_SIV_S_CUR_LAST  Current packet is the last, either alone or in a sequence
CCSDS_ISTREAM_SIV_S_CUR  Convenience symbol for the current packet's state
CCSDS_ISTREAM_SIV_S_RSVD_20  Reserved
CCSDS_ISTREAM_SIV_S_RSVD_21  Reserved
CCSDS_ISTREAM_SIV_S_RSVD_22  Reserved
CCSDS_ISTREAM_SIV_S_RSVD_23  Reserved
CCSDS_ISTREAM_SIV_S_ERR  Size of the error field, in bits
CCSDS_ISTREAM_SIV_S_ERR_EOS  End of stream reached prematurely
CCSDS_ISTREAM_SIV_S_ERR_RDHDR  Error is getting the header
CCSDS_ISTREAM_SIV_S_ERR_BADHDR  Error, header is not properly formatted, essentially an error reported by CCSDS_pktHdr
CCSDS_ISTREAM_SIV_S_ERR_SEQ  Sequence error on the last packet
CCSDS_ISTREAM_SIV_S_ERR_SEQNUM  Sequence number error on the last packet
CCSDS_ISTREAM_SIV_S_ERR_RDDAT  Error is reading the data
CCSDS_ISTREAM_SIV_S_ERR_OVRRUN  Data packet was to large to fit in user provided buffer
CCSDS_ISTREAM_SIV_S_ERR_SUMMARY  Error Summary bit

enum _CCSDS_ISTREAM_SIV_V
 

State Information Vector, right justified bit field offsets.

Enumerator:
CCSDS_ISTREAM_SIV_V_SEQGAP  The gap between successive sequence numbers + 1, that is CURRENT_SEQUENCE_NUMBER - PREVIOUS_SEQUENCE_NUMBER + 1 If all is right, this number should be 0
CCSDS_ISTREAM_SIV_V_PRV_FIRST  Previous packet is the first, either alone or in a sequence
CCSDS_ISTREAM_SIV_V_PRV_LAST  Previous packet is the last, either alone or in a sequence
CCSDS_ISTREAM_SIV_V_PRV  Convenience symbol for the previous packet's state
CCSDS_ISTREAM_SIV_V_CUR_FIRST  Current packet is the first, either alone or in a sequence
CCSDS_ISTREAM_SIV_V_CUR_LAST  Previous packet is the last, either alone or in a sequence
CCSDS_ISTREAM_SIV_V_CUR  Convenience symbol for the current packet's state
CCSDS_ISTREAM_SIV_V_RSVD_20  Reserved
CCSDS_ISTREAM_SIV_V_RSVD_21  Reserved
CCSDS_ISTREAM_SIV_V_RSVD_22  Reserved
CCSDS_ISTREAM_SIV_V_RSVD_23  Reserved
CCSDS_ISTREAM_SIV_V_ERR  Begining of the ERR field
CCSDS_ISTREAM_SIV_V_ERR_EOS  End of stream reached
CCSDS_ISTREAM_SIV_V_ERR_RDHDR  Error is getting the header
CCSDS_ISTREAM_SIV_V_ERR_BADHDR  Error, header is not properly formatted, essentially an error reported by CCSDS_pktHdr
CCSDS_ISTREAM_SIV_V_ERR_SEQ  Sequence error on the last packet
CCSDS_ISTREAM_SIV_V_ERR_SEQNUM  Sequence number error on the last packet
CCSDS_ISTREAM_SIV_V_ERR_RDDAT  Error is reading the data
CCSDS_ISTREAM_SIV_V_ERR_OVRRUN  Data packet was to large to fit in user provided buffer
CCSDS_ISTREAM_SIV_V_ERR_SUMMARY  Error Summary bit


Function Documentation

int CCSDS_istreamClose CCSDS_istream istream  ) 
 

Closes the input stream associated with istream.

Returns:
Status
Parameters:
istream The stream to close
Note:
This does not free/destroy the istream control structure, it merely closes the physical stream associated with it.

int CCSDS_istreamConnect CCSDS_istream istream,
void *  prm,
CCSDS_istreamReader  read,
CCSDS_istreamCloser  close,
CCSDS_istreamTeller  tell
 

Connects a read mechanism with the specified stream.

Return values:
0,Always 
Parameters:
istream The target CCSDS_istream
prm Arbitrary user context parameter passed to the read routine
read The routine used to read from the underlying physical data stream
close The routine used to close the underlying physical stream
tell The routine used to get the current position in the stream.

int CCSDS_istreamConstruct CCSDS_istream istream  ) 
 

Constructs (initializes) a previously uninitialized CCSDS_istream control structure.

Return values:
==0,Successful 
!=0,Failure (currently the routine always succeeds
Parameters:
istream The CCSDS_istream structure to construct (initialize)

int CCSDS_istreamDatRead CCSDS_istream istream,
const CCSDS_istreamHdr hdr,
CCSDS_apidDsc dsc
 

Reads the current CCSDS data payload into the buffer specified by dsc.

Returns:
The State Information Vector. This is a heavily bit-encoded 32-bit word, see CCSDS_ISTREAM_SIV_M, for example for the meanings of these bits. Consult the dsc->status word for more information
Parameters:
istream The target CCSDS_istream structure
hdr The header associated with the data about to be read
dsc The target APIDs descriptor
If there was insufficient space in the descriptor's read buffer to perform the read, no bytes are read, but rather, the return value is set to indicate insufficient space and the descriptor's status word (dsc->status) is set to the number of bytes needed. The user may increase the descriptors read buffer side and then recall this routine.

int CCSDS_istreamDestroy CCSDS_istream istream  ) 
 

Destroys (i.e. returns the resources) associated with the stream.

Returns:
Status
Parameters:
istream The stream to destroy.

int CCSDS_istreamFileOpen CCSDS_istream istream,
const char *  filename,
unsigned int  options,
unsigned char *  buf,
unsigned int  buf_size
 

Convenience function to construct a CCSDS_istream to read from the specified named file filename.

Returns:
0, If successful

-1, If could not allocate a new stream (i.e. out of memory)

-2, If the file does not exist XS

Parameters:
istream The target CCSDS_istream
filename The name of the file to open
options Bit list of options, currently unused, specify as 0
buf Optional parameter specifying the FILE's input read buffer
buf_size Optional parameter specifying the size of buf

void CCSDS_istreamHdrPrint const CCSDS_istreamHdr hdr  ) 
 

Prints a one-line summary of the CCSDS_istream header.

Parameters:
hdr The header to print

int CCSDS_istreamHdrRead CCSDS_istream istream,
CCSDS_istreamHdr hdr
 

Reads the CCSDS header.

Return values:
0,Success 
-1,End Of Stream
Anything else, error number (errno)
Parameters:
istream The target CCSDS_istream
hdr The destination CCSDS header

CCSDS_istream* CCSDS_istreamNew void   ) 
 

Convenience function to allocate and initialize a CCSDS_istream control structure.

Returns:
Pointer to the allocated CCSDS_istream control structure

static __inline int CCSDS_istreamSivConstruct void   )  [static]
 

Initializes the State Information Vector to a known and beign state.

Returns:
The initialized value

static __inline int CCSDS_istreamSivIsError int  siv  )  [static]
 

Returns non-zero if State Information Vector, siv, is in error.

Return values:
=0 Is not in error
!=0 Is in error

static __inline int CCSDS_istreamSivIsFirst int  siv  )  [static]
 

Returns non-zero if the current packet is the first packet, either alone or in a sequence.

Return values:
=0 Is not the first packet, either alone or in a sequence
!=0 Is the first packet, either alone or in a sequence

static __inline int CCSDS_istreamSivIsLast int  siv  )  [static]
 

Returns non-zero if the current packet is the last packet, either alone or in a sequence.

Return values:
=0 Is not the last packet, either alone or in a sequence
!=0 Is the last packet, either alone or in a sequence

static __inline int CCSDS_istreamSivIsMid int  siv  )  [static]
 

Returns non-zero if the current packet is the middle packet in a sequence.

Return values:
=0 Is not the last packet in a sequence
!=0 Is the last packet in a sequence

static __inline int CCSDS_istreamSivIsOnly int  siv  )  [static]
 

Returns non-zero if the current packet is the only packet, i.e. bare packet, not a member of a sequence.

Return values:
=0 Is not the only packet
!=0 Is the only packet

int CCSDS_istreamSizeof void   ) 
 

Returns the size, in bytes, of a CCSDS_istream structure.

Returns:
The size, in bytes, of a CCSDS_istream structure

unsigned int CCSDS_istreamTell const CCSDS_istream istream  ) 
 

Returns the current byte offset into the stream.

Returns:
The current byte offset into the stream, i.e. the read pointer
Parameters:
istream The target CCSDS_istream


Generated on Tue Nov 21 01:38:50 2006 by  doxygen 1.4.4