Commit 4ec52ea7 authored by Simon Morlat's avatar Simon Morlat

Merge branch 'master' of git.sv.gnu.org:/srv/git/linphone

parents 451c2ae3 e545c638
......@@ -1417,13 +1417,13 @@ static int apply_transports(LinphoneCore *lc){
sal_unlisten_ports (sal);
if (tr->udp_port>0){
if (sal_listen_port (sal,anyaddr,tr->udp_port,SalTransportDatagram,FALSE)!=0){
if (sal_listen_port (sal,anyaddr,tr->udp_port,SalTransportUDP,FALSE)!=0){
transport_error(lc,"UDP",tr->udp_port);
return -1;
}
}
if (tr->tcp_port>0){
if (sal_listen_port (sal,anyaddr,tr->tcp_port,SalTransportStream,FALSE)!=0){
if (sal_listen_port (sal,anyaddr,tr->tcp_port,SalTransportTCP,FALSE)!=0){
transport_error(lc,"TCP",tr->tcp_port);
}
}
......
......@@ -259,7 +259,7 @@ static char *guess_contact_for_register(LinphoneProxyConfig *obj){
linphone_core_get_sip_transports(obj->lc,&tr);
if (tr.udp_port <= 0 && tr.tcp_port>0) {
sal_address_add_param(contact,"transport","tcp");
sal_address_set_param(contact,"transport","TCP");
}
ret=linphone_address_as_string(contact);
linphone_address_destroy(contact);
......
......@@ -24,7 +24,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**/
#include "sal.h"
const char* sal_transport_to_string(SalTransport transport) {
switch (transport) {
case SalTransportUDP:return "UDP";
case SalTransportTCP: return "TCP";
case SalTransportTLS:return "TLS";
case SalTransportDTLS:return "DTLS";
default: {
ms_fatal("Unexpected transport [%i]",transport);
return NULL;
}
}
}
SalTransport sal_transport_parse(const char* param) {
if (strcasecmp("UDP",param)==0) return SalTransportUDP;
if (strcasecmp("TCP",param)==0) return SalTransportTCP;
if (strcasecmp("TLS",param)==0) return SalTransportTLS;
if (strcasecmp("DTLS",param)==0) return SalTransportDTLS;
ms_error("Unkown transport type[%s], returning UDP", param);
return SalTransportUDP;
}
SalMediaDescription *sal_media_description_new(){
SalMediaDescription *md=ms_new0(SalMediaDescription,1);
md->refcount=1;
......
......@@ -40,6 +40,15 @@ struct SalAddress;
typedef struct SalAddress SalAddress;
typedef enum {
SalTransportUDP, /*UDP*/
SalTransportTCP, /*TCP*/
SalTransportTLS, /*TLS*/
SalTransportDTLS /*DTLS*/
}SalTransport;
const char* sal_transport_to_string(SalTransport transport);
SalTransport sal_transport_parse(const char*);
/* Address manipulation API*/
SalAddress * sal_address_new(const char *uri);
SalAddress * sal_address_clone(const SalAddress *addr);
......@@ -49,7 +58,8 @@ 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);
const char * sal_address_get_port(const SalAddress *addr);
int sal_address_get_port_int(const SalAddress *uri);
int sal_address_get_port_int(const SalAddress *addr);
SalTransport sal_address_get_transport(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);
......@@ -60,8 +70,8 @@ void sal_address_clean(SalAddress *addr);
char *sal_address_as_string(const SalAddress *u);
char *sal_address_as_string_uri_only(const SalAddress *u);
void sal_address_destroy(SalAddress *u);
void sal_address_add_param(SalAddress *u,const char* name,const char* value);
void sal_address_set_param(SalAddress *u,const char* name,const char* value);
void sal_address_set_transport(SalAddress* addr,SalTransport transport);
Sal * sal_init();
......@@ -69,10 +79,6 @@ void sal_uninit(Sal* sal);
void sal_set_user_pointer(Sal *sal, void *user_data);
void *sal_get_user_pointer(const Sal *sal);
typedef enum {
SalTransportDatagram,
SalTransportStream
}SalTransport;
typedef enum {
SalAudio,
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment