Skip to content

Commit

Permalink
fixup! return codes and flag defines
Browse files Browse the repository at this point in the history
  • Loading branch information
kb2ma committed May 28, 2018
1 parent 47d1f91 commit ca3da41
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sys/include/net/nanocoap.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ extern "C" {
* @{
*/
/** @brief no special handling required */
#define COAP_OPT_FINISH_NONE (0x0)
#define COAP_OPT_FINISH_NONE (0x0000)
/** @brief expect a payload to follow */
#define COAP_OPT_FINISH_PAYLOAD (0x1)
#define COAP_OPT_FINISH_PAYLOAD (0x0001)
/** @} */

/**
Expand Down Expand Up @@ -542,6 +542,7 @@ size_t coap_put_block1_ok(uint8_t *pkt_pos, coap_block1_t *block1, uint16_t last
* @param[in] separator character used in @p string to separate parts
*
* @return number of bytes written to buffer
* @return -ENOSPC if no available options
*/
ssize_t coap_opt_add_string(coap_pkt_t *pkt, uint16_t optnum, const char *string, char separator);

Expand All @@ -556,6 +557,7 @@ ssize_t coap_opt_add_string(coap_pkt_t *pkt, uint16_t optnum, const char *string
* @param[in] value uint to encode
*
* @return number of bytes written to buffer
* @return <0 reserved for error but not implemented yet
*/
ssize_t coap_opt_add_uint(coap_pkt_t *pkt, uint16_t optnum, uint32_t value);

Expand Down
3 changes: 3 additions & 0 deletions sys/net/application_layer/nanocoap/nanocoap.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ ssize_t coap_opt_add_string(coap_pkt_t *pkt, uint16_t optnum, const char *string
part_len = (uint8_t *)uripos - part_start;

if (part_len) {
if (pkt->options_len == NANOCOAP_NOPTS_MAX) {
return -ENOSPC;
}
write_len += _add_opt_pkt(pkt, optnum, part_start, part_len);
}
}
Expand Down

0 comments on commit ca3da41

Please sign in to comment.