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" 14 #import "RTCCryptoOptions.h" 15 #import "RTCMacros.h" 16 17 @class RTC_OBJC_TYPE(RTCIceServer); 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) { 66 // TODO(https://crbug.com/webrtc/13528): Remove support for Plan B. 67 RTCSdpSemanticsPlanB, 68 RTCSdpSemanticsUnifiedPlan, 69 }; 70 71 NS_ASSUME_NONNULL_BEGIN 72 73 RTC_OBJC_EXPORT 74 @interface RTC_OBJC_TYPE (RTCConfiguration) : NSObject 75 76 /** If true, allows DSCP codes to be set on outgoing packets, configured using 77 * networkPriority field of RTCRtpEncodingParameters. Defaults to false. 78 */ 79 @property(nonatomic, assign) BOOL enableDscp; 80 81 /** An array of Ice Servers available to be used by ICE. */ 82 @property(nonatomic, copy) NSArray<RTC_OBJC_TYPE(RTCIceServer) *> *iceServers; 83 84 /** An RTCCertificate for 're' use. */ 85 @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCertificate) * certificate; 86 87 /** Which candidates the ICE agent is allowed to use. The W3C calls it 88 * `iceTransportPolicy`, while in C++ it is called `type`. */ 89 @property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy; 90 91 /** The media-bundling policy to use when gathering ICE candidates. */ 92 @property(nonatomic, assign) RTCBundlePolicy bundlePolicy; 93 94 /** The rtcp-mux policy to use when gathering ICE candidates. */ 95 @property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy; 96 @property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy; 97 @property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy; 98 @property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy; 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 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 /* This flag is only effective when `continualGatheringPolicy` is 144 * RTCContinualGatheringPolicyGatherContinually. 145 * 146 * If YES, after the ICE transport type is changed such that new types of 147 * ICE candidates are allowed by the new transport type, e.g. from 148 * RTCIceTransportPolicyRelay to RTCIceTransportPolicyAll, candidates that 149 * have been gathered by the ICE transport but not matching the previous 150 * transport type and as a result not observed by PeerConnectionDelegateAdapter, 151 * will be surfaced to the delegate. 152 */ 153 @property(nonatomic, assign) BOOL shouldSurfaceIceCandidatesOnIceTransportTypeChanged; 154 155 /** If set to non-nil, controls the minimal interval between consecutive ICE 156 * check packets. 157 */ 158 @property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval; 159 160 /** 161 * Configure the SDP semantics used by this PeerConnection. By default, this 162 * is RTCSdpSemanticsUnifiedPlan which is compliant to the WebRTC 1.0 163 * specification. It is possible to overrwite this to the deprecated 164 * RTCSdpSemanticsPlanB SDP format, but note that RTCSdpSemanticsPlanB will be 165 * deleted at some future date, see https://crbug.com/webrtc/13528. 166 * 167 * RTCSdpSemanticsUnifiedPlan will cause RTCPeerConnection to create offers and 168 * answers with multiple m= sections where each m= section maps to one 169 * RTCRtpSender and one RTCRtpReceiver (an RTCRtpTransceiver), either both audio 170 * or both video. This will also cause RTCPeerConnection to ignore all but the 171 * first a=ssrc lines that form a Plan B stream. 172 * 173 * RTCSdpSemanticsPlanB will cause RTCPeerConnection to create offers and 174 * answers with at most one audio and one video m= section with multiple 175 * RTCRtpSenders and RTCRtpReceivers specified as multiple a=ssrc lines within 176 * the section. This will also cause RTCPeerConnection to ignore all but the 177 * first m= section of the same media type. 178 */ 179 @property(nonatomic, assign) RTCSdpSemantics sdpSemantics; 180 181 /** Actively reset the SRTP parameters when the DTLS transports underneath are 182 * changed after offer/answer negotiation. This is only intended to be a 183 * workaround for crbug.com/835958 184 */ 185 @property(nonatomic, assign) BOOL activeResetSrtpParams; 186 187 /** If the remote side support mid-stream codec switches then allow encoder 188 * switching to be performed. 189 */ 190 191 @property(nonatomic, assign) BOOL allowCodecSwitching; 192 193 /** 194 * Defines advanced optional cryptographic settings related to SRTP and 195 * frame encryption for native WebRTC. Setting this will overwrite any 196 * options set through the PeerConnectionFactory (which is deprecated). 197 */ 198 @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCryptoOptions) * cryptoOptions; 199 200 /** 201 * An optional string that will be attached to the TURN_ALLOCATE_REQUEST which 202 * which can be used to correlate client logs with backend logs. 203 */ 204 @property(nonatomic, nullable, copy) NSString *turnLoggingId; 205 206 /** 207 * Time interval between audio RTCP reports. 208 */ 209 @property(nonatomic, assign) int rtcpAudioReportIntervalMs; 210 211 /** 212 * Time interval between video RTCP reports. 213 */ 214 @property(nonatomic, assign) int rtcpVideoReportIntervalMs; 215 216 /** 217 * Allow implicit rollback of local description when remote description 218 * conflicts with local description. 219 * See: https://w3c.github.io/webrtc-pc/#dom-peerconnection-setremotedescription 220 */ 221 @property(nonatomic, assign) BOOL enableImplicitRollback; 222 223 /** 224 * Control if "a=extmap-allow-mixed" is included in the offer. 225 * See: https://www.chromestatus.com/feature/6269234631933952 226 */ 227 @property(nonatomic, assign) BOOL offerExtmapAllowMixed; 228 229 /** 230 * Defines the interval applied to ALL candidate pairs 231 * when ICE is strongly connected, and it overrides the 232 * default value of this interval in the ICE implementation; 233 */ 234 @property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalStrongConnectivity; 235 236 /** 237 * Defines the counterpart for ALL pairs when ICE is 238 * weakly connected, and it overrides the default value of 239 * this interval in the ICE implementation 240 */ 241 @property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalWeakConnectivity; 242 243 /** 244 * The min time period for which a candidate pair must wait for response to 245 * connectivity checks before it becomes unwritable. This parameter 246 * overrides the default value in the ICE implementation if set. 247 */ 248 @property(nonatomic, copy, nullable) NSNumber *iceUnwritableTimeout; 249 250 /** 251 * The min number of connectivity checks that a candidate pair must sent 252 * without receiving response before it becomes unwritable. This parameter 253 * overrides the default value in the ICE implementation if set. 254 */ 255 @property(nonatomic, copy, nullable) NSNumber *iceUnwritableMinChecks; 256 257 /** 258 * The min time period for which a candidate pair must wait for response to 259 * connectivity checks it becomes inactive. This parameter overrides the 260 * default value in the ICE implementation if set. 261 */ 262 @property(nonatomic, copy, nullable) NSNumber *iceInactiveTimeout; 263 264 - (instancetype)init; 265 266 @end 267 268 NS_ASSUME_NONNULL_END 269