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
1045b8a8
Commit
1045b8a8
authored
Jul 28, 2009
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change new API to nice_agent_set_stream_tos, save the tos and apply it to new sockets
parent
55880a22
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
14 deletions
+43
-14
agent/agent-priv.h
agent/agent-priv.h
+2
-0
agent/agent.c
agent/agent.c
+28
-13
agent/agent.h
agent/agent.h
+10
-1
agent/discovery.c
agent/discovery.c
+1
-0
agent/stream.h
agent/stream.h
+1
-0
nice/libnice.sym
nice/libnice.sym
+1
-0
No files found.
agent/agent-priv.h
View file @
1045b8a8
...
@@ -172,4 +172,6 @@ StunUsageIceCompatibility agent_to_ice_compatibility (NiceAgent *agent);
...
@@ -172,4 +172,6 @@ StunUsageIceCompatibility agent_to_ice_compatibility (NiceAgent *agent);
StunUsageTurnCompatibility
agent_to_turn_compatibility
(
NiceAgent
*
agent
);
StunUsageTurnCompatibility
agent_to_turn_compatibility
(
NiceAgent
*
agent
);
NiceTurnSocketCompatibility
agent_to_turn_socket_compatibility
(
NiceAgent
*
agent
);
NiceTurnSocketCompatibility
agent_to_turn_socket_compatibility
(
NiceAgent
*
agent
);
void
_priv_set_socket_tos
(
NiceAgent
*
agent
,
NiceSocket
*
sock
,
gint
tos
);
#endif
/*_NICE_AGENT_PRIV_H */
#endif
/*_NICE_AGENT_PRIV_H */
agent/agent.c
View file @
1045b8a8
...
@@ -968,6 +968,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
...
@@ -968,6 +968,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
new_socket
=
nice_udp_bsd_socket_new
(
&
addr
);
new_socket
=
nice_udp_bsd_socket_new
(
&
addr
);
if
(
new_socket
)
{
if
(
new_socket
)
{
_priv_set_socket_tos
(
agent
,
new_socket
,
stream
->
tos
);
agent_attach_stream_component_socket
(
agent
,
stream
,
agent_attach_stream_component_socket
(
agent
,
stream
,
component
,
new_socket
);
component
,
new_socket
);
socket_modified_list
=
g_slist_append
(
component
->
sockets
,
new_socket
);
socket_modified_list
=
g_slist_append
(
component
->
sockets
,
new_socket
);
...
@@ -992,6 +993,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
...
@@ -992,6 +993,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
socket
=
nice_tcp_bsd_socket_new
(
agent
,
component
->
ctx
,
&
proxy_server
);
socket
=
nice_tcp_bsd_socket_new
(
agent
,
component
->
ctx
,
&
proxy_server
);
if
(
socket
)
{
if
(
socket
)
{
_priv_set_socket_tos
(
agent
,
socket
,
stream
->
tos
);
if
(
agent
->
proxy_type
==
NICE_PROXY_TYPE_SOCKS5
)
{
if
(
agent
->
proxy_type
==
NICE_PROXY_TYPE_SOCKS5
)
{
socket
=
nice_socks5_socket_new
(
socket
,
&
turn
->
server
,
socket
=
nice_socks5_socket_new
(
socket
,
&
turn
->
server
,
agent
->
proxy_username
,
agent
->
proxy_password
);
agent
->
proxy_username
,
agent
->
proxy_password
);
...
@@ -1007,6 +1009,7 @@ priv_add_new_candidate_discovery_turn (NiceAgent *agent,
...
@@ -1007,6 +1009,7 @@ 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
,
component
->
ctx
,
&
turn
->
server
);
_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
)
{
...
@@ -2316,34 +2319,46 @@ nice_agent_set_selected_remote_candidate (
...
@@ -2316,34 +2319,46 @@ nice_agent_set_selected_remote_candidate (
return
ret
;
return
ret
;
}
}
void
nice_agent_set_stream_type_of_service
(
NiceAgent
*
agent
,
void
_priv_set_socket_tos
(
NiceAgent
*
agent
,
NiceSocket
*
sock
,
gint
tos
)
{
if
(
setsockopt
(
sock
->
fileno
,
IPPROTO_IP
,
IP_TOS
,
&
tos
,
sizeof
(
tos
))
<
0
)
{
nice_debug
(
"Agent %p: Could not set socket ToS"
,
agent
,
g_strerror
(
errno
));
}
#ifdef IPV6_TCLASS
if
(
setsockopt
(
sock
->
fileno
,
IPPROTO_IPV6
,
IPV6_TCLASS
,
&
tos
,
sizeof
(
tos
))
<
0
)
{
nice_debug
(
"Agent %p: Could not set IPV6 socket ToS"
,
agent
,
g_strerror
(
errno
));
}
#endif
}
void
nice_agent_set_stream_tos
(
NiceAgent
*
agent
,
guint
stream_id
,
gint
tos
)
guint
stream_id
,
gint
tos
)
{
{
GSList
*
i
,
*
j
,
*
k
;
GSList
*
i
,
*
j
,
*
k
;
agent_lock
();
for
(
i
=
agent
->
streams
;
i
;
i
=
i
->
next
)
{
for
(
i
=
agent
->
streams
;
i
;
i
=
i
->
next
)
{
Stream
*
stream
=
i
->
data
;
Stream
*
stream
=
i
->
data
;
if
(
stream
->
id
==
stream_id
)
{
if
(
stream
->
id
==
stream_id
)
{
stream
->
tos
=
tos
;
for
(
j
=
stream
->
components
;
j
;
j
=
j
->
next
)
{
for
(
j
=
stream
->
components
;
j
;
j
=
j
->
next
)
{
Component
*
component
=
j
->
data
;
Component
*
component
=
j
->
data
;
for
(
k
=
component
->
local_candidates
;
k
;
k
=
k
->
next
)
{
for
(
k
=
component
->
local_candidates
;
k
;
k
=
k
->
next
)
{
NiceCandidate
*
local_candidate
=
k
->
data
;
NiceCandidate
*
local_candidate
=
k
->
data
;
if
(
setsockopt
(
local_candidate
->
sockptr
->
fileno
,
IPPROTO_IP
,
_priv_set_socket_tos
(
agent
,
local_candidate
->
sockptr
,
tos
);
IP_TOS
,
&
tos
,
sizeof
(
tos
))
<
0
)
{
nice_debug
(
"Agent %p: Could not set socket ToS"
,
agent
,
g_strerror
(
errno
));
}
#ifdef IPV6_TCLASS
if
(
setsockopt
(
local_candidate
->
sockptr
->
fileno
,
IPPROTO_IPV6
,
IPV6_TCLASS
,
&
tos
,
sizeof
(
tos
))
<
0
)
{
nice_debug
(
"Agent %p: Could not set IPV6 socket ToS"
,
agent
,
g_strerror
(
errno
));
}
#endif
}
}
}
}
}
}
}
}
agent_unlock
();
}
}
agent/agent.h
View file @
1045b8a8
...
@@ -621,7 +621,16 @@ nice_agent_set_selected_remote_candidate (
...
@@ -621,7 +621,16 @@ nice_agent_set_selected_remote_candidate (
NiceCandidate
*
candidate
);
NiceCandidate
*
candidate
);
void
nice_agent_set_stream_type_of_service
(
/**
* nice_agent_set_stream_tos:
* @agent: The #NiceAgent Object
* @stream_id: The ID of the stream
* @tos: The ToS to set
*
* Sets the ToS on the stream's sockets
*
*/
void
nice_agent_set_stream_tos
(
NiceAgent
*
agent
,
NiceAgent
*
agent
,
guint
stream_id
,
guint
stream_id
,
gint
tos
);
gint
tos
);
...
...
agent/discovery.c
View file @
1045b8a8
...
@@ -481,6 +481,7 @@ NiceCandidate *discovery_add_local_host_candidate (
...
@@ -481,6 +481,7 @@ NiceCandidate *discovery_add_local_host_candidate (
if
(
udp_socket
)
{
if
(
udp_socket
)
{
gboolean
result
;
gboolean
result
;
_priv_set_socket_tos
(
agent
,
udp_socket
,
stream
->
tos
);
agent_attach_stream_component_socket
(
agent
,
stream
,
agent_attach_stream_component_socket
(
agent
,
stream
,
component
,
udp_socket
);
component
,
udp_socket
);
...
...
agent/stream.h
View file @
1045b8a8
...
@@ -83,6 +83,7 @@ struct _Stream
...
@@ -83,6 +83,7 @@ struct _Stream
gchar
remote_ufrag
[
NICE_STREAM_MAX_UFRAG
];
gchar
remote_ufrag
[
NICE_STREAM_MAX_UFRAG
];
gchar
remote_password
[
NICE_STREAM_MAX_PWD
];
gchar
remote_password
[
NICE_STREAM_MAX_PWD
];
gboolean
gathering
;
gboolean
gathering
;
gint
tos
;
};
};
Stream
*
Stream
*
...
...
nice/libnice.sym
View file @
1045b8a8
...
@@ -30,6 +30,7 @@ nice_agent_set_remote_candidates
...
@@ -30,6 +30,7 @@ nice_agent_set_remote_candidates
nice_agent_set_remote_credentials
nice_agent_set_remote_credentials
nice_agent_set_selected_pair
nice_agent_set_selected_pair
nice_agent_set_selected_remote_candidate
nice_agent_set_selected_remote_candidate
nice_agent_set_stream_tos
nice_candidate_free
nice_candidate_free
nice_candidate_new
nice_candidate_new
nice_debug_disable
nice_debug_disable
...
...
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