nRF5 IoT SDK  v0.9.0
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
CoAP Block transfer

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

Data Structures

struct  coap_block_opt_block1_t
 

Macros

#define COAP_BLOCK_OPT_BLOCK_MORE_BIT_UNSET   0
 
#define COAP_BLOCK_OPT_BLOCK_MORE_BIT_SET   1
 

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...
 

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_optPointer to block1 option structure to be filled by the function. Must not be NULL.
[in]encodedEncoded version of the coap block1 option value.
Return values
NRF_SUCCESSIf decoding of the option was successful.
NRF_ERROR_NULLIf p_opt parameter is NULL.
NRF_ERROR_INVALID_PARAMIf the block number is higher then allowed by spec (more than 20 bits).
NRF_ERROR_INVALID_DATAIf 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_encodedEncoded version of the coap block1 option value. Must not be NULL.
[in]p_optPointer to block1 option structure to be decoded into uint format. Must not be NULL.
Return values
NRF_SUCCESSIf encoding of option was successful.
NRF_ERROR_NULLIf one of the parameters supplied is a null pointer.
NRF_ERROR_INVALID_PARAMIf one of the fields in the option structure has an illegal value.