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