A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
ipv6-option-header.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008-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, MA 02111-1307 USA
16
*
17
* Author: David Gross <gdavid.devel@gmail.com>
18
*/
19
20
#ifndef IPV6_OPTION_HEADER_H
21
#define IPV6_OPTION_HEADER_H
22
23
#include "ns3/header.h"
24
25
#include <ostream>
26
27
namespace
ns3
28
{
29
30
/**
31
* \ingroup ipv6HeaderExt
32
*
33
* \brief Header for IPv6 Option.
34
*/
35
class
Ipv6OptionHeader
:
public
Header
36
{
37
public
:
38
/**
39
* \struct Alignment
40
* \brief represents the alignment requirements of an option header
41
*
42
* Represented as factor*n+offset (eg. 8n+2) See \RFC{2460}.
43
* No alignment is represented as 1n+0.
44
*/
45
struct
Alignment
46
{
47
uint8_t
factor
;
/**< Factor */
48
uint8_t
offset
;
/**< Offset */
49
};
50
51
/**
52
* \brief Get the type identificator.
53
* \return type identificator
54
*/
55
static
TypeId
GetTypeId
();
56
57
/**
58
* \brief Get the instance type ID.
59
* \return instance type ID
60
*/
61
TypeId
GetInstanceTypeId
()
const override
;
62
63
/**
64
* \brief Constructor.
65
*/
66
Ipv6OptionHeader
();
67
68
/**
69
* \brief Destructor.
70
*/
71
~Ipv6OptionHeader
()
override
;
72
73
/**
74
* \brief Set the type of the option.
75
* \param type the type of the option
76
*/
77
void
SetType
(uint8_t type);
78
79
/**
80
* \brief Get the type of the option.
81
* \return the type of the option
82
*/
83
uint8_t
GetType
()
const
;
84
85
/**
86
* \brief Set the option length.
87
* \param length the option length
88
*/
89
void
SetLength
(uint8_t length);
90
91
/**
92
* \brief Get the option length.
93
* \return the option length
94
*/
95
uint8_t
GetLength
()
const
;
96
97
/**
98
* \brief Print some information about the packet.
99
* \param os output stream
100
*/
101
void
Print
(std::ostream& os)
const override
;
102
103
/**
104
* \brief Get the serialized size of the packet.
105
* \return size
106
*/
107
uint32_t
GetSerializedSize
()
const override
;
108
109
/**
110
* \brief Serialize the packet.
111
* \param start Buffer iterator
112
*/
113
void
Serialize
(
Buffer::Iterator
start)
const override
;
114
115
/**
116
* \brief Deserialize the packet.
117
* \param start Buffer iterator
118
* \return size of the packet
119
*/
120
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
121
122
/**
123
* \brief Get the Alignment requirement of this option header
124
* \return The required alignment
125
*
126
* Subclasses should only implement this method, if special alignment is
127
* required. Default is no alignment (1n+0).
128
*/
129
virtual
Alignment
GetAlignment
()
const
;
130
131
private
:
132
/**
133
* \brief The type of the option.
134
*/
135
uint8_t
m_type
;
136
137
/**
138
* \brief The option length.
139
*/
140
uint8_t
m_length
;
141
142
/**
143
* \brief The anonymous data of this option
144
*/
145
Buffer
m_data
;
146
};
147
148
/**
149
* \ingroup ipv6HeaderExt
150
*
151
* \brief Header of IPv6 Option Pad1
152
*/
153
class
Ipv6OptionPad1Header
:
public
Ipv6OptionHeader
154
{
155
public
:
156
/**
157
* \brief Get the type identificator.
158
* \return type identificator
159
*/
160
static
TypeId
GetTypeId
();
161
162
/**
163
* \brief Get the instance type ID.
164
* \return instance type ID
165
*/
166
TypeId
GetInstanceTypeId
()
const override
;
167
168
/**
169
* \brief Constructor.
170
*/
171
Ipv6OptionPad1Header
();
172
173
/**
174
* \brief Destructor.
175
*/
176
~Ipv6OptionPad1Header
()
override
;
177
178
/**
179
* \brief Print some information about the packet.
180
* \param os output stream
181
*/
182
void
Print
(std::ostream& os)
const override
;
183
184
/**
185
* \brief Get the serialized size of the packet.
186
* \return size
187
*/
188
uint32_t
GetSerializedSize
()
const override
;
189
190
/**
191
* \brief Serialize the packet.
192
* \param start Buffer iterator
193
*/
194
void
Serialize
(
Buffer::Iterator
start)
const override
;
195
196
/**
197
* \brief Deserialize the packet.
198
* \param start Buffer iterator
199
* \return size of the packet
200
*/
201
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
202
};
203
204
/**
205
* \ingroup ipv6HeaderExt
206
*
207
* \brief Header of IPv6 Option Padn
208
*/
209
class
Ipv6OptionPadnHeader
:
public
Ipv6OptionHeader
210
{
211
public
:
212
/**
213
* \brief Get the type identificator.
214
* \return type identificator
215
*/
216
static
TypeId
GetTypeId
();
217
218
/**
219
* \brief Get the instance type ID.
220
* \return instance type ID
221
*/
222
TypeId
GetInstanceTypeId
()
const override
;
223
224
/**
225
* \brief Constructor.
226
* \param pad Number of bytes to pad (>=2)
227
*/
228
Ipv6OptionPadnHeader
(
uint32_t
pad = 2);
229
230
/**
231
* \brief Destructor.
232
*/
233
~Ipv6OptionPadnHeader
()
override
;
234
235
/**
236
* \brief Print some information about the packet.
237
* \param os output stream
238
*/
239
void
Print
(std::ostream& os)
const override
;
240
241
/**
242
* \brief Get the serialized size of the packet.
243
* \return size
244
*/
245
uint32_t
GetSerializedSize
()
const override
;
246
247
/**
248
* \brief Serialize the packet.
249
* \param start Buffer iterator
250
*/
251
void
Serialize
(
Buffer::Iterator
start)
const override
;
252
253
/**
254
* \brief Deserialize the packet.
255
* \param start Buffer iterator
256
* \return size of the packet
257
*/
258
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
259
};
260
261
/**
262
* \ingroup ipv6HeaderExt
263
*
264
* \brief Header of IPv6 Option Jumbogram
265
*/
266
class
Ipv6OptionJumbogramHeader
:
public
Ipv6OptionHeader
267
{
268
public
:
269
/**
270
* \brief Get the type identificator.
271
* \return type identificator
272
*/
273
static
TypeId
GetTypeId
();
274
275
/**
276
* \brief Get the instance type ID.
277
* \return instance type ID
278
*/
279
TypeId
GetInstanceTypeId
()
const override
;
280
281
/**
282
* \brief Constructor.
283
*/
284
Ipv6OptionJumbogramHeader
();
285
286
/**
287
* \brief Destructor.
288
*/
289
~Ipv6OptionJumbogramHeader
()
override
;
290
291
/**
292
* \brief Set the data length.
293
* \param dataLength the data length
294
*/
295
void
SetDataLength
(
uint32_t
dataLength);
296
297
/**
298
* \brief Get the data length.
299
* \return the data length
300
*/
301
uint32_t
GetDataLength
()
const
;
302
303
/**
304
* \brief Print some information about the packet.
305
* \param os output stream
306
*/
307
void
Print
(std::ostream& os)
const override
;
308
309
/**
310
* \brief Get the serialized size of the packet.
311
* \return size
312
*/
313
uint32_t
GetSerializedSize
()
const override
;
314
315
/**
316
* \brief Serialize the packet.
317
* \param start Buffer iterator
318
*/
319
void
Serialize
(
Buffer::Iterator
start)
const override
;
320
321
/**
322
* \brief Deserialize the packet.
323
* \param start Buffer iterator
324
* \return size of the packet
325
*/
326
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
327
328
/**
329
* \brief Get the Alignment requirement of this option header
330
* \return The required alignment
331
*/
332
Alignment
GetAlignment
()
const override
;
333
334
private
:
335
/**
336
* \brief The data length.
337
*/
338
uint32_t
m_dataLength
;
339
};
340
341
/**
342
* \ingroup ipv6HeaderExt
343
*
344
* \brief Header of IPv6 Option Router Alert
345
*/
346
class
Ipv6OptionRouterAlertHeader
:
public
Ipv6OptionHeader
347
{
348
public
:
349
/**
350
* \brief Get the type identificator.
351
* \return type identificator
352
*/
353
static
TypeId
GetTypeId
();
354
355
/**
356
* \brief Get the instance type ID.
357
* \return instance type ID
358
*/
359
TypeId
GetInstanceTypeId
()
const override
;
360
361
/**
362
* \brief Constructor.
363
*/
364
Ipv6OptionRouterAlertHeader
();
365
366
/**
367
* \brief Destructor.
368
*/
369
~Ipv6OptionRouterAlertHeader
()
override
;
370
371
/**
372
* \brief Set the field "value".
373
* \param value the value to be set.
374
*/
375
void
SetValue
(uint16_t value);
376
377
/**
378
* \brief Get the field "value".
379
* \return the field "value"
380
*/
381
uint16_t
GetValue
()
const
;
382
383
/**
384
* \brief Print some information about the packet.
385
* \param os output stream
386
*/
387
void
Print
(std::ostream& os)
const override
;
388
389
/**
390
* \brief Get the serialized size of the packet.
391
* \return size
392
*/
393
uint32_t
GetSerializedSize
()
const override
;
394
395
/**
396
* \brief Serialize the packet.
397
* \param start Buffer iterator
398
*/
399
void
Serialize
(
Buffer::Iterator
start)
const override
;
400
401
/**
402
* \brief Deserialize the packet.
403
* \param start Buffer iterator
404
* \return size of the packet
405
*/
406
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
407
408
/**
409
* \brief Get the Alignment requirement of this option header
410
* \return The required alignment
411
*/
412
Alignment
GetAlignment
()
const override
;
413
414
private
:
415
/**
416
* \brief The value.
417
*/
418
uint16_t
m_value
;
419
};
420
421
}
// namespace ns3
422
423
#endif
/* IPV6_OPTION_HEADER_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:100
ns3::Buffer
automatically resized byte buffer
Definition:
buffer.h:94
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:44
ns3::Ipv6OptionHeader
Header for IPv6 Option.
Definition:
ipv6-option-header.h:36
ns3::Ipv6OptionHeader::Ipv6OptionHeader
Ipv6OptionHeader()
Constructor.
Definition:
ipv6-option-header.cc:49
ns3::Ipv6OptionHeader::GetLength
uint8_t GetLength() const
Get the option length.
Definition:
ipv6-option-header.cc:78
ns3::Ipv6OptionHeader::m_type
uint8_t m_type
The type of the option.
Definition:
ipv6-option-header.h:135
ns3::Ipv6OptionHeader::SetLength
void SetLength(uint8_t length)
Set the option length.
Definition:
ipv6-option-header.cc:72
ns3::Ipv6OptionHeader::SetType
void SetType(uint8_t type)
Set the type of the option.
Definition:
ipv6-option-header.cc:60
ns3::Ipv6OptionHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Definition:
ipv6-option-header.cc:96
ns3::Ipv6OptionHeader::Print
void Print(std::ostream &os) const override
Print some information about the packet.
Definition:
ipv6-option-header.cc:84
ns3::Ipv6OptionHeader::GetType
uint8_t GetType() const
Get the type of the option.
Definition:
ipv6-option-header.cc:66
ns3::Ipv6OptionHeader::GetAlignment
virtual Alignment GetAlignment() const
Get the Alignment requirement of this option header.
Definition:
ipv6-option-header.cc:125
ns3::Ipv6OptionHeader::m_length
uint8_t m_length
The option length.
Definition:
ipv6-option-header.h:140
ns3::Ipv6OptionHeader::~Ipv6OptionHeader
~Ipv6OptionHeader() override
Destructor.
Definition:
ipv6-option-header.cc:55
ns3::Ipv6OptionHeader::GetTypeId
static TypeId GetTypeId()
Get the type identificator.
Definition:
ipv6-option-header.cc:34
ns3::Ipv6OptionHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Definition:
ipv6-option-header.cc:44
ns3::Ipv6OptionHeader::m_data
Buffer m_data
The anonymous data of this option.
Definition:
ipv6-option-header.h:145
ns3::Ipv6OptionHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Definition:
ipv6-option-header.cc:90
ns3::Ipv6OptionHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Definition:
ipv6-option-header.cc:107
ns3::Ipv6OptionJumbogramHeader
Header of IPv6 Option Jumbogram.
Definition:
ipv6-option-header.h:267
ns3::Ipv6OptionJumbogramHeader::GetTypeId
static TypeId GetTypeId()
Get the type identificator.
Definition:
ipv6-option-header.cc:256
ns3::Ipv6OptionJumbogramHeader::Ipv6OptionJumbogramHeader
Ipv6OptionJumbogramHeader()
Constructor.
Definition:
ipv6-option-header.cc:271
ns3::Ipv6OptionJumbogramHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Definition:
ipv6-option-header.cc:308
ns3::Ipv6OptionJumbogramHeader::GetAlignment
Alignment GetAlignment() const override
Get the Alignment requirement of this option header.
Definition:
ipv6-option-header.cc:330
ns3::Ipv6OptionJumbogramHeader::~Ipv6OptionJumbogramHeader
~Ipv6OptionJumbogramHeader() override
Destructor.
Definition:
ipv6-option-header.cc:278
ns3::Ipv6OptionJumbogramHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Definition:
ipv6-option-header.cc:318
ns3::Ipv6OptionJumbogramHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Definition:
ipv6-option-header.cc:266
ns3::Ipv6OptionJumbogramHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Definition:
ipv6-option-header.cc:302
ns3::Ipv6OptionJumbogramHeader::SetDataLength
void SetDataLength(uint32_t dataLength)
Set the data length.
Definition:
ipv6-option-header.cc:283
ns3::Ipv6OptionJumbogramHeader::m_dataLength
uint32_t m_dataLength
The data length.
Definition:
ipv6-option-header.h:338
ns3::Ipv6OptionJumbogramHeader::Print
void Print(std::ostream &os) const override
Print some information about the packet.
Definition:
ipv6-option-header.cc:295
ns3::Ipv6OptionJumbogramHeader::GetDataLength
uint32_t GetDataLength() const
Get the data length.
Definition:
ipv6-option-header.cc:289
ns3::Ipv6OptionPad1Header
Header of IPv6 Option Pad1.
Definition:
ipv6-option-header.h:154
ns3::Ipv6OptionPad1Header::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Definition:
ipv6-option-header.cc:143
ns3::Ipv6OptionPad1Header::Ipv6OptionPad1Header
Ipv6OptionPad1Header()
Constructor.
Definition:
ipv6-option-header.cc:148
ns3::Ipv6OptionPad1Header::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Definition:
ipv6-option-header.cc:178
ns3::Ipv6OptionPad1Header::Print
void Print(std::ostream &os) const override
Print some information about the packet.
Definition:
ipv6-option-header.cc:158
ns3::Ipv6OptionPad1Header::GetTypeId
static TypeId GetTypeId()
Get the type identificator.
Definition:
ipv6-option-header.cc:133
ns3::Ipv6OptionPad1Header::~Ipv6OptionPad1Header
~Ipv6OptionPad1Header() override
Destructor.
Definition:
ipv6-option-header.cc:153
ns3::Ipv6OptionPad1Header::GetSerializedSize
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Definition:
ipv6-option-header.cc:164
ns3::Ipv6OptionPad1Header::Serialize
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Definition:
ipv6-option-header.cc:170
ns3::Ipv6OptionPadnHeader
Header of IPv6 Option Padn.
Definition:
ipv6-option-header.h:210
ns3::Ipv6OptionPadnHeader::GetTypeId
static TypeId GetTypeId()
Get the type identificator.
Definition:
ipv6-option-header.cc:190
ns3::Ipv6OptionPadnHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Definition:
ipv6-option-header.cc:223
ns3::Ipv6OptionPadnHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Definition:
ipv6-option-header.cc:200
ns3::Ipv6OptionPadnHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Definition:
ipv6-option-header.cc:243
ns3::Ipv6OptionPadnHeader::Print
void Print(std::ostream &os) const override
Print some information about the packet.
Definition:
ipv6-option-header.cc:217
ns3::Ipv6OptionPadnHeader::~Ipv6OptionPadnHeader
~Ipv6OptionPadnHeader() override
Destructor.
Definition:
ipv6-option-header.cc:212
ns3::Ipv6OptionPadnHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Definition:
ipv6-option-header.cc:229
ns3::Ipv6OptionRouterAlertHeader
Header of IPv6 Option Router Alert.
Definition:
ipv6-option-header.h:347
ns3::Ipv6OptionRouterAlertHeader::Ipv6OptionRouterAlertHeader
Ipv6OptionRouterAlertHeader()
Constructor.
Definition:
ipv6-option-header.cc:353
ns3::Ipv6OptionRouterAlertHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Definition:
ipv6-option-header.cc:390
ns3::Ipv6OptionRouterAlertHeader::SetValue
void SetValue(uint16_t value)
Set the field "value".
Definition:
ipv6-option-header.cc:365
ns3::Ipv6OptionRouterAlertHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Get the instance type ID.
Definition:
ipv6-option-header.cc:348
ns3::Ipv6OptionRouterAlertHeader::m_value
uint16_t m_value
The value.
Definition:
ipv6-option-header.h:418
ns3::Ipv6OptionRouterAlertHeader::GetTypeId
static TypeId GetTypeId()
Get the type identificator.
Definition:
ipv6-option-header.cc:338
ns3::Ipv6OptionRouterAlertHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Definition:
ipv6-option-header.cc:384
ns3::Ipv6OptionRouterAlertHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Definition:
ipv6-option-header.cc:400
ns3::Ipv6OptionRouterAlertHeader::GetAlignment
Alignment GetAlignment() const override
Get the Alignment requirement of this option header.
Definition:
ipv6-option-header.cc:412
ns3::Ipv6OptionRouterAlertHeader::GetValue
uint16_t GetValue() const
Get the field "value".
Definition:
ipv6-option-header.cc:371
ns3::Ipv6OptionRouterAlertHeader::Print
void Print(std::ostream &os) const override
Print some information about the packet.
Definition:
ipv6-option-header.cc:377
ns3::Ipv6OptionRouterAlertHeader::~Ipv6OptionRouterAlertHeader
~Ipv6OptionRouterAlertHeader() override
Destructor.
Definition:
ipv6-option-header.cc:360
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::Ipv6OptionHeader::Alignment
represents the alignment requirements of an option header
Definition:
ipv6-option-header.h:46
ns3::Ipv6OptionHeader::Alignment::factor
uint8_t factor
Factor.
Definition:
ipv6-option-header.h:47
ns3::Ipv6OptionHeader::Alignment::offset
uint8_t offset
Offset.
Definition:
ipv6-option-header.h:48
src
internet
model
ipv6-option-header.h
Generated on Tue May 28 2024 23:36:00 for ns-3 by
1.9.6