63 #define TIMEOUT_MS 1000
89 static struct bpf_program
fp;
98 char errbuf[PCAP_ERRBUF_SIZE];
104 if (pcap_lookupnet(dev, &net, &mask, errbuf) == -1)
106 printf(
"Sorry, Can't get netmask for device %s\n", dev);
114 printf(
"Sorry, occured problem while opening pcap\n");
120 if (pcap_datalink(
handle) != DLT_EN10MB)
122 printf(
"Sorry, pcap has been open on a NOT ethernet device\n");
128 if (pcap_compile(
handle, &
fp, filter_expr, 0, net) == -1)
130 printf(
"Sorry, pcap can't paser filter%s: %s\n", filter_expr, pcap_geterr(
handle));
135 if (pcap_setfilter(
handle, &
fp) == -1)
137 printf(
"Sorry, pcap couldn't install filter %s: %s\n", filter_expr, pcap_geterr(
handle));
146 #warning cnt 32 o 64 bit???
151 ret = pcap_loop(
handle, cnt, callback, user);
uint8_t wrapperPcap_loop(int32_t cnt, pcap_handler callback, uint8_t *user)
void wrapperPcap_close(void)
static struct bpf_program fp
uint8_t wrapperPcap_init(char *dev, char *filter_expr)