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  break;
69  case 1:
70  return LRWPAN_MAC_DATA;
71  break;
72  case 2:
74  break;
75  case 3:
76  return LRWPAN_MAC_COMMAND;
77  break;
78  default:
79  return LRWPAN_MAC_RESERVED;
80  }
81 }
82 
83 uint16_t
85 {
86  uint16_t val = 0;
87 
88  val = m_fctrlFrmType & (0x07); // Bit 0-2
89  val |= (m_fctrlSecU << 3) & (0x01 << 3); // Bit 3
90  val |= (m_fctrlFrmPending << 4) & (0x01 << 4); // Bit 4
91  val |= (m_fctrlAckReq << 5) & (0x01 << 5); // Bit 5
92  val |= (m_fctrlPanIdComp << 6) & (0x01 << 6); // Bit 6
93  val |= (m_fctrlReserved << 7) & (0x07 << 7); // Bit 7-9
94  val |= (m_fctrlDstAddrMode << 10) & (0x03 << 10); // Bit 10-11
95  val |= (m_fctrlFrmVer << 12) & (0x03 << 12); // Bit 12-13
96  val |= (m_fctrlSrcAddrMode << 14) & (0x03 << 14); // Bit 14-15
97  return val;
98 }
99 
100 bool
102 {
103  return (m_fctrlSecU == 1);
104 }
105 
106 bool
108 {
109  return (m_fctrlFrmPending == 1);
110 }
111 
112 bool
114 {
115  return (m_fctrlAckReq == 1);
116 }
117 
118 bool
120 {
121  return (m_fctrlPanIdComp == 1);
122 }
123 
124 uint8_t
126 {
127  return (m_fctrlReserved);
128 }
129 
130 uint8_t
132 {
133  return m_fctrlDstAddrMode;
134 }
135 
136 uint8_t
138 {
139  return m_fctrlFrmVer;
140 }
141 
142 uint8_t
144 {
145  return m_fctrlSrcAddrMode;
146 }
147 
148 uint8_t
150 {
151  return (m_SeqNum);
152 }
153 
154 uint16_t
156 {
157  return (m_addrDstPanId);
158 }
159 
162 {
163  return (m_addrShortDstAddr);
164 }
165 
168 {
169  return (m_addrExtDstAddr);
170 }
171 
172 uint16_t
174 {
175  return (m_addrSrcPanId);
176 }
177 
180 {
181  return (m_addrShortSrcAddr);
182 }
183 
186 {
187  return (m_addrExtSrcAddr);
188 }
189 
190 uint8_t
192 {
193  uint8_t val = 0;
194 
195  val = m_secctrlSecLevel & (0x7); // Bit 0-2
196  val |= (m_secctrlKeyIdMode << 3) & (0x3 << 3); // Bit 3-4
197  val |= (m_secctrlReserved << 5) & (0x7 << 5); // Bit 5-7
198 
199  return (val);
200 }
201 
202 uint32_t
204 {
205  return (m_auxFrmCntr);
206 }
207 
208 uint8_t
210 {
211  return (m_secctrlSecLevel);
212 }
213 
214 uint8_t
216 {
217  return (m_secctrlKeyIdMode);
218 }
219 
220 uint8_t
222 {
223  return (m_secctrlReserved);
224 }
225 
226 uint32_t
228 {
229  return (m_auxKeyIdKeySrc32);
230 }
231 
232 uint64_t
234 {
235  return (m_auxKeyIdKeySrc64);
236 }
237 
238 uint8_t
240 {
241  return (m_auxKeyIdKeyIndex);
242 }
243 
244 bool
246 {
247  return (m_fctrlFrmType == LRWPAN_MAC_BEACON);
248 }
249 
250 bool
252 {
253  return (m_fctrlFrmType == LRWPAN_MAC_DATA);
254 }
255 
256 bool
258 {
260 }
261 
262 bool
264 {
266 }
267 
268 void
270 {
271  m_fctrlFrmType = wpanMacType;
272 }
273 
274 void
275 LrWpanMacHeader::SetFrameControl(uint16_t frameControl)
276 {
277  m_fctrlFrmType = (frameControl) & (0x07); // Bit 0-2
278  m_fctrlSecU = (frameControl >> 3) & (0x01); // Bit 3
279  m_fctrlFrmPending = (frameControl >> 4) & (0x01); // Bit 4
280  m_fctrlAckReq = (frameControl >> 5) & (0x01); // Bit 5
281  m_fctrlPanIdComp = (frameControl >> 6) & (0x01); // Bit 6
282  m_fctrlReserved = (frameControl >> 7) & (0x07); // Bit 7-9
283  m_fctrlDstAddrMode = (frameControl >> 10) & (0x03); // Bit 10-11
284  m_fctrlFrmVer = (frameControl >> 12) & (0x03); // Bit 12-13
285  m_fctrlSrcAddrMode = (frameControl >> 14) & (0x03); // Bit 14-15
286 }
287 
288 void
290 {
291  m_fctrlSecU = 1;
292 }
293 
294 void
296 {
297  m_fctrlSecU = 0;
298 }
299 
300 void
302 {
303  m_fctrlFrmPending = 1;
304 }
305 
306 void
308 {
309  m_fctrlFrmPending = 0;
310 }
311 
312 void
314 {
315  m_fctrlAckReq = 1;
316 }
317 
318 void
320 {
321  m_fctrlAckReq = 0;
322 }
323 
324 void
326 {
327  m_fctrlPanIdComp = 1;
328 }
329 
330 void
332 {
333  m_fctrlPanIdComp = 0;
334 }
335 
336 void
338 {
340 }
341 
342 void
344 {
345  m_fctrlDstAddrMode = addrMode;
346 }
347 
348 void
350 {
351  m_fctrlFrmVer = ver;
352 }
353 
354 void
356 {
357  m_fctrlSrcAddrMode = addrMode;
358 }
359 
360 void
362 {
363  m_SeqNum = seqNum;
364 }
365 
366 void
368 {
369  m_addrSrcPanId = panId;
370  m_addrShortSrcAddr = addr;
371 }
372 
373 void
375 {
376  m_addrSrcPanId = panId;
377  m_addrExtSrcAddr = addr;
378 }
379 
380 void
382 {
383  m_addrDstPanId = panId;
384  m_addrShortDstAddr = addr;
385 }
386 
387 void
389 {
390  m_addrDstPanId = panId;
391  m_addrExtDstAddr = addr;
392 }
393 
394 void
396 {
397  m_secctrlSecLevel = (secControl) & (0x07); // Bit 0-2
398  m_secctrlKeyIdMode = (secControl >> 3) & (0x03); // Bit 3-4
399  m_secctrlReserved = (secControl >> 5) & (0x07); // Bit 5-7
400 }
401 
402 void
404 {
405  m_auxFrmCntr = frmCntr;
406 }
407 
408 void
410 {
411  m_secctrlSecLevel = secLevel;
412 }
413 
414 void
416 {
417  m_secctrlKeyIdMode = keyIdMode;
418 }
419 
420 void
422 {
424 }
425 
426 void
427 LrWpanMacHeader::SetKeyId(uint8_t keyIndex)
428 {
429  m_auxKeyIdKeyIndex = keyIndex;
430 }
431 
432 void
433 LrWpanMacHeader::SetKeyId(uint32_t keySrc, uint8_t keyIndex)
434 {
435  m_auxKeyIdKeyIndex = keyIndex;
436  m_auxKeyIdKeySrc32 = keySrc;
437 }
438 
439 void
440 LrWpanMacHeader::SetKeyId(uint64_t keySrc, uint8_t keyIndex)
441 {
442  m_auxKeyIdKeyIndex = keyIndex;
443  m_auxKeyIdKeySrc64 = keySrc;
444 }
445 
446 TypeId
448 {
449  static TypeId tid = TypeId("ns3::LrWpanMacHeader")
450  .SetParent<Header>()
451  .SetGroupName("LrWpan")
452  .AddConstructor<LrWpanMacHeader>();
453  return tid;
454 }
455 
456 TypeId
458 {
459  return GetTypeId();
460 }
461 
462 void
463 LrWpanMacHeader::Print(std::ostream& os) const
464 {
465  os << " Frame Type = " << (uint32_t)m_fctrlFrmType
466  << ", Sec Enable = " << (uint32_t)m_fctrlSecU
467  << ", Frame Pending = " << (uint32_t)m_fctrlFrmPending
468  << ", Ack Request = " << (uint32_t)m_fctrlAckReq
469  << ", PAN ID Compress = " << (uint32_t)m_fctrlPanIdComp
470  << ", Frame Vers = " << (uint32_t)m_fctrlFrmVer
471  << ", Dst Addrs Mode = " << (uint32_t)m_fctrlDstAddrMode
472  << ", Src Addr Mode = " << (uint32_t)m_fctrlSrcAddrMode;
473 
474  os << ", Sequence Num = " << static_cast<uint16_t>(m_SeqNum);
475 
476  switch (m_fctrlDstAddrMode)
477  {
478  case NOADDR:
479  break;
480  case SHORTADDR:
481  os << ", Dst Addr Pan ID = " << static_cast<uint16_t>(m_addrDstPanId)
482  << ", m_addrShortDstAddr = " << m_addrShortDstAddr;
483  break;
484  case EXTADDR:
485  os << ", Dst Addr Pan ID = " << static_cast<uint16_t>(m_addrDstPanId)
486  << ", m_addrExtDstAddr = " << m_addrExtDstAddr;
487  break;
488  }
489 
490  switch (m_fctrlSrcAddrMode)
491  {
492  case NOADDR:
493  break;
494  case SHORTADDR:
495  os << ", Src Addr Pan ID = " << static_cast<uint16_t>(m_addrSrcPanId)
496  << ", m_addrShortSrcAddr = " << m_addrShortSrcAddr;
497  break;
498  case EXTADDR:
499  os << ", Src Addr Pan ID = " << static_cast<uint32_t>(m_addrSrcPanId)
500  << ", m_addrExtSrcAddr = " << m_addrExtDstAddr;
501  break;
502  }
503 
504  if (IsSecEnable())
505  {
506  os << " Security Level = " << static_cast<uint32_t>(m_secctrlSecLevel)
507  << ", Key Id Mode = " << static_cast<uint32_t>(m_secctrlKeyIdMode)
508  << ", Frame Counter = " << static_cast<uint32_t>(m_auxFrmCntr);
509 
510  switch (m_secctrlKeyIdMode)
511  {
512  case IMPLICIT:
513  break;
514  case NOKEYSOURCE:
515  os << ", Key Id - Key Index = " << static_cast<uint32_t>(m_auxKeyIdKeyIndex);
516  break;
517  case SHORTKEYSOURCE:
518  os << ", Key Id - Key Source 32 =" << static_cast<uint32_t>(m_auxKeyIdKeySrc32)
519  << ", Key Id - Key Index = " << static_cast<uint32_t>(m_auxKeyIdKeyIndex);
520  break;
521  case LONGKEYSOURCE:
522  os << ", Key Id - Key Source 64 =" << static_cast<uint64_t>(m_auxKeyIdKeySrc64)
523  << ", Key Id - Key Index = " << static_cast<uint32_t>(m_auxKeyIdKeyIndex);
524  break;
525  }
526  }
527 }
528 
529 uint32_t
531 {
532  /*
533  * Each mac header will have
534  * Frame Control : 2 octet
535  * Sequence Number : 1 Octet
536  * Dst PAN Id : 0/2 Octet
537  * Dst Address : 0/2/8 octet
538  * Src PAN Id : 0/2 octet
539  * Src Address : 0/2/8 octet
540  * Aux Sec Header : 0/5/6/10/14 octet
541  */
542 
543  uint32_t size = 3;
544 
545  switch (m_fctrlDstAddrMode)
546  {
547  case NOADDR:
548  break;
549  case SHORTADDR:
550  size += 4;
551  break;
552  case EXTADDR:
553  size += 10;
554  break;
555  }
556 
557  switch (m_fctrlSrcAddrMode)
558  {
559  case NOADDR:
560  break;
561  case SHORTADDR:
562  // check if PAN Id compression is enabled
563  if (!IsPanIdComp())
564  {
565  size += 4;
566  }
567  else
568  {
569  size += 2;
570  }
571  break;
572  case EXTADDR:
573  // check if PAN Id compression is enabled
574  if (!IsPanIdComp())
575  {
576  size += 10;
577  }
578  else
579  {
580  size += 8;
581  }
582  break;
583  }
584 
585  // check if security is enabled
586  if (IsSecEnable())
587  {
588  size += 5;
589  switch (m_secctrlKeyIdMode)
590  {
591  case IMPLICIT:
592  break;
593  case NOKEYSOURCE:
594  size += 1;
595  break;
596  case SHORTKEYSOURCE:
597  size += 5;
598  break;
599  case LONGKEYSOURCE:
600  size += 9;
601  break;
602  }
603  }
604  return (size);
605 }
606 
607 void
609 {
611  uint16_t frameControl = GetFrameControl();
612 
613  i.WriteHtolsbU16(frameControl);
614  i.WriteU8(GetSeqNum());
615 
616  switch (m_fctrlDstAddrMode)
617  {
618  case NOADDR:
619  break;
620  case SHORTADDR:
623  break;
624  case EXTADDR:
627  break;
628  }
629 
630  switch (m_fctrlSrcAddrMode)
631  {
632  case NOADDR:
633  break;
634  case SHORTADDR:
635  if (!IsPanIdComp())
636  {
638  }
640  break;
641  case EXTADDR:
642  if (!IsPanIdComp())
643  {
645  }
647  break;
648  }
649 
650  if (IsSecEnable())
651  {
652  i.WriteU8(GetSecControl());
654 
655  switch (m_secctrlKeyIdMode)
656  {
657  case IMPLICIT:
658  break;
659  case NOKEYSOURCE:
660  i.WriteU8(GetKeyIdIndex());
661  break;
662  case SHORTKEYSOURCE:
664  i.WriteU8(GetKeyIdIndex());
665  break;
666  case LONGKEYSOURCE:
668  i.WriteU8(GetKeyIdIndex());
669  break;
670  }
671  }
672 }
673 
674 uint32_t
676 {
678  uint16_t frameControl = i.ReadLsbtohU16();
679  SetFrameControl(frameControl);
680 
681  SetSeqNum(i.ReadU8());
682  switch (m_fctrlDstAddrMode)
683  {
684  case NOADDR:
685  break;
686  case SHORTADDR:
689  break;
690  case EXTADDR:
693  break;
694  }
695 
696  switch (m_fctrlSrcAddrMode)
697  {
698  case NOADDR:
699  break;
700  case SHORTADDR:
701  if (!IsPanIdComp())
702  {
704  }
705  else
706  {
707  if (m_fctrlDstAddrMode > 0)
708  {
710  }
711  }
713  break;
714  case EXTADDR:
715  if (!IsPanIdComp())
716  {
718  }
719  else
720  {
721  if (m_fctrlDstAddrMode > 0)
722  {
724  }
725  }
727  break;
728  }
729 
730  if (IsSecEnable())
731  {
732  SetSecControl(i.ReadU8());
734 
735  switch (m_secctrlKeyIdMode)
736  {
737  case IMPLICIT:
738  break;
739  case NOKEYSOURCE:
740  SetKeyId(i.ReadU8());
741  break;
742  case SHORTKEYSOURCE:
743  SetKeyId(i.ReadLsbtohU32(), i.ReadU8());
744  break;
745  case LONGKEYSOURCE:
746  SetKeyId(i.ReadLsbtohU64(), i.ReadU8());
747  break;
748  }
749  }
750  return i.GetDistanceFrom(start);
751 }
752 
753 } // namespace ns3
iterator in a Buffer instance
Definition: buffer.h:100
void WriteHtolsbU16(uint16_t data)
Definition: buffer.cc:905
uint8_t ReadU8()
Definition: buffer.h:1027
void WriteU8(uint8_t data)
Definition: buffer.h:881
void WriteHtolsbU32(uint32_t data)
Definition: buffer.cc:913
uint16_t ReadLsbtohU16()
Definition: buffer.cc:1067
uint64_t ReadLsbtohU64()
Definition: buffer.cc:1097
void WriteHtolsbU64(uint64_t data)
Definition: buffer.cc:923
uint32_t GetDistanceFrom(const Iterator &o) const
Definition: buffer.cc:783
uint32_t ReadLsbtohU32()
Definition: buffer.cc:1079
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
LrWpanMacType GetType() const
Get the header type.
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.
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:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
#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.