Rename UdpSocket to DatagramSocket
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "ns3/internet-node.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/udp-socket.h"
|
||||
#include "ns3/datagram-socket.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/p2p-channel.h"
|
||||
#include "ns3/p2p-net-device.h"
|
||||
@@ -15,7 +15,7 @@ using namespace ns3;
|
||||
|
||||
|
||||
static void
|
||||
GenerateTraffic (UdpSocket *socket, uint32_t size)
|
||||
GenerateTraffic (DatagramSocket *socket, uint32_t size)
|
||||
{
|
||||
std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, tx bytes=" << size << std::endl;
|
||||
socket->SendDummy (size);
|
||||
@@ -26,15 +26,15 @@ GenerateTraffic (UdpSocket *socket, uint32_t size)
|
||||
}
|
||||
|
||||
static void
|
||||
UdpSocketPrinter (UdpSocket *socket, uint32_t size, Ipv4Address from, uint16_t fromPort)
|
||||
DatagramSocketPrinter (DatagramSocket *socket, uint32_t size, Ipv4Address from, uint16_t fromPort)
|
||||
{
|
||||
std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, rx bytes=" << size << std::endl;
|
||||
}
|
||||
|
||||
static void
|
||||
PrintTraffic (UdpSocket *socket)
|
||||
PrintTraffic (DatagramSocket *socket)
|
||||
{
|
||||
socket->SetDummyRxCallback (MakeCallback (&UdpSocketPrinter));
|
||||
socket->SetDummyRxCallback (MakeCallback (&DatagramSocketPrinter));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -94,9 +94,9 @@ int main (int argc, char *argv[])
|
||||
|
||||
AddP2PLink (a, b);
|
||||
|
||||
UdpSocket *sink = new UdpSocket (a);
|
||||
DatagramSocket *sink = new DatagramSocket (a);
|
||||
sink->Bind (80);
|
||||
UdpSocket *source = new UdpSocket (b);
|
||||
DatagramSocket *source = new DatagramSocket (b);
|
||||
source->SetDefaultDestination (Ipv4Address ("192.168.0.2"), 80);
|
||||
|
||||
GenerateTraffic (source, 500);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "ns3/internet-node.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/udp-socket.h"
|
||||
#include "ns3/datagram-socket.h"
|
||||
#include "ns3/nstime.h"
|
||||
|
||||
using namespace ns3;
|
||||
@@ -31,7 +31,7 @@ SmallTests (void)
|
||||
}
|
||||
|
||||
static void
|
||||
GenerateTraffic (UdpSocket *socket, uint32_t size)
|
||||
GenerateTraffic (DatagramSocket *socket, uint32_t size)
|
||||
{
|
||||
std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, tx bytes=" << size << std::endl;
|
||||
socket->SendDummy (size);
|
||||
@@ -42,15 +42,15 @@ GenerateTraffic (UdpSocket *socket, uint32_t size)
|
||||
}
|
||||
|
||||
static void
|
||||
UdpSocketPrinter (UdpSocket *socket, uint32_t size, Ipv4Address from, uint16_t fromPort)
|
||||
DatagramSocketPrinter (DatagramSocket *socket, uint32_t size, Ipv4Address from, uint16_t fromPort)
|
||||
{
|
||||
std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, rx bytes=" << size << std::endl;
|
||||
}
|
||||
|
||||
static void
|
||||
PrintTraffic (UdpSocket *socket)
|
||||
PrintTraffic (DatagramSocket *socket)
|
||||
{
|
||||
socket->SetDummyRxCallback (MakeCallback (&UdpSocketPrinter));
|
||||
socket->SetDummyRxCallback (MakeCallback (&DatagramSocketPrinter));
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
@@ -59,10 +59,10 @@ int main (int argc, char *argv[])
|
||||
|
||||
InternetNode *a = new InternetNode ();
|
||||
|
||||
UdpSocket *sink = new UdpSocket (a);
|
||||
DatagramSocket *sink = new DatagramSocket (a);
|
||||
sink->Bind (80);
|
||||
|
||||
UdpSocket *source = new UdpSocket (a);
|
||||
DatagramSocket *source = new DatagramSocket (a);
|
||||
source->SetDefaultDestination (Ipv4Address::GetLoopback (), 80);
|
||||
|
||||
GenerateTraffic (source, 500);
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
#include "ns3/ipv4-address.h"
|
||||
#include "ns3/arp-ipv4-interface.h"
|
||||
#include "ns3/ipv4.h"
|
||||
#include "ns3/udp-socket.h"
|
||||
#include "ns3/datagram-socket.h"
|
||||
#include "ns3/ipv4-route.h"
|
||||
#include "ns3/drop-tail.h"
|
||||
#include "ns3/trace-writer.h"
|
||||
@@ -147,7 +147,7 @@ protected:
|
||||
|
||||
|
||||
static void
|
||||
GenerateTraffic (UdpSocket *socket, uint32_t size)
|
||||
GenerateTraffic (DatagramSocket *socket, uint32_t size)
|
||||
{
|
||||
std::cout << "Node: " << socket->GetNode()->GetId ()
|
||||
<< " at=" << Simulator::Now ().GetSeconds () << "s,"
|
||||
@@ -160,7 +160,7 @@ GenerateTraffic (UdpSocket *socket, uint32_t size)
|
||||
}
|
||||
|
||||
static void
|
||||
UdpSocketPrinter (UdpSocket *socket, uint32_t size, Ipv4Address from, uint16_t fromPort)
|
||||
DatagramSocketPrinter (DatagramSocket *socket, uint32_t size, Ipv4Address from, uint16_t fromPort)
|
||||
{
|
||||
std::cout << "Node: " << socket->GetNode()->GetId ()
|
||||
<< " at=" << Simulator::Now ().GetSeconds () << "s,"
|
||||
@@ -168,9 +168,9 @@ UdpSocketPrinter (UdpSocket *socket, uint32_t size, Ipv4Address from, uint16_t f
|
||||
}
|
||||
|
||||
static void
|
||||
PrintTraffic (UdpSocket *socket)
|
||||
PrintTraffic (DatagramSocket *socket)
|
||||
{
|
||||
socket->SetDummyRxCallback (MakeCallback (&UdpSocketPrinter));
|
||||
socket->SetDummyRxCallback (MakeCallback (&DatagramSocketPrinter));
|
||||
}
|
||||
|
||||
#if 0
|
||||
@@ -315,11 +315,11 @@ int main (int argc, char *argv[])
|
||||
traceContainer, channelName);
|
||||
SetupTrace (traceContainer, tracer);
|
||||
|
||||
UdpSocket *source0 = new UdpSocket (n0);
|
||||
UdpSocket *source3 = new UdpSocket (n3);
|
||||
UdpSocket *sink3 = new UdpSocket(n3);
|
||||
DatagramSocket *source0 = new DatagramSocket (n0);
|
||||
DatagramSocket *source3 = new DatagramSocket (n3);
|
||||
DatagramSocket *sink3 = new DatagramSocket(n3);
|
||||
sink3->Bind (80);
|
||||
UdpSocket *sink1 = new UdpSocket(n1);
|
||||
DatagramSocket *sink1 = new DatagramSocket(n1);
|
||||
sink1->Bind (80);
|
||||
|
||||
source3->SetDefaultDestination (Ipv4Address ("10.1.2.1"), 80);
|
||||
|
||||
Reference in New Issue
Block a user