KNX IoT
KNX IoT Point API stack implementation
|
CoAP block wise transfer implementation. More...
#include "messaging/coap/coap.h"
#include "messaging/coap/transactions.h"
#include "oc_helpers.h"
#include "oc_ri.h"
#include "port/oc_connectivity.h"
Go to the source code of this file.
Data Structures | |
struct | oc_blockwise_request_state_s |
the blockwise request state More... | |
struct | oc_blockwise_response_state_s |
the blockwise response state More... | |
Typedefs | |
typedef struct oc_blockwise_request_state_s | oc_blockwise_request_state_t |
the blockwise request state More... | |
typedef struct oc_blockwise_response_state_s | oc_blockwise_response_state_t |
the blockwise response state More... | |
typedef struct oc_blockwise_state_s | oc_blockwise_state_t |
Enumerations | |
enum | oc_blockwise_role_t { OC_BLOCKWISE_CLIENT = 0 , OC_BLOCKWISE_SERVER } |
role of the transfer More... | |
Functions | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
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 More... | |
oc_blockwise_state_t * | oc_blockwise_find_request_buffer_by_mid (uint16_t mid) |
find the block wise request based on mid More... | |
oc_blockwise_state_t * | oc_blockwise_find_request_buffer_by_token (uint8_t *token, uint8_t token_len) |
find the request by token More... | |
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 More... | |
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 More... | |
oc_blockwise_state_t * | oc_blockwise_find_response_buffer_by_mid (uint16_t mid) |
find the block wise response based on mid More... | |
oc_blockwise_state_t * | oc_blockwise_find_response_buffer_by_token (uint8_t *token, uint8_t token_len) |
find the response by token More... | |
void | oc_blockwise_free_request_buffer (oc_blockwise_state_t *buffer) |
free the request buffer More... | |
void | oc_blockwise_free_response_buffer (oc_blockwise_state_t *buffer) |
free the response buffer More... | |
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) More... | |
void | oc_blockwise_scrub_buffers (bool all) |
free all blocks that are handled (ref_count = 0) More... | |
void | oc_blockwise_scrub_buffers_for_client_cb (void *cb) |
scrub blocks for client side More... | |
oc_blockwise_state_t * | oc_get_request_buffer_with_ptr (uint8_t *data) |
get blockwise buffer that contains data in its payload More... | |
CoAP block wise transfer implementation.
Definition in file oc_blockwise.h.
typedef struct oc_blockwise_request_state_s oc_blockwise_request_state_t |
the blockwise request state
typedef struct oc_blockwise_response_state_s oc_blockwise_response_state_t |
the blockwise response state
enum oc_blockwise_role_t |
role of the transfer
Enumerator | |
---|---|
OC_BLOCKWISE_CLIENT | client |
OC_BLOCKWISE_SERVER | server |
Definition at line 37 of file oc_blockwise.h.
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
href | the href |
href_len | the href length |
endpoint | the endpoint |
method | the CoAP method |
role | the role (clien or server) |
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
href | the href |
href_len | the href length |
endpoint | the endpoint |
method | the CoAP method |
role | the role (client or server) |
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
buffer | the buffer (whole message) |
block_offset | the block offset |
requested_block_size | block size to be send |
payload_size | the send payload size |
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
href | the href |
href_len | the href length |
endpoint | the endpoint |
method | the method |
query | the query parameters |
query_len | the query length |
role | the role (client or server) |
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
endpoint | the endpoint |
client_cb | the callback |
oc_blockwise_state_t* oc_blockwise_find_request_buffer_by_mid | ( | uint16_t | mid | ) |
find the block wise request based on mid
mid | the message id |
oc_blockwise_state_t* oc_blockwise_find_request_buffer_by_token | ( | uint8_t * | token, |
uint8_t | token_len | ||
) |
find the request by token
token | the token |
token_len | the token length |
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
href | the href |
href_len | the href length |
endpoint | the endpoint |
method | the method |
query | the query parameters |
query_len | the query length |
role | the role (client or server) |
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
endpoint | the endpoint |
client_cb | the callback |
oc_blockwise_state_t* oc_blockwise_find_response_buffer_by_mid | ( | uint16_t | mid | ) |
find the block wise response based on mid
mid | the message id |
oc_blockwise_state_t* oc_blockwise_find_response_buffer_by_token | ( | uint8_t * | token, |
uint8_t | token_len | ||
) |
find the response by token
token | the token |
token_len | the token length |
void oc_blockwise_free_request_buffer | ( | oc_blockwise_state_t * | buffer | ) |
free the request buffer
buffer | the buffer to be freed |
void oc_blockwise_free_response_buffer | ( | oc_blockwise_state_t * | buffer | ) |
free the response buffer
buffer | the response buffer to be freed |
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)
buffer | the whole message |
incoming_block_offset | the block offset |
incoming_block | the incoming block to be added |
incoming_block_size | the size of the incoming block |
void oc_blockwise_scrub_buffers | ( | bool | all | ) |
free all blocks that are handled (ref_count = 0)
all | : including ref count != 0 |
void oc_blockwise_scrub_buffers_for_client_cb | ( | void * | cb | ) |
scrub blocks for client side
cb | the callback |
oc_blockwise_state_t* oc_get_request_buffer_with_ptr | ( | uint8_t * | data | ) |
get blockwise buffer that contains data in its payload
data | pointer suspected to be inside a blockwise buffer |