19#ifndef COAP_BLOCK_INTERNAL_H_
20#define COAP_BLOCK_INTERNAL_H_
33#if COAP_Q_BLOCK_SUPPORT
35#define COAP_BLOCK_HAS_Q_BLOCK 0x40
36#define COAP_BLOCK_PROBE_Q_BLOCK 0x80
38#define set_block_mode_probe_q(block_mode) \
40 block_mode |= COAP_BLOCK_PROBE_Q_BLOCK; \
41 block_mode &= ~(COAP_BLOCK_TRY_Q_BLOCK | COAP_BLOCK_HAS_Q_BLOCK); \
44#define set_block_mode_has_q(block_mode) \
46 block_mode |= COAP_BLOCK_HAS_Q_BLOCK; \
47 block_mode &= ~(COAP_BLOCK_TRY_Q_BLOCK | COAP_BLOCK_PROBE_Q_BLOCK); \
50#define set_block_mode_drop_q(block_mode) \
52 block_mode &= ~(COAP_BLOCK_TRY_Q_BLOCK |\
53 COAP_BLOCK_PROBE_Q_BLOCK |\
54 COAP_BLOCK_HAS_Q_BLOCK | \
55 COAP_BLOCK_USE_M_Q_BLOCK); \
58#define COAP_SINGLE_BLOCK_OR_Q (COAP_BLOCK_SINGLE_BODY|COAP_BLOCK_HAS_Q_BLOCK)
60#define COAP_SINGLE_BLOCK_OR_Q (COAP_BLOCK_SINGLE_BODY)
73#define COAP_RBLOCK_CNT 4
80#if COAP_Q_BLOCK_SUPPORT
81 uint32_t processing_payload_set;
82 uint32_t latest_payload_set;
135#if COAP_Q_BLOCK_SUPPORT
142#if COAP_CLIENT_SUPPORT
173#if COAP_SERVER_SUPPORT
194#if COAP_Q_BLOCK_SUPPORT
203#if COAP_Q_BLOCK_SUPPORT
210#if COAP_CLIENT_SUPPORT
222#if COAP_Q_BLOCK_SUPPORT
226 coap_send_pdu_t send_request);
236#if COAP_Q_BLOCK_SUPPORT
241 coap_send_pdu_t send_pdu);
244#if COAP_SERVER_SUPPORT
252#if COAP_Q_BLOCK_SUPPORT
262 coap_send_pdu_t send_response);
287#if COAP_CLIENT_SUPPORT
308#if COAP_Q_BLOCK_SUPPORT
333#if COAP_CLIENT_SUPPORT
343#define coap_check_update_token(a,b)
Pulls together all the internal only header files.
uint8_t coap_opt_t
Use byte-oriented access methods here because sliding a complex struct coap_opt_t over the data buffe...
CoAP PDU internal information.
Generic resource handling.
struct coap_rblock_t coap_rblock_t
Structure to keep track of received blocks.
void coap_block_delete_lg_srcv(coap_session_t *session, coap_lg_srcv_t *lg_srcv)
int coap_block_check_lg_crcv_timeouts(coap_session_t *session, coap_tick_t now, coap_tick_t *tim_rem)
int coap_block_check_lg_srcv_timeouts(coap_session_t *session, coap_tick_t now, coap_tick_t *tim_rem)
void coap_block_delete_lg_crcv(coap_session_t *session, coap_lg_crcv_t *lg_crcv)
struct coap_l_block1_t coap_l_block1_t
Structure to keep track of block1 specific information (Requests)
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(const coap_session_t *session, const coap_pdu_t *request, coap_pdu_t *response, const coap_resource_t *resource, const coap_string_t *query)
The function checks that the code in a newly formed lg_xmit created by coap_add_data_large_response()...
int coap_handle_response_send_block(coap_session_t *session, coap_pdu_t *sent, coap_pdu_t *rcvd)
coap_mid_t coap_retransmit_oscore_pdu(coap_session_t *session, coap_pdu_t *pdu, coap_opt_t *echo)
void coap_check_update_token(coap_session_t *session, coap_pdu_t *pdu)
The function checks if the token needs to be updated before PDU is presented to the application (only...
struct coap_l_block2_t coap_l_block2_t
Structure to keep track of block2 specific information (Responses)
void coap_block_delete_lg_xmit(coap_session_t *session, coap_lg_xmit_t *lg_xmit)
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, int *added_block, coap_lg_srcv_t **free_lg_srcv)
coap_lg_xmit_t * coap_find_lg_xmit_response(const coap_session_t *session, const coap_pdu_t *request, const coap_resource_t *resource, const coap_string_t *query)
coap_lg_crcv_t * coap_block_new_lg_crcv(coap_session_t *session, coap_pdu_t *pdu, coap_lg_xmit_t *lg_xmit)
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)
int coap_block_check_lg_xmit_timeouts(coap_session_t *session, coap_tick_t now, coap_tick_t *tim_rem)
void(* coap_release_large_data_t)(coap_session_t *session, void *app_ptr)
Callback handler for de-allocating the data based on app_ptr provided to coap_add_data_large_*() func...
time_t coap_time_t
CoAP time in seconds since epoch.
uint64_t coap_tick_t
This data type represents internal timer ticks with COAP_TICKS_PER_SECOND resolution.
int coap_mid_t
coap_mid_t is used to store the CoAP Message ID of a CoAP PDU.
coap_pdu_code_t
Set of codes available for a PDU.
CoAP binary data definition with const data.
CoAP binary data definition.
Structure of Block options with BERT support.
The CoAP stack's global state is stored in a coap_context_t object.
Structure to keep track of block1 specific information (Requests)
uint64_t state_token
state token
size_t bert_size
size of last BERT block
uint32_t count
the number of packets sent for payload
coap_binary_t * app_token
original PDU token
Structure to keep track of block2 specific information (Responses)
coap_pdu_code_t request_method
Method used to request this data.
uint8_t rtag_length
RTag length.
coap_string_t * query
Associated query for the resource.
coap_resource_t * resource
associated resource
coap_time_t maxage_expire
When this entry expires.
uint8_t rtag_set
Set if RTag is in receive PDU.
uint8_t rtag[8]
RTag for block checking.
Structure to hold large body (many blocks) client receive information.
uint16_t block_option
Block option in use.
uint8_t etag[8]
ETag for block checking.
uint8_t etag_length
ETag length.
uint8_t last_type
Last request type (CON/NON)
uint8_t observe_length
Length of observe data.
uint8_t observe[3]
Observe data (if observe_set) (only 24 bits)
uint8_t etag_set
Set if ETag is in receive PDU.
struct coap_lg_crcv_t * next
uint8_t initial
If set, has not been used yet.
uint8_t szx
size of individual blocks
uint16_t content_format
Content format for the set of blocks.
coap_pdu_t pdu
skeletal PDU
coap_tick_t last_used
< list of received blocks
coap_bin_const_t ** obs_token
Tokens used in setting up Observe (to handle large FETCH)
uint64_t state_token
state token
coap_binary_t * app_token
app requesting PDU token
uint16_t retry_counter
Retry counter (part of state token)
coap_binary_t * body_data
Used for re-assembling entire body.
size_t obs_token_cnt
number of tokens used to set up Observe
uint8_t observe_set
Set if this is an observe receive PDU.
size_t total_len
Length as indicated by SIZE2 option.
Structure to hold large body (many blocks) server receive information.
uint8_t rtag[8]
RTag for block checking.
coap_mid_t last_mid
< list of received blocks
uint8_t rtag_set
Set if RTag is in receive PDU.
uint16_t block_option
Block option in use.
size_t total_len
Length as indicated by SIZE1 option.
struct coap_lg_srcv_t * next
uint8_t observe_length
Length of observe data.
coap_rblock_t rec_blocks
set to uri_path if unknown resource
coap_binary_t * body_data
Used for re-assembling entire body.
coap_resource_t * resource
associated resource
uint8_t observe_set
Set if this is an observe receive PDU.
uint8_t rtag_length
RTag length.
uint8_t last_type
Last request type (CON/NON)
uint8_t szx
size of individual blocks
size_t amount_so_far
Amount of data seen so far.
coap_tick_t last_used
Last time data sent or 0.
uint8_t observe[3]
Observe data (if set) (only 24 bits)
uint16_t content_format
Content format for the set of blocks.
coap_str_const_t * uri_path
Structure to hold large body (many blocks) transmission information.
coap_tick_t last_all_sent
Last time all data sent or 0.
coap_release_large_data_t release_func
large data de-alloc function
uint8_t blk_size
large block transmission size
coap_tick_t last_sent
Last time any data sent.
union coap_lg_xmit_t::@1 b
const uint8_t * data
large data ptr
int last_block
last acknowledged block number Block1 last transmitted Q-Block2
coap_tick_t last_payload
Last time MAX_PAYLOAD was sent or 0.
size_t offset
large data next offset to transmit
coap_pdu_t pdu
skeletal PDU
size_t length
large data length
uint16_t option
large block transmisson CoAP option
struct coap_lg_xmit_t * next
void * app_ptr
applicaton provided ptr for de-alloc function
coap_tick_t last_obs
Last time used (Observe tracking) or 0.
Structure to keep track of received blocks.
struct coap_lg_range range[COAP_RBLOCK_CNT]
Abstraction of resource that can be attached to coap_context_t.
Abstraction of virtual session that can be attached to coap_context_t (client) or coap_endpoint_t (se...
CoAP string data definition with const data.
CoAP string data definition.