SatCat5
coap_reader.h File Reference

Detailed Description

Message parsing for the Constrained Applications Protocol (CoAP)

This file implements message parsing for the Constrained Applications Protocol (CoAP) defined in IETF RFC-7252: https://www.rfc-editor.org/rfc/rfc7252

The coap::Reader object is typically ephemeral:

  • Create a coap::Reader object, attaching to any Readable source.
  • Constructor automatically reads basic header information.
  • User should call read_read() to access the message contents.
  • Destroy the coap::Reader object to finalize the parsing process.

Any of these actions, including object creation, may trigger an error. The error state can be checked via the error() function. If errored, error_code() MUST return a the correct response code for the error, or CODE_EMPTY if a Reset is required, and error_msg() MAY contain a diagnostic payload.

Options are parsed by the coap::Reader::read_options() method. Children of coap::Reader MUST call this method in their constructor. The coap::Reader class handles several CoAP options itself; other options of interest MAY be supported in child classes by overriding the read_user_option() method. If adding vendor-specific options, the chosen Option Number(s) MUST be in the range [2048, 65000) per RFC7252 ยง12.2.

Definition in file coap_reader.h.

Include dependency graph for coap_reader.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  satcat5::coap::Option
 Accessor for a single CoAP option field. More...
 
class  satcat5::coap::ReadHeader
 Parser for CoAP message headers only. More...
 
class  satcat5::coap::Reader
 Base-class for parsing CoAP message headers and options. More...
 
class  satcat5::coap::ReadSimple
 Wrapper for coap::ReadOptions that automatically parses options, rejecting any message with unrecognized Critical options. More...
 

Macros

#define SATCAT5_COAP_MAX_URI_PATH_LEN   64