Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.4 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef INETWORK_H
  7. #define INETWORK_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. class IConnectionlessPacketHandler;
  12. abstract_class INetwork
  13. {
  14. public:
  15. virtual ~INetwork( void ) {};
  16. virtual void Init( void ) = 0;
  17. virtual void Config (bool multiplayer);
  18. virtual void IsMultiplayer( void ) = 0; // true = full MP mode, false = loopback SP mode
  19. virtual void IsEnabled( void ) = 0;
  20. // shuts down Network, closes all UPD/TCP channels
  21. virtual void Shutdown( void ) = 0;
  22. // must be called each system frame to do any asynchronouse TCP stuff
  23. virtual void RunFrame( double time ) = 0;
  24. virtual void ProcessSocket( netsrc_t sock, IConnectionlessPacketHandler * handler ) = 0;
  25. virtual void OutOfBandPrintf(netsrc_t sock, netadr_t &adr, const char *format, ...) = 0;
  26. virtual void SendConnectionless(netsrc_t sock, netadr_t &adr, unsigned char * data, int length ) = 0;
  27. virtual void LogBadPacket(netpacket_t * packet) = 0;
  28. // Address conversion
  29. virtual bool StringToAdr ( const char *s, netadr_t *a) = 0;
  30. // Convert from host to network byte ordering
  31. virtual unsigned short HostToNetShort( unsigned short us_in );
  32. // and vice versa
  33. virtual unsigned short NetToHostShort( unsigned short us_in );
  34. };
  35. #endif // INETWORK_H