summaryrefslogtreecommitdiff
path: root/pjlib-util/include
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-02-02 09:12:13 +0000
committerBenny Prijono <bennylp@teluu.com>2008-02-02 09:12:13 +0000
commit18993521e89c2157c0be2f10b038f2600e54eaa9 (patch)
treee9aa88dae4c3b1a2bf86d70cc1cb7b9fffc14e8e /pjlib-util/include
parent289a68d8d6b3df5ad39d4280f88822be4d91c58e (diff)
More ticket #465: option to return UDP header in pj_pcap_read_udp(), and better RTP packet handling in pcaputil sample
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1769 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib-util/include')
-rw-r--r--pjlib-util/include/pjlib-util/pcap.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/pjlib-util/include/pjlib-util/pcap.h b/pjlib-util/include/pjlib-util/pcap.h
index e27f5709..58d39a9f 100644
--- a/pjlib-util/include/pjlib-util/pcap.h
+++ b/pjlib-util/include/pjlib-util/pcap.h
@@ -60,9 +60,22 @@ typedef enum pj_pcap_proto_type
/**
+ * This describes UDP header, which may optionally be returned in
+ * #pj_pcap_read_udp() function. All fields are in network byte order.
+ */
+typedef struct pj_pcap_udp_hdr
+{
+ pj_uint16_t src_port; /**< Source port. */
+ pj_uint16_t dst_port; /**< Destination port */
+ pj_uint16_t len; /**< Length. */
+ pj_uint16_t csum; /**< Checksum. */
+} pj_pcap_udp_hdr;
+
+
+/**
* This structure describes the filter to be used when reading packets from
- * a PCAP file. The filter is used to select what packets can be returned
- * to a read operation.
+ * a PCAP file. When a filter is configured, only packets matching all the
+ * filter specifications will be read from PCAP file.
*/
typedef struct pj_pcap_filter
{
@@ -142,7 +155,8 @@ PJ_DECL(pj_status_t) pj_pcap_open(pj_pool_t *pool,
PJ_DECL(pj_status_t) pj_pcap_close(pj_pcap_file *file);
/**
- * Configure filter for reading the file.
+ * Configure filter for reading the file. When filter is configured,
+ * only packets matching all the filter settings will be returned.
*
* @param file PCAP file handle.
* @param filter The filter.
@@ -153,9 +167,11 @@ PJ_DECL(pj_status_t) pj_pcap_set_filter(pj_pcap_file *file,
const pj_pcap_filter *filter);
/**
- * Read UDP payload from the next packet in the PCAP file.
+ * Read UDP payload from the next packet in the PCAP file. Optionally it
+ * can return the UDP header, if caller supplies it.
*
* @param file PCAP file handle.
+ * @param udp_hdr Optional buffer to receive UDP header.
* @param udp_payload Buffer to receive the UDP payload.
* @param udp_payload_size On input, specify the size of the buffer.
* On output, it will be filled with the actual size
@@ -164,6 +180,7 @@ PJ_DECL(pj_status_t) pj_pcap_set_filter(pj_pcap_file *file,
* @return PJ_SUCCESS on success, or the appropriate error code.
*/
PJ_DECL(pj_status_t) pj_pcap_read_udp(pj_pcap_file *file,
+ pj_pcap_udp_hdr *udp_hdr,
pj_uint8_t *udp_payload,
pj_size_t *udp_payload_size);