summaryrefslogtreecommitdiff
path: root/vio/VioSSLFactoriesFd.h
blob: ed5a24f6b4a208034848e927587a2be9c392c4da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
 * Wrapper around SSL_CTX.
 */

#ifdef VIO_HAVE_OPENSSL

#ifdef __GNUC__
#pragma interface			/* gcc class implementation */
#endif

VIO_NS_BEGIN

class VioSSLAcceptorFd : public VioAcceptorFd
{
public:
  VioSSLAcceptorFd(const char*	key_file,
		   const char*	cert_file,
		   const char*	ca_file,
		   const char*	ca_path);
						
  virtual ~VioSSLAcceptorFd();
  virtual VioSSL*  accept(int	fd);
  virtual VioSSL*  accept(VioSocket*	sd);
private:
  VioSSLAcceptorFd(const VioSSLAcceptorFd& rhs);//undefined
  VioSSLAcceptorFd& operator=(const VioSSLAcceptorFd& rhs);//undefined
private:
  void	 report_errors();
  vio_ptr ssl_;
  vio_ptr ssl_context_;
  vio_ptr ssl_method_;
  vio_ptr session_id_context_;
};

VIO_NS_END

/*
 * The Factory where Vio's are made!
 */

class VioSSLConnectorFd : public VioConnectorFd
{
public:
  VioSSLConnectorFd(const char*	key_file,
		    const char*	cert_file,
		    const char*	ca_file,
		    const char*	ca_path);
						
  virtual ~VioSSLConnectorFd();
  virtual VioSSL* connect(int		fd);
  virtual VioSSL* connect(VioSocket*	sd);
private:
  VioSSLConnectorFd(const VioSSLConnectorFd& rhs);//undefined
  VioSSLConnectorFd& operator=(const VioSSLConnectorFd& rhs);//undefined
private:
  void	  report_errors();
  vio_ptr ssl_context_;
  vio_ptr ssl_method_;
  vio_ptr ssl_;
};

VIO_NS_END

#endif /* VIO_HAVE_OPENSSL */