X-Git-Url: http://sjero.net/git/?p=linphone;a=blobdiff_plain;f=coreapi%2Flinphone_tunnel.h;h=f02baab5473ee6d8f7f29b03808eb253667b47a8;hp=6a2d5218e00071540be3ead2630667fa9049be2f;hb=5f0d5793b7e65a518076de6f8e253770503f8824;hpb=92c2160888d192a46613905b31b7e78de247651c diff --git a/coreapi/linphone_tunnel.h b/coreapi/linphone_tunnel.h index 6a2d5218..f02baab5 100644 --- a/coreapi/linphone_tunnel.h +++ b/coreapi/linphone_tunnel.h @@ -23,63 +23,203 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef LINPHONETUNNELMANAGER_H -#define LINPHONETUNNELMANAGER_H +#ifndef LINPHONETUNNEL_H +#define LINPHONETUNNEL_H #include "linphonecore.h" +/** + * @addtogroup tunnel + * @{ +**/ + + /** + * This set of methods enhance LinphoneCore functionalities in order to provide an easy to use API to + * - provision tunnel servers ip addresses and ports. This functionality is an option not implemented under GPL. + * - start/stop the tunneling service + * - perform auto-detection whether tunneling is required, based on a test of sending/receiving a flow of UDP packets. + * + * It takes in charge automatically the SIP registration procedure when connecting or disconnecting to a tunnel server. + * No other action on LinphoneCore is required to enable full operation in tunnel mode. + **/ + #ifdef __cplusplus extern "C" { #endif -typedef void (*LogHandler)(int log_level, const char *str, va_list l); +typedef struct _LinphoneTunnelConfig LinphoneTunnelConfig; -void linphone_tunnel_add_server(LinphoneTunnel *tunnel, const char *host, int port); -void linphone_tunnel_add_server_and_mirror(LinphoneTunnel *tunnel, const char *host, int port, int remote_udp_mirror, int delay); -void linphone_tunnel_clean_servers(LinphoneTunnel *tunnel); -void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled); -bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel); -void linphone_tunnel_enable_logs(LinphoneTunnel *tunnel, bool_t enabled); -void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, LogHandler logHandler); -void linphone_tunnel_reconnect(LinphoneTunnel *tunnel); -void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel); -void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tunnel, const char* username,const char* passwd); +/** + * Create a new tunnel configuration + */ +LinphoneTunnelConfig *linphone_tunnel_config_new(); + +/** + * Set address of server. + * + * @param tunnel configuration object + * @param host tunnel server ip address + */ +void linphone_tunnel_config_set_host(LinphoneTunnelConfig *tunnel, const char *host); + +/** + * Get address of server. + * + * @param tunnel configuration object + */ +const char *linphone_tunnel_config_get_host(const LinphoneTunnelConfig *tunnel); + +/** + * Set tls port of server. + * + * @param tunnel configuration object + * @param port tunnel server tls port, recommended value is 443 + */ +void linphone_tunnel_config_set_port(LinphoneTunnelConfig *tunnel, int port); +/** + * Get tls port of server. + * + * @param tunnel configuration object + */ +int linphone_tunnel_config_get_port(const LinphoneTunnelConfig *tunnel); /** - * LinphoneTunnelState describes the tunnel activation states. + * Set the remote port on the tunnel server side used to test udp reachability. + * + * @param tunnel configuration object + * @param remote_udp_mirror_port remote port on the tunnel server side used to test udp reachability, set to -1 to disable the feature */ -typedef enum _LinphoneTunnelState{ - LinphoneTunnelDisabled, /**In case of success, the tunnel is automatically turned off. Otherwise, if no udp commmunication is feasible, tunnel mode is turned on. + *
Call this method each time to run the auto detection algorithm + */ +void linphone_tunnel_auto_detect(LinphoneTunnel *tunnel); + +/** + * Set an optional http proxy to go through when connecting to tunnel server. + * @param tunnel LinphoneTunnel object + * @param host Http proxy host. + * @param port http proxy port. + * @param username optional http proxy username if the proxy request authentication. Currently only basic authentication is supported. Use NULL if not needed. + * @param password optional http proxy password. Use NULL if not needed. + **/ +void linphone_tunnel_set_http_proxy(LinphoneTunnel *tunnel, const char *host, int port, const char* username,const char* passwd); + +/** + * Retrieve optional http proxy configuration previously set with linphone_tunnel_set_http_proxy(). + * @param tunnel LinphoneTunnel object + * @param host Http proxy host. + * @param port http proxy port. + * @param username optional http proxy username if the proxy request authentication. Currently only basic authentication is supported. Use NULL if not needed. + * @param password optional http proxy password. Use NULL if not needed. + **/ +void linphone_tunnel_get_http_proxy(LinphoneTunnel*tunnel,const char **host, int *port, const char **username, const char **passwd); + +void linphone_tunnel_set_http_proxy_auth_info(LinphoneTunnel*tunnel, const char* username,const char* passwd); + + +/** + * @} +**/ #ifdef __cplusplus } #endif -#endif +#endif //LINPHONETUNNEL_H +