A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
sixlowpan-header.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 Universita' di Firenze, Italy
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
7 * Michele Muccio <michelemuccio@virgilio.it>
8 */
9
10#ifndef SIXLOWPANHEADER_H_
11#define SIXLOWPANHEADER_H_
12
13#include "ns3/header.h"
14#include "ns3/icmpv6-header.h"
15#include "ns3/ipv6-address.h"
16
17namespace ns3
18{
19
20/**
21* @ingroup sixlowpan
22* @brief Dispatch header helper. This class only purpose is to interpret
23* the Dispatch header into its correct type.
24*
25* The dispatch type is defined by a zero bit as the first bit and a one
26* bit as the second bit.
27 @verbatim
28 1 2 3
29 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
30 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31 |0 1| Dispatch | type-specific header
32 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33 @endverbatim
34*/
36{
37 public:
38 /**
39 * @brief Dispatch values, as defined in \RFC{4944} and \RFC{6282}
40 @verbatim
41 Pattern Header Type
42 +------------+------------------------------------------------+
43 | 00 xxxxxx | NALP - Not a LoWPAN frame |
44 | 01 000000 | ESC - Additional Dispatch byte follows |
45 | 01 000001 | IPv6 - Uncompressed IPv6 Addresses |
46 | 01 000010 | LOWPAN_HC1 - LOWPAN_HC1 compressed IPv6 |
47 | 01 000011 | reserved - Reserved for future use |
48 | ... | reserved - Reserved for future use |
49 | 01 001111 | reserved - Reserved for future use |
50 | 01 010000 | LOWPAN_BC0 - LOWPAN_BC0 broadcast |
51 | 01 010001 | reserved - Reserved for future use |
52 | ... | reserved - Reserved for future use |
53 | 01 1xxxxx | LOWPAN_IPHC - LOWPAN_IPHC compressed IPv6 |
54 | 10 xxxxxx | MESH - Mesh Header |
55 | 11 000xxx | FRAG1 - Fragmentation Header (first) |
56 | 11 001000 | reserved - Reserved for future use |
57 | ... | reserved - Reserved for future use |
58 | 11 011111 | reserved - Reserved for future use |
59 | 11 100xxx | FRAGN - Fragmentation Header (subsequent)|
60 | 11 101000 | reserved - Reserved for future use |
61 | ... | reserved - Reserved for future use |
62 | 11 111111 | reserved - Reserved for future use |
63 +------------+------------------------------------------------+
64 @endverbatim
65 */
83
84 /**
85 * @brief Dispatch values for Next Header compression.
86 *
87 * The dispatch values reflect the dispatch use, since
88 * some dispatch bits carry actual header compression bits.
89 */
98
100
101 /**
102 * @brief Get the Dispatch type.
103 * @param [in] dispatch The dispatch value.
104 * @return The Dispatch type.
105 */
106 static Dispatch_e GetDispatchType(uint8_t dispatch);
107
108 /**
109 * @brief Get the NhcDispatch type.
110 * @param [in] dispatch The dispatch value.
111 * @return The NhcDispatch type.
112 */
113 static NhcDispatch_e GetNhcDispatchType(uint8_t dispatch);
114};
115
116/**
117 * @ingroup sixlowpan
118 * @brief 6LoWPAN HC1 header - see \RFC{4944}.
119 */
120class SixLowPanHc1 : public Header
121{
122 public:
123 /**
124 * @brief Kind of address compression.
125 *
126 * The address compression is handled in 4 bits and might mean:
127 * PI: Prefix inline, PC: Prefix Compressed,
128 * II: Interface Identifier, Inline, IC: Interface Identifier Compressed.
129 */
131 {
132 HC1_PIII = 0x00,
133 HC1_PIIC = 0x01,
134 HC1_PCII = 0x02,
135 HC1_PCIC = 0x03
136 };
137
138 /**
139 * @brief Next header information.
140 *
141 * The Next header compression is handled in 4 bits and might mean:
142 * NC: Not Compressed, UDP, ICMP or TCP.
143 */
145 {
146 HC1_NC = 0x00,
147 HC1_UDP = 0x01,
148 HC1_ICMP = 0x02,
149 HC1_TCP = 0x03
150 };
151
152 SixLowPanHc1();
153
154 /**
155 * @brief Get the type ID.
156 * @return The object TypeId.
157 */
158 static TypeId GetTypeId();
159
160 /**
161 * @brief Return the instance type identifier.
162 * @return Instance type ID.
163 */
164
165 TypeId GetInstanceTypeId() const override;
166
167 void Print(std::ostream& os) const override;
168
169 /**
170 * @brief Get the serialized size of the packet.
171 * @return Size.
172 */
173 uint32_t GetSerializedSize() const override;
174
175 /**
176 * @brief Serialize the packet.
177 * @param [in] start Buffer iterator.
178 */
179 void Serialize(Buffer::Iterator start) const override;
180
181 /**
182 * @brief Deserialize the packet.
183 * @param [in] start Buffer iterator.
184 * @return Size of the packet.
185 */
186 uint32_t Deserialize(Buffer::Iterator start) override;
187
188 /**
189 * @brief Set the "Hop limit" field (TTL).
190 * @param [in] limit The hop limit value.
191 */
192 void SetHopLimit(uint8_t limit);
193
194 /**
195 * @brief Get the "Hop limit" field (TTL).
196 * @return The hop limit value.
197 */
198 uint8_t GetHopLimit() const;
199
200 /**
201 * @brief Get Destination Compression type.
202 * @returns The kind of address compression.
203 */
204 LowPanHc1Addr_e GetDstCompression() const;
205
206 /**
207 * @brief Get the destination interface.
208 * @returns The destination interface.
209 */
210 const uint8_t* GetDstInterface() const;
211
212 /**
213 * @brief Get the destination prefix.
214 * @returns The destination prefix.
215 */
216 const uint8_t* GetDstPrefix() const;
217
218 /**
219 * @brief Get the Flow Label value.
220 * @returns The Flow Label.
221 */
222 uint32_t GetFlowLabel() const;
223
224 /**
225 * @brief Get the Next Header value.
226 * @returns The Next Header value.
227 */
228 uint8_t GetNextHeader() const;
229
230 /**
231 * @brief Get Source Compression type.
232 * @returns The kind of address compression.
233 */
234 LowPanHc1Addr_e GetSrcCompression() const;
235
236 /**
237 * @brief Get the source interface.
238 * @returns The source interface.
239 */
240 const uint8_t* GetSrcInterface() const;
241
242 /**
243 * @brief Get the source prefix.
244 * @returns The source prefix.
245 */
246 const uint8_t* GetSrcPrefix() const;
247
248 /**
249 * @brief Get the Traffic Class value.
250 * @returns The Traffic Class value.
251 */
252 uint8_t GetTrafficClass() const;
253
254 /**
255 * @brief Check if the Traffic Class and Flow Labels are compressed.
256 * @returns True if TC and FL are compressed.
257 */
258 bool IsTcflCompression() const;
259
260 /**
261 * @brief Check if there is a HC2 compressed header.
262 * @returns True if next header is HC2 compressed.
263 */
264 bool IsHc2HeaderPresent() const;
265
266 /**
267 * @brief Set Destination Compression type.
268 * @param [in] dstCompression The kind of address compression.
269 */
270 void SetDstCompression(LowPanHc1Addr_e dstCompression);
271
272 /**
273 * @brief Set the destination interface.
274 * @param [in] dstInterface The destination interface.
275 */
276 void SetDstInterface(const uint8_t* dstInterface);
277
278 /**
279 * @brief Set the destination prefix.
280 * @param [in] dstPrefix The destination prefix.
281 */
282 void SetDstPrefix(const uint8_t* dstPrefix);
283
284 /**
285 * @brief Set the Flow Label value.
286 * @param [in] flowLabel The Flow Label.
287 */
288 void SetFlowLabel(uint32_t flowLabel);
289
290 /**
291 * @brief Set the Next Header value.
292 * @param [in] nextHeader The Next Header value.
293 */
294 void SetNextHeader(uint8_t nextHeader);
295
296 /**
297 * @brief Set Source Compression type.
298 * @param [in] srcCompression The kind of address compression.
299 */
300 void SetSrcCompression(LowPanHc1Addr_e srcCompression);
301
302 /**
303 * @brief Set the source interface.
304 * @param [in] srcInterface The source interface.
305 */
306 void SetSrcInterface(const uint8_t* srcInterface);
307
308 /**
309 * @brief Set the source prefix.
310 * @param [in] srcPrefix The source prefix.
311 */
312 void SetSrcPrefix(const uint8_t* srcPrefix);
313
314 /**
315 * @brief Set the Traffic Class and Flow Labels as compressed.
316 * @param [in] tcflCompression True if TC and FL are compressed.
317 */
318 void SetTcflCompression(bool tcflCompression);
319
320 /**
321 * @brief Set the next header a HC2 compressed header.
322 * @param [in] hc2HeaderPresent True if next header is HC2 compressed.
323 */
324 void SetHc2HeaderPresent(bool hc2HeaderPresent);
325
326 /**
327 * @brief Set the Traffic Class value.
328 * @param [in] trafficClass The Traffic Class value.
329 */
330 void SetTrafficClass(uint8_t trafficClass);
331
332 private:
333 uint8_t m_hopLimit; //!< Hop Limit.
334 uint8_t m_srcPrefix[8]; //!< Source prefix.
335 uint8_t m_srcInterface[8]; //!< Source interface.
336 uint8_t m_dstPrefix[8]; //!< Destination prefix.
337 uint8_t m_dstInterface[8]; //!< Destination interface.
338 uint8_t m_trafficClass; //!< Traffic Class.
339 uint32_t m_flowLabel; //!< Flow Label.
340 uint8_t m_nextHeader; //!< Next header.
341 LowPanHc1Addr_e m_srcCompression; //!< Source compression type.
342 LowPanHc1Addr_e m_dstCompression; //!< Destination compression type.
343 bool m_tcflCompression; //!< Is TC and FL compressed.
344 LowPanHc1NextHeader_e m_nextHeaderCompression; //!< Next header compression.
345 bool m_hc2HeaderPresent; //!< Is next header HC2 compressed.
346};
347
348/**
349 * @brief Stream insertion operator.
350 *
351 * @param [in] os The reference to the output stream.
352 * @param [in] header The HC1 Header.
353 * @returns The reference to the output stream.
354 */
355std::ostream& operator<<(std::ostream& os, const SixLowPanHc1& header);
356
357/**
358 * @ingroup sixlowpan
359 * @brief 6LoWPAN FRAG1 header - see \RFC{4944}.
360 */
361class SixLowPanFrag1 : public Header
362{
363 public:
365
366 /**
367 * @brief Get the type ID.
368 * @return The object TypeId.
369 */
370 static TypeId GetTypeId();
371
372 /**
373 * @brief Return the instance type identifier.
374 * @return Instance type ID.
375 */
376 TypeId GetInstanceTypeId() const override;
377
378 void Print(std::ostream& os) const override;
379
380 /**
381 * @brief Get the serialized size of the packet.
382 * @return Size.
383 */
384 uint32_t GetSerializedSize() const override;
385
386 /**
387 * @brief Serialize the packet.
388 * @param [in] start Buffer iterator.
389 */
390 void Serialize(Buffer::Iterator start) const override;
391
392 /**
393 * @brief Deserialize the packet.
394 * @param [in] start Buffer iterator.
395 * @return Size of the packet.
396 */
397 uint32_t Deserialize(Buffer::Iterator start) override;
398
399 /**
400 * @brief Set the datagram size.
401 * @param [in] datagramSize The datagram size.
402 */
403 void SetDatagramSize(uint16_t datagramSize);
404
405 /**
406 * @brief Get the datagram size.
407 * @returns The datagram size.
408 */
409 uint16_t GetDatagramSize() const;
410
411 /**
412 * @brief Set the datagram tag.
413 * @param [in] datagramTag The datagram tag.
414 */
415 void SetDatagramTag(uint16_t datagramTag);
416
417 /**
418 * @brief Get the datagram tag.
419 * @returns The datagram tag.
420 */
421 uint16_t GetDatagramTag() const;
422
423 private:
424 uint16_t m_datagramSize; //!< Datagram size.
425 uint16_t m_datagramTag; //!< Datagram tag.
426};
427
428/**
429 * @brief Stream insertion operator.
430 *
431 * @param [in] os The reference to the output stream.
432 * @param [in] header The Frag1 Header.
433 * @returns The reference to the output stream.
434 */
435std::ostream& operator<<(std::ostream& os, const SixLowPanFrag1& header);
436
437/**
438 * @ingroup sixlowpan
439 * @brief 6LoWPAN FRAGN header - see \RFC{4944}.
440 */
441class SixLowPanFragN : public Header
442{
443 public:
445
446 /**
447 * @brief Get the type ID.
448 * @return The object TypeId.
449 */
450 static TypeId GetTypeId();
451
452 /**
453 * @brief Return the instance type identifier.
454 * @return Instance type ID.
455 */
456 TypeId GetInstanceTypeId() const override;
457
458 void Print(std::ostream& os) const override;
459
460 /**
461 * @brief Get the serialized size of the packet.
462 * @return Size.
463 */
464 uint32_t GetSerializedSize() const override;
465
466 /**
467 * @brief Serialize the packet.
468 * @param [in] start Buffer iterator.
469 */
470 void Serialize(Buffer::Iterator start) const override;
471
472 /**
473 * @brief Deserialize the packet.
474 * @param [in] start Buffer iterator.
475 * @return Size of the packet.
476 */
477 uint32_t Deserialize(Buffer::Iterator start) override;
478
479 /**
480 * @brief Set the datagram size.
481 * @param [in] datagramSize The datagram size.
482 */
483 void SetDatagramSize(uint16_t datagramSize);
484
485 /**
486 * @brief Get the datagram size.
487 * @returns The datagram size.
488 */
489 uint16_t GetDatagramSize() const;
490
491 /**
492 * @brief Set the datagram tag.
493 * @param [in] datagramTag The datagram tag.
494 */
495 void SetDatagramTag(uint16_t datagramTag);
496
497 /**
498 * @brief Get the datagram tag.
499 * @returns The datagram tag.
500 */
501 uint16_t GetDatagramTag() const;
502
503 /**
504 * @brief Set the datagram offset.
505 * @param [in] datagramOffset The datagram offset.
506 */
507 void SetDatagramOffset(uint8_t datagramOffset);
508
509 /**
510 * @brief Get the datagram offset.
511 * @returns The datagram offset.
512 */
513 uint8_t GetDatagramOffset() const;
514
515 private:
516 uint16_t m_datagramSize; //!< Datagram size.
517 uint16_t m_datagramTag; //!< Datagram tag.
518 uint8_t m_datagramOffset; //!< Datagram offset.
519};
520
521/**
522 * @brief Stream insertion operator.
523 *
524 * @param [in] os The reference to the output stream.
525 * @param [in] header The FragN Header.
526 * @returns The reference to the output stream.
527 */
528std::ostream& operator<<(std::ostream& os, const SixLowPanFragN& header);
529
530/**
531 * @ingroup sixlowpan
532 * @brief 6LoWPAN IPv6 uncompressed header - see \RFC{4944}.
533 */
534class SixLowPanIpv6 : public Header
535{
536 public:
538
539 /**
540 * @brief Get the type ID.
541 * @return The object TypeId.
542 */
543 static TypeId GetTypeId();
544
545 /**
546 * @brief Return the instance type identifier.
547 * @return Instance type ID.
548 */
549 TypeId GetInstanceTypeId() const override;
550
551 void Print(std::ostream& os) const override;
552
553 /**
554 * @brief Get the serialized size of the packet.
555 * @return Size.
556 */
557 uint32_t GetSerializedSize() const override;
558
559 /**
560 * @brief Serialize the packet.
561 * @param [in] start Buffer iterator.
562 */
563 void Serialize(Buffer::Iterator start) const override;
564
565 /**
566 * @brief Deserialize the packet.
567 * @param [in] start Buffer iterator.
568 * @return Size of the packet.
569 */
570 uint32_t Deserialize(Buffer::Iterator start) override;
571};
572
573/**
574 * @brief Stream insertion operator.
575 *
576 * @param [in] os The reference to the output stream.
577 * @param [in] header The Frag1 Header.
578 * @returns The reference to the output stream.
579 */
580std::ostream& operator<<(std::ostream& os, const SixLowPanIpv6& header);
581
582/**
583* @ingroup sixlowpan
584* @brief LOWPAN_IPHC base Encoding - see \RFC{6282}.
585 @verbatim
586 0 1
587 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
588 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
589 | 0 | 1 | 1 | TF |NH | HLIM |CID|SAC| SAM | M |DAC| DAM |
590 +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
591 @endverbatim
592*/
593class SixLowPanIphc : public Header
594{
595 public:
596 /**
597 * @brief TF: Traffic Class, Flow Label.
598 *
599 * 00: ECN + DSCP + 4-bit Pad + Flow Label (4 bytes)
600 * 01: ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided.
601 * 10: ECN + DSCP (1 byte), Flow Label is elided.
602 * 11: Traffic Class and Flow Label are elided.
603 *
604 */
612
613 /**
614 * @brief HLIM: Hop Limit.
615 *
616 * 00: The Hop Limit field is carried in-line.
617 * 01: The Hop Limit field is compressed and the hop limit is 1.
618 * 10: The Hop Limit field is compressed and the hop limit is 64.
619 * 11: The Hop Limit field is compressed and the hop limit is 255.
620 */
628
629 /**
630 * @brief Source or Destination Address Mode.
631 *
632 * 00: 128 bits.
633 * 01: 64 bits (or 48 bits if multicast).
634 * 10: 16 bits (or 32 bits if multicast).
635 * 11: Fully elided (or 8 bits if multicast).
636 */
644
646 /**
647 * @brief Constructor.
648 * @param [in] dispatch Dispatch value.
649 */
650 SixLowPanIphc(uint8_t dispatch);
651
652 /**
653 * @brief Get the type ID.
654 * @return The object TypeId.
655 */
656 static TypeId GetTypeId();
657
658 /**
659 * @brief Return the instance type identifier.
660 * @return Instance type ID.
661 */
662 TypeId GetInstanceTypeId() const override;
663
664 void Print(std::ostream& os) const override;
665
666 /**
667 * @brief Get the serialized size of the packet.
668 * @return Size.
669 */
670 uint32_t GetSerializedSize() const override;
671
672 /**
673 * @brief Serialize the packet.
674 * @param [in] start Buffer iterator.
675 */
676 void Serialize(Buffer::Iterator start) const override;
677
678 /**
679 * @brief Deserialize the packet.
680 * @param [in] start Buffer iterator.
681 * @return Size of the packet.
682 */
683 uint32_t Deserialize(Buffer::Iterator start) override;
684
685 /**
686 * @brief Set the TF (Traffic Class, Flow Label) compression.
687 * @param [in] tfField ECN, DSCP, Flow Label compression type.
688 */
689 void SetTf(TrafficClassFlowLabel_e tfField);
690
691 /**
692 * @brief Get the TF (Traffic Class, Flow Label) compression.
693 * @return The ECN, DSCP, Flow Label compression type.
694 */
696
697 /**
698 * @brief Set the NH (Next Header) compression.
699 * @param [in] nhField False (Next Header carried in-line), true (compressed NH).
700 */
701 void SetNh(bool nhField);
702
703 /**
704 * @brief Get the NH (Next Header) compression.
705 * @return False (Next Header carried in-line), true (compressed NH).
706 */
707 bool GetNh() const;
708
709 /**
710 * @brief Set the HLIM (Hop Limit) compression.
711 * @param [in] hlimField Hop Limit compression type
712 */
713 void SetHlim(Hlim_e hlimField);
714
715 /**
716 * @brief Get the HLIM (Hop Limit) compression.
717 * @return Hop Limit compression type.
718 */
719 Hlim_e GetHlim() const;
720
721 /**
722 * @brief Set the CID (Context Identifier Extension) compression.
723 * @param [in] cidField False (no CID present), true (CID follows).
724 */
725 void SetCid(bool cidField);
726
727 /**
728 * @brief Get the CID (Context Identifier Extension) compression.
729 * @return False (no CID present), true (CID follows).
730 */
731 bool GetCid() const;
732
733 /**
734 * @brief Set the SAC (Source Address Compression) compression.
735 * @param [in] sacField False (stateless), true (stateful).
736 */
737 void SetSac(bool sacField);
738
739 /**
740 * @brief Get the SAC (Source Address Compression) compression.
741 * @return False (stateless), true (stateful).
742 */
743 bool GetSac() const;
744
745 /**
746 * @brief Set the SAM (Source Address Mode) compression.
747 * @param [in] samField Depends on the SAC.
748 */
749 void SetSam(HeaderCompression_e samField);
750
751 /**
752 * @brief Get the SAM (Source Address Mode) compression.
753 * @return Depends on the SAC field.
754 */
756
757 /**
758 * brief Set the source address inline part
759 * @param srcInlinePart The inline portion of the compressed source address (16 bytes)
760 * @param size The number of inline bytes
761 */
762 void SetSrcInlinePart(uint8_t srcInlinePart[16], uint8_t size);
763
764 /**
765 * brief Get the source address inline part
766 * @return The inline portion of the compressed source address (16 bytes)
767 */
768 const uint8_t* GetSrcInlinePart() const;
769
770 /**
771 * @brief Set the M (Multicast) compression.
772 * @param [in] mField True if destination is multicast.
773 */
774 void SetM(bool mField);
775
776 /**
777 * @brief Get the M (Multicast) compression.
778 * @return True if destination is multicast.
779 */
780 bool GetM() const;
781
782 /**
783 * @brief Set the DAC (Destination Address Compression) compression.
784 * @param [in] dacField False (stateless), true (stateful).
785 */
786 void SetDac(bool dacField);
787
788 /**
789 * @brief Get the DAC (Destination Address Compression) compression.
790 * @return False (stateless), true (stateful).
791 */
792 bool GetDac() const;
793
794 /**
795 * @brief Set the DAM (Destination Address Mode) compression.
796 * @param [in] damField Depends on the DAC and M fields.
797 */
798 void SetDam(HeaderCompression_e damField);
799
800 /**
801 * @brief Get the DAM (Destination Address Mode) compression.
802 * @return Depends on the DAC and M fields.
803 */
805
806 /**
807 * brief Set the destination address inline part
808 * @param dstInlinePart The inline portion of the compressed destination address (16 bytes)
809 * @param size The number of inline bytes
810 */
811 void SetDstInlinePart(uint8_t dstInlinePart[16], uint8_t size);
812
813 /**
814 * brief Get the destination address inline part
815 * @return The inline portion of the compressed destination address (16 bytes)
816 */
817 const uint8_t* GetDstInlinePart() const;
818
819 /**
820 * @brief Set the SrcContextId.
821 * @param [in] srcContextId Valid values are [0:15].
822 */
823 void SetSrcContextId(uint8_t srcContextId);
824
825 /**
826 * @brief Get the SrcContextId.
827 * @return The SrcContextId.
828 */
829 uint8_t GetSrcContextId() const;
830
831 /**
832 * @brief Set the DstContextId.
833 * @param [in] dstContextId Valid values are [0:15].
834 */
835 void SetDstContextId(uint8_t dstContextId);
836
837 /**
838 * @brief Get the DstContextId.
839 * @return The DstContextId.
840 */
841 uint8_t GetDstContextId() const;
842
843 /**
844 * @brief Set the ECN (2bits).
845 * @param [in] ecn Valid values are [0:3].
846 */
847 void SetEcn(uint8_t ecn);
848
849 /**
850 * @brief Get the ECN.
851 * @return The ECN.
852 */
853 uint8_t GetEcn() const;
854
855 /**
856 * @brief Set the DSCP (6bits).
857 * @param [in] dscp Valid values are [0:63].
858 */
859 void SetDscp(uint8_t dscp);
860
861 /**
862 * @brief Get the DSCP.
863 * @return The DSCP.
864 */
865 uint8_t GetDscp() const;
866
867 /**
868 * @brief Set the Flow Label (20bits).
869 * @param [in] flowLabel Valid values are 20 bits long.
870 */
871 void SetFlowLabel(uint32_t flowLabel);
872
873 /**
874 * @brief Get the Flow Label.
875 * @return The Flow Label.
876 */
877 uint32_t GetFlowLabel() const;
878
879 /**
880 * @brief Set the Next Header field.
881 * @param [in] nextHeader Next Header field.
882 */
883 void SetNextHeader(uint8_t nextHeader);
884
885 /**
886 * @brief Get the Next Header field.
887 * @return The Next Header field.
888 */
889 uint8_t GetNextHeader() const;
890
891 /**
892 * @brief Set the Hop Limit field.
893 * @param [in] hopLimit Hop Limit field.
894 */
895 void SetHopLimit(uint8_t hopLimit);
896
897 /**
898 * @brief Get the Hop Limit field.
899 * @return The Hop Limit field.
900 */
901 uint8_t GetHopLimit() const;
902
903 private:
904 uint16_t m_baseFormat; //!< Dispatch + encoding fields.
905 uint8_t m_srcdstContextId; //!< Src and Dst Context ID.
906 uint8_t m_ecn : 2; //!< ECN bits.
907 uint8_t m_dscp : 6; //!< DSCP bits.
908 uint32_t m_flowLabel : 20; //!< Flow Label bits.
909 uint8_t m_nextHeader; //!< Next header.
910 uint8_t m_hopLimit; //!< Hop Limit.
911 uint8_t m_srcInlinePart[16]; //!< source address inline part.
912 uint8_t m_dstInlinePart[16]; //!< destination address inline part.
913};
914
915/**
916 * @brief Stream insertion operator.
917 *
918 * @param [in] os The reference to the output stream.
919 * @param [in] header The IPHC Header.
920 * @returns The reference to the output stream.
921 */
922std::ostream& operator<<(std::ostream& os, const SixLowPanIphc& header);
923
924/**
925* @ingroup sixlowpan
926* @brief LOWPAN_NHC Extension Header Encoding - see \RFC{6282}.
927 @verbatim
928 0 1 2 3 4 5 6 7
929 +---+---+---+---+---+---+---+---+
930 | 1 | 1 | 1 | 0 | EID |NH |
931 +---+---+---+---+---+---+---+---+
932 @endverbatim
933*/
935{
936 public:
937 /**
938 * @brief EID: IPv6 Extension Header ID.
939 *
940 * EID: IPv6 Extension Header ID:
941 * 0: IPv6 Hop-by-Hop Options Header [\RFC{2460}]
942 * 1: IPv6 Routing Header [\RFC{2460}]
943 * 2: IPv6 Fragment Header [\RFC{2460}]
944 * 3: IPv6 Destination Options Header [\RFC{2460}]
945 * 4: IPv6 Mobility Header [\RFC{6275}]
946 * 5: Reserved
947 * 6: Reserved
948 * 7: IPv6 Header
949 */
959
961
962 /**
963 * @brief Get the type ID.
964 * @return The object TypeId.
965 */
966 static TypeId GetTypeId();
967
968 /**
969 * @brief Return the instance type identifier.
970 * @return Instance type ID.
971 */
972 TypeId GetInstanceTypeId() const override;
973
974 void Print(std::ostream& os) const override;
975
976 /**
977 * @brief Get the serialized size of the packet.
978 * @return Size.
979 */
980 uint32_t GetSerializedSize() const override;
981
982 /**
983 * @brief Serialize the packet.
984 * @param [in] start Buffer iterator.
985 */
986 void Serialize(Buffer::Iterator start) const override;
987
988 /**
989 * @brief Deserialize the packet.
990 * @param [in] start Buffer iterator.
991 * @return Size of the packet.
992 */
993 uint32_t Deserialize(Buffer::Iterator start) override;
994
995 /**
996 * @brief Get the NhcDispatch type.
997 * @return The NhcDispatch type.
998 */
1000
1001 /**
1002 * @brief Set the Extension Header Type.
1003 * @param [in] extensionHeaderType The Extension Header Type.
1004 */
1005 void SetEid(Eid_e extensionHeaderType);
1006
1007 /**
1008 * @brief Get the Extension Header Type.
1009 * @return The Extension Header Type.
1010 */
1011 Eid_e GetEid() const;
1012
1013 /**
1014 * @brief Set the Next Header field values.
1015 * @param [in] nextHeader The Next Header field value.
1016 */
1017 void SetNextHeader(uint8_t nextHeader);
1018
1019 /**
1020 * @brief Get the Next Header field value.
1021 * @return The Next Header field value.
1022 */
1023 uint8_t GetNextHeader() const;
1024
1025 /**
1026 * @brief Set the NH field values.
1027 * @param [in] nhField The NH field value.
1028 */
1029 void SetNh(bool nhField);
1030
1031 /**
1032 * @brief Get the Next Header field value.
1033 * @return The NH field value.
1034 */
1035 bool GetNh() const;
1036
1037 /**
1038 * @brief Set the option header data blob.
1039 * @param [in] blob A buffer holding the blob data.
1040 * @param [in] size The data blob size.
1041 */
1042 void SetBlob(const uint8_t* blob, uint32_t size);
1043
1044 /**
1045 * @brief Get the option header data blob.
1046 * @param [in] blob A buffer to copy the blob data into.
1047 * @param [in] size The size of the buffer.
1048 * @return The length of the copied data.
1049 */
1050 uint32_t CopyBlob(uint8_t* blob, uint32_t size) const;
1051
1052 private:
1053 uint8_t m_nhcExtensionHeader; //!< NHC extension header type.
1054 uint8_t m_nhcNextHeader; //!< Next header.
1055 uint8_t m_nhcBlobLength; //!< Length of the NHC compressed header.
1056 uint8_t m_nhcBlob[256]; //!< NHC compressed header.
1057};
1058
1059/**
1060 * @brief Stream insertion operator.
1061 *
1062 * @param [in] os The reference to the output stream.
1063 * @param [in] header The NHC Extension Header.
1064 * @returns The reference to the output stream.
1065 */
1066std::ostream& operator<<(std::ostream& os, const SixLowPanNhcExtension& header);
1067
1068/**
1069* @ingroup sixlowpan
1070* @brief UDP LOWPAN_NHC Extension Header Encoding - see \RFC{6282}.
1071 @verbatim
1072 0 1 2 3 4 5 6 7
1073 +---+---+---+---+---+---+---+---+
1074 | 1 | 1 | 1 | 1 | 0 | C | P |
1075 +---+---+---+---+---+---+---+---+
1076 @endverbatim
1077*/
1079{
1080 public:
1081 /**
1082 * @brief Ports:
1083 *
1084 * 00: 16 bits for both Source Port and Destination Port
1085 * 01: 16 bits for Source Port. Last 8 bits for Destination Port
1086 * 10: Last 8 bits for Source Port. All 16 bits for Destination Port
1087 * 11: Last 4 bits of both Source Port and Destination Port
1088 */
1096
1098
1099 /**
1100 * @brief Get the type ID.
1101 * @return The object TypeId.
1102 */
1103 static TypeId GetTypeId();
1104
1105 /**
1106 * @brief Return the instance type identifier.
1107 * @return Instance type ID.
1108 */
1109 TypeId GetInstanceTypeId() const override;
1110
1111 void Print(std::ostream& os) const override;
1112
1113 /**
1114 * @brief Get the serialized size of the packet.
1115 * @return Size.
1116 */
1117 uint32_t GetSerializedSize() const override;
1118
1119 /**
1120 * @brief Serialize the packet.
1121 * @param [in] start Buffer iterator.
1122 */
1123 void Serialize(Buffer::Iterator start) const override;
1124
1125 /**
1126 * @brief Deserialize the packet.
1127 * @param [in] start Buffer iterator.
1128 * @return Size of the packet.
1129 */
1130 uint32_t Deserialize(Buffer::Iterator start) override;
1131
1132 /**
1133 * @brief Get the NhcDispatch type.
1134 * @return The NhcDispatch type.
1135 */
1137
1138 /**
1139 * @brief Set the compressed Src and Dst Ports.
1140 * @param [in] port Src and Dst Ports.
1141 */
1142 void SetPorts(Ports_e port);
1143
1144 /**
1145 * @brief Get the compressed Src and Dst Ports.
1146 * @return The Src and Dst Ports.
1147 */
1148 Ports_e GetPorts() const;
1149
1150 /**
1151 * @brief Set the Source Port.
1152 * @param [in] port The Source Port.
1153 */
1154 void SetSrcPort(uint16_t port);
1155
1156 /**
1157 * @brief Get the Source Port.
1158 * @return The Source Port.
1159 */
1160 uint16_t GetSrcPort() const;
1161
1162 /**
1163 * @brief Set the Destination Port.
1164 * @param [in] port The Destination Port.
1165 */
1166 void SetDstPort(uint16_t port);
1167
1168 /**
1169 * @brief Get the Destination Port.
1170 * @return The Destination Port.
1171 */
1172 uint16_t GetDstPort() const;
1173
1174 /**
1175 * @brief Set the C (Checksum).
1176 * @param [in] cField False (All checksum carried in-line), true (Checksum elided).
1177 */
1178 void SetC(bool cField);
1179
1180 /**
1181 * @brief Get the C (Checksum).
1182 * @return False (All checksum carried in-line), true (Checksum elided).
1183 */
1184 bool GetC() const;
1185
1186 /**
1187 * @brief Set the Checksum field values.
1188 * @param [in] checksum The Checksum field value.
1189 */
1190 void SetChecksum(uint16_t checksum);
1191
1192 /**
1193 * @brief Get the Checksum field value.
1194 * @return The Checksum field value.
1195 */
1196 uint16_t GetChecksum() const;
1197
1198 private:
1199 uint8_t m_baseFormat; //!< Dispatch + encoding fields.
1200 uint16_t m_checksum; //!< Checksum.
1201 uint16_t m_srcPort; //!< Source port.
1202 uint16_t m_dstPort; //!< Destination port.
1203};
1204
1205/**
1206 * @brief Stream insertion operator.
1207 *
1208 * @param [in] os The reference to the output stream.
1209 * @param [in] header The UDP NHC Extension Header.
1210 * @returns The reference to the output stream.
1211 */
1212std::ostream& operator<<(std::ostream& os, const SixLowPanUdpNhcExtension& header);
1213
1214/**
1215 * @ingroup sixlowpan
1216 * @brief 6LoWPAN BC0 header - see \RFC{4944}.
1217 */
1218class SixLowPanBc0 : public Header
1219{
1220 public:
1221 SixLowPanBc0();
1222
1223 /**
1224 * @brief Get the type ID.
1225 * @return The object TypeId.
1226 */
1227 static TypeId GetTypeId();
1228
1229 /**
1230 * @brief Return the instance type identifier.
1231 * @return Instance type ID.
1232 */
1233 TypeId GetInstanceTypeId() const override;
1234
1235 void Print(std::ostream& os) const override;
1236
1237 /**
1238 * @brief Get the serialized size of the packet.
1239 * @return Size.
1240 */
1241 uint32_t GetSerializedSize() const override;
1242
1243 /**
1244 * @brief Serialize the packet.
1245 * @param [in] start Buffer iterator.
1246 */
1247 void Serialize(Buffer::Iterator start) const override;
1248
1249 /**
1250 * @brief Deserialize the packet.
1251 * @param [in] start Buffer iterator.
1252 * @return Size of the packet.
1253 */
1254 uint32_t Deserialize(Buffer::Iterator start) override;
1255
1256 /**
1257 * @brief Set the "Sequence Number" field.
1258 * @param [in] seqNumber The sequence number value.
1259 */
1260 void SetSequenceNumber(uint8_t seqNumber);
1261
1262 /**
1263 * @brief Get the "Sequence Number" field.
1264 * @return The sequence number value.
1265 */
1266 uint8_t GetSequenceNumber() const;
1267
1268 private:
1269 uint8_t m_seqNumber; //!< Sequence number.
1270};
1271
1272/**
1273 * @brief Stream insertion operator.
1274 *
1275 * @param [in] os The reference to the output stream.
1276 * @param [in] header The BC0 Extension Header.
1277 * @returns The reference to the output stream.
1278 */
1279std::ostream& operator<<(std::ostream& os, const SixLowPanBc0& header);
1280
1281/**
1282 * @ingroup sixlowpan
1283 * @brief 6LoWPAN Mesh header - see \RFC{4944}.
1284 */
1285class SixLowPanMesh : public Header
1286{
1287 public:
1288 SixLowPanMesh();
1289
1290 /**
1291 * @brief Get the type ID.
1292 * @return The object TypeId.
1293 */
1294 static TypeId GetTypeId();
1295
1296 /**
1297 * @brief Return the instance type identifier.
1298 * @return Instance type ID.
1299 */
1300 TypeId GetInstanceTypeId() const override;
1301
1302 void Print(std::ostream& os) const override;
1303
1304 /**
1305 * @brief Get the serialized size of the packet.
1306 * @return Size.
1307 */
1308 uint32_t GetSerializedSize() const override;
1309
1310 /**
1311 * @brief Serialize the packet.
1312 * @param [in] start Buffer iterator.
1313 */
1314 void Serialize(Buffer::Iterator start) const override;
1315
1316 /**
1317 * @brief Deserialize the packet.
1318 * @param [in] start Buffer iterator.
1319 * @return Size of the packet.
1320 */
1321 uint32_t Deserialize(Buffer::Iterator start) override;
1322
1323 /**
1324 * @brief Set the "Hops Left" field.
1325 * @param [in] hopsLeft The number of hops left.
1326 */
1327 void SetHopsLeft(uint8_t hopsLeft);
1328
1329 /**
1330 * @brief Get the "Hops Left" field.
1331 * @return The number of hops left.
1332 */
1333 uint8_t GetHopsLeft() const;
1334
1335 /**
1336 * @brief Set the "Originator" address.
1337 * @param [in] originator The Originator address (Mac64Address or Mac16Address).
1338 */
1339 void SetOriginator(Address originator);
1340
1341 /**
1342 * @brief Get the "Originator" address.
1343 * @return The Originator address (Mac64Address or Mac16Address).
1344 */
1345 Address GetOriginator() const;
1346
1347 /**
1348 * @brief Set the "Final Destination" address.
1349 * @param [in] finalDst The Final Destination address (Mac64Address or Mac16Address).
1350 */
1351 void SetFinalDst(Address finalDst);
1352
1353 /**
1354 * @brief Get the "Final Destination" address.
1355 * @return The Final Destination address (Mac64Address or Mac16Address).
1356 */
1357 Address GetFinalDst() const;
1358
1359 private:
1360 uint8_t m_hopsLeft; //!< Hops left.
1361 bool m_v; //!< True if Originator address is 16 bit
1362 bool m_f; //!< True if Destination address is 16 bit
1363 Address m_src; //!< Originator (source) address.
1364 Address m_dst; //!< Destination (final) address.
1365};
1366
1367/**
1368 * @brief Stream insertion operator.
1369 *
1370 * @param [in] os The reference to the output stream.
1371 * @param [in] header The Mesh Extension Header.
1372 * @returns The reference to the output stream.
1373 */
1374std::ostream& operator<<(std::ostream& os, const SixLowPanMesh& header);
1375
1376/**
1377 * @ingroup sixlowpan
1378 * @brief 6LoWPAN Capability Indication Option - see \RFC{7400}.
1379 */
1381{
1382 public:
1384
1385 /**
1386 * @brief Get the type ID.
1387 * @return The object TypeId.
1388 */
1389 static TypeId GetTypeId();
1390
1391 /**
1392 * @brief Return the instance type identifier.
1393 * @return Instance type ID.
1394 */
1395 TypeId GetInstanceTypeId() const override;
1396
1397 void Print(std::ostream& os) const override;
1398
1399 /**
1400 * @brief Get the serialized size of the packet.
1401 * @return Size.
1402 */
1403 uint32_t GetSerializedSize() const override;
1404
1405 /**
1406 * @brief Serialize the packet.
1407 * @param [in] start Buffer iterator.
1408 */
1409 void Serialize(Buffer::Iterator start) const override;
1410
1411 /**
1412 * @brief Deserialize the packet.
1413 * @param [in] start Buffer iterator.
1414 * @return Size of the packet.
1415 */
1416 uint32_t Deserialize(Buffer::Iterator start) override;
1417
1418 /**
1419 * @brief The Capability field bit.
1420 */
1422 {
1423 G = 0x01, /**< Generic Header Compression (GHC) capable (see \RFC{7400}) */
1424 E = 0x02, /**< The node is an IPv6 ND Registrar (see \RFC{8505}) */
1425 P = 0x04, /**< The node is a Routing Registrar (see \RFC{8505}) */
1426 B = 0x08, /**< The node is a 6LBR (see \RFC{8505}) */
1427 L = 0x10, /**< The node is a 6LR (see \RFC{8505}) */
1428 D = 0x20, /**< The 6LBR supports EDAR and EDAC messages (see \RFC{8505}) */
1429 };
1430
1431 /**
1432 * @brief Set an option.
1433 * @param [in] option The option to be set.
1434 */
1435 void SetOption(SixLowPanCapability_e option);
1436
1437 /**
1438 * @brief Checks an option.
1439 * @param [in] option The option to be checked.
1440 * @return True if the option is set, false otherwise.
1441 */
1442 bool CheckOption(SixLowPanCapability_e option) const;
1443
1444 private:
1445 uint8_t m_capabilityOptionField; //!< Capability options bitfield.
1446};
1447
1448/**
1449 * @brief Stream insertion operator.
1450 *
1451 * @param [in] os The reference to the output stream.
1452 * @param [in] header The Mesh Extension Header.
1453 * @returns The reference to the output stream.
1454 */
1455std::ostream& operator<<(std::ostream& os, const Icmpv6OptionSixLowPanCapabilityIndication& header);
1456
1457} // namespace ns3
1458
1459#endif /* SIXLOWPANHEADER_H_ */
a polymophic address class
Definition address.h:114
iterator in a Buffer instance
Definition buffer.h:98
Protocol header serialization and deserialization.
Definition header.h:36
Icmpv6OptionHeader()
Constructor.
6LoWPAN Capability Indication Option - see RFC 7400.
void SetOption(SixLowPanCapability_e option)
Set an option.
bool CheckOption(SixLowPanCapability_e option) const
Checks an option.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
@ P
The node is a Routing Registrar (see RFC 8505).
@ G
Generic Header Compression (GHC) capable (see RFC 7400).
@ B
The node is a 6LBR (see RFC 8505).
@ E
The node is an IPv6 ND Registrar (see RFC 8505).
@ D
The 6LBR supports EDAR and EDAC messages (see RFC 8505).
uint8_t m_capabilityOptionField
Capability options bitfield.
void Print(std::ostream &os) const override
Print information.
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
6LoWPAN BC0 header - see RFC 4944.
void Print(std::ostream &os) const override
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
void SetSequenceNumber(uint8_t seqNumber)
Set the "Sequence Number" field.
static TypeId GetTypeId()
Get the type ID.
uint8_t m_seqNumber
Sequence number.
uint8_t GetSequenceNumber() const
Get the "Sequence Number" field.
static Dispatch_e GetDispatchType(uint8_t dispatch)
Get the Dispatch type.
Dispatch_e
Dispatch values, as defined in RFC 4944 and RFC 6282.
static NhcDispatch_e GetNhcDispatchType(uint8_t dispatch)
Get the NhcDispatch type.
NhcDispatch_e
Dispatch values for Next Header compression.
6LoWPAN FRAG1 header - see RFC 4944.
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
static TypeId GetTypeId()
Get the type ID.
void SetDatagramSize(uint16_t datagramSize)
Set the datagram size.
void Print(std::ostream &os) const override
void SetDatagramTag(uint16_t datagramTag)
Set the datagram tag.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
uint16_t GetDatagramSize() const
Get the datagram size.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint16_t m_datagramTag
Datagram tag.
uint16_t GetDatagramTag() const
Get the datagram tag.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
uint16_t m_datagramSize
Datagram size.
6LoWPAN FRAGN header - see RFC 4944.
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint16_t m_datagramTag
Datagram tag.
void SetDatagramSize(uint16_t datagramSize)
Set the datagram size.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
static TypeId GetTypeId()
Get the type ID.
uint16_t GetDatagramTag() const
Get the datagram tag.
void SetDatagramTag(uint16_t datagramTag)
Set the datagram tag.
void SetDatagramOffset(uint8_t datagramOffset)
Set the datagram offset.
uint8_t GetDatagramOffset() const
Get the datagram offset.
uint8_t m_datagramOffset
Datagram offset.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
uint16_t GetDatagramSize() const
Get the datagram size.
uint16_t m_datagramSize
Datagram size.
void Print(std::ostream &os) const override
6LoWPAN HC1 header - see RFC 4944.
static TypeId GetTypeId()
Get the type ID.
void SetTcflCompression(bool tcflCompression)
Set the Traffic Class and Flow Labels as compressed.
uint8_t m_dstInterface[8]
Destination interface.
uint8_t GetHopLimit() const
Get the "Hop limit" field (TTL).
const uint8_t * GetSrcPrefix() const
Get the source prefix.
void SetFlowLabel(uint32_t flowLabel)
Set the Flow Label value.
uint8_t GetTrafficClass() const
Get the Traffic Class value.
void SetDstCompression(LowPanHc1Addr_e dstCompression)
Set Destination Compression type.
void SetTrafficClass(uint8_t trafficClass)
Set the Traffic Class value.
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
void SetHopLimit(uint8_t limit)
Set the "Hop limit" field (TTL).
LowPanHc1Addr_e
Kind of address compression.
uint8_t m_srcInterface[8]
Source interface.
uint8_t m_dstPrefix[8]
Destination prefix.
uint32_t GetFlowLabel() const
Get the Flow Label value.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
bool m_hc2HeaderPresent
Is next header HC2 compressed.
const uint8_t * GetSrcInterface() const
Get the source interface.
const uint8_t * GetDstPrefix() const
Get the destination prefix.
void SetHc2HeaderPresent(bool hc2HeaderPresent)
Set the next header a HC2 compressed header.
LowPanHc1NextHeader_e m_nextHeaderCompression
Next header compression.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
bool m_tcflCompression
Is TC and FL compressed.
uint32_t m_flowLabel
Flow Label.
void SetNextHeader(uint8_t nextHeader)
Set the Next Header value.
LowPanHc1Addr_e m_dstCompression
Destination compression type.
LowPanHc1NextHeader_e
Next header information.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
uint8_t m_hopLimit
Hop Limit.
void SetSrcCompression(LowPanHc1Addr_e srcCompression)
Set Source Compression type.
uint8_t m_srcPrefix[8]
Source prefix.
void SetDstInterface(const uint8_t *dstInterface)
Set the destination interface.
void SetDstPrefix(const uint8_t *dstPrefix)
Set the destination prefix.
const uint8_t * GetDstInterface() const
Get the destination interface.
LowPanHc1Addr_e m_srcCompression
Source compression type.
uint8_t m_nextHeader
Next header.
void Print(std::ostream &os) const override
void SetSrcPrefix(const uint8_t *srcPrefix)
Set the source prefix.
uint8_t GetNextHeader() const
Get the Next Header value.
void SetSrcInterface(const uint8_t *srcInterface)
Set the source interface.
uint8_t m_trafficClass
Traffic Class.
LowPanHc1Addr_e GetDstCompression() const
Get Destination Compression type.
bool IsHc2HeaderPresent() const
Check if there is a HC2 compressed header.
LowPanHc1Addr_e GetSrcCompression() const
Get Source Compression type.
bool IsTcflCompression() const
Check if the Traffic Class and Flow Labels are compressed.
LOWPAN_IPHC base Encoding - see RFC 6282.
bool GetSac() const
Get the SAC (Source Address Compression) compression.
void SetNextHeader(uint8_t nextHeader)
Set the Next Header field.
uint8_t GetNextHeader() const
Get the Next Header field.
void SetHlim(Hlim_e hlimField)
Set the HLIM (Hop Limit) compression.
void SetDstContextId(uint8_t dstContextId)
Set the DstContextId.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Hlim_e
HLIM: Hop Limit.
const uint8_t * GetSrcInlinePart() const
brief Get the source address inline part
uint8_t m_srcdstContextId
Src and Dst Context ID.
void SetSam(HeaderCompression_e samField)
Set the SAM (Source Address Mode) compression.
void SetNh(bool nhField)
Set the NH (Next Header) compression.
uint8_t GetDscp() const
Get the DSCP.
HeaderCompression_e
Source or Destination Address Mode.
HeaderCompression_e GetDam() const
Get the DAM (Destination Address Mode) compression.
uint8_t GetHopLimit() const
Get the Hop Limit field.
bool GetDac() const
Get the DAC (Destination Address Compression) compression.
uint8_t m_srcInlinePart[16]
source address inline part.
void SetEcn(uint8_t ecn)
Set the ECN (2bits).
uint8_t m_hopLimit
Hop Limit.
void SetFlowLabel(uint32_t flowLabel)
Set the Flow Label (20bits).
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void SetDscp(uint8_t dscp)
Set the DSCP (6bits).
uint32_t GetFlowLabel() const
Get the Flow Label.
void SetTf(TrafficClassFlowLabel_e tfField)
Set the TF (Traffic Class, Flow Label) compression.
uint8_t GetEcn() const
Get the ECN.
static TypeId GetTypeId()
Get the type ID.
void SetDam(HeaderCompression_e damField)
Set the DAM (Destination Address Mode) compression.
void SetCid(bool cidField)
Set the CID (Context Identifier Extension) compression.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Hlim_e GetHlim() const
Get the HLIM (Hop Limit) compression.
uint8_t m_dscp
DSCP bits.
void SetSac(bool sacField)
Set the SAC (Source Address Compression) compression.
bool GetNh() const
Get the NH (Next Header) compression.
void Print(std::ostream &os) const override
TrafficClassFlowLabel_e GetTf() const
Get the TF (Traffic Class, Flow Label) compression.
bool GetM() const
Get the M (Multicast) compression.
HeaderCompression_e GetSam() const
Get the SAM (Source Address Mode) compression.
uint8_t m_dstInlinePart[16]
destination address inline part.
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
void SetDstInlinePart(uint8_t dstInlinePart[16], uint8_t size)
brief Set the destination address inline part
void SetSrcContextId(uint8_t srcContextId)
Set the SrcContextId.
void SetSrcInlinePart(uint8_t srcInlinePart[16], uint8_t size)
brief Set the source address inline part
TrafficClassFlowLabel_e
TF: Traffic Class, Flow Label.
void SetM(bool mField)
Set the M (Multicast) compression.
uint16_t m_baseFormat
Dispatch + encoding fields.
uint8_t m_nextHeader
Next header.
const uint8_t * GetDstInlinePart() const
brief Get the destination address inline part
bool GetCid() const
Get the CID (Context Identifier Extension) compression.
uint8_t GetSrcContextId() const
Get the SrcContextId.
uint32_t m_flowLabel
Flow Label bits.
void SetHopLimit(uint8_t hopLimit)
Set the Hop Limit field.
uint8_t m_ecn
ECN bits.
uint8_t GetDstContextId() const
Get the DstContextId.
void SetDac(bool dacField)
Set the DAC (Destination Address Compression) compression.
6LoWPAN IPv6 uncompressed header - see RFC 4944.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
static TypeId GetTypeId()
Get the type ID.
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
void Print(std::ostream &os) const override
6LoWPAN Mesh header - see RFC 4944.
bool m_f
True if Destination address is 16 bit.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Address GetOriginator() const
Get the "Originator" address.
bool m_v
True if Originator address is 16 bit.
void SetHopsLeft(uint8_t hopsLeft)
Set the "Hops Left" field.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
void SetFinalDst(Address finalDst)
Set the "Final Destination" address.
uint8_t m_hopsLeft
Hops left.
Address m_src
Originator (source) address.
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
uint8_t GetHopsLeft() const
Get the "Hops Left" field.
static TypeId GetTypeId()
Get the type ID.
void Print(std::ostream &os) const override
Address GetFinalDst() const
Get the "Final Destination" address.
void SetOriginator(Address originator)
Set the "Originator" address.
Address m_dst
Destination (final) address.
LOWPAN_NHC Extension Header Encoding - see RFC 6282.
uint8_t m_nhcNextHeader
Next header.
uint8_t m_nhcBlob[256]
NHC compressed header.
SixLowPanDispatch::NhcDispatch_e GetNhcDispatchType() const
Get the NhcDispatch type.
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
bool GetNh() const
Get the Next Header field value.
uint8_t m_nhcExtensionHeader
NHC extension header type.
Eid_e GetEid() const
Get the Extension Header Type.
void SetNh(bool nhField)
Set the NH field values.
void SetEid(Eid_e extensionHeaderType)
Set the Extension Header Type.
uint8_t m_nhcBlobLength
Length of the NHC compressed header.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
void SetBlob(const uint8_t *blob, uint32_t size)
Set the option header data blob.
void Print(std::ostream &os) const override
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Eid_e
EID: IPv6 Extension Header ID.
uint32_t CopyBlob(uint8_t *blob, uint32_t size) const
Get the option header data blob.
uint8_t GetNextHeader() const
Get the Next Header field value.
void SetNextHeader(uint8_t nextHeader)
Set the Next Header field values.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
static TypeId GetTypeId()
Get the type ID.
UDP LOWPAN_NHC Extension Header Encoding - see RFC 6282.
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
uint8_t m_baseFormat
Dispatch + encoding fields.
Ports_e GetPorts() const
Get the compressed Src and Dst Ports.
uint16_t GetChecksum() const
Get the Checksum field value.
uint16_t GetDstPort() const
Get the Destination Port.
void SetPorts(Ports_e port)
Set the compressed Src and Dst Ports.
bool GetC() const
Get the C (Checksum).
static TypeId GetTypeId()
Get the type ID.
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
void Print(std::ostream &os) const override
void SetChecksum(uint16_t checksum)
Set the Checksum field values.
void SetDstPort(uint16_t port)
Set the Destination Port.
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
void SetSrcPort(uint16_t port)
Set the Source Port.
void SetC(bool cField)
Set the C (Checksum).
uint16_t m_dstPort
Destination port.
SixLowPanDispatch::NhcDispatch_e GetNhcDispatchType() const
Get the NhcDispatch type.
uint16_t GetSrcPort() const
Get the Source Port.
a unique identifier for an interface.
Definition type-id.h:50
uint16_t port
Definition dsdv-manet.cc:33
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148