block.c File Reference
`#include "coap3/coap_internal.h"`
Include dependency graph for block.c:

Go to the source code of this file.

## Macros

#define | min(a, b) ((a) < (b) ? (a) : (b))
#define | MAX_BLK_LEN (((1 << 20) - 1) * (1 << (6 + 4)))

## Functions

unsigned int | coap_opt_block_num (const coap_opt_t *block_opt)
| Returns the value of field `num` in the given block option `block_opt`. More...
int | coap_get_block (const coap_pdu_t *pdu, coap_option_num_t number, coap_block_t *block)
| Initializes `block` from `pdu`. More...
int | coap_write_block_opt (coap_block_t *block, coap_option_num_t number, coap_pdu_t *pdu, size_t data_length)
| Writes a block option of type `number` to message `pdu`. More...
int | coap_add_block (coap_pdu_t *pdu, size_t len, const uint8_t *data, unsigned int block_num, unsigned char block_szx)
| Adds the `block_num` block of size 1 << (`block_szx` + 4) from source `data` to `pdu`. More...
void | coap_add_data_blocked_response (const coap_pdu_t *request, coap_pdu_t *response, uint16_t media_type, int maxage, size_t length, const uint8_t *data)
| Adds the appropriate part of `data` to the `response` pdu. More...
void | coap_context_set_block_mode (coap_context_t *context, uint8_t block_mode)
| Set the context level CoAP block handling bits for handling RFC7959. More...
COAP_STATIC_INLINE int | block_token_match (const uint8_t *a, size_t alen, const uint8_t *b, size_t blen)
COAP_STATIC_INLINE int | full_match (const uint8_t *a, size_t alen, const uint8_t *b, size_t blen)
int | coap_cancel_observe (coap_session_t *session, coap_binary_t *token, coap_pdu_type_t type)
| Cancel an observe that is being tracked by the client large receive logic. More...
int | coap_add_data_large_internal (coap_session_t *session, coap_pdu_t *pdu, coap_resource_t *resource, const coap_string_t *query, int maxage, uint64_t etag, size_t length, const uint8_t *data, coap_release_large_data_t release_func, void *app_ptr)
| The function that does all the work for the coap_add_data_large*() functions. More...
int | coap_add_data_large_request (coap_session_t *session, coap_pdu_t *pdu, size_t length, const uint8_t *data, coap_release_large_data_t release_func, void *app_ptr)
| Associates given data with the `pdu` that is passed as second parameter. More...
int | coap_add_data_large_response (coap_resource_t *resource, coap_session_t *session, const coap_pdu_t *request, coap_pdu_t *response, const coap_string_t *query, uint16_t media_type, int maxage, uint64_t etag, size_t length, const uint8_t *data, coap_release_large_data_t release_func, void *app_ptr)
| Associates given data with the `response` pdu that is passed as fourth parameter. More...
coap_tick_t | coap_block_check_lg_crcv_timeouts (coap_session_t *session, coap_tick_t now)
static int | check_if_received_block (coap_rblock_t *rec_blocks, uint32_t block_num)
static int | check_all_blocks_in (coap_rblock_t *rec_blocks, size_t total_blocks)
coap_tick_t | coap_block_check_lg_srcv_timeouts (coap_session_t *session, coap_tick_t now)
coap_lg_crcv_t * | coap_block_new_lg_crcv (coap_session_t *session, coap_pdu_t *pdu)
void | coap_block_delete_lg_crcv (coap_session_t *session, coap_lg_crcv_t *lg_crcv)
void | coap_block_delete_lg_srcv (coap_session_t *session, coap_lg_srcv_t *lg_srcv)
void | coap_block_delete_lg_xmit (coap_session_t *session, coap_lg_xmit_t *lg_xmit)
static int | add_block_send (uint32_t num, uint32_t *out_blocks, uint32_t *count, uint32_t max_count)
int | coap_handle_request_send_block (coap_session_t *session, coap_pdu_t *pdu, coap_pdu_t *response, coap_resource_t *resource, coap_string_t *query)
static int | update_received_blocks (coap_rblock_t *rec_blocks, uint32_t block_num)
int | coap_handle_request_put_block (coap_context_t *context, coap_session_t *session, coap_pdu_t *pdu, coap_pdu_t *response, coap_resource_t *resource, coap_string_t *uri_path, coap_opt_t *observe, coap_string_t *query, coap_method_handler_t h, int *added_block)
int | coap_handle_response_send_block (coap_session_t *session, coap_pdu_t *rcvd)
coap_binary_t * | coap_block_build_body (coap_binary_t *body_data, size_t length, const uint8_t *data, size_t offset, size_t total)
| Re-assemble payloads into a body. More...
int | coap_handle_response_get_block (coap_context_t *context, coap_session_t *session, coap_pdu_t *sent, coap_pdu_t *rcvd, coap_recurse_t recursive)
void | coap_check_code_lg_xmit (coap_session_t *session, coap_pdu_t *response, coap_resource_t *resource, coap_string_t *query)
| The function checks that the code in a newly formed lg_xmit created by coap_add_data_large_response() is updated. More...

## Macro Definition Documentation

## MAX_BLK_LEN

#define MAX_BLK_LEN (((1 << 20) - 1) * (1 << (6 + 4)))

## min

#define min | ( |  | a,
|  |  | b
| ) |  | ((a) < (b) ? (a) : (b))

Definition at line 14 of file block.c.

## Function Documentation

## add_block_send()

static int add_block_send | ( | uint32_t | num,
|  | uint32_t * | out_blocks,
|  | uint32_t * | count,
|  | uint32_t | max_count
| ) |  |

static

Definition at line 912 of file block.c.

Here is the caller graph for this function:

## block_token_match()

COAP_STATIC_INLINE int block_token_match | ( | const uint8_t * | a,
|  | size_t | alen,
|  | const uint8_t * | b,
|  | size_t | blen
| ) |  |

Definition at line 263 of file block.c.

Here is the caller graph for this function:

## check_all_blocks_in()

static int check_all_blocks_in | ( | coap_rblock_t * | rec_blocks,
|  | size_t | total_blocks
| ) |  |

static

Definition at line 770 of file block.c.

Here is the caller graph for this function:

## check_if_received_block()

static int check_if_received_block | ( | coap_rblock_t * | rec_blocks,
|  | uint32_t | block_num
| ) |  |

static

Definition at line 757 of file block.c.

Here is the caller graph for this function:

## full_match()

COAP_STATIC_INLINE int full_match | ( | const uint8_t * | a,
|  | size_t | alen,
|  | const uint8_t * | b,
|  | size_t | blen
| ) |  |

Definition at line 273 of file block.c.

Here is the caller graph for this function:

## update_received_blocks()

static int update_received_blocks | ( | coap_rblock_t * | rec_blocks,
|  | uint32_t | block_num
| ) |  |

static

Definition at line 1159 of file block.c.

Here is the call graph for this function:
Here is the caller graph for this function: