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
ipv6-packet-info-tag.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 Hajime Tazaki
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Authors: Hajime Tazaki <tazaki@sfc.wide.ad.jp>
7
*/
8
9
#ifndef IPV6_PACKET_INFO_TAG_H
10
#define IPV6_PACKET_INFO_TAG_H
11
12
#include "ns3/ipv6-address.h"
13
#include "ns3/tag.h"
14
15
namespace
ns3
16
{
17
18
class
Node;
19
class
Packet;
20
21
/**
22
* \ingroup ipv6
23
*
24
* \brief This class implements a tag that carries socket ancillary
25
* data to the socket interface. This is used like
26
* socket option of IP_PKTINFO/IPV6_PKTINFO in \RFC{3542}
27
*
28
* See also SocketIpv6TclassTag and SocketIpv6HopLimitTag
29
*
30
* This tag in the send direction is presently not enabled but we
31
* would accept a patch along those lines in the future. To include
32
* the nexthop in the send direction would increase the size of the
33
* tag beyond 20 bytes, so in that case, we recommend that an
34
* additional tag be used to carry the IPv6 next hop address.
35
*/
36
class
Ipv6PacketInfoTag
:
public
Tag
37
{
38
public
:
39
Ipv6PacketInfoTag
();
40
41
/**
42
* \brief Get the type ID.
43
* \return the object TypeId
44
*/
45
static
TypeId
GetTypeId
();
46
47
/**
48
* \brief Set the tag's address
49
*
50
* \param addr the address
51
*/
52
void
SetAddress
(
Ipv6Address
addr);
53
54
/**
55
* \brief Get the tag's address
56
*
57
* \returns the address
58
*/
59
Ipv6Address
GetAddress
()
const
;
60
61
/**
62
* \brief Set the tag's receiving interface
63
*
64
* \param ifindex the interface index
65
*/
66
void
SetRecvIf
(
uint32_t
ifindex);
67
68
/**
69
* \brief Get the tag's receiving interface
70
*
71
* \returns the interface index
72
*/
73
uint32_t
GetRecvIf
()
const
;
74
75
/**
76
* \brief Set the tag's Hop Limit
77
*
78
* \param ttl the hop limit
79
*/
80
void
SetHoplimit
(uint8_t ttl);
81
82
/**
83
* \brief Get the tag's Hop Limit
84
*
85
* \returns the Hop Limit
86
*/
87
uint8_t
GetHoplimit
()
const
;
88
89
/**
90
* \brief Set the tag's Traffic Class
91
*
92
* \param tclass the Traffic Class
93
*/
94
void
SetTrafficClass
(uint8_t tclass);
95
96
/**
97
* \brief Get the tag's Traffic Class
98
*
99
* \returns the Traffic Class
100
*/
101
uint8_t
GetTrafficClass
()
const
;
102
103
// inherited functions, no doc necessary
104
TypeId
GetInstanceTypeId
()
const override
;
105
uint32_t
GetSerializedSize
()
const override
;
106
void
Serialize
(
TagBuffer
i)
const override
;
107
void
Deserialize
(
TagBuffer
i)
override
;
108
void
Print
(std::ostream& os)
const override
;
109
110
private
:
111
/*
112
* RFC 3542 includes
113
* for outgoing packet,
114
* 1. the source IPv6 address,
115
* 2. the outgoing interface index,
116
* 3. the outgoing hop limit,
117
* 4. the next hop address, and
118
* 5. the outgoing traffic class value.
119
*
120
* for incoming packet,
121
* 1. the destination IPv6 address,
122
* 2. the arriving interface index,
123
* 3. the arriving hop limit, and
124
* 4. the arriving traffic class value.
125
*/
126
Ipv6Address
m_addr
;
//!< the packet address (src or dst)
127
uint8_t
m_ifindex
;
//!< the Interface index
128
uint8_t
m_hoplimit
;
//!< the Hop Limit
129
uint8_t
m_tclass
;
//!< the Traffic Class
130
};
131
}
// namespace ns3
132
133
#endif
/* IPV6_PACKET_INFO_TAG_H */
ns3::Ipv6Address
Describes an IPv6 address.
Definition
ipv6-address.h:38
ns3::Ipv6PacketInfoTag
This class implements a tag that carries socket ancillary data to the socket interface.
Definition
ipv6-packet-info-tag.h:37
ns3::Ipv6PacketInfoTag::Deserialize
void Deserialize(TagBuffer i) override
Definition
ipv6-packet-info-tag.cc:108
ns3::Ipv6PacketInfoTag::Ipv6PacketInfoTag
Ipv6PacketInfoTag()
Definition
ipv6-packet-info-tag.cc:18
ns3::Ipv6PacketInfoTag::SetTrafficClass
void SetTrafficClass(uint8_t tclass)
Set the tag's Traffic Class.
Definition
ipv6-packet-info-tag.cc:63
ns3::Ipv6PacketInfoTag::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition
ipv6-packet-info-tag.cc:85
ns3::Ipv6PacketInfoTag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
ipv6-packet-info-tag.cc:75
ns3::Ipv6PacketInfoTag::Print
void Print(std::ostream &os) const override
Definition
ipv6-packet-info-tag.cc:119
ns3::Ipv6PacketInfoTag::m_addr
Ipv6Address m_addr
the packet address (src or dst)
Definition
ipv6-packet-info-tag.h:126
ns3::Ipv6PacketInfoTag::Serialize
void Serialize(TagBuffer i) const override
Definition
ipv6-packet-info-tag.cc:97
ns3::Ipv6PacketInfoTag::m_tclass
uint8_t m_tclass
the Traffic Class
Definition
ipv6-packet-info-tag.h:129
ns3::Ipv6PacketInfoTag::m_ifindex
uint8_t m_ifindex
the Interface index
Definition
ipv6-packet-info-tag.h:127
ns3::Ipv6PacketInfoTag::GetAddress
Ipv6Address GetAddress() const
Get the tag's address.
Definition
ipv6-packet-info-tag.cc:33
ns3::Ipv6PacketInfoTag::SetRecvIf
void SetRecvIf(uint32_t ifindex)
Set the tag's receiving interface.
Definition
ipv6-packet-info-tag.cc:39
ns3::Ipv6PacketInfoTag::SetHoplimit
void SetHoplimit(uint8_t ttl)
Set the tag's Hop Limit.
Definition
ipv6-packet-info-tag.cc:51
ns3::Ipv6PacketInfoTag::GetHoplimit
uint8_t GetHoplimit() const
Get the tag's Hop Limit.
Definition
ipv6-packet-info-tag.cc:57
ns3::Ipv6PacketInfoTag::GetTrafficClass
uint8_t GetTrafficClass() const
Get the tag's Traffic Class.
Definition
ipv6-packet-info-tag.cc:69
ns3::Ipv6PacketInfoTag::m_hoplimit
uint8_t m_hoplimit
the Hop Limit
Definition
ipv6-packet-info-tag.h:128
ns3::Ipv6PacketInfoTag::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition
ipv6-packet-info-tag.cc:91
ns3::Ipv6PacketInfoTag::GetRecvIf
uint32_t GetRecvIf() const
Get the tag's receiving interface.
Definition
ipv6-packet-info-tag.cc:45
ns3::Ipv6PacketInfoTag::SetAddress
void SetAddress(Ipv6Address addr)
Set the tag's address.
Definition
ipv6-packet-info-tag.cc:27
ns3::TagBuffer
read and write tag data
Definition
tag-buffer.h:41
ns3::Tag
tag a set of bytes in a packet
Definition
tag.h:28
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
internet
model
ipv6-packet-info-tag.h
Generated on Fri Nov 8 2024 13:59:01 for ns-3 by
1.11.0