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
332c9c5b
Commit
332c9c5b
authored
Dec 17, 2013
by
Philip Withnall
Committed by
Olivier Crête
Dec 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix variable shadowing
parent
4b11c683
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
37 deletions
+37
-37
agent/agent.c
agent/agent.c
+5
-5
examples/simple-example.c
examples/simple-example.c
+16
-16
socket/http.c
socket/http.c
+7
-7
socket/socks5.c
socket/socks5.c
+2
-2
socket/turn.c
socket/turn.c
+7
-7
No files found.
agent/agent.c
View file @
332c9c5b
...
...
@@ -1097,7 +1097,7 @@ pseudo_tcp_socket_closed (PseudoTcpSocket *sock, guint32 err,
static
PseudoTcpWriteResult
pseudo_tcp_socket_write_packet
(
PseudoTcpSocket
*
sock
,
pseudo_tcp_socket_write_packet
(
PseudoTcpSocket
*
sock
et
,
const
gchar
*
buffer
,
guint32
len
,
gpointer
user_data
)
{
TcpUserData
*
data
=
(
TcpUserData
*
)
user_data
;
...
...
@@ -1870,13 +1870,13 @@ nice_agent_gather_candidates (
#ifdef HAVE_GUPNP
if
(
agent
->
upnp_enabled
)
{
NiceAddress
*
addr
=
nice_address_dup
(
&
host_candidate
->
base_addr
);
NiceAddress
*
base_
addr
=
nice_address_dup
(
&
host_candidate
->
base_addr
);
nice_debug
(
"Agent %p: Adding UPnP port %s:%d"
,
agent
,
local_ip
,
nice_address_get_port
(
&
host_candidate
->
base_addr
));
nice_address_get_port
(
base_addr
));
gupnp_simple_igd_add_port
(
GUPNP_SIMPLE_IGD
(
agent
->
upnp
),
"UDP"
,
0
,
local_ip
,
nice_address_get_port
(
&
host_candidate
->
base_addr
),
0
,
local_ip
,
nice_address_get_port
(
base_addr
),
0
,
PACKAGE_STRING
);
agent
->
upnp_mapping
=
g_slist_prepend
(
agent
->
upnp_mapping
,
addr
);
agent
->
upnp_mapping
=
g_slist_prepend
(
agent
->
upnp_mapping
,
base_
addr
);
}
#endif
...
...
examples/simple-example.c
View file @
332c9c5b
...
...
@@ -155,7 +155,7 @@ main(int argc, char *argv[])
}
static
void
cb_candidate_gathering_done
(
NiceAgent
*
agent
,
guint
stream_id
,
cb_candidate_gathering_done
(
NiceAgent
*
agent
,
guint
_
stream_id
,
gpointer
data
)
{
...
...
@@ -164,7 +164,7 @@ cb_candidate_gathering_done(NiceAgent *agent, guint stream_id,
// Candidate gathering is done. Send our local candidates on stdout
printf
(
"Copy this line to remote client:
\n
"
);
printf
(
"
\n
"
);
print_local_data
(
agent
,
stream_id
,
1
);
print_local_data
(
agent
,
_
stream_id
,
1
);
printf
(
"
\n
"
);
// Listen on stdin for the remote candidate list
...
...
@@ -206,19 +206,19 @@ stdin_remote_info_cb (GIOChannel *source, GIOCondition cond,
}
static
void
cb_component_state_changed
(
NiceAgent
*
agent
,
guint
stream_id
,
cb_component_state_changed
(
NiceAgent
*
agent
,
guint
_
stream_id
,
guint
component_id
,
guint
state
,
gpointer
data
)
{
g_debug
(
"SIGNAL: state changed %d %d %s[%d]
\n
"
,
stream_id
,
component_id
,
state_name
[
state
],
state
);
_
stream_id
,
component_id
,
state_name
[
state
],
state
);
if
(
state
==
NICE_COMPONENT_STATE_READY
)
{
NiceCandidate
*
local
,
*
remote
;
// Get current selected candidate pair and print IP address used
if
(
nice_agent_get_selected_pair
(
agent
,
stream_id
,
component_id
,
if
(
nice_agent_get_selected_pair
(
agent
,
_
stream_id
,
component_id
,
&
local
,
&
remote
))
{
gchar
ipaddr
[
INET6_ADDRSTRLEN
];
...
...
@@ -262,7 +262,7 @@ stdin_send_data_cb (GIOChannel *source, GIOCondition cond,
}
static
void
cb_new_selected_pair
(
NiceAgent
*
agent
,
guint
stream_id
,
cb_new_selected_pair
(
NiceAgent
*
agent
,
guint
_
stream_id
,
guint
component_id
,
gchar
*
lfoundation
,
gchar
*
rfoundation
,
gpointer
data
)
{
...
...
@@ -270,7 +270,7 @@ cb_new_selected_pair(NiceAgent *agent, guint stream_id,
}
static
void
cb_nice_recv
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
,
cb_nice_recv
(
NiceAgent
*
agent
,
guint
_
stream_id
,
guint
component_id
,
guint
len
,
gchar
*
buf
,
gpointer
data
)
{
if
(
len
==
1
&&
buf
[
0
]
==
'\0'
)
...
...
@@ -280,7 +280,7 @@ cb_nice_recv(NiceAgent *agent, guint stream_id, guint component_id,
}
static
NiceCandidate
*
parse_candidate
(
char
*
scand
,
guint
stream_id
)
parse_candidate
(
char
*
scand
,
guint
_
stream_id
)
{
NiceCandidate
*
cand
=
NULL
;
NiceCandidateType
ntype
;
...
...
@@ -303,7 +303,7 @@ parse_candidate(char *scand, guint stream_id)
cand
=
nice_candidate_new
(
ntype
);
cand
->
component_id
=
1
;
cand
->
stream_id
=
stream_id
;
cand
->
stream_id
=
_
stream_id
;
cand
->
transport
=
NICE_CANDIDATE_TRANSPORT_UDP
;
strncpy
(
cand
->
foundation
,
tokens
[
0
],
NICE_CANDIDATE_MAX_FOUNDATION
);
cand
->
priority
=
atoi
(
tokens
[
1
]);
...
...
@@ -325,7 +325,7 @@ parse_candidate(char *scand, guint stream_id)
static
int
print_local_data
(
NiceAgent
*
agent
,
guint
stream_id
,
guint
component_id
)
print_local_data
(
NiceAgent
*
agent
,
guint
_
stream_id
,
guint
component_id
)
{
int
result
=
EXIT_FAILURE
;
gchar
*
local_ufrag
=
NULL
;
...
...
@@ -333,11 +333,11 @@ print_local_data (NiceAgent *agent, guint stream_id, guint component_id)
gchar
ipaddr
[
INET6_ADDRSTRLEN
];
GSList
*
cands
=
NULL
,
*
item
;
if
(
!
nice_agent_get_local_credentials
(
agent
,
stream_id
,
if
(
!
nice_agent_get_local_credentials
(
agent
,
_
stream_id
,
&
local_ufrag
,
&
local_password
))
goto
end
;
cands
=
nice_agent_get_local_candidates
(
agent
,
stream_id
,
component_id
);
cands
=
nice_agent_get_local_candidates
(
agent
,
_
stream_id
,
component_id
);
if
(
cands
==
NULL
)
goto
end
;
...
...
@@ -372,7 +372,7 @@ print_local_data (NiceAgent *agent, guint stream_id, guint component_id)
static
int
parse_remote_data
(
NiceAgent
*
agent
,
guint
stream_id
,
parse_remote_data
(
NiceAgent
*
agent
,
guint
_
stream_id
,
guint
component_id
,
char
*
line
)
{
GSList
*
remote_candidates
=
NULL
;
...
...
@@ -394,7 +394,7 @@ parse_remote_data(NiceAgent *agent, guint stream_id,
passwd
=
line_argv
[
i
];
}
else
{
// Remaining args are serialized canidates (at least one is required)
NiceCandidate
*
c
=
parse_candidate
(
line_argv
[
i
],
stream_id
);
NiceCandidate
*
c
=
parse_candidate
(
line_argv
[
i
],
_
stream_id
);
if
(
c
==
NULL
)
{
g_message
(
"failed to parse candidate: %s"
,
line_argv
[
i
]);
...
...
@@ -408,13 +408,13 @@ parse_remote_data(NiceAgent *agent, guint stream_id,
goto
end
;
}
if
(
!
nice_agent_set_remote_credentials
(
agent
,
stream_id
,
ufrag
,
passwd
))
{
if
(
!
nice_agent_set_remote_credentials
(
agent
,
_
stream_id
,
ufrag
,
passwd
))
{
g_message
(
"failed to set remote credentials"
);
goto
end
;
}
// Note: this will trigger the start of negotiation.
if
(
nice_agent_set_remote_candidates
(
agent
,
stream_id
,
component_id
,
if
(
nice_agent_set_remote_candidates
(
agent
,
_
stream_id
,
component_id
,
remote_candidates
)
<
1
)
{
g_message
(
"failed to set remote candidates"
);
goto
end
;
...
...
socket/http.c
View file @
332c9c5b
...
...
@@ -317,17 +317,17 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
break
;
case
HTTP_STATE_CONNECTED
:
{
guint
re
ad
=
priv
->
recv_len
;
guint
re
cv_len
=
priv
->
recv_len
;
struct
to_be_sent
*
tbs
=
NULL
;
if
(
re
ad
>
len
)
re
ad
=
len
;
if
(
re
cv_len
>
len
)
re
cv_len
=
len
;
memcpy
(
buf
,
priv
->
recv_buf
,
re
ad
);
memcpy
(
buf
,
priv
->
recv_buf
,
re
cv_len
);
/* consume the data we returned */
priv
->
recv_len
-=
re
ad
;
memmove
(
priv
->
recv_buf
,
priv
->
recv_buf
+
re
ad
,
priv
->
recv_len
);
priv
->
recv_len
-=
re
cv_len
;
memmove
(
priv
->
recv_buf
,
priv
->
recv_buf
+
re
cv_len
,
priv
->
recv_len
);
priv
->
recv_buf
=
g_realloc
(
priv
->
recv_buf
,
priv
->
recv_len
);
/* Send the pending data */
...
...
@@ -338,7 +338,7 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
g_slice_free
(
struct
to_be_sent
,
tbs
);
}
return
re
ad
;
return
re
cv_len
;
}
break
;
default:
...
...
socket/socks5.c
View file @
332c9c5b
...
...
@@ -160,7 +160,7 @@ socket_close (NiceSocket *sock)
static
gint
socket_recv
(
NiceSocket
*
sock
,
NiceAddress
*
from
,
guint
len
,
gchar
*
buf
)
socket_recv
(
NiceSocket
*
sock
,
NiceAddress
*
from
,
guint
buf_
len
,
gchar
*
buf
)
{
Socks5Priv
*
priv
=
sock
->
priv
;
...
...
@@ -170,7 +170,7 @@ socket_recv (NiceSocket *sock, NiceAddress *from, guint len, gchar *buf)
switch
(
priv
->
state
)
{
case
SOCKS_STATE_CONNECTED
:
if
(
priv
->
base_socket
)
return
nice_socket_recv
(
priv
->
base_socket
,
NULL
,
len
,
buf
);
return
nice_socket_recv
(
priv
->
base_socket
,
NULL
,
buf_
len
,
buf
);
break
;
case
SOCKS_STATE_INIT
:
{
...
...
socket/turn.c
View file @
332c9c5b
...
...
@@ -146,9 +146,9 @@ priv_nice_address_hash (gconstpointer data)
}
static
void
priv_send_data_queue_destroy
(
gpointer
data
)
priv_send_data_queue_destroy
(
gpointer
user_
data
)
{
GQueue
*
send_queue
=
(
GQueue
*
)
data
;
GQueue
*
send_queue
=
(
GQueue
*
)
user_
data
;
GList
*
i
;
for
(
i
=
g_queue_peek_head_link
(
send_queue
);
i
;
i
=
i
->
next
)
{
...
...
@@ -762,9 +762,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
TurnPriv
*
priv
=
(
TurnPriv
*
)
sock
->
priv
;
StunValidationStatus
valid
;
StunMessage
msg
;
struct
sockaddr_storage
sa
;
socklen_t
from_len
=
sizeof
(
sa
);
GList
*
i
=
priv
->
channels
;
GList
*
l
;
ChannelBinding
*
binding
=
NULL
;
if
(
nice_address_equal
(
&
priv
->
server_addr
,
recv_from
))
{
...
...
@@ -1035,6 +1033,8 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
stun_message_get_method
(
&
msg
)
==
STUN_IND_DATA
)
{
uint16_t
data_len
;
uint8_t
*
data
;
struct
sockaddr_storage
sa
;
socklen_t
from_len
=
sizeof
(
sa
);
if
(
priv
->
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9
||
priv
->
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_RFC5766
)
{
...
...
@@ -1074,8 +1074,8 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
}
recv:
for
(
i
=
priv
->
channels
;
i
;
i
=
i
->
next
)
{
ChannelBinding
*
b
=
i
->
data
;
for
(
l
=
priv
->
channels
;
l
;
l
=
l
->
next
)
{
ChannelBinding
*
b
=
l
->
data
;
if
(
priv
->
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9
||
priv
->
compatibility
==
NICE_TURN_SOCKET_COMPATIBILITY_RFC5766
)
{
if
(
b
->
channel
==
ntohs
(((
uint16_t
*
)
recv_buf
)[
0
]))
{
...
...
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