stk-code_catmod/dev/SocketsBase/network_manager.cpp
hilnius d933eae338 base commit
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@12865 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2013-06-16 23:54:02 +00:00

44 lines
884 B
C++

#include "network_manager.hpp"
#include <stdio.h>
NetworkManager* NetworkManager::instance = NULL;
NetworkManager::NetworkManager()
{
if (NetworkManager::instance)
{
printf("Warning : a Newtork Manager is being deleted.\n");
delete NetworkManager::instance;
}
NetworkManager::instance = this;
printf("New Network Manager created.\n");
}
NetworkManager::~NetworkManager()
{
}
void NetworkManager::run()
{
}
void NetworkManager::sendRawPacket(uint8_t* data, int length, unsigned int dstIp, unsigned short dstPort)
{
instance->getHost()->sendRawPacket(data, length, dstIp, dstPort);
}
uint8_t* NetworkManager::receiveRawPacket()
{
return instance->getHost()->receiveRawPacket();
}
void NetworkManager::receptionCallback(char* data)
{
instance->packetReceived(data);
}
STKHost* NetworkManager::getHost()
{
return m_localhost;
}