[coap] add support for CoAP header exceeding 255 bytes (#3210)

This commit is contained in:
Łukasz Duda
2018-10-25 21:08:17 -07:00
committed by Jonathan Hui
parent 597a81fd0a
commit 52669a925a
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -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
+1 -1
View File
@@ -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:
+1 -1
View File
@@ -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.