public static bool SteamNetworkingIdentity_ParseString(out SteamNetworkingIdentity pIdentity, string pszStr)
 {
     InteropHelp.TestIfAvailableClient();
     using (var pszStr2 = new InteropHelp.UTF8StringHandle(pszStr)) {
         return(NativeMethods.ISteamNetworkingUtils_SteamNetworkingIdentity_ParseString(CSteamAPIContext.GetSteamNetworkingUtils(), out pIdentity, pszStr2));
     }
 }
        public static void SteamNetworkingIdentity_ToString(ref SteamNetworkingIdentity identity, out string buf, uint cbBuf)
        {
            InteropHelp.TestIfAvailableClient();
            IntPtr buf2 = Marshal.AllocHGlobal((int)cbBuf);

            NativeMethods.ISteamNetworkingUtils_SteamNetworkingIdentity_ToString(CSteamAPIContext.GetSteamNetworkingUtils(), ref identity, buf2, cbBuf);
            buf = InteropHelp.PtrToStringUTF8(buf2);
            Marshal.FreeHGlobal(buf2);
        }
 public static HSteamNetConnection ConnectP2P(ref SteamNetworkingIdentity identityRemote, int nVirtualPort, int nOptions, SteamNetworkingConfigValue_t[] pOptions)
 {
     InteropHelp.TestIfAvailableGameServer();
     return((HSteamNetConnection)NativeMethods.ISteamNetworkingSockets_ConnectP2P(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), ref identityRemote, nVirtualPort, nOptions, pOptions));
 }
 public static HSteamNetConnection ConnectP2PCustomSignaling(out ISteamNetworkingConnectionCustomSignaling pSignaling, ref SteamNetworkingIdentity pPeerIdentity, int nOptions, SteamNetworkingConfigValue_t[] pOptions)
 {
     InteropHelp.TestIfAvailableGameServer();
     return((HSteamNetConnection)NativeMethods.ISteamNetworkingSockets_ConnectP2PCustomSignaling(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), out pSignaling, ref pPeerIdentity, nOptions, pOptions));
 }
 public static int FindRelayAuthTicketForServer(ref SteamNetworkingIdentity identityGameServer, int nVirtualPort, out SteamDatagramRelayAuthTicket pOutParsedTicket)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamNetworkingSockets_FindRelayAuthTicketForServer(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), ref identityGameServer, nVirtualPort, out pOutParsedTicket));
 }
 public static bool GetIdentity(out SteamNetworkingIdentity pIdentity)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamNetworkingSockets_GetIdentity(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), out pIdentity));
 }
 public static bool CreateSocketPair(out HSteamNetConnection pOutConnection1, out HSteamNetConnection pOutConnection2, bool bUseNetworkLoopback, ref SteamNetworkingIdentity pIdentity1, ref SteamNetworkingIdentity pIdentity2)
 {
     InteropHelp.TestIfAvailableGameServer();
     return(NativeMethods.ISteamNetworkingSockets_CreateSocketPair(CSteamGameServerAPIContext.GetSteamNetworkingSockets(), out pOutConnection1, out pOutConnection2, bUseNetworkLoopback, ref pIdentity1, ref pIdentity2));
 }
Ejemplo n.º 8
0
		public static HSteamNetConnection ConnectToHostedDedicatedServer(ref SteamNetworkingIdentity identityTarget, int nVirtualPort, int nOptions, SteamNetworkingConfigValue_t[] pOptions)
		{
			InteropHelp.TestIfAvailableClient();
			return (HSteamNetConnection)NativeMethods.ISteamNetworkingSockets_ConnectToHostedDedicatedServer(CSteamAPIContext.GetSteamNetworkingSockets(), ref identityTarget, nVirtualPort, nOptions, pOptions);
		}
Ejemplo n.º 9
0
 /// 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.
 public IntPtr OnConnectRequest(HSteamNetConnection hConn, ref SteamNetworkingIdentity identityPeer)
 {
     return(NativeMethods.SteamAPI_ISteamNetworkingCustomSignalingRecvContext_OnConnectRequest(ref this, hConn, ref identityPeer));
 }
 /// <summary>
 /// <para>/ Get the real identity associated with a given FakeIP.</para>
 /// <para>/</para>
 /// <para>/ On failure, returns:</para>
 /// <para>/ - k_EResultInvalidParam: the IP is not a FakeIP.</para>
 /// <para>/ - k_EResultNoMatch: we don't recognize that FakeIP and don't know the corresponding identity.</para>
 /// <para>/</para>
 /// <para>/ FakeIP's used by active connections, or the FakeIPs assigned to local identities,</para>
 /// <para>/ will always work.  FakeIPs for recently destroyed connections will continue to</para>
 /// <para>/ return results for a little while, but not forever.  At some point, we will forget</para>
 /// <para>/ FakeIPs to save space.  It's reasonably safe to assume that you can read back the</para>
 /// <para>/ real identity of a connection very soon after it is destroyed.  But do not wait</para>
 /// <para>/ indefinitely.</para>
 /// </summary>
 public static EResult GetRealIdentityForFakeIP(ref SteamNetworkingIPAddr fakeIP, out SteamNetworkingIdentity pOutRealIdentity)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamNetworkingUtils_GetRealIdentityForFakeIP(CSteamAPIContext.GetSteamNetworkingUtils(), ref fakeIP, out pOutRealIdentity));
 }
