Plumb in outbound SerialPhy

This commit is contained in:
Unknown
2007-02-20 23:58:21 -08:00
parent c320f9ea81
commit cc8286b25e
5 changed files with 20 additions and 2 deletions

View File

@@ -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

View File

@@ -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()

View File

@@ -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

View File

@@ -164,4 +164,10 @@ UdpSocket::GetUdp (void) const
return m_node->GetUdp ();
}
Node *
UdpSocket::GetNode (void) const
{
return m_node;
}
}//namespace ns3

View File

@@ -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;