RTCIceServer.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. #import <Foundation/Foundation.h>
  11. #import "RTCMacros.h"
  12. typedef NS_ENUM(NSUInteger, RTCTlsCertPolicy) {
  13. RTCTlsCertPolicySecure,
  14. RTCTlsCertPolicyInsecureNoCheck
  15. };
  16. NS_ASSUME_NONNULL_BEGIN
  17. RTC_OBJC_EXPORT
  18. @interface RTC_OBJC_TYPE (RTCIceServer) : NSObject
  19. /** URI(s) for this server represented as NSStrings. */
  20. @property(nonatomic, readonly) NSArray<NSString *> *urlStrings;
  21. /** Username to use if this RTCIceServer object is a TURN server. */
  22. @property(nonatomic, readonly, nullable) NSString *username;
  23. /** Credential to use if this RTCIceServer object is a TURN server. */
  24. @property(nonatomic, readonly, nullable) NSString *credential;
  25. /**
  26. * TLS certificate policy to use if this RTCIceServer object is a TURN server.
  27. */
  28. @property(nonatomic, readonly) RTCTlsCertPolicy tlsCertPolicy;
  29. /**
  30. If the URIs in |urls| only contain IP addresses, this field can be used
  31. to indicate the hostname, which may be necessary for TLS (using the SNI
  32. extension). If |urls| itself contains the hostname, this isn't necessary.
  33. */
  34. @property(nonatomic, readonly, nullable) NSString *hostname;
  35. /** List of protocols to be used in the TLS ALPN extension. */
  36. @property(nonatomic, readonly) NSArray<NSString *> *tlsAlpnProtocols;
  37. /**
  38. List elliptic curves to be used in the TLS elliptic curves extension.
  39. Only curve names supported by OpenSSL should be used (eg. "P-256","X25519").
  40. */
  41. @property(nonatomic, readonly) NSArray<NSString *> *tlsEllipticCurves;
  42. - (nonnull instancetype)init NS_UNAVAILABLE;
  43. /** Convenience initializer for a server with no authentication (e.g. STUN). */
  44. - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings;
  45. /**
  46. * Initialize an RTCIceServer with its associated URLs, optional username,
  47. * optional credential, and credentialType.
  48. */
  49. - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
  50. username:(nullable NSString *)username
  51. credential:(nullable NSString *)credential;
  52. /**
  53. * Initialize an RTCIceServer with its associated URLs, optional username,
  54. * optional credential, and TLS cert policy.
  55. */
  56. - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
  57. username:(nullable NSString *)username
  58. credential:(nullable NSString *)credential
  59. tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy;
  60. /**
  61. * Initialize an RTCIceServer with its associated URLs, optional username,
  62. * optional credential, TLS cert policy and hostname.
  63. */
  64. - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
  65. username:(nullable NSString *)username
  66. credential:(nullable NSString *)credential
  67. tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
  68. hostname:(nullable NSString *)hostname;
  69. /**
  70. * Initialize an RTCIceServer with its associated URLs, optional username,
  71. * optional credential, TLS cert policy, hostname and ALPN protocols.
  72. */
  73. - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
  74. username:(nullable NSString *)username
  75. credential:(nullable NSString *)credential
  76. tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
  77. hostname:(nullable NSString *)hostname
  78. tlsAlpnProtocols:(NSArray<NSString *> *)tlsAlpnProtocols;
  79. /**
  80. * Initialize an RTCIceServer with its associated URLs, optional username,
  81. * optional credential, TLS cert policy, hostname, ALPN protocols and
  82. * elliptic curves.
  83. */
  84. - (instancetype)initWithURLStrings:(NSArray<NSString *> *)urlStrings
  85. username:(nullable NSString *)username
  86. credential:(nullable NSString *)credential
  87. tlsCertPolicy:(RTCTlsCertPolicy)tlsCertPolicy
  88. hostname:(nullable NSString *)hostname
  89. tlsAlpnProtocols:(nullable NSArray<NSString *> *)tlsAlpnProtocols
  90. tlsEllipticCurves:(nullable NSArray<NSString *> *)tlsEllipticCurves
  91. NS_DESIGNATED_INITIALIZER;
  92. @end
  93. NS_ASSUME_NONNULL_END