A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
sll-header.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2015 Université Pierre et Marie Curie
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Matthieu Coudron <matthieu.coudron@lip6.fr>
7
*/
8
#ifndef SLL_HEADER_H
9
#define SLL_HEADER_H
10
11
#include "ns3/buffer.h"
12
#include "ns3/header.h"
13
14
#include <stdint.h>
15
16
namespace
ns3
17
{
18
19
/**
20
* \ingroup packet
21
*
22
* \brief Protocol header serialization and deserialization.
23
*
24
* Libpcap sometimes add an additional header to provide information that would be
25
* lost otherwise due to the link-layer/capture mechanism, for instance when capturing from
26
* "nlmon" device on linux
27
*
28
* \see http://www.tcpdump.org/linktypes/LINKTYPE_LINUX_SLL.html
29
* \see https://wiki.wireshark.org/SLL
30
*
31
\verbatim
32
+---------------------------+
33
| Packet type |
34
| (2 Octets) |
35
+---------------------------+
36
| ARPHRD_ type |
37
| (2 Octets) |
38
+---------------------------+
39
| Link-layer address length |
40
| (2 Octets) |
41
+---------------------------+
42
| Link-layer address |
43
| (8 Octets) |
44
+---------------------------+
45
| Protocol type |
46
| (2 Octets) |
47
+---------------------------+
48
| Payload |
49
. .
50
. .
51
. .
52
\endverbatim
53
*/
54
class
SllHeader
:
public
Header
55
{
56
public
:
57
/**
58
* Type of the packet.
59
*/
60
enum
PacketType
61
{
62
UNICAST_FROM_PEER_TO_ME
= 0,
/**< the packet was specifically sent to us by somebody else */
63
BROADCAST_BY_PEER
= 1,
/**< packet was broadcast by somebody else */
64
MULTICAST_BY_PEER
= 2,
/**< packet was multicast, but not broadcast, by somebody else */
65
INTERCEPTED_PACKET
= 3,
/**< packet was sent to somebody else by somebody else **/
66
SENT_BY_US
/**< the packet was sent by us */
67
};
68
69
/**
70
* \brief Get the type ID.
71
* \return the object TypeId
72
*/
73
static
TypeId
GetTypeId
();
74
75
SllHeader
();
76
~SllHeader
()
override
;
77
78
/**
79
* \return ARP header type field in network byte order
80
* The ARPHRD_ type field is in network byte order; it contains a Linux ARPHRD_ value for the
81
* link-layer device type.
82
*/
83
uint16_t
GetArpType
()
const
;
84
85
/**
86
* \param arphdType ARP protocol hardware identifier
87
*/
88
void
SetArpType
(uint16_t arphdType);
89
90
/**
91
* \return Packet type
92
*/
93
PacketType
GetPacketType
()
const
;
94
95
/**
96
* \param type Depends on source and address of the packet
97
*/
98
void
SetPacketType
(PacketType type);
99
100
// Inherited from ObjectBase
101
TypeId
GetInstanceTypeId
()
const override
;
102
// Inherited from Header
103
uint32_t
GetSerializedSize
()
const override
;
104
void
Serialize
(
Buffer::Iterator
start)
const override
;
105
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
106
void
Print
(std::ostream& os)
const override
;
107
108
protected
:
109
// declared in packet order
110
PacketType
m_packetType
;
/**< Packet type */
111
uint16_t
m_arphdType
;
/**< ARP protocol hardware identifier */
112
uint16_t
m_addressLength
;
/**< Address length */
113
uint64_t
m_address
;
/**< Address */
114
uint16_t
m_protocolType
;
/**< protocol type */
115
};
116
117
}
// namespace ns3
118
119
#endif
/* SLL_HEADER_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::SllHeader
Protocol header serialization and deserialization.
Definition
sll-header.h:55
ns3::SllHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
sll-header.cc:45
ns3::SllHeader::SetArpType
void SetArpType(uint16_t arphdType)
Definition
sll-header.cc:57
ns3::SllHeader::m_addressLength
uint16_t m_addressLength
Address length.
Definition
sll-header.h:112
ns3::SllHeader::GetArpType
uint16_t GetArpType() const
Definition
sll-header.cc:51
ns3::SllHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
sll-header.cc:83
ns3::SllHeader::m_packetType
PacketType m_packetType
Packet type.
Definition
sll-header.h:110
ns3::SllHeader::~SllHeader
~SllHeader() override
Definition
sll-header.cc:29
ns3::SllHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
sll-header.cc:35
ns3::SllHeader::PacketType
PacketType
Type of the packet.
Definition
sll-header.h:61
ns3::SllHeader::BROADCAST_BY_PEER
@ BROADCAST_BY_PEER
packet was broadcast by somebody else
Definition
sll-header.h:63
ns3::SllHeader::INTERCEPTED_PACKET
@ INTERCEPTED_PACKET
packet was sent to somebody else by somebody else
Definition
sll-header.h:65
ns3::SllHeader::UNICAST_FROM_PEER_TO_ME
@ UNICAST_FROM_PEER_TO_ME
the packet was specifically sent to us by somebody else
Definition
sll-header.h:62
ns3::SllHeader::MULTICAST_BY_PEER
@ MULTICAST_BY_PEER
packet was multicast, but not broadcast, by somebody else
Definition
sll-header.h:64
ns3::SllHeader::SENT_BY_US
@ SENT_BY_US
the packet was sent by us
Definition
sll-header.h:66
ns3::SllHeader::m_arphdType
uint16_t m_arphdType
ARP protocol hardware identifier.
Definition
sll-header.h:111
ns3::SllHeader::GetPacketType
PacketType GetPacketType() const
Definition
sll-header.cc:64
ns3::SllHeader::SetPacketType
void SetPacketType(PacketType type)
Definition
sll-header.cc:70
ns3::SllHeader::m_protocolType
uint16_t m_protocolType
protocol type
Definition
sll-header.h:114
ns3::SllHeader::m_address
uint64_t m_address
Address.
Definition
sll-header.h:113
ns3::SllHeader::SllHeader
SllHeader()
Definition
sll-header.cc:19
ns3::SllHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Definition
sll-header.cc:100
ns3::SllHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Definition
sll-header.cc:89
ns3::SllHeader::Print
void Print(std::ostream &os) const override
Definition
sll-header.cc:77
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
network
utils
sll-header.h
Generated on Fri Nov 8 2024 13:59:05 for ns-3 by
1.11.0