00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLSOCKET_H_
00019 #define _DECAF_INTERNAL_NET_SSL_OPENSSL_OPENSSLSOCKET_H_
00020
00021 #include <decaf/util/Config.h>
00022
00023 #include <decaf/net/ssl/SSLSocket.h>
00024
00025 #include <decaf/io/InputStream.h>
00026 #include <decaf/io/OutputStream.h>
00027
00028 namespace decaf {
00029 namespace internal {
00030 namespace net {
00031 namespace ssl {
00032 namespace openssl {
00033
00034 class OpenSSLParameters;
00035 class SocketData;
00036
00043 class DECAF_API OpenSSLSocket: public decaf::net::ssl::SSLSocket {
00044 private:
00045
00046
00047 SocketData* data;
00048
00049
00050 OpenSSLParameters* parameters;
00051
00052
00053 decaf::io::InputStream* input;
00054
00055
00056 decaf::io::OutputStream* output;
00057
00058 private:
00059
00060 OpenSSLSocket(const OpenSSLSocket&);
00061 OpenSSLSocket& operator=(const OpenSSLSocket&);
00062
00063 public:
00064
00065 OpenSSLSocket(OpenSSLParameters* parameters);
00066
00067 OpenSSLSocket(OpenSSLParameters* parameters, const decaf::net::InetAddress* address, int port);
00068
00069 OpenSSLSocket(OpenSSLParameters* parameters, const decaf::net::InetAddress* address, int port, const decaf::net::InetAddress* localAddress, int localPort);
00070
00071 OpenSSLSocket(OpenSSLParameters* parameters, const std::string& host, int port);
00072
00073 OpenSSLSocket(OpenSSLParameters* parameters, const std::string& host, int port, const decaf::net::InetAddress* localAddress, int localPort);
00074
00075 virtual ~OpenSSLSocket();
00076
00077 public:
00078
00079
00083 virtual void connect(const std::string& host, int port, int timeout);
00084
00088 virtual void close();
00089
00093 virtual decaf::io::InputStream* getInputStream();
00094
00098 virtual decaf::io::OutputStream* getOutputStream();
00099
00103 virtual void shutdownInput();
00104
00108 virtual void shutdownOutput();
00109
00113 virtual void setOOBInline(bool value);
00114
00118 virtual void sendUrgentData(int data);
00119
00120 public:
00121
00125 virtual decaf::net::ssl::SSLParameters getSSLParameters() const;
00126
00130 virtual void setSSLParameters(const decaf::net::ssl::SSLParameters& value);
00131
00135 virtual std::vector<std::string> getSupportedCipherSuites() const;
00136
00140 virtual std::vector<std::string> getSupportedProtocols() const;
00141
00145 virtual std::vector<std::string> getEnabledCipherSuites() const;
00146
00150 virtual void setEnabledCipherSuites(const std::vector<std::string>& suites);
00151
00155 virtual std::vector<std::string> getEnabledProtocols() const;
00156
00160 virtual void setEnabledProtocols(const std::vector<std::string>& protocols);
00161
00165 virtual void startHandshake();
00166
00170 virtual void setUseClientMode(bool value);
00171
00175 virtual bool getUseClientMode() const;
00176
00180 virtual void setNeedClientAuth(bool value);
00181
00185 virtual bool getNeedClientAuth() const;
00186
00190 virtual void setWantClientAuth(bool value);
00191
00195 virtual bool getWantClientAuth() const;
00196
00197 public:
00198
00217 int read(unsigned char* buffer, int size, int offset, int length);
00218
00235 void write(const unsigned char* buffer, int size, int offset, int length);
00236
00244 int available();
00245
00246 private:
00247
00248
00249
00250 void verifyServerCert(const std::string& serverName);
00251
00252 };
00253
00254 }}}}}
00255
00256 #endif