add old lci module
This commit is contained in:
1 parent
38a6e815f0
commit
8499631091
171 files changed
+25562
No files matched your search
@@ -0,0 +1,85 @@
|
||||
#ifndef PMC_NET_WEBSOCKET_CLIENT_SSL_HPP
|
||||
#define PMC_NET_WEBSOCKET_CLIENT_SSL_HPP
|
||||
|
||||
#include "WebSocketClientBase.hpp"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
namespace pmc {
|
||||
namespace net {
|
||||
|
||||
/**
|
||||
* @brief 基于 Boost.Beast 的异步 WebSocket 客户端(SSL/TLS 版本)
|
||||
*
|
||||
* 支持安全的 WebSocket 连接(wss://)
|
||||
*/
|
||||
class WebSocketClientSSL : public WebSocketClientBase {
|
||||
public:
|
||||
/**
|
||||
* @brief 构造函数
|
||||
* @param host 服务器主机名或 IP 地址
|
||||
* @param port 服务器端口号(通常为 443)
|
||||
* @param path WebSocket 路径(默认 "/")
|
||||
*/
|
||||
WebSocketClientSSL(const std::string& host, const std::string& port, const std::string& path = "/");
|
||||
|
||||
/**
|
||||
* @brief 析构函数
|
||||
*/
|
||||
~WebSocketClientSSL();
|
||||
|
||||
// 实现 WebSocketClientBase 接口
|
||||
void setMessageCallback(MessageCallback callback) override;
|
||||
void setErrorCallback(ErrorCallback callback) override;
|
||||
void setConnectCallback(ConnectCallback callback) override;
|
||||
void setCloseCallback(CloseCallback callback) override;
|
||||
|
||||
bool connect(int timeout_ms = 5000) override;
|
||||
void disconnect() override;
|
||||
bool isConnected() const override;
|
||||
|
||||
bool send(const std::string& message) override;
|
||||
bool sendBinary(const void* data, size_t size) override;
|
||||
|
||||
void setAutoReconnect(bool enable, int interval_ms = 3000) override;
|
||||
void setHeartbeatInterval(int interval_ms = 30000) override;
|
||||
|
||||
std::string getHost() const override;
|
||||
std::string getPort() const override;
|
||||
std::string getPath() const override;
|
||||
|
||||
// SSL/TLS 相关方法
|
||||
bool isSecure() const override { return true; }
|
||||
void setVerifyCertificate(bool verify) override;
|
||||
void setCertificateFile(const std::string& cert_file) override;
|
||||
void setPrivateKeyFile(const std::string& key_file) override;
|
||||
void setCertificateAuthorityFile(const std::string& ca_file) override;
|
||||
|
||||
/**
|
||||
* @brief 设置 SSL 上下文选项
|
||||
* @param options SSL 上下文选项
|
||||
*/
|
||||
void setSSLContextOptions(long options);
|
||||
|
||||
/**
|
||||
* @brief 设置密码列表
|
||||
* @param ciphers 密码列表字符串
|
||||
*/
|
||||
void setCiphers(const std::string& ciphers);
|
||||
|
||||
/**
|
||||
* @brief 设置 SNI 主机名
|
||||
* @param sni_hostname SNI 主机名
|
||||
*/
|
||||
void setSNIHostname(const std::string& sni_hostname);
|
||||
|
||||
private:
|
||||
// 前向声明实现类
|
||||
class Impl;
|
||||
std::unique_ptr<Impl> impl_;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
} // namespace pmc
|
||||
|
||||
#endif // PMC_NET_WEBSOCKET_CLIENT_SSL_HPP
|
||||
Reference in new issue
Block a user