2013-12-10 08:32:08 +01:00
|
|
|
#ifndef NETWORK_API_NETWORK_CLIENT_H
|
|
|
|
#define NETWORK_API_NETWORK_CLIENT_H
|
|
|
|
|
|
|
|
/////////////////////////////////////
|
|
|
|
// Created by Pontus Fransson 2013 //
|
|
|
|
/////////////////////////////////////
|
|
|
|
|
|
|
|
#ifdef CUSTOM_NET_PROTOCOL_EXPORT
|
|
|
|
#define NET_PROTOCOL_EXPORT __declspec(dllexport)
|
|
|
|
#else
|
|
|
|
#define NET_PROTOCOL_EXPORT __declspec(dllimport)
|
|
|
|
#endif
|
|
|
|
|
2013-12-11 21:45:43 +01:00
|
|
|
#include "NetworkCallbackHelper.h"
|
2013-12-16 11:05:24 +01:00
|
|
|
//#include <vld.h>
|
2013-12-10 08:32:08 +01:00
|
|
|
|
|
|
|
namespace Oyster
|
|
|
|
{
|
|
|
|
namespace Network
|
|
|
|
{
|
|
|
|
extern "C"
|
|
|
|
{
|
2013-12-12 10:32:43 +01:00
|
|
|
struct CustomProtocolObject;
|
2013-12-10 08:32:08 +01:00
|
|
|
class NET_PROTOCOL_EXPORT NetworkClient
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NetworkClient();
|
2013-12-11 21:45:43 +01:00
|
|
|
NetworkClient(unsigned int socket);
|
|
|
|
NetworkClient(RecieverObject recvObj, NetworkProtocolCallbackType type);
|
|
|
|
NetworkClient(RecieverObject recvObj, NetworkProtocolCallbackType type, unsigned int socket);
|
2013-12-12 12:14:53 +01:00
|
|
|
NetworkClient(const NetworkClient& obj);
|
|
|
|
|
|
|
|
NetworkClient& operator =(const NetworkClient& obj);
|
2013-12-10 08:32:08 +01:00
|
|
|
virtual ~NetworkClient();
|
|
|
|
|
2013-12-11 21:45:43 +01:00
|
|
|
bool Connect(unsigned short port, const char serverIP[]);
|
|
|
|
void Disconnect();
|
2013-12-10 08:32:08 +01:00
|
|
|
|
2013-12-11 21:45:43 +01:00
|
|
|
bool IsConnected();
|
|
|
|
|
2013-12-13 08:23:54 +01:00
|
|
|
//Adds the protocol to the queue of protocols to be sent.
|
2013-12-12 10:32:43 +01:00
|
|
|
void Send(CustomProtocolObject& protocol);
|
2013-12-11 21:45:43 +01:00
|
|
|
|
|
|
|
void SetRecieverObject(RecieverObject recvObj, NetworkProtocolCallbackType type);
|
2013-12-10 08:32:08 +01:00
|
|
|
|
2013-12-13 08:23:54 +01:00
|
|
|
//Compares the internal ID.
|
2013-12-12 15:33:11 +01:00
|
|
|
bool operator ==(const NetworkClient& obj);
|
2013-12-16 09:00:11 +01:00
|
|
|
bool operator ==(const int& ID);
|
|
|
|
|
|
|
|
int Id() const;
|
2013-12-12 15:33:11 +01:00
|
|
|
|
2013-12-10 08:32:08 +01:00
|
|
|
private:
|
|
|
|
struct PrivateData;
|
|
|
|
PrivateData* privateData;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|