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 | |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 17 | @class RTC_OBJC_TYPE(RTCIceServer); |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 18 | |
| 19 | /** |
| 20 | * Represents the ice transport policy. This exposes the same states in C++, |
| 21 | * which include one more state than what exists in the W3C spec. |
| 22 | */ |
| 23 | typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) { |
| 24 | RTCIceTransportPolicyNone, |
| 25 | RTCIceTransportPolicyRelay, |
| 26 | RTCIceTransportPolicyNoHost, |
| 27 | RTCIceTransportPolicyAll |
| 28 | }; |
| 29 | |
| 30 | /** Represents the bundle policy. */ |
| 31 | typedef NS_ENUM(NSInteger, RTCBundlePolicy) { |
| 32 | RTCBundlePolicyBalanced, |
| 33 | RTCBundlePolicyMaxCompat, |
| 34 | RTCBundlePolicyMaxBundle |
| 35 | }; |
| 36 | |
| 37 | /** Represents the rtcp mux policy. */ |
| 38 | typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire }; |
| 39 | |
| 40 | /** Represents the tcp candidate policy. */ |
| 41 | typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) { |
| 42 | RTCTcpCandidatePolicyEnabled, |
| 43 | RTCTcpCandidatePolicyDisabled |
| 44 | }; |
| 45 | |
| 46 | /** Represents the candidate network policy. */ |
| 47 | typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) { |
| 48 | RTCCandidateNetworkPolicyAll, |
| 49 | RTCCandidateNetworkPolicyLowCost |
| 50 | }; |
| 51 | |
| 52 | /** Represents the continual gathering policy. */ |
| 53 | typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) { |
| 54 | RTCContinualGatheringPolicyGatherOnce, |
| 55 | RTCContinualGatheringPolicyGatherContinually |
| 56 | }; |
| 57 | |
| 58 | /** Represents the encryption key type. */ |
| 59 | typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) { |
| 60 | RTCEncryptionKeyTypeRSA, |
| 61 | RTCEncryptionKeyTypeECDSA, |
| 62 | }; |
| 63 | |
| 64 | /** Represents the chosen SDP semantics for the RTCPeerConnection. */ |
| 65 | typedef NS_ENUM(NSInteger, RTCSdpSemantics) { |
Henrik Boström | 766c80b | 2022-01-12 17:46:03 +0100 | [diff] [blame] | 66 | // TODO(https://crbug.com/webrtc/13528): Remove support for Plan B. |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 67 | RTCSdpSemanticsPlanB, |
| 68 | RTCSdpSemanticsUnifiedPlan, |
Henrik Boström | 766c80b | 2022-01-12 17:46:03 +0100 | [diff] [blame] | 69 | // The default sdpSemantics value is about to change to Unified Plan. During |
| 70 | // a short transition period, NotSpecified is used to ensure clients that |
| 71 | // don't set sdpSemantics are aware of the change by CHECK-crashing. |
| 72 | // TODO(https://crbug.com/webrtc/11121): When the default has changed to |
| 73 | // UnifiedPlan, delete NotSpecified. |
| 74 | RTCSdpSemanticsNotSpecified, |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 75 | }; |
| 76 | |
| 77 | NS_ASSUME_NONNULL_BEGIN |
| 78 | |
Mirko Bonadei | e8d5724 | 2018-09-17 10:22:56 +0200 | [diff] [blame] | 79 | RTC_OBJC_EXPORT |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 80 | @interface RTC_OBJC_TYPE (RTCConfiguration) : NSObject |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 81 | |
Taylor Brandstetter | 21c8032 | 2020-03-24 15:41:19 -0700 | [diff] [blame] | 82 | /** If true, allows DSCP codes to be set on outgoing packets, configured using |
| 83 | * networkPriority field of RTCRtpEncodingParameters. Defaults to false. |
| 84 | */ |
| 85 | @property(nonatomic, assign) BOOL enableDscp; |
| 86 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 87 | /** An array of Ice Servers available to be used by ICE. */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 88 | @property(nonatomic, copy) NSArray<RTC_OBJC_TYPE(RTCIceServer) *> *iceServers; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 89 | |
| 90 | /** An RTCCertificate for 're' use. */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 91 | @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCertificate) * certificate; |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 92 | |
| 93 | /** Which candidates the ICE agent is allowed to use. The W3C calls it |
Artem Titov | d7ac581 | 2021-07-27 12:23:39 +0200 | [diff] [blame] | 94 | * `iceTransportPolicy`, while in C++ it is called `type`. */ |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 95 | @property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy; |
| 96 | |
| 97 | /** The media-bundling policy to use when gathering ICE candidates. */ |
| 98 | @property(nonatomic, assign) RTCBundlePolicy bundlePolicy; |
| 99 | |
| 100 | /** The rtcp-mux policy to use when gathering ICE candidates. */ |
| 101 | @property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy; |
| 102 | @property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy; |
| 103 | @property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy; |
| 104 | @property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy; |
| 105 | |
Uladzislau Susha | bf0d0c1 | 2018-11-05 12:48:35 +0300 | [diff] [blame] | 106 | /** If set to YES, don't gather IPv6 ICE candidates. |
| 107 | * Default is NO. |
| 108 | */ |
| 109 | @property(nonatomic, assign) BOOL disableIPV6; |
| 110 | |
| 111 | /** If set to YES, don't gather IPv6 ICE candidates on Wi-Fi. |
| 112 | * Only intended to be used on specific devices. Certain phones disable IPv6 |
| 113 | * when the screen is turned off and it would be better to just disable the |
| 114 | * IPv6 ICE candidates on Wi-Fi in those cases. |
| 115 | * Default is NO. |
| 116 | */ |
| 117 | @property(nonatomic, assign) BOOL disableIPV6OnWiFi; |
| 118 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 119 | /** By default, the PeerConnection will use a limited number of IPv6 network |
| 120 | * interfaces, in order to avoid too many ICE candidate pairs being created |
| 121 | * and delaying ICE completion. |
| 122 | * |
| 123 | * Can be set to INT_MAX to effectively disable the limit. |
| 124 | */ |
| 125 | @property(nonatomic, assign) int maxIPv6Networks; |
| 126 | |
| 127 | /** Exclude link-local network interfaces |
| 128 | * from considertaion for gathering ICE candidates. |
| 129 | * Defaults to NO. |
| 130 | */ |
| 131 | @property(nonatomic, assign) BOOL disableLinkLocalNetworks; |
| 132 | |
| 133 | @property(nonatomic, assign) int audioJitterBufferMaxPackets; |
| 134 | @property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate; |
| 135 | @property(nonatomic, assign) int iceConnectionReceivingTimeout; |
| 136 | @property(nonatomic, assign) int iceBackupCandidatePairPingInterval; |
| 137 | |
| 138 | /** Key type used to generate SSL identity. Default is ECDSA. */ |
| 139 | @property(nonatomic, assign) RTCEncryptionKeyType keyType; |
| 140 | |
| 141 | /** ICE candidate pool size as defined in JSEP. Default is 0. */ |
| 142 | @property(nonatomic, assign) int iceCandidatePoolSize; |
| 143 | |
| 144 | /** Prune turn ports on the same network to the same turn server. |
| 145 | * Default is NO. |
| 146 | */ |
| 147 | @property(nonatomic, assign) BOOL shouldPruneTurnPorts; |
| 148 | |
| 149 | /** If set to YES, this means the ICE transport should presume TURN-to-TURN |
| 150 | * candidate pairs will succeed, even before a binding response is received. |
| 151 | */ |
| 152 | @property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed; |
| 153 | |
Artem Titov | d7ac581 | 2021-07-27 12:23:39 +0200 | [diff] [blame] | 154 | /* This flag is only effective when `continualGatheringPolicy` is |
Qingsi Wang | 1fe119f | 2019-05-31 16:55:33 -0700 | [diff] [blame] | 155 | * RTCContinualGatheringPolicyGatherContinually. |
| 156 | * |
| 157 | * If YES, after the ICE transport type is changed such that new types of |
| 158 | * ICE candidates are allowed by the new transport type, e.g. from |
| 159 | * RTCIceTransportPolicyRelay to RTCIceTransportPolicyAll, candidates that |
| 160 | * have been gathered by the ICE transport but not matching the previous |
| 161 | * transport type and as a result not observed by PeerConnectionDelegateAdapter, |
| 162 | * will be surfaced to the delegate. |
| 163 | */ |
| 164 | @property(nonatomic, assign) BOOL shouldSurfaceIceCandidatesOnIceTransportTypeChanged; |
| 165 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 166 | /** If set to non-nil, controls the minimal interval between consecutive ICE |
| 167 | * check packets. |
| 168 | */ |
| 169 | @property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval; |
| 170 | |
Henrik Boström | 766c80b | 2022-01-12 17:46:03 +0100 | [diff] [blame] | 171 | /** Configure the SDP semantics used by this PeerConnection. The WebRTC 1.0 |
| 172 | * specification requires RTCSdpSemanticsUnifiedPlan semantics and the |
| 173 | * RtpTransceiver API is only available in Unified Plan. RTCSdpSemanticsPlanB |
| 174 | * is being deprecated and will be removed at a future date. |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 175 | * |
| 176 | * PlanB will cause RTCPeerConnection to create offers and answers with at |
| 177 | * most one audio and one video m= section with multiple RTCRtpSenders and |
| 178 | * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This |
| 179 | * will also cause RTCPeerConnection to ignore all but the first m= section of |
| 180 | * the same media type. |
| 181 | * |
| 182 | * UnifiedPlan will cause RTCPeerConnection to create offers and answers with |
| 183 | * multiple m= sections where each m= section maps to one RTCRtpSender and one |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 184 | * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both |
Henrik Boström | 766c80b | 2022-01-12 17:46:03 +0100 | [diff] [blame] | 185 | * video. This will also cause RTCPeerConnection) to ignore all but the first |
| 186 | * a=ssrc lines that form a Plan B stream. |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 187 | * |
Henrik Boström | 766c80b | 2022-01-12 17:46:03 +0100 | [diff] [blame] | 188 | * For users who have to interwork with legacy WebRTC implementations, it |
| 189 | * is possible to specify PlanB until the code is finally removed |
| 190 | * (https://crbug.com/webrtc/13528). |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 191 | * |
Henrik Boström | 766c80b | 2022-01-12 17:46:03 +0100 | [diff] [blame] | 192 | * The default SdpSemantics value is about to change to UnifiedPlan. During a |
| 193 | * short transition period, NotSpecified is used to ensure clients that don't |
| 194 | * set SdpSemantics are aware of the change by CHECK-crashing. |
| 195 | * TODO(https://crbug.com/webrtc/11121): When the default has changed to |
| 196 | * UnifiedPlan, delete NotSpecified. |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 197 | */ |
| 198 | @property(nonatomic, assign) RTCSdpSemantics sdpSemantics; |
| 199 | |
| 200 | /** Actively reset the SRTP parameters when the DTLS transports underneath are |
| 201 | * changed after offer/answer negotiation. This is only intended to be a |
| 202 | * workaround for crbug.com/835958 |
| 203 | */ |
| 204 | @property(nonatomic, assign) BOOL activeResetSrtpParams; |
| 205 | |
philipel | 3eb84f0 | 2019-11-11 12:57:44 +0100 | [diff] [blame] | 206 | /** If the remote side support mid-stream codec switches then allow encoder |
| 207 | * switching to be performed. |
| 208 | */ |
| 209 | |
| 210 | @property(nonatomic, assign) BOOL allowCodecSwitching; |
| 211 | |
Piotr (Peter) Slatala | e0c2e97 | 2018-10-08 09:43:21 -0700 | [diff] [blame] | 212 | /** |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 213 | * Defines advanced optional cryptographic settings related to SRTP and |
| 214 | * frame encryption for native WebRTC. Setting this will overwrite any |
| 215 | * options set through the PeerConnectionFactory (which is deprecated). |
| 216 | */ |
Mirko Bonadei | a81e9c8 | 2020-05-04 16:14:32 +0200 | [diff] [blame] | 217 | @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCryptoOptions) * cryptoOptions; |
Benjamin Wright | 8c27cca | 2018-10-25 10:16:44 -0700 | [diff] [blame] | 218 | |
Jiawei Ou | b1e4775 | 2018-11-13 23:48:19 -0800 | [diff] [blame] | 219 | /** |
Brad Pugh | f24143d | 2020-11-16 16:27:20 -0800 | [diff] [blame] | 220 | * An optional string that will be attached to the TURN_ALLOCATE_REQUEST which |
| 221 | * which can be used to correlate client logs with backend logs. |
| 222 | */ |
| 223 | @property(nonatomic, nullable, copy) NSString *turnLoggingId; |
| 224 | |
| 225 | /** |
Jiawei Ou | b1e4775 | 2018-11-13 23:48:19 -0800 | [diff] [blame] | 226 | * Time interval between audio RTCP reports. |
| 227 | */ |
| 228 | @property(nonatomic, assign) int rtcpAudioReportIntervalMs; |
| 229 | |
| 230 | /** |
| 231 | * Time interval between video RTCP reports. |
| 232 | */ |
| 233 | @property(nonatomic, assign) int rtcpVideoReportIntervalMs; |
| 234 | |
Yura Yaroshevich | 4173614 | 2021-03-16 18:04:36 +0300 | [diff] [blame] | 235 | /** |
| 236 | * Allow implicit rollback of local description when remote description |
| 237 | * conflicts with local description. |
| 238 | * See: https://w3c.github.io/webrtc-pc/#dom-peerconnection-setremotedescription |
| 239 | */ |
| 240 | @property(nonatomic, assign) BOOL enableImplicitRollback; |
| 241 | |
Yura Yaroshevich | cbadb8b | 2021-03-17 17:39:52 +0300 | [diff] [blame] | 242 | /** |
| 243 | * Control if "a=extmap-allow-mixed" is included in the offer. |
| 244 | * See: https://www.chromestatus.com/feature/6269234631933952 |
| 245 | */ |
| 246 | @property(nonatomic, assign) BOOL offerExtmapAllowMixed; |
| 247 | |
Yura Yaroshevich | b9fa319 | 2021-03-31 16:48:39 +0300 | [diff] [blame] | 248 | /** |
| 249 | * Defines the interval applied to ALL candidate pairs |
| 250 | * when ICE is strongly connected, and it overrides the |
| 251 | * default value of this interval in the ICE implementation; |
| 252 | */ |
| 253 | @property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalStrongConnectivity; |
| 254 | |
| 255 | /** |
| 256 | * Defines the counterpart for ALL pairs when ICE is |
| 257 | * weakly connected, and it overrides the default value of |
| 258 | * this interval in the ICE implementation |
| 259 | */ |
| 260 | @property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalWeakConnectivity; |
| 261 | |
| 262 | /** |
| 263 | * The min time period for which a candidate pair must wait for response to |
| 264 | * connectivity checks before it becomes unwritable. This parameter |
| 265 | * overrides the default value in the ICE implementation if set. |
| 266 | */ |
| 267 | @property(nonatomic, copy, nullable) NSNumber *iceUnwritableTimeout; |
| 268 | |
| 269 | /** |
| 270 | * The min number of connectivity checks that a candidate pair must sent |
| 271 | * without receiving response before it becomes unwritable. This parameter |
| 272 | * overrides the default value in the ICE implementation if set. |
| 273 | */ |
| 274 | @property(nonatomic, copy, nullable) NSNumber *iceUnwritableMinChecks; |
| 275 | |
| 276 | /** |
| 277 | * The min time period for which a candidate pair must wait for response to |
| 278 | * connectivity checks it becomes inactive. This parameter overrides the |
| 279 | * default value in the ICE implementation if set. |
| 280 | */ |
| 281 | @property(nonatomic, copy, nullable) NSNumber *iceInactiveTimeout; |
| 282 | |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 283 | - (instancetype)init; |
| 284 | |
| 285 | @end |
| 286 | |
| 287 | NS_ASSUME_NONNULL_END |