]> sjero.net Git - linphone/blob - coreapi/address.c
Merge branch 'dev_sal'
[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         SalAddress *saddr=sal_address_new(addr);
35         if (saddr==NULL) ms_error("Cannot create LinphoneAddress, bad uri [%s]",addr);
36         return saddr;
37 }
38
39 /**
40  * Clones a LinphoneAddress object.
41 **/
42 LinphoneAddress * linphone_address_clone(const LinphoneAddress *addr){
43         return sal_address_clone(addr);
44 }
45
46 /**
47  * Returns the address scheme, normally "sip".
48 **/
49 const char *linphone_address_get_scheme(const LinphoneAddress *u){
50         return sal_address_get_scheme(u);
51 }
52
53 /**
54  * Returns the display name.
55 **/
56 const char *linphone_address_get_display_name(const LinphoneAddress* u){
57         return sal_address_get_display_name(u);
58 }
59
60 /**
61  * Returns the username.
62 **/
63 const char *linphone_address_get_username(const LinphoneAddress *u){
64         return sal_address_get_username(u);
65 }
66
67 /**
68  * Returns the domain name.
69 **/
70 const char *linphone_address_get_domain(const LinphoneAddress *u){
71         return sal_address_get_domain(u);
72 }
73
74 /**
75  * Sets the display name.
76 **/
77 void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name){
78         sal_address_set_display_name(u,display_name);
79 }
80
81 /**
82  * Sets the username.
83 **/
84 void linphone_address_set_username(LinphoneAddress *uri, const char *username){
85         sal_address_set_username(uri,username);
86 }
87
88 /**
89  * Sets the domain.
90 **/
91 void linphone_address_set_domain(LinphoneAddress *uri, const char *host){
92         sal_address_set_domain(uri,host);
93 }
94
95 /**
96  * Sets the port number.
97 **/
98 void linphone_address_set_port(LinphoneAddress *uri, const char *port){
99         sal_address_set_port(uri,port);
100 }
101
102 /**
103  * Sets the port number.
104 **/
105 void linphone_address_set_port_int(LinphoneAddress *uri, int port){
106         sal_address_set_port_int(uri,port);
107 }
108
109 /**
110  * Removes address's tags and uri headers so that it is displayable to the user.
111 **/
112 void linphone_address_clean(LinphoneAddress *uri){
113         sal_address_clean(uri);
114 }
115
116 /**
117  * Returns the address as a string.
118  * The returned char * must be freed by the application. Use ms_free().
119 **/
120 char *linphone_address_as_string(const LinphoneAddress *u){
121         return sal_address_as_string(u);
122 }
123
124 /**
125  * Returns the SIP uri only as a string, that is display name is removed.
126  * The returned char * must be freed by the application. Use ms_free().
127 **/
128 char *linphone_address_as_string_uri_only(const LinphoneAddress *u){
129         return sal_address_as_string_uri_only(u);
130 }
131
132 /**
133  * Destroys a LinphoneAddress object.
134 **/
135 void linphone_address_destroy(LinphoneAddress *u){
136         sal_address_destroy(u);
137 }
138
139
140 /** @} */