blob: 627946c062e2368d7c002a9a4a1883234a947e71 [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyev08d984e2011-08-13 19:20:22 -07002/*
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
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070028#include "ns3/log.h"
29
Alexander Afanasyev08d984e2011-08-13 19:20:22 -070030NS_LOG_COMPONENT_DEFINE ("CcnxInterestHeader");
31
32namespace ns3
33{
34
35NS_OBJECT_ENSURE_REGISTERED (CcnxInterestHeader);
36
37TypeId
38CcnxInterestHeader::GetTypeId (void)
39{
40 static TypeId tid = TypeId ("ns3::CcnxInterestHeader")
41 .SetParent<Header> ()
42 .AddConstructor<CcnxInterestHeader> ()
43 ;
44 return tid;
45}
46
47
48CcnxInterestHeader::CcnxInterestHeader ()
49 : m_minSuffixComponents (-1)
50 , m_maxSuffixComponents (-1)
51 , m_childSelector (false)
52 , m_answerOriginKind (false)
53 , m_scope (-1)
54 , m_interestLifetime (-1)
55 , m_nonce (0)
56{
57}
58
59void
60CcnxInterestHeader::SetName (const Ptr<Name::Components> &name)
61{
62 m_name = name;
63}
64
65const Name::Components&
66CcnxInterestHeader::GetName () const
67{
68 return *m_name;
69}
70
71void
72CcnxInterestHeader::SetMinSuffixComponents (int32_t value)
73{
74 m_minSuffixComponents = value;
75}
76
77int32_t
78CcnxInterestHeader::GetMinSuffixComponents () const
79{
80 return m_minSuffixComponents;
81}
82
83void
84CcnxInterestHeader::SetMaxSuffixComponents (int32_t value)
85{
86 m_maxSuffixComponents = value;
87}
88
89int32_t
90CcnxInterestHeader::GetMaxSuffixComponents () const
91{
92 return m_maxSuffixComponents;
93}
94
95void
96CcnxInterestHeader::SetExclude (const Ptr<Name::Components> &exclude)
97{
98 m_exclude = exclude;
99}
100
101const Name::Components&
102CcnxInterestHeader::GetExclude () const
103{
104 return *m_exclude;
105}
106
107void
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700108CcnxInterestHeader::SetChildSelector (bool value)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700109{
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700110 m_childSelector = value;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700111}
112
113bool
114CcnxInterestHeader::IsEnabledChildSelector () const
115{
116 return m_childSelector;
117}
118
119void
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700120CcnxInterestHeader::SetAnswerOriginKind (bool value)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700121{
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700122 m_answerOriginKind = value;
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700123}
124
125bool
126CcnxInterestHeader::IsEnabledAnswerOriginKind () const
127{
128 return m_answerOriginKind;
129}
130
131void
132CcnxInterestHeader::SetScope (int8_t scope)
133{
134 m_scope = scope;
135}
136
137int8_t
138CcnxInterestHeader::GetScope () const
139{
140 return m_scope;
141}
142
143void
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700144CcnxInterestHeader::SetInterestLifetime (Time lifetime)
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700145{
146 m_interestLifetime = lifetime;
147}
148
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700149Time
Alexander Afanasyev08d984e2011-08-13 19:20:22 -0700150CcnxInterestHeader::GetInterestLifetime () const
151{
152 return m_interestLifetime;
153}
154
155void
156CcnxInterestHeader::SetNonce (uint32_t nonce)
157{
158 m_nonce = nonce;
159}
160
161uint32_t
162CcnxInterestHeader::GetNonce () const
163{
164 return m_nonce;
165}
166
167uint32_t
168CcnxInterestHeader::GetSerializedSize (void) const
169{
170 return 0;
171}
172
173void
174CcnxInterestHeader::Serialize (Buffer::Iterator start) const
175{
176 return;
177}
178
179uint32_t
180CcnxInterestHeader::Deserialize (Buffer::Iterator start)
181{
182 return 0;
183}
184
185TypeId
186CcnxInterestHeader::GetInstanceTypeId (void) const
187{
188 return GetTypeId ();
189}
190
191void
192CcnxInterestHeader::Print (std::ostream &os) const
193{
194 os << "Interest: " << *m_name;
195}
196
197}