summaryrefslogtreecommitdiff
path: root/vio/VioSSL.h
blob: 6446c10700ee7edd372dfd83dbd04fa60dfe0cbf (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
/*
 * Concrete Vio around OpenSSL's SSL structure.
 */

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

VIO_NS_BEGIN

class VioSocket;

class VioSSL : public Vio
{
public:
  enum {
    state_connect	= 1,
    state_accept	= 2
  };
public:
  VioSSL(int	fd, vio_ptr ssl_context, int	state);
  VioSSL(VioSocket* sd, vio_ptr	ssl_context, int state);
  virtual		~VioSSL();
  virtual bool		open() const;
  virtual int		read(	vio_ptr	buf,	int	size);
  virtual int		write(	const vio_ptr	buf,	int	size);
  virtual bool		blocking() const;
  virtual int		blocking(bool onoff);
  virtual int		fastsend(bool onoff=true);
  virtual int		keepalive(bool onoff);
  virtual bool		fcntl() const;
  virtual bool		should_retry() const;
  virtual int		close();
  virtual const char*	description() const;
  virtual const char*	peer_addr() const;
  virtual const char*	peer_name() const;
  virtual const char*	cipher_description() const;

private:
  int init_bio_(int fd,
		vio_ptr	ssl_context,
		int state,
		int bio_flags);
  vio_ptr bio_;
  vio_ptr ssl_con_;
  vio_ptr ssl_cip_;
  char	desc_[100];
  bool	open_;
  VioSocket* sd_;
};

VIO_NS_END

#endif /* VIO_HAVE_OPENSSL */