hjon | aa32c3e | 2015-12-13 19:58:11 -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 | |
hnsl | 6741516 | 2017-02-02 13:04:27 -0800 | [diff] [blame] | 15 | typedef NS_ENUM(NSUInteger, RTCTlsCertPolicy) { |
| 16 | RTCTlsCertPolicySecure, |
| 17 | RTCTlsCertPolicyInsecureNoCheck |
| 18 | }; |
| 19 | |
hjon | aa32c3e | 2015-12-13 19:58:11 -0800 | [diff] [blame] | 20 | NS_ASSUME_NONNULL_BEGIN |
| 21 | |
tkchin | 8b577ed | 2016-04-19 10:04:41 -0700 | [diff] [blame] | 22 | RTC_EXPORT |
hjon | aa32c3e | 2015-12-13 19:58:11 -0800 | [diff] [blame] | 23 | @interface RTCIceServer : NSObject |
| 24 | |
| 25 | /** URI(s) for this server represented as NSStrings. */ |
Jon Hjelle | 32e0c01 | 2016-03-08 16:04:46 -0800 | [diff] [blame] | 26 | @property(nonatomic, readonly) NSArray<NSString *> *urlStrings; |
hjon | aa32c3e | 2015-12-13 19:58:11 -0800 | [diff] [blame] | 27 | |
| 28 | /** Username to use if this RTCIceServer object is a TURN server. */ |
hjon | a2f7798 | 2016-03-04 07:09:09 -0800 | [diff] [blame] | 29 | @property(nonatomic, readonly, nullable) NSString *username; |
hjon | aa32c3e | 2015-12-13 19:58:11 -0800 | [diff] [blame] | 30 | |
| 31 | /** Credential to use if this RTCIceServer object is a TURN server. */ |
hjon | a2f7798 | 2016-03-04 07:09:09 -0800 | [diff] [blame] | 32 | @property(nonatomic, readonly, nullable) NSString *credential; |
hjon | aa32c3e | 2015-12-13 19:58:11 -0800 | [diff] [blame] | 33 | |
hnsl | 6741516 | 2017-02-02 13:04:27 -0800 | [diff] [blame] | 34 | /** |
| 35 | * TLS certificate policy to use if this RTCIceServer object is a TURN server. |
| 36 | */ |
| 37 | @property(nonatomic, readonly) RTCTlsCertPolicy tlsCertPolicy; |
| 38 | |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 39 | /** |
| 40 | If the URIs in |urls| only contain IP addresses, this field can be used |
| 41 | to indicate the hostname, which may be necessary for TLS (using the SNI |
| 42 | extension). If |urls| itself contains the hostname, this isn't necessary. |
| 43 | */ |
| 44 | @property(nonatomic, readonly, nullable) NSString *hostname; |
| 45 | |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 46 | /** List of protocols to be used in the TLS ALPN extension. */ |
| 47 | @property(nonatomic, readonly) NSArray<NSString *> *tlsAlpnProtocols; |
| 48 | |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 49 | /** |
| 50 | List elliptic curves to be used in the TLS elliptic curves extension. |
| 51 | Only curve names supported by OpenSSL should be used (eg. "P-256","X25519"). |
| 52 | */ |
| 53 | @property(nonatomic, readonly) NSArray<NSString *> *tlsEllipticCurves; |
| 54 | |
hjon | 6b03995 | 2016-02-25 12:32:58 -0800 | [diff] [blame] | 55 | - (nonnull instancetype)init NS_UNAVAILABLE; |
hjon | aa32c3e | 2015-12-13 19:58:11 -0800 | [diff] [blame] | 56 | |
| 57 | /** Convenience initializer for a server with no authentication (e.g. STUN). */ |
Jon Hjelle | 32e0c01 | 2016-03-08 16:04:46 -0800 | [diff] [blame] | 58 | - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings; |
hjon | aa32c3e | 2015-12-13 19:58:11 -0800 | [diff] [blame] | 59 | |
| 60 | /** |
| 61 | * Initialize an RTCIceServer with its associated URLs, optional username, |
| 62 | * optional credential, and credentialType. |
| 63 | */ |
Jon Hjelle | 32e0c01 | 2016-03-08 16:04:46 -0800 | [diff] [blame] | 64 | - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings |
| 65 | username:(nullable NSString *)username |
hnsl | 6741516 | 2017-02-02 13:04:27 -0800 | [diff] [blame] | 66 | credential:(nullable NSString *)credential; |
| 67 | |
| 68 | /** |
| 69 | * Initialize an RTCIceServer with its associated URLs, optional username, |
| 70 | * optional credential, and TLS cert policy. |
| 71 | */ |
| 72 | - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings |
| 73 | username:(nullable NSString *)username |
Jon Hjelle | 32e0c01 | 2016-03-08 16:04:46 -0800 | [diff] [blame] | 74 | credential:(nullable NSString *)credential |
Emad Omara | dab1d2d | 2017-06-16 15:43:11 -0700 | [diff] [blame] | 75 | tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy; |
| 76 | |
| 77 | /** |
| 78 | * Initialize an RTCIceServer with its associated URLs, optional username, |
| 79 | * optional credential, TLS cert policy and hostname. |
| 80 | */ |
| 81 | - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings |
| 82 | username:(nullable NSString *)username |
| 83 | credential:(nullable NSString *)credential |
hnsl | 6741516 | 2017-02-02 13:04:27 -0800 | [diff] [blame] | 84 | tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 85 | hostname:(nullable NSString *)hostname; |
| 86 | |
| 87 | /** |
| 88 | * Initialize an RTCIceServer with its associated URLs, optional username, |
| 89 | * optional credential, TLS cert policy, hostname and ALPN protocols. |
| 90 | */ |
| 91 | - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings |
| 92 | username:(nullable NSString *)username |
| 93 | credential:(nullable NSString *)credential |
| 94 | tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy |
| 95 | hostname:(nullable NSString *)hostname |
Diogo Real | 7bd1f1b | 2017-09-08 12:50:41 -0700 | [diff] [blame] | 96 | tlsAlpnProtocols:(NSArray<NSString *> *)tlsAlpnProtocols; |
| 97 | |
| 98 | /** |
| 99 | * Initialize an RTCIceServer with its associated URLs, optional username, |
| 100 | * optional credential, TLS cert policy, hostname, ALPN protocols and |
| 101 | * elliptic curves. |
| 102 | */ |
| 103 | - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings |
| 104 | username:(nullable NSString *)username |
| 105 | credential:(nullable NSString *)credential |
| 106 | tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy |
| 107 | hostname:(nullable NSString *)hostname |
| 108 | tlsAlpnProtocols:(nullable NSArray<NSString *> *)tlsAlpnProtocols |
| 109 | tlsEllipticCurves:(nullable NSArray<NSString *> *)tlsEllipticCurves |
Diogo Real | 1dca9d5 | 2017-08-29 12:18:32 -0700 | [diff] [blame] | 110 | NS_DESIGNATED_INITIALIZER; |
hjon | aa32c3e | 2015-12-13 19:58:11 -0800 | [diff] [blame] | 111 | |
| 112 | @end |
| 113 | |
| 114 | NS_ASSUME_NONNULL_END |