GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EDS / V2-12-1 > ebf_dirtest / rhel5-64


Interface   Data Structures   File List   Data Fields   Globals  

ebf_dirtest.c File Reference

Tests various features of the EBF_dir utilities. More...

#include <EDS/EDS_fw.h>
#include <EDS/EDSD_siv.h>
#include <EDS/LCBV.h>
#include <EDS/EBF_cid.h>
#include <EDS/EBF_dir.h>
#include <EDS/io/LCBP.h>
#include <EDS/io/EBF_stream.h>
#include <PBI/FFS.ih>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <EDS/../src/EBF_pktPrint.c>

Classes

struct  _Ctl
 Collections all the control parameters together. These are essentially the interpretted command line options. More...

Typedefs

typedef enum _OPT_M OPT_M
 Typedef for enum OPT_M.
typedef struct _Ctl Ctl
 Typedef for struct _Ctl.

Enumerations

enum  _OPT_M {
  OPT_M_FORWARD = 1 << 0,
  OPT_M_REVERSE = 1 << 1,
  OPT_M_ALL = 1 << 2,
  OPT_M_PRT_IDXS = 1 << 16,
  OPT_M_PRT_PKTS = 1 << 17
}
 Enumerates the reassembly options, specified as bit masks. More...

Functions

static unsigned int ebf_dirtest (Ctl *ctl)
 Finishes the platform common setup and initalization, starts the packet flow.
static void reportUsage (void)
 Brief explanation on readtest usage.
static unsigned int get_number (const char *s)
 Parses the input string, returning the integer equivalent.
static unsigned int dir_test (Ctl *ctl, unsigned int pktBytes, EBF_pkt *pkt, EBF_siv siv, EDS_fwIxb *ixb)
 Writes each event to the output stream.
static void reassemble (EBF_dir *dir, unsigned int cids, unsigned int options)
 Basically a call to EBF_dirReassemble dressed-up with some print options.
static void print_pkt_dscs (const EBF_dirPktDsc *dscs, int ndscs)
 Prints a hex dump of the specified list of packet descriptors.
static void print_pkt_dsc_idxs (const unsigned char *idxs, unsigned int cids)
 Prints the packet descriptor indexs for the specified list of contributors.
static int fillCtl (Ctl *ctl, int argc, char *const argv[])
 Examines the command line parameters and fills the print control structure.
int main (int argc, char *const argv[])
 Usual entry point for the readtest.


Detailed Description

Tests various features of the EBF_dir utilities.

Author:
JJRussell - russell@slac.stanford.edu
  $ ebf_dirtest -n<# of events> -s<# to skip> <input.ebf>
   
    CVS $Id: ebf_dirtest.c,v 1.4 2011/03/31 20:34:29 russell Exp $
   

Enumeration Type Documentation

enum _OPT_M

Enumerates the reassembly options, specified as bit masks.

Enumerator:
OPT_M_FORWARD  Reassemble in forward order
OPT_M_REVERSE  Reassemble in reverse order
OPT_M_ALL  Reassemble all at once
OPT_M_PRT_IDXS  Print the contributor packet indices both before and after reassembly
OPT_M_PRT_PKTS  Print packets after reassembly


Function Documentation

static unsigned int dir_test ( Ctl ctl,
unsigned int  pktBytes,
EBF_pkt pkt,
EBF_siv  siv,
EDS_fwIxb *  ixb 
) [static]

Writes each event to the output stream.

Parameters:
ctl Control structure
pktBytes The number of bytes in the packet
pkt The packet to process
siv The state information vector
ixb The information exchange block

References _EBF_dirTruncated::cids, OPT_M_ALL, OPT_M_FORWARD, OPT_M_REVERSE, _Ctl::options, _EBF_dirTruncated::rcids, reassemble(), and _EBF_dir::truncated.

Referenced by ebf_dirtest().

static unsigned int ebf_dirtest ( Ctl ctl  )  [static]

Finishes the platform common setup and initalization, starts the packet flow.

Parameters:
ctl The control structure

References dir_test(), _Ctl::iname, _Ctl::seg_size, _Ctl::to_process, and _Ctl::to_skip.

Referenced by main().

static int fillCtl ( Ctl ctl,
int  argc,
char *const   argv[] 
) [static]

Examines the command line parameters and fills the print control structure.

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

References get_number(), _Ctl::iname, OPT_M_ALL, OPT_M_FORWARD, OPT_M_PRT_IDXS, OPT_M_PRT_PKTS, OPT_M_REVERSE, _Ctl::options, reportUsage(), _Ctl::seg_size, _Ctl::to_process, and _Ctl::to_skip.

Referenced by main().

static unsigned int get_number ( const char *  s  )  [static]

Parses the input string, returning the integer equivalent.

Returns:
The integer equivalent
Parameters:
s The string to parse
The string must be in the form of a conventionally specified C integer and may optionally be followed by the suffix K, M, C. These give the scaling or units

-K Hexadecimal kilobytes (scale by 1024) -M Hexadecimal megabytes (scale by 1024 * 1024) -C LCB cells (scale by 128) Examples
s result
"100" 100
"100K" 100*1024
"100M" 100*1024*124
"128C 128*16

Referenced by fillCtl().

int main ( int  argc,
char *const   argv[] 
)

Usual entry point for the readtest.

Parameters:
argc The number of arguments
argv The vector of arguments.
For usage type ebf_dirtest with no arguments

References ebf_dirtest(), and fillCtl().

static void print_pkt_dsc_idxs ( const unsigned char *  idxs,
unsigned int  cids 
) [static]

Prints the packet descriptor indexs for the specified list of contributors.

Parameters:
idxs The list of packet descriptor indexes
cids The list of contributors

Referenced by reassemble().

static void print_pkt_dscs ( const EBF_dirPktDsc dscs,
int  ndscs 
) [static]

Prints a hex dump of the specified list of packet descriptors.

Parameters:
dscs The list of packet descriptors to print
ndscs The count of packet descriptors to print

References EBF_pktPrint(), _EBF_dirPktDsc::nbytes, and _EBF_dirPktDsc::pkt.

Referenced by reassemble().

static void reassemble ( EBF_dir dir,
unsigned int  cids,
unsigned int  options 
) [static]

Basically a call to EBF_dirReassemble dressed-up with some print options.

Parameters:
dir The directory to reassemble
cids The bit-mask of contributors to reassemble
options The print options

References _EBF_dirTruncated::cids, _EBF_dirTruncated::npktDscs, OPT_M_PRT_IDXS, OPT_M_PRT_PKTS, _EBF_dirTruncated::pktDscIdxs, _EBF_dirTruncated::pktDscs, print_pkt_dsc_idxs(), print_pkt_dscs(), _EBF_dirTruncated::rcids, and _EBF_dir::truncated.

Referenced by dir_test().


Generated on Thu Sep 27 13:54:44 2012 by  doxygen 1.5.8