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