blob: a9760c7e54081ad95eab280371a534595ba517c6 [file] [log] [blame]
Anders Carlsson7bca8ca2018-08-30 09:30:29 +02001/*
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"
Diogo Real4f085432018-09-11 16:00:22 -070014#import "RTCSSLConfig.h"
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020015
16NS_ASSUME_NONNULL_BEGIN
17
18RTC_EXPORT
19@interface RTCIceServer : NSObject
20
21/** URI(s) for this server represented as NSStrings. */
22@property(nonatomic, readonly) NSArray<NSString *> *urlStrings;
23
24/** Username to use if this RTCIceServer object is a TURN server. */
25@property(nonatomic, readonly, nullable) NSString *username;
26
27/** Credential to use if this RTCIceServer object is a TURN server. */
28@property(nonatomic, readonly, nullable) NSString *credential;
29
30/**
Diogo Real4f085432018-09-11 16:00:22 -070031 Deprecated. TODO(diogor, webrtc:9673): Remove from API.
32 TLS certificate policy to use if this RTCIceServer object is a TURN server.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020033 */
34@property(nonatomic, readonly) RTCTlsCertPolicy tlsCertPolicy;
35
36/**
37 If the URIs in |urls| only contain IP addresses, this field can be used
38 to indicate the hostname, which may be necessary for TLS (using the SNI
39 extension). If |urls| itself contains the hostname, this isn't necessary.
40 */
41@property(nonatomic, readonly, nullable) NSString *hostname;
42
Diogo Real4f085432018-09-11 16:00:22 -070043/**
44 Deprecated. TODO(diogor, webrtc:9673): Remove from API.
45 List of protocols to be used in the TLS ALPN extension.
46 This field will be ignored if also set in RTCSSLConfig.
47 */
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020048@property(nonatomic, readonly) NSArray<NSString *> *tlsAlpnProtocols;
49
50/**
Diogo Real4f085432018-09-11 16:00:22 -070051 Deprecated. TODO(diogor, webrtc:9673): Remove from API.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020052 List elliptic curves to be used in the TLS elliptic curves extension.
53 Only curve names supported by OpenSSL should be used (eg. "P-256","X25519").
Diogo Real4f085432018-09-11 16:00:22 -070054 This field will be ignored if also set in RTCSSLConfig.
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020055 */
56@property(nonatomic, readonly) NSArray<NSString *> *tlsEllipticCurves;
57
Diogo Real4f085432018-09-11 16:00:22 -070058/** SSL configuration options for any SSL/TLS connections to this IceServer. */
59@property(nonatomic, readonly) RTCSSLConfig *sslConfig;
60
Anders Carlsson7bca8ca2018-08-30 09:30:29 +020061- (nonnull instancetype)init NS_UNAVAILABLE;
62
63/** Convenience initializer for a server with no authentication (e.g. STUN). */
64- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings;
65
66/**
67 * Initialize an RTCIceServer with its associated URLs, optional username,
68 * optional credential, and credentialType.
69 */
70- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
71 username:(nullable NSString *)username
72 credential:(nullable NSString *)credential;
73
74/**
75 * Initialize an RTCIceServer with its associated URLs, optional username,
76 * optional credential, and TLS cert policy.
77 */
78- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
79 username:(nullable NSString *)username
80 credential:(nullable NSString *)credential
81 tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy;
82
83/**
84 * Initialize an RTCIceServer with its associated URLs, optional username,
85 * optional credential, TLS cert policy and hostname.
86 */
87- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
88 username:(nullable NSString *)username
89 credential:(nullable NSString *)credential
90 tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
91 hostname:(nullable NSString *)hostname;
92
93/**
94 * Initialize an RTCIceServer with its associated URLs, optional username,
95 * optional credential, TLS cert policy, hostname and ALPN protocols.
96 */
97- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
98 username:(nullable NSString *)username
99 credential:(nullable NSString *)credential
100 tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
101 hostname:(nullable NSString *)hostname
102 tlsAlpnProtocols:(NSArray<NSString *> *)tlsAlpnProtocols;
103
104/**
105 * Initialize an RTCIceServer with its associated URLs, optional username,
106 * optional credential, TLS cert policy, hostname, ALPN protocols and
107 * elliptic curves.
108 */
109- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
110 username:(nullable NSString *)username
111 credential:(nullable NSString *)credential
112 tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
113 hostname:(nullable NSString *)hostname
114 tlsAlpnProtocols:(nullable NSArray<NSString *> *)tlsAlpnProtocols
Diogo Real4f085432018-09-11 16:00:22 -0700115 tlsEllipticCurves:(nullable NSArray<NSString *> *)tlsEllipticCurves;
116
117/**
118 * Initialize an RTCIceServer with its associated URLs, optional
119 * username, optional credential, hostname and SSL config.
120 */
121- (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
122 username:(nullable NSString *)username
123 credential:(nullable NSString *)credential
124 hostname:(nullable NSString *)hostname
125 sslConfig:(RTCSSLConfig *)sslConfig NS_DESIGNATED_INITIALIZER;
Anders Carlsson7bca8ca2018-08-30 09:30:29 +0200126
127@end
128
129NS_ASSUME_NONNULL_END