Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [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 | |
| 13 | #import "RTCCertificate.h" |
| 14 | #import "RTCMacros.h" |
| 15 | |
| 16 | @class RTCIceServer; |
| 17 | @class RTCIntervalRange; |
| 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 | |
Mirko Bonadei | e8d5724 | 2018-09-17 10:22:56 +0200 | [diff] [blame] | 72 | RTC_OBJC_EXPORT |
Anders Carlsson | 7bca8ca | 2018-08-30 09:30:29 +0200 | [diff] [blame] | 73 | @interface RTCConfiguration : NSObject |
| 74 | |
| 75 | /** An array of Ice Servers available to be used by ICE. */ |
| 76 | @property(nonatomic, copy) NSArray<RTCIceServer *> *iceServers; |
| 77 | |
| 78 | /** An RTCCertificate for 're' use. */ |
| 79 | @property(nonatomic, nullable) RTCCertificate *certificate; |
| 80 | |
| 81 | /** Which candidates the ICE agent is allowed to use. The W3C calls it |
| 82 | * |iceTransportPolicy|, while in C++ it is called |type|. */ |
| 83 | @property(nonatomic, assign) RTCIceTransportPolicy iceTransportPolicy; |
| 84 | |
| 85 | /** The media-bundling policy to use when gathering ICE candidates. */ |
| 86 | @property(nonatomic, assign) RTCBundlePolicy bundlePolicy; |
| 87 | |
| 88 | /** The rtcp-mux policy to use when gathering ICE candidates. */ |
| 89 | @property(nonatomic, assign) RTCRtcpMuxPolicy rtcpMuxPolicy; |
| 90 | @property(nonatomic, assign) RTCTcpCandidatePolicy tcpCandidatePolicy; |
| 91 | @property(nonatomic, assign) RTCCandidateNetworkPolicy candidateNetworkPolicy; |
| 92 | @property(nonatomic, assign) RTCContinualGatheringPolicy continualGatheringPolicy; |
| 93 | |
| 94 | /** By default, the PeerConnection will use a limited number of IPv6 network |
| 95 | * interfaces, in order to avoid too many ICE candidate pairs being created |
| 96 | * and delaying ICE completion. |
| 97 | * |
| 98 | * Can be set to INT_MAX to effectively disable the limit. |
| 99 | */ |
| 100 | @property(nonatomic, assign) int maxIPv6Networks; |
| 101 | |
| 102 | /** Exclude link-local network interfaces |
| 103 | * from considertaion for gathering ICE candidates. |
| 104 | * Defaults to NO. |
| 105 | */ |
| 106 | @property(nonatomic, assign) BOOL disableLinkLocalNetworks; |
| 107 | |
| 108 | @property(nonatomic, assign) int audioJitterBufferMaxPackets; |
| 109 | @property(nonatomic, assign) BOOL audioJitterBufferFastAccelerate; |
| 110 | @property(nonatomic, assign) int iceConnectionReceivingTimeout; |
| 111 | @property(nonatomic, assign) int iceBackupCandidatePairPingInterval; |
| 112 | |
| 113 | /** Key type used to generate SSL identity. Default is ECDSA. */ |
| 114 | @property(nonatomic, assign) RTCEncryptionKeyType keyType; |
| 115 | |
| 116 | /** ICE candidate pool size as defined in JSEP. Default is 0. */ |
| 117 | @property(nonatomic, assign) int iceCandidatePoolSize; |
| 118 | |
| 119 | /** Prune turn ports on the same network to the same turn server. |
| 120 | * Default is NO. |
| 121 | */ |
| 122 | @property(nonatomic, assign) BOOL shouldPruneTurnPorts; |
| 123 | |
| 124 | /** If set to YES, this means the ICE transport should presume TURN-to-TURN |
| 125 | * candidate pairs will succeed, even before a binding response is received. |
| 126 | */ |
| 127 | @property(nonatomic, assign) BOOL shouldPresumeWritableWhenFullyRelayed; |
| 128 | |
| 129 | /** If set to non-nil, controls the minimal interval between consecutive ICE |
| 130 | * check packets. |
| 131 | */ |
| 132 | @property(nonatomic, copy, nullable) NSNumber *iceCheckMinInterval; |
| 133 | |
| 134 | /** ICE Periodic Regathering |
| 135 | * If set, WebRTC will periodically create and propose candidates without |
| 136 | * starting a new ICE generation. The regathering happens continuously with |
| 137 | * interval specified in milliseconds by the uniform distribution [a, b]. |
| 138 | */ |
| 139 | @property(nonatomic, strong, nullable) RTCIntervalRange *iceRegatherIntervalRange; |
| 140 | |
| 141 | /** Configure the SDP semantics used by this PeerConnection. Note that the |
| 142 | * WebRTC 1.0 specification requires UnifiedPlan semantics. The |
| 143 | * RTCRtpTransceiver API is only available with UnifiedPlan semantics. |
| 144 | * |
| 145 | * PlanB will cause RTCPeerConnection to create offers and answers with at |
| 146 | * most one audio and one video m= section with multiple RTCRtpSenders and |
| 147 | * RTCRtpReceivers specified as multiple a=ssrc lines within the section. This |
| 148 | * will also cause RTCPeerConnection to ignore all but the first m= section of |
| 149 | * the same media type. |
| 150 | * |
| 151 | * UnifiedPlan will cause RTCPeerConnection to create offers and answers with |
| 152 | * multiple m= sections where each m= section maps to one RTCRtpSender and one |
| 153 | * RTCRtpReceiver (an RTCRtpTransceiver), either both audio or both video. This |
| 154 | * will also cause RTCPeerConnection to ignore all but the first a=ssrc lines |
| 155 | * that form a Plan B stream. |
| 156 | * |
| 157 | * For users who wish to send multiple audio/video streams and need to stay |
| 158 | * interoperable with legacy WebRTC implementations or use legacy APIs, |
| 159 | * specify PlanB. |
| 160 | * |
| 161 | * For all other users, specify UnifiedPlan. |
| 162 | */ |
| 163 | @property(nonatomic, assign) RTCSdpSemantics sdpSemantics; |
| 164 | |
| 165 | /** Actively reset the SRTP parameters when the DTLS transports underneath are |
| 166 | * changed after offer/answer negotiation. This is only intended to be a |
| 167 | * workaround for crbug.com/835958 |
| 168 | */ |
| 169 | @property(nonatomic, assign) BOOL activeResetSrtpParams; |
| 170 | |
| 171 | - (instancetype)init; |
| 172 | |
| 173 | @end |
| 174 | |
| 175 | NS_ASSUME_NONNULL_END |