blob: e2c6eafa51643f39f36d9d89fb837985a0df18bc (
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
|
/*
** Virtual I/O library
** Written by Andrei Errapart <andreie@no.spam.ee>
*/
/*
* Concrete Vio around socket. Doesn't differ much from VioFd.
*/
#ifdef WIN32
typedef SOCKET vio_socket;
#else
typedef int vio_socket;
#endif /* WIN32 */
VIO_NS_BEGIN
class VioSSL;
class VioSocket : public Vio
{
public:
VioSocket(vio_socket sd, bool localhost=true);
virtual ~VioSocket();
virtual bool is_open() const;
virtual int read(vio_ptr buf, int size);
virtual int write(const vio_ptr buf, int size);
virtual int blocking(bool onoff);
virtual bool blocking() const;
virtual int fastsend(bool onoff=true);
virtual int keepalive(bool onoff);
virtual bool should_retry() const;
virtual int close();
virtual const char* description() const;
virtual bool peer_addr(char *buf) const;
virtual const char* cipher_description() const;
virtual int vio_errno();
int shutdown(int how);
private:
vio_socket sd_;
const bool localhost_;
int fcntl_;
bool fcntl_set_;
char desc_[30];
mutable struct sockaddr_in local_;
mutable struct sockaddr_in remote_;
mutable char* cipher_description_;
friend class VioSSL; // he wants to tinker with this->sd_;
};
VIO_NS_END
#endif /* vio_VioSocket_h_ */
|