mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
net/nanocoap: add block init helper function
This commit is contained in:
parent
582db9f9fb
commit
69efaa1d56
@ -540,6 +540,19 @@ static inline ssize_t coap_get_uri_query(const coap_pkt_t *pkt, uint8_t *target)
|
||||
* generally useful functions to write block options.
|
||||
*/
|
||||
/**@{*/
|
||||
/**
|
||||
* @brief Initialize a block struct from content information
|
||||
*
|
||||
* @param[out] block block struct to initialize
|
||||
* @param[in] blknum offset from the beginning of content, in terms of
|
||||
@p blksize byte blocks
|
||||
* @param[in] blksize size of each block; must be a power of 2 between 16
|
||||
* and 2 raised to #NANOCOAP_BLOCK_SIZE_EXP_MAX
|
||||
* @param[in] more more blocks? use 1 if yes; 0 if no or unknown
|
||||
*/
|
||||
void coap_block_object_init(coap_block1_t *block, size_t blknum, size_t blksize,
|
||||
int more);
|
||||
|
||||
/**
|
||||
* @brief Finish a block2 response
|
||||
*
|
||||
|
@ -875,6 +875,14 @@ ssize_t coap_opt_finish(coap_pkt_t *pkt, uint16_t flags)
|
||||
return pkt->payload - (uint8_t *)pkt->hdr;
|
||||
}
|
||||
|
||||
void coap_block_object_init(coap_block1_t *block, size_t blknum, size_t blksize,
|
||||
int more)
|
||||
{
|
||||
block->szx = _size2szx(blksize);
|
||||
block->blknum = blknum;
|
||||
block->more = more;
|
||||
}
|
||||
|
||||
void coap_block2_init(coap_pkt_t *pkt, coap_block_slicer_t *slicer)
|
||||
{
|
||||
uint32_t blknum;
|
||||
|
Loading…
Reference in New Issue
Block a user