mirror of
https://github.com/espressif/openthread.git
synced 2026-08-12 05:37:46 +00:00
[coap] add support for CoAP header exceeding 255 bytes (#3210)
This commit is contained in:
committed by
Jonathan Hui
parent
597a81fd0a
commit
52669a925a
@@ -165,7 +165,7 @@ typedef enum otCoapOptionContentFormat {
|
||||
OT_COAP_OPTION_CONTENT_FORMAT_JWS = 101 ///< application/json-web-signature
|
||||
} otCoapOptionContentFormat;
|
||||
|
||||
#define OT_COAP_HEADER_MAX_LENGTH 128 ///< Max CoAP header length (bytes)
|
||||
#define OT_COAP_HEADER_MAX_LENGTH 512 ///< Max CoAP header length (bytes)
|
||||
|
||||
/**
|
||||
* This structure represents a CoAP header.
|
||||
@@ -183,7 +183,7 @@ typedef struct otCoapHeader
|
||||
} mFields; ///< Structure representing a CoAP base header
|
||||
uint8_t mBytes[OT_COAP_HEADER_MAX_LENGTH]; ///< The raw byte encoding for the CoAP header
|
||||
} mHeader; ///< The CoAP header encoding
|
||||
uint8_t mHeaderLength; ///< The CoAP header length (bytes)
|
||||
uint16_t mHeaderLength; ///< The CoAP header length (bytes)
|
||||
uint16_t mOptionLast; ///< The last CoAP Option Number value
|
||||
uint16_t mFirstOptionOffset; ///< The byte offset for the first CoAP Option
|
||||
uint16_t mNextOptionOffset; ///< The byte offset for the next CoAP Option
|
||||
|
||||
@@ -249,7 +249,7 @@ otError Header::AppendOption(const Option &aOption)
|
||||
memcpy(cur, aOption.mValue, aOption.mLength);
|
||||
cur += aOption.mLength;
|
||||
|
||||
mHeaderLength += static_cast<uint8_t>(cur - buf);
|
||||
mHeaderLength += static_cast<uint16_t>(cur - buf);
|
||||
mOptionLast = aOption.mNumber;
|
||||
|
||||
exit:
|
||||
|
||||
@@ -402,7 +402,7 @@ public:
|
||||
* @returns The header length in bytes.
|
||||
*
|
||||
*/
|
||||
uint8_t GetLength(void) const { return mHeaderLength; }
|
||||
uint16_t GetLength(void) const { return mHeaderLength; }
|
||||
|
||||
/**
|
||||
* This method sets a default response header based on request header.
|
||||
|
||||
Reference in New Issue
Block a user