src/wifi/model/amsdu-subframe-header.cc
changeset 9705 43fa2408aa05
parent 9237 db83a668984c
child 10410 4d4eb8097fa3
equal deleted inserted replaced
9704:1db7690f8e8f 9705:43fa2408aa05
    17  *
    17  *
    18  * Author: Mirko Banchi <mk.banchi@gmail.com>
    18  * Author: Mirko Banchi <mk.banchi@gmail.com>
    19  */
    19  */
    20 #include "amsdu-subframe-header.h"
    20 #include "amsdu-subframe-header.h"
    21 #include "ns3/address-utils.h"
    21 #include "ns3/address-utils.h"
       
    22 #include "ns3/log.h"
       
    23 
       
    24 NS_LOG_COMPONENT_DEFINE ("AmsduSubframeHeader");
    22 
    25 
    23 namespace ns3 {
    26 namespace ns3 {
    24 
    27 
    25 NS_OBJECT_ENSURE_REGISTERED (AmsduSubframeHeader);
    28 NS_OBJECT_ENSURE_REGISTERED (AmsduSubframeHeader);
    26 
    29 
    41 }
    44 }
    42 
    45 
    43 AmsduSubframeHeader::AmsduSubframeHeader ()
    46 AmsduSubframeHeader::AmsduSubframeHeader ()
    44   : m_length (0)
    47   : m_length (0)
    45 {
    48 {
       
    49   NS_LOG_FUNCTION (this);
    46 }
    50 }
    47 
    51 
    48 AmsduSubframeHeader::~AmsduSubframeHeader ()
    52 AmsduSubframeHeader::~AmsduSubframeHeader ()
    49 {
    53 {
       
    54   NS_LOG_FUNCTION (this);
    50 }
    55 }
    51 
    56 
    52 uint32_t
    57 uint32_t
    53 AmsduSubframeHeader::GetSerializedSize () const
    58 AmsduSubframeHeader::GetSerializedSize () const
    54 {
    59 {
       
    60   NS_LOG_FUNCTION (this);
    55   return (6 + 6 + 2);
    61   return (6 + 6 + 2);
    56 }
    62 }
    57 
    63 
    58 void
    64 void
    59 AmsduSubframeHeader::Serialize (Buffer::Iterator i) const
    65 AmsduSubframeHeader::Serialize (Buffer::Iterator i) const
    60 {
    66 {
       
    67   NS_LOG_FUNCTION (this << &i);
    61   WriteTo (i, m_da);
    68   WriteTo (i, m_da);
    62   WriteTo (i, m_sa);
    69   WriteTo (i, m_sa);
    63   i.WriteHtonU16 (m_length);
    70   i.WriteHtonU16 (m_length);
    64 }
    71 }
    65 
    72 
    66 uint32_t
    73 uint32_t
    67 AmsduSubframeHeader::Deserialize (Buffer::Iterator start)
    74 AmsduSubframeHeader::Deserialize (Buffer::Iterator start)
    68 {
    75 {
       
    76   NS_LOG_FUNCTION (this << &start);
    69   Buffer::Iterator i = start;
    77   Buffer::Iterator i = start;
    70   ReadFrom (i, m_da);
    78   ReadFrom (i, m_da);
    71   ReadFrom (i, m_sa);
    79   ReadFrom (i, m_sa);
    72   m_length = i.ReadNtohU16 ();
    80   m_length = i.ReadNtohU16 ();
    73   return i.GetDistanceFrom (start);
    81   return i.GetDistanceFrom (start);
    74 }
    82 }
    75 
    83 
    76 void
    84 void
    77 AmsduSubframeHeader::Print (std::ostream &os) const
    85 AmsduSubframeHeader::Print (std::ostream &os) const
    78 {
    86 {
       
    87   NS_LOG_FUNCTION (this << &os);
    79   os << "DA = " << m_da << ", SA = " << m_sa << ", length = " << m_length;
    88   os << "DA = " << m_da << ", SA = " << m_sa << ", length = " << m_length;
    80 }
    89 }
    81 
    90 
    82 void
    91 void
    83 AmsduSubframeHeader::SetDestinationAddr (Mac48Address to)
    92 AmsduSubframeHeader::SetDestinationAddr (Mac48Address to)
    84 {
    93 {
       
    94   NS_LOG_FUNCTION (this << to);
    85   m_da = to;
    95   m_da = to;
    86 }
    96 }
    87 
    97 
    88 void
    98 void
    89 AmsduSubframeHeader::SetSourceAddr (Mac48Address from)
    99 AmsduSubframeHeader::SetSourceAddr (Mac48Address from)
    90 {
   100 {
       
   101   NS_LOG_FUNCTION (this << from);
    91   m_sa = from;
   102   m_sa = from;
    92 }
   103 }
    93 
   104 
    94 void
   105 void
    95 AmsduSubframeHeader::SetLength (uint16_t length)
   106 AmsduSubframeHeader::SetLength (uint16_t length)
    96 {
   107 {
       
   108   NS_LOG_FUNCTION (this << length);
    97   m_length = length;
   109   m_length = length;
    98 }
   110 }
    99 
   111 
   100 Mac48Address
   112 Mac48Address
   101 AmsduSubframeHeader::GetDestinationAddr (void) const
   113 AmsduSubframeHeader::GetDestinationAddr (void) const
   102 {
   114 {
       
   115   NS_LOG_FUNCTION (this);
   103   return m_da;
   116   return m_da;
   104 }
   117 }
   105 
   118 
   106 Mac48Address
   119 Mac48Address
   107 AmsduSubframeHeader::GetSourceAddr (void) const
   120 AmsduSubframeHeader::GetSourceAddr (void) const
   108 {
   121 {
       
   122   NS_LOG_FUNCTION (this);
   109   return m_sa;
   123   return m_sa;
   110 }
   124 }
   111 
   125 
   112 uint16_t
   126 uint16_t
   113 AmsduSubframeHeader::GetLength (void) const
   127 AmsduSubframeHeader::GetLength (void) const
   114 {
   128 {
       
   129   NS_LOG_FUNCTION (this);
   115   return m_length;
   130   return m_length;
   116 }
   131 }
   117 
   132 
   118 } // namespace ns3
   133 } // namespace ns3