diff options
author | George Joseph <gjoseph@digium.com> | 2018-02-01 11:26:49 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2018-02-01 11:26:49 -0600 |
commit | b1484537084ed560df14b8c0bb563948411fcbbb (patch) | |
tree | eef2d65ce59a1cd50f617aef8a7aed9795e74d2b /include | |
parent | b9efe5adf03a12c314d53b27a80709799be9e251 (diff) | |
parent | 2b9aa6b5bbe8d3ada6e4a9b0bc614f2f77470cd0 (diff) |
Merge "res_pjsip_pubsub: Prune subs with reliable transports at startup"
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/res_pjsip.h | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h index a3bd78222..c017e62db 100644 --- a/include/asterisk/res_pjsip.h +++ b/include/asterisk/res_pjsip.h @@ -2985,6 +2985,18 @@ int ast_sip_str_to_dtmf(const char *dtmf_mode); */ typedef void (*ast_transport_monitor_shutdown_cb)(void *data); +/*! + * \brief Transport shutdown monitor data matcher + * \since 13.20.0 + * + * \param a User data to compare. + * \param b User data to compare. + * + * \retval 1 The data objects match + * \retval 0 The data objects don't match + */ +typedef int (*ast_transport_monitor_data_matcher)(void *a, void *b); + enum ast_transport_monitor_reg { /*! \brief Successfully registered the transport monitor */ AST_TRANSPORT_MONITOR_REG_SUCCESS, @@ -3001,37 +3013,59 @@ enum ast_transport_monitor_reg { /*! * \brief Register a reliable transport shutdown monitor callback. - * \since 13.18.0 + * \since 13.20.0 * * \param transport Transport to monitor for shutdown. * \param cb Who to call when transport is shutdown. * \param ao2_data Data to pass with the callback. * + * \note The data object passed will have its reference count automatically + * incremented by this call and automatically decremented after the callback + * runs or when the callback is unregistered. + * + * There is no checking for duplicate registrations. + * * \return enum ast_transport_monitor_reg */ enum ast_transport_monitor_reg ast_sip_transport_monitor_register(pjsip_transport *transport, ast_transport_monitor_shutdown_cb cb, void *ao2_data); /*! - * \brief Unregister a reliable transport shutdown monitor callback. - * \since 13.18.0 + * \brief Unregister a reliable transport shutdown monitor + * \since 13.20.0 * * \param transport Transport to monitor for shutdown. - * \param cb Who to call when transport is shutdown. + * \param cb The callback that was used for the original register. + * \param data Data to pass to the matcher. May be NULL and does NOT need to be an ao2 object. + * If NULL, all monitors with the provided callbck are unregistered. + * \param matches Matcher function that returns true if data matches the previously + * registered data object. If NULL, a simple pointer comparison is done. + * + * \note The data object passed into the original register will have its reference count + * automatically decremeneted. * * \return Nothing */ -void ast_sip_transport_monitor_unregister(pjsip_transport *transport, ast_transport_monitor_shutdown_cb cb); +void ast_sip_transport_monitor_unregister(pjsip_transport *transport, + ast_transport_monitor_shutdown_cb cb, void *data, ast_transport_monitor_data_matcher matches); /*! - * \brief Unregister monitor callback from all reliable transports. - * \since 13.18.0 + * \brief Unregister a transport shutdown monitor from all reliable transports + * \since 13.20.0 + * + * \param cb The callback that was used for the original register. + * \param data Data to pass to the matcher. May be NULL and does NOT need to be an ao2 object. + * If NULL, all monitors with the provided callbck are unregistered. + * \param matches Matcher function that returns true if ao2_data matches the previously + * registered data object. If NULL, a simple pointer comparison is done. * - * \param cb Who to call when a transport is shutdown. + * \note The data object passed into the original register will have its reference count + * automatically decremeneted. * * \return Nothing */ -void ast_sip_transport_monitor_unregister_all(ast_transport_monitor_shutdown_cb cb); +void ast_sip_transport_monitor_unregister_all(ast_transport_monitor_shutdown_cb cb, + void *data, ast_transport_monitor_data_matcher matches); /*! Transport state notification registration element. */ struct ast_sip_tpmgr_state_callback { |