diff options
Diffstat (limited to 'contrib/libpcap/pcap-septel.c')
-rw-r--r-- | contrib/libpcap/pcap-septel.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/contrib/libpcap/pcap-septel.c b/contrib/libpcap/pcap-septel.c index e0be766..2f0ff33 100644 --- a/contrib/libpcap/pcap-septel.c +++ b/contrib/libpcap/pcap-septel.c @@ -14,11 +14,6 @@ * (+961 3 485243) */ -#ifndef lint -static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/pcap-septel.c,v 1.4 2008-04-14 20:40:58 guy Exp $"; -#endif - #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -51,12 +46,20 @@ static int septel_stats(pcap_t *p, struct pcap_stat *ps); static int septel_setnonblock(pcap_t *p, int nonblock, char *errbuf); /* + * Private data for capturing on Septel devices. + */ +struct pcap_septel { + struct pcap_stat stat; +} + +/* * Read at most max_packets from the capture queue and call the callback * for each of them. Returns the number of packets handled, -1 if an * error occured, or -2 if we were told to break out of the loop. */ static int septel_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) { + struct pcap_septel *ps = p->priv; HDR *h; MSG *m; int processed = 0 ; @@ -154,7 +157,7 @@ loop: pcap_header.len = packet_len; /* Count the packet. */ - p->md.stat.ps_recv++; + ps->stat.ps_recv++; /* Call the user supplied callback function */ callback(user, &pcap_header, dp); @@ -229,7 +232,7 @@ pcap_t *septel_create(const char *device, char *ebuf, int *is_ours) { /* OK, it's probably ours. */ *is_ours = 1; - p = pcap_create_common(device, ebuf); + p = pcap_create_common(device, ebuf, sizeof (struct pcap_septel)); if (p == NULL) return NULL; @@ -238,10 +241,11 @@ pcap_t *septel_create(const char *device, char *ebuf, int *is_ours) { } static int septel_stats(pcap_t *p, struct pcap_stat *ps) { - /*p->md.stat.ps_recv = 0;*/ - /*p->md.stat.ps_drop = 0;*/ + struct pcap_septel *handlep = p->priv; + /*handlep->stat.ps_recv = 0;*/ + /*handlep->stat.ps_drop = 0;*/ - *ps = p->md.stat; + *ps = handlep->stat; return 0; } @@ -250,13 +254,8 @@ static int septel_stats(pcap_t *p, struct pcap_stat *ps) { int septel_findalldevs(pcap_if_t **devlistp, char *errbuf) { -unsigned char *p; - const char description[512]= "Intel/Septel device"; - char name[512]="septel" ; - int ret = 0; - pcap_add_if(devlistp,name,0,description,errbuf); - - return (ret); + return (pcap_add_if(devlistp,"septel",0, + "Intel/Septel device",errbuf)); } @@ -282,8 +281,6 @@ static int septel_setfilter(pcap_t *p, struct bpf_program *fp) { return -1; } - p->md.use_bpf = 0; - return (0); } @@ -291,5 +288,6 @@ static int septel_setfilter(pcap_t *p, struct bpf_program *fp) { static int septel_setnonblock(pcap_t *p, int nonblock, char *errbuf) { - return (0); + fprintf(errbuf, PCAP_ERRBUF_SIZE, "Non-blocking mode not supported on Septel devices"); + return (-1); } |