Rise
The Vieneo Province
Loading...
Searching...
No Matches
steamnetworkingtypes.h
Go to the documentation of this file.
1//====== Copyright Valve Corporation, All rights reserved. ====================
2//
3// Purpose: misc networking utilities
4//
5//=============================================================================
6
7#ifndef STEAMNETWORKINGTYPES
8#define STEAMNETWORKINGTYPES
9#pragma once
10
11#include <string.h>
12#include <stdint.h>
13#include "steamtypes.h"
14#include "steamclientpublic.h"
15
16//-----------------------------------------------------------------------------
17// SteamNetworkingSockets config.
18#if !defined(STEAMNETWORKINGSOCKETS_STANDALONELIB) && !defined(STEAMNETWORKINGSOCKETS_STEAMAPI)
19 #define STEAMNETWORKINGSOCKETS_STEAMAPI
20#endif
21//-----------------------------------------------------------------------------
22
23#ifdef NN_NINTENDO_SDK // We always static link on Nintendo
24 #define STEAMNETWORKINGSOCKETS_STATIC_LINK
25#endif
26#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK )
27 #define STEAMNETWORKINGSOCKETS_INTERFACE extern "C"
28#elif defined( STEAMNETWORKINGSOCKETS_FOREXPORT )
29 #if defined( _WIN32 ) || defined( __ORBIS__ ) || defined( __PROSPERO__ )
30 #define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __declspec( dllexport )
31 #else
32 #define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __attribute__((visibility("default")))
33 #endif
34#else
35 #ifdef _WIN32
36 #define STEAMNETWORKINGSOCKETS_INTERFACE extern "C" __declspec( dllimport )
37 #else
38 #define STEAMNETWORKINGSOCKETS_INTERFACE extern "C"
39 #endif
40#endif
41
42#if defined( VALVE_CALLBACK_PACK_SMALL )
43#pragma pack( push, 4 )
44#elif defined( VALVE_CALLBACK_PACK_LARGE )
45#pragma pack( push, 8 )
46#else
47#error "Must define VALVE_CALLBACK_PACK_SMALL or VALVE_CALLBACK_PACK_LARGE"
48#endif
49
50struct SteamDatagramRelayAuthTicket;
51struct SteamDatagramHostedAddress;
52struct SteamDatagramGameCoordinatorServerLogin;
59
66
70
76
81
84
88
92
99
102{
103 // Negative values indicate a problem.
104 //
105 // In general, we will not automatically retry unless you take some action that
106 // depends on of requests this resource, such as querying the status, attempting
107 // to initiate a connection, receive a connection, etc. If you do not take any
108 // action at all, we do not automatically retry in the background.
109 k_ESteamNetworkingAvailability_CannotTry = -102, // A dependent resource is missing, so this service is unavailable. (E.g. we cannot talk to routers because Internet is down or we don't have the network config.)
110 k_ESteamNetworkingAvailability_Failed = -101, // We have tried for enough time that we would expect to have been successful by now. We have never been successful
111 k_ESteamNetworkingAvailability_Previously = -100, // We tried and were successful at one time, but now it looks like we have a problem
112
113 k_ESteamNetworkingAvailability_Retrying = -10, // We previously failed and are currently retrying
114
115 // Not a problem, but not ready either
116 k_ESteamNetworkingAvailability_NeverTried = 1, // We don't know because we haven't ever checked/tried
117 k_ESteamNetworkingAvailability_Waiting = 2, // We're waiting on a dependent resource to be acquired. (E.g. we cannot obtain a cert until we are logged into Steam. We cannot measure latency to relays until we have the network config.)
118 k_ESteamNetworkingAvailability_Attempting = 3, // We're actively trying now, but are not yet successful.
119
120 k_ESteamNetworkingAvailability_Current = 100, // Resource is online/available
121
122
123 k_ESteamNetworkingAvailability_Unknown = 0, // Internal dummy/sentinel, or value is not applicable in this context
125};
126
127//
128// Describing network hosts
129//
130
133{
134 // Dummy/empty/invalid.
135 // Please note that if we parse a string that we don't recognize
136 // but that appears reasonable, we will NOT use this type. Instead
137 // we'll use k_ESteamNetworkingIdentityType_UnknownType.
139
140 //
141 // Basic platform-specific identifiers.
142 //
144 k_ESteamNetworkingIdentityType_XboxPairwiseID = 17, // Publisher-specific user identity, as string
146
147 //
148 // Special identifiers.
149 //
150
151 // Use their IP address (and port) as their "identity".
152 // These types of identities are always unauthenticated.
153 // They are useful for porting plain sockets code, and other
154 // situations where you don't care about authentication. In this
155 // case, the local identity will be "localhost",
156 // and the remote address will be their network address.
157 //
158 // We use the same type for either IPv4 or IPv6, and
159 // the address is always store as IPv6. We use IPv4
160 // mapped addresses to handle IPv4.
162
163 // Generic string/binary blobs. It's up to your app to interpret this.
164 // This library can tell you if the remote host presented a certificate
165 // signed by somebody you have chosen to trust, with this identity on it.
166 // It's up to you to ultimately decide what this identity means.
169
170 // This identity type is used when we parse a string that looks like is a
171 // valid identity, just of a kind that we don't recognize. In this case, we
172 // can often still communicate with the peer! Allowing such identities
173 // for types we do not recognize useful is very useful for forward
174 // compatibility.
176
177 // Make sure this enum is stored in an int.
179};
180
184{
185 k_ESteamNetworkingFakeIPType_Invalid, // Error, argument was not even an IP address, etc.
186 k_ESteamNetworkingFakeIPType_NotFake, // Argument was a valid IP, but was not from the reserved "fake" range
187 k_ESteamNetworkingFakeIPType_GlobalIPv4, // Globally unique (for a given app) IPv4 address. Address space managed by Steam
188 k_ESteamNetworkingFakeIPType_LocalIPv4, // Locally unique IPv4 address. Address space managed by the local process. For internal use only; should not be shared!
189
191};
192
193#pragma pack(push,1)
194
199{
200 void Clear(); // Set everything to zero. E.g. [::]:0
201 bool IsIPv6AllZeros() const; // Return true if the IP is ::0. (Doesn't check port.)
202 void SetIPv6( const uint8 *ipv6, uint16 nPort ); // Set IPv6 address. IP is interpreted as bytes, so there are no endian issues. (Same as inaddr_in6.) The IP can be a mapped IPv4 address
203 void SetIPv4( uint32 nIP, uint16 nPort ); // Sets to IPv4 mapped address. IP and port are in host byte order.
204 bool IsIPv4() const; // Return true if IP is mapped IPv4
205 uint32 GetIPv4() const; // Returns IP in host byte order (e.g. aa.bb.cc.dd as 0xaabbccdd). Returns 0 if IP is not mapped IPv4.
206 void SetIPv6LocalHost( uint16 nPort = 0); // Set to the IPv6 localhost address ::1, and the specified port.
207 bool IsLocalHost() const; // Return true if this identity is localhost. (Either IPv6 ::1, or IPv4 127.0.0.1)
208
209 // Max length of the buffer needed to hold IP formatted using ToString, including '\0'
210 // ([0123:4567:89ab:cdef:0123:4567:89ab:cdef]:12345)
211 enum { k_cchMaxString = 48 };
212
220 inline void ToString( char *buf, size_t cbBuf, bool bWithPort ) const;
221
224 inline bool ParseString( const char *pszStr );
225
231 uint8 m_ip[ 4 ]; // NOTE: As bytes, i.e. network byte order
232 };
233
234 union
235 {
236 uint8 m_ipv6[ 16 ];
238 };
239 uint16 m_port; // Host byte order
240
242 bool operator==(const SteamNetworkingIPAddr &x ) const;
243
247
250};
251
258{
261
262 //
263 // Get/Set in various formats.
264 //
265
266 void Clear();
267 bool IsInvalid() const; // Return true if we are the invalid type. Does not make any other validity checks (e.g. is SteamID actually valid)
268
269 void SetSteamID( CSteamID steamID );
270 CSteamID GetSteamID() const; // Return black CSteamID (!IsValid()) if identity is not a SteamID
271 void SetSteamID64( uint64 steamID ); // Takes SteamID as raw 64-bit number
272 uint64 GetSteamID64() const; // Returns 0 if identity is not SteamID
273
274 bool SetXboxPairwiseID( const char *pszString ); // Returns false if invalid length
275 const char *GetXboxPairwiseID() const; // Returns nullptr if not Xbox ID
276
277 void SetPSNID( uint64 id );
278 uint64 GetPSNID() const; // Returns 0 if not PSN
279
280 void SetIPAddr( const SteamNetworkingIPAddr &addr ); // Set to specified IP:port
281 const SteamNetworkingIPAddr *GetIPAddr() const; // returns null if we are not an IP address.
282 void SetIPv4Addr( uint32 nIPv4, uint16 nPort ); // Set to specified IPv4:port
283 uint32 GetIPv4() const; // returns 0 if we are not an IPv4 address.
284
287
288 // "localhost" is equivalent for many purposes to "anonymous." Our remote
289 // will identify us by the network address we use.
290 void SetLocalHost(); // Set to localhost. (We always use IPv6 ::1 for this, not 127.0.0.1)
291 bool IsLocalHost() const; // Return true if this identity is localhost.
292
293 bool SetGenericString( const char *pszString ); // Returns false if invalid length
294 const char *GetGenericString() const; // Returns nullptr if not generic string type
295
296 bool SetGenericBytes( const void *data, size_t cbLen ); // Returns false if invalid size.
297 const uint8 *GetGenericBytes( int &cbLen ) const; // Returns null if not generic bytes type
298
300 bool operator==(const SteamNetworkingIdentity &x ) const;
301
308 void ToString( char *buf, size_t cbBuf ) const;
309
315 bool ParseString( const char *pszStr );
316
317 // Max sizes
318 enum {
319 k_cchMaxString = 128, // Max length of the buffer needed to hold any identity, formatted in string format by ToString
320 k_cchMaxGenericString = 32, // Max length of the string for generic string identities. Including terminating '\0'
321 k_cchMaxXboxPairwiseID = 33, // Including terminating '\0'
323 };
324
325 //
326 // Internal representation. Don't access this directly, use the accessors!
327 //
328 // Number of bytes that are relevant below. This MUST ALWAYS be
329 // set. (Use the accessors!) This is important to enable old code to work
330 // with new identity types.
332 union {
340 uint32 m_reserved[ 32 ]; // Pad structure to leave easy room for future expansion
341 };
342};
343#pragma pack(pop)
344
345//
346// Connection status
347//
348
351{
352
356
381
389
397
406
416
417//
418// The following values are used internally and will not be returned by any API.
419// We document them here to provide a little insight into the state machine that is used
420// under the hood.
421//
422
431
447
450
452};
453
458{
459 // Invalid/sentinel value
461
462 //
463 // Application codes. These are the values you will pass to
464 // ISteamNetworkingSockets::CloseConnection. You can use these codes if
465 // you want to plumb through application-specific reason codes. If you don't
466 // need this facility, feel free to always pass
467 // k_ESteamNetConnectionEnd_App_Generic.
468 //
469 // The distinction between "normal" and "exceptional" termination is
470 // one you may use if you find useful, but it's not necessary for you
471 // to do so. The only place where we distinguish between normal and
472 // exceptional is in connection analytics. If a significant
473 // proportion of connections terminates in an exceptional manner,
474 // this can trigger an alert.
475 //
476
477 // 1xxx: Application ended the connection in a "usual" manner.
478 // E.g.: user intentionally disconnected from the server,
479 // gameplay ended normally, etc
482 // Use codes in this range for "normal" disconnection
484
485 // 2xxx: Application ended the connection in some sort of exceptional
486 // or unusual manner that might indicate a bug or configuration
487 // issue.
488 //
491 // Use codes in this range for "unusual" disconnection
493
494 //
495 // System codes. These will be returned by the system when
496 // the connection state is k_ESteamNetworkingConnectionState_ClosedByPeer
497 // or k_ESteamNetworkingConnectionState_ProblemDetectedLocally. It is
498 // illegal to pass a code in this range to ISteamNetworkingSockets::CloseConnection
499 //
500
501 // 3xxx: Connection failed or ended because of problem with the
502 // local host or their connection to the Internet.
504
505 // You cannot do what you want to do because you're running in offline mode.
507
508 // We're having trouble contacting many (perhaps all) relays.
509 // Since it's unlikely that they all went offline at once, the best
510 // explanation is that we have a problem on our end. Note that we don't
511 // bother distinguishing between "many" and "all", because in practice,
512 // it takes time to detect a connection problem, and by the time
513 // the connection has timed out, we might not have been able to
514 // actively probe all of the relay clusters, even if we were able to
515 // contact them at one time. So this code just means that:
516 //
517 // * We don't have any recent successful communication with any relay.
518 // * We have evidence of recent failures to communicate with multiple relays.
520
521 // A hosted server is having trouble talking to the relay
522 // that the client was using, so the problem is most likely
523 // on our end
525
526 // We're not able to get the SDR network config. This is
527 // *almost* always a local issue, since the network config
528 // comes from the CDN, which is pretty darn reliable.
530
531 // Steam rejected our request because we don't have rights
532 // to do this.
534
535 // ICE P2P rendezvous failed because we were not able to
536 // determine our "public" address (e.g. reflexive address via STUN)
537 //
538 // If relay fallback is available (it always is on Steam), then
539 // this is only used internally and will not be returned as a high
540 // level failure.
542
544
545 // 4xxx: Connection failed or ended, and it appears that the
546 // cause does NOT have to do with the local host or their
547 // connection to the Internet. It could be caused by the
548 // remote host, or it could be somewhere in between.
550
551 // The connection was lost, and as far as we can tell our connection
552 // to relevant services (relays) has not been disrupted. This doesn't
553 // mean that the problem is "their fault", it just means that it doesn't
554 // appear that we are having network issues on our end.
556
557 // Something was invalid with the cert or crypt handshake
558 // info you gave me, I don't understand or like your key types,
559 // etc.
561
562 // You presented me with a cert that was I was able to parse
563 // and *technically* we could use encrypted communication.
564 // But there was a problem that prevents me from checking your identity
565 // or ensuring that somebody int he middle can't observe our communication.
566 // E.g.: - the CA key was missing (and I don't accept unsigned certs)
567 // - The CA key isn't one that I trust,
568 // - The cert doesn't was appropriately restricted by app, user, time, data center, etc.
569 // - The cert wasn't issued to you.
570 // - etc
572
573 // These will never be returned
574 //k_ESteamNetConnectionEnd_Remote_NotLoggedIn_DEPRECATED = 4004,
575 //k_ESteamNetConnectionEnd_Remote_NotRunningApp_DEPRECATED = 4005,
576
577 // Something wrong with the protocol version you are using.
578 // (Probably the code you are running is too old.)
580
581 // NAT punch failed failed because we never received any public
582 // addresses from the remote host. (But we did receive some
583 // signals form them.)
584 //
585 // If relay fallback is available (it always is on Steam), then
586 // this is only used internally and will not be returned as a high
587 // level failure.
589
591
592 // 5xxx: Connection failed for some other reason.
594
595 // A failure that isn't necessarily the result of a software bug,
596 // but that should happen rarely enough that it isn't worth specifically
597 // writing UI or making a localized message for.
598 // The debug string should contain further details.
600
601 // Generic failure that is most likely a software bug.
603
604 // The connection to the remote host timed out, but we
605 // don't know if the problem is on our end, in the middle,
606 // or on their end.
608
609 //k_ESteamNetConnectionEnd_Misc_RelayConnectivity_DEPRECATED = 5004,
610
611 // There's some trouble talking to Steam.
613
614 // A server in a dedicated hosting situation has no relay sessions
615 // active with which to talk back to a client. (It's the client's
616 // job to open and maintain those sessions.)
618
619 // While trying to initiate a connection, we never received
620 // *any* communication from the peer.
621 //k_ESteamNetConnectionEnd_Misc_ServerNeverReplied = 5007,
622
623 // P2P rendezvous failed in a way that we don't have more specific
624 // information
626
627 // NAT punch failed, probably due to NAT/firewall configuration.
628 //
629 // If relay fallback is available (it always is on Steam), then
630 // this is only used internally and will not be returned as a high
631 // level failure.
633
634 // Our peer replied that it has no record of the connection.
635 // This should not happen ordinarily, but can happen in a few
636 // exception cases:
637 //
638 // - This is an old connection, and the peer has already cleaned
639 // up and forgotten about it. (Perhaps it timed out and they
640 // closed it and were not able to communicate this to us.)
641 // - A bug or internal protocol error has caused us to try to
642 // talk to the peer about the connection before we received
643 // confirmation that the peer has accepted the connection.
644 // - The peer thinks that we have closed the connection for some
645 // reason (perhaps a bug), and believes that is it is
646 // acknowledging our closure.
648
650
652};
653
657
661
664
665const int k_nSteamNetworkConnectionInfoFlags_Unauthenticated = 1; // We don't have a certificate for the remote host.
666const int k_nSteamNetworkConnectionInfoFlags_Unencrypted = 2; // Information is being sent out over a wire unencrypted (by this library)
667const int k_nSteamNetworkConnectionInfoFlags_LoopbackBuffers = 4; // Internal loopback buffers. Won't be true for localhost. (You can check the address to determine that.) This implies k_nSteamNetworkConnectionInfoFlags_FastLAN
668const int k_nSteamNetworkConnectionInfoFlags_Fast = 8; // The connection is "fast" and "reliable". Either internal/localhost (check the address to find out), or the peer is on the same LAN. (Probably. It's based on the address and the ping time, this is actually hard to determine unambiguously).
669const int k_nSteamNetworkConnectionInfoFlags_Relayed = 16; // The connection is relayed somehow (SDR or TURN).
670const int k_nSteamNetworkConnectionInfoFlags_DualWifi = 32; // We're taking advantage of dual-wifi multi-path
671
725
812
815{
816 // Counters for this particular lane. See the corresponding variables
817 // in SteamNetConnectionRealTimeStatus_t
821 int _reservePad1; // Reserved for future use
822
827
828 // Internal stuff, room to change API easily
830};
831
832#pragma pack( pop )
833
834//
835// Network messages
836//
837
842
845{
846
848 void *m_pData;
849
852
857
862
880
884
890
898
903
907
912
919
924
927 inline void Release();
928
929 // For code compatibility, some accessors
930#ifndef API_GEN
931 inline uint32 GetSize() const { return m_cbSize; }
932 inline const void *GetData() const { return m_pData; }
933 inline int GetChannel() const { return m_nChannel; }
934 inline HSteamNetConnection GetConnection() const { return m_conn; }
935 inline int64 GetConnectionUserData() const { return m_nConnUserData; }
937 inline int64 GetMessageNumber() const { return m_nMessageNumber; }
938#endif
939protected:
940 // Declare destructor protected. You should never need to declare a message
941 // object on the stack or create one yourself.
942 // - You will receive a pointer to a message object when you receive messages (e.g. ISteamNetworkingSockets::ReceiveMessagesOnConnection)
943 // - You can allocate a message object for efficient sending using ISteamNetworkingUtils::AllocateMessage
944 // - Call Release() to free the object
946};
947
948//
949// Flags used to set options for message sending
950//
951
952// Send the message unreliably. Can be lost. Messages *can* be larger than a
953// single MTU (UDP packet), but there is no retransmission, so if any piece
954// of the message is lost, the entire message will be dropped.
955//
956// The sending API does have some knowledge of the underlying connection, so
957// if there is no NAT-traversal accomplished or there is a recognized adjustment
958// happening on the connection, the packet will be batched until the connection
959// is open again.
960//
961// Migration note: This is not exactly the same as k_EP2PSendUnreliable! You
962// probably want k_ESteamNetworkingSendType_UnreliableNoNagle
964
965// Disable Nagle's algorithm.
966// By default, Nagle's algorithm is applied to all outbound messages. This means
967// that the message will NOT be sent immediately, in case further messages are
968// sent soon after you send this, which can be grouped together. Any time there
969// is enough buffered data to fill a packet, the packets will be pushed out immediately,
970// but partially-full packets not be sent until the Nagle timer expires. See
971// ISteamNetworkingSockets::FlushMessagesOnConnection, ISteamNetworkingMessages::FlushMessagesToUser
972//
973// NOTE: Don't just send every message without Nagle because you want packets to get there
974// quicker. Make sure you understand the problem that Nagle is solving before disabling it.
975// If you are sending small messages, often many at the same time, then it is very likely that
976// it will be more efficient to leave Nagle enabled. A typical proper use of this flag is
977// when you are sending what you know will be the last message sent for a while (e.g. the last
978// in the server simulation tick to a particular client), and you use this flag to flush all
979// messages.
981
982// Send a message unreliably, bypassing Nagle's algorithm for this message and any messages
983// currently pending on the Nagle timer. This is equivalent to using k_ESteamNetworkingSend_Unreliable
984// and then immediately flushing the messages using ISteamNetworkingSockets::FlushMessagesOnConnection
985// or ISteamNetworkingMessages::FlushMessagesToUser. (But using this flag is more efficient since you
986// only make one API call.)
988
989// If the message cannot be sent very soon (because the connection is still doing some initial
990// handshaking, route negotiations, etc), then just drop it. This is only applicable for unreliable
991// messages. Using this flag on reliable messages is invalid.
993
994// Send an unreliable message, but if it cannot be sent relatively quickly, just drop it instead of queuing it.
995// This is useful for messages that are not useful if they are excessively delayed, such as voice data.
996// NOTE: The Nagle algorithm is not used, and if the message is not dropped, any messages waiting on the
997// Nagle timer are immediately flushed.
998//
999// A message will be dropped under the following circumstances:
1000// - the connection is not fully connected. (E.g. the "Connecting" or "FindingRoute" states)
1001// - there is a sufficiently large number of messages queued up already such that the current message
1002// will not be placed on the wire in the next ~200ms or so.
1003//
1004// If a message is dropped for these reasons, k_EResultIgnored will be returned.
1006
1007// Reliable message send. Can send up to k_cbMaxSteamNetworkingSocketsMessageSizeSend bytes in a single message.
1008// Does fragmentation/re-assembly of messages under the hood, as well as a sliding window for
1009// efficient sends of large chunks of data.
1010//
1011// The Nagle algorithm is used. See notes on k_ESteamNetworkingSendType_Unreliable for more details.
1012// See k_ESteamNetworkingSendType_ReliableNoNagle, ISteamNetworkingSockets::FlushMessagesOnConnection,
1013// ISteamNetworkingMessages::FlushMessagesToUser
1014//
1015// Migration note: This is NOT the same as k_EP2PSendReliable, it's more like k_EP2PSendReliableWithBuffering
1017
1018// Send a message reliably, but bypass Nagle's algorithm.
1019//
1020// Migration note: This is equivalent to k_EP2PSendReliable
1022
1023// By default, message sending is queued, and the work of encryption and talking to
1024// the operating system sockets, etc is done on a service thread. This is usually a
1025// a performance win when messages are sent from the "main thread". However, if this
1026// flag is set, and data is ready to be sent immediately (either from this message
1027// or earlier queued data), then that work will be done in the current thread, before
1028// the current call returns. If data is not ready to be sent (due to rate limiting
1029// or Nagle), then this flag has no effect.
1030//
1031// This is an advanced flag used to control performance at a very low level. For
1032// most applications running on modern hardware with more than one CPU core, doing
1033// the work of sending on a service thread will yield the best performance. Only
1034// use this flag if you have a really good reason and understand what you are doing.
1035// Otherwise you will probably just make performance worse.
1037
1038// When sending a message using ISteamNetworkingMessages, automatically re-establish
1039// a broken session, without returning k_EResultNoConnection. Without this flag,
1040// if you attempt to send a message, and the session was proactively closed by the
1041// peer, or an error occurred that disrupted communications, then you must close the
1042// session using ISteamNetworkingMessages::CloseSessionWithUser before attempting to
1043// send another message. (Or you can simply add this flag and retry.) In this way,
1044// the disruption cannot go unnoticed, and a more clear order of events can be
1045// ascertained. This is especially important when reliable messages are used, since
1046// if the connection is disrupted, some of those messages will not have been delivered,
1047// and it is in general not possible to know which. Although a
1048// SteamNetworkingMessagesSessionFailed_t callback will be posted when an error occurs
1049// to notify you that a failure has happened, callbacks are asynchronous, so it is not
1050// possible to tell exactly when it happened. And because the primary purpose of
1051// ISteamNetworkingMessages is to be like UDP, there is no notification when a peer closes
1052// the session.
1053//
1054// If you are not using any reliable messages (e.g. you are using ISteamNetworkingMessages
1055// exactly as a transport replacement for UDP-style datagrams only), you may not need to
1056// know when an underlying connection fails, and so you may not need this notification.
1058
1059//
1060// Ping location / measurement
1061//
1062
1080
1087
1091
1092//
1093// Configuration values
1094//
1095
1123
1124// Different configuration values have different data types
1135
1138{
1140
1141//
1142// Connection options
1143//
1144
1147
1150
1155
1163
1169
1177
1191
1224 // ensure you have the current value.
1226
1235
1244
1258
1263
1268
1272
1283
1369
1384
1388
1392
1403
1404//
1405// Simulating network conditions
1406//
1407// These are global (not per-connection) because they apply at
1408// a relatively low UDP layer.
1409//
1410
1416
1420
1451
1462
1466
1470
1474
1477 // 0 only traces the info but no actual data bytes
1479
1480
1481 // [global int32] Global UDP token bucket rate limits.
1482 // "Rate" refers to the steady state rate. (Bytes/sec, the
1483 // rate that tokens are put into the bucket.) "Burst"
1484 // refers to the max amount that could be sent in a single
1485 // burst. (In bytes, the max capacity of the bucket.)
1486 // Rate=0 disables the limiter entirely, which is the default.
1487 // Burst=0 disables burst. (This is not realistic. A
1488 // burst of at least 4K is recommended; the default is higher.)
1493
1494 // Timeout used for out-of-order correction. This is used when we see a small
1495 // gap in the sequence number on a packet flow. For example let's say we are
1496 // processing packet 105 when the most recent one was 103. 104 might have dropped,
1497 // but there is also a chance that packets are simply being reordered. It is very
1498 // common on certain types of connections for packet 104 to arrive very soon after 105,
1499 // especially if 104 was large and 104 was small. In this case, when we see packet 105
1500 // we will shunt it aside and pend it, in the hopes of seeing 104 soon after. If 104
1501 // arrives before the a timeout occurs, then we can deliver the packets in order to the
1502 // remainder of packet processing, and we will record this as a "correctable" out-of-order
1503 // situation. If the timer expires, then we will process packet 105, and assume for now
1504 // that 104 has dropped. (If 104 later arrives, we will process it, but that will be
1505 // accounted for as uncorrected.)
1506 //
1507 // The default value is 1000 microseconds. Note that the Windows scheduler does not
1508 // have microsecond precision.
1509 //
1510 // Set the value to 0 to disable out of order correction at the packet layer.
1511 // In many cases we are still effectively able to correct the situation because
1512 // reassembly of message fragments is tolerant of fragments packets arriving out of
1513 // order. Also, when messages are decoded and inserted into the queue for the app
1514 // to receive them, we will correct out of order messages that have not been
1515 // dequeued by the app yet. However, when out-of-order packets are corrected
1516 // at the packet layer, they will not reduce the connection quality measure.
1517 // (E.g. SteamNetConnectionRealTimeStatus_t::m_flConnectionQualityLocal)
1519
1520//
1521// Callbacks
1522//
1523
1524 // On Steam, you may use the default Steam callback dispatch mechanism. If you prefer
1525 // to not use this dispatch mechanism (or you are not running with Steam), or you want
1526 // to associate specific functions with specific listen sockets or connections, you can
1527 // register them as configuration values.
1528 //
1529 // Note also that ISteamNetworkingUtils has some helpers to set these globally.
1530
1557
1563
1569
1574
1580
1586
1591
1592//
1593// P2P connection settings
1594//
1595
1596// /// [listen socket int32] When you create a P2P listen socket, we will automatically
1597// /// open up a UDP port to listen for LAN connections. LAN connections can be made
1598// /// without any signaling: both sides can be disconnected from the Internet.
1599// ///
1600// /// This value can be set to zero to disable the feature.
1601// k_ESteamNetworkingConfig_P2P_Discovery_Server_LocalPort = 101,
1602//
1603// /// [connection int32] P2P connections can perform broadcasts looking for the peer
1604// /// on the LAN.
1605// k_ESteamNetworkingConfig_P2P_Discovery_Client_RemotePort = 102,
1606
1612
1616
1626 //k_ESteamNetworkingConfig_P2P_Transport_LANBeacon_Penalty = 107,
1628
1629//
1630// Settings for SDR relayed connections
1631//
1632
1637
1642
1649
1657
1661
1669
1673
1680
1684
1685//
1686// Log levels for debugging information of various subsystems.
1687// Higher numeric values will cause more stuff to be printed.
1688// See ISteamNetworkingUtils::SetDebugOutputFunction for more
1689// information
1690//
1691// The default for all values is k_ESteamNetworkingSocketsDebugOutputType_Warning.
1692//
1693 k_ESteamNetworkingConfig_LogLevel_AckRTT = 13, // [connection int32] RTT calculations for inline pings and replies
1694 k_ESteamNetworkingConfig_LogLevel_PacketDecode = 14, // [connection int32] log SNP packets send/recv
1695 k_ESteamNetworkingConfig_LogLevel_Message = 15, // [connection int32] log each message send/recv
1696 k_ESteamNetworkingConfig_LogLevel_PacketGaps = 16, // [connection int32] dropped packets
1697 k_ESteamNetworkingConfig_LogLevel_P2PRendezvous = 17, // [connection int32] P2P rendezvous messages
1698 k_ESteamNetworkingConfig_LogLevel_SDRRelayPings = 18, // [global int32] Ping relays
1699
1700//
1701// Experimental values. These are subject to be deleted or change at any time,
1702// do not set them, except as a result of an explicit and advanced user opt-in,
1703// and do not write anything that depends on them existing, or have any particular
1704// behaviour.
1705//
1706 // [global int32] ECN value to send in every packet.
1707 // -1 = The default, and means "auto". We will set ECN=1, if it appears that the local internet connection appears to understand it and there may be some benefit.
1708 // 0..2 = use that value.
1710
1711 // [global int32] If true, send and request different TOS values in probes to relays
1712 // to try to deduce if there is any bleaching or mutating of the TOS field in either direction
1714
1715//
1716// Deleted, do not use
1717//
1719
1721};
1722
1723// Bitmask of types to share
1724const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Default = -1; // Special value - use user defaults
1725const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Disable = 0; // Do not do any ICE work at all or share any IP addresses with peer
1726const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Relay = 1; // Relayed connection via TURN server.
1727const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Private = 2; // host addresses that appear to be link-local or RFC1918 addresses
1728const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Public = 4; // STUN reflexive addresses, or host address that isn't a "private" address
1730
1743{
1746
1749
1751 union
1752 {
1753 int32_t m_int32;
1754 int64_t m_int64;
1755 float m_float;
1756 const char *m_string; // Points to your '\0'-terminated buffer
1757 void *m_ptr;
1759
1760 //
1761 // Shortcut helpers to set the type and value in a single call
1762 //
1763 inline void SetInt32( ESteamNetworkingConfigValue eVal, int32_t data )
1764 {
1765 m_eValue = eVal;
1767 m_val.m_int32 = data;
1768 }
1769 inline void SetInt64( ESteamNetworkingConfigValue eVal, int64_t data )
1770 {
1771 m_eValue = eVal;
1773 m_val.m_int64 = data;
1774 }
1775 inline void SetFloat( ESteamNetworkingConfigValue eVal, float data )
1776 {
1777 m_eValue = eVal;
1779 m_val.m_float = data;
1780 }
1781 inline void SetPtr( ESteamNetworkingConfigValue eVal, void *data )
1782 {
1783 m_eValue = eVal;
1785 m_val.m_ptr = data;
1786 }
1787 inline void SetString( ESteamNetworkingConfigValue eVal, const char *data ) // WARNING - Just saves your pointer. Does NOT make a copy of the string
1788 {
1789 m_eValue = eVal;
1791 m_val.m_string = data;
1792 }
1793};
1794
1797{
1798 k_ESteamNetworkingGetConfigValue_BadValue = -1, // No such configuration value
1799 k_ESteamNetworkingGetConfigValue_BadScopeObj = -2, // Bad connection handle, etc
1800 k_ESteamNetworkingGetConfigValue_BufferTooSmall = -3, // Couldn't fit the result in your buffer
1802 k_ESteamNetworkingGetConfigValue_OKInherited = 2, // A value was not set at this level, but the effective (inherited) value was returned.
1803
1805};
1806
1807//
1808// Debug output
1809//
1810
1814{
1816 k_ESteamNetworkingSocketsDebugOutputType_Bug = 1, // You used the API incorrectly, or an internal error happened
1817 k_ESteamNetworkingSocketsDebugOutputType_Error = 2, // Run-time error condition that isn't the result of a bug. (E.g. we are offline, cannot bind a port, etc)
1818 k_ESteamNetworkingSocketsDebugOutputType_Important = 3, // Nothing is wrong, but this is an important notification
1823 k_ESteamNetworkingSocketsDebugOutputType_Everything = 8, // Wall of text, detailed packet contents breakdown, etc
1824
1826};
1827
1830
1831//
1832// Valve data centers
1833//
1834
1837{
1838 // OK we made a bad decision when we decided how to pack 3-character codes into a uint32. We'd like to support
1839 // 4-character codes, but we don't want to break compatibility. The migration path has some subtleties that make
1840 // this nontrivial, and there are already some IDs stored in SQL. Ug, so the 4 character code "abcd" will
1841 // be encoded with the digits like "0xddaabbcc".
1842 //
1843 // Also: we don't currently use 1- or 2-character codes, but if ever do in the future, let's make sure don't read
1844 // past the end of the string and access uninitialized memory. (And if the string is empty, we always want
1845 // to return 0 and not read bytes past the '\0'.)
1846 //
1847 // There is also extra paranoia to make sure the bytes are not treated as signed.
1848 SteamNetworkingPOPID result = (uint32)(uint8)pszCode[0] << 16U;
1849 if ( result && pszCode[1] )
1850 {
1851 result |= ( (uint32)(uint8)pszCode[1] << 8U );
1852 if ( pszCode[2] )
1853 {
1854 result |= (uint32)(uint8)pszCode[2] | ( (uint32)(uint8)pszCode[3] << 24U );
1855 }
1856 }
1857 return result;
1858}
1859
1863template <int N>
1865{
1866 static_assert( N >= 5, "Fixed-size buffer not big enough to hold SDR POP ID" );
1867 szCode[0] = char( id >> 16U );
1868 szCode[1] = char( id >> 8U );
1869 szCode[2] = char( id );
1870 szCode[3] = char( id >> 24U ); // See comment above about deep regret and sadness
1871 szCode[4] = 0;
1872}
1873
1875const SteamNetworkingPOPID k_SteamDatagramPOPID_dev = ( (uint32)'d' << 16U ) | ( (uint32)'e' << 8U ) | (uint32)'v';
1876
1877#ifndef API_GEN
1878
1881{
1883 inline const char *c_str() const { return buf; }
1884private:
1885 char buf[ 8 ];
1886};
1887
1888#endif
1889
1891//
1892// Internal stuff
1893#ifndef API_GEN
1894
1895// For code compatibility
1898
1899inline void SteamNetworkingIPAddr::Clear() { memset( this, 0, sizeof(*this) ); }
1900inline bool SteamNetworkingIPAddr::IsIPv6AllZeros() const { uint64 q[2] = {}; memcpy(q, m_ipv6, sizeof(m_ipv6)); return q[0] == 0 && q[1] == 0; }
1901inline void SteamNetworkingIPAddr::SetIPv6( const uint8 *ipv6, uint16 nPort ) { memcpy( m_ipv6, ipv6, 16 ); m_port = nPort; }
1902inline void SteamNetworkingIPAddr::SetIPv4( uint32 nIP, uint16 nPort ) { m_ipv4.m_8zeros = 0; m_ipv4.m_0000 = 0; m_ipv4.m_ffff = 0xffff; m_ipv4.m_ip[0] = uint8(nIP>>24); m_ipv4.m_ip[1] = uint8(nIP>>16); m_ipv4.m_ip[2] = uint8(nIP>>8); m_ipv4.m_ip[3] = uint8(nIP); m_port = nPort; }
1903inline bool SteamNetworkingIPAddr::IsIPv4() const { return m_ipv4.m_8zeros == 0 && m_ipv4.m_0000 == 0 && m_ipv4.m_ffff == 0xffff; }
1904inline uint32 SteamNetworkingIPAddr::GetIPv4() const { return IsIPv4() ? ( (uint32(m_ipv4.m_ip[0])<<24) | (uint32(m_ipv4.m_ip[1])<<16) | (uint32(m_ipv4.m_ip[2])<<8) | uint32(m_ipv4.m_ip[3]) ) : 0; }
1905inline void SteamNetworkingIPAddr::SetIPv6LocalHost( uint16 nPort ) { m_ipv4.m_8zeros = 0; m_ipv4.m_0000 = 0; m_ipv4.m_ffff = 0; m_ipv6[12] = 0; m_ipv6[13] = 0; m_ipv6[14] = 0; m_ipv6[15] = 1; m_port = nPort; }
1906inline bool SteamNetworkingIPAddr::IsLocalHost() const { return ( m_ipv4.m_8zeros == 0 && m_ipv4.m_0000 == 0 && m_ipv4.m_ffff == 0 && m_ipv6[12] == 0 && m_ipv6[13] == 0 && m_ipv6[14] == 0 && m_ipv6[15] == 1 ) || ( GetIPv4() == 0x7f000001 ); }
1907inline bool SteamNetworkingIPAddr::operator==(const SteamNetworkingIPAddr &x ) const { return memcmp( this, &x, sizeof(SteamNetworkingIPAddr) ) == 0; }
1908
1909inline void SteamNetworkingIdentity::Clear() { memset( this, 0, sizeof(*this) ); }
1913inline void SteamNetworkingIdentity::SetSteamID64( uint64 steamID ) { m_eType = k_ESteamNetworkingIdentityType_SteamID; m_cbSize = sizeof( m_steamID64 ); m_steamID64 = steamID; }
1915inline bool SteamNetworkingIdentity::SetXboxPairwiseID( const char *pszString ) { size_t l = strlen( pszString ); if ( l < 1 || l >= sizeof(m_szXboxPairwiseID) ) return false;
1916 m_eType = k_ESteamNetworkingIdentityType_XboxPairwiseID; m_cbSize = int(l+1); memcpy( m_szXboxPairwiseID, pszString, m_cbSize ); return true; }
1917inline const char *SteamNetworkingIdentity::GetXboxPairwiseID() const { return m_eType == k_ESteamNetworkingIdentityType_XboxPairwiseID ? m_szXboxPairwiseID : NULL; }
1922inline void SteamNetworkingIdentity::SetIPv4Addr( uint32 nIPv4, uint16 nPort ) { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip.SetIPv4( nIPv4, nPort ); }
1925inline void SteamNetworkingIdentity::SetLocalHost() { m_eType = k_ESteamNetworkingIdentityType_IPAddress; m_cbSize = (int)sizeof(m_ip); m_ip.SetIPv6LocalHost(); }
1926inline bool SteamNetworkingIdentity::IsLocalHost() const { return m_eType == k_ESteamNetworkingIdentityType_IPAddress && m_ip.IsLocalHost(); }
1927inline bool SteamNetworkingIdentity::SetGenericString( const char *pszString ) { size_t l = strlen( pszString ); if ( l >= sizeof(m_szGenericString) ) return false;
1928 m_eType = k_ESteamNetworkingIdentityType_GenericString; m_cbSize = int(l+1); memcpy( m_szGenericString, pszString, m_cbSize ); return true; }
1929inline const char *SteamNetworkingIdentity::GetGenericString() const { return m_eType == k_ESteamNetworkingIdentityType_GenericString ? m_szGenericString : NULL; }
1930inline bool SteamNetworkingIdentity::SetGenericBytes( const void *data, size_t cbLen ) { if ( cbLen > sizeof(m_genericBytes) ) return false;
1931 m_eType = k_ESteamNetworkingIdentityType_GenericBytes; m_cbSize = int(cbLen); memcpy( m_genericBytes, data, m_cbSize ); return true; }
1933 cbLen = m_cbSize; return m_genericBytes; }
1934inline bool SteamNetworkingIdentity::operator==(const SteamNetworkingIdentity &x ) const { return m_eType == x.m_eType && m_cbSize == x.m_cbSize && memcmp( m_genericBytes, x.m_genericBytes, m_cbSize ) == 0; }
1935inline void SteamNetworkingMessage_t::Release() { (*m_pfnRelease)( this ); }
1936
1937#endif // #ifndef API_GEN
1938
1939#endif // #ifndef STEAMNETWORKINGTYPES
SCRIPT_CONTROL SCRIPT_STATE const void int
uint64 ConvertToUint64() const
const char *typedef uint32(S_CALLTYPE *SteamAPI_CheckCallbackRegistered_t)(int iCallbackNum)
typedef void(S_CALLTYPE *SteamAPIWarningMessageHook_t)(int
const int k_nSteamNetworkingPing_Unknown
SteamNetworkingErrMsg SteamDatagramErrMsg
ESteamNetworkingSocketsDebugOutputType
@ k_ESteamNetworkingSocketsDebugOutputType_Debug
@ k_ESteamNetworkingSocketsDebugOutputType_Everything
@ k_ESteamNetworkingSocketsDebugOutputType_Warning
@ k_ESteamNetworkingSocketsDebugOutputType_Error
@ k_ESteamNetworkingSocketsDebugOutputType__Force32Bit
@ k_ESteamNetworkingSocketsDebugOutputType_Bug
@ k_ESteamNetworkingSocketsDebugOutputType_Verbose
@ k_ESteamNetworkingSocketsDebugOutputType_Msg
@ k_ESteamNetworkingSocketsDebugOutputType_Important
@ k_ESteamNetworkingSocketsDebugOutputType_None
ESteamNetConnectionEnd
@ k_ESteamNetConnectionEnd_Local_OfflineMode
@ k_ESteamNetConnectionEnd_Misc_InternalError
@ k_ESteamNetConnectionEnd_Local_NetworkConfig
@ k_ESteamNetConnectionEnd_Remote_Timeout
@ k_ESteamNetConnectionEnd_AppException_Max
@ k_ESteamNetConnectionEnd_Remote_P2P_ICE_NoPublicAddresses
@ k_ESteamNetConnectionEnd_AppException_Generic
@ k_ESteamNetConnectionEnd_Misc_PeerSentNoConnection
@ k_ESteamNetConnectionEnd_AppException_Min
@ k_ESteamNetConnectionEnd_Local_ManyRelayConnectivity
@ k_ESteamNetConnectionEnd_Local_HostedServerPrimaryRelay
@ k_ESteamNetConnectionEnd_Local_Rights
@ k_ESteamNetConnectionEnd_Remote_Min
@ k_ESteamNetConnectionEnd_App_Generic
@ k_ESteamNetConnectionEnd_Misc_Timeout
@ k_ESteamNetConnectionEnd_Misc_Min
@ k_ESteamNetConnectionEnd_Remote_BadCrypt
@ k_ESteamNetConnectionEnd_Misc_P2P_NAT_Firewall
@ k_ESteamNetConnectionEnd__Force32Bit
@ k_ESteamNetConnectionEnd_App_Min
@ k_ESteamNetConnectionEnd_Local_Max
@ k_ESteamNetConnectionEnd_App_Max
@ k_ESteamNetConnectionEnd_Remote_BadProtocolVersion
@ k_ESteamNetConnectionEnd_Misc_SteamConnectivity
@ k_ESteamNetConnectionEnd_Remote_Max
@ k_ESteamNetConnectionEnd_Misc_P2P_Rendezvous
@ k_ESteamNetConnectionEnd_Misc_Max
@ k_ESteamNetConnectionEnd_Local_P2P_ICE_NoPublicAddresses
@ k_ESteamNetConnectionEnd_Remote_BadCert
@ k_ESteamNetConnectionEnd_Local_Min
@ k_ESteamNetConnectionEnd_Misc_Generic
@ k_ESteamNetConnectionEnd_Misc_NoRelaySessionsToClient
@ k_ESteamNetConnectionEnd_Invalid
const HSteamNetPollGroup k_HSteamNetPollGroup_Invalid
void(*) FnSteamNetConnectionStatusChanged(SteamNetConnectionStatusChangedCallback_t *)
void(*) FnSteamNetworkingFakeIPResult(SteamNetworkingFakeIPResult_t *)
const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Relay
const int k_nSteamNetworkConnectionInfoFlags_Fast
const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_All
int64 SteamNetworkingMicroseconds
const int k_nSteamNetworkingSend_UnreliableNoDelay
const int k_cbMaxSteamNetworkingSocketsMessageSizeSend
const int k_nSteamNetworkingSend_UnreliableNoNagle
const int k_nSteamNetworkConnectionInfoFlags_LoopbackBuffers
const int k_nSteamNetworkingSend_ReliableNoNagle
ESteamNetworkingFakeIPType
@ k_ESteamNetworkingFakeIPType__Force32Bit
@ k_ESteamNetworkingFakeIPType_Invalid
@ k_ESteamNetworkingFakeIPType_GlobalIPv4
@ k_ESteamNetworkingFakeIPType_LocalIPv4
@ k_ESteamNetworkingFakeIPType_NotFake
SteamNetworkingPOPID CalculateSteamNetworkingPOPIDFromString(const char *pszCode)
Convert 3- or 4-character ID to 32-bit int.
SteamNetworkingMessage_t ISteamNetworkingMessage
const int k_cchSteamNetworkingMaxConnectionAppName
Max length of the app's part of the description.
uint32 HSteamNetConnection
Handle used to identify a connection to a remote host.
const int k_nSteamNetworkConnectionInfoFlags_Relayed
const int k_cchSteamNetworkingMaxConnectionDescription
void(*) FnSteamNetAuthenticationStatusChanged(SteamNetAuthenticationStatus_t *)
ESteamNetworkingConfigScope
Configuration values can be applied to different types of objects.
@ k_ESteamNetworkingConfig_SocketsInterface
@ k_ESteamNetworkingConfig_Connection
Options for a specific connection.
@ k_ESteamNetworkingConfigScope__Force32Bit
@ k_ESteamNetworkingConfig_ListenSocket
@ k_ESteamNetworkingConfig_Global
const int k_nSteamNetworkConnectionInfoFlags_DualWifi
uint32 HSteamNetPollGroup
uint32 HSteamListenSocket
ESteamNetworkingConfigValue
Configuration options.
@ k_ESteamNetworkingConfig_RecvMaxSegmentsPerPacket
@ k_ESteamNetworkingConfig_SDRClient_DevTicket
@ k_ESteamNetworkingConfig_SDRClient_MinPingsBeforePingAccurate
@ k_ESteamNetworkingConfig_P2P_Transport_SDR_Penalty
@ k_ESteamNetworkingConfig_P2P_TURN_UserList
@ k_ESteamNetworkingConfig_EnableDiagnosticsUI
@ k_ESteamNetworkingConfig_LogLevel_PacketDecode
@ k_ESteamNetworkingConfig_RecvBufferMessages
@ k_ESteamNetworkingConfig_PacketTraceMaxBytes
@ k_ESteamNetworkingConfig_SendBufferSize
@ k_ESteamNetworkingConfig_ECN
@ k_ESteamNetworkingConfig_P2P_TURN_ServerList
@ k_ESteamNetworkingConfig_Callback_ConnectionStatusChanged
@ k_ESteamNetworkingConfig_DualWifi_Enable
@ k_ESteamNetworkingConfig_TimeoutConnected
[connection int32] Timeout value (in ms) to use after connection is established
@ k_ESteamNetworkingConfig_SDRClient_ConsecutitivePingTimeoutsFail
@ k_ESteamNetworkingConfig_FakeRateLimit_Recv_Burst
@ k_ESteamNetworkingConfig_Callback_RelayNetworkStatusChanged
@ k_ESteamNetworkingConfig_SendRateMax
@ k_ESteamNetworkingConfig_FakePacketJitter_Recv_Avg
@ k_ESteamNetworkingConfig_SendTimeSincePreviousPacket
@ k_ESteamNetworkingConfig_Invalid
@ k_ESteamNetworkingConfig_Callback_MessagesSessionFailed
@ k_ESteamNetworkingConfig_P2P_Transport_ICE_Implementation
@ k_ESteamNetworkingConfig_DELETED_EnumerateDevVars
@ k_ESteamNetworkingConfig_FakeRateLimit_Send_Rate
@ k_ESteamNetworkingConfig_FakePacketJitter_Send_Pct
@ k_ESteamNetworkingConfig_LogLevel_Message
@ k_ESteamNetworkingConfig_Callback_CreateConnectionSignaling
@ k_ESteamNetworkingConfig_FakePacketJitter_Recv_Pct
@ k_ESteamNetworkingConfig_SDRClient_EnableTOSProbes
@ k_ESteamNetworkingConfig_P2P_TURN_PassList
@ k_ESteamNetworkingConfig_SDRClient_FakeClusterPing
@ k_ESteamNetworkingConfig_NagleTime
@ k_ESteamNetworkingConfig_P2P_Transport_ICE_Enable
@ k_ESteamNetworkingConfig_FakePacketJitter_Recv_Max
@ k_ESteamNetworkingConfig_SymmetricConnect
@ k_ESteamNetworkingConfig_FakePacketReorder_Time
@ k_ESteamNetworkingConfig_LogLevel_SDRRelayPings
@ k_ESteamNetworkingConfig_RecvMaxMessageSize
@ k_ESteamNetworkingConfig_LogLevel_PacketGaps
@ k_ESteamNetworkingConfig_ConnectionUserData
@ k_ESteamNetworkingConfig_Unencrypted
@ k_ESteamNetworkingConfig_FakePacketReorder_Send
@ k_ESteamNetworkingConfig_FakePacketLoss_Recv
@ k_ESteamNetworkingConfig_FakePacketJitter_Send_Max
@ k_ESteamNetworkingConfig_RecvBufferSize
@ k_ESteamNetworkingConfig_Callback_MessagesSessionRequest
@ k_ESteamNetworkingConfig_P2P_Transport_ICE_Penalty
@ k_ESteamNetworkingConfig_FakePacketLoss_Send
@ k_ESteamNetworkingConfig_Callback_FakeIPResult
@ k_ESteamNetworkingConfig_OutOfOrderCorrectionWindowMicroseconds
@ k_ESteamNetworkingConfig_FakeRateLimit_Recv_Rate
@ k_ESteamNetworkingConfig_FakePacketDup_TimeMax
@ k_ESteamNetworkingConfig_TimeoutInitial
[connection int32] Timeout value (in ms) to use when first connecting
@ k_ESteamNetworkingConfig_FakeRateLimit_Send_Burst
@ k_ESteamNetworkingConfig_LocalVirtualPort
@ k_ESteamNetworkingConfig_FakePacketDup_Send
[global float 0–100] Globally duplicate some percentage of packets.
@ k_ESteamNetworkingConfig_IP_AllowWithoutAuth
@ k_ESteamNetworkingConfig_SDRClient_ForceProxyAddr
@ k_ESteamNetworkingConfig_FakePacketLag_Recv
@ k_ESteamNetworkingConfig_SDRClient_ForceRelayCluster
@ k_ESteamNetworkingConfig_LogLevel_AckRTT
@ k_ESteamNetworkingConfig_SDRClient_LimitPingProbesToNearestN
@ k_ESteamNetworkingConfig_FakePacketLag_Send
[global int32]. Delay all outbound/inbound packets by N ms
@ k_ESteamNetworkingConfig_SDRClient_SingleSocket
@ k_ESteamNetworkingConfig_IPLocalHost_AllowWithoutAuth
@ k_ESteamNetworkingConfig_MTU_DataSize
@ k_ESteamNetworkingConfig_FakePacketDup_Recv
@ k_ESteamNetworkingConfig_FakePacketReorder_Recv
@ k_ESteamNetworkingConfig_SendRateMin
@ k_ESteamNetworkingConfig_LogLevel_P2PRendezvous
@ k_ESteamNetworkingConfig_MTU_PacketSize
@ k_ESteamNetworkingConfig_SDRClient_ConsecutitivePingTimeoutsFailInitial
@ k_ESteamNetworkingConfig_Callback_AuthStatusChanged
@ k_ESteamNetworkingConfigValue__Force32Bit
@ k_ESteamNetworkingConfig_FakePacketJitter_Send_Avg
@ k_ESteamNetworkingConfig_P2P_STUN_ServerList
const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Default
void(*) FSteamNetworkingSocketsDebugOutput(ESteamNetworkingSocketsDebugOutputType nType, const char *pszMsg)
Setup callback for debug output, and the desired verbosity you want.
const int k_nSteamNetworkConnectionInfoFlags_Unauthenticated
const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Private
ESteamNetworkingAvailability
Describe the status of a particular network resource.
@ k_ESteamNetworkingAvailability_NeverTried
@ k_ESteamNetworkingAvailability_Previously
@ k_ESteamNetworkingAvailability_Unknown
@ k_ESteamNetworkingAvailability_Waiting
@ k_ESteamNetworkingAvailability_Current
@ k_ESteamNetworkingAvailability_Retrying
@ k_ESteamNetworkingAvailability_Failed
@ k_ESteamNetworkingAvailability_Attempting
@ k_ESteamNetworkingAvailability_CannotTry
@ k_ESteamNetworkingAvailability__Force32bit
const int k_cchMaxSteamNetworkingErrMsg
Max length of diagnostic error message.
void(*) FnSteamNetworkingMessagesSessionRequest(SteamNetworkingMessagesSessionRequest_t *)
ESteamNetworkingConnectionState
High level connection status.
@ k_ESteamNetworkingConnectionState_Connecting
@ k_ESteamNetworkingConnectionState_ProblemDetectedLocally
@ k_ESteamNetworkingConnectionState_Linger
@ k_ESteamNetworkingConnectionState__Force32Bit
@ k_ESteamNetworkingConnectionState_ClosedByPeer
@ k_ESteamNetworkingConnectionState_None
@ k_ESteamNetworkingConnectionState_FindingRoute
@ k_ESteamNetworkingConnectionState_Dead
Connection is completely inactive and ready to be destroyed.
@ k_ESteamNetworkingConnectionState_FinWait
@ k_ESteamNetworkingConnectionState_Connected
void(*) FnSteamNetworkingMessagesSessionFailed(SteamNetworkingMessagesSessionFailed_t *)
const int k_nSteamNetworkingSend_NoNagle
const int k_nSteamNetworkingSend_Unreliable
const SteamNetworkingPOPID k_SteamDatagramPOPID_dev
The POPID "dev" is used in non-production environments for testing.
const HSteamListenSocket k_HSteamListenSocket_Invalid
void GetSteamNetworkingLocationPOPStringFromID(SteamNetworkingPOPID id, char(&szCode)[N])
const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Public
ESteamNetworkingGetConfigValueResult
Return value of ISteamNetworkintgUtils::GetConfigValue.
@ k_ESteamNetworkingGetConfigValue_BadValue
@ k_ESteamNetworkingGetConfigValue_BufferTooSmall
@ k_ESteamNetworkingGetConfigValue_BadScopeObj
@ k_ESteamNetworkingGetConfigValue_OKInherited
@ k_ESteamNetworkingGetConfigValueResult__Force32Bit
@ k_ESteamNetworkingGetConfigValue_OK
const HSteamNetConnection k_HSteamNetConnection_Invalid
const int k_cchSteamNetworkingMaxConnectionCloseReason
const int k_nSteamNetworkingSend_Reliable
const int k_nSteamNetworkingSend_AutoRestartBrokenSession
const int k_nSteamNetworkingPing_Failed
Special values that are returned by some functions that return a ping.
ESteamNetworkingIdentityType
Different methods of describing the identity of a network host.
@ k_ESteamNetworkingIdentityType_Invalid
@ k_ESteamNetworkingIdentityType_UnknownType
@ k_ESteamNetworkingIdentityType_IPAddress
@ k_ESteamNetworkingIdentityType_SteamID
@ k_ESteamNetworkingIdentityType_GenericString
@ k_ESteamNetworkingIdentityType_GenericBytes
@ k_ESteamNetworkingIdentityType_SonyPSN
@ k_ESteamNetworkingIdentityType__Force32bit
@ k_ESteamNetworkingIdentityType_XboxPairwiseID
const int k_nSteamNetworkingSend_UseCurrentThread
void(*) FnSteamRelayNetworkStatusChanged(SteamRelayNetworkStatus_t *)
const int k_cchMaxSteamNetworkingPingLocationString
const int k_nSteamNetworkConnectionInfoFlags_Unencrypted
uint32 SteamNetworkingPOPID
char SteamNetworkingErrMsg[k_cchMaxSteamNetworkingErrMsg]
const int k_nSteamNetworkingConfig_P2P_Transport_ICE_Enable_Disable
ESteamNetworkingConfigDataType
@ k_ESteamNetworkingConfig_String
@ k_ESteamNetworkingConfigDataType__Force32Bit
@ k_ESteamNetworkingConfig_Int32
@ k_ESteamNetworkingConfig_Ptr
@ k_ESteamNetworkingConfig_Float
@ k_ESteamNetworkingConfig_Int64
const int k_nSteamNetworkingSend_NoDelay
unsigned short uint16
Definition steamtypes.h:56
unsigned long long uint64
Definition steamtypes.h:60
int int32
Definition steamtypes.h:57
unsigned char uint8
Definition steamtypes.h:11
long long int64
Definition steamtypes.h:59
Describe the state of a connection.
SteamNetworkingPOPID m_idPOPRemote
What data center is the remote host in? (0 if we don't know.).
ESteamNetworkingConnectionState m_eState
High level state of the connection.
HSteamListenSocket m_hListenSocket
Handle to listen socket this was connected on, or k_HSteamListenSocket_Invalid if we initiated the co...
int64 m_nUserData
Arbitrary user data set by the local application code.
char m_szConnectionDescription[k_cchSteamNetworkingMaxConnectionDescription]
SteamNetworkingIdentity m_identityRemote
Who is on the other end? Depending on the connection type and phase of the connection,...
uint32 reserved[63]
Internal stuff, room to change API easily.
char m_szEndDebug[k_cchSteamNetworkingMaxConnectionCloseReason]
int m_nFlags
Misc flags. Bitmask of k_nSteamNetworkConnectionInfoFlags_Xxxx.
SteamNetworkingPOPID m_idPOPRelay
SteamNetworkingIPAddr m_addrRemote
Quick status of a particular lane.
SteamNetworkingMicroseconds m_usecQueueTime
float m_flOutPacketsPerSec
Current data rates from recent history.
float m_flConnectionQualityRemote
Packet delivery success rate as observed from remote host.
SteamNetworkingMicroseconds m_usecQueueTime
ESteamNetworkingConnectionState m_eState
High level state of the connection.
Callback struct used to notify when a connection has changed state.
void SetString(ESteamNetworkingConfigValue eVal, const char *data)
ESteamNetworkingConfigValue m_eValue
Which option is being set.
union SteamNetworkingConfigValue_t::@226264230310136375067366131222017367032047164040 m_val
void SetInt64(ESteamNetworkingConfigValue eVal, int64_t data)
void SetFloat(ESteamNetworkingConfigValue eVal, float data)
void SetInt32(ESteamNetworkingConfigValue eVal, int32_t data)
ESteamNetworkingConfigDataType m_eDataType
Which field below did you fill in?
void SetPtr(ESteamNetworkingConfigValue eVal, void *data)
Callback struct used to notify when a connection has changed state.
bool ParseString(const char *pszStr)
void SetIPv6(const uint8 *ipv6, uint16 nPort)
bool IsFakeIP() const
Return true if we are a FakeIP.
bool operator==(const SteamNetworkingIPAddr &x) const
See if two addresses are identical.
void SetIPv6LocalHost(uint16 nPort=0)
ESteamNetworkingFakeIPType GetFakeIPType() const
void SetIPv4(uint32 nIP, uint16 nPort)
void ToString(char *buf, size_t cbBuf, bool bWithPort) const
bool ParseString(const char *pszStr)
void SetSteamID64(uint64 steamID)
bool SetXboxPairwiseID(const char *pszString)
void SetIPAddr(const SteamNetworkingIPAddr &addr)
bool operator==(const SteamNetworkingIdentity &x) const
See if two identities are identical.
const SteamNetworkingIPAddr * GetIPAddr() const
const char * GetGenericString() const
bool SetGenericString(const char *pszString)
ESteamNetworkingFakeIPType GetFakeIPType() const
void SetIPv4Addr(uint32 nIPv4, uint16 nPort)
ESteamNetworkingIdentityType m_eType
Type of identity.
bool SetGenericBytes(const void *data, size_t cbLen)
void ToString(char *buf, size_t cbBuf) const
const char * GetXboxPairwiseID() const
void SetSteamID(CSteamID steamID)
const uint8 * GetGenericBytes(int &cbLen) const
A message that has been received.
void * m_pData
Message payload.
SteamNetworkingIdentity m_identityPeer
SteamNetworkingMicroseconds m_usecTimeReceived
HSteamNetConnection GetConnection() const
void(*) m_pfnRelease(SteamNetworkingMessage_t *pMsg)
void(*) m_pfnFreeData(SteamNetworkingMessage_t *pMsg)
SteamNetworkingMicroseconds GetTimeReceived() const
int m_cbSize
Size of the payload.
Posted when a remote host is sending us a message, and we do not already have a session with them.
SteamNetworkingPOPIDRender(SteamNetworkingPOPID x)
char m_szGenericString[k_cchMaxGenericString]
uint8 m_genericBytes[k_cbMaxGenericBytes]
char m_szXboxPairwiseID[k_cchMaxXboxPairwiseID]