ssladapter.h

来自「本人收集整理的一份c/c++跨平台网络库」· C头文件 代码 · 共 48 行

H
48
字号
#ifndef UTILS_BASE_SSLADAPTER_H_#define UTILS_BASE_SSLADAPTER_H_#include "asyncsocket.h"namespace utils_base {///////////////////////////////////////////////////////////////////////////////class SSLAdapter : public AsyncSocketAdapter {public:  SSLAdapter(AsyncSocket* socket)    : AsyncSocketAdapter(socket), ignore_bad_cert_(false) { }  bool ignore_bad_cert() const { return ignore_bad_cert_; }  void set_ignore_bad_cert(bool ignore) { ignore_bad_cert_ = ignore; }  // StartSSL returns 0 if successful.  // If StartSSL is called while the socket is closed or connecting, the SSL  // negotiation will begin as soon as the socket connects.  virtual int StartSSL(const char* hostname, bool restartable) = 0;  // Create the default SSL adapter for this platform  static SSLAdapter* Create(AsyncSocket* socket);private:  // If true, the server certificate need not match the configured hostname.  bool ignore_bad_cert_;};///////////////////////////////////////////////////////////////////////////////// Call this on the main thread, before using SSL.// Call CleanupSSLThread when finished with SSL.bool InitializeSSL();// Call to initialize additional threads.bool InitializeSSLThread();// Call to cleanup additional threads, and also the main thread.bool CleanupSSL();///////////////////////////////////////////////////////////////////////////////}  // namespace utils_base#endif // UTILS_BASE_SSLADAPTER_H_

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?