stuff-from-scratch/src/network/NetworkManager.h

34 lines
537 B
C
Raw Normal View History

2020-05-02 07:31:03 +00:00
#pragma once
#include <memory>
#include <vector>
#include "Socket.h"
2020-07-04 18:43:08 +00:00
#include "SocketInterface.h"
2020-05-02 07:31:03 +00:00
class NetworkManager
{
2020-07-04 18:43:08 +00:00
std::vector<SocketPtr> mActiveSockets;
SocketInterfaceUPtr mSocketInterface;
2020-05-02 07:31:03 +00:00
public:
2020-07-04 18:43:08 +00:00
NetworkManager();
2020-05-02 07:31:03 +00:00
2020-07-04 18:43:08 +00:00
~NetworkManager();
2020-05-02 07:31:03 +00:00
2020-07-04 18:43:08 +00:00
static std::unique_ptr<NetworkManager> Create();
2020-05-02 07:31:03 +00:00
2020-07-04 18:43:08 +00:00
void Initialize();
2020-05-02 07:31:03 +00:00
2020-07-04 18:43:08 +00:00
void OpenSocket(SocketPtr socket);
2020-05-02 07:31:03 +00:00
2020-07-04 18:43:08 +00:00
void CloseSocket(SocketPtr socket);
2020-05-02 07:31:03 +00:00
2020-07-04 18:43:08 +00:00
void RunHttpServer();
2020-05-02 07:31:03 +00:00
2020-07-04 18:43:08 +00:00
void ShutDown();
2020-05-02 07:31:03 +00:00
};
2020-07-04 18:43:08 +00:00
using NetworkManagerUPtr = std::unique_ptr<NetworkManager>;