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