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