From 77b3ed6cb9985850e12a511db80351a575d5ab0f Mon Sep 17 00:00:00 2001 From: Kirill Andreev Date: Mon, 15 Jun 2009 19:06:23 +0400 Subject: [PATCH] added 'const' label to packet in MeshPointDevice::Forward and L2RoutingProtocol::RequestRoute --- src/devices/mesh/dot11s/hwmp-protocol.cc | 5 +++-- src/devices/mesh/dot11s/hwmp-protocol.h | 2 +- src/devices/mesh/mesh-l2-routing-protocol.h | 2 +- src/devices/mesh/mesh-point-device.cc | 11 +++-------- src/devices/mesh/mesh-point-device.h | 4 ++-- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/devices/mesh/dot11s/hwmp-protocol.cc b/src/devices/mesh/dot11s/hwmp-protocol.cc index ec577706d..71665aee6 100644 --- a/src/devices/mesh/dot11s/hwmp-protocol.cc +++ b/src/devices/mesh/dot11s/hwmp-protocol.cc @@ -195,18 +195,19 @@ HwmpProtocol::RequestRoute ( uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, - Ptr packet, + Ptr constPacket, uint16_t protocolType, //ethrnet 'Protocol' field MeshL2RoutingProtocol::RouteReplyCallback routeReply ) { + Ptr 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 ()) diff --git a/src/devices/mesh/dot11s/hwmp-protocol.h b/src/devices/mesh/dot11s/hwmp-protocol.h index 2195be60f..6f9530428 100644 --- a/src/devices/mesh/dot11s/hwmp-protocol.h +++ b/src/devices/mesh/dot11s/hwmp-protocol.h @@ -53,7 +53,7 @@ public: /// Route request, inherited from MeshL2RoutingProtocol bool RequestRoute (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, - Ptr packet, uint16_t protocolType, RouteReplyCallback routeReply); + Ptr packet, uint16_t protocolType, RouteReplyCallback routeReply); /** * \brief Install HWMP on given mesh point. * diff --git a/src/devices/mesh/mesh-l2-routing-protocol.h b/src/devices/mesh/mesh-l2-routing-protocol.h index b376858fa..003df2a5e 100644 --- a/src/devices/mesh/mesh-l2-routing-protocol.h +++ b/src/devices/mesh/mesh-l2-routing-protocol.h @@ -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, uint16_t protocolType, RouteReplyCallback routeReply ) = 0; + Ptr packet, uint16_t protocolType, RouteReplyCallback routeReply ) = 0; /// Set host mesh point, analog of SetNode (...) methods for upper layer protocols. void SetMeshPoint (Ptr mp); /// Each mesh protocol must be installed on the mesh point to work. diff --git a/src/devices/mesh/mesh-point-device.cc b/src/devices/mesh/mesh-point-device.cc index 3ecff71cc..02f9bd340 100644 --- a/src/devices/mesh/mesh-point-device.cc +++ b/src/devices/mesh/mesh-point-device.cc @@ -89,13 +89,8 @@ MeshPointDevice::ReceiveFromDevice (Ptr incomingPort, PtrCopy (), protocol, src48, dst48); - - // ... and deliver to upper layer - Ptr 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 incomingPort, Ptr inport, Ptr packet, +MeshPointDevice::Forward (Ptr inport, Ptr packet, uint16_t protocol, const Mac48Address src, const Mac48Address dst) { // pass through routing protocol diff --git a/src/devices/mesh/mesh-point-device.h b/src/devices/mesh/mesh-point-device.h index 803bd034e..ae5e9caae 100644 --- a/src/devices/mesh/mesh-point-device.h +++ b/src/devices/mesh/mesh-point-device.h @@ -123,7 +123,7 @@ private: void ReceiveFromDevice (Ptr device, Ptr packet, uint16_t protocol, Address const &source, Address const &destination, PacketType packetType); /// Forward packet down to interfaces - void Forward (Ptr incomingPort, Ptr packet, + void Forward (Ptr incomingPort, Ptr 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, + Ptr, uint16_t, MeshL2RoutingProtocol::RouteReplyCallback> m_requestRoute;