Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #import <Foundation/Foundation.h> |
| 12 | |
| 13 | #import "RTCCertificate.h" |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 14 | #import "RTCCryptoOptions.h" |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 15 | #import "RTCMacros.h" |
| 16 | |
| 17 | @class RTCIceServer; |
| 18 | @class RTCIntervalRange; |
| 19 | |
| 20 | /** |
| 21 | * Represents the ice transport policy. This exposes the same states in C++, |
| 22 | * which include one more state than what exists in the W3C spec. |
| 23 | */ |
| 24 | typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) { |
| 25 | RTCIceTransportPolicyNone, |
| 26 | RTCIceTransportPolicyRelay, |
| 27 | RTCIceTransportPolicyNoHost, |
| 28 | RTCIceTransportPolicyAll |
| 29 | }; |
| 30 | |
| 31 | /** Represents the bundle policy. */ |
| 32 | typedef NS_ENUM(NSInteger, RTCBundlePolicy) { |
| 33 | RTCBundlePolicyBalanced, |
| 34 | RTCBundlePolicyMaxCompat, |
| 35 | RTCBundlePolicyMaxBundle |
| 36 | }; |
| 37 | |
| 38 | /** Represents the rtcp mux policy. */ |
| 39 | typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire }; |
| 40 | |
| 41 | /** Represents the tcp candidate policy. */ |
| 42 | typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) { |
| 43 | RTCTcpCandidatePolicyEnabled, |
| 44 | RTCTcpCandidatePolicyDisabled |
| 45 | }; |
| 46 | |
| 47 | /** Represents the candidate network policy. */ |
| 48 | typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) { |
| 49 | RTCCandidateNetworkPolicyAll, |
| 50 | RTCCandidateNetworkPolicyLowCost |
| 51 | }; |
| 52 | |
| 53 | /** Represents the continual gathering policy. */ |
| 54 | typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) { |
| 55 | RTCContinualGatheringPolicyGatherOnce, |
| 56 | RTCContinualGatheringPolicyGatherContinually |
| 57 | }; |
| 58 | |
| 59 | /** Represents the encryption key type. */ |
| 60 | typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) { |
| 61 | RTCEncryptionKeyTypeRSA, |
| 62 | RTCEncryptionKeyTypeECDSA, |
| 63 | }; |
| 64 | |
| 65 | /** Represents the chosen SDP semantics for the RTCPeerConnection. */ |
| 66 | typedef NS_ENUM(NSInteger, RTCSdpSemantics) { |
| 67 | RTCSdpSemanticsPlanB, |
| 68 | RTCSdpSemanticsUnifiedPlan, |
| 69 | }; |
| 70 | |
| 71 | NS_ASSUME_NONNULL_BEGIN |
| 72 | |
Mirko Bonadei | e8d5724 | 2018-09-17 10:22:56 +0200 | [diff] [blame] | 73 | RTC_OBJC_EXPORT |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 74 | @interface RTCConfiguration : NSObject |
| 75 | |
| 76 | /** An array of Ice Servers available to be used by ICE. */ |
| 77 | @property(nonatomic, copy) NSArray<RTCIceServer *> *iceServers; |
| 78 | |
| 79 | /** An RTCCertificate for 're' use. */ |
| 80 | @property(nonatomic, nullable) RTCCertificate *certificate; |
| 81 | |
| 82 | /** Which candidates the ICE agent is allowed to use. The W3C calls it |
| 83 | * |iceTransportPolicy|, while in C++ it is called |type|. */ |
| 84 | @property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy; |
| 85 | |
| 86 | /** The media-bundling policy to use when gathering ICE candidates. */ |
| 87 | @property(nonatomic, assign) RTCBundlePolicy bundlePolicy; |
| 88 | |
| 89 | /** The rtcp-mux policy to use when gathering ICE candidates. */ |
| 90 | @property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy; |
| 91 | @property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy; |
| 92 | @property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy; |
| 93 | @property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy; |
| 94 | |
Uladzislau Susha | bf0d0c1 | 2018-11-05 12:48:35 +0300 | [diff] [blame] | 95 | /** If set to YES, don't gather IPv6 ICE candidates. |
| 96 | * Default is NO. |
| 97 | */ |
| 98 | @property(nonatomic, assign) BOOL disableIPV6; |
| 99 | |
| 100 | /** If set to YES, don't gather IPv6 ICE candidates on Wi-Fi. |
| 101 | * Only intended to be used on specific devices. Certain phones disable IPv6 |
| 102 | * when the screen is turned off and it would be better to just disable the |
| 103 | * IPv6 ICE candidates on Wi-Fi in those cases. |
| 104 | * Default is NO. |
| 105 | */ |
| 106 | @property(nonatomic, assign) BOOL disableIPV6OnWiFi; |
| 107 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 108 | /** By default, the PeerConnection will use a limited number of IPv6 network |
| 109 | * interfaces, in order to avoid too many ICE candidate pairs being created |
| 110 | * and delaying ICE completion. |
| 111 | * |
| 112 | * Can be set to INT_MAX to effectively disable the limit. |
| 113 | */ |
| 114 | @property(nonatomic, assign) int maxIPv6Networks; |
| 115 | |
| 116 | /** Exclude link-local network interfaces |
| 117 | * from considertaion for gathering ICE candidates. |
| 118 | * Defaults to NO. |
| 119 | */ |
| 120 | @property(nonatomic, assign) BOOL disableLinkLocalNetworks; |
| 121 | |
| 122 | @property(nonatomic, assign) int audioJitterBufferMaxPackets; |
| 123 | @property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate; |
| 124 | @property(nonatomic, assign) int iceConnectionReceivingTimeout; |
| 125 | @property(nonatomic, assign) int iceBackupCandidatePairPingInterval; |
| 126 | |
| 127 | /** Key type used to generate SSL identity. Default is ECDSA. */ |
| 128 | @property(nonatomic, assign) RTCEncryptionKeyType keyType; |
| 129 | |
| 130 | /** ICE candidate pool size as defined in JSEP. Default is 0. */ |
| 131 | @property(nonatomic, assign) int iceCandidatePoolSize; |
| 132 | |
| 133 | /** Prune turn ports on the same network to the same turn server. |
| 134 | * Default is NO. |
| 135 | */ |
| 136 | @property(nonatomic, assign) BOOL shouldPruneTurnPorts; |
| 137 | |
| 138 | /** If set to YES, this means the ICE transport should presume TURN-to-TURN |
| 139 | * candidate pairs will succeed, even before a binding response is received. |
| 140 | */ |
| 141 | @property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed; |
| 142 | |
| 143 | /** If set to non-nil, controls the minimal interval between consecutive ICE |
| 144 | * check packets. |
| 145 | */ |
| 146 | @property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval; |
| 147 | |
| 148 | /** ICE Periodic Regathering |
| 149 | * If set, WebRTC will periodically create and propose candidates without |
| 150 | * starting a new ICE generation. The regathering happens continuously with |
| 151 | * interval specified in milliseconds by the uniform distribution [a, b]. |
| 152 | */ |
| 153 | @property(nonatomic, strong, nullable) RTCIntervalRange *iceRegatherIntervalRange; |
| 154 | |
| 155 | /** Configure the SDP semantics used by this PeerConnection. Note that the |
| 156 | * WebRTC 1.0 specification requires UnifiedPlan semantics. The |
| 157 | * RTCRtpTransceiver API is only available with UnifiedPlan semantics. |
| 158 | * |
| 159 | * PlanB will cause RTCPeerConnection to create offers and answers with at |
| 160 | * most one audio and one video m= section with multiple RTCRtpSenders and |
| 161 | * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This |
| 162 | * will also cause RTCPeerConnection to ignore all but the first m= section of |
| 163 | * the same media type. |
| 164 | * |
| 165 | * UnifiedPlan will cause RTCPeerConnection to create offers and answers with |
| 166 | * multiple m= sections where each m= section maps to one RTCRtpSender and one |
| 167 | * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both video. This |
| 168 | * will also cause RTCPeerConnection to ignore all but the first a=ssrc lines |
| 169 | * that form a Plan B stream. |
| 170 | * |
| 171 | * For users who wish to send multiple audio/video streams and need to stay |
| 172 | * interoperable with legacy WebRTC implementations or use legacy APIs, |
| 173 | * specify PlanB. |
| 174 | * |
| 175 | * For all other users, specify UnifiedPlan. |
| 176 | */ |
| 177 | @property(nonatomic, assign) RTCSdpSemantics sdpSemantics; |
| 178 | |
| 179 | /** Actively reset the SRTP parameters when the DTLS transports underneath are |
| 180 | * changed after offer/answer negotiation. This is only intended to be a |
| 181 | * workaround for crbug.com/835958 |
| 182 | */ |
| 183 | @property(nonatomic, assign) BOOL activeResetSrtpParams; |
| 184 | |
Piotr (Peter) Slatala | e0c2e97 | 2018-10-08 09:43:21 -0700 | [diff] [blame] | 185 | /** |
| 186 | * If MediaTransportFactory is provided in PeerConnectionFactory, this flag informs PeerConnection |
| 187 | * that it should use the MediaTransportInterface. |
| 188 | */ |
| 189 | @property(nonatomic, assign) BOOL useMediaTransport; |
| 190 | |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 191 | /** |
Bjorn Mellem | a9bbd86 | 2018-11-02 09:07:48 -0700 | [diff] [blame] | 192 | * If MediaTransportFactory is provided in PeerConnectionFactory, this flag informs PeerConnection |
| 193 | * that it should use the MediaTransportInterface for data channels. |
| 194 | */ |
| 195 | @property(nonatomic, assign) BOOL useMediaTransportForDataChannels; |
| 196 | |
| 197 | /** |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 198 | * Defines advanced optional cryptographic settings related to SRTP and |
| 199 | * frame encryption for native WebRTC. Setting this will overwrite any |
| 200 | * options set through the PeerConnectionFactory (which is deprecated). |
| 201 | */ |
| 202 | @property(nonatomic, nullable) RTCCryptoOptions *cryptoOptions; |
| 203 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 204 | - (instancetype)init; |
| 205 | |
| 206 | @end |
| 207 | |
| 208 | NS_ASSUME_NONNULL_END |