summaryrefslogtreecommitdiff
path: root/pjsip/include
diff options
context:
space:
mode:
authorLiong Sauw Ming <ming@teluu.com>2015-05-18 04:42:42 +0000
committerLiong Sauw Ming <ming@teluu.com>2015-05-18 04:42:42 +0000
commit476a04aca75f9b49813db98744a3214d41aef2d2 (patch)
treef54c87741d1fde1f989c1df8be0cd547c7f50d14 /pjsip/include
parentf33fab4fc22321a8c4e19015f9a11b6299272e3e (diff)
Fixed #1853: Add callback for dropped data in SIP transport
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5097 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/include')
-rw-r--r--pjsip/include/pjsip/sip_transport.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/pjsip/include/pjsip/sip_transport.h b/pjsip/include/pjsip/sip_transport.h
index 2ebecd48..1fe3b5af 100644
--- a/pjsip/include/pjsip/sip_transport.h
+++ b/pjsip/include/pjsip/sip_transport.h
@@ -1513,6 +1513,67 @@ PJ_DECL(pj_status_t) pjsip_transport_remove_state_listener (
/**
+ * Structure of dropped received data.
+ */
+typedef struct pjsip_tp_dropped_data
+{
+ /**
+ * The transport receiving the data.
+ */
+ pjsip_transport *tp;
+
+ /**
+ * The data.
+ */
+ void *data;
+
+ /**
+ * The data length.
+ * If the status field below indicates an invalid SIP message
+ * (PJSIP_EINVALIDMSG) and application detects a SIP message
+ * at position p, it can pass the data back to PJSIP to be processed
+ * by setting the len to p. This can be useful for apps which
+ * wishes to use the same transport for SIP signalling and non-SIP
+ * purposes (such as SIP outbound using STUN message).
+ */
+ pj_size_t len;
+
+ /**
+ * The status or reason of drop. For example, a leading newlines (common
+ * keep-alive packet) will be dropped with status PJ_EIGNORED, an invalid
+ * SIP message will have status PJSIP_EINVALIDMSG, a SIP message overflow
+ * will have status PJSIP_ERXOVERFLOW.
+ */
+ pj_status_t status;
+
+} pjsip_tp_dropped_data;
+
+
+/**
+ * Type of callback to data dropping notifications.
+ *
+ * @param data The dropped data.
+ */
+typedef void (*pjsip_tp_on_rx_dropped_cb)(pjsip_tp_dropped_data *data);
+
+
+/**
+ * Set callback of data dropping. The caller will be notified whenever any
+ * received data is dropped (due to leading newlines or keep-alive packet or
+ * invalid SIP message). This callback can be useful for application,
+ * for example, to implement custom keep-alive mechanism or connection
+ * availability detection.
+ *
+ * @param mgr Transport manager.
+ * @param cb The callback function, set to NULL to reset the callback.
+ *
+ * @return PJ_SUCCESS on success, or the appropriate error code.
+ */
+PJ_DECL(pj_status_t) pjsip_tpmgr_set_drop_data_cb(pjsip_tpmgr *mgr,
+ pjsip_tp_on_rx_dropped_cb cb);
+
+
+/**
* @}
*/