add NetDevice::GetChannel method and doxygen-document it

Mathieu Lacage 2007-03-29 17:07:04 +02:00
parent f83f28eacc
commit 2584c78959
5 changed files with 21 additions and 38 deletions

View File

@ -350,8 +350,8 @@ PointToPointNetDevice::GetQueue(void) const
return m_queue;
}
PointToPointChannel*
PointToPointNetDevice::GetChannel(void) const
Channel*
PointToPointNetDevice::DoGetChannel(void) const
{
return m_channel;
}

View File

@ -33,8 +33,8 @@
namespace ns3 {
class PointToPointChannel;
class Queue;
class PointToPointChannel;
class PointToPointNetDevice : public NetDevice {
public:
@ -60,7 +60,6 @@ public:
protected:
Queue* GetQueue(void) const;
PointToPointChannel* GetChannel(void) const;
private:
virtual bool SendTo (Packet& p, const MacAddress& dest);
@ -70,6 +69,8 @@ private:
void TransmitReadyEvent (void);
virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
virtual Channel *DoGetChannel(void) const;
enum TxMachineState
{

View File

@ -27,40 +27,8 @@
namespace ns3 {
class Ipv4DummyNetDevice : public NetDevice
{
public:
Ipv4DummyNetDevice (Node *node);
Node *PeekNode (void) const;
private:
virtual bool SendTo (Packet& p, const MacAddress& dest);
virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context);
};
Ipv4DummyNetDevice::Ipv4DummyNetDevice (Node *node)
: NetDevice (node, MacAddress ())
{
SetMtu (10000);
}
Node *
Ipv4DummyNetDevice::PeekNode (void) const
{
return GetNode ();
}
bool
Ipv4DummyNetDevice::SendTo (Packet& p, const MacAddress& dest)
{
return false;
}
TraceResolver *
Ipv4DummyNetDevice::DoCreateTraceResolver (TraceContext const &context)
{
return new EmptyTraceResolver (context);
}
Ipv4LoopbackInterface::Ipv4LoopbackInterface (Node *node)
: Ipv4Interface (new Ipv4DummyNetDevice (node)),
: Ipv4Interface (0),
m_node (node)
{
}

View File

@ -169,6 +169,12 @@ NetDevice::CreateTraceResolver (TraceContext const &context)
return DoCreateTraceResolver (context);
}
Channel *
NetDevice::GetChannel (void) const
{
return DoGetChannel ();
}
// Receive packet from below
bool
NetDevice::ForwardUp (Packet& packet)

View File

@ -29,10 +29,10 @@
namespace ns3 {
class Ipv4L4Demux;
class Node;
class TraceResolver;
class TraceContext;
class Channel;
/**
* \brief Network layer to device interface
@ -71,6 +71,13 @@ class NetDevice {
*/
TraceResolver *CreateTraceResolver (TraceContext const &context);
/**
* \return the channel this NetDevice is connected to. The value
* returned can be zero if the NetDevice is not yet connected
* to any channel.
*/
Channel *GetChannel (void) const;
/**
* \return the current MacAddress of this interface.
*/
@ -218,6 +225,7 @@ class NetDevice {
virtual bool SendTo (Packet& p, const MacAddress& dest) = 0;
virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context) = 0;
virtual Channel *DoGetChannel (void) const = 0;
Node* m_node;
std::string m_name;
uint16_t m_ifIndex;