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