diff --git a/include/coap/pdu.h b/include/coap/pdu.h index 7cdc174ef2..ca37071520 100644 --- a/include/coap/pdu.h +++ b/include/coap/pdu.h @@ -621,7 +621,7 @@ int coap_add_token2(coap_pdu_t *pdu, size_t len, const unsigned char *data, */ int coap_add_token_to_empty_message(coap_pdu_t *pdu, size_t len, const unsigned char *data, coap_transport_t transport); - + /** * Get token from coap header * diff --git a/src/pdu.c b/src/pdu.c index d5bfded7a6..5d531888ae 100644 --- a/src/pdu.c +++ b/src/pdu.c @@ -950,6 +950,7 @@ coap_pdu_parse2(unsigned char *data, size_t length, coap_pdu_t *pdu, switch (transport) { case COAP_UDP: break; +#if defined(WITH_TCP) case COAP_TCP: for (size_t i = 0 ; i < headerSize ; i++) { pdu->transport_hdr->tcp.header_data[i] = data[i]; @@ -984,6 +985,8 @@ coap_pdu_parse2(unsigned char *data, size_t length, coap_pdu_t *pdu, opt = ((unsigned char *) &(pdu->transport_hdr->tcp_32bit)) + headerSize + tokenLength; break; +#endif +#if defined(WITH_WS) case COAP_WS: for (size_t i = 0 ; i < headerSize ; i++) { pdu->transport_hdr->ws.header_data[i] = data[i]; @@ -993,6 +996,7 @@ coap_pdu_parse2(unsigned char *data, size_t length, coap_pdu_t *pdu, opt = ((unsigned char *) &(pdu->transport_hdr->ws)) + headerSize + tokenLength; break; +#endif default: printf("it has wrong type\n"); }