GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSD / dev > qsd_print / rhel5-64


Interface   Data Structures   File List   Data Fields   Globals  

QSD_process.c File Reference

Program to process the contents of a .pkt file. More...

#include <QSD/QSD_process.h>
#include <QSD/QSF_schema.h>
#include <QSD/QSF_services.h>
#include <QSD/CCSDS_istream.h>
#include <QSD/CCSDS_apidDsc.h>
#include <QSD/CCSDS_telemetry.h>
#include <QSD/CCSDS_telemetryPrint.h>
#include <LSF/LSF.h>
#include <LSF/LSF_scan.h>
#include <CDM/CDM_pubdefs.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

Classes

struct  _QSD_dgmProcessor
 Parameters used to locate the datagram processor. More...
struct  _QSD_printRto
 Run time print options/parameters for qsd_print. More...
struct  _DgmEntry
 Describes one datagram plug-in entry. More...
struct  _DgmTable
 The table of already loaded plug-ins. More...
struct  _DgmCtl
 The datagram print control structure. More...

Typedefs

typedef struct _QSD_dgmProcessor QSD_dgmProcessor
 Typedef for struct _QSD_dgmProcessor.
typedef struct _QSD_printRto QSD_printRto
 Typedef for struct _QSD_printRto.
typedef struct _DgmEntry DgmEntry
 Typedef for struct _DgmEntry.
typedef struct _DgmTable DgmTable
 Typedef for struct _DgmTable.
typedef struct _DgmCtl DgmCtl
 Typedef for struct _DgmCtl.

Functions

static int get_rto (QSD_printRto *rto, int argc, char *const argv[], const char *facility)
 Examines the command line parameters and fills the print run time options control structure.
static void new_line (void)
 Prints a new line.
static void ccsds_hdr_print (const CCSDS_telemetry *packet)
 Prints a one-line summary of the CCSDS_istream header.
static const QSF_schemaload (const QSD_dgmProcessor *processor, unsigned int id)
 Loads the specified print plugin.
static void dgm_tbl_init (DgmTable *tbl)
 Initialize the plug-in table.
static LSF_scanContributionHandler generic_dgm_handler (DgmCtl *ctl, const LSF_datagram *dgm)
 This is the generic datagram handler. It attempts to find the print plug-in that goes this datagram, using the type_id as the key.
int QSD_process (int argc, char *const argv[], const char *facility, const QSF_schema *generic)
 Process a file of datagrams.
const DgmEntrydgm_tbl_find (DgmTable *tbl, unsigned int type_id)
 Tries to locate the specified entry.
static void dgm_tbl_add (DgmTable *tbl, unsigned int type_id, LSF_scanDatagramHandler dgm_handler, QSF_servicesDestruct destruct)
 Adds the specifed datagram handler to the table of known handlers.
static LSF_scanDatagramHandler dgm_handler_get (const QSF_services *services)
 Returns the datagram handler (routine + initialize context parameter) associated with the specified schema. If no schema is specified, a default handler is constructed.


Detailed Description

Program to process the contents of a .pkt file.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: QSD_process.c,v 1.4 2011/03/26 21:06:58 russell Exp $

Function Documentation

static void ccsds_hdr_print ( const CCSDS_telemetry packet  )  [static]

Prints a one-line summary of the CCSDS_istream header.

Parameters:
packet The packet of the header to print

References CCSDS__headerSequenceFlags(), CCSDS_TELEMETRY_PRINT_OPTS_M_ALL, CCSDS_TELEMETRY_PRINT_OPTS_M_HEADER, and _CCSDS_telemetry::header.

Referenced by QSD_process().

static LSF_scanDatagramHandler dgm_handler_get ( const QSF_services services  )  [static]

Returns the datagram handler (routine + initialize context parameter) associated with the specified schema. If no schema is specified, a default handler is constructed.

Returns:
The constructed handler
Parameters:
services The service table

References _QSF_services::construct, _QSF_services::dgm_rtn, and _QSF_services::size.

Referenced by generic_dgm_handler().

static void dgm_tbl_add ( DgmTable tbl,
unsigned int  type_id,
LSF_scanDatagramHandler  dgm_handler,
QSF_servicesDestruct  destruct 
) [static]

Adds the specifed datagram handler to the table of known handlers.

Parameters:
tbl The table of datagram handlers
type_id The name of the datagram handler. This value is used to locate the handler when scanning the table
dgm_handler The datagram handler
destruct The destruction rotuine

References _DgmTable::cnt, _DgmEntry::destruct, _DgmEntry::dgm_handler, _DgmTable::entries, _DgmEntry::hits, and _DgmEntry::type_id.

