CoAP Block transfer

nRF5 SDK v15.0.0

CoAP block transfer options encoding and decoding interface and definitions. More...

Data Structures

struct coap_block_opt_block1_t

Typedefs

typedef coap_block_opt_block1_t coap_block_opt_block2_t

Functions

uint32_t coap_block_opt_block1_encode (uint32_t *p_encoded, coap_block_opt_block1_t *p_opt)
Encode block1 option into its uint binary counter part. More...
uint32_t coap_block_opt_block1_decode ( coap_block_opt_block1_t *p_opt, uint32_t encoded)
Decode block1 option from a uint to its structure counter part. More...
uint32_t coap_block_opt_block2_encode (uint32_t *p_encoded, coap_block_opt_block2_t *p_opt)
Encode block2 option into its uint binary counter part. More...
uint32_t coap_block_opt_block2_decode ( coap_block_opt_block2_t *p_opt, uint32_t encoded)
Decode block2 option from a uint to its structure counter part. More...

Detailed Description

CoAP block transfer options encoding and decoding interface and definitions.

Macro Definition Documentation

#define COAP_BLOCK_OPT_BLOCK_MORE_BIT_SET   1

Value when more flag is not set.

#define COAP_BLOCK_OPT_BLOCK_MORE_BIT_UNSET   0

Value when more flag is set.

Function Documentation

uint32_t coap_block_opt_block1_decode ( coap_block_opt_block1_t * p_opt ,
uint32_t encoded
)

Decode block1 option from a uint to its structure counter part.

Parameters
[out] p_opt Pointer to block1 option structure to be filled by the function. Must not be NULL.
[in] encoded Encoded version of the coap block1 option value.
Return values
NRF_SUCCESS If decoding of the option was successful.
NRF_ERROR_NULL If p_opt parameter is NULL.
NRF_ERROR_INVALID_PARAM If the block number is higher then allowed by spec (more than 20 bits).
NRF_ERROR_INVALID_DATA If the size has the value of the reserved 2048 value (7).
uint32_t coap_block_opt_block1_encode ( uint32_t * p_encoded ,
coap_block_opt_block1_t * p_opt
)

Encode block1 option into its uint binary counter part.

Parameters
[out] p_encoded Encoded version of the coap block1 option value. Must not be NULL.
[in] p_opt Pointer to block1 option structure to be decoded into uint format. Must not be NULL.
Return values
NRF_SUCCESS If encoding of option was successful.
NRF_ERROR_NULL If one of the parameters supplied is a null pointer.
NRF_ERROR_INVALID_PARAM If one of the fields in the option structure has an illegal value.
uint32_t coap_block_opt_block2_decode ( coap_block_opt_block2_t * p_opt ,
uint32_t encoded
)

Decode block2 option from a uint to its structure counter part.

Parameters
[out] p_opt Pointer to block2 option structure to be filled by the function. Must not be NULL.
[in] encoded Encoded version of the coap block2 option value.
Return values
NRF_SUCCESS If decoding of the option was successful.
NRF_ERROR_NULL If p_opt parameter is NULL.
NRF_ERROR_INVALID_PARAM If the block number is higher then allowed by spec (more than 20 bits).
NRF_ERROR_INVALID_DATA If the size has the value of the reserved 2048 value (7).
uint32_t coap_block_opt_block2_encode ( uint32_t * p_encoded ,
coap_block_opt_block2_t * p_opt
)

Encode block2 option into its uint binary counter part.

Parameters
[out] p_encoded Encoded version of the coap block2 option value. Must not be NULL.
[in] p_opt Pointer to block2 option structure to be decoded into uint format. Must not be NULL.
Return values
NRF_SUCCESS If encoding of option was successful.
NRF_ERROR_NULL If one of the parameters supplied is a null pointer.
NRF_ERROR_INVALID_PARAM If one of the fields in the option structure has an illegal value.