A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
35namespace ns3
36{
37
38/**
39 * \ingroup ipv6HeaderExt
40 *
41 * \brief IPv6 Option base
42 *
43 * If you want to implement a new IPv6 option, all you have to do is
44 * implement a subclass of this class and add it to an Ipv6OptionDemux.
45 */
46class Ipv6Option : public Object
47{
48 public:
49 /**
50 * \brief Get the type identificator.
51 * \return type identificator
52 */
53 static TypeId GetTypeId();
54
55 /**
56 * \brief Destructor.
57 */
58 ~Ipv6Option() override;
59
60 /**
61 * \brief Set the node.
62 * \param node the node to set
63 */
64 void SetNode(Ptr<Node> node);
65
66 /**
67 * \brief Get the option number.
68 * \return option number
69 */
70 virtual uint8_t GetOptionNumber() const = 0;
71
72 /**
73 * \brief Process method
74 *
75 * Called from Ipv6L3Protocol::Receive.
76 * \param packet the packet
77 * \param offset the offset of the extension to process
78 * \param ipv6Header the IPv6 header of packet received
79 * \param isDropped if the packet must be dropped
80 * \return the processed size
81 */
82 virtual uint8_t Process(Ptr<Packet> packet,
83 uint8_t offset,
84 const Ipv6Header& ipv6Header,
85 bool& isDropped) = 0;
86
87 private:
88 /**
89 * \brief The node.
90 */
92};
93
94/**
95 * \ingroup ipv6HeaderExt
96 *
97 * \brief IPv6 Option Pad1
98 */
100{
101 public:
102 /**
103 * \brief Pad1 option number.
104 */
105 static const uint8_t OPT_NUMBER = 0;
106
107 /**
108 * \brief Get the type identificator.
109 * \return type identificator
110 */
111 static TypeId GetTypeId();
112
113 /**
114 * \brief Constructor.
115 */
117
118 /**
119 * \brief Destructor.
120 */
121 ~Ipv6OptionPad1() override;
122
123 /**
124 * \brief Get the option number.
125 * \return option number
126 */
127 uint8_t GetOptionNumber() const override;
128
129 /**
130 * \brief Process method
131 *
132 * Called from Ipv6L3Protocol::Receive.
133 * \param packet the packet
134 * \param offset the offset of the extension to process
135 * \param ipv6Header the IPv6 header of packet received
136 * \param isDropped if the packet must be dropped
137 * \return the processed size
138 */
139 uint8_t Process(Ptr<Packet> packet,
140 uint8_t offset,
141 const Ipv6Header& ipv6Header,
142 bool& isDropped) override;
143};
144
145/**
146 * \ingroup ipv6HeaderExt
147 *
148 * \brief IPv6 Option Padn
149 */
151{
152 public:
153 /**
154 * \brief PadN option number.
155 */
156 static const uint8_t OPT_NUMBER = 60;
157
158 /**
159 * \brief Get the type identificator.
160 * \return type identificator
161 */
162 static TypeId GetTypeId();
163
164 /**
165 * \brief Constructor.
166 */
168
169 /**
170 * \brief Destructor.
171 */
172 ~Ipv6OptionPadn() override;
173
174 /**
175 * \brief Get the option number.
176 * \return option number
177 */
178 uint8_t GetOptionNumber() const override;
179
180 /**
181 * \brief Process method
182 *
183 * Called from Ipv6L3Protocol::Receive.
184 * \param packet the packet
185 * \param offset the offset of the extension to process
186 * \param ipv6Header the IPv6 header of packet received
187 * \param isDropped if the packet must be dropped
188 * \return the processed size
189 */
190 uint8_t Process(Ptr<Packet> packet,
191 uint8_t offset,
192 const Ipv6Header& ipv6Header,
193 bool& isDropped) override;
194};
195
196/**
197 * \ingroup ipv6HeaderExt
198 *
199 * \brief IPv6 Option Jumbogram
200 */
202{
203 public:
204 /**
205 * \brief Jumbogram option number.
206 */
207 static const uint8_t OPT_NUMBER = 44;
208
209 /**
210 * \brief Get the type identificator.
211 * \return type identificator
212 */
213 static TypeId GetTypeId();
214
215 /**
216 * \brief Constructor.
217 */
219
220 /**
221 * \brief Destructor.
222 */
223 ~Ipv6OptionJumbogram() override;
224
225 /**
226 * \brief Get the option number.
227 * \return option number
228 */
229 uint8_t GetOptionNumber() const override;
230
231 /**
232 * \brief Process method
233 * Called from Ipv6L3Protocol::Receive.
234 * \param packet the packet
235 * \param offset the offset of the extension to process
236 * \param ipv6Header the IPv6 header of packet received
237 * \param isDropped if the packet must be dropped
238 * \return the processed size
239 */
240 uint8_t Process(Ptr<Packet> packet,
241 uint8_t offset,
242 const Ipv6Header& ipv6Header,
243 bool& isDropped) override;
244};
245
246/**
247 * \ingroup ipv6HeaderExt
248 *
249 * \brief IPv6 Option Router Alert
250 */
252{
253 public:
254 /**
255 * \brief Router alert option number.
256 */
257 static const uint8_t OPT_NUMBER = 43;
258
259 /**
260 * \brief Get the type identificator.
261 * \return type identificator
262 */
263 static TypeId GetTypeId();
264
265 /**
266 * \brief Constructor.
267 */
269
270 /**
271 * \brief Destructor.
272 */
273 ~Ipv6OptionRouterAlert() override;
274
275 /**
276 * \brief Get the option number.
277 * \return option number
278 */
279 uint8_t GetOptionNumber() const override;
280
281 /**
282 * \brief Process method
283 *
284 * Called from Ipv6L3Protocol::Receive.
285 * \param packet the packet
286 * \param offset the offset of the extension to process
287 * \param ipv6Header the IPv6 header of packet received
288 * \param isDropped if the packet must be dropped
289 * \return the processed size
290 */
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
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.