-#ifndef VG_STEAM_NETWORKING_H
-#define VG_STEAM_NETWORKING_H
-
+#pragma once
#include "vg_steam.h"
#ifdef VALVE_CALLBACK_PACK_SMALL
/* 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
* different abstractions.
*/
typedef u32 HSteamListenSocket;
-HSteamListenSocket const k_HSteamListenSocket_Invalid = 0;
+static HSteamListenSocket const k_HSteamListenSocket_Invalid = 0;
typedef u32 SteamNetworkingPOPID;
typedef i64 SteamNetworkingMicroseconds;
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).
* 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
* 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
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
* 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();
ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_SteamAPI_v012();
+static inline
ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_SteamAPI()
{
return SteamAPI_SteamNetworkingSockets_SteamAPI_v012();
* 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.
* 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
* 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;
/*
* 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
*
* 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;
* 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;
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(
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 );
* 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 );
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 );
* 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;
return "Error";
}
-static const char *string_ESteamNetworkingAvailability(
+static inline const char *string_ESteamNetworkingAvailability(
ESteamNetworkingAvailability s )
{
switch(s)
break;
}
}
-
-#endif /* VG_STEAM_NETWORKING_H */