Packet Sniffer SDK DLL Edition
HNAdapter :: Properties :: AdpSetUserFilter | | Previous Next |
Sets the handle of HNUserFilter object.
Syntax:
HANDLE __stdcall AdpSetUserFilter(HANDLE hAdp, HANDLE hFtr);
Parameters:
hAdp
[in] HNAdapter object handle.
hFtr
Return values:
If the function succeeds the return value will be the handle of the
HNUserFilter object.
Otherwise the return value will be NULL.
Description:
Use AdpSetUserFilter to set a user-settable packet filter for the network adapter.
 | Please remember, that UserFilter must be used with the UserFilterActive
property. |
// Create IP filter
HANDLE hBpf = BpfCreate();
...
BpfAddCmd(hBpf,BPF_LD+BPF_H+BPF_ABS, 12);
BpfAddJmp(hBpf,BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 1);
BpfAddCmd(hBpf,BPF_RET+BPF_K, -1);
BpfAddCmd(hBpf,BPF_RET+BPF_K, 0);
AdpSetUserFilter(hAdp,hBpf);
AdpSetUserFilterActive(hAdp,TRUE);
AdpSetMacFilter(hAdp,mfAll);