summaryrefslogtreecommitdiff
path: root/src/net/tmwa/network.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa/network.h')
-rw-r--r--src/net/tmwa/network.h63
1 files changed, 3 insertions, 60 deletions
diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h
index cc7ae129b..b110b7fb9 100644
--- a/src/net/tmwa/network.h
+++ b/src/net/tmwa/network.h
@@ -23,6 +23,8 @@
#ifndef NET_TA_NETWORK_H
#define NET_TA_NETWORK_H
+#include "net/ea/network.h"
+
#include "net/serverinfo.h"
#include "net/tmwa/messagehandler.h"
@@ -45,89 +47,30 @@
namespace TmwAthena
{
-class Network
+class Network : public Ea::Network
{
public:
Network();
~Network();
- bool connect(ServerInfo server);
-
- void disconnect();
-
- ServerInfo getServer() const
- { return mServer; }
-
void registerHandler(MessageHandler *handler);
void unregisterHandler(MessageHandler *handler);
void clearHandlers();
- int getState() const
- { return mState; }
-
- const std::string &getError() const
- { return mError; }
-
- bool isConnected() const
- { return mState == CONNECTED; }
-
- int getInSize() const
- { return mInSize; }
-
- void skip(int len);
-
bool messageReady();
MessageIn getNextMessage();
void dispatchMessages();
- void flush();
-
- void fixSendBuffer();
-
- // ERROR replaced by NET_ERROR because already defined in Windows
- enum
- {
- IDLE = 0,
- CONNECTED,
- CONNECTING,
- DATA,
- NET_ERROR
- };
-
protected:
- friend int networkThread(void *data);
friend class MessageOut;
static Network *instance();
- void setError(const std::string &error);
-
- uint16_t readWord(int pos);
-
- bool realConnect();
-
- void receive();
-
- TCPsocket mSocket;
-
- ServerInfo mServer;
-
- char *mInBuffer, *mOutBuffer;
- unsigned int mInSize, mOutSize;
-
- unsigned int mToSkip;
-
- int mState;
- std::string mError;
-
- SDL_Thread *mWorkerThread;
- SDL_mutex *mMutex;
-
typedef std::map<uint16_t, MessageHandler*> MessageHandlers;
typedef MessageHandlers::iterator MessageHandlerIterator;
MessageHandlers mMessageHandlers;