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