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