Opens a network device for packet capture.
pcap Library (libpcap.a)
#include <pcap.h>
pcap_t *pcap_open_live(char * device, int snaplen,
int promisc, int to_ms, char * ebuf);
The pcap_open_live subroutine opens the specified network device for packet capture. The term "live" is to indicate that a network device is being opened, as opposed to a file that contains packet capture data. This subroutine must be called before any packet capturing can occur. All other routines dealing with packet capture require the packet capture descriptor that is created and initialized with this routine. See the pcap_open_offline (pcap_open_offline Subroutine) subroutine for more details on opening a previously saved file that contains packet capture data.
Upon successful completion, the pcap_open_live subroutine will return a pointer to the packet capture descriptor that was created. If the pcap_open_live subroutine is unsuccessful, Null is returned, and text indicating the specific error is written into the ebuf buffer.
The pcap_close (pcap_close Subroutine) subroutine, pcap_compile (pcap_compile Subroutine) subroutine, pcap_datalink (pcap_datalink Subroutine) subroutine, pcap_dispatch (pcap_dispatch Subroutine) subroutine, pcap_dump (pcap_dump Subroutine) subroutine, pcap_dump_open (pcap_dump_open Subroutine) subroutine, pcap_geterr (pcap_geterr Subroutine) subroutine, pcap_loop (pcap_loop Subroutine) subroutine, pcap_open_offline (pcap_open_offline Subroutine) subroutine, pcap_perror (pcap_perror Subroutine) subroutine, pcap_setfilter (pcap_setfilter Subroutine) subroutine, pcap_snapshot (pcap_setfilter Subroutine) subroutine, pcap_stats (pcap_stats Subroutine) subroutine.