2013-06-16 19:54:02 -04:00
|
|
|
#ifndef NETWORKMANAGER_HPP
|
|
|
|
#define NETWORKMANAGER_HPP
|
|
|
|
|
|
|
|
#include "stk_peer.hpp"
|
|
|
|
#include "stk_host.hpp"
|
|
|
|
#include <vector>
|
|
|
|
|
2013-06-17 14:06:02 -04:00
|
|
|
#include "protocol_manager.hpp"
|
2013-06-16 19:54:02 -04:00
|
|
|
|
|
|
|
class NetworkManager
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NetworkManager();
|
|
|
|
virtual ~NetworkManager();
|
|
|
|
|
2013-06-17 08:48:44 -04:00
|
|
|
virtual void run() = 0;
|
2013-06-16 19:54:02 -04:00
|
|
|
|
2013-06-17 08:48:44 -04:00
|
|
|
static void setManualSocketsMode(bool manual);
|
2013-06-16 19:54:02 -04:00
|
|
|
static void sendRawPacket(uint8_t* data, int length, unsigned int dstIp, unsigned short dstPort);
|
2013-06-17 08:48:44 -04:00
|
|
|
|
2013-06-16 19:54:02 -04:00
|
|
|
static void receptionCallback(char* data);
|
|
|
|
virtual void packetReceived(char* data) = 0;
|
|
|
|
|
2013-06-17 20:42:11 -04:00
|
|
|
static STKHost* getHost();
|
2013-06-16 19:54:02 -04:00
|
|
|
protected:
|
|
|
|
std::vector<STKPeer*> m_peers;
|
|
|
|
STKHost* m_localhost;
|
|
|
|
|
|
|
|
static NetworkManager* instance;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NETWORKMANAGER_HPP
|