diff options
author | guy <guy> | 2003-11-04 07:05:32 +0000 |
---|---|---|
committer | guy <guy> | 2003-11-04 07:05:32 +0000 |
commit | 991d444f7116bef16893826b46f3950f62281507 (patch) | |
tree | a6e3cc271bc1560beb89dcc0d0c3893297bbba0b /pcap-linux.c | |
parent | 4246a40e00fd598e3af4ab8e4251749968b086c1 (diff) |
Add a "pcap_breakloop()" API to break out of the loop in
"pcap_dispatch()" and "pcap_loop()".
Diffstat (limited to 'pcap-linux.c')
-rw-r--r-- | pcap-linux.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/pcap-linux.c b/pcap-linux.c index 9828d13..6120b67 100644 --- a/pcap-linux.c +++ b/pcap-linux.c @@ -27,7 +27,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.96 2003-10-06 07:04:55 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap-linux.c,v 1.97 2003-11-04 07:05:34 guy Exp $ (LBL)"; #endif /* @@ -462,6 +462,18 @@ pcap_read_packet(pcap_t *handle, pcap_handler callback, u_char *userdata) bp = handle->buffer + handle->offset; do { + /* + * Has "pcap_breakloop()" been called? + */ + if (p->break_loop) { + /* + * Yes - clear the flag that indicates that it + * has, and return -2 as an indication that we + * were told to break out of the loop. + */ + p->break_loop = 0; + return -2; + } fromlen = sizeof(from); packet_len = recvfrom( handle->fd, bp + offset, |