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
b9f63540
Commit
b9f63540
authored
6 years ago
by
Ken Bannister
Browse files
Options
Downloads
Patches
Plain Diff
net/nanocoap: document function that writes option header
parent
4e5de1b7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sys/net/application_layer/nanocoap/nanocoap.c
+29
-1
29 additions, 1 deletion
sys/net/application_layer/nanocoap/nanocoap.c
with
29 additions
and
1 deletion
sys/net/application_layer/nanocoap/nanocoap.c
+
29
−
1
View file @
b9f63540
...
...
@@ -499,7 +499,35 @@ static size_t _encode_uint(uint32_t *val)
return
size
;
}
static
unsigned
_put_delta_optlen
(
uint8_t
*
buf
,
unsigned
offset
,
unsigned
shift
,
unsigned
val
)
/*
* Writes CoAP Option header. Expected to be called twice to write an option:
*
* 1. write delta, using offset 1, shift 4
* 2. write length, using offset n, shift 0, where n is the return value from
* the first invocation of this function
*
* 0 1 2 3 4 5 6 7
* +---------------+---------------+
* | Option Delta | Option Length | 1 byte
* +---------------+---------------+
* / Option Delta / 0-2 bytes
* \ (extended) \
* +-------------------------------+
* / Option Length / 0-2 bytes
* \ (extended) \
* +-------------------------------+
*
* From RFC 7252, Figure 8
*
* param[out] buf addr of byte 0 of header
* param[in] offset offset from buf to write any extended header
* param[in] shift bit shift for byte 0 value
* param[in] value delta/length value to write to header
*
* return offset from byte 0 of next byte to write
*/
static
unsigned
_put_delta_optlen
(
uint8_t
*
buf
,
unsigned
offset
,
unsigned
shift
,
unsigned
val
)
{
if
(
val
<
13
)
{
*
buf
|=
(
val
<<
shift
);
...
...
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