home *** CD-ROM | disk | FTP | other *** search
- #ifndef __Network_h__
- #define __Network_h__
-
- #include "NetworkInfo.h"
-
- //#include "SDL/SDL_net.h"
-
- #include "Server.h"
- #include "Client.h"
-
- #define NETWORK_PROTOCOL_VERSION 2
- #define NETWORK_DEFAULT_SERVER_PORT 27680
- #define NETWORK_DEFAULT_CLIENT_PORT 0
- #define NETWORK_MAX_CLIENTS 16
-
- #define NETWORK_FWP_PACKET_ID 0x27
- #define NETWORK_MAX_PACKET_SIZE 2048
- #define NETWORK_MAX_PACKETS_PER_FRAME 32
-
- class Network{
- public:
- static NetworkInfo info;
-
- static bool init();
- static bool shutdown();
- static bool wasInit();
-
- static bool initServer();
- static bool shutdownServer();
- static bool wasServerInit();
-
- static bool initClient();
- static bool shutdownClient();
- static bool wasClientInit();
-
- static bool registerCVarsAndCCmds();
- static bool unregisterCVarsAndCCmds();
-
- protected:
- static bool initialized;
- static bool serverInitialized;
- static bool clientInitialized;
-
- public:
- static Server* server;
- static Client* client;
-
- static void sendAndReceive();
- static bool makeLoopbackConnection();
-
- static bool sendPacket(UDPsocket socket, UDPpacket* p);
- static bool sendAndFreePacket(UDPsocket socket, UDPpacket* p);
- static UDPpacket* receivePacket(UDPsocket socket);
- static void ipAddressToString(IPaddress ip, char* buff);
- };
-
-
- #endif /* __Network_h__ */
-