blob: f1400813d610b40ed2cf24ae2bab775c080cf739 [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
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 */
24typedef NS_ENUM(NSInteger, RTCIceTransportPolicy) {
25 RTCIceTransportPolicyNone,
26 RTCIceTransportPolicyRelay,
27 RTCIceTransportPolicyNoHost,
28 RTCIceTransportPolicyAll
29};
30
31/** Represents the bundle policy. */
32typedef NS_ENUM(NSInteger, RTCBundlePolicy) {
33 RTCBundlePolicyBalanced,
34 RTCBundlePolicyMaxCompat,
35 RTCBundlePolicyMaxBundle
36};
37
38/** Represents the rtcp mux policy. */
39typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire };
40
41/** Represents the tcp candidate policy. */
42typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) {
43 RTCTcpCandidatePolicyEnabled,
44 RTCTcpCandidatePolicyDisabled
45};
46
47/** Represents the candidate network policy. */
48typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) {
49 RTCCandidateNetworkPolicyAll,
50 RTCCandidateNetworkPolicyLowCost
51};
52
53/** Represents the continual gathering policy. */
54typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) {
55 RTCContinualGatheringPolicyGatherOnce,
56 RTCContinualGatheringPolicyGatherContinually
57};
58
59/** Represents the encryption key type. */
60typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) {
61 RTCEncryptionKeyTypeRSA,
62 RTCEncryptionKeyTypeECDSA,
63};
64
65/** Represents the chosen SDP semantics for the RTCPeerConnection. */
66typedef NS_ENUM(NSInteger, RTCSdpSemantics) {
67 RTCSdpSemanticsPlanB,
68 RTCSdpSemanticsUnifiedPlan,
69};
70
71NS_ASSUME_NONNULL_BEGIN
72
Mirko Bonadeie8d57242018-09-17 10:22:56 +020073RTC_OBJC_EXPORT
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020074@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 Sushabf0d0c12018-11-05 12:48:35 +030095/** 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 Carlsson7bca8ca2018-08-30 09:30:29 +0200108/** 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) Slatalae0c2e972018-10-08 09:43:21 -0700185/**
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 Wright8c27cca2018-10-25 10:16:44 -0700191/**
Bjorn Mellema9bbd862018-11-02 09:07:48 -0700192 * 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 Wright8c27cca2018-10-25 10:16:44 -0700198 * 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 Carlsson7bca8ca2018-08-30 09:30:29 +0200204- (instancetype)init;
205
206@end
207
208NS_ASSUME_NONNULL_END