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
ripng-header.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2014 Universita' di Firenze, Italy
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
7
*/
8
9
#ifndef RIPNG_HEADER_H
10
#define RIPNG_HEADER_H
11
12
#include "
ipv6-header.h
"
13
14
#include "ns3/header.h"
15
#include "ns3/ipv6-address.h"
16
#include "ns3/packet.h"
17
18
#include <list>
19
20
namespace
ns3
21
{
22
23
/**
24
* \ingroup ripng
25
*
26
* \brief RipNg Routing Table Entry (RTE) - see \RFC{2080}
27
*/
28
class
RipNgRte
:
public
Header
29
{
30
public
:
31
RipNgRte
();
32
33
/**
34
* \brief Get the type ID.
35
* \return the object TypeId
36
*/
37
static
TypeId
GetTypeId
();
38
39
/**
40
* \brief Return the instance type identifier.
41
* \return instance type ID
42
*/
43
TypeId
GetInstanceTypeId
()
const override
;
44
45
void
Print
(std::ostream& os)
const override
;
46
47
/**
48
* \brief Get the serialized size of the packet.
49
* \return size
50
*/
51
uint32_t
GetSerializedSize
()
const override
;
52
53
/**
54
* \brief Serialize the packet.
55
* \param start Buffer iterator
56
*/
57
void
Serialize
(
Buffer::Iterator
start)
const override
;
58
59
/**
60
* \brief Deserialize the packet.
61
* \param start Buffer iterator
62
* \return size of the packet
63
*/
64
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
65
66
/**
67
* \brief Set the prefix
68
* \param prefix the prefix
69
*/
70
void
SetPrefix
(
Ipv6Address
prefix);
71
72
/**
73
* \brief Get the prefix
74
* \returns the prefix
75
*/
76
Ipv6Address
GetPrefix
()
const
;
77
78
/**
79
* \brief Set the prefix length
80
* \param prefixLen the prefix length
81
*/
82
void
SetPrefixLen
(uint8_t prefixLen);
83
84
/**
85
* \brief Get the prefix length
86
* \returns the prefix length
87
*/
88
uint8_t
GetPrefixLen
()
const
;
89
90
/**
91
* \brief Set the route tag
92
* \param routeTag the route tag
93
*/
94
void
SetRouteTag
(uint16_t routeTag);
95
96
/**
97
* \brief Get the route tag
98
* \returns the route tag
99
*/
100
uint16_t
GetRouteTag
()
const
;
101
102
/**
103
* \brief Set the route metric
104
* \param routeMetric the route metric
105
*/
106
void
SetRouteMetric
(uint8_t routeMetric);
107
108
/**
109
* \brief Get the route metric
110
* \returns the route metric
111
*/
112
uint8_t
GetRouteMetric
()
const
;
113
114
private
:
115
Ipv6Address
m_prefix
;
//!< prefix
116
uint16_t
m_tag
;
//!< route tag
117
uint8_t
m_prefixLen
;
//!< prefix length
118
uint8_t
m_metric
;
//!< route metric
119
};
120
121
/**
122
* \brief Stream insertion operator.
123
*
124
* \param os the reference to the output stream
125
* \param h the Routing Table Entry
126
* \returns the reference to the output stream
127
*/
128
std::ostream&
operator<<
(std::ostream& os,
const
RipNgRte
& h);
129
130
/**
131
* \ingroup ripng
132
*
133
* \brief RipNgHeader - see \RFC{2080}
134
*/
135
class
RipNgHeader
:
public
Header
136
{
137
public
:
138
RipNgHeader
();
139
140
/**
141
* \brief Get the type ID.
142
* \return the object TypeId
143
*/
144
static
TypeId
GetTypeId
();
145
146
/**
147
* \brief Return the instance type identifier.
148
* \return instance type ID
149
*/
150
TypeId
GetInstanceTypeId
()
const override
;
151
152
void
Print
(std::ostream& os)
const override
;
153
154
/**
155
* \brief Get the serialized size of the packet.
156
* \return size
157
*/
158
uint32_t
GetSerializedSize
()
const override
;
159
160
/**
161
* \brief Serialize the packet.
162
* \param start Buffer iterator
163
*/
164
void
Serialize
(
Buffer::Iterator
start)
const override
;
165
166
/**
167
* \brief Deserialize the packet.
168
* \param start Buffer iterator
169
* \return size of the packet
170
*/
171
uint32_t
Deserialize
(
Buffer::Iterator
start)
override
;
172
173
/**
174
* Commands to be used in RipNg headers
175
*/
176
enum
Command_e
177
{
178
REQUEST
= 0x1,
179
RESPONSE
= 0x2,
180
};
181
182
/**
183
* \brief Set the command
184
* \param command the command
185
*/
186
void
SetCommand
(
Command_e
command);
187
188
/**
189
* \brief Get the command
190
* \returns the command
191
*/
192
Command_e
GetCommand
()
const
;
193
194
/**
195
* \brief Add a RTE to the message
196
* \param rte the RTE
197
*/
198
void
AddRte
(
RipNgRte
rte);
199
200
/**
201
* \brief Clear all the RTEs from the header
202
*/
203
void
ClearRtes
();
204
205
/**
206
* \brief Get the number of RTE included in the message
207
* \returns the number of RTE in the message
208
*/
209
uint16_t
GetRteNumber
()
const
;
210
211
/**
212
* \brief Get the list of the RTEs included in the message
213
* \returns the list of the RTEs in the message
214
*/
215
std::list<RipNgRte>
GetRteList
()
const
;
216
217
private
:
218
uint8_t
m_command
;
//!< command type
219
std::list<RipNgRte>
m_rteList
;
//!< list of the RTEs in the message
220
};
221
222
/**
223
* \brief Stream insertion operator.
224
*
225
* \param os the reference to the output stream
226
* \param h the RIPng header
227
* \returns the reference to the output stream
228
*/
229
std::ostream&
operator<<
(std::ostream& os,
const
RipNgHeader
& h);
230
231
}
// namespace ns3
232
233
#endif
/* RIPNG_HEADER_H */
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition
buffer.h:89
ns3::Header
Protocol header serialization and deserialization.
Definition
header.h:33
ns3::Ipv6Address
Describes an IPv6 address.
Definition
ipv6-address.h:38
ns3::RipNgHeader
RipNgHeader - see RFC 2080
Definition
ripng-header.h:136
ns3::RipNgHeader::m_command
uint8_t m_command
command type
Definition
ripng-header.h:218
ns3::RipNgHeader::SetCommand
void SetCommand(Command_e command)
Set the command.
Definition
ripng-header.cc:241
ns3::RipNgHeader::RipNgHeader
RipNgHeader()
Definition
ripng-header.cc:146
ns3::RipNgHeader::ClearRtes
void ClearRtes()
Clear all the RTEs from the header.
Definition
ripng-header.cc:259
ns3::RipNgHeader::GetRteNumber
uint16_t GetRteNumber() const
Get the number of RTE included in the message.
Definition
ripng-header.cc:265
ns3::RipNgHeader::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
ripng-header.cc:152
ns3::RipNgHeader::Serialize
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Definition
ripng-header.cc:186
ns3::RipNgHeader::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
Definition
ripng-header.cc:162
ns3::RipNgHeader::m_rteList
std::list< RipNgRte > m_rteList
list of the RTEs in the message
Definition
ripng-header.h:219
ns3::RipNgHeader::Print
void Print(std::ostream &os) const override
Definition
ripng-header.cc:168
ns3::RipNgHeader::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Definition
ripng-header.cc:202
ns3::RipNgHeader::Command_e
Command_e
Commands to be used in RipNg headers.
Definition
ripng-header.h:177
ns3::RipNgHeader::REQUEST
@ REQUEST
Definition
ripng-header.h:178
ns3::RipNgHeader::RESPONSE
@ RESPONSE
Definition
ripng-header.h:179
ns3::RipNgHeader::GetSerializedSize
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Definition
ripng-header.cc:179
ns3::RipNgHeader::GetCommand
Command_e GetCommand() const
Get the command.
Definition
ripng-header.cc:247
ns3::RipNgHeader::GetRteList
std::list< RipNgRte > GetRteList() const
Get the list of the RTEs included in the message.
Definition
ripng-header.cc:271
ns3::RipNgHeader::AddRte
void AddRte(RipNgRte rte)
Add a RTE to the message.
Definition
ripng-header.cc:253
ns3::RipNgRte
RipNg Routing Table Entry (RTE) - see RFC 2080
Definition
ripng-header.h:29
ns3::RipNgRte::m_tag
uint16_t m_tag
route tag
Definition
ripng-header.h:116
ns3::RipNgRte::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
ripng-header.cc:30
ns3::RipNgRte::m_metric
uint8_t m_metric
route metric
Definition
ripng-header.h:118
ns3::RipNgRte::m_prefix
Ipv6Address m_prefix
prefix
Definition
ripng-header.h:115
ns3::RipNgRte::GetPrefix
Ipv6Address GetPrefix() const
Get the prefix.
Definition
ripng-header.cc:92
ns3::RipNgRte::GetRouteMetric
uint8_t GetRouteMetric() const
Get the route metric.
Definition
ripng-header.cc:128
ns3::RipNgRte::GetPrefixLen
uint8_t GetPrefixLen() const
Get the prefix length.
Definition
ripng-header.cc:104
ns3::RipNgRte::GetRouteTag
uint16_t GetRouteTag() const
Get the route tag.
Definition
ripng-header.cc:116
ns3::RipNgRte::m_prefixLen
uint8_t m_prefixLen
prefix length
Definition
ripng-header.h:117
ns3::RipNgRte::SetPrefix
void SetPrefix(Ipv6Address prefix)
Set the prefix.
Definition
ripng-header.cc:86
ns3::RipNgRte::Print
void Print(std::ostream &os) const override
Definition
ripng-header.cc:46
ns3::RipNgRte::Serialize
void Serialize(Buffer::Iterator start) const override
Serialize the packet.
Definition
ripng-header.cc:59
ns3::RipNgRte::SetPrefixLen
void SetPrefixLen(uint8_t prefixLen)
Set the prefix length.
Definition
ripng-header.cc:98
ns3::RipNgRte::Deserialize
uint32_t Deserialize(Buffer::Iterator start) override
Deserialize the packet.
Definition
ripng-header.cc:72
ns3::RipNgRte::SetRouteMetric
void SetRouteMetric(uint8_t routeMetric)
Set the route metric.
Definition
ripng-header.cc:122
ns3::RipNgRte::GetInstanceTypeId
TypeId GetInstanceTypeId() const override
Return the instance type identifier.
Definition
ripng-header.cc:40
ns3::RipNgRte::GetSerializedSize
uint32_t GetSerializedSize() const override
Get the serialized size of the packet.
Definition
ripng-header.cc:53
ns3::RipNgRte::RipNgRte
RipNgRte()
Definition
ripng-header.cc:21
ns3::RipNgRte::SetRouteTag
void SetRouteTag(uint16_t routeTag)
Set the route tag.
Definition
ripng-header.cc:110
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
uint32_t
ipv6-header.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::operator<<
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition
angles.cc:148
src
internet
model
ripng-header.h
Generated on Fri Nov 8 2024 13:59:01 for ns-3 by
1.11.0