20 #ifndef OC_BLOCKWISE_H
21 #define OC_BLOCKWISE_H
23 #include "messaging/coap/coap.h"
24 #include "messaging/coap/transactions.h"
42 typedef struct oc_blockwise_state_s
44 struct oc_blockwise_state_s *next;
49 uint32_t payload_size;
50 uint32_t next_block_offset;
53 #ifdef OC_DYNAMIC_ALLOCATION
54 #ifdef OC_APP_DATA_BUFFER_POOL
59 uint8_t buffer[OC_MAX_APP_DATA_SIZE];
61 oc_string_t uri_query;
64 uint8_t token[COAP_TOKEN_LEN];
69 } oc_blockwise_state_t;
87 uint8_t
etag[COAP_ETAG_LEN];
118 uint8_t *token, uint8_t token_len);
128 uint8_t *token, uint8_t token_len);
164 oc_method_t method,
const char *query,
size_t query_len,
181 oc_method_t method,
const char *query,
size_t query_len,
236 uint32_t block_offset,
237 uint32_t requested_block_size,
238 uint32_t *payload_size);
251 uint32_t incoming_block_offset,
252 const uint8_t *incoming_block,
253 uint32_t incoming_block_size);
struct oc_blockwise_response_state_s oc_blockwise_response_state_t
the blockwise response state
oc_blockwise_state_t * oc_get_request_buffer_with_ptr(uint8_t *data)
get blockwise buffer that contains data in its payload
oc_blockwise_state_t * oc_blockwise_find_response_buffer_by_client_cb(oc_endpoint_t *endpoint, void *client_cb)
find the response by client callback & endpoint
void oc_blockwise_free_request_buffer(oc_blockwise_state_t *buffer)
free the request buffer
oc_blockwise_state_t * oc_blockwise_find_request_buffer_by_client_cb(oc_endpoint_t *endpoint, void *client_cb)
find the request by client callback & endpoint
oc_blockwise_role_t
role of the transfer
@ OC_BLOCKWISE_SERVER
server
@ OC_BLOCKWISE_CLIENT
client
oc_blockwise_state_t * oc_blockwise_alloc_response_buffer(const char *href, size_t href_len, oc_endpoint_t *endpoint, oc_method_t method, oc_blockwise_role_t role)
allocate the response buffer
oc_blockwise_state_t * oc_blockwise_alloc_request_buffer(const char *href, size_t href_len, oc_endpoint_t *endpoint, oc_method_t method, oc_blockwise_role_t role)
allocate the request buffer
bool oc_blockwise_handle_block(oc_blockwise_state_t *buffer, uint32_t incoming_block_offset, const uint8_t *incoming_block, uint32_t incoming_block_size)
handle the incoming block (partial message)
oc_blockwise_state_t * oc_blockwise_find_request_buffer(const char *href, size_t href_len, oc_endpoint_t *endpoint, oc_method_t method, const char *query, size_t query_len, oc_blockwise_role_t role)
find request buffer based on more information
oc_blockwise_state_t * oc_blockwise_find_response_buffer(const char *href, size_t href_len, oc_endpoint_t *endpoint, oc_method_t method, const char *query, size_t query_len, oc_blockwise_role_t role)
find response buffer based on more information
struct oc_blockwise_request_state_s oc_blockwise_request_state_t
the blockwise request state
void oc_blockwise_free_response_buffer(oc_blockwise_state_t *buffer)
free the response buffer
oc_blockwise_state_t * oc_blockwise_find_request_buffer_by_mid(uint16_t mid)
find the block wise request based on mid
oc_blockwise_state_t * oc_blockwise_find_response_buffer_by_token(uint8_t *token, uint8_t token_len)
find the response by token
const void * oc_blockwise_dispatch_block(oc_blockwise_state_t *buffer, uint32_t block_offset, uint32_t requested_block_size, uint32_t *payload_size)
send the block
oc_blockwise_state_t * oc_blockwise_find_request_buffer_by_token(uint8_t *token, uint8_t token_len)
find the request by token
void oc_blockwise_scrub_buffers(bool all)
free all blocks that are handled (ref_count = 0)
oc_blockwise_state_t * oc_blockwise_find_response_buffer_by_mid(uint16_t mid)
find the block wise response based on mid
void oc_blockwise_scrub_buffers_for_client_cb(void *cb)
scrub blocks for client side
platform abstraction of networking
oc_content_format_t
payload content formats
the blockwise request state
oc_blockwise_state_t base
blockwise state data
the blockwise response state
int32_t observe_seq
the observe sequence number
oc_blockwise_state_t base
blockwise state data
uint8_t etag[COAP_ETAG_LEN]
etag for the response