1 ////////////////////////////////////////////////////////////////////////////////
2 // Scorched3D (c) 2000-2009
4 // This file is part of Scorched3D.
6 // Scorched3D is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
11 // Scorched3D is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with Scorched3D; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 ////////////////////////////////////////////////////////////////////////////////
21 #if !defined(__INCLUDE_NetInterfaceh_INCLUDE__)
22 #define __INCLUDE_NetInterfaceh_INCLUDE__
24 #include <net/NetMessageHandler.h>
25 #include <net/NetInterfaceFlags.h>
31 virtual ~NetInterface();
33 virtual bool started() = 0;
34 virtual bool connect(const char *hostName
, int portNo
) = 0;
35 virtual bool start(int portNo
) = 0;
36 virtual void stop() = 0;
38 virtual int processMessages() = 0;
39 virtual void setMessageHandler(NetMessageHandlerI
*handler
) = 0;
41 virtual void disconnectAllClients() = 0;
42 virtual void disconnectClient(unsigned int client
) = 0;
43 virtual void sendMessageServer(NetBuffer
&buffer
,
44 unsigned int flags
= 0) = 0;
45 virtual void sendMessageDest(NetBuffer
&buffer
,
46 unsigned int destination
, unsigned int flags
= 0) = 0;
48 static unsigned int &getBytesIn() { return bytesIn_
; }
49 static unsigned int &getBytesOut() { return bytesOut_
; }
50 static unsigned int &getPings() { return pings_
; }
51 static unsigned int &getConnects() { return connects_
; }
52 static const char *getIpName(unsigned int ipAddress
);
55 static unsigned int bytesIn_
;
56 static unsigned int bytesOut_
;
57 static unsigned int pings_
;
58 static unsigned int connects_
;