blob: 9f41fd28d2105dc927ffd14f7335e5beefd8bfe3 [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
95/** By default, the PeerConnection will use a limited number of IPv6 network
96 * interfaces, in order to avoid too many ICE candidate pairs being created
97 * and delaying ICE completion.
98 *
99 * Can be set to INT_MAX to effectively disable the limit.
100 */
101@property(nonatomic, assign) int maxIPv6Networks;
102
103/** Exclude link-local network interfaces
104 * from considertaion for gathering ICE candidates.
105 * Defaults to NO.
106 */
107@property(nonatomic, assign) BOOL disableLinkLocalNetworks;
108
109@property(nonatomic, assign) int audioJitterBufferMaxPackets;
110@property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate;
111@property(nonatomic, assign) int iceConnectionReceivingTimeout;
112@property(nonatomic, assign) int iceBackupCandidatePairPingInterval;
113
114/** Key type used to generate SSL identity. Default is ECDSA. */
115@property(nonatomic, assign) RTCEncryptionKeyType keyType;
116
117/** ICE candidate pool size as defined in JSEP. Default is 0. */
118@property(nonatomic, assign) int iceCandidatePoolSize;
119
120/** Prune turn ports on the same network to the same turn server.
121 * Default is NO.
122 */
123@property(nonatomic, assign) BOOL shouldPruneTurnPorts;
124
125/** If set to YES, this means the ICE transport should presume TURN-to-TURN
126 * candidate pairs will succeed, even before a binding response is received.
127 */
128@property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed;
129
130/** If set to non-nil, controls the minimal interval between consecutive ICE
131 * check packets.
132 */
133@property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval;
134
135/** ICE Periodic Regathering
136 * If set, WebRTC will periodically create and propose candidates without
137 * starting a new ICE generation. The regathering happens continuously with
138 * interval specified in milliseconds by the uniform distribution [a, b].
139 */
140@property(nonatomic, strong, nullable) RTCIntervalRange *iceRegatherIntervalRange;
141
142/** Configure the SDP semantics used by this PeerConnection. Note that the
143 * WebRTC 1.0 specification requires UnifiedPlan semantics. The
144 * RTCRtpTransceiver API is only available with UnifiedPlan semantics.
145 *
146 * PlanB will cause RTCPeerConnection to create offers and answers with at
147 * most one audio and one video m= section with multiple RTCRtpSenders and
148 * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This
149 * will also cause RTCPeerConnection to ignore all but the first m= section of
150 * the same media type.
151 *
152 * UnifiedPlan will cause RTCPeerConnection to create offers and answers with
153 * multiple m= sections where each m= section maps to one RTCRtpSender and one
154 * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both video. This
155 * will also cause RTCPeerConnection to ignore all but the first a=ssrc lines
156 * that form a Plan B stream.
157 *
158 * For users who wish to send multiple audio/video streams and need to stay
159 * interoperable with legacy WebRTC implementations or use legacy APIs,
160 * specify PlanB.
161 *
162 * For all other users, specify UnifiedPlan.
163 */
164@property(nonatomic, assign) RTCSdpSemantics sdpSemantics;
165
166/** Actively reset the SRTP parameters when the DTLS transports underneath are
167 * changed after offer/answer negotiation. This is only intended to be a
168 * workaround for crbug.com/835958
169 */
170@property(nonatomic, assign) BOOL activeResetSrtpParams;
171
Piotr (Peter) Slatalae0c2e972018-10-08 09:43:21 -0700172/**
173 * If MediaTransportFactory is provided in PeerConnectionFactory, this flag informs PeerConnection
174 * that it should use the MediaTransportInterface.
175 */
176@property(nonatomic, assign) BOOL useMediaTransport;
177
Benjamin Wright8c27cca2018-10-25 10:16:44 -0700178/**
179 * Defines advanced optional cryptographic settings related to SRTP and
180 * frame encryption for native WebRTC. Setting this will overwrite any
181 * options set through the PeerConnectionFactory (which is deprecated).
182 */
183@property(nonatomic, nullable) RTCCryptoOptions *cryptoOptions;
184
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200185- (instancetype)init;
186
187@end
188
189NS_ASSUME_NONNULL_END