bad char
[vg.git] / vg_steam_networking.h
index 6eb059909d261274abe9321572f935140b0fed68..5abb7b651afed22dbe9f38437ff1438e0617282d 100644 (file)
@@ -1,6 +1,4 @@
-#ifndef VG_STEAM_NETWORKING_H
-#define VG_STEAM_NETWORKING_H
-
+#pragma once
 #include "vg_steam.h"
 
 #ifdef VALVE_CALLBACK_PACK_SMALL
@@ -183,7 +181,7 @@ typedef enum ESteamNetworkingAvailability ESteamNetworkingAvailability;
 
 /* Handle used to identify a connection to a remote host. */
 typedef u32 HSteamNetConnection;
-HSteamNetConnection const k_HSteamNetConnection_Invalid = 0;
+static HSteamNetConnection const k_HSteamNetConnection_Invalid = 0;
 
 /* 
  * Handle used to identify a "listen socket".  Unlike traditional
@@ -191,7 +189,7 @@ HSteamNetConnection const k_HSteamNetConnection_Invalid = 0;
  * different abstractions.
  */
 typedef u32 HSteamListenSocket;
-HSteamListenSocket const k_HSteamListenSocket_Invalid = 0;
+static HSteamListenSocket const k_HSteamListenSocket_Invalid = 0;
 
 typedef u32 SteamNetworkingPOPID;
 typedef i64 SteamNetworkingMicroseconds;
@@ -274,7 +272,8 @@ void SteamAPI_SteamNetworkingIPAddr_SetIPv4( SteamNetworkingIPAddr* self,
       u32 nIP, u16 nPort );
 
 /* Return true if IP is mapped IPv4 */
-int SteamAPI_SteamNetworkingIPAddr_IsIPv4( SteamNetworkingIPAddr* self );
+steamapi_bool 
+SteamAPI_SteamNetworkingIPAddr_IsIPv4( SteamNetworkingIPAddr *self );
 
 /* 
  * Returns IP in host byte order (e.g. aa.bb.cc.dd as 0xaabbccdd).
@@ -290,7 +289,8 @@ void SteamAPI_SteamNetworkingIPAddr_SetIPv6LocalHost(
  * Return true if this identity is localhost.  
  * (Either IPv6 ::1, or IPv4 127.0.0.1)
  */
-int SteamAPI_SteamNetworkingIPAddr_IsLocalHost( SteamNetworkingIPAddr* self );
+steamapi_bool SteamAPI_SteamNetworkingIPAddr_IsLocalHost( 
+      SteamNetworkingIPAddr* self );
 
 /* 
  * Print to a string, with or without the port. Mapped IPv4 addresses are 
@@ -302,19 +302,19 @@ int SteamAPI_SteamNetworkingIPAddr_IsLocalHost( SteamNetworkingIPAddr* self );
  * See also SteamNetworkingIdentityRender
  */
 void SteamAPI_SteamNetworkingIPAddr_ToString( SteamNetworkingIPAddr* self, 
-      char *buf, u32 cbBuf, int bWithPort );
+      char *buf, u32 cbBuf, steamapi_bool bWithPort );
 
 /* 
  * Parse an IP address and optional port. If a port is not present, it is set 
  * to 0.
  * (This means that you cannot tell if a zero port was explicitly specified.)
  */
-int SteamAPI_SteamNetworkingIPAddr_ParseString( SteamNetworkingIPAddr* self, 
-      const char *pszStr );
+steamapi_bool SteamAPI_SteamNetworkingIPAddr_ParseString( 
+      SteamNetworkingIPAddr* self, const char *pszStr );
 
 /* See if two addresses are identical */
-int SteamAPI_SteamNetworkingIPAddr_IsEqualTo( SteamNetworkingIPAddr* self, 
-      SteamNetworkingIPAddr *x );
+steamapi_bool SteamAPI_SteamNetworkingIPAddr_IsEqualTo( 
+      SteamNetworkingIPAddr *self, SteamNetworkingIPAddr *x );
 
 /* 
  * Classify address as FakeIP.  This function never returns
@@ -324,7 +324,7 @@ ESteamNetworkingFakeIPType SteamAPI_SteamNetworkingIPAddr_GetFakeIPType(
       SteamNetworkingIPAddr* self );
 
 /* Return true if we are a FakeIP */
-int SteamAPI_SteamNetworkingIPAddr_IsFakeIP( SteamNetworkingIPAddr* self );
+steamapi_bool SteamAPI_SteamNetworkingIPAddr_IsFakeIP( SteamNetworkingIPAddr* self );
 
 /* 
  * In a few places we need to set configuration options on listen sockets and 
@@ -391,12 +391,12 @@ typedef struct SteamNetConnectionInfo_t SteamNetConnectionInfo_t;
  * connections at once efficiently.
  */
 typedef u32 HSteamNetPollGroup;
