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