src/node/llc-snap-header.cc
changeset 1232 2e8c3f8bb77f
parent 1152 1d06449f0a98
child 1234 ca195a6a7e1e
equal deleted inserted replaced
1231:01baeebb110e 1232:2e8c3f8bb77f
    36 }
    36 }
    37 
    37 
    38 LlcSnapHeader::LlcSnapHeader ()
    38 LlcSnapHeader::LlcSnapHeader ()
    39 {}
    39 {}
    40 
    40 
    41 LlcSnapHeader::~LlcSnapHeader ()
       
    42 {}
       
    43 void 
    41 void 
    44 LlcSnapHeader::SetType (uint16_t type)
    42 LlcSnapHeader::SetType (uint16_t type)
    45 {
    43 {
    46   m_etherType = type;
    44   m_etherType = type;
    47 }
    45 }
    56 {
    54 {
    57   return 1 + 1 + 1 + 3 + 2;
    55   return 1 + 1 + 1 + 3 + 2;
    58 }
    56 }
    59 
    57 
    60 std::string
    58 std::string
    61 LlcSnapHeader::DoGetName (void) const
    59 LlcSnapHeader::GetName (void) const
    62 {
    60 {
    63   return "LLCSNAP";
    61   return "LLCSNAP";
    64 }
    62 }
    65 
    63 
    66 void 
    64 void 
    67 LlcSnapHeader::PrintTo (std::ostream &os) const
    65 LlcSnapHeader::Print (std::ostream &os) const
    68 {
    66 {
    69   os << "(type 0x";
    67   os << "(type 0x";
    70   os.setf (std::ios::hex, std::ios::basefield);
    68   os.setf (std::ios::hex, std::ios::basefield);
    71   os << m_etherType;
    69   os << m_etherType;
    72   os.setf (std::ios::dec, std::ios::basefield);
    70   os.setf (std::ios::dec, std::ios::basefield);
    73   os << ")";
    71   os << ")";
    74 }
    72 }
    75 
    73 
    76 void
    74 void
    77 LlcSnapHeader::SerializeTo (Buffer::Iterator start) const
    75 LlcSnapHeader::Serialize (Buffer::Iterator start) const
    78 {
    76 {
    79   Buffer::Iterator i = start;
    77   Buffer::Iterator i = start;
    80   uint8_t buf[] = {0xaa, 0xaa, 0x03, 0, 0, 0};
    78   uint8_t buf[] = {0xaa, 0xaa, 0x03, 0, 0, 0};
    81   i.Write (buf, 6);
    79   i.Write (buf, 6);
    82   i.WriteHtonU16 (m_etherType);
    80   i.WriteHtonU16 (m_etherType);
    83 }
    81 }
    84 uint32_t
    82 uint32_t
    85 LlcSnapHeader::DeserializeFrom (Buffer::Iterator start)
    83 LlcSnapHeader::Deserialize (Buffer::Iterator start)
    86 {
    84 {
    87   Buffer::Iterator i = start;
    85   Buffer::Iterator i = start;
    88   i.Next (5+1);
    86   i.Next (5+1);
    89   m_etherType = i.ReadNtohU16 ();
    87   m_etherType = i.ReadNtohU16 ();
    90   return GetSerializedSize ();
    88   return GetSerializedSize ();
    91 }
    89 }
    92 
    90 
    93 
    91 
    94 }; // namespace ns3
    92 } // namespace ns3