Danbias/Code/Game/DanBiasServer/ServerObjects/NetworkSession.h

51 lines
1.3 KiB
C
Raw Normal View History

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
#define NOMINMAX
2013-12-12 09:33:59 +01:00
#include "Utilities.h"
#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);
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
void SetPostbox(Oyster::IPostBox<DanBias::NetworkSession::NetEvent> *box);
2013-12-12 09:33:59 +01:00
protected:
std::vector<Utility::DynamicMemory::SmartPointer<ClientObject>> clients;
Oyster::IPostBox<DanBias::NetworkSession::NetEvent> *box;
2013-12-12 09:33:59 +01:00
};
}//End namespace DanBias
#endif // !DANBIASSERVER_NETWORK_SESSION_H