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
mesh-l2-routing-protocol.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008,2009 IITP RAS
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
* Authors: Kirill Andreev <andreev@iitp.ru>
18
* Pavel Boyko <boyko@iitp.ru>
19
*/
20
21
#ifndef MESH_L2_ROUTING_PROTOCOL_H
22
#define MESH_L2_ROUTING_PROTOCOL_H
23
24
#include "ns3/mac48-address.h"
25
#include "ns3/object.h"
26
#include "ns3/packet.h"
27
28
namespace
ns3
29
{
30
31
class
Packet;
32
class
MeshPointDevice;
33
34
/**
35
* \ingroup mesh
36
*
37
* \brief Interface for L2 mesh routing protocol and mesh point communication.
38
*
39
* Every mesh routing protocol must implement this interface. Each mesh point (MeshPointDevice) is
40
* supposed to know single L2RoutingProtocol to work with, see MeshPointDevice::SetRoutingProtocol
41
* ().
42
*
43
* This interface is similar to ipv4 routing protocol base class.
44
*/
45
class
MeshL2RoutingProtocol
:
public
Object
46
{
47
public
:
48
/**
49
* \brief Get the type ID.
50
* \return the object TypeId
51
*/
52
static
TypeId
GetTypeId
();
53
/// virtual D-tor for subclasses
54
~MeshL2RoutingProtocol
()
override
;
55
/**
56
* Callback to be invoked when route discovery procedure is completed.
57
*
58
* \param flag indicating whether a route was actually found and all needed information
59
* is added to the packet successfully
60
*
61
* \param packet for which the route was resolved. All routing information for MAC layer
62
* must be stored in proper tags (like in case of HWMP, when WifiMacHeader
63
* needs address of next hop), or must be added as a packet header (if MAC
64
* does not need any additional information). So, the packet is returned back
65
* to MeshPointDevice looks like a pure packet with ethernet header
66
* (i.e data + src +dst + protocol). The only special information addressed
67
* to MeshPointDevice is an outcoming interface ID.
68
*
69
* \param src source address of the packet
70
*
71
* \param dst destination address of the packet
72
*
73
* \param protocol ethernet 'Protocol' field, needed to form a proper MAC-layer header
74
*
75
* \param uint32_t outcoming interface to use or 0xffffffff if packet should be sent by ALL
76
* interfaces
77
*/
78
typedef
Callback
<void,
/* return type */
79
bool,
/* flag */
80
Ptr<Packet>
,
/* packet */
81
Mac48Address
,
/* src */
82
Mac48Address
,
/* dst */
83
uint16_t,
/* protocol */
84
uint32_t
/* out interface ID */
85
>
86
RouteReplyCallback
;
87
/**
88
* Request routing information, all packets must go through this request.
89
*
90
* Note that route discovery works async. -- RequestRoute returns immediately, while
91
* reply callback will be called when routing information will be available.
92
* \return true if valid route is already known
93
* \param sourceIface the incoming interface of the packet
94
* \param source source address
95
* \param destination destination address
96
* \param packet the packet to be resolved (needed the whole packet, because
97
* routing information is added as tags or headers). The packet
98
* will be returned to reply callback.
99
* \param protocolType protocol ID, needed to form a proper MAC-layer header
100
* \param routeReply callback to be invoked after route discovery procedure, supposed
101
* to really send packet using routing information.
102
*/
103
virtual
bool
RequestRoute
(
uint32_t
sourceIface,
104
const
Mac48Address
source,
105
const
Mac48Address
destination,
106
Ptr<const Packet>
packet,
107
uint16_t protocolType,
108
RouteReplyCallback
routeReply) = 0;
109
/**
110
* \brief When packet is ready to go to upper layer, protocol must
111
* remove all its information: tags, header, etc. So,
112
* MeshPointDevice must call this method when passing a packet to
113
* upper layer.
114
* \returns true if packet shall not be dropped, false otherwise.
115
* \param fromIface the incoming interface of the packet
116
* \param source source address
117
* \param destination destination address
118
* \param packet the packet to be handled
119
* \param protocolType protocol ID, needed to form a proper MAC-layer header
120
* \attention protocol type is passed by reference, because may be
121
* changed
122
*/
123
virtual
bool
RemoveRoutingStuff
(
uint32_t
fromIface,
124
const
Mac48Address
source,
125
const
Mac48Address
destination,
126
Ptr<Packet>
packet,
127
uint16_t& protocolType) = 0;
128
/**
129
* Set host mesh point, analog of SetNode (...) methods for upper layer protocols.
130
*
131
* \param mp the mesh point device
132
*/
133
void
SetMeshPoint
(
Ptr<MeshPointDevice>
mp);
134
/**
135
* Each mesh protocol must be installed on the mesh point to work.
136
*
137
* \returns the mesh point device
138
*/
139
Ptr<MeshPointDevice>
GetMeshPoint
()
const
;
140
141
protected
:
142
/// Host mesh point
143
Ptr<MeshPointDevice>
m_mp
;
144
};
145
}
// namespace ns3
146
#endif
ns3::Callback
Callback template class.
Definition:
callback.h:438
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:46
ns3::MeshL2RoutingProtocol
Interface for L2 mesh routing protocol and mesh point communication.
Definition:
mesh-l2-routing-protocol.h:46
ns3::MeshL2RoutingProtocol::~MeshL2RoutingProtocol
~MeshL2RoutingProtocol() override
virtual D-tor for subclasses
Definition:
mesh-l2-routing-protocol.cc:42
ns3::MeshL2RoutingProtocol::RouteReplyCallback
Callback< void, bool, Ptr< Packet >, Mac48Address, Mac48Address, uint16_t, uint32_t > RouteReplyCallback
Callback to be invoked when route discovery procedure is completed.
Definition:
mesh-l2-routing-protocol.h:86
ns3::MeshL2RoutingProtocol::SetMeshPoint
void SetMeshPoint(Ptr< MeshPointDevice > mp)
Set host mesh point, analog of SetNode (...) methods for upper layer protocols.
Definition:
mesh-l2-routing-protocol.cc:48
ns3::MeshL2RoutingProtocol::RequestRoute
virtual bool RequestRoute(uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, Ptr< const Packet > packet, uint16_t protocolType, RouteReplyCallback routeReply)=0
Request routing information, all packets must go through this request.
ns3::MeshL2RoutingProtocol::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
mesh-l2-routing-protocol.cc:35
ns3::MeshL2RoutingProtocol::GetMeshPoint
Ptr< MeshPointDevice > GetMeshPoint() const
Each mesh protocol must be installed on the mesh point to work.
Definition:
mesh-l2-routing-protocol.cc:54
ns3::MeshL2RoutingProtocol::RemoveRoutingStuff
virtual bool RemoveRoutingStuff(uint32_t fromIface, const Mac48Address source, const Mac48Address destination, Ptr< Packet > packet, uint16_t &protocolType)=0
When packet is ready to go to upper layer, protocol must remove all its information: tags,...
ns3::MeshL2RoutingProtocol::m_mp
Ptr< MeshPointDevice > m_mp
Host mesh point.
Definition:
mesh-l2-routing-protocol.h:143
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:89
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
uint32_t
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
mesh
model
mesh-l2-routing-protocol.h
Generated on Tue May 28 2024 23:38:11 for ns-3 by
1.9.6