James Kuszmaul | 4a42b18 | 2021-01-17 11:32:46 -0800 | [diff] [blame^] | 1 | #pragma once |
| 2 | #include "ice_gather_options.h" |
| 3 | #include <rawrtcc/code.h> |
| 4 | #include <rawrtcdc/sctp_transport.h> |
| 5 | #include <re.h> |
| 6 | |
| 7 | // Dependencies |
| 8 | struct rawrtc_certificate; |
| 9 | struct rawrtc_certificates; |
| 10 | struct rawrtc_ice_servers; |
| 11 | |
| 12 | /* |
| 13 | * Peer connection configuration. |
| 14 | */ |
| 15 | struct rawrtc_peer_connection_configuration; |
| 16 | |
| 17 | /* |
| 18 | * Create a new peer connection configuration. |
| 19 | * `*configurationp` must be unreferenced. |
| 20 | */ |
| 21 | enum rawrtc_code rawrtc_peer_connection_configuration_create( |
| 22 | struct rawrtc_peer_connection_configuration** const configurationp, // de-referenced |
| 23 | enum rawrtc_ice_gather_policy const gather_policy); |
| 24 | |
| 25 | /* |
| 26 | * Add an ICE server to the peer connection configuration. |
| 27 | */ |
| 28 | enum rawrtc_code rawrtc_peer_connection_configuration_add_ice_server( |
| 29 | struct rawrtc_peer_connection_configuration* const configuration, |
| 30 | char* const* const urls, // copied |
| 31 | size_t const n_urls, |
| 32 | char* const username, // nullable, copied |
| 33 | char* const credential, // nullable, copied |
| 34 | enum rawrtc_ice_credential_type const credential_type); |
| 35 | |
| 36 | /* |
| 37 | * Get ICE servers from the peer connection configuration. |
| 38 | * `*serversp` must be unreferenced. |
| 39 | */ |
| 40 | enum rawrtc_code rawrtc_peer_connection_configuration_get_ice_servers( |
| 41 | struct rawrtc_ice_servers** const serversp, // de-referenced |
| 42 | struct rawrtc_peer_connection_configuration* const configuration); |
| 43 | |
| 44 | /* |
| 45 | * Add a certificate to the peer connection configuration to be used |
| 46 | * instead of an ephemerally generated one. |
| 47 | */ |
| 48 | enum rawrtc_code rawrtc_peer_connection_configuration_add_certificate( |
| 49 | struct rawrtc_peer_connection_configuration* configuration, |
| 50 | struct rawrtc_certificate* const certificate // copied |
| 51 | ); |
| 52 | |
| 53 | /* |
| 54 | * Get certificates from the peer connection configuration. |
| 55 | * `*certificatesp` must be unreferenced. |
| 56 | */ |
| 57 | enum rawrtc_code rawrtc_peer_connection_configuration_get_certificates( |
| 58 | struct rawrtc_certificates** const certificatesp, // de-referenced |
| 59 | struct rawrtc_peer_connection_configuration* const configuration); |
| 60 | |
| 61 | /* |
| 62 | * Set whether to use legacy SDP for data channel parameter encoding. |
| 63 | * Note: Legacy SDP for data channels is on by default due to parsing problems in Chrome. |
| 64 | */ |
| 65 | enum rawrtc_code rawrtc_peer_connection_configuration_set_sctp_sdp_05( |
| 66 | struct rawrtc_peer_connection_configuration* configuration, bool on); |
| 67 | |
| 68 | /* |
| 69 | * Set the SCTP transport's send and receive buffer length in bytes. |
| 70 | * If both values are zero, the default buffer length will be used. Otherwise, |
| 71 | * zero is invalid. |
| 72 | */ |
| 73 | enum rawrtc_code rawrtc_peer_connection_configuration_set_sctp_buffer_length( |
| 74 | struct rawrtc_peer_connection_configuration* configuration, |
| 75 | uint32_t send_buffer_length, |
| 76 | uint32_t receive_buffer_length); |
| 77 | |
| 78 | /* |
| 79 | * Set the SCTP transport's congestion control algorithm. |
| 80 | */ |
| 81 | enum rawrtc_code rawrtc_peer_connection_configuration_set_sctp_congestion_ctrl_algorithm( |
| 82 | struct rawrtc_peer_connection_configuration* configuration, |
| 83 | enum rawrtc_sctp_transport_congestion_ctrl algorithm); |
| 84 | |
| 85 | /* |
| 86 | * Set the SCTP transport's maximum transmission unit (MTU). |
| 87 | * A value of zero indicates that the default MTU should be used. |
| 88 | */ |
| 89 | enum rawrtc_code rawrtc_peer_connection_configuration_set_sctp_mtu( |
| 90 | struct rawrtc_peer_connection_configuration* configuration, uint32_t mtu); |
| 91 | |
| 92 | /* |
| 93 | * Enable or disable MTU discovery on the SCTP transport. |
| 94 | */ |
| 95 | enum rawrtc_code rawrtc_peer_connection_configuration_set_sctp_mtu_discovery( |
| 96 | struct rawrtc_peer_connection_configuration* configuration, bool on); |