Ejemplo n.º 11
0
 /// <summary>
 /// <para>/ Call this in response to a SteamNetworkingMessagesSessionRequest_t callback.</para>
 /// <para>/ SteamNetworkingMessagesSessionRequest_t are posted when a user tries to send you a message,</para>
 /// <para>/ and you haven't tried to talk to them first.  If you don't want to talk to them, just ignore</para>
 /// <para>/ the request.  If the user continues to send you messages, SteamNetworkingMessagesSessionRequest_t</para>
 /// <para>/ callbacks will continue to be posted periodically.</para>
 /// <para>/</para>
 /// <para>/ Returns false if there is no session with the user pending or otherwise.  If there is an</para>
 /// <para>/ existing active session, this function will return true, even if it is not pending.</para>
 /// <para>/</para>
 /// <para>/ Calling SendMessageToUser() will implicitly accepts any pending session request to that user.</para>
 /// </summary>
 public static bool AcceptSessionWithUser(ref SteamNetworkingIdentity identityRemote)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamNetworkingMessages_AcceptSessionWithUser(CSteamAPIContext.GetSteamNetworkingMessages(), ref identityRemote));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// <para>/ Sends a message to the specified host.  If we don't already have a session with that user,</para>
 /// <para>/ a session is implicitly created.  There might be some handshaking that needs to happen</para>
 /// <para>/ before we can actually begin sending message data.  If this handshaking fails and we can't</para>
 /// <para>/ get through, an error will be posted via the callback SteamNetworkingMessagesSessionFailed_t.</para>
 /// <para>/ There is no notification when the operation succeeds.  (You should have the peer send a reply</para>
 /// <para>/ for this purpose.)</para>
 /// <para>/</para>
 /// <para>/ Sending a message to a host will also implicitly accept any incoming connection from that host.</para>
 /// <para>/</para>
 /// <para>/ nSendFlags is a bitmask of k_nSteamNetworkingSend_xxx options</para>
 /// <para>/</para>
 /// <para>/ nRemoteChannel is a routing number you can use to help route message to different systems.</para>
 /// <para>/ You'll have to call ReceiveMessagesOnChannel() with the same channel number in order to retrieve</para>
 /// <para>/ the data on the other end.</para>
 /// <para>/</para>
 /// <para>/ Using different channels to talk to the same user will still use the same underlying</para>
 /// <para>/ connection, saving on resources.  If you don't need this feature, use 0.</para>
 /// <para>/ Otherwise, small integers are the most efficient.</para>
 /// <para>/</para>
 /// <para>/ It is guaranteed that reliable messages to the same host on the same channel</para>
 /// <para>/ will be be received by the remote host (if they are received at all) exactly once,</para>
 /// <para>/ and in the same order that they were sent.</para>
 /// <para>/</para>
 /// <para>/ NO other order guarantees exist!  In particular, unreliable messages may be dropped,</para>
 /// <para>/ received out of order with respect to each other and with respect to reliable data,</para>
 /// <para>/ or may be received multiple times.  Messages on different channels are *not* guaranteed</para>
 /// <para>/ to be received in the order they were sent.</para>
 /// <para>/</para>
 /// <para>/ A note for those familiar with TCP/IP ports, or converting an existing codebase that</para>
 /// <para>/ opened multiple sockets:  You might notice that there is only one channel, and with</para>
 /// <para>/ TCP/IP each endpoint has a port number.  You can think of the channel number as the</para>
 /// <para>/ *destination* port.  If you need each message to also include a "source port" (so the</para>
 /// <para>/ recipient can route the reply), then just put that in your message.  That is essentially</para>
 /// <para>/ how UDP works!</para>
 /// <para>/</para>
 /// <para>/ Returns:</para>
 /// <para>/ - k_EREsultOK on success.</para>
 /// <para>/ - k_EResultNoConnection, if the session has failed or was closed by the peer and</para>
 /// <para>/   k_nSteamNetworkingSend_AutoRestartBrokenSession was not specified.  (You can</para>
 /// <para>/   use GetSessionConnectionInfo to get the details.)  In order to acknowledge the</para>
 /// <para>/   broken session and start a new one, you must call CloseSessionWithUser, or you may</para>
 /// <para>/   repeat the call with k_nSteamNetworkingSend_AutoRestartBrokenSession.  See</para>
 /// <para>/   k_nSteamNetworkingSend_AutoRestartBrokenSession for more details.</para>
 /// <para>/ - See ISteamNetworkingSockets::SendMessageToConnection for more possible return values</para>
 /// </summary>
 public static EResult SendMessageToUser(ref SteamNetworkingIdentity identityRemote, IntPtr pubData, uint cubData, int nSendFlags, int nRemoteChannel)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamNetworkingMessages_SendMessageToUser(CSteamAPIContext.GetSteamNetworkingMessages(), ref identityRemote, pubData, cubData, nSendFlags, nRemoteChannel));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// <para>/ Returns information about the latest state of a connection, if any, with the given peer.</para>
 /// <para>/ Primarily intended for debugging purposes, but can also be used to get more detailed</para>
 /// <para>/ failure information.  (See SendMessageToUser and k_nSteamNetworkingSend_AutoRestartBrokenSession.)</para>
 /// <para>/</para>
 /// <para>/ Returns the value of SteamNetConnectionInfo_t::m_eState, or k_ESteamNetworkingConnectionState_None</para>
 /// <para>/ if no connection exists with specified peer.  You may pass nullptr for either parameter if</para>
 /// <para>/ you do not need the corresponding details.  Note that sessions time out after a while,</para>
 /// <para>/ so if a connection fails, or SendMessageToUser returns k_EResultNoConnection, you cannot wait</para>
 /// <para>/ indefinitely to obtain the reason for failure.</para>
 /// </summary>
 public static ESteamNetworkingConnectionState GetSessionConnectionInfo(ref SteamNetworkingIdentity identityRemote, out SteamNetConnectionInfo_t pConnectionInfo, out SteamNetConnectionRealTimeStatus_t pQuickStatus)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamNetworkingMessages_GetSessionConnectionInfo(CSteamAPIContext.GetSteamNetworkingMessages(), ref identityRemote, out pConnectionInfo, out pQuickStatus));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// <para>/ Call this  when you're done talking to a user on a specific channel.  Once all</para>
 /// <para>/ open channels to a user have been closed, the open session to the user will be</para>
 /// <para>/ closed, and any new data from this user will trigger a</para>
 /// <para>/ SteamSteamNetworkingMessagesSessionRequest_t callback</para>
 /// </summary>
 public static bool CloseChannelWithUser(ref SteamNetworkingIdentity identityRemote, int nLocalChannel)
 {
     InteropHelp.TestIfAvailableClient();
     return(NativeMethods.ISteamNetworkingMessages_CloseChannelWithUser(CSteamAPIContext.GetSteamNetworkingMessages(), ref identityRemote, nLocalChannel));
 }
        public IntPtr OnConnectRequest(HSteamNetConnection hConn, ref SteamNetworkingIdentity identityPeer) => default;         // 0x0000000180004D00-0x0000000180004E00

        public void SendRejectionSignal(ref SteamNetworkingIdentity identityPeer, IntPtr pMsg, int cbMsg)
        {
        }                                                                                                            // 0x0000000180004E00-0x0000000180004F10
 // Methods
 public IntPtr OnConnectRequest(HSteamNetConnection hConn, ref SteamNetworkingIdentity identityPeer) => default;         // 0x0000000180004D00-0x0000000180004E00
