📄 ssladapter.h
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -