rawrtc-data-channel
rawrtc-data-channel copied to clipboard
The big picture
To Do:
- [x] API additions
- [x]
rawrtc_sctp_context- [x] DTLS role getter
- [x] DTLS transport state getter
- [x] SCTP transport detach (from DTLS transport) handler
- [x] SCTP transport outbound handler
- [x] SCTP transport destroyed handler
- [x] ~~Enter event loop thread (?)~~
- [x] ~~Leave event loop thread (?)~~
- [x]
rawrtc_sctp_transport_feed_inbound - [x]
rawrtc_sctp_transport_set_mtu - [x]
rawrtc_sctp_transport_get_mtu - [x]
rawrtc_sctp_transport_enable_mtu_discovery - [x]
rawrtc_sctp_transport_set_context - [x]
rawrtcdc_timer_tick
- [x]
- [x] Get rid of
struct rawrtc_data_channel_options. - [x] Remove everything from RAWRTC that has been defined in RAWRTCDC
- [x] Fix private declarations in public API
- [x] Move
rawrtc_sctp_transport_get_capabilitiesintosctp_transport.c - [x] Move
rawrtc_sctp_transport_state_to_nameto the bottom ofsctp_transport.c - [x] Test that default MTU works (it may need to be applied when starting the transport as well)
- [x] Ensure disabled SCTP checksum is not problematic regarding interop or disable it by default (see https://github.com/NEAT-project/usrsctp-neat/issues/13).
- [x] Ensure redirect transport still works
- [x] Make it non-blocking
- [x] Add state handler
- [x] Receive/send async
- [x] Update in RAWRTC
- [x] Update redirect transport tool
- [x] Add missing functions from todos
- [x] Test CRC32C speed
- We can achieve ~110% of the original speed by disabling checksum verification at the receiver side.
- [ ] Create issues for
TODOitems - [x] Move and close related issues from RAWRTC
- [ ] Proper documentation
- [ ] If a function can fail (even if only due to invalid input parameters), it will return a
enum rawrtc_code. - [ ] Function parameters ending with
pwill usually be de-referenced and it's value will be changed. The documentation of the parameter will clearly indicate whether or not that's the case. - [ ] Multithreading
- The below mutex documentation only applies if the SCTP iterator thread is not only idling (it does look like it's just idling and can be removed - see https://github.com/NEAT-project/usrsctp-neat/issues/12).
- Locking: Always hold a lock to the mutex by calling
re_enter_thread(you can set your own mutex by callingre_set_mutex(your_mutex)) before calling functions of this library. Some event loops always hold a lock implicitly when handling callbacks. So, if the event loop's mutex has been applied and if used inside such a context, you do not need to lock explicitly. - Unlocking: If explicitly locked by calling
re_enter_thread, you need to explicitly unlock by callingre_leave_thread.
- [ ] FAQ
- Is it a complete SCTP implementation? No, it uses usrsctp underneath.
- Where is it intended to be used? In a WebRTC or ORTC stack on top of DTLS.
- Who should use this? Everyone who is interested in having support for data channels who already has an ICE/DTLS stack.
- But I also need ICE/DTLS! Check out RAWRTC.
- Can I access struct members directly and do hacky stuff? Certainly, just import
rawrtcdc_internal.h. Be aware, there may be breaking API changes even between minor versions when accessing non-public functions and structures. If you're missing something essential, create a new issue or make a pull request instead of using the internal API.
- Warnings
- Under no circumstances should you
mem_derefstuff that's being used inside of a handler function called by RAWRTCDC or you will see segfaults. Instead, schedule removal and do it after the handler function returned.
- Under no circumstances should you
- [ ] If a function can fail (even if only due to invalid input parameters), it will return a
- [ ] Backport (from RAWRTCC to RAWRTCDC and RAWRTC)
- [ ] Fix callback typedefs to make them documentable
- [ ] Project author in CMake
- [ ] Version parsing from
rawrtc*.h - [ ] Generated
rawrtc*_configuration.hheader - [ ] Install public header -> Install headers
- [ ] Remove generated
rawrtc*_internal.hheader - [ ] Docs (all files)
- [ ] Ensure debug level can still be set (and defaults to
5) across libraries. Test this insiderawrtc-terminal-demo. - [ ] Build using CI
- [ ] Docker container?
- [x] Pull request
- https://github.com/rawrtc/rawrtc/issues/47
- https://github.com/rawrtc/rawrtc/issues/33
Afterwards:
- [ ] GitHub release
- [ ] Announce
- [ ] W3C WebRTC Mailing List
- [ ] Consider setting states earlier and therefore get rid of issues when a callback calls a function during a state change that also checks the state. This would also get rid of the quirky helper flags.
- [ ] Make SCTP send/receive window configurable
- [ ] Test ARM detection.
- [ ] Consider requiring to
mem_refof the channel when callingrawrtc_data_channel_handleror close the channel immediately. (No implicit reference anymore.) - [x] Backport generated header to RAWRTC
- [ ] Remove thread ID sanity check from RAWRTC (see: https://github.com/NEAT-project/usrsctp-neat/issues/12)
- [ ]
const * constorconst* const- decide! - [ ] Write tests
- [ ] Hardware CRC32C for ARM?
- [ ] Backpressure handling
- [ ] Sending: Wait for buffered amount low, send, repeat (normal/streamed)
- [ ] Use a send buffer per channel.
- [ ] Implement setting buffered amount low threshold
- [ ] Get buffered amount info from usrsctp's internal buffers & our own buffers
- [ ] Raise buffered amount low (on open, after each write if buffered amount is low enough)
- [ ] Receiving: Pause transport if busy, unpause transport, receive message event, repeat (normal/streamed)
- [ ] Add a way to pause/unpause the data transport for incoming messages (something like
rawrtc_data_transport_pause_incoming(true/false))- Warning: This will also pause all other channels. Talk to the usrsctp folks to find out whether it's possible to signal backpressure on a single stream without affecting other streams.
- [ ] Remember SCTP read event if paused
- [ ] When unpausing, handle pending SCTP read events
- [ ] Add a way to pause/unpause the data transport for incoming messages (something like
- [ ] Sending: Wait for buffered amount low, send, repeat (normal/streamed)
Why are you using everywhere in your code "const"?
For the same reason everything in Rust is immutable by default: It can be optimised by the compiler.
Is this your work for NEAT? https://github.com/NEAT-project/neat/blob/master/neat_webrtc_tools.h I can't beleiving it. It uses rawrtc stack on top of libuv loop!
I'm not working on that project. They use RAWRTC but have also sponsored development of this library. You can find the libuv compatible branch here: https://github.com/rawrtc/re/tree/rawrtc-neat