added 'const' label to packet in MeshPointDevice::Forward and

L2RoutingProtocol::RequestRoute
This commit is contained in:
Kirill Andreev
2009-06-15 19:06:23 +04:00
parent 9e1e68aa10
commit 77b3ed6cb9
5 changed files with 10 additions and 14 deletions

View File

@@ -195,18 +195,19 @@ HwmpProtocol::RequestRoute (
uint32_t sourceIface,
const Mac48Address source,
const Mac48Address destination,
Ptr<Packet> packet,
Ptr<const Packet> constPacket,
uint16_t protocolType, //ethrnet 'Protocol' field
MeshL2RoutingProtocol::RouteReplyCallback routeReply
)
{
Ptr <Packet> packet = constPacket->Copy ();
HwmpTag tag;
if (sourceIface == GetMeshPoint ()->GetIfIndex())
// packet from level 3
{
if(packet->PeekPacketTag(tag))
{
NS_FATAL_ERROR ("HWMP tag is not supposed to be here at this point.");
NS_FATAL_ERROR ("HWMP tag has come with a packet from upper layer. This must not occur...");
}
//Filling TAG:
if(destination == Mac48Address::GetBroadcast ())

View File

@@ -53,7 +53,7 @@ public:
/// Route request, inherited from MeshL2RoutingProtocol
bool RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination,
Ptr<Packet> packet, uint16_t protocolType, RouteReplyCallback routeReply);
Ptr<const Packet> packet, uint16_t protocolType, RouteReplyCallback routeReply);
/**
* \brief Install HWMP on given mesh point.
*

View File

@@ -95,7 +95,7 @@ public:
* to really send packet using routing information.
*/
virtual bool RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination,
Ptr<Packet> packet, uint16_t protocolType, RouteReplyCallback routeReply ) = 0;
Ptr<const Packet> packet, uint16_t protocolType, RouteReplyCallback routeReply ) = 0;
/// Set host mesh point, analog of SetNode (...) methods for upper layer protocols.
void SetMeshPoint (Ptr<MeshPointDevice> mp);
/// Each mesh protocol must be installed on the mesh point to work.

View File

@@ -89,13 +89,8 @@ MeshPointDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packe
m_promiscRxCallback (this, packet, protocol, src, dst, packetType);
if(dst48.IsGroup ())
{
// forward broadcast further ...
Forward (incomingPort, packet->Copy (), protocol, src48, dst48);
// ... and deliver to upper layer
Ptr<Packet> packet_copy = packet->Copy ();
packet_copy->RemoveAllPacketTags (); // XXX remove all L2 routing tags
m_rxCallback (this, packet_copy, protocol, src);
Forward (incomingPort, packet, protocol, src48, dst48);
m_rxCallback (this, packet->Copy (), protocol, src);
return;
}
if(dst48 == m_address)
@@ -105,7 +100,7 @@ MeshPointDevice::ReceiveFromDevice (Ptr<NetDevice> incomingPort, Ptr<const Packe
}
void
MeshPointDevice::Forward (Ptr<NetDevice> inport, Ptr<Packet> packet,
MeshPointDevice::Forward (Ptr<NetDevice> inport, Ptr<const Packet> packet,
uint16_t protocol, const Mac48Address src, const Mac48Address dst)
{
// pass through routing protocol

View File

@@ -123,7 +123,7 @@ private:
void ReceiveFromDevice (Ptr<NetDevice> device, Ptr<const Packet> packet, uint16_t protocol,
Address const &source, Address const &destination, PacketType packetType);
/// Forward packet down to interfaces
void Forward (Ptr<NetDevice> incomingPort, Ptr<Packet> packet,
void Forward (Ptr<NetDevice> incomingPort, Ptr<const Packet> packet,
uint16_t protocol, const Mac48Address src, const Mac48Address dst);
/**
* Response callback for L2 routing protocol. This will be executed when routing information is ready.
@@ -162,7 +162,7 @@ private:
uint32_t,
Mac48Address,
Mac48Address,
Ptr<Packet>,
Ptr<const Packet>,
uint16_t,
MeshL2RoutingProtocol::RouteReplyCallback> m_requestRoute;