/*********************************************************
*
* Readme for the messages.c module.  
*
*   This provides a "C" interface to functions for creating and managing
*   messages that might be needed by networked applications.
*
*  The methods are defined in messages.h 
*  The implementation is in messages.c
*
*  Example tests and usage can be found in 
*  testMsg.c and testSimple.c.
*
*********************************************************/

The design assumes that common.h and utils.c are a part 
of whatever application is usings the functions.

You should be able to just move messages.c/h to your code directory
and after including in the sources and objects list in the
makefile, all should work.

The makefile in this package provides the following targets:

testMsg - the main test code- the single program param 
          specifies unit tests 1 - 6 
testSimple -  a simpler usage example. Creates a DataMsg,
              packs it to a buffer, 

              The net buffer is then unpacketd to create a 
              new data msg 



The go script is setup to build and run testSimple.   
THE following is what you should see.....note the scripppppt
uses  the od tool to show the data that has been dumped to a file. 


rm -f testMsg *.dat core core.* *.core *.o temp.* *.out typescript* *.lc *.lh *.bsdi *.sparc *.uw
gcc -c -ggdb -O2 -Wall -DLINUX  -DUNIX  -DANSI testMsg.c
gcc -c -ggdb -O2 -Wall -DLINUX  -DUNIX  -DANSI messages.c
gcc -c -ggdb -O2 -Wall -DLINUX  -DUNIX  -DANSI utils.c
gcc -o   testMsg testMsg.o  messages.o utils.o	  -lm -lrt
gcc -c -ggdb -O2 -Wall -DLINUX  -DUNIX  -DANSI testSimple.c
gcc -o   testSimple testSimple.o  messages.o utils.o	  -lm -lrt
createMsgHdr: Succeeded to create header  sizeof:16, sequenceNumber:16909060 
dumpBufferToFile: Succeded to dump to file TESTSIMPLEMSGHDR1.dat, paramSize:16, sizeFwrite:16, statSize:16  
testMsg:  init myData:   0  1  2  3  4  5  6  7 
createDataMsg: Succeeded to create DataMsg sequenceNumber:16909060,dataLen:8,msgSize:32 
dumpBufferToFile: Succeded to dump to file TESTSIMPLEDATAMSG1.dat, paramSize:24, sizeFwrite:24, statSize:24  
TestSimple: (rc from dump:24, msgSize:32)  DataMsg  seqnum:16909060, msgType:1, timestamp:-1.1431655765 
packMsgHdrToNetworkBuffer: SUCCEEDED!  octetCount:16  
packDataMsgToNetworkBuffer: After MsgHdr octetCount:20,  
packDataMsgToNetworkBuffer: SUCCEEDED to pack DataMsg! msgSize:32,    octetCount:28, datasize:8  
dumpBufferToFile: Succeded to dump to file TESTSIMPLENETBUFDATAMSG1.dat, paramSize:28, sizeFwrite:28, statSize:28  
unpackNetworkBufferMsgHdr: SUCCEEDED!  octetCount:16  
unpackNetworkBufferMsgHdr: seq:16909060, mode:0, msgType:1, sec.usec:-1.1431655765 
unpackNetworkBufferToDataMsg: malloc databuffer of size :8  
unpackNetworkBufferToDataMsg: memcpy data 8 octects, current octetCount:28,  
 0  1  2  3  4  5  6  7 
unpackNetworkBufferToDataMsg: SUCCEEDED! dataSize:8, msgSize:32  octetCount:28  
dumpBufferToFile: Succeded to dump to file TESTSIMPLEDATAMSG2.dat, paramSize:24, sizeFwrite:24, statSize:24  
TestSimple: (rc from dump:24, msgSize:32)  DataMsgNEW  seqnum:16909060, msgType:1, timestamp:-1.1431655765 
compareMsgHdrs: MATCHED sequence num:16909060  
compareDataMsgs: MATCHED MsgHdrs .... sequence nums 16909060  16909060  
compareDataMsgs: MATCHED....now check dataPtr dataSize: 8  8  
compareDataMsgs: index:0 data: 0  0  
compareDataMsgs: index:1 data: 1  1  
compareDataMsgs: index:2 data: 2  2  
compareDataMsgs: index:3 data: 3  3  
compareDataMsgs: index:4 data: 4  4  
compareDataMsgs: index:5 data: 5  5  
compareDataMsgs: index:6 data: 6  6  
compareDataMsgs: index:7 data: 7  7  
compareDataMsgs: MATCHED sequence num:16909060, msgSize:32, dataSize:8  
TestSimple: compare is TRUE returns 1  
TestSimple:  free both DataMsgs, rcs: 0, 0 
TestSimple: SUCCEEDED !!  
 
 The size of TESTSIMPLEMSGHDR1.dat is  16
0000000 04 03 02 01 00 00 01 00 ff ff ff ff 55 55 55 55
0000020
 
 The size of TESTSIMPLEDATAMSG1.dat is  24
0000000 50 17 1c 01 00 00 00 00 20 00 08 00 00 00 00 00
0000020 30 17 1c 01 00 00 00 00
0000030
 
 The size of TESTSIMPLENETBUFDATAMSG1.dat is  28
0000000 01 02 03 04 00 00 00 01 ff ff ff ff 55 55 55 55
0000020 00 20 00 08 00 01 02 03 04 05 06 07
0000034
 
 The size of TESTSIMPLEDATAMSG2.dat is  24
0000000 a0 27 1c 01 00 00 00 00 20 00 08 00 00 00 00 00
0000020 e0 27 1c 01 00 00 00 00
0000030
