A Discrete-Event Network Simulator
API
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 
46 {
47  public:
52  static TypeId GetTypeId();
54  ~MeshL2RoutingProtocol() override;
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  >
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;
123  virtual bool RemoveRoutingStuff(uint32_t fromIface,
124  const Mac48Address source,
125  const Mac48Address destination,
126  Ptr<Packet> packet,
127  uint16_t& protocolType) = 0;
140 
141  protected:
144 };
145 } // namespace ns3
146 #endif
Callback template class.
Definition: callback.h:438
an EUI-48 address
Definition: mac48-address.h:46
Interface for L2 mesh routing protocol and mesh point communication.
~MeshL2RoutingProtocol() override
virtual D-tor for subclasses
Callback< void, bool, Ptr< Packet >, Mac48Address, Mac48Address, uint16_t, uint32_t > RouteReplyCallback
Callback to be invoked when route discovery procedure is completed.
void SetMeshPoint(Ptr< MeshPointDevice > mp)
Set host mesh point, analog of SetNode (...) methods for upper layer protocols.
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.
static TypeId GetTypeId()
Get the type ID.
Ptr< MeshPointDevice > GetMeshPoint() const
Each mesh protocol must be installed on the mesh point to work.
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,...
Ptr< MeshPointDevice > m_mp
Host mesh point.
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.