A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
44 class Ipv6PacketInfoTag : public Tag
45 {
46 public:
48  // Implemented, but not used in the stack yet
49  void SetAddress (Ipv6Address addr);
50  // Implemented, but not used in the stack yet
51  Ipv6Address GetAddress (void) const;
52  void SetRecvIf (uint32_t ifindex);
53  uint32_t GetRecvIf (void) const;
54  // Implemented, but not used in the stack yet
55  void SetHoplimit (uint8_t ttl);
56  // Implemented, but not used in the stack yet
57  uint8_t GetHoplimit (void) const;
58  // Implemented, but not used in the stack yet
59  void SetTrafficClass (uint8_t tclass);
60  // Implemented, but not used in the stack yet
61  uint8_t GetTrafficClass (void) const;
62 
63  static TypeId GetTypeId (void);
64  virtual TypeId GetInstanceTypeId (void) const;
65  virtual uint32_t GetSerializedSize (void) const;
66  virtual void Serialize (TagBuffer i) const;
67  virtual void Deserialize (TagBuffer i);
68  virtual void Print (std::ostream &os) const;
69 
70 private:
71  /*
72  * RFC 3542 includes
73  * for outgoing packet,
74  * 1. the source IPv6 address,
75  * 2. the outgoing interface index,
76  * 3. the outgoing hop limit,
77  * 4. the next hop address, and
78  * 5. the outgoing traffic class value.
79  *
80  * for incoming packet,
81  * 1. the destination IPv6 address,
82  * 2. the arriving interface index,
83  * 3. the arriving hop limit, and
84  * 4. the arriving traffic class value.
85  */
87  uint8_t m_ifindex;
88  uint8_t m_hoplimit;
89  uint8_t m_tclass;
90 };
91 } // namespace ns3
92 
93 #endif /* IPV6_PACKET_INFO_TAG_H */
94 
void SetAddress(Ipv6Address addr)
void SetTrafficClass(uint8_t tclass)
virtual TypeId GetInstanceTypeId(void) const
virtual void Print(std::ostream &os) const
uint8_t GetHoplimit(void) const
virtual uint32_t GetSerializedSize(void) const
Ipv6Address GetAddress(void) const
void SetHoplimit(uint8_t ttl)
tag a set of bytes in a packet
Definition: tag.h:36
virtual void Serialize(TagBuffer i) const
uint8_t GetTrafficClass(void) const
Describes an IPv6 address.
Definition: ipv6-address.h:46
read and write tag data
Definition: tag-buffer.h:51
uint32_t GetRecvIf(void) const
This class implements a tag that carries socket ancillary data to the socket interface. This is used like socket option of IP_PKTINFO/IPV6_PKTINFO in RFC 3542
a unique identifier for an interface.
Definition: type-id.h:49
void SetRecvIf(uint32_t ifindex)
virtual void Deserialize(TagBuffer i)
static TypeId GetTypeId(void)