hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 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 | |
Michael Iedema | ccee56b | 2018-07-05 15:28:24 +0200 | [diff] [blame^] | 13 | #import <WebRTC/RTCCertificate.h> |
tkchin | 9eeb624 | 2016-04-27 01:54:20 -0700 | [diff] [blame] | 14 | #import <WebRTC/RTCMacros.h> |
tkchin | 8b577ed | 2016-04-19 10:04:41 -0700 | [diff] [blame] | 15 | |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 16 | @class RTCIceServer; |
Steve Anton | d295e40 | 2017-07-14 16:06:41 -0700 | [diff] [blame] | 17 | @class RTCIntervalRange; |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 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. */ |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 38 | typedef NS_ENUM(NSInteger, RTCRtcpMuxPolicy) { RTCRtcpMuxPolicyNegotiate, RTCRtcpMuxPolicyRequire }; |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 39 | |
| 40 | /** Represents the tcp candidate policy. */ |
| 41 | typedef NS_ENUM(NSInteger, RTCTcpCandidatePolicy) { |
| 42 | RTCTcpCandidatePolicyEnabled, |
| 43 | RTCTcpCandidatePolicyDisabled |
| 44 | }; |
| 45 | |
Honghai Zhang | 46007ae | 2016-06-03 16:31:32 -0700 | [diff] [blame] | 46 | /** Represents the candidate network policy. */ |
| 47 | typedef NS_ENUM(NSInteger, RTCCandidateNetworkPolicy) { |
| 48 | RTCCandidateNetworkPolicyAll, |
| 49 | RTCCandidateNetworkPolicyLowCost |
| 50 | }; |
| 51 | |
Honghai Zhang | 3108fc9 | 2016-05-11 10:10:39 -0700 | [diff] [blame] | 52 | /** Represents the continual gathering policy. */ |
| 53 | typedef NS_ENUM(NSInteger, RTCContinualGatheringPolicy) { |
| 54 | RTCContinualGatheringPolicyGatherOnce, |
| 55 | RTCContinualGatheringPolicyGatherContinually |
| 56 | }; |
| 57 | |
tkchin | ab8f82f | 2016-01-27 17:50:11 -0800 | [diff] [blame] | 58 | /** Represents the encryption key type. */ |
| 59 | typedef NS_ENUM(NSInteger, RTCEncryptionKeyType) { |
| 60 | RTCEncryptionKeyTypeRSA, |
| 61 | RTCEncryptionKeyTypeECDSA, |
| 62 | }; |
| 63 | |
Steve Anton | 8cb344a | 2018-02-27 15:34:53 -0800 | [diff] [blame] | 64 | /** Represents the chosen SDP semantics for the RTCPeerConnection. */ |
| 65 | typedef NS_ENUM(NSInteger, RTCSdpSemantics) { |
Steve Anton | 8cb344a | 2018-02-27 15:34:53 -0800 | [diff] [blame] | 66 | RTCSdpSemanticsPlanB, |
| 67 | RTCSdpSemanticsUnifiedPlan, |
| 68 | }; |
| 69 | |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 70 | NS_ASSUME_NONNULL_BEGIN |
tkchin | 8b577ed | 2016-04-19 10:04:41 -0700 | [diff] [blame] | 71 | RTC_EXPORT |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 72 | @interface RTCConfiguration : NSObject |
| 73 | |
| 74 | /** An array of Ice Servers available to be used by ICE. */ |
Jon Hjelle | 32e0c01 | 2016-03-08 16:04:46 -0800 | [diff] [blame] | 75 | @property(nonatomic, copy) NSArray<RTCIceServer *> *iceServers; |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 76 | |
Michael Iedema | ccee56b | 2018-07-05 15:28:24 +0200 | [diff] [blame^] | 77 | /** An RTCCertificate for 're' use. */ |
| 78 | @property(nonatomic, nullable) RTCCertificate *certificate; |
| 79 | |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 80 | /** Which candidates the ICE agent is allowed to use. The W3C calls it |
| 81 | * |iceTransportPolicy|, while in C++ it is called |type|. */ |
| 82 | @property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy; |
| 83 | |
| 84 | /** The media-bundling policy to use when gathering ICE candidates. */ |
| 85 | @property(nonatomic, assign) RTCBundlePolicy bundlePolicy; |
| 86 | |
| 87 | /** The rtcp-mux policy to use when gathering ICE candidates. */ |
| 88 | @property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy; |
| 89 | @property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy; |
Honghai Zhang | 46007ae | 2016-06-03 16:31:32 -0700 | [diff] [blame] | 90 | @property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy; |
Yves Gerey | 665174f | 2018-06-19 15:03:05 +0200 | [diff] [blame] | 91 | @property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy; |
deadbeef | 2059bb3 | 2017-07-26 18:25:43 -0700 | [diff] [blame] | 92 | |
| 93 | /** By default, the PeerConnection will use a limited number of IPv6 network |
| 94 | * interfaces, in order to avoid too many ICE candidate pairs being created |
| 95 | * and delaying ICE completion. |
| 96 | * |
| 97 | * Can be set to INT_MAX to effectively disable the limit. |
| 98 | */ |
| 99 | @property(nonatomic, assign) int maxIPv6Networks; |
| 100 | |
Daniel Lazarenko | 2870b0a | 2018-01-25 10:30:22 +0100 | [diff] [blame] | 101 | /** Exclude link-local network interfaces |
| 102 | * from considertaion for gathering ICE candidates. |
| 103 | * Defaults to NO. |
| 104 | */ |
| 105 | @property(nonatomic, assign) BOOL disableLinkLocalNetworks; |
| 106 | |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 107 | @property(nonatomic, assign) int audioJitterBufferMaxPackets; |
haysc | c9f9500 | 2016-12-05 14:24:32 -0800 | [diff] [blame] | 108 | @property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate; |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 109 | @property(nonatomic, assign) int iceConnectionReceivingTimeout; |
| 110 | @property(nonatomic, assign) int iceBackupCandidatePairPingInterval; |
| 111 | |
tkchin | ab8f82f | 2016-01-27 17:50:11 -0800 | [diff] [blame] | 112 | /** Key type used to generate SSL identity. Default is ECDSA. */ |
| 113 | @property(nonatomic, assign) RTCEncryptionKeyType keyType; |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 114 | |
deadbeef | be0c96f | 2016-05-18 16:20:14 -0700 | [diff] [blame] | 115 | /** ICE candidate pool size as defined in JSEP. Default is 0. */ |
| 116 | @property(nonatomic, assign) int iceCandidatePoolSize; |
| 117 | |
honghaiz | af6b6e0 | 2016-07-11 15:09:26 -0700 | [diff] [blame] | 118 | /** Prune turn ports on the same network to the same turn server. |
| 119 | * Default is NO. |
| 120 | */ |
| 121 | @property(nonatomic, assign) BOOL shouldPruneTurnPorts; |
Honghai Zhang | e2e35ca | 2016-07-01 14:22:17 -0700 | [diff] [blame] | 122 | |
honghaiz | af6b6e0 | 2016-07-11 15:09:26 -0700 | [diff] [blame] | 123 | /** If set to YES, this means the ICE transport should presume TURN-to-TURN |
Taylor Brandstetter | e985111 | 2016-07-01 11:11:13 -0700 | [diff] [blame] | 124 | * candidate pairs will succeed, even before a binding response is received. |
| 125 | */ |
honghaiz | af6b6e0 | 2016-07-11 15:09:26 -0700 | [diff] [blame] | 126 | @property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed; |
Taylor Brandstetter | e985111 | 2016-07-01 11:11:13 -0700 | [diff] [blame] | 127 | |
skvlad | a5d94ff | 2017-02-02 13:02:30 -0800 | [diff] [blame] | 128 | /** If set to non-nil, controls the minimal interval between consecutive ICE |
| 129 | * check packets. |
| 130 | */ |
| 131 | @property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval; |
| 132 | |
Steve Anton | d295e40 | 2017-07-14 16:06:41 -0700 | [diff] [blame] | 133 | /** ICE Periodic Regathering |
| 134 | * If set, WebRTC will periodically create and propose candidates without |
| 135 | * starting a new ICE generation. The regathering happens continuously with |
| 136 | * interval specified in milliseconds by the uniform distribution [a, b]. |
| 137 | */ |
| 138 | @property(nonatomic, strong, nullable) RTCIntervalRange *iceRegatherIntervalRange; |
| 139 | |
Steve Anton | 8cb344a | 2018-02-27 15:34:53 -0800 | [diff] [blame] | 140 | /** Configure the SDP semantics used by this PeerConnection. Note that the |
| 141 | * WebRTC 1.0 specification requires UnifiedPlan semantics. The |
| 142 | * RTCRtpTransceiver API is only available with UnifiedPlan semantics. |
| 143 | * |
| 144 | * PlanB will cause RTCPeerConnection to create offers and answers with at |
| 145 | * most one audio and one video m= section with multiple RTCRtpSenders and |
| 146 | * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This |
| 147 | * will also cause RTCPeerConnection to ignore all but the first m= section of |
| 148 | * the same media type. |
| 149 | * |
| 150 | * UnifiedPlan will cause RTCPeerConnection to create offers and answers with |
| 151 | * multiple m= sections where each m= section maps to one RTCRtpSender and one |
| 152 | * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both video. This |
| 153 | * will also cause RTCPeerConnection to ignore all but the first a=ssrc lines |
| 154 | * that form a Plan B stream. |
| 155 | * |
Steve Anton | 8cb344a | 2018-02-27 15:34:53 -0800 | [diff] [blame] | 156 | * For users who wish to send multiple audio/video streams and need to stay |
Steve Anton | 3acffc3 | 2018-04-12 17:21:03 -0700 | [diff] [blame] | 157 | * interoperable with legacy WebRTC implementations or use legacy APIs, |
| 158 | * specify PlanB. |
Steve Anton | 8cb344a | 2018-02-27 15:34:53 -0800 | [diff] [blame] | 159 | * |
Steve Anton | 3acffc3 | 2018-04-12 17:21:03 -0700 | [diff] [blame] | 160 | * For all other users, specify UnifiedPlan. |
Steve Anton | 8cb344a | 2018-02-27 15:34:53 -0800 | [diff] [blame] | 161 | */ |
| 162 | @property(nonatomic, assign) RTCSdpSemantics sdpSemantics; |
| 163 | |
Zhi Huang | b57e169 | 2018-06-12 11:41:11 -0700 | [diff] [blame] | 164 | /** Actively reset the SRTP parameters when the DTLS transports underneath are |
| 165 | * changed after offer/answer negotiation. This is only intended to be a |
| 166 | * workaround for crbug.com/835958 |
| 167 | */ |
| 168 | @property(nonatomic, assign) BOOL activeResetSrtpParams; |
| 169 | |
jtteh | 4eeb537 | 2017-04-03 15:06:37 -0700 | [diff] [blame] | 170 | - (instancetype)init; |
hjon | 6d49a8e | 2016-01-26 13:06:42 -0800 | [diff] [blame] | 171 | |
| 172 | @end |
| 173 | |
| 174 | NS_ASSUME_NONNULL_END |