A Discrete-Event Network Simulator
API
llc-snap-header.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18  */
19 
20 #ifndef LLC_SNAP_HEADER_H
21 #define LLC_SNAP_HEADER_H
22 
23 #include "ns3/header.h"
24 
25 #include <stdint.h>
26 #include <string>
27 
28 namespace ns3
29 {
30 
34 static const uint16_t LLC_SNAP_HEADER_LENGTH = 8;
35 
44 class LlcSnapHeader : public Header
45 {
46  public:
47  LlcSnapHeader();
48 
53  void SetType(uint16_t type);
58  uint16_t GetType();
59 
64  static TypeId GetTypeId();
65  TypeId GetInstanceTypeId() const override;
66  void Print(std::ostream& os) const override;
67  uint32_t GetSerializedSize() const override;
68  void Serialize(Buffer::Iterator start) const override;
69  uint32_t Deserialize(Buffer::Iterator start) override;
70 
71  private:
72  uint16_t m_etherType;
73 };
74 
75 } // namespace ns3
76 
77 #endif /* LLC_SNAP_HEADER_H */
iterator in a Buffer instance
Definition: buffer.h:100
Protocol header serialization and deserialization.
Definition: header.h:44
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
Header for the LLC/SNAP encapsulation.
uint16_t m_etherType
the Ethertype
void Print(std::ostream &os) const override
static TypeId GetTypeId()
Get the type ID.
uint16_t GetType()
Return the Ethertype.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
uint32_t GetSerializedSize() const override
void Serialize(Buffer::Iterator start) const override
void SetType(uint16_t type)
Set the Ethertype.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const uint16_t LLC_SNAP_HEADER_LENGTH
The length in octets of the LLC/SNAP header.