| 1 |
// This the the "node test" (nt) program to exercise our node, iface, link data structures |
| 2 |
|
| 3 |
|
| 4 |
#include "manetMsg.h" |
| 5 |
#include "testFuncs.h" |
| 6 |
#include <stdio.h> // for sprintf() |
| 7 |
#include <stdlib.h> // for rand(), srand() |
| 8 |
#include <ctype.h> // for isprint |
| 9 |
int main(int argc, char* argv[]) |
| 10 |
{ |
| 11 |
|
| 12 |
// Original program used TRACE statements that we have changed to PL_INFO |
| 13 |
// for library use |
| 14 |
SetDebugLevel(3); |
| 15 |
|
| 16 |
if (argc > 1) |
| 17 |
{ |
| 18 |
return ParseDump(argv[1]); |
| 19 |
} |
| 20 |
|
| 21 |
UINT32 buffer[PACKET_SIZE_MAX/4]; |
| 22 |
ManetPkt pkt; |
| 23 |
if (!BuildPacket((UINT32*)buffer,pkt)) |
| 24 |
{ |
| 25 |
PLOG(PL_ERROR,"MsgExample::BuildPacket() failes\n"); |
| 26 |
return -1; |
| 27 |
} |
| 28 |
|
| 29 |
// OK, let's parse a "received" packet using sent "buffer" and "pktLen" |
| 30 |
PLOG(PL_INFO,"msgExample: Parsing \"recvPkt\" ...\n"); |
| 31 |
UINT16 pktLen = pkt.GetLength(); |
| 32 |
|
| 33 |
MakeDump((char*)buffer, pktLen); |
| 34 |
|
| 35 |
int result = ParseBuffer(buffer, pktLen); |
| 36 |
|
| 37 |
PLOG(PL_INFO,"msgExample: \"recvPkt\" packet parsing completed.\n\n"); |
| 38 |
|
| 39 |
MakeDump((char*)buffer, pktLen); |
| 40 |
|
| 41 |
return result; |
| 42 |
} // end main() |
| 43 |
|