~ubuntu-branches/debian/lenny/linuxdcpp/lenny

« back to all changes in this revision

Viewing changes to client/SSLSocket.h

  • Committer: Bazaar Package Importer
  • Author(s): Romain Beauxis
  • Date: 2006-12-08 15:50:58 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20061208155058-tgl4tv9qhurow54z
Tags: 0.0.1.cvs20061208-1
* New upstream release
* Dropped patch for tightening linking, a solution has been implemented
  upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "Socket.h"
23
23
#include "Singleton.h"
24
24
 
25
 
class SSLSocket;
26
 
 
27
 
namespace yaSSL {
28
 
        class SSL;
29
 
        class SSL_CTX;
30
 
        struct DH;
31
 
}
32
 
 
 
25
#include <openssl/ssl.h>
 
26
 
 
27
#ifndef SSL_SUCCESS
 
28
#define SSL_SUCCESS 1
 
29
#endif
 
30
 
 
31
#ifdef YASSL_VERSION
33
32
using namespace yaSSL;
34
 
 
35
 
class SSLSocketFactory : public Singleton<SSLSocketFactory> {
36
 
public:
37
 
        SSLSocketFactory();
38
 
        virtual ~SSLSocketFactory();
39
 
 
40
 
        SSLSocket* getClientSocket() throw(SocketException);
41
 
        SSLSocket* getServerSocket() throw(SocketException);
42
 
 
43
 
        void loadCertificates() throw();
44
 
        bool hasCerts() const { return certsLoaded; }
45
 
private:
46
 
        SSL_CTX* clientContext;
47
 
        SSL_CTX* serverContext;
48
 
        DH* dh;
49
 
        bool certsLoaded;
50
 
};
 
33
#endif
 
34
 
 
35
class CryptoManager;
51
36
 
52
37
class SSLSocket : public Socket {
53
38
public:
57
42
        virtual void connect(const string& aIp, short aPort) throw(SocketException);
58
43
        virtual int read(void* aBuffer, int aBufLen) throw(SocketException);
59
44
        virtual int write(const void* aBuffer, int aLen) throw(SocketException);
60
 
        virtual int wait(u_int32_t millis, int waitFor) throw(SocketException);
 
45
        virtual int wait(uint32_t millis, int waitFor) throw(SocketException);
61
46
        virtual void shutdown() throw();
62
47
        virtual void close() throw();
 
48
 
 
49
        virtual bool isSecure() const throw() { return true; }
 
50
        virtual bool isTrusted() const throw();
 
51
 
63
52
private:
64
 
        friend class SSLSocketFactory;
 
53
        friend class CryptoManager;
65
54
 
66
55
        SSLSocket(SSL_CTX* context) throw(SocketException);
67
56
        SSLSocket(const SSLSocket&);