Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
This commit is contained in:
@@ -38,25 +38,4 @@ TypeId NetDevice::GetTypeId (void)
|
||||
NetDevice::~NetDevice ()
|
||||
{}
|
||||
|
||||
bool
|
||||
NetDevice::SupportsPromiscuous () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
NetDevice::SetPromiscReceiveCallback (PromiscReceiveCallback cb)
|
||||
{
|
||||
// assert that the virtual method was overridden in a subclass if it
|
||||
// claims to support promiscuous mode.
|
||||
NS_ASSERT (!SupportsPromiscuous ());
|
||||
}
|
||||
|
||||
bool
|
||||
NetDevice::SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber)
|
||||
{
|
||||
NS_FATAL_ERROR ("NetDevice::SendFrom not implemented for " << GetInstanceTypeId ().GetName ());
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -228,7 +228,7 @@ public:
|
||||
*
|
||||
* \return whether the Send operation succeeded
|
||||
*/
|
||||
virtual bool SendFrom(Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
|
||||
virtual bool SendFrom(Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber) = 0;
|
||||
/**
|
||||
* \returns the node base class which contains this network
|
||||
* interface.
|
||||
@@ -309,12 +309,12 @@ public:
|
||||
* sensed by the netdevice but which are intended to be received by
|
||||
* other hosts.
|
||||
*/
|
||||
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
|
||||
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb) = 0;
|
||||
|
||||
/**
|
||||
* \return true if this interface supports a promiscuous mode, false otherwise.
|
||||
*/
|
||||
virtual bool SupportsPromiscuous (void) const;
|
||||
virtual bool SupportsPromiscuous (void) const = 0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -200,5 +200,16 @@ SimpleNetDevice::DoDispose (void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SimpleNetDevice::SetPromiscReceiveCallback (PromiscReceiveCallback cb)
|
||||
{
|
||||
NS_FATAL_ERROR ("Not supported");
|
||||
}
|
||||
|
||||
bool
|
||||
SimpleNetDevice::SupportsPromiscuous (void) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -68,6 +68,8 @@ public:
|
||||
virtual void SetNode (Ptr<Node> node);
|
||||
virtual bool NeedsArp (void) const;
|
||||
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
|
||||
virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
|
||||
virtual bool SupportsPromiscuous (void) const;
|
||||
|
||||
protected:
|
||||
virtual void DoDispose (void);
|
||||
|
||||
Reference in New Issue
Block a user