blob: fa9700ee29caff77a6d8c81b216a711bdbe7873b [file] [log] [blame]
Alexander Afanasyeve91ab752011-08-31 19:13:40 -07001#include "ns3/test.h"
2#include "ns3/annotated-topology-reader.h"
3#include "ns3/ccnx-content-object-header.h"
4#include "ns3/uinteger.h"
5#include "ns3/random-variable.h"
6#include <limits>
7#include "ns3/ccnx-header-helper.h"
8#include "ns3/header.h"
9#include "ns3/ccnx-name-components.h"
10#include "ns3/nstime.h"
11#include "ns3/buffer.h"
12#include "ns3/log.h"
13
14using namespace ns3;
15#include <fstream>
16
17NS_LOG_COMPONENT_DEFINE ("ContentObjectHeaderExample");
18
19int
20main (int argc, char *argv[])
21{
22 LogComponentEnable ("ContentObjectHeaderExample", LOG_ALL);
23 LogComponentEnable ("Packet", LOG_ALL);
24
25 NS_LOG_INFO ("Test started");
26
27 Packet::EnablePrinting ();
28 Packet::EnableChecking ();
29 Packet packet (10);
30
31 CcnxContentObjectHeader header;
32 CcnxContentObjectTail trailer;
33
34 Ptr<CcnxNameComponents> testname = Create<CcnxNameComponents> ();
35 (*testname) ("1");
36 header.SetName(testname);
37
38 NS_LOG_INFO ("Source: \n" << header << trailer);
39
40 packet.AddHeader (header);
41 packet.AddTrailer (trailer);
42
43 // NS_LOG_INFO ("Deserialized packet: \n" << packet);
44
45 NS_LOG_INFO ("Removing and deserializing individual headers");
46
47 CcnxContentObjectHeader dst_header;
48 CcnxContentObjectTail dst_trailer;
49
50 packet.RemoveHeader (dst_header);
51 packet.RemoveTrailer (dst_trailer);
52
53 NS_LOG_INFO ("Target: \n" << dst_header << dst_trailer);
54
55 return 0;
56}