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 |