A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ipv6-option.h
1 /* -*- Mode: C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007-2009 Strasbourg University
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, MA02111-1307USA
17  *
18  * Author: David Gross <gdavid.devel@gmail.com>
19  */
20 
21 #ifndef IPV6_OPTION_H
22 #define IPV6_OPTION_H
23 
24 #include <map>
25 
26 #include "ns3/object.h"
27 #include "ns3/node.h"
28 #include "ns3/ptr.h"
29 #include "ipv6-interface.h"
30 #include "ns3/ipv6-header.h"
31 #include "ns3/buffer.h"
32 #include "ns3/packet.h"
33 #include "ns3/ipv6-address.h"
34 
35 namespace ns3
36 {
37 
45 class Ipv6Option : public Object
46 {
47 public:
52  static TypeId GetTypeId ();
53 
57  virtual ~Ipv6Option ();
58 
63  void SetNode (Ptr<Node> node);
64 
69  virtual uint8_t GetOptionNumber () const = 0;
70 
81  virtual uint8_t Process (Ptr<Packet> packet, uint8_t offset, Ipv6Header const& ipv6Header, bool& isDropped) = 0;
82 
83 private:
88 };
89 
94 class Ipv6OptionPad1 : public Ipv6Option
95 {
96 public:
100  static const uint8_t OPT_NUMBER = 0;
101 
106  static TypeId GetTypeId ();
107 
111  Ipv6OptionPad1 ();
112 
116  ~Ipv6OptionPad1 ();
117 
122  virtual uint8_t GetOptionNumber () const;
123 
134  virtual uint8_t Process (Ptr<Packet> packet, uint8_t offset, Ipv6Header const& ipv6Header, bool& isDropped);
135 };
136 
142 {
143 public:
147  static const uint8_t OPT_NUMBER = 60;
148 
153  static TypeId GetTypeId ();
154 
158  Ipv6OptionPadn ();
159 
163  ~Ipv6OptionPadn ();
164 
169  virtual uint8_t GetOptionNumber () const;
170 
181  virtual uint8_t Process (Ptr<Packet> packet, uint8_t offset, Ipv6Header const& ipv6Header, bool& isDropped);
182 };
183 
189 {
190 public:
194  static const uint8_t OPT_NUMBER = 44;
195 
200  static TypeId GetTypeId ();
201 
206 
211 
216  virtual uint8_t GetOptionNumber () const;
217 
227  virtual uint8_t Process (Ptr<Packet> packet, uint8_t offset, Ipv6Header const& ipv6Header, bool& isDropped);
228 
229 private:
233  uint32_t m_length;
234 };
235 
241 {
242 public:
246  static const uint8_t OPT_NUMBER = 43;
247 
252  static TypeId GetTypeId ();
253 
258 
263 
268  virtual uint8_t GetOptionNumber () const;
269 
280  virtual uint8_t Process (Ptr<Packet> packet, uint8_t offset, Ipv6Header const& ipv6Header, bool& isDropped);
281 };
282 
283 } /* namespace ns3 */
284 
285 #endif /* IPV6_OPTION_H */
286 
Packet header for IPv6.
Definition: ipv6-header.h:33
Ipv6OptionRouterAlert()
Constructor.
Definition: ipv6-option.cc:201
virtual ~Ipv6Option()
Destructor.
Definition: ipv6-option.cc:46
IPv6 Option Pad1.
Definition: ipv6-option.h:94
static TypeId GetTypeId()
Get the type identificator.
Definition: ipv6-option.cc:148
static TypeId GetTypeId()
Get the type identificator.
Definition: ipv6-option.cc:104
Ipv6OptionPadn()
Constructor.
Definition: ipv6-option.cc:113
static const uint8_t OPT_NUMBER
Router alert option number.
Definition: ipv6-option.h:246
static const uint8_t OPT_NUMBER
Pad1 option number.
Definition: ipv6-option.h:100
Ipv6OptionJumbogram()
Constructor.
Definition: ipv6-option.cc:157
static TypeId GetTypeId()
Get the type identificator.
Definition: ipv6-option.cc:34
Ipv6OptionPad1()
Constructor.
Definition: ipv6-option.cc:69
~Ipv6OptionPad1()
Destructor.
Definition: ipv6-option.cc:74
virtual uint8_t GetOptionNumber() const
Get the option number.
Definition: ipv6-option.cc:79
virtual uint8_t Process(Ptr< Packet > packet, uint8_t offset, Ipv6Header const &ipv6Header, bool &isDropped)
Process method Called from Ipv6L3Protocol::Receive.
Definition: ipv6-option.cc:174
void SetNode(Ptr< Node > node)
Set the node.
Definition: ipv6-option.cc:51
~Ipv6OptionRouterAlert()
Destructor.
Definition: ipv6-option.cc:206
static const uint8_t OPT_NUMBER
PadN option number.
Definition: ipv6-option.h:147
virtual uint8_t Process(Ptr< Packet > packet, uint8_t offset, Ipv6Header const &ipv6Header, bool &isDropped)
Process method.
Definition: ipv6-option.cc:86
virtual uint8_t GetOptionNumber() const =0
Get the option number.
static TypeId GetTypeId()
Get the type identificator.
Definition: ipv6-option.cc:192
IPv6 Option Padn.
Definition: ipv6-option.h:141
~Ipv6OptionPadn()
Destructor.
Definition: ipv6-option.cc:118
IPv6 Option Router Alert.
Definition: ipv6-option.h:240
uint32_t m_length
The length of the packet.
Definition: ipv6-option.h:233
virtual uint8_t GetOptionNumber() const
Get the option number.
Definition: ipv6-option.cc:123
~Ipv6OptionJumbogram()
Destructor.
Definition: ipv6-option.cc:162
virtual uint8_t GetOptionNumber() const
Get the option number.
Definition: ipv6-option.cc:211
virtual uint8_t GetOptionNumber() const
Get the option number.
Definition: ipv6-option.cc:167
static TypeId GetTypeId()
Get the type identificator.
Definition: ipv6-option.cc:60
static const uint8_t OPT_NUMBER
Jumbogram option number.
Definition: ipv6-option.h:194
Ptr< Node > m_node
The node.
Definition: ipv6-option.h:87
virtual uint8_t Process(Ptr< Packet > packet, uint8_t offset, Ipv6Header const &ipv6Header, bool &isDropped)=0
Process method.
a base class which provides memory management and object aggregation
Definition: object.h:63
virtual uint8_t Process(Ptr< Packet > packet, uint8_t offset, Ipv6Header const &ipv6Header, bool &isDropped)
Process method.
Definition: ipv6-option.cc:218
IPv6 Option Jumbogram.
Definition: ipv6-option.h:188
IPv6 Option base.
Definition: ipv6-option.h:45
a unique identifier for an interface.
Definition: type-id.h:44
virtual uint8_t Process(Ptr< Packet > packet, uint8_t offset, Ipv6Header const &ipv6Header, bool &isDropped)
Process method.
Definition: ipv6-option.cc:130