SetHwPacketFilter

BOOL SetHwPacketFilter ( HANDLE hOpen, HANDLE hAdapter, DWORD Filter );

Return Value:
TRUE if call was successful, FALSE otherwise

Parameters:
hOpen
Specifies driver object open handle.

hAdapter
Specifies adapter handle.

Filter
Specifies hardware filter value.

Remarks:
This function sets a hardware filter on the incoming packets. The constants that define the filters are declared in the file ntddndis.h. The input parameters are the adapter on which the filter must be defined, and the identifier of the filter. Here is a list of the most useful filters:

  • NDIS_PACKET_TYPE_PROMISCUOUS: sets the promiscuous mode. Every incoming packet is accepted by the adapter.
  • NDIS_PACKET_TYPE_DIRECTED: only packets directed to the workstation’s adapter are accepted.
  • NDIS_PACKET_TYPE_BROADCAST: only the broadcast packets are accepted.
  • NDIS_PACKET_TYPE_MULTICAST: only the multicast packets belonging to the groups of which this adapter is a member are accepted.
  • NDIS_PACKET_TYPE_ALL_MULTICAST: every multicast packet is accepted.
  • NDIS_PACKET_TYPE_ALL_LOCAL: all local packets, i.e. NDIS_PACKET_TYPE_DIRECTED + NDIS_PACKET_TYPE_BROADCAST + NDIS_PACKET_TYPE_MULTICAST