mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
nanocoap: make coap_get_block2() actually fill struct
This commit is contained in:
parent
91d982733f
commit
6c02521591
@ -641,30 +641,33 @@ size_t coap_put_option_block1(uint8_t *buf, uint16_t lastonum, unsigned blknum,
|
|||||||
return coap_put_option_block(buf, lastonum, blknum, szx, more, COAP_OPT_BLOCK1);
|
return coap_put_option_block(buf, lastonum, blknum, szx, more, COAP_OPT_BLOCK1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int coap_get_block1(coap_pkt_t *pkt, coap_block1_t *block1)
|
int coap_get_block(coap_pkt_t *pkt, coap_block1_t *block, uint16_t blkopt)
|
||||||
{
|
{
|
||||||
uint32_t blknum;
|
uint32_t blknum;
|
||||||
unsigned szx;
|
unsigned szx;
|
||||||
|
|
||||||
block1->more = coap_get_blockopt(pkt, COAP_OPT_BLOCK1, &blknum, &szx);
|
block->more = coap_get_blockopt(pkt, blkopt, &blknum, &szx);
|
||||||
if (block1->more >= 0) {
|
if (block->more >= 0) {
|
||||||
block1->offset = blknum << (szx + 4);
|
block->offset = blknum << (szx + 4);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
block1->offset = 0;
|
block->offset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
block1->blknum = blknum;
|
block->blknum = blknum;
|
||||||
block1->szx = szx;
|
block->szx = szx;
|
||||||
|
|
||||||
return (block1->more >= 0);
|
return (block->more >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int coap_get_block2(coap_pkt_t *pkt, coap_block1_t *block2)
|
int coap_get_block1(coap_pkt_t *pkt, coap_block1_t *block)
|
||||||
{
|
{
|
||||||
block2->more = coap_get_blockopt(pkt, COAP_OPT_BLOCK2, &block2->blknum,
|
return coap_get_block(pkt, block, COAP_OPT_BLOCK1);
|
||||||
&block2->szx);
|
}
|
||||||
return (block2->more >= 0);
|
|
||||||
|
int coap_get_block2(coap_pkt_t *pkt, coap_block1_t *block)
|
||||||
|
{
|
||||||
|
return coap_get_block(pkt, block, COAP_OPT_BLOCK2);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t coap_put_block1_ok(uint8_t *pkt_pos, coap_block1_t *block1, uint16_t lastonum)
|
size_t coap_put_block1_ok(uint8_t *pkt_pos, coap_block1_t *block1, uint16_t lastonum)
|
||||||
|
Loading…
Reference in New Issue
Block a user