Ignore:
Timestamp:
May 18, 2015 4:42:42 AM (9 years ago)
Author:
ming
Message:

Fixed #1853: Add callback for dropped data in SIP transport

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsip/sip_transport.h

    r4775 r5097  
    15141514 
    15151515/** 
     1516 * Structure of dropped received data. 
     1517 */ 
     1518typedef struct pjsip_tp_dropped_data 
     1519{ 
     1520    /** 
     1521     * The transport receiving the data. 
     1522     */ 
     1523    pjsip_transport *tp; 
     1524 
     1525    /** 
     1526     * The data. 
     1527     */ 
     1528    void            *data; 
     1529 
     1530    /** 
     1531     * The data length. 
     1532     * If the status field below indicates an invalid SIP message 
     1533     * (PJSIP_EINVALIDMSG) and application detects a SIP message 
     1534     * at position p, it can pass the data back to PJSIP to be processed 
     1535     * by setting the len to p. This can be useful for apps which 
     1536     * wishes to use the same transport for SIP signalling and non-SIP 
     1537     * purposes (such as SIP outbound using STUN message). 
     1538     */ 
     1539    pj_size_t        len; 
     1540 
     1541    /** 
     1542     * The status or reason of drop. For example, a leading newlines (common 
     1543     * keep-alive packet) will be dropped with status PJ_EIGNORED, an invalid 
     1544     * SIP message will have status PJSIP_EINVALIDMSG, a SIP message overflow 
     1545     * will have status PJSIP_ERXOVERFLOW. 
     1546     */ 
     1547    pj_status_t      status; 
     1548 
     1549} pjsip_tp_dropped_data; 
     1550 
     1551 
     1552/** 
     1553 * Type of callback to data dropping notifications. 
     1554 * 
     1555 * @param data          The dropped data. 
     1556 */ 
     1557typedef void (*pjsip_tp_on_rx_dropped_cb)(pjsip_tp_dropped_data *data); 
     1558 
     1559 
     1560/** 
     1561 * Set callback of data dropping. The caller will be notified whenever any 
     1562 * received data is dropped (due to leading newlines or keep-alive packet or 
     1563 * invalid SIP message). This callback can be useful for application, 
     1564 * for example, to implement custom keep-alive mechanism or connection 
     1565 * availability detection. 
     1566 * 
     1567 * @param mgr       Transport manager. 
     1568 * @param cb        The callback function, set to NULL to reset the callback. 
     1569 * 
     1570 * @return          PJ_SUCCESS on success, or the appropriate error code. 
     1571 */ 
     1572PJ_DECL(pj_status_t) pjsip_tpmgr_set_drop_data_cb(pjsip_tpmgr *mgr, 
     1573                                                  pjsip_tp_on_rx_dropped_cb cb); 
     1574 
     1575 
     1576/** 
    15161577 * @} 
    15171578 */ 
Note: See TracChangeset for help on using the changeset viewer.