IoTivity-Lite
oc_blockwise.h File Reference
#include "messaging/coap/coap.h"
#include "messaging/coap/transactions.h"
#include "oc_helpers.h"
#include "oc_ri.h"
#include "port/oc_connectivity.h"

Typedefs

typedef void oc_blockwise_finish_cb_t(void)
 
typedef struct oc_blockwise_request_state_s oc_blockwise_request_state_t
 
typedef struct oc_blockwise_response_state_s oc_blockwise_response_state_t
 
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 transer 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, uint32_t buffer_size)
 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, uint32_t buffer_size)
 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 blockwise 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 blockwise 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 incomming block (partial message) More...
 
void oc_blockwise_scrub_buffers (bool all)
 free all blocks that are handled (refcount = 0) More...
 
void oc_blockwise_scrub_buffers_for_client_cb (void *cb)
 scrub blocks for client side More...
 

Enumeration Type Documentation

◆ oc_blockwise_role_t

role of the transer

Enumerator
OC_BLOCKWISE_CLIENT 

client

OC_BLOCKWISE_SERVER 

server

Function Documentation

◆ oc_blockwise_alloc_request_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,
uint32_t  buffer_size 
)

allocate the request buffer

Parameters
hrefthe href
href_lenthe href length
endpointthe endpoint
methodmethod
rolethe role (client or server)
buffer_sizethe buffer size for allocation
Returns
oc_blockwise_state_t*

◆ oc_blockwise_alloc_response_buffer()

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,
uint32_t  buffer_size 
)

allocate the response buffer

Parameters
hrefthe href
href_lenthe href length
endpointthe endpoint
methodmethod
rolethe role (client or server)
buffer_sizethe buffer size for allocation
Returns
oc_blockwise_state_t*

◆ oc_blockwise_dispatch_block()

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

Parameters
bufferthe buffer (whole message)
block_offsetthe block offset
requested_block_sizeblocksize to be send
payload_sizethe send payload size
Returns
const void*

◆ oc_blockwise_find_request_buffer()

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

Parameters
hrefthe href
href_lenthe href lenght
endpointthe endpoint
methodthe method
querythe query parameters
query_lenthe query lenght
rolethe role (client or server)
Returns
oc_blockwise_state_t*

◆ oc_blockwise_find_request_buffer_by_client_cb()

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

Parameters
endpointthe endpoint
client_cbthe callback
Returns
oc_blockwise_state_t*

◆ oc_blockwise_find_request_buffer_by_mid()

oc_blockwise_state_t* oc_blockwise_find_request_buffer_by_mid ( uint16_t  mid)

find the blockwise request based on mid

Parameters
midthe message id
Returns
oc_blockwise_state_t* the blocktranfer

◆ oc_blockwise_find_request_buffer_by_token()

oc_blockwise_state_t* oc_blockwise_find_request_buffer_by_token ( uint8_t *  token,
uint8_t  token_len 
)

find the request by token

Parameters
tokenthe token
token_lenthe token lenght
Returns
oc_blockwise_state_t* the blocktranfer

◆ oc_blockwise_find_response_buffer()

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

Parameters
hrefthe href
href_lenthe href lenght
endpointthe endpoint
methodthe method
querythe query parameters
query_lenthe query lenght
rolethe role (client or server)
Returns
oc_blockwise_state_t*

◆ oc_blockwise_find_response_buffer_by_client_cb()

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

Parameters
endpointthe endpoint
client_cbthe callback
Returns
oc_blockwise_state_t*

◆ oc_blockwise_find_response_buffer_by_mid()

oc_blockwise_state_t* oc_blockwise_find_response_buffer_by_mid ( uint16_t  mid)

find the blockwise response based on mid

Parameters
midthe message id
Returns
oc_blockwise_state_t* the blocktranfer

◆ oc_blockwise_find_response_buffer_by_token()

oc_blockwise_state_t* oc_blockwise_find_response_buffer_by_token ( uint8_t *  token,
uint8_t  token_len 
)

find the response by token

Parameters
tokenthe token
token_lenthe token lenght
Returns
oc_blockwise_state_t* the blocktransfer

◆ oc_blockwise_free_request_buffer()

void oc_blockwise_free_request_buffer ( oc_blockwise_state_t *  buffer)

free the request buffer

Parameters
bufferbuffer to be freed

◆ oc_blockwise_free_response_buffer()

void oc_blockwise_free_response_buffer ( oc_blockwise_state_t *  buffer)

free the response buffer

Parameters
bufferbuffer to be freed

◆ oc_blockwise_handle_block()

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 incomming block (partial message)

Parameters
bufferthe whole message
incoming_block_offsetthe block offset
incoming_blockthe incomming block to be added
incoming_block_sizethe size of the incomming block
Returns
true
false

◆ oc_blockwise_scrub_buffers()

void oc_blockwise_scrub_buffers ( bool  all)

free all blocks that are handled (refcount = 0)

Parameters
all: including ref count != 0

◆ oc_blockwise_scrub_buffers_for_client_cb()

void oc_blockwise_scrub_buffers_for_client_cb ( void *  cb)

scrub blocks for client side

Parameters
cb