Fix the virtual-net-device.cc example; thanks Antti M?kel?.
1.1 --- a/examples/virtual-net-device.cc Thu Jul 02 22:36:44 2009 -0700
1.2 +++ b/examples/virtual-net-device.cc Fri Jul 03 11:17:38 2009 +0100
1.3 @@ -78,23 +78,29 @@
1.4
1.5
1.6 bool
1.7 - N0N1VirtualSend (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber)
1.8 + N0VirtualSend (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber)
1.9 {
1.10 - m_n3Socket->SendTo (packet, 0, InetSocketAddress (m_n3Address, 667));
1.11 + m_n0Socket->SendTo (packet, 0, InetSocketAddress (m_n3Address, 667));
1.12 + return true;
1.13 + }
1.14 +
1.15 + bool
1.16 + N1VirtualSend (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber)
1.17 + {
1.18 + m_n1Socket->SendTo (packet, 0, InetSocketAddress (m_n3Address, 667));
1.19 return true;
1.20 }
1.21
1.22 bool
1.23 N3VirtualSend (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber)
1.24 {
1.25 -
1.26 if (m_rng.GetValue () < 0.25)
1.27 {
1.28 - m_n0Socket->SendTo (packet, 0, InetSocketAddress (m_n0Address, 667));
1.29 + m_n3Socket->SendTo (packet, 0, InetSocketAddress (m_n0Address, 667));
1.30 }
1.31 else
1.32 {
1.33 - m_n1Socket->SendTo (packet, 0, InetSocketAddress (m_n1Address, 667));
1.34 + m_n3Socket->SendTo (packet, 0, InetSocketAddress (m_n1Address, 667));
1.35 }
1.36 return true;
1.37 }
1.38 @@ -144,7 +150,7 @@
1.39 // n0 tap device
1.40 m_n0Tap = CreateObject<VirtualNetDevice> ();
1.41 m_n0Tap->SetAddress (Mac48Address ("11:00:01:02:03:01"));
1.42 - m_n0Tap->SetSendCallback (MakeCallback (&Tunnel::N0N1VirtualSend, this));
1.43 + m_n0Tap->SetSendCallback (MakeCallback (&Tunnel::N0VirtualSend, this));
1.44 n0->AddDevice (m_n0Tap);
1.45 Ptr<Ipv4> ipv4 = n0->GetObject<Ipv4> ();
1.46 uint32_t i = ipv4->AddInterface (m_n0Tap);
1.47 @@ -154,7 +160,7 @@
1.48 // n1 tap device
1.49 m_n1Tap = CreateObject<VirtualNetDevice> ();
1.50 m_n1Tap->SetAddress (Mac48Address ("11:00:01:02:03:02"));
1.51 - m_n1Tap->SetSendCallback (MakeCallback (&Tunnel::N0N1VirtualSend, this));
1.52 + m_n1Tap->SetSendCallback (MakeCallback (&Tunnel::N1VirtualSend, this));
1.53 n1->AddDevice (m_n1Tap);
1.54 ipv4 = n1->GetObject<Ipv4> ();
1.55 i = ipv4->AddInterface (m_n1Tap);