Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 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 | |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 22 | #ifndef _CCNX_INTEREST_HEADER_H_ |
| 23 | #define _CCNX_INTEREST_HEADER_H_ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 24 | |
Alexander Afanasyev | 2536e20 | 2011-08-12 14:13:10 -0700 | [diff] [blame] | 25 | #include "ns3/integer.h" |
| 26 | #include "ns3/header.h" |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 27 | #include "ns3/nstime.h" |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 28 | |
| 29 | #include <string> |
| 30 | #include <vector> |
| 31 | #include <list> |
| 32 | |
Ilya Moiseenko | d26e682 | 2011-08-23 17:48:38 -0700 | [diff] [blame] | 33 | #include "ccnx-name-components.h" |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 34 | |
| 35 | namespace ns3 |
| 36 | { |
Alexander Afanasyev | 2536e20 | 2011-08-12 14:13:10 -0700 | [diff] [blame] | 37 | |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 38 | /** |
| 39 | * CCNx XML definition of Interest |
| 40 | * |
| 41 | * Only few important fields are actually implemented in the simulation |
| 42 | * |
| 43 | * <xs:element name="Interest" type="InterestType"/> |
| 44 | * <xs:complexType name="InterestType"> |
| 45 | * <xs:sequence> |
| 46 | * <xs:element name="Name" type="NameType"/> |
| 47 | * <xs:element name="MinSuffixComponents" type="xs:nonNegativeInteger" |
| 48 | * minOccurs="0" maxOccurs="1"/> |
| 49 | * <xs:element name="MaxSuffixComponents" type="xs:nonNegativeInteger" |
| 50 | * minOccurs="0" maxOccurs="1"/> |
| 51 | * <xs:choice minOccurs="0" maxOccurs="1"> |
| 52 | * <xs:element name="PublisherPublicKeyDigest" type="DigestType"/> |
| 53 | * <xs:element name="PublisherCertificateDigest" type="DigestType"/> |
| 54 | * <xs:element name="PublisherIssuerKeyDigest" type="DigestType"/> |
| 55 | * <xs:element name="PublisherIssuerCertificateDigest" type="DigestType"/> |
| 56 | * </xs:choice> |
| 57 | * <xs:element name="Exclude" type="ExcludeType" |
| 58 | * minOccurs="0" maxOccurs="1"/> |
| 59 | * <xs:element name="ChildSelector" type="xs:nonNegativeInteger" |
| 60 | * minOccurs="0" maxOccurs="1"/> |
| 61 | * <xs:element name="AnswerOriginKind" type="xs:nonNegativeInteger" |
| 62 | * minOccurs="0" maxOccurs="1"/> |
| 63 | * <xs:element name="Scope" type="xs:nonNegativeInteger" |
| 64 | * minOccurs="0" maxOccurs="1"/> |
| 65 | * <xs:element name="InterestLifetime" type="FinegrainLifetimeType" |
| 66 | * minOccurs="0" maxOccurs="1"/> |
| 67 | * <xs:element name="Nonce" type="Base64BinaryType" |
| 68 | * minOccurs="0" maxOccurs="1"/> |
| 69 | * </xs:sequence> |
| 70 | * </xs:complexType> |
| 71 | * |
| 72 | * <xs:complexType name="NameType"> |
| 73 | * <xs:sequence> |
| 74 | * <xs:element name="Component" type="Base64BinaryType" |
| 75 | * minOccurs="0" maxOccurs="unbounded"/> |
| 76 | * </xs:sequence> |
| 77 | * </xs:complexType> |
| 78 | * |
| 79 | * <xs:complexType name="ExcludeType"> |
| 80 | * <xs:sequence> |
| 81 | * <xs:choice minOccurs="0" maxOccurs="1"> |
| 82 | * <xs:element name="Any" type="EmptyType"/> |
| 83 | * <xs:element name="Bloom" type="Base64BinaryType"/> <!-- Bloom is deprecated --!> |
| 84 | * </xs:choice> |
| 85 | * <xs:sequence minOccurs="0" maxOccurs="unbounded"> |
| 86 | * <xs:element name="Component" type="Base64BinaryType"/> |
| 87 | * <xs:choice minOccurs="0" maxOccurs="1"> |
| 88 | * <xs:element name="Any" type="EmptyType"/> |
| 89 | * <xs:element name="Bloom" type="Base64BinaryType"/> <!-- Bloom is deprecated --!> |
| 90 | * </xs:choice> |
| 91 | * </xs:sequence> |
| 92 | * </xs:sequence> |
| 93 | * </xs:complexType> |
| 94 | * |
| 95 | * <!-- Binary representation of time, Unix time epoch, units 2**-12 sec (0.000244140625 sec) --> |
| 96 | * <!-- The length limit limit of 6 bytes is not actually to be enforced, but |
| 97 | * it will be a loooooooong time before anyone cares. --> |
| 98 | * |
| 99 | * <!-- Binary representation of relative time, relative to "now" --> |
| 100 | * <xs:complexType name="FinegrainLifetimeType"> |
| 101 | * <xs:simpleContent> |
| 102 | * <xs:extension base="BinaryTime12"> |
| 103 | * <xs:attribute name="ccnbencoding" type="xs:string" fixed="base64Binary"/> |
| 104 | * </xs:extension> |
| 105 | * </xs:simpleContent> |
| 106 | * </xs:complexType> |
| 107 | * |
| 108 | * <xs:simpleType name="BinaryTime12"> |
| 109 | * <xs:restriction base="xs:base64Binary"> |
| 110 | * <xs:length value="6" fixed="true"/> |
| 111 | * </xs:restriction> |
| 112 | * </xs:simpleType> |
| 113 | * |
| 114 | **/ |
| 115 | |
| 116 | /** |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 117 | * NDN InterestHeader and routines to serialize/deserialize |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 118 | |
| 119 | Simplifications: |
| 120 | - Name: binary name components are not supported |
| 121 | - MinSuffixComponents and MasSuffixComponents: if value is negative (default), will not be serialized |
| 122 | - ChildSelector, AnswerOriginKind: 0 - false, 1 - true, -1 not set |
| 123 | - Publisher* elements are not supported |
| 124 | - Exclude: only simple name matching is supported (Bloom support has been deprecated in CCNx) |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 125 | - InterestLifetime: ? |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 126 | - Nonce: 32 bit random integer. If value is 0, will not be serialized |
| 127 | */ |
Alexander Afanasyev | fccdb9e | 2011-08-22 19:27:14 -0700 | [diff] [blame] | 128 | class CcnxInterestHeader : public Header |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 129 | { |
| 130 | public: |
| 131 | /** |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 132 | * \brief Constructor |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 133 | * |
| 134 | * Creates a null header |
| 135 | **/ |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 136 | CcnxInterestHeader (); |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 137 | |
| 138 | /** |
| 139 | * \brief Set interest name |
| 140 | * |
Ilya Moiseenko | 2bd1bc3 | 2011-08-23 16:01:35 -0700 | [diff] [blame] | 141 | * Sets name of the interest. For example, SetName( CcnxNameComponents("prefix")("postfix") ); |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 142 | * @param[in] name const pointer to CcnxNameComponents object that contains an interest name |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 143 | **/ |
| 144 | void |
Ilya Moiseenko | 2bd1bc3 | 2011-08-23 16:01:35 -0700 | [diff] [blame] | 145 | SetName (const Ptr<CcnxNameComponents> &name); |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 146 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 147 | |
| 148 | /** |
| 149 | * \brief Get interest name |
| 150 | * |
| 151 | * Gets name of the interest. |
| 152 | **/ |
Ilya Moiseenko | 2bd1bc3 | 2011-08-23 16:01:35 -0700 | [diff] [blame] | 153 | const CcnxNameComponents& |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 154 | GetName () const; |
| 155 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 156 | /** |
| 157 | * \brief Set interest MinSuffixComponents |
| 158 | * |
| 159 | * MinSuffixComponents refer to the number of name components beyond those in the prefix, |
| 160 | * and counting the implicit digest, that may occur in the matching ContentObject. |
| 161 | * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information. |
| 162 | * @param[in] value minimum length of suffix components |
| 163 | **/ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 164 | void |
| 165 | SetMinSuffixComponents (int32_t value); |
| 166 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 167 | /** |
| 168 | * \brief Get interest MinSuffixComponents |
| 169 | * |
| 170 | * MinSuffixComponents refer to the number of name components beyond those in the prefix, |
| 171 | * and counting the implicit digest, that may occur in the matching ContentObject. |
| 172 | * For more information, see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html |
| 173 | **/ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 174 | int32_t |
| 175 | GetMinSuffixComponents () const; |
| 176 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 177 | |
| 178 | /** |
| 179 | * \brief Set interest MaxSuffixComponents |
| 180 | * |
| 181 | * MaxSuffixComponents refer to the number of name components beyond those in the prefix, |
| 182 | * and counting the implicit digest, that may occur in the matching ContentObject. |
| 183 | * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information. |
| 184 | * @param[in] value maximum length of suffix components |
| 185 | **/ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 186 | void |
| 187 | SetMaxSuffixComponents (int32_t value); |
| 188 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 189 | /** |
| 190 | * \brief Get interest MaxSuffixComponents |
| 191 | * |
| 192 | * MaxSuffixComponents refer to the number of name components beyond those in the prefix, |
| 193 | * and counting the implicit digest, that may occur in the matching ContentObject. |
| 194 | * For more information, see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html |
| 195 | **/ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 196 | int32_t |
| 197 | GetMaxSuffixComponents () const; |
| 198 | |
| 199 | /** |
| 200 | * \brief Set exclude filer |
| 201 | * |
Ilya Moiseenko | 2bd1bc3 | 2011-08-23 16:01:35 -0700 | [diff] [blame] | 202 | * For example, SetExclude (CcnxNameComponents("exclude1")("exclude2")("exclude3")) |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 203 | * @param[in] exclude const pointer to CcnxNameComponents to be excluded |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 204 | **/ |
| 205 | void |
Ilya Moiseenko | 2bd1bc3 | 2011-08-23 16:01:35 -0700 | [diff] [blame] | 206 | SetExclude (const Ptr<CcnxNameComponents> &exclude); |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 207 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 208 | /** |
| 209 | * \brief Check if interest conatins exclude filter |
| 210 | * |
| 211 | */ |
Alexander Afanasyev | 85a3bca | 2011-08-31 16:51:03 -0700 | [diff] [blame] | 212 | bool |
| 213 | IsEnabledExclude () const; |
| 214 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 215 | /** |
| 216 | * \brief Get exclude filter |
| 217 | */ |
Ilya Moiseenko | 2bd1bc3 | 2011-08-23 16:01:35 -0700 | [diff] [blame] | 218 | const CcnxNameComponents& |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 219 | GetExclude () const; |
| 220 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 221 | /** |
| 222 | * \brief Set ChildSelector |
| 223 | * Often a given interest will match more than one ContentObject within a given content store. |
| 224 | * The ChildSelector provides a way of expressing a preference for which of these should be returned. |
| 225 | * If the value is false, the leftmost child is preferred. If true, the rightmost child is preferred. |
| 226 | * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information. |
| 227 | * @param[in] value boolean ChildSelector value |
| 228 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 229 | void |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 230 | SetChildSelector (bool value); |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 231 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 232 | /** |
| 233 | * \brief Return ChildSelector value |
| 234 | * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information. |
| 235 | * |
| 236 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 237 | bool |
| 238 | IsEnabledChildSelector () const; |
| 239 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 240 | /** |
| 241 | * \brief Set AnswerOriginKind |
| 242 | * Default value for AnswerOriginKind is false. |
| 243 | * @param[in] value boolean AnswerOriginKind value |
| 244 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 245 | void |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 246 | SetAnswerOriginKind (bool value); |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 247 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 248 | /** |
| 249 | * \brief Check the value of AnswerOriginKind |
| 250 | * |
| 251 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 252 | bool |
| 253 | IsEnabledAnswerOriginKind () const; |
| 254 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 255 | /** |
| 256 | * \brief Set Scope |
| 257 | * Scope limits where the Interest may propagate. |
| 258 | * Scope 0 prevents propagation beyond the local ccnd (even to other applications on the same host). |
| 259 | * Scope 1 limits propagation to the applications on the originating host. |
| 260 | * Scope 2 limits propagation to no further than the next host. |
| 261 | * Other values are not defined, and will cause the Interest message to be dropped. |
| 262 | * Note that this is not a hop count - the value is not decremented as the interest is forwarded. |
| 263 | * @param[in] scope interest scope |
| 264 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 265 | void |
| 266 | SetScope (int8_t scope); |
| 267 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 268 | /** |
| 269 | * \brief Get Scope value |
| 270 | * Scope limits where the Interest may propagate. |
| 271 | * Scope 0 prevents propagation beyond the local ccnd (even to other applications on the same host). |
| 272 | * Scope 1 limits propagation to the applications on the originating host. |
| 273 | * Scope 2 limits propagation to no further than the next host. |
| 274 | * Other values are not defined, and will cause the Interest message to be dropped. |
| 275 | * Note that this is not a hop count - the value is not decremented as the interest is forwarded. |
| 276 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 277 | int8_t |
| 278 | GetScope () const; |
| 279 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 280 | /** |
| 281 | * \brief Set InterestLifetime |
| 282 | * InterestLifetime indicates the (approximate) time remaining before the interest times out. |
| 283 | * The timeout is relative to the arrival time of the interest at the current node. |
| 284 | * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information. |
| 285 | * @param[in] time interest lifetime |
| 286 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 287 | void |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 288 | SetInterestLifetime (Time time); |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 289 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 290 | /** |
| 291 | * \brief Get InterestLifetime value |
| 292 | * InterestLifetime indicates the (approximate) time remaining before the interest times out. |
| 293 | * The timeout is relative to the arrival time of the interest at the current node. |
| 294 | * \see http://www.ccnx.org/releases/latest/doc/technical/InterestMessage.html for more information. |
| 295 | */ |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 296 | Time |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 297 | GetInterestLifetime () const; |
| 298 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 299 | /** |
| 300 | * \brief Set Nonce |
| 301 | * Nonce carries a randomly-genenerated bytestring that is used to detect and discard duplicate Interest messages. |
| 302 | * @param[in] nonce Unique packet identification number |
| 303 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 304 | void |
| 305 | SetNonce (uint32_t nonce); |
| 306 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 307 | /** |
| 308 | * \brief Get Nonce value |
| 309 | * Nonce carries a randomly-genenerated bytestring that is used to detect and discard duplicate Interest messages. |
| 310 | * |
| 311 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 312 | uint32_t |
| 313 | GetNonce () const; |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 314 | |
| 315 | /** |
| 316 | * \enum NACK Type |
| 317 | * \brief Specifies the type of Interest packet |
| 318 | */ |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame] | 319 | enum |
| 320 | { |
| 321 | NORMAL_INTEREST = 0, |
Alexander Afanasyev | 23d2b54 | 2011-12-07 18:54:46 -0800 | [diff] [blame] | 322 | NACK_LOOP = 10, |
| 323 | NACK_CONGESTION = 11, |
| 324 | NACK_GIVEUP_PIT = 12, |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame] | 325 | }; |
| 326 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 327 | /** |
| 328 | * \brief Mark the Interest as a Negative Acknowledgement |
| 329 | * Three types of NACKs are supported |
| 330 | * 1. NACK_LOOP |
| 331 | * 2. NACK_CONGESTION |
| 332 | * 3. NACK_GIVEUP_PIT |
| 333 | * @param[in] nackType NACK_LOOP or NACK_CONGESTION or NACK_GIVEUP_PIT or NORMAL_INTEREST |
| 334 | */ |
Ilya Moiseenko | 75d9bf5 | 2011-10-28 13:18:32 -0700 | [diff] [blame] | 335 | void |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame] | 336 | SetNack (uint32_t nackType); |
Ilya Moiseenko | 75d9bf5 | 2011-10-28 13:18:32 -0700 | [diff] [blame] | 337 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 338 | /** |
| 339 | * \brief Get NACK type |
| 340 | * Returns NACK_LOOP, NACK_CONGESTION or NACK_GIVEUP_PIT. |
| 341 | * Otherwise, in case of normal interest packet, returns NORMAL_INTEREST (equals 0). |
| 342 | */ |
Alexander Afanasyev | a46844b | 2011-11-21 19:13:26 -0800 | [diff] [blame] | 343 | uint32_t |
| 344 | GetNack () const; |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 345 | |
| 346 | ////////////////////////////////////////////////////////////////// |
| 347 | |
| 348 | static TypeId GetTypeId (void); |
| 349 | virtual TypeId GetInstanceTypeId (void) const; |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 350 | |
| 351 | /** |
| 352 | * \brief Print Interest packet |
| 353 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 354 | virtual void Print (std::ostream &os) const; |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 355 | |
| 356 | /** |
| 357 | * \brief Get the size of Interest packet |
| 358 | * Returns the Interest packet size after serialization |
| 359 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 360 | virtual uint32_t GetSerializedSize (void) const; |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 361 | |
| 362 | /** |
| 363 | * \brief Serialize Interest packet |
| 364 | * Serializes Interest packet into Buffer::Iterator |
| 365 | * @param[in] start buffer to contain serialized Interest packet |
| 366 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 367 | virtual void Serialize (Buffer::Iterator start) const; |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 368 | |
| 369 | /** |
| 370 | * \brief Deserialize Interest packet |
| 371 | * Deserializes Buffer::Iterator into Interest packet |
| 372 | * @param[in] start buffer that contains serialized Interest packet |
| 373 | */ |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 374 | virtual uint32_t Deserialize (Buffer::Iterator start); |
| 375 | |
| 376 | private: |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 377 | Ptr<CcnxNameComponents> m_name; ///< Interest name |
| 378 | int32_t m_minSuffixComponents; ///< Minimum suffix components. not used if negative |
| 379 | int32_t m_maxSuffixComponents; ///< Maximum suffix components. not used if negative |
| 380 | Ptr<CcnxNameComponents> m_exclude; ///< Exclude filter |
| 381 | bool m_childSelector; ///< Default value for ChildSelector is false |
| 382 | bool m_answerOriginKind; ///< Default value for AnswerOriginKind is false |
| 383 | int8_t m_scope; ///< -1 not set, 0 local scope, 1 this host, 2 immediate neighborhood |
| 384 | Time m_interestLifetime; ///< InterestLifetime |
| 385 | uint32_t m_nonce; ///< Nonce. not used if zero |
| 386 | uint32_t m_nackType; ///< Negative Acknowledgement type |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 387 | }; |
| 388 | |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 389 | /** |
| 390 | * \brief Exception class for CcnxInterestHeader |
| 391 | */ |
Alexander Afanasyev | 85a3bca | 2011-08-31 16:51:03 -0700 | [diff] [blame] | 392 | class CcnxInterestHeaderException {}; |
| 393 | |
Alexander Afanasyev | 8a677dd | 2011-08-12 13:08:15 -0700 | [diff] [blame] | 394 | } // namespace ns3 |
| 395 | |
Alexander Afanasyev | 08d984e | 2011-08-13 19:20:22 -0700 | [diff] [blame] | 396 | #endif // _CCNX_INTEREST_HEADER_H_ |