]> sjero.net Git - linphone/blob - coreapi/linphone_tunnel_config.c
Aac-eld add missing header according to RFC3640 3.3.6
[linphone] / coreapi / linphone_tunnel_config.c
1 /***************************************************************************
2  *            linphone_tunnel_config.c
3  *
4  *  Copyright  2012  Belledonne Communications
5  ****************************************************************************/
6
7 /*
8  *  This program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2 of the License, or
11  *  (at your option) any later version.
12  *
13  *  This program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with this program; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21  */
22
23 #include "linphone_tunnel.h"
24
25 struct _LinphoneTunnelConfig {
26         char *host;
27         int port;
28         int remote_udp_mirror_port;
29         int delay;      
30 };
31
32 LinphoneTunnelConfig *linphone_tunnel_config_new() {
33         LinphoneTunnelConfig *ltc = ms_new0(LinphoneTunnelConfig,1);
34         ltc->remote_udp_mirror_port = 12345;
35         ltc->delay = 1000;
36         return ltc;
37 }
38
39 void linphone_tunnel_config_set_host(LinphoneTunnelConfig *tunnel, const char *host) {
40         if(tunnel->host != NULL) {
41                 ms_free(tunnel->host);
42                 tunnel->host = NULL;
43         }
44         if(host != NULL && strlen(host)) {
45                 tunnel->host = ms_strdup(host);
46         }
47 }
48
49 const char *linphone_tunnel_config_get_host(const LinphoneTunnelConfig *tunnel) {
50         return tunnel->host;
51 }
52
53 void linphone_tunnel_config_set_port(LinphoneTunnelConfig *tunnel, int port) {
54         tunnel->port = port;
55 }
56
57 int linphone_tunnel_config_get_port(const LinphoneTunnelConfig *tunnel) {
58         return tunnel->port;
59 }
60
61 void linphone_tunnel_config_set_remote_udp_mirror_port(LinphoneTunnelConfig *tunnel, int remote_udp_mirror_port) {
62         tunnel->remote_udp_mirror_port = remote_udp_mirror_port;
63 }
64
65 int linphone_tunnel_config_get_remote_udp_mirror_port(const LinphoneTunnelConfig *tunnel) {
66         return tunnel->remote_udp_mirror_port;
67 }
68
69 void linphone_tunnel_config_set_delay(LinphoneTunnelConfig *tunnel, int delay) {
70         tunnel->delay = delay;
71 }
72
73 int linphone_tunnel_config_get_delay(const LinphoneTunnelConfig *tunnel) {
74         return tunnel->delay;
75 }
76
77 void linphone_tunnel_config_destroy(LinphoneTunnelConfig *tunnel) {
78         if(tunnel->host != NULL) {
79                 ms_free(tunnel->host);
80         }
81         ms_free(tunnel);
82 }
83