A Discrete-Event Network Simulator
API
lr-wpan-mac-header.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011 The Boeing Company
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: kwong yin <kwong-sang.yin@boeing.com>
18  */
19 #include "lr-wpan-mac-header.h"
20 
21 #include <ns3/address-utils.h>
22 
23 namespace ns3
24 {
25 
26 NS_OBJECT_ENSURE_REGISTERED(LrWpanMacHeader);
27 
28 // TODO: Test Compressed PAN Id, Security Enabled, different size Key
29 
31 {
32  SetType(LRWPAN_MAC_DATA); // Assume Data frame
33  SetSecDisable(); // Assume there is No Aux Sec but
34  SetNoFrmPend(); // No Frame Pending
35  SetNoAckReq(); // No Ack Frame will be expected from recipient
36  SetNoPanIdComp(); // No PAN Id Compression since no addresses
37  SetFrmCtrlRes(0); // Initialize the 3 reserved bits to 0
38  SetDstAddrMode(NOADDR); // Assume there will be no src and dst address
40  SetFrameVer(1); // Indicates an IEEE 802.15.4 frame
41 }
42 
43 LrWpanMacHeader::LrWpanMacHeader(LrWpanMacType wpanMacType, uint8_t seqNum)
44 {
45  SetType(wpanMacType);
46  SetSeqNum(seqNum);
47  SetSecDisable(); // Assume there is No Aux Sec but
48  SetNoFrmPend(); // No Frame Pending
49  SetNoAckReq(); // No Ack Frame will be expected from recipient
50  SetNoPanIdComp(); // No PAN Id Compression since no addresses
51  SetFrmCtrlRes(0); // Initialize the 3 reserved bits to 0
52  SetDstAddrMode(NOADDR); // Assume there will be no src and dst address
54  SetFrameVer(1); // Indicates an IEEE 802.15.4 frame
55 }
56 
58 {
59 }
60 
63 {
64  switch (m_fctrlFrmType)
65  {
66  case 0:
67  return LRWPAN_MAC_BEACON;
68  case 1:
69  return LRWPAN_MAC_DATA;
70  case 2:
72  case 3:
73  return LRWPAN_MAC_COMMAND;
74  default:
75  return LRWPAN_MAC_RESERVED;
76  }
77 }
78 
79 uint16_t
81 {
82  uint16_t val = 0;
83 
84  val = m_fctrlFrmType & (0x07); // Bit 0-2
85  val |= (m_fctrlSecU << 3) & (0x01 << 3); // Bit 3
86  val |= (m_fctrlFrmPending << 4) & (0x01 << 4); // Bit 4
87  val |= (m_fctrlAckReq << 5) & (0x01 << 5); // Bit 5
88  val |= (m_fctrlPanIdComp << 6) & (0x01 << 6); // Bit 6
89  val |= (m_fctrlReserved << 7) & (0x07 << 7); // Bit 7-9
90  val |= (m_fctrlDstAddrMode << 10) & (0x03 << 10); // Bit 10-11
91  val |= (m_fctrlFrmVer << 12) & (0x03 << 12); // Bit 12-13
92  val |= (m_fctrlSrcAddrMode << 14) & (0x03 << 14); // Bit 14-15
93  return val;
94 }
95 
96 bool
98 {
99  return (m_fctrlSecU == 1);
100 }
101 
102 bool
104 {
105  return (m_fctrlFrmPending == 1);
106 }
107 
108 bool
110 {
111  return (m_fctrlAckReq == 1);
112 }
113 
114 bool
116 {
117  return (m_fctrlPanIdComp == 1);
118 }
119 
120 uint8_t
122 {
123  return m_fctrlReserved;
124 }
125 
126 uint8_t
128 {
129  return m_fctrlDstAddrMode;
130 }
131 
132 uint8_t
134 {
135  return m_fctrlFrmVer;
136 }
137 
138 uint8_t
140 {
141  return m_fctrlSrcAddrMode;
142 }
143 
144 uint8_t
146 {
147  return m_SeqNum;
148 }
149 
150 uint16_t
152 {
153  return m_addrDstPanId;
154 }
155 
158 {
159  return m_addrShortDstAddr;
160 }
161 
164 {
165  return m_addrExtDstAddr;
166 }
167 
168 uint16_t
170 {
171  return m_addrSrcPanId;
172 }
173 
176 {
177  return m_addrShortSrcAddr;
178 }
179 
182 {
183  return m_addrExtSrcAddr;
184 }
185 
186 uint8_t
188 {
189  uint8_t val = 0;
190 
191  val = m_secctrlSecLevel & (0x7); // Bit 0-2
192  val |= (m_secctrlKeyIdMode << 3) & (0x3 << 3); // Bit 3-4
193  val |= (m_secctrlReserved << 5) & (0x7 << 5); // Bit 5-7
194 
195  return val;
196 }
197 
198 uint32_t
200 {
201  return m_auxFrmCntr;
202 }
203 
204 uint8_t
206 {
207  return m_secctrlSecLevel;
208 }
209 
210 uint8_t
212 {
213  return m_secctrlKeyIdMode;
214 }
215 
216 uint8_t
218 {
219  return m_secctrlReserved;
220 }
221 
222 uint32_t
224 {
225  return m_auxKeyIdKeySrc32;
226 }
227 
228 uint64_t
230 {
231  return m_auxKeyIdKeySrc64;
232 }
233 
234 uint8_t
236 {
237  return m_auxKeyIdKeyIndex;
238 }
239 
240 bool
242 {
243  return (m_fctrlFrmType == LRWPAN_MAC_BEACON);
244 }
245 
246 bool
248 {
249  return (m_fctrlFrmType == LRWPAN_MAC_DATA);
250 }
251 
252 bool
254 {
256 }
257 
258 bool
260 {
262 }
263 
264 void
266 {
267  m_fctrlFrmType = wpanMacType;
268 }
269 
270 void
271 LrWpanMacHeader::SetFrameControl(uint16_t frameControl)
272 {
273  m_fctrlFrmType = (frameControl) & (0x07); // Bit 0-2
274  m_fctrlSecU = (frameControl >> 3) & (0x01); // Bit 3
275  m_fctrlFrmPending = (frameControl >> 4) & (0x01); // Bit 4
276  m_fctrlAckReq = (frameControl >> 5) & (0x01); // Bit 5
277  m_fctrlPanIdComp = (frameControl >> 6) & (0x01); // Bit 6
278  m_fctrlReserved = (frameControl >> 7) & (0x07); // Bit 7-9
279  m_fctrlDstAddrMode = (frameControl >> 10) & (0x03); // Bit 10-11
280  m_fctrlFrmVer = (frameControl >> 12) & (0x03); // Bit 12-13
281  m_fctrlSrcAddrMode = (frameControl >> 14) & (0x03); // Bit 14-15
282 }
283 
284 void
286 {
287  m_fctrlSecU = 1;
288 }
289 
290 void
292 {
293  m_fctrlSecU = 0;
294 }
295 
296 void
298 {
299  m_fctrlFrmPending = 1;
300 }
301 
302 void
304 {
305  m_fctrlFrmPending = 0;
306 }
307 
308 void
310 {
311  m_fctrlAckReq = 1;
312 }
313 
314 void
316 {
317  m_fctrlAckReq = 0;
318 }
319 
320 void
322 {
323  m_fctrlPanIdComp = 1;
324 }
325 
326 void
328 {
329  m_fctrlPanIdComp = 0;
330 }
331 
332 void
334 {
336 }
337 
338 void
340 {
341  m_fctrlDstAddrMode = addrMode;
342 }
343 
344 void
346 {
347  m_fctrlFrmVer = ver;
348 }
349 
350 void
352 {
353  m_fctrlSrcAddrMode = addrMode;
354 }
355 
356 void
358 {
359  m_SeqNum = seqNum;
360 }
361 
362 void
364 {
365  m_addrSrcPanId = panId;
366  m_addrShortSrcAddr = addr;
367 }
368 
369 void
371 {
372  m_addrSrcPanId = panId;
373  m_addrExtSrcAddr = addr;
374 }
375 
376 void
378 {
379  m_addrDstPanId = panId;
380  m_addrShortDstAddr = addr;
381 }
382 
383 void
385 {
386  m_addrDstPanId = panId;
387  m_addrExtDstAddr = addr;
388 }
389 
390 void
392 {
393  m_secctrlSecLevel = (secControl) & (0x07); // Bit 0-2
394  m_secctrlKeyIdMode = (secControl >> 3) & (0x03); // Bit 3-4
395  m_secctrlReserved = (secControl >> 5) & (0x07); // Bit 5-7
396 }
397 
398 void
400 {
401  m_auxFrmCntr = frmCntr;
402 }
403 
404 void
406 {
407  m_secctrlSecLevel = secLevel;
408 }
409 
410 void
412 {
413  m_secctrlKeyIdMode = keyIdMode;
414 }
415 
416 void
418 {
420 }
421 
422 void
423 LrWpanMacHeader::SetKeyId(uint8_t keyIndex)
424 {
425  m_auxKeyIdKeyIndex = keyIndex;
426 }
427 
428 void
429 LrWpanMacHeader::SetKeyId(uint32_t keySrc, uint8_t keyIndex)
430 {
431  m_auxKeyIdKeyIndex = keyIndex;
432  m_auxKeyIdKeySrc32 = keySrc;
433 }
434 
435 void
436 LrWpanMacHeader::SetKeyId(uint64_t keySrc, uint8_t keyIndex)
437 {
438  m_auxKeyIdKeyIndex = keyIndex;
439  m_auxKeyIdKeySrc64 = keySrc;
440 }
441 
442 TypeId
444 {
445  static TypeId tid = TypeId("ns3::LrWpanMacHeader")
446  .SetParent<Header>()
447  .SetGroupName("LrWpan")
448  .AddConstructor<LrWpanMacHeader>();
449  return tid;
450 }
451 
452 TypeId
454 {
455  return GetTypeId();
456 }
457 
458 void
459 LrWpanMacHeader::Print(std::ostream& os) const
460 {
461  os << " Frame Type = " << (uint32_t)m_fctrlFrmType
462  << ", Sec Enable = " << (uint32_t)m_fctrlSecU
463  << ", Frame Pending = " << (uint32_t)m_fctrlFrmPending
464  << ", Ack Request = " << (uint32_t)m_fctrlAckReq
465  << ", PAN ID Compress = " << (uint32_t)m_fctrlPanIdComp
466  << ", Frame Vers = " << (uint32_t)m_fctrlFrmVer
467  << ", Dst Addrs Mode = " << (uint32_t)m_fctrlDstAddrMode
468  << ", Src Addr Mode = " << (uint32_t)m_fctrlSrcAddrMode;
469 
470  os << ", Sequence Num = " << static_cast<uint16_t>(m_SeqNum);
471 
472  switch (m_fctrlDstAddrMode)
473  {
474  case NOADDR:
475  break;
476  case SHORTADDR:
477  os << ", Dst Addr Pan ID = " << static_cast<uint16_t>(m_addrDstPanId)
478  << ", m_addrShortDstAddr = " << m_addrShortDstAddr;
479  break;
480  case EXTADDR:
481  os << ", Dst Addr Pan ID = " << static_cast<uint16_t>(m_addrDstPanId)
482  << ", m_addrExtDstAddr = " << m_addrExtDstAddr;
483  break;
484  }
485 
486  switch (m_fctrlSrcAddrMode)
487  {
488  case NOADDR:
489  break;
490  case SHORTADDR:
491  os << ", Src Addr Pan ID = " << static_cast<uint16_t>(m_addrSrcPanId)
492  << ", m_addrShortSrcAddr = " << m_addrShortSrcAddr;
493  break;
494  case EXTADDR:
495  os << ", Src Addr Pan ID = " << static_cast<uint32_t>(m_addrSrcPanId)
496  << ", m_addrExtSrcAddr = " << m_addrExtDstAddr;
497  break;
498  }
499 
500  if (IsSecEnable())
501  {
502  os << " Security Level = " << static_cast<uint32_t>(m_secctrlSecLevel)
503  << ", Key Id Mode = " << static_cast<uint32_t>(m_secctrlKeyIdMode)
504  << ", Frame Counter = " << static_cast<uint32_t>(m_auxFrmCntr);
505 
506  switch (m_secctrlKeyIdMode)
507  {
508  case IMPLICIT:
509  break;
510  case NOKEYSOURCE:
511  os << ", Key Id - Key Index = " << static_cast<uint32_t>(m_auxKeyIdKeyIndex);
512  break;
513  case SHORTKEYSOURCE:
514  os << ", Key Id - Key Source 32 =" << static_cast<uint32_t>(m_auxKeyIdKeySrc32)
515  << ", Key Id - Key Index = " << static_cast<uint32_t>(m_auxKeyIdKeyIndex);
516  break;
517  case LONGKEYSOURCE:
518  os << ", Key Id - Key Source 64 =" << static_cast<uint64_t>(m_auxKeyIdKeySrc64)
519  << ", Key Id - Key Index = " << static_cast<uint32_t>(m_auxKeyIdKeyIndex);
520  break;
521  }
522  }
523 }
524 
525 uint32_t
527 {
528  /*
529  * Each mac header will have
530  * Frame Control : 2 octet
531  * Sequence Number : 1 Octet
532  * Dst PAN Id : 0/2 Octet
533  * Dst Address : 0/2/8 octet
534  * Src PAN Id : 0/2 octet
535  * Src Address : 0/2/8 octet
536  * Aux Sec Header : 0/5/6/10/14 octet
537  */
538 
539  uint32_t size = 3;
540 
541  switch (m_fctrlDstAddrMode)
542  {
543  case NOADDR:
544  break;
545  case SHORTADDR:
546  size += 4;
547  break;
548  case EXTADDR:
549  size += 10;
550  break;
551  }
552 
553  switch (m_fctrlSrcAddrMode)
554  {
555  case NOADDR:
556  break;
557  case SHORTADDR:
558  // check if PAN Id compression is enabled
559  if (!IsPanIdComp())
560  {
561  size += 4;
562  }
563  else
564  {
565  size += 2;
566  }
567  break;
568  case EXTADDR:
569  // check if PAN Id compression is enabled
570  if (!IsPanIdComp())
571  {
572  size += 10;
573  }
574  else
575  {
576  size += 8;
577  }
578  break;
579  }
580 
581  // check if security is enabled
582  if (IsSecEnable())
583  {
584  size += 5;
585  switch (m_secctrlKeyIdMode)
586  {
587  case IMPLICIT:
588  break;
589  case NOKEYSOURCE:
590  size += 1;
591  break;
592  case SHORTKEYSOURCE:
593  size += 5;
594  break;
595  case LONGKEYSOURCE:
596  size += 9;
597  break;
598  }
599  }
600  return size;
601 }
602 
603 void
605 {
607  uint16_t frameControl = GetFrameControl();
608 
609  i.WriteHtolsbU16(frameControl);
610  i.WriteU8(GetSeqNum());
611 
612  switch (m_fctrlDstAddrMode)
613  {
614  case NOADDR:
615  break;
616  case SHORTADDR:
619  break;
620  case EXTADDR:
623  break;
624  }
625 
626  switch (m_fctrlSrcAddrMode)
627  {
628  case NOADDR:
629  break;
630  case SHORTADDR:
631  if (!IsPanIdComp())
632  {
634  }
636  break;
637  case EXTADDR:
638  if (!IsPanIdComp())
639  {
641  }
643  break;
644  }
645 
646  if (IsSecEnable())
647  {
648  i.WriteU8(GetSecControl());
650 
651  switch (m_secctrlKeyIdMode)
652  {
653  case IMPLICIT:
654  break;
655  case NOKEYSOURCE:
656  i.WriteU8(GetKeyIdIndex());
657  break;
658  case SHORTKEYSOURCE:
660  i.WriteU8(GetKeyIdIndex());
661  break;
662  case LONGKEYSOURCE:
664  i.WriteU8(GetKeyIdIndex());
665  break;
666  }
667  }
668 }
669 
670 uint32_t
672 {
674  uint16_t frameControl = i.ReadLsbtohU16();
675  SetFrameControl(frameControl);
676 
677  SetSeqNum(i.ReadU8());
678  switch (m_fctrlDstAddrMode)
679  {
680  case NOADDR:
681  break;
682  case SHORTADDR:
685  break;
686  case EXTADDR:
689  break;
690  }
691 
692  switch (m_fctrlSrcAddrMode)
693  {
694  case NOADDR:
695  break;
696  case SHORTADDR:
697  if (!IsPanIdComp())
698  {
700  }
701  else
702  {
703  if (m_fctrlDstAddrMode > 0)
704  {
706  }
707  }
709  break;
710  case EXTADDR:
711  if (!IsPanIdComp())
712  {
714  }
715  else
716  {
717  if (m_fctrlDstAddrMode > 0)
718  {
720  }
721  }
723  break;
724  }
725 
726  if (IsSecEnable())
727  {
728  SetSecControl(i.ReadU8());
730 
731  switch (m_secctrlKeyIdMode)
732  {
733  case IMPLICIT:
734  break;
735  case NOKEYSOURCE:
736  SetKeyId(i.ReadU8());
737  break;
738  case SHORTKEYSOURCE:
739  SetKeyId(i.ReadLsbtohU32(), i.ReadU8());
740  break;
741  case LONGKEYSOURCE:
742  SetKeyId(i.ReadLsbtohU64(), i.ReadU8());
743  break;
744  }
745  }
746  return i.GetDistanceFrom(start);
747 }
748 
749 } // namespace ns3
iterator in a Buffer instance
Definition: buffer.h:100
void WriteHtolsbU16(uint16_t data)
Definition: buffer.cc:902
uint8_t ReadU8()
Definition: buffer.h:1027
void WriteU8(uint8_t data)
Definition: buffer.h:881
void WriteHtolsbU32(uint32_t data)
Definition: buffer.cc:910
uint16_t ReadLsbtohU16()
Definition: buffer.cc:1064
uint64_t ReadLsbtohU64()
Definition: buffer.cc:1094
void WriteHtolsbU64(uint64_t data)
Definition: buffer.cc:920
uint32_t GetDistanceFrom(const Iterator &o) const
Definition: buffer.cc:780
uint32_t ReadLsbtohU32()
Definition: buffer.cc:1076
Protocol header serialization and deserialization.
Definition: header.h:44
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
Represent the Mac Header with the Frame Control and Sequence Number fields.
uint8_t m_secctrlSecLevel
Auxiliary security header - Security Control field - Bit 0-2.
uint8_t m_fctrlDstAddrMode
Frame Control field Bit 10-11 = 0 - No DstAddr, 2 - ShtDstAddr, 3 - ExtDstAddr.
uint32_t m_auxFrmCntr
Auxiliary security header - Frame Counter (4 Octets)
uint8_t GetSecControl() const
Get the Auxiliary Security Header - Security Control Octet.
Mac16Address GetShortSrcAddr() const
Get the Source Short address.
LrWpanMacType
The possible MAC types, see IEEE 802.15.4-2006, Table 79.
@ LRWPAN_MAC_BEACON
LRWPAN_MAC_BEACON.
@ LRWPAN_MAC_COMMAND
LRWPAN_MAC_COMMAND.
@ LRWPAN_MAC_DATA
LRWPAN_MAC_DATA.
@ LRWPAN_MAC_ACKNOWLEDGMENT
LRWPAN_MAC_ACKNOWLEDGMENT.
@ LRWPAN_MAC_RESERVED
LRWPAN_MAC_RESERVED.
static TypeId GetTypeId()
Get the type ID.
bool IsCommand() const
Returns true if the header is a command.
uint8_t m_fctrlReserved
Frame Control field Bit 7-9.
uint8_t m_SeqNum
Sequence Number (1 Octet)
void SetSecEnable()
Set the Frame Control field "Security Enabled" bit to true.
uint32_t m_auxKeyIdKeySrc32
Auxiliary security header - Key Source (4 Octets)
bool IsBeacon() const
Returns true if the header is a beacon.
void SetKeyIdMode(uint8_t keyIdMode)
Set the Security Control field "Key Identifier Mode" bits (2 bits)
Mac16Address m_addrShortSrcAddr
Src Short addr (0 or 2 Octets)
Mac64Address GetExtSrcAddr() const
Get the Source Extended address.
uint8_t m_secctrlReserved
Auxiliary security header - Security Control field - Bit 5-7.
void SetType(LrWpanMacType wpanMacType)
Set the Frame Control field "Frame Type" bits.
void SetFrmCtrlRes(uint8_t res)
Set the Frame Control field "Reserved" bits.
void SetNoPanIdComp()
Set the Frame Control field "PAN ID Compression" bit to false.
uint8_t GetKeyIdIndex() const
Get the Auxiliary Security Header - Key Identifier - Key Index.
void SetSeqNum(uint8_t seqNum)
Set the Sequence number.
uint8_t GetSrcAddrMode() const
Get the Source Addressing Mode of Frame control field.
bool IsPanIdComp() const
Check if PAN ID Compression bit of Frame Control is enabled.
void SetPanIdComp()
Set the Frame Control field "PAN ID Compression" bit to true.
void SetSrcAddrMode(uint8_t addrMode)
Set the Source address mode.
void SetFrmPend()
Set the Frame Control field "Frame Pending" bit to true.
uint32_t GetFrmCounter() const
Get the Auxiliary Security Header - Frame Counter Octets.
uint8_t GetFrmCtrlRes() const
Get the Reserved bits of Frame control field.
uint8_t m_fctrlAckReq
Frame Control field Bit 5.
uint8_t m_fctrlPanIdComp
Frame Control field Bit 6 = 0 - no compression, 1 - using only DstPanId for both Src and DstPanId.
uint8_t GetDstAddrMode() const
Get the Dest.
void SetNoFrmPend()
Set the Frame Control field "Frame Pending" bit to false.
void SetSecDisable()
Set the Frame Control field "Security Enabled" bit to false.
uint16_t GetFrameControl() const
Get the Frame control field.
void SetSrcAddrFields(uint16_t panId, Mac16Address addr)
Set Source address fields.
void Print(std::ostream &os) const override
uint64_t GetKeyIdSrc64() const
Get the Auxiliary Security Header - Key Identifier - Key Source (4 Octets)
bool IsFrmPend() const
Check if Frame Pending bit of Frame Control is enabled.
uint32_t GetSerializedSize() const override
bool IsAcknowledgment() const
Returns true if the header is an ack.
bool IsData() const
Returns true if the header is a data.
uint8_t m_fctrlSrcAddrMode
Frame Control field Bit 14-15 = 0 - No SrcAddr, 2 - ShtSrcAddr, 3 - ExtSrcAddr.
uint8_t m_fctrlFrmType
Frame Control field Bit 0-2 = 0 - Beacon, 1 - Data, 2 - Ack, 3 - Command.
uint8_t GetKeyIdMode() const
Get the Auxiliary Security Header - Security Control - Key Identifier Mode bits.
uint32_t GetKeyIdSrc32() const
Get the Auxiliary Security Header - Key Identifier - Key Source (2 Octets)
void SetDstAddrFields(uint16_t panId, Mac16Address addr)
Set Destination address fields.
uint8_t GetSeqNum() const
Get the frame Sequence number.
void SetDstAddrMode(uint8_t addrMode)
Set the Destination address mode.
void SetFrmCounter(uint32_t frmCntr)
Set the auxiliary security header "Frame Counter" octet.
uint8_t m_secctrlKeyIdMode
Auxiliary security header - Security Control field - Bit 3-4 will indicate size of Key Id.
void SetNoAckReq()
Set the Frame Control field "Ack. Request" bit to false.
uint64_t m_auxKeyIdKeySrc64
Auxiliary security header - Key Source (8 Octets)
Mac64Address GetExtDstAddr() const
Get the Destination Extended address.
bool IsSecEnable() const
Check if Security Enabled bit of Frame Control is enabled.
uint8_t m_fctrlFrmPending
Frame Control field Bit 4.
void Serialize(Buffer::Iterator start) const override
void SetFrameControl(uint16_t frameControl)
Set the whole Frame Control field.
void SetSecCtrlReserved(uint8_t res)
Set the Security Control field "Reserved" bits (3 bits)
uint8_t GetSecLevel() const
Get the Auxiliary Security Header - Security Control - Security Level bits.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
void SetSecLevel(uint8_t secLevel)
Set the Security Control field "Security Level" bits (3 bits)
uint8_t GetSecCtrlReserved() const
Get the Auxiliary Security Header - Security Control - Reserved bits.
LrWpanMacType GetType() const
Get the header type.
uint16_t GetDstPanId() const
Get the Destination PAN ID.
uint8_t GetFrameVer() const
Get the Frame Version of Frame control field.
void SetKeyId(uint8_t keyIndex)
Set the Key Index.
Mac64Address m_addrExtSrcAddr
Src Ext addr (0 or 8 Octets)
Mac64Address m_addrExtDstAddr
Dst Ext addr (0 or 8 Octets)
uint16_t m_addrDstPanId
Dst PAN id (0 or 2 Octets)
void SetFrameVer(uint8_t ver)
Set the Frame version.
Mac16Address m_addrShortDstAddr
Dst Short addr (0 or 2 Octets)
uint16_t GetSrcPanId() const
Get the Source PAN ID.
uint16_t m_addrSrcPanId
Src PAN id (0 or 2 Octets)
uint8_t m_fctrlFrmVer
Frame Control field Bit 12-13.
uint8_t m_auxKeyIdKeyIndex
Auxiliary security header - Key Index (1 Octet)
bool IsAckReq() const
Check if Ack.
uint8_t m_fctrlSecU
Frame Control field Bit 3 = 0 - no AuxSecHdr , 1 - security enabled AuxSecHdr present.
void SetSecControl(uint8_t secLevel)
Set the auxiliary security header "Security Control" octet.
Mac16Address GetShortDstAddr() const
Get the Destination Short address.
void SetAckReq()
Set the Frame Control field "Ack. Request" bit to true.
This class can contain 16 bit addresses.
Definition: mac16-address.h:44
an EUI-64 address
Definition: mac64-address.h:46
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void WriteTo(Buffer::Iterator &i, Ipv4Address ad)
Write an Ipv4Address to a Buffer.
void ReadFrom(Buffer::Iterator &i, Ipv4Address &ad)
Read an Ipv4Address from a Buffer.