A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
flame-rtable.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 IITP RAS
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: Kirill Andreev <andreev@iitp.ru>
19
*/
20
21
#ifndef FLAME_RTABLE_H
22
#define FLAME_RTABLE_H
23
24
#include <map>
25
#include "ns3/nstime.h"
26
#include "ns3/object.h"
27
#include "ns3/mac48-address.h"
28
29
namespace
ns3
{
30
namespace
flame {
36
class
FlameRtable
:
public
Object
37
{
38
public
:
40
const
static
uint32_t
INTERFACE_ANY
= 0xffffffff;
42
const
static
uint32_t
MAX_COST
= 0xff;
43
45
struct
LookupResult
46
{
47
Mac48Address
retransmitter
;
48
uint32_t
ifIndex
;
49
uint8_t
cost
;
50
uint16_t
seqnum
;
59
LookupResult
(
Mac48Address
r =
Mac48Address::GetBroadcast
(),
60
uint32_t i =
INTERFACE_ANY
,
61
uint8_t c =
MAX_COST
,
62
uint16_t s = 0)
63
:
retransmitter
(r),
64
ifIndex
(i),
65
cost
(c),
66
seqnum
(s)
67
{
68
}
72
bool
IsValid
()
const
;
79
bool
operator==
(
const
LookupResult
& o)
const
;
80
};
81
public
:
86
static
TypeId
GetTypeId
();
87
FlameRtable
();
88
~FlameRtable
();
89
void
DoDispose
();
90
100
void
AddPath
(
101
const
Mac48Address
destination,
102
const
Mac48Address
retransmitter,
103
const
uint32_t interface,
104
const
uint8_t cost,
105
const
uint16_t seqnum
106
);
112
LookupResult
Lookup
(
Mac48Address
destination);
113
private
:
120
FlameRtable
&
operator=
(
const
FlameRtable
& table);
122
FlameRtable
(
const
FlameRtable
&);
123
125
struct
Route
126
{
127
Mac48Address
retransmitter
;
128
uint32_t
interface
;
129
uint32_t
cost
;
130
Time
whenExpire
;
131
uint32_t
seqnum
;
132
};
134
Time
m_lifetime
;
136
std::map<Mac48Address, Route>
m_routes
;
137
};
138
139
}
// namespace flame
140
}
// namespace ns3
141
#endif
/* FLAME_PROTOCOL_H */
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:44
ns3::Mac48Address::GetBroadcast
static Mac48Address GetBroadcast(void)
Definition:
mac48-address.cc:170
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:88
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:103
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
ns3::flame::FlameRtable
Routing table for FLAME.
Definition:
flame-rtable.h:37
ns3::flame::FlameRtable::Lookup
LookupResult Lookup(Mac48Address destination)
Lookup path to destination.
Definition:
flame-rtable.cc:88
ns3::flame::FlameRtable::operator=
FlameRtable & operator=(const FlameRtable &table)
assignment operator
ns3::flame::FlameRtable::FlameRtable
FlameRtable()
Definition:
flame-rtable.cc:52
ns3::flame::FlameRtable::INTERFACE_ANY
static const uint32_t INTERFACE_ANY
Means all interfaces.
Definition:
flame-rtable.h:40
ns3::flame::FlameRtable::DoDispose
void DoDispose()
Destructor implementation.
Definition:
flame-rtable.cc:60
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:65
ns3::flame::FlameRtable::~FlameRtable
~FlameRtable()
Definition:
flame-rtable.cc:56
ns3::flame::FlameRtable::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
flame-rtable.cc:36
ns3::flame::FlameRtable::m_routes
std::map< Mac48Address, Route > m_routes
List of routes.
Definition:
flame-rtable.h:136
ns3::flame::FlameRtable::m_lifetime
Time m_lifetime
Lifetime parameter.
Definition:
flame-rtable.h:134
ns3::flame::FlameRtable::MAX_COST
static const uint32_t MAX_COST
Maximum (the best?) path cost.
Definition:
flame-rtable.h:42
ns3::flame::FlameRtable::FlameRtable
FlameRtable(const FlameRtable &)
type conversion operator
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:46
ns3::flame::FlameRtable::LookupResult::ifIndex
uint32_t ifIndex
IF index.
Definition:
flame-rtable.h:48
ns3::flame::FlameRtable::LookupResult::seqnum
uint16_t seqnum
sequence number
Definition:
flame-rtable.h:50
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:59
ns3::flame::FlameRtable::LookupResult::operator==
bool operator==(const LookupResult &o) const
Compare route lookup results, used by tests.
Definition:
flame-rtable.cc:104
ns3::flame::FlameRtable::LookupResult::retransmitter
Mac48Address retransmitter
retransmitter
Definition:
flame-rtable.h:47
ns3::flame::FlameRtable::LookupResult::cost
uint8_t cost
cost
Definition:
flame-rtable.h:49
ns3::flame::FlameRtable::Route
Routing table entry.
Definition:
flame-rtable.h:126
ns3::flame::FlameRtable::Route::seqnum
uint32_t seqnum
sequence number
Definition:
flame-rtable.h:131
ns3::flame::FlameRtable::Route::whenExpire
Time whenExpire
expire when?
Definition:
flame-rtable.h:130
ns3::flame::FlameRtable::Route::retransmitter
Mac48Address retransmitter
retransmitter
Definition:
flame-rtable.h:127
ns3::flame::FlameRtable::Route::cost
uint32_t cost
cost
Definition:
flame-rtable.h:129
ns3::flame::FlameRtable::Route::interface
uint32_t interface
interface
Definition:
flame-rtable.h:128
src
mesh
model
flame
flame-rtable.h
Generated on Tue Feb 6 2024 19:21:24 for ns-3 by
1.9.1