2022-08-20 19:31:37 +08:00
|
|
|
|
#pragma once
|
|
|
|
|
#include "../acl_cpp_define.hpp"
|
|
|
|
|
#include "sslbase_io.hpp"
|
|
|
|
|
|
|
|
|
|
struct ACL_VSTREAM;
|
2023-02-11 10:45:44 +08:00
|
|
|
|
typedef struct ssl_st SSL;
|
2022-08-20 19:31:37 +08:00
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
class openssl_conf;
|
|
|
|
|
|
|
|
|
|
class ACL_CPP_API openssl_io : public sslbase_io {
|
|
|
|
|
public:
|
|
|
|
|
openssl_io(openssl_conf& conf, bool server_side, bool nblock = false);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* @override stream_hook
|
|
|
|
|
*/
|
|
|
|
|
void destroy(void);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @override sslbase_io
|
|
|
|
|
* @return {bool}
|
|
|
|
|
*/
|
|
|
|
|
bool handshake(void);
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
~openssl_io(void);
|
|
|
|
|
|
2022-08-22 22:32:23 +08:00
|
|
|
|
// ʵ<><CAB5> stream_hook <20><><EFBFBD><EFBFBD><EFBFBD>鷽<EFBFBD><E9B7BD>
|
2022-08-20 19:31:37 +08:00
|
|
|
|
|
|
|
|
|
// @override stream_hook
|
|
|
|
|
bool open(ACL_VSTREAM* s);
|
|
|
|
|
|
|
|
|
|
// @override stream_hook
|
|
|
|
|
bool on_close(bool alive);
|
|
|
|
|
|
|
|
|
|
// @override stream_hook
|
|
|
|
|
int read(void* buf, size_t len);
|
|
|
|
|
|
|
|
|
|
// @override stream_hook
|
|
|
|
|
int send(const void* buf, size_t len);
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
openssl_conf& conf_;
|
2023-02-11 10:45:44 +08:00
|
|
|
|
SSL* ssl_;
|
2022-08-20 19:31:37 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|