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 file of a program in BPF assembler for IP traffic filtering.
#define IP_PROTO 0x800
ld P[12:2] // A = WORD offset 12 (protocol in Ethernet header)
jeq IP_PROTO, 0, Exit // If A <> 0x800 (IP) - exit
ret -1 // Exit, it is IP packet - return TRUE
Exit:
ret 0 // Exit, it is not IP packet - return FALSE
Requirements:
Unicode
Implemented as BpfCompileBPFAsmFromFileW (Unicode) and BpfCompileBPFAsmFromFileA (ANSI).