Make routing protocol attribute of mesh point to be accessable by Config::

This commit is contained in:
Pavel Boyko
2009-04-01 16:14:05 +04:00
parent df751a24e7
commit af32684b40
2 changed files with 18 additions and 4 deletions

View File

@@ -23,6 +23,7 @@
#include "ns3/node.h"
#include "ns3/packet.h"
#include "ns3/log.h"
#include "ns3/pointer.h"
#include "ns3/mesh-point-device.h"
NS_LOG_COMPONENT_DEFINE ("MeshPointDevice");
@@ -37,8 +38,12 @@ MeshPointDevice::GetTypeId ()
static TypeId tid = TypeId ("ns3::MeshPointDevice")
.SetParent<NetDevice> ()
.AddConstructor<MeshPointDevice> ()
.AddAttribute ("RoutingProtocol", "The mesh routing protocol used by this mesh point.",
PointerValue (),
MakePointerAccessor (&MeshPointDevice::GetRoutingProtocol,
&MeshPointDevice::SetRoutingProtocol),
MakePointerChecker<MeshL2RoutingProtocol> ())
;
// TODO Add station-level attributes here
return tid;
}
@@ -333,12 +338,19 @@ MeshPointDevice::SetRoutingProtocol (Ptr<MeshL2RoutingProtocol> protocol)
NS_ASSERT_MSG (PeekPointer(protocol->GetMeshPoint()) == this, "Routing protocol must be installed on mesh point to be usefull.");
m_routingProtocol = protocol;
m_requestRoute = MakeCallback (&MeshL2RoutingProtocol::RequestRoute, protocol);
m_myResponse = MakeCallback (&MeshPointDevice::DoSend, this);
return;
}
Ptr<MeshL2RoutingProtocol>
MeshPointDevice::GetRoutingProtocol () const
{
return m_routingProtocol;
}
void
MeshPointDevice::DoSend (bool success, Ptr<Packet> packet, Mac48Address src, Mac48Address dst, uint16_t protocol, uint32_t outIface)
{

View File

@@ -82,10 +82,10 @@ public:
///\name Protocols
//\{
/**
* \brief Register routing protocol to be used. Protocol must be alredy installed on this mesh point.
*/
/// Register routing protocol to be used. Protocol must be alredy installed on this mesh point.
void SetRoutingProtocol (Ptr<MeshL2RoutingProtocol> protocol);
/// Access current routing protocol
Ptr<MeshL2RoutingProtocol> GetRoutingProtocol() const;
//\}
///\name NetDevice interface for upper layers
@@ -168,6 +168,8 @@ private:
/// Routing response callback, this is supplied to mesh routing protocol
MeshL2RoutingProtocol::RouteReplyCallback m_myResponse;
/// Current routing protocol, used mainly by GetRoutingProtocol
Ptr<MeshL2RoutingProtocol> m_routingProtocol;
};
} //namespace ns3
#endif