Commit 62c03843 authored by François Grisez's avatar François Grisez
Browse files

Turn LinphoneTunnel into belle_sip_object_t

parent c979eeaa
......@@ -34,16 +34,33 @@ LinphoneTunnel* linphone_core_get_tunnel(const LinphoneCore *lc){
}
struct _LinphoneTunnel {
::belle_sip_object_t *base;
belledonnecomm::TunnelManager *manager;
bctbx_list_t *config_list;
};
static void _linphone_tunnel_uninit(LinphoneTunnel *tunnel);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneTunnel);
BELLE_SIP_DECLARE_VPTR(LinphoneTunnel);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneTunnel, belle_sip_object_t,
_linphone_tunnel_uninit, // uninit
NULL, // clone
NULL, // marshal
FALSE // unowned
)
extern "C" LinphoneTunnel* linphone_core_tunnel_new(LinphoneCore *lc){
LinphoneTunnel* tunnel = ms_new0(LinphoneTunnel, 1);
LinphoneTunnel* tunnel = belle_sip_object_new(LinphoneTunnel);
tunnel->manager = new belledonnecomm::TunnelManager(lc);
return tunnel;
}
static void _linphone_tunnel_uninit(LinphoneTunnel *tunnel) {
delete tunnel->manager;
bctbx_list_free_with_data(tunnel->config_list, (bctbx_list_free_func)linphone_tunnel_config_unref);
}
belledonnecomm::TunnelManager *bcTunnel(const LinphoneTunnel *tunnel){
return tunnel->manager;
}
......@@ -52,12 +69,12 @@ static inline _LpConfig *config(const LinphoneTunnel *tunnel){
return tunnel->manager->getLinphoneCore()->config;
}
void linphone_tunnel_destroy(LinphoneTunnel *tunnel){
delete tunnel->manager;
bctbx_list_free_with_data(tunnel->config_list, (void (*)(void *))linphone_tunnel_config_destroy);
LinphoneTunnel *linphone_tunnel_ref(LinphoneTunnel *tunnel) {
return (LinphoneTunnel *)belle_sip_object_ref(tunnel);
}
ms_free(tunnel);
void linphone_tunnel_unref(LinphoneTunnel *tunnel) {
belle_sip_object_unref(tunnel);
}
static char *linphone_tunnel_config_to_string(const LinphoneTunnelConfig *tunnel_config) {
......
......@@ -1119,7 +1119,6 @@ struct _LinphoneEvent{
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneEvent);
LinphoneTunnel *linphone_core_tunnel_new(LinphoneCore *lc);
void linphone_tunnel_destroy(LinphoneTunnel *tunnel);
void linphone_tunnel_configure(LinphoneTunnel *tunnel);
void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler);
......@@ -1606,7 +1605,8 @@ BELLE_SIP_TYPE_ID(LinphonePresenceModel),
BELLE_SIP_TYPE_ID(LinphonePresenceService),
BELLE_SIP_TYPE_ID(LinphonePresencePerson),
BELLE_SIP_TYPE_ID(LinphonePresenceActivity),
BELLE_SIP_TYPE_ID(LinphonePresenceNote)
BELLE_SIP_TYPE_ID(LinphonePresenceNote),
BELLE_SIP_TYPE_ID(LinphoneTunnel)
BELLE_SIP_DECLARE_TYPES_END
......
......@@ -81,6 +81,8 @@
\endcode
**/
#define LINPHONE_TUNNEL(obj) BELLE_SIP_CAST(obj, LinphoneTunnel)
#ifdef __cplusplus
extern "C"
{
......@@ -91,6 +93,19 @@ extern "C"
*/
LINPHONE_PUBLIC LinphoneTunnelConfig *linphone_tunnel_config_new(void);
/**
* Take a reference on a #LinphoneTunnel.
* @param[in] tunnel The #LinphoneTunnel whose the ref counter will be increased.
* @return Pointer on the freshly refed #LinphoneTunnel.
*/
LINPHONE_PUBLIC LinphoneTunnel *linphone_tunnel_ref(LinphoneTunnel *tunnel);
/**
* Release a reference on a #LinphoneTunnel.
* @param[in] tunnel The #LinphoneTunnel whose the ref counter will be decreased.
*/
LINPHONE_PUBLIC void linphone_tunnel_unref(LinphoneTunnel *tunnel);
/**
* Set the IP address or hostname of the tunnel server.
* @param tunnel LinphoneTunnelConfig object
......@@ -194,7 +209,7 @@ LINPHONE_PUBLIC void linphone_tunnel_config_unref(LinphoneTunnelConfig *cfg);
* @param tunnel LinphoneTunnelConfig object
* @deprecated use linphone_tunnel_config_unref().
*/
LINPHONE_PUBLIC void linphone_tunnel_config_destroy(LinphoneTunnelConfig *tunnel);
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_tunnel_config_destroy(LinphoneTunnelConfig *tunnel);
/**
* Store a user data in the tunnel config object
......@@ -345,7 +360,7 @@ LINPHONE_PUBLIC void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tun
* The TunnelManager takes care of refreshing SIP registration when switching on or off the tunneled mode.
* @deprecated Replaced by linphone_tunnel_set_mode()
**/
LINPHONE_PUBLIC void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled);
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled);
/**
* Check whether tunnel is enabled
......@@ -353,7 +368,7 @@ LINPHONE_PUBLIC void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabl
* @return Returns a boolean indicating whether tunneled operation is enabled.
* @deprecated Replaced by linphone_tunnel_get_mode()
**/
LINPHONE_PUBLIC bool_t linphone_tunnel_enabled(const LinphoneTunnel *tunnel);
LINPHONE_PUBLIC LINPHONE_DEPRECATED bool_t linphone_tunnel_enabled(const LinphoneTunnel *tunnel);
/**
* Start tunnel need detection.
......@@ -363,7 +378,7 @@ LINPHONE_PUBLIC bool_t linphone_tunnel_enabled(const LinphoneTunnel *tunnel);
* <br> Call this method each time to run the auto detection algorithm
* @deprecated Replaced by linphone_tunnel_set_mode(LinphoneTunnelModeAuto)
*/
LINPHONE_PUBLIC void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel);
LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel);
/**
* Tell whether tunnel auto detection is enabled.
......@@ -371,7 +386,7 @@ LINPHONE_PUBLIC void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel);
* @return TRUE if auto detection is enabled, FALSE otherwise.
* @deprecated Replaced by linphone_tunnel_get_mode()
*/
LINPHONE_PUBLIC bool_t linphone_tunnel_auto_detect_enabled(LinphoneTunnel *tunnel);
LINPHONE_PUBLIC LINPHONE_DEPRECATED bool_t linphone_tunnel_auto_detect_enabled(LinphoneTunnel *tunnel);
LINPHONE_PUBLIC void linphone_tunnel_simulate_udp_loss(LinphoneTunnel *tunnel, bool_t enabled);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment