mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
Always use int values for getter/setter of LinphoneAddress port.
This commit is contained in:
parent
b3a6fd3619
commit
ae764ae952
11 changed files with 37 additions and 40 deletions
|
|
@ -106,18 +106,16 @@ void linphone_address_set_domain(LinphoneAddress *uri, const char *host){
|
|||
sal_address_set_domain(uri,host);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the port number.
|
||||
**/
|
||||
void linphone_address_set_port(LinphoneAddress *uri, const char *port){
|
||||
sal_address_set_port(uri,port);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the port number.
|
||||
**/
|
||||
void linphone_address_set_port_int(LinphoneAddress *uri, int port){
|
||||
void linphone_address_set_port(LinphoneAddress *uri, int port){
|
||||
#ifdef USE_BELLESIP
|
||||
sal_address_set_port(uri,port);
|
||||
#else
|
||||
sal_address_set_port_int(uri,port);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -159,8 +157,8 @@ bool_t linphone_address_weak_equal(const LinphoneAddress *a1, const LinphoneAddr
|
|||
int p1,p2;
|
||||
u1=linphone_address_get_username(a1);
|
||||
u2=linphone_address_get_username(a2);
|
||||
p1=linphone_address_get_port_int(a1);
|
||||
p2=linphone_address_get_port_int(a2);
|
||||
p1=linphone_address_get_port(a1);
|
||||
p2=linphone_address_get_port(a2);
|
||||
h1=linphone_address_get_domain(a1);
|
||||
h2=linphone_address_get_domain(a2);
|
||||
return strings_equals(u1,u2) && strings_equals(h1,h2) && p1==p2;
|
||||
|
|
@ -173,12 +171,13 @@ void linphone_address_destroy(LinphoneAddress *u){
|
|||
sal_address_unref(u);
|
||||
}
|
||||
|
||||
int linphone_address_get_port_int(const LinphoneAddress *u) {
|
||||
return sal_address_get_port_int(u);
|
||||
}
|
||||
|
||||
const char* linphone_address_get_port(const LinphoneAddress *u) {
|
||||
int linphone_address_get_port(const LinphoneAddress *u) {
|
||||
#ifdef USE_BELLESIP
|
||||
return sal_address_get_port(u);
|
||||
#else
|
||||
return sal_address_get_port_int(u);
|
||||
#endif
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
|
|
|||
|
|
@ -70,11 +70,7 @@ const char *sal_address_get_username(const SalAddress *addr){
|
|||
const char *sal_address_get_domain(const SalAddress *addr){
|
||||
SAL_ADDRESS_GET(addr,host)
|
||||
}
|
||||
const char * sal_address_get_port(const SalAddress *addr){
|
||||
ms_fatal("sal_address_get_port not implemented yet");
|
||||
return NULL;
|
||||
}
|
||||
int sal_address_get_port_int(const SalAddress *addr){
|
||||
int sal_address_get_port(const SalAddress *addr){
|
||||
belle_sip_header_address_t* header_addr = BELLE_SIP_HEADER_ADDRESS(addr);
|
||||
belle_sip_uri_t* uri = belle_sip_header_address_get_uri(header_addr);
|
||||
if (uri) {
|
||||
|
|
@ -112,11 +108,7 @@ void sal_address_set_domain(SalAddress *addr, const char *host){
|
|||
SAL_ADDRESS_SET(addr,host,host);
|
||||
}
|
||||
|
||||
void sal_address_set_port(SalAddress *addr, const char *port){
|
||||
SAL_ADDRESS_SET(addr,port,atoi(port));
|
||||
}
|
||||
|
||||
void sal_address_set_port_int(SalAddress *addr, int port){
|
||||
void sal_address_set_port(SalAddress *addr, int port){
|
||||
SAL_ADDRESS_SET(addr,port,port);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ int sal_add_listen_port(Sal *ctx, SalAddress* addr){
|
|||
int result;
|
||||
belle_sip_listening_point_t* lp = belle_sip_stack_create_listening_point(ctx->stack
|
||||
,sal_address_get_domain(addr)
|
||||
,sal_address_get_port_int(addr)
|
||||
,sal_address_get_port(addr)
|
||||
,sal_transport_to_string(sal_address_get_transport(addr)));
|
||||
if (lp) {
|
||||
belle_sip_listening_point_set_keep_alive(lp,ctx->keep_alive);
|
||||
|
|
@ -504,7 +504,7 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i
|
|||
SalAddress* sal_addr = sal_address_new(NULL);
|
||||
int result;
|
||||
sal_address_set_domain(sal_addr,addr);
|
||||
sal_address_set_port_int(sal_addr,port);
|
||||
sal_address_set_port(sal_addr,port);
|
||||
sal_address_set_transport(sal_addr,tr);
|
||||
result = sal_add_listen_port(ctx,sal_addr);
|
||||
sal_address_destroy(sal_addr);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ static void presence_refresher_listener(belle_sip_refresher_t* refresher, void*
|
|||
if (sal_op_get_contact_address(op)) {
|
||||
/*contact is also probably not good*/
|
||||
SalAddress* contact=sal_address_clone(sal_op_get_contact_address(op));
|
||||
sal_address_set_port_int(contact,-1);
|
||||
sal_address_set_port(contact,-1);
|
||||
sal_address_set_domain(contact,NULL);
|
||||
sal_op_set_contact_address(op,contact);
|
||||
sal_address_destroy(contact);
|
||||
|
|
|
|||
|
|
@ -2607,7 +2607,7 @@ static LinphoneAddress *get_fixed_contact(LinphoneCore *lc, LinphoneCall *call ,
|
|||
if (ctt!=NULL){
|
||||
/*otherwise use supllied localip*/
|
||||
linphone_address_set_domain(ctt,localip);
|
||||
linphone_address_set_port_int(ctt,linphone_core_get_sip_port(lc));
|
||||
linphone_address_set_port(ctt,linphone_core_get_sip_port(lc));
|
||||
ms_message("Contact has been fixed using local ip"/* to %s",ret*/);
|
||||
#ifdef USE_BELLESIP
|
||||
ret=ctt;
|
||||
|
|
|
|||
|
|
@ -1460,7 +1460,7 @@ static void update_primary_contact(LinphoneCore *lc){
|
|||
lc->sip_conf.loopback_only=TRUE;
|
||||
}else lc->sip_conf.loopback_only=FALSE;
|
||||
linphone_address_set_domain(url,tmp);
|
||||
linphone_address_set_port_int(url,linphone_core_get_sip_port (lc));
|
||||
linphone_address_set_port(url,linphone_core_get_sip_port (lc));
|
||||
guessed=linphone_address_as_string(url);
|
||||
lc->sip_conf.guessed_contact=guessed;
|
||||
linphone_address_destroy(url);
|
||||
|
|
@ -2395,7 +2395,11 @@ static MSList *make_routes_for_proxy(LinphoneProxyConfig *proxy, const LinphoneA
|
|||
if (transport){
|
||||
SalAddress *route=sal_address_new(NULL);
|
||||
sal_address_set_domain(route,sal_address_get_domain((SalAddress*)dest));
|
||||
#ifdef USE_BELLESIP
|
||||
sal_address_set_port(route,sal_address_get_port((SalAddress*)dest));
|
||||
#else
|
||||
sal_address_set_port_int(route,sal_address_get_port_int((SalAddress*)dest));
|
||||
#endif
|
||||
sal_address_set_transport_name(route,transport);
|
||||
ret=ms_list_append(ret,route);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,19 +183,13 @@ LINPHONE_PUBLIC const char *linphone_address_get_display_name(const LinphoneAddr
|
|||
LINPHONE_PUBLIC const char *linphone_address_get_username(const LinphoneAddress *u);
|
||||
LINPHONE_PUBLIC const char *linphone_address_get_domain(const LinphoneAddress *u);
|
||||
/**
|
||||
* Get port number as an integer value.
|
||||
*
|
||||
* Get port number as an integer value, -1 if not set.
|
||||
*/
|
||||
LINPHONE_PUBLIC int linphone_address_get_port_int(const LinphoneAddress *u);
|
||||
/**
|
||||
* Get port number, null if not present.
|
||||
*/
|
||||
LINPHONE_PUBLIC const char* linphone_address_get_port(const LinphoneAddress *u);
|
||||
LINPHONE_PUBLIC int linphone_address_get_port(const LinphoneAddress *u);
|
||||
LINPHONE_PUBLIC void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name);
|
||||
LINPHONE_PUBLIC void linphone_address_set_username(LinphoneAddress *uri, const char *username);
|
||||
LINPHONE_PUBLIC void linphone_address_set_domain(LinphoneAddress *uri, const char *host);
|
||||
LINPHONE_PUBLIC void linphone_address_set_port(LinphoneAddress *uri, const char *port);
|
||||
LINPHONE_PUBLIC void linphone_address_set_port_int(LinphoneAddress *uri, int port);
|
||||
LINPHONE_PUBLIC void linphone_address_set_port(LinphoneAddress *uri, int port);
|
||||
/*remove tags, params etc... so that it is displayable to the user*/
|
||||
LINPHONE_PUBLIC void linphone_address_clean(LinphoneAddress *uri);
|
||||
LINPHONE_PUBLIC char *linphone_address_as_string(const LinphoneAddress *u);
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ LinphoneAddress *guess_contact_for_register(LinphoneProxyConfig *obj){
|
|||
}
|
||||
#endif
|
||||
|
||||
linphone_address_set_port_int(contact,localport);
|
||||
linphone_address_set_port(contact,localport);
|
||||
linphone_address_set_domain(contact,localip);
|
||||
linphone_address_set_display_name(contact,NULL);
|
||||
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ void linphone_gtk_update_my_contact(GtkWidget *w){
|
|||
|
||||
linphone_address_set_display_name(parsed,displayname);
|
||||
linphone_address_set_username(parsed,username);
|
||||
linphone_address_set_port_int(parsed,port);
|
||||
linphone_address_set_port(parsed,port);
|
||||
contact=linphone_address_as_string(parsed);
|
||||
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"sip_address")),contact);
|
||||
linphone_core_set_primary_contact(linphone_gtk_get_core(),contact);
|
||||
|
|
|
|||
|
|
@ -83,16 +83,24 @@ const char *sal_address_get_display_name(const SalAddress* addr);
|
|||
const char *sal_address_get_display_name_unquoted(const SalAddress *addr);
|
||||
const char *sal_address_get_username(const SalAddress *addr);
|
||||
const char *sal_address_get_domain(const SalAddress *addr);
|
||||
#ifdef USE_BELLESIP
|
||||
int sal_address_get_port(const SalAddress *addr);
|
||||
#else
|
||||
const char * sal_address_get_port(const SalAddress *addr);
|
||||
int sal_address_get_port_int(const SalAddress *addr);
|
||||
#endif
|
||||
SalTransport sal_address_get_transport(const SalAddress* addr);
|
||||
const char* sal_address_get_transport_name(const SalAddress* addr);
|
||||
|
||||
void sal_address_set_display_name(SalAddress *addr, const char *display_name);
|
||||
void sal_address_set_username(SalAddress *addr, const char *username);
|
||||
void sal_address_set_domain(SalAddress *addr, const char *host);
|
||||
#ifdef USE_BELLESIP
|
||||
void sal_address_set_port(SalAddress *uri, int port);
|
||||
#else
|
||||
void sal_address_set_port(SalAddress *addr, const char *port);
|
||||
void sal_address_set_port_int(SalAddress *uri, int port);
|
||||
#endif
|
||||
void sal_address_clean(SalAddress *addr);
|
||||
char *sal_address_as_string(const SalAddress *u);
|
||||
char *sal_address_as_string_uri_only(const SalAddress *u);
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ static void tls_with_non_tls_server(){
|
|||
linphone_proxy_config_edit(proxy_cfg);
|
||||
addr=linphone_address_new(linphone_proxy_config_get_addr(proxy_cfg));
|
||||
snprintf(tmp,sizeof(tmp),"sip:%s:%i;transport=tls" ,linphone_address_get_domain(addr)
|
||||
,(linphone_address_get_port_int(addr)>0?linphone_address_get_port_int(addr):5060));
|
||||
,(linphone_address_get_port(addr)>0?linphone_address_get_port(addr):5060));
|
||||
linphone_proxy_config_set_server_addr(proxy_cfg,tmp);
|
||||
linphone_proxy_config_done(proxy_cfg);
|
||||
linphone_address_destroy(addr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue