mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-28 01:27:09 +03:00
Merge pull request #408 from mrdeep1/encode8
encode.c: Support encoding/decoding 8 byte options
This commit is contained in:
4 files changed
+65
-4
No files matched your search
+31
-4
@@ -47,7 +47,7 @@ extern int coap_flsll(long long i);
|
||||
|
||||
/**
|
||||
* Decodes multiple-length byte sequences. @p buf points to an input byte
|
||||
* sequence of length @p length. Returns the decoded value.
|
||||
* sequence of length @p length. Returns the up to 4 byte decoded value.
|
||||
*
|
||||
* @param buf The input byte sequence to decode from
|
||||
* @param length The length of the input byte sequence
|
||||
@@ -56,13 +56,24 @@ extern int coap_flsll(long long i);
|
||||
*/
|
||||
unsigned int coap_decode_var_bytes(const uint8_t *buf, unsigned int length);
|
||||
|
||||
/**
|
||||
* Decodes multiple-length byte sequences. @p buf points to an input byte
|
||||
* sequence of length @p length. Returns the up to 8 byte decoded value.
|
||||
*
|
||||
* @param buf The input byte sequence to decode from
|
||||
* @param length The length of the input byte sequence
|
||||
*
|
||||
* @return The decoded value
|
||||
*/
|
||||
uint64_t coap_decode_var_bytes8(const uint8_t *buf, unsigned int length);
|
||||
|
||||
/**
|
||||
* Encodes multiple-length byte sequences. @p buf points to an output buffer of
|
||||
* sufficient length to store the encoded bytes. @p value is the value to
|
||||
* encode.
|
||||
* sufficient length to store the encoded bytes. @p value is the 4 byte value
|
||||
* to encode.
|
||||
* Returns the number of bytes used to encode @p value or 0 on error.
|
||||
*
|
||||
* @param buf The output buffer to decode into
|
||||
* @param buf The output buffer to encode into
|
||||
* @param length The output buffer size to encode into (must be sufficient)
|
||||
* @param value The value to encode into the buffer
|
||||
*
|
||||
@@ -72,6 +83,22 @@ unsigned int coap_encode_var_safe(uint8_t *buf,
|
||||
size_t length,
|
||||
unsigned int value);
|
||||
|
||||
/**
|
||||
* Encodes multiple-length byte sequences. @p buf points to an output buffer of
|
||||
* sufficient length to store the encoded bytes. @p value is the 8 byte value
|
||||
* to encode.
|
||||
* Returns the number of bytes used to encode @p value or 0 on error.
|
||||
*
|
||||
* @param buf The output buffer to encode into
|
||||
* @param length The output buffer size to encode into (must be sufficient)
|
||||
* @param value The value to encode into the buffer
|
||||
*
|
||||
* @return The number of bytes used to encode @p value or @c 0 on error.
|
||||
*/
|
||||
unsigned int coap_encode_var_safe8(uint8_t *buf,
|
||||
size_t length,
|
||||
uint64_t value);
|
||||
|
||||
/**
|
||||
* @deprecated Use coap_encode_var_safe() instead.
|
||||
* Provided for backward compatibility. As @p value has a
|
||||
|
||||
Reference in new issue
Block a user