blob: 345bf179bcb598e9d7e028c70ff3b7c4f89d20ec [file] [log] [blame]
Anders Carlsson7bca8ca2018-08-30 09:30:29 +02001/*
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 Wright8c27cca2018-10-25 10:16:44 -070014#import "RTCCryptoOptions.h"
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020015#import "RTCMacros.h"
16
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020017@class RTC_OBJC_TYPE(RTCIceServer);
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020018
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 */
23typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) {
24 RTCIceTransportPolicyNone,
25 RTCIceTransportPolicyRelay,
26 RTCIceTransportPolicyNoHost,
27 RTCIceTransportPolicyAll
28};
29
30/** Represents the bundle policy. */
31typedef NS_ENUM(NSInteger, RTCBundlePolicy) {
32 RTCBundlePolicyBalanced,
33 RTCBundlePolicyMaxCompat,
34 RTCBundlePolicyMaxBundle
35};
36
37/** Represents the rtcp mux policy. */
38typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire };
39
40/** Represents the tcp candidate policy. */
41typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) {
42 RTCTcpCandidatePolicyEnabled,
43 RTCTcpCandidatePolicyDisabled
44};
45
46/** Represents the candidate network policy. */
47typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) {
48 RTCCandidateNetworkPolicyAll,
49 RTCCandidateNetworkPolicyLowCost
50};
51
52/** Represents the continual gathering policy. */
53typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) {
54 RTCContinualGatheringPolicyGatherOnce,
55 RTCContinualGatheringPolicyGatherContinually
56};
57
58/** Represents the encryption key type. */
59typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) {
60 RTCEncryptionKeyTypeRSA,
61 RTCEncryptionKeyTypeECDSA,
62};
63
64/** Represents the chosen SDP semantics for the RTCPeerConnection. */
65typedef NS_ENUM(NSInteger, RTCSdpSemantics) {
Henrik Boström766c80b2022-01-12 17:46:03 +010066 // TODO(https://crbug.com/webrtc/13528): Remove support for Plan B.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020067 RTCSdpSemanticsPlanB,
68 RTCSdpSemanticsUnifiedPlan,
69};
70
71NS_ASSUME_NONNULL_BEGIN
72
Mirko Bonadeie8d57242018-09-17 10:22:56 +020073RTC_OBJC_EXPORT
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020074@interface RTC_OBJC_TYPE (RTCConfiguration) : NSObject
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020075
Taylor Brandstetter21c80322020-03-24 15:41:19 -070076/** 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
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020081/** An array of Ice Servers available to be used by ICE. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020082@property(nonatomic, copy) NSArray<RTC_OBJC_TYPE(RTCIceServer) *> *iceServers;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020083
84/** An RTCCertificate for 're' use. */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +020085@property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCertificate) * certificate;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020086
87/** Which candidates the ICE agent is allowed to use. The W3C calls it
Artem Titovd7ac5812021-07-27 12:23:39 +020088 * `iceTransportPolicy`, while in C++ it is called `type`. */
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020089@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
Uladzislau Sushabf0d0c12018-11-05 12:48:35 +0300100/** If set to YES, don't gather IPv6 ICE candidates.
101 * Default is NO.
102 */
103@property(nonatomic, assign) BOOL disableIPV6;
104
105/** If set to YES, don't gather IPv6 ICE candidates on Wi-Fi.
106 * Only intended to be used on specific devices. Certain phones disable IPv6
107 * when the screen is turned off and it would be better to just disable the
108 * IPv6 ICE candidates on Wi-Fi in those cases.
109 * Default is NO.
110 */
111@property(nonatomic, assign) BOOL disableIPV6OnWiFi;
112
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200113/** By default, the PeerConnection will use a limited number of IPv6 network
114 * interfaces, in order to avoid too many ICE candidate pairs being created
115 * and delaying ICE completion.
116 *
117 * Can be set to INT_MAX to effectively disable the limit.
118 */
119@property(nonatomic, assign) int maxIPv6Networks;
120
121/** Exclude link-local network interfaces
122 * from considertaion for gathering ICE candidates.
123 * Defaults to NO.
124 */
125@property(nonatomic, assign) BOOL disableLinkLocalNetworks;
126
127@property(nonatomic, assign) int audioJitterBufferMaxPackets;
128@property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate;
129@property(nonatomic, assign) int iceConnectionReceivingTimeout;
130@property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
131
132/** Key type used to generate SSL identity. Default is ECDSA. */
133@property(nonatomic, assign) RTCEncryptionKeyType keyType;
134
135/** ICE candidate pool size as defined in JSEP. Default is 0. */
136@property(nonatomic, assign) int iceCandidatePoolSize;
137
138/** Prune turn ports on the same network to the same turn server.
139 * Default is NO.
140 */
141@property(nonatomic, assign) BOOL shouldPruneTurnPorts;
142
143/** If set to YES, this means the ICE transport should presume TURN-to-TURN
144 * candidate pairs will succeed, even before a binding response is received.
145 */
146@property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
147
Artem Titovd7ac5812021-07-27 12:23:39 +0200148/* This flag is only effective when `continualGatheringPolicy` is
Qingsi Wang1fe119f2019-05-31 16:55:33 -0700149 * RTCContinualGatheringPolicyGatherContinually.
150 *
151 * If YES, after the ICE transport type is changed such that new types of
152 * ICE candidates are allowed by the new transport type, e.g. from
153 * RTCIceTransportPolicyRelay to RTCIceTransportPolicyAll, candidates that
154 * have been gathered by the ICE transport but not matching the previous
155 * transport type and as a result not observed by PeerConnectionDelegateAdapter,
156 * will be surfaced to the delegate.
157 */
158@property(nonatomic, assign) BOOL shouldSurfaceIceCandidatesOnIceTransportTypeChanged;
159
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200160/** If set to non-nil, controls the minimal interval between consecutive ICE
161 * check packets.
162 */
163@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
164
Henrik Boström2832bbf2022-01-21 09:49:31 +0100165/**
166 * Configure the SDP semantics used by this PeerConnection. By default, this
167 * is RTCSdpSemanticsUnifiedPlan which is compliant to the WebRTC 1.0
168 * specification. It is possible to overrwite this to the deprecated
169 * RTCSdpSemanticsPlanB SDP format, but note that RTCSdpSemanticsPlanB will be
170 * deleted at some future date, see https://crbug.com/webrtc/13528.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200171 *
Henrik Boström2832bbf2022-01-21 09:49:31 +0100172 * RTCSdpSemanticsUnifiedPlan will cause RTCPeerConnection to create offers and
173 * answers with multiple m= sections where each m= section maps to one
174 * RTCRtpSender and one RTCRtpReceiver (an RTCRtpTransceiver), either both audio
175 * or both video. This will also cause RTCPeerConnection to ignore all but the
176 * first a=ssrc lines that form a Plan B stream.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200177 *
Henrik Boström2832bbf2022-01-21 09:49:31 +0100178 * RTCSdpSemanticsPlanB will cause RTCPeerConnection to create offers and
179 * answers with at most one audio and one video m= section with multiple
180 * RTCRtpSenders and RTCRtpReceivers specified as multiple a=ssrc lines within
181 * the section. This will also cause RTCPeerConnection to ignore all but the
182 * first m= section of the same media type.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200183 */
184@property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
185
186/** Actively reset the SRTP parameters when the DTLS transports underneath are
187 * changed after offer/answer negotiation. This is only intended to be a
188 * workaround for crbug.com/835958
189 */
190@property(nonatomic, assign) BOOL activeResetSrtpParams;
191
philipel3eb84f02019-11-11 12:57:44 +0100192/** If the remote side support mid-stream codec switches then allow encoder
193 * switching to be performed.
194 */
195
196@property(nonatomic, assign) BOOL allowCodecSwitching;
197
Piotr (Peter) Slatalae0c2e972018-10-08 09:43:21 -0700198/**
Benjamin Wright8c27cca2018-10-25 10:16:44 -0700199 * Defines advanced optional cryptographic settings related to SRTP and
200 * frame encryption for native WebRTC. Setting this will overwrite any
201 * options set through the PeerConnectionFactory (which is deprecated).
202 */
Mirko Bonadeia81e9c82020-05-04 16:14:32 +0200203@property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCryptoOptions) * cryptoOptions;
Benjamin Wright8c27cca2018-10-25 10:16:44 -0700204
Jiawei Oub1e47752018-11-13 23:48:19 -0800205/**
Brad Pughf24143d2020-11-16 16:27:20 -0800206 * An optional string that will be attached to the TURN_ALLOCATE_REQUEST which
207 * which can be used to correlate client logs with backend logs.
208 */
209@property(nonatomic, nullable, copy) NSString *turnLoggingId;
210
211/**
Jiawei Oub1e47752018-11-13 23:48:19 -0800212 * Time interval between audio RTCP reports.
213 */
214@property(nonatomic, assign) int rtcpAudioReportIntervalMs;
215
216/**
217 * Time interval between video RTCP reports.
218 */
219@property(nonatomic, assign) int rtcpVideoReportIntervalMs;
220
Yura Yaroshevich41736142021-03-16 18:04:36 +0300221/**
222 * Allow implicit rollback of local description when remote description
223 * conflicts with local description.
224 * See: https://w3c.github.io/webrtc-pc/#dom-peerconnection-setremotedescription
225 */
226@property(nonatomic, assign) BOOL enableImplicitRollback;
227
Yura Yaroshevichcbadb8b2021-03-17 17:39:52 +0300228/**
229 * Control if "a=extmap-allow-mixed" is included in the offer.
230 * See: https://www.chromestatus.com/feature/6269234631933952
231 */
232@property(nonatomic, assign) BOOL offerExtmapAllowMixed;
233
Yura Yaroshevichb9fa3192021-03-31 16:48:39 +0300234/**
235 * Defines the interval applied to ALL candidate pairs
236 * when ICE is strongly connected, and it overrides the
237 * default value of this interval in the ICE implementation;
238 */
239@property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalStrongConnectivity;
240
241/**
242 * Defines the counterpart for ALL pairs when ICE is
243 * weakly connected, and it overrides the default value of
244 * this interval in the ICE implementation
245 */
246@property(nonatomic, copy, nullable) NSNumber *iceCheckIntervalWeakConnectivity;
247
248/**
249 * The min time period for which a candidate pair must wait for response to
250 * connectivity checks before it becomes unwritable. This parameter
251 * overrides the default value in the ICE implementation if set.
252 */
253@property(nonatomic, copy, nullable) NSNumber *iceUnwritableTimeout;
254
255/**
256 * The min number of connectivity checks that a candidate pair must sent
257 * without receiving response before it becomes unwritable. This parameter
258 * overrides the default value in the ICE implementation if set.
259 */
260@property(nonatomic, copy, nullable) NSNumber *iceUnwritableMinChecks;
261
262/**
263 * The min time period for which a candidate pair must wait for response to
264 * connectivity checks it becomes inactive. This parameter overrides the
265 * default value in the ICE implementation if set.
266 */
267@property(nonatomic, copy, nullable) NSNumber *iceInactiveTimeout;
268
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200269- (instancetype)init;
270
271@end
272
273NS_ASSUME_NONNULL_END