pcap_get_required_select_timeout(3pcap) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

pcap_get_required_select_timeout(3pcap)

PCAP_GET_REQUI...SELECT_TIMEOUT(3pcap)  PCAP_GET_REQUI...SELECT_TIMEOUT(3pcap)

NAME
       pcap_get_required_select_timeout  - get a timeout to be used when doing
       select() for a live capture

SYNOPSIS
       #include <pcap/pcap.h>

       const struct timeval *pcap_get_required_select_timeout(pcap_t *p);

DESCRIPTION
       pcap_get_required_select_timeout() returns, on UNIX,  a  pointer  to  a
       struct  timeval  containing  a  value  that must be used as the minimum
       timeout in select(2), poll(2), epoll_wait(2), and kevent(2)  calls,  or
       NULL  if there is no such timeout.  If a non-NULL value is returned, it
       must be used regardless of  whether  pcap_get_selectable_fd(3PCAP)  re‐
       turns  -1  for  any  descriptor  on  which  those calls are being done.
       pcap_get_required_select_timeout() should be called for all pcap_ts be‐
       fore a call to select(), poll(), epoll_wait(),  or  kevent(),  and  any
       timeouts  used  for  those calls should be updated as appropriate given
       the new value of the timeout.

       For kevent(), one EVFILT_TIMER filter per selectable descriptor can  be
       used,  rather  than  using  the  timeout  argument  to kevent(); if the
       EVFILT_TIMER event for a particular selectable  descriptor  signals  an
       event,  pcap_dispatch(3PCAP)  should  be  called  for the corresponding
       pcap_t.

       On Linux systems with timerfd_create(2), one timer  object  created  by
       timerfd_create() per selectable descriptor can be used, rather than us‐
       ing  the  timeout  argument  to epoll_wait(); if the timer object for a
       particular selectable descriptor signals an event, pcap_dispatch(3PCAP)
       should be called for the corresponding pcap_t.

       Otherwise, a timeout value no larger than the smallest of all  timeouts
       returned  by  pcap_get_required_select_timeout() for devices from which
       packets will be captured and any other timeouts to be used in the  call
       should be used as the timeout for the call, and, when the call returns,
       pcap_dispatch(3PCAP)  should be called for all pcap_ts for which a non-
       NULL timeout was returned, regardless of whether it's indicated as hav‐
       ing anything to read from it or not.

       All devices with a non-NULL timeout must be put  in  non-blocking  mode
       with pcap_setnonblock(3PCAP).

       Note that a device on which a read can be done without blocking may, on
       some platforms, not have any packets to read if the packet buffer time‐
       out has expired.  A call to pcap_dispatch() or pcap_next_ex(3PCAP) will
       return 0 in this case, but will not block.

       pcap_get_required_select_timeout() is not available on Windows.

RETURN VALUE
       A  pointer  to a struct timeval is returned if the timeout is required;
       otherwise NULL is returned.

BACKWARD COMPATIBILITY
       This function became available in libpcap release 1.9.0.   In  previous
       releases,  select(),  poll(),  epoll_wait(),  and kevent() could not be
       used for devices that don't provide a selectable  file  descriptor  (in
       other  words,  on  any capture source for that pcap_get_selectable_fd()
       returns -1).

       In libpcap release 1.10.0 and later, the timeout value can change  from
       call  to call, so pcap_get_required_select_timeout() must be called be‐
       fore each call to select(), poll(), epoll_wait(), or kevent(), and  the
       new  value  must be used to calculate timeouts for the call.  Code that
       does that will also work with libpcap 1.9.x  releases,  so  code  using
       pcap_get_required_select_timeout()  should  be  changed  to call it for
       each call to select(), poll(), epoll_wait(), or kevent()  even  if  the
       code must also work with libpcap 1.9.x.


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:

       box; cbp-1 | cbp-1 l | l .  ATTRIBUTE TYPE ATTRIBUTE VALUE = Availabil‐
       ity   system/library/libpcap = Stability Uncommitted

SEE ALSO
       pcap(3PCAP),    pcap_get_selectable_fd(3PCAP),    select(2),   poll(2),
       epoll_wait(2), kqueue(2)



NOTES
       Source code for open source software components in Oracle  Solaris  can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This software was built from source available at:
       https://github.com/oracle/solaris-userland

       The original community source was downloaded from:
       https://www.tcpdump.org/release/libpcap-1.10.4.tar.gz

       Further information about this software can be found on the open source
       community website at https://www.tcpdump.org/.

                                29 JanuarPyCA2P0_2G0ET_REQUI...SELECT_TIMEOUT(3pcap)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3