Danbias/Code/Network/NetworkAPI/NetworkClient.h

61 lines
1.4 KiB
C
Raw Normal View History

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
#include "NetworkCallbackHelper.h"
2013-12-13 23:47:16 +01:00
#include <vld.h>
2013-12-10 08:32:08 +01:00
namespace Oyster
{
namespace Network
{
extern "C"
{
struct CustomProtocolObject;
2013-12-10 08:32:08 +01:00
class NET_PROTOCOL_EXPORT NetworkClient
{
public:
NetworkClient();
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();
bool Connect(unsigned short port, const char serverIP[]);
void Disconnect();
2013-12-10 08:32:08 +01:00
bool IsConnected();
2013-12-13 08:23:54 +01:00
//Adds the protocol to the queue of protocols to be sent.
void Send(CustomProtocolObject& protocol);
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.
bool operator ==(const NetworkClient& obj);
2013-12-16 09:00:11 +01:00
bool operator ==(const int& ID);
int Id() const;
2013-12-10 08:32:08 +01:00
private:
struct PrivateData;
PrivateData* privateData;
};
}
}
}
#endif