Ejemplo n.º 17
0
 /// 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.
 public IntPtr OnConnectRequest(HSteamNetConnection hConn, ref SteamNetworkingIdentity identityPeer, int nLocalVirtualPort)
 {
     return(NativeMethods.SteamAPI_ISteamNetworkingSignalingRecvContext_OnConnectRequest(ref this, hConn, ref identityPeer, nLocalVirtualPort));
 }
Ejemplo n.º 18
0
 public static HSteamListenSocket CreateListenSocketP2P(int nVirtualPort, int nOptions, SteamNetworkingConfigValue_t[] pOptions) => default;                                   // 0x00000001809576D0-0x0000000180957790
 public static HSteamNetConnection ConnectP2P(ref SteamNetworkingIdentity identityRemote, int nVirtualPort, int nOptions, SteamNetworkingConfigValue_t[] pOptions) => default; // 0x00000001809573B0-0x0000000180957480
Ejemplo n.º 19
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.
 public void SendRejectionSignal(ref SteamNetworkingIdentity identityPeer, IntPtr pMsg, int cbMsg)
 {
     NativeMethods.SteamAPI_ISteamNetworkingCustomSignalingRecvContext_SendRejectionSignal(ref this, ref identityPeer, pMsg, cbMsg);
 }
Ejemplo n.º 20
0
		public static bool GetIdentity(out SteamNetworkingIdentity pIdentity)
		{
			InteropHelp.TestIfAvailableClient();
			return NativeMethods.ISteamNetworkingSockets_GetIdentity(CSteamAPIContext.GetSteamNetworkingSockets(), out pIdentity);
		}