blob: eecb75394ca387354357a0853911c9b7eb120e04 [file] [log] [blame]
Alexander Afanasyev404c0792011-08-09 17:09:59 -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 */
20
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070021///< #CCN_PR_SCOPE0 (0x20) local scope,
22///< #CCN_PR_SCOPE1 (0x40) this host,
23///< #CCN_PR_SCOPE2 (0x80) immediate neighborhood
24
25
Alexander Afanasyev404c0792011-08-09 17:09:59 -070026#include "interest-packet.h"
27
28namespace ns3
29{
30namespace NDNabstraction
31{
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070032
33 InterestHeader::InterestHeader ()
34 : m_minSuffixComponents (-1)
35 , m_maxSuffixComponents (-1)
36 , m_childSelector (false)
37 , m_answerOriginKind (false)
38 , m_scope (-1)
39 , m_interestLifetime (-1)
40 , m_nonce (0)
Alexander Afanasyev404c0792011-08-09 17:09:59 -070041 {
42 }
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -070043
44 void
45 InterestHeader::SetName (const Ptr<Name::Components> &name)
46 {
47 m_name = name;
48 }
49
50 const Name::Components&
51 InterestHeader::GetName () const
52 {
53 return *m_name;
54 }
55
56 void
57 InterestHeader::SetMinSuffixComponents (int32_t value)
58 {
59 m_minSuffixComponents = value;
60 }
61
62 int32_t
63 InterestHeader::GetMinSuffixComponents () const
64 {
65 return m_minSuffixComponents;
66 }
67
68 void
69 InterestHeader::SetMaxSuffixComponents (int32_t value)
70 {
71 m_maxSuffixComponents = value;
72 }
73
74 int32_t
75 InterestHeader::GetMaxSuffixComponents () const
76 {
77 return m_maxSuffixComponents;
78 }
79
80 void
81 InterestHeader::SetExclude (const Ptr<Name::Components> &exclude)
82 {
83 m_exclude = exclude;
84 }
85
86 const Name::Components&
87 InterestHeader::GetExclude () const
88 {
89 return *m_exclude;
90 }
91
92 void
93 InterestHeader::EnableChildSelector ()
94 {
95 m_childSelector = true;
96 }
97
98 bool
99 InterestHeader::IsEnabledChildSelector () const
100 {
101 return m_childSelector;
102 }
103
104 void
105 InterestHeader::EnableAnswerOriginKind ()
106 {
107 m_answerOriginKind = true;
108 }
109
110 bool
111 InterestHeader::IsEnabledAnswerOriginKind () const
112 {
113 return m_answerOriginKind;
114 }
115
116 void
117 InterestHeader::SetScope (int8_t scope)
118 {
119 m_scope = scope;
120 }
121
122 int8_t
123 InterestHeader::GetScope () const
124 {
125 return m_scope;
126 }
127
128 void
129 InterestHeader::SetInterestLifetime (intmax_t lifetime)
130 {
131 m_interestLifetime = lifetime;
132 }
133
134 intmax_t
135 InterestHeader::GetInterestLifetime () const
136 {
137 return m_interestLifetime;
138 }
139
140 void
141 InterestHeader::SetNonce (uint32_t nonce)
142 {
143 m_nonce = nonce;
144 }
145
146 uint32_t
147 InterestHeader::GetNonce () const
148 {
149 return m_nonce;
150 }
151
152 uint32_t
153 InterestHeader::GetSerializedSize (void) const
154 {
155 return 0;
156 }
Alexander Afanasyev404c0792011-08-09 17:09:59 -0700157
Alexander Afanasyev3a6ea5c2011-08-11 18:15:49 -0700158 void
159 InterestHeader::Serialize (Buffer::Iterator start) const
160 {
161 return;
162 }
163
164 uint32_t
165 InterestHeader::Deserialize (Buffer::Iterator start)
166 {
167 return 0;
168 }
169
170 TypeId
171 InterestHeader::GetTypeId (void)
172 {
173 static TypeId tid = TypeId ("ns3::NDNabstraction::InterestHeader")
174 .SetParent<Header> ()
175 .AddConstructor<InterestHeader> ()
176 ;
177 return tid;
178 }
179
180 TypeId
181 InterestHeader::GetInstanceTypeId (void) const
182 {
183 return GetTypeId ();
184 }
185
186 void
187 InterestHeader::Print (std::ostream &os) const
188 {
189 os << "Interest: " << *m_name;
190 }
Alexander Afanasyev404c0792011-08-09 17:09:59 -0700191}
192}