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
100a31fc
Commit
100a31fc
authored
Apr 22, 2014
by
Olivier Crête
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
agent: Factor out creating the TurnServer structure
parent
59a23cfe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
11 deletions
+29
-11
agent/agent.c
agent/agent.c
+2
-11
agent/component.c
agent/component.c
+22
-0
agent/component.h
agent/component.h
+5
-0
No files found.
agent/agent.c
View file @
100a31fc
...
@@ -1930,22 +1930,13 @@ nice_agent_set_relay_info(NiceAgent *agent,
...
@@ -1930,22 +1930,13 @@ nice_agent_set_relay_info(NiceAgent *agent,
goto
done
;
goto
done
;
}
}
turn
=
g_slice_new0
(
TurnServer
);
turn
=
turn_server_new
(
server_ip
,
server_port
,
username
,
password
,
type
);
nice_address_init
(
&
turn
->
server
);
if
(
!
turn
)
{
if
(
nice_address_set_from_string
(
&
turn
->
server
,
server_ip
))
{
nice_address_set_port
(
&
turn
->
server
,
server_port
);
}
else
{
g_slice_free
(
TurnServer
,
turn
);
ret
=
FALSE
;
ret
=
FALSE
;
goto
done
;
goto
done
;
}
}
turn
->
username
=
g_strdup
(
username
);
turn
->
password
=
g_strdup
(
password
);
turn
->
type
=
type
;
nice_debug
(
"Agent %p: added relay server [%s]:%d of type %d to s/c %d/%d "
nice_debug
(
"Agent %p: added relay server [%s]:%d of type %d to s/c %d/%d "
"with user/pass : %s -- %s"
,
agent
,
server_ip
,
server_port
,
type
,
"with user/pass : %s -- %s"
,
agent
,
server_ip
,
server_port
,
type
,
stream_id
,
component_id
,
username
,
password
);
stream_id
,
component_id
,
username
,
password
);
...
...
agent/component.c
View file @
100a31fc
...
@@ -1070,3 +1070,25 @@ component_input_source_new (NiceAgent *agent, guint stream_id,
...
@@ -1070,3 +1070,25 @@ component_input_source_new (NiceAgent *agent, guint stream_id,
return
(
GSource
*
)
component_source
;
return
(
GSource
*
)
component_source
;
}
}
TurnServer
*
turn_server_new
(
const
gchar
*
server_ip
,
guint
server_port
,
const
gchar
*
username
,
const
gchar
*
password
,
NiceRelayType
type
)
{
TurnServer
*
turn
=
g_slice_new
(
TurnServer
);
nice_address_init
(
&
turn
->
server
);
if
(
nice_address_set_from_string
(
&
turn
->
server
,
server_ip
))
{
nice_address_set_port
(
&
turn
->
server
,
server_port
);
}
else
{
g_slice_free
(
TurnServer
,
turn
);
return
NULL
;
}
turn
->
username
=
g_strdup
(
username
);
turn
->
password
=
g_strdup
(
password
);
turn
->
type
=
type
;
return
turn
;
}
agent/component.h
View file @
100a31fc
...
@@ -260,6 +260,11 @@ component_has_io_callback (Component *component);
...
@@ -260,6 +260,11 @@ component_has_io_callback (Component *component);
void
void
component_clean_turn_servers
(
Component
*
component
);
component_clean_turn_servers
(
Component
*
component
);
TurnServer
*
turn_server_new
(
const
gchar
*
server_ip
,
guint
server_port
,
const
gchar
*
username
,
const
gchar
*
password
,
NiceRelayType
type
);
G_END_DECLS
G_END_DECLS
#endif
/* _NICE_COMPONENT_H */
#endif
/* _NICE_COMPONENT_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