2016-05-12 04:36:12 +08:00
|
|
|
---
|
|
|
|
title: "mg_coap_parse()"
|
|
|
|
decl_name: "mg_coap_parse"
|
|
|
|
symbol_kind: "func"
|
|
|
|
signature: |
|
|
|
|
uint32_t mg_coap_parse(struct mbuf *io, struct mg_coap_message *cm);
|
|
|
|
---
|
|
|
|
|
2016-07-26 22:53:33 +08:00
|
|
|
Parses CoAP message and fills mg_coap_message and returns cm->flags.
|
2016-05-12 04:36:12 +08:00
|
|
|
This is a helper function.
|
|
|
|
|
2016-07-26 22:53:33 +08:00
|
|
|
NOTE: usually CoAP works over UDP, so lack of data means format error.
|
|
|
|
But, in theory, it is possible to use CoAP over TCP (according to RFC)
|
2016-05-12 04:36:12 +08:00
|
|
|
|
2016-07-26 22:53:33 +08:00
|
|
|
The caller has to check results and treat COAP_NOT_ENOUGH_DATA according to
|
2016-05-12 04:36:12 +08:00
|
|
|
underlying protocol:
|
|
|
|
|
|
|
|
- in case of UDP COAP_NOT_ENOUGH_DATA means COAP_FORMAT_ERROR,
|
|
|
|
- in case of TCP client can try to receive more data
|
|
|
|
|
|
|
|
Return value: see `mg_coap_send_message()`
|
|
|
|
|