Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libnice
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
libnice
Commits
6449dabb
Commit
6449dabb
authored
Feb 08, 2012
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://dhansak/srv/git.collabora.co.uk/git/libnice
Conflicts: configure.ac
parents
85229f99
50e8cf84
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
56 additions
and
30 deletions
+56
-30
agent/agent.c
agent/agent.c
+13
-10
agent/component.c
agent/component.c
+5
-0
agent/discovery.c
agent/discovery.c
+1
-1
socket/pseudossl.c
socket/pseudossl.c
+1
-1
socket/pseudossl.h
socket/pseudossl.h
+1
-2
socket/tcp-bsd.c
socket/tcp-bsd.c
+5
-4
socket/tcp-bsd.h
socket/tcp-bsd.h
+1
-2
socket/tcp-turn.c
socket/tcp-turn.c
+1
-1
socket/tcp-turn.h
socket/tcp-turn.h
+1
-1
socket/turn.c
socket/turn.c
+26
-6
socket/turn.h
socket/turn.h
+1
-2
No files found.
agent/agent.c
View file @
6449dabb
...
@@ -1409,7 +1409,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
...
@@ -1409,7 +1409,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
agent
->
proxy_ip
!=
NULL
&&
agent
->
proxy_ip
!=
NULL
&&
nice_address_set_from_string
(
&
proxy_server
,
agent
->
proxy_ip
))
{
nice_address_set_from_string
(
&
proxy_server
,
agent
->
proxy_ip
))
{
nice_address_set_port
(
&
proxy_server
,
agent
->
proxy_port
);
nice_address_set_port
(
&
proxy_server
,
agent
->
proxy_port
);
socket
=
nice_tcp_bsd_socket_new
(
agent
,
component
->
ctx
,
&
proxy_server
);
socket
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
proxy_server
);
if
(
socket
)
{
if
(
socket
)
{
_priv_set_socket_tos
(
agent
,
socket
,
stream
->
tos
);
_priv_set_socket_tos
(
agent
,
socket
,
stream
->
tos
);
...
@@ -1427,14 +1427,14 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
...
@@ -1427,14 +1427,14 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
}
}
if
(
socket
==
NULL
)
{
if
(
socket
==
NULL
)
{
socket
=
nice_tcp_bsd_socket_new
(
agent
,
component
->
ctx
,
&
turn
->
server
);
socket
=
nice_tcp_bsd_socket_new
(
agent
->
main_context
,
&
turn
->
server
);
_priv_set_socket_tos
(
agent
,
socket
,
stream
->
tos
);
_priv_set_socket_tos
(
agent
,
socket
,
stream
->
tos
);
}
}
if
(
turn
->
type
==
NICE_RELAY_TYPE_TURN_TLS
&&
if
(
turn
->
type
==
NICE_RELAY_TYPE_TURN_TLS
&&
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
socket
=
nice_pseudossl_socket_new
(
agent
,
socket
);
socket
=
nice_pseudossl_socket_new
(
socket
);
}
}
cdisco
->
nicesock
=
nice_tcp_turn_socket_new
(
agent
,
socket
,
cdisco
->
nicesock
=
nice_tcp_turn_socket_new
(
socket
,
agent_to_turn_socket_compatibility
(
agent
));
agent_to_turn_socket_compatibility
(
agent
));
agent_attach_stream_component_socket
(
agent
,
stream
,
agent_attach_stream_component_socket
(
agent
,
stream
,
...
@@ -2752,10 +2752,18 @@ nice_agent_attach_recv (
...
@@ -2752,10 +2752,18 @@ nice_agent_attach_recv (
ret
=
TRUE
;
ret
=
TRUE
;
component
->
g_source_io_cb
=
NULL
;
component
->
data
=
NULL
;
if
(
component
->
ctx
)
g_main_context_unref
(
component
->
ctx
);
component
->
ctx
=
NULL
;
if
(
func
)
{
if
(
func
)
{
component
->
g_source_io_cb
=
func
;
component
->
g_source_io_cb
=
func
;
component
->
data
=
data
;
component
->
data
=
data
;
component
->
ctx
=
ctx
;
component
->
ctx
=
ctx
;
if
(
ctx
)
g_main_context_ref
(
ctx
);
priv_attach_stream_component
(
agent
,
stream
,
component
);
priv_attach_stream_component
(
agent
,
stream
,
component
);
...
@@ -2768,13 +2776,8 @@ nice_agent_attach_recv (
...
@@ -2768,13 +2776,8 @@ nice_agent_attach_recv (
if
(
component
->
tcp
&&
component
->
tcp_data
&&
component
->
tcp_readable
)
if
(
component
->
tcp
&&
component
->
tcp_data
&&
component
->
tcp_readable
)
pseudo_tcp_socket_readable
(
component
->
tcp
,
component
->
tcp_data
);
pseudo_tcp_socket_readable
(
component
->
tcp
,
component
->
tcp_data
);
}
else
{
component
->
g_source_io_cb
=
NULL
;
component
->
data
=
NULL
;
component
->
ctx
=
NULL
;
}
}
done:
done:
agent_unlock
();
agent_unlock
();
return
ret
;
return
ret
;
...
@@ -2834,7 +2837,7 @@ GSource* agent_timeout_add_with_context (NiceAgent *agent, guint interval,
...
@@ -2834,7 +2837,7 @@ GSource* agent_timeout_add_with_context (NiceAgent *agent, guint interval,
{
{
GSource
*
source
;
GSource
*
source
;
g_return_val_if_fail
(
function
!=
NULL
,
0
);
g_return_val_if_fail
(
function
!=
NULL
,
NULL
);
source
=
g_timeout_source_new
(
interval
);
source
=
g_timeout_source_new
(
interval
);
...
...
agent/component.c
View file @
6449dabb
...
@@ -140,6 +140,11 @@ component_free (Component *cmp)
...
@@ -140,6 +140,11 @@ component_free (Component *cmp)
cmp
->
tcp_data
=
NULL
;
cmp
->
tcp_data
=
NULL
;
}
}
if
(
cmp
->
ctx
!=
NULL
)
{
g_main_context_unref
(
cmp
->
ctx
);
cmp
->
ctx
=
NULL
;
}
g_slice_free
(
Component
,
cmp
);
g_slice_free
(
Component
,
cmp
);
}
}
...
...
agent/discovery.c
View file @
6449dabb
...
@@ -600,7 +600,7 @@ discovery_add_relay_candidate (
...
@@ -600,7 +600,7 @@ discovery_add_relay_candidate (
candidate
->
turn
=
turn
;
candidate
->
turn
=
turn
;
/* step: link to the base candidate+socket */
/* step: link to the base candidate+socket */
relay_socket
=
nice_turn_socket_new
(
agent
,
address
,
relay_socket
=
nice_turn_socket_new
(
agent
->
main_context
,
address
,
base_socket
,
&
turn
->
server
,
base_socket
,
&
turn
->
server
,
turn
->
username
,
turn
->
password
,
turn
->
username
,
turn
->
password
,
agent_to_turn_socket_compatibility
(
agent
));
agent_to_turn_socket_compatibility
(
agent
));
...
...
socket/pseudossl.c
View file @
6449dabb
...
@@ -101,7 +101,7 @@ static void free_to_be_sent (struct to_be_sent *tbs);
...
@@ -101,7 +101,7 @@ static void free_to_be_sent (struct to_be_sent *tbs);
NiceSocket
*
NiceSocket
*
nice_pseudossl_socket_new
(
Nice
Agent
*
agent
,
Nice
Socket
*
base_socket
)
nice_pseudossl_socket_new
(
NiceSocket
*
base_socket
)
{
{
PseudoSSLPriv
*
priv
;
PseudoSSLPriv
*
priv
;
NiceSocket
*
sock
=
g_slice_new0
(
NiceSocket
);
NiceSocket
*
sock
=
g_slice_new0
(
NiceSocket
);
...
...
socket/pseudossl.h
View file @
6449dabb
...
@@ -38,13 +38,12 @@
...
@@ -38,13 +38,12 @@
#define _PSEUDOSSL_H
#define _PSEUDOSSL_H
#include "socket.h"
#include "socket.h"
#include "agent.h"
G_BEGIN_DECLS
G_BEGIN_DECLS
NiceSocket
*
NiceSocket
*
nice_pseudossl_socket_new
(
Nice
Agent
*
agent
,
Nice
Socket
*
base_socket
);
nice_pseudossl_socket_new
(
NiceSocket
*
base_socket
);
G_END_DECLS
G_END_DECLS
...
...
socket/tcp-bsd.c
View file @
6449dabb
...
@@ -54,7 +54,6 @@
...
@@ -54,7 +54,6 @@
#endif
#endif
typedef
struct
{
typedef
struct
{
NiceAgent
*
agent
;
NiceAddress
server_addr
;
NiceAddress
server_addr
;
GQueue
send_queue
;
GQueue
send_queue
;
GMainContext
*
context
;
GMainContext
*
context
;
...
@@ -86,7 +85,7 @@ static gboolean socket_send_more (GIOChannel *source, GIOCondition condition,
...
@@ -86,7 +85,7 @@ static gboolean socket_send_more (GIOChannel *source, GIOCondition condition,
gpointer
data
);
gpointer
data
);
NiceSocket
*
NiceSocket
*
nice_tcp_bsd_socket_new
(
NiceAgent
*
agent
,
GMainContext
*
ctx
,
NiceAddress
*
addr
)
nice_tcp_bsd_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
addr
)
{
{
int
sockfd
=
-
1
;
int
sockfd
=
-
1
;
int
ret
;
int
ret
;
...
@@ -163,8 +162,7 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr)
...
@@ -163,8 +162,7 @@ nice_tcp_bsd_socket_new (NiceAgent *agent, GMainContext *ctx, NiceAddress *addr)
sock
->
priv
=
priv
=
g_slice_new0
(
TcpPriv
);
sock
->
priv
=
priv
=
g_slice_new0
(
TcpPriv
);
priv
->
agent
=
agent
;
priv
->
context
=
g_main_context_ref
(
ctx
);
priv
->
context
=
ctx
;
priv
->
server_addr
=
*
addr
;
priv
->
server_addr
=
*
addr
;
priv
->
error
=
FALSE
;
priv
->
error
=
FALSE
;
...
@@ -197,6 +195,9 @@ socket_close (NiceSocket *sock)
...
@@ -197,6 +195,9 @@ socket_close (NiceSocket *sock)
g_queue_foreach
(
&
priv
->
send_queue
,
(
GFunc
)
free_to_be_sent
,
NULL
);
g_queue_foreach
(
&
priv
->
send_queue
,
(
GFunc
)
free_to_be_sent
,
NULL
);
g_queue_clear
(
&
priv
->
send_queue
);
g_queue_clear
(
&
priv
->
send_queue
);
if
(
priv
->
context
)
g_main_context_unref
(
priv
->
context
);
g_slice_free
(
TcpPriv
,
sock
->
priv
);
g_slice_free
(
TcpPriv
,
sock
->
priv
);
}
}
...
...
socket/tcp-bsd.h
View file @
6449dabb
...
@@ -38,13 +38,12 @@
...
@@ -38,13 +38,12 @@
#define _TCP_BSD_H
#define _TCP_BSD_H
#include "socket.h"
#include "socket.h"
#include "agent.h"
G_BEGIN_DECLS
G_BEGIN_DECLS
NiceSocket
*
NiceSocket
*
nice_tcp_bsd_socket_new
(
NiceAgent
*
agent
,
GMainContext
*
ctx
,
NiceAddress
*
addr
);
nice_tcp_bsd_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
addr
);
G_END_DECLS
G_END_DECLS
...
...
socket/tcp-turn.c
View file @
6449dabb
...
@@ -70,7 +70,7 @@ static gboolean socket_send (NiceSocket *sock, const NiceAddress *to,
...
@@ -70,7 +70,7 @@ static gboolean socket_send (NiceSocket *sock, const NiceAddress *to,
static
gboolean
socket_is_reliable
(
NiceSocket
*
sock
);
static
gboolean
socket_is_reliable
(
NiceSocket
*
sock
);
NiceSocket
*
NiceSocket
*
nice_tcp_turn_socket_new
(
Nice
Agent
*
agent
,
Nice
Socket
*
base_socket
,
nice_tcp_turn_socket_new
(
NiceSocket
*
base_socket
,
NiceTurnSocketCompatibility
compatibility
)
NiceTurnSocketCompatibility
compatibility
)
{
{
TurnTcpPriv
*
priv
;
TurnTcpPriv
*
priv
;
...
...
socket/tcp-turn.h
View file @
6449dabb
...
@@ -44,7 +44,7 @@ G_BEGIN_DECLS
...
@@ -44,7 +44,7 @@ G_BEGIN_DECLS
NiceSocket
*
NiceSocket
*
nice_tcp_turn_socket_new
(
Nice
Agent
*
agent
,
Nice
Socket
*
base_socket
,
nice_tcp_turn_socket_new
(
NiceSocket
*
base_socket
,
NiceTurnSocketCompatibility
compatibility
);
NiceTurnSocketCompatibility
compatibility
);
...
...
socket/turn.c
View file @
6449dabb
...
@@ -71,7 +71,7 @@ typedef struct {
...
@@ -71,7 +71,7 @@ typedef struct {
}
ChannelBinding
;
}
ChannelBinding
;
typedef
struct
{
typedef
struct
{
NiceAgent
*
nice
;
GMainContext
*
ctx
;
StunAgent
agent
;
StunAgent
agent
;
GList
*
channels
;
GList
*
channels
;
GList
*
pending_bindings
;
GList
*
pending_bindings
;
...
@@ -161,7 +161,7 @@ priv_send_data_queue_destroy (gpointer data)
...
@@ -161,7 +161,7 @@ priv_send_data_queue_destroy (gpointer data)
}
}
NiceSocket
*
NiceSocket
*
nice_turn_socket_new
(
NiceAgent
*
agent
,
NiceAddress
*
addr
,
nice_turn_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
addr
,
NiceSocket
*
base_socket
,
NiceAddress
*
server_addr
,
NiceSocket
*
base_socket
,
NiceAddress
*
server_addr
,
gchar
*
username
,
gchar
*
password
,
gchar
*
username
,
gchar
*
password
,
NiceTurnSocketCompatibility
compatibility
)
NiceTurnSocketCompatibility
compatibility
)
...
@@ -198,10 +198,11 @@ nice_turn_socket_new (NiceAgent *agent, NiceAddress *addr,
...
@@ -198,10 +198,11 @@ nice_turn_socket_new (NiceAgent *agent, NiceAddress *addr,
STUN_AGENT_USAGE_NO_ALIGNED_ATTRIBUTES
);
STUN_AGENT_USAGE_NO_ALIGNED_ATTRIBUTES
);
}
}
priv
->
nice
=
agent
;
priv
->
channels
=
NULL
;
priv
->
channels
=
NULL
;
priv
->
current_binding
=
NULL
;
priv
->
current_binding
=
NULL
;
priv
->
base_socket
=
base_socket
;
priv
->
base_socket
=
base_socket
;
if
(
ctx
)
priv
->
ctx
=
g_main_context_ref
(
ctx
);
if
(
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_MSN
||
if
(
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_MSN
||
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_OC2007
)
{
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_OC2007
)
{
...
@@ -291,6 +292,9 @@ socket_close (NiceSocket *sock)
...
@@ -291,6 +292,9 @@ socket_close (NiceSocket *sock)
if
(
priv
->
permission_timeout_source
)
if
(
priv
->
permission_timeout_source
)
g_source_remove
(
priv
->
permission_timeout_source
);
g_source_remove
(
priv
->
permission_timeout_source
);
if
(
priv
->
ctx
)
g_main_context_unref
(
priv
->
ctx
);
g_free
(
priv
->
current_binding
);
g_free
(
priv
->
current_binding
);
g_free
(
priv
->
current_binding_msg
);
g_free
(
priv
->
current_binding_msg
);
g_free
(
priv
->
current_create_permission_msg
);
g_free
(
priv
->
current_create_permission_msg
);
...
@@ -321,6 +325,22 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
...
@@ -321,6 +325,22 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
return
recv_len
;
return
recv_len
;
}
}
static
GSource
*
priv_timeout_add_with_context
(
TurnPriv
*
priv
,
guint
interval
,
GSourceFunc
function
,
gpointer
data
)
{
GSource
*
source
;
g_return_val_if_fail
(
function
!=
NULL
,
NULL
);
source
=
g_timeout_source_new
(
interval
);
g_source_set_callback
(
source
,
function
,
data
,
NULL
);
g_source_attach
(
source
,
priv
->
ctx
);
return
source
;
}
static
StunMessageReturn
static
StunMessageReturn
stun_message_append_ms_connection_id
(
StunMessage
*
msg
,
stun_message_append_ms_connection_id
(
StunMessage
*
msg
,
uint8_t
*
ms_connection_id
,
uint32_t
ms_sequence_num
)
uint8_t
*
ms_connection_id
,
uint32_t
ms_sequence_num
)
...
@@ -557,7 +577,7 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
...
@@ -557,7 +577,7 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
req
->
priv
=
priv
;
req
->
priv
=
priv
;
stun_message_id
(
&
msg
,
req
->
id
);
stun_message_id
(
&
msg
,
req
->
id
);
req
->
source
=
agent_timeout_add_with_context
(
priv
->
nice
,
req
->
source
=
priv_timeout_add_with_context
(
priv
,
STUN_END_TIMEOUT
,
priv_forget_send_request
,
req
);
STUN_END_TIMEOUT
,
priv_forget_send_request
,
req
);
g_queue_push_tail
(
priv
->
send_requests
,
req
);
g_queue_push_tail
(
priv
->
send_requests
,
req
);
}
}
...
@@ -1275,7 +1295,7 @@ priv_schedule_tick (TurnPriv *priv)
...
@@ -1275,7 +1295,7 @@ priv_schedule_tick (TurnPriv *priv)
guint
timeout
=
stun_timer_remainder
(
&
priv
->
current_binding_msg
->
timer
);
guint
timeout
=
stun_timer_remainder
(
&
priv
->
current_binding_msg
->
timer
);
if
(
timeout
>
0
)
{
if
(
timeout
>
0
)
{
priv
->
tick_source_channel_bind
=
priv
->
tick_source_channel_bind
=
agent_timeout_add_with_context
(
priv
->
nice
,
timeout
,
priv_timeout_add_with_context
(
priv
,
timeout
,
priv_retransmissions_tick
,
priv
);
priv_retransmissions_tick
,
priv
);
}
else
{
}
else
{
priv_retransmissions_tick_unlocked
(
priv
);
priv_retransmissions_tick_unlocked
(
priv
);
...
@@ -1288,7 +1308,7 @@ priv_schedule_tick (TurnPriv *priv)
...
@@ -1288,7 +1308,7 @@ priv_schedule_tick (TurnPriv *priv)
if
(
timeout
>
0
)
{
if
(
timeout
>
0
)
{
priv
->
tick_source_create_permission
=
priv
->
tick_source_create_permission
=
agent_timeout_add_with_context
(
priv
->
nice
,
priv_timeout_add_with_context
(
priv
,
timeout
,
timeout
,
priv_retransmissions_create_permission_tick
,
priv_retransmissions_create_permission_tick
,
priv
);
priv
);
...
...
socket/turn.h
View file @
6449dabb
...
@@ -47,7 +47,6 @@ typedef enum {
...
@@ -47,7 +47,6 @@ typedef enum {
}
NiceTurnSocketCompatibility
;
}
NiceTurnSocketCompatibility
;
#include "socket.h"
#include "socket.h"
#include "agent.h"
#include "stun/stunmessage.h"
#include "stun/stunmessage.h"
...
@@ -62,7 +61,7 @@ gboolean
...
@@ -62,7 +61,7 @@ gboolean
nice_turn_socket_set_peer
(
NiceSocket
*
sock
,
NiceAddress
*
peer
);
nice_turn_socket_set_peer
(
NiceSocket
*
sock
,
NiceAddress
*
peer
);
NiceSocket
*
NiceSocket
*
nice_turn_socket_new
(
NiceAgent
*
agent
,
NiceAddress
*
addr
,
nice_turn_socket_new
(
GMainContext
*
ctx
,
NiceAddress
*
addr
,
NiceSocket
*
base_socket
,
NiceAddress
*
server_addr
,
NiceSocket
*
base_socket
,
NiceAddress
*
server_addr
,
gchar
*
username
,
gchar
*
password
,
NiceTurnSocketCompatibility
compatibility
);
gchar
*
username
,
gchar
*
password
,
NiceTurnSocketCompatibility
compatibility
);
...
...
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