home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 March / ENTER.ISO / files / fwp-0.0.6-win32-installer.exe / Network.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-01-22  |  1.3 KB  |  59 lines

  1. #ifndef __Network_h__
  2. #define __Network_h__
  3.  
  4. #include "NetworkInfo.h"
  5.  
  6. //#include "SDL/SDL_net.h"
  7.  
  8. #include "Server.h"
  9. #include "Client.h"
  10.  
  11. #define NETWORK_PROTOCOL_VERSION        2
  12. #define NETWORK_DEFAULT_SERVER_PORT        27680
  13. #define NETWORK_DEFAULT_CLIENT_PORT        0
  14. #define NETWORK_MAX_CLIENTS                16
  15.  
  16. #define NETWORK_FWP_PACKET_ID            0x27
  17. #define NETWORK_MAX_PACKET_SIZE            2048
  18. #define NETWORK_MAX_PACKETS_PER_FRAME    32
  19.  
  20. class Network{
  21. public:
  22.     static NetworkInfo info;
  23.  
  24.     static bool init();
  25.     static bool shutdown();
  26.     static bool wasInit();
  27.  
  28.     static bool initServer();
  29.     static bool shutdownServer();
  30.     static bool wasServerInit();
  31.  
  32.     static bool initClient();
  33.     static bool shutdownClient();
  34.     static bool wasClientInit();
  35.  
  36.     static bool registerCVarsAndCCmds();
  37.     static bool unregisterCVarsAndCCmds();
  38.  
  39. protected:
  40.     static bool initialized;
  41.     static bool serverInitialized;
  42.     static bool clientInitialized;
  43.  
  44. public:
  45.     static Server* server;
  46.     static Client* client;
  47.  
  48.     static void sendAndReceive();
  49.     static bool makeLoopbackConnection();
  50.  
  51.     static bool sendPacket(UDPsocket socket, UDPpacket* p);
  52.     static bool sendAndFreePacket(UDPsocket socket, UDPpacket* p);
  53.     static UDPpacket* receivePacket(UDPsocket socket);
  54.     static void ipAddressToString(IPaddress ip, char* buff);
  55. };
  56.  
  57.  
  58. #endif    /* __Network_h__ */
  59.