GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> QSD / dev > qsd_print / rhel5-64
#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_schema * | load (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 DgmEntry * | dgm_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. |
CVS $Id: QSD_process.c,v 1.4 2011/03/26 21:06:58 russell Exp $
static void ccsds_hdr_print | ( | const CCSDS_telemetry * | packet | ) | [static] |
Prints a one-line summary of the CCSDS_istream header.
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.
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.
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().
Tries to locate the specified entry.
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.
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.
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.
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 |
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.
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.
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 |
lib<facility>_<datagram_id><variant>.so
Each of these components come from a different place
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().