blob: 6a22f3bcc8620c749367b2f6e1eb3a00e1cbef98 (
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
|
#pragma once
#include <netinet/in.h>
#include <cstdint>
#include <vector>
namespace erebos {
using std::vector;
class NetworkProtocol
{
public:
NetworkProtocol();
explicit NetworkProtocol(int sock);
NetworkProtocol(const NetworkProtocol &) = delete;
NetworkProtocol(NetworkProtocol &&);
NetworkProtocol & operator=(const NetworkProtocol &) = delete;
NetworkProtocol & operator=(NetworkProtocol &&);
~NetworkProtocol();
bool recvfrom(vector<uint8_t> & buffer, sockaddr_in6 & addr);
void sendto(const vector<uint8_t> & buffer, sockaddr_in addr);
void sendto(const vector<uint8_t> & buffer, sockaddr_in6 addr);
void shutdown();
private:
int sock;
};
}
|