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   RTCSdpSemanticsPlanB,
67   RTCSdpSemanticsUnifiedPlan,
68 };
69 
70 NS_ASSUME_NONNULL_BEGIN
71 
72 RTC_OBJC_EXPORT
73 @interface RTC_OBJC_TYPE (RTCConfiguration) : NSObject
74 
75 /** If true, allows DSCP codes to be set on outgoing packets, configured using
76  *  networkPriority field of RTCRtpEncodingParameters. Defaults to false.
77  */
78 @property(nonatomic, assign) BOOL enableDscp;
79 
80 /** An array of Ice Servers available to be used by ICE. */
81 @property(nonatomic, copy) NSArray<RTC_OBJC_TYPE(RTCIceServer) *> *iceServers;
82 
83 /** An RTCCertificate for 're' use. */
84 @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCertificate) * certificate;
85 
86 /** Which candidates the ICE agent is allowed to use. The W3C calls it
87  * |iceTransportPolicy|, while in C++ it is called |type|. */
88 @property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy;
89 
90 /** The media-bundling policy to use when gathering ICE candidates. */
91 @property(nonatomic, assign) RTCBundlePolicy bundlePolicy;
92 
93 /** The rtcp-mux policy to use when gathering ICE candidates. */
94 @property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy;
95 @property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy;
96 @property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy;
97 @property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy;
98 
99 /** If set to YES, don't gather IPv6 ICE candidates.
100  *  Default is NO.
101  */
102 @property(nonatomic, assign) BOOL disableIPV6;
103 
104 /** If set to YES, don't gather IPv6 ICE candidates on Wi-Fi.
105  *  Only intended to be used on specific devices. Certain phones disable IPv6
106  *  when the screen is turned off and it would be better to just disable the
107  *  IPv6 ICE candidates on Wi-Fi in those cases.
108  *  Default is NO.
109  */
110 @property(nonatomic, assign) BOOL disableIPV6OnWiFi;
111 
112 /** By default, the PeerConnection will use a limited number of IPv6 network
113  *  interfaces, in order to avoid too many ICE candidate pairs being created
114  *  and delaying ICE completion.
115  *
116  *  Can be set to INT_MAX to effectively disable the limit.
117  */
118 @property(nonatomic, assign) int maxIPv6Networks;
119 
120 /** Exclude link-local network interfaces
121  *  from considertaion for gathering ICE candidates.
122  *  Defaults to NO.
123  */
124 @property(nonatomic, assign) BOOL disableLinkLocalNetworks;
125 
126 @property(nonatomic, assign) int audioJitterBufferMaxPackets;
127 @property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate;
128 @property(nonatomic, assign) int iceConnectionReceivingTimeout;
129 @property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
130 
131 /** Key type used to generate SSL identity. Default is ECDSA. */
132 @property(nonatomic, assign) RTCEncryptionKeyType keyType;
133 
134 /** ICE candidate pool size as defined in JSEP. Default is 0. */
135 @property(nonatomic, assign) int iceCandidatePoolSize;
136 
137 /** Prune turn ports on the same network to the same turn server.
138  *  Default is NO.
139  */
140 @property(nonatomic, assign) BOOL shouldPruneTurnPorts;
141 
142 /** If set to YES, this means the ICE transport should presume TURN-to-TURN
143  *  candidate pairs will succeed, even before a binding response is received.
144  */
145 @property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
146 
147 /* This flag is only effective when |continualGatheringPolicy| is
148  * RTCContinualGatheringPolicyGatherContinually.
149  *
150  * If YES, after the ICE transport type is changed such that new types of
151  * ICE candidates are allowed by the new transport type, e.g. from
152  * RTCIceTransportPolicyRelay to RTCIceTransportPolicyAll, candidates that
153  * have been gathered by the ICE transport but not matching the previous
154  * transport type and as a result not observed by PeerConnectionDelegateAdapter,
155  * will be surfaced to the delegate.
156  */
157 @property(nonatomic, assign) BOOL shouldSurfaceIceCandidatesOnIceTransportTypeChanged;
158 
159 /** If set to non-nil, controls the minimal interval between consecutive ICE
160  *  check packets.
161  */
162 @property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
163 
164 /** Configure the SDP semantics used by this PeerConnection. Note that the
165  *  WebRTC 1.0 specification requires UnifiedPlan semantics. The
166  *  RTCRtpTransceiver API is only available with UnifiedPlan semantics.
167  *
168  *  PlanB will cause RTCPeerConnection to create offers and answers with at
169  *  most one audio and one video m= section with multiple RTCRtpSenders and
170  *  RTCRtpReceivers specified as multiple a=ssrc lines within the section. This
171  *  will also cause RTCPeerConnection to ignore all but the first m= section of
172  *  the same media type.
173  *
174  *  UnifiedPlan will cause RTCPeerConnection to create offers and answers with
175  *  multiple m= sections where each m= section maps to one RTCRtpSender and one
176  *  RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both
177  *  video. This will also cause RTCPeerConnection) to ignore all but the first a=ssrc
178  *  lines that form a Plan B stream.
179  *
180  *  For users who wish to send multiple audio/video streams and need to stay
181  *  interoperable with legacy WebRTC implementations or use legacy APIs,
182  *  specify PlanB.
183  *
184  *  For all other users, specify UnifiedPlan.
185  */
186 @property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
187 
188 /** Actively reset the SRTP parameters when the DTLS transports underneath are
189  *  changed after offer/answer negotiation. This is only intended to be a
190  *  workaround for crbug.com/835958
191  */
192 @property(nonatomic, assign) BOOL activeResetSrtpParams;
193 
194 /** If the remote side support mid-stream codec switches then allow encoder
195  *  switching to be performed.
196  */
197 
198 @property(nonatomic, assign) BOOL allowCodecSwitching;
199 
200 /**
201  * Defines advanced optional cryptographic settings related to SRTP and
202  * frame encryption for native WebRTC. Setting this will overwrite any
203  * options set through the PeerConnectionFactory (which is deprecated).
204  */
205 @property(nonatomic, nullable) RTC_OBJC_TYPE(RTCCryptoOptions) * cryptoOptions;
206 
207 /**
208  * Time interval between audio RTCP reports.
209  */
210 @property(nonatomic, assign) int rtcpAudioReportIntervalMs;
211 
212 /**
213  * Time interval between video RTCP reports.
214  */
215 @property(nonatomic, assign) int rtcpVideoReportIntervalMs;
216 
217 - (instancetype)init;
218 
219 @end
220 
221 NS_ASSUME_NONNULL_END
222