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
01e72828
Commit
01e72828
authored
Oct 06, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port libnice to the new NiceSocket API
parent
4d04f6a4
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
81 additions
and
84 deletions
+81
-84
agent/agent-priv.h
agent/agent-priv.h
+3
-3
agent/agent.c
agent/agent.c
+26
-26
agent/agent.h
agent/agent.h
+1
-1
agent/candidate.h
agent/candidate.h
+2
-2
agent/component.c
agent/component.c
+3
-4
agent/component.h
agent/component.h
+2
-2
agent/conncheck.c
agent/conncheck.c
+25
-25
agent/conncheck.h
agent/conncheck.h
+1
-1
agent/discovery.c
agent/discovery.c
+12
-12
agent/discovery.h
agent/discovery.h
+5
-5
nice/nice.h
nice/nice.h
+1
-3
No files found.
agent/agent-priv.h
View file @
01e72828
...
@@ -68,8 +68,8 @@ struct _NiceAgent
...
@@ -68,8 +68,8 @@ struct _NiceAgent
GObject
parent
;
/**< gobject pointer */
GObject
parent
;
/**< gobject pointer */
gboolean
full_mode
;
/**< property: full-mode */
gboolean
full_mode
;
/**< property: full-mode */
Nice
UDPSocketFactory
udp_socket_factory
;
/**< property: socket factory */
Nice
SocketFactory
*
udp_socket_factory
;
/**< property: socket factory */
Nice
UDPSocketFactory
relay_socket_factory
;
/**< property: socket factory */
Nice
SocketFactory
*
relay_socket_factory
;
/**< property: socket factory */
GTimeVal
next_check_tv
;
/**< property: next conncheck timestamp */
GTimeVal
next_check_tv
;
/**< property: next conncheck timestamp */
gchar
*
stun_server_ip
;
/**< property: STUN server IP */
gchar
*
stun_server_ip
;
/**< property: STUN server IP */
guint
stun_server_port
;
/**< property: STUN server port */
guint
stun_server_port
;
/**< property: STUN server port */
...
@@ -138,6 +138,6 @@ GSource *agent_timeout_add_with_context (NiceAgent *agent, guint interval, GSour
...
@@ -138,6 +138,6 @@ GSource *agent_timeout_add_with_context (NiceAgent *agent, guint interval, GSour
void
priv_attach_stream_component_socket
(
NiceAgent
*
agent
,
void
priv_attach_stream_component_socket
(
NiceAgent
*
agent
,
Stream
*
stream
,
Stream
*
stream
,
Component
*
component
,
Component
*
component
,
Nice
UDPSocket
*
udp_
socket
);
Nice
Socket
*
socket
);
#endif
/*_NICE_AGENT_PRIV_H */
#endif
/*_NICE_AGENT_PRIV_H */
agent/agent.c
View file @
01e72828
...
@@ -57,8 +57,7 @@
...
@@ -57,8 +57,7 @@
#include "debug.h"
#include "debug.h"
#include "udp.h"
#include "socket.h"
#include "udp-bsd.h"
#include "udp-turn.h"
#include "udp-turn.h"
#include "candidate.h"
#include "candidate.h"
#include "component.h"
#include "component.h"
...
@@ -377,8 +376,10 @@ nice_agent_init (NiceAgent *agent)
...
@@ -377,8 +376,10 @@ nice_agent_init (NiceAgent *agent)
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_USE_FINGERPRINT
);
STUN_AGENT_USAGE_USE_FINGERPRINT
);
nice_udp_bsd_socket_factory_init
(
&
agent
->
udp_socket_factory
);
agent
->
udp_socket_factory
=
nice_udp_turn_socket_factory_init
(
&
agent
->
relay_socket_factory
);
nice_socket_factory_new
(
NICE_SOCKET_FACTORY_UDP_BSD
);
agent
->
relay_socket_factory
=
nice_socket_factory_new
(
NICE_SOCKET_FACTORY_UDP_RELAY
);
agent
->
rng
=
nice_rng_new
();
agent
->
rng
=
nice_rng_new
();
priv_generate_tie_breaker
(
agent
);
priv_generate_tie_breaker
(
agent
);
...
@@ -1305,22 +1306,21 @@ _nice_agent_recv (
...
@@ -1305,22 +1306,21 @@ _nice_agent_recv (
NiceAgent
*
agent
,
NiceAgent
*
agent
,
Stream
*
stream
,
Stream
*
stream
,
Component
*
component
,
Component
*
component
,
Nice
UDPSocket
*
udp_
socket
,
Nice
Socket
*
socket
,
guint
buf_len
,
guint
buf_len
,
gchar
*
buf
)
gchar
*
buf
)
{
{
NiceAddress
from
;
NiceAddress
from
;
gint
len
;
gint
len
;
len
=
nice_udp_socket_recv
(
udp_socket
,
&
from
,
len
=
nice_socket_recv
(
socket
,
&
from
,
buf_len
,
buf
);
buf_len
,
buf
);
#ifndef NDEBUG
#ifndef NDEBUG
if
(
len
>=
0
)
{
if
(
len
>=
0
)
{
gchar
tmpbuf
[
INET6_ADDRSTRLEN
];
gchar
tmpbuf
[
INET6_ADDRSTRLEN
];
nice_address_to_string
(
&
from
,
tmpbuf
);
nice_address_to_string
(
&
from
,
tmpbuf
);
nice_debug
(
"Agent %p : Packet received on local socket %u from [%s]:%u (%u octets)."
,
agent
,
nice_debug
(
"Agent %p : Packet received on local socket %u from [%s]:%u (%u octets)."
,
agent
,
udp_
socket
->
fileno
,
tmpbuf
,
nice_address_get_port
(
&
from
),
len
);
socket
->
fileno
,
tmpbuf
,
nice_address_get_port
(
&
from
),
len
);
}
}
#endif
#endif
...
@@ -1341,7 +1341,7 @@ _nice_agent_recv (
...
@@ -1341,7 +1341,7 @@ _nice_agent_recv (
NiceCandidate
*
cand
=
i
->
data
;
NiceCandidate
*
cand
=
i
->
data
;
if
(
cand
->
type
==
NICE_CANDIDATE_TYPE_RELAYED
)
{
if
(
cand
->
type
==
NICE_CANDIDATE_TYPE_RELAYED
)
{
len
=
nice_udp_turn_socket_parse_recv
(
cand
->
sockptr
,
&
from
,
len
,
buf
,
&
from
,
buf
,
len
);
len
=
nice_udp_turn_socket_parse_recv
(
cand
->
sockptr
,
&
from
,
len
,
buf
,
&
from
,
buf
,
len
);
udp_
socket
=
cand
->
sockptr
;
socket
=
cand
->
sockptr
;
}
}
}
}
}
}
...
@@ -1352,7 +1352,7 @@ _nice_agent_recv (
...
@@ -1352,7 +1352,7 @@ _nice_agent_recv (
return
len
;
return
len
;
if
(
conn_check_handle_inbound_stun
(
agent
,
stream
,
component
,
udp_
socket
,
if
(
conn_check_handle_inbound_stun
(
agent
,
stream
,
component
,
socket
,
&
from
,
buf
,
len
))
&
from
,
buf
,
len
))
/* handled STUN message*/
/* handled STUN message*/
return
0
;
return
0
;
...
@@ -1399,7 +1399,7 @@ nice_agent_recv (
...
@@ -1399,7 +1399,7 @@ nice_agent_recv (
for
(
i
=
component
->
sockets
;
i
;
i
=
i
->
next
)
for
(
i
=
component
->
sockets
;
i
;
i
=
i
->
next
)
{
{
Nice
UDP
Socket
*
sockptr
=
i
->
data
;
NiceSocket
*
sockptr
=
i
->
data
;
FD_SET
(
sockptr
->
fileno
,
&
fds
);
FD_SET
(
sockptr
->
fileno
,
&
fds
);
max_fd
=
MAX
(
sockptr
->
fileno
,
max_fd
);
max_fd
=
MAX
(
sockptr
->
fileno
,
max_fd
);
...
@@ -1421,7 +1421,7 @@ nice_agent_recv (
...
@@ -1421,7 +1421,7 @@ nice_agent_recv (
for
(
j
=
0
;
j
<=
max_fd
;
j
++
)
for
(
j
=
0
;
j
<=
max_fd
;
j
++
)
if
(
FD_ISSET
(
j
,
&
fds
))
if
(
FD_ISSET
(
j
,
&
fds
))
{
{
Nice
UDP
Socket
*
socket
;
NiceSocket
*
socket
;
socket
=
component_find_udp_socket_by_fd
(
component
,
j
);
socket
=
component_find_udp_socket_by_fd
(
component
,
j
);
g_assert
(
socket
);
g_assert
(
socket
);
...
@@ -1454,7 +1454,7 @@ nice_agent_recv_sock (
...
@@ -1454,7 +1454,7 @@ nice_agent_recv_sock (
guint
buf_len
,
guint
buf_len
,
gchar
*
buf
)
gchar
*
buf
)
{
{
Nice
UDP
Socket
*
socket
;
NiceSocket
*
socket
;
Stream
*
stream
;
Stream
*
stream
;
Component
*
component
;
Component
*
component
;
guint
ret
=
0
;
guint
ret
=
0
;
...
@@ -1517,7 +1517,7 @@ nice_agent_poll_read (
...
@@ -1517,7 +1517,7 @@ nice_agent_poll_read (
for
(
j
=
component
->
sockets
;
j
;
j
=
j
->
next
)
for
(
j
=
component
->
sockets
;
j
;
j
=
j
->
next
)
{
{
Nice
UDP
Socket
*
sockptr
=
j
->
data
;
NiceSocket
*
sockptr
=
j
->
data
;
FD_SET
(
sockptr
->
fileno
,
&
fds
);
FD_SET
(
sockptr
->
fileno
,
&
fds
);
max_fd
=
MAX
(
sockptr
->
fileno
,
max_fd
);
max_fd
=
MAX
(
sockptr
->
fileno
,
max_fd
);
...
@@ -1554,7 +1554,7 @@ nice_agent_poll_read (
...
@@ -1554,7 +1554,7 @@ nice_agent_poll_read (
}
}
else
else
{
{
Nice
UDP
Socket
*
socket
=
NULL
;
NiceSocket
*
socket
=
NULL
;
Stream
*
stream
=
NULL
;
Stream
*
stream
=
NULL
;
Component
*
component
=
NULL
;
Component
*
component
=
NULL
;
gchar
buf
[
MAX_BUFFER_SIZE
];
gchar
buf
[
MAX_BUFFER_SIZE
];
...
@@ -1622,7 +1622,7 @@ nice_agent_send (
...
@@ -1622,7 +1622,7 @@ nice_agent_send (
if
(
component
->
selected_pair
.
local
!=
NULL
)
if
(
component
->
selected_pair
.
local
!=
NULL
)
{
{
Nice
UDP
Socket
*
sock
;
NiceSocket
*
sock
;
NiceAddress
*
addr
;
NiceAddress
*
addr
;
#ifndef NDEBUG
#ifndef NDEBUG
...
@@ -1636,7 +1636,7 @@ nice_agent_send (
...
@@ -1636,7 +1636,7 @@ nice_agent_send (
sock
=
component
->
selected_pair
.
local
->
sockptr
;
sock
=
component
->
selected_pair
.
local
->
sockptr
;
addr
=
&
component
->
selected_pair
.
remote
->
addr
;
addr
=
&
component
->
selected_pair
.
remote
->
addr
;
nice_
udp_
socket_send
(
sock
,
addr
,
len
,
buf
);
nice_socket_send
(
sock
,
addr
,
len
,
buf
);
component
->
media_after_tick
=
TRUE
;
component
->
media_after_tick
=
TRUE
;
ret
=
len
;
ret
=
len
;
...
@@ -1802,10 +1802,10 @@ nice_agent_dispose (GObject *object)
...
@@ -1802,10 +1802,10 @@ nice_agent_dispose (GObject *object)
if
(
G_OBJECT_CLASS
(
nice_agent_parent_class
)
->
dispose
)
if
(
G_OBJECT_CLASS
(
nice_agent_parent_class
)
->
dispose
)
G_OBJECT_CLASS
(
nice_agent_parent_class
)
->
dispose
(
object
);
G_OBJECT_CLASS
(
nice_agent_parent_class
)
->
dispose
(
object
);
nice_
udp_socket_factory_close
(
&
agent
->
udp_socket_factory
);
nice_
socket_factory_free
(
agent
->
udp_socket_factory
);
agent
->
udp_socket_factory
=
NULL
;
nice_
udp_socket_factory_close
(
&
agent
->
relay_socket_factory
);
nice_
socket_factory_free
(
agent
->
relay_socket_factory
);
agent
->
relay_socket_factory
=
NULL
;
g_static_rec_mutex_free
(
&
agent
->
mutex
);
g_static_rec_mutex_free
(
&
agent
->
mutex
);
}
}
...
@@ -1818,7 +1818,7 @@ struct _IOCtx
...
@@ -1818,7 +1818,7 @@ struct _IOCtx
NiceAgent
*
agent
;
NiceAgent
*
agent
;
Stream
*
stream
;
Stream
*
stream
;
Component
*
component
;
Component
*
component
;
Nice
UDP
Socket
*
socket
;
NiceSocket
*
socket
;
};
};
...
@@ -1827,7 +1827,7 @@ io_ctx_new (
...
@@ -1827,7 +1827,7 @@ io_ctx_new (
NiceAgent
*
agent
,
NiceAgent
*
agent
,
Stream
*
stream
,
Stream
*
stream
,
Component
*
component
,
Component
*
component
,
Nice
UDP
Socket
*
socket
)
NiceSocket
*
socket
)
{
{
IOCtx
*
ctx
;
IOCtx
*
ctx
;
...
@@ -1888,7 +1888,7 @@ void
...
@@ -1888,7 +1888,7 @@ void
priv_attach_stream_component_socket
(
NiceAgent
*
agent
,
priv_attach_stream_component_socket
(
NiceAgent
*
agent
,
Stream
*
stream
,
Stream
*
stream
,
Component
*
component
,
Component
*
component
,
Nice
UDPSocket
*
udp_
socket
)
Nice
Socket
*
socket
)
{
{
GIOChannel
*
io
;
GIOChannel
*
io
;
GSource
*
source
;
GSource
*
source
;
...
@@ -1897,11 +1897,11 @@ priv_attach_stream_component_socket (NiceAgent *agent,
...
@@ -1897,11 +1897,11 @@ priv_attach_stream_component_socket (NiceAgent *agent,
if
(
!
component
->
ctx
)
if
(
!
component
->
ctx
)
return
;
return
;
io
=
g_io_channel_unix_new
(
udp_
socket
->
fileno
);
io
=
g_io_channel_unix_new
(
socket
->
fileno
);
/* note: without G_IO_ERR the glib mainloop goes into
/* note: without G_IO_ERR the glib mainloop goes into
* busyloop if errors are encountered */
* busyloop if errors are encountered */
source
=
g_io_create_watch
(
io
,
G_IO_IN
|
G_IO_ERR
);
source
=
g_io_create_watch
(
io
,
G_IO_IN
|
G_IO_ERR
);
ctx
=
io_ctx_new
(
agent
,
stream
,
component
,
udp_
socket
);
ctx
=
io_ctx_new
(
agent
,
stream
,
component
,
socket
);
g_source_set_callback
(
source
,
(
GSourceFunc
)
nice_agent_g_source_cb
,
g_source_set_callback
(
source
,
(
GSourceFunc
)
nice_agent_g_source_cb
,
ctx
,
(
GDestroyNotify
)
io_ctx_free
);
ctx
,
(
GDestroyNotify
)
io_ctx_free
);
nice_debug
(
"Agent %p : Attach source %p (stream %u)."
,
agent
,
source
,
stream
->
id
);
nice_debug
(
"Agent %p : Attach source %p (stream %u)."
,
agent
,
source
,
stream
->
id
);
...
...
agent/agent.h
View file @
01e72828
...
@@ -41,7 +41,7 @@
...
@@ -41,7 +41,7 @@
#include <glib-object.h>
#include <glib-object.h>
#include "
udp
.h"
#include "
socket
.h"
#include "address.h"
#include "address.h"
#include "candidate.h"
#include "candidate.h"
#include "random.h"
#include "random.h"
...
...
agent/candidate.h
View file @
01e72828
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
#ifndef _CANDIDATE_H
#ifndef _CANDIDATE_H
#define _CANDIDATE_H
#define _CANDIDATE_H
#include "
udp
.h"
#include "
socket
.h"
G_BEGIN_DECLS
G_BEGIN_DECLS
...
@@ -76,7 +76,7 @@ struct _NiceCandidate
...
@@ -76,7 +76,7 @@ struct _NiceCandidate
guint
stream_id
;
guint
stream_id
;
guint
component_id
;
guint
component_id
;
gchar
foundation
[
NICE_CANDIDATE_MAX_FOUNDATION
];
gchar
foundation
[
NICE_CANDIDATE_MAX_FOUNDATION
];
Nice
UDP
Socket
*
sockptr
;
NiceSocket
*
sockptr
;
gchar
*
username
;
/* pointer to a NULL-terminated username string */
gchar
*
username
;
/* pointer to a NULL-terminated username string */
gchar
*
password
;
/* pointer to a NULL-terminated password string */
gchar
*
password
;
/* pointer to a NULL-terminated password string */
};
};
...
...
agent/component.c
View file @
01e72828
...
@@ -87,9 +87,8 @@ component_free (Component *cmp)
...
@@ -87,9 +87,8 @@ component_free (Component *cmp)
cmp
->
restart_candidate
=
NULL
;
cmp
->
restart_candidate
=
NULL
;
for
(
i
=
cmp
->
sockets
;
i
;
i
=
i
->
next
)
{
for
(
i
=
cmp
->
sockets
;
i
;
i
=
i
->
next
)
{
NiceUDPSocket
*
udpsocket
=
i
->
data
;
NiceSocket
*
udpsocket
=
i
->
data
;
nice_udp_socket_close
(
udpsocket
);
nice_socket_free
(
udpsocket
);
g_slice_free
(
NiceUDPSocket
,
udpsocket
);
}
}
for
(
i
=
cmp
->
gsources
;
i
;
i
=
i
->
next
)
{
for
(
i
=
cmp
->
gsources
;
i
;
i
=
i
->
next
)
{
...
@@ -130,7 +129,7 @@ component_find_udp_socket_by_fd (Component *component, guint fd)
...
@@ -130,7 +129,7 @@ component_find_udp_socket_by_fd (Component *component, guint fd)
for
(
i
=
component
->
sockets
;
i
;
i
=
i
->
next
)
for
(
i
=
component
->
sockets
;
i
;
i
=
i
->
next
)
{
{
Nice
UDP
Socket
*
sockptr
=
i
->
data
;
NiceSocket
*
sockptr
=
i
->
data
;
if
(
sockptr
->
fileno
==
fd
)
if
(
sockptr
->
fileno
==
fd
)
return
sockptr
;
return
sockptr
;
...
...
agent/component.h
View file @
01e72828
...
@@ -67,7 +67,7 @@ struct _CandidatePair
...
@@ -67,7 +67,7 @@ struct _CandidatePair
struct
_IncomingCheck
struct
_IncomingCheck
{
{
NiceAddress
from
;
NiceAddress
from
;
Nice
UDP
Socket
*
local_socket
;
NiceSocket
*
local_socket
;
uint32_t
priority
;
uint32_t
priority
;
gboolean
use_candidate
;
gboolean
use_candidate
;
};
};
...
@@ -79,7 +79,7 @@ struct _Component
...
@@ -79,7 +79,7 @@ struct _Component
NiceComponentState
state
;
NiceComponentState
state
;
GSList
*
local_candidates
;
/**< list of Candidate objs */
GSList
*
local_candidates
;
/**< list of Candidate objs */
GSList
*
remote_candidates
;
/**< list of Candidate objs */
GSList
*
remote_candidates
;
/**< list of Candidate objs */
GSList
*
sockets
;
/**< list of Nice
UDP
Socket objs */
GSList
*
sockets
;
/**< list of NiceSocket objs */
GSList
*
gsources
;
/**< list of GSource objs */
GSList
*
gsources
;
/**< list of GSource objs */
GSList
*
incoming_checks
;
/**< list of IncomingCheck objs */
GSList
*
incoming_checks
;
/**< list of IncomingCheck objs */
NiceAddress
turn_server
;
/**< TURN server address */
NiceAddress
turn_server
;
/**< TURN server address */
...
...
agent/conncheck.c
View file @
01e72828
This diff is collapsed.
Click to expand it.
agent/conncheck.h
View file @
01e72828
...
@@ -86,7 +86,7 @@ void conn_check_free (NiceAgent *agent);
...
@@ -86,7 +86,7 @@ void conn_check_free (NiceAgent *agent);
gboolean
conn_check_schedule_next
(
NiceAgent
*
agent
);
gboolean
conn_check_schedule_next
(
NiceAgent
*
agent
);
int
conn_check_send
(
NiceAgent
*
agent
,
CandidateCheckPair
*
pair
);
int
conn_check_send
(
NiceAgent
*
agent
,
CandidateCheckPair
*
pair
);
gboolean
conn_check_prune_stream
(
NiceAgent
*
agent
,
Stream
*
stream
);
gboolean
conn_check_prune_stream
(
NiceAgent
*
agent
,
Stream
*
stream
);
gboolean
conn_check_handle_inbound_stun
(
NiceAgent
*
agent
,
Stream
*
stream
,
Component
*
component
,
Nice
UDP
Socket
*
udp_socket
,
const
NiceAddress
*
from
,
gchar
*
buf
,
guint
len
);
gboolean
conn_check_handle_inbound_stun
(
NiceAgent
*
agent
,
Stream
*
stream
,
Component
*
component
,
NiceSocket
*
udp_socket
,
const
NiceAddress
*
from
,
gchar
*
buf
,
guint
len
);
gint
conn_check_compare
(
const
CandidateCheckPair
*
a
,
const
CandidateCheckPair
*
b
);
gint
conn_check_compare
(
const
CandidateCheckPair
*
a
,
const
CandidateCheckPair
*
b
);
void
conn_check_remote_candidates_set
(
NiceAgent
*
agent
);
void
conn_check_remote_candidates_set
(
NiceAgent
*
agent
);
...
...
agent/discovery.c
View file @
01e72828
...
@@ -281,7 +281,7 @@ NiceCandidate *discovery_add_local_host_candidate (
...
@@ -281,7 +281,7 @@ NiceCandidate *discovery_add_local_host_candidate (
NiceCandidate
*
candidate
;
NiceCandidate
*
candidate
;
Component
*
component
;
Component
*
component
;
Stream
*
stream
;
Stream
*
stream
;
Nice
UDP
Socket
*
udp_socket
=
NULL
;
NiceSocket
*
udp_socket
=
NULL
;
gboolean
errors
=
FALSE
;
gboolean
errors
=
FALSE
;
if
(
!
agent_find_component
(
agent
,
stream_id
,
component_id
,
&
stream
,
&
component
))
if
(
!
agent_find_component
(
agent
,
stream_id
,
component_id
,
&
stream
,
&
component
))
...
@@ -347,7 +347,7 @@ NiceCandidate *discovery_add_local_host_candidate (
...
@@ -347,7 +347,7 @@ NiceCandidate *discovery_add_local_host_candidate (
if
(
candidate
)
if
(
candidate
)
nice_candidate_free
(
candidate
),
candidate
=
NULL
;
nice_candidate_free
(
candidate
),
candidate
=
NULL
;
if
(
udp_socket
)
if
(
udp_socket
)
g_slice_free
(
NiceUDPSocket
,
udp_socket
);
nice_socket_free
(
udp_socket
);
}
}
return
candidate
;
return
candidate
;
...
@@ -365,7 +365,7 @@ discovery_add_server_reflexive_candidate (
...
@@ -365,7 +365,7 @@ discovery_add_server_reflexive_candidate (
guint
stream_id
,
guint
stream_id
,
guint
component_id
,
guint
component_id
,
NiceAddress
*
address
,
NiceAddress
*
address
,
Nice
UDP
Socket
*
base_socket
)
NiceSocket
*
base_socket
)
{
{
NiceCandidate
*
candidate
;
NiceCandidate
*
candidate
;
Component
*
component
;
Component
*
component
;
...
@@ -422,21 +422,21 @@ discovery_add_relay_candidate (
...
@@ -422,21 +422,21 @@ discovery_add_relay_candidate (
guint
stream_id
,
guint
stream_id
,
guint
component_id
,
guint
component_id
,
NiceAddress
*
address
,
NiceAddress
*
address
,
Nice
UDP
Socket
*
base_socket
)
NiceSocket
*
base_socket
)
{
{
NiceCandidate
*
candidate
;
NiceCandidate
*
candidate
;
Component
*
component
;
Component
*
component
;
Stream
*
stream
;
Stream
*
stream
;
gboolean
result
=
FALSE
;
gboolean
result
=
FALSE
;
gboolean
errors
=
FALSE
;
gboolean
errors
=
FALSE
;
Nice
UDP
Socket
*
relay_socket
=
NULL
;
NiceSocket
*
relay_socket
=
NULL
;
if
(
!
agent_find_component
(
agent
,
stream_id
,
component_id
,
&
stream
,
&
component
))
if
(
!
agent_find_component
(
agent
,
stream_id
,
component_id
,
&
stream
,
&
component
))
return
NULL
;
return
NULL
;
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_RELAYED
);
candidate
=
nice_candidate_new
(
NICE_CANDIDATE_TYPE_RELAYED
);
if
(
candidate
)
{
if
(
candidate
)
{
relay_socket
=
g_slice_new0
(
Nice
UDP
Socket
);
relay_socket
=
g_slice_new0
(
NiceSocket
);
if
(
relay_socket
)
{
if
(
relay_socket
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
)
*
1000
;
candidate
->
priority
=
nice_candidate_jingle_priority
(
candidate
)
*
1000
;
...
@@ -451,7 +451,7 @@ discovery_add_relay_candidate (
...
@@ -451,7 +451,7 @@ discovery_add_relay_candidate (
candidate
->
addr
=
*
address
;
candidate
->
addr
=
*
address
;
/* step: link to the base candidate+socket */
/* step: link to the base candidate+socket */
if
(
nice_udp_turn_create_socket_full
(
&
agent
->
relay_socket_factory
,
if
(
nice_udp_turn_create_socket_full
(
agent
->
relay_socket_factory
,
relay_socket
,
address
,
base_socket
,
&
component
->
turn_server
,
relay_socket
,
address
,
base_socket
,
&
component
->
turn_server
,
component
->
turn_username
,
component
->
turn_password
,
component
->
turn_username
,
component
->
turn_password
,
priv_agent_to_udp_turn_compatibility
(
agent
)))
{
priv_agent_to_udp_turn_compatibility
(
agent
)))
{
...
@@ -484,7 +484,7 @@ discovery_add_relay_candidate (
...
@@ -484,7 +484,7 @@ discovery_add_relay_candidate (
if
(
candidate
)
if
(
candidate
)
nice_candidate_free
(
candidate
),
candidate
=
NULL
;
nice_candidate_free
(
candidate
),
candidate
=
NULL
;
if
(
relay_socket
)
if
(
relay_socket
)
g_slice_free
(
Nice
UDP
Socket
,
relay_socket
);
g_slice_free
(
NiceSocket
,
relay_socket
);
}
}
return
candidate
;
return
candidate
;
}
}
...
@@ -501,7 +501,7 @@ discovery_add_peer_reflexive_candidate (
...
@@ -501,7 +501,7 @@ discovery_add_peer_reflexive_candidate (
guint
stream_id
,
guint
stream_id
,
guint
component_id
,
guint
component_id
,
NiceAddress
*
address
,
NiceAddress
*
address
,
Nice
UDP
Socket
*
base_socket
,
NiceSocket
*
base_socket
,
NiceCandidate
*
local
,
NiceCandidate
*
local
,
NiceCandidate
*
remote
)
NiceCandidate
*
remote
)
{
{
...
@@ -602,7 +602,7 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
...
@@ -602,7 +602,7 @@ NiceCandidate *discovery_learn_remote_peer_reflexive_candidate (
Component
*
component
,
Component
*
component
,
guint32
priority
,
guint32
priority
,
const
NiceAddress
*
remote_address
,
const
NiceAddress
*
remote_address
,
Nice
UDP
Socket
*
udp_socket
,
NiceSocket
*
udp_socket
,
NiceCandidate
*
local
,
NiceCandidate
*
local
,
NiceCandidate
*
remote
)
NiceCandidate
*
remote
)
{
{
...
@@ -751,7 +751,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
...
@@ -751,7 +751,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
stun_timer_start
(
&
cand
->
timer
);
stun_timer_start
(
&
cand
->
timer
);
/* send the conncheck */
/* send the conncheck */
nice_
udp_
socket_send
(
cand
->
nicesock
,
&
cand
->
server
,
nice_socket_send
(
cand
->
nicesock
,
&
cand
->
server
,
buffer_len
,
(
gchar
*
)
cand
->
stun_buffer
);
buffer_len
,
(
gchar
*
)
cand
->
stun_buffer
);
/* case: success, start waiting for the result */
/* case: success, start waiting for the result */
...
@@ -800,7 +800,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
...
@@ -800,7 +800,7 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
timeout
);
timeout
);
/* TODO retransmit */
/* TODO retransmit */
nice_
udp_
socket_send
(
cand
->
nicesock
,
&
cand
->
server
,
nice_socket_send
(
cand
->
nicesock
,
&
cand
->
server
,
stun_message_length
(
&
cand
->
stun_message
),
stun_message_length
(
&
cand
->
stun_message
),
(
gchar
*
)
cand
->
stun_buffer
);
(
gchar
*
)
cand
->
stun_buffer
);
...
...
agent/discovery.h
View file @
01e72828
...
@@ -48,7 +48,7 @@ struct _CandidateDiscovery
...
@@ -48,7 +48,7 @@ struct _CandidateDiscovery
NiceAgent
*
agent
;
/**< back pointer to owner */
NiceAgent
*
agent
;
/**< back pointer to owner */
NiceCandidateType
type
;
/**< candidate type STUN or TURN */
NiceCandidateType
type
;
/**< candidate type STUN or TURN */
guint
socket
;
/**< XXX: should be taken from local cand: existing socket to use */
guint
socket
;
/**< XXX: should be taken from local cand: existing socket to use */
Nice
UDP
Socket
*
nicesock
;
/**< XXX: should be taken from local cand: existing socket to use */
NiceSocket
*
nicesock
;
/**< XXX: should be taken from local cand: existing socket to use */
NiceAddress
server
;
/**< STUN/TURN server address */
NiceAddress
server
;
/**< STUN/TURN server address */
NiceAddress
*
interface
;
/**< Address of local interface */
NiceAddress
*
interface
;
/**< Address of local interface */
GTimeVal
next_tick
;
/**< next tick timestamp */
GTimeVal
next_tick
;
/**< next tick timestamp */
...
@@ -84,7 +84,7 @@ discovery_add_relay_candidate (
...
@@ -84,7 +84,7 @@ discovery_add_relay_candidate (
guint
stream_id
,
guint
stream_id
,
guint
component_id
,
guint
component_id
,
NiceAddress
*
address
,
NiceAddress
*
address
,
Nice
UDP
Socket
*
base_socket
);
NiceSocket
*
base_socket
);
NiceCandidate
*
NiceCandidate
*
discovery_add_server_reflexive_candidate
(
discovery_add_server_reflexive_candidate
(
...
@@ -92,7 +92,7 @@ discovery_add_server_reflexive_candidate (
...
@@ -92,7 +92,7 @@ discovery_add_server_reflexive_candidate (
guint
stream_id
,
guint
stream_id
,
guint
component_id
,
guint
component_id
,
NiceAddress
*
address
,
NiceAddress
*
address
,
Nice
UDP
Socket
*
base_socket
);
NiceSocket
*
base_socket
);
NiceCandidate
*
NiceCandidate
*
discovery_add_peer_reflexive_candidate
(
discovery_add_peer_reflexive_candidate
(
...
@@ -100,7 +100,7 @@ discovery_add_peer_reflexive_candidate (
...
@@ -100,7 +100,7 @@ discovery_add_peer_reflexive_candidate (
guint
stream_id
,
guint
stream_id
,
guint
component_id
,
guint
component_id
,
NiceAddress
*
address
,
NiceAddress
*
address
,
Nice
UDP
Socket
*
base_socket
,
NiceSocket
*
base_socket
,
NiceCandidate
*
local
,
NiceCandidate
*
local
,
NiceCandidate
*
remote
);
NiceCandidate
*
remote
);
...
@@ -111,7 +111,7 @@ discovery_learn_remote_peer_reflexive_candidate (
...
@@ -111,7 +111,7 @@ discovery_learn_remote_peer_reflexive_candidate (
Component
*
component
,
Component
*
component
,
guint32
priority
,
guint32
priority
,
const
NiceAddress
*
remote_address
,
const
NiceAddress
*
remote_address
,
Nice
UDP
Socket
*
udp_socket
,
NiceSocket
*
udp_socket
,
NiceCandidate
*
local
,
NiceCandidate
*
local
,
NiceCandidate
*
remote
);
NiceCandidate
*
remote
);
...
...
nice/nice.h
View file @
01e72828
...
@@ -38,9 +38,7 @@
...
@@ -38,9 +38,7 @@
#ifndef _NICE_H
#ifndef _NICE_H
#define _NICE_H
#define _NICE_H
#include "udp.h"
#include "socket.h"
#include "udp-bsd.h"
#include "udp-fake.h"
#include "agent.h"
#include "agent.h"
#include "random.h"
#include "random.h"
#include "random-glib.h"
#include "random-glib.h"
...
...
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