A Discrete-Event Network Simulator
API
lr-wpan-mac-header.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 The Boeing Company
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: kwong yin <kwong-sang.yin@boeing.com>
19  */
20 #include "lr-wpan-mac-header.h"
21 #include <ns3/address-utils.h>
22 
23 namespace ns3 {
24 
25 NS_OBJECT_ENSURE_REGISTERED (LrWpanMacHeader);
26 
27 // TODO: Test Compressed PAN Id, Security Enabled, different size Key
28 
30 {
31  SetType (LRWPAN_MAC_DATA); // Assume Data frame
32  SetSecDisable (); // Assume there is No Aux Sec but
33  SetNoFrmPend (); // No Frame Pending
34  SetNoAckReq (); // No Ack Frame will be expected from recepient
35  SetNoPanIdComp (); // No PAN Id Compression since no addresses
36  SetFrmCtrlRes (0); // Initialize the 3 reserved bits to 0
37  SetDstAddrMode (NOADDR); // Assume there will be no src and dst address
39  SetFrameVer (1); //Indicates an IEEE 802.15.4 frame
40 }
41 
42 
44  uint8_t seqNum)
45 {
46  SetType (wpanMacType);
47  SetSeqNum (seqNum);
48  SetSecDisable (); // Assume there is No Aux Sec but
49  SetNoFrmPend (); // No Frame Pending
50  SetNoAckReq (); // No Ack Frame will be expected from recepient
51  SetNoPanIdComp (); // No PAN Id Compression since no addresses
52  SetFrmCtrlRes (0); // Initialize the 3 reserved bits to 0
53  SetDstAddrMode (NOADDR); // Assume there will be no src and dst address
55  SetFrameVer (1); //Indicates an IEEE 802.15.4 frame
56 }
57 
58 
60 {
61 }
62 
63 
66 {
67  switch (m_fctrlFrmType)
68  {
69  case 0:
70  return LRWPAN_MAC_BEACON;
71  break;
72  case 1:
73  return LRWPAN_MAC_DATA;
74  break;
75  case 2:
77  break;
78  case 3:
79  return LRWPAN_MAC_COMMAND;
80  break;
81  default:
82  return LRWPAN_MAC_RESERVED;
83  }
84 }
85 
86 
87 
88 uint16_t
90 {
91  uint16_t val = 0;
92 
93  val = m_fctrlFrmType & (0x07); // Bit 0-2
94  val |= (m_fctrlSecU << 3) & (0x01 << 3); // Bit 3
95  val |= (m_fctrlFrmPending << 4) & (0x01 << 4); // Bit 4
96  val |= (m_fctrlAckReq << 5) & (0x01 << 5); // Bit 5
97  val |= (m_fctrlPanIdComp << 6) & (0x01 << 6); // Bit 6
98  val |= (m_fctrlReserved << 7) & (0x07 << 7); // Bit 7-9
99  val |= (m_fctrlDstAddrMode << 10) & (0x03 << 10); // Bit 10-11
100  val |= (m_fctrlFrmVer << 12) & (0x03 << 12); // Bit 12-13
101  val |= (m_fctrlSrcAddrMode << 14) & (0x03 << 14); // Bit 14-15
102  return val;
103 
104 }
105 
106 bool
108 {
109  return (m_fctrlSecU == 1);
110 }
111 
112 bool
114 {
115  return (m_fctrlFrmPending == 1);
116 }
117 
118 bool
120 {
121  return (m_fctrlAckReq == 1);
122 }
123 
124 bool
126 {
127  return (m_fctrlPanIdComp == 1);
128 }
129 
130 uint8_t
132 {
133  return (m_fctrlReserved);
134 }
135 
136 uint8_t
138 {
139  return m_fctrlDstAddrMode;
140 }
141 
142 uint8_t
144 {
145  return m_fctrlFrmVer;
146 }
147 
148 uint8_t
150 {
151  return m_fctrlSrcAddrMode;
152 }
153 
154 
155 uint8_t
157 {
158  return(m_SeqNum);
159 }
160 
161 
162 uint16_t
164 {
165  return(m_addrDstPanId);
166 }
167 
168 
171 {
172  return(m_addrShortDstAddr);
173 }
176 {
177  return(m_addrExtDstAddr);
178 }
179 
180 uint16_t
182 {
183  return(m_addrSrcPanId);
184 }
185 
186 
187 
190 {
191  return(m_addrShortSrcAddr);
192 }
195 {
196  return(m_addrExtSrcAddr);
197 }
198 
199 
200 uint8_t
202 {
203  uint8_t val = 0;
204 
205  val = m_secctrlSecLevel & (0x7); // Bit 0-2
206  val |= (m_secctrlKeyIdMode << 3) & (0x3 << 3); // Bit 3-4
207  val |= (m_secctrlReserved << 5) & (0x7 << 5); // Bit 5-7
208 
209  return(val);
210 }
211 
212 uint32_t
214 {
215  return(m_auxFrmCntr);
216 }
217 
218 uint8_t
220 {
221  return (m_secctrlSecLevel);
222 }
223 
224 uint8_t
226 {
227  return(m_secctrlKeyIdMode);
228 }
229 
230 uint8_t
232 {
233  return (m_secctrlReserved);
234 }
235 
236 uint32_t
238 {
239  return(m_auxKeyIdKeySrc32);
240 }
241 
242 uint64_t
244 {
245 
246  return(m_auxKeyIdKeySrc64);
247 }
248 
249 uint8_t
251 {
252  return(m_auxKeyIdKeyIndex);
253 }
254 
255 
256 bool
258 {
260 }
261 
262 
263 
264 bool
266 {
267  return(m_fctrlFrmType == LRWPAN_MAC_DATA);
268 }
269 
270 
271 
272 bool
274 {
276 }
277 
278 
279 
280 bool
282 {
284 }
285 
286 
287 
288 void
290 {
291  m_fctrlFrmType = wpanMacType;
292 }
293 
294 
295 void
296 LrWpanMacHeader::SetFrameControl (uint16_t frameControl)
297 {
298  m_fctrlFrmType = (frameControl) & (0x07); // Bit 0-2
299  m_fctrlSecU = (frameControl >> 3) & (0x01); // Bit 3
300  m_fctrlFrmPending = (frameControl >> 4) & (0x01); // Bit 4
301  m_fctrlAckReq = (frameControl >> 5) & (0x01); // Bit 5
302  m_fctrlPanIdComp = (frameControl >> 6) & (0x01); // Bit 6
303  m_fctrlReserved = (frameControl >> 7) & (0x07); // Bit 7-9
304  m_fctrlDstAddrMode = (frameControl >> 10) & (0x03); // Bit 10-11
305  m_fctrlFrmVer = (frameControl >> 12) & (0x03); // Bit 12-13
306  m_fctrlSrcAddrMode = (frameControl >> 14) & (0x03); // Bit 14-15
307 }
308 
309 
310 void
312 {
313  m_fctrlSecU = 1;
314 }
315 
316 
317 void
319 {
320  m_fctrlSecU = 0;
321 }
322 
323 
324 void
326 {
327  m_fctrlFrmPending = 1;
328 }
329 
330 
331 void
333 {
334  m_fctrlFrmPending = 0;
335 }
336 
337 
338 void
340 {
341  m_fctrlAckReq = 1;
342 }
343 
344 
345 void
347 {
348  m_fctrlAckReq = 0;
349 }
350 
351 
352 void
354 {
355  m_fctrlPanIdComp = 1;
356 }
357 
358 
360 {
361  m_fctrlPanIdComp = 0;
362 }
363 
364 void
366 {
367  m_fctrlReserved = res;
368 }
369 
370 void
372 {
373  m_fctrlDstAddrMode = addrMode;
374 }
375 
376 
377 void
379 {
380  m_fctrlFrmVer = ver;
381 }
382 
383 
384 void
386 {
387  m_fctrlSrcAddrMode = addrMode;
388 }
389 
390 
391 void
393 {
394  m_SeqNum = seqNum;
395 }
396 
397 void
399  Mac16Address addr)
400 {
401  m_addrSrcPanId = panId;
402  m_addrShortSrcAddr = addr;
403 }
404 
405 void
407  Mac64Address addr)
408 {
409  m_addrSrcPanId = panId;
410  m_addrExtSrcAddr = addr;
411 }
412 
413 void
415  Mac16Address addr)
416 {
417  m_addrDstPanId = panId;
418  m_addrShortDstAddr = addr;
419 }
420 void
422  Mac64Address addr)
423 {
424  m_addrDstPanId = panId;
425  m_addrExtDstAddr = addr;
426 }
427 void
428 LrWpanMacHeader::SetSecControl (uint8_t secControl)
429 {
430  m_secctrlSecLevel = (secControl) & (0x07); // Bit 0-2
431  m_secctrlKeyIdMode = (secControl >> 3) & (0x03); // Bit 3-4
432  m_secctrlReserved = (secControl >> 5) & (0x07); // Bit 5-7
433 }
434 
435 void
437 {
438  m_auxFrmCntr = frmCntr;
439 }
440 
441 void
443 {
444  m_secctrlSecLevel = secLevel;
445 }
446 
447 void
448 LrWpanMacHeader::SetKeyIdMode (uint8_t keyIdMode)
449 {
450  m_secctrlKeyIdMode = keyIdMode;
451 }
452 
453 void
455 {
456  m_secctrlReserved = res;
457 }
458 
459 void
460 LrWpanMacHeader::SetKeyId (uint8_t keyIndex)
461 {
462  m_auxKeyIdKeyIndex = keyIndex;
463 }
464 
465 
466 void
467 LrWpanMacHeader::SetKeyId (uint32_t keySrc,
468  uint8_t keyIndex)
469 {
470  m_auxKeyIdKeyIndex = keyIndex;
471  m_auxKeyIdKeySrc32 = keySrc;
472 }
473 
474 
475 void
476 LrWpanMacHeader::SetKeyId (uint64_t keySrc,
477  uint8_t keyIndex)
478 {
479  m_auxKeyIdKeyIndex = keyIndex;
480  m_auxKeyIdKeySrc64 = keySrc;
481 }
482 
483 TypeId
485 {
486  static TypeId tid = TypeId ("ns3::LrWpanMacHeader")
487  .SetParent<Header> ()
488  .AddConstructor<LrWpanMacHeader> ();
489  return tid;
490 }
491 
492 TypeId
494 {
495  return GetTypeId ();
496 }
497 
498 void
499 LrWpanMacHeader::Print (std::ostream &os) const
500 {
501  os << " Frame Type = " << (uint32_t) m_fctrlFrmType << ", Sec Enable = " << (uint32_t) m_fctrlSecU
502  << ", Frame Pending = " << (uint32_t) m_fctrlFrmPending << ", Ack Request = " << (uint32_t) m_fctrlAckReq
503  << ", PAN ID Compress = " << (uint32_t) m_fctrlPanIdComp << ", Frame Vers = " << (uint32_t) m_fctrlFrmVer
504  << ", Dst Addrs Mode = " << (uint32_t) m_fctrlDstAddrMode << ", Src Addr Mode = " << (uint32_t) m_fctrlSrcAddrMode;
505 
506  os << ", Sequence Num = " << static_cast<uint16_t> (m_SeqNum);
507 
508  switch (m_fctrlDstAddrMode)
509  {
510  case NOADDR:
511  break;
512  case SHORTADDR:
513  os << ", Dst Addr Pan ID = " << static_cast<uint16_t> (m_addrDstPanId)
514  << ", m_addrShortDstAddr = " << m_addrShortDstAddr;
515  break;
516  case EXTADDR:
517  os << ", Dst Addr Pan ID = " << static_cast<uint16_t> (m_addrDstPanId)
518  << ", m_addrExtDstAddr = " << m_addrExtDstAddr;
519  break;
520  }
521 
522  switch (m_fctrlSrcAddrMode)
523  {
524  case NOADDR:
525  break;
526  case SHORTADDR:
527  os << ", Src Addr Pan ID = " << static_cast<uint16_t> (m_addrSrcPanId)
528  << ", m_addrShortSrcAddr = " << m_addrShortSrcAddr;
529  break;
530  case EXTADDR:
531  os << ", Src Addr Pan ID = " << static_cast<uint32_t> (m_addrSrcPanId)
532  << ", m_addrExtSrcAddr = " << m_addrExtDstAddr;
533  break;
534  }
535 
536  if (IsSecEnable ())
537  {
538  os << " Security Level = " << static_cast<uint32_t> (m_secctrlSecLevel)
539  << ", Key Id Mode = " << static_cast<uint32_t> (m_secctrlKeyIdMode)
540  << ", Frame Counter = " << static_cast<uint32_t> (m_auxFrmCntr);
541 
542  switch (m_secctrlKeyIdMode)
543  {
544  case IMPLICIT:
545  break;
546  case NOKEYSOURCE:
547  os << ", Key Id - Key Index = " << static_cast<uint32_t> (m_auxKeyIdKeyIndex);
548  break;
549  case SHORTKEYSOURCE:
550  os << ", Key Id - Key Source 32 =" << static_cast<uint32_t> (m_auxKeyIdKeySrc32)
551  << ", Key Id - Key Index = " << static_cast<uint32_t> (m_auxKeyIdKeyIndex);
552  break;
553  case LONGKEYSOURCE:
554  os << ", Key Id - Key Source 64 =" << static_cast<uint64_t> (m_auxKeyIdKeySrc64)
555  << ", Key Id - Key Index = " << static_cast<uint32_t> (m_auxKeyIdKeyIndex);
556  break;
557  }
558  }
559 }
560 
561 uint32_t
563 {
564  /*
565  * Each mac header will have
566  * Frame Control : 2 octet
567  * Sequence Number : 1 Octet
568  * Dst PAN Id : 0/2 Octet
569  * Dst Address : 0/2/8 octet
570  * Src PAN Id : 0/2 octet
571  * Src Address : 0/2/8 octet
572  * Aux Sec Header : 0/5/6/10/14 octet
573  */
574 
575  uint32_t size = 3;
576 
577  switch (m_fctrlDstAddrMode)
578  {
579  case NOADDR:
580  break;
581  case SHORTADDR:
582  size += 4;
583  break;
584  case EXTADDR:
585  size += 10;
586  break;
587  }
588 
589  switch (m_fctrlSrcAddrMode)
590  {
591  case NOADDR:
592  break;
593  case SHORTADDR:
594  // check if PAN Id compression is enabled
595  if (!IsPanIdComp ())
596  {
597  size += 4;
598  }
599  else
600  {
601  size += 2;
602  }
603  break;
604  case EXTADDR:
605  // check if PAN Id compression is enabled
606  if (!IsPanIdComp ())
607  {
608  size += 10;
609  }
610  else
611  {
612  size += 8;
613  }
614  break;
615  }
616 
617 
618  // check if security is enabled
619  if (IsSecEnable ())
620  {
621  size += 5;
622  switch (m_secctrlKeyIdMode)
623  {
624  case IMPLICIT:
625  break;
626  case NOKEYSOURCE:
627  size += 1;
628  break;
629  case SHORTKEYSOURCE:
630  size += 5;
631  break;
632  case LONGKEYSOURCE:
633  size += 9;
634  break;
635  }
636  }
637  return (size);
638 }
639 
640 
641 void
643 {
645  uint16_t frameControl = GetFrameControl ();
646 
647  i.WriteHtolsbU16 (frameControl);
648  i.WriteU8 (GetSeqNum ());
649 
650  switch (m_fctrlDstAddrMode)
651  {
652  case NOADDR:
653  break;
654  case SHORTADDR:
657  break;
658  case EXTADDR:
661  break;
662  }
663 
664  switch (m_fctrlSrcAddrMode)
665  {
666  case NOADDR:
667  break;
668  case SHORTADDR:
669  if (!IsPanIdComp ())
670  {
672  }
674  break;
675  case EXTADDR:
676  if (!IsPanIdComp ())
677  {
679  }
681  break;
682  }
683 
684  if (IsSecEnable ())
685  {
686  i.WriteU8 (GetSecControl ());
688 
689  switch (m_secctrlKeyIdMode)
690  {
691  case IMPLICIT:
692  break;
693  case NOKEYSOURCE:
694  i.WriteU8 (GetKeyIdIndex ());
695  break;
696  case SHORTKEYSOURCE:
698  i.WriteU8 (GetKeyIdIndex ());
699  break;
700  case LONGKEYSOURCE:
702  i.WriteU8 (GetKeyIdIndex ());
703  break;
704  }
705  }
706 }
707 
708 
709 uint32_t
711 {
712 
714  uint16_t frameControl = i.ReadLsbtohU16 ();
715  SetFrameControl (frameControl);
716 
717  SetSeqNum (i.ReadU8 ());
718  switch (m_fctrlDstAddrMode)
719  {
720  case NOADDR:
721  break;
722  case SHORTADDR:
725  break;
726  case EXTADDR:
729  break;
730  }
731 
732  switch (m_fctrlSrcAddrMode)
733  {
734  case NOADDR:
735  break;
736  case SHORTADDR:
737  if (!IsPanIdComp ())
738  {
740  }
741  else
742  {
743  if (m_fctrlDstAddrMode > 0)
744  {
746  }
747  }
749  break;
750  case EXTADDR:
751  if (!IsPanIdComp ())
752  {
754  }
755  else
756  {
757  if (m_fctrlDstAddrMode > 0)
758  {
760  }
761  }
763  break;
764  }
765 
766  if (IsSecEnable ())
767  {
768  SetSecControl (i.ReadU8 ());
770 
771  switch (m_secctrlKeyIdMode)
772  {
773  case IMPLICIT:
774  break;
775  case NOKEYSOURCE:
776  SetKeyId (i.ReadU8 ());
777  break;
778  case SHORTKEYSOURCE:
779  SetKeyId (i.ReadLsbtohU32 (),i.ReadU8 ());
780  break;
781  case LONGKEYSOURCE:
782  SetKeyId (i.ReadLsbtohU64 (),i.ReadU8 ());
783  break;
784  }
785  }
786  return i.GetDistanceFrom (start);
787 }
788 
789 // ----------------------------------------------------------------------------------------------------------
790 
791 
792 } //namespace ns3
793 
794 
Protocol header serialization and deserialization.
Definition: header.h:42
void SetNoFrmPend(void)
Set the Frame Control field "Frame Pending" bit to false.
uint8_t GetSecCtrlReserved(void) const
Get the Auxiliary Security Header - Security Control - Reserved bits.
void SetSecDisable(void)
Set the Frame Control field "Security Enabled" bit to false.
uint8_t m_fctrlDstAddrMode
Frame Control field Bit 10-11 = 0 - No DstAddr, 2 - ShtDstAddr, 3 - ExtDstAddr.
bool IsPanIdComp(void) const
Check if PAN ID Compression bit of Frame Control is enabled.
uint8_t m_fctrlSecU
Frame Control field Bit 3 = 0 - no AuxSecHdr , 1 - security enabled AuxSecHdr present.
uint8_t GetKeyIdMode(void) const
Get the Auxiliary Security Header - Security Control - Key Identifier Mode bits.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:44
void SetKeyId(uint8_t keyIndex)
Set the Key Index.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.
def start()
Definition: core.py:1482
uint32_t GetKeyIdSrc32(void) const
Get the Auxiliary Security Header - Key Identifier - Key Source (2 Octects)
void SetNoPanIdComp(void)
Set the Frame Control field "PAN ID Compression" bit to false.
void SetNoAckReq(void)
Set the Frame Control field "Ack. Request" bit to false.
uint8_t m_secctrlReserved
Auxiliary security header - Security Control field - Bit 5-7.
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
uint8_t m_secctrlKeyIdMode
Auxiliary security header - Security Control field - Bit 3-4 will indicate size of Key Id...
uint8_t GetSecLevel(void) const
Get the Auxiliary Security Header - Security Control - Security Level bits.
Mac16Address m_addrShortDstAddr
Dst Short addr (0 or 2 Octets)
void SetSeqNum(uint8_t seqNum)
Set the Sequence number.
uint16_t m_addrDstPanId
Dst PAN id (0 or 2 Octets)
bool IsBeacon(void) const
Returns true if the header is a beacon.
uint8_t m_fctrlFrmPending
Frame Control field Bit 4.
uint16_t m_addrSrcPanId
Src PAN id (0 or 2 Octets)
Mac16Address GetShortSrcAddr(void) const
Get the Source Short address.
void SetAckReq(void)
Set the Frame Control field "Ack. Request" bit to true.
void SetFrmCounter(uint32_t frmCntr)
Set the auxiliary security header "Frame Counter" octet.
uint32_t GetDistanceFrom(Iterator const &o) const
Definition: buffer.cc:811
iterator in a Buffer instance
Definition: buffer.h:98
void SetSrcAddrFields(uint16_t panId, Mac16Address addr)
Set Source address fields.
an EUI-64 address
Definition: mac64-address.h:43
bool IsData(void) const
Returns true if the header is a data.
void SetKeyIdMode(uint8_t keyIdMode)
Set the Security Control field "Key Identifier Mode" bits (2 bits)
uint8_t GetFrmCtrlRes(void) const
Get the Reserved bits of Frame control field.
void Serialize(Buffer::Iterator start) const
uint32_t m_auxKeyIdKeySrc32
Auxiliary security header - Key Source (4 Octets)
void SetSecCtrlReserved(uint8_t res)
Set the Security Control field "Reserved" bits (3 bits)
void SetSecEnable(void)
Set the Frame Control field "Security Enabled" bit to true.
uint64_t m_auxKeyIdKeySrc64
Auxiliary security header - Key Source (8 Octets)
uint16_t GetFrameControl(void) const
Get the Frame control field.
Mac64Address GetExtDstAddr(void) const
Get the Destination Extended address.
uint32_t GetSerializedSize(void) const
Mac64Address m_addrExtDstAddr
Dst Ext addr (0 or 8 Octets)
void SetFrameVer(uint8_t ver)
Set the Frame version.
uint8_t GetSecControl(void) const
Get the Auxiliary Security Header - Security Control Octect.
bool IsSecEnable(void) const
Check if Security Enabled bit of Frame Control is enabled.
bool IsAckReq(void) const
Check if Ack.
uint8_t m_SeqNum
Sequence Number (1 Octet)
void SetType(enum LrWpanMacType wpanMacType)
Set the Frame Control field "Frame Type" bits.
void SetFrmCtrlRes(uint8_t res)
Set the Frame Control field "Reserved" bits.
void SetPanIdComp(void)
Set the Frame Control field "PAN ID Compression" bit to true.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t m_auxKeyIdKeyIndex
Auxiliary security header - Key Index (1 Octet)
uint8_t GetSrcAddrMode(void) const
Get the Source Addressing Mode of Frame control field.
Mac16Address m_addrShortSrcAddr
Src Short addr (0 or 2 Octets)
void SetDstAddrMode(uint8_t addrMode)
Set the Destination address mode.
uint8_t m_fctrlPanIdComp
Frame Control field Bit 6 = 0 - no compression, 1 - using only DstPanId for both Src and DstPanId...
void Print(std::ostream &os) const
bool IsAcknowledgment(void) const
Returns true if the header is an ack.
Mac16Address GetShortDstAddr(void) const
Get the Destination Short address.
uint16_t GetSrcPanId(void) const
Get the Source PAN ID.
uint64_t GetKeyIdSrc64(void) const
Get the Auxiliary Security Header - Key Identifier - Key Source (4 Octects)
bool IsFrmPend(void) const
Check if Frame Pending bit of Frame Control is enabled.
This class can contain 16 bit addresses.
Definition: mac16-address.h:41
Mac64Address m_addrExtSrcAddr
Src Ext addr (0 or 8 Octets)
uint8_t m_secctrlSecLevel
Auxiliary security header - Security Control field - Bit 0-2.
void SetDstAddrFields(uint16_t panId, Mac16Address addr)
Set Destination address fields.
void SetSecControl(uint8_t secLevel)
Set the auxiliary security header "Security Control" octet.
void WriteHtolsbU16(uint16_t data)
Definition: buffer.cc:939
uint8_t GetFrameVer(void) const
Get the Frame Version of Frame control field.
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
Mac64Address GetExtSrcAddr(void) const
Get the Source Extended address.
uint8_t GetKeyIdIndex(void) const
Get the Auxiliary Security Header - Key Identifier - Key Index.
uint32_t Deserialize(Buffer::Iterator start)
uint32_t GetFrmCounter(void) const
Get the Auxiliary Security Header - Frame Counter Octects.
void SetFrmPend(void)
Set the Frame Control field "Frame Pending" bit to true.
void WriteU8(uint8_t data)
Definition: buffer.h:876
void WriteHtolsbU64(uint64_t data)
Definition: buffer.cc:955
void SetFrameControl(uint16_t frameControl)
Set the whole Frame Control field.
bool IsCommand(void) const
Returns true if the header is a command.
void SetSrcAddrMode(uint8_t addrMode)
Set the Source address mode.
static TypeId GetTypeId(void)
Get the type ID.
uint8_t ReadU8(void)
Definition: buffer.h:1028
uint8_t m_fctrlReserved
Frame Control field Bit 7-9.
uint8_t GetSeqNum(void) const
Get the frame Sequence number.
uint32_t m_auxFrmCntr
Auxiliary security header - Frame Counter (4 Octets)
uint8_t m_fctrlSrcAddrMode
Frame Control field Bit 14-15 = 0 - No SrcAddr, 2 - ShtSrcAddr, 3 - ExtSrcAddr.
uint16_t ReadLsbtohU16(void)
Definition: buffer.cc:1094
uint8_t m_fctrlFrmVer
Frame Control field Bit 12-13.
uint8_t m_fctrlAckReq
Frame Control field Bit 5.
enum LrWpanMacType GetType(void) const
Get the header type.
uint64_t ReadLsbtohU64(void)
Definition: buffer.cc:1122
uint8_t m_fctrlFrmType
Frame Control field Bit 0-2 = 0 - Beacon, 1 - Data, 2 - Ack, 3 - Command.
void SetSecLevel(uint8_t secLevel)
Set the Security Control field "Security Level" bits (3 bits)
a unique identifier for an interface.
Definition: type-id.h:51
TypeId SetParent(TypeId tid)
Definition: type-id.cc:631
uint8_t GetDstAddrMode(void) const
Get the Dest.
uint32_t ReadLsbtohU32(void)
Definition: buffer.cc:1105
LrWpanMacType
The possible MAC types, see IEEE 802.15.4-2006, Table 79.
uint16_t GetDstPanId(void) const
Get the Destination PAN ID.
void WriteHtolsbU32(uint32_t data)
Definition: buffer.cc:946