+++ /dev/null
-#ifndef VG_STEAM_NETWORKING_H
-#define VG_STEAM_NETWORKING_H
-
-#include "vg_steam.h"
-
-#ifdef VALVE_CALLBACK_PACK_SMALL
- #pragma pack(push,4)
-#else
- #pragma pack(push,8)
-#endif
-
-typedef enum ESteamNetworkingConfigScope ESteamNetworkingConfigScope;
-enum ESteamNetworkingConfigScope
-{
- k_ESteamNetworkingConfig_Global = 1,
- k_ESteamNetworkingConfig_SocketsInterface = 2,
- k_ESteamNetworkingConfig_ListenSocket = 3,
- k_ESteamNetworkingConfig_Connection = 4,
- k_ESteamNetworkingConfigScope__Force32Bit = 0x7fffffff
-};
-
-typedef enum ESteamNetworkingConfigDataType ESteamNetworkingConfigDataType;
-enum ESteamNetworkingConfigDataType
-{
- k_ESteamNetworkingConfig_Int32 = 1,
- k_ESteamNetworkingConfig_Int64 = 2,
- k_ESteamNetworkingConfig_Float = 3,
- k_ESteamNetworkingConfig_String = 4,
- k_ESteamNetworkingConfig_Ptr = 5,
-
- k_ESteamNetworkingConfigDataType__Force32Bit = 0x7fffffff
-};
-
-typedef enum ESteamNetworkingConfigValue ESteamNetworkingConfigValue;
-enum ESteamNetworkingConfigValue
-{
- k_ESteamNetworkingConfig_Invalid = 0,
- k_ESteamNetworkingConfig_TimeoutInitial = 24,
- k_ESteamNetworkingConfig_TimeoutConnected = 25,
- k_ESteamNetworkingConfig_SendBufferSize = 9,
- k_ESteamNetworkingConfig_ConnectionUserData = 40,
- k_ESteamNetworkingConfig_SendRateMin = 10,
- k_ESteamNetworkingConfig_SendRateMax = 11,
- k_ESteamNetworkingConfig_NagleTime = 12,
- k_ESteamNetworkingConfig_IP_AllowWithoutAuth = 23,
- k_ESteamNetworkingConfig_MTU_PacketSize = 32,
- k_ESteamNetworkingConfig_MTU_DataSize = 33,
- k_ESteamNetworkingConfig_Unencrypted = 34,
- k_ESteamNetworkingConfig_SymmetricConnect = 37,
- k_ESteamNetworkingConfig_LocalVirtualPort = 38,
- k_ESteamNetworkingConfig_DualWifi_Enable = 39,
- k_ESteamNetworkingConfig_EnableDiagnosticsUI = 46,
- k_ESteamNetworkingConfig_FakePacketLoss_Send = 2,
- k_ESteamNetworkingConfig_FakePacketLoss_Recv = 3,
- k_ESteamNetworkingConfig_FakePacketLag_Send = 4,
- k_ESteamNetworkingConfig_FakePacketLag_Recv = 5,
- k_ESteamNetworkingConfig_FakePacketReorder_Send = 6,
- k_ESteamNetworkingConfig_FakePacketReorder_Recv = 7,
- k_ESteamNetworkingConfig_FakePacketReorder_Time = 8,
- k_ESteamNetworkingConfig_FakePacketDup_Send = 26,
- k_ESteamNetworkingConfig_FakePacketDup_Recv = 27,
- k_ESteamNetworkingConfig_FakePacketDup_TimeMax = 28,
- k_ESteamNetworkingConfig_PacketTraceMaxBytes = 41,
- k_ESteamNetworkingConfig_FakeRateLimit_Send_Rate = 42,
- k_ESteamNetworkingConfig_FakeRateLimit_Send_Burst = 43,
- k_ESteamNetworkingConfig_FakeRateLimit_Recv_Rate = 44,
- k_ESteamNetworkingConfig_FakeRateLimit_Recv_Burst = 45,
- k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged = 201,
- k_ESteamNetworkingConfig_Callback_AuthStatusChanged = 202,
- k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged = 203,
- k_ESteamNetworkingConfig_Callback_MessagesSessionRequest = 204,
- k_ESteamNetworkingConfig_Callback_MessagesSessionFailed = 205,
- k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling = 206,
- k_ESteamNetworkingConfig_Callback_FakeIPResult = 207,
- k_ESteamNetworkingConfig_P2P_STUN_ServerList = 103,
- k_ESteamNetworkingConfig_P2P_Transport_ICE_Enable = 104,
- k_ESteamNetworkingConfig_P2P_Transport_ICE_Penalty = 105,
- k_ESteamNetworkingConfig_P2P_Transport_SDR_Penalty = 106,
- k_ESteamNetworkingConfig_SDRClient_ConsecutitivePingTimeoutsFailInitial = 19,
- k_ESteamNetworkingConfig_SDRClient_ConsecutitivePingTimeoutsFail = 20,
- k_ESteamNetworkingConfig_SDRClient_MinPingsBeforePingAccurate = 21,
- k_ESteamNetworkingConfig_SDRClient_SingleSocket = 22,
- k_ESteamNetworkingConfig_SDRClient_ForceRelayCluster = 29,
- k_ESteamNetworkingConfig_SDRClient_DebugTicketAddress = 30,
- k_ESteamNetworkingConfig_SDRClient_ForceProxyAddr = 31,
- k_ESteamNetworkingConfig_SDRClient_FakeClusterPing = 36,
- k_ESteamNetworkingConfig_LogLevel_AckRTT = 13,
- k_ESteamNetworkingConfig_LogLevel_PacketDecode = 14,
- k_ESteamNetworkingConfig_LogLevel_Message = 15,
- k_ESteamNetworkingConfig_LogLevel_PacketGaps = 16,
- k_ESteamNetworkingConfig_LogLevel_P2PRendezvous = 17,
- k_ESteamNetworkingConfig_LogLevel_SDRRelayPings = 18,
- k_ESteamNetworkingConfig_DELETED_EnumerateDevVars = 35,
- k_ESteamNetworkingConfigValue__Force32Bit = 0x7fffffff
-};
-
-
-typedef enum ESteamNetworkingConnectionState ESteamNetworkingConnectionState;
-enum ESteamNetworkingConnectionState
-{
- k_ESteamNetworkingConnectionState_None = 0,
- k_ESteamNetworkingConnectionState_Connecting = 1,
- k_ESteamNetworkingConnectionState_FindingRoute = 2,
- k_ESteamNetworkingConnectionState_Connected = 3,
- k_ESteamNetworkingConnectionState_ClosedByPeer = 4,
- k_ESteamNetworkingConnectionState_ProblemDetectedLocally = 5,
- k_ESteamNetworkingConnectionState_FinWait = -1,
- k_ESteamNetworkingConnectionState_Linger = -2,
- k_ESteamNetworkingConnectionState_Dead = -3,
- k_ESteamNetworkingConnectionState__Force32Bit = 0x7fffffff
-};
-
-typedef enum ESteamNetConnectionEnd ESteamNetConnectionEnd;
-enum ESteamNetConnectionEnd
-{
- k_ESteamNetConnectionEnd_Invalid = 0,
- k_ESteamNetConnectionEnd_App_Min = 1000,
- k_ESteamNetConnectionEnd_App_Generic = k_ESteamNetConnectionEnd_App_Min,
- k_ESteamNetConnectionEnd_App_Max = 1999,
- k_ESteamNetConnectionEnd_AppException_Min = 2000,
- k_ESteamNetConnectionEnd_AppException_Generic =
- k_ESteamNetConnectionEnd_AppException_Min,
- k_ESteamNetConnectionEnd_AppException_Max = 2999,
- k_ESteamNetConnectionEnd_Local_Min = 3000,
- k_ESteamNetConnectionEnd_Local_OfflineMode = 3001,
- k_ESteamNetConnectionEnd_Local_ManyRelayConnectivity = 3002,
- k_ESteamNetConnectionEnd_Local_HostedServerPrimaryRelay = 3003,
- k_ESteamNetConnectionEnd_Local_NetworkConfig = 3004,
- k_ESteamNetConnectionEnd_Local_Rights = 3005,
- k_ESteamNetConnectionEnd_Local_P2P_ICE_NoPublicAddresses = 3006,
-
- k_ESteamNetConnectionEnd_Local_Max = 3999,
- k_ESteamNetConnectionEnd_Remote_Min = 4000,
- k_ESteamNetConnectionEnd_Remote_Timeout = 4001,
- k_ESteamNetConnectionEnd_Remote_BadCrypt = 4002,
- k_ESteamNetConnectionEnd_Remote_BadCert = 4003,
- k_ESteamNetConnectionEnd_Remote_BadProtocolVersion = 4006,
- k_ESteamNetConnectionEnd_Remote_P2P_ICE_NoPublicAddresses = 4007,
-
- k_ESteamNetConnectionEnd_Remote_Max = 4999,
-
- k_ESteamNetConnectionEnd_Misc_Min = 5000,
- k_ESteamNetConnectionEnd_Misc_Generic = 5001,
- k_ESteamNetConnectionEnd_Misc_InternalError = 5002,
- k_ESteamNetConnectionEnd_Misc_Timeout = 5003,
- k_ESteamNetConnectionEnd_Misc_SteamConnectivity = 5005,
- k_ESteamNetConnectionEnd_Misc_NoRelaySessionsToClient = 5006,
- k_ESteamNetConnectionEnd_Misc_P2P_Rendezvous = 5008,
- k_ESteamNetConnectionEnd_Misc_P2P_NAT_Firewall = 5009,
- k_ESteamNetConnectionEnd_Misc_PeerSentNoConnection = 5010,
-
- k_ESteamNetConnectionEnd_Misc_Max = 5999,
- k_ESteamNetConnectionEnd__Force32Bit = 0x7fffffff
-};
-
-typedef enum ESteamNetworkingIdentityType ESteamNetworkingIdentityType;
-enum ESteamNetworkingIdentityType
-{
- k_ESteamNetworkingIdentityType_Invalid = 0,
- k_ESteamNetworkingIdentityType_SteamID = 16,
- k_ESteamNetworkingIdentityType_IPAddress = 1,
- k_ESteamNetworkingIdentityType_GenericString = 2,
- k_ESteamNetworkingIdentityType_GenericBytes = 3,
- k_ESteamNetworkingIdentityType_UnknownType = 4,
- k_ESteamNetworkingIdentityType__Force32bit = 0x7fffffff,
-};
-
-typedef enum ESteamNetworkingAvailability ESteamNetworkingAvailability;
-enum ESteamNetworkingAvailability
-{
- k_ESteamNetworkingAvailability_CannotTry = -102,
- k_ESteamNetworkingAvailability_Failed = -101,
- k_ESteamNetworkingAvailability_Previously = -100,
- k_ESteamNetworkingAvailability_Retrying = -10,
- k_ESteamNetworkingAvailability_NeverTried = 1,
- k_ESteamNetworkingAvailability_Waiting = 2,
- k_ESteamNetworkingAvailability_Attempting = 3,
- k_ESteamNetworkingAvailability_Current = 100,
- k_ESteamNetworkingAvailability_Unknown = 0,
- k_ESteamNetworkingAvailability__Force32bit = 0x7fffffff,
-};
-
-/* Handle used to identify a connection to a remote host. */
-typedef u32 HSteamNetConnection;
-HSteamNetConnection const k_HSteamNetConnection_Invalid = 0;
-
-/*
- * Handle used to identify a "listen socket". Unlike traditional
- * Berkeley sockets, a listen socket and a connection are two
- * different abstractions.
- */
-typedef u32 HSteamListenSocket;
-HSteamListenSocket const k_HSteamListenSocket_Invalid = 0;
-
-typedef u32 SteamNetworkingPOPID;
-
-#define k_cchSteamNetworkingMaxConnectionCloseReason 128
-#define k_cchSteamNetworkingMaxConnectionDescription 128
-#define k_cchSteamNetworkingMaxConnectionAppName 32
-
-#pragma pack(push,1)
-/* Store an IP and port. IPv6 is always used; IPv4 is represented using
- * "IPv4-mapped" addresses: IPv4 aa.bb.cc.dd => IPv6 ::ffff:aabb:ccdd
- * (RFC 4291 section 2.5.5.2.)
- */
-typedef struct SteamNetworkingIPAddr SteamNetworkingIPAddr;
-struct SteamNetworkingIPAddr
-{
- union
- {
- u8 m_ipv6[ 16 ];
-
- /* RFC4038, section 4.2 */
- struct IPv4MappedAddress
- {
- u64 m_8zeros;
- u16 m_0000;
- u16 m_ffff;
- u8 m_ip[ 4 ]; /* NOTE: As bytes, i.e. network byte order */
- }
- m_ipv4;
- };
-
- u16 m_port; // Host byte order
-};
-
-typedef struct SteamNetworkingIdentity SteamNetworkingIdentity;
-struct SteamNetworkingIdentity
-{
- ESteamNetworkingIdentityType m_eType;
-
- int m_cbSize;
- union
- {
- u64 m_steamID64;
- char m_szGenericString[ 32 ];
- u8 m_genericBytes[ 32 ];
- char m_szUnknownRawString[ 128 ];
- SteamNetworkingIPAddr m_ip;
- u32 m_reserved[ 32 ];
- };
-};
-
-#pragma pack(pop)
-
-/*
- * "Fake IPs" are assigned to hosts, to make it easier to interface with
- * older code that assumed all hosts will have an IPv4 address
- */
-typedef enum ESteamNetworkingFakeIPType ESteamNetworkingFakeIPType;
-enum ESteamNetworkingFakeIPType
-{
- k_ESteamNetworkingFakeIPType_Invalid,
- k_ESteamNetworkingFakeIPType_NotFake,
- k_ESteamNetworkingFakeIPType_GlobalIPv4,
- k_ESteamNetworkingFakeIPType_LocalIPv4,
- k_ESteamNetworkingFakeIPType__Force32Bit = 0x7fffffff
-};
-
-/* Set everything to zero. E.g. [::]:0 */
-void SteamAPI_SteamNetworkingIPAddr_Clear( SteamNetworkingIPAddr* self );
-
-/* Returns true if the IP is ::0. (Doesn't check port.) */
-int SteamAPI_SteamNetworkingIPAddr_IsIPv6AllZeros(
- SteamNetworkingIPAddr* self );
-
-/*
- * Set IPv6 address. IP is interpreted as bytes, so there are no endian issues.
- * (Same as inaddr_in6.) The IP can be a mapped IPv4 address
- */
-void SteamAPI_SteamNetworkingIPAddr_SetIPv6( SteamNetworkingIPAddr* self,
- u8 *ipv6, u16 nPort );
-
-/* Sets to IPv4 mapped address. IP and port are in host byte order. */
-void SteamAPI_SteamNetworkingIPAddr_SetIPv4( SteamNetworkingIPAddr* self,
- u32 nIP, u16 nPort );
-
-/* Return true if IP is mapped IPv4 */
-int SteamAPI_SteamNetworkingIPAddr_IsIPv4( SteamNetworkingIPAddr* self );
-
-/*
- * Returns IP in host byte order (e.g. aa.bb.cc.dd as 0xaabbccdd).
- * Returns 0 if IP is not mapped IPv4.
- */
-u32 SteamAPI_SteamNetworkingIPAddr_GetIPv4( SteamNetworkingIPAddr* self );
-
-/* Set to the IPv6 localhost address ::1, and the specified port. */
-void SteamAPI_SteamNetworkingIPAddr_SetIPv6LocalHost(
- SteamNetworkingIPAddr* self, u16 nPort );
-
-/*
- * Return true if this identity is localhost.
- * (Either IPv6 ::1, or IPv4 127.0.0.1)
- */
-int SteamAPI_SteamNetworkingIPAddr_IsLocalHost( SteamNetworkingIPAddr* self );
-
-/*
- * Print to a string, with or without the port. Mapped IPv4 addresses are
- * printed as dotted decimal (12.34.56.78), otherwise this will print the
- * canonical form according to RFC5952. If you include the port, IPv6 will be
- * surrounded by brackets, e.g. [::1:2]:80. Your buffer should be at least
- * k_cchMaxString bytes to avoid truncation
- *
- * See also SteamNetworkingIdentityRender
- */
-void SteamAPI_SteamNetworkingIPAddr_ToString( SteamNetworkingIPAddr* self,
- char *buf, u32 cbBuf, int 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 );
-
-/* See if two addresses are identical */
-int SteamAPI_SteamNetworkingIPAddr_IsEqualTo( SteamNetworkingIPAddr* self,
- SteamNetworkingIPAddr *x );
-
-/*
- * Classify address as FakeIP. This function never returns
- * k_ESteamNetworkingFakeIPType_Invalid.
- */
-ESteamNetworkingFakeIPType SteamAPI_SteamNetworkingIPAddr_GetFakeIPType(
- SteamNetworkingIPAddr* self );
-
-/* Return true if we are a FakeIP */
-int SteamAPI_SteamNetworkingIPAddr_IsFakeIP( SteamNetworkingIPAddr* self );
-
-
-/* Describe the state of a connection. */
-typedef struct SteamNetConnectionInfo_t SteamNetConnectionInfo_t;
-struct SteamNetConnectionInfo_t
-{
- SteamNetworkingIdentity m_identityRemote;
-
- /* Arbitrary user data set by the local application code */
- i64 m_nUserData;
-
- /* Handle to listen socket this was connected on, or
- * k_HSteamListenSocket_Invalid if we initiated the connection */
- HSteamListenSocket m_hListenSocket;
-
- /* Remote address. Might be all 0's if we don't know it, or if this is N/A.
- * (E.g. Basically everything except direct UDP connection.) */
- SteamNetworkingIPAddr m_addrRemote;
- u16 m__pad1;
-
- /* What data center is the remote host in? (0 if we don't know.) */
- SteamNetworkingPOPID m_idPOPRemote;
-
- /* What relay are we using to communicate with the remote host?
- * (0 if not applicable.) */
- SteamNetworkingPOPID m_idPOPRelay;
-
- /* High level state of the connection */
- ESteamNetworkingConnectionState m_eState;
-
- /* Basic cause of the connection termination or problem.
- * See ESteamNetConnectionEnd for the values used */
- int m_eEndReason;
-
- /*
- * Human-readable, but non-localized explanation for connection
- * termination or problem. This is intended for debugging /
- * diagnostic purposes only, not to display to users. It might
- * have some details specific to the issue.
- */
- char m_szEndDebug[ 128 ];
-
- /*
- * Debug description. This includes the internal connection ID,
- * connection type (and peer information), and any name
- * given to the connection by the app. This string is used in various
- * internal logging messages.
- *
- * Note that the connection ID *usually* matches the HSteamNetConnection
- * handle, but in certain cases with symmetric connections it might not.
- */
- char m_szConnectionDescription[ 128 ];
-
- /*
- * Misc flags. Bitmask of k_nSteamNetworkConnectionInfoFlags_Xxxx
- */
- int m_nFlags;
-
- /*
- * Internal stuff, room to change API easily
- */
- u32 reserved[63];
-};
-
-/*
- * In a few places we need to set configuration options on listen sockets and
- * connections, and have them take effect *before* the listen socket or
- * connection really starts doing anything. Creating the object and then setting
- * the options "immediately" after creation doesn't work completely, because
- * network packets could be received between the time the object is created and
- * when the options are applied. To set options at creation time in a reliable
- * way, they must be passed to the creation function. This structure is used to
- * pass those options.
- *
- * For the meaning of these fields, see ISteamNetworkingUtils::SetConfigValue.
- * Basically when the object is created, we just iterate over the list of
- * options and call ISteamNetworkingUtils::SetConfigValueStruct, where the scope
- * arguments are supplied by the object being created.
- */
-typedef struct SteamNetworkingConfigValue_t SteamNetworkingConfigValue_t;
-struct SteamNetworkingConfigValue_t
-{
- /* Which option is being set */
- ESteamNetworkingConfigValue m_eValue;
-
- /// Which field below did you fill in?
- ESteamNetworkingConfigDataType m_eDataType;
-
- /// Option value
- union
- {
- i32 m_int32;
- i64 m_int64;
- float m_float;
- const char *m_string; // Points to your '\0'-terminated buffer
- void *m_ptr;
- } m_val;
-};
-
-void SteamAPI_SteamNetworkingConfigValue_t_SetInt32(
- SteamNetworkingConfigValue_t* self,
- ESteamNetworkingConfigValue eVal, i32 data );
-
-void SteamAPI_SteamNetworkingConfigValue_t_SetInt64(
- SteamNetworkingConfigValue_t* self,
- ESteamNetworkingConfigValue eVal, i64 data );
-
-void SteamAPI_SteamNetworkingConfigValue_t_SetFloat(
- SteamNetworkingConfigValue_t* self,
- ESteamNetworkingConfigValue eVal, float data );
-
-void SteamAPI_SteamNetworkingConfigValue_t_SetPtr(
- SteamNetworkingConfigValue_t* self,
- ESteamNetworkingConfigValue eVal, void *data );
-
-void SteamAPI_SteamNetworkingConfigValue_t_SetString(
- SteamNetworkingConfigValue_t* self, ESteamNetworkingConfigValue eVal,
- const char * data );
-
-/*
- * Handle used to identify a poll group, used to query many
- * connections at once efficiently.
- */
-typedef u32 HSteamNetPollGroup;
-HSteamNetPollGroup const k_HSteamNetPollGroup_Invalid = 0;
-
-void *SteamAPI_SteamGameServerNetworkingSockets_SteamAPI_v012(void);
-void *SteamAPI_SteamGameServerNetworkingSockets_SteamAPI(void)
-{
- return SteamAPI_SteamGameServerNetworkingSockets_SteamAPI_v012();
-}
-
-
-void *SteamAPI_SteamNetworkingSockets_SteamAPI_v012();
-void *SteamAPI_SteamNetworkingSockets_SteamAPI()
-{
- return SteamAPI_SteamNetworkingSockets_SteamAPI_v012();
-}
-
-HSteamListenSocket SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP(
- void *self, SteamNetworkingIPAddr *localAddress, int nOptions,
- SteamNetworkingConfigValue_t *pOptions );
-
-HSteamNetConnection SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress(
- void *self,
- SteamNetworkingIPAddr *address, int nOptions,
- SteamNetworkingConfigValue_t *pOptions );
-
-int SteamAPI_ISteamNetworkingSockets_CloseConnection(
- void *self, HSteamNetConnection hPeer, int nReason, const char *pszDebug,
- int bEnableLinger );
-
-int SteamAPI_ISteamNetworkingSockets_CloseListenSocket(
- void *self, HSteamListenSocket hSocket );
-
-/*
- * Callbacks
- */
-
-enum { k_iSteamNetConnectionStatusChangedCallBack =
- k_iSteamNetworkingSocketsCallbacks + 1 };
-
-typedef struct SteamNetConnectionStatusChangedCallback_t
- SteamNetConnectionStatusChangedCallback_t;
-struct SteamNetConnectionStatusChangedCallback_t
-{
- /// Connection handle
- HSteamNetConnection m_hConn;
-
- /// Full connection info
- SteamNetConnectionInfo_t m_info;
-
- /// Previous state. (Current state is in m_info.m_eState)
- ESteamNetworkingConnectionState m_eOldState;
-};
-
-enum { k_iSteamNetAuthenticationStatus =
- k_iSteamNetworkingSocketsCallbacks + 2 };
-
-typedef struct SteamNetAuthenticationStatus_t SteamNetAuthenticationStatus_t;
-struct SteamNetAuthenticationStatus_t
-{
- /// Status
- ESteamNetworkingAvailability m_eAvail;
-
- /// Non-localized English language status. For diagnostic/debugging
- /// purposes only.
- char m_debugMsg[ 256 ];
-};
-
-#pragma pack(pop)
-#endif /* VG_STEAM_NETWORKING_H */