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
675487c9
Commit
675487c9
authored
Jun 20, 2008
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(WIP) Ported libnice to the new API...
parent
8febb558
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
9 deletions
+33
-9
agent/Makefile.am
agent/Makefile.am
+2
-2
agent/agent-priv.h
agent/agent-priv.h
+2
-0
agent/agent.c
agent/agent.c
+18
-1
agent/agent.h
agent/agent.h
+1
-0
agent/conncheck.c
agent/conncheck.c
+8
-5
agent/conncheck.h
agent/conncheck.h
+2
-1
No files found.
agent/Makefile.am
View file @
675487c9
...
...
@@ -72,8 +72,8 @@ check_PROGRAMS = \
test-mainloop
\
test-fullmode
\
test-restart
\
test-fallback
\
test-thread
test-fallback
#
test-thread
dist_check_SCRIPTS
=
\
check-test-fullmode-with-stun.sh
...
...
agent/agent-priv.h
View file @
675487c9
...
...
@@ -48,6 +48,7 @@
#include "stream.h"
#include "conncheck.h"
#include "component.h"
#include "stun/stunagent.h"
/* XXX: starting from ICE ID-18, Ta SHOULD now be set according
* to session bandwidth -> this is not yet implemented in NICE */
...
...
@@ -93,6 +94,7 @@ struct _NiceAgent
"Determining Role" ID-19) */
GStaticRecMutex
mutex
;
/* Mutex used for thread-safe lib */
NiceCompatibility
compatibility
;
/* property: Compatibility mode */
StunAgent
stun_agent
;
/* STUN agent */
/* XXX: add pointer to internal data struct for ABI-safe extensions */
};
...
...
agent/agent.c
View file @
675487c9
...
...
@@ -399,6 +399,11 @@ nice_agent_init (NiceAgent *agent)
agent
->
keepalive_timer_id
=
0
;
agent
->
compatibility
=
NICE_COMPATIBILITY_ID19
;
stun_agent_init
(
&
agent
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_3489BIS
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_USE_FINGERPRINT
);
agent
->
rng
=
nice_rng_new
();
priv_generate_tie_breaker
(
agent
);
...
...
@@ -517,6 +522,18 @@ nice_agent_set_property (
case
PROP_COMPATIBILITY
:
agent
->
compatibility
=
g_value_get_uint
(
value
);
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_ID19
)
{
stun_agent_init
(
&
agent
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_3489BIS
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_USE_FINGERPRINT
);
}
else
if
(
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
{
stun_agent_init
(
&
agent
->
stun_agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
STUN_COMPATIBILITY_RFC3489
,
STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
|
STUN_AGENT_USAGE_IGNORE_CREDENTIALS
);
}
break
;
case
PROP_STUN_SERVER
:
...
...
@@ -1260,7 +1277,7 @@ _nice_agent_recv (
}
/* step: validate using the new STUN API */
/* - note: old check '((buf[0] & 0xc0) == 0)' */
else
if
(
stun_
validate
((
uint8_t
*
)
buf
,
len
)
>
0
)
{
else
if
(
stun_
message_validate_buffer_length
((
uint8_t
*
)
buf
,
(
size_t
)
len
)
==
len
)
{
/* If the retval is no 0, its not a valid stun packet, probably data */
conn_check_handle_inbound_stun
(
agent
,
stream
,
component
,
udp_socket
,
&
from
,
buf
,
len
);
...
...
agent/agent.h
View file @
675487c9
...
...
@@ -46,6 +46,7 @@
#include "candidate.h"
#include "random.h"
G_BEGIN_DECLS
#define NICE_TYPE_AGENT nice_agent_get_type()
...
...
agent/conncheck.c
View file @
675487c9
...
...
@@ -1564,6 +1564,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Compo
size_t
rbuf_len
=
sizeof
(
rbuf
);
bool
control
=
agent
->
controlling_mode
;
gchar
uname
[
NICE_STREAM_MAX_UNAME
];
StunMessage
req
;
StunMessage
msg
;
nice_address_copy_to_sockaddr
(
from
,
&
sockaddr
);
g_snprintf
(
uname
,
sizeof
(
uname
),
"%s:%s"
,
stream
->
local_ufrag
,
...
...
@@ -1576,8 +1578,9 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Compo
/* note: ICE 7.2. "STUN Server Procedures" (ID-19) */
res
=
stun_conncheck_reply
(
rbuf
,
&
rbuf_len
,
(
const
uint8_t
*
)
buf
,
&
sockaddr
,
sizeof
(
sockaddr
),
stream
->
local_ufrag
,
stream
->
local_password
,
res
=
stun_conncheck_reply
(
&
agent
->
stun_agent
,
&
req
,
(
uint8_t
*
)
buf
,
(
size_t
)
len
,
&
msg
,
rbuf
,
&
rbuf_len
,
&
sockaddr
,
sizeof
(
sockaddr
),
(
uint8_t
*
)
stream
->
local_ufrag
,
strlen
(
stream
->
local_ufrag
),
(
uint8_t
*
)
stream
->
local_password
,
strlen
(
stream
->
local_password
),
&
control
,
agent
->
tie_breaker
,
agent
->
compatibility
);
if
(
res
==
EACCES
)
...
...
@@ -1588,8 +1591,8 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream, Compo
GSList
*
i
;
bool
use_candidate
=
stun_conncheck_use_candidate
(
(
const
uint8_t
*
)
buf
);
uint32_t
priority
=
stun_conncheck_priority
(
(
const
uint8_t
*
)
buf
);
stun_conncheck_use_candidate
(
&
req
);
uint32_t
priority
=
stun_conncheck_priority
(
&
req
);
if
(
agent
->
controlling_mode
||
agent
->
compatibility
==
NICE_COMPATIBILITY_GOOGLE
)
...
...
agent/conncheck.h
View file @
675487c9
...
...
@@ -43,7 +43,8 @@
#include "agent.h"
#include "stream.h"
#include "usages/stun-ice.h"
/* note: the new STUN API */
#include "stun/usages/stun-ice.h"
#include "stun/usages/bind.h"
#define NICE_CANDIDATE_PAIR_MAX_FOUNDATION NICE_CANDIDATE_MAX_FOUNDATION*2
...
...
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