A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
ipv4-packet-info-tag.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 Hajime Tazaki
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
* Authors: Hajime Tazaki <tazaki@sfc.wide.ad.jp>
18
*/
19
20
#ifndef IPV4_PACKET_INFO_TAG_H
21
#define IPV4_PACKET_INFO_TAG_H
22
23
#include "ns3/ipv4-address.h"
24
#include "ns3/tag.h"
25
26
namespace
ns3
27
{
28
29
class
Node;
30
class
Packet;
31
48
class
Ipv4PacketInfoTag
:
public
Tag
49
{
50
public
:
51
Ipv4PacketInfoTag
();
52
58
void
SetAddress
(
Ipv4Address
addr);
59
65
Ipv4Address
GetAddress
()
const
;
66
72
void
SetRecvIf
(uint32_t ifindex);
78
uint32_t
GetRecvIf
()
const
;
79
85
void
SetTtl
(uint8_t ttl);
91
uint8_t
GetTtl
()
const
;
92
97
static
TypeId
GetTypeId
();
98
TypeId
GetInstanceTypeId
()
const override
;
99
uint32_t
GetSerializedSize
()
const override
;
100
void
Serialize
(
TagBuffer
i)
const override
;
101
void
Deserialize
(
TagBuffer
i)
override
;
102
void
Print
(std::ostream& os)
const override
;
103
104
private
:
105
// Linux IP_PKTINFO ip(7) implementation
106
//
107
// struct in_pktinfo {
108
// unsigned int ipi_ifindex; /* Interface index */
109
// struct in_addr ipi_spec_dst; /* Local address */
110
// struct in_addr ipi_addr; /* Header Destination
111
// address */
112
// };
113
114
Ipv4Address
m_addr
;
115
uint32_t
m_ifindex
;
116
117
// Used for IP_RECVTTL, though not implemented yet.
118
uint8_t
m_ttl
;
119
};
120
}
// namespace ns3
121
122
#endif
/* IPV4_PACKET_INFO_TAG_H */
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:42
ns3::Ipv4PacketInfoTag
This class implements Linux struct pktinfo in order to deliver ancillary information to the socket in...
Definition:
ipv4-packet-info-tag.h:49
ns3::Ipv4PacketInfoTag::Print
void Print(std::ostream &os) const override
Definition:
ipv4-packet-info-tag.cc:129
ns3::Ipv4PacketInfoTag::m_ttl
uint8_t m_ttl
Time to Live.
Definition:
ipv4-packet-info-tag.h:118
ns3::Ipv4PacketInfoTag::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
ipv4-packet-info-tag.cc:83
ns3::Ipv4PacketInfoTag::SetRecvIf
void SetRecvIf(uint32_t ifindex)
Set the tag's receiving interface.
Definition:
ipv4-packet-info-tag.cc:55
ns3::Ipv4PacketInfoTag::Ipv4PacketInfoTag
Ipv4PacketInfoTag()
Definition:
ipv4-packet-info-tag.cc:32
ns3::Ipv4PacketInfoTag::SetAddress
void SetAddress(Ipv4Address addr)
Set the tag's address.
Definition:
ipv4-packet-info-tag.cc:41
ns3::Ipv4PacketInfoTag::GetTtl
uint8_t GetTtl() const
Get the tag's Time to Live Implemented, but not used in the stack yet.
Definition:
ipv4-packet-info-tag.cc:76
ns3::Ipv4PacketInfoTag::GetRecvIf
uint32_t GetRecvIf() const
Get the tag's receiving interface.
Definition:
ipv4-packet-info-tag.cc:62
ns3::Ipv4PacketInfoTag::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
Definition:
ipv4-packet-info-tag.cc:93
ns3::Ipv4PacketInfoTag::m_addr
Ipv4Address m_addr
Header destination address.
Definition:
ipv4-packet-info-tag.h:114
ns3::Ipv4PacketInfoTag::Serialize
void Serialize(TagBuffer i) const override
Definition:
ipv4-packet-info-tag.cc:107
ns3::Ipv4PacketInfoTag::SetTtl
void SetTtl(uint8_t ttl)
Set the tag's Time to Live Implemented, but not used in the stack yet.
Definition:
ipv4-packet-info-tag.cc:69
ns3::Ipv4PacketInfoTag::GetSerializedSize
uint32_t GetSerializedSize() const override
Definition:
ipv4-packet-info-tag.cc:100
ns3::Ipv4PacketInfoTag::m_ifindex
uint32_t m_ifindex
interface index
Definition:
ipv4-packet-info-tag.h:115
ns3::Ipv4PacketInfoTag::GetAddress
Ipv4Address GetAddress() const
Get the tag's address.
Definition:
ipv4-packet-info-tag.cc:48
ns3::Ipv4PacketInfoTag::Deserialize
void Deserialize(TagBuffer i) override
Definition:
ipv4-packet-info-tag.cc:118
ns3::TagBuffer
read and write tag data
Definition:
tag-buffer.h:52
ns3::Tag
tag a set of bytes in a packet
Definition:
tag.h:39
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
internet
model
ipv4-packet-info-tag.h
Generated on Sun Mar 3 2024 17:10:58 for ns-3 by
1.9.1