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) 2014 Universita' di Firenze, Italy | 3 * Copyright (c) 2014 Universita' di Firenze, Italy |
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 Inet6SocketAddress local = Inet6SocketAddress (RIPNG_ALL_NODE, RIPNG_PORT)
; | 161 Inet6SocketAddress local = Inet6SocketAddress (RIPNG_ALL_NODE, RIPNG_PORT)
; |
162 m_recvSocket->Bind (local); | 162 m_recvSocket->Bind (local); |
163 m_recvSocket->SetRecvCallback (MakeCallback (&RipNg::Receive, this)); | 163 m_recvSocket->SetRecvCallback (MakeCallback (&RipNg::Receive, this)); |
164 m_recvSocket->SetIpv6RecvHopLimit (true); | 164 m_recvSocket->SetIpv6RecvHopLimit (true); |
165 m_recvSocket->SetRecvPktInfo (true); | 165 m_recvSocket->SetRecvPktInfo (true); |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 if (addedGlobal) | 169 if (addedGlobal) |
170 { | 170 { |
171 Time delay = Seconds (m_rng->GetValue (m_minTriggeredUpdateDelay.GetSecond
s (), m_maxTriggeredUpdateDelay.GetSeconds ())); | 171 delay = Seconds (m_rng->GetValue (m_minTriggeredUpdateDelay.GetSeconds (),
m_maxTriggeredUpdateDelay.GetSeconds ())); |
172 m_nextTriggeredUpdate = Simulator::Schedule (delay, &RipNg::DoSendRouteUpd
ate, this, false); | 172 m_nextTriggeredUpdate = Simulator::Schedule (delay, &RipNg::DoSendRouteUpd
ate, this, false); |
173 } | 173 } |
174 | 174 |
175 delay = Seconds (m_rng->GetValue (0.01, m_startupDelay.GetSeconds ())); | 175 delay = Seconds (m_rng->GetValue (0.01, m_startupDelay.GetSeconds ())); |
176 m_nextTriggeredUpdate = Simulator::Schedule (delay, &RipNg::SendRouteRequest,
this); | 176 m_nextTriggeredUpdate = Simulator::Schedule (delay, &RipNg::SendRouteRequest,
this); |
177 | 177 |
178 Ipv6RoutingProtocol::DoInitialize (); | 178 Ipv6RoutingProtocol::DoInitialize (); |
179 } | 179 } |
180 | 180 |
181 Ptr<Ipv6Route> RipNg::RouteOutput (Ptr<Packet> p, const Ipv6Header &header, Ptr<
NetDevice> oif, Socket::SocketErrno &sockerr) | 181 Ptr<Ipv6Route> RipNg::RouteOutput (Ptr<Packet> p, const Ipv6Header &header, Ptr<
NetDevice> oif, Socket::SocketErrno &sockerr) |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 for (SocketListI iter = m_sendSocketList.begin (); iter != m_sendS
ocketList.end (); iter++ ) | 780 for (SocketListI iter = m_sendSocketList.begin (); iter != m_sendS
ocketList.end (); iter++ ) |
781 { | 781 { |
782 if (iter->second == incomingInterface) | 782 if (iter->second == incomingInterface) |
783 { | 783 { |
784 sendingSocket = iter->first; | 784 sendingSocket = iter->first; |
785 } | 785 } |
786 } | 786 } |
787 NS_ASSERT_MSG (sendingSocket, "HandleRequest - Impossible to find
a socket to send the reply"); | 787 NS_ASSERT_MSG (sendingSocket, "HandleRequest - Impossible to find
a socket to send the reply"); |
788 | 788 |
789 uint16_t mtu = m_ipv6->GetMtu (incomingInterface); | 789 uint16_t mtu = m_ipv6->GetMtu (incomingInterface); |
790 uint16_t maxRte = (mtu - Ipv6Header ().GetSerializedSize () - UdpH
eader ().GetSerializedSize () - RipNgHeader ().GetSerializedSize ()) / RipNgRte
().GetSerializedSize (); | 790 uint16_t maxRte = static_cast<uint16_t> ((mtu - Ipv6Header ().GetS
erializedSize () - UdpHeader ().GetSerializedSize () - RipNgHeader ().GetSeriali
zedSize ()) / RipNgRte ().GetSerializedSize ()); |
791 | 791 |
792 Ptr<Packet> p = Create<Packet> (); | 792 Ptr<Packet> p = Create<Packet> (); |
793 SocketIpv6HopLimitTag tag; | 793 SocketIpv6HopLimitTag tag; |
794 p->RemovePacketTag (tag); | 794 p->RemovePacketTag (tag); |
795 tag.SetHopLimit (255); | 795 tag.SetHopLimit (255); |
796 p->AddPacketTag (tag); | 796 p->AddPacketTag (tag); |
797 | 797 |
798 RipNgHeader hdr; | 798 RipNgHeader hdr; |
799 hdr.SetCommand (RipNgHeader::RESPONSE); | 799 hdr.SetCommand (RipNgHeader::RESPONSE); |
800 | 800 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 { | 1078 { |
1079 NS_LOG_FUNCTION (this << (periodic ? " periodic" : " triggered")); | 1079 NS_LOG_FUNCTION (this << (periodic ? " periodic" : " triggered")); |
1080 | 1080 |
1081 for (SocketListI iter = m_sendSocketList.begin (); iter != m_sendSocketList.en
d (); iter++ ) | 1081 for (SocketListI iter = m_sendSocketList.begin (); iter != m_sendSocketList.en
d (); iter++ ) |
1082 { | 1082 { |
1083 uint32_t interface = iter->second; | 1083 uint32_t interface = iter->second; |
1084 | 1084 |
1085 if (m_interfaceExclusions.find (interface) == m_interfaceExclusions.end ()
) | 1085 if (m_interfaceExclusions.find (interface) == m_interfaceExclusions.end ()
) |
1086 { | 1086 { |
1087 uint16_t mtu = m_ipv6->GetMtu (interface); | 1087 uint16_t mtu = m_ipv6->GetMtu (interface); |
1088 uint16_t maxRte = (mtu - Ipv6Header ().GetSerializedSize () - UdpHeade
r ().GetSerializedSize () - RipNgHeader ().GetSerializedSize ()) / RipNgRte ().G
etSerializedSize (); | 1088 uint16_t maxRte = static_cast<uint16_t> ((mtu - Ipv6Header ().GetSeria
lizedSize () - UdpHeader ().GetSerializedSize () - RipNgHeader ().GetSerializedS
ize ()) / RipNgRte ().GetSerializedSize ()); |
1089 | 1089 |
1090 Ptr<Packet> p = Create<Packet> (); | 1090 Ptr<Packet> p = Create<Packet> (); |
1091 SocketIpv6HopLimitTag tag; | 1091 SocketIpv6HopLimitTag tag; |
1092 tag.SetHopLimit (255); | 1092 tag.SetHopLimit (255); |
1093 p->AddPacketTag (tag); | 1093 p->AddPacketTag (tag); |
1094 | 1094 |
1095 RipNgHeader hdr; | 1095 RipNgHeader hdr; |
1096 hdr.SetCommand (RipNgHeader::RESPONSE); | 1096 hdr.SetCommand (RipNgHeader::RESPONSE); |
1097 | 1097 |
1098 for (RoutesI rtIter = m_routes.begin (); rtIter != m_routes.end (); rt
Iter++) | 1098 for (RoutesI rtIter = m_routes.begin (); rtIter != m_routes.end (); rt
Iter++) |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 | 1316 |
1317 void RipNgRoutingTableEntry::SetRouteMetric (uint8_t routeMetric) | 1317 void RipNgRoutingTableEntry::SetRouteMetric (uint8_t routeMetric) |
1318 { | 1318 { |
1319 if (m_metric != routeMetric) | 1319 if (m_metric != routeMetric) |
1320 { | 1320 { |
1321 m_metric = routeMetric; | 1321 m_metric = routeMetric; |
1322 m_changed = true; | 1322 m_changed = true; |
1323 } | 1323 } |
1324 } | 1324 } |
1325 | 1325 |
| 1326 void RipNgRoutingTableEntry::SetRouteMetric(uint16_t routeMetric) |
| 1327 { |
| 1328 SetRouteMetric(static_cast<uint8_t> (routeMetric)); |
| 1329 } |
| 1330 |
| 1331 void RipNgRoutingTableEntry::SetRouteMetric(int routeMetric) |
| 1332 { |
| 1333 SetRouteMetric(static_cast<uint8_t> (routeMetric)); |
| 1334 } |
| 1335 |
1326 uint8_t RipNgRoutingTableEntry::GetRouteMetric () const | 1336 uint8_t RipNgRoutingTableEntry::GetRouteMetric () const |
1327 { | 1337 { |
1328 return m_metric; | 1338 return m_metric; |
1329 } | 1339 } |
1330 | 1340 |
1331 void RipNgRoutingTableEntry::SetRouteStatus (Status_e status) | 1341 void RipNgRoutingTableEntry::SetRouteStatus (Status_e status) |
1332 { | 1342 { |
1333 if (m_status != status) | 1343 if (m_status != status) |
1334 { | 1344 { |
1335 m_status = status; | 1345 m_status = status; |
(...skipping 21 matching lines...) Expand all Loading... |
1357 { | 1367 { |
1358 os << static_cast<const Ipv6RoutingTableEntry &>(rte); | 1368 os << static_cast<const Ipv6RoutingTableEntry &>(rte); |
1359 os << ", metric: " << int (rte.GetRouteMetric ()) << ", tag: " << int (rte.Get
RouteTag ()); | 1369 os << ", metric: " << int (rte.GetRouteMetric ()) << ", tag: " << int (rte.Get
RouteTag ()); |
1360 | 1370 |
1361 return os; | 1371 return os; |
1362 } | 1372 } |
1363 | 1373 |
1364 | 1374 |
1365 } | 1375 } |
1366 | 1376 |
OLD | NEW |