Plumb in outbound SerialPhy
This commit is contained in:
@@ -71,7 +71,7 @@ protected:
|
||||
static void
|
||||
GenerateTraffic (UdpSocket *socket, uint32_t size)
|
||||
{
|
||||
std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, tx bytes=" << size << std::endl;
|
||||
std::cout << "Node: " << socket->GetNode()->GetId () << " at=" << Simulator::Now ().GetSeconds () << "s, tx bytes=" << size << std::endl;
|
||||
socket->SendDummy (size);
|
||||
if (size > 50)
|
||||
{
|
||||
@@ -82,7 +82,7 @@ GenerateTraffic (UdpSocket *socket, uint32_t size)
|
||||
static void
|
||||
UdpSocketPrinter (UdpSocket *socket, uint32_t size, Ipv4Address from, uint16_t fromPort)
|
||||
{
|
||||
std::cout << "at=" << Simulator::Now ().GetSeconds () << "s, rx bytes=" << size << std::endl;
|
||||
std::cout << "Node: " << socket->GetNode()->GetId () << " at=" << Simulator::Now ().GetSeconds () << "s, rx bytes=" << size << std::endl;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "queue.h"
|
||||
#include "serial-net-device.h"
|
||||
#include "serial-channel.h"
|
||||
#include "serial-phy.h"
|
||||
|
||||
NS_DEBUG_COMPONENT_DEFINE ("SerialNetDevice");
|
||||
|
||||
@@ -46,6 +47,8 @@ SerialNetDevice::SerialNetDevice(Node* node, const MacAddress& addr) :
|
||||
EnableMulticast();
|
||||
EnablePointToPoint();
|
||||
SetMtu(512); // bytes
|
||||
|
||||
m_phy = new SerialPhy(node, this);
|
||||
}
|
||||
|
||||
SerialNetDevice::~SerialNetDevice()
|
||||
|
||||
@@ -32,9 +32,11 @@
|
||||
namespace ns3 {
|
||||
|
||||
class SerialChannel;
|
||||
class SerialPhy;
|
||||
class Queue;
|
||||
|
||||
class SerialNetDevice : public NetDevice {
|
||||
friend class SerialPhy;
|
||||
public:
|
||||
SerialNetDevice(Node* node, const MacAddress& addr);
|
||||
virtual ~SerialNetDevice();
|
||||
@@ -52,13 +54,16 @@ public:
|
||||
|
||||
protected:
|
||||
Queue* GetQueue(void) const { return m_queue;};
|
||||
SerialChannel* GetChannel(void) const { return m_channel;};
|
||||
|
||||
private:
|
||||
virtual void NotifyDataAvailable (void);
|
||||
virtual bool SendTo (Packet& p, const MacAddress& dest);
|
||||
|
||||
SerialPhy* m_phy;
|
||||
SerialChannel* m_channel;
|
||||
Queue* m_queue;
|
||||
|
||||
};
|
||||
|
||||
}; // namespace ns3
|
||||
|
||||
@@ -164,4 +164,10 @@ UdpSocket::GetUdp (void) const
|
||||
return m_node->GetUdp ();
|
||||
}
|
||||
|
||||
Node *
|
||||
UdpSocket::GetNode (void) const
|
||||
{
|
||||
return m_node;
|
||||
}
|
||||
|
||||
}//namespace ns3
|
||||
|
||||
@@ -114,6 +114,10 @@ public:
|
||||
* to keep track of it.
|
||||
*/
|
||||
void SetRxCallback (Callback<void,UdpSocket*,uint8_t const*,uint32_t,Ipv4Address,uint16_t> cb);
|
||||
/**
|
||||
* Return pointer to node
|
||||
*/
|
||||
Node* GetNode(void) const;
|
||||
|
||||
private:
|
||||
friend class Udp;
|
||||
|
||||
Reference in New Issue
Block a user