Packet Sniffer SDK VCL Edition

HNAdapter :: Properties :: UserFilter

 Previous Next

Sets/Returns the handle of the HNUserFilter object.

Syntax:

property UserFilter: Pointer;

Description:

Use this property 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
Bpf : THNUserFilter;
Bpf := THNUserFilter.Create;
...
Bpf.AddCmd(Bpf,BPF_LD+BPF_H+BPF_ABS, 12);
Bpf.AddJmp(Bpf,BPF_JMP+BPF_JEQ+BPF_K, ETHERTYPE_IP, 0, 1);
Bpf.AddCmd(Bpf,BPF_RET+BPF_K, -1);
Bpf.AddCmd(Bpf,BPF_RET+BPF_K, 0);

hAdp.UserFilter := Bpf.Handle;
hAdp.UserFilterActive := TRUE;
hAdp.MacFilter := mfAll;
See also:HNAdapter, HNUserFilter, UserFilterActive