Initial commit.
This commit is contained in:
commit
82b4f23c06
56 changed files with 3485 additions and 0 deletions
45
Shared/Network/Network.h
Normal file
45
Shared/Network/Network.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#pragma once
|
||||
|
||||
#include "Shared.h"
|
||||
#include "Events.h"
|
||||
#include "Connection.h"
|
||||
|
||||
namespace Artifact {
|
||||
|
||||
namespace Events {
|
||||
|
||||
struct NetworkMessage {
|
||||
void * data;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class NetworkClient;
|
||||
|
||||
class NetworkServer: public BaseSubsystem, public EventTarget {
|
||||
NetworkClient * localClient = nullptr;
|
||||
std::unique_ptr<ServerListener> server = nullptr;
|
||||
bool active = false;
|
||||
uint64_t listener;
|
||||
public:
|
||||
|
||||
void host(NetworkClient * client);
|
||||
void host(std::string port);
|
||||
|
||||
void unhost();
|
||||
};
|
||||
|
||||
class NetworkClient: public BaseSubsystem, public EventTarget {
|
||||
NetworkServer * localServer = nullptr;
|
||||
std::unique_ptr<Connection> server = nullptr;
|
||||
bool active = false;
|
||||
uint64_t listener;
|
||||
public:
|
||||
|
||||
void connect(NetworkServer * local);
|
||||
void connect(std::string host, std::string port);
|
||||
|
||||
void disconnect();
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue