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
flame-rtable.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2009 IITP RAS
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Kirill Andreev <andreev@iitp.ru>
7
*/
8
9
#ifndef FLAME_RTABLE_H
10
#define FLAME_RTABLE_H
11
12
#include "ns3/mac48-address.h"
13
#include "ns3/nstime.h"
14
#include "ns3/object.h"
15
16
#include <map>
17
18
namespace
ns3
19
{
20
namespace
flame
21
{
22
/**
23
* @ingroup flame
24
*
25
* @brief Routing table for FLAME
26
*/
27
class
FlameRtable
:
public
Object
28
{
29
public
:
30
/// Means all interfaces
31
const
static
uint32_t
INTERFACE_ANY
= 0xffffffff;
32
/// Maximum (the best?) path cost
33
const
static
uint32_t
MAX_COST
= 0xff;
34
35
/// Route lookup result, return type of LookupXXX methods
36
struct
LookupResult
37
{
38
Mac48Address
retransmitter
;
///< retransmitter
39
uint32_t
ifIndex
;
///< IF index
40
uint8_t
cost
;
///< cost
41
uint16_t
seqnum
;
///< sequence number
42
43
/**
44
* Constructor
45
*
46
* @param r retransmitter MAC address
47
* @param i interfce index
48
* @param c cost
49
* @param s sequence number
50
*/
51
LookupResult
(
Mac48Address
r =
Mac48Address::GetBroadcast
(),
52
uint32_t
i =
INTERFACE_ANY
,
53
uint8_t c =
MAX_COST
,
54
uint16_t s = 0)
55
:
retransmitter
(r),
56
ifIndex
(i),
57
cost
(c),
58
seqnum
(s)
59
{
60
}
61
62
/**
63
* @returns True for valid route
64
*/
65
bool
IsValid
()
const
;
66
/**
67
* Compare route lookup results, used by tests
68
*
69
* @param o the object to compare
70
* @returns true if equal
71
*/
72
bool
operator==
(
const
LookupResult
& o)
const
;
73
};
74
75
public
:
76
/**
77
* @brief Get the type ID.
78
* @return the object TypeId
79
*/
80
static
TypeId
GetTypeId
();
81
82
FlameRtable
();
83
~FlameRtable
()
override
;
84
85
// Delete copy constructor and assignment operator to avoid misuse
86
FlameRtable
(
const
FlameRtable
&) =
delete
;
87
FlameRtable
&
operator=
(
const
FlameRtable
&) =
delete
;
88
89
void
DoDispose
()
override
;
90
91
/**
92
* Add path
93
*
94
* @param destination the destination address
95
* @param retransmitter the retransmitter address
96
* @param interface the interface
97
* @param cost the cost
98
* @param seqnum the sequence number
99
*/
100
void
AddPath
(
const
Mac48Address
destination,
101
const
Mac48Address
retransmitter,
102
const
uint32_t
interface,
103
const
uint8_t cost,
104
const
uint16_t seqnum);
105
/**
106
* @brief Lookup path to destination
107
* @param destination
108
* @return Broadcast if not found
109
*/
110
LookupResult
Lookup
(
Mac48Address
destination);
111
112
private
:
113
/// Routing table entry
114
struct
Route
115
{
116
Mac48Address
retransmitter
;
///< retransmitter
117
uint32_t
interface
;
///< interface
118
uint32_t
cost
;
///< cost
119
Time
whenExpire
;
///< expire when?
120
uint32_t
seqnum
;
///< sequence number
121
};
122
123
/// Lifetime parameter
124
Time
m_lifetime
;
125
/// List of routes
126
std::map<Mac48Address, Route>
m_routes
;
127
};
128
129
}
// namespace flame
130
}
// namespace ns3
131
#endif
/* FLAME_PROTOCOL_H */
ns3::Mac48Address
an EUI-48 address
Definition
mac48-address.h:35
ns3::Mac48Address::GetBroadcast
static Mac48Address GetBroadcast()
Definition
mac48-address.cc:144
ns3::Object
A base class which provides memory management and object aggregation.
Definition
object.h:78
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition
nstime.h:94
ns3::TypeId
a unique identifier for an interface.
Definition
type-id.h:48
ns3::flame::FlameRtable
Routing table for FLAME.
Definition
flame-rtable.h:28
ns3::flame::FlameRtable::Lookup
LookupResult Lookup(Mac48Address destination)
Lookup path to destination.
Definition
flame-rtable.cc:83
ns3::flame::FlameRtable::DoDispose
void DoDispose() override
Destructor implementation.
Definition
flame-rtable.cc:50
ns3::flame::FlameRtable::FlameRtable
FlameRtable()
Definition
flame-rtable.cc:40
ns3::flame::FlameRtable::INTERFACE_ANY
static const uint32_t INTERFACE_ANY
Means all interfaces.
Definition
flame-rtable.h:31
ns3::flame::FlameRtable::AddPath
void AddPath(const Mac48Address destination, const Mac48Address retransmitter, const uint32_t interface, const uint8_t cost, const uint16_t seqnum)
Add path.
Definition
flame-rtable.cc:56
ns3::flame::FlameRtable::~FlameRtable
~FlameRtable() override
Definition
flame-rtable.cc:45
ns3::flame::FlameRtable::FlameRtable
FlameRtable(const FlameRtable &)=delete
ns3::flame::FlameRtable::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition
flame-rtable.cc:26
ns3::flame::FlameRtable::m_routes
std::map< Mac48Address, Route > m_routes
List of routes.
Definition
flame-rtable.h:126
ns3::flame::FlameRtable::m_lifetime
Time m_lifetime
Lifetime parameter.
Definition
flame-rtable.h:124
ns3::flame::FlameRtable::MAX_COST
static const uint32_t MAX_COST
Maximum (the best?) path cost.
Definition
flame-rtable.h:33
ns3::flame::FlameRtable::operator=
FlameRtable & operator=(const FlameRtable &)=delete
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::flame::FlameRtable::LookupResult
Route lookup result, return type of LookupXXX methods.
Definition
flame-rtable.h:37
ns3::flame::FlameRtable::LookupResult::ifIndex
uint32_t ifIndex
IF index.
Definition
flame-rtable.h:39
ns3::flame::FlameRtable::LookupResult::seqnum
uint16_t seqnum
sequence number
Definition
flame-rtable.h:41
ns3::flame::FlameRtable::LookupResult::IsValid
bool IsValid() const
Definition
flame-rtable.cc:110
ns3::flame::FlameRtable::LookupResult::LookupResult
LookupResult(Mac48Address r=Mac48Address::GetBroadcast(), uint32_t i=INTERFACE_ANY, uint8_t c=MAX_COST, uint16_t s=0)
Constructor.
Definition
flame-rtable.h:51
ns3::flame::FlameRtable::LookupResult::operator==
bool operator==(const LookupResult &o) const
Compare route lookup results, used by tests.
Definition
flame-rtable.cc:103
ns3::flame::FlameRtable::LookupResult::retransmitter
Mac48Address retransmitter
retransmitter
Definition
flame-rtable.h:38
ns3::flame::FlameRtable::LookupResult::cost
uint8_t cost
cost
Definition
flame-rtable.h:40
ns3::flame::FlameRtable::Route
Routing table entry.
Definition
flame-rtable.h:115
ns3::flame::FlameRtable::Route::seqnum
uint32_t seqnum
sequence number
Definition
flame-rtable.h:120
ns3::flame::FlameRtable::Route::whenExpire
Time whenExpire
expire when?
Definition
flame-rtable.h:119
ns3::flame::FlameRtable::Route::retransmitter
Mac48Address retransmitter
retransmitter
Definition
flame-rtable.h:116
ns3::flame::FlameRtable::Route::cost
uint32_t cost
cost
Definition
flame-rtable.h:118
ns3::flame::FlameRtable::Route::interface
uint32_t interface
interface
Definition
flame-rtable.h:117
src
mesh
model
flame
flame-rtable.h
Generated on Mon Dec 2 2024 09:20:45 for ns-3 by
1.11.0