Sketching a new promiscuous mode protocol handlers API; Netdevices implementation missing, though.
This commit is contained in:
@@ -154,6 +154,35 @@ public:
|
||||
*/
|
||||
void UnregisterProtocolHandler (ProtocolHandler handler);
|
||||
|
||||
/**
|
||||
* A promiscuous protocol handler
|
||||
*/
|
||||
typedef Callback<void,Ptr<NetDevice>, Ptr<Packet>,uint16_t,
|
||||
const Address &, const Address &> PromiscuousProtocolHandler;
|
||||
/**
|
||||
* \param handler the handler to register
|
||||
* \param protocolType the type of protocol this handler is
|
||||
* interested in. This protocol type is a so-called
|
||||
* EtherType, as registered here:
|
||||
* http://standards.ieee.org/regauth/ethertype/eth.txt
|
||||
* the value zero is interpreted as matching all
|
||||
* protocols.
|
||||
* \param device the device attached to this handler. If the
|
||||
* value is zero, the handler is attached to all
|
||||
* devices on this node.
|
||||
*/
|
||||
void RegisterPromiscuousProtocolHandler (PromiscuousProtocolHandler handler,
|
||||
uint16_t protocolType,
|
||||
Ptr<NetDevice> device);
|
||||
/**
|
||||
* \param handler the handler to unregister
|
||||
*
|
||||
* After this call returns, the input handler will never
|
||||
* be invoked anymore.
|
||||
*/
|
||||
void UnregisterPromiscuousProtocolHandler (PromiscuousProtocolHandler handler);
|
||||
|
||||
|
||||
protected:
|
||||
/**
|
||||
* The dispose method. Subclasses must override this method
|
||||
@@ -172,6 +201,8 @@ private:
|
||||
|
||||
bool ReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet>,
|
||||
uint16_t protocol, const Address &from);
|
||||
bool PromiscuousReceiveFromDevice (Ptr<NetDevice> device, Ptr<Packet>,
|
||||
uint16_t protocol, const Address &from, const Address &to);
|
||||
void Construct (void);
|
||||
|
||||
struct ProtocolHandlerEntry {
|
||||
@@ -185,6 +216,15 @@ private:
|
||||
std::vector<Ptr<NetDevice> > m_devices;
|
||||
std::vector<Ptr<Application> > m_applications;
|
||||
ProtocolHandlerList m_handlers;
|
||||
|
||||
// promiscuous protocol handlers
|
||||
struct PromiscuousProtocolHandlerEntry {
|
||||
PromiscuousProtocolHandler handler;
|
||||
uint16_t protocol;
|
||||
Ptr<NetDevice> device;
|
||||
};
|
||||
typedef std::vector<struct Node::PromiscuousProtocolHandlerEntry> PromiscuousProtocolHandlerList;
|
||||
PromiscuousProtocolHandlerList m_promiscuousHandlers;
|
||||
};
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
Reference in New Issue
Block a user