src/node/ethernet-trailer.cc
changeset 2646 c1fef7686472
parent 2643 2a3324f4dabe
child 2650 3de4cacb8981
equal deleted inserted replaced
2645:139b2dec56c0 2646:c1fef7686472
    26 
    26 
    27 NS_LOG_COMPONENT_DEFINE ("EthernetTrailer");
    27 NS_LOG_COMPONENT_DEFINE ("EthernetTrailer");
    28 
    28 
    29 namespace ns3 {
    29 namespace ns3 {
    30 
    30 
    31 NS_TRAILER_ENSURE_REGISTERED (EthernetTrailer);
       
    32 NS_OBJECT_ENSURE_REGISTERED (EthernetTrailer);
    31 NS_OBJECT_ENSURE_REGISTERED (EthernetTrailer);
    33 
    32 
    34 bool EthernetTrailer::m_calcFcs = false;
    33 bool EthernetTrailer::m_calcFcs = false;
    35 
       
    36 TypeId 
       
    37 EthernetTrailer::GetTypeId (void)
       
    38 {
       
    39   static TypeId tid = TypeId ("ns3::EthernetTrailer")
       
    40     .SetParent<Trailer> ()
       
    41     ;
       
    42   return tid;
       
    43 }
       
    44 TypeId 
       
    45 EthernetTrailer::GetInstanceTypeId (void) const
       
    46 {
       
    47   return GetTypeId ();
       
    48 }
       
    49 
       
    50 uint32_t
       
    51 EthernetTrailer::GetUid (void)
       
    52 {
       
    53   static uint32_t uid = AllocateUid<EthernetTrailer> ("EthernetTrailer.ns3");
       
    54   return uid;
       
    55 }
       
    56 
    34 
    57 EthernetTrailer::EthernetTrailer ()
    35 EthernetTrailer::EthernetTrailer ()
    58 {
    36 {
    59   Init();
    37   Init();
    60 }
    38 }
    74 EthernetTrailer::CheckFcs (Ptr<Packet> p) const
    52 EthernetTrailer::CheckFcs (Ptr<Packet> p) const
    75 {
    53 {
    76   if (!m_calcFcs)
    54   if (!m_calcFcs)
    77     {
    55     {
    78       return true;
    56       return true;
    79     } else {
    57     } 
       
    58   else 
       
    59     {
    80       NS_LOG_WARN ("FCS calculation is not yet enabled");
    60       NS_LOG_WARN ("FCS calculation is not yet enabled");
    81       return false;
    61       return false;
    82     }
    62     }
    83 }
    63 }
    84 
    64 
   103 uint32_t
    83 uint32_t
   104 EthernetTrailer::GetTrailerSize (void) const
    84 EthernetTrailer::GetTrailerSize (void) const
   105 {
    85 {
   106   return GetSerializedSize();
    86   return GetSerializedSize();
   107 }
    87 }
   108 std::string
    88 
   109 EthernetTrailer::GetName (void) const
    89 TypeId 
       
    90 EthernetTrailer::GetTypeId (void)
   110 {
    91 {
   111   return "ETHERNET";
    92   static TypeId tid = TypeId ("ns3::EthernetTrailer")
       
    93     .SetParent<Trailer> ()
       
    94     ;
       
    95   return tid;
   112 }
    96 }
   113 
    97 TypeId 
       
    98 EthernetTrailer::GetInstanceTypeId (void) const
       
    99 {
       
   100   return GetTypeId ();
       
   101 }
   114 void 
   102 void 
   115 EthernetTrailer::Print (std::ostream &os) const
   103 EthernetTrailer::Print (std::ostream &os) const
   116 {
   104 {
   117   os << " fcs=" << m_fcs;
   105   os << " fcs=" << m_fcs;
   118 }
   106 }