-HSteamNetPollGroup const k_HSteamNetPollGroup_Invalid = 0;
+static HSteamNetPollGroup const k_HSteamNetPollGroup_Invalid = 0;
 
 ISteamNetworkingSockets 
 *SteamAPI_SteamGameServerNetworkingSockets_SteamAPI_v012(void);
 
-ISteamNetworkingSockets 
+static inline ISteamNetworkingSockets 
 *SteamAPI_SteamGameServerNetworkingSockets_SteamAPI(void) 
 { 
    return SteamAPI_SteamGameServerNetworkingSockets_SteamAPI_v012(); 
@@ -404,6 +404,7 @@ ISteamNetworkingSockets
 
 
 ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_SteamAPI_v012();
+static inline 
 ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_SteamAPI() 
 { 
    return SteamAPI_SteamNetworkingSockets_SteamAPI_v012(); 
@@ -423,7 +424,7 @@ ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_SteamAPI()
  * Migration note: This is not exactly the same as k_EP2PSendUnreliable!  You
  * probably want k_ESteamNetworkingSendType_UnreliableNoNagle
  */
-const int k_nSteamNetworkingSend_Unreliable = 0;
+static const int k_nSteamNetworkingSend_Unreliable = 0;
 
 /* 
  * Disable Nagle's algorithm.
@@ -444,7 +445,7 @@ const int k_nSteamNetworkingSend_Unreliable = 0;
  * server simulation tick to a particular client), and you use this flag to
  * flush all messages.
  */
-const int k_nSteamNetworkingSend_NoNagle = 1;
+static const int k_nSteamNetworkingSend_NoNagle = 1;
 
 /* 
  * Send a message unreliably, bypassing Nagle's algorithm for this message and 
@@ -454,7 +455,7 @@ const int k_nSteamNetworkingSend_NoNagle = 1;
  * ISteamNetworkingMessages::FlushMessagesToUser. (But using this flag is more 
  * efficient since you only make one API call.)
  */
-const int k_nSteamNetworkingSend_UnreliableNoNagle = 
+static const int k_nSteamNetworkingSend_UnreliableNoNagle = 
             k_nSteamNetworkingSend_Unreliable | 
             k_nSteamNetworkingSend_NoNagle;
 /*
@@ -463,7 +464,7 @@ const int k_nSteamNetworkingSend_UnreliableNoNagle =
  * This is only applicable for unreliable messages. Using this flag on reliable 
  * messages is invalid.
  */
-const int k_nSteamNetworkingSend_NoDelay = 4;
+static const int k_nSteamNetworkingSend_NoDelay = 4;
 
 /* 
  * Send an unreliable message, but if it cannot be sent relatively quickly, just
@@ -481,7 +482,7 @@ const int k_nSteamNetworkingSend_NoDelay = 4;
  *
  * If a message is dropped for these reasons, k_EResultIgnored will be returned.
  */
-const int k_nSteamNetworkingSend_UnreliableNoDelay = 
+static const int k_nSteamNetworkingSend_UnreliableNoDelay = 
             k_nSteamNetworkingSend_Unreliable |
             k_nSteamNetworkingSend_NoDelay | 
             k_nSteamNetworkingSend_NoNagle;
@@ -500,14 +501,14 @@ const int k_nSteamNetworkingSend_UnreliableNoDelay =
  * Migration note: This is NOT the same as k_EP2PSendReliable, it's more like 
  * k_EP2PSendReliableWithBuffering
  */
-const int k_nSteamNetworkingSend_Reliable = 8;
+static const int k_nSteamNetworkingSend_Reliable = 8;
 
 /* 
  * Send a message reliably, but bypass Nagle's algorithm.
  *
  * Migration note: This is equivalent to k_EP2PSendReliable
  */
-const int k_nSteamNetworkingSend_ReliableNoNagle = 
+static const int k_nSteamNetworkingSend_ReliableNoNagle = 
             k_nSteamNetworkingSend_Reliable | 
             k_nSteamNetworkingSend_NoNagle;
 
@@ -527,21 +528,21 @@ EResult SteamAPI_ISteamNetworkingSockets_AcceptConnection(
       ISteamNetworkingSockets *self, 
       HSteamNetConnection hConn );
 
-int SteamAPI_ISteamNetworkingSockets_CloseConnection( 
+steamapi_bool SteamAPI_ISteamNetworkingSockets_CloseConnection( 
       ISteamNetworkingSockets *self, 
       HSteamNetConnection hPeer, int nReason, const char *pszDebug, 
-      int bEnableLinger );
+      steamapi_bool bEnableLinger );
 
-int SteamAPI_ISteamNetworkingSockets_GetListenSocketAddress( 
+steamapi_bool SteamAPI_ISteamNetworkingSockets_GetListenSocketAddress( 
       ISteamNetworkingSockets *self, HSteamListenSocket hSocket, 
       SteamNetworkingIPAddr *address );
 
-int SteamAPI_ISteamNetworkingSockets_CloseConnection( 
+steamapi_bool SteamAPI_ISteamNetworkingSockets_CloseConnection( 
       ISteamNetworkingSockets *self, 
       HSteamNetConnection hPeer, int nReason, const char *pszDebug, 
-      int bEnableLinger );
+      steamapi_bool bEnableLinger );
 
-int SteamAPI_ISteamNetworkingSockets_CloseListenSocket( 
+steamapi_bool SteamAPI_ISteamNetworkingSockets_CloseListenSocket( 
       ISteamNetworkingSockets *self, HSteamListenSocket hSocket );
 
 EResult SteamAPI_ISteamNetworkingSockets_SendMessageToConnection( 
@@ -571,11 +572,11 @@ int SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnConnection(
 HSteamNetPollGroup SteamAPI_ISteamNetworkingSockets_CreatePollGroup( 
       ISteamNetworkingSockets *self );
 
-int SteamAPI_ISteamNetworkingSockets_DestroyPollGroup( 
+steamapi_bool SteamAPI_ISteamNetworkingSockets_DestroyPollGroup( 
       ISteamNetworkingSockets *self, 
       HSteamNetPollGroup hPollGroup );
 
-int SteamAPI_ISteamNetworkingSockets_SetConnectionPollGroup( 
+steamapi_bool SteamAPI_ISteamNetworkingSockets_SetConnectionPollGroup( 
       ISteamNetworkingSockets *self, 
       HSteamNetConnection hConn, HSteamNetPollGroup hPollGroup );
 
@@ -587,7 +588,7 @@ int SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnPollGroup(
  * Returns basic information about the high-level state of the connection.
  * Returns false if the connection handle is invalid.
  */
-int SteamAPI_ISteamNetworkingSockets_GetConnectionInfo( 
+steamapi_bool SteamAPI_ISteamNetworkingSockets_GetConnectionInfo( 
       ISteamNetworkingSockets* self, 
       HSteamNetConnection hConn, SteamNetConnectionInfo_t * pInfo );
 
@@ -595,13 +596,13 @@ int SteamAPI_ISteamNetworkingSockets_GetDetailedConnectionStatus(
       ISteamNetworkingSockets* self, 
       HSteamNetConnection hConn, char *pszBuf, int cbBuf );
 
-int SteamAPI_ISteamNetworkingSockets_SetConnectionUserData( 
+steamapi_bool SteamAPI_ISteamNetworkingSockets_SetConnectionUserData( 
       ISteamNetworkingSockets* self, HSteamNetConnection hPeer, i64 nUserData );
 
 i64 SteamAPI_ISteamNetworkingSockets_GetConnectionUserData( 
       ISteamNetworkingSockets* self, HSteamNetConnection hPeer );
 
-int SteamAPI_ISteamNetworkingSockets_GetListenSocketAddress( 
+steamapi_bool SteamAPI_ISteamNetworkingSockets_GetListenSocketAddress( 
       ISteamNetworkingSockets* self, 
       HSteamListenSocket hSocket, SteamNetworkingIPAddr *address );
 
@@ -931,12 +932,14 @@ void SteamAPI_SteamNetworkingMessage_t_Release(SteamNetworkingMessage_t* self);
  * Utility
  */
 
-static const char *string_ESteamNetworkingConnectionState( 
+static inline const char *string_ESteamNetworkingConnectionState( 
       ESteamNetworkingConnectionState s )
 {
    switch(s)
    {
-      case k_ESteamNetworkingConnectionState_None:       return "None"; break;
+      case k_ESteamNetworkingConnectionState_None:       
+         return "None"; 
+      break;
       case k_ESteamNetworkingConnectionState_Connecting: 
          return "Connecting";
       break;
@@ -969,7 +972,7 @@ static const char *string_ESteamNetworkingConnectionState(
    return "Error";
 }
 
-static const char *string_ESteamNetworkingAvailability( 
+static inline const char *string_ESteamNetworkingAvailability( 
       ESteamNetworkingAvailability s )
 {
    switch(s)
@@ -1006,5 +1009,3 @@ static const char *string_ESteamNetworkingAvailability(
       break;
    }
 }
-
-#endif /* VG_STEAM_NETWORKING_H */