Team Fortress 2 Source Code as on 22/4/2020
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.

41 lines
1.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #if !defined( INETAPI_H )
  8. #define INETAPI_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "netadr.h"
  13. //-----------------------------------------------------------------------------
  14. // Purpose: Internal winsock helpers for launcher
  15. //-----------------------------------------------------------------------------
  16. class INetAPI
  17. {
  18. public:
  19. // Convert a netadr_t to sockaddr
  20. virtual void NetAdrToSockAddr( netadr_t *a, struct sockaddr *s ) = 0;
  21. // Convert a sockaddr to netadr_t
  22. virtual void SockAddrToNetAdr( struct sockaddr *s, netadr_t *a ) = 0;
  23. // Convert a netadr_t to a string
  24. virtual char *AdrToString( netadr_t *a ) = 0;
  25. // Convert a string address to a netadr_t, doing DNS if needed
  26. virtual bool StringToAdr( const char *s, netadr_t *a ) = 0;
  27. // Look up IP address for socket
  28. virtual void GetSocketAddress( int socket, netadr_t *a ) = 0;
  29. virtual bool CompareAdr( netadr_t *a, netadr_t *b ) =0;
  30. // return the IP of the local host
  31. virtual void GetLocalIP(netadr_t *a)=0;
  32. };
  33. extern INetAPI *net;
  34. #endif // INETAPI_H