Menu

#25 Added pcap_time function

closed-rejected
nobody
None
5
2013-11-20
2007-11-16
No

Added the function pcap_time which captures for a specified number of seconds. This was for implementing an option in tcpdump that does the same thing. It brings time.h into pcap.c

I updated the man page as well.

Discussion

  • Matthew Topper

    Matthew Topper - 2007-11-16

    patch -i pcap_time.patch in the untarred directory. Based on 0.9.8

     
  • Guy Harris

    Guy Harris - 2008-04-11
    • status: open --> closed-rejected
     
  • Guy Harris

    Guy Harris - 2008-04-11

    Logged In: YES
    user_id=541179
    Originator: NO

    Timed capture doesn't require libpcap changes - and that code won't work on all platforms in any case. A call to the read method for a capture device can block indefinitely if no packets arrive (the timeout specified in pcap_open_live() is *not* guaranteed to be a timer that starts when you try to read packets; on Solaris, for example, the timer doesn't start until the first packet arrives, and, on some platforms, there isn't a timer.

    Using alarm() in tcpdump would work on all UN*X platforms - without requiring a call to time() for each packet batch. On Windows, the multimedia timer might be usable; note the code that's already there in top-of-tree tcpdump, where, if you're capturing to a file with the "-w" flag, the "-v" flag causes tcpdump to periodically report how many packets it's captured.

     
  • Denis Ovsienko

    Denis Ovsienko - 2013-11-20

    Administrators of the "libpcap" SourceForge project have superseded this tracker item (formerly artifact 1832829, now patch 25) with issue 221 of the "libpcap" GitHub project.

     
MongoDB Logo MongoDB