2013-12-16 09:00:11 +01:00
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
// Created by [Dennis Andersen] [2013]
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
2013-12-12 09:33:59 +01:00
|
|
|
#ifndef DANBIASSERVER_NETWORK_SESSION_H
|
|
|
|
#define DANBIASSERVER_NETWORK_SESSION_H
|
|
|
|
|
2013-12-14 22:04:42 +01:00
|
|
|
#define NOMINMAX
|
2013-12-12 09:33:59 +01:00
|
|
|
#include "Utilities.h"
|
2013-12-18 08:37:45 +01:00
|
|
|
#include <PostBox\IPostBox.h>
|
2013-12-16 09:00:11 +01:00
|
|
|
#include <CustomNetProtocol.h>
|
|
|
|
#include <NetworkClient.h>
|
2013-12-12 09:33:59 +01:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace DanBias
|
|
|
|
{
|
2013-12-13 23:47:16 +01:00
|
|
|
class ClientObject;
|
2013-12-12 09:33:59 +01:00
|
|
|
class NetworkSession
|
|
|
|
{
|
2013-12-13 23:47:16 +01:00
|
|
|
public:
|
2013-12-16 09:00:11 +01:00
|
|
|
struct NetEvent
|
2013-12-13 23:47:16 +01:00
|
|
|
{
|
|
|
|
ClientObject* reciever;
|
|
|
|
Oyster::Network::CustomNetProtocol protocol;
|
|
|
|
};
|
|
|
|
|
2013-12-12 09:33:59 +01:00
|
|
|
public:
|
|
|
|
NetworkSession();
|
|
|
|
~NetworkSession();
|
|
|
|
|
2013-12-13 23:47:16 +01:00
|
|
|
void AttachClient(Utility::DynamicMemory::SmartPointer<ClientObject> client);
|
2013-12-12 09:33:59 +01:00
|
|
|
|
2013-12-16 09:00:11 +01:00
|
|
|
void DetachClient(Oyster::Network::NetworkClient* client);
|
|
|
|
void DetachClient(ClientObject* client);
|
2013-12-12 09:33:59 +01:00
|
|
|
void DetachClient(short ID);
|
2013-12-14 22:04:42 +01:00
|
|
|
void DetachClient();
|
2013-12-12 09:33:59 +01:00
|
|
|
|
|
|
|
void Kick();
|
|
|
|
|
2013-12-12 10:36:55 +01:00
|
|
|
void Send(Oyster::Network::CustomNetProtocol& protocol);
|
|
|
|
void Send(Oyster::Network::CustomNetProtocol& protocol, int ID);
|
2013-12-12 09:33:59 +01:00
|
|
|
|
|
|
|
//TODO: Do more lobby features
|
2013-12-18 08:37:45 +01:00
|
|
|
void SetPostbox(Oyster::IPostBox<DanBias::NetworkSession::NetEvent> *box);
|
2013-12-12 09:33:59 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
std::vector<Utility::DynamicMemory::SmartPointer<ClientObject>> clients;
|
2013-12-18 08:37:45 +01:00
|
|
|
Oyster::IPostBox<DanBias::NetworkSession::NetEvent> *box;
|
2013-12-12 09:33:59 +01:00
|
|
|
};
|
|
|
|
}//End namespace DanBias
|
|
|
|
#endif // !DANBIASSERVER_NETWORK_SESSION_H
|