diff --git a/Generator/steam_sdk/isteamnetworking.h b/Generator/steam_sdk/isteamnetworking.h index bdf53a1..2f14d27 100644 --- a/Generator/steam_sdk/isteamnetworking.h +++ b/Generator/steam_sdk/isteamnetworking.h @@ -120,6 +120,10 @@ enum ESNetSocketConnectionType //----------------------------------------------------------------------------- // Purpose: Functions for making connections and sending data between clients, // traversing NAT's where possible +// +// NOTE: This interface is deprecated and may be removed in a future release of +/// the Steamworks SDK. Please see ISteamNetworkingSockets and +/// ISteamNetworkingMessages //----------------------------------------------------------------------------- class ISteamNetworking { @@ -133,6 +137,9 @@ public: // Both interface styles can send both reliable and unreliable messages. // // Automatically establishes NAT-traversing or Relay server connections + // + // These APIs are deprecated, and may be removed in a future version of the Steamworks + // SDK. See ISteamNetworkingMessages. // Sends a P2P packet to the specified user // UDP-like, unreliable and a max packet size of 1200 bytes @@ -181,6 +188,10 @@ public: // or to existing connections that need to automatically reconnect after this value is set. // // P2P packet relay is allowed by default + // + // NOTE: This function is deprecated and may be removed in a future version of the SDK. For + // security purposes, we may decide to relay the traffic to certain peers, even if you pass false + // to this function, to prevent revealing the client's IP address top another peer. virtual bool AllowP2PPacketRelay( bool bAllow ) = 0; @@ -198,6 +209,9 @@ public: // // Both methods can send both reliable and unreliable methods. // + // These APIs are deprecated, and may be removed in a future version of the Steamworks + // SDK. See ISteamNetworkingSockets. + // //////////////////////////////////////////////////////////////////////////////////////////// diff --git a/Generator/steam_sdk/isteamnetworkingmessages.h b/Generator/steam_sdk/isteamnetworkingmessages.h new file mode 100644 index 0000000..a23a386 --- /dev/null +++ b/Generator/steam_sdk/isteamnetworkingmessages.h @@ -0,0 +1,184 @@ +//====== Copyright Valve Corporation, All rights reserved. ==================== + +#ifndef ISTEAMNETWORKINGMESSAGES +#define ISTEAMNETWORKINGMESSAGES +#pragma once + +#include "steamnetworkingtypes.h" + +//----------------------------------------------------------------------------- +/// The non-connection-oriented interface to send and receive messages +/// (whether they be "clients" or "servers"). +/// +/// ISteamNetworkingSockets is connection-oriented (like TCP), meaning you +/// need to listen and connect, and then you send messages using a connection +/// handle. ISteamNetworkingMessages is more like UDP, in that you can just send +/// messages to arbitrary peers at any time. The underlying connections are +/// established implicitly. +/// +/// Under the hood ISteamNetworkingMessages works on top of the ISteamNetworkingSockets +/// code, so you get the same routing and messaging efficiency. The difference is +/// mainly in your responsibility to explicitly establish a connection and +/// the type of feedback you get about the state of the connection. Both +/// interfaces can do "P2P" communications, and both support both unreliable +/// and reliable messages, fragmentation and reassembly. +/// +/// The primary purpose of this interface is to be "like UDP", so that UDP-based code +/// can be ported easily to take advantage of relayed connections. If you find +/// yourself needing more low level information or control, or to be able to better +/// handle failure, then you probably need to use ISteamNetworkingSockets directly. +/// Also, note that if your main goal is to obtain a connection between two peers +/// without concerning yourself with assigning roles of "client" and "server", +/// you may find the symmetric connection mode of ISteamNetworkingSockets useful. +/// (See k_ESteamNetworkingConfig_SymmetricConnect.) +/// +class ISteamNetworkingMessages +{ +public: + /// Sends a message to the specified host. If we don't already have a session with that user, + /// a session is implicitly created. There might be some handshaking that needs to happen + /// before we can actually begin sending message data. If this handshaking fails and we can't + /// get through, an error will be posted via the callback SteamNetworkingMessagesSessionFailed_t. + /// There is no notification when the operation succeeds. (You should have the peer send a reply + /// for this purpose.) + /// + /// Sending a message to a host will also implicitly accept any incoming connection from that host. + /// + /// nSendFlags is a bitmask of k_nSteamNetworkingSend_xxx options + /// + /// nRemoteChannel is a routing number you can use to help route message to different systems. + /// You'll have to call ReceiveMessagesOnChannel() with the same channel number in order to retrieve + /// the data on the other end. + /// + /// Using different channels to talk to the same user will still use the same underlying + /// connection, saving on resources. If you don't need this feature, use 0. + /// Otherwise, small integers are the most efficient. + /// + /// It is guaranteed that reliable messages to the same host on the same channel + /// will be be received by the remote host (if they are received at all) exactly once, + /// and in the same order that they were send. + /// + /// NO other order guarantees exist! In particular, unreliable messages may be dropped, + /// received out of order with respect to each other and with respect to reliable data, + /// or may be received multiple times. Messages on different channels are *not* guaranteed + /// to be received in the order they were sent. + /// + /// A note for those familiar with TCP/IP ports, or converting an existing codebase that + /// opened multiple sockets: You might notice that there is only one channel, and with + /// TCP/IP each endpoint has a port number. You can think of the channel number as the + /// *destination* port. If you need each message to also include a "source port" (so the + /// recipient can route the reply), then just put that in your message. That is essentially + /// how UDP works! + /// + /// Returns: + /// - k_EREsultOK on success. + /// - k_EResultNoConnection will be returned if the session has failed or was closed by the peer, + /// and k_nSteamNetworkingSend_AutoRestartBrokwnSession is not used. (You can use + /// GetSessionConnectionInfo to get the details.) In order to acknowledge the broken session + /// and start a new one, you must call CloseSessionWithUser + /// - See SendMessageToConnection::SendMessageToConnection for more + virtual EResult SendMessageToUser( const SteamNetworkingIdentity &identityRemote, const void *pubData, uint32 cubData, int nSendFlags, int nRemoteChannel ) = 0; + + /// Reads the next message that has been sent from another user via SendMessageToUser() on the given channel. + /// Returns number of messages returned into your list. (0 if no message are available on that channel.) + /// + /// When you're done with the message object(s), make sure and call Release()! + virtual int ReceiveMessagesOnChannel( int nLocalChannel, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0; + + /// AcceptSessionWithUser() should only be called in response to a SteamP2PSessionRequest_t callback + /// SteamP2PSessionRequest_t will be posted if another user tries to send you a message, and you haven't + /// tried to talk to them. If you don't want to talk to them, just ignore the request. + /// If the user continues to send you messages, SteamP2PSessionRequest_t callbacks will continue to + /// be posted periodically. This may be called multiple times for a single user. + /// + /// Calling SendMessage() on the other user, this implicitly accepts any pending session request. + virtual bool AcceptSessionWithUser( const SteamNetworkingIdentity &identityRemote ) = 0; + + /// Call this when you're done talking to a user to immediately free up resources under-the-hood. + /// If the remote user tries to send data to you again, another P2PSessionRequest_t callback will + /// be posted. + /// + /// Note that sessions that go unused for a few minutes are automatically timed out. + virtual bool CloseSessionWithUser( const SteamNetworkingIdentity &identityRemote ) = 0; + + /// Call this when you're done talking to a user on a specific channel. Once all + /// open channels to a user have been closed, the open session to the user will be + /// closed, and any new data from this user will trigger a SteamP2PSessionRequest_t + /// callback + virtual bool CloseChannelWithUser( const SteamNetworkingIdentity &identityRemote, int nLocalChannel ) = 0; + + /// Returns information about the latest state of a connection, if any, with the given peer. + /// Primarily intended for debugging purposes, but can also be used to get more detailed + /// failure information. (See SendMessageToUser and k_nSteamNetworkingSend_AutoRestartBrokwnSession.) + /// + /// Returns the value of SteamNetConnectionInfo_t::m_eState, or k_ESteamNetworkingConnectionState_None + /// if no connection exists with specified peer. You may pass nullptr for either parameter if + /// you do not need the corresponding details. Note that sessions time out after a while, + /// so if a connection fails, or SendMessageToUser returns SendMessageToUser, you cannot wait + /// indefinitely to obtain the reason for failure. + virtual ESteamNetworkingConnectionState GetSessionConnectionInfo( const SteamNetworkingIdentity &identityRemote, SteamNetConnectionInfo_t *pConnectionInfo, SteamNetworkingQuickConnectionStatus *pQuickStatus ) = 0; +}; +#define STEAMNETWORKINGMESSAGES_VERSION "SteamNetworkingMessages002" + +// +// Callbacks +// + +#pragma pack( push, 1 ) + +/// Posted when a remote host is sending us a message, and we do not already have a session with them +struct SteamNetworkingMessagesSessionRequest_t +{ + enum { k_iCallback = k_iSteamNetworkingMessagesCallbacks + 1 }; + SteamNetworkingIdentity m_identityRemote; // user who wants to talk to us +}; + +/// Posted when we fail to establish a connection, or we detect that communications +/// have been disrupted it an unusual way. There is no notification when a peer proactively +/// closes the session. ("Closed by peer" is not a concept of UDP-style communications, and +/// SteamNetworkingMessages is primarily intended to make porting UDP code easy.) +/// +/// Remember: callbacks are asynchronous. See notes on SendMessageToUser, +/// and k_nSteamNetworkingSend_AutoRestartBrokwnSession in particular. +/// +/// Also, if a session times out due to inactivity, no callbacks will be posted. The only +/// way to detect that this is happening is that querying the session state may return +/// none, connecting, and findingroute again. +struct SteamNetworkingMessagesSessionFailed_t +{ + enum { k_iCallback = k_iSteamNetworkingMessagesCallbacks + 2 }; + + /// Detailed info about the connection. This will include the + SteamNetConnectionInfo_t m_info; +}; + +#pragma pack(pop) + +// +// Global accessor +// + +#if defined( STEAMNETWORKINGSOCKETS_PARTNER ) + + // Standalone lib. Use different symbol name, so that we can dynamically switch between steamclient.dll + // and the standalone lib + STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamNetworkingMessages_Lib(); + STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamGameServerNetworkingMessages_Lib(); + inline ISteamNetworkingMessages *SteamNetworkingMessages() { return SteamNetworkingMessages_Lib(); } + inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages() { return SteamGameServerNetworkingMessages_Lib(); } + +#elif defined( STEAMNETWORKINGSOCKETS_OPENSOURCE ) + + // Opensource GameNetworkingSockets + STEAMNETWORKINGSOCKETS_INTERFACE ISteamNetworkingMessages *SteamNetworkingMessages(); + +#else + + // Steamworks SDK + inline ISteamNetworkingMessages *SteamNetworkingMessages(); + STEAM_DEFINE_USER_INTERFACE_ACCESSOR( ISteamNetworkingMessages *, SteamNetworkingMessages, STEAMNETWORKINGMESSAGES_VERSION ); + inline ISteamNetworkingMessages *SteamGameServerNetworkingMessages(); + STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR( ISteamNetworkingMessages *, SteamGameServerNetworkingMessages, STEAMNETWORKINGMESSAGES_VERSION ); +#endif + +#endif // ISTEAMNETWORKINGMESSAGES diff --git a/Generator/steam_sdk/isteamnetworkingsockets.h b/Generator/steam_sdk/isteamnetworkingsockets.h index 9770ec3..904ec4b 100644 --- a/Generator/steam_sdk/isteamnetworkingsockets.h +++ b/Generator/steam_sdk/isteamnetworkingsockets.h @@ -1,16 +1,4 @@ //====== Copyright Valve Corporation, All rights reserved. ==================== -// -// Networking API similar to Berkeley sockets, but for games. -// - connection-oriented API (like TCP, not UDP) -// - but unlike TCP, it's message-oriented, not stream-oriented -// - mix of reliable and unreliable messages -// - fragmentation and reassembly -// - Supports connectivity over plain UDPv4 -// - Also supports SDR ("Steam Datagram Relay") connections, which are -// addressed by SteamID. There is a "P2P" use case and also a "hosted -// dedicated server" use case. -// -//============================================================================= #ifndef ISTEAMNETWORKINGSOCKETS #define ISTEAMNETWORKINGSOCKETS @@ -20,24 +8,33 @@ #include "steamnetworkingtypes.h" -class ISteamNetworkingSocketsCallbacks; struct SteamNetAuthenticationStatus_t; class ISteamNetworkingConnectionCustomSignaling; class ISteamNetworkingCustomSignalingRecvContext; //----------------------------------------------------------------------------- -/// Lower level networking interface that more closely mirrors the standard -/// Berkeley sockets model. Sockets are hard! You should probably only use -/// this interface under the existing circumstances: +/// Lower level networking API. /// -/// - You have an existing socket-based codebase you want to port, or coexist with. -/// - You want to be able to connect based on IP address, rather than (just) Steam ID. -/// - You need low-level control of bandwidth utilization, when to drop packets, etc. +/// - Connection-oriented API (like TCP, not UDP). When sending and receiving +/// messages, a connection handle is used. (For a UDP-style interface, see +/// ISteamNetworkingMessages.) In this TCP-style interface, the "server" will +/// "listen" on a "listen socket." A "client" will "connect" to the server, +/// and the server will "accept" the connection. +/// - But unlike TCP, it's message-oriented, not stream-oriented. +/// - Mix of reliable and unreliable messages +/// - Fragmentation and reassembly +/// - Supports connectivity over plain UDP +/// - Also supports SDR ("Steam Datagram Relay") connections, which are +/// addressed by the identity of the peer. There is a "P2P" use case and +/// a "hosted dedicated server" use case. /// -/// Note that neither of the terms "connection" and "socket" will correspond +/// Note that neither of the terms "connection" nor "socket" necessarily correspond /// one-to-one with an underlying UDP socket. An attempt has been made to /// keep the semantics as similar to the standard socket model when appropriate, /// but some deviations do exist. +/// +/// See also: ISteamNetworkingMessages, the UDP-style interface. This API might be +/// easier to use, especially when porting existing UDP code. class ISteamNetworkingSockets { public: @@ -87,14 +84,13 @@ public: /// setting the options "immediately" after creation. virtual HSteamNetConnection ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; -#ifdef STEAMNETWORKINGSOCKETS_ENABLE_SDR /// Like CreateListenSocketIP, but clients will connect using ConnectP2P /// - /// nVirtualPort specifies how clients can connect to this socket using + /// nLocalVirtualPort specifies how clients can connect to this socket using /// ConnectP2P. It's very common for applications to only have one listening socket; /// in that case, use zero. If you need to open multiple listen sockets and have clients - /// be able to connect to one or the other, then nVirtualPort should be a small integer (<1000) - /// unique to each listen socket you create. + /// be able to connect to one or the other, then nLocalVirtualPort should be a small + /// integer (<1000) unique to each listen socket you create. /// /// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess() /// when your app initializes @@ -102,21 +98,16 @@ public: /// If you need to set any initial config options, pass them here. See /// SteamNetworkingConfigValue_t for more about why this is preferable to /// setting the options "immediately" after creation. - virtual HSteamListenSocket CreateListenSocketP2P( int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; + virtual HSteamListenSocket CreateListenSocketP2P( int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; - /// Begin connecting to a server that is identified using a platform-specific identifier. + /// Begin connecting to a peer that is identified using a platform-specific identifier. /// This uses the default rendezvous service, which depends on the platform and library - /// configuration. (E.g. on Steam, it goes through the steam backend.) The traffic is relayed - /// over the Steam Datagram Relay network. - /// - /// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess() - /// when your app initializes + /// configuration. (E.g. on Steam, it goes through the steam backend.) /// /// If you need to set any initial config options, pass them here. See /// SteamNetworkingConfigValue_t for more about why this is preferable to /// setting the options "immediately" after creation. - virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; -#endif + virtual HSteamNetConnection ConnectP2P( const SteamNetworkingIdentity &identityRemote, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; /// Accept an incoming connection that has been received on a listen socket. /// @@ -465,7 +456,7 @@ public: /// /// Typically this is useful just to confirm that you have a ticket, before you /// call ConnectToHostedDedicatedServer to connect to the server. - virtual int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0; + virtual int FindRelayAuthTicketForServer( const SteamNetworkingIdentity &identityGameServer, int nRemoteVirtualPort, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0; /// Client call to connect to a server hosted in a Valve data center, on the specified virtual /// port. You must have placed a ticket for this server into the cache, or else this connect attempt will fail! @@ -480,7 +471,7 @@ public: /// If you need to set any initial config options, pass them here. See /// SteamNetworkingConfigValue_t for more about why this is preferable to /// setting the options "immediately" after creation. - virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; + virtual HSteamNetConnection ConnectToHostedDedicatedServer( const SteamNetworkingIdentity &identityTarget, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; // // Servers hosted in data centers known to the Valve relay network @@ -536,7 +527,7 @@ public: /// If you need to set any initial config options, pass them here. See /// SteamNetworkingConfigValue_t for more about why this is preferable to /// setting the options "immediately" after creation. - virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; + virtual HSteamListenSocket CreateHostedDedicatedServerListenSocket( int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; /// Generate an authentication blob that can be used to securely login with /// your backend, using SteamDatagram_ParseHostedServerLogin. (See @@ -569,6 +560,7 @@ public: /// NOTE: The routing blob returned here is not encrypted. Send it to your backend /// and don't share it directly with clients. virtual EResult GetGameCoordinatorServerLogin( SteamDatagramGameCoordinatorServerLogin *pLoginInfo, int *pcbSignedBlob, void *pBlob ) = 0; +#endif // #ifndef STEAMNETWORKINGSOCKETS_ENABLE_SDR // @@ -611,7 +603,7 @@ public: /// If you need to set any initial config options, pass them here. See /// SteamNetworkingConfigValue_t for more about why this is preferable to /// setting the options "immediately" after creation. - virtual HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionCustomSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; + virtual HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionCustomSignaling *pSignaling, const SteamNetworkingIdentity *pPeerIdentity, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0; /// Called when custom signaling has received a message. When your /// signaling channel receives a message, it should save off whatever @@ -643,7 +635,6 @@ public: /// If you expect to be using relayed connections, then you probably want /// to call ISteamNetworkingUtils::InitRelayNetworkAccess() when your app initializes virtual bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingCustomSignalingRecvContext *pContext ) = 0; -#endif // #ifndef STEAMNETWORKINGSOCKETS_ENABLE_SDR // // Certificate provision by the application. On Steam, we normally handle all this automatically @@ -662,94 +653,16 @@ public: /// SteamDatagram_CreateCert. virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) = 0; - // Invoke all callbacks queued for this interface. - // On Steam, callbacks are dispatched via the ordinary Steamworks callbacks mechanism. - // So if you have code that is also targeting Steam, you should call this at about the - // same time you would call SteamAPI_RunCallbacks and SteamGameServer_RunCallbacks. -#ifdef STEAMNETWORKINGSOCKETS_STANDALONELIB - virtual void RunCallbacks( ISteamNetworkingSocketsCallbacks *pCallbacks ) = 0; -#endif + /// Invoke all callback functions queued for this interface. + /// See k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, etc + /// + /// You don't need to call this if you are using Steam's callback dispatch + /// mechanism (SteamAPI_RunCallbacks and SteamGameserver_RunCallbacks). + virtual void RunCallbacks() = 0; protected: ~ISteamNetworkingSockets(); // Silence some warnings }; -#define STEAMNETWORKINGSOCKETS_INTERFACE_VERSION "SteamNetworkingSockets008" - -/// Interface used to send signaling messages for a particular connection. -/// You will need to construct one of these per connection. -/// -/// - For connections initiated locally, you will construct it and pass -/// it to ISteamNetworkingSockets::ConnectP2PCustomSignaling. -/// - For connections initiated remotely and "accepted" locally, you -/// will return it from ISteamNetworkingCustomSignalingRecvContext::OnConnectRequest -class ISteamNetworkingConnectionCustomSignaling -{ -public: - /// Called to send a rendezvous message to the remote peer. This may be called - /// from any thread, at any time, so you need to be thread-safe! Don't take - /// any locks that might hold while calling into SteamNetworkingSockets functions, - /// because this could lead to deadlocks. - /// - /// Note that when initiating a connection, we may not know the identity - /// of the peer, if you did not specify it in ConnectP2PCustomSignaling. - /// - /// Return true if a best-effort attempt was made to deliver the message. - /// If you return false, it is assumed that the situation is fatal; - /// the connection will be closed, and Release() will be called - /// eventually. - /// - /// Signaling objects will not be shared between connections. - /// You can assume that the same value of hConn will be used - /// every time. - virtual bool SendSignal( HSteamNetConnection hConn, const SteamNetConnectionInfo_t &info, const void *pMsg, int cbMsg ) = 0; - - /// Called when the connection no longer needs to send signals. - /// Note that this happens eventually (but not immediately) after - /// the connection is closed. Signals may need to be sent for a brief - /// time after the connection is closed, to clean up the connection. - virtual void Release() = 0; -}; - -/// Interface used when a custom signal is received. -/// See ISteamNetworkingSockets::ReceivedP2PCustomSignal -class ISteamNetworkingCustomSignalingRecvContext -{ -public: - - /// Called when the signal represents a request for a new connection. - /// - /// If you want to ignore the request, just return NULL. In this case, - /// the peer will NOT receive any reply. You should consider ignoring - /// requests rather than actively rejecting them, as a security measure. - /// If you actively reject requests, then this makes it possible to detect - /// if a user is online or not, just by sending them a request. - /// - /// If you wish to send back a rejection, then use - /// ISteamNetworkingSockets::CloseConnection() and then return NULL. - /// We will marshal a properly formatted rejection signal and - /// call SendRejectionSignal() so you can send it to them. - /// - /// If you return a signaling object, the connection is NOT immediately - /// accepted by default. Instead, it stays in the "connecting" state, - /// and the usual callback is posted, and your app can accept the - /// connection using ISteamNetworkingSockets::AcceptConnection. This - /// may be useful so that these sorts of connections can be more similar - /// to your application code as other types of connections accepted on - /// a listen socket. If this is not useful and you want to skip this - /// callback process and immediately accept the connection, call - /// ISteamNetworkingSockets::AcceptConnection before returning the - /// signaling object. - /// - /// After accepting a connection (through either means), the connection - /// will transition into the "finding route" state. - virtual ISteamNetworkingConnectionCustomSignaling *OnConnectRequest( HSteamNetConnection hConn, const SteamNetworkingIdentity &identityPeer ) = 0; - - /// This is called actively communication rejection or failure - /// to the incoming message. If you intend to ignore all incoming requests - /// that you do not wish to accept, then it's not strictly necessary to - /// implement this. - virtual void SendRejectionSignal( const SteamNetworkingIdentity &identityPeer, const void *pMsg, int cbMsg ) = 0; -}; - +#define STEAMNETWORKINGSOCKETS_INTERFACE_VERSION "SteamNetworkingSockets009" // Global accessor. #if defined( STEAMNETWORKINGSOCKETS_PARTNER ) diff --git a/Generator/steam_sdk/isteamnetworkingutils.h b/Generator/steam_sdk/isteamnetworkingutils.h index 2640c48..0f15f73 100644 --- a/Generator/steam_sdk/isteamnetworkingutils.h +++ b/Generator/steam_sdk/isteamnetworkingutils.h @@ -254,10 +254,23 @@ public: bool SetGlobalConfigValueInt32( ESteamNetworkingConfigValue eValue, int32 val ); bool SetGlobalConfigValueFloat( ESteamNetworkingConfigValue eValue, float val ); bool SetGlobalConfigValueString( ESteamNetworkingConfigValue eValue, const char *val ); + bool SetGlobalConfigValuePtr( ESteamNetworkingConfigValue eValue, void *val ); bool SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val ); bool SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val ); bool SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val ); + // + // Set global callbacks. If you do not want to use Steam's callback dispatch mechanism and you + // want to use the same callback on all (or most) listen sockets and connections, then + // simply install these callbacks first thing, and you are good to go. + // See ISteamNetworkingSockets::RunCallbacks + // + bool SetGlobalCallback_SteamNetConnectionStatusChanged( FnSteamNetConnectionStatusChanged fnCallback ); + bool SetGlobalCallback_SteamNetAuthenticationStatusChanged( FnSteamNetAuthenticationStatusChanged fnCallback ); + bool SetGlobalCallback_SteamRelayNetworkStatusChanged( FnSteamRelayNetworkStatusChanged fnCallback ); + bool SetGlobalCallback_MessagesSessionRequest( FnSteamNetworkingMessagesSessionRequest fnCallback ); + bool SetGlobalCallback_MessagesSessionFailed( FnSteamNetworkingMessagesSessionFailed fnCallback ); + /// Set a configuration value. /// - eValue: which value is being set /// - eScope: Onto what type of object are you applying the setting? @@ -266,7 +279,7 @@ public: /// - pArg: Value to set it to. You can pass NULL to remove a non-global setting at this scope, /// causing the value for that object to use global defaults. Or at global scope, passing NULL /// will reset any custom value and restore it to the system default. - /// NOTE: When setting callback functions, do not pass the function pointer directly. + /// NOTE: When setting pointers (e.g. callback functions), do not pass the function pointer directly. /// Your argument should be a pointer to a function pointer. virtual bool SetConfigValue( ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj, ESteamNetworkingConfigDataType eDataType, const void *pArg ) = 0; @@ -398,13 +411,22 @@ inline void ISteamNetworkingUtils::InitRelayNetworkAccess() { CheckPingDataUpToD inline bool ISteamNetworkingUtils::SetGlobalConfigValueInt32( ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Int32, &val ); } inline bool ISteamNetworkingUtils::SetGlobalConfigValueFloat( ESteamNetworkingConfigValue eValue, float val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Float, &val ); } inline bool ISteamNetworkingUtils::SetGlobalConfigValueString( ESteamNetworkingConfigValue eValue, const char *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_String, val ); } +inline bool ISteamNetworkingUtils::SetGlobalConfigValuePtr( ESteamNetworkingConfigValue eValue, void *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Global, 0, k_ESteamNetworkingConfig_Ptr, &val ); } // Note: passing pointer to pointer. inline bool ISteamNetworkingUtils::SetConnectionConfigValueInt32( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Int32, &val ); } inline bool ISteamNetworkingUtils::SetConnectionConfigValueFloat( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_Float, &val ); } inline bool ISteamNetworkingUtils::SetConnectionConfigValueString( HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char *val ) { return SetConfigValue( eValue, k_ESteamNetworkingConfig_Connection, hConn, k_ESteamNetworkingConfig_String, val ); } +inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamNetConnectionStatusChanged( FnSteamNetConnectionStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, (void*)fnCallback ); } +inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamNetAuthenticationStatusChanged( FnSteamNetAuthenticationStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_AuthStatusChanged, (void*)fnCallback ); } +inline bool ISteamNetworkingUtils::SetGlobalCallback_SteamRelayNetworkStatusChanged( FnSteamRelayNetworkStatusChanged fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged, (void*)fnCallback ); } +inline bool ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionRequest( FnSteamNetworkingMessagesSessionRequest fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_MessagesSessionRequest, (void*)fnCallback ); } +inline bool ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionFailed( FnSteamNetworkingMessagesSessionFailed fnCallback ) { return SetGlobalConfigValuePtr( k_ESteamNetworkingConfig_Callback_MessagesSessionFailed, (void*)fnCallback ); } + inline bool ISteamNetworkingUtils::SetConfigValueStruct( const SteamNetworkingConfigValue_t &opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj ) { // Locate the argument. Strings are a special case, since the // "value" (the whole string buffer) doesn't fit in the struct + // NOTE: for pointer values, we pass a pointer to the pointer, + // we do not pass the pointer directly. const void *pVal = ( opt.m_eDataType == k_ESteamNetworkingConfig_String ) ? (const void *)opt.m_val.m_string : (const void *)&opt.m_val; return SetConfigValue( opt.m_eValue, eScopeType, scopeObj, opt.m_eDataType, pVal ); } diff --git a/Generator/steam_sdk/isteamutils.h b/Generator/steam_sdk/isteamutils.h index 3f6d027..b19526f 100644 --- a/Generator/steam_sdk/isteamutils.h +++ b/Generator/steam_sdk/isteamutils.h @@ -41,6 +41,17 @@ enum EGamepadTextInputLineMode k_EGamepadTextInputLineModeMultipleLines = 1 }; + +// The context where text filtering is being done +enum ETextFilteringContext +{ + k_ETextFilteringContextUnknown = 0, // Unknown context + k_ETextFilteringContextGameContent = 1, // Game content, only legally required filtering is performed + k_ETextFilteringContextChat = 2, // Chat from another player + k_ETextFilteringContextName = 3, // Character or item name +}; + + // function prototype for warning message hook #if defined( POSIX ) #define __cdecl @@ -173,23 +184,25 @@ public: virtual bool IsSteamChinaLauncher() = 0; // Initializes text filtering. - // Returns false if filtering is unavailable for the language the user is currently running in. - virtual bool InitFilterText() = 0; + // unFilterOptions are reserved for future use and should be set to 0 + // Returns false if filtering is unavailable for the language the user is currently running in. + virtual bool InitFilterText( uint32 unFilterOptions = 0 ) = 0; - // Filters the provided input message and places the filtered result into pchOutFilteredText. - // pchOutFilteredText is where the output will be placed, even if no filtering or censoring is performed - // nByteSizeOutFilteredText is the size (in bytes) of pchOutFilteredText + // Filters the provided input message and places the filtered result into pchOutFilteredText, using legally required filtering and additional filtering based on the context and user settings + // eContext is the type of content in the input string + // sourceSteamID is the Steam ID that is the source of the input string (e.g. the player with the name, or who said the chat text) // pchInputText is the input string that should be filtered, which can be ASCII or UTF-8 - // bLegalOnly should be false if you want profanity and legally required filtering (where required) and true if you want legally required filtering only - // Returns the number of characters (not bytes) filtered. - virtual int FilterText( char* pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly ) = 0; + // pchOutFilteredText is where the output will be placed, even if no filtering is performed + // nByteSizeOutFilteredText is the size (in bytes) of pchOutFilteredText, should be at least strlen(pchInputText)+1 + // Returns the number of characters (not bytes) filtered + virtual int FilterText( ETextFilteringContext eContext, CSteamID sourceSteamID, const char *pchInputMessage, char *pchOutFilteredText, uint32 nByteSizeOutFilteredText ) = 0; // Return what we believe your current ipv6 connectivity to "the internet" is on the specified protocol. // This does NOT tell you if the Steam client is currently connected to Steam via ipv6. virtual ESteamIPv6ConnectivityState GetIPv6ConnectivityState( ESteamIPv6ConnectivityProtocol eProtocol ) = 0; }; -#define STEAMUTILS_INTERFACE_VERSION "SteamUtils009" +#define STEAMUTILS_INTERFACE_VERSION "SteamUtils010" // Global interface accessor inline ISteamUtils *SteamUtils(); diff --git a/Generator/steam_sdk/steam_api.h b/Generator/steam_sdk/steam_api.h index 80d5740..494f1dd 100644 --- a/Generator/steam_sdk/steam_api.h +++ b/Generator/steam_sdk/steam_api.h @@ -43,6 +43,7 @@ #include "isteamparentalsettings.h" #include "isteaminput.h" #include "isteamremoteplay.h" +#include "isteamnetworkingmessages.h" #include "isteamnetworkingsockets.h" #include "isteamnetworkingutils.h" diff --git a/Generator/steam_sdk/steam_api.json b/Generator/steam_sdk/steam_api.json index 164ccc0..5574388 100644 --- a/Generator/steam_sdk/steam_api.json +++ b/Generator/steam_sdk/steam_api.json @@ -1623,19 +1623,6 @@ { "fieldname":"m_unVideoAppID", "fieldtype":"AppId_t" } ], "struct": "GetOPFSettingsResult_t" - }, { - "callback_id": 4604, - "fields": [ - { "fieldname":"m_bIsRTMP", "fieldtype":"bool" } - ], - "struct": "BroadcastUploadStart_t" - }, - { - "callback_id": 4605, - "fields": [ - { "fieldname":"m_eResult", "fieldtype":"EBroadcastUploadResult" } - ], - "struct": "BroadcastUploadStop_t" }, { "callback_id": 5001, @@ -1656,6 +1643,20 @@ ], "struct": "SteamRemotePlaySessionDisconnected_t" }, + { + "callback_id": 1251, + "fields": [ + { "fieldname":"m_identityRemote", "fieldtype":"SteamNetworkingIdentity" } + ], + "struct": "SteamNetworkingMessagesSessionRequest_t" + }, + { + "callback_id": 1252, + "fields": [ + { "fieldname":"m_info", "fieldtype":"SteamNetConnectionInfo_t" } + ], + "struct": "SteamNetworkingMessagesSessionFailed_t" + }, { "callback_id": 1221, "fields": [ @@ -1879,6 +1880,7 @@ { "constname":"k_nSteamNetworkingSend_Reliable", "consttype":"int", "constval":"8" }, { "constname":"k_nSteamNetworkingSend_ReliableNoNagle", "consttype":"int", "constval":"k_nSteamNetworkingSend_Reliable | k_nSteamNetworkingSend_NoNagle" }, { "constname":"k_nSteamNetworkingSend_UseCurrentThread", "consttype":"int", "constval":"16" }, + { "constname":"k_nSteamNetworkingSend_AutoRestartBrokenSession", "consttype":"int", "constval":"32" }, { "constname":"k_cchMaxSteamNetworkingPingLocationString", "consttype":"int", "constval":"1024" }, { "constname":"k_nSteamNetworkingPing_Failed", "consttype":"int", "constval":"- 1" }, { "constname":"k_nSteamNetworkingPing_Unknown", "consttype":"int", "constval":"- 2" }, @@ -2566,6 +2568,15 @@ { "name":"k_EGamepadTextInputLineModeMultipleLines", "value":"1" } ] }, + { + "enumname": "ETextFilteringContext", + "values": [ + { "name":"k_ETextFilteringContextUnknown", "value":"0" }, + { "name":"k_ETextFilteringContextGameContent", "value":"1" }, + { "name":"k_ETextFilteringContextChat", "value":"2" }, + { "name":"k_ETextFilteringContextName", "value":"3" } + ] + }, { "enumname": "ECheckFileSignature", "values": [ @@ -3754,6 +3765,7 @@ { "name":"k_ESteamNetConnectionEnd_Misc_NoRelaySessionsToClient", "value":"5006" }, { "name":"k_ESteamNetConnectionEnd_Misc_P2P_Rendezvous", "value":"5008" }, { "name":"k_ESteamNetConnectionEnd_Misc_P2P_NAT_Firewall", "value":"5009" }, + { "name":"k_ESteamNetConnectionEnd_Misc_PeerSentNoConnection", "value":"5010" }, { "name":"k_ESteamNetConnectionEnd_Misc_Max", "value":"5999" }, { "name":"k_ESteamNetConnectionEnd__Force32Bit", "value":"2147483647" } ] @@ -3789,7 +3801,7 @@ { "name":"k_ESteamNetworkingConfig_Int64", "value":"2" }, { "name":"k_ESteamNetworkingConfig_Float", "value":"3" }, { "name":"k_ESteamNetworkingConfig_String", "value":"4" }, - { "name":"k_ESteamNetworkingConfig_FunctionPtr", "value":"5" }, + { "name":"k_ESteamNetworkingConfig_Ptr", "value":"5" }, { "name":"k_ESteamNetworkingConfigDataType__Force32Bit", "value":"2147483647" } ] }, @@ -3818,6 +3830,13 @@ { "name":"k_ESteamNetworkingConfig_MTU_DataSize", "value":"33" }, { "name":"k_ESteamNetworkingConfig_Unencrypted", "value":"34" }, { "name":"k_ESteamNetworkingConfig_EnumerateDevVars", "value":"35" }, + { "name":"k_ESteamNetworkingConfig_SymmetricConnect", "value":"37" }, + { "name":"k_ESteamNetworkingConfig_LocalVirtualPort", "value":"38" }, + { "name":"k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged", "value":"201" }, + { "name":"k_ESteamNetworkingConfig_Callback_AuthStatusChanged", "value":"202" }, + { "name":"k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged", "value":"203" }, + { "name":"k_ESteamNetworkingConfig_Callback_MessagesSessionRequest", "value":"204" }, + { "name":"k_ESteamNetworkingConfig_Callback_MessagesSessionFailed", "value":"205" }, { "name":"k_ESteamNetworkingConfig_P2P_STUN_ServerList", "value":"103" }, { "name":"k_ESteamNetworkingConfig_P2P_Transport_ICE_Enable", "value":"104" }, { "name":"k_ESteamNetworkingConfig_P2P_Transport_ICE_Penalty", "value":"105" }, @@ -5170,12 +5189,12 @@ { "kind": "user", "name": "SteamUtils", - "name_flat": "SteamAPI_SteamUtils_v009" + "name_flat": "SteamAPI_SteamUtils_v010" }, { "kind": "gameserver", "name": "SteamGameServerUtils", - "name_flat": "SteamAPI_SteamGameServerUtils_v009" + "name_flat": "SteamAPI_SteamGameServerUtils_v010" } ], "classname": "ISteamUtils", @@ -5407,17 +5426,20 @@ { "methodname": "InitFilterText", "methodname_flat": "SteamAPI_ISteamUtils_InitFilterText", - "params": [], + "params": [ + { "paramname":"unFilterOptions", "paramtype":"uint32" } + ], "returntype": "bool" }, { "methodname": "FilterText", "methodname_flat": "SteamAPI_ISteamUtils_FilterText", "params": [ - { "paramname":"pchOutFilteredText", "paramtype":"char *" }, - { "paramname":"nByteSizeOutFilteredText", "paramtype":"uint32" }, + { "paramname":"eContext", "paramtype":"ETextFilteringContext" }, + { "paramname":"sourceSteamID", "paramtype":"CSteamID", "paramtype_flat":"uint64_steamid" }, { "paramname":"pchInputMessage", "paramtype":"const char *" }, - { "paramname":"bLegalOnly", "paramtype":"bool" } + { "paramname":"pchOutFilteredText", "paramtype":"char *" }, + { "paramname":"nByteSizeOutFilteredText", "paramtype":"uint32" } ], "returntype": "int" }, @@ -5430,7 +5452,7 @@ "returntype": "ESteamIPv6ConnectivityState" } ], - "version_string": "SteamUtils009" + "version_string": "SteamUtils010" }, { "accessors": [ @@ -11157,17 +11179,93 @@ ], "version_string": "STEAMREMOTEPLAY_INTERFACE_VERSION001" }, + { + "accessors": [ + { + "kind": "user", + "name": "SteamNetworkingMessages", + "name_flat": "SteamAPI_SteamNetworkingMessages_v002" + }, + { + "kind": "gameserver", + "name": "SteamGameServerNetworkingMessages", + "name_flat": "SteamAPI_SteamGameServerNetworkingMessages_v002" + } + ], + "classname": "ISteamNetworkingMessages", + "fields": [], + "methods": [ + { + "methodname": "SendMessageToUser", + "methodname_flat": "SteamAPI_ISteamNetworkingMessages_SendMessageToUser", + "params": [ + { "paramname":"identityRemote", "paramtype":"const SteamNetworkingIdentity &" }, + { "paramname":"pubData", "paramtype":"const void *" }, + { "paramname":"cubData", "paramtype":"uint32" }, + { "paramname":"nSendFlags", "paramtype":"int" }, + { "paramname":"nRemoteChannel", "paramtype":"int" } + ], + "returntype": "EResult" + }, + { + "methodname": "ReceiveMessagesOnChannel", + "methodname_flat": "SteamAPI_ISteamNetworkingMessages_ReceiveMessagesOnChannel", + "params": [ + { "paramname":"nLocalChannel", "paramtype":"int" }, + { "paramname":"ppOutMessages", "paramtype":"SteamNetworkingMessage_t **" }, + { "paramname":"nMaxMessages", "paramtype":"int" } + ], + "returntype": "int" + }, + { + "methodname": "AcceptSessionWithUser", + "methodname_flat": "SteamAPI_ISteamNetworkingMessages_AcceptSessionWithUser", + "params": [ + { "paramname":"identityRemote", "paramtype":"const SteamNetworkingIdentity &" } + ], + "returntype": "bool" + }, + { + "methodname": "CloseSessionWithUser", + "methodname_flat": "SteamAPI_ISteamNetworkingMessages_CloseSessionWithUser", + "params": [ + { "paramname":"identityRemote", "paramtype":"const SteamNetworkingIdentity &" } + ], + "returntype": "bool" + }, + { + "methodname": "CloseChannelWithUser", + "methodname_flat": "SteamAPI_ISteamNetworkingMessages_CloseChannelWithUser", + "params": [ + { "paramname":"identityRemote", "paramtype":"const SteamNetworkingIdentity &" }, + { "paramname":"nLocalChannel", "paramtype":"int" } + ], + "returntype": "bool" + }, + { + "methodname": "GetSessionConnectionInfo", + "methodname_flat": "SteamAPI_ISteamNetworkingMessages_GetSessionConnectionInfo", + "params": [ + { "paramname":"identityRemote", "paramtype":"const SteamNetworkingIdentity &" }, + { "paramname":"pConnectionInfo", "paramtype":"SteamNetConnectionInfo_t *" }, + { "paramname":"pQuickStatus", "paramtype":"SteamNetworkingQuickConnectionStatus *" } + ], + "returntype": "ESteamNetworkingConnectionState" + } + ], + "version_string": "SteamNetworkingMessages002" + }, { "accessors": [ { "kind": "user", "name": "SteamNetworkingSockets", - "name_flat": "SteamAPI_SteamNetworkingSockets_v008" + "name_flat": "SteamAPI_SteamNetworkingSockets_v009" }, { "kind": "gameserver", "name": "SteamGameServerNetworkingSockets", - "name_flat": "SteamAPI_SteamGameServerNetworkingSockets_v008" + "name_flat": "SteamAPI_SteamGameServerNetworkingSockets_v009" } ], "classname": "ISteamNetworkingSockets", @@ -11197,7 +11295,7 @@ "methodname": "CreateListenSocketP2P", "methodname_flat": "SteamAPI_ISteamNetworkingSockets_CreateListenSocketP2P", "params": [ - { "paramname":"nVirtualPort", "paramtype":"int" }, + { "paramname":"nLocalVirtualPort", "paramtype":"int" }, { "paramname":"nOptions", "paramtype":"int" }, { "paramname":"pOptions", "paramtype":"const SteamNetworkingConfigValue_t *" } ], @@ -11208,7 +11306,7 @@ "methodname_flat": "SteamAPI_ISteamNetworkingSockets_ConnectP2P", "params": [ { "paramname":"identityRemote", "paramtype":"const SteamNetworkingIdentity &" }, - { "paramname":"nVirtualPort", "paramtype":"int" }, + { "paramname":"nRemoteVirtualPort", "paramtype":"int" }, { "paramname":"nOptions", "paramtype":"int" }, { "paramname":"pOptions", "paramtype":"const SteamNetworkingConfigValue_t *" } ], @@ -11436,7 +11534,7 @@ "methodname_flat": "SteamAPI_ISteamNetworkingSockets_FindRelayAuthTicketForServer", "params": [ { "paramname":"identityGameServer", "paramtype":"const SteamNetworkingIdentity &" }, - { "paramname":"nVirtualPort", "paramtype":"int" }, + { "paramname":"nRemoteVirtualPort", "paramtype":"int" }, { "paramname":"pOutParsedTicket", "paramtype":"SteamDatagramRelayAuthTicket *" } ], "returntype": "int" @@ -11446,7 +11544,7 @@ "methodname_flat": "SteamAPI_ISteamNetworkingSockets_ConnectToHostedDedicatedServer", "params": [ { "paramname":"identityTarget", "paramtype":"const SteamNetworkingIdentity &" }, - { "paramname":"nVirtualPort", "paramtype":"int" }, + { "paramname":"nRemoteVirtualPort", "paramtype":"int" }, { "paramname":"nOptions", "paramtype":"int" }, { "paramname":"pOptions", "paramtype":"const SteamNetworkingConfigValue_t *" } ], @@ -11476,7 +11574,7 @@ "methodname": "CreateHostedDedicatedServerListenSocket", "methodname_flat": "SteamAPI_ISteamNetworkingSockets_CreateHostedDedicatedServerListenSocket", "params": [ - { "paramname":"nVirtualPort", "paramtype":"int" }, + { "paramname":"nLocalVirtualPort", "paramtype":"int" }, { "paramname":"nOptions", "paramtype":"int" }, { "paramname":"pOptions", "paramtype":"const SteamNetworkingConfigValue_t *" } ], @@ -11498,6 +11596,7 @@ "params": [ { "paramname":"pSignaling", "paramtype":"ISteamNetworkingConnectionCustomSignaling *" }, { "paramname":"pPeerIdentity", "paramtype":"const SteamNetworkingIdentity *" }, + { "paramname":"nRemoteVirtualPort", "paramtype":"int" }, { "paramname":"nOptions", "paramtype":"int" }, { "paramname":"pOptions", "paramtype":"const SteamNetworkingConfigValue_t *" } ], @@ -11532,57 +11631,15 @@ { "paramname":"errMsg", "paramtype":"SteamNetworkingErrMsg &" } ], "returntype": "bool" - } - ], - "version_string": "SteamNetworkingSockets008" - }, - { - "classname": "ISteamNetworkingConnectionCustomSignaling", - "fields": [], - "methods": [ - { - "methodname": "SendSignal", - "methodname_flat": "SteamAPI_ISteamNetworkingConnectionCustomSignaling_SendSignal", - "params": [ - { "paramname":"hConn", "paramtype":"HSteamNetConnection" }, - { "paramname":"info", "paramtype":"const SteamNetConnectionInfo_t &" }, - { "paramname":"pMsg", "paramtype":"const void *" }, - { "paramname":"cbMsg", "paramtype":"int" } - ], - "returntype": "bool" }, { - "methodname": "Release", - "methodname_flat": "SteamAPI_ISteamNetworkingConnectionCustomSignaling_Release", + "methodname": "RunCallbacks", + "methodname_flat": "SteamAPI_ISteamNetworkingSockets_RunCallbacks", "params": [], "returntype": "void" } - ] - }, - { - "classname": "ISteamNetworkingCustomSignalingRecvContext", - "fields": [], - "methods": [ - { - "methodname": "OnConnectRequest", - "methodname_flat": "SteamAPI_ISteamNetworkingCustomSignalingRecvContext_OnConnectRequest", - "params": [ - { "paramname":"hConn", "paramtype":"HSteamNetConnection" }, - { "paramname":"identityPeer", "paramtype":"const SteamNetworkingIdentity &" } - ], - "returntype": "ISteamNetworkingConnectionCustomSignaling *" - }, - { - "methodname": "SendRejectionSignal", - "methodname_flat": "SteamAPI_ISteamNetworkingCustomSignalingRecvContext_SendRejectionSignal", - "params": [ - { "paramname":"identityPeer", "paramtype":"const SteamNetworkingIdentity &" }, - { "paramname":"pMsg", "paramtype":"const void *" }, - { "paramname":"cbMsg", "paramtype":"int" } - ], - "returntype": "void" - } - ] + ], + "version_string": "SteamNetworkingSockets009" }, { "accessors": [ @@ -11743,6 +11800,15 @@ ], "returntype": "bool" }, + { + "methodname": "SetGlobalConfigValuePtr", + "methodname_flat": "SteamAPI_ISteamNetworkingUtils_SetGlobalConfigValuePtr", + "params": [ + { "paramname":"eValue", "paramtype":"ESteamNetworkingConfigValue" }, + { "paramname":"val", "paramtype":"void *" } + ], + "returntype": "bool" + }, { "methodname": "SetConnectionConfigValueInt32", "methodname_flat": "SteamAPI_ISteamNetworkingUtils_SetConnectionConfigValueInt32", @@ -11773,6 +11839,46 @@ ], "returntype": "bool" }, + { + "methodname": "SetGlobalCallback_SteamNetConnectionStatusChanged", + "methodname_flat": "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged", + "params": [ + { "paramname":"fnCallback", "paramtype":"FnSteamNetConnectionStatusChanged" } + ], + "returntype": "bool" + }, + { + "methodname": "SetGlobalCallback_SteamNetAuthenticationStatusChanged", + "methodname_flat": "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetAuthenticationStatusChanged", + "params": [ + { "paramname":"fnCallback", "paramtype":"FnSteamNetAuthenticationStatusChanged" } + ], + "returntype": "bool" + }, + { + "methodname": "SetGlobalCallback_SteamRelayNetworkStatusChanged", + "methodname_flat": "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamRelayNetworkStatusChanged", + "params": [ + { "paramname":"fnCallback", "paramtype":"FnSteamRelayNetworkStatusChanged" } + ], + "returntype": "bool" + }, + { + "methodname": "SetGlobalCallback_MessagesSessionRequest", + "methodname_flat": "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_MessagesSessionRequest", + "params": [ + { "paramname":"fnCallback", "paramtype":"FnSteamNetworkingMessagesSessionRequest" } + ], + "returntype": "bool" + }, + { + "methodname": "SetGlobalCallback_MessagesSessionFailed", + "methodname_flat": "SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_MessagesSessionFailed", + "params": [ + { "paramname":"fnCallback", "paramtype":"FnSteamNetworkingMessagesSessionFailed" } + ], + "returntype": "bool" + }, { "methodname": "SetConfigValue", "methodname_flat": "SteamAPI_ISteamNetworkingUtils_SetConfigValue", @@ -12964,6 +13070,53 @@ { "fieldname":"m_eDataType", "fieldtype":"ESteamNetworkingConfigDataType" }, { "fieldname":"m_int64", "fieldtype":"int64_t" } ], + "methods": [ + { + "methodname": "SetInt32", + "methodname_flat": "SteamAPI_SteamNetworkingConfigValue_t_SetInt32", + "params": [ + { "paramname":"eVal", "paramtype":"ESteamNetworkingConfigValue" }, + { "paramname":"data", "paramtype":"int32_t" } + ], + "returntype": "void" + }, + { + "methodname": "SetInt64", + "methodname_flat": "SteamAPI_SteamNetworkingConfigValue_t_SetInt64", + "params": [ + { "paramname":"eVal", "paramtype":"ESteamNetworkingConfigValue" }, + { "paramname":"data", "paramtype":"int64_t" } + ], + "returntype": "void" + }, + { + "methodname": "SetFloat", + "methodname_flat": "SteamAPI_SteamNetworkingConfigValue_t_SetFloat", + "params": [ + { "paramname":"eVal", "paramtype":"ESteamNetworkingConfigValue" }, + { "paramname":"data", "paramtype":"float" } + ], + "returntype": "void" + }, + { + "methodname": "SetPtr", + "methodname_flat": "SteamAPI_SteamNetworkingConfigValue_t_SetPtr", + "params": [ + { "paramname":"eVal", "paramtype":"ESteamNetworkingConfigValue" }, + { "paramname":"data", "paramtype":"void *" } + ], + "returntype": "void" + }, + { + "methodname": "SetString", + "methodname_flat": "SteamAPI_SteamNetworkingConfigValue_t_SetString", + "params": [ + { "paramname":"eVal", "paramtype":"ESteamNetworkingConfigValue" }, + { "paramname":"data", "paramtype":"const char *" } + ], + "returntype": "void" + } + ], "struct": "SteamNetworkingConfigValue_t" }, { @@ -13131,6 +13284,11 @@ { "typedef":"SteamInventoryResult_t", "type":"int" }, { "typedef":"SteamInventoryUpdateHandle_t", "type":"unsigned long long" }, { "typedef":"RemotePlaySessionID_t", "type":"unsigned int" }, + { "typedef":"FnSteamNetConnectionStatusChanged", "type":"void (*)(SteamNetConnectionStatusChangedCallback_t *)" }, + { "typedef":"FnSteamNetAuthenticationStatusChanged", "type":"void (*)(SteamNetAuthenticationStatus_t *)" }, + { "typedef":"FnSteamRelayNetworkStatusChanged", "type":"void (*)(SteamRelayNetworkStatus_t *)" }, + { "typedef":"FnSteamNetworkingMessagesSessionRequest", "type":"void (*)(SteamNetworkingMessagesSessionRequest_t *)" }, + { "typedef":"FnSteamNetworkingMessagesSessionFailed", "type":"void (*)(SteamNetworkingMessagesSessionFailed_t *)" }, { "typedef":"HSteamNetConnection", "type":"unsigned int" }, { "typedef":"HSteamListenSocket", "type":"unsigned int" }, { "typedef":"HSteamNetPollGroup", "type":"unsigned int" }, diff --git a/Generator/steam_sdk/steam_api_flat.h b/Generator/steam_sdk/steam_api_flat.h index d03f1b1..9c19f8c 100644 --- a/Generator/steam_sdk/steam_api_flat.h +++ b/Generator/steam_sdk/steam_api_flat.h @@ -169,8 +169,8 @@ S_API void SteamAPI_ISteamFriends_ActivateGameOverlayRemotePlayTogetherInviteDia S_API bool SteamAPI_ISteamFriends_RegisterProtocolInOverlayBrowser( ISteamFriends* self, const char * pchProtocol ); // ISteamUtils -S_API ISteamUtils *SteamAPI_SteamUtils_v009(); -S_API ISteamUtils *SteamAPI_SteamGameServerUtils_v009(); +S_API ISteamUtils *SteamAPI_SteamUtils_v010(); +S_API ISteamUtils *SteamAPI_SteamGameServerUtils_v010(); S_API uint32 SteamAPI_ISteamUtils_GetSecondsSinceAppActive( ISteamUtils* self ); S_API uint32 SteamAPI_ISteamUtils_GetSecondsSinceComputerActive( ISteamUtils* self ); S_API EUniverse SteamAPI_ISteamUtils_GetConnectedUniverse( ISteamUtils* self ); @@ -201,8 +201,8 @@ S_API void SteamAPI_ISteamUtils_StartVRDashboard( ISteamUtils* self ); S_API bool SteamAPI_ISteamUtils_IsVRHeadsetStreamingEnabled( ISteamUtils* self ); S_API void SteamAPI_ISteamUtils_SetVRHeadsetStreamingEnabled( ISteamUtils* self, bool bEnabled ); S_API bool SteamAPI_ISteamUtils_IsSteamChinaLauncher( ISteamUtils* self ); -S_API bool SteamAPI_ISteamUtils_InitFilterText( ISteamUtils* self ); -S_API int SteamAPI_ISteamUtils_FilterText( ISteamUtils* self, char * pchOutFilteredText, uint32 nByteSizeOutFilteredText, const char * pchInputMessage, bool bLegalOnly ); +S_API bool SteamAPI_ISteamUtils_InitFilterText( ISteamUtils* self, uint32 unFilterOptions ); +S_API int SteamAPI_ISteamUtils_FilterText( ISteamUtils* self, ETextFilteringContext eContext, uint64_steamid sourceSteamID, const char * pchInputMessage, char * pchOutFilteredText, uint32 nByteSizeOutFilteredText ); S_API ESteamIPv6ConnectivityState SteamAPI_ISteamUtils_GetIPv6ConnectivityState( ISteamUtils* self, ESteamIPv6ConnectivityProtocol eProtocol ); // ISteamMatchmaking @@ -844,13 +844,23 @@ S_API ESteamDeviceFormFactor SteamAPI_ISteamRemotePlay_GetSessionClientFormFacto S_API bool SteamAPI_ISteamRemotePlay_BGetSessionClientResolution( ISteamRemotePlay* self, RemotePlaySessionID_t unSessionID, int * pnResolutionX, int * pnResolutionY ); S_API bool SteamAPI_ISteamRemotePlay_BSendRemotePlayTogetherInvite( ISteamRemotePlay* self, uint64_steamid steamIDFriend ); +// ISteamNetworkingMessages +S_API ISteamNetworkingMessages *SteamAPI_SteamNetworkingMessages_v002(); +S_API ISteamNetworkingMessages *SteamAPI_SteamGameServerNetworkingMessages_v002(); +S_API EResult SteamAPI_ISteamNetworkingMessages_SendMessageToUser( ISteamNetworkingMessages* self, const SteamNetworkingIdentity & identityRemote, const void * pubData, uint32 cubData, int nSendFlags, int nRemoteChannel ); +S_API int SteamAPI_ISteamNetworkingMessages_ReceiveMessagesOnChannel( ISteamNetworkingMessages* self, int nLocalChannel, SteamNetworkingMessage_t ** ppOutMessages, int nMaxMessages ); +S_API bool SteamAPI_ISteamNetworkingMessages_AcceptSessionWithUser( ISteamNetworkingMessages* self, const SteamNetworkingIdentity & identityRemote ); +S_API bool SteamAPI_ISteamNetworkingMessages_CloseSessionWithUser( ISteamNetworkingMessages* self, const SteamNetworkingIdentity & identityRemote ); +S_API bool SteamAPI_ISteamNetworkingMessages_CloseChannelWithUser( ISteamNetworkingMessages* self, const SteamNetworkingIdentity & identityRemote, int nLocalChannel ); +S_API ESteamNetworkingConnectionState SteamAPI_ISteamNetworkingMessages_GetSessionConnectionInfo( ISteamNetworkingMessages* self, const SteamNetworkingIdentity & identityRemote, SteamNetConnectionInfo_t * pConnectionInfo, SteamNetworkingQuickConnectionStatus * pQuickStatus ); + // ISteamNetworkingSockets -S_API ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_v008(); -S_API ISteamNetworkingSockets *SteamAPI_SteamGameServerNetworkingSockets_v008(); +S_API ISteamNetworkingSockets *SteamAPI_SteamNetworkingSockets_v009(); +S_API ISteamNetworkingSockets *SteamAPI_SteamGameServerNetworkingSockets_v009(); S_API HSteamListenSocket SteamAPI_ISteamNetworkingSockets_CreateListenSocketIP( ISteamNetworkingSockets* self, const SteamNetworkingIPAddr & localAddress, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); S_API HSteamNetConnection SteamAPI_ISteamNetworkingSockets_ConnectByIPAddress( ISteamNetworkingSockets* self, const SteamNetworkingIPAddr & address, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); -S_API HSteamListenSocket SteamAPI_ISteamNetworkingSockets_CreateListenSocketP2P( ISteamNetworkingSockets* self, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); -S_API HSteamNetConnection SteamAPI_ISteamNetworkingSockets_ConnectP2P( ISteamNetworkingSockets* self, const SteamNetworkingIdentity & identityRemote, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); +S_API HSteamListenSocket SteamAPI_ISteamNetworkingSockets_CreateListenSocketP2P( ISteamNetworkingSockets* self, int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); +S_API HSteamNetConnection SteamAPI_ISteamNetworkingSockets_ConnectP2P( ISteamNetworkingSockets* self, const SteamNetworkingIdentity & identityRemote, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); S_API EResult SteamAPI_ISteamNetworkingSockets_AcceptConnection( ISteamNetworkingSockets* self, HSteamNetConnection hConn ); S_API bool SteamAPI_ISteamNetworkingSockets_CloseConnection( ISteamNetworkingSockets* self, HSteamNetConnection hPeer, int nReason, const char * pszDebug, bool bEnableLinger ); S_API bool SteamAPI_ISteamNetworkingSockets_CloseListenSocket( ISteamNetworkingSockets* self, HSteamListenSocket hSocket ); @@ -875,25 +885,18 @@ S_API bool SteamAPI_ISteamNetworkingSockets_DestroyPollGroup( ISteamNetworkingSo S_API bool SteamAPI_ISteamNetworkingSockets_SetConnectionPollGroup( ISteamNetworkingSockets* self, HSteamNetConnection hConn, HSteamNetPollGroup hPollGroup ); S_API int SteamAPI_ISteamNetworkingSockets_ReceiveMessagesOnPollGroup( ISteamNetworkingSockets* self, HSteamNetPollGroup hPollGroup, SteamNetworkingMessage_t ** ppOutMessages, int nMaxMessages ); S_API bool SteamAPI_ISteamNetworkingSockets_ReceivedRelayAuthTicket( ISteamNetworkingSockets* self, const void * pvTicket, int cbTicket, SteamDatagramRelayAuthTicket * pOutParsedTicket ); -S_API int SteamAPI_ISteamNetworkingSockets_FindRelayAuthTicketForServer( ISteamNetworkingSockets* self, const SteamNetworkingIdentity & identityGameServer, int nVirtualPort, SteamDatagramRelayAuthTicket * pOutParsedTicket ); -S_API HSteamNetConnection SteamAPI_ISteamNetworkingSockets_ConnectToHostedDedicatedServer( ISteamNetworkingSockets* self, const SteamNetworkingIdentity & identityTarget, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); +S_API int SteamAPI_ISteamNetworkingSockets_FindRelayAuthTicketForServer( ISteamNetworkingSockets* self, const SteamNetworkingIdentity & identityGameServer, int nRemoteVirtualPort, SteamDatagramRelayAuthTicket * pOutParsedTicket ); +S_API HSteamNetConnection SteamAPI_ISteamNetworkingSockets_ConnectToHostedDedicatedServer( ISteamNetworkingSockets* self, const SteamNetworkingIdentity & identityTarget, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); S_API uint16 SteamAPI_ISteamNetworkingSockets_GetHostedDedicatedServerPort( ISteamNetworkingSockets* self ); S_API SteamNetworkingPOPID SteamAPI_ISteamNetworkingSockets_GetHostedDedicatedServerPOPID( ISteamNetworkingSockets* self ); S_API EResult SteamAPI_ISteamNetworkingSockets_GetHostedDedicatedServerAddress( ISteamNetworkingSockets* self, SteamDatagramHostedAddress * pRouting ); -S_API HSteamListenSocket SteamAPI_ISteamNetworkingSockets_CreateHostedDedicatedServerListenSocket( ISteamNetworkingSockets* self, int nVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); +S_API HSteamListenSocket SteamAPI_ISteamNetworkingSockets_CreateHostedDedicatedServerListenSocket( ISteamNetworkingSockets* self, int nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); S_API EResult SteamAPI_ISteamNetworkingSockets_GetGameCoordinatorServerLogin( ISteamNetworkingSockets* self, SteamDatagramGameCoordinatorServerLogin * pLoginInfo, int * pcbSignedBlob, void * pBlob ); -S_API HSteamNetConnection SteamAPI_ISteamNetworkingSockets_ConnectP2PCustomSignaling( ISteamNetworkingSockets* self, ISteamNetworkingConnectionCustomSignaling * pSignaling, const SteamNetworkingIdentity * pPeerIdentity, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); +S_API HSteamNetConnection SteamAPI_ISteamNetworkingSockets_ConnectP2PCustomSignaling( ISteamNetworkingSockets* self, ISteamNetworkingConnectionCustomSignaling * pSignaling, const SteamNetworkingIdentity * pPeerIdentity, int nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t * pOptions ); S_API bool SteamAPI_ISteamNetworkingSockets_ReceivedP2PCustomSignal( ISteamNetworkingSockets* self, const void * pMsg, int cbMsg, ISteamNetworkingCustomSignalingRecvContext * pContext ); S_API bool SteamAPI_ISteamNetworkingSockets_GetCertificateRequest( ISteamNetworkingSockets* self, int * pcbBlob, void * pBlob, SteamNetworkingErrMsg & errMsg ); S_API bool SteamAPI_ISteamNetworkingSockets_SetCertificate( ISteamNetworkingSockets* self, const void * pCertificate, int cbCertificate, SteamNetworkingErrMsg & errMsg ); - -// ISteamNetworkingConnectionCustomSignaling -S_API bool SteamAPI_ISteamNetworkingConnectionCustomSignaling_SendSignal( ISteamNetworkingConnectionCustomSignaling* self, HSteamNetConnection hConn, const SteamNetConnectionInfo_t & info, const void * pMsg, int cbMsg ); -S_API void SteamAPI_ISteamNetworkingConnectionCustomSignaling_Release( ISteamNetworkingConnectionCustomSignaling* self ); - -// ISteamNetworkingCustomSignalingRecvContext -S_API ISteamNetworkingConnectionCustomSignaling * SteamAPI_ISteamNetworkingCustomSignalingRecvContext_OnConnectRequest( ISteamNetworkingCustomSignalingRecvContext* self, HSteamNetConnection hConn, const SteamNetworkingIdentity & identityPeer ); -S_API void SteamAPI_ISteamNetworkingCustomSignalingRecvContext_SendRejectionSignal( ISteamNetworkingCustomSignalingRecvContext* self, const SteamNetworkingIdentity & identityPeer, const void * pMsg, int cbMsg ); +S_API void SteamAPI_ISteamNetworkingSockets_RunCallbacks( ISteamNetworkingSockets* self ); // ISteamNetworkingUtils S_API ISteamNetworkingUtils *SteamAPI_SteamNetworkingUtils_v003(); @@ -915,9 +918,15 @@ S_API void SteamAPI_ISteamNetworkingUtils_SetDebugOutputFunction( ISteamNetworki S_API bool SteamAPI_ISteamNetworkingUtils_SetGlobalConfigValueInt32( ISteamNetworkingUtils* self, ESteamNetworkingConfigValue eValue, int32 val ); S_API bool SteamAPI_ISteamNetworkingUtils_SetGlobalConfigValueFloat( ISteamNetworkingUtils* self, ESteamNetworkingConfigValue eValue, float val ); S_API bool SteamAPI_ISteamNetworkingUtils_SetGlobalConfigValueString( ISteamNetworkingUtils* self, ESteamNetworkingConfigValue eValue, const char * val ); +S_API bool SteamAPI_ISteamNetworkingUtils_SetGlobalConfigValuePtr( ISteamNetworkingUtils* self, ESteamNetworkingConfigValue eValue, void * val ); S_API bool SteamAPI_ISteamNetworkingUtils_SetConnectionConfigValueInt32( ISteamNetworkingUtils* self, HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, int32 val ); S_API bool SteamAPI_ISteamNetworkingUtils_SetConnectionConfigValueFloat( ISteamNetworkingUtils* self, HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, float val ); S_API bool SteamAPI_ISteamNetworkingUtils_SetConnectionConfigValueString( ISteamNetworkingUtils* self, HSteamNetConnection hConn, ESteamNetworkingConfigValue eValue, const char * val ); +S_API bool SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetConnectionStatusChanged( ISteamNetworkingUtils* self, FnSteamNetConnectionStatusChanged fnCallback ); +S_API bool SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamNetAuthenticationStatusChanged( ISteamNetworkingUtils* self, FnSteamNetAuthenticationStatusChanged fnCallback ); +S_API bool SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_SteamRelayNetworkStatusChanged( ISteamNetworkingUtils* self, FnSteamRelayNetworkStatusChanged fnCallback ); +S_API bool SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_MessagesSessionRequest( ISteamNetworkingUtils* self, FnSteamNetworkingMessagesSessionRequest fnCallback ); +S_API bool SteamAPI_ISteamNetworkingUtils_SetGlobalCallback_MessagesSessionFailed( ISteamNetworkingUtils* self, FnSteamNetworkingMessagesSessionFailed fnCallback ); S_API bool SteamAPI_ISteamNetworkingUtils_SetConfigValue( ISteamNetworkingUtils* self, ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj, ESteamNetworkingConfigDataType eDataType, const void * pArg ); S_API bool SteamAPI_ISteamNetworkingUtils_SetConfigValueStruct( ISteamNetworkingUtils* self, const SteamNetworkingConfigValue_t & opt, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj ); S_API ESteamNetworkingGetConfigValueResult SteamAPI_ISteamNetworkingUtils_GetConfigValue( ISteamNetworkingUtils* self, ESteamNetworkingConfigValue eValue, ESteamNetworkingConfigScope eScopeType, intptr_t scopeObj, ESteamNetworkingConfigDataType * pOutDataType, void * pResult, size_t * cbResult ); @@ -1049,6 +1058,13 @@ S_API bool SteamAPI_SteamNetworkingIdentity_ParseString( SteamNetworkingIdentity // SteamNetworkingMessage_t S_API void SteamAPI_SteamNetworkingMessage_t_Release( SteamNetworkingMessage_t* self ); +// SteamNetworkingConfigValue_t +S_API void SteamAPI_SteamNetworkingConfigValue_t_SetInt32( SteamNetworkingConfigValue_t* self, ESteamNetworkingConfigValue eVal, int32_t data ); +S_API void SteamAPI_SteamNetworkingConfigValue_t_SetInt64( SteamNetworkingConfigValue_t* self, ESteamNetworkingConfigValue eVal, int64_t data ); +S_API void SteamAPI_SteamNetworkingConfigValue_t_SetFloat( SteamNetworkingConfigValue_t* self, ESteamNetworkingConfigValue eVal, float data ); +S_API void SteamAPI_SteamNetworkingConfigValue_t_SetPtr( SteamNetworkingConfigValue_t* self, ESteamNetworkingConfigValue eVal, void * data ); +S_API void SteamAPI_SteamNetworkingConfigValue_t_SetString( SteamNetworkingConfigValue_t* self, ESteamNetworkingConfigValue eVal, const char * data ); + // SteamNetworkingPOPIDRender S_API const char * SteamAPI_SteamNetworkingPOPIDRender_c_str( SteamNetworkingPOPIDRender* self ); diff --git a/Generator/steam_sdk/steamnetworkingtypes.h b/Generator/steam_sdk/steamnetworkingtypes.h index 5f92c38..7a70add 100644 --- a/Generator/steam_sdk/steamnetworkingtypes.h +++ b/Generator/steam_sdk/steamnetworkingtypes.h @@ -41,6 +41,14 @@ struct SteamDatagramGameCoordinatorServerLogin; struct SteamNetConnectionStatusChangedCallback_t; struct SteamNetAuthenticationStatus_t; struct SteamRelayNetworkStatus_t; +struct SteamNetworkingMessagesSessionRequest_t; +struct SteamNetworkingMessagesSessionFailed_t; + +typedef void (*FnSteamNetConnectionStatusChanged)( SteamNetConnectionStatusChangedCallback_t * ); +typedef void (*FnSteamNetAuthenticationStatusChanged)( SteamNetAuthenticationStatus_t * ); +typedef void (*FnSteamRelayNetworkStatusChanged)(SteamRelayNetworkStatus_t *); +typedef void (*FnSteamNetworkingMessagesSessionRequest)(SteamNetworkingMessagesSessionRequest_t *); +typedef void (*FnSteamNetworkingMessagesSessionFailed)(SteamNetworkingMessagesSessionFailed_t *); /// Handle used to identify a connection to a remote host. typedef uint32 HSteamNetConnection; @@ -581,6 +589,21 @@ enum ESteamNetConnectionEnd // level failure. k_ESteamNetConnectionEnd_Misc_P2P_NAT_Firewall = 5009, + // Our peer replied that it has no record of the connection. + // This should not happen ordinarily, but can happen in a few + // exception cases: + // + // - This is an old connection, and the peer has already cleaned + // up and forgotten about it. (Perhaps it timed out and they + // closed it and were not able to communicate this to us.) + // - A bug or internal protocol error has caused us to try to + // talk to the peer about the connection before we received + // confirmation that the peer has accepted the connection. + // - The peer thinks that we have closed the connection for some + // reason (perhaps a bug), and believes that is it is + // acknowledging our closure. + k_ESteamNetConnectionEnd_Misc_PeerSentNoConnection = 5010, + k_ESteamNetConnectionEnd_Misc_Max = 5999, k_ESteamNetConnectionEnd__Force32Bit = 0x7fffffff @@ -632,9 +655,10 @@ struct SteamNetConnectionInfo_t /// have some details specific to the issue. char m_szEndDebug[ k_cchSteamNetworkingMaxConnectionCloseReason ]; - /// Debug description. This includes the connection handle, - /// connection type (and peer information), and the app name. - /// This string is used in various internal logging messages + /// 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. char m_szConnectionDescription[ k_cchSteamNetworkingMaxConnectionDescription ]; /// Internal stuff, room to change API easily @@ -913,6 +937,27 @@ const int k_nSteamNetworkingSend_ReliableNoNagle = k_nSteamNetworkingSend_Reliab // Otherwise you will probably just make performance worse. const int k_nSteamNetworkingSend_UseCurrentThread = 16; +// When sending a message using ISteamNetworkingMessages, automatically re-establish +// a broken session, without returning k_EResultNoConnection. Without this flag, +// if you attempt to send a message, and the session was proactively closed by the +// peer, or an error occurred that disrupted communications, then you must close the +// session using ISteamNetworkingMessages::CloseSessionWithUser before attempting to +// send another message. (Or you can simply add this flag and retry.) In this way, +// the disruption cannot go unnoticed, and a more clear order of events can be +// ascertained. This is especially important when reliable messages are used, since +// if the connection is disrupted, some of those messages will not have been delivered, +// and it is in general not possible to know which. Although a +// SteamNetworkingMessagesSessionFailed_t callback will be posted when an error occurs +// to notify you that a failure has happened, callbacks are asynchronous, so it is not +// possible to tell exactly when it happened. And because the primary purpose of +// ISteamNetworkingMessages is to be like UDP, there is no notification when a peer closes +// the session. +// +// If you are not using any reliable messages (e.g. you are using ISteamNetworkingMessages +// exactly as a transport replacement for UDP-style datagrams only), you may not need to +// know when an underlying connection fails, and so you may not need this notification. +const int k_nSteamNetworkingSend_AutoRestartBrokenSession = 32; + // // Ping location / measurement // @@ -985,7 +1030,7 @@ enum ESteamNetworkingConfigDataType k_ESteamNetworkingConfig_Int64 = 2, k_ESteamNetworkingConfig_Float = 3, k_ESteamNetworkingConfig_String = 4, - k_ESteamNetworkingConfig_FunctionPtr = 5, // NOTE: When setting callbacks, you should put the pointer into a variable and pass a pointer to that variable. + k_ESteamNetworkingConfig_Ptr = 5, k_ESteamNetworkingConfigDataType__Force32Bit = 0x7fffffff }; @@ -1090,6 +1135,168 @@ enum ESteamNetworkingConfigValue /// (This flag is itself a dev variable.) k_ESteamNetworkingConfig_EnumerateDevVars = 35, + /// [connection int32] Set this to 1 on outbound connections and listen sockets, + /// to enable "symmetric connect mode", which is useful in the following + /// common peer-to-peer use case: + /// + /// - The two peers are "equal" to each other. (Neither is clearly the "client" + /// or "server".) + /// - Either peer may initiate the connection, and indeed they may do this + /// at the same time + /// - The peers only desire a single connection to each other, and if both + /// peers initiate connections simultaneously, a protocol is needed for them + /// to resolve the conflict, so that we end up with a single connection. + /// + /// This use case is both common, and involves subtle race conditions and tricky + /// pitfalls, which is why the API has support for dealing with it. + /// + /// If an incoming connection arrives on a listen socket or via custom signaling, + /// and the application has not attempted to make a matching outbound connection + /// in symmetric mode, then the incoming connection can be accepted as usual. + /// A "matching" connection means that the relevant endpoint information matches. + /// (At the time this comment is being written, this is only supported for P2P + /// connections, which means that the peer identities must match, and the virtual + /// port must match. At a later time, symmetric mode may be supported for other + /// connection types.) + /// + /// If connections are initiated by both peers simultaneously, race conditions + /// can arise, but fortunately, most of them are handled internally and do not + /// require any special awareness from the application. However, there + /// is one important case that application code must be aware of: + /// If application code attempts an outbound connection using a ConnectXxx + /// function in symmetric mode, and a matching incoming connection is already + /// waiting on a listen socket, then instead of forming a new connection, + /// the ConnectXxx call will accept the existing incoming connection, and return + /// a connection handle to this accepted connection. + /// IMPORTANT: in this case, a SteamNetConnectionStatusChangedCallback_t + /// has probably *already* been posted to the queue for the incoming connection! + /// (Once callbacks are posted to the queue, they are not modified.) It doesn't + /// matter if the callback has not been consumed by the app. Thus, application + /// code that makes use of symmetric connections must be aware that, when processing a + /// SteamNetConnectionStatusChangedCallback_t for an incoming connection, the + /// m_hConn may refer to a new connection that the app has has not + /// seen before (the usual case), but it may also refer to a connection that + /// has already been accepted implicitly through a call to Connect()! In this + /// case, AcceptConnection() will return k_EResultDuplicateRequest. + /// + /// Only one symmetric connection to a given peer (on a given virtual port) + /// may exist at any given time. If client code attempts to create a connection, + /// and a (live) connection already exists on the local host, then either the + /// existing connection will be accepted as described above, or the attempt + /// to create a new connection will fail. Furthermore, linger mode functionality + /// is not supported on symmetric connections. + /// + /// A more complicated race condition can arise if both peers initiate a connection + /// at roughly the same time. In this situation, each peer will receive an incoming + /// connection from the other peer, when the application code has already initiated + /// an outgoing connection to that peer. The peers must resolve this conflict and + /// decide who is going to act as the "server" and who will act as the "client". + /// Typically the application does not need to be aware of this case as it is handled + /// internally. On both sides, the will observe their outbound connection being + /// "accepted", although one of them one have been converted internally to act + /// as the "server". + /// + /// In general, symmetric mode should be all-or-nothing: do not mix symmetric + /// connections with a non-symmetric connection that it might possible "match" + /// with. If you use symmetric mode on any connections, then both peers should + /// use it on all connections, and the corresponding listen socket, if any. The + /// behaviour when symmetric and ordinary connections are mixed is not defined by + /// this API, and you should not rely on it. (This advice only applies when connections + /// might possibly "match". For example, it's OK to use all symmetric mode + /// connections on one virtual port, and all ordinary, non-symmetric connections + /// on a different virtual port, as there is no potential for ambiguity.) + /// + /// When using the feature, you should set it in the following situations on + /// applicable objects: + /// + /// - When creating an outbound connection using ConnectXxx function + /// - When creating a listen socket. (Note that this will automatically cause + /// any accepted connections to inherit the flag.) + /// - When using custom signaling, before accepting an incoming connection. + /// + /// Setting the flag on listen socket and accepted connections will enable the + /// API to automatically deal with duplicate incoming connections, even if the + /// local host has not made any outbound requests. (In general, such duplicate + /// requests from a peer are ignored internally and will not be visible to the + /// application code. The previous connection must be closed or resolved first.) + k_ESteamNetworkingConfig_SymmetricConnect = 37, + + /// [connection int32] For connection types that use "virtual ports", this can be used + /// to assign a local virtual port. For incoming connections, this will always be the + /// virtual port of the listen socket (or the port requested by the remote host if custom + /// signaling is used and the connection is accepted), and cannot be changed. For + /// connections initiated locally, the local virtual port will default to the same as the + /// requested remote virtual port, if you do not specify a different option when creating + /// the connection. The local port is only relevant for symmetric connections, when + /// determining if two connections "match." In this case, if you need the local and remote + /// port to differ, you can set this value. + /// + /// You can also read back this value on listen sockets. + /// + /// This value should not be read or written in any other context. + k_ESteamNetworkingConfig_LocalVirtualPort = 38, + + // + // Callbacks + // + + // On Steam, you may use the default Steam callback dispatch mechanism. If you prefer + // to not use this dispatch mechanism (or you are not running with Steam), or you want + // to associate specific functions with specific listen sockets or connections, you can + // register them as configuration values. + // + // Note also that ISteamNetworkingUtils has some helpers to set these globally. + + /// [connection FnSteamNetConnectionStatusChanged] Callback that will be invoked + /// when the state of a connection changes. + /// + /// IMPORTANT: callbacks are dispatched to the handler that is in effect at the time + /// the event occurs, which might be in another thread. For example, immediately after + /// creating a listen socket, you may receive an incoming connection. And then immediately + /// after this, the remote host may close the connection. All of this could happen + /// before the function to create the listen socket has returned. For this reason, + /// callbacks usually must be in effect at the time of object creation. This means + /// you should set them when you are creating the listen socket or connection, or have + /// them in effect so they will be inherited at the time of object creation. + /// + /// For example: + /// + /// exterm void MyStatusChangedFunc( SteamNetConnectionStatusChangedCallback_t *info ); + /// SteamNetworkingConfigValue_t opt; opt.SetPtr( k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged, MyStatusChangedFunc ); + /// SteamNetworkingIPAddr localAddress; localAddress.Clear(); + /// HSteamListenSocket hListenSock = SteamNetworkingSockets()->CreateListenSocketIP( localAddress, 1, &opt ); + /// + /// When accepting an incoming connection, there is no atomic way to switch the + /// callback. However, if the connection is DOA, AcceptConnection() will fail, and + /// you can fetch the state of the connection at that time. + /// + /// If all connections and listen sockets can use the same callback, the simplest + /// method is to set it globally before you create any listen sockets or connections. + k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged = 201, + + /// [global FnSteamNetAuthenticationStatusChanged] Callback that will be invoked + /// when our auth state changes. If you use this, install the callback before creating + /// any connections or listen sockets, and don't change it. + /// See: ISteamNetworkingUtils::SetGlobalCallback_SteamNetAuthenticationStatusChanged + k_ESteamNetworkingConfig_Callback_AuthStatusChanged = 202, + + /// [global FnSteamRelayNetworkStatusChanged] Callback that will be invoked + /// when our auth state changes. If you use this, install the callback before creating + /// any connections or listen sockets, and don't change it. + /// See: ISteamNetworkingUtils::SetGlobalCallback_SteamRelayNetworkStatusChanged + k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged = 203, + + /// [global FnSteamNetworkingMessagesSessionRequest] Callback that will be invoked + /// when a peer wants to initiate a SteamNetworkingMessagesSessionRequest. + /// See: ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionRequest + k_ESteamNetworkingConfig_Callback_MessagesSessionRequest = 204, + + /// [global FnSteamNetworkingMessagesSessionFailed] Callback that will be invoked + /// when a session you have initiated, or accepted either fails to connect, or loses + /// connection in some unexpected way. + /// See: ISteamNetworkingUtils::SetGlobalCallback_MessagesSessionFailed + k_ESteamNetworkingConfig_Callback_MessagesSessionFailed = 205, + // // P2P settings // @@ -1224,8 +1431,42 @@ struct SteamNetworkingConfigValue_t int64_t m_int64; float m_float; const char *m_string; // Points to your '\0'-terminated buffer - void *m_functionPtr; + void *m_ptr; } m_val; + + // + // Shortcut helpers to set the type and value in a single call + // + inline void SetInt32( ESteamNetworkingConfigValue eVal, int32_t data ) + { + m_eValue = eVal; + m_eDataType = k_ESteamNetworkingConfig_Int32; + m_val.m_int32 = data; + } + inline void SetInt64( ESteamNetworkingConfigValue eVal, int64_t data ) + { + m_eValue = eVal; + m_eDataType = k_ESteamNetworkingConfig_Int64; + m_val.m_int64 = data; + } + inline void SetFloat( ESteamNetworkingConfigValue eVal, float data ) + { + m_eValue = eVal; + m_eDataType = k_ESteamNetworkingConfig_Float; + m_val.m_float = data; + } + inline void SetPtr( ESteamNetworkingConfigValue eVal, void *data ) + { + m_eValue = eVal; + m_eDataType = k_ESteamNetworkingConfig_Ptr; + m_val.m_ptr = data; + } + inline void SetString( ESteamNetworkingConfigValue eVal, const char *data ) // WARNING - Just saves your pointer. Does NOT make a copy of the string + { + m_eValue = eVal; + m_eDataType = k_ESteamNetworkingConfig_Ptr; + m_val.m_string = data; + } }; /// Return value of ISteamNetworkintgUtils::GetConfigValue