Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
belle-sip
Commits
c74b3796
Commit
c74b3796
authored
Oct 18, 2016
by
Ghislain MARY
Browse files
Merge branch 'master' into dev_rat
parents
ff31776c
a25069ed
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
18 additions
and
49 deletions
+18
-49
CMakeLists.txt
CMakeLists.txt
+0
-1
configure.ac
configure.ac
+0
-13
include/belle-sip/listeningpoint.h
include/belle-sip/listeningpoint.h
+5
-0
src/belle_sip_resolver.c
src/belle_sip_resolver.c
+5
-0
src/channel.c
src/channel.c
+0
-4
src/listeningpoint_internal.h
src/listeningpoint_internal.h
+2
-6
src/transports/stream_listeningpoint.c
src/transports/stream_listeningpoint.c
+4
-17
src/transports/tls_listeningpoint.c
src/transports/tls_listeningpoint.c
+2
-8
No files found.
CMakeLists.txt
View file @
c74b3796
...
...
@@ -37,7 +37,6 @@ set(VERSION "${PACKAGE_VERSION}")
option
(
ENABLE_SHARED
"Build shared library."
YES
)
option
(
ENABLE_STATIC
"Build static library."
YES
)
option
(
ENABLE_RTP_MAP_ALWAYS_IN_SDP
"Always include rtpmap in SDP."
OFF
)
option
(
ENABLE_SERVER_SOCKETS
"Enable server sockets"
ON
)
option
(
ENABLE_STRICT
"Build with strict compile options."
YES
)
option
(
ENABLE_TUNNEL
"Enable tunnel support"
OFF
)
option
(
ENABLE_TESTS
"Enable compilation of tests"
ON
)
...
...
configure.ac
View file @
c74b3796
...
...
@@ -245,19 +245,6 @@ AC_SUBST(TLS_CFLAGS)
AC_SUBST(TLS_LIBS)
AC_SUBST(TLS_PC)
AC_ARG_ENABLE(server_sockets,
[AS_HELP_STRING([--disable-server-sockets], [Disable server sockets creation])],
[case "${enableval}" in
yes) server_sockets_enabled=true ;;
no) server_sockets_enabled=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-server-sockets) ;;
esac],
[server_sockets_enabled=yes]
)
if test "x$server_sockets_enabled" = "xyes" ; then
AC_DEFINE(ENABLE_SERVER_SOCKETS,1,[Defined when server sockets are enabled])
fi
AC_ARG_ENABLE(tunnel,
[AS_HELP_STRING([--enable-tunnel], [Enable tunnel support (default=no)])])
if test "$enable_tunnel" = "yes" ; then
...
...
include/belle-sip/listeningpoint.h
View file @
c74b3796
...
...
@@ -22,6 +22,11 @@
BELLE_SIP_BEGIN_DECLS
/*This is passed as port information to listening point URIs and means that it shall use a random port.*/
#define BELLE_SIP_LISTENING_POINT_RANDOM_PORT (-1)
/*This is passed as port information to listening point URIs and means that it shall not bind.*/
#define BELLE_SIP_LISTENING_POINT_DONT_BIND (-2)
BELLESIP_EXPORT
const
char
*
belle_sip_listening_point_get_ip_address
(
const
belle_sip_listening_point_t
*
lp
);
BELLESIP_EXPORT
int
belle_sip_listening_point_get_port
(
const
belle_sip_listening_point_t
*
lp
);
BELLESIP_EXPORT
const
char
*
belle_sip_listening_point_get_transport
(
const
belle_sip_listening_point_t
*
lp
);
...
...
src/belle_sip_resolver.c
View file @
c74b3796
...
...
@@ -969,6 +969,7 @@ belle_sip_resolver_context_t * belle_sip_stack_resolve(belle_sip_stack_t *stack,
ctx
->
cb_data
=
data
;
ctx
->
name
=
belle_sip_strdup
(
name
);
ctx
->
port
=
port
;
belle_sip_object_set_name
((
belle_sip_object_t
*
)
ctx
,
ctx
->
name
);
if
(
family
==
0
)
family
=
AF_UNSPEC
;
ctx
->
family
=
family
;
/*take a ref for the entire duration of the DNS procedure, it will be released when it is finished*/
...
...
@@ -998,6 +999,8 @@ static belle_sip_resolver_context_t * belle_sip_stack_resolve_single(belle_sip_s
ctx
->
name
=
belle_sip_strdup
(
name
);
ctx
->
port
=
port
;
ctx
->
flags
=
flags
;
belle_sip_object_set_name
((
belle_sip_object_t
*
)
ctx
,
ctx
->
name
);
if
(
family
==
0
)
family
=
AF_UNSPEC
;
ctx
->
family
=
family
;
ctx
->
type
=
(
ctx
->
family
==
AF_INET6
)
?
DNS_T_AAAA
:
DNS_T_A
;
...
...
@@ -1041,6 +1044,7 @@ static belle_sip_resolver_context_t * belle_sip_stack_resolve_dual(belle_sip_sta
ctx
->
cb_data
=
data
;
ctx
->
cb
=
cb
;
ctx
->
name
=
belle_sip_strdup
(
name
);
belle_sip_object_set_name
((
belle_sip_object_t
*
)
ctx
,
ctx
->
name
);
/*take a ref for the entire duration of the DNS procedure, it will be released when it is finished*/
belle_sip_object_ref
(
ctx
);
ctx
->
a_ctx
=
belle_sip_stack_resolve_single
(
stack
,
name
,
port
,
AF_INET
,
AI_V4MAPPED
,
on_ipv4_results
,
ctx
);
...
...
@@ -1085,6 +1089,7 @@ belle_sip_resolver_context_t * belle_sip_stack_resolve_srv(belle_sip_stack_t *st
ctx
->
srv_cb
=
cb
;
ctx
->
name
=
belle_sip_concat
(
srv_prefix
,
name
,
NULL
);
ctx
->
type
=
DNS_T_SRV
;
belle_sip_object_set_name
((
belle_sip_object_t
*
)
ctx
,
ctx
->
name
);
belle_sip_free
(
srv_prefix
);
return
(
belle_sip_resolver_context_t
*
)
resolver_start_query
(
ctx
);
}
...
...
src/channel.c
View file @
c74b3796
...
...
@@ -120,7 +120,6 @@ static void belle_sip_channel_destroy(belle_sip_channel_t *obj){
if
(
obj
->
resolver_ctx
!=
NULL
)
{
belle_sip_resolver_context_cancel
(
obj
->
resolver_ctx
);
belle_sip_object_unref
(
obj
->
resolver_ctx
);
}
if
(
obj
->
inactivity_timer
){
belle_sip_main_loop_remove_source
(
obj
->
stack
->
ml
,
obj
->
inactivity_timer
);
...
...
@@ -1418,9 +1417,6 @@ void belle_sip_channel_resolve(belle_sip_channel_t *obj){
else
obj
->
resolver_ctx
=
belle_sip_stack_resolve_a
(
obj
->
stack
,
obj
->
peer_name
,
obj
->
peer_port
,
obj
->
ai_family
,
channel_res_done
,
obj
);
if
(
obj
->
resolver_ctx
){
char
*
name
=
belle_sip_strdup_printf
(
"Channel resolver for %s"
,
obj
->
peer_name
);
belle_sip_object_set_name
((
belle_sip_object_t
*
)
obj
->
resolver_ctx
,
name
);
belle_sip_free
(
name
);
belle_sip_object_ref
(
obj
->
resolver_ctx
);
}
return
;
...
...
src/listeningpoint_internal.h
View file @
c74b3796
...
...
@@ -69,22 +69,18 @@ typedef struct belle_sip_stream_listening_point belle_sip_stream_listening_point
struct
belle_sip_stream_listening_point
{
belle_sip_listening_point_t
base
;
#ifdef ENABLE_SERVER_SOCKETS
belle_sip_socket_t
server_sock
;
belle_sip_source_t
*
source
;
#endif
/* ENABLE_SERVER_SOCKETS */
};
BELLE_SIP_DECLARE_CUSTOM_VPTR_BEGIN
(
belle_sip_stream_listening_point_t
,
belle_sip_listening_point_t
)
BELLE_SIP_DECLARE_CUSTOM_VPTR_END
#ifdef ENABLE_SERVER_SOCKETS
void
belle_sip_stream_listening_point_setup_server_socket
(
belle_sip_stream_listening_point_t
*
obj
,
belle_sip_source_func_t
on_new_connection_cb
);
void
belle_sip_stream_listening_point_destroy_server_socket
(
belle_sip_stream_listening_point_t
*
lp
);
void
belle_sip_stream_listening_point_init
(
belle_sip_stream_listening_point_t
*
obj
,
belle_sip_stack_t
*
s
,
const
char
*
ipaddress
,
int
port
,
belle_sip_source_func_t
on_new_connection_cb
);
#else
void
belle_sip_stream_listening_point_init
(
belle_sip_stream_listening_point_t
*
obj
,
belle_sip_stack_t
*
s
,
const
char
*
ipaddress
,
int
port
);
#endif
/* ENABLE_SERVER_SOCKETS */
belle_sip_listening_point_t
*
belle_sip_stream_listening_point_new
(
belle_sip_stack_t
*
s
,
const
char
*
ipaddress
,
int
port
);
/*tls*/
...
...
src/transports/stream_listeningpoint.c
View file @
c74b3796
...
...
@@ -17,7 +17,6 @@
*/
#include "belle_sip_internal.h"
#ifdef ENABLE_SERVER_SOCKETS
static
int
on_new_connection
(
void
*
userdata
,
unsigned
int
events
);
...
...
@@ -32,12 +31,9 @@ void belle_sip_stream_listening_point_destroy_server_socket(belle_sip_stream_lis
lp
->
source
=
NULL
;
}
}
#endif
/* ENABLE_SERVER_SOCKETS */
static
void
belle_sip_stream_listening_point_uninit
(
belle_sip_stream_listening_point_t
*
lp
){
#ifdef ENABLE_SERVER_SOCKETS
belle_sip_stream_listening_point_destroy_server_socket
(
lp
);
#endif
/* ENABLE_SERVER_SOCKETS */
}
static
belle_sip_channel_t
*
stream_create_channel
(
belle_sip_listening_point_t
*
lp
,
const
belle_sip_hop_t
*
hop
){
...
...
@@ -62,7 +58,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_stream_listening_point_t)
}
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
#ifdef ENABLE_SERVER_SOCKETS
static
belle_sip_socket_t
create_server_socket
(
const
char
*
addr
,
int
*
port
,
int
*
family
){
struct
addrinfo
hints
=
{
0
};
struct
addrinfo
*
res
=
NULL
;
...
...
@@ -165,28 +161,19 @@ static int on_new_connection(void *userdata, unsigned int events){
void
belle_sip_stream_listening_point_init
(
belle_sip_stream_listening_point_t
*
obj
,
belle_sip_stack_t
*
s
,
const
char
*
ipaddress
,
int
port
,
belle_sip_source_func_t
on_new_connection_cb
){
belle_sip_listening_point_init
((
belle_sip_listening_point_t
*
)
obj
,
s
,
ipaddress
,
port
);
belle_sip_stream_listening_point_setup_server_socket
(
obj
,
on_new_connection_cb
);
if
(
port
!=
BELLE_SIP_LISTENING_POINT_DONT_BIND
)
belle_sip_stream_listening_point_setup_server_socket
(
obj
,
on_new_connection_cb
);
}
#else
void
belle_sip_stream_listening_point_init
(
belle_sip_stream_listening_point_t
*
obj
,
belle_sip_stack_t
*
s
,
const
char
*
ipaddress
,
int
port
){
belle_sip_listening_point_init
((
belle_sip_listening_point_t
*
)
obj
,
s
,
ipaddress
,
port
);
}
#endif
/* ENABLE_SERVER_SOCKETS */
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
){
if
(
port
!=
BELLE_SIP_LISTENING_POINT_DONT_BIND
&&
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
);
}
src/transports/tls_listeningpoint.c
View file @
c74b3796
...
...
@@ -45,7 +45,7 @@ BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_BEGIN(belle_sip_tls_listening_point_t)
}
BELLE_SIP_INSTANCIATE_CUSTOM_VPTR_END
#ifdef ENABLE_SERVER_SOCKETS
static
int
on_new_connection
(
void
*
userdata
,
unsigned
int
revents
){
belle_sip_socket_t
child
;
struct
sockaddr_storage
addr
;
...
...
@@ -64,18 +64,12 @@ static int on_new_connection(void *userdata, unsigned int revents){
belle_sip_close_socket
(
child
);
return
BELLE_SIP_CONTINUE
;
}
#endif
/* ENABLE_SERVER_SOCKETS */
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 */
belle_sip_stream_listening_point_init
((
belle_sip_stream_listening_point_t
*
)
lp
,
s
,
ipaddress
,
port
,
on_new_connection
);
lp
->
crypto_config
=
belle_tls_crypto_config_new
();
return
BELLE_SIP_LISTENING_POINT
(
lp
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment