Ignore:
Timestamp:
Apr 14, 2010 6:57:35 AM (14 years ago)
Author:
nanang
Message:

Ticket #1056:

  • Added functions to set/unset transport state notification callback on specific transport.
  • Updated transaction to immediately terminate the transactions when their transport gets disconnected.
  • Minor update: renamed function pjsip_tpmgr_set/get_status_cb() to pjsip_tpmgr_set/get_state_cb().
File:
1 edited

Legend:

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

    r3119 r3138  
    750750    pjsip_tpmgr            *tpmgr;          /**< Transport manager.         */ 
    751751    pj_timer_entry          idle_timer;     /**< Timer when ref cnt is zero.*/ 
     752 
     753    void                   *data;           /**< Internal transport data.   */ 
    752754 
    753755    /** 
     
    12711273 
    12721274/** 
     1275 * Definition of transport state listener key. 
     1276 */ 
     1277typedef void pjsip_tp_state_listener_key; 
     1278 
     1279/** 
    12731280 * Structure of transport state info passed by #pjsip_tp_state_callback. 
    12741281 */ 
     
    12831290     */ 
    12841291    void                *ext_info; 
     1292 
     1293    /** 
     1294     * Optional user data. In global transport state notification, this will 
     1295     * always be NULL. 
     1296     */ 
     1297    void                *user_data; 
     1298 
    12851299} pjsip_transport_state_info; 
    12861300 
     
    13021316 
    13031317/** 
    1304  * Setting callback of transport state notification. The caller will be 
    1305  * notified whenever the state of transport is changed. The type of 
    1306  * events are defined in #pjsip_transport_state. 
     1318 * Set callback of global transport state notification. The caller will be 
     1319 * notified whenever the state of any transport is changed. The type of events 
     1320 * are defined in #pjsip_transport_state. 
     1321 * 
     1322 * Note that this function will override the existing callback, if any, so 
     1323 * application is recommended to keep the old callback and manually forward 
     1324 * the notification to the old callback, otherwise other component that  
     1325 * concerns about the transport state will no longer receive transport state  
     1326 * events. 
    13071327 *  
    13081328 * @param mgr       Transport manager. 
    13091329 * @param cb        Callback to be called to notify caller about transport  
    1310  *                  status changing. 
     1330 *                  state changing. 
    13111331 * 
    13121332 * @return          PJ_SUCCESS on success, or the appropriate error code. 
    13131333 */ 
    1314 PJ_DECL(pj_status_t) pjsip_tpmgr_set_status_cb(pjsip_tpmgr *mgr, 
    1315                                                pjsip_tp_state_callback cb); 
    1316  
    1317  
    1318 /** 
    1319  * Getting the callback of transport state notification. 
     1334PJ_DECL(pj_status_t) pjsip_tpmgr_set_state_cb(pjsip_tpmgr *mgr, 
     1335                                              pjsip_tp_state_callback cb); 
     1336 
     1337 
     1338/** 
     1339 * Get the callback of global transport state notification. 
    13201340 *  
    13211341 * @param mgr       Transport manager. 
     
    13231343 * @return          The transport state callback or NULL if it is not set. 
    13241344 */ 
    1325 PJ_DECL(pjsip_tp_state_callback) pjsip_tpmgr_get_status_cb( 
    1326                                                const pjsip_tpmgr *mgr); 
     1345PJ_DECL(pjsip_tp_state_callback) pjsip_tpmgr_get_state_cb( 
     1346                                              const pjsip_tpmgr *mgr); 
     1347 
     1348 
     1349/** 
     1350 * Add a listener to the specified transport for transport state notification. 
     1351 *  
     1352 * @param tp        The transport. 
     1353 * @param cb        Callback to be called to notify listener about transport  
     1354 *                  state changing. 
     1355 * @param user_data The user data. 
     1356 * @param key       Output key, used to remove this listener. 
     1357 * 
     1358 * @return          PJ_SUCCESS on success, or the appropriate error code. 
     1359 */ 
     1360PJ_DECL(pj_status_t) pjsip_transport_add_state_listener ( 
     1361                                            pjsip_transport *tp, 
     1362                                            pjsip_tp_state_callback cb, 
     1363                                            void *user_data, 
     1364                                            pjsip_tp_state_listener_key **key); 
     1365 
     1366 
     1367/** 
     1368 * Remove a listener from the specified transport for transport state  
     1369 * notification. 
     1370 *  
     1371 * @param tp        The transport. 
     1372 * @param key       The listener key. 
     1373 * @param user_data The user data, for validation purpose. 
     1374 * 
     1375 * @return          PJ_SUCCESS on success, or the appropriate error code. 
     1376 */ 
     1377PJ_DECL(pj_status_t) pjsip_transport_remove_state_listener ( 
     1378                                    pjsip_transport *tp, 
     1379                                    pjsip_tp_state_listener_key *key, 
     1380                                    const void *user_data); 
    13271381 
    13281382 
Note: See TracChangeset for help on using the changeset viewer.