nRF5 SDK v16.0.0
Data Structures | Macros | Typedefs | Functions
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
 

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_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.
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_optPointer to block2 option structure to be filled by the function. Must not be NULL.
[in]encodedEncoded version of the coap block2 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_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_encodedEncoded version of the coap block2 option value. Must not be NULL.
[in]p_optPointer to block2 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.

Documentation feedback | Developer Zone | Subscribe | Updated