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
68d331dd
Commit
68d331dd
authored
Aug 04, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding turn support to libnice
parent
6e731d62
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
8 deletions
+64
-8
agent/agent-priv.h
agent/agent-priv.h
+2
-0
agent/agent.c
agent/agent.c
+62
-8
No files found.
agent/agent-priv.h
View file @
68d331dd
...
...
@@ -75,6 +75,8 @@ struct _NiceAgent
guint
stun_server_port
;
/**< property: STUN server port */
gchar
*
turn_server_ip
;
/**< property: TURN server IP */
guint
turn_server_port
;
/**< property: TURN server port */
gchar
*
turn_username
;
/**< property: TURN username */
gchar
*
turn_password
;
/**< property: TURN password */
gboolean
controlling_mode
;
/**< property: controlling-mode */
guint
timer_ta
;
/**< property: timer Ta */
guint
max_conn_checks
;
/**< property: max connectivity checks */
...
...
agent/agent.c
View file @
68d331dd
...
...
@@ -85,6 +85,8 @@ enum
PROP_STUN_SERVER_PORT
,
PROP_TURN_SERVER
,
PROP_TURN_SERVER_PORT
,
PROP_TURN_USERNAME
,
PROP_TURN_PASSWORD
,
PROP_CONTROLLING_MODE
,
PROP_FULL_MODE
,
PROP_STUN_PACING_TIMER
,
...
...
@@ -237,6 +239,22 @@ nice_agent_class_init (NiceAgentClass *klass)
1
,
/* not a construct property, ignored */
G_PARAM_READWRITE
));
g_object_class_install_property
(
gobject_class
,
PROP_TURN_USERNAME
,
g_param_spec_string
(
"turn-username"
,
"TURN server"
,
"The username to authenticate with the TURN relay server"
,
NULL
,
G_PARAM_READWRITE
));
g_object_class_install_property
(
gobject_class
,
PROP_TURN_PASSWORD
,
g_param_spec_string
(
"turn-password"
,
"TURN server"
,
"The password to authenticate with the TURN relay server"
,
NULL
,
G_PARAM_READWRITE
));
g_object_class_install_property
(
gobject_class
,
PROP_CONTROLLING_MODE
,
g_param_spec_boolean
(
"controlling-mode"
,
...
...
@@ -461,6 +479,14 @@ nice_agent_get_property (
g_value_set_uint
(
value
,
agent
->
turn_server_port
);
break
;
case
PROP_TURN_USERNAME
:
g_value_set_string
(
value
,
agent
->
turn_username
);
break
;
case
PROP_TURN_PASSWORD
:
g_value_set_string
(
value
,
agent
->
turn_password
);
break
;
case
PROP_CONTROLLING_MODE
:
g_value_set_boolean
(
value
,
agent
->
controlling_mode
);
break
;
...
...
@@ -536,6 +562,14 @@ nice_agent_set_property (
agent
->
turn_server_ip
=
g_value_dup_string
(
value
);
break
;
case
PROP_TURN_USERNAME
:
agent
->
turn_username
=
g_value_dup_string
(
value
);
break
;
case
PROP_TURN_PASSWORD
:
agent
->
turn_password
=
g_value_dup_string
(
value
);
break
;
case
PROP_CONTROLLING_MODE
:
agent
->
controlling_mode
=
g_value_get_boolean
(
value
);
break
;
...
...
@@ -670,7 +704,7 @@ agent_candidate_pair_priority (NiceAgent *agent, NiceCandidate *local, NiceCandi
}
static
gboolean
priv_add_srv_rfx_candidate_discovery
(
NiceAgent
*
agent
,
NiceCandidate
*
host_candidate
,
const
gchar
*
stun_server_ip
,
const
guint
stun_server_port
,
Stream
*
stream
,
guint
component_id
,
NiceAddress
*
addr
)
priv_add_srv_rfx_candidate_discovery
(
NiceAgent
*
agent
,
NiceCandidate
*
host_candidate
,
const
gchar
*
stun_server_ip
,
const
guint
stun_server_port
,
Stream
*
stream
,
guint
component_id
,
NiceAddress
*
addr
,
NiceCandidateType
type
)
{
CandidateDiscovery
*
cdisco
;
GSList
*
modified_list
;
...
...
@@ -683,7 +717,7 @@ priv_add_srv_rfx_candidate_discovery (NiceAgent *agent, NiceCandidate *host_cand
modified_list
=
g_slist_append
(
agent
->
discovery_list
,
cdisco
);
if
(
modified_list
)
{
cdisco
->
type
=
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
;
cdisco
->
type
=
type
;
cdisco
->
socket
=
host_candidate
->
sockptr
->
fileno
;
cdisco
->
nicesock
=
host_candidate
->
sockptr
;
cdisco
->
server_addr
=
stun_server_ip
;
...
...
@@ -703,6 +737,7 @@ priv_add_srv_rfx_candidate_discovery (NiceAgent *agent, NiceCandidate *host_cand
return
FALSE
;
}
/**
* nice_agent_add_stream:
* @agent: a NiceAgent
...
...
@@ -797,12 +832,31 @@ nice_agent_gather_candidates (
gboolean
res
=
priv_add_srv_rfx_candidate_discovery
(
agent
,
host_candidate
,
agent
->
stun_server_ip
,
agent
->
stun_server_port
,
stream
,
n
+
1
/* component-id */
,
addr
);
host_candidate
,
agent
->
stun_server_ip
,
agent
->
stun_server_port
,
stream
,
n
+
1
/* component-id */
,
addr
,
NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE
);
if
(
res
!=
TRUE
)
{
/* note: memory allocation failure, return error */
g_error
(
"Memory allocation failure?"
);
}
}
if
(
agent
->
full_mode
&&
agent
->
turn_server_ip
)
{
gboolean
res
=
priv_add_srv_rfx_candidate_discovery
(
agent
,
host_candidate
,
agent
->
turn_server_ip
,
agent
->
turn_server_port
,
stream
,
n
+
1
/* component-id */
,
addr
,
NICE_CANDIDATE_TYPE_RELAYED
);
if
(
res
!=
TRUE
)
{
/* note: memory allocation failure, return error */
...
...
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