A Discrete-Event Network Simulator
API
dsr-option-header.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2011 Yufei Cheng
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Yufei Cheng <yfcheng@ittc.ku.edu>
19 *
20 * James P.G. Sterbenz <jpgs@ittc.ku.edu>, director
21 * ResiliNets Research Group https://resilinets.org/
22 * Information and Telecommunication Technology Center (ITTC)
23 * and Department of Electrical Engineering and Computer Science
24 * The University of Kansas Lawrence, KS USA.
25 *
26 * Work supported in part by NSF FIND (Future Internet Design) Program
27 * under grant CNS-0626918 (Postmodern Internet Architecture),
28 * NSF grant CNS-1050226 (Multilayer Network Resilience Analysis and Experimentation on GENI),
29 * US Department of Defense (DoD), and ITTC at The University of Kansas.
30 */
31
32#include "ns3/assert.h"
33#include "ns3/log.h"
34#include "ns3/header.h"
35#include "dsr-option-header.h"
36#include "ns3/ipv4-address.h"
37#include "ns3/address-utils.h"
38#include "ns3/packet.h"
39#include "ns3/enum.h"
40
41namespace ns3 {
42
43NS_LOG_COMPONENT_DEFINE ("DsrOptionHeader");
44
45namespace dsr {
46
47NS_OBJECT_ENSURE_REGISTERED (DsrOptionHeader);
48
50{
51 static TypeId tid = TypeId ("ns3::dsr::DsrOptionHeader")
53 .SetParent<Header> ()
54 .SetGroupName ("Dsr")
55 ;
56 return tid;
57}
58
60{
61 return GetTypeId ();
62}
63
65 : m_type (0),
66 m_length (0)
67{
68}
69
71{
72}
73
75{
76 m_type = type;
77}
78
80{
81 return m_type;
82}
83
84void DsrOptionHeader::SetLength (uint8_t length)
85{
86 m_length = length;
87}
88
90{
91 return m_length;
92}
93
94void DsrOptionHeader::Print (std::ostream &os) const
95{
96 os << "( type = " << (uint32_t)m_type << " length = " << (uint32_t)m_length << " )";
97}
98
100{
101 return m_length + 2;
102}
103
105{
107
108 i.WriteU8 (m_type);
109 i.WriteU8 (m_length);
110 i.Write (m_data.Begin (), m_data.End ());
111}
112
114{
116
117 m_type = i.ReadU8 ();
118 m_length = i.ReadU8 ();
119
120 m_data = Buffer ();
122 Buffer::Iterator dataStart = i;
123 i.Next (m_length);
124 Buffer::Iterator dataEnd = i;
125 m_data.Begin ().Write (dataStart, dataEnd);
126
127 return GetSerializedSize ();
128}
129
131{
132 Alignment retVal = { 1, 0 };
133 return retVal;
134}
135
137
139{
140 static TypeId tid = TypeId ("ns3::dsr::DsrOptionPad1Header")
142 .SetParent<DsrOptionHeader> ()
143 .SetGroupName ("Dsr")
144 ;
145 return tid;
146}
147
149{
150 return GetTypeId ();
151}
152
154{
155 SetType (224);
156}
157
159{
160}
161
162void DsrOptionPad1Header::Print (std::ostream &os) const
163{
164 os << "( type = " << (uint32_t)GetType () << " )";
165}
166
168{
169 return 1;
170}
171
173{
175
176 i.WriteU8 (GetType ());
177}
178
180{
182
183 SetType (i.ReadU8 ());
184
185 return GetSerializedSize ();
186}
187
189
191{
192 static TypeId tid = TypeId ("ns3::dsr::DsrOptionPadnHeader")
194 .SetParent<DsrOptionHeader> ()
195 .SetGroupName ("Dsr")
196 ;
197 return tid;
198}
199
201{
202 return GetTypeId ();
203}
204
206{
207 SetType (0);
208 NS_ASSERT_MSG (pad >= 2, "PadN must be at least 2 bytes long");
209 SetLength (pad - 2);
210}
211
213{
214}
215
216void DsrOptionPadnHeader::Print (std::ostream &os) const
217{
218 os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength () << " )";
219}
220
222{
223 return GetLength () + 2;
224}
225
227{
229
230 i.WriteU8 (GetType ());
231 i.WriteU8 (GetLength ());
232
233 for (int padding = 0; padding < GetLength (); padding++)
234 {
235 i.WriteU8 (0);
236 }
237}
238
240{
242
243 SetType (i.ReadU8 ());
244 SetLength (i.ReadU8 ());
245
246 return GetSerializedSize ();
247}
248
250
252{
253 static TypeId tid = TypeId ("ns3::dsr::DsrOptionRreqHeader")
255 .SetParent<DsrOptionHeader> ()
256 .SetGroupName ("Dsr")
257 ;
258 return tid;
259}
260
262{
263 return GetTypeId ();
264}
265
267 : m_ipv4Address (0)
268{
269 SetType (1);
270 SetLength (6 + m_ipv4Address.size () * 4);
271}
272
274{
275}
276
278{
279 m_ipv4Address.clear ();
280 m_ipv4Address.assign (n, Ipv4Address ());
281}
282
284{
285 return m_target;
286}
287
289{
290 m_target = target;
291}
292
294{
295 m_ipv4Address.push_back (ipv4);
296 SetLength (6 + m_ipv4Address.size () * 4);
297}
298
299void DsrOptionRreqHeader::SetNodesAddress (std::vector<Ipv4Address> ipv4Address)
300{
301 m_ipv4Address = ipv4Address;
302 SetLength (6 + m_ipv4Address.size () * 4);
303}
304
305std::vector<Ipv4Address> DsrOptionRreqHeader::GetNodesAddresses () const
306{
307 return m_ipv4Address;
308}
309
311{
312 return m_ipv4Address.size ();
313}
314
316{
317 m_ipv4Address.at (index) = addr;
318}
319
321{
322 return m_ipv4Address.at (index);
323}
324
325void DsrOptionRreqHeader::SetId (uint16_t identification)
326{
327 m_identification = identification;
328}
329
331{
332 return m_identification;
333}
334
335void DsrOptionRreqHeader::Print (std::ostream &os) const
336{
337 os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength () << "";
338
339 for (std::vector<Ipv4Address>::const_iterator it = m_ipv4Address.begin (); it != m_ipv4Address.end (); it++)
340 {
341 os << *it << " ";
342 }
343
344 os << ")";
345}
346
348{
349 return 8 + m_ipv4Address.size () * 4;
350}
351
353{
355 uint8_t buff[4];
356
357 i.WriteU8 (GetType ());
358 i.WriteU8 (GetLength ());
360 WriteTo (i, m_target);
361
362 for (VectorIpv4Address_t::const_iterator it = m_ipv4Address.begin (); it != m_ipv4Address.end (); it++)
363 {
364 it->Serialize (buff);
365 i.Write (buff, 4);
366 }
367}
368
370{
372 uint8_t buff[4];
373
374 SetType (i.ReadU8 ());
375 SetLength (i.ReadU8 ());
377 ReadFrom (i, m_target);
378
379 uint8_t index = 0;
380 for (std::vector<Ipv4Address>::iterator it = m_ipv4Address.begin (); it != m_ipv4Address.end (); it++)
381 {
382 i.Read (buff, 4);
383 m_address = it->Deserialize (buff);
384 SetNodeAddress (index, m_address);
385 ++index;
386 }
387
388 return GetSerializedSize ();
389}
390
392{
393 Alignment retVal = { 4, 0 };
394 return retVal;
395}
396
398
400{
401 static TypeId tid = TypeId ("ns3::dsr::DsrOptionRrepHeader")
403 .SetParent<DsrOptionHeader> ()
404 .SetGroupName ("Dsr")
405 ;
406 return tid;
407}
408
410{
411 return GetTypeId ();
412}
413
415 : m_ipv4Address (0)
416{
417 SetType (2);
418 SetLength (2 + m_ipv4Address.size () * 4);
419}
420
422{
423}
424
426{
427 m_ipv4Address.clear ();
428 m_ipv4Address.assign (n, Ipv4Address ());
429}
430
431void DsrOptionRrepHeader::SetNodesAddress (std::vector<Ipv4Address> ipv4Address)
432{
433 m_ipv4Address = ipv4Address;
434 SetLength (2 + m_ipv4Address.size () * 4);
435}
436
437std::vector<Ipv4Address> DsrOptionRrepHeader::GetNodesAddress () const
438{
439 return m_ipv4Address;
440}
441
443{
444 m_ipv4Address.at (index) = addr;
445}
446
448{
449 return m_ipv4Address.at (index);
450}
451
452Ipv4Address DsrOptionRrepHeader::GetTargetAddress (std::vector<Ipv4Address> ipv4Address) const
453{
454 return m_ipv4Address.at (ipv4Address.size () - 1);
455}
456
457void DsrOptionRrepHeader::Print (std::ostream &os) const
458{
459 os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength () << "";
460
461 for (std::vector<Ipv4Address>::const_iterator it = m_ipv4Address.begin (); it != m_ipv4Address.end (); it++)
462 {
463 os << *it << " ";
464 }
465
466 os << ")";
467}
468
470{
471 return 4 + m_ipv4Address.size () * 4;
472}
473
475{
477 uint8_t buff[4];
478
479 i.WriteU8 (GetType ());
480 i.WriteU8 (GetLength ());
481 i.WriteU8 (0);
482 i.WriteU8 (0);
483
484 for (VectorIpv4Address_t::const_iterator it = m_ipv4Address.begin (); it != m_ipv4Address.end (); it++)
485 {
486 it->Serialize (buff);
487 i.Write (buff, 4);
488 }
489}
490
492{
494 uint8_t buff[4];
495
496 SetType (i.ReadU8 ());
497 SetLength (i.ReadU8 ());
498 i.ReadU8 ();
499 i.ReadU8 ();
500
501 uint8_t index = 0;
502 for (std::vector<Ipv4Address>::iterator it = m_ipv4Address.begin (); it != m_ipv4Address.end (); it++)
503 {
504 i.Read (buff, 4);
505 m_address = it->Deserialize (buff);
506 SetNodeAddress (index, m_address);
507 ++index;
508 }
509
510 return GetSerializedSize ();
511}
512
514{
515 Alignment retVal = { 4, 0 };
516 return retVal;
517}
518
520
522{
523 static TypeId tid = TypeId ("ns3::dsr::DsrOptionSRHeader")
525 .SetParent<DsrOptionHeader> ()
526 .SetGroupName ("Dsr")
527 ;
528 return tid;
529}
530
532{
533 return GetTypeId ();
534}
535
537 : m_segmentsLeft (0),
538 m_ipv4Address (0)
539{
540 SetType (96);
541 SetLength (2 + m_ipv4Address.size () * 4);
542}
543
545{
546}
547
548void DsrOptionSRHeader::SetSegmentsLeft (uint8_t segmentsLeft)
549{
550 m_segmentsLeft = segmentsLeft;
551}
552
554{
555 return m_segmentsLeft;
556}
557
558void DsrOptionSRHeader::SetSalvage (uint8_t salvage)
559{
560 m_salvage = salvage;
561}
562
564{
565 return m_salvage;
566}
567
569{
570 m_ipv4Address.clear ();
571 m_ipv4Address.assign (n, Ipv4Address ());
572}
573
574void DsrOptionSRHeader::SetNodesAddress (std::vector<Ipv4Address> ipv4Address)
575{
576 m_ipv4Address = ipv4Address;
577 SetLength (2 + m_ipv4Address.size () * 4);
578}
579
580std::vector<Ipv4Address> DsrOptionSRHeader::GetNodesAddress () const
581{
582 return m_ipv4Address;
583}
584
586{
587 m_ipv4Address.at (index) = addr;
588}
589
591{
592 return m_ipv4Address.at (index);
593}
594
596{
597 return m_ipv4Address.size ();
598}
599
600void DsrOptionSRHeader::Print (std::ostream &os) const
601{
602 os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength () << "";
603
604 for (std::vector<Ipv4Address>::const_iterator it = m_ipv4Address.begin (); it != m_ipv4Address.end (); it++)
605 {
606 os << *it << " ";
607 }
608
609 os << ")";
610}
611
613{
614 return 4 + m_ipv4Address.size () * 4;
615}
616
618{
620 uint8_t buff[4];
621
622 i.WriteU8 (GetType ());
623 i.WriteU8 (GetLength ());
624 i.WriteU8 (m_salvage);
626
627 for (VectorIpv4Address_t::const_iterator it = m_ipv4Address.begin (); it != m_ipv4Address.end (); it++)
628 {
629 it->Serialize (buff);
630 i.Write (buff, 4);
631 }
632}
633
635{
637 uint8_t buff[4];
638
639 SetType (i.ReadU8 ());
640 SetLength (i.ReadU8 ());
641 m_salvage = i.ReadU8 ();
642 m_segmentsLeft = i.ReadU8 ();
643
644 uint8_t index = 0;
645 for (std::vector<Ipv4Address>::iterator it = m_ipv4Address.begin (); it != m_ipv4Address.end (); it++)
646 {
647 i.Read (buff, 4);
648 m_address = it->Deserialize (buff);
649 SetNodeAddress (index, m_address);
650 ++index;
651 }
652
653 return GetSerializedSize ();
654}
655
657{
658 Alignment retVal = { 4, 0 };
659 return retVal;
660}
661
663
665{
666 static TypeId tid = TypeId ("ns3::dsr::DsrOptionRerrHeader")
668 .SetParent<DsrOptionHeader> ()
669 .SetGroupName ("Dsr")
670 ;
671 return tid;
672}
673
675{
676 return GetTypeId ();
677}
678
680 : m_errorType (0),
681 m_salvage (0),
682 m_errorLength (4)
683{
684 SetType (3);
685 SetLength (18);
686}
687
689{
690}
691
692void DsrOptionRerrHeader::SetErrorType (uint8_t errorType)
693{
694 m_errorType = errorType;
695}
696
698{
699 return m_errorType;
700}
701
703{
704 m_salvage = salvage;
705}
706
708{
709 return m_salvage;
710}
711
713{
714 m_errorSrcAddress = errorSrcAddress;
715}
716
718{
719 return m_errorSrcAddress;
720}
721
723{
724 m_errorDstAddress = errorDstAddress;
725}
726
728{
729 return m_errorDstAddress;
730}
731
732void DsrOptionRerrHeader::Print (std::ostream &os) const
733{
734 os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength ()
735 << " errorType = " << (uint32_t)m_errorType << " salvage = " << (uint32_t)m_salvage
736 << " error source = " << m_errorSrcAddress << " error dst = " << m_errorDstAddress << " )";
737
738}
739
741{
742 return 20;
743}
744
746{
748
749 i.WriteU8 (GetType ());
750 i.WriteU8 (GetLength ());
752 i.WriteU8 (m_salvage);
756}
757
759{
761
762 SetType (i.ReadU8 ());
763 SetLength (i.ReadU8 ());
764 m_errorType = i.ReadU8 ();
765 m_salvage = i.ReadU8 ();
768
769 m_errorData = Buffer ();
771 Buffer::Iterator dataStart = i;
773 Buffer::Iterator dataEnd = i;
774 m_errorData.Begin ().Write (dataStart, dataEnd);
775
776 return GetSerializedSize ();
777}
778
780{
781 Alignment retVal = { 4, 0 };
782 return retVal;
783}
784
786
788{
789 static TypeId tid = TypeId ("ns3::dsr::DsrOptionRerrUnreachHeader")
791 .SetParent<DsrOptionRerrHeader> ()
792 .SetGroupName ("Dsr")
793 ;
794 return tid;
795}
796
798{
799 return GetTypeId ();
800}
801
803 : m_salvage (0)
804{
805 SetType (3);
806 SetLength (18);
807 SetErrorType (1);
808}
809
811{
812}
813
815{
816 m_salvage = salvage;
817}
818
820{
821 return m_salvage;
822}
823
825{
826 m_errorSrcAddress = errorSrcAddress;
827}
828
830{
831 return m_errorSrcAddress;
832}
833
835{
836 m_errorDstAddress = errorDstAddress;
837}
838
840{
841 return m_errorDstAddress;
842}
843
845{
846 m_unreachNode = unreachNode;
847}
848
850{
851 return m_unreachNode;
852}
853
855{
856 m_originalDst = originalDst;
857}
858
860{
861 return m_originalDst;
862}
863
864void DsrOptionRerrUnreachHeader::Print (std::ostream &os) const
865{
866 os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength ()
867 << " errorType = " << (uint32_t)m_errorType << " salvage = " << (uint32_t)m_salvage
868 << " error source = " << m_errorSrcAddress << " error dst = " << m_errorDstAddress
869 << " unreach node = " << m_unreachNode << " )";
870}
871
873{
874 return 20;
875}
876
878{
880
881 i.WriteU8 (GetType ());
882 i.WriteU8 (GetLength ());
883 i.WriteU8 (GetErrorType ());
884 i.WriteU8 (m_salvage);
889}
890
892{
894
895 SetType (i.ReadU8 ());
896 SetLength (i.ReadU8 ());
897 SetErrorType (i.ReadU8 ());
898 m_salvage = i.ReadU8 ();
903
904 return GetSerializedSize ();
905}
906
908{
909 Alignment retVal = { 4, 0 };
910 return retVal;
911}
912
914
916{
917 static TypeId tid = TypeId ("ns3::dsr::DsrOptionRerrUnsupportHeader")
919 .SetParent<DsrOptionRerrHeader> ()
920 .SetGroupName ("Dsr")
921 ;
922 return tid;
923}
924
926{
927 return GetTypeId ();
928}
929
931 : m_salvage (0)
932{
933 SetType (3);
934 SetLength (14);
935 SetErrorType (3);
936}
937
939{
940}
941
943{
944 m_salvage = salvage;
945}
946
948{
949 return m_salvage;
950}
951
953{
954 m_errorSrcAddress = errorSrcAddress;
955}
956
958{
959 return m_errorSrcAddress;
960}
961
963{
964 m_errorDstAddress = errorDstAddress;
965}
966
968{
969 return m_errorDstAddress;
970}
971
973{
974 m_unsupport = unsupport;
975}
976
978{
979 return m_unsupport;
980}
981
982void DsrOptionRerrUnsupportHeader::Print (std::ostream &os) const
983{
984 os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength ()
985 << " errorType = " << (uint32_t)m_errorType << " salvage = " << (uint32_t)m_salvage
986 << " error source = " << m_errorSrcAddress << " error dst = " << m_errorDstAddress
987 << " unsupported option = " << m_unsupport << " )";
988
989}
990
992{
993 return 16;
994}
995
997{
999
1000 i.WriteU8 (GetType ());
1001 i.WriteU8 (GetLength ());
1002 i.WriteU8 (GetErrorType ());
1003 i.WriteU8 (m_salvage);
1007
1008}
1009
1011{
1013
1014 SetType (i.ReadU8 ());
1015 SetLength (i.ReadU8 ());
1016 SetErrorType (i.ReadU8 ());
1017 m_salvage = i.ReadU8 ();
1020 m_unsupport = i.ReadU16 ();
1021
1022 return GetSerializedSize ();
1023}
1024
1026{
1027 Alignment retVal = { 4, 0 };
1028 return retVal;
1029}
1030
1032
1034{
1035 static TypeId tid = TypeId ("ns3::dsr::DsrOptionAckReqHeader")
1037 .SetParent<DsrOptionHeader> ()
1038 .SetGroupName ("Dsr")
1039 ;
1040 return tid;
1041}
1042
1044{
1045 return GetTypeId ();
1046}
1047
1049 : m_identification (0)
1050
1051{
1052 SetType (160);
1053 SetLength (2);
1054}
1055
1057{
1058}
1059
1060void DsrOptionAckReqHeader::SetAckId (uint16_t identification)
1061{
1062 m_identification = identification;
1063}
1064
1066{
1067 return m_identification;
1068}
1069
1070void DsrOptionAckReqHeader::Print (std::ostream &os) const
1071{
1072 os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength ()
1073 << " id = " << m_identification << " )";
1074}
1075
1077{
1078 return 4;
1079}
1080
1082{
1084
1085 i.WriteU8 (GetType ());
1086 i.WriteU8 (GetLength ());
1088}
1089
1091{
1093
1094 SetType (i.ReadU8 ());
1095 SetLength (i.ReadU8 ());
1097
1098 return GetSerializedSize ();
1099}
1100
1102{
1103 Alignment retVal = { 4, 0 };
1104 return retVal;
1105}
1106
1108
1110{
1111 static TypeId tid = TypeId ("ns3::dsr::DsrOptionAckHeader")
1113 .SetParent<DsrOptionHeader> ()
1114 .SetGroupName ("Dsr")
1115 ;
1116 return tid;
1117}
1118
1120{
1121 return GetTypeId ();
1122}
1123
1125 : m_identification (0)
1126{
1127 SetType (32);
1128 SetLength (10);
1129}
1130
1132{
1133}
1134
1135void DsrOptionAckHeader::SetAckId (uint16_t identification)
1136{
1137 m_identification = identification;
1138}
1139
1141{
1142 return m_identification;
1143}
1144
1146{
1147 m_realSrcAddress = realSrcAddress;
1148}
1149
1151{
1152 return m_realSrcAddress;
1153}
1154
1156{
1157 m_realDstAddress = realDstAddress;
1158}
1159
1161{
1162 return m_realDstAddress;
1163}
1164
1165void DsrOptionAckHeader::Print (std::ostream &os) const
1166{
1167 os << "( type = " << (uint32_t)GetType () << " length = " << (uint32_t)GetLength ()
1168 << " id = " << m_identification << " real src = " << m_realSrcAddress
1169 << " real dst = " << m_realDstAddress << " )";
1170
1171}
1172
1174{
1175 return 12;
1176}
1177
1179{
1181
1182 i.WriteU8 (GetType ());
1183 i.WriteU8 (GetLength ());
1187}
1188
1190{
1192
1193 SetType (i.ReadU8 ());
1194 SetLength (i.ReadU8 ());
1198
1199 return GetSerializedSize ();
1200}
1201
1203{
1204 Alignment retVal = { 4, 0 };
1205 return retVal;
1206}
1207} /* namespace dsr */
1208} /* namespace ns3 */
iterator in a Buffer instance
Definition: buffer.h:99
void Write(uint8_t const *buffer, uint32_t size)
Definition: buffer.cc:954
uint16_t ReadNtohU16(void)
Definition: buffer.h:946
void WriteU8(uint8_t data)
Definition: buffer.h:869
void Next(void)
go forward by one byte
Definition: buffer.h:845
void WriteU16(uint16_t data)
Definition: buffer.cc:871
uint16_t ReadU16(void)
Definition: buffer.h:1029
uint8_t ReadU8(void)
Definition: buffer.h:1021
void Read(uint8_t *buffer, uint32_t size)
Definition: buffer.cc:1124
void WriteHtonU16(uint16_t data)
Definition: buffer.h:905
automatically resized byte buffer
Definition: buffer.h:93
void AddAtEnd(uint32_t end)
Definition: buffer.cc:354
Buffer::Iterator End(void) const
Definition: buffer.h:1075
Buffer::Iterator Begin(void) const
Definition: buffer.h:1069
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
static Ipv4Address Deserialize(const uint8_t buf[4])
a unique identifier for an interface.
Definition: type-id.h:59
TypeId AddConstructor(void)
Record in this TypeId the fact that the default constructor is accessible.
Definition: type-id.h:638
Acknowledgement (ACK) Message Format.
void SetAckId(uint16_t identification)
Set the Ack id number.
virtual ~DsrOptionAckHeader()
Destructor.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
uint16_t GetAckId() const
Set the Ack id number.
uint16_t m_identification
identification field
static TypeId GetTypeId()
Get the type identificator.
void SetRealSrc(Ipv4Address realSrcAddress)
Set Error source ip address.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
void SetRealDst(Ipv4Address realDstAddress)
Set Error source ip address.
virtual void Print(std::ostream &os) const
Print some information about the packet.
Ipv4Address m_realDstAddress
ack destination address
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Ipv4Address GetRealDst() const
Get Error source ip address.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
Ipv4Address m_realSrcAddress
ack source address
Ipv4Address GetRealSrc() const
Get Error source ip address.
Acknowledgement Request (ACK_RREQ) Message Format.
virtual void Print(std::ostream &os) const
Print some information about the packet.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
void SetAckId(uint16_t identification)
Set the Ack request id number.
uint16_t m_identification
The identification field.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
uint16_t GetAckId() const
Set the Ack request id number.
virtual ~DsrOptionAckReqHeader()
Destructor.
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.
uint8_t GetType() const
Get the type of the option.
virtual ~DsrOptionHeader()
Destructor.
void SetType(uint8_t type)
Set the type of the option.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
uint8_t m_length
The option length.
uint8_t m_type
The type of the option.
virtual void Print(std::ostream &os) const
Print some information about the packet.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
void SetLength(uint8_t length)
Set the option length.
uint8_t GetLength() const
Get the option length.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Header of Dsr Option Pad1.
virtual ~DsrOptionPad1Header()
Destructor.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual void Print(std::ostream &os) const
Print some information about the packet.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
static TypeId GetTypeId()
Get the type identificator.
Header of Dsr Option Padn.
DsrOptionPadnHeader(uint32_t pad=2)
Constructor.
virtual void Print(std::ostream &os) const
Print some information about the packet.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual ~DsrOptionPadnHeader()
Destructor.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
static TypeId GetTypeId()
Get the type identificator.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Header of Dsr Option Route Error.
uint8_t GetErrorType() const
Get the route error type.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual void Print(std::ostream &os) const
Print some information about 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.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Ipv4Address m_errorSrcAddress
The error source address.
static TypeId GetTypeId()
Get the type identificator.
uint8_t m_salvage
The salavage field.
virtual ~DsrOptionRerrHeader()
Destructor.
virtual void SetErrorDst(Ipv4Address errorDstAddress)
Set the error destination ip address.
virtual Ipv4Address GetErrorDst() const
Get the error destination ip address.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
Ipv4Address m_errorDstAddress
The error destination address.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
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.
virtual void SetErrorSrc(Ipv4Address errorSrcAddress)
Set the route error source address.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
Route Error (RERR) Unreachable node address option Message Format.
void SetOriginalDst(Ipv4Address originalDst)
Set the unreachable node ip address.
virtual void SetErrorSrc(Ipv4Address errorSrcAddress)
Set the route error source address.
static TypeId GetTypeId()
Get the type identificator.
virtual void Print(std::ostream &os) const
Print some information about the packet.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
Ipv4Address m_unreachNode
The unreachable node address.
Ipv4Address GetOriginalDst() const
Get the unreachable node ip address.
void SetUnreachNode(Ipv4Address unreachNode)
Set the unreachable node ip address.
virtual void SetErrorDst(Ipv4Address errorDstAddress)
Set the error destination ip address.
virtual Ipv4Address GetErrorSrc() const
Get the route error source address.
virtual ~DsrOptionRerrUnreachHeader()
Destructor.
virtual uint8_t GetSalvage() const
Get the salvage value of the packet.
uint8_t m_errorType
The error type or route error option.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
virtual void SetSalvage(uint8_t salvage)
Set the salvage value of the packet.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
Ipv4Address m_errorSrcAddress
The error source address.
uint8_t m_salvage
The salavage field.
Ipv4Address m_originalDst
The original destination address.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
Ipv4Address m_errorDstAddress
The error destination address.
virtual Ipv4Address GetErrorDst() const
Get the error destination ip address.
Ipv4Address GetUnreachNode() const
Get the unreachable node ip address.
Route Error (RERR) Unsupported option Message Format.
virtual uint8_t GetSalvage() const
Get the salvage value of the packet.
virtual ~DsrOptionRerrUnsupportHeader()
Destructor.
static TypeId GetTypeId()
Get the type identificator.
virtual void SetSalvage(uint8_t salvage)
Set the salvage value of the packet.
void SetUnsupported(uint16_t optionType)
Set the unsupported option type value.
uint16_t m_unsupport
The unsupported option.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
Ipv4Address m_errorDstAddress
The error destination address.
virtual Ipv4Address GetErrorDst() const
Get the error destination ip address.
uint8_t m_errorType
The error type or route error option.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
uint16_t GetUnsupported() const
Get the unsupported option type value.
virtual void Print(std::ostream &os) const
Print some information about the packet.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual void SetErrorSrc(Ipv4Address errorSrcAddress)
Set the route error source address.
virtual void SetErrorDst(Ipv4Address errorDstAddress)
Set the error destination ip address.
virtual Ipv4Address GetErrorSrc() const
Get the route error source address.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
Ipv4Address m_errorSrcAddress
The error source address.
Route Reply (RREP) Message Format.
Ipv4Address GetTargetAddress(std::vector< Ipv4Address > ipv4Address) const
Get the target node Ip address.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
virtual void Print(std::ostream &os) const
Print some information about the packet.
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.
VectorIpv4Address_t m_ipv4Address
The vector of Nodes' IPv4 Address.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
static TypeId GetTypeId()
Get the type identificator.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
virtual ~DsrOptionRrepHeader()
Destructor.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual uint32_t GetSerializedSize() const
Get the serialized size of 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.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
Ipv4Address m_address
Ipv4 address to write when desearizing the packet.
void SetNodeAddress(uint8_t index, Ipv4Address addr)
Set a Node IPv4 Address.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
virtual ~DsrOptionRreqHeader()
Destructor.
Ipv4Address GetNodeAddress(uint8_t index) const
Get a Node IPv4 Address.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
uint16_t m_identification
Identifier of the packet.
void SetTarget(Ipv4Address target)
Set the target ipv4 address.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual void Print(std::ostream &os) const
Print some information about the packet.
Ipv4Address GetTarget()
Get the target ipv4 address.
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
std::vector< Ipv4Address > GetNodesAddresses() const
Get the vector of ipv4 address.
VectorIpv4Address_t m_ipv4Address
The vector of Nodes' IPv4 Address.
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.
virtual ~DsrOptionSRHeader()
Destructor.
uint8_t m_segmentsLeft
Number of left segments.
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.
virtual uint32_t GetSerializedSize() const
Get the serialized size of the packet.
void SetSalvage(uint8_t salvage)
Set the salvage value for a packet.
VectorIpv4Address_t m_ipv4Address
The vector of Nodes' IPv4 Address.
virtual uint32_t Deserialize(Buffer::Iterator start)
Deserialize the packet.
virtual TypeId GetInstanceTypeId() const
Get the instance type ID.
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.
uint8_t GetSalvage() const
Get the salvage value for a packet.
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
virtual void Serialize(Buffer::Iterator start) const
Serialize 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.
virtual void Print(std::ostream &os) const
Print some information about the packet.
void SetNodesAddress(std::vector< Ipv4Address > ipv4Address)
Set the vector of ipv4 address.
uint8_t GetSegmentsLeft() const
Get the number of segments left to send.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:88
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
def start()
Definition: core.py:1852
represents the alignment requirements of an option header