author | Peter D. Barnes, Jr. <barnes26@llnl.gov> |
Fri, 03 Oct 2014 02:24:42 -0700 | |
changeset 11085 | 6e4d08656d7c |
parent 10521 | 81a6f41319cc |
permissions | -rw-r--r-- |
8751 | 1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2011 Yufei Cheng |
|
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: Yufei Cheng <yfcheng@ittc.ku.edu> |
|
19 |
* |
|
20 |
* James P.G. Sterbenz <jpgs@ittc.ku.edu>, director |
|
21 |
* ResiliNets Research Group http://wiki.ittc.ku.edu/resilinets |
|
22 |
* Information and Telecommunication Technology Center (ITTC) |
|
23 |
* and Department of Electrical Engineering and Computer Science |
|
24 |
* The University of Kansas Lawrence, KS USA. |
|
25 |
* |
|
26 |
* Work supported in part by NSF FIND (Future Internet Design) Program |
|
27 |
* under grant CNS-0626918 (Postmodern Internet Architecture), |
|
28 |
* NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI), |
|
29 |
* US Department of Defense (DoD), and ITTC at The University of Kansas. |
|
30 |
*/ |
|
31 |
||
32 |
#ifndef DSR_OPTION_HEADER_H |
|
33 |
#define DSR_OPTION_HEADER_H |
|
34 |
||
35 |
#include <ostream> |
|
36 |
#include <algorithm> |
|
37 |
||
38 |
#include "ns3/header.h" |
|
39 |
#include "ns3/ipv4-address.h" |
|
40 |
#include "ns3/simulator.h" |
|
41 |
||
42 |
namespace ns3 { |
|
43 |
||
44 |
class Time; |
|
45 |
namespace dsr { |
|
46 |
/** |
|
47 |
* \class DsrOptionHeader |
|
48 |
* \brief Header for Dsr Options. |
|
49 |
*/ |
|
50 |
class DsrOptionHeader : public Header |
|
51 |
{ |
|
52 |
public: |
|
53 |
/** |
|
54 |
* \struct Alignment |
|
55 |
* \brief represents the alignment requirements of an option header |
|
56 |
*/ |
|
57 |
struct Alignment |
|
58 |
{ |
|
59 |
uint8_t factor; /**< Factor */ |
|
60 |
uint8_t offset; /**< Offset */ |
|
61 |
}; |
|
62 |
/** |
|
63 |
* \brief Get the type identificator. |
|
64 |
* \return type identificator |
|
65 |
*/ |
|
66 |
static TypeId GetTypeId (); |
|
67 |
/** |
|
68 |
* \brief Get the instance type ID. |
|
69 |
* \return instance type ID |
|
70 |
*/ |
|
71 |
virtual TypeId GetInstanceTypeId () const; |
|
72 |
/** |
|
73 |
* \brief Constructor. |
|
74 |
*/ |
|
75 |
DsrOptionHeader (); |
|
76 |
/** |
|
77 |
* \brief Destructor. |
|
78 |
*/ |
|
79 |
virtual ~DsrOptionHeader (); |
|
80 |
/** |
|
81 |
* \brief Set the type of the option. |
|
82 |
* \param type the type of the option |
|
83 |
*/ |
|
84 |
void SetType (uint8_t type); |
|
85 |
/** |
|
86 |
* \brief Get the type of the option. |
|
87 |
* \return the type of the option |
|
88 |
*/ |
|
89 |
uint8_t GetType () const; |
|
90 |
/** |
|
91 |
* \brief Set the option length. |
|
92 |
* \param length the option length |
|
93 |
*/ |
|
94 |
void SetLength (uint8_t length); |
|
95 |
/** |
|
96 |
* \brief Get the option length. |
|
97 |
* \return the option length |
|
98 |
*/ |
|
99 |
uint8_t GetLength () const; |
|
100 |
/** |
|
101 |
* \brief Print some informations about the packet. |
|
102 |
* \param os output stream |
|
103 |
* \return info about this packet |
|
104 |
*/ |
|
105 |
virtual void Print (std::ostream &os) const; |
|
106 |
/** |
|
107 |
* \brief Get the serialized size of the packet. |
|
108 |
* \return size |
|
109 |
*/ |
|
110 |
virtual uint32_t GetSerializedSize () const; |
|
111 |
/** |
|
112 |
* \brief Serialize the packet. |
|
113 |
* \param start Buffer iterator |
|
114 |
*/ |
|
115 |
virtual void Serialize (Buffer::Iterator start) const; |
|
116 |
/** |
|
117 |
* \brief Deserialize the packet. |
|
118 |
* \param start Buffer iterator |
|
119 |
* \return size of the packet |
|
120 |
*/ |
|
121 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
122 |
/** |
|
123 |
* \brief Get the Alignment requirement of this option header |
|
124 |
* \return The required alignment |
|
125 |
* |
|
126 |
* Subclasses should only implement this method, if special alignment is |
|
127 |
* required. Default is no alignment (1n+0). |
|
128 |
*/ |
|
129 |
virtual Alignment GetAlignment () const; |
|
130 |
||
131 |
private: |
|
132 |
/** |
|
133 |
* \brief The type of the option. |
|
134 |
*/ |
|
135 |
uint8_t m_type; |
|
136 |
/** |
|
137 |
* \brief The option length. |
|
138 |
*/ |
|
139 |
uint8_t m_length; |
|
140 |
/** |
|
141 |
* \brief The anonymous data of this option |
|
142 |
*/ |
|
143 |
Buffer m_data; |
|
144 |
}; |
|
145 |
||
146 |
/** |
|
147 |
* \class DsrOptionPad1Header |
|
148 |
* \brief Header of Dsr Option Pad1 |
|
149 |
*/ |
|
150 |
class DsrOptionPad1Header : public DsrOptionHeader |
|
151 |
{ |
|
152 |
public: |
|
153 |
/** |
|
154 |
* \brief Get the type identificator. |
|
155 |
* \return type identificator |
|
156 |
*/ |
|
157 |
static TypeId GetTypeId (); |
|
158 |
/** |
|
159 |
* \brief Get the instance type ID. |
|
160 |
* \return instance type ID |
|
161 |
*/ |
|
162 |
virtual TypeId GetInstanceTypeId () const; |
|
163 |
/** |
|
164 |
* \brief Constructor. |
|
165 |
*/ |
|
166 |
DsrOptionPad1Header (); |
|
167 |
/** |
|
168 |
* \brief Destructor. |
|
169 |
*/ |
|
170 |
virtual ~DsrOptionPad1Header (); |
|
171 |
/** |
|
172 |
* \brief Print some informations about the packet. |
|
173 |
* \param os output stream |
|
174 |
* \return info about this packet |
|
175 |
*/ |
|
176 |
virtual void Print (std::ostream &os) const; |
|
177 |
/** |
|
178 |
* \brief Get the serialized size of the packet. |
|
179 |
* \return size |
|
180 |
*/ |
|
181 |
virtual uint32_t GetSerializedSize () const; |
|
182 |
/** |
|
183 |
* \brief Serialize the packet. |
|
184 |
* \param start Buffer iterator |
|
185 |
*/ |
|
186 |
virtual void Serialize (Buffer::Iterator start) const; |
|
187 |
/** |
|
188 |
* \brief Deserialize the packet. |
|
189 |
* \param start Buffer iterator |
|
190 |
* \return size of the packet |
|
191 |
*/ |
|
192 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
193 |
}; |
|
194 |
||
195 |
/** |
|
196 |
* \class DsrOptionPadnHeader |
|
197 |
* \brief Header of Dsr Option Padn |
|
198 |
*/ |
|
199 |
class DsrOptionPadnHeader : public DsrOptionHeader |
|
200 |
{ |
|
201 |
public: |
|
202 |
/** |
|
203 |
* \brief Get the type identificator. |
|
204 |
* \return type identificator |
|
205 |
*/ |
|
206 |
static TypeId GetTypeId (); |
|
207 |
/** |
|
208 |
* \brief Get the instance type ID. |
|
209 |
* \return instance type ID |
|
210 |
*/ |
|
211 |
virtual TypeId GetInstanceTypeId () const; |
|
212 |
/** |
|
213 |
* \brief Constructor. |
|
214 |
* \param pad Number of bytes to pad (>=2) |
|
215 |
*/ |
|
216 |
DsrOptionPadnHeader (uint32_t pad = 2); |
|
217 |
/** |
|
218 |
* \brief Destructor. |
|
219 |
*/ |
|
220 |
virtual ~DsrOptionPadnHeader (); |
|
221 |
/** |
|
222 |
* \brief Print some informations about the packet. |
|
223 |
* \param os output stream |
|
224 |
* \return info about this packet |
|
225 |
*/ |
|
226 |
virtual void Print (std::ostream &os) const; |
|
227 |
/** |
|
228 |
* \brief Get the serialized size of the packet. |
|
229 |
* \return size |
|
230 |
*/ |
|
231 |
virtual uint32_t GetSerializedSize () const; |
|
232 |
/** |
|
233 |
* \brief Serialize the packet. |
|
234 |
* \param start Buffer iterator |
|
235 |
*/ |
|
236 |
virtual void Serialize (Buffer::Iterator start) const; |
|
237 |
/** |
|
238 |
* \brief Deserialize the packet. |
|
239 |
* \param start Buffer iterator |
|
240 |
* \return size of the packet |
|
241 |
*/ |
|
242 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
243 |
}; |
|
244 |
||
245 |
/** |
|
246 |
* \class DsrOptionRouteRequestHeader |
|
247 |
* \brief Header of Dsr Option Route Request |
|
248 |
*/ |
|
249 |
||
250 |
/** |
|
251 |
* \ingroup dsr |
|
252 |
* \brief Route Request (RREQ) Message Format |
|
253 |
\verbatim |
|
254 |
| 0 | 1 | 2 | 3 | |
|
255 |
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 |
|
256 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
257 |
| Option Type | Opt Data Len | Identification | |
|
258 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
259 |
| Target Address | |
|
260 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
261 |
| Address[1] | |
|
262 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
263 |
| Address[2] | |
|
264 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
265 |
| ... | |
|
266 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
267 |
| Address[n] | |
|
268 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
269 |
\endverbatim |
|
270 |
*/ |
|
271 |
||
272 |
class DsrOptionRreqHeader : public DsrOptionHeader |
|
273 |
{ |
|
274 |
public: |
|
275 |
/** |
|
276 |
* \brief Get the type identificator. |
|
277 |
* \return type identificator |
|
278 |
*/ |
|
279 |
static TypeId GetTypeId (); |
|
280 |
/** |
|
281 |
* \brief Get the instance type ID. |
|
282 |
* \return instance type ID |
|
283 |
*/ |
|
284 |
virtual TypeId GetInstanceTypeId () const; |
|
285 |
/** |
|
286 |
* \brief Constructor. |
|
287 |
*/ |
|
288 |
DsrOptionRreqHeader (); |
|
289 |
/** |
|
290 |
* \brief Destructor. |
|
291 |
*/ |
|
292 |
virtual ~DsrOptionRreqHeader (); |
|
293 |
/** |
|
294 |
* \brief Set the number of ipv4 address. |
|
295 |
* \param n the number of ipv4 address |
|
296 |
*/ |
|
297 |
void SetNumberAddress (uint8_t n); |
|
298 |
/** |
|
299 |
* \brief Get the target ipv4 address. |
|
300 |
* \return target the target packet |
|
301 |
*/ |
|
302 |
Ipv4Address GetTarget (); |
|
303 |
/** |
|
304 |
* \brief Set the target ipv4 address. |
|
305 |
* \param target the target packet |
|
306 |
*/ |
|
307 |
void SetTarget (Ipv4Address target); |
|
308 |
/** |
|
309 |
* \brief Set the vector of ipv4 address |
|
310 |
* \param ipv4Address the vector of ipv4 address |
|
311 |
*/ |
|
312 |
void SetNodesAddress (std::vector<Ipv4Address> ipv4Address); |
|
313 |
/** |
|
314 |
* \brief Get the vector of ipv4 address |
|
315 |
* \return the vector of ipv4 address |
|
316 |
*/ |
|
317 |
std::vector<Ipv4Address> GetNodesAddresses () const; |
|
318 |
/** |
|
319 |
* \brief Get the number of nodes |
|
320 |
* \return the number of nodes |
|
321 |
*/ |
|
322 |
uint32_t GetNodesNumber () const; |
|
323 |
/** |
|
324 |
* \brief Add one node address |
|
325 |
* \param ipv4 The ip address to add |
|
326 |
*/ |
|
327 |
void AddNodeAddress (Ipv4Address ipv4); |
|
328 |
/** |
|
329 |
* \brief Set a Node IPv4 Address. |
|
330 |
* \param index the index of the IPv4 Address |
|
331 |
* \param addr the new IPv4 Address |
|
332 |
*/ |
|
333 |
void SetNodeAddress (uint8_t index, Ipv4Address addr); |
|
334 |
/** |
|
335 |
* \brief Get a Node IPv4 Address. |
|
336 |
* \param index the index of the IPv4 Address |
|
337 |
* \return the router IPv4 Address |
|
338 |
*/ |
|
339 |
Ipv4Address GetNodeAddress (uint8_t index) const; |
|
340 |
/** |
|
341 |
* \brief Set the request id number. |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
342 |
* \param identification the identification number |
8751 | 343 |
*/ |
344 |
void SetId (uint16_t identification); |
|
345 |
/** |
|
346 |
* \brief Set the request id number. |
|
347 |
* \return request id number |
|
348 |
*/ |
|
349 |
uint16_t GetId () const; |
|
350 |
/** |
|
351 |
* \brief Print some informations about the packet. |
|
352 |
* \param os output stream |
|
353 |
* \return info about this packet |
|
354 |
*/ |
|
355 |
virtual void Print (std::ostream &os) const; |
|
356 |
/** |
|
357 |
* \brief Get the serialized size of the packet. |
|
358 |
* \return size |
|
359 |
*/ |
|
360 |
virtual uint32_t GetSerializedSize () const; |
|
361 |
/** |
|
362 |
* \brief Serialize the packet. |
|
363 |
* \param start Buffer iterator |
|
364 |
*/ |
|
365 |
virtual void Serialize (Buffer::Iterator start) const; |
|
366 |
/** |
|
367 |
* \brief Deserialize the packet. |
|
368 |
* \param start Buffer iterator |
|
369 |
* \return size of the packet |
|
370 |
*/ |
|
371 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
372 |
/** |
|
373 |
* \brief Get the Alignment requirement of this option header |
|
374 |
* \return The required alignment |
|
375 |
*/ |
|
376 |
virtual Alignment GetAlignment () const; |
|
377 |
||
378 |
private: |
|
379 |
/** |
|
380 |
* \brief Identifier of the packet. |
|
381 |
*/ |
|
382 |
uint16_t m_identification; |
|
383 |
/* |
|
384 |
* Ipv4 address of target node |
|
385 |
*/ |
|
386 |
Ipv4Address m_target; |
|
387 |
/* |
|
388 |
* Ipv4 address to write when desearizing the packet |
|
389 |
*/ |
|
390 |
Ipv4Address m_address; |
|
391 |
/** |
|
392 |
* \brief A vector of IPv4 Address. |
|
393 |
*/ |
|
394 |
typedef std::vector<Ipv4Address> VectorIpv4Address_t; |
|
395 |
/** |
|
396 |
* \brief The vector of Nodes' IPv4 Address. |
|
397 |
*/ |
|
398 |
VectorIpv4Address_t m_ipv4Address; |
|
399 |
}; |
|
400 |
||
401 |
/** |
|
402 |
* \class DsrOptionRrepHeader |
|
403 |
* \brief Header of Dsr Option Route Reply |
|
404 |
*/ |
|
405 |
||
406 |
/** |
|
407 |
* \ingroup dsr |
|
408 |
* \brief Route Reply (RREP) Message Format |
|
409 |
\verbatim |
|
410 |
| 0 | 1 | 2 | 3 | |
|
411 |
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 |
|
412 |
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
413 |
| Option Type | Opt Data Len |L| Reserved | |
|
414 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
415 |
| Address[1] | |
|
416 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
417 |
| Address[2] | |
|
418 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
419 |
| ... | |
|
420 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
421 |
| Address[n] | |
|
422 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
423 |
\endverbatim |
|
424 |
*/ |
|
425 |
||
426 |
// The Route Reply header modified for ns-3 implementation |
|
427 |
/** |
|
428 |
* \ingroup dsr |
|
429 |
* \brief Route Reply (RREP) Message Format |
|
430 |
\verbatim |
|
431 |
| 0 | 1 | 2 | 3 | |
|
432 |
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 |
|
433 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
434 |
| Option Type | Opt Data Len |L| Reserved | Reserved | |
|
435 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
436 |
| Address[1] | |
|
437 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
438 |
| Address[2] | |
|
439 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
440 |
| ... | |
|
441 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
442 |
| Address[n] | |
|
443 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
444 |
\endverbatim |
|
445 |
*/ |
|
446 |
||
447 |
||
448 |
class DsrOptionRrepHeader : public DsrOptionHeader |
|
449 |
{ |
|
450 |
public: |
|
451 |
/** |
|
452 |
* \brief Get the type identificator. |
|
453 |
* \return type identificator |
|
454 |
*/ |
|
455 |
static TypeId GetTypeId (); |
|
456 |
/** |
|
457 |
* \brief Get the instance type ID. |
|
458 |
* \return instance type ID |
|
459 |
*/ |
|
460 |
virtual TypeId GetInstanceTypeId () const; |
|
461 |
/** |
|
462 |
* \brief Constructor. |
|
463 |
*/ |
|
464 |
DsrOptionRrepHeader (); |
|
465 |
/** |
|
466 |
* \brief Destructor. |
|
467 |
*/ |
|
468 |
virtual ~DsrOptionRrepHeader (); |
|
469 |
/** |
|
470 |
* \brief Set the number of ipv4 address. |
|
471 |
* \param n the number of ipv4 address |
|
472 |
*/ |
|
473 |
void SetNumberAddress (uint8_t n); |
|
474 |
/** |
|
475 |
* \brief Set the vector of ipv4 address |
|
476 |
* \param ipv4Address the vector of ipv4 address |
|
477 |
*/ |
|
478 |
void SetNodesAddress (std::vector<Ipv4Address> ipv4Address); |
|
479 |
/** |
|
480 |
* \brief Get the vector of ipv4 address |
|
481 |
* \return the vector of ipv4 address |
|
482 |
*/ |
|
483 |
std::vector<Ipv4Address> GetNodesAddress () const; |
|
484 |
/* |
|
485 |
* \brief Get the target node Ip address |
|
486 |
* \return the target address |
|
487 |
*/ |
|
488 |
Ipv4Address GetTargetAddress (std::vector<Ipv4Address> ipv4Address) const; |
|
489 |
/** |
|
490 |
* \brief Set a Node IPv4 Address. |
|
491 |
* \param index the index of the IPv4 Address |
|
492 |
* \param addr the new IPv4 Address |
|
493 |
*/ |
|
494 |
void SetNodeAddress (uint8_t index, Ipv4Address addr); |
|
495 |
/** |
|
496 |
* \brief Get a Node IPv4 Address. |
|
497 |
* \param index the index of the IPv4 Address |
|
498 |
* \return the router IPv4 Address |
|
499 |
*/ |
|
500 |
Ipv4Address GetNodeAddress (uint8_t index) const; |
|
501 |
/** |
|
502 |
* \brief Print some informations about the packet. |
|
503 |
* \param os output stream |
|
504 |
* \return info about this packet |
|
505 |
*/ |
|
506 |
virtual void Print (std::ostream &os) const; |
|
507 |
/** |
|
508 |
* \brief Get the serialized size of the packet. |
|
509 |
* \return size |
|
510 |
*/ |
|
511 |
virtual uint32_t GetSerializedSize () const; |
|
512 |
/** |
|
513 |
* \brief Serialize the packet. |
|
514 |
* \param start Buffer iterator |
|
515 |
*/ |
|
516 |
virtual void Serialize (Buffer::Iterator start) const; |
|
517 |
/** |
|
518 |
* \brief Deserialize the packet. |
|
519 |
* \param start Buffer iterator |
|
520 |
* \return size of the packet |
|
521 |
*/ |
|
522 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
523 |
/** |
|
524 |
* \brief Get the Alignment requirement of this option header |
|
525 |
* \return The required alignment |
|
526 |
*/ |
|
527 |
virtual Alignment GetAlignment () const; |
|
528 |
||
529 |
private: |
|
530 |
/* |
|
531 |
* The Ip address to write to when deserialize the packet |
|
532 |
*/ |
|
533 |
Ipv4Address m_address; |
|
534 |
/** |
|
535 |
* \brief type def A vector of IPv4 Address. |
|
536 |
*/ |
|
537 |
typedef std::vector<Ipv4Address> VectorIpv4Address_t; |
|
538 |
/** |
|
539 |
* \brief The vector of Nodes' IPv4 Address. |
|
540 |
*/ |
|
541 |
VectorIpv4Address_t m_ipv4Address; |
|
542 |
}; |
|
543 |
||
544 |
/** |
|
545 |
* \class DsrOptionSRHeader |
|
546 |
* \brief Header of Dsr Option Source Route |
|
547 |
*/ |
|
548 |
||
549 |
/** |
|
550 |
* \ingroup dsr |
|
551 |
* \brief Source Route (SR) Message Format |
|
552 |
\verbatim |
|
553 |
| 0 | 1 | 2 | 3 | |
|
554 |
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 |
|
555 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
556 |
| Option Type | Opt Data Len |F|L|Reservd|Salvage| Segs Left | |
|
557 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
558 |
| Address[1] | |
|
559 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
560 |
| Address[2] | |
|
561 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
562 |
| ... | |
|
563 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
564 |
| Address[n] | |
|
565 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
566 |
\endverbatim |
|
567 |
*/ |
|
568 |
||
569 |
class DsrOptionSRHeader : public DsrOptionHeader |
|
570 |
{ |
|
571 |
public: |
|
572 |
/** |
|
573 |
* \brief Get the type identificator. |
|
574 |
* \return type identificator |
|
575 |
*/ |
|
576 |
static TypeId GetTypeId (); |
|
577 |
/** |
|
578 |
* \brief Get the instance type ID. |
|
579 |
* \return instance type ID |
|
580 |
*/ |
|
581 |
virtual TypeId GetInstanceTypeId () const; |
|
582 |
/** |
|
583 |
* \brief Constructor. |
|
584 |
*/ |
|
585 |
DsrOptionSRHeader (); |
|
586 |
/** |
|
587 |
* \brief Destructor. |
|
588 |
*/ |
|
589 |
virtual ~DsrOptionSRHeader (); |
|
590 |
/* |
|
591 |
* \brief Set the number of segments left to send |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
592 |
* \param segmentsLeft The segments left |
8751 | 593 |
*/ |
594 |
void SetSegmentsLeft (uint8_t segmentsLeft); |
|
595 |
/* |
|
596 |
* \brief Get the number of segments left to send |
|
597 |
* \return The segments left |
|
598 |
*/ |
|
599 |
uint8_t GetSegmentsLeft () const; |
|
600 |
/** |
|
601 |
* \brief Set the number of ipv4 address. |
|
602 |
* \param n the number of ipv4' address |
|
603 |
*/ |
|
604 |
void SetNumberAddress (uint8_t n); |
|
605 |
/** |
|
606 |
* \brief Set the vector of ipv4 address |
|
607 |
* \param ipv4Address the vector of ipv4 address |
|
608 |
*/ |
|
609 |
void SetNodesAddress (std::vector<Ipv4Address> ipv4Address); |
|
610 |
/** |
|
611 |
* \brief Get the vector of ipv4 address |
|
612 |
* \return the vector of ipv4 address |
|
613 |
*/ |
|
614 |
std::vector<Ipv4Address> GetNodesAddress () const; |
|
615 |
/* |
|
616 |
* \brief Get the node list size which is the number of ip address of the route |
|
617 |
* \return the node list size |
|
618 |
*/ |
|
619 |
uint8_t GetNodeListSize () const; |
|
620 |
/** |
|
621 |
* \brief Set a Node IPv4 Address. |
|
622 |
* \param index the index of the IPv4 Address |
|
623 |
* \param addr the new IPv4 Address |
|
624 |
*/ |
|
625 |
void SetNodeAddress (uint8_t index, Ipv4Address addr); |
|
626 |
/** |
|
627 |
* \brief Get a Node IPv4 Address. |
|
628 |
* \param index the index of the IPv4 Address |
|
629 |
* \return the router IPv4 Address |
|
630 |
*/ |
|
631 |
Ipv4Address GetNodeAddress (uint8_t index) const; |
|
632 |
/* |
|
633 |
* \brief Set the salvage value for a packet |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
634 |
* \param salvage The salvage value of the packet |
8751 | 635 |
*/ |
636 |
void SetSalvage (uint8_t salvage); |
|
637 |
/* |
|
638 |
* \brief Get the salvage value for a packet |
|
639 |
* \return The salvage value of the packet |
|
640 |
*/ |
|
641 |
uint8_t GetSalvage () const; |
|
642 |
/** |
|
643 |
* \brief Print some informations about the packet. |
|
644 |
* \param os output stream |
|
645 |
* \return info about this packet |
|
646 |
*/ |
|
647 |
virtual void Print (std::ostream &os) const; |
|
648 |
/** |
|
649 |
* \brief Get the serialized size of the packet. |
|
650 |
* \return size |
|
651 |
*/ |
|
652 |
virtual uint32_t GetSerializedSize () const; |
|
653 |
/** |
|
654 |
* \brief Serialize the packet. |
|
655 |
* \param start Buffer iterator |
|
656 |
*/ |
|
657 |
virtual void Serialize (Buffer::Iterator start) const; |
|
658 |
/** |
|
659 |
* \brief Deserialize the packet. |
|
660 |
* \param start Buffer iterator |
|
661 |
* \return size of the packet |
|
662 |
*/ |
|
663 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
664 |
/** |
|
665 |
* \brief Get the Alignment requirement of this option header |
|
666 |
* \return The required alignment |
|
667 |
*/ |
|
668 |
virtual Alignment GetAlignment () const; |
|
669 |
||
11085
6e4d08656d7c
TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10521
diff
changeset
|
670 |
/** |
6e4d08656d7c
TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10521
diff
changeset
|
671 |
* TracedCallback signature for DsrOptionSrHeader. |
6e4d08656d7c
TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10521
diff
changeset
|
672 |
* |
6e4d08656d7c
TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10521
diff
changeset
|
673 |
* \param [in] header The DsrOptionsSRHeader |
6e4d08656d7c
TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10521
diff
changeset
|
674 |
*/ |
6e4d08656d7c
TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10521
diff
changeset
|
675 |
typedef void (* TracedCallback) (const DsrOptionSRHeader & header); |
6e4d08656d7c
TracedCallback function signatures, the simple ones.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10521
diff
changeset
|
676 |
|
8751 | 677 |
private: |
678 |
/** |
|
679 |
* \brief The ip address header deserilize to |
|
680 |
*/ |
|
681 |
Ipv4Address m_address; |
|
682 |
/** |
|
683 |
* \brief Number of left segments. |
|
684 |
*/ |
|
685 |
uint8_t m_segmentsLeft; |
|
686 |
/** |
|
687 |
* \brief Number of savlage times for a packet. |
|
688 |
*/ |
|
689 |
uint8_t m_salvage; |
|
690 |
/** |
|
691 |
* \brief A vector of IPv4 Address. |
|
692 |
*/ |
|
693 |
typedef std::vector<Ipv4Address> VectorIpv4Address_t; |
|
694 |
/** |
|
695 |
* \brief The vector of Nodes' IPv4 Address. |
|
696 |
*/ |
|
697 |
VectorIpv4Address_t m_ipv4Address; |
|
698 |
}; |
|
699 |
||
700 |
/** |
|
701 |
* \class DsrOptionRerrHeader |
|
702 |
* \brief Header of Dsr Option Route Error |
|
703 |
*/ |
|
704 |
||
705 |
/** |
|
706 |
* \ingroup dsr |
|
707 |
* \brief Route Error (RERR) Message Format |
|
708 |
\verbatim |
|
709 |
| 0 | 1 | 2 | 3 | |
|
710 |
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 |
|
711 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
712 |
| Option Type | Opt Data Len | Error Type |Reservd| Salvage| |
|
713 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
714 |
| Error Source Address | |
|
715 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
716 |
| Error Destination Address | |
|
717 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
718 |
. . |
|
719 |
. Type-Specific Information . |
|
720 |
. . |
|
721 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
722 |
\endverbatim |
|
723 |
*/ |
|
724 |
||
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
725 |
/// Error type |
8751 | 726 |
enum ErrorType |
727 |
{ |
|
728 |
NODE_UNREACHABLE = 1, // !< NODE_UNREACHABLE |
|
729 |
FLOW_STATE_NOT_SUPPORTED = 2, // !< FLOW_STATE_NOT_SUPPORTED |
|
730 |
OPTION_NOT_SUPPORTED = 3, // !< OPTION_NOT_SUPPORTED |
|
731 |
}; |
|
732 |
||
733 |
class DsrOptionRerrHeader : public DsrOptionHeader |
|
734 |
{ |
|
735 |
public: |
|
736 |
/** |
|
737 |
* \brief Get the type identificator. |
|
738 |
* \return type identificator |
|
739 |
*/ |
|
740 |
static TypeId GetTypeId (); |
|
741 |
/** |
|
742 |
* \brief Get the instance type ID. |
|
743 |
* \return instance type ID |
|
744 |
*/ |
|
745 |
virtual TypeId GetInstanceTypeId () const; |
|
746 |
/** |
|
747 |
* \brief Constructor. |
|
748 |
*/ |
|
749 |
DsrOptionRerrHeader (); |
|
750 |
/** |
|
751 |
* \brief Destructor. |
|
752 |
*/ |
|
753 |
virtual ~DsrOptionRerrHeader (); |
|
754 |
/** |
|
755 |
* \brief Set the route error type |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
756 |
* \param errorType The error type |
8751 | 757 |
*/ |
758 |
void SetErrorType (uint8_t errorType); |
|
759 |
/** |
|
760 |
* \brief Get the route error type |
|
761 |
* \return The error type |
|
762 |
*/ |
|
763 |
uint8_t GetErrorType () const; |
|
764 |
/** |
|
765 |
* \brief Set the route error source address |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
766 |
* \param errorSrcAddress The error source address |
8751 | 767 |
*/ |
768 |
virtual void SetErrorSrc (Ipv4Address errorSrcAddress); |
|
769 |
/** |
|
770 |
* \brief Get the route error source address |
|
771 |
* \return The error source address |
|
772 |
*/ |
|
773 |
virtual Ipv4Address GetErrorSrc () const; |
|
774 |
/** |
|
775 |
* \brief Set the salvage value of the packet |
|
776 |
*/ |
|
777 |
virtual void SetSalvage (uint8_t salvage); |
|
778 |
/** |
|
779 |
* \brief Get the salvage value of the packet |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
780 |
* \return The salvage value of the packet |
8751 | 781 |
*/ |
782 |
virtual uint8_t GetSalvage () const; |
|
783 |
/** |
|
784 |
* \brief Set the error destination ip address |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
785 |
* \param errorDstAddress The error destination address |
8751 | 786 |
*/ |
787 |
virtual void SetErrorDst (Ipv4Address errorDstAddress); |
|
788 |
/** |
|
789 |
* \brief Get the error destination ip address |
|
790 |
* \return The error destination address |
|
791 |
*/ |
|
792 |
virtual Ipv4Address GetErrorDst () const; |
|
793 |
/** |
|
794 |
* \brief Print some informations about the packet. |
|
795 |
* \param os output stream |
|
796 |
* \return info about this packet |
|
797 |
*/ |
|
798 |
virtual void Print (std::ostream &os) const; |
|
799 |
/** |
|
800 |
* \brief Get the serialized size of the packet. |
|
801 |
* \return size |
|
802 |
*/ |
|
803 |
virtual uint32_t GetSerializedSize () const; |
|
804 |
/** |
|
805 |
* \brief Serialize the packet. |
|
806 |
* \param start Buffer iterator |
|
807 |
*/ |
|
808 |
virtual void Serialize (Buffer::Iterator start) const; |
|
809 |
/** |
|
810 |
* \brief Deserialize the packet. |
|
811 |
* \param start Buffer iterator |
|
812 |
* \return size of the packet |
|
813 |
*/ |
|
814 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
815 |
/** |
|
816 |
* \brief Get the Alignment requirement of this option header |
|
817 |
* \return The required alignment |
|
818 |
*/ |
|
819 |
virtual Alignment GetAlignment () const; |
|
820 |
||
821 |
private: |
|
822 |
/** |
|
823 |
* \brief The error type or route error option |
|
824 |
*/ |
|
825 |
uint8_t m_errorType; |
|
826 |
/** |
|
827 |
* \brief The salavage field |
|
828 |
*/ |
|
829 |
uint8_t m_salvage; |
|
830 |
/** |
|
831 |
* \brief The specific error message length |
|
832 |
*/ |
|
833 |
uint16_t m_errorLength; |
|
834 |
/** |
|
835 |
* \brief The error source address |
|
836 |
*/ |
|
837 |
Ipv4Address m_errorSrcAddress; |
|
838 |
/** |
|
839 |
* \brief The error destination address |
|
840 |
*/ |
|
841 |
Ipv4Address m_errorDstAddress; |
|
842 |
/** |
|
843 |
* \brief The anonymous data of this option |
|
844 |
*/ |
|
845 |
Buffer m_errorData; |
|
846 |
}; |
|
847 |
||
848 |
/** |
|
849 |
* \ingroup dsr |
|
850 |
* \brief Route Error (RERR) Unreachable node address option Message Format |
|
851 |
\verbatim |
|
852 |
| 0 | 1 | 2 | 3 | |
|
853 |
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 |
|
854 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
855 |
| Option Type | Opt Data Len | Error Type |Reservd| Salvage| |
|
856 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
857 |
| Error Source Address | |
|
858 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
859 |
| Error Destination Address | |
|
860 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
861 |
. . |
|
862 |
. Type-Specific Information . |
|
863 |
. . |
|
864 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
865 |
\endverbatim |
|
866 |
*/ |
|
867 |
/* |
|
868 |
* \brief The type-specific info field |
|
869 |
* \verbatim |
|
870 |
| 0 | 1 | 2 | 3 | |
|
871 |
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 |
|
872 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
873 |
| Unreachable Node Address | |
|
874 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
875 |
\endverbatim |
|
876 |
*/ |
|
877 |
||
878 |
class DsrOptionRerrUnreachHeader : public DsrOptionRerrHeader |
|
879 |
{ |
|
880 |
public: |
|
881 |
/** |
|
882 |
* \brief Get the type identificator. |
|
883 |
* \return type identificator |
|
884 |
*/ |
|
885 |
static TypeId GetTypeId (); |
|
886 |
/** |
|
887 |
* \brief Get the instance type ID. |
|
888 |
* \return instance type ID |
|
889 |
*/ |
|
890 |
virtual TypeId GetInstanceTypeId () const; |
|
891 |
/** |
|
892 |
* \brief Constructor. |
|
893 |
*/ |
|
894 |
DsrOptionRerrUnreachHeader (); |
|
895 |
/** |
|
896 |
* \brief Destructor. |
|
897 |
*/ |
|
898 |
virtual ~DsrOptionRerrUnreachHeader (); |
|
899 |
/** |
|
900 |
* \brief Set the route error source address |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
901 |
* \param errorSrcAddress The error source address |
8751 | 902 |
*/ |
903 |
virtual void SetErrorSrc (Ipv4Address errorSrcAddress); |
|
904 |
/** |
|
905 |
* \brief Get the route error source address |
|
906 |
* \return The error source address |
|
907 |
*/ |
|
908 |
virtual Ipv4Address GetErrorSrc () const; |
|
909 |
/** |
|
910 |
* \brief Set the salvage value of the packet |
|
911 |
*/ |
|
912 |
virtual void SetSalvage (uint8_t salvage); |
|
913 |
/** |
|
914 |
* \brief Get the salvage value of the packet |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
915 |
* \return The salvage value of the packet |
8751 | 916 |
*/ |
917 |
virtual uint8_t GetSalvage () const; |
|
918 |
/** |
|
919 |
* \brief Set the error destination ip address |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
920 |
* \param errorDstAddress The error destination address |
8751 | 921 |
*/ |
922 |
virtual void SetErrorDst (Ipv4Address errorDstAddress); |
|
923 |
/** |
|
924 |
* \brief Get the error destination ip address |
|
925 |
* \return The error destination address |
|
926 |
*/ |
|
927 |
virtual Ipv4Address GetErrorDst () const; |
|
928 |
/** |
|
929 |
* \brief Set the unreachable node ip address |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
930 |
* \param unreachNode The unreachable ip address |
8751 | 931 |
*/ |
932 |
void SetUnreachNode (Ipv4Address unreachNode); |
|
933 |
/** |
|
934 |
* \brief Get the unreachable node ip address |
|
935 |
* \return The unreachable ip address |
|
936 |
*/ |
|
937 |
Ipv4Address GetUnreachNode () const; |
|
938 |
/** |
|
8752 | 939 |
* \brief Set the unreachable node ip address |
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
940 |
* \param originalDst The unreachable ip address |
8752 | 941 |
*/ |
942 |
void SetOriginalDst (Ipv4Address originalDst); |
|
943 |
/** |
|
944 |
* \brief Get the unreachable node ip address |
|
945 |
* \return The unreachable ip address |
|
946 |
*/ |
|
947 |
Ipv4Address GetOriginalDst () const; |
|
948 |
/** |
|
8751 | 949 |
* \brief Print some informations about the packet. |
950 |
* \param os output stream |
|
951 |
* \return info about this packet |
|
952 |
*/ |
|
953 |
virtual void Print (std::ostream &os) const; |
|
954 |
/** |
|
955 |
* \brief Get the serialized size of the packet. |
|
956 |
* \return size |
|
957 |
*/ |
|
958 |
virtual uint32_t GetSerializedSize () const; |
|
959 |
/** |
|
960 |
* \brief Serialize the packet. |
|
961 |
* \param start Buffer iterator |
|
962 |
*/ |
|
963 |
virtual void Serialize (Buffer::Iterator start) const; |
|
964 |
/** |
|
965 |
* \brief Deserialize the packet. |
|
966 |
* \param start Buffer iterator |
|
967 |
* \return size of the packet |
|
968 |
*/ |
|
969 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
970 |
/** |
|
971 |
* \brief Get the Alignment requirement of this option header |
|
972 |
* \return The required alignment |
|
973 |
*/ |
|
974 |
virtual Alignment GetAlignment () const; |
|
975 |
||
976 |
private: |
|
977 |
/** |
|
978 |
* \brief The error type or route error option |
|
979 |
*/ |
|
980 |
uint8_t m_errorType; |
|
981 |
/** |
|
982 |
* \brief The salavage field |
|
983 |
*/ |
|
984 |
uint8_t m_salvage; |
|
985 |
/** |
|
986 |
* \brief The error source address |
|
987 |
*/ |
|
988 |
Ipv4Address m_errorSrcAddress; |
|
989 |
/** |
|
990 |
* \brief The error destination address |
|
991 |
*/ |
|
992 |
Ipv4Address m_errorDstAddress; |
|
993 |
/** |
|
994 |
* \brief The unreachable node address |
|
995 |
*/ |
|
996 |
Ipv4Address m_unreachNode; |
|
997 |
/** |
|
8752 | 998 |
* \brief The original destination address |
999 |
*/ |
|
1000 |
Ipv4Address m_originalDst; |
|
8751 | 1001 |
}; |
1002 |
||
1003 |
/** |
|
1004 |
* \ingroup dsr |
|
1005 |
* \brief Route Error (RERR) Unsupported option Message Format |
|
1006 |
\verbatim |
|
1007 |
| 0 | 1 | 2 | 3 | |
|
1008 |
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 |
|
1009 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1010 |
| Option Type | Opt Data Len | Error Type |Reservd| Salvage| |
|
1011 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1012 |
| Error Source Address | |
|
1013 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1014 |
| Error Destination Address | |
|
1015 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1016 |
. . |
|
1017 |
. Type-Specific Information . |
|
1018 |
. . |
|
1019 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1020 |
\endverbatim |
|
1021 |
*/ |
|
1022 |
/* |
|
1023 |
* \brief The type-specific info field |
|
1024 |
* \unsupported option |
|
1025 |
* \verbatim |
|
1026 |
| 0 | |
|
1027 |
0 1 2 3 4 5 6 7 |
|
1028 |
+-+-+-+-+-+-+-+-+ |
|
1029 |
|Unsupported Opt| |
|
1030 |
+-+-+-+-+-+-+-+-+ |
|
1031 |
\endverbatim |
|
1032 |
*/ |
|
1033 |
||
1034 |
class DsrOptionRerrUnsupportHeader : public DsrOptionRerrHeader |
|
1035 |
{ |
|
1036 |
public: |
|
1037 |
/** |
|
1038 |
* \brief Get the type identificator. |
|
1039 |
* \return type identificator |
|
1040 |
*/ |
|
1041 |
static TypeId GetTypeId (); |
|
1042 |
/** |
|
1043 |
* \brief Get the instance type ID. |
|
1044 |
* \return instance type ID |
|
1045 |
*/ |
|
1046 |
virtual TypeId GetInstanceTypeId () const; |
|
1047 |
/** |
|
1048 |
* \brief Constructor. |
|
1049 |
*/ |
|
1050 |
DsrOptionRerrUnsupportHeader (); |
|
1051 |
/** |
|
1052 |
* \brief Destructor. |
|
1053 |
*/ |
|
1054 |
virtual ~DsrOptionRerrUnsupportHeader (); |
|
1055 |
/** |
|
1056 |
* \brief Set the route error source address |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
1057 |
* \param errorSrcAddress The error source address |
8751 | 1058 |
*/ |
1059 |
virtual void SetErrorSrc (Ipv4Address errorSrcAddress); |
|
1060 |
/** |
|
1061 |
* \brief Get the route error source address |
|
1062 |
* \return The error source address |
|
1063 |
*/ |
|
1064 |
virtual Ipv4Address GetErrorSrc () const; |
|
1065 |
/** |
|
1066 |
* \brief Set the salvage value of the packet |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
1067 |
* \param salvage the salvage value |
8751 | 1068 |
*/ |
1069 |
virtual void SetSalvage (uint8_t salvage); |
|
1070 |
/** |
|
1071 |
* \brief Get the salvage value of the packet |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
1072 |
* \return The salvage value of the packet |
8751 | 1073 |
*/ |
1074 |
virtual uint8_t GetSalvage () const; |
|
1075 |
/** |
|
1076 |
* \brief Set the error destination ip address |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
1077 |
* \param errorDstAddress The error destination address |
8751 | 1078 |
*/ |
1079 |
virtual void SetErrorDst (Ipv4Address errorDstAddress); |
|
1080 |
/** |
|
1081 |
* \brief Get the error destination ip address |
|
1082 |
* \return The error destination address |
|
1083 |
*/ |
|
1084 |
virtual Ipv4Address GetErrorDst () const; |
|
1085 |
/** |
|
1086 |
* \brief Set the unsupported option type value |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
1087 |
* \param optionType The unsupported option type value |
8751 | 1088 |
*/ |
1089 |
void SetUnsupported (uint16_t optionType); |
|
1090 |
/** |
|
1091 |
* \brief Get the unsupported option type value |
|
1092 |
* \return The unsupported option type value |
|
1093 |
*/ |
|
1094 |
uint16_t GetUnsupported () const; |
|
1095 |
/** |
|
1096 |
* \brief Print some informations about the packet. |
|
1097 |
* \param os output stream |
|
1098 |
* \return info about this packet |
|
1099 |
*/ |
|
1100 |
virtual void Print (std::ostream &os) const; |
|
1101 |
/** |
|
1102 |
* \brief Get the serialized size of the packet. |
|
1103 |
* \return size |
|
1104 |
*/ |
|
1105 |
virtual uint32_t GetSerializedSize () const; |
|
1106 |
/** |
|
1107 |
* \brief Serialize the packet. |
|
1108 |
* \param start Buffer iterator |
|
1109 |
*/ |
|
1110 |
virtual void Serialize (Buffer::Iterator start) const; |
|
1111 |
/** |
|
1112 |
* \brief Deserialize the packet. |
|
1113 |
* \param start Buffer iterator |
|
1114 |
* \return size of the packet |
|
1115 |
*/ |
|
1116 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
1117 |
/** |
|
1118 |
* \brief Get the Alignment requirement of this option header |
|
1119 |
* \return The required alignment |
|
1120 |
*/ |
|
1121 |
virtual Alignment GetAlignment () const; |
|
1122 |
||
1123 |
private: |
|
1124 |
/** |
|
1125 |
* \brief The error type or route error option |
|
1126 |
*/ |
|
1127 |
uint8_t m_errorType; |
|
1128 |
/** |
|
1129 |
* \brief The salavage field |
|
1130 |
*/ |
|
1131 |
uint8_t m_salvage; |
|
1132 |
/** |
|
1133 |
* \brief The error source address |
|
1134 |
*/ |
|
1135 |
Ipv4Address m_errorSrcAddress; |
|
1136 |
/** |
|
1137 |
* \brief The error destination address |
|
1138 |
*/ |
|
1139 |
Ipv4Address m_errorDstAddress; |
|
1140 |
/** |
|
1141 |
* \brief The unsupported option |
|
1142 |
*/ |
|
1143 |
uint16_t m_unsupport; |
|
1144 |
}; |
|
1145 |
||
1146 |
/** |
|
1147 |
* \class DsrOptionAckReqHeader |
|
1148 |
* \brief Header of Dsr Option ack request |
|
1149 |
*/ |
|
1150 |
||
1151 |
/** |
|
1152 |
* \ingroup dsr |
|
1153 |
* \brief Acknowledgement Request (ACK_RREQ) Message Format |
|
1154 |
\verbatim |
|
1155 |
| 0 | 1 | 2 | 3 | |
|
1156 |
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 |
|
1157 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1158 |
| Option Type | Opt Data Len | Identification | |
|
1159 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1160 |
\endverbatim |
|
1161 |
*/ |
|
1162 |
||
1163 |
class DsrOptionAckReqHeader : public DsrOptionHeader |
|
1164 |
{ |
|
1165 |
public: |
|
1166 |
/** |
|
1167 |
* \brief Get the type identificator. |
|
1168 |
* \return type identificator |
|
1169 |
*/ |
|
1170 |
static TypeId GetTypeId (); |
|
1171 |
/** |
|
1172 |
* \brief Get the instance type ID. |
|
1173 |
* \return instance type ID |
|
1174 |
*/ |
|
1175 |
virtual TypeId GetInstanceTypeId () const; |
|
1176 |
/** |
|
1177 |
* \brief Constructor. |
|
1178 |
*/ |
|
1179 |
DsrOptionAckReqHeader (); |
|
1180 |
/** |
|
1181 |
* \brief Destructor. |
|
1182 |
*/ |
|
1183 |
virtual ~DsrOptionAckReqHeader (); |
|
1184 |
/** |
|
1185 |
* \brief Set the Ack request id number. |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
1186 |
* \param identification the identification number |
8751 | 1187 |
*/ |
1188 |
void SetAckId (uint16_t identification); |
|
1189 |
/** |
|
1190 |
* \brief Set the Ack request id number. |
|
1191 |
* \return request id number |
|
1192 |
*/ |
|
1193 |
uint16_t GetAckId () const; |
|
1194 |
/** |
|
1195 |
* \brief Print some informations about the packet. |
|
1196 |
* \param os output stream |
|
1197 |
* \return info about this packet |
|
1198 |
*/ |
|
1199 |
virtual void Print (std::ostream &os) const; |
|
1200 |
/** |
|
1201 |
* \brief Get the serialized size of the packet. |
|
1202 |
* \return size |
|
1203 |
*/ |
|
1204 |
virtual uint32_t GetSerializedSize () const; |
|
1205 |
/** |
|
1206 |
* \brief Serialize the packet. |
|
1207 |
* \param start Buffer iterator |
|
1208 |
*/ |
|
1209 |
virtual void Serialize (Buffer::Iterator start) const; |
|
1210 |
/** |
|
1211 |
* \brief Deserialize the packet. |
|
1212 |
* \param start Buffer iterator |
|
1213 |
* \return size of the packet |
|
1214 |
*/ |
|
1215 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
1216 |
/** |
|
1217 |
* \brief Get the Alignment requirement of this option header |
|
1218 |
* \return The required alignment |
|
1219 |
*/ |
|
1220 |
virtual Alignment GetAlignment () const; |
|
1221 |
||
1222 |
private: |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
1223 |
/** |
8751 | 1224 |
* The identification field |
1225 |
*/ |
|
1226 |
uint16_t m_identification; |
|
1227 |
}; |
|
1228 |
||
1229 |
/** |
|
1230 |
* \class DsrOptionAckHeader |
|
1231 |
* \brief Header of Dsr Option ack |
|
1232 |
*/ |
|
1233 |
||
1234 |
/** |
|
1235 |
* \ingroup dsr |
|
1236 |
* \brief Acknowledgement (ACK) Message Format |
|
1237 |
\verbatim |
|
1238 |
| 0 | 1 | 2 | 3 | |
|
1239 |
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 |
|
1240 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1241 |
| Option Type | Opt Data Len | Identification | |
|
1242 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1243 |
| ACK Source Address | |
|
1244 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1245 |
| ACK Destination Address | |
|
1246 |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
|
1247 |
\endverbatim |
|
1248 |
*/ |
|
1249 |
||
1250 |
class DsrOptionAckHeader : public DsrOptionHeader |
|
1251 |
{ |
|
1252 |
public: |
|
1253 |
/** |
|
1254 |
* \brief Get the type identificator. |
|
1255 |
* \return type identificator |
|
1256 |
*/ |
|
1257 |
static TypeId GetTypeId (); |
|
1258 |
/** |
|
1259 |
* \brief Get the instance type ID. |
|
1260 |
* \return instance type ID |
|
1261 |
*/ |
|
1262 |
virtual TypeId GetInstanceTypeId () const; |
|
1263 |
/** |
|
1264 |
* \brief Constructor. |
|
1265 |
*/ |
|
1266 |
DsrOptionAckHeader (); |
|
1267 |
/** |
|
1268 |
* \brief Destructor. |
|
1269 |
*/ |
|
1270 |
virtual ~DsrOptionAckHeader (); |
|
1271 |
/** |
|
1272 |
* \brief Set the Ack id number. |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
1273 |
* \param identification the identification number |
8751 | 1274 |
*/ |
1275 |
void SetAckId (uint16_t identification); |
|
1276 |
/** |
|
1277 |
* \brief Set the Ack id number. |
|
1278 |
* \return request id number |
|
1279 |
*/ |
|
1280 |
uint16_t GetAckId () const; |
|
1281 |
/** |
|
1282 |
* \brief Set Error source ip address. |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
1283 |
* \param realSrcAddress The real source address |
8751 | 1284 |
*/ |
1285 |
void SetRealSrc (Ipv4Address realSrcAddress); |
|
1286 |
/** |
|
1287 |
* \brief Get Error source ip address. |
|
1288 |
* \return The real source address |
|
1289 |
*/ |
|
1290 |
Ipv4Address GetRealSrc () const; |
|
1291 |
/** |
|
1292 |
* \brief Set Error source ip address. |
|
10521
81a6f41319cc
[doxygen] dsr module (fix only trivial warnings)
Daniel Lertpratchya <nikkipui@gmail.com>
parents:
10218
diff
changeset
|
1293 |
* \param realDstAddress The real dst address |
8751 | 1294 |
*/ |
1295 |
void SetRealDst (Ipv4Address realDstAddress); |
|
1296 |
/** |
|
1297 |
* \brief Get Error source ip address. |
|
1298 |
* \return The real dst address |
|
1299 |
*/ |
|
1300 |
Ipv4Address GetRealDst () const; |
|
1301 |
/** |
|
1302 |
* \brief Print some informations about the packet. |
|
1303 |
* \param os output stream |
|
1304 |
* \return info about this packet |
|
1305 |
*/ |
|
1306 |
virtual void Print (std::ostream &os) const; |
|
1307 |
/** |
|
1308 |
* \brief Get the serialized size of the packet. |
|
1309 |
* \return size |
|
1310 |
*/ |
|
1311 |
virtual uint32_t GetSerializedSize () const; |
|
1312 |
/** |
|
1313 |
* \brief Serialize the packet. |
|
1314 |
* \param start Buffer iterator |
|
1315 |
*/ |
|
1316 |
virtual void Serialize (Buffer::Iterator start) const; |
|
1317 |
/** |
|
1318 |
* \brief Deserialize the packet. |
|
1319 |
* \param start Buffer iterator |
|
1320 |
* \return size of the packet |
|
1321 |
*/ |
|
1322 |
virtual uint32_t Deserialize (Buffer::Iterator start); |
|
1323 |
/** |
|
1324 |
* \brief Get the Alignment requirement of this option header |
|
1325 |
* \return The required alignment |
|
1326 |
*/ |
|
1327 |
virtual Alignment GetAlignment () const; |
|
1328 |
||
1329 |
private: |
|
1330 |
/** |
|
1331 |
* \brief identification field |
|
1332 |
*/ |
|
1333 |
uint16_t m_identification; |
|
1334 |
/** |
|
1335 |
* \brief ack source address |
|
1336 |
*/ |
|
1337 |
Ipv4Address m_realSrcAddress; |
|
1338 |
/** |
|
1339 |
* \brief ack destination address |
|
1340 |
*/ |
|
1341 |
Ipv4Address m_realDstAddress; |
|
1342 |
}; |
|
1343 |
||
1344 |
static inline std::ostream & operator<< (std::ostream& os, const DsrOptionSRHeader & sr) |
|
1345 |
{ |
|
1346 |
sr.Print (os); |
|
1347 |
return os; |
|
1348 |
} |
|
1349 |
||
1350 |
} // namespace dsr |
|
1351 |
} // namespace ns3 |
|
1352 |
||
1353 |
#endif /* DSR_OPTION_HEADER_H */ |