OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2009 IITP RAS | 3 * Copyright (c) 2009 IITP RAS |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 .AddAttribute ("EnableBroadcast", "Indicates whether a broadcast data packet
s forwarding enable.", | 270 .AddAttribute ("EnableBroadcast", "Indicates whether a broadcast data packet
s forwarding enable.", |
271 BooleanValue (true), | 271 BooleanValue (true), |
272 MakeBooleanAccessor (&RoutingProtocol::SetBroadcastEnable, | 272 MakeBooleanAccessor (&RoutingProtocol::SetBroadcastEnable, |
273 &RoutingProtocol::GetBroadcastEnable), | 273 &RoutingProtocol::GetBroadcastEnable), |
274 MakeBooleanChecker ()) | 274 MakeBooleanChecker ()) |
275 .AddAttribute ("UniformRv", | 275 .AddAttribute ("UniformRv", |
276 "Access to the underlying UniformRandomVariable", | 276 "Access to the underlying UniformRandomVariable", |
277 StringValue ("ns3::UniformRandomVariable"), | 277 StringValue ("ns3::UniformRandomVariable"), |
278 MakePointerAccessor (&RoutingProtocol::m_uniformRandomVariabl
e), | 278 MakePointerAccessor (&RoutingProtocol::m_uniformRandomVariabl
e), |
279 MakePointerChecker<UniformRandomVariable> ()) | 279 MakePointerChecker<UniformRandomVariable> ()) |
| 280 .AddTraceSource ("Rx", "Receive AODV packet.", |
| 281 MakeTraceSourceAccessor (&RoutingProtocol::m_rxPacketTrace)
, |
| 282 "ns3::aodv::RoutingProtocol::PacketTxRxTracedCallback") |
| 283 .AddTraceSource ("Tx", "Send AODV packet.", |
| 284 MakeTraceSourceAccessor (&RoutingProtocol::m_txPacketTrace)
, |
| 285 "ns3::aodv::RoutingProtocol::PacketTxRxTracedCallback") |
280 ; | 286 ; |
281 return tid; | 287 return tid; |
282 } | 288 } |
283 | 289 |
284 void | 290 void |
285 RoutingProtocol::SetMaxQueueLen (uint32_t len) | 291 RoutingProtocol::SetMaxQueueLen (uint32_t len) |
286 { | 292 { |
287 m_maxQueueLen = len; | 293 m_maxQueueLen = len; |
288 m_queue.SetMaxQueueLen (len); | 294 m_queue.SetMaxQueueLen (len); |
289 } | 295 } |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 m_lastBcastTime = Simulator::Now (); | 1028 m_lastBcastTime = Simulator::Now (); |
1023 Simulator::Schedule (Time (MilliSeconds (m_uniformRandomVariable->GetInteg
er (0, 10))), &RoutingProtocol::SendTo, this, socket, packet, destination);· | 1029 Simulator::Schedule (Time (MilliSeconds (m_uniformRandomVariable->GetInteg
er (0, 10))), &RoutingProtocol::SendTo, this, socket, packet, destination);· |
1024 } | 1030 } |
1025 ScheduleRreqRetry (dst); | 1031 ScheduleRreqRetry (dst); |
1026 } | 1032 } |
1027 | 1033 |
1028 void | 1034 void |
1029 RoutingProtocol::SendTo (Ptr<Socket> socket, Ptr<Packet> packet, Ipv4Address des
tination) | 1035 RoutingProtocol::SendTo (Ptr<Socket> socket, Ptr<Packet> packet, Ipv4Address des
tination) |
1030 { | 1036 { |
1031 socket->SendTo (packet, 0, InetSocketAddress (destination, AODV_PORT)); | 1037 socket->SendTo (packet, 0, InetSocketAddress (destination, AODV_PORT)); |
1032 | 1038 m_txPacketTrace (packet); |
1033 } | 1039 } |
1034 void | 1040 void |
1035 RoutingProtocol::ScheduleRreqRetry (Ipv4Address dst) | 1041 RoutingProtocol::ScheduleRreqRetry (Ipv4Address dst) |
1036 { | 1042 { |
1037 NS_LOG_FUNCTION (this << dst); | 1043 NS_LOG_FUNCTION (this << dst); |
1038 if (m_addressReqTimer.find (dst) == m_addressReqTimer.end ()) | 1044 if (m_addressReqTimer.find (dst) == m_addressReqTimer.end ()) |
1039 { | 1045 { |
1040 Timer timer (Timer::CANCEL_ON_DESTROY); | 1046 Timer timer (Timer::CANCEL_ON_DESTROY); |
1041 m_addressReqTimer[dst] = timer; | 1047 m_addressReqTimer[dst] = timer; |
1042 } | 1048 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 NS_LOG_DEBUG ("AODV node " << this << " received a AODV packet from " << sende
r << " to " << receiver); | 1090 NS_LOG_DEBUG ("AODV node " << this << " received a AODV packet from " << sende
r << " to " << receiver); |
1085 | 1091 |
1086 UpdateRouteToNeighbor (sender, receiver); | 1092 UpdateRouteToNeighbor (sender, receiver); |
1087 TypeHeader tHeader (AODVTYPE_RREQ); | 1093 TypeHeader tHeader (AODVTYPE_RREQ); |
1088 packet->RemoveHeader (tHeader); | 1094 packet->RemoveHeader (tHeader); |
1089 if (!tHeader.IsValid ()) | 1095 if (!tHeader.IsValid ()) |
1090 { | 1096 { |
1091 NS_LOG_DEBUG ("AODV message " << packet->GetUid () << " with unknown type
received: " << tHeader.Get () << ". Drop"); | 1097 NS_LOG_DEBUG ("AODV message " << packet->GetUid () << " with unknown type
received: " << tHeader.Get () << ". Drop"); |
1092 return; // drop | 1098 return; // drop |
1093 } | 1099 } |
| 1100 |
| 1101 m_rxPacketTrace (packet); |
| 1102 |
1094 switch (tHeader.Get ()) | 1103 switch (tHeader.Get ()) |
1095 { | 1104 { |
1096 case AODVTYPE_RREQ: | 1105 case AODVTYPE_RREQ: |
1097 { | 1106 { |
1098 RecvRequest (packet, receiver, sender); | 1107 RecvRequest (packet, receiver, sender); |
1099 break; | 1108 break; |
1100 } | 1109 } |
1101 case AODVTYPE_RREP: | 1110 case AODVTYPE_RREP: |
1102 { | 1111 { |
1103 RecvReply (packet, receiver, sender); | 1112 RecvReply (packet, receiver, sender); |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 m_htimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this); | 2067 m_htimer.SetFunction (&RoutingProtocol::HelloTimerExpire, this); |
2059 startTime = m_uniformRandomVariable->GetInteger (0, 100); | 2068 startTime = m_uniformRandomVariable->GetInteger (0, 100); |
2060 NS_LOG_DEBUG ("Starting at time " << startTime << "ms"); | 2069 NS_LOG_DEBUG ("Starting at time " << startTime << "ms"); |
2061 m_htimer.Schedule (MilliSeconds (startTime)); | 2070 m_htimer.Schedule (MilliSeconds (startTime)); |
2062 } | 2071 } |
2063 Ipv4RoutingProtocol::DoInitialize (); | 2072 Ipv4RoutingProtocol::DoInitialize (); |
2064 } | 2073 } |
2065 | 2074 |
2066 } //namespace aodv | 2075 } //namespace aodv |
2067 } //namespace ns3 | 2076 } //namespace ns3 |
OLD | NEW |