blob: 727da8acbeb8540c44326f7eeaffe95249030c4a [file] [log] [blame]
hjonaa32c3e2015-12-13 19:58:11 -08001/*
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
tkchin9eeb6242016-04-27 01:54:20 -070013#import <WebRTC/RTCMacros.h>
tkchin8b577ed2016-04-19 10:04:41 -070014
hnsl67415162017-02-02 13:04:27 -080015typedef NS_ENUM(NSUInteger, RTCTlsCertPolicy) {
16 RTCTlsCertPolicySecure,
17 RTCTlsCertPolicyInsecureNoCheck
18};
19
hjonaa32c3e2015-12-13 19:58:11 -080020NS_ASSUME_NONNULL_BEGIN
21
tkchin8b577ed2016-04-19 10:04:41 -070022RTC_EXPORT
hjonaa32c3e2015-12-13 19:58:11 -080023@interface RTCIceServer : NSObject
24
25/** URI(s) for this server represented as NSStrings. */
Jon Hjelle32e0c012016-03-08 16:04:46 -080026@property(nonatomic, readonly) NSArray<NSString *> *urlStrings;
hjonaa32c3e2015-12-13 19:58:11 -080027
28/** Username to use if this RTCIceServer object is a TURN server. */
hjona2f77982016-03-04 07:09:09 -080029@property(nonatomic, readonly, nullable) NSString *username;
hjonaa32c3e2015-12-13 19:58:11 -080030
31/** Credential to use if this RTCIceServer object is a TURN server. */
hjona2f77982016-03-04 07:09:09 -080032@property(nonatomic, readonly, nullable) NSString *credential;
hjonaa32c3e2015-12-13 19:58:11 -080033
hnsl67415162017-02-02 13:04:27 -080034/**
35 * TLS certificate policy to use if this RTCIceServer object is a TURN server.
36 */
37@property(nonatomic, readonly) RTCTlsCertPolicy tlsCertPolicy;
38
Emad Omaradab1d2d2017-06-16 15:43:11 -070039/**
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 Real1dca9d52017-08-29 12:18:32 -070046/** List of protocols to be used in the TLS ALPN extension. */
47@property(nonatomic, readonly) NSArray<NSString *> *tlsAlpnProtocols;
48
Diogo Real7bd1f1b2017-09-08 12:50:41 -070049/**
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
hjon6b039952016-02-25 12:32:58 -080055- (nonnull instancetype)init NS_UNAVAILABLE;
hjonaa32c3e2015-12-13 19:58:11 -080056
57/** Convenience initializer for a server with no authentication (e.g. STUN). */
Jon Hjelle32e0c012016-03-08 16:04:46 -080058- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings;
hjonaa32c3e2015-12-13 19:58:11 -080059
60/**
61 * Initialize an RTCIceServer with its associated URLs, optional username,
62 * optional credential, and credentialType.
63 */
Jon Hjelle32e0c012016-03-08 16:04:46 -080064- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
65 username:(nullable NSString *)username
hnsl67415162017-02-02 13:04:27 -080066 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 Hjelle32e0c012016-03-08 16:04:46 -080074 credential:(nullable NSString *)credential
Emad Omaradab1d2d2017-06-16 15:43:11 -070075 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
hnsl67415162017-02-02 13:04:27 -080084 tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
Diogo Real1dca9d52017-08-29 12:18:32 -070085 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 Real7bd1f1b2017-09-08 12:50:41 -070096 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 Real1dca9d52017-08-29 12:18:32 -0700110 NS_DESIGNATED_INITIALIZER;
hjonaa32c3e2015-12-13 19:58:11 -0800111
112@end
113
114NS_ASSUME_NONNULL_END