static void belle_sip_listening_point_uninit(belle_sip_listening_point_t *lp){ char *tmp=belle_sip_object_to_string((belle_sip_object_t*)BELLE_SIP_LISTENING_POINT(lp)->listening_uri); belle_sip_listening_point_clean_channels(lp); belle_sip_message("Listening point [%p] on [%s] destroyed",lp, tmp); belle_sip_object_unref(lp->listening_uri); belle_sip_free(tmp); lp->channel_listener=NULL; /*does not unref provider*/ belle_sip_uninit_sockets(); belle_sip_listening_point_set_keep_alive(lp,-1); }
belle_sip_listening_point_t * belle_sip_tls_listening_point_new(belle_sip_stack_t *s, const char *ipaddress, int port){ belle_sip_tls_listening_point_t *lp=belle_sip_object_new(belle_sip_tls_listening_point_t); #ifdef ENABLE_SERVER_SOCKETS belle_sip_stream_listening_point_init((belle_sip_stream_listening_point_t*)lp,s,ipaddress,port,on_new_connection); #else belle_sip_stream_listening_point_init((belle_sip_stream_listening_point_t*)lp,s,ipaddress,port); #endif /* ENABLE_SERVER_SOCKETS */ lp->crypto_config=belle_tls_crypto_config_new(); return BELLE_SIP_LISTENING_POINT(lp); }
belle_sip_listening_point_t * belle_sip_tls_listening_point_new(belle_sip_stack_t *s, const char *ipaddress, int port){ belle_sip_tls_listening_point_t *lp=belle_sip_object_new(belle_sip_tls_listening_point_t); belle_sip_stream_listening_point_init((belle_sip_stream_listening_point_t*)lp,s,ipaddress,port,on_new_connection); lp->verify_exceptions=0; /*try to load "system" default root ca, wihtout warranty...*/ #ifdef __linux belle_sip_tls_listening_point_set_root_ca(lp,"/etc/ssl/certs"); #elif defined(__APPLE__) belle_sip_tls_listening_point_set_root_ca(lp,"/opt/local/share/curl/curl-ca-bundle.crt"); #endif return BELLE_SIP_LISTENING_POINT(lp); }
belle_sip_listening_point_t * belle_sip_stream_listening_point_new(belle_sip_stack_t *s, const char *ipaddress, int port){ belle_sip_stream_listening_point_t *lp=belle_sip_object_new(belle_sip_stream_listening_point_t); #ifdef ENABLE_SERVER_SOCKETS belle_sip_stream_listening_point_init(lp,s,ipaddress,port,on_new_connection); if (lp->server_sock==(belle_sip_socket_t)-1){ belle_sip_object_unref(lp); return NULL; } #else belle_sip_stream_listening_point_init(lp,s,ipaddress,port); #endif /* ENABLE_SERVER_SOCKETS */ return BELLE_SIP_LISTENING_POINT(lp); }
void belle_sip_listening_point_init(belle_sip_listening_point_t *lp, belle_sip_stack_t *s, const char *address, int port){ char *tmp; belle_sip_init_sockets(); lp->stack=s; lp->listening_uri=belle_sip_uri_create(NULL,address); belle_sip_object_ref(lp->listening_uri); belle_sip_uri_set_port(lp->listening_uri,port); belle_sip_uri_set_transport_param(lp->listening_uri,BELLE_SIP_OBJECT_VPTR(lp,belle_sip_listening_point_t)->transport); tmp=belle_sip_object_to_string((belle_sip_object_t*)BELLE_SIP_LISTENING_POINT(lp)->listening_uri); if (strchr(address,':')) { lp->ai_family=AF_INET6; } else { lp->ai_family=AF_INET; } belle_sip_message("Creating listening point [%p] on [%s]",lp, tmp); belle_sip_free(tmp); }