I just use Packet Driver API to do some work.
in the Packet.dll Samples,the testapp Program in the downloaded zip file
wpdpack.zip.
I just want add some packet filter code,but can't work ,It always said
"Unable to compile the packet filter. Check the syntax"
My added code is in the below:
u_int netmask;
char packet_filter[] = "tcp dst port 25";
struct bpf_program fcode;
//compile the filter
netmask=0xffffff;
if(pcap_compile((pcap_t *)lpAdapter, &fcode, packet_filter, 1, netmask) <0 ){
fprintf(stderr,"\nUnable to compile the packet filter. Check the syntax.\n");
PacketFreePacket(lpPacket);
return -1;
}
//set the filter
if(PacketSetBpf(lpAdapter, &fcode)<0){
fprintf(stderr,"\nError setting the filter.\n");
PacketFreePacket(lpPacket);
return -1;
}
I think the error is that in the pcap_compile function ,the type of 1st param can't
match
how can I compile the filter in packet.dll mode,not in the wpcap.dll mode
thx a lot!
==================================================================
This is the WinPcap users list. It is archived at
http://www.mail-archive.com/[EMAIL PROTECTED]/
To unsubscribe use
mailto: [EMAIL PROTECTED]
==================================================================