Skip to content

Commit

Permalink
add define for CoAP protocol version
Browse files Browse the repository at this point in the history
  • Loading branch information
smlng committed Aug 18, 2016
1 parent e5303d7 commit d3571be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions coap.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int coap_make_request(const uint16_t msgid, const coap_buffer_t* tok,
if ((path->count + 1) > COAP_MAX_OPTIONS)
return COAP_ERR_BUFFER_TOO_SMALL;
// init request header
pkt->hdr.ver = 0x01;
pkt->hdr.ver = COAP_VERSION;
pkt->hdr.t = msg_type;
pkt->hdr.tkl = 0;
pkt->hdr.code = resource->method;
Expand Down Expand Up @@ -197,7 +197,7 @@ int coap_make_response(const uint16_t msgid, const coap_buffer_t* tok,
const uint8_t *content, const size_t content_len,
coap_packet_t *pkt)
{
pkt->hdr.ver = 0x01;
pkt->hdr.ver = COAP_VERSION;
pkt->hdr.t = msgtype;
pkt->hdr.tkl = 0;
pkt->hdr.code = rspcode;
Expand Down
2 changes: 2 additions & 0 deletions coap.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ extern "C" {
#include <stdbool.h>
#include <stddef.h>

#define COAP_VERSION (0x01) //!< The CoAP protocol version used

#define COAP_DEFAULT_PORT 5683 //!< The port number used by the CoAP protocol.
#define COAPS_DEFAULT_PORT 5684 //!< The port number used by the CoAPs protocol.

Expand Down

0 comments on commit d3571be

Please sign in to comment.