00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __ssl_rpc_client_hpp
00021 #define __ssl_rpc_client_hpp
00022
00023
00024 #include "iobase.hpp"
00025
00026
00027
00028
00029
00030 #include <openssl/crypto.h>
00031 #include <openssl/x509.h>
00032 #include <openssl/pem.h>
00033 #include <openssl/ssl.h>
00034 #include <openssl/err.h>
00035
00036 #include "sslarchivestream.hpp"
00037 #include "streamconstructor.hpp"
00038
00039 #include <string>
00040
00041 #include <mynahsa/spimpl.hpp>
00042
00043
00044
00045 namespace MynahSA {
00046
00052 class SSLRPCClient {
00053 public:
00061 SSLRPCClient(const StreamConstructor& sc,
00062 unsigned int ipaddress,
00063 unsigned int port,
00064 std::string certificateFile="",
00065 std::string privateKeyFile="");
00066
00074 SSLRPCClient(const StreamConstructor& sc,
00075 std::string machineName,
00076 unsigned int port,
00077 std::string certificateFile="",
00078 std::string privateKeyFile="");
00079
00080
00082 ~SSLRPCClient();
00083
00085 SHARED_PTR<IoBase> rpc(SHARED_PTR<IoBase> req);
00086
00088 bool is_open() const { return _isopen; }
00089
00091 void close();
00092
00093
00094 private:
00096 void init(const StreamConstructor& sc,
00097 unsigned int ipaddress,
00098 unsigned int port,
00099 std::string certificateFile="",
00100 std::string privateKeyFile="");
00101
00103 bool _isopen;
00104
00106 SSL_CTX* _ctx;
00107
00109 SSL* _ssl;
00110
00112 X509* _serverCert;
00113
00115 int _sd;
00116
00118 SHARED_PTR<SSLArchiveStream> _stream;
00119
00120
00121 };
00122 };
00123
00124 #endif