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