Referenced by generic_dgm_handler().

const DgmEntry * dgm_tbl_find ( DgmTable tbl,
unsigned int  type_id 
)

Tries to locate the specified entry.

Returns:
If found, the datagram entry, else NULL
Parameters:
tbl The datagram table
type_id The type_id of the entry to find

References _DgmTable::cnt, _DgmTable::entries, and _DgmEntry::type_id.

Referenced by generic_dgm_handler().

static void dgm_tbl_init ( DgmTable tbl  )  [static]

Initialize the plug-in table.

Parameters:
tbl The plug-in table to intialize

Referenced by QSD_process().

static LSF_scanContributionHandler generic_dgm_handler ( DgmCtl ctl,
const LSF_datagram *  dgm 
) [static]

This is the generic datagram handler. It attempts to find the print plug-in that goes this datagram, using the type_id as the key.

Returns:
The contribution level handler for this datagram (if found) else NULL
Parameters:
ctl The control structure (previously filled in), has pointers to the run-time options and the cache table.
dgm The datagram to process

References _QSF_services::destruct, _DgmEntry::dgm_handler, dgm_handler_get(), dgm_tbl_add(), dgm_tbl_find(), _QSF_schema::get, load(), _QSF_schema::name, _QSD_printRto::processor, _DgmCtl::rto, and _DgmCtl::tbl.

Referenced by QSD_process().

static int get_rto ( QSD_printRto rto,
int  argc,
char *const   argv[],
const char *  facility 
) [static]

Examines the command line parameters and fills the print run time options control structure.

Parameters:
rto The parameter run time options block.
argc The number of command line parameters.
argv The array of pointers to the command line parameters.
facility Default facilty name
Return values:
0,Everything is okay.
-1,Incorrect command usage. Usually this means that the input file name was absent.

References _QSD_printRto::dmp_ccsds, _QSD_dgmProcessor::facility, _QSD_printRto::file, _QSD_dgmProcessor::name, _QSD_printRto::processor, _QSD_dgmProcessor::use_generic, and _QSD_dgmProcessor::variant.

Referenced by QSD_process().

static const QSF_schema * load ( const QSD_dgmProcessor processor,
unsigned int  id 
) [static]

Loads the specified print plugin.

Returns:
The interface schema
Parameters:
processor Parameters used to construct the processor's name
id The id of the print plugin to load

References _QSD_dgmProcessor::facility, _QSD_dgmProcessor::generic, _QSD_dgmProcessor::name, _QSD_dgmProcessor::use_generic, and _QSD_dgmProcessor::variant.

Referenced by generic_dgm_handler().

int QSD_process ( int  argc,
char *const   argv[],
const char *  facility,
const QSF_schema generic 
)

Process a file of datagrams.

Returns:
Overall status
Parameters:
argc The argument count
argv The vector of command line strings
facility The name of the facility invoking this utility.
generic The generic or default processor to use if none is supplied via the command line
Usage
This utility scans an input .lsd file, processing each datagram. The datagrams are processed by attempting to dynamically load a datagram specific processor meant to be customized for both
  1. The type of datagram being processed (from the datagram's ID) and
  2. The type of processing being requested (from the facility)

To this end the utility attempts to load a shareable whose name is constructed of these pieces
       lib<facility>_<datagram_id><variant>.so
  

Each of these components come from a different place

  • facility is from the calling program and is meant to define the type of processing being requested, e.g.

  • qsd_print, for a print utility
  • qsd_analyze, for a analysis utility

  • datagram_id is from the datagram itself. This number is formatted as a 0-filled 5-digit hex number, e.g. f0200 or 00111. Note that the hex digits represented by letters (a-f) are formatted in lower case.

  • variant is from the command line and is meant to indicate variations on the basic theme (i.e. a verbose print or a terse print option. This is not the greatest method since one can quickly enter permutation hell trying to build a shareable specific for each possible combination of options.

References CCSDS_APIDDSC_BRIDGE_K_PAD, CCSDS_apidDscPktBeg(), CCSDS_apidDscPktLen(), ccsds_hdr_print(), CCSDS_istreamSivIsError(), CCSDS_istreamSivIsLast(), dgm_tbl_init(), _QSD_printRto::dmp_ccsds, _QSD_printRto::file, _QSD_dgmProcessor::generic, generic_dgm_handler(), get_rto(), new_line(), _QSD_printRto::processor, _DgmCtl::rto, and _DgmCtl::tbl.

Referenced by main().


Generated on Thu Sep 27 16:32:17 2012 by  doxygen 1.5.8