00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _TMWSERV_CONNECTION_H_
00023 #define _TMWSERV_CONNECTION_H_
00024
00025 #include <string>
00026 #include <enet/enet.h>
00027
00028 class MessageIn;
00029 class MessageOut;
00030 class BandwidthMonitor;
00031
00036 class Connection
00037 {
00038 public:
00039 Connection();
00040 virtual ~Connection() {}
00041
00046 bool start(const std::string &, int);
00047
00051 void stop();
00052
00056 bool isConnected() const;
00057
00061 void send(const MessageOut &msg, bool reliable = true,
00062 unsigned channel = 0);
00063
00067 void process();
00068
00069 protected:
00073 virtual void processMessage(MessageIn &) = 0;
00074
00075 private:
00076 ENetPeer *mRemote;
00077 ENetHost *mLocal;
00078 };
00079
00080 #endif