A Discrete-Event Network Simulator
API
ipv6-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 IPV6_PACKET_INFO_TAG_H
21 #define IPV6_PACKET_INFO_TAG_H
22 
23 #include "ns3/ipv6-address.h"
24 #include "ns3/tag.h"
25 
26 namespace ns3
27 {
28 
29 class Node;
30 class Packet;
31 
47 class Ipv6PacketInfoTag : public Tag
48 {
49  public:
51 
56  static TypeId GetTypeId();
57 
63  void SetAddress(Ipv6Address addr);
64 
70  Ipv6Address GetAddress() const;
71 
77  void SetRecvIf(uint32_t ifindex);
78 
84  uint32_t GetRecvIf() const;
85 
91  void SetHoplimit(uint8_t ttl);
92 
98  uint8_t GetHoplimit() const;
99 
105  void SetTrafficClass(uint8_t tclass);
106 
112  uint8_t GetTrafficClass() const;
113 
114  // inherited functions, no doc necessary
115  TypeId GetInstanceTypeId() const override;
116  uint32_t GetSerializedSize() const override;
117  void Serialize(TagBuffer i) const override;
118  void Deserialize(TagBuffer i) override;
119  void Print(std::ostream& os) const override;
120 
121  private:
122  /*
123  * RFC 3542 includes
124  * for outgoing packet,
125  * 1. the source IPv6 address,
126  * 2. the outgoing interface index,
127  * 3. the outgoing hop limit,
128  * 4. the next hop address, and
129  * 5. the outgoing traffic class value.
130  *
131  * for incoming packet,
132  * 1. the destination IPv6 address,
133  * 2. the arriving interface index,
134  * 3. the arriving hop limit, and
135  * 4. the arriving traffic class value.
136  */
138  uint8_t m_ifindex;
139  uint8_t m_hoplimit;
140  uint8_t m_tclass;
141 };
142 } // namespace ns3
143 
144 #endif /* IPV6_PACKET_INFO_TAG_H */
Describes an IPv6 address.
Definition: ipv6-address.h:49
This class implements a tag that carries socket ancillary data to the socket interface.
void Deserialize(TagBuffer i) override
void SetTrafficClass(uint8_t tclass)
Set the tag's Traffic Class.
TypeId GetInstanceTypeId() const override
Get the most derived TypeId for this Object.
static TypeId GetTypeId()
Get the type ID.
void Print(std::ostream &os) const override
Ipv6Address m_addr
the packet address (src or dst)
void Serialize(TagBuffer i) const override
uint8_t m_tclass
the Traffic Class
uint8_t m_ifindex
the Interface index
Ipv6Address GetAddress() const
Get the tag's address.
void SetRecvIf(uint32_t ifindex)
Set the tag's receiving interface.
void SetHoplimit(uint8_t ttl)
Set the tag's Hop Limit.
uint8_t GetHoplimit() const
Get the tag's Hop Limit.
uint8_t GetTrafficClass() const
Get the tag's Traffic Class.
uint8_t m_hoplimit
the Hop Limit
uint32_t GetSerializedSize() const override
uint32_t GetRecvIf() const
Get the tag's receiving interface.
void SetAddress(Ipv6Address addr)
Set the tag's address.
read and write tag data
Definition: tag-buffer.h:52
tag a set of bytes in a packet
Definition: tag.h:39
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.