A Discrete-Event Network Simulator
API
ipv6-option.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2009 Strasbourg University
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, MA02111-1307USA
16  *
17  * Author: David Gross <gdavid.devel@gmail.com>
18  */
19 
20 #ifndef IPV6_OPTION_H
21 #define IPV6_OPTION_H
22 
23 #include "ipv6-header.h"
24 #include "ipv6-interface.h"
25 
26 #include "ns3/buffer.h"
27 #include "ns3/ipv6-address.h"
28 #include "ns3/node.h"
29 #include "ns3/object.h"
30 #include "ns3/packet.h"
31 #include "ns3/ptr.h"
32 
33 #include <map>
34 
35 namespace ns3
36 {
37 
46 class Ipv6Option : public Object
47 {
48  public:
53  static TypeId GetTypeId();
54 
58  ~Ipv6Option() override;
59 
64  void SetNode(Ptr<Node> node);
65 
70  virtual uint8_t GetOptionNumber() const = 0;
71 
82  virtual uint8_t Process(Ptr<Packet> packet,
83  uint8_t offset,
84  const Ipv6Header& ipv6Header,
85  bool& isDropped) = 0;
86 
87  private:
92 };
93 
99 class Ipv6OptionPad1 : public Ipv6Option
100 {
101  public:
105  static const uint8_t OPT_NUMBER = 0;
106 
111  static TypeId GetTypeId();
112 
116  Ipv6OptionPad1();
117 
121  ~Ipv6OptionPad1() override;
122 
127  uint8_t GetOptionNumber() const override;
128 
139  uint8_t Process(Ptr<Packet> packet,
140  uint8_t offset,
141  const Ipv6Header& ipv6Header,
142  bool& isDropped) override;
143 };
144 
151 {
152  public:
156  static const uint8_t OPT_NUMBER = 60;
157 
162  static TypeId GetTypeId();
163 
167  Ipv6OptionPadn();
168 
172  ~Ipv6OptionPadn() override;
173 
178  uint8_t GetOptionNumber() const override;
179 
190  uint8_t Process(Ptr<Packet> packet,
191  uint8_t offset,
192  const Ipv6Header& ipv6Header,
193  bool& isDropped) override;
194 };
195 
202 {
203  public:
207  static const uint8_t OPT_NUMBER = 44;
208 
213  static TypeId GetTypeId();
214 
219 
223  ~Ipv6OptionJumbogram() override;
224 
229  uint8_t GetOptionNumber() const override;
230 
240  uint8_t Process(Ptr<Packet> packet,
241  uint8_t offset,
242  const Ipv6Header& ipv6Header,
243  bool& isDropped) override;
244 };
245 
252 {
253  public:
257  static const uint8_t OPT_NUMBER = 43;
258 
263  static TypeId GetTypeId();
264 
269 
273  ~Ipv6OptionRouterAlert() override;
274 
279  uint8_t GetOptionNumber() const override;
280 
291  uint8_t Process(Ptr<Packet> packet,
292  uint8_t offset,
293  const Ipv6Header& ipv6Header,
294  bool& isDropped) override;
295 };
296 
297 } /* namespace ns3 */
298 
299 #endif /* IPV6_OPTION_H */
Packet header for IPv6.
Definition: ipv6-header.h:35
IPv6 Option base.
Definition: ipv6-option.h:47
static TypeId GetTypeId()
Get the type identificator.
Definition: ipv6-option.cc:36
~Ipv6Option() override
Destructor.
Definition: ipv6-option.cc:49
virtual uint8_t GetOptionNumber() const =0
Get the option number.
Ptr< Node > m_node
The node.
Definition: ipv6-option.h:91
virtual uint8_t Process(Ptr< Packet > packet, uint8_t offset, const Ipv6Header &ipv6Header, bool &isDropped)=0
Process method.
void SetNode(Ptr< Node > node)
Set the node.
Definition: ipv6-option.cc:55
IPv6 Option Jumbogram.
Definition: ipv6-option.h:202
uint8_t GetOptionNumber() const override
Get the option number.
Definition: ipv6-option.cc:182
~Ipv6OptionJumbogram() override
Destructor.
Definition: ipv6-option.cc:176
static TypeId GetTypeId()
Get the type identificator.
Definition: ipv6-option.cc:162
uint8_t Process(Ptr< Packet > packet, uint8_t offset, const Ipv6Header &ipv6Header, bool &isDropped) override
Process method Called from Ipv6L3Protocol::Receive.
Definition: ipv6-option.cc:190
static const uint8_t OPT_NUMBER
Jumbogram option number.
Definition: ipv6-option.h:207
Ipv6OptionJumbogram()
Constructor.
Definition: ipv6-option.cc:171
IPv6 Option Pad1.
Definition: ipv6-option.h:100
static TypeId GetTypeId()
Get the type identificator.
Definition: ipv6-option.cc:64
static const uint8_t OPT_NUMBER
Pad1 option number.
Definition: ipv6-option.h:105
uint8_t GetOptionNumber() const override
Get the option number.
Definition: ipv6-option.cc:84
Ipv6OptionPad1()
Constructor.
Definition: ipv6-option.cc:73
~Ipv6OptionPad1() override
Destructor.
Definition: ipv6-option.cc:78
uint8_t Process(Ptr< Packet > packet, uint8_t offset, const Ipv6Header &ipv6Header, bool &isDropped) override
Process method.
Definition: ipv6-option.cc:92
IPv6 Option Padn.
Definition: ipv6-option.h:151
~Ipv6OptionPadn() override
Destructor.
Definition: ipv6-option.cc:127
static const uint8_t OPT_NUMBER
PadN option number.
Definition: ipv6-option.h:156
uint8_t GetOptionNumber() const override
Get the option number.
Definition: ipv6-option.cc:133
uint8_t Process(Ptr< Packet > packet, uint8_t offset, const Ipv6Header &ipv6Header, bool &isDropped) override
Process method.
Definition: ipv6-option.cc:141
Ipv6OptionPadn()
Constructor.
Definition: ipv6-option.cc:122
static TypeId GetTypeId()
Get the type identificator.
Definition: ipv6-option.cc:113
IPv6 Option Router Alert.
Definition: ipv6-option.h:252
static const uint8_t OPT_NUMBER
Router alert option number.
Definition: ipv6-option.h:257
uint8_t Process(Ptr< Packet > packet, uint8_t offset, const Ipv6Header &ipv6Header, bool &isDropped) override
Process method.
Definition: ipv6-option.cc:239
~Ipv6OptionRouterAlert() override
Destructor.
Definition: ipv6-option.cc:225
uint8_t GetOptionNumber() const override
Get the option number.
Definition: ipv6-option.cc:231
static TypeId GetTypeId()
Get the type identificator.
Definition: ipv6-option.cc:211
Ipv6OptionRouterAlert()
Constructor.
Definition: ipv6-option.cc:220
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.