tcpdump mailing list archives
Re: Feature request: time limits
From: Guy Harris <guy () alum mit edu>
Date: Mon, 3 Nov 2003 23:39:36 -0800
On Mon, Nov 03, 2003 at 07:24:39PM -0800, Guy Harris wrote:
Ideally, the signal handler should just be able to force the capture loop to terminate; there currently isn't a "force the loop to terminate" API - I've done some work on implementing one, and should probably go back and finish it.
Well, I've added that API - "pcap_breakloop()"; it takes as an argument a "pcap_t *", and sets a flag in that "pcap_t" to cause packet capturing loops to be terminated. Note that, in order for this to work on UNIX systems with restartable system calls (most if not all of them at this point), if you set up a handler for a signal, and that handler will call "pcap_breakloop()", you must NOT specify, when you set up the signal handler, that the signal should restart system calls. If a "pcap_dispatch()" or "pcap_loop()" loop is terminated by "pcap_breakloop()" being called, they return -2. Applications that use "pcap_breakloop()" must not assume that a negative return from those routines mean an error occurred while capturing packets; only a return value of -1 means that. (In applications that don't call "pcap_breakloop()" and don't use libraries that call "pcap_breakloop()", those routines will never return -2, so they can safely check for negative values - i.e., this doesn't break existing applications.) I've converted tcpdump to use that API if available. - This is the TCPDUMP workers list. It is archived at http://www.tcpdump.org/lists/workers/index.html To unsubscribe use mailto:tcpdump-workers-request () tcpdump org?body=unsubscribe
Current thread:
- Feature request: time limits Rob Quinn (Oct 20)
- Re: Feature request: time limits Guy Harris (Nov 03)
- Re: Feature request: time limits Guy Harris (Nov 03)
- Re: Feature request: time limits Rob Quinn (Nov 05)
- Re: Feature request: time limits Guy Harris (Nov 05)
- Re: Feature request: time limits Guy Harris (Nov 03)