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