[in] An ASCIIZ string containing BPF assembler program.
Return values:
HNERR_OK
No errors.
HNERR_ERROR
Errors occured during the compilation. To track errors use
OnBPFAsmError handler.
Description:
This function compiles the program written in BPF assembler to BPF filter. The definitions of the
constants previously loaded by BpfCompileBPFDefinesFromFile
and BpfCompileBPFDefinesFromStr functions may be used in the
program.
Below there is an example of a program in BPF assembler for IP traffic filtering.
char BpfProg[]=
"#define IP_PROTO 0x800 \n"
"ld P[12:2] \n" // A = WORD offset 12 (protocol in Ethernet header)
"jeq IP_PROTO, 0, Exit \n" // If A <> 0x800 (IP) - exit
"ret -1 \n" // Exit, it is IP packet - return TRUE
"Exit: \n"
"ret 0 \n"; // Exit, it is not IP packet - return FALSE