4 #ifndef _libiqnet_ssl_lib_h_
5 #define _libiqnet_ssl_lib_h_
7 #include "api_export.h"
9 #include <openssl/ssl.h>
23 extern LIBIQXMLRPC_API Ctx* ctx;
26 void LIBIQXMLRPC_API throw_io_exception( SSL*,
int ret );
36 class LIBIQXMLRPC_API
Ctx {
40 static Ctx* client_server(
const std::string& cert_path,
const std::string& key_path );
41 static Ctx* server_only(
const std::string& cert_path,
const std::string& key_path );
42 static Ctx* client_only();
46 SSL_CTX* context() {
return ctx; }
49 Ctx(
const std::string&,
const std::string&,
bool init_client );
54 #pragma warning(disable: 4251)
58 class LIBIQXMLRPC_API
exception:
public std::exception {
59 unsigned long ssl_err;
64 explicit exception(
unsigned long ssl_err )
throw();
65 exception(
const std::string& msg )
throw();
68 const char* what()
const throw() {
return msg.c_str(); }
69 unsigned long code()
const throw() {
return ssl_err; }
75 exception(
"Libiqnet::ssl not initialized." ) {}
82 exception(
"Connection has been closed." ),
85 bool is_clean()
const {
return clean; }