forked from awwit/httpserverapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathServerProtocol.h
More file actions
35 lines (28 loc) · 752 Bytes
/
ServerProtocol.h
File metadata and controls
35 lines (28 loc) · 752 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
33
34
35
#pragma once
#include "../../socket/Adapter.h"
#include "../../transfer/HttpStatusCode.h"
namespace HttpServer
{
class ServerProtocol
{
protected:
Socket::Adapter *sock;
public:
ServerProtocol(Socket::Adapter *sock) noexcept;
virtual ~ServerProtocol() noexcept = default;
Socket::Adapter *getSocket() noexcept;
virtual bool sendHeaders(
const Http::StatusCode status,
std::vector<std::pair<std::string, std::string> > &headers,
const std::chrono::milliseconds &timeout,
const bool endStream = true
) const = 0;
virtual long sendData(
const void *src,
const size_t size,
const std::chrono::milliseconds &timeout,
const bool endStream = true
) const noexcept = 0;
virtual void close() noexcept;
};
}