NF_IPEventHandler

The client application can implement this interface and pass the object pointer to nf_setIPEventHandler function. nfapi code calls the methods of NF_IPEventHandler to indicate IP packets for filtering/monitoring. The interface is defined as an abstract class with pure virtual functions for C++. If the symbol _C_API is defined, the interface is a structure with function pointers.

C++ (_C_API is not defined):

class NF_IPEventHandler
{
public:
	virtual void ipReceive(const char * buf, int len, PNF_IP_PACKET_OPTIONS options) = 0;
	virtual void ipSend(const char * buf, int len, PNF_IP_PACKET_OPTIONS options) = 0;
};

C (_C_API is defined):

typedef struct _NF_IPEventHandler
{
	void (NFAPI_CC *ipReceive)(const char * buf, int len, PNF_IP_PACKET_OPTIONS options);
	void (NFAPI_CC *ipSend)(const char * buf, int len, PNF_IP_PACKET_OPTIONS options);
} NF_EventHandler, *PNF_EventHandler;

Members

void ipReceive(const char * buf, int len, PNF_IP_PACKET_OPTIONS options)
Indicates an IP packet received from server. It is possible to call nf_ipPostReceive to post a packet to destination, ignore the packet, or store it in own queue and filter the packet later.

Parameters:
buf - Pointer to data buffer
len - Buffer length
options - Pointer to NF_IP_PACKET_OPTIONS structure

void ipSend(const char * buf, int len, PNF_IP_PACKET_OPTIONS options)
Indicates an IP packet sent to server. It is possible to call nf_ipPostSend to post a packet to destination, ignore the packet, or store it in own queue and filter the packet later.

Parameters:
buf - Pointer to data buffer
len - Buffer length
options - Pointer to NF_IP_PACKET_OPTIONS structure

Remarks

Note that IP filter bypasses loopback traffic. It indicates only communications with remote hosts.

IP filtering is supported only with WFP driver.

Requirements

Driver type WFP
Header nfapi.h
Library nfapi.lib