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