A Discrete-Event Network Simulator
API
ipv4-packet-info-tag.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2010 Hajime Tazaki
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Authors: Hajime Tazaki <tazaki@sfc.wide.ad.jp>
19 */
20
21#ifndef IPV4_PACKET_INFO_TAG_H
22#define IPV4_PACKET_INFO_TAG_H
23
24#include "ns3/tag.h"
25#include "ns3/ipv4-address.h"
26
27namespace ns3 {
28
29
30class Node;
31class Packet;
32
49class Ipv4PacketInfoTag : public Tag
50{
51public:
53
59 void SetAddress (Ipv4Address addr);
60
66 Ipv4Address GetAddress (void) const;
67
73 void SetRecvIf (uint32_t ifindex);
79 uint32_t GetRecvIf (void) const;
80
86 void SetTtl (uint8_t ttl);
92 uint8_t GetTtl (void) const;
93
98 static TypeId GetTypeId (void);
99 virtual TypeId GetInstanceTypeId (void) const;
100 virtual uint32_t GetSerializedSize (void) const;
101 virtual void Serialize (TagBuffer i) const;
102 virtual void Deserialize (TagBuffer i);
103 virtual void Print (std::ostream &os) const;
104
105private:
106 // Linux IP_PKTINFO ip(7) implementation
107 //
108 // struct in_pktinfo {
109 // unsigned int ipi_ifindex; /* Interface index */
110 // struct in_addr ipi_spec_dst; /* Local address */
111 // struct in_addr ipi_addr; /* Header Destination
112 // address */
113 // };
114
117
118 // Used for IP_RECVTTL, though not implemented yet.
119 uint8_t m_ttl;
120};
121} // namespace ns3
122
123#endif /* IPV4_PACKET_INFO_TAG_H */
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
This class implements Linux struct pktinfo in order to deliver ancillary information to the socket in...
uint8_t m_ttl
Time to Live.
void SetRecvIf(uint32_t ifindex)
Set the tag's receiving interface.
virtual void Print(std::ostream &os) const
uint8_t GetTtl(void) const
Get the tag's Time to Live Implemented, but not used in the stack yet.
Ipv4Address GetAddress(void) const
Get the tag's address.
uint32_t GetRecvIf(void) const
Get the tag's receiving interface.
void SetAddress(Ipv4Address addr)
Set the tag's address.
Ipv4Address m_addr
Header destination address.
void SetTtl(uint8_t ttl)
Set the tag's Time to Live Implemented, but not used in the stack yet.
virtual void Deserialize(TagBuffer i)
uint32_t m_ifindex
interface index
static TypeId GetTypeId(void)
Get the type ID.
virtual void Serialize(TagBuffer i) const
virtual TypeId GetInstanceTypeId(void) const
Get the most derived TypeId for this Object.
virtual uint32_t GetSerializedSize(void) const
read and write tag data
Definition: tag-buffer.h:52
tag a set of bytes in a packet
Definition: tag.h:37
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.