blob: fdda4cf9bddf2e491a6861e134f72974ea22edf9 [file] [log] [blame]
Ilya Moiseenko08a98a42011-08-02 16:06:51 -07001//
2// ndn_interestpacket.cc
3// Abstraction
4//
5// Copyright 2011 UCLA. All rights reserved.
6//
7
8#include "ndn_interestpacket.h"
9
10namespace ns3
11{
Ilya Moiseenko5881eb12011-08-04 19:05:26 -070012namespace NDNabstraction
13{
14 InterestPacket::InterestPacket(unsigned char *name, uint32_t size):Packet ((uint8_t const *)name,size)
15 {
16 maxNameLength = 10240;
17 }
18
19 uint32_t
20 InterestPacket::GetName(unsigned char *name)
21 {
22 //uint32_t Packet::CopyData (uint8_t *buffer, uint32_t size) const
23 return CopyData((uint8_t*) name, maxNameLength);
24 }
25
26 void
27 InterestPacket::AddTimeout(uint32_t milliseconds)
28 {
29 TimeoutHeader tHeader (milliseconds);
30 AddHeader (tHeader);
31 }
32
33 uint32_t
34 InterestPacket::GetTimeout(void)
35 {
36 TimeoutHeader tHeader;
37 PeekHeader(tHeader);
38 return tHeader.GetValue();
39 }
40
41 void
42 InterestPacket::RemoveTimeout(void)
43 {
44 TimeoutHeader tHeader;
45 RemoveHeader(tHeader);
46 }
47
48 void
49 InterestPacket::AddNonce(uint32_t nonce)
50 {
51 NonceHeader tHeader (nonce);
52 AddHeader (tHeader);
53 }
54
55 uint32_t
56 InterestPacket::GetNonce(void)
57 {
58 NonceHeader tHeader;
59 PeekHeader(tHeader);
60 return tHeader.GetValue();
61 }
62
63 void
64 InterestPacket::RemoveNonce(void)
65 {
66 NonceHeader tHeader;
67 RemoveHeader(tHeader);
68 }
69}
Ilya Moiseenko08a98a42011-08-02 16:06:51 -070070}