d933eae338
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@12865 178a84e3-b1eb-0310-8ba1-8eac791a3b58
44 lines
884 B
C++
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;
|
|
}
|