This module describes simple utility to read PCAP file. It is not intended to support all PCAP features (that's what libpcap is for!), but it can be useful for example to playback or stream PCAP contents.
◆ pj_pcap_file
Opaque declaration for PCAP file
◆ pj_pcap_link_type
Enumeration to describe supported data link types.
Enumerator |
---|
PJ_PCAP_LINK_TYPE_ETH | Ethernet data link
|
◆ pj_pcap_proto_type
Enumeration to describe supported protocol types.
Enumerator |
---|
PJ_PCAP_PROTO_TYPE_UDP | UDP protocol
|
◆ pj_pcap_close()
Close PCAP file.
- Parameters
-
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
◆ pj_pcap_filter_default()
Initialize filter with default values. The default value is to allow any packets.
- Parameters
-
filter | Filter to be initialized. |
◆ pj_pcap_open()
Open PCAP file.
- Parameters
-
pool | Pool to allocate memory. |
path | File/path name. |
p_file | Pointer to receive PCAP file handle. |
- Returns
- PJ_SUCCESS if file can be opened successfully.
◆ pj_pcap_read_udp()
Read UDP payload from the next packet in the PCAP file. Optionally it can return the UDP header, if caller supplies it.
- Parameters
-
file | PCAP file handle. |
udp_hdr | Optional buffer to receive UDP header. |
udp_payload | Buffer to receive the UDP payload. |
udp_payload_size | On input, specify the size of the buffer. On output, it will be filled with the actual size of the payload as read from the packet. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.
References PJ_END_DECL.
◆ pj_pcap_set_filter()
Configure filter for reading the file. When filter is configured, only packets matching all the filter settings will be returned.
- Parameters
-
file | PCAP file handle. |
filter | The filter. |
- Returns
- PJ_SUCCESS on success, or the appropriate error code.