Skip to content

Commit

Permalink
Merge pull request #18668 from miri64/coap/enh/coap_v1
Browse files Browse the repository at this point in the history
coap: provide definition for version field value
  • Loading branch information
benpicco authored Sep 29, 2022
2 parents 6257e32 + b9d7028 commit 0e181e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions sys/include/net/coap.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ extern "C" {
*/
#define COAP_PORT (5683)

#define COAP_V1 (1) /**< Identifier for CoAP version 1 (RFC 7252) */

/**
* @name CoAP option numbers
* @{
Expand Down
2 changes: 1 addition & 1 deletion sys/net/application_layer/nanocoap/nanocoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ ssize_t coap_build_hdr(coap_hdr_t *hdr, unsigned type, uint8_t *token, size_t to
assert(!(token_len & ~0x1f));

memset(hdr, 0, sizeof(coap_hdr_t));
hdr->ver_t_tkl = (0x1 << 6) | (type << 4) | token_len;
hdr->ver_t_tkl = (COAP_V1 << 6) | (type << 4) | token_len;
hdr->code = code;
hdr->id = htons(id);

Expand Down

0 comments on commit 0e181e9

Please sign in to comment.