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
6bc52b3a
Commit
6bc52b3a
authored
Mar 31, 2009
by
Youness Alaoui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve test-turn to test for turnserver locally too
parent
f8f3a803
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
stun/tests/test-turn.c
stun/tests/test-turn.c
+13
-4
No files found.
stun/tests/test-turn.c
View file @
6bc52b3a
...
@@ -115,7 +115,7 @@ printaddr (const char *str, const struct sockaddr *addr, socklen_t addrlen)
...
@@ -115,7 +115,7 @@ printaddr (const char *str, const struct sockaddr *addr, socklen_t addrlen)
/** Various responses test */
/** Various responses test */
static
void
t
urnserver
(
void
)
static
void
t
est_turn
(
char
*
username
,
char
*
password
,
char
*
hostname
,
int
port
)
{
{
struct
sockaddr_storage
addr
;
struct
sockaddr_storage
addr
;
socklen_t
addrlen
=
sizeof
(
addr
);
socklen_t
addrlen
=
sizeof
(
addr
);
...
@@ -135,8 +135,6 @@ static void turnserver (void)
...
@@ -135,8 +135,6 @@ static void turnserver (void)
StunMessage
req_msg
;
StunMessage
req_msg
;
StunMessage
refresh_msg
;
StunMessage
refresh_msg
;
uint32_t
bandwidth
,
lifetime
;
uint32_t
bandwidth
,
lifetime
;
char
username
[]
=
"toto"
;
char
password
[]
=
"password"
;
struct
addrinfo
hints
,
*
res
;
struct
addrinfo
hints
,
*
res
;
int
ret
=
-
1
;
int
ret
=
-
1
;
...
@@ -145,7 +143,7 @@ static void turnserver (void)
...
@@ -145,7 +143,7 @@ static void turnserver (void)
hints
.
ai_socktype
=
SOCK_DGRAM
;
hints
.
ai_socktype
=
SOCK_DGRAM
;
hints
.
ai_flags
=
0
;
hints
.
ai_flags
=
0
;
ret
=
getaddrinfo
(
"127.0.0.1"
,
"3478"
,
&
hints
,
&
res
);
ret
=
getaddrinfo
(
hostname
,
port
,
&
hints
,
&
res
);
assert
(
ret
==
0
);
assert
(
ret
==
0
);
stun_agent_init
(
&
agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
stun_agent_init
(
&
agent
,
STUN_ALL_KNOWN_ATTRIBUTES
,
...
@@ -238,6 +236,16 @@ static void turnserver (void)
...
@@ -238,6 +236,16 @@ static void turnserver (void)
assert
(
val
==
0
);
assert
(
val
==
0
);
}
}
static
void
turnserver
(
void
)
{
test_turn
(
"toto"
,
"password"
,
"127.0.0.1"
,
"3478"
);
}
static
void
numb
(
void
)
{
test_turn
(
"youness.alaoui@collabora.co.uk"
,
"badger"
,
"numb.viagenie.ca"
,
"3478"
);
}
static
void
test
(
void
(
*
func
)
(
void
),
const
char
*
name
)
static
void
test
(
void
(
*
func
)
(
void
),
const
char
*
name
)
{
{
alarm
(
10
);
alarm
(
10
);
...
@@ -251,5 +259,6 @@ static void test (void (*func) (void), const char *name)
...
@@ -251,5 +259,6 @@ static void test (void (*func) (void), const char *name)
int
main
(
void
)
int
main
(
void
)
{
{
test
(
turnserver
,
"Testing TURN"
);
test
(
turnserver
,
"Testing TURN"
);
test
(
numb
,
"Testing numb"
);
return
0
;
return
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