]> sjero.net Git - linphone/blob - coreapi/address.c
work in progress to use SAL in coreapi
[linphone] / coreapi / address.c
1 /*
2 linphone
3 Copyright (C) 2009  Simon MORLAT (simon.morlat@linphone.org)
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19
20 #include "linphonecore.h"
21 #include "lpconfig.h"
22 #include "private.h"
23
24 /**
25  * @addtogroup linphone_address
26  * @{
27 **/
28
29 /**
30  * Constructs a LinphoneAddress object by parsing the user supplied address,
31  * given as a string.
32 **/
33 LinphoneAddress * linphone_address_new(const char *addr){
34         return sal_address_new(addr);
35 }
36
37 /**
38  * Clones a LinphoneAddress object.
39 **/
40 LinphoneAddress * linphone_address_clone(const LinphoneAddress *addr){
41         return sal_address_clone(addr);
42 }
43
44 /**
45  * Returns the address scheme, normally "sip".
46 **/
47 const char *linphone_address_get_scheme(const LinphoneAddress *u){
48         return sal_address_get_scheme(u);
49 }
50
51 /**
52  * Returns the display name.
53 **/
54 const char *linphone_address_get_display_name(const LinphoneAddress* u){
55         return sal_address_get_display_name(u);
56 }
57
58 /**
59  * Returns the username.
60 **/
61 const char *linphone_address_get_username(const LinphoneAddress *u){
62         return sal_address_get_username(u);
63 }
64
65 /**
66  * Returns the domain name.
67 **/
68 const char *linphone_address_get_domain(const LinphoneAddress *u){
69         return sal_address_get_domain(u);
70 }
71
72 /**
73  * Sets the display name.
74 **/
75 void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name){
76         sal_address_set_display_name(u,display_name);
77 }
78
79 /**
80  * Sets the username.
81 **/
82 void linphone_address_set_username(LinphoneAddress *uri, const char *username){
83         sal_address_set_username(uri,username);
84 }
85
86 /**
87  * Sets the domain.
88 **/
89 void linphone_address_set_domain(LinphoneAddress *uri, const char *host){
90         sal_address_set_domain(uri,host);
91 }
92
93 /**
94  * Sets the port number.
95 **/
96 void linphone_address_set_port(LinphoneAddress *uri, const char *port){
97         sal_address_set_port(uri,port);
98 }
99
100 /**
101  * Sets the port number.
102 **/
103 void linphone_address_set_port_int(LinphoneAddress *uri, int port){
104         sal_address_set_port_int(uri,port);
105 }
106
107 /**
108  * Removes address's tags and uri headers so that it is displayable to the user.
109 **/
110 void linphone_address_clean(LinphoneAddress *uri){
111         sal_address_clean(uri);
112 }
113
114 /**
115  * Returns the address as a string.
116  * The returned char * must be freed by the application. Use ms_free().
117 **/
118 char *linphone_address_as_string(const LinphoneAddress *u){
119         return sal_address_as_string(u);
120 }
121
122 /**
123  * Returns the SIP uri only as a string, that is display name is removed.
124  * The returned char * must be freed by the application. Use ms_free().
125 **/
126 char *linphone_address_as_string_uri_only(const LinphoneAddress *u){
127         return sal_address_as_string_uri_only(u);
128 }
129
130 /**
131  * Destroys a LinphoneAddress object.
132 **/
133 void linphone_address_destroy(LinphoneAddress *u){
134         sal_address_destroy(u);
135 }
136
137
138 /** @} */