mirage / mirage-tcpip

TCP/IP networking stack in pure OCaml, using the Mirage platform libraries. Includes IPv4/6, ICMP, and UDP/TCP support.
https://mirage.io
ISC License
339 stars 86 forks source link

jsoo support #378

Open copy opened 5 years ago

copy commented 5 years ago

I'd like to use mirage-tcpip in a project using JavaScript using js_of_ocaml. The only piece that is missing is an OCaml (or JavaScript) implementation of the tcp checksum calculation.

As a quick-and-dirty fix, I ported the C implementation to OCaml and it seems to be working fine: patch. It's missing a non-allocating version for the _list variant. It'll also need to be properly integrated with the build system so that the native version will be selected for native builds and the pure version of jsoo builds.

avsm commented 5 years ago

This sounds good; please do send in a PR with the JS implementation and I'll fix up the build system to integrate it.

samoht commented 5 years ago

Would it make sense to extend and use mirage/checkseum for this? /cc @dinosaure