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 "RTCMacros.h" 14 15 typedef NS_ENUM(NSUInteger, RTCTlsCertPolicy) { 16 RTCTlsCertPolicySecure, 17 RTCTlsCertPolicyInsecureNoCheck 18 }; 19 20 NS_ASSUME_NONNULL_BEGIN 21 22 RTC_OBJC_EXPORT 23 @interface RTC_OBJC_TYPE (RTCIceServer) : NSObject 24 25 /** URI(s) for this server represented as NSStrings. */ 26 @property(nonatomic, readonly) NSArray<NSString *> *urlStrings; 27 28 /** Username to use if this RTCIceServer object is a TURN server. */ 29 @property(nonatomic, readonly, nullable) NSString *username; 30 31 /** Credential to use if this RTCIceServer object is a TURN server. */ 32 @property(nonatomic, readonly, nullable) NSString *credential; 33 34 /** 35 * TLS certificate policy to use if this RTCIceServer object is a TURN server. 36 */ 37 @property(nonatomic, readonly) RTCTlsCertPolicy tlsCertPolicy; 38 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 46 /** List of protocols to be used in the TLS ALPN extension. */ 47 @property(nonatomic, readonly) NSArray<NSString *> *tlsAlpnProtocols; 48 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 55 - (nonnull instancetype)init NS_UNAVAILABLE; 56 57 /** Convenience initializer for a server with no authentication (e.g. STUN). */ 58 - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings; 59 60 /** 61 * Initialize an RTCIceServer with its associated URLs, optional username, 62 * optional credential, and credentialType. 63 */ 64 - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings 65 username:(nullable NSString *)username 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 74 credential:(nullable NSString *)credential 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 84 tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy 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 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 110 NS_DESIGNATED_INITIALIZER; 111 112 @end 113 114 NS_ASSUME_NONNULL_END 115