Main Page | Class List | File List | Class Members | File Members

demux.h

Go to the documentation of this file.
00001 /* DEMUX.H */
00002 
00003 #ifndef _DEMUX_H_
00004 #define _DEMUX_H_
00005 
00006 #include "al_receiving.h"
00007 #include "channel.h"
00008 #include "mux.h"
00009 
00010 
00011 typedef struct {
00012   char name[41];       /* A label like "Remote Demux" or "Local Demux" */
00013 
00014   /* Params shared with corresponding MUX */
00015   mux_parameters *params;
00016 
00017   /************************************************************************** 
00018    * DEMUX Specific Parameters                                              *
00019    **************************************************************************/
00020 
00021   al_receiving_entity *al_receivers[MAX_AL_RECEIVERS]; /* MUX-SDU's go here */
00022 
00023   int num_al_receivers;
00024 
00025   channel *input;
00026 
00027   int sync_delay;                           /* will be in sync after this number of bytes */
00028   int in_sync;
00029 
00030   byte sync_reg[8];                         /* sync bytes */
00031   byte THRESH;                              /* bits == standard sync bits */
00032 
00033   byte header_reg[8];                       /* header bytes. */
00034   int MC;                                   /* current multiplex code */
00035   int PM;                                   /* packet marker bit. */
00036 
00037   byte mpl_reg[8];                          /* mpl bytes */
00038   int MPL;
00039 
00040   int byte_count;                           /* byte count */
00041  
00042   int goodPackets;                          /* number of good header packets */
00043   int badPackets;                           /* number of bad header packets */
00044   int bad_mpls;                             /* number of bad mpls detected */
00045   int mpl_counter;                          /* number of bytes remaining until
00046                                                need to resume byte searching */
00047 } demux;
00048 
00049 /* Function Prototypes */
00050 
00051 demux *new_demux(char *name);
00052 /*
00053  * This mallocs and sets up a new demux structure
00054  */
00055 
00056 void close_demux(demux *d);
00057 /*
00058  * This prints out packet statistics for the demux
00059  */
00060 
00061 static int correlation(byte a, byte b);
00062 /*
00063  * returns the number of bits the same in a and b
00064  */
00065 
00066 byte shift_in(demux *d, byte b);
00067 /*
00068  * This moves data through the demux
00069  *   Shifts in new byte b.  Returns byte shifted out.
00070  */
00071 
00072 void demultiplex(demux *d);
00073 /*
00074  * This reads incoming data from the channel one byte
00075  *   at a time and acts appropriately
00076  */
00077 
00078 #endif

Generated on Sun Jul 16 16:27:45 2006 by  doxygen 1.3.9.1