本文转自http://eslxf.blog.51cto.com/918801/290488
库wpcap.dll为数据包
过滤
,提供了下列函数:
int pcap_compile(pcap_t *p, struct bpf_program *fp,char *str,int optimize, bpf_u_int32 netmask)
int pcap_compile_nopcap(int snaplen_arg,int linktype_arg,
struct bpf_program *program,char *buf,
int optimize,bpf_u_int32 mask)
int pcap_setfilter(pcap_t *p,struct bpf_program *fp)
void pcap_freecode(struct bpf_program *fp)
其中,函数pcap_compile将一个高层的布尔过滤表达式编译成一个能够被过滤虚拟机所执行的低层字节码。
函数pcap_setfilter将一个过滤器与内核捕获实例相关联。
函数pcap_compile_nopcap在不需要打开适配器的情况下,编译过滤器。这个函数能将程序中高级的过滤表达式,转换成能被内核级的过滤引擎所处理的字节码。
本文详细解释了库wpcap.dll中的数据包过滤功能,包括pcap_compile、pcap_compile_nopcap、pcap_setfilter及pcap_freecode函数的作用,以及它们在过滤数据包过程中的应用。

1411

被折叠的 条评论
为什么被折叠?



