rawrtc-data-channel icon indicating copy to clipboard operation
rawrtc-data-channel copied to clipboard

The big picture

Open lgrahl opened this issue 7 years ago • 4 comments

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] 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_capabilities into sctp_transport.c
  • [x] Move rawrtc_sctp_transport_state_to_name to the bottom of sctp_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 TODO items
  • [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 p will 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 calling re_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 calling re_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_deref stuff 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.
  • [ ] 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.h header
    • [ ] Install public header -> Install headers
    • [ ] Remove generated rawrtc*_internal.h header
    • [ ] Docs (all files)
  • [ ] Ensure debug level can still be set (and defaults to 5) across libraries. Test this inside rawrtc-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
    • [ ] Twitter
    • [ ] 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_ref of the channel when calling rawrtc_data_channel_handler or 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 * const or const* 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

lgrahl avatar Mar 01 '18 18:03 lgrahl

Why are you using everywhere in your code "const"?

Globik avatar Aug 31 '18 20:08 Globik

For the same reason everything in Rust is immutable by default: It can be optimised by the compiler.

lgrahl avatar Aug 31 '18 22:08 lgrahl

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!

Globik avatar Aug 31 '18 22:08 Globik

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

lgrahl avatar Aug 31 '18 22:08 lgrahl