You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to use Botan's ZFEC implementation from languages/runtimes other than C++. The obvious way to enable this to add a extern "C" style interface on top of the C++ interface, similar to how other functionality is exposed in src/lib/ffi/.
A reasonably simple interface to use might be something like:
// input gives the primary shares
// size gives the length of the primary shares (all equal)
// output gives a place to write a uint8_t** giving the generated secondary shares
// outputSizes gives a place to write size_t* giving the size of the generated shares (all equal)
// memory ownership of *output and all contained pointers and *outputSizes is given to the caller on success
int botan_zfec_encode(size_t K, size_t N, const uint8_t input[], size_t size, uint8_t ***output, size_t **outputSizes);
// shares gives primary or secondary shares to decode
// share_indexes gives the index of corresponding elements of shares
// num_shares gives the length of shares and share_indexes
// share_size gives the length of each share
// output and outputSizes are like for encode
int botan_zfec_decode(size_t K, size_t N, const uint8_t shares[], const size_t[] share_indexes, size_t num_shares, size_t share_size, uint8_t ***output, size_t **outputSizes);
A different interface could use output_cb_t instead of output buffers which might enable less copying but it's also harder (but maybe not impossible to consume across an FFI interface).
This interface does not preclude the addition of such an interface later on, if it proves desirable enough to do the extra work.
I have a preliminary implementation of botan_fec_encode that I've demonstrated works when called from Haskell. I can finish it (docs, tests, whatever else it needs) and work on botan_fec_decode if this addition is welcome.
The text was updated successfully, but these errors were encountered:
I think #3196 is in reasonable shape for a first review. I'm sure I got many things wrong. There is at least a passing test that verifies the round-trip behavior for encode/decode. Looking forward to any feedback.
It would be nice to use Botan's ZFEC implementation from languages/runtimes other than C++. The obvious way to enable this to add a
extern "C"
style interface on top of the C++ interface, similar to how other functionality is exposed insrc/lib/ffi/
.A reasonably simple interface to use might be something like:
A different interface could use
output_cb_t
instead of output buffers which might enable less copying but it's also harder (but maybe not impossible to consume across an FFI interface).This interface does not preclude the addition of such an interface later on, if it proves desirable enough to do the extra work.
I have a preliminary implementation of
botan_fec_encode
that I've demonstrated works when called from Haskell. I can finish it (docs, tests, whatever else it needs) and work onbotan_fec_decode
if this addition is welcome.The text was updated successfully, but these errors were encountered: