summaryrefslogtreecommitdiff
path: root/common/netapi.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /common/netapi.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'common/netapi.h')
-rw-r--r--common/netapi.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/common/netapi.h b/common/netapi.h
new file mode 100644
index 0000000..1528480
--- /dev/null
+++ b/common/netapi.h
@@ -0,0 +1,43 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+#if !defined( INETAPI_H )
+#define INETAPI_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "tier0/platform.h"
+#include "netadr.h"
+
+//-----------------------------------------------------------------------------
+// Purpose: Internal winsock helpers for launcher
+//-----------------------------------------------------------------------------
+abstract_class INetAPI
+{
+public:
+ // Convert a netadr_t to sockaddr
+ virtual void NetAdrToSockAddr( netadr_t *a, struct sockaddr *s ) = 0;
+ // Convert a sockaddr to netadr_t
+ virtual void SockAddrToNetAdr( struct sockaddr *s, netadr_t *a ) = 0;
+
+ // Convert a netadr_t to a string
+ virtual char *AdrToString( netadr_t *a ) = 0;
+ // Convert a string address to a netadr_t, doing DNS if needed
+ virtual bool StringToAdr( const char *s, netadr_t *a ) = 0;
+ // Look up IP address for socket
+ virtual void GetSocketAddress( int socket, netadr_t *a ) = 0;
+
+ virtual bool CompareAdr( netadr_t *a, netadr_t *b ) =0;
+
+ // return the IP of the local host
+ virtual void GetLocalIP(netadr_t *a)=0;
+
+};
+
+extern INetAPI *net;
+
+#endif // INETAPI_H \ No newline at end of file