40 #ifndef SATCAT5_COAP_MAX_URI_PATH_LEN
41 #define SATCAT5_COAP_MAX_URI_PATH_LEN 64
51 u16
id()
const {
return m_id; }
53 u16
len()
const {
return m_len; }
73 inline Option* reset(
unsigned len)
103 {
return m_state == State::ERROR; }
121 {
return type() == TYPE_CON ||
type() == TYPE_NON; }
123 {
return type() == TYPE_ACK; }
129 enum class State {OPTIONS, DATA, ERROR};
Accessor for a single CoAP option field.
bool no_cache_key() const
Option bit mapping indicates relevant properties (Section 5.4.6).
u16 len() const
Option Number (RFC-7252, Section 3.1).
bool is_critical() const
Option bit mapping indicates relevant properties (Section 5.4.6).
u16 id() const
Option Number (RFC-7252, Section 3.1).
unsigned value_str(char *dst)
Access the Option Value as a UTF-8 string ("string").
u64 value_uint()
Access the Option Value as an unsigned integer ("uint").
bool is_unsafe() const
Option bit mapping indicates relevant properties (Section 5.4.6).
Wrapper for coap::ReadOptions that automatically parses options, rejecting any message with unrecogni...
ReadSimple(satcat5::io::Readable *src)
Wrapper object automatically reads header and options.
void read_user_option() override
The default implementation simply rejects any unsupported "Critical" Option as defined in RFC 7252,...
Base-class for parsing CoAP message headers and options.
void read_options()
Read all option headers, storing supported option fields.
satcat5::util::optional< u64 > size1() const
Accessors for parsed options.
bool block1_more() const
Accessors for parsed options.
bool block2_more() const
Accessors for parsed options.
unsigned m_uri_path_wridx
Index into m_uri_path
satcat5::util::optional< u64 > m_block2
Block2.
satcat5::util::optional< const char * > uri_path() const
Accessors for parsed options.
u32 block1_num() const
Accessors for parsed options.
u16 block_size() const
Accessors for parsed options.
satcat5::util::optional< u64 > block2()
Accessors for parsed options.
satcat5::util::optional< u64 > m_size1
Size1.
bool block_more() const
Accessors for parsed options.
char m_uri_path[SATCAT5_COAP_MAX_URI_PATH_LEN+1]
URI path for this request.
u16 block1_size() const
Accessors for parsed options.
u16 block2_size() const
Accessors for parsed options.
u32 block_num() const
Accessors for parsed options.
void append_uri_path()
Uri-Path string builder.
satcat5::util::optional< u64 > m_block1
Block1.
satcat5::util::optional< u64 > block1() const
Accessors for parsed options.
satcat5::util::optional< u16 > format() const
Accessors for parsed options.
satcat5::util::optional< u16 > m_format
Content-Format.
satcat5::util::optional< u64 > block() const
Accessors for parsed options.
Reader(satcat5::io::Readable *src)
Create this object and read the message header.
virtual void read_user_option()=0
Handler called for each option with an unknown ID.
u32 block2_num() const
Accessors for parsed options.
Limited read of next N bytes.
void read_reset(unsigned rem)
Children may reset the number of remaining bytes.
constexpr LimitedRead(satcat5::io::Readable *src, unsigned maxrd)
Explicitly set maximum read length in bytes.
Abstract API for reading byte-streams and packets.
virtual void read_finalize()
Consume any remaining bytes in this frame, if applicable.
Constants relating to the Constrained Applications Protocol (CoAP)
"Readable" I/O interface core definitions
CoAP message header CODE field (Section 12.1).
An optional field that may be filled or empty.
T value() const
Fetch the inner value.
Miscellaneous mathematical utility functions.