forked from awwit/httpserverapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSocketAdapter.h
More file actions
32 lines (23 loc) · 900 Bytes
/
SocketAdapter.h
File metadata and controls
32 lines (23 loc) · 900 Bytes
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
#pragma once
#include "System.h"
#include <vector>
#include <string>
#include <chrono>
#include <gnutls/gnutls.h>
namespace HttpServer
{
class SocketAdapter
{
public:
virtual ~SocketAdapter() = default;
virtual System::native_socket_type get_handle() const = 0;
virtual ::gnutls_session_t get_tls_session() const = 0;
virtual SocketAdapter *copy() const = 0;
virtual long nonblock_recv(std::vector<std::string::value_type> &buf, const std::chrono::milliseconds &timeout) const = 0;
virtual long nonblock_send(const std::string &buf, const std::chrono::milliseconds &timeout) const = 0;
virtual long nonblock_send(const std::vector<std::string::value_type> &buf, const size_t length, const std::chrono::milliseconds &timeout) const = 0;
virtual void close() = 0;
bool operator ==(const SocketAdapter &obj) const;
bool operator !=(const SocketAdapter &obj) const;
};
};