Skip to content

nanocoap: Add blockwise transfer block2 support#21

Closed
bergzand wants to merge 11 commits intokaspar030:masterfrom
bergzand:coap/block_wise_transfer
Closed

nanocoap: Add blockwise transfer block2 support#21
bergzand wants to merge 11 commits intokaspar030:masterfrom
bergzand:coap/block_wise_transfer

Conversation

@bergzand
Copy link
Copy Markdown

@bergzand bergzand commented Aug 1, 2017

This PR adds block2 support for nanocoap. This facilitates larger transfers such as a large /.well-know/core payload.

I've tried to make it as easy as possible for a handler to support blockwise transfer. As an example I rewrote the /.well-known/core handler with block2 support.

I've added two extra fields to the coap_pkt_t struct, but with #18 merged, it should be possible to remove these fields.

@bergzand bergzand changed the title coap: Add blockwise transfer block2 support nanocoap: Add blockwise transfer block2 support Aug 1, 2017
@bergzand
Copy link
Copy Markdown
Author

bergzand commented Aug 1, 2017

I need a small bit of advise before continuing with the size2 option. The problem with both the block2 and the size2 option is that the value needs to be adjusted after the payload is inserted. The block2 header needs adjustment if the last block is reached and the size2 requires the full size of the payload.

This problem can be resolved with #18, finding these options again after the payload is written and adjusting them is possible with this. Furthermore, the two additional fields in the coap_pkt_t struct can be removed again.

So with this in mind, should I continue with a rebase on #18 and assume that it will be merged eventually?

@kaspar030
Copy link
Copy Markdown
Owner

So with this in mind, should I continue with a rebase on #18 and assume that it will be merged eventually?

Yes!

@kaspar030
Copy link
Copy Markdown
Owner

Thanks for tackling this.
Please rebase (probably to #18), and prefix the commits with "nanocoap:".

@bergzand bergzand force-pushed the coap/block_wise_transfer branch from a49ecab to 8f6890f Compare August 16, 2017 12:20
@bergzand bergzand force-pushed the coap/block_wise_transfer branch from 8f6890f to b7c5c36 Compare August 16, 2017 12:23
@bergzand
Copy link
Copy Markdown
Author

Rebased and adjusted for coap_find_option.
I've split the coap_put_option_block2 into an extra coap_finish_option_block2 to reduce some checks and improve readability.

@bergzand
Copy link
Copy Markdown
Author

Still contains a few bugs with larger resources where the option length is longer than 1.

@bergzand
Copy link
Copy Markdown
Author

Tested some more with really huge transfers, everything seems to work now. If somebody could check if r421 is endianess proof, I'd be happy.

@bergzand
Copy link
Copy Markdown
Author

Closing this now that it is merged in RIOT.

@bergzand bergzand closed this Oct 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants