Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
871a6f9c
Commit
871a6f9c
authored
9 years ago
by
Martine Lenders
Browse files
Options
Downloads
Patches
Plain Diff
ng_nettest: some fixes
parent
0103fa2e
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile.dep
+1
-0
1 addition, 0 deletions
Makefile.dep
sys/include/net/ng_nettest.h
+4
-0
4 additions, 0 deletions
sys/include/net/ng_nettest.h
sys/net/crosslayer/ng_nettest/ng_nettest.c
+17
-16
17 additions, 16 deletions
sys/net/crosslayer/ng_nettest/ng_nettest.c
with
22 additions
and
16 deletions
Makefile.dep
+
1
−
0
View file @
871a6f9c
...
@@ -193,6 +193,7 @@ ifneq (,$(filter ng_nettest,$(USEMODULE)))
...
@@ -193,6 +193,7 @@ ifneq (,$(filter ng_nettest,$(USEMODULE)))
USEMODULE
+=
ng_netreg
USEMODULE
+=
ng_netreg
USEMODULE
+=
ng_netif
USEMODULE
+=
ng_netif
USEMODULE
+=
ng_pktbuf
USEMODULE
+=
ng_pktbuf
USEMODULE
+=
vtimer
endif
endif
ifneq
(,$(filter ng_netbase,$(USEMODULE)))
ifneq
(,$(filter ng_netbase,$(USEMODULE)))
...
...
This diff is collapsed.
Click to expand it.
sys/include/net/ng_nettest.h
+
4
−
0
View file @
871a6f9c
...
@@ -125,6 +125,8 @@ void ng_nettest_register_set(ng_netconf_opt_t opt, ng_nettest_opt_cb_t cb);
...
@@ -125,6 +125,8 @@ void ng_nettest_register_set(ng_netconf_opt_t opt, ng_nettest_opt_cb_t cb);
* If no message was received after @ref NG_NETTEST_TIMEOUT microseconds, while
* If no message was received after @ref NG_NETTEST_TIMEOUT microseconds, while
* there are still packets expected, the function will return NG_NETTEST_TIMED_OUT.
* there are still packets expected, the function will return NG_NETTEST_TIMED_OUT.
*
*
* In case of success it releases all packets send by the tested module.
*
* @param[in] pid The thread you want to test the
* @param[in] pid The thread you want to test the
* @ref NG_NETAPI_MSG_TYPE_SND command for.
* @ref NG_NETAPI_MSG_TYPE_SND command for.
* @param[in] in The packet you want to send through @p pid.
* @param[in] in The packet you want to send through @p pid.
...
@@ -154,6 +156,8 @@ ng_nettest_res_t ng_nettest_send(kernel_pid_t pid, ng_pktsnip_t *in,
...
@@ -154,6 +156,8 @@ ng_nettest_res_t ng_nettest_send(kernel_pid_t pid, ng_pktsnip_t *in,
* was received after @ref NG_NETTEST_TIMEOUT microseconds, while there are
* was received after @ref NG_NETTEST_TIMEOUT microseconds, while there are
* still packets expected, the function will return NG_NETTEST_TIMED_OUT.
* still packets expected, the function will return NG_NETTEST_TIMED_OUT.
*
*
* In case of success it releases all packets received from the tested module.
*
* @param[in] pid The thread you want to test the
* @param[in] pid The thread you want to test the
* @ref NG_NETAPI_MSG_TYPE_SND command for.
* @ref NG_NETAPI_MSG_TYPE_SND command for.
* @param[in] in The packet you want to send through @p pid.
* @param[in] in The packet you want to send through @p pid.
...
...
This diff is collapsed.
Click to expand it.
sys/net/crosslayer/ng_nettest/ng_nettest.c
+
17
−
16
View file @
871a6f9c
...
@@ -61,38 +61,39 @@ static ng_nettest_res_t _pkt_test(uint16_t cmd_type, kernel_pid_t pid, ng_pktsni
...
@@ -61,38 +61,39 @@ static ng_nettest_res_t _pkt_test(uint16_t cmd_type, kernel_pid_t pid, ng_pktsni
msg
.
content
.
ptr
=
(
char
*
)
in
;
msg
.
content
.
ptr
=
(
char
*
)
in
;
msg_send
(
&
msg
,
pid
);
msg_send
(
&
msg
,
pid
);
timex_normalize
(
&
t
);
for
(
unsigned
int
i
=
0
;
i
<
exp_pkts
;
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
exp_pkts
;
i
++
)
{
ng_pktsnip_t
*
out
;
ng_pktsnip_t
*
out
,
*
exp
=
exp_out
[
i
]
;
if
(
(
vtimer_msg_receive_timeout
(
&
msg
,
t
)
<
0
)
&&
res
==
NG_NETTEST_SUCCESS
)
{
if
(
vtimer_msg_receive_timeout
(
&
msg
,
t
)
<
0
)
{
re
s
=
NG_NETTEST_TIMED_OUT
;
re
turn
NG_NETTEST_TIMED_OUT
;
}
}
if
(
msg
.
type
!=
NG_NETAPI_MSG_TYPE_SND
&&
(
res
==
NG_NETTEST_SUCCESS
)
)
{
if
(
msg
.
type
!=
cmd_type
)
{
re
s
=
NG_NETTEST_WRONG_MSG
;
re
turn
NG_NETTEST_WRONG_MSG
;
}
}
if
(
msg
.
sender_pid
!=
exp_senders
[
i
]
&&
(
res
==
NG_NETTEST_SUCCESS
)
)
{
if
(
msg
.
sender_pid
!=
exp_senders
[
i
])
{
re
s
=
NG_NETTEST_WRONG_SENDER
;
re
turn
NG_NETTEST_WRONG_SENDER
;
}
}
out
=
(
ng_pktsnip_t
*
)
msg
.
content
.
ptr
;
out
=
(
ng_pktsnip_t
*
)
msg
.
content
.
ptr
;
if
(
(
out
==
NULL
)
&&
(
res
==
NG_NETTEST_SUCCESS
))
{
if
(
out
==
NULL
)
{
re
s
=
NG_NETTEST_FAIL
;
re
turn
NG_NETTEST_FAIL
;
}
}
while
(
out
)
{
while
(
out
&&
exp
)
{
if
((
res
==
NG_NETTEST_SUCCESS
)
&&
if
((
out
->
users
!=
exp
->
users
)
||
((
out
->
users
!=
exp_out
[
i
]
->
users
)
||
(
out
->
size
!=
exp
->
size
)
||
(
out
->
size
!=
exp_out
[
i
]
->
size
)
||
(
out
->
type
!=
exp
->
type
)
||
(
out
->
type
!=
exp_out
[
i
]
->
type
)
||
(
memcmp
(
out
->
data
,
exp
->
data
,
out
->
size
)
!=
0
))
{
(
memcmp
(
out
->
data
,
exp_out
[
i
]
->
data
,
out
->
size
)
!=
0
)))
{
return
NG_NETTEST_FAIL
;
res
=
NG_NETTEST_FAIL
;
}
}
out
=
out
->
next
;
out
=
out
->
next
;
exp
=
exp
->
next
;
}
}
ng_pktbuf_release
((
ng_pktsnip_t
*
)
msg
.
content
.
ptr
);
ng_pktbuf_release
((
ng_pktsnip_t
*
)
msg
.
content
.
ptr
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment