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