gdbstub_plugin/src/socket.h

30 lines
434 B
C
Raw Normal View History

2018-09-24 10:43:20 +02:00
#pragma once
#include <cstddef>
class Socket {
public:
2022-02-08 14:48:41 +01:00
enum Type { TCP,
UDP };
2018-09-24 10:43:20 +02:00
2022-02-08 14:44:53 +01:00
Socket();
~Socket();
bool init(Type type);
bool close();
int sock;
2018-09-24 10:43:20 +02:00
};
class Client : public Socket {
public:
2022-02-08 14:44:53 +01:00
bool sendall(const void *data, size_t length);
bool recvall(void *data, size_t length);
2018-09-24 10:43:20 +02:00
};
class Server : public Socket {
public:
2022-02-08 14:44:53 +01:00
bool bind(int port);
bool accept(Client *client);
2018-09-24 10:43:20 +02:00
};