Obtains the next packet from the packet capture device.
pcap Library (libpcap.a)
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.
Item | Description |
---|---|
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.