blob: bb3a878736b25746ce64e3c122851abdf656ea6a [file] [log] [blame]
Alexander Afanasyev6b997c52011-08-08 12:55:25 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011 University of California, Los Angeles
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
19 */
Ilya Moiseenko08a98a42011-08-02 16:06:51 -070020
21#include "ndn_interestpacket.h"
22
23namespace ns3
24{
Ilya Moiseenko5881eb12011-08-04 19:05:26 -070025namespace NDNabstraction
26{
Alexander Afanasyevf583ef22011-08-08 19:05:28 -070027 InterestPacket::InterestPacket(const unsigned char *name, uint32_t size)
28 :Packet(name,size)
29 {
30 maxNameLength = 10240;
31 }
Ilya Moiseenko5881eb12011-08-04 19:05:26 -070032
Alexander Afanasyevf583ef22011-08-08 19:05:28 -070033 uint32_t
34 InterestPacket::GetName(unsigned char *name)
35 {
36 //uint32_t Packet::CopyData (uint8_t *buffer, uint32_t size) const
37 return CopyData((uint8_t*) name, maxNameLength);
38 }
Ilya Moiseenko5881eb12011-08-04 19:05:26 -070039
Alexander Afanasyevf583ef22011-08-08 19:05:28 -070040 void
41 InterestPacket::AddTimeout(uint32_t milliseconds)
42 {
43 TimeoutHeader tHeader (milliseconds);
44 AddHeader (tHeader);
45 }
Ilya Moiseenko5881eb12011-08-04 19:05:26 -070046
Alexander Afanasyevf583ef22011-08-08 19:05:28 -070047 uint32_t
48 InterestPacket::GetTimeout(void)
49 {
50 TimeoutHeader tHeader;
51 PeekHeader(tHeader);
52 return tHeader.GetValue();
53 }
Ilya Moiseenko5881eb12011-08-04 19:05:26 -070054
Alexander Afanasyevf583ef22011-08-08 19:05:28 -070055 void
56 InterestPacket::RemoveTimeout(void)
57 {
58 TimeoutHeader tHeader;
59 RemoveHeader(tHeader);
60 }
Ilya Moiseenko5881eb12011-08-04 19:05:26 -070061
Alexander Afanasyevf583ef22011-08-08 19:05:28 -070062 void
63 InterestPacket::AddNonce(uint32_t nonce)
64 {
65 NonceHeader tHeader (nonce);
66 AddHeader (tHeader);
67 }
Ilya Moiseenko5881eb12011-08-04 19:05:26 -070068
Alexander Afanasyevf583ef22011-08-08 19:05:28 -070069 uint32_t
70 InterestPacket::GetNonce(void)
71 {
72 NonceHeader tHeader;
73 PeekHeader(tHeader);
74 return tHeader.GetValue();
75 }
Ilya Moiseenko5881eb12011-08-04 19:05:26 -070076
Alexander Afanasyevf583ef22011-08-08 19:05:28 -070077 void
78 InterestPacket::RemoveNonce(void)
79 {
80 NonceHeader tHeader;
81 RemoveHeader(tHeader);
82 }
Ilya Moiseenko5881eb12011-08-04 19:05:26 -070083}
Alexander Afanasyev6b997c52011-08-08 12:55:25 -070084}