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
da44b0dc
Commit
da44b0dc
authored
10 years ago
by
Hauke Petersen
Browse files
Options
Downloads
Plain Diff
Merge pull request #2598 from haukepetersen/ng_opt_getset
ng_net: changed semantic of get and set command slightly
parents
c633c083
67b12375
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sys/include/net/ng_netapi.h
+2
-2
2 additions, 2 deletions
sys/include/net/ng_netapi.h
sys/include/net/ng_netdev.h
+7
-6
7 additions, 6 deletions
sys/include/net/ng_netdev.h
sys/net/link_layer/ng_nomac/ng_nomac.c
+3
-2
3 additions, 2 deletions
sys/net/link_layer/ng_nomac/ng_nomac.c
with
12 additions
and
10 deletions
sys/include/net/ng_netapi.h
+
2
−
2
View file @
da44b0dc
...
@@ -91,12 +91,12 @@ int ng_netapi_send(kernel_pid_t pid, ng_pktsnip_t *pkt);
...
@@ -91,12 +91,12 @@ int ng_netapi_send(kernel_pid_t pid, ng_pktsnip_t *pkt);
* @param[in] opt option to get
* @param[in] opt option to get
* @param[in] context (optional) context to the given option
* @param[in] context (optional) context to the given option
* @param[in] data pointer to buffer for reading the option's value
* @param[in] data pointer to buffer for reading the option's value
* @param[in]
data
_len
size of the given buffer
* @param[in]
max
_len
maximum number of bytes that fit into @p data
*
*
* @return value returned by the @ref NG_NETAPI_MSG_TYPE_ACK message
* @return value returned by the @ref NG_NETAPI_MSG_TYPE_ACK message
*/
*/
int
ng_netapi_get
(
kernel_pid_t
pid
,
ng_netconf_opt_t
opt
,
uint16_t
context
,
int
ng_netapi_get
(
kernel_pid_t
pid
,
ng_netconf_opt_t
opt
,
uint16_t
context
,
void
*
data
,
size_t
data
_len
);
void
*
data
,
size_t
max
_len
);
/**
/**
* @brief Shortcut function for sending @ref NG_NETAPI_MSG_TYPE_SET messages and
* @brief Shortcut function for sending @ref NG_NETAPI_MSG_TYPE_SET messages and
...
...
This diff is collapsed.
Click to expand it.
sys/include/net/ng_netdev.h
+
7
−
6
View file @
da44b0dc
...
@@ -115,17 +115,17 @@ typedef struct {
...
@@ -115,17 +115,17 @@ typedef struct {
* @param[in] dev network device descriptor
* @param[in] dev network device descriptor
* @param[in] opt option type
* @param[in] opt option type
* @param[out] value pointer to store the option's value in
* @param[out] value pointer to store the option's value in
* @param[in,out] value_len the length of @p value. Must be initialized to
* @param[in] max_len maximal amount of byte that fit into @p value
* the available space in @p value on call.
*
*
* @return
0 on success
* @return
number of bytes written to @p value
* @return -ENODEV if @p dev is invalid
* @return -ENODEV if @p dev is invalid
* @return -ENOTSUP if @p opt is not supported
* @return -ENOTSUP if @p opt is not supported
* @return -EOVERFLOW if available space in @p value given in
* @return -EOVERFLOW if available space in @p value given in
* @p value_len is too small to store the option value
* @p max_len is too small to store the option value
* @return -ECANCELED if internal driver error occurred
*/
*/
int
(
*
get
)(
ng_netdev_t
*
dev
,
ng_netconf_opt_t
opt
,
int
(
*
get
)(
ng_netdev_t
*
dev
,
ng_netconf_opt_t
opt
,
void
*
value
,
size_t
*
value
_len
);
void
*
value
,
size_t
max
_len
);
/**
/**
* @brief Set an option value for a given network device
* @brief Set an option value for a given network device
...
@@ -135,10 +135,11 @@ typedef struct {
...
@@ -135,10 +135,11 @@ typedef struct {
* @param[in] value value to set
* @param[in] value value to set
* @param[in] value_len the length of @p value
* @param[in] value_len the length of @p value
*
*
* @return
0 on success
* @return
number of bytes used from @p value
* @return -ENODEV if @p dev is invalid
* @return -ENODEV if @p dev is invalid
* @return -ENOTSUP if @p opt is not supported
* @return -ENOTSUP if @p opt is not supported
* @return -EINVAL if @p value is invalid
* @return -EINVAL if @p value is invalid
* @return -ECANCELED if internal driver error occurred
*/
*/
int
(
*
set
)(
ng_netdev_t
*
dev
,
ng_netconf_opt_t
opt
,
int
(
*
set
)(
ng_netdev_t
*
dev
,
ng_netconf_opt_t
opt
,
void
*
value
,
size_t
value_len
);
void
*
value
,
size_t
value_len
);
...
...
This diff is collapsed.
Click to expand it.
sys/net/link_layer/ng_nomac/ng_nomac.c
+
3
−
2
View file @
da44b0dc
...
@@ -110,6 +110,7 @@ static void *_nomac_thread(void *args)
...
@@ -110,6 +110,7 @@ static void *_nomac_thread(void *args)
opt
=
(
ng_netapi_opt_t
*
)
msg
.
content
.
ptr
;
opt
=
(
ng_netapi_opt_t
*
)
msg
.
content
.
ptr
;
/* set option for device driver */
/* set option for device driver */
res
=
dev
->
driver
->
set
(
dev
,
opt
->
opt
,
opt
->
data
,
opt
->
data_len
);
res
=
dev
->
driver
->
set
(
dev
,
opt
->
opt
,
opt
->
data
,
opt
->
data_len
);
DEBUG
(
"nomac: response of netdev->set: %i
\n
"
,
res
);
/* send reply to calling thread */
/* send reply to calling thread */
reply
.
type
=
NG_NETAPI_MSG_TYPE_ACK
;
reply
.
type
=
NG_NETAPI_MSG_TYPE_ACK
;
reply
.
content
.
value
=
(
uint32_t
)
res
;
reply
.
content
.
value
=
(
uint32_t
)
res
;
...
@@ -122,8 +123,8 @@ static void *_nomac_thread(void *args)
...
@@ -122,8 +123,8 @@ static void *_nomac_thread(void *args)
/* read incoming options */
/* read incoming options */
opt
=
(
ng_netapi_opt_t
*
)
msg
.
content
.
ptr
;
opt
=
(
ng_netapi_opt_t
*
)
msg
.
content
.
ptr
;
/* get option from device driver */
/* get option from device driver */
res
=
dev
->
driver
->
get
(
dev
,
opt
->
opt
,
opt
->
data
,
res
=
dev
->
driver
->
get
(
dev
,
opt
->
opt
,
opt
->
data
,
opt
->
data_len
);
(
size_t
*
)(
&
(
opt
->
data_len
))
);
DEBUG
(
"nomac: response of netdev->get: %i
\n
"
,
res
);
/* send reply to calling thread */
/* send reply to calling thread */
reply
.
type
=
NG_NETAPI_MSG_TYPE_ACK
;
reply
.
type
=
NG_NETAPI_MSG_TYPE_ACK
;
reply
.
content
.
value
=
(
uint32_t
)
res
;
reply
.
content
.
value
=
(
uint32_t
)
res
;
...
...
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