A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
rip-header.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2016 Universita' di Firenze, Italy
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
19
*/
20
21
#ifndef RIP_HEADER_H
22
#define RIP_HEADER_H
23
24
#include <list>
25
#include "ns3/header.h"
26
#include "ns3/ipv4-address.h"
27
#include "ns3/packet.h"
28
#include "ns3/ipv4-header.h"
29
30
31
namespace
ns3
{
32
37
class
RipRte
:
public
Header
38
{
39
public
:
40
RipRte
(
void
);
41
46
static
TypeId
GetTypeId
(
void
);
47
52
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
53
54
virtual
void
Print
(std::ostream& os)
const
;
55
60
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
61
66
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
67
73
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
);
74
79
void
SetPrefix
(
Ipv4Address
prefix);
80
85
Ipv4Address
GetPrefix
(
void
)
const
;
86
91
void
SetSubnetMask
(
Ipv4Mask
subnetMask);
92
97
Ipv4Mask
GetSubnetMask
(
void
)
const
;
98
103
void
SetRouteTag
(uint16_t routeTag);
104
109
uint16_t
GetRouteTag
(
void
)
const
;
110
115
void
SetRouteMetric
(uint32_t routeMetric);
116
121
uint32_t
GetRouteMetric
(
void
)
const
;
122
127
void
SetNextHop
(
Ipv4Address
nextHop);
128
133
Ipv4Address
GetNextHop
(
void
)
const
;
134
135
136
private
:
137
uint16_t
m_tag
;
138
Ipv4Address
m_prefix
;
139
Ipv4Mask
m_subnetMask
;
140
Ipv4Address
m_nextHop
;
141
uint32_t
m_metric
;
142
};
143
151
std::ostream &
operator <<
(std::ostream & os,
const
RipRte
& h);
152
157
class
RipHeader
:
public
Header
158
{
159
public
:
160
RipHeader
(
void
);
161
166
static
TypeId
GetTypeId
(
void
);
167
172
virtual
TypeId
GetInstanceTypeId
(
void
)
const
;
173
174
virtual
void
Print
(std::ostream& os)
const
;
175
180
virtual
uint32_t
GetSerializedSize
(
void
)
const
;
181
186
virtual
void
Serialize
(
Buffer::Iterator
start
)
const
;
187
193
virtual
uint32_t
Deserialize
(
Buffer::Iterator
start
);
194
198
enum
Command_e
199
{
200
REQUEST
= 0x1,
201
RESPONSE
= 0x2,
202
};
203
208
void
SetCommand
(
Command_e
command);
209
214
Command_e
GetCommand
(
void
)
const
;
215
220
void
AddRte
(
RipRte
rte);
221
225
void
ClearRtes
();
226
231
uint16_t
GetRteNumber
(
void
)
const
;
232
237
std::list<RipRte>
GetRteList
(
void
)
const
;
238
239
private
:
240
uint8_t
m_command
;
241
std::list<RipRte>
m_rteList
;
242
};
243
251
std::ostream &
operator <<
(std::ostream & os,
const
RipHeader
& h);
252
253
}
254
255
#endif
/* Rip_HEADER_H */
256
ns3::Buffer::Iterator
iterator in a Buffer instance
Definition:
buffer.h:99
ns3::Header
Protocol header serialization and deserialization.
Definition:
header.h:43
ns3::Header::Deserialize
virtual uint32_t Deserialize(Buffer::Iterator start)=0
Deserialize the object from a buffer iterator.
ns3::Ipv4Address
Ipv4 addresses are stored in host order in this class.
Definition:
ipv4-address.h:41
ns3::Ipv4Mask
a class to represent an Ipv4 address mask
Definition:
ipv4-address.h:256
ns3::RipHeader
RipHeader - see RFC 2453
Definition:
rip-header.h:158
ns3::RipHeader::Print
virtual void Print(std::ostream &os) const
Definition:
rip-header.cc:176
ns3::RipHeader::GetRteList
std::list< RipRte > GetRteList(void) const
Get the list of the RTEs included in the message.
Definition:
rip-header.cc:272
ns3::RipHeader::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
Definition:
rip-header.cc:171
ns3::RipHeader::AddRte
void AddRte(RipRte rte)
Add a RTE to the message.
Definition:
rip-header.cc:257
ns3::RipHeader::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
Definition:
rip-header.cc:187
ns3::RipHeader::m_rteList
std::list< RipRte > m_rteList
list of the RTEs in the message
Definition:
rip-header.h:241
ns3::RipHeader::SetCommand
void SetCommand(Command_e command)
Set the command.
Definition:
rip-header.cc:247
ns3::RipHeader::Command_e
Command_e
Commands to be used in Rip headers.
Definition:
rip-header.h:199
ns3::RipHeader::RESPONSE
@ RESPONSE
Definition:
rip-header.h:201
ns3::RipHeader::REQUEST
@ REQUEST
Definition:
rip-header.h:200
ns3::RipHeader::m_command
uint8_t m_command
command type
Definition:
rip-header.h:240
ns3::RipHeader::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
rip-header.cc:162
ns3::RipHeader::ClearRtes
void ClearRtes()
Clear all the RTEs from the header.
Definition:
rip-header.cc:262
ns3::RipHeader::GetRteNumber
uint16_t GetRteNumber(void) const
Get the number of RTE included in the message.
Definition:
rip-header.cc:267
ns3::RipHeader::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition:
rip-header.cc:193
ns3::RipHeader::GetCommand
Command_e GetCommand(void) const
Get the command.
Definition:
rip-header.cc:252
ns3::RipHeader::RipHeader
RipHeader(void)
Definition:
rip-header.cc:157
ns3::RipRte
Rip v2 Routing Table Entry (RTE) - see RFC 2453.
Definition:
rip-header.h:38
ns3::RipRte::SetSubnetMask
void SetSubnetMask(Ipv4Mask subnetMask)
Set the subnet mask.
Definition:
rip-header.cc:103
ns3::RipRte::GetNextHop
Ipv4Address GetNextHop(void) const
Get the next hop.
Definition:
rip-header.cc:138
ns3::RipRte::m_prefix
Ipv4Address m_prefix
Advertised prefix.
Definition:
rip-header.h:138
ns3::RipRte::m_metric
uint32_t m_metric
Route metric.
Definition:
rip-header.h:141
ns3::RipRte::m_subnetMask
Ipv4Mask m_subnetMask
Subnet mask.
Definition:
rip-header.h:139
ns3::RipRte::SetRouteMetric
void SetRouteMetric(uint32_t routeMetric)
Set the route metric.
Definition:
rip-header.cc:123
ns3::RipRte::GetPrefix
Ipv4Address GetPrefix(void) const
Get the prefix.
Definition:
rip-header.cc:98
ns3::RipRte::m_tag
uint16_t m_tag
Route tag.
Definition:
rip-header.h:137
ns3::RipRte::SetPrefix
void SetPrefix(Ipv4Address prefix)
Set the prefix.
Definition:
rip-header.cc:93
ns3::RipRte::GetRouteTag
uint16_t GetRouteTag(void) const
Get the route tag.
Definition:
rip-header.cc:118
ns3::RipRte::GetSubnetMask
Ipv4Mask GetSubnetMask(void) const
Get the subnet mask.
Definition:
rip-header.cc:108
ns3::RipRte::GetInstanceTypeId
virtual TypeId GetInstanceTypeId(void) const
Return the instance type identifier.
Definition:
rip-header.cc:46
ns3::RipRte::RipRte
RipRte(void)
Definition:
rip-header.cc:32
ns3::RipRte::Serialize
virtual void Serialize(Buffer::Iterator start) const
Serialize the packet.
Definition:
rip-header.cc:62
ns3::RipRte::GetRouteMetric
uint32_t GetRouteMetric(void) const
Get the route metric.
Definition:
rip-header.cc:128
ns3::RipRte::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const
Get the serialized size of the packet.
Definition:
rip-header.cc:57
ns3::RipRte::m_nextHop
Ipv4Address m_nextHop
Next hop.
Definition:
rip-header.h:140
ns3::RipRte::SetRouteTag
void SetRouteTag(uint16_t routeTag)
Set the route tag.
Definition:
rip-header.cc:113
ns3::RipRte::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
rip-header.cc:37
ns3::RipRte::SetNextHop
void SetNextHop(Ipv4Address nextHop)
Set the next hop.
Definition:
rip-header.cc:133
ns3::RipRte::Print
virtual void Print(std::ostream &os) const
Definition:
rip-header.cc:51
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
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:139
visualizer.core.start
def start()
Definition:
core.py:1853
src
internet
model
rip-header.h
Generated on Tue Feb 6 2024 19:21:19 for ns-3 by
1.9.1