47 lines
877 B
C++
47 lines
877 B
C++
/******************************************************************************
|
|
* File: network.hpp
|
|
*
|
|
* Author: Tonitch
|
|
* Created: 12/10/21
|
|
* Description: Header for meuporg (name might change) for network part
|
|
*****************************************************************************/
|
|
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#include <stdlib.h>
|
|
#include <vector>
|
|
#include <sys/select.h>
|
|
#include "Config.hpp"
|
|
|
|
#ifndef NETWORK_H
|
|
#define NETWORK_H
|
|
class Network
|
|
{
|
|
private:
|
|
int main_socket;
|
|
std::vector<int> accepted_sock;
|
|
int max_fd;
|
|
|
|
fd_set readfds;
|
|
|
|
sockaddr_in server, new_sockaddr;
|
|
bool will_close = false;
|
|
char msg[1024];
|
|
const char* motd;
|
|
int rcv_bytes;
|
|
unsigned int sin_size = sizeof(struct sockaddr*);
|
|
|
|
Config* conf;
|
|
|
|
public:
|
|
Network();
|
|
void run();
|
|
};
|
|
|
|
|
|
#endif /* NETWORK_H */
|
|
|
|
|
|
|