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