Packet Sniffer SDK DLL Edition

HNUserFilter :: Methods :: BpfCheckFilter

 Previous Next

Checks the BPF program code accuracy.

Syntax:

DWORD __stdcall BpfCheckFilter(HANDLE hFtr);

Parameters:

hFtr

[in] HNUserFilter object handle.

Return values:

HNERR_OKNo errors.
HNERR_NO_PROGRAMMNo programm in the filter (the CommandCount field of the HN_BPF_PROGRAMM structure is equal to 0).
HNERR_FLT_BAD_LENInstructions count in the filter program is wrong.
HNERR_WRONG_INSTRUCTIONWrong instruction code.
HNERR_JMP_TO_LONGJump is too long.
HNERR_WORK_MEMThe wrong values of instructions working with the memory of the virtual BPF machine (BPF_ST, BPF_STX, BPF_LD|BPF_MEM, BPF_LDX|BPF_MEM).
HNERR_NO_RETNo return instruction at the end of filter. The Code of the last BPF instruction must be equal to BPF_RET.
HNERR_INVALID_HANDLEhFtr parameter is not the HNUserFilter object handle.

Description:

Use the BpfCheckFilter function to check the BPF program accuracy in the HNUserFilter component. If BpfCheckFilter returns the error code which is not equal to HNERR_OK, use the BpfGetErrInstruction property to get the index of the wrong instruction.

See also:HNUserFilter, HN_BPF_PROGRAMM, BpfGetErrInstruction