예제 #1
0
파일: sal_impl.c 프로젝트: CTA/linphone
static int sal_add_listen_port(Sal *ctx, SalAddress* addr, bool_t is_tunneled){
	int result;
	belle_sip_listening_point_t* lp;
	if (is_tunneled){
#ifdef TUNNEL_ENABLED
		if (sal_address_get_transport(addr)!=SalTransportUDP){
			ms_error("Tunneled mode is only available for UDP kind of transports.");
			return -1;
		}
		lp = belle_sip_tunnel_listening_point_new(ctx->stack, ctx->tunnel_client);
		if (!lp){
			ms_error("Could not create tunnel listening point.");
			return -1;
		}
#else
		ms_error("No tunnel support in library.");
		return -1;
#endif
	}else{
		lp = belle_sip_stack_create_listening_point(ctx->stack,
									sal_address_get_domain(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);
		result = belle_sip_provider_add_listening_point(ctx->prov,lp);
		if (sal_address_get_transport(addr)==SalTransportTLS) {
			set_tls_properties(ctx);
		}
	} else {
		return -1;
	}
	return result;
}
예제 #2
0
void sal_set_root_ca(Sal* ctx, const char* rootCa){
	if (ctx->root_ca){
		ms_free(ctx->root_ca);
		ctx->root_ca=NULL;
	}
	if (rootCa)
		ctx->root_ca=ms_strdup(rootCa);
	set_tls_properties(ctx);
	return ;
}
예제 #3
0
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_transport_to_string(sal_address_get_transport(addr)));
	if (lp) {
		belle_sip_listening_point_set_keep_alive(lp,ctx->keep_alive);
		result = belle_sip_provider_add_listening_point(ctx->prov,lp);
		set_tls_properties(ctx);
	} else {
		return -1;
	}
	return result;
}
예제 #4
0
int sal_enable_tunnel(Sal *ctx, void *tunnelclient) {
#ifdef TUNNEL_ENABLED
	belle_sip_listening_point_t *lp;
	int result;

	sal_unlisten_ports(ctx);
	lp = belle_sip_tunnel_listening_point_new(ctx->stack, tunnelclient);
	if (lp == NULL) return -1;

	belle_sip_listening_point_set_keep_alive(lp, ctx->keep_alive);
	result = belle_sip_provider_add_listening_point(ctx->prov, lp);
	set_tls_properties(ctx);
	return result;
#else
	return 0;
#endif
}
예제 #5
0
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(addr),
									sal_transport_to_string(sal_address_get_transport(addr)));
	if (sal_address_get_port(addr)==-1 && lp==NULL){
		int random_port=(0xDFFF&random())+1024;
		ms_warning("This version of belle-sip doesn't support random port, choosing one here.");
		lp = belle_sip_stack_create_listening_point(ctx->stack,
						sal_address_get_domain(addr),
						random_port,
						sal_transport_to_string(sal_address_get_transport(addr)));
	}
	if (lp) {
		belle_sip_listening_point_set_keep_alive(lp,ctx->keep_alive);
		result = belle_sip_provider_add_listening_point(ctx->prov,lp);
		if (sal_address_get_transport(addr)==SalTransportTLS) set_tls_properties(ctx);
	} else {
		return -1;
	}
	return result;
}
예제 #6
0
void sal_verify_server_cn(Sal *ctx, bool_t verify){
	ctx->tls_verify_cn=verify;
	set_tls_properties(ctx);
	return ;
}
예제 #7
0
파일: sal_impl.c 프로젝트: CTA/linphone
void sal_set_ssl_config(Sal *ctx, void *ssl_config) {
	ctx->ssl_config = ssl_config;
	set_tls_properties(ctx);
	return ;
}