GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QMEM / V0-2-1 > qmem_dump_packets / sun-gcc


Interface   Data Structures   File List   Data Fields   Globals  

qmem_dump_packets.c File Reference

Display memory dump information within a set of CCSDS packets. More...

#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <QMEM/QMEM.h>

Classes

struct  _Dump_State
 State information for collecting memory dump datagrams. More...

Defines

#define PROG_NAME   "qmem_dump_packets"
#define STATUS_USAGE   ( -1)
#define STATUS_BAD_OPEN   ( -4)
#define STATUS_BAD_CLOSE   ( -5)
#define STATUS_TRUNCATED   (-10)
#define STATUS_BAD_PKT   (-11)
#define STATUS_BAD_ALLOC   (-12)
#define STATUS_BAD_PARSE   (-13)
#define STATUS_SHORT_BUFFER   (-14)

Typedefs

typedef struct _Dump_State Dump_State
 Typedef for _Dump_State.

Functions

static int show_usage (void)
 Display a usage message for the program.
static int show_bad_packet (unsigned int file_offset)
 Display a bad CCSDS packet message.
static int show_short_buffer (unsigned int buf_bytes, unsigned int bytes_needed)
 Display a short packet buffer message.
static int show_truncated (char *desc, unsigned int file_offset)
 Display a truncated file message.
static int show_qmem_status (QMEM_Status q_status)
 Display QMEM function failure status.
static int alloc (void **alloc_pp, unsigned int num_bytes)
 Allocate memory.
static void display_dump (Dump_State *state_p)
 Display memory dump information.
static int get_ccsds_pkt (Dump_State *state_p)
 Read a CCSDS packet into a packet buffer.
static int parse_buffer (Dump_State *state_p)
 Parse a packet buffer as a memory dump datagram.
static int process_file (FILE *in_file, char *out_fname)
 Read CCSDS packets from a file and process them as datagrams.
int main (int argc, char **argv)
 Entry point for the program.


Detailed Description

Display memory dump information within a set of CCSDS packets.

**  CVS $Id: qmem_dump_packets.c,v 1.3 2011/03/30 23:56:36 russell Exp $
**  

This utility extracts memory dump information from a set of CCSDS packets and displays the results.

See the show_usage() function for a description of the options for this program.


Function Documentation

int alloc ( void **  alloc_pp,
unsigned int  num_bytes 
) [static]

Allocate memory.

Parameters:
alloc_pp Location to return pointer to allocated memory.
num_bytes Number of bytes to allocate.
Returns:
Error status code.

Referenced by process_file().

void display_dump ( Dump_State state_p  )  [static]

Display memory dump information.

Parameters:
state_p Pointer to dump state.
Returns:
Error status code.

References _Dump_State::ctx_p, _Dump_State::ctx_valid, _Dump_State::out_fname, QMEM_bytes_available(), QMEM_bytes_dumped(), QMEM_data_buf(), QMEM_lat_unit(), QMEM_num_datagrams(), QMEM_start_addr(), and QMEM_tran_id().

Referenced by parse_buffer(), and process_file().

int get_ccsds_pkt ( Dump_State state_p  )  [static]

Read a CCSDS packet into a packet buffer.

Parameters:
state_p Pointer to dump state.
Returns:
Error status code.

References _Dump_State::in_eof, _Dump_State::in_file, _Dump_State::pkt_buf_bytes, _Dump_State::pkt_buf_offset, _Dump_State::pkt_buf_p, show_bad_packet(), show_short_buffer(), and show_truncated().

Referenced by process_file().

int main ( int  argc,
char **  argv 
)

Entry point for the program.

Parameters:
argc Number of command-line arguments.
argv Array of pointers to the command-line arguments.
Returns:
Error status code.

References process_file(), and show_usage().

int parse_buffer ( Dump_State state_p  )  [static]

int process_file ( FILE *  in_file,
char *  out_fname 
) [static]

Read CCSDS packets from a file and process them as datagrams.

Parameters:
in_file Pointer to input file.
out_fname Name of output file prefix.
Returns:
Error status code.

References alloc(), _Dump_State::ctx_p, display_dump(), _Dump_State::dump_buf_bytes, _Dump_State::dump_buf_p, get_ccsds_pkt(), _Dump_State::in_eof, _Dump_State::in_file, _Dump_State::out_fname, parse_buffer(), _Dump_State::pkt_buf_bytes, _Dump_State::pkt_buf_offset, _Dump_State::pkt_buf_p, QMEM_sizeof_context(), and QMEM_sizeof_max_datagram().

Referenced by main().

int show_bad_packet ( unsigned int  file_offset  )  [static]

Display a bad CCSDS packet message.

Parameters:
file_offset Current offset within packet file.
Returns:
Error status code.

Referenced by get_ccsds_pkt().

int show_qmem_status ( QMEM_Status  q_status  )  [static]

Display QMEM function failure status.

Parameters:
q_status Status value returned from QMEM function.
Returns:
Error status code.

References QMEM_STATUS_OK.

Referenced by parse_buffer().

int show_short_buffer ( unsigned int  buf_bytes,
unsigned int  bytes_needed 
) [static]

Display a short packet buffer message.

Parameters:
buf_bytes Size, in bytes, of the packet buffer.
bytes_needed Amount of data, in bytes, to store in pkt buffer.
Returns:
Error status code.

Referenced by get_ccsds_pkt().

int show_truncated ( char *  desc,
unsigned int  file_offset 
) [static]

Display a truncated file message.

Parameters:
desc Description of current activity.
file_offset Current offset within packet file.
Returns:
Error status code.

Referenced by get_ccsds_pkt().

int show_usage ( void   )  [static]

Display a usage message for the program.

Returns:
Error status code.

Referenced by main().


Generated on Wed Nov 21 22:50:44 2012 by  doxygen 1.5.8