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

muxstuff.h

Go to the documentation of this file.
00001 /* MUXSTUFF.H */
00002 
00003 #ifndef _MUXSTUFF_H_
00004 #define _MUXSTUFF_H_
00005 
00006 #include "mux.h"
00007 
00008 
00009 /* Function Prototypes */
00010 
00011 static int twotothe(int n);
00012 /* 
00013  * returns 2 to the n
00014  */
00015 
00016 int **make_mt_bytes(mux_table_entry *mt,
00017                     int mt_size,
00018                     int num_channels,
00019                     int info_bytes);
00020 /*
00021  * Fills in a structure that indicates how many bytes are used
00022  *   for a particlar mux code given a payload length 
00023  */
00024 
00025 float **make_mt_ratios(int **mt_bytes,
00026                        int mt_size,
00027                        int num_channels,
00028                        int info_bytes);
00029 /*
00030  * Does the same as above, but for a ratio structure
00031  */
00032 
00033 mux_parameters *new_mux_parameters(char *name);
00034 /*
00035  * A function to query the parameters shared between a multiplexer and
00036  *   the corresponding demultiplexer.
00037  */
00038 
00039 
00040 byte *construct_header(int mc, int pm, bch_type code, int level);
00041 /*
00042  * Constructs the header.
00043  * NOTE: CRC is always 3 bits.
00044  * MC is always 4 bits.
00045  * pm should be either 1 or 0, nothing else.
00046  *
00047  * Bit fields look like this:
00048  *
00049  */
00050 
00051 byte *construct_header_level2(int mc, int pm, int mpl);
00052 /*
00053  * constructs concatenated header with mc, pm and mpl protected
00054  * by golay code
00055  *
00056  */
00057 
00058 int deconstruct_header(byte *header,int *mc,int *pm,bch_type code,int level);
00059 /*
00060  * Deconstructs the header, check crc for level 1.
00061  *   returns 1 if crc checks valid, 0 if not
00062  *
00063  */
00064 
00065 void deconstruct_header_level2(byte *header,int *mc,int *pm,int *mpl);
00066 /* 
00067  * deconstructs the level 2 header, described above in construct_header
00068  * sets mc, pm and mpl to received value
00069  */
00070 
00071 byte *construct_mpl(int mpl, bch_type code);
00072 /*
00073  * Creates an mpl field
00074  */
00075 
00076 int deconstruct_mpl(byte *mplf, int *mpl, bch_type code);
00077 /*
00078  * returns status of detection (0 if errors detected, 1 if not)
00079  *   at this point, only will return 1 because using for correction
00080  */
00081 
00082 void swapbits(bytes *b, int a1, int a2);
00083 /*
00084  * Swaps two bits.
00085  */
00086 
00087 void swapbytes(bytes *b, int a1, int a2);
00088 /*
00089  * Swaps bytes at a1 and a2 of (b).
00090  */
00091 
00092 void interleave_header(bytes *mux_pdu, int sync_bytes, int header_bytes, int mode);
00093 /*
00094  * Performs interleaving of the header throughout the area taken up by
00095  *   the header and the information field of the MUX-PDU.
00096  *
00097  * Swaps bits or bytes around since that is the simplest way of doing it.
00098  */
00099 
00100 int mux_byte_source(mux_table_entry *mte, int x); 
00101 /*
00102  * Returns the channel that octet x of the information field of a packet
00103  *   multiplexed with mux table entry *(mte) should come from or should
00104  *   return to.
00105  */
00106 
00107 
00108 #endif

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