From: Richard Whitehouse Date: Sun, 20 Feb 2011 04:18:52 +0000 (+0000) Subject: Multimap required as each port may be on the optimal path for more than one MOOSE... X-Git-Url: https://git.richardwhiuk.com/?a=commitdiff_plain;h=6ac5e82407dfaa7d03f668f4425a1088b28d9d21;p=ns-moose.git Multimap required as each port may be on the optimal path for more than one MOOSE Switch --- diff --git a/code/src/devices/bridge/helper/moose-bridge-helper.cc b/code/src/devices/bridge/helper/moose-bridge-helper.cc index 7d4b727..f74203f 100644 --- a/code/src/devices/bridge/helper/moose-bridge-helper.cc +++ b/code/src/devices/bridge/helper/moose-bridge-helper.cc @@ -43,7 +43,7 @@ MooseBridgeHelper::SetDeviceAttribute (std::string n1, const AttributeValue &v1) } NetDeviceContainer -MooseBridgeHelper::Install (Ptr node, NetDeviceContainer c, MoosePrefixAddress addr, std::map, MoosePrefixAddress> routes) +MooseBridgeHelper::Install (Ptr node, NetDeviceContainer c, MoosePrefixAddress addr, std::multimap, MoosePrefixAddress> routes) { NS_LOG_FUNCTION_NOARGS (); NS_LOG_LOGIC ("**** Install MOOSE bridge device on node " << node->GetId ()); @@ -61,9 +61,8 @@ MooseBridgeHelper::Install (Ptr node, NetDeviceContainer c, MoosePrefixAdd { NS_LOG_LOGIC ("**** Add MooseBridgePort "<< *i); Ptr port = dev->AddBridgePort (*i); - std::map, MoosePrefixAddress>::iterator it = routes.find(*i); - if(it != routes.end()){ - portMap[routes[*i]] = port; + for(std::multimap, MoosePrefixAddress>::iterator it = routes.lower_bound(*i); it != routes.upper_bound(*i); ++it){ + portMap[it->second] = port; } } diff --git a/code/src/devices/bridge/helper/moose-bridge-helper.h b/code/src/devices/bridge/helper/moose-bridge-helper.h index c6fa8d9..9bd463d 100644 --- a/code/src/devices/bridge/helper/moose-bridge-helper.h +++ b/code/src/devices/bridge/helper/moose-bridge-helper.h @@ -69,7 +69,7 @@ public: * This method creates an ns3::MooseBridgeNetDevice with static routing. */ - NetDeviceContainer Install (Ptr node, NetDeviceContainer c, MoosePrefixAddress addr, std::map, MoosePrefixAddress> routes); + NetDeviceContainer Install (Ptr node, NetDeviceContainer c, MoosePrefixAddress addr, std::multimap, MoosePrefixAddress> routes); /** * This method creates an ns3::MooseBridgeNetDevice with the attributes