Obtains the next packet from the packet capture device.
pcap Library (libpcap.a)
u_char *pcap_next(pcap_t * p, struct pcap_pkthdr * h);
The pcap_next subroutine returns a u_char pointer to the next packet from the packet capture device. The packet capture device can be a network device or a savefile that contains packet capture data. The data has the same format as used by tcpdump.
|h||Points to the packet header of the packet that is returned. This is filled in upon return by this routine.|
|p||Points to the packet capture descriptor to use as returned by the pcap_open_live or the pcap_open_offline subroutine.|
Upon successful completion, the pcap_next subroutine returns a pointer to a buffer containing the next packet and fills in the h, which points to the packet header of the returned packet. If the pcap_next subroutine is unsuccessful, Null is returned.
The pcap_dispatch (pcap_dispatch Subroutine) subroutine, pcap_dump (pcap_dump Subroutine) subroutine, pcap_dump_close (pcap_dump_close Subroutine) subroutine, pcap_dump_open (pcap_dump_open Subroutine) subroutine, pcap_loop (pcap_loop Subroutine) subroutine, pcap_open_live (pcap_open_live Subroutine) subroutine, pcap_open_offline (pcap_open_offline Subroutine) subroutine.
The tcpdump command.