mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-12-28 11:24:15 +08:00
Merge pull request #8 from otavepto/patch-missing-impl
Add some missing implementations
This commit is contained in:
commit
5f78184e60
60
dev.notes/how to add a branch as a submodule.md
Normal file
60
dev.notes/how to add a branch as a submodule.md
Normal file
@ -0,0 +1,60 @@
|
||||
1. create an orphan branch
|
||||
```shell
|
||||
git checkout --orphan 'third-party/my-branch'
|
||||
```
|
||||
2. make sure no files are staged yet
|
||||
```shell
|
||||
git rm -r -f --cached .
|
||||
```
|
||||
3. copy some new files (or add ones that already exist)
|
||||
```shell
|
||||
cp ~/myfile.txt ./
|
||||
```
|
||||
4. stage the required files
|
||||
```shell
|
||||
git add myfile.txt
|
||||
```
|
||||
you can also stage all files in the current directory
|
||||
```shell
|
||||
git add .
|
||||
```
|
||||
5. commit the files
|
||||
```shell
|
||||
git commit -m 'my commit msg'
|
||||
```
|
||||
6. add the branch as submodule
|
||||
```shell
|
||||
git -c protocol.file.allow=always submodule add -f -b 'third-party/my-branch' file://"$(pwd)" 'my-relative-dir/without/dot/at/beginning'
|
||||
```
|
||||
git by default disallow local repos, this option `protocol.file.allow=always` forces git to allow it
|
||||
this will:
|
||||
- look for a **local** repo in the directory shown by `pwd` (current folder),
|
||||
notice how we don't simply use `./` because if we did that git will try to use the `origin` of the repo,
|
||||
and since the origin (github/gitlab/etc...) doesn't have this branch yet it will fail, using the file protocol (`file://absolute_path`) forces git to use the local repo files
|
||||
you can of course push the branch to origin before doing this step
|
||||
- look for a branch named `third-party/my-branch`
|
||||
- create a submodule pointing at this branch inside a new folder `my-relative-dir/without/dot/at/beginning`
|
||||
notice that the new folder does **not** start with `./` as usual
|
||||
7. fix the submodule path
|
||||
after the last command, the file `.gitmodules` will point at the absolute path of the repo on disk, fix it to be relative
|
||||
```shell
|
||||
git -c protocol.file.allow=always submodule add -f -b 'third-party/my-branch' ./ 'my-relative-dir/without/dot/at/beginning'
|
||||
```
|
||||
this time git won't try to grab the data from origin, it will just edit `.gitmodules`
|
||||
8. new git management objects/files will be staged, you can view them
|
||||
```shell
|
||||
git status
|
||||
```
|
||||
possible output
|
||||
```shell
|
||||
On branch third-party/my-branch
|
||||
|
||||
Changes to be committed:
|
||||
(use "git restore --staged <file>..." to unstage)
|
||||
modified: .gitmodules
|
||||
new file: third-party/my-branch
|
||||
```
|
||||
9. commit these 2 files
|
||||
```shell
|
||||
git commit -m 'add branch third-party/my-branch as submodule'
|
||||
```
|
@ -1333,7 +1333,13 @@ STEAMCLIENT_API steam_bool Steam_GetAPICallResult( HSteamPipe hSteamPipe, SteamA
|
||||
STEAMCLIENT_API void *CreateInterface( const char *pName, int *pReturnCode )
|
||||
{
|
||||
PRINT_DEBUG("%s %p", pName, pReturnCode);
|
||||
return create_client_interface(pName);
|
||||
auto ptr = create_client_interface(pName);
|
||||
if (ptr) {
|
||||
if (pReturnCode) *pReturnCode = 1;
|
||||
} else {
|
||||
if (pReturnCode) *pReturnCode = 0;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
STEAMCLIENT_API void Breakpad_SteamMiniDumpInit( uint32 a, const char *b, const char *c )
|
||||
|
@ -81,6 +81,8 @@ public ISteamNetworkingSockets004,
|
||||
public ISteamNetworkingSockets006,
|
||||
public ISteamNetworkingSockets008,
|
||||
public ISteamNetworkingSockets009,
|
||||
public ISteamNetworkingSockets010,
|
||||
public ISteamNetworkingSockets011,
|
||||
public ISteamNetworkingSockets
|
||||
{
|
||||
class Settings *settings{};
|
||||
@ -488,6 +490,9 @@ public:
|
||||
/// - k_EResultInvalidParam - nLanes is bad
|
||||
EResult GetConnectionRealTimeStatus( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus, int nLanes, SteamNetConnectionRealTimeLaneStatus_t *pLanes );
|
||||
|
||||
// based on reversing the vftable returned from original steamclient64.dll
|
||||
bool GetConnectionRealTimeStatus_old( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus );
|
||||
|
||||
/// Fetch the next available message(s) from the socket, if any.
|
||||
/// Returns the number of messages returned into your array, up to nMaxMessages.
|
||||
/// If the connection handle is invalid, -1 is returned.
|
||||
|
@ -77,6 +77,7 @@ public ISteamRemoteStorage011,
|
||||
public ISteamRemoteStorage012,
|
||||
public ISteamRemoteStorage013,
|
||||
public ISteamRemoteStorage014,
|
||||
public ISteamRemoteStorage015,
|
||||
public ISteamRemoteStorage
|
||||
{
|
||||
private:
|
||||
|
@ -44,6 +44,7 @@ public ISteamUGC007,
|
||||
public ISteamUGC008,
|
||||
public ISteamUGC009,
|
||||
public ISteamUGC010,
|
||||
public ISteamUGC011,
|
||||
public ISteamUGC012,
|
||||
public ISteamUGC013,
|
||||
public ISteamUGC014,
|
||||
|
@ -311,16 +311,16 @@ void *Steam_Client::GetISteamGenericInterface( HSteamUser hSteamUser, HSteamPipe
|
||||
return reinterpret_cast<void *>(static_cast<ISteamNetworkingSockets004 *>( steam_networking_sockets_temp));
|
||||
} else if (strcmp(pchVersion, "SteamNetworkingSockets006") == 0) {
|
||||
return reinterpret_cast<void *>(static_cast<ISteamNetworkingSockets006 *>( steam_networking_sockets_temp));
|
||||
|
||||
// SteamNetworkingSockets007 Not found in public Archive, must be between 1.47-1.48
|
||||
|
||||
} else if (strcmp(pchVersion, "SteamNetworkingSockets007") == 0) { // Not found in public Archive, real steamclient64.dll returns null
|
||||
return nullptr;
|
||||
} else if (strcmp(pchVersion, "SteamNetworkingSockets008") == 0) {
|
||||
return reinterpret_cast<void *>(static_cast<ISteamNetworkingSockets008 *>( steam_networking_sockets_temp));
|
||||
} else if (strcmp(pchVersion, "SteamNetworkingSockets009") == 0) {
|
||||
return reinterpret_cast<void *>(static_cast<ISteamNetworkingSockets009 *>( steam_networking_sockets_temp));
|
||||
|
||||
// SteamNetworkingSockets010-011 Not found in public Archive, must be between 1.52-1.53
|
||||
|
||||
} else if (strcmp(pchVersion, "SteamNetworkingSockets010") == 0) { // Not found in public Archive, based on reversing
|
||||
return reinterpret_cast<void *>(static_cast<ISteamNetworkingSockets010 *>( steam_networking_sockets_temp));
|
||||
} else if (strcmp(pchVersion, "SteamNetworkingSockets011") == 0) { // Not found in public Archive, based on reversing, requested by appid 1492070
|
||||
return reinterpret_cast<void *>(static_cast<ISteamNetworkingSockets011 *>( steam_networking_sockets_temp));
|
||||
} else if (strcmp(pchVersion, STEAMNETWORKINGSOCKETS_INTERFACE_VERSION) == 0) {
|
||||
return reinterpret_cast<void *>(static_cast<ISteamNetworkingSockets *>( steam_networking_sockets_temp));
|
||||
}
|
||||
@ -572,9 +572,8 @@ ISteamRemoteStorage *Steam_Client::GetISteamRemoteStorage( HSteamUser hSteamuser
|
||||
return reinterpret_cast<ISteamRemoteStorage *>(static_cast<ISteamRemoteStorage013 *>(steam_remote_storage));
|
||||
} else if (strcmp(pchVersion, "STEAMREMOTESTORAGE_INTERFACE_VERSION014") == 0) {
|
||||
return reinterpret_cast<ISteamRemoteStorage *>(static_cast<ISteamRemoteStorage014 *>(steam_remote_storage));
|
||||
|
||||
// STEAMREMOTESTORAGE_INTERFACE_VERSION015 Not found in public Archive, must be between 1.51-1.52
|
||||
|
||||
} else if (strcmp(pchVersion, "STEAMREMOTESTORAGE_INTERFACE_VERSION015") == 0) { // Not found in public Archive, based on reversing
|
||||
return reinterpret_cast<ISteamRemoteStorage *>(static_cast<ISteamRemoteStorage015 *>(steam_remote_storage));
|
||||
} else if (strcmp(pchVersion, STEAMREMOTESTORAGE_INTERFACE_VERSION) == 0) {
|
||||
return reinterpret_cast<ISteamRemoteStorage *>(static_cast<ISteamRemoteStorage *>(steam_remote_storage));
|
||||
}
|
||||
@ -710,9 +709,8 @@ ISteamUGC *Steam_Client::GetISteamUGC( HSteamUser hSteamUser, HSteamPipe hSteamP
|
||||
return reinterpret_cast<ISteamUGC *>(static_cast<ISteamUGC009 *>(steam_ugc_temp));
|
||||
} else if (strcmp(pchVersion, "STEAMUGC_INTERFACE_VERSION010") == 0) {
|
||||
return reinterpret_cast<ISteamUGC *>(static_cast<ISteamUGC010 *>(steam_ugc_temp));
|
||||
|
||||
// STEAMUGC_INTERFACE_VERSION011 Not found in public Archive, must be between 1.42-1.43
|
||||
|
||||
} else if (strcmp(pchVersion, "STEAMUGC_INTERFACE_VERSION011") == 0) { // Not found in public Archive, based on reversing
|
||||
return reinterpret_cast<ISteamUGC *>(static_cast<ISteamUGC011 *>(steam_ugc_temp));
|
||||
} else if (strcmp(pchVersion, "STEAMUGC_INTERFACE_VERSION012") == 0) {
|
||||
return reinterpret_cast<ISteamUGC *>(static_cast<ISteamUGC012 *>(steam_ugc_temp));
|
||||
} else if (strcmp(pchVersion, "STEAMUGC_INTERFACE_VERSION013") == 0) {
|
||||
|
@ -923,7 +923,7 @@ bool Steam_Networking_Sockets::GetConnectionInfo( HSteamNetConnection hConn, Ste
|
||||
/// - k_EResultInvalidParam - nLanes is bad
|
||||
EResult Steam_Networking_Sockets::GetConnectionRealTimeStatus( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus, int nLanes, SteamNetConnectionRealTimeLaneStatus_t *pLanes )
|
||||
{
|
||||
PRINT_DEBUG("%s %u %p %i %p", __FUNCTION__, hConn, pStatus, nLanes, pLanes);
|
||||
PRINT_DEBUG("%u %p %i %p", hConn, pStatus, nLanes, pLanes);
|
||||
std::lock_guard<std::recursive_mutex> lock(global_mutex);
|
||||
auto connect_socket = sbcs->connect_sockets.find(hConn);
|
||||
if (connect_socket == sbcs->connect_sockets.end()) return k_EResultNoConnection;
|
||||
@ -950,6 +950,24 @@ EResult Steam_Networking_Sockets::GetConnectionRealTimeStatus( HSteamNetConnecti
|
||||
return k_EResultOK;
|
||||
}
|
||||
|
||||
// based on reversing the vftable returned from original steamclient64.dll
|
||||
bool Steam_Networking_Sockets::GetConnectionRealTimeStatus_old( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus )
|
||||
{
|
||||
PRINT_DEBUG("undocumented API, interface v10-11");
|
||||
/*
|
||||
...
|
||||
xor r9d, r9d // int nLanes = 0
|
||||
mov qword ptr ss:[rsp+0x20], 0x0 // SteamNetConnectionRealTimeLaneStatus_t *pLanes = nullptr
|
||||
...
|
||||
call qword ptr ds:[rax+0x80] // call GetConnectionRealTimeStatus(hConn, pStatus, nLanes, pLanes)
|
||||
test eax, eax
|
||||
setne al if (eax !=0) { al=1 } else { al=0 }
|
||||
...
|
||||
ret
|
||||
*/
|
||||
return GetConnectionRealTimeStatus(hConn, pStatus, 0, nullptr) != EResult::k_EResultNone;
|
||||
}
|
||||
|
||||
/// Fetch the next available message(s) from the socket, if any.
|
||||
/// Returns the number of messages returned into your array, up to nMaxMessages.
|
||||
/// If the connection handle is invalid, -1 is returned.
|
||||
|
@ -133,28 +133,6 @@ void common_helpers::write(std::ofstream &file, std::string_view data)
|
||||
file << data << std::endl;
|
||||
}
|
||||
|
||||
std::wstring common_helpers::str_to_w(std::string_view str)
|
||||
{
|
||||
if (str.empty()) return std::wstring();
|
||||
auto cvt_state = std::mbstate_t();
|
||||
const char* src = &str[0];
|
||||
size_t conversion_bytes = std::mbsrtowcs(nullptr, &src, 0, &cvt_state);
|
||||
std::wstring res(conversion_bytes + 1, L'\0');
|
||||
std::mbsrtowcs(&res[0], &src, res.size(), &cvt_state);
|
||||
return res.substr(0, conversion_bytes);
|
||||
}
|
||||
|
||||
std::string common_helpers::wstr_to_a(std::wstring_view wstr)
|
||||
{
|
||||
if (wstr.empty()) return std::string();
|
||||
auto cvt_state = std::mbstate_t();
|
||||
const wchar_t* src = &wstr[0];
|
||||
size_t conversion_bytes = std::wcsrtombs(nullptr, &src, 0, &cvt_state);
|
||||
std::string res(conversion_bytes + 1, '\0');
|
||||
std::wcsrtombs(&res[0], &src, res.size(), &cvt_state);
|
||||
return res.substr(0, conversion_bytes);
|
||||
}
|
||||
|
||||
bool common_helpers::starts_with_i(std::string_view target, std::string_view query)
|
||||
{
|
||||
if (target.size() < query.size()) {
|
||||
|
804
sdk/steam/isteamnetworkingsockets010.h
Normal file
804
sdk/steam/isteamnetworkingsockets010.h
Normal file
@ -0,0 +1,804 @@
|
||||
|
||||
#ifndef ISTEAMNETWORKINGSOCKETS010
|
||||
#define ISTEAMNETWORKINGSOCKETS010
|
||||
|
||||
// this interface version is not found in public SDK archives, it is based on reversing the returned vftable from steamclient64.dll
|
||||
|
||||
class ISteamNetworkingSockets010
|
||||
{
|
||||
public:
|
||||
|
||||
/// Creates a "server" socket that listens for clients to connect to by
|
||||
/// calling ConnectByIPAddress, over ordinary UDP (IPv4 or IPv6)
|
||||
///
|
||||
/// You must select a specific local port to listen on and set it
|
||||
/// the port field of the local address.
|
||||
///
|
||||
/// Usually you will set the IP portion of the address to zero (SteamNetworkingIPAddr::Clear()).
|
||||
/// This means that you will not bind to any particular local interface (i.e. the same
|
||||
/// as INADDR_ANY in plain socket code). Furthermore, if possible the socket will be bound
|
||||
/// in "dual stack" mode, which means that it can accept both IPv4 and IPv6 client connections.
|
||||
/// If you really do wish to bind a particular interface, then set the local address to the
|
||||
/// appropriate IPv4 or IPv6 IP.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t
|
||||
/// will be posted. The connection will be in the connecting state.
|
||||
virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
/// Creates a connection and begins talking to a "server" over UDP at the
|
||||
/// given IPv4 or IPv6 address. The remote host must be listening with a
|
||||
/// matching call to CreateListenSocketIP on the specified port.
|
||||
///
|
||||
/// A SteamNetConnectionStatusChangedCallback_t callback will be triggered when we start
|
||||
/// connecting, and then another one on either timeout or successful connection.
|
||||
///
|
||||
/// If the server does not have any identity configured, then their network address
|
||||
/// will be the only identity in use. Or, the network host may provide a platform-specific
|
||||
/// identity with or without a valid certificate to authenticate that identity. (These
|
||||
/// details will be contained in the SteamNetConnectionStatusChangedCallback_t.) It's
|
||||
/// up to your application to decide whether to allow the connection.
|
||||
///
|
||||
/// By default, all connections will get basic encryption sufficient to prevent
|
||||
/// casual eavesdropping. But note that without certificates (or a shared secret
|
||||
/// distributed through some other out-of-band mechanism), you don't have any
|
||||
/// way of knowing who is actually on the other end, and thus are vulnerable to
|
||||
/// man-in-the-middle attacks.
|
||||
///
|
||||
/// 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 ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P.
|
||||
///
|
||||
/// 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 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.
|
||||
///
|
||||
/// If you are listening on a dedicated servers in known data center,
|
||||
/// then you can listen using this function instead of CreateHostedDedicatedServerListenSocket,
|
||||
/// to allow clients to connect without a ticket. Any user that owns
|
||||
/// the app and is signed into Steam will be able to attempt to connect to
|
||||
/// your server. Also, a connection attempt may require the client to
|
||||
/// be connected to Steam, which is one more moving part that may fail. When
|
||||
/// tickets are used, then once a ticket is obtained, a client can connect to
|
||||
/// your server even if they got disconnected from Steam or Steam is offline.
|
||||
///
|
||||
/// 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 nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
/// 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.)
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// To use your own signaling service, see:
|
||||
/// - ConnectP2PCustomSignaling
|
||||
/// - k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling
|
||||
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.
|
||||
///
|
||||
/// When a connection attempt is received (perhaps after a few basic handshake
|
||||
/// packets have been exchanged to prevent trivial spoofing), a connection interface
|
||||
/// object is created in the k_ESteamNetworkingConnectionState_Connecting state
|
||||
/// and a SteamNetConnectionStatusChangedCallback_t is posted. At this point, your
|
||||
/// application MUST either accept or close the connection. (It may not ignore it.)
|
||||
/// Accepting the connection will transition it either into the connected state,
|
||||
/// or the finding route state, depending on the connection type.
|
||||
///
|
||||
/// You should take action within a second or two, because accepting the connection is
|
||||
/// what actually sends the reply notifying the client that they are connected. If you
|
||||
/// delay taking action, from the client's perspective it is the same as the network
|
||||
/// being unresponsive, and the client may timeout the connection attempt. In other
|
||||
/// words, the client cannot distinguish between a delay caused by network problems
|
||||
/// and a delay caused by the application.
|
||||
///
|
||||
/// This means that if your application goes for more than a few seconds without
|
||||
/// processing callbacks (for example, while loading a map), then there is a chance
|
||||
/// that a client may attempt to connect in that interval and fail due to timeout.
|
||||
///
|
||||
/// If the application does not respond to the connection attempt in a timely manner,
|
||||
/// and we stop receiving communication from the client, the connection attempt will
|
||||
/// be timed out locally, transitioning the connection to the
|
||||
/// k_ESteamNetworkingConnectionState_ProblemDetectedLocally state. The client may also
|
||||
/// close the connection before it is accepted, and a transition to the
|
||||
/// k_ESteamNetworkingConnectionState_ClosedByPeer is also possible depending the exact
|
||||
/// sequence of events.
|
||||
///
|
||||
/// Returns k_EResultInvalidParam if the handle is invalid.
|
||||
/// Returns k_EResultInvalidState if the connection is not in the appropriate state.
|
||||
/// (Remember that the connection state could change in between the time that the
|
||||
/// notification being posted to the queue and when it is received by the application.)
|
||||
///
|
||||
/// A note about connection configuration options. If you need to set any configuration
|
||||
/// options that are common to all connections accepted through a particular listen
|
||||
/// socket, consider setting the options on the listen socket, since such options are
|
||||
/// inherited automatically. If you really do need to set options that are connection
|
||||
/// specific, it is safe to set them on the connection before accepting the connection.
|
||||
virtual EResult AcceptConnection( HSteamNetConnection hConn ) = 0;
|
||||
|
||||
/// Disconnects from the remote host and invalidates the connection handle.
|
||||
/// Any unread data on the connection is discarded.
|
||||
///
|
||||
/// nReason is an application defined code that will be received on the other
|
||||
/// end and recorded (when possible) in backend analytics. The value should
|
||||
/// come from a restricted range. (See ESteamNetConnectionEnd.) If you don't need
|
||||
/// to communicate any information to the remote host, and do not want analytics to
|
||||
/// be able to distinguish "normal" connection terminations from "exceptional" ones,
|
||||
/// You may pass zero, in which case the generic value of
|
||||
/// k_ESteamNetConnectionEnd_App_Generic will be used.
|
||||
///
|
||||
/// pszDebug is an optional human-readable diagnostic string that will be received
|
||||
/// by the remote host and recorded (when possible) in backend analytics.
|
||||
///
|
||||
/// If you wish to put the socket into a "linger" state, where an attempt is made to
|
||||
/// flush any remaining sent data, use bEnableLinger=true. Otherwise reliable data
|
||||
/// is not flushed.
|
||||
///
|
||||
/// If the connection has already ended and you are just freeing up the
|
||||
/// connection interface, the reason code, debug string, and linger flag are
|
||||
/// ignored.
|
||||
virtual bool CloseConnection( HSteamNetConnection hPeer, int nReason, const char *pszDebug, bool bEnableLinger ) = 0;
|
||||
|
||||
/// Destroy a listen socket. All the connections that were accepting on the listen
|
||||
/// socket are closed ungracefully.
|
||||
virtual bool CloseListenSocket( HSteamListenSocket hSocket ) = 0;
|
||||
|
||||
/// Set connection user data. the data is returned in the following places
|
||||
/// - You can query it using GetConnectionUserData.
|
||||
/// - The SteamNetworkingmessage_t structure.
|
||||
/// - The SteamNetConnectionInfo_t structure.
|
||||
/// (Which is a member of SteamNetConnectionStatusChangedCallback_t -- but see WARNINGS below!!!!)
|
||||
///
|
||||
/// Do you need to set this atomically when the connection is created?
|
||||
/// See k_ESteamNetworkingConfig_ConnectionUserData.
|
||||
///
|
||||
/// WARNING: Be *very careful* when using the value provided in callbacks structs.
|
||||
/// Callbacks are queued, and the value that you will receive in your
|
||||
/// callback is the userdata that was effective at the time the callback
|
||||
/// was queued. There are subtle race conditions that can happen if you
|
||||
/// don't understand this!
|
||||
///
|
||||
/// If any incoming messages for this connection are queued, the userdata
|
||||
/// field is updated, so that when when you receive messages (e.g. with
|
||||
/// ReceiveMessagesOnConnection), they will always have the very latest
|
||||
/// userdata. So the tricky race conditions that can happen with callbacks
|
||||
/// do not apply to retrieving messages.
|
||||
///
|
||||
/// Returns false if the handle is invalid.
|
||||
virtual bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData ) = 0;
|
||||
|
||||
/// Fetch connection user data. Returns -1 if handle is invalid
|
||||
/// or if you haven't set any userdata on the connection.
|
||||
virtual int64 GetConnectionUserData( HSteamNetConnection hPeer ) = 0;
|
||||
|
||||
/// Set a name for the connection, used mostly for debugging
|
||||
virtual void SetConnectionName( HSteamNetConnection hPeer, const char *pszName ) = 0;
|
||||
|
||||
/// Fetch connection name. Returns false if handle is invalid
|
||||
virtual bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) = 0;
|
||||
|
||||
/// Send a message to the remote host on the specified connection.
|
||||
///
|
||||
/// nSendFlags determines the delivery guarantees that will be provided,
|
||||
/// when data should be buffered, etc. E.g. k_nSteamNetworkingSend_Unreliable
|
||||
///
|
||||
/// Note that the semantics we use for messages are not precisely
|
||||
/// the same as the semantics of a standard "stream" socket.
|
||||
/// (SOCK_STREAM) For an ordinary stream socket, the boundaries
|
||||
/// between chunks are not considered relevant, and the sizes of
|
||||
/// the chunks of data written will not necessarily match up to
|
||||
/// the sizes of the chunks that are returned by the reads on
|
||||
/// the other end. The remote host might read a partial chunk,
|
||||
/// or chunks might be coalesced. For the message semantics
|
||||
/// used here, however, the sizes WILL match. Each send call
|
||||
/// will match a successful read call on the remote host
|
||||
/// one-for-one. If you are porting existing stream-oriented
|
||||
/// code to the semantics of reliable messages, your code should
|
||||
/// work the same, since reliable message semantics are more
|
||||
/// strict than stream semantics. The only caveat is related to
|
||||
/// performance: there is per-message overhead to retain the
|
||||
/// message sizes, and so if your code sends many small chunks
|
||||
/// of data, performance will suffer. Any code based on stream
|
||||
/// sockets that does not write excessively small chunks will
|
||||
/// work without any changes.
|
||||
///
|
||||
/// The pOutMessageNumber is an optional pointer to receive the
|
||||
/// message number assigned to the message, if sending was successful.
|
||||
///
|
||||
/// Returns:
|
||||
/// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big.
|
||||
/// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend)
|
||||
/// - k_EResultInvalidState: connection is in an invalid state
|
||||
/// - k_EResultNoConnection: connection has ended
|
||||
/// - k_EResultIgnored: You used k_nSteamNetworkingSend_NoDelay, and the message was dropped because
|
||||
/// we were not ready to send it.
|
||||
/// - k_EResultLimitExceeded: there was already too much data queued to be sent.
|
||||
/// (See k_ESteamNetworkingConfig_SendBufferSize)
|
||||
virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags, int64 *pOutMessageNumber ) = 0;
|
||||
|
||||
/// Send one or more messages without copying the message payload.
|
||||
/// This is the most efficient way to send messages. To use this
|
||||
/// function, you must first allocate a message object using
|
||||
/// ISteamNetworkingUtils::AllocateMessage. (Do not declare one
|
||||
/// on the stack or allocate your own.)
|
||||
///
|
||||
/// You should fill in the message payload. You can either let
|
||||
/// it allocate the buffer for you and then fill in the payload,
|
||||
/// or if you already have a buffer allocated, you can just point
|
||||
/// m_pData at your buffer and set the callback to the appropriate function
|
||||
/// to free it. Note that if you use your own buffer, it MUST remain valid
|
||||
/// until the callback is executed. And also note that your callback can be
|
||||
/// invoked at any time from any thread (perhaps even before SendMessages
|
||||
/// returns!), so it MUST be fast and threadsafe.
|
||||
///
|
||||
/// You MUST also fill in:
|
||||
/// - m_conn - the handle of the connection to send the message to
|
||||
/// - m_nFlags - bitmask of k_nSteamNetworkingSend_xxx flags.
|
||||
///
|
||||
/// All other fields are currently reserved and should not be modified.
|
||||
///
|
||||
/// The library will take ownership of the message structures. They may
|
||||
/// be modified or become invalid at any time, so you must not read them
|
||||
/// after passing them to this function.
|
||||
///
|
||||
/// pOutMessageNumberOrResult is an optional array that will receive,
|
||||
/// for each message, the message number that was assigned to the message
|
||||
/// if sending was successful. If sending failed, then a negative EResult
|
||||
/// value is placed into the array. For example, the array will hold
|
||||
/// -k_EResultInvalidState if the connection was in an invalid state.
|
||||
/// See ISteamNetworkingSockets::SendMessageToConnection for possible
|
||||
/// failure codes.
|
||||
virtual void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, int64 *pOutMessageNumberOrResult ) = 0;
|
||||
|
||||
/// Flush any messages waiting on the Nagle timer and send them
|
||||
/// at the next transmission opportunity (often that means right now).
|
||||
///
|
||||
/// If Nagle is enabled (it's on by default) then when calling
|
||||
/// SendMessageToConnection the message will be buffered, up to the Nagle time
|
||||
/// before being sent, to merge small messages into the same packet.
|
||||
/// (See k_ESteamNetworkingConfig_NagleTime)
|
||||
///
|
||||
/// Returns:
|
||||
/// k_EResultInvalidParam: invalid connection handle
|
||||
/// k_EResultInvalidState: connection is in an invalid state
|
||||
/// k_EResultNoConnection: connection has ended
|
||||
/// k_EResultIgnored: We weren't (yet) connected, so this operation has no effect.
|
||||
virtual EResult FlushMessagesOnConnection( HSteamNetConnection hConn ) = 0;
|
||||
|
||||
/// Fetch the next available message(s) from the connection, if any.
|
||||
/// Returns the number of messages returned into your array, up to nMaxMessages.
|
||||
/// If the connection handle is invalid, -1 is returned.
|
||||
///
|
||||
/// The order of the messages returned in the array is relevant.
|
||||
/// Reliable messages will be received in the order they were sent (and with the
|
||||
/// same sizes --- see SendMessageToConnection for on this subtle difference from a stream socket).
|
||||
///
|
||||
/// Unreliable messages may be dropped, or delivered out of order with respect to
|
||||
/// each other or with respect to reliable messages. The same unreliable message
|
||||
/// may be received multiple times.
|
||||
///
|
||||
/// If any messages are returned, you MUST call SteamNetworkingMessage_t::Release() on each
|
||||
/// of them free up resources after you are done. It is safe to keep the object alive for
|
||||
/// a little while (put it into some queue, etc), and you may call Release() from any thread.
|
||||
virtual int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
|
||||
|
||||
/// Returns basic information about the high-level state of the connection.
|
||||
virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0;
|
||||
|
||||
// based on reversing the vftable returned from original steamclient64.dll
|
||||
virtual bool GetConnectionRealTimeStatus_old( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus ) = 0;
|
||||
|
||||
/// Returns detailed connection stats in text format. Useful
|
||||
/// for dumping to a log, etc.
|
||||
///
|
||||
/// Returns:
|
||||
/// -1 failure (bad connection handle)
|
||||
/// 0 OK, your buffer was filled in and '\0'-terminated
|
||||
/// >0 Your buffer was either nullptr, or it was too small and the text got truncated.
|
||||
/// Try again with a buffer of at least N bytes.
|
||||
virtual int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cbBuf ) = 0;
|
||||
|
||||
/// Returns local IP and port that a listen socket created using CreateListenSocketIP is bound to.
|
||||
///
|
||||
/// An IPv6 address of ::0 means "any IPv4 or IPv6"
|
||||
/// An IPv6 address of ::ffff:0000:0000 means "any IPv4"
|
||||
virtual bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr *address ) = 0;
|
||||
|
||||
/// Create a pair of connections that are talking to each other, e.g. a loopback connection.
|
||||
/// This is very useful for testing, or so that your client/server code can work the same
|
||||
/// even when you are running a local "server".
|
||||
///
|
||||
/// The two connections will immediately be placed into the connected state, and no callbacks
|
||||
/// will be posted immediately. After this, if you close either connection, the other connection
|
||||
/// will receive a callback, exactly as if they were communicating over the network. You must
|
||||
/// close *both* sides in order to fully clean up the resources!
|
||||
///
|
||||
/// By default, internal buffers are used, completely bypassing the network, the chopping up of
|
||||
/// messages into packets, encryption, copying the payload, etc. This means that loopback
|
||||
/// packets, by default, will not simulate lag or loss. Passing true for bUseNetworkLoopback will
|
||||
/// cause the socket pair to send packets through the local network loopback device (127.0.0.1)
|
||||
/// on ephemeral ports. Fake lag and loss are supported in this case, and CPU time is expended
|
||||
/// to encrypt and decrypt.
|
||||
///
|
||||
/// If you wish to assign a specific identity to either connection, you may pass a particular
|
||||
/// identity. Otherwise, if you pass nullptr, the respective connection will assume a generic
|
||||
/// "localhost" identity. If you use real network loopback, this might be translated to the
|
||||
/// actual bound loopback port. Otherwise, the port will be zero.
|
||||
virtual bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection *pOutConnection2, bool bUseNetworkLoopback, const SteamNetworkingIdentity *pIdentity1, const SteamNetworkingIdentity *pIdentity2 ) = 0;
|
||||
|
||||
//
|
||||
// Identity and authentication
|
||||
//
|
||||
|
||||
/// Get the identity assigned to this interface.
|
||||
/// E.g. on Steam, this is the user's SteamID, or for the gameserver interface, the SteamID assigned
|
||||
/// to the gameserver. Returns false and sets the result to an invalid identity if we don't know
|
||||
/// our identity yet. (E.g. GameServer has not logged in. On Steam, the user will know their SteamID
|
||||
/// even if they are not signed into Steam.)
|
||||
virtual bool GetIdentity( SteamNetworkingIdentity *pIdentity ) = 0;
|
||||
|
||||
/// Indicate our desire to be ready participate in authenticated communications.
|
||||
/// If we are currently not ready, then steps will be taken to obtain the necessary
|
||||
/// certificates. (This includes a certificate for us, as well as any CA certificates
|
||||
/// needed to authenticate peers.)
|
||||
///
|
||||
/// You can call this at program init time if you know that you are going to
|
||||
/// be making authenticated connections, so that we will be ready immediately when
|
||||
/// those connections are attempted. (Note that essentially all connections require
|
||||
/// authentication, with the exception of ordinary UDP connections with authentication
|
||||
/// disabled using k_ESteamNetworkingConfig_IP_AllowWithoutAuth.) If you don't call
|
||||
/// this function, we will wait until a feature is utilized that that necessitates
|
||||
/// these resources.
|
||||
///
|
||||
/// You can also call this function to force a retry, if failure has occurred.
|
||||
/// Once we make an attempt and fail, we will not automatically retry.
|
||||
/// In this respect, the behavior of the system after trying and failing is the same
|
||||
/// as before the first attempt: attempting authenticated communication or calling
|
||||
/// this function will call the system to attempt to acquire the necessary resources.
|
||||
///
|
||||
/// You can use GetAuthenticationStatus or listen for SteamNetAuthenticationStatus_t
|
||||
/// to monitor the status.
|
||||
///
|
||||
/// Returns the current value that would be returned from GetAuthenticationStatus.
|
||||
virtual ESteamNetworkingAvailability InitAuthentication() = 0;
|
||||
|
||||
/// Query our readiness to participate in authenticated communications. A
|
||||
/// SteamNetAuthenticationStatus_t callback is posted any time this status changes,
|
||||
/// but you can use this function to query it at any time.
|
||||
///
|
||||
/// The value of SteamNetAuthenticationStatus_t::m_eAvail is returned. If you only
|
||||
/// want this high level status, you can pass NULL for pDetails. If you want further
|
||||
/// details, pass non-NULL to receive them.
|
||||
virtual ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStatus_t *pDetails ) = 0;
|
||||
|
||||
//
|
||||
// Poll groups. A poll group is a set of connections that can be polled efficiently.
|
||||
// (In our API, to "poll" a connection means to retrieve all pending messages. We
|
||||
// actually don't have an API to "poll" the connection *state*, like BSD sockets.)
|
||||
//
|
||||
|
||||
/// Create a new poll group.
|
||||
///
|
||||
/// You should destroy the poll group when you are done using DestroyPollGroup
|
||||
virtual HSteamNetPollGroup CreatePollGroup() = 0;
|
||||
|
||||
/// Destroy a poll group created with CreatePollGroup().
|
||||
///
|
||||
/// If there are any connections in the poll group, they are removed from the group,
|
||||
/// and left in a state where they are not part of any poll group.
|
||||
/// Returns false if passed an invalid poll group handle.
|
||||
virtual bool DestroyPollGroup( HSteamNetPollGroup hPollGroup ) = 0;
|
||||
|
||||
/// Assign a connection to a poll group. Note that a connection may only belong to a
|
||||
/// single poll group. Adding a connection to a poll group implicitly removes it from
|
||||
/// any other poll group it is in.
|
||||
///
|
||||
/// You can pass k_HSteamNetPollGroup_Invalid to remove a connection from its current
|
||||
/// poll group without adding it to a new poll group.
|
||||
///
|
||||
/// If there are received messages currently pending on the connection, an attempt
|
||||
/// is made to add them to the queue of messages for the poll group in approximately
|
||||
/// the order that would have applied if the connection was already part of the poll
|
||||
/// group at the time that the messages were received.
|
||||
///
|
||||
/// Returns false if the connection handle is invalid, or if the poll group handle
|
||||
/// is invalid (and not k_HSteamNetPollGroup_Invalid).
|
||||
virtual bool SetConnectionPollGroup( HSteamNetConnection hConn, HSteamNetPollGroup hPollGroup ) = 0;
|
||||
|
||||
/// Same as ReceiveMessagesOnConnection, but will return the next messages available
|
||||
/// on any connection in the poll group. Examine SteamNetworkingMessage_t::m_conn
|
||||
/// to know which connection. (SteamNetworkingMessage_t::m_nConnUserData might also
|
||||
/// be useful.)
|
||||
///
|
||||
/// Delivery order of messages among different connections will usually match the
|
||||
/// order that the last packet was received which completed the message. But this
|
||||
/// is not a strong guarantee, especially for packets received right as a connection
|
||||
/// is being assigned to poll group.
|
||||
///
|
||||
/// Delivery order of messages on the same connection is well defined and the
|
||||
/// same guarantees are present as mentioned in ReceiveMessagesOnConnection.
|
||||
/// (But the messages are not grouped by connection, so they will not necessarily
|
||||
/// appear consecutively in the list; they may be interleaved with messages for
|
||||
/// other connections.)
|
||||
virtual int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
|
||||
|
||||
//
|
||||
// Clients connecting to dedicated servers hosted in a data center,
|
||||
// using tickets issued by your game coordinator. If you are not
|
||||
// issuing your own tickets to restrict who can attempt to connect
|
||||
// to your server, then you won't use these functions.
|
||||
//
|
||||
|
||||
/// Call this when you receive a ticket from your backend / matchmaking system. Puts the
|
||||
/// ticket into a persistent cache, and optionally returns the parsed ticket.
|
||||
///
|
||||
/// See stamdatagram_ticketgen.h for more details.
|
||||
virtual bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0;
|
||||
|
||||
/// Search cache for a ticket to talk to the server on the specified virtual port.
|
||||
/// If found, returns the number of seconds until the ticket expires, and optionally
|
||||
/// the complete cracked ticket. Returns 0 if we don't have a ticket.
|
||||
///
|
||||
/// 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 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! If you are not issuing your own tickets, then to connect to a dedicated
|
||||
/// server via SDR in auto-ticket mode, use ConnectP2P. (The server must be configured to allow
|
||||
/// this type of connection by listening using CreateListenSocketP2P.)
|
||||
///
|
||||
/// You may wonder why tickets are stored in a cache, instead of simply being passed as an argument
|
||||
/// here. The reason is to make reconnection to a gameserver robust, even if the client computer loses
|
||||
/// connection to Steam or the central backend, or the app is restarted or crashes, etc.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
///
|
||||
/// 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 nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
//
|
||||
// Servers hosted in data centers known to the Valve relay network
|
||||
//
|
||||
|
||||
/// Returns the value of the SDR_LISTEN_PORT environment variable. This
|
||||
/// is the UDP server your server will be listening on. This will
|
||||
/// configured automatically for you in production environments.
|
||||
///
|
||||
/// In development, you'll need to set it yourself. See
|
||||
/// https://partner.steamgames.com/doc/api/ISteamNetworkingSockets
|
||||
/// for more information on how to configure dev environments.
|
||||
virtual uint16 GetHostedDedicatedServerPort() = 0;
|
||||
|
||||
/// Returns 0 if SDR_LISTEN_PORT is not set. Otherwise, returns the data center the server
|
||||
/// is running in. This will be k_SteamDatagramPOPID_dev in non-production environment.
|
||||
virtual SteamNetworkingPOPID GetHostedDedicatedServerPOPID() = 0;
|
||||
|
||||
/// Return info about the hosted server. This contains the PoPID of the server,
|
||||
/// and opaque routing information that can be used by the relays to send traffic
|
||||
/// to your server.
|
||||
///
|
||||
/// You will need to send this information to your backend, and put it in tickets,
|
||||
/// so that the relays will know how to forward traffic from
|
||||
/// clients to your server. See SteamDatagramRelayAuthTicket for more info.
|
||||
///
|
||||
/// Also, note that the routing information is contained in SteamDatagramGameCoordinatorServerLogin,
|
||||
/// so if possible, it's preferred to use GetGameCoordinatorServerLogin to send this info
|
||||
/// to your game coordinator service, and also login securely at the same time.
|
||||
///
|
||||
/// On a successful exit, k_EResultOK is returned
|
||||
///
|
||||
/// Unsuccessful exit:
|
||||
/// - Something other than k_EResultOK is returned.
|
||||
/// - k_EResultInvalidState: We are not configured to listen for SDR (SDR_LISTEN_SOCKET
|
||||
/// is not set.)
|
||||
/// - k_EResultPending: we do not (yet) have the authentication information needed.
|
||||
/// (See GetAuthenticationStatus.) If you use environment variables to pre-fetch
|
||||
/// the network config, this data should always be available immediately.
|
||||
/// - A non-localized diagnostic debug message will be placed in m_data that describes
|
||||
/// the cause of the failure.
|
||||
///
|
||||
/// NOTE: The returned blob is not encrypted. Send it to your backend, but don't
|
||||
/// directly share it with clients.
|
||||
virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRouting ) = 0;
|
||||
|
||||
/// Create a listen socket on the specified virtual port. The physical UDP port to use
|
||||
/// will be determined by the SDR_LISTEN_PORT environment variable. If a UDP port is not
|
||||
/// configured, this call will fail.
|
||||
///
|
||||
/// This call MUST be made through the SteamGameServerNetworkingSockets() interface.
|
||||
///
|
||||
/// This function should be used when you are using the ticket generator library
|
||||
/// to issue your own tickets. Clients connecting to the server on this virtual
|
||||
/// port will need a ticket, and they must connect using ConnectToHostedDedicatedServer.
|
||||
///
|
||||
/// 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 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
|
||||
/// steamdatagram_gamecoordinator.h)
|
||||
///
|
||||
/// Before calling the function:
|
||||
/// - Populate the app data in pLoginInfo (m_cbAppData and m_appData). You can leave
|
||||
/// all other fields uninitialized.
|
||||
/// - *pcbSignedBlob contains the size of the buffer at pBlob. (It should be
|
||||
/// at least k_cbMaxSteamDatagramGameCoordinatorServerLoginSerialized.)
|
||||
///
|
||||
/// On a successful exit:
|
||||
/// - k_EResultOK is returned
|
||||
/// - All of the remaining fields of pLoginInfo will be filled out.
|
||||
/// - *pcbSignedBlob contains the size of the serialized blob that has been
|
||||
/// placed into pBlob.
|
||||
///
|
||||
/// Unsuccessful exit:
|
||||
/// - Something other than k_EResultOK is returned.
|
||||
/// - k_EResultNotLoggedOn: you are not logged in (yet)
|
||||
/// - See GetHostedDedicatedServerAddress for more potential failure return values.
|
||||
/// - A non-localized diagnostic debug message will be placed in pBlob that describes
|
||||
/// the cause of the failure.
|
||||
///
|
||||
/// This works by signing the contents of the SteamDatagramGameCoordinatorServerLogin
|
||||
/// with the cert that is issued to this server. In dev environments, it's OK if you do
|
||||
/// not have a cert. (You will need to enable insecure dev login in SteamDatagram_ParseHostedServerLogin.)
|
||||
/// Otherwise, you will need a signed cert.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
|
||||
//
|
||||
// Relayed connections using custom signaling protocol
|
||||
//
|
||||
// This is used if you have your own method of sending out-of-band
|
||||
// signaling / rendezvous messages through a mutually trusted channel.
|
||||
//
|
||||
|
||||
/// Create a P2P "client" connection that does signaling over a custom
|
||||
/// rendezvous/signaling channel.
|
||||
///
|
||||
/// pSignaling points to a new object that you create just for this connection.
|
||||
/// It must stay valid until Release() is called. Once you pass the
|
||||
/// object to this function, it assumes ownership. Release() will be called
|
||||
/// from within the function call if the call fails. Furthermore, until Release()
|
||||
/// is called, you should be prepared for methods to be invoked on your
|
||||
/// object from any thread! You need to make sure your object is threadsafe!
|
||||
/// Furthermore, you should make sure that dispatching the methods is done
|
||||
/// as quickly as possible.
|
||||
///
|
||||
/// This function will immediately construct a connection in the "connecting"
|
||||
/// state. Soon after (perhaps before this function returns, perhaps in another thread),
|
||||
/// the connection will begin sending signaling messages by calling
|
||||
/// ISteamNetworkingConnectionSignaling::SendSignal.
|
||||
///
|
||||
/// When the remote peer accepts the connection (See
|
||||
/// ISteamNetworkingSignalingRecvContext::OnConnectRequest),
|
||||
/// it will begin sending signaling messages. When these messages are received,
|
||||
/// you can pass them to the connection using ReceivedP2PCustomSignal.
|
||||
///
|
||||
/// If you know the identity of the peer that you expect to be on the other end,
|
||||
/// you can pass their identity to improve debug output or just detect bugs.
|
||||
/// If you don't know their identity yet, you can pass NULL, and their
|
||||
/// identity will be established in the connection handshake.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
///
|
||||
/// 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 nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
virtual HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionSignaling *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
|
||||
/// routing information was in the envelope into the context object,
|
||||
/// and then pass the payload to this function.
|
||||
///
|
||||
/// A few different things can happen next, depending on the message:
|
||||
///
|
||||
/// - If the signal is associated with existing connection, it is dealt
|
||||
/// with immediately. If any replies need to be sent, they will be
|
||||
/// dispatched using the ISteamNetworkingConnectionSignaling
|
||||
/// associated with the connection.
|
||||
/// - If the message represents a connection request (and the request
|
||||
/// is not redundant for an existing connection), a new connection
|
||||
/// will be created, and ReceivedConnectRequest will be called on your
|
||||
/// context object to determine how to proceed.
|
||||
/// - Otherwise, the message is for a connection that does not
|
||||
/// exist (anymore). In this case, we *may* call SendRejectionReply
|
||||
/// on your context object.
|
||||
///
|
||||
/// In any case, we will not save off pContext or access it after this
|
||||
/// function returns.
|
||||
///
|
||||
/// Returns true if the message was parsed and dispatched without anything
|
||||
/// unusual or suspicious happening. Returns false if there was some problem
|
||||
/// with the message that prevented ordinary handling. (Debug output will
|
||||
/// usually have more information.)
|
||||
///
|
||||
/// 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;
|
||||
virtual bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingSignalingRecvContext *pContext ) = 0;
|
||||
|
||||
//
|
||||
// Certificate provision by the application. On Steam, we normally handle all this automatically
|
||||
// and you will not need to use these advanced functions.
|
||||
//
|
||||
|
||||
/// Get blob that describes a certificate request. You can send this to your game coordinator.
|
||||
/// Upon entry, *pcbBlob should contain the size of the buffer. On successful exit, it will
|
||||
/// return the number of bytes that were populated. You can pass pBlob=NULL to query for the required
|
||||
/// size. (512 bytes is a conservative estimate.)
|
||||
///
|
||||
/// Pass this blob to your game coordinator and call SteamDatagram_CreateCert.
|
||||
virtual bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg ) = 0;
|
||||
|
||||
/// Set the certificate. The certificate blob should be the output of
|
||||
/// SteamDatagram_CreateCert.
|
||||
virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) = 0;
|
||||
|
||||
/// Reset the identity associated with this instance.
|
||||
/// Any open connections are closed. Any previous certificates, etc are discarded.
|
||||
/// You can pass a specific identity that you want to use, or you can pass NULL,
|
||||
/// in which case the identity will be invalid until you set it using SetCertificate
|
||||
///
|
||||
/// NOTE: This function is not actually supported on Steam! It is included
|
||||
/// for use on other platforms where the active user can sign out and
|
||||
/// a new user can sign in.
|
||||
virtual void ResetIdentity( const SteamNetworkingIdentity *pIdentity ) = 0;
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
|
||||
/// 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;
|
||||
|
||||
//
|
||||
// "FakeIP" system.
|
||||
//
|
||||
// A FakeIP is essentially a temporary, arbitrary identifier that
|
||||
// happens to be a valid IPv4 address. The purpose of this system is to make it
|
||||
// easy to integrate with existing code that identifies hosts using IPv4 addresses.
|
||||
// The FakeIP address will never actually be used to send or receive any packets
|
||||
// on the Internet, it is strictly an identifier.
|
||||
//
|
||||
// FakeIP addresses are designed to (hopefully) pass through existing code as
|
||||
// transparently as possible, while conflicting with "real" addresses that might
|
||||
// be in use on networks (both the Internet and LANs) in the same code as little
|
||||
// as possible. At the time this comment is being written, they come from the
|
||||
// 169.254.0.0/16 range, and the port number will always be >1024. HOWEVER,
|
||||
// this is subject to change! Do not make assumptions about these addresses,
|
||||
// or your code might break in the future. In particular, you should use
|
||||
// functions such as ISteamNetworkingUtils::IsFakeIP to determine if an IP
|
||||
// address is a "fake" one used by this system.
|
||||
//
|
||||
|
||||
/// Begin asynchronous process of allocating a fake IPv4 address that other
|
||||
/// peers can use to contact us via P2P. IP addresses returned by this
|
||||
/// function are globally unique for a given appid.
|
||||
///
|
||||
/// nNumPorts is the numbers of ports you wish to reserve. This is useful
|
||||
/// for the same reason that listening on multiple UDP ports is useful for
|
||||
/// different types of traffic. Because these allocations come from a global
|
||||
/// namespace, there is a relatively strict limit on the maximum number of
|
||||
/// ports you may request. (At the time of this writing, the limit is 4.)
|
||||
/// The port assignments are *not* guaranteed to have any particular order
|
||||
/// or relationship! Do *not* assume they are contiguous, even though that
|
||||
/// may often occur in practice.
|
||||
///
|
||||
/// Returns false if a request was already in progress, true if a new request
|
||||
/// was started. A SteamNetworkingFakeIPResult_t will be posted when the request
|
||||
/// completes.
|
||||
///
|
||||
/// For gameservers, you *must* call this after initializing the SDK but before
|
||||
/// beginning login. Steam needs to know in advance that FakeIP will be used.
|
||||
/// Everywhere your public IP would normally appear (such as the server browser) will be
|
||||
/// replaced by the FakeIP, and the fake port at index 0. The request is actually queued
|
||||
/// until the logon completes, so you must not wait until the allocation completes
|
||||
/// before logging in. Except for trivial failures that can be detected locally
|
||||
/// (e.g. invalid parameter), a SteamNetworkingFakeIPResult_t callback (whether success or
|
||||
/// failure) will not be posted until after we have logged in. Furthermore, it is assumed
|
||||
/// that FakeIP allocation is essential for your application to function, and so failure
|
||||
/// will not be reported until *several* retries have been attempted. This process may
|
||||
/// last several minutes. It is *highly* recommended to treat failure as fatal.
|
||||
///
|
||||
/// To communicate using a connection-oriented (TCP-style) API:
|
||||
/// - Server creates a listen socket using CreateListenSocketP2PFakeIP
|
||||
/// - Client connects using ConnectByIPAddress, passing in the FakeIP address.
|
||||
/// - The connection will behave mostly like a P2P connection. The identities
|
||||
/// that appear in SteamNetConnectionInfo_t will be the FakeIP identity until
|
||||
/// we know the real identity. Then it will be the real identity. If the
|
||||
/// SteamNetConnectionInfo_t::m_addrRemote is valid, it will be a real IPv4
|
||||
/// address of a NAT-punched connection. Otherwise, it will not be valid.
|
||||
///
|
||||
/// To communicate using an ad-hoc sendto/recv from (UDP-style) API,
|
||||
/// use CreateFakeUDPPort.
|
||||
virtual bool BeginAsyncRequestFakeIP( int nNumPorts ) = 0;
|
||||
|
||||
/// Return info about the FakeIP and port(s) that we have been assigned,
|
||||
/// if any. idxFirstPort is currently reserved and must be zero.
|
||||
/// Make sure and check SteamNetworkingFakeIPResult_t::m_eResult
|
||||
virtual void GetFakeIP( int idxFirstPort, SteamNetworkingFakeIPResult_t *pInfo ) = 0;
|
||||
|
||||
/// Create a listen socket that will listen for P2P connections sent
|
||||
/// to our FakeIP. A peer can initiate connections to this listen
|
||||
/// socket by calling ConnectByIPAddress.
|
||||
///
|
||||
/// idxFakePort refers to the *index* of the fake port requested,
|
||||
/// not the actual port number. For example, pass 0 to refer to the
|
||||
/// first port in the reservation. You must call this only after calling
|
||||
/// BeginAsyncRequestFakeIP. However, you do not need to wait for the
|
||||
/// request to complete before creating the listen socket.
|
||||
virtual HSteamListenSocket CreateListenSocketP2PFakeIP( int idxFakePort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
/// If the connection was initiated using the "FakeIP" system, then we
|
||||
/// we can get an IP address for the remote host. If the remote host had
|
||||
/// a global FakeIP at the time the connection was established, this
|
||||
/// function will return that global IP. Otherwise, a FakeIP that is
|
||||
/// unique locally will be allocated from the local FakeIP address space,
|
||||
/// and that will be returned.
|
||||
///
|
||||
/// The allocation of local FakeIPs attempts to assign addresses in
|
||||
/// a consistent manner. If multiple connections are made to the
|
||||
/// same remote host, they *probably* will return the same FakeIP.
|
||||
/// However, since the namespace is limited, this cannot be guaranteed.
|
||||
///
|
||||
/// On failure, returns:
|
||||
/// - k_EResultInvalidParam: invalid connection handle
|
||||
/// - k_EResultIPNotFound: This connection wasn't made using FakeIP system
|
||||
virtual EResult GetRemoteFakeIPForConnection( HSteamNetConnection hConn, SteamNetworkingIPAddr *pOutAddr ) = 0;
|
||||
|
||||
/// Get an interface that can be used like a UDP port to send/receive
|
||||
/// datagrams to a FakeIP address. This is intended to make it easy
|
||||
/// to port existing UDP-based code to take advantage of SDR.
|
||||
///
|
||||
/// idxFakeServerPort refers to the *index* of the port allocated using
|
||||
/// BeginAsyncRequestFakeIP and is used to create "server" ports. You may
|
||||
/// call this before the allocation has completed. However, any attempts
|
||||
/// to send packets will fail until the allocation has succeeded. When
|
||||
/// the peer receives packets sent from this interface, the from address
|
||||
/// of the packet will be the globally-unique FakeIP. If you call this
|
||||
/// function multiple times and pass the same (nonnegative) fake port index,
|
||||
/// the same object will be returned, and this object is not reference counted.
|
||||
///
|
||||
/// To create a "client" port (e.g. the equivalent of an ephemeral UDP port)
|
||||
/// pass -1. In this case, a distinct object will be returned for each call.
|
||||
/// When the peer receives packets sent from this interface, the peer will
|
||||
/// assign a FakeIP from its own locally-controlled namespace.
|
||||
virtual ISteamNetworkingFakeUDPPort *CreateFakeUDPPort( int idxFakeServerPort ) = 0;
|
||||
|
||||
protected:
|
||||
// ~ISteamNetworkingSockets(); // Silence some warnings
|
||||
};
|
||||
|
||||
#endif // ISTEAMNETWORKINGSOCKETS010
|
804
sdk/steam/isteamnetworkingsockets011.h
Normal file
804
sdk/steam/isteamnetworkingsockets011.h
Normal file
@ -0,0 +1,804 @@
|
||||
|
||||
#ifndef ISTEAMNETWORKINGSOCKETS011
|
||||
#define ISTEAMNETWORKINGSOCKETS011
|
||||
|
||||
// this interface version is not found in public SDK archives, it is based on reversing the returned vftable from steamclient64.dll
|
||||
|
||||
class ISteamNetworkingSockets011
|
||||
{
|
||||
public:
|
||||
|
||||
/// Creates a "server" socket that listens for clients to connect to by
|
||||
/// calling ConnectByIPAddress, over ordinary UDP (IPv4 or IPv6)
|
||||
///
|
||||
/// You must select a specific local port to listen on and set it
|
||||
/// the port field of the local address.
|
||||
///
|
||||
/// Usually you will set the IP portion of the address to zero (SteamNetworkingIPAddr::Clear()).
|
||||
/// This means that you will not bind to any particular local interface (i.e. the same
|
||||
/// as INADDR_ANY in plain socket code). Furthermore, if possible the socket will be bound
|
||||
/// in "dual stack" mode, which means that it can accept both IPv4 and IPv6 client connections.
|
||||
/// If you really do wish to bind a particular interface, then set the local address to the
|
||||
/// appropriate IPv4 or IPv6 IP.
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// When a client attempts to connect, a SteamNetConnectionStatusChangedCallback_t
|
||||
/// will be posted. The connection will be in the connecting state.
|
||||
virtual HSteamListenSocket CreateListenSocketIP( const SteamNetworkingIPAddr &localAddress, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
/// Creates a connection and begins talking to a "server" over UDP at the
|
||||
/// given IPv4 or IPv6 address. The remote host must be listening with a
|
||||
/// matching call to CreateListenSocketIP on the specified port.
|
||||
///
|
||||
/// A SteamNetConnectionStatusChangedCallback_t callback will be triggered when we start
|
||||
/// connecting, and then another one on either timeout or successful connection.
|
||||
///
|
||||
/// If the server does not have any identity configured, then their network address
|
||||
/// will be the only identity in use. Or, the network host may provide a platform-specific
|
||||
/// identity with or without a valid certificate to authenticate that identity. (These
|
||||
/// details will be contained in the SteamNetConnectionStatusChangedCallback_t.) It's
|
||||
/// up to your application to decide whether to allow the connection.
|
||||
///
|
||||
/// By default, all connections will get basic encryption sufficient to prevent
|
||||
/// casual eavesdropping. But note that without certificates (or a shared secret
|
||||
/// distributed through some other out-of-band mechanism), you don't have any
|
||||
/// way of knowing who is actually on the other end, and thus are vulnerable to
|
||||
/// man-in-the-middle attacks.
|
||||
///
|
||||
/// 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 ConnectByIPAddress( const SteamNetworkingIPAddr &address, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
/// Like CreateListenSocketIP, but clients will connect using ConnectP2P.
|
||||
///
|
||||
/// 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 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.
|
||||
///
|
||||
/// If you are listening on a dedicated servers in known data center,
|
||||
/// then you can listen using this function instead of CreateHostedDedicatedServerListenSocket,
|
||||
/// to allow clients to connect without a ticket. Any user that owns
|
||||
/// the app and is signed into Steam will be able to attempt to connect to
|
||||
/// your server. Also, a connection attempt may require the client to
|
||||
/// be connected to Steam, which is one more moving part that may fail. When
|
||||
/// tickets are used, then once a ticket is obtained, a client can connect to
|
||||
/// your server even if they got disconnected from Steam or Steam is offline.
|
||||
///
|
||||
/// 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 nLocalVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
/// 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.)
|
||||
///
|
||||
/// 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.
|
||||
///
|
||||
/// To use your own signaling service, see:
|
||||
/// - ConnectP2PCustomSignaling
|
||||
/// - k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling
|
||||
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.
|
||||
///
|
||||
/// When a connection attempt is received (perhaps after a few basic handshake
|
||||
/// packets have been exchanged to prevent trivial spoofing), a connection interface
|
||||
/// object is created in the k_ESteamNetworkingConnectionState_Connecting state
|
||||
/// and a SteamNetConnectionStatusChangedCallback_t is posted. At this point, your
|
||||
/// application MUST either accept or close the connection. (It may not ignore it.)
|
||||
/// Accepting the connection will transition it either into the connected state,
|
||||
/// or the finding route state, depending on the connection type.
|
||||
///
|
||||
/// You should take action within a second or two, because accepting the connection is
|
||||
/// what actually sends the reply notifying the client that they are connected. If you
|
||||
/// delay taking action, from the client's perspective it is the same as the network
|
||||
/// being unresponsive, and the client may timeout the connection attempt. In other
|
||||
/// words, the client cannot distinguish between a delay caused by network problems
|
||||
/// and a delay caused by the application.
|
||||
///
|
||||
/// This means that if your application goes for more than a few seconds without
|
||||
/// processing callbacks (for example, while loading a map), then there is a chance
|
||||
/// that a client may attempt to connect in that interval and fail due to timeout.
|
||||
///
|
||||
/// If the application does not respond to the connection attempt in a timely manner,
|
||||
/// and we stop receiving communication from the client, the connection attempt will
|
||||
/// be timed out locally, transitioning the connection to the
|
||||
/// k_ESteamNetworkingConnectionState_ProblemDetectedLocally state. The client may also
|
||||
/// close the connection before it is accepted, and a transition to the
|
||||
/// k_ESteamNetworkingConnectionState_ClosedByPeer is also possible depending the exact
|
||||
/// sequence of events.
|
||||
///
|
||||
/// Returns k_EResultInvalidParam if the handle is invalid.
|
||||
/// Returns k_EResultInvalidState if the connection is not in the appropriate state.
|
||||
/// (Remember that the connection state could change in between the time that the
|
||||
/// notification being posted to the queue and when it is received by the application.)
|
||||
///
|
||||
/// A note about connection configuration options. If you need to set any configuration
|
||||
/// options that are common to all connections accepted through a particular listen
|
||||
/// socket, consider setting the options on the listen socket, since such options are
|
||||
/// inherited automatically. If you really do need to set options that are connection
|
||||
/// specific, it is safe to set them on the connection before accepting the connection.
|
||||
virtual EResult AcceptConnection( HSteamNetConnection hConn ) = 0;
|
||||
|
||||
/// Disconnects from the remote host and invalidates the connection handle.
|
||||
/// Any unread data on the connection is discarded.
|
||||
///
|
||||
/// nReason is an application defined code that will be received on the other
|
||||
/// end and recorded (when possible) in backend analytics. The value should
|
||||
/// come from a restricted range. (See ESteamNetConnectionEnd.) If you don't need
|
||||
/// to communicate any information to the remote host, and do not want analytics to
|
||||
/// be able to distinguish "normal" connection terminations from "exceptional" ones,
|
||||
/// You may pass zero, in which case the generic value of
|
||||
/// k_ESteamNetConnectionEnd_App_Generic will be used.
|
||||
///
|
||||
/// pszDebug is an optional human-readable diagnostic string that will be received
|
||||
/// by the remote host and recorded (when possible) in backend analytics.
|
||||
///
|
||||
/// If you wish to put the socket into a "linger" state, where an attempt is made to
|
||||
/// flush any remaining sent data, use bEnableLinger=true. Otherwise reliable data
|
||||
/// is not flushed.
|
||||
///
|
||||
/// If the connection has already ended and you are just freeing up the
|
||||
/// connection interface, the reason code, debug string, and linger flag are
|
||||
/// ignored.
|
||||
virtual bool CloseConnection( HSteamNetConnection hPeer, int nReason, const char *pszDebug, bool bEnableLinger ) = 0;
|
||||
|
||||
/// Destroy a listen socket. All the connections that were accepting on the listen
|
||||
/// socket are closed ungracefully.
|
||||
virtual bool CloseListenSocket( HSteamListenSocket hSocket ) = 0;
|
||||
|
||||
/// Set connection user data. the data is returned in the following places
|
||||
/// - You can query it using GetConnectionUserData.
|
||||
/// - The SteamNetworkingmessage_t structure.
|
||||
/// - The SteamNetConnectionInfo_t structure.
|
||||
/// (Which is a member of SteamNetConnectionStatusChangedCallback_t -- but see WARNINGS below!!!!)
|
||||
///
|
||||
/// Do you need to set this atomically when the connection is created?
|
||||
/// See k_ESteamNetworkingConfig_ConnectionUserData.
|
||||
///
|
||||
/// WARNING: Be *very careful* when using the value provided in callbacks structs.
|
||||
/// Callbacks are queued, and the value that you will receive in your
|
||||
/// callback is the userdata that was effective at the time the callback
|
||||
/// was queued. There are subtle race conditions that can happen if you
|
||||
/// don't understand this!
|
||||
///
|
||||
/// If any incoming messages for this connection are queued, the userdata
|
||||
/// field is updated, so that when when you receive messages (e.g. with
|
||||
/// ReceiveMessagesOnConnection), they will always have the very latest
|
||||
/// userdata. So the tricky race conditions that can happen with callbacks
|
||||
/// do not apply to retrieving messages.
|
||||
///
|
||||
/// Returns false if the handle is invalid.
|
||||
virtual bool SetConnectionUserData( HSteamNetConnection hPeer, int64 nUserData ) = 0;
|
||||
|
||||
/// Fetch connection user data. Returns -1 if handle is invalid
|
||||
/// or if you haven't set any userdata on the connection.
|
||||
virtual int64 GetConnectionUserData( HSteamNetConnection hPeer ) = 0;
|
||||
|
||||
/// Set a name for the connection, used mostly for debugging
|
||||
virtual void SetConnectionName( HSteamNetConnection hPeer, const char *pszName ) = 0;
|
||||
|
||||
/// Fetch connection name. Returns false if handle is invalid
|
||||
virtual bool GetConnectionName( HSteamNetConnection hPeer, char *pszName, int nMaxLen ) = 0;
|
||||
|
||||
/// Send a message to the remote host on the specified connection.
|
||||
///
|
||||
/// nSendFlags determines the delivery guarantees that will be provided,
|
||||
/// when data should be buffered, etc. E.g. k_nSteamNetworkingSend_Unreliable
|
||||
///
|
||||
/// Note that the semantics we use for messages are not precisely
|
||||
/// the same as the semantics of a standard "stream" socket.
|
||||
/// (SOCK_STREAM) For an ordinary stream socket, the boundaries
|
||||
/// between chunks are not considered relevant, and the sizes of
|
||||
/// the chunks of data written will not necessarily match up to
|
||||
/// the sizes of the chunks that are returned by the reads on
|
||||
/// the other end. The remote host might read a partial chunk,
|
||||
/// or chunks might be coalesced. For the message semantics
|
||||
/// used here, however, the sizes WILL match. Each send call
|
||||
/// will match a successful read call on the remote host
|
||||
/// one-for-one. If you are porting existing stream-oriented
|
||||
/// code to the semantics of reliable messages, your code should
|
||||
/// work the same, since reliable message semantics are more
|
||||
/// strict than stream semantics. The only caveat is related to
|
||||
/// performance: there is per-message overhead to retain the
|
||||
/// message sizes, and so if your code sends many small chunks
|
||||
/// of data, performance will suffer. Any code based on stream
|
||||
/// sockets that does not write excessively small chunks will
|
||||
/// work without any changes.
|
||||
///
|
||||
/// The pOutMessageNumber is an optional pointer to receive the
|
||||
/// message number assigned to the message, if sending was successful.
|
||||
///
|
||||
/// Returns:
|
||||
/// - k_EResultInvalidParam: invalid connection handle, or the individual message is too big.
|
||||
/// (See k_cbMaxSteamNetworkingSocketsMessageSizeSend)
|
||||
/// - k_EResultInvalidState: connection is in an invalid state
|
||||
/// - k_EResultNoConnection: connection has ended
|
||||
/// - k_EResultIgnored: You used k_nSteamNetworkingSend_NoDelay, and the message was dropped because
|
||||
/// we were not ready to send it.
|
||||
/// - k_EResultLimitExceeded: there was already too much data queued to be sent.
|
||||
/// (See k_ESteamNetworkingConfig_SendBufferSize)
|
||||
virtual EResult SendMessageToConnection( HSteamNetConnection hConn, const void *pData, uint32 cbData, int nSendFlags, int64 *pOutMessageNumber ) = 0;
|
||||
|
||||
/// Send one or more messages without copying the message payload.
|
||||
/// This is the most efficient way to send messages. To use this
|
||||
/// function, you must first allocate a message object using
|
||||
/// ISteamNetworkingUtils::AllocateMessage. (Do not declare one
|
||||
/// on the stack or allocate your own.)
|
||||
///
|
||||
/// You should fill in the message payload. You can either let
|
||||
/// it allocate the buffer for you and then fill in the payload,
|
||||
/// or if you already have a buffer allocated, you can just point
|
||||
/// m_pData at your buffer and set the callback to the appropriate function
|
||||
/// to free it. Note that if you use your own buffer, it MUST remain valid
|
||||
/// until the callback is executed. And also note that your callback can be
|
||||
/// invoked at any time from any thread (perhaps even before SendMessages
|
||||
/// returns!), so it MUST be fast and threadsafe.
|
||||
///
|
||||
/// You MUST also fill in:
|
||||
/// - m_conn - the handle of the connection to send the message to
|
||||
/// - m_nFlags - bitmask of k_nSteamNetworkingSend_xxx flags.
|
||||
///
|
||||
/// All other fields are currently reserved and should not be modified.
|
||||
///
|
||||
/// The library will take ownership of the message structures. They may
|
||||
/// be modified or become invalid at any time, so you must not read them
|
||||
/// after passing them to this function.
|
||||
///
|
||||
/// pOutMessageNumberOrResult is an optional array that will receive,
|
||||
/// for each message, the message number that was assigned to the message
|
||||
/// if sending was successful. If sending failed, then a negative EResult
|
||||
/// value is placed into the array. For example, the array will hold
|
||||
/// -k_EResultInvalidState if the connection was in an invalid state.
|
||||
/// See ISteamNetworkingSockets::SendMessageToConnection for possible
|
||||
/// failure codes.
|
||||
virtual void SendMessages( int nMessages, SteamNetworkingMessage_t *const *pMessages, int64 *pOutMessageNumberOrResult ) = 0;
|
||||
|
||||
/// Flush any messages waiting on the Nagle timer and send them
|
||||
/// at the next transmission opportunity (often that means right now).
|
||||
///
|
||||
/// If Nagle is enabled (it's on by default) then when calling
|
||||
/// SendMessageToConnection the message will be buffered, up to the Nagle time
|
||||
/// before being sent, to merge small messages into the same packet.
|
||||
/// (See k_ESteamNetworkingConfig_NagleTime)
|
||||
///
|
||||
/// Returns:
|
||||
/// k_EResultInvalidParam: invalid connection handle
|
||||
/// k_EResultInvalidState: connection is in an invalid state
|
||||
/// k_EResultNoConnection: connection has ended
|
||||
/// k_EResultIgnored: We weren't (yet) connected, so this operation has no effect.
|
||||
virtual EResult FlushMessagesOnConnection( HSteamNetConnection hConn ) = 0;
|
||||
|
||||
/// Fetch the next available message(s) from the connection, if any.
|
||||
/// Returns the number of messages returned into your array, up to nMaxMessages.
|
||||
/// If the connection handle is invalid, -1 is returned.
|
||||
///
|
||||
/// The order of the messages returned in the array is relevant.
|
||||
/// Reliable messages will be received in the order they were sent (and with the
|
||||
/// same sizes --- see SendMessageToConnection for on this subtle difference from a stream socket).
|
||||
///
|
||||
/// Unreliable messages may be dropped, or delivered out of order with respect to
|
||||
/// each other or with respect to reliable messages. The same unreliable message
|
||||
/// may be received multiple times.
|
||||
///
|
||||
/// If any messages are returned, you MUST call SteamNetworkingMessage_t::Release() on each
|
||||
/// of them free up resources after you are done. It is safe to keep the object alive for
|
||||
/// a little while (put it into some queue, etc), and you may call Release() from any thread.
|
||||
virtual int ReceiveMessagesOnConnection( HSteamNetConnection hConn, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
|
||||
|
||||
/// Returns basic information about the high-level state of the connection.
|
||||
virtual bool GetConnectionInfo( HSteamNetConnection hConn, SteamNetConnectionInfo_t *pInfo ) = 0;
|
||||
|
||||
// based on reversing the vftable returned from original steamclient64.dll
|
||||
virtual bool GetConnectionRealTimeStatus_old( HSteamNetConnection hConn, SteamNetConnectionRealTimeStatus_t *pStatus ) = 0;
|
||||
|
||||
/// Returns detailed connection stats in text format. Useful
|
||||
/// for dumping to a log, etc.
|
||||
///
|
||||
/// Returns:
|
||||
/// -1 failure (bad connection handle)
|
||||
/// 0 OK, your buffer was filled in and '\0'-terminated
|
||||
/// >0 Your buffer was either nullptr, or it was too small and the text got truncated.
|
||||
/// Try again with a buffer of at least N bytes.
|
||||
virtual int GetDetailedConnectionStatus( HSteamNetConnection hConn, char *pszBuf, int cbBuf ) = 0;
|
||||
|
||||
/// Returns local IP and port that a listen socket created using CreateListenSocketIP is bound to.
|
||||
///
|
||||
/// An IPv6 address of ::0 means "any IPv4 or IPv6"
|
||||
/// An IPv6 address of ::ffff:0000:0000 means "any IPv4"
|
||||
virtual bool GetListenSocketAddress( HSteamListenSocket hSocket, SteamNetworkingIPAddr *address ) = 0;
|
||||
|
||||
/// Create a pair of connections that are talking to each other, e.g. a loopback connection.
|
||||
/// This is very useful for testing, or so that your client/server code can work the same
|
||||
/// even when you are running a local "server".
|
||||
///
|
||||
/// The two connections will immediately be placed into the connected state, and no callbacks
|
||||
/// will be posted immediately. After this, if you close either connection, the other connection
|
||||
/// will receive a callback, exactly as if they were communicating over the network. You must
|
||||
/// close *both* sides in order to fully clean up the resources!
|
||||
///
|
||||
/// By default, internal buffers are used, completely bypassing the network, the chopping up of
|
||||
/// messages into packets, encryption, copying the payload, etc. This means that loopback
|
||||
/// packets, by default, will not simulate lag or loss. Passing true for bUseNetworkLoopback will
|
||||
/// cause the socket pair to send packets through the local network loopback device (127.0.0.1)
|
||||
/// on ephemeral ports. Fake lag and loss are supported in this case, and CPU time is expended
|
||||
/// to encrypt and decrypt.
|
||||
///
|
||||
/// If you wish to assign a specific identity to either connection, you may pass a particular
|
||||
/// identity. Otherwise, if you pass nullptr, the respective connection will assume a generic
|
||||
/// "localhost" identity. If you use real network loopback, this might be translated to the
|
||||
/// actual bound loopback port. Otherwise, the port will be zero.
|
||||
virtual bool CreateSocketPair( HSteamNetConnection *pOutConnection1, HSteamNetConnection *pOutConnection2, bool bUseNetworkLoopback, const SteamNetworkingIdentity *pIdentity1, const SteamNetworkingIdentity *pIdentity2 ) = 0;
|
||||
|
||||
//
|
||||
// Identity and authentication
|
||||
//
|
||||
|
||||
/// Get the identity assigned to this interface.
|
||||
/// E.g. on Steam, this is the user's SteamID, or for the gameserver interface, the SteamID assigned
|
||||
/// to the gameserver. Returns false and sets the result to an invalid identity if we don't know
|
||||
/// our identity yet. (E.g. GameServer has not logged in. On Steam, the user will know their SteamID
|
||||
/// even if they are not signed into Steam.)
|
||||
virtual bool GetIdentity( SteamNetworkingIdentity *pIdentity ) = 0;
|
||||
|
||||
/// Indicate our desire to be ready participate in authenticated communications.
|
||||
/// If we are currently not ready, then steps will be taken to obtain the necessary
|
||||
/// certificates. (This includes a certificate for us, as well as any CA certificates
|
||||
/// needed to authenticate peers.)
|
||||
///
|
||||
/// You can call this at program init time if you know that you are going to
|
||||
/// be making authenticated connections, so that we will be ready immediately when
|
||||
/// those connections are attempted. (Note that essentially all connections require
|
||||
/// authentication, with the exception of ordinary UDP connections with authentication
|
||||
/// disabled using k_ESteamNetworkingConfig_IP_AllowWithoutAuth.) If you don't call
|
||||
/// this function, we will wait until a feature is utilized that that necessitates
|
||||
/// these resources.
|
||||
///
|
||||
/// You can also call this function to force a retry, if failure has occurred.
|
||||
/// Once we make an attempt and fail, we will not automatically retry.
|
||||
/// In this respect, the behavior of the system after trying and failing is the same
|
||||
/// as before the first attempt: attempting authenticated communication or calling
|
||||
/// this function will call the system to attempt to acquire the necessary resources.
|
||||
///
|
||||
/// You can use GetAuthenticationStatus or listen for SteamNetAuthenticationStatus_t
|
||||
/// to monitor the status.
|
||||
///
|
||||
/// Returns the current value that would be returned from GetAuthenticationStatus.
|
||||
virtual ESteamNetworkingAvailability InitAuthentication() = 0;
|
||||
|
||||
/// Query our readiness to participate in authenticated communications. A
|
||||
/// SteamNetAuthenticationStatus_t callback is posted any time this status changes,
|
||||
/// but you can use this function to query it at any time.
|
||||
///
|
||||
/// The value of SteamNetAuthenticationStatus_t::m_eAvail is returned. If you only
|
||||
/// want this high level status, you can pass NULL for pDetails. If you want further
|
||||
/// details, pass non-NULL to receive them.
|
||||
virtual ESteamNetworkingAvailability GetAuthenticationStatus( SteamNetAuthenticationStatus_t *pDetails ) = 0;
|
||||
|
||||
//
|
||||
// Poll groups. A poll group is a set of connections that can be polled efficiently.
|
||||
// (In our API, to "poll" a connection means to retrieve all pending messages. We
|
||||
// actually don't have an API to "poll" the connection *state*, like BSD sockets.)
|
||||
//
|
||||
|
||||
/// Create a new poll group.
|
||||
///
|
||||
/// You should destroy the poll group when you are done using DestroyPollGroup
|
||||
virtual HSteamNetPollGroup CreatePollGroup() = 0;
|
||||
|
||||
/// Destroy a poll group created with CreatePollGroup().
|
||||
///
|
||||
/// If there are any connections in the poll group, they are removed from the group,
|
||||
/// and left in a state where they are not part of any poll group.
|
||||
/// Returns false if passed an invalid poll group handle.
|
||||
virtual bool DestroyPollGroup( HSteamNetPollGroup hPollGroup ) = 0;
|
||||
|
||||
/// Assign a connection to a poll group. Note that a connection may only belong to a
|
||||
/// single poll group. Adding a connection to a poll group implicitly removes it from
|
||||
/// any other poll group it is in.
|
||||
///
|
||||
/// You can pass k_HSteamNetPollGroup_Invalid to remove a connection from its current
|
||||
/// poll group without adding it to a new poll group.
|
||||
///
|
||||
/// If there are received messages currently pending on the connection, an attempt
|
||||
/// is made to add them to the queue of messages for the poll group in approximately
|
||||
/// the order that would have applied if the connection was already part of the poll
|
||||
/// group at the time that the messages were received.
|
||||
///
|
||||
/// Returns false if the connection handle is invalid, or if the poll group handle
|
||||
/// is invalid (and not k_HSteamNetPollGroup_Invalid).
|
||||
virtual bool SetConnectionPollGroup( HSteamNetConnection hConn, HSteamNetPollGroup hPollGroup ) = 0;
|
||||
|
||||
/// Same as ReceiveMessagesOnConnection, but will return the next messages available
|
||||
/// on any connection in the poll group. Examine SteamNetworkingMessage_t::m_conn
|
||||
/// to know which connection. (SteamNetworkingMessage_t::m_nConnUserData might also
|
||||
/// be useful.)
|
||||
///
|
||||
/// Delivery order of messages among different connections will usually match the
|
||||
/// order that the last packet was received which completed the message. But this
|
||||
/// is not a strong guarantee, especially for packets received right as a connection
|
||||
/// is being assigned to poll group.
|
||||
///
|
||||
/// Delivery order of messages on the same connection is well defined and the
|
||||
/// same guarantees are present as mentioned in ReceiveMessagesOnConnection.
|
||||
/// (But the messages are not grouped by connection, so they will not necessarily
|
||||
/// appear consecutively in the list; they may be interleaved with messages for
|
||||
/// other connections.)
|
||||
virtual int ReceiveMessagesOnPollGroup( HSteamNetPollGroup hPollGroup, SteamNetworkingMessage_t **ppOutMessages, int nMaxMessages ) = 0;
|
||||
|
||||
//
|
||||
// Clients connecting to dedicated servers hosted in a data center,
|
||||
// using tickets issued by your game coordinator. If you are not
|
||||
// issuing your own tickets to restrict who can attempt to connect
|
||||
// to your server, then you won't use these functions.
|
||||
//
|
||||
|
||||
/// Call this when you receive a ticket from your backend / matchmaking system. Puts the
|
||||
/// ticket into a persistent cache, and optionally returns the parsed ticket.
|
||||
///
|
||||
/// See stamdatagram_ticketgen.h for more details.
|
||||
virtual bool ReceivedRelayAuthTicket( const void *pvTicket, int cbTicket, SteamDatagramRelayAuthTicket *pOutParsedTicket ) = 0;
|
||||
|
||||
/// Search cache for a ticket to talk to the server on the specified virtual port.
|
||||
/// If found, returns the number of seconds until the ticket expires, and optionally
|
||||
/// the complete cracked ticket. Returns 0 if we don't have a ticket.
|
||||
///
|
||||
/// 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 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! If you are not issuing your own tickets, then to connect to a dedicated
|
||||
/// server via SDR in auto-ticket mode, use ConnectP2P. (The server must be configured to allow
|
||||
/// this type of connection by listening using CreateListenSocketP2P.)
|
||||
///
|
||||
/// You may wonder why tickets are stored in a cache, instead of simply being passed as an argument
|
||||
/// here. The reason is to make reconnection to a gameserver robust, even if the client computer loses
|
||||
/// connection to Steam or the central backend, or the app is restarted or crashes, etc.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
///
|
||||
/// 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 nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
//
|
||||
// Servers hosted in data centers known to the Valve relay network
|
||||
//
|
||||
|
||||
/// Returns the value of the SDR_LISTEN_PORT environment variable. This
|
||||
/// is the UDP server your server will be listening on. This will
|
||||
/// configured automatically for you in production environments.
|
||||
///
|
||||
/// In development, you'll need to set it yourself. See
|
||||
/// https://partner.steamgames.com/doc/api/ISteamNetworkingSockets
|
||||
/// for more information on how to configure dev environments.
|
||||
virtual uint16 GetHostedDedicatedServerPort() = 0;
|
||||
|
||||
/// Returns 0 if SDR_LISTEN_PORT is not set. Otherwise, returns the data center the server
|
||||
/// is running in. This will be k_SteamDatagramPOPID_dev in non-production environment.
|
||||
virtual SteamNetworkingPOPID GetHostedDedicatedServerPOPID() = 0;
|
||||
|
||||
/// Return info about the hosted server. This contains the PoPID of the server,
|
||||
/// and opaque routing information that can be used by the relays to send traffic
|
||||
/// to your server.
|
||||
///
|
||||
/// You will need to send this information to your backend, and put it in tickets,
|
||||
/// so that the relays will know how to forward traffic from
|
||||
/// clients to your server. See SteamDatagramRelayAuthTicket for more info.
|
||||
///
|
||||
/// Also, note that the routing information is contained in SteamDatagramGameCoordinatorServerLogin,
|
||||
/// so if possible, it's preferred to use GetGameCoordinatorServerLogin to send this info
|
||||
/// to your game coordinator service, and also login securely at the same time.
|
||||
///
|
||||
/// On a successful exit, k_EResultOK is returned
|
||||
///
|
||||
/// Unsuccessful exit:
|
||||
/// - Something other than k_EResultOK is returned.
|
||||
/// - k_EResultInvalidState: We are not configured to listen for SDR (SDR_LISTEN_SOCKET
|
||||
/// is not set.)
|
||||
/// - k_EResultPending: we do not (yet) have the authentication information needed.
|
||||
/// (See GetAuthenticationStatus.) If you use environment variables to pre-fetch
|
||||
/// the network config, this data should always be available immediately.
|
||||
/// - A non-localized diagnostic debug message will be placed in m_data that describes
|
||||
/// the cause of the failure.
|
||||
///
|
||||
/// NOTE: The returned blob is not encrypted. Send it to your backend, but don't
|
||||
/// directly share it with clients.
|
||||
virtual EResult GetHostedDedicatedServerAddress( SteamDatagramHostedAddress *pRouting ) = 0;
|
||||
|
||||
/// Create a listen socket on the specified virtual port. The physical UDP port to use
|
||||
/// will be determined by the SDR_LISTEN_PORT environment variable. If a UDP port is not
|
||||
/// configured, this call will fail.
|
||||
///
|
||||
/// This call MUST be made through the SteamGameServerNetworkingSockets() interface.
|
||||
///
|
||||
/// This function should be used when you are using the ticket generator library
|
||||
/// to issue your own tickets. Clients connecting to the server on this virtual
|
||||
/// port will need a ticket, and they must connect using ConnectToHostedDedicatedServer.
|
||||
///
|
||||
/// 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 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
|
||||
/// steamdatagram_gamecoordinator.h)
|
||||
///
|
||||
/// Before calling the function:
|
||||
/// - Populate the app data in pLoginInfo (m_cbAppData and m_appData). You can leave
|
||||
/// all other fields uninitialized.
|
||||
/// - *pcbSignedBlob contains the size of the buffer at pBlob. (It should be
|
||||
/// at least k_cbMaxSteamDatagramGameCoordinatorServerLoginSerialized.)
|
||||
///
|
||||
/// On a successful exit:
|
||||
/// - k_EResultOK is returned
|
||||
/// - All of the remaining fields of pLoginInfo will be filled out.
|
||||
/// - *pcbSignedBlob contains the size of the serialized blob that has been
|
||||
/// placed into pBlob.
|
||||
///
|
||||
/// Unsuccessful exit:
|
||||
/// - Something other than k_EResultOK is returned.
|
||||
/// - k_EResultNotLoggedOn: you are not logged in (yet)
|
||||
/// - See GetHostedDedicatedServerAddress for more potential failure return values.
|
||||
/// - A non-localized diagnostic debug message will be placed in pBlob that describes
|
||||
/// the cause of the failure.
|
||||
///
|
||||
/// This works by signing the contents of the SteamDatagramGameCoordinatorServerLogin
|
||||
/// with the cert that is issued to this server. In dev environments, it's OK if you do
|
||||
/// not have a cert. (You will need to enable insecure dev login in SteamDatagram_ParseHostedServerLogin.)
|
||||
/// Otherwise, you will need a signed cert.
|
||||
///
|
||||
/// 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;
|
||||
|
||||
|
||||
//
|
||||
// Relayed connections using custom signaling protocol
|
||||
//
|
||||
// This is used if you have your own method of sending out-of-band
|
||||
// signaling / rendezvous messages through a mutually trusted channel.
|
||||
//
|
||||
|
||||
/// Create a P2P "client" connection that does signaling over a custom
|
||||
/// rendezvous/signaling channel.
|
||||
///
|
||||
/// pSignaling points to a new object that you create just for this connection.
|
||||
/// It must stay valid until Release() is called. Once you pass the
|
||||
/// object to this function, it assumes ownership. Release() will be called
|
||||
/// from within the function call if the call fails. Furthermore, until Release()
|
||||
/// is called, you should be prepared for methods to be invoked on your
|
||||
/// object from any thread! You need to make sure your object is threadsafe!
|
||||
/// Furthermore, you should make sure that dispatching the methods is done
|
||||
/// as quickly as possible.
|
||||
///
|
||||
/// This function will immediately construct a connection in the "connecting"
|
||||
/// state. Soon after (perhaps before this function returns, perhaps in another thread),
|
||||
/// the connection will begin sending signaling messages by calling
|
||||
/// ISteamNetworkingConnectionSignaling::SendSignal.
|
||||
///
|
||||
/// When the remote peer accepts the connection (See
|
||||
/// ISteamNetworkingSignalingRecvContext::OnConnectRequest),
|
||||
/// it will begin sending signaling messages. When these messages are received,
|
||||
/// you can pass them to the connection using ReceivedP2PCustomSignal.
|
||||
///
|
||||
/// If you know the identity of the peer that you expect to be on the other end,
|
||||
/// you can pass their identity to improve debug output or just detect bugs.
|
||||
/// If you don't know their identity yet, you can pass NULL, and their
|
||||
/// identity will be established in the connection handshake.
|
||||
///
|
||||
/// If you use this, you probably want to call ISteamNetworkingUtils::InitRelayNetworkAccess()
|
||||
/// when your app initializes
|
||||
///
|
||||
/// 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 nRemoteVirtualPort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
virtual HSteamNetConnection ConnectP2PCustomSignaling( ISteamNetworkingConnectionSignaling *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
|
||||
/// routing information was in the envelope into the context object,
|
||||
/// and then pass the payload to this function.
|
||||
///
|
||||
/// A few different things can happen next, depending on the message:
|
||||
///
|
||||
/// - If the signal is associated with existing connection, it is dealt
|
||||
/// with immediately. If any replies need to be sent, they will be
|
||||
/// dispatched using the ISteamNetworkingConnectionSignaling
|
||||
/// associated with the connection.
|
||||
/// - If the message represents a connection request (and the request
|
||||
/// is not redundant for an existing connection), a new connection
|
||||
/// will be created, and ReceivedConnectRequest will be called on your
|
||||
/// context object to determine how to proceed.
|
||||
/// - Otherwise, the message is for a connection that does not
|
||||
/// exist (anymore). In this case, we *may* call SendRejectionReply
|
||||
/// on your context object.
|
||||
///
|
||||
/// In any case, we will not save off pContext or access it after this
|
||||
/// function returns.
|
||||
///
|
||||
/// Returns true if the message was parsed and dispatched without anything
|
||||
/// unusual or suspicious happening. Returns false if there was some problem
|
||||
/// with the message that prevented ordinary handling. (Debug output will
|
||||
/// usually have more information.)
|
||||
///
|
||||
/// 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;
|
||||
virtual bool ReceivedP2PCustomSignal( const void *pMsg, int cbMsg, ISteamNetworkingSignalingRecvContext *pContext ) = 0;
|
||||
|
||||
//
|
||||
// Certificate provision by the application. On Steam, we normally handle all this automatically
|
||||
// and you will not need to use these advanced functions.
|
||||
//
|
||||
|
||||
/// Get blob that describes a certificate request. You can send this to your game coordinator.
|
||||
/// Upon entry, *pcbBlob should contain the size of the buffer. On successful exit, it will
|
||||
/// return the number of bytes that were populated. You can pass pBlob=NULL to query for the required
|
||||
/// size. (512 bytes is a conservative estimate.)
|
||||
///
|
||||
/// Pass this blob to your game coordinator and call SteamDatagram_CreateCert.
|
||||
virtual bool GetCertificateRequest( int *pcbBlob, void *pBlob, SteamNetworkingErrMsg &errMsg ) = 0;
|
||||
|
||||
/// Set the certificate. The certificate blob should be the output of
|
||||
/// SteamDatagram_CreateCert.
|
||||
virtual bool SetCertificate( const void *pCertificate, int cbCertificate, SteamNetworkingErrMsg &errMsg ) = 0;
|
||||
|
||||
/// Reset the identity associated with this instance.
|
||||
/// Any open connections are closed. Any previous certificates, etc are discarded.
|
||||
/// You can pass a specific identity that you want to use, or you can pass NULL,
|
||||
/// in which case the identity will be invalid until you set it using SetCertificate
|
||||
///
|
||||
/// NOTE: This function is not actually supported on Steam! It is included
|
||||
/// for use on other platforms where the active user can sign out and
|
||||
/// a new user can sign in.
|
||||
virtual void ResetIdentity( const SteamNetworkingIdentity *pIdentity ) = 0;
|
||||
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
|
||||
/// 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;
|
||||
|
||||
//
|
||||
// "FakeIP" system.
|
||||
//
|
||||
// A FakeIP is essentially a temporary, arbitrary identifier that
|
||||
// happens to be a valid IPv4 address. The purpose of this system is to make it
|
||||
// easy to integrate with existing code that identifies hosts using IPv4 addresses.
|
||||
// The FakeIP address will never actually be used to send or receive any packets
|
||||
// on the Internet, it is strictly an identifier.
|
||||
//
|
||||
// FakeIP addresses are designed to (hopefully) pass through existing code as
|
||||
// transparently as possible, while conflicting with "real" addresses that might
|
||||
// be in use on networks (both the Internet and LANs) in the same code as little
|
||||
// as possible. At the time this comment is being written, they come from the
|
||||
// 169.254.0.0/16 range, and the port number will always be >1024. HOWEVER,
|
||||
// this is subject to change! Do not make assumptions about these addresses,
|
||||
// or your code might break in the future. In particular, you should use
|
||||
// functions such as ISteamNetworkingUtils::IsFakeIP to determine if an IP
|
||||
// address is a "fake" one used by this system.
|
||||
//
|
||||
|
||||
/// Begin asynchronous process of allocating a fake IPv4 address that other
|
||||
/// peers can use to contact us via P2P. IP addresses returned by this
|
||||
/// function are globally unique for a given appid.
|
||||
///
|
||||
/// nNumPorts is the numbers of ports you wish to reserve. This is useful
|
||||
/// for the same reason that listening on multiple UDP ports is useful for
|
||||
/// different types of traffic. Because these allocations come from a global
|
||||
/// namespace, there is a relatively strict limit on the maximum number of
|
||||
/// ports you may request. (At the time of this writing, the limit is 4.)
|
||||
/// The port assignments are *not* guaranteed to have any particular order
|
||||
/// or relationship! Do *not* assume they are contiguous, even though that
|
||||
/// may often occur in practice.
|
||||
///
|
||||
/// Returns false if a request was already in progress, true if a new request
|
||||
/// was started. A SteamNetworkingFakeIPResult_t will be posted when the request
|
||||
/// completes.
|
||||
///
|
||||
/// For gameservers, you *must* call this after initializing the SDK but before
|
||||
/// beginning login. Steam needs to know in advance that FakeIP will be used.
|
||||
/// Everywhere your public IP would normally appear (such as the server browser) will be
|
||||
/// replaced by the FakeIP, and the fake port at index 0. The request is actually queued
|
||||
/// until the logon completes, so you must not wait until the allocation completes
|
||||
/// before logging in. Except for trivial failures that can be detected locally
|
||||
/// (e.g. invalid parameter), a SteamNetworkingFakeIPResult_t callback (whether success or
|
||||
/// failure) will not be posted until after we have logged in. Furthermore, it is assumed
|
||||
/// that FakeIP allocation is essential for your application to function, and so failure
|
||||
/// will not be reported until *several* retries have been attempted. This process may
|
||||
/// last several minutes. It is *highly* recommended to treat failure as fatal.
|
||||
///
|
||||
/// To communicate using a connection-oriented (TCP-style) API:
|
||||
/// - Server creates a listen socket using CreateListenSocketP2PFakeIP
|
||||
/// - Client connects using ConnectByIPAddress, passing in the FakeIP address.
|
||||
/// - The connection will behave mostly like a P2P connection. The identities
|
||||
/// that appear in SteamNetConnectionInfo_t will be the FakeIP identity until
|
||||
/// we know the real identity. Then it will be the real identity. If the
|
||||
/// SteamNetConnectionInfo_t::m_addrRemote is valid, it will be a real IPv4
|
||||
/// address of a NAT-punched connection. Otherwise, it will not be valid.
|
||||
///
|
||||
/// To communicate using an ad-hoc sendto/recv from (UDP-style) API,
|
||||
/// use CreateFakeUDPPort.
|
||||
virtual bool BeginAsyncRequestFakeIP( int nNumPorts ) = 0;
|
||||
|
||||
/// Return info about the FakeIP and port(s) that we have been assigned,
|
||||
/// if any. idxFirstPort is currently reserved and must be zero.
|
||||
/// Make sure and check SteamNetworkingFakeIPResult_t::m_eResult
|
||||
virtual void GetFakeIP( int idxFirstPort, SteamNetworkingFakeIPResult_t *pInfo ) = 0;
|
||||
|
||||
/// Create a listen socket that will listen for P2P connections sent
|
||||
/// to our FakeIP. A peer can initiate connections to this listen
|
||||
/// socket by calling ConnectByIPAddress.
|
||||
///
|
||||
/// idxFakePort refers to the *index* of the fake port requested,
|
||||
/// not the actual port number. For example, pass 0 to refer to the
|
||||
/// first port in the reservation. You must call this only after calling
|
||||
/// BeginAsyncRequestFakeIP. However, you do not need to wait for the
|
||||
/// request to complete before creating the listen socket.
|
||||
virtual HSteamListenSocket CreateListenSocketP2PFakeIP( int idxFakePort, int nOptions, const SteamNetworkingConfigValue_t *pOptions ) = 0;
|
||||
|
||||
/// If the connection was initiated using the "FakeIP" system, then we
|
||||
/// we can get an IP address for the remote host. If the remote host had
|
||||
/// a global FakeIP at the time the connection was established, this
|
||||
/// function will return that global IP. Otherwise, a FakeIP that is
|
||||
/// unique locally will be allocated from the local FakeIP address space,
|
||||
/// and that will be returned.
|
||||
///
|
||||
/// The allocation of local FakeIPs attempts to assign addresses in
|
||||
/// a consistent manner. If multiple connections are made to the
|
||||
/// same remote host, they *probably* will return the same FakeIP.
|
||||
/// However, since the namespace is limited, this cannot be guaranteed.
|
||||
///
|
||||
/// On failure, returns:
|
||||
/// - k_EResultInvalidParam: invalid connection handle
|
||||
/// - k_EResultIPNotFound: This connection wasn't made using FakeIP system
|
||||
virtual EResult GetRemoteFakeIPForConnection( HSteamNetConnection hConn, SteamNetworkingIPAddr *pOutAddr ) = 0;
|
||||
|
||||
/// Get an interface that can be used like a UDP port to send/receive
|
||||
/// datagrams to a FakeIP address. This is intended to make it easy
|
||||
/// to port existing UDP-based code to take advantage of SDR.
|
||||
///
|
||||
/// idxFakeServerPort refers to the *index* of the port allocated using
|
||||
/// BeginAsyncRequestFakeIP and is used to create "server" ports. You may
|
||||
/// call this before the allocation has completed. However, any attempts
|
||||
/// to send packets will fail until the allocation has succeeded. When
|
||||
/// the peer receives packets sent from this interface, the from address
|
||||
/// of the packet will be the globally-unique FakeIP. If you call this
|
||||
/// function multiple times and pass the same (nonnegative) fake port index,
|
||||
/// the same object will be returned, and this object is not reference counted.
|
||||
///
|
||||
/// To create a "client" port (e.g. the equivalent of an ephemeral UDP port)
|
||||
/// pass -1. In this case, a distinct object will be returned for each call.
|
||||
/// When the peer receives packets sent from this interface, the peer will
|
||||
/// assign a FakeIP from its own locally-controlled namespace.
|
||||
virtual ISteamNetworkingFakeUDPPort *CreateFakeUDPPort( int idxFakeServerPort ) = 0;
|
||||
|
||||
protected:
|
||||
// ~ISteamNetworkingSockets(); // Silence some warnings
|
||||
};
|
||||
|
||||
#endif // ISTEAMNETWORKINGSOCKETS011
|
147
sdk/steam/isteamremotestorage015.h
Normal file
147
sdk/steam/isteamremotestorage015.h
Normal file
@ -0,0 +1,147 @@
|
||||
#ifndef ISTEAMREMOTESTORAGE015_H
|
||||
#define ISTEAMREMOTESTORAGE015_H
|
||||
#ifdef STEAM_WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
|
||||
// this interface version is not found in public SDK archives, it is based on reversing the returned vftable from steamclient64.dll
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Functions for accessing, reading and writing files stored remotely
|
||||
// and cached locally
|
||||
//-----------------------------------------------------------------------------
|
||||
class ISteamRemoteStorage015
|
||||
{
|
||||
public:
|
||||
// NOTE
|
||||
//
|
||||
// Filenames are case-insensitive, and will be converted to lowercase automatically.
|
||||
// So "foo.bar" and "Foo.bar" are the same file, and if you write "Foo.bar" then
|
||||
// iterate the files, the filename returned will be "foo.bar".
|
||||
//
|
||||
|
||||
// file operations
|
||||
virtual bool FileWrite( const char *pchFile, const void *pvData, int32 cubData ) = 0;
|
||||
virtual int32 FileRead( const char *pchFile, void *pvData, int32 cubDataToRead ) = 0;
|
||||
|
||||
STEAM_CALL_RESULT( RemoteStorageFileWriteAsyncComplete_t )
|
||||
virtual SteamAPICall_t FileWriteAsync( const char *pchFile, const void *pvData, uint32 cubData ) = 0;
|
||||
|
||||
STEAM_CALL_RESULT( RemoteStorageFileReadAsyncComplete_t )
|
||||
virtual SteamAPICall_t FileReadAsync( const char *pchFile, uint32 nOffset, uint32 cubToRead ) = 0;
|
||||
virtual bool FileReadAsyncComplete( SteamAPICall_t hReadCall, void *pvBuffer, uint32 cubToRead ) = 0;
|
||||
|
||||
virtual bool FileForget( const char *pchFile ) = 0;
|
||||
virtual bool FileDelete( const char *pchFile ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageFileShareResult_t )
|
||||
virtual SteamAPICall_t FileShare( const char *pchFile ) = 0;
|
||||
virtual bool SetSyncPlatforms( const char *pchFile, ERemoteStoragePlatform eRemoteStoragePlatform ) = 0;
|
||||
|
||||
// file operations that cause network IO
|
||||
virtual UGCFileWriteStreamHandle_t FileWriteStreamOpen( const char *pchFile ) = 0;
|
||||
virtual bool FileWriteStreamWriteChunk( UGCFileWriteStreamHandle_t writeHandle, const void *pvData, int32 cubData ) = 0;
|
||||
virtual bool FileWriteStreamClose( UGCFileWriteStreamHandle_t writeHandle ) = 0;
|
||||
virtual bool FileWriteStreamCancel( UGCFileWriteStreamHandle_t writeHandle ) = 0;
|
||||
|
||||
// file information
|
||||
virtual bool FileExists( const char *pchFile ) = 0;
|
||||
virtual bool FilePersisted( const char *pchFile ) = 0;
|
||||
virtual int32 GetFileSize( const char *pchFile ) = 0;
|
||||
virtual int64 GetFileTimestamp( const char *pchFile ) = 0;
|
||||
virtual ERemoteStoragePlatform GetSyncPlatforms( const char *pchFile ) = 0;
|
||||
|
||||
// iteration
|
||||
virtual int32 GetFileCount() = 0;
|
||||
virtual const char *GetFileNameAndSize( int iFile, int32 *pnFileSizeInBytes ) = 0;
|
||||
|
||||
// configuration management
|
||||
virtual bool GetQuota( uint64 *pnTotalBytes, uint64 *puAvailableBytes ) = 0;
|
||||
virtual bool IsCloudEnabledForAccount() = 0;
|
||||
virtual bool IsCloudEnabledForApp() = 0;
|
||||
virtual void SetCloudEnabledForApp( bool bEnabled ) = 0;
|
||||
|
||||
// user generated content
|
||||
|
||||
// Downloads a UGC file. A priority value of 0 will download the file immediately,
|
||||
// otherwise it will wait to download the file until all downloads with a lower priority
|
||||
// value are completed. Downloads with equal priority will occur simultaneously.
|
||||
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
|
||||
virtual SteamAPICall_t UGCDownload( UGCHandle_t hContent, uint32 unPriority ) = 0;
|
||||
|
||||
// Gets the amount of data downloaded so far for a piece of content. pnBytesExpected can be 0 if function returns false
|
||||
// or if the transfer hasn't started yet, so be careful to check for that before dividing to get a percentage
|
||||
virtual bool GetUGCDownloadProgress( UGCHandle_t hContent, int32 *pnBytesDownloaded, int32 *pnBytesExpected ) = 0;
|
||||
|
||||
// Gets metadata for a file after it has been downloaded. This is the same metadata given in the RemoteStorageDownloadUGCResult_t call result
|
||||
virtual bool GetUGCDetails( UGCHandle_t hContent, AppId_t *pnAppID, STEAM_OUT_STRING() char **ppchName, int32 *pnFileSizeInBytes, STEAM_OUT_STRUCT() CSteamID *pSteamIDOwner ) = 0;
|
||||
|
||||
// After download, gets the content of the file.
|
||||
// Small files can be read all at once by calling this function with an offset of 0 and cubDataToRead equal to the size of the file.
|
||||
// Larger files can be read in chunks to reduce memory usage (since both sides of the IPC client and the game itself must allocate
|
||||
// enough memory for each chunk). Once the last byte is read, the file is implicitly closed and further calls to UGCRead will fail
|
||||
// unless UGCDownload is called again.
|
||||
// For especially large files (anything over 100MB) it is a requirement that the file is read in chunks.
|
||||
virtual int32 UGCRead( UGCHandle_t hContent, void *pvData, int32 cubDataToRead, uint32 cOffset, EUGCReadAction eAction ) = 0;
|
||||
|
||||
// Functions to iterate through UGC that has finished downloading but has not yet been read via UGCRead()
|
||||
virtual int32 GetCachedUGCCount() = 0;
|
||||
virtual UGCHandle_t GetCachedUGCHandle( int32 iCachedContent ) = 0;
|
||||
|
||||
// publishing UGC
|
||||
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
|
||||
virtual SteamAPICall_t PublishWorkshopFile( const char *pchFile, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags, EWorkshopFileType eWorkshopFileType ) = 0;
|
||||
virtual PublishedFileUpdateHandle_t CreatePublishedFileUpdateRequest( PublishedFileId_t unPublishedFileId ) = 0;
|
||||
virtual bool UpdatePublishedFileFile( PublishedFileUpdateHandle_t updateHandle, const char *pchFile ) = 0;
|
||||
virtual bool UpdatePublishedFilePreviewFile( PublishedFileUpdateHandle_t updateHandle, const char *pchPreviewFile ) = 0;
|
||||
virtual bool UpdatePublishedFileTitle( PublishedFileUpdateHandle_t updateHandle, const char *pchTitle ) = 0;
|
||||
virtual bool UpdatePublishedFileDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchDescription ) = 0;
|
||||
virtual bool UpdatePublishedFileVisibility( PublishedFileUpdateHandle_t updateHandle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0;
|
||||
virtual bool UpdatePublishedFileTags( PublishedFileUpdateHandle_t updateHandle, SteamParamStringArray_t *pTags ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageUpdatePublishedFileResult_t )
|
||||
virtual SteamAPICall_t CommitPublishedFileUpdate( PublishedFileUpdateHandle_t updateHandle ) = 0;
|
||||
// Gets published file details for the given publishedfileid. If unMaxSecondsOld is greater than 0,
|
||||
// cached data may be returned, depending on how long ago it was cached. A value of 0 will force a refresh.
|
||||
// A value of k_WorkshopForceLoadPublishedFileDetailsFromCache will use cached data if it exists, no matter how old it is.
|
||||
STEAM_CALL_RESULT( RemoteStorageGetPublishedFileDetailsResult_t )
|
||||
virtual SteamAPICall_t GetPublishedFileDetails( PublishedFileId_t unPublishedFileId, uint32 unMaxSecondsOld ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageDeletePublishedFileResult_t )
|
||||
virtual SteamAPICall_t DeletePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
|
||||
// enumerate the files that the current user published with this app
|
||||
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
|
||||
virtual SteamAPICall_t EnumerateUserPublishedFiles( uint32 unStartIndex ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
|
||||
virtual SteamAPICall_t SubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageEnumerateUserSubscribedFilesResult_t )
|
||||
virtual SteamAPICall_t EnumerateUserSubscribedFiles( uint32 unStartIndex ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
|
||||
virtual SteamAPICall_t UnsubscribePublishedFile( PublishedFileId_t unPublishedFileId ) = 0;
|
||||
virtual bool UpdatePublishedFileSetChangeDescription( PublishedFileUpdateHandle_t updateHandle, const char *pchChangeDescription ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
|
||||
virtual SteamAPICall_t GetPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageUpdateUserPublishedItemVoteResult_t )
|
||||
virtual SteamAPICall_t UpdateUserPublishedItemVote( PublishedFileId_t unPublishedFileId, bool bVoteUp ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageGetPublishedItemVoteDetailsResult_t )
|
||||
virtual SteamAPICall_t GetUserPublishedItemVoteDetails( PublishedFileId_t unPublishedFileId ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageEnumerateUserPublishedFilesResult_t )
|
||||
virtual SteamAPICall_t EnumerateUserSharedWorkshopFiles( CSteamID steamId, uint32 unStartIndex, SteamParamStringArray_t *pRequiredTags, SteamParamStringArray_t *pExcludedTags ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStoragePublishFileProgress_t )
|
||||
virtual SteamAPICall_t PublishVideo( EWorkshopVideoProvider eVideoProvider, const char *pchVideoAccount, const char *pchVideoIdentifier, const char *pchPreviewFile, AppId_t nConsumerAppId, const char *pchTitle, const char *pchDescription, ERemoteStoragePublishedFileVisibility eVisibility, SteamParamStringArray_t *pTags ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageSetUserPublishedFileActionResult_t )
|
||||
virtual SteamAPICall_t SetUserPublishedFileAction( PublishedFileId_t unPublishedFileId, EWorkshopFileAction eAction ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageEnumeratePublishedFilesByUserActionResult_t )
|
||||
virtual SteamAPICall_t EnumeratePublishedFilesByUserAction( EWorkshopFileAction eAction, uint32 unStartIndex ) = 0;
|
||||
// this method enumerates the public view of workshop files
|
||||
STEAM_CALL_RESULT( RemoteStorageEnumerateWorkshopFilesResult_t )
|
||||
virtual SteamAPICall_t EnumeratePublishedWorkshopFiles( EWorkshopEnumerationType eEnumerationType, uint32 unStartIndex, uint32 unCount, uint32 unDays, SteamParamStringArray_t *pTags, SteamParamStringArray_t *pUserTags ) = 0;
|
||||
|
||||
STEAM_CALL_RESULT( RemoteStorageDownloadUGCResult_t )
|
||||
virtual SteamAPICall_t UGCDownloadToLocation( UGCHandle_t hContent, const char *pchLocation, uint32 unPriority ) = 0;
|
||||
|
||||
// Cloud dynamic state change notification
|
||||
virtual int32 GetLocalFileChangeCount() = 0;
|
||||
virtual const char *GetLocalFileChange( int iFile, ERemoteStorageLocalFileChange *pEChangeType, ERemoteStorageFilePathType *pEFilePathType ) = 0;
|
||||
};
|
||||
|
||||
#endif // ISTEAMREMOTESTORAGE015_H
|
161
sdk/steam/isteamugc011.h
Normal file
161
sdk/steam/isteamugc011.h
Normal file
@ -0,0 +1,161 @@
|
||||
|
||||
#ifndef ISTEAMUGC011_H
|
||||
#define ISTEAMUGC011_H
|
||||
#ifdef STEAM_WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
// this interface version is not found in public SDK archives, it is based on reversing the returned vftable from steamclient64.dll
|
||||
|
||||
class ISteamUGC011
|
||||
{
|
||||
public:
|
||||
|
||||
// Query UGC associated with a user. Creator app id or consumer app id must be valid and be set to the current running app. unPage should start at 1.
|
||||
virtual UGCQueryHandle_t CreateQueryUserUGCRequest( AccountID_t unAccountID, EUserUGCList eListType, EUGCMatchingUGCType eMatchingUGCType, EUserUGCListSortOrder eSortOrder, AppId_t nCreatorAppID, AppId_t nConsumerAppID, uint32 unPage ) = 0;
|
||||
|
||||
// Query for all matching UGC using the new deep paging interface. Creator app id or consumer app id must be valid and be set to the current running app. pchCursor should be set to NULL or "*" to get the first result set.
|
||||
virtual UGCQueryHandle_t CreateQueryAllUGCRequest( EUGCQuery eQueryType, EUGCMatchingUGCType eMatchingeMatchingUGCTypeFileType, AppId_t nCreatorAppID, AppId_t nConsumerAppID, const char *pchCursor = NULL ) = 0;
|
||||
|
||||
// Query for the details of the given published file ids (the RequestUGCDetails call is deprecated and replaced with this)
|
||||
virtual UGCQueryHandle_t CreateQueryUGCDetailsRequest( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
|
||||
|
||||
// Send the query to Steam
|
||||
STEAM_CALL_RESULT( SteamUGCQueryCompleted_t )
|
||||
virtual SteamAPICall_t SendQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
|
||||
|
||||
// Retrieve an individual result after receiving the callback for querying UGC
|
||||
virtual bool GetQueryUGCResult( UGCQueryHandle_t handle, uint32 index, SteamUGCDetails_t *pDetails ) = 0;
|
||||
virtual bool GetQueryUGCPreviewURL( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURL, uint32 cchURLSize ) = 0;
|
||||
virtual bool GetQueryUGCMetadata( UGCQueryHandle_t handle, uint32 index, STEAM_OUT_STRING_COUNT(cchMetadatasize) char *pchMetadata, uint32 cchMetadatasize ) = 0;
|
||||
virtual bool GetQueryUGCChildren( UGCQueryHandle_t handle, uint32 index, PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0;
|
||||
virtual bool GetQueryUGCStatistic( UGCQueryHandle_t handle, uint32 index, EItemStatistic eStatType, uint64 *pStatValue ) = 0;
|
||||
virtual uint32 GetQueryUGCNumAdditionalPreviews( UGCQueryHandle_t handle, uint32 index ) = 0;
|
||||
virtual bool GetQueryUGCAdditionalPreview( UGCQueryHandle_t handle, uint32 index, uint32 previewIndex, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchURLOrVideoID, uint32 cchURLSize, STEAM_OUT_STRING_COUNT(cchURLSize) char *pchOriginalFileName, uint32 cchOriginalFileNameSize, EItemPreviewType *pPreviewType ) = 0;
|
||||
virtual uint32 GetQueryUGCNumKeyValueTags( UGCQueryHandle_t handle, uint32 index ) = 0;
|
||||
virtual bool GetQueryUGCKeyValueTag( UGCQueryHandle_t handle, uint32 index, uint32 keyValueTagIndex, STEAM_OUT_STRING_COUNT(cchKeySize) char *pchKey, uint32 cchKeySize, STEAM_OUT_STRING_COUNT(cchValueSize) char *pchValue, uint32 cchValueSize ) = 0;
|
||||
|
||||
// Release the request to free up memory, after retrieving results
|
||||
virtual bool ReleaseQueryUGCRequest( UGCQueryHandle_t handle ) = 0;
|
||||
|
||||
// Options to set for querying UGC
|
||||
virtual bool AddRequiredTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
|
||||
virtual bool AddExcludedTag( UGCQueryHandle_t handle, const char *pTagName ) = 0;
|
||||
virtual bool SetReturnOnlyIDs( UGCQueryHandle_t handle, bool bReturnOnlyIDs ) = 0;
|
||||
virtual bool SetReturnKeyValueTags( UGCQueryHandle_t handle, bool bReturnKeyValueTags ) = 0;
|
||||
virtual bool SetReturnLongDescription( UGCQueryHandle_t handle, bool bReturnLongDescription ) = 0;
|
||||
virtual bool SetReturnMetadata( UGCQueryHandle_t handle, bool bReturnMetadata ) = 0;
|
||||
virtual bool SetReturnChildren( UGCQueryHandle_t handle, bool bReturnChildren ) = 0;
|
||||
virtual bool SetReturnAdditionalPreviews( UGCQueryHandle_t handle, bool bReturnAdditionalPreviews ) = 0;
|
||||
virtual bool SetReturnTotalOnly( UGCQueryHandle_t handle, bool bReturnTotalOnly ) = 0;
|
||||
virtual bool SetReturnPlaytimeStats( UGCQueryHandle_t handle, uint32 unDays ) = 0;
|
||||
virtual bool SetLanguage( UGCQueryHandle_t handle, const char *pchLanguage ) = 0;
|
||||
virtual bool SetAllowCachedResponse( UGCQueryHandle_t handle, uint32 unMaxAgeSeconds ) = 0;
|
||||
|
||||
// Options only for querying user UGC
|
||||
virtual bool SetCloudFileNameFilter( UGCQueryHandle_t handle, const char *pMatchCloudFileName ) = 0;
|
||||
|
||||
// Options only for querying all UGC
|
||||
virtual bool SetMatchAnyTag( UGCQueryHandle_t handle, bool bMatchAnyTag ) = 0;
|
||||
virtual bool SetSearchText( UGCQueryHandle_t handle, const char *pSearchText ) = 0;
|
||||
virtual bool SetRankedByTrendDays( UGCQueryHandle_t handle, uint32 unDays ) = 0;
|
||||
virtual bool AddRequiredKeyValueTag( UGCQueryHandle_t handle, const char *pKey, const char *pValue ) = 0;
|
||||
|
||||
// DEPRECATED - Use CreateQueryUGCDetailsRequest call above instead!
|
||||
virtual SteamAPICall_t RequestUGCDetails( PublishedFileId_t nPublishedFileID, uint32 unMaxAgeSeconds ) = 0;
|
||||
|
||||
// Steam Workshop Creator API
|
||||
STEAM_CALL_RESULT( CreateItemResult_t )
|
||||
virtual SteamAPICall_t CreateItem( AppId_t nConsumerAppId, EWorkshopFileType eFileType ) = 0; // create new item for this app with no content attached yet
|
||||
|
||||
virtual UGCUpdateHandle_t StartItemUpdate( AppId_t nConsumerAppId, PublishedFileId_t nPublishedFileID ) = 0; // start an UGC item update. Set changed properties before commiting update with CommitItemUpdate()
|
||||
|
||||
virtual bool SetItemTitle( UGCUpdateHandle_t handle, const char *pchTitle ) = 0; // change the title of an UGC item
|
||||
virtual bool SetItemDescription( UGCUpdateHandle_t handle, const char *pchDescription ) = 0; // change the description of an UGC item
|
||||
virtual bool SetItemUpdateLanguage( UGCUpdateHandle_t handle, const char *pchLanguage ) = 0; // specify the language of the title or description that will be set
|
||||
virtual bool SetItemMetadata( UGCUpdateHandle_t handle, const char *pchMetaData ) = 0; // change the metadata of an UGC item (max = k_cchDeveloperMetadataMax)
|
||||
virtual bool SetItemVisibility( UGCUpdateHandle_t handle, ERemoteStoragePublishedFileVisibility eVisibility ) = 0; // change the visibility of an UGC item
|
||||
virtual bool SetItemTags( UGCUpdateHandle_t updateHandle, const SteamParamStringArray_t *pTags ) = 0; // change the tags of an UGC item
|
||||
virtual bool SetItemContent( UGCUpdateHandle_t handle, const char *pszContentFolder ) = 0; // update item content from this local folder
|
||||
virtual bool SetItemPreview( UGCUpdateHandle_t handle, const char *pszPreviewFile ) = 0; // change preview image file for this item. pszPreviewFile points to local image file, which must be under 1MB in size
|
||||
virtual bool SetAllowLegacyUpload( UGCUpdateHandle_t handle, bool bAllowLegacyUpload ) = 0; // use legacy upload for a single small file. The parameter to SetItemContent() should either be a directory with one file or the full path to the file. The file must also be less than 10MB in size.
|
||||
virtual bool RemoveItemKeyValueTags( UGCUpdateHandle_t handle, const char *pchKey ) = 0; // remove any existing key-value tags with the specified key
|
||||
virtual bool AddItemKeyValueTag( UGCUpdateHandle_t handle, const char *pchKey, const char *pchValue ) = 0; // add new key-value tags for the item. Note that there can be multiple values for a tag.
|
||||
virtual bool AddItemPreviewFile( UGCUpdateHandle_t handle, const char *pszPreviewFile, EItemPreviewType type ) = 0; // add preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
|
||||
virtual bool AddItemPreviewVideo( UGCUpdateHandle_t handle, const char *pszVideoID ) = 0; // add preview video for this item
|
||||
virtual bool UpdateItemPreviewFile( UGCUpdateHandle_t handle, uint32 index, const char *pszPreviewFile ) = 0; // updates an existing preview file for this item. pszPreviewFile points to local file, which must be under 1MB in size
|
||||
virtual bool UpdateItemPreviewVideo( UGCUpdateHandle_t handle, uint32 index, const char *pszVideoID ) = 0; // updates an existing preview video for this item
|
||||
virtual bool RemoveItemPreview( UGCUpdateHandle_t handle, uint32 index ) = 0; // remove a preview by index starting at 0 (previews are sorted)
|
||||
|
||||
STEAM_CALL_RESULT( SubmitItemUpdateResult_t )
|
||||
virtual SteamAPICall_t SubmitItemUpdate( UGCUpdateHandle_t handle, const char *pchChangeNote ) = 0; // commit update process started with StartItemUpdate()
|
||||
virtual EItemUpdateStatus GetItemUpdateProgress( UGCUpdateHandle_t handle, uint64 *punBytesProcessed, uint64* punBytesTotal ) = 0;
|
||||
|
||||
// Steam Workshop Consumer API
|
||||
STEAM_CALL_RESULT( SetUserItemVoteResult_t )
|
||||
virtual SteamAPICall_t SetUserItemVote( PublishedFileId_t nPublishedFileID, bool bVoteUp ) = 0;
|
||||
STEAM_CALL_RESULT( GetUserItemVoteResult_t )
|
||||
virtual SteamAPICall_t GetUserItemVote( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
|
||||
virtual SteamAPICall_t AddItemToFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
|
||||
STEAM_CALL_RESULT( UserFavoriteItemsListChanged_t )
|
||||
virtual SteamAPICall_t RemoveItemFromFavorites( AppId_t nAppId, PublishedFileId_t nPublishedFileID ) = 0;
|
||||
STEAM_CALL_RESULT( RemoteStorageSubscribePublishedFileResult_t )
|
||||
virtual SteamAPICall_t SubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // subscribe to this item, will be installed ASAP
|
||||
STEAM_CALL_RESULT( RemoteStorageUnsubscribePublishedFileResult_t )
|
||||
virtual SteamAPICall_t UnsubscribeItem( PublishedFileId_t nPublishedFileID ) = 0; // unsubscribe from this item, will be uninstalled after game quits
|
||||
virtual uint32 GetNumSubscribedItems() = 0; // number of subscribed items
|
||||
virtual uint32 GetSubscribedItems( PublishedFileId_t* pvecPublishedFileID, uint32 cMaxEntries ) = 0; // all subscribed item PublishFileIDs
|
||||
|
||||
// get EItemState flags about item on this client
|
||||
virtual uint32 GetItemState( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
|
||||
// get info about currently installed content on disc for items that have k_EItemStateInstalled set
|
||||
// if k_EItemStateLegacyItem is set, pchFolder contains the path to the legacy file itself (not a folder)
|
||||
virtual bool GetItemInstallInfo( PublishedFileId_t nPublishedFileID, uint64 *punSizeOnDisk, STEAM_OUT_STRING_COUNT( cchFolderSize ) char *pchFolder, uint32 cchFolderSize, uint32 *punTimeStamp ) = 0;
|
||||
|
||||
// get info about pending update for items that have k_EItemStateNeedsUpdate set. punBytesTotal will be valid after download started once
|
||||
virtual bool GetItemDownloadInfo( PublishedFileId_t nPublishedFileID, uint64 *punBytesDownloaded, uint64 *punBytesTotal ) = 0;
|
||||
|
||||
// download new or update already installed item. If function returns true, wait for DownloadItemResult_t. If the item is already installed,
|
||||
// then files on disk should not be used until callback received. If item is not subscribed to, it will be cached for some time.
|
||||
// If bHighPriority is set, any other item download will be suspended and this item downloaded ASAP.
|
||||
virtual bool DownloadItem( PublishedFileId_t nPublishedFileID, bool bHighPriority ) = 0;
|
||||
|
||||
// game servers can set a specific workshop folder before issuing any UGC commands.
|
||||
// This is helpful if you want to support multiple game servers running out of the same install folder
|
||||
virtual bool BInitWorkshopForGameServer( DepotId_t unWorkshopDepotID, const char *pszFolder ) = 0;
|
||||
|
||||
// SuspendDownloads( true ) will suspend all workshop downloads until SuspendDownloads( false ) is called or the game ends
|
||||
virtual void SuspendDownloads( bool bSuspend ) = 0;
|
||||
|
||||
// usage tracking
|
||||
STEAM_CALL_RESULT( StartPlaytimeTrackingResult_t )
|
||||
virtual SteamAPICall_t StartPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
|
||||
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
|
||||
virtual SteamAPICall_t StopPlaytimeTracking( PublishedFileId_t *pvecPublishedFileID, uint32 unNumPublishedFileIDs ) = 0;
|
||||
STEAM_CALL_RESULT( StopPlaytimeTrackingResult_t )
|
||||
virtual SteamAPICall_t StopPlaytimeTrackingForAllItems() = 0;
|
||||
|
||||
// parent-child relationship or dependency management
|
||||
STEAM_CALL_RESULT( AddUGCDependencyResult_t )
|
||||
virtual SteamAPICall_t AddDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
|
||||
STEAM_CALL_RESULT( RemoveUGCDependencyResult_t )
|
||||
virtual SteamAPICall_t RemoveDependency( PublishedFileId_t nParentPublishedFileID, PublishedFileId_t nChildPublishedFileID ) = 0;
|
||||
|
||||
// add/remove app dependence/requirements (usually DLC)
|
||||
STEAM_CALL_RESULT( AddAppDependencyResult_t )
|
||||
virtual SteamAPICall_t AddAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
|
||||
STEAM_CALL_RESULT( RemoveAppDependencyResult_t )
|
||||
virtual SteamAPICall_t RemoveAppDependency( PublishedFileId_t nPublishedFileID, AppId_t nAppID ) = 0;
|
||||
// request app dependencies. note that whatever callback you register for GetAppDependenciesResult_t may be called multiple times
|
||||
// until all app dependencies have been returned
|
||||
STEAM_CALL_RESULT( GetAppDependenciesResult_t )
|
||||
virtual SteamAPICall_t GetAppDependencies( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
|
||||
// delete the item without prompting the user
|
||||
STEAM_CALL_RESULT( DeleteItemResult_t )
|
||||
virtual SteamAPICall_t DeleteItem( PublishedFileId_t nPublishedFileID ) = 0;
|
||||
};
|
||||
|
||||
#endif // ISTEAMUGC011_H
|
@ -120,6 +120,8 @@
|
||||
#include "isteamnetworkingsockets006.h"
|
||||
#include "isteamnetworkingsockets008.h"
|
||||
#include "isteamnetworkingsockets009.h"
|
||||
#include "isteamnetworkingsockets010.h"
|
||||
#include "isteamnetworkingsockets011.h"
|
||||
#include "isteamremotestorage.h"
|
||||
#include "isteamremotestorage001.h"
|
||||
#include "isteamremotestorage002.h"
|
||||
@ -135,6 +137,7 @@
|
||||
#include "isteamremotestorage012.h"
|
||||
#include "isteamremotestorage013.h"
|
||||
#include "isteamremotestorage014.h"
|
||||
#include "isteamremotestorage015.h"
|
||||
#include "isteamscreenshots.h"
|
||||
#include "isteamscreenshots001.h"
|
||||
#include "isteamscreenshots002.h"
|
||||
@ -161,6 +164,7 @@
|
||||
#include "isteamugc008.h"
|
||||
#include "isteamugc009.h"
|
||||
#include "isteamugc010.h"
|
||||
#include "isteamugc011.h"
|
||||
#include "isteamugc012.h"
|
||||
#include "isteamugc013.h"
|
||||
#include "isteamugc014.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user