Compiles a filter expression into a filter program.
pcap Library (libpcap.a)
#include <pcap.h>
int pcap_compile(pcap_t * p, struct bpf_ program *fp, char * str,
int optimize, bpf_u_int32 netmask);
The pcap_compile subroutine is used to compile the string str into a filter program. This filter program will then be used to filter, or select, the desired packets.
Upon successful completion, the pcap_compile subroutine returns 0, and the program parameter will hold the filter program. If pcap_compile subroutine is unsuccessful, -1 is returned.
The pcap_geterr (pcap_geterr Subroutine) subroutine, pcap_lookupnet (pcap_lookupnet Subroutine) subroutine, pcap_open_live (pcap_open_live Subroutine) subroutine, pcap_open_offline (pcap_open_offline Subroutine) subroutine, pcap_perror (pcap_perror Subroutine) subroutine, pcap_setfilter (pcap_setfilter Subroutine) subroutine.