Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
sofia-sip
Commits
89ba9ac3
Commit
89ba9ac3
authored
Dec 23, 2005
by
Martti Mela
Browse files
API cleanup contd. # N+100
darcs-hash:20051223062628-1b897-00a968067fa1e98cffb213a0c65e7ef96420b2ba.gz
parent
ae992428
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
20 deletions
+11
-20
libsofia-sip-ua/stun/stun.c
libsofia-sip-ua/stun/stun.c
+10
-19
libsofia-sip-ua/stun/stun_internal.h
libsofia-sip-ua/stun/stun_internal.h
+1
-1
No files found.
libsofia-sip-ua/stun/stun.c
View file @
89ba9ac3
...
...
@@ -461,8 +461,7 @@ int stun_handle_bind(stun_handle_t *se,
SU_DEBUG_3
((
"%s: Local socket bound to: %s:%u
\n
"
,
__func__
,
ipaddr
,
(
unsigned
)
ntohs
(
bind_addr
.
su_port
)));
retval
=
stun_send_binding_request
(
se
,
se
->
st_pri_addr
,
clnt_addr
,
0
,
0
);
retval
=
stun_send_binding_request
(
se
,
se
->
st_pri_addr
,
0
,
0
);
if
(
lifetime
)
{
if
(
retval
==
0
)
...
...
@@ -538,8 +537,7 @@ int stun_handle_get_nattype(stun_handle_t *se,
if
(
memcmp
(
&
local
,
&
mapped_addr1
->
li_addr
,
8
)
==
0
)
{
/* conduct TEST II */
memset
(
&
mapped_addr2
,
0
,
sizeof
(
mapped_addr2
));
retval
=
stun_send_binding_request
(
se
,
se
->
st_pri_addr
,
(
su_localinfo_t
*
)
&
mapped_addr2
,
1
,
1
);
retval
=
stun_send_binding_request
(
se
,
se
->
st_pri_addr
,
1
,
1
);
if
(
retval
==
-
1
)
{
if
(
errno
==
ETIMEDOUT
)
{
/* No Response: Type 3 - Sym UDP FW */
...
...
@@ -555,20 +553,17 @@ int stun_handle_get_nattype(stun_handle_t *se,
/* Different IP */
else
{
memset
(
&
mapped_addr2
,
0
,
sizeof
(
mapped_addr2
));
retval
=
stun_send_binding_request
(
se
,
se
->
st_pri_addr
,
(
su_localinfo_t
*
)
&
mapped_addr2
,
1
,
1
);
retval
=
stun_send_binding_request
(
se
,
se
->
st_pri_addr
,
1
,
1
);
if
(
retval
==
-
1
)
{
if
(
errno
==
ETIMEDOUT
)
{
/* No Response */
retval
=
stun_send_binding_request
(
se
,
se
->
st_sec_addr
,
(
su_localinfo_t
*
)
&
mapped_addr2
,
0
,
0
);
retval
=
stun_send_binding_request
(
se
,
se
->
st_sec_addr
,
0
,
0
);
/* response comes back, has to be the case */
if
(
retval
==
0
)
{
if
(
memcmp
(
&
mapped_addr1
,
&
mapped_addr2
,
8
)
==
0
)
{
/* Same Public IP and port, Test III, server ip 0 or 1 should be
same */
retval
=
stun_send_binding_request
(
se
,
se
->
st_pri_addr
,
(
su_localinfo_t
*
)
&
mapped_addr2
,
0
,
1
);
retval
=
stun_send_binding_request
(
se
,
se
->
st_pri_addr
,
0
,
1
);
if
(
retval
==
0
)
{
/* Response: Type 6 - Restricted */
se
->
st_nattype
=
STUN_NAT_RES_CONE
;
...
...
@@ -630,8 +625,7 @@ int stun_handle_get_nattype(stun_handle_t *se,
if (memcmp(&local, &mapped_addr1, 8) == 0) { /* Same IP and port*/
/* conduct TEST II */
memset(&mapped_addr2, 0, sizeof(mapped_addr2));
retval = stun_send_binding_request(se, se->st_pri_addr,
(su_localinfo_t *) &mapped_addr2, 1, 1);
retval = stun_send_binding_request(se, se->st_pri_addr, &mapped_addr2, 1, 1);
if (retval == -1) {
if (errno == ETIMEDOUT) {
/* No Response: Type 3 - Sym UDP FW */
...
...
@@ -646,20 +640,17 @@ int stun_handle_get_nattype(stun_handle_t *se,
}
else { /* Different IP */
memset(&mapped_addr2, 0, sizeof(mapped_addr2));
retval = stun_send_binding_request(se, se->st_pri_addr,
(su_localinfo_t *) &mapped_addr2, 1, 1);
retval = stun_send_binding_request(se, se->st_pri_addr, &mapped_addr2, 1, 1);
if (retval == -1) {
if (errno == ETIMEDOUT) {
/* No Response */
retval = stun_send_binding_request(se, se->st_sec_addr,
(su_localinfo_t *) &mapped_addr2, 0, 0);
retval = stun_send_binding_request(se, se->st_sec_addr, &mapped_addr2, 0, 0);
/* response comes back, has to be the case */
if (retval == 0) {
if (memcmp(&mapped_addr1, &mapped_addr2, 8) == 0) {
/* Same Public IP and port, Test III, server ip 0 or 1 should be
same */
retval = stun_send_binding_request(se, se->st_pri_addr,
(su_localinfo_t *) &mapped_addr2, 0, 1);
retval = stun_send_binding_request(se, se->st_pri_addr, &mapped_addr2, 0, 1);
if(retval==0) {
/* Response: Type 6 - Restricted */
nattype = STUN_NAT_RES_CONE;
...
...
@@ -1298,7 +1289,7 @@ static void stun_sendto_timer_cb(su_root_magic_t *magic,
*/
int
stun_send_binding_request
(
stun_handle_t
*
se
,
su_sockaddr_t
*
srvr_addr
,
su_localinfo_t
*
clnt_addr
,
/*
su_localinfo_t *clnt_addr,
*/
int
chg_ip
,
int
chg_port
)
{
...
...
libsofia-sip-ua/stun/stun_internal.h
View file @
89ba9ac3
...
...
@@ -78,7 +78,7 @@ int stun_make_sharedsecret_req(stun_msg_t *msg);
int
stun_send_binding_request
(
stun_handle_t
*
se
,
su_sockaddr_t
*
srvr_addr
,
su_localinfo_t
*
clnt_addr
,
/*
su_localinfo_t *clnt_addr,
*/
int
chg_ip
,
int
chg_port
);
int
stun_send_message
(
su_socket_t
ss
,
su_sockaddr_t
*
srvr
,
stun_msg_t
*
msg
,
stun_buffer_t
*
pwd
);
/* client version */
...
...
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