| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2007 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 #ifndef WEBRTC_BASE_SSLSOCKETFACTORY_H__ | |
| 12 #define WEBRTC_BASE_SSLSOCKETFACTORY_H__ | |
| 13 | |
| 14 #include "webrtc/base/proxyinfo.h" | |
| 15 #include "webrtc/base/socketserver.h" | |
| 16 | |
| 17 namespace rtc { | |
| 18 | |
| 19 /////////////////////////////////////////////////////////////////////////////// | |
| 20 // SslSocketFactory | |
| 21 /////////////////////////////////////////////////////////////////////////////// | |
| 22 | |
| 23 class SslSocketFactory : public SocketFactory { | |
| 24 public: | |
| 25 SslSocketFactory(SocketFactory* factory, const std::string& user_agent); | |
| 26 ~SslSocketFactory() override; | |
| 27 | |
| 28 void SetAutoDetectProxy() { | |
| 29 autodetect_proxy_ = true; | |
| 30 } | |
| 31 void SetForceConnect(bool force) { | |
| 32 force_connect_ = force; | |
| 33 } | |
| 34 void SetProxy(const ProxyInfo& proxy) { | |
| 35 autodetect_proxy_ = false; | |
| 36 proxy_ = proxy; | |
| 37 } | |
| 38 bool autodetect_proxy() const { return autodetect_proxy_; } | |
| 39 const ProxyInfo& proxy() const { return proxy_; } | |
| 40 | |
| 41 void UseSSL(const char* hostname) { hostname_ = hostname; } | |
| 42 void DisableSSL() { hostname_.clear(); } | |
| 43 void SetIgnoreBadCert(bool ignore) { ignore_bad_cert_ = ignore; } | |
| 44 bool ignore_bad_cert() const { return ignore_bad_cert_; } | |
| 45 | |
| 46 void SetLogging(LoggingSeverity level, const std::string& label, | |
| 47 bool binary_mode = false) { | |
| 48 logging_level_ = level; | |
| 49 logging_label_ = label; | |
| 50 binary_mode_ = binary_mode; | |
| 51 } | |
| 52 | |
| 53 // SocketFactory Interface | |
| 54 Socket* CreateSocket(int type) override; | |
| 55 Socket* CreateSocket(int family, int type) override; | |
| 56 | |
| 57 AsyncSocket* CreateAsyncSocket(int type) override; | |
| 58 AsyncSocket* CreateAsyncSocket(int family, int type) override; | |
| 59 | |
| 60 private: | |
| 61 friend class ProxySocketAdapter; | |
| 62 AsyncSocket* CreateProxySocket(const ProxyInfo& proxy, int family, int type); | |
| 63 | |
| 64 SocketFactory* factory_; | |
| 65 std::string agent_; | |
| 66 bool autodetect_proxy_, force_connect_; | |
| 67 ProxyInfo proxy_; | |
| 68 std::string hostname_, logging_label_; | |
| 69 LoggingSeverity logging_level_; | |
| 70 bool binary_mode_; | |
| 71 bool ignore_bad_cert_; | |
| 72 }; | |
| 73 | |
| 74 /////////////////////////////////////////////////////////////////////////////// | |
| 75 | |
| 76 } // namespace rtc | |
| 77 | |
| 78 #endif // WEBRTC_BASE_SSLSOCKETFACTORY_H__ | |
| OLD | NEW |