Removed unneeded word "struct", fixed mobility model, fixed random variable
authorKirill Andreev <andreev@iitp.ru>
Thu Mar 12 12:34:49 2009 +0300 (11 months ago)
changeset 47979902003078aa
parent 4795 1e94348872e0
child 4798 f5f30f79d845
Removed unneeded word "struct", fixed mobility model, fixed random variable
examples/mesh.cc
src/devices/l2-routing/l2-routing-hwmp/hwmp-rtable.cc
src/devices/l2-routing/l2-routing-hwmp/hwmp-state.cc
src/devices/l2-routing/l2-routing-hwmp/hwmp.cc
src/devices/wifi/mesh-wifi-peer-manager.cc
     1.1 --- a/examples/mesh.cc	Tue Mar 10 17:54:58 2009 +0300
     1.2 +++ b/examples/mesh.cc	Thu Mar 12 12:34:49 2009 +0300
     1.3 @@ -80,9 +80,10 @@
     1.4                   "DeltaY", DoubleValue (step),
     1.5  		 "GridWidth", UintegerValue (xSize),
     1.6  		 "LayoutType", StringValue("RowFirst"));
     1.7 -	mobility.SetMobilityModel ("ns3::StaticMobilityModel");
     1.8 +	NS_LOG_UNCOND("Mobility");
     1.9 +	mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
    1.10  	mobility.Install (nodes);
    1.11 -
    1.12 +	NS_LOG_UNCOND("Mobility installed");
    1.13  	// Setting Internet Stack:
    1.14  	InternetStackHelper stack;
    1.15  	stack.Install(nodes);
     2.1 --- a/src/devices/l2-routing/l2-routing-hwmp/hwmp-rtable.cc	Tue Mar 10 17:54:58 2009 +0300
     2.2 +++ b/src/devices/l2-routing/l2-routing-hwmp/hwmp-rtable.cc	Thu Mar 12 12:34:49 2009 +0300
     2.3 @@ -70,10 +70,10 @@
     2.4  		uint32_t	seqnum
     2.5  		)
     2.6  {
     2.7 -	std::map<Mac48Address, struct ReactiveRoute, addrcmp>::iterator i = m_routes.find(destination);
     2.8 +	std::map<Mac48Address, ReactiveRoute, addrcmp>::iterator i = m_routes.find(destination);
     2.9  	if(i == m_routes.end())
    2.10  	{
    2.11 -		struct ReactiveRoute newroute;
    2.12 +		ReactiveRoute newroute;
    2.13  		m_routes[destination] = newroute;
    2.14  	}
    2.15  	else
    2.16 @@ -119,9 +119,9 @@
    2.17  		uint32_t	seqnum
    2.18  		)
    2.19  {
    2.20 -	struct ProactiveRoute newroute;
    2.21 +	ProactiveRoute newroute;
    2.22  	m_roots[port] = newroute;
    2.23 -	std::map<uint32_t,struct ProactiveRoute>::iterator i = m_roots.find(port);
    2.24 +	std::map<uint32_t,ProactiveRoute>::iterator i = m_roots.find(port);
    2.25  	NS_ASSERT(i != m_roots.end());
    2.26  	i->second.root = root;
    2.27  	i->second.retransmitter = retransmitter;
    2.28 @@ -135,7 +135,7 @@
    2.29  HwmpRtable::AddPrecursor(Mac48Address destination, uint32_t port, Mac48Address precursor)
    2.30  {
    2.31  	bool should_add = true;
    2.32 -	std::map<Mac48Address, struct ReactiveRoute, addrcmp>::iterator i = m_routes.find(destination);
    2.33 +	std::map<Mac48Address, ReactiveRoute, addrcmp>::iterator i = m_routes.find(destination);
    2.34  	if((i != m_routes.end()) && (i->second.port == port))
    2.35  	{
    2.36  		for(unsigned int j = 0 ; j < i->second.precursors.size(); j ++)
    2.37 @@ -147,7 +147,7 @@
    2.38  		if(should_add)
    2.39  			i->second.precursors.push_back(precursor);
    2.40  	}
    2.41 -	std::map<uint32_t,struct ProactiveRoute>::iterator k = m_roots.find(port);
    2.42 +	std::map<uint32_t,ProactiveRoute>::iterator k = m_roots.find(port);
    2.43  	if(k!= m_roots.end())
    2.44  	{
    2.45  		for(unsigned int j = 0 ; j < k->second.precursors.size(); j ++)
    2.46 @@ -161,7 +161,7 @@
    2.47  void
    2.48  HwmpRtable::DeleteProactivePath(uint32_t port)
    2.49  {
    2.50 -	std::map<uint32_t,struct ProactiveRoute>::iterator j = m_roots.find(port);
    2.51 +	std::map<uint32_t,ProactiveRoute>::iterator j = m_roots.find(port);
    2.52  	if(j != m_roots.end())
    2.53  		m_roots.erase(j);
    2.54  
    2.55 @@ -169,7 +169,7 @@
    2.56  void
    2.57  HwmpRtable::DeleteProactivePath(Mac48Address root, uint32_t port)
    2.58  {
    2.59 -	std::map<uint32_t,struct ProactiveRoute>::iterator j = m_roots.find(port);
    2.60 +	std::map<uint32_t,ProactiveRoute>::iterator j = m_roots.find(port);
    2.61  	if((j != m_roots.end())&&(j->second.root == root))
    2.62  		m_roots.erase(j);
    2.63  
    2.64 @@ -178,21 +178,21 @@
    2.65  void
    2.66  HwmpRtable::DeleteReactivePath(Mac48Address destination, uint32_t port)
    2.67  {
    2.68 -	std::map<Mac48Address, struct ReactiveRoute, addrcmp>::iterator i = m_routes.find(destination);
    2.69 +	std::map<Mac48Address, ReactiveRoute, addrcmp>::iterator i = m_routes.find(destination);
    2.70  	if(i != m_routes.end())
    2.71  		if(i->second.port ==  port)
    2.72  			m_routes.erase(i);
    2.73  }
    2.74  
    2.75 -struct HwmpRtable::LookupResult
    2.76 +HwmpRtable::LookupResult
    2.77  HwmpRtable::LookupReactive(Mac48Address destination)
    2.78  {
    2.79 -	struct LookupResult result;
    2.80 +	LookupResult result;
    2.81  	result.retransmitter = Mac48Address::GetBroadcast();
    2.82  	result.metric = MAX_METRIC;
    2.83  	result.ifIndex = PORT_ANY;
    2.84  	
    2.85 -	std::map<Mac48Address, struct ReactiveRoute, addrcmp>::iterator i = m_routes.find(destination);
    2.86 +	std::map<Mac48Address, ReactiveRoute, addrcmp>::iterator i = m_routes.find(destination);
    2.87  	if(i == m_routes.end())
    2.88  		return result;
    2.89  	result.ifIndex = i->second.port;
    2.90 @@ -206,14 +206,14 @@
    2.91  	return result;
    2.92  }
    2.93  
    2.94 -struct HwmpRtable::LookupResult
    2.95 +HwmpRtable::LookupResult
    2.96  HwmpRtable::LookupProactive(uint32_t port)
    2.97  {
    2.98 -	struct LookupResult result;
    2.99 +	LookupResult result;
   2.100  	result.retransmitter = Mac48Address::GetBroadcast();
   2.101  	result.metric = MAX_METRIC;
   2.102  	result.ifIndex = PORT_ANY;
   2.103 -	std::map<uint32_t, struct ProactiveRoute, addrcmp>::iterator i = m_roots.find(port);
   2.104 +	std::map<uint32_t, ProactiveRoute, addrcmp>::iterator i = m_roots.find(port);
   2.105  	if(i == m_roots.end())
   2.106  		return result;
   2.107  	result.ifIndex = i->first;
   2.108 @@ -225,14 +225,14 @@
   2.109  	return result;
   2.110  }
   2.111  
   2.112 -std::vector<struct HwmpRtable::FailedDestination>
   2.113 +std::vector<HwmpRtable::FailedDestination>
   2.114  HwmpRtable::GetUnreachableDestinations(Mac48Address peerAddress, uint32_t port)
   2.115  {
   2.116 -	std::vector<struct FailedDestination> retval;
   2.117 -	for(std::map<Mac48Address, struct ReactiveRoute, addrcmp>::iterator i = m_routes.begin(); i!= m_routes.end(); i++)
   2.118 +	std::vector<FailedDestination> retval;
   2.119 +	for(std::map<Mac48Address, ReactiveRoute, addrcmp>::iterator i = m_routes.begin(); i!= m_routes.end(); i++)
   2.120  		if((i->second.retransmitter == peerAddress)&&(i->second.port == port))
   2.121  		{
   2.122 -			struct FailedDestination dst;
   2.123 +			FailedDestination dst;
   2.124  			dst.destination = i->first;
   2.125  			i->second.seqnum ++;
   2.126  			dst.seqnum = i->second.seqnum;
   2.127 @@ -241,10 +241,10 @@
   2.128  	/**
   2.129  	 * Lookup a path to root
   2.130  	 */
   2.131 -	std::map<uint32_t, struct ProactiveRoute, addrcmp>::iterator i = m_roots.find(port);
   2.132 +	std::map<uint32_t, ProactiveRoute, addrcmp>::iterator i = m_roots.find(port);
   2.133  	if((i != m_roots.end())&&(i->second.retransmitter == peerAddress))
   2.134  	{
   2.135 -		struct FailedDestination dst;
   2.136 +		FailedDestination dst;
   2.137  		dst.destination = i->second.root;
   2.138  		dst.seqnum = i->second.seqnum;
   2.139  		retval.push_back(dst);
   2.140 @@ -254,7 +254,7 @@
   2.141  uint32_t
   2.142  HwmpRtable::RequestSeqnum(Mac48Address destination)
   2.143  {
   2.144 -	std::map<Mac48Address, struct ReactiveRoute, addrcmp>::iterator i = m_routes.find(destination);
   2.145 +	std::map<Mac48Address, ReactiveRoute, addrcmp>::iterator i = m_routes.find(destination);
   2.146  	if(i == m_routes.end())
   2.147  		return 0;
   2.148  	return i->second.seqnum;
   2.149 @@ -264,13 +264,13 @@
   2.150  HwmpRtable::GetPrecursors(Mac48Address destination, uint32_t port)
   2.151  {
   2.152  	std::vector<Mac48Address> retval;
   2.153 -	std::map<uint32_t, struct ProactiveRoute, addrcmp>::iterator root = m_roots.find(port);
   2.154 +	std::map<uint32_t, ProactiveRoute, addrcmp>::iterator root = m_roots.find(port);
   2.155  	if((root != m_roots.end()) &&(root->second.root == destination))
   2.156  	{
   2.157  		for(unsigned int i = 0; i < root->second.precursors.size(); i ++)
   2.158  			retval.push_back(root->second.precursors[i]);
   2.159  	}
   2.160 -	std::map<Mac48Address, struct ReactiveRoute, addrcmp>::iterator route = m_routes.find(destination);
   2.161 +	std::map<Mac48Address, ReactiveRoute, addrcmp>::iterator route = m_routes.find(destination);
   2.162  	if( (route != m_routes.end()) && (route->second.port == port) )
   2.163  	{
   2.164  		for(unsigned int i = 0; i < route->second.precursors.size(); i ++)
     3.1 --- a/src/devices/l2-routing/l2-routing-hwmp/hwmp-state.cc	Tue Mar 10 17:54:58 2009 +0300
     3.2 +++ b/src/devices/l2-routing/l2-routing-hwmp/hwmp-state.cc	Thu Mar 12 12:34:49 2009 +0300
     3.3 @@ -47,14 +47,14 @@
     3.4  }
     3.5  void
     3.6  HwmpState::SetRequestRouteCallback(
     3.7 -		Callback<struct HwmpRtable::LookupResult, const Mac48Address&> cb)
     3.8 +		Callback<HwmpRtable::LookupResult, const Mac48Address&> cb)
     3.9  {
    3.10  	m_requestRouteCallback = cb;
    3.11  }
    3.12  
    3.13  void
    3.14  HwmpState::SetRequestRootPathCallback(
    3.15 -		Callback<struct HwmpRtable::LookupResult, uint32_t> cb)
    3.16 +		Callback<HwmpRtable::LookupResult, uint32_t> cb)
    3.17  {
    3.18  	m_requestRootPathCallback = cb;
    3.19  }
    3.20 @@ -87,7 +87,7 @@
    3.21  
    3.22  void
    3.23  HwmpState::SetRetransmittersOfPerrCallback(
    3.24 -		Callback<std::vector<Mac48Address>, std::vector<struct HwmpRtable::FailedDestination>, uint32_t> cb)
    3.25 +		Callback<std::vector<Mac48Address>, std::vector<HwmpRtable::FailedDestination>, uint32_t> cb)
    3.26  {
    3.27  	m_retransmittersOfPerrCallback = cb;
    3.28  }
    3.29 @@ -133,7 +133,7 @@
    3.30  	}
    3.31  }
    3.32  void
    3.33 -HwmpState::SendPathError(std::vector<struct HwmpRtable::FailedDestination> destinations)
    3.34 +HwmpState::SendPathError(std::vector<HwmpRtable::FailedDestination> destinations)
    3.35  {
    3.36  	std::vector<Mac48Address> receivers =  m_retransmittersOfPerrCallback(destinations, m_ifIndex);
    3.37  	NS_LOG_DEBUG("SendPathError started");
    3.38 @@ -272,7 +272,7 @@
    3.39  			continue;
    3.40  		}
    3.41  		//check if can answer:
    3.42 -		struct HwmpRtable::LookupResult result = m_requestRouteCallback((*i)->GetDestinationAddress());
    3.43 +		HwmpRtable::LookupResult result = m_requestRouteCallback((*i)->GetDestinationAddress());
    3.44  		if((!((*i)->IsDo())) && (result.retransmitter!=Mac48Address::GetBroadcast()))
    3.45  		{
    3.46  			//have a valid information and acn answer
    3.47 @@ -328,7 +328,7 @@
    3.48  		if(i->second > prep.GetDestinationSeqNumber())
    3.49  			return;
    3.50  	//update routing info
    3.51 -	struct HwmpRtable::LookupResult result = m_requestRouteCallback(prep.GetDestinationAddress());
    3.52 +	HwmpRtable::LookupResult result = m_requestRouteCallback(prep.GetDestinationAddress());
    3.53  	if(result.retransmitter == Mac48Address::GetBroadcast())
    3.54  		//try to look for default route
    3.55  		result = m_requestRootPathCallback(m_ifIndex);
    3.56 @@ -371,7 +371,7 @@
    3.57  		/**
    3.58  		 * Lookup for a valid routing information
    3.59  		 */
    3.60 -	struct HwmpRtable::LookupResult result = m_requestRouteCallback(destinations[i].destination);
    3.61 +	HwmpRtable::LookupResult result = m_requestRouteCallback(destinations[i].destination);
    3.62  	if(
    3.63  			(result.retransmitter != from)
    3.64  			||(result.seqnum >= destinations[i].seqnum)
     4.1 --- a/src/devices/l2-routing/l2-routing-hwmp/hwmp.cc	Tue Mar 10 17:54:58 2009 +0300
     4.2 +++ b/src/devices/l2-routing/l2-routing-hwmp/hwmp.cc	Thu Mar 12 12:34:49 2009 +0300
     4.3 @@ -180,7 +180,7 @@
     4.4  	 * clear routing queue:
     4.5  	 */
     4.6  	for(
     4.7 -			std::map<Mac48Address, std::queue<struct QueuedPacket> >::iterator i =  m_rqueue.begin();
     4.8 +			std::map<Mac48Address, std::queue<QueuedPacket> >::iterator i =  m_rqueue.begin();
     4.9  			i != m_rqueue.end();
    4.10  			i++
    4.11  	   )
    4.12 @@ -211,7 +211,7 @@
    4.13  		L2RoutingProtocol::RouteReplyCallback routeReply
    4.14  		)
    4.15  {
    4.16 -	struct HwmpRtable::LookupResult result;
    4.17 +	HwmpRtable::LookupResult result;
    4.18  	HwmpTag tag;
    4.19  	if(sourceIface == m_interface)
    4.20  	{
    4.21 @@ -269,14 +269,14 @@
    4.22  		{
    4.23  			//Start path error procedure:
    4.24  			NS_LOG_DEBUG("Must Send PERR");
    4.25 -			std::vector<struct HwmpRtable::FailedDestination> destinations;
    4.26 -			struct HwmpRtable::FailedDestination dst;
    4.27 +			std::vector<HwmpRtable::FailedDestination> destinations;
    4.28 +			HwmpRtable::FailedDestination dst;
    4.29  			dst.seqnum = m_rtable->RequestSeqnum(destination);
    4.30  			dst.destination = destination;
    4.31  			destinations.push_back(dst);
    4.32  			StartPathErrorProcedure(destinations, result.ifIndex);
    4.33  		}
    4.34 -		struct L2RoutingProtocol::QueuedPacket pkt;
    4.35 +		L2RoutingProtocol::QueuedPacket pkt;
    4.36  		packet->RemoveAllTags();
    4.37  		packet->AddTag(tag);
    4.38  		pkt.pkt = packet;
    4.39 @@ -527,12 +527,12 @@
    4.40  		 */
    4.41  		{
    4.42  			NS_LOG_DEBUG("Failed peer"<<info.destination);
    4.43 -			std::vector<struct HwmpRtable::FailedDestination> failedDestinations = 
    4.44 +			std::vector<HwmpRtable::FailedDestination> failedDestinations = 
    4.45  				m_rtable->GetUnreachableDestinations(info.destination, info.outPort);
    4.46  			/**
    4.47  			 * Entry about peer does not contain seqnum
    4.48  			 */
    4.49 -			struct HwmpRtable::FailedDestination peer;
    4.50 +			HwmpRtable::FailedDestination peer;
    4.51  			peer.destination = info.destination;
    4.52  			peer.seqnum = 0;
    4.53  			failedDestinations.push_back(peer);
    4.54 @@ -544,20 +544,20 @@
    4.55  	}
    4.56  }
    4.57  
    4.58 -struct HwmpRtable::LookupResult
    4.59 +HwmpRtable::LookupResult
    4.60  Hwmp::RequestRouteForAddress(const Mac48Address& dst)
    4.61  {
    4.62  	return m_rtable->LookupReactive(dst);
    4.63  }
    4.64  
    4.65 -struct	HwmpRtable::LookupResult
    4.66 +HwmpRtable::LookupResult
    4.67  Hwmp::RequestRootPathForPort(uint32_t port)
    4.68  {
    4.69  	return m_rtable->LookupProactive(port);
    4.70  }
    4.71  
    4.72  void
    4.73 -Hwmp::StartPathErrorProcedure(std::vector<struct HwmpRtable::FailedDestination> destinations, uint32_t port)
    4.74 +Hwmp::StartPathErrorProcedure(std::vector<HwmpRtable::FailedDestination> destinations, uint32_t port)
    4.75  {
    4.76  	NS_LOG_DEBUG("START PERR");
    4.77  	for(unsigned int i  = 0; i < m_hwmpStates.size(); i++)
    4.78 @@ -565,7 +565,7 @@
    4.79  			m_pathErrorCallback[i](destinations);
    4.80  }
    4.81  std::vector<Mac48Address>
    4.82 -Hwmp::GetRetransmittersForFailedDestinations(std::vector<struct HwmpRtable::FailedDestination> failedDest, uint32_t port)
    4.83 +Hwmp::GetRetransmittersForFailedDestinations(std::vector<HwmpRtable::FailedDestination> failedDest, uint32_t port)
    4.84  {
    4.85  	std::vector<Mac48Address> retransmitters;
    4.86  	if(m_broadcastPerr)
    4.87 @@ -597,7 +597,7 @@
    4.88  }
    4.89  
    4.90  bool
    4.91 -Hwmp::QueuePacket(struct L2RoutingProtocol::QueuedPacket packet)
    4.92 +Hwmp::QueuePacket(L2RoutingProtocol::QueuedPacket packet)
    4.93  {
    4.94  	if((int)m_rqueue[packet.dst].size() > m_maxQueueSize)
    4.95  		return false;
    4.96 @@ -605,13 +605,13 @@
    4.97  	return true;
    4.98  }
    4.99  
   4.100 -struct L2RoutingProtocol::QueuedPacket
   4.101 +L2RoutingProtocol::QueuedPacket
   4.102  Hwmp::DequeuePacket(Mac48Address dst)
   4.103  {
   4.104 -	struct L2RoutingProtocol::QueuedPacket retval;
   4.105 +	L2RoutingProtocol::QueuedPacket retval;
   4.106  	retval.pkt = NULL;
   4.107  	//Ptr<Packet> in this structure is NULL when queue is empty
   4.108 -	std::map<Mac48Address, std::queue<struct QueuedPacket>, addrcmp>:: iterator i = m_rqueue.find(dst);
   4.109 +	std::map<Mac48Address, std::queue<QueuedPacket>, addrcmp>:: iterator i = m_rqueue.find(dst);
   4.110  	if(i == m_rqueue.end())
   4.111  		return retval;
   4.112  	if((int)m_rqueue[dst].size() == 0)
   4.113 @@ -629,8 +629,8 @@
   4.114  void
   4.115  Hwmp::SendAllPossiblePackets(Mac48Address dst)
   4.116  {
   4.117 -	struct HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst);
   4.118 -	struct L2RoutingProtocol::QueuedPacket packet;
   4.119 +	HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst);
   4.120 +	L2RoutingProtocol::QueuedPacket packet;
   4.121  		while(1)
   4.122  		       
   4.123  		{
   4.124 @@ -664,7 +664,7 @@
   4.125  void
   4.126  Hwmp::RetryPathDiscovery(Mac48Address dst, uint8_t numOfRetry)
   4.127  {
   4.128 -	struct HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst);
   4.129 +	HwmpRtable::LookupResult result = m_rtable->LookupReactive(dst);
   4.130  	if(result.retransmitter != Mac48Address::GetBroadcast())
   4.131  	{
   4.132  		std::map<Mac48Address, EventId, addrcmp>::iterator i = m_timeoutDatabase.find(dst);
   4.133 @@ -675,7 +675,7 @@
   4.134  	numOfRetry++;
   4.135  	if(numOfRetry > dot11sParameters::dot11MeshHWMPmaxPREQretries)
   4.136  	{
   4.137 -		struct L2RoutingProtocol::QueuedPacket packet;
   4.138 +		L2RoutingProtocol::QueuedPacket packet;
   4.139  		//purge queue and delete entry from retryDatabase
   4.140  		while(1)
   4.141  		{
     5.1 --- a/src/devices/wifi/mesh-wifi-peer-manager.cc	Tue Mar 10 17:54:58 2009 +0300
     5.2 +++ b/src/devices/wifi/mesh-wifi-peer-manager.cc	Thu Mar 12 12:34:49 2009 +0300
     5.3 @@ -967,7 +967,7 @@
     5.4  			coefficientSign = 1;
     5.5  		UniformVariable randomShift(1, 15);
     5.6  		//So, the shift is a random integer variable uniformly distributed in [-15;-1] U [1;15]
     5.7 -		int beaconShift = randomShift.GetInteger() * coefficientSign;
     5.8 +		int beaconShift = randomShift.GetInteger(1,15) * coefficientSign;
     5.9  		NS_LOG_DEBUG("Shift value = " << beaconShift << " beacon TUs");
    5.10  		//We need the result not in Time Units, but in microseconds
    5.11  		return MicroSeconds(beaconShift * 1024);