Merge pull request #298 from alessandrelli/er-coap-13-token-fix

Fix for coap_get_header_token() always returning 0 when using CoAP draft v13
This commit is contained in:
Nicolas Tsiftes 2013-07-23 14:35:25 -07:00
commit 14a2483a48
2 changed files with 0 additions and 4 deletions

View file

@ -822,8 +822,6 @@ coap_get_header_token(void *packet, const uint8_t **token)
{ {
coap_packet_t *const coap_pkt = (coap_packet_t *) packet; coap_packet_t *const coap_pkt = (coap_packet_t *) packet;
if (!IS_OPTION(coap_pkt, COAP_OPTION_TOKEN)) return 0;
*token = coap_pkt->token; *token = coap_pkt->token;
return coap_pkt->token_len; return coap_pkt->token_len;
} }
@ -836,7 +834,6 @@ coap_set_header_token(void *packet, const uint8_t *token, size_t token_len)
coap_pkt->token_len = MIN(COAP_TOKEN_LEN, token_len); coap_pkt->token_len = MIN(COAP_TOKEN_LEN, token_len);
memcpy(coap_pkt->token, token, coap_pkt->token_len); memcpy(coap_pkt->token, token, coap_pkt->token_len);
SET_OPTION(coap_pkt, COAP_OPTION_TOKEN);
return coap_pkt->token_len; return coap_pkt->token_len;
} }
/*-----------------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------------*/

View file

@ -172,7 +172,6 @@ typedef enum {
COAP_OPTION_MAX_AGE = 14, /* 0-4 B */ COAP_OPTION_MAX_AGE = 14, /* 0-4 B */
COAP_OPTION_URI_QUERY = 15, /* 0-270 B */ COAP_OPTION_URI_QUERY = 15, /* 0-270 B */
COAP_OPTION_ACCEPT = 16, /* 0-2 B */ COAP_OPTION_ACCEPT = 16, /* 0-2 B */
COAP_OPTION_TOKEN = 19, /* 1-8 B */
COAP_OPTION_LOCATION_QUERY = 20, /* 1-270 B */ COAP_OPTION_LOCATION_QUERY = 20, /* 1-270 B */
COAP_OPTION_BLOCK2 = 23, /* 1-3 B */ COAP_OPTION_BLOCK2 = 23, /* 1-3 B */
COAP_OPTION_BLOCK1 = 27, /* 1-3 B */ COAP_OPTION_BLOCK1 = 27, /* 1-3 B */