A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
28namespace ns3
29{
30
31/**
32 * The length in octets of the LLC/SNAP header
33 */
34static const uint16_t LLC_SNAP_HEADER_LENGTH = 8;
35
36/**
37 * \ingroup network
38 *
39 * \brief Header for the LLC/SNAP encapsulation
40 *
41 * For a list of EtherTypes, see
42 * http://www.iana.org/assignments/ieee-802-numbers/ieee-802-numbers.xhtml
43 */
44class LlcSnapHeader : public Header
45{
46 public:
48
49 /**
50 * \brief Set the Ethertype.
51 * \param type the Ethertype
52 */
53 void SetType(uint16_t type);
54 /**
55 * \brief Return the Ethertype.
56 * \return Ethertype
57 */
58 uint16_t GetType();
59
60 /**
61 * \brief Get the type ID.
62 * \return the object TypeId
63 */
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;
70
71 private:
72 uint16_t m_etherType; //!< the 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
Header for the LLC/SNAP encapsulation.
uint32_t Deserialize(Buffer::Iterator start) override
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.