-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgns.h
2943 lines (2523 loc) · 147 KB
/
gns.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///////////////
//
// gns.h
// This is the C style header file that is for all of the GameNetworkSocket library
//
//
///////////////////////////////////////////////////////////////////////////////////////
// steamnetworkingsockets_flat.h
///////////////////////////////////////////////////////////////////////////////////////
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// "Flat" interface to SteamNetworkingSockets.
//
// Designed to match the auto-generated flat interface in the Steamworks SDK
// (for better or worse...) It uses plain C linkage, but it is C++ code, and
// is not intended to compile as C code.
//
//=============================================================================
// define parameters
#define VALVE_CALLBACK_PACK_LARGE
#define API_GEN
#ifndef STEAMNETWORKINGSOCKETS_FLAT
#define STEAMNETWORKINGSOCKETS_FLAT
#pragma once
//#include "steamnetworkingtypes.h"
///////////////////////////////////////////////////////////////////////////////////////
// steamnetworkingsockets.h
///////////////////////////////////////////////////////////////////////////////////////
//====== Copyright Valve Corporation, All rights reserved. ====================
//
// Purpose: misc networking utilities
//
//=============================================================================
#ifndef STEAMNETWORKINGTYPES
#define STEAMNETWORKINGTYPES
#ifdef _WIN32
#pragma once
#endif
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
//----------------------------------------
// SteamNetworkingSockets library config
// Opensource version
//
#ifndef STEAMNETWORKINGSOCKETS_OPENSOURCE
#define STEAMNETWORKINGSOCKETS_OPENSOURCE
#endif
#define STEAMNETWORKINGSOCKETS_STANDALONELIB
//#include "../minbase/minbase_identify.h"
///////////////////////////////////////////////////////////////////////////////////////
// minbase_identify.h
///////////////////////////////////////////////////////////////////////////////////////
//====== Copyright 1996-2012, Valve Corporation, All rights reserved. ======//
//
// Compiler/platform identification to provide a consistent set of
// macros for places that need to specialize behavior.
//
//==========================================================================//
#ifndef MINBASE_IDENTIFY_H
#define MINBASE_IDENTIFY_H
#pragma once
#if defined(_LP64) || defined(__x86_64__) || defined(__arm64__) || defined(__aarch64__) || defined(_WIN64)
#define X64BITS
#define PLATFORM_64BITS
#endif // __x86_64__
#ifdef SN_TARGET_PS3
#define _PS3 1
#define COMPILER_PS3 1
#define PLATFORM_PS3 1
#define PLATFORM_PPC 1
// There are 2 compilers for the PS3: GCC and the SN Systems compiler.
// They are mostly similar, but in a few places we need to distinguish between the two.
#if defined( __SNC__ )
#define COMPILER_SNC 1
#elif defined( __GCC__ )
#define COMPILER_GCC 1
#else
#error "Unrecognized PS3 compiler; either __SNC__ or __GCC__ must be defined"
#endif
#endif // SN_TARGET_PS3
#if !defined(COMPILER_GCC) && (defined(__GCC__) || defined(__GNUC__))
#define COMPILER_GCC 1
#endif
#if !defined(COMPILER_CLANG) && defined(__clang__)
#define COMPILER_CLANG 1
#endif
#ifdef _MSC_VER
#define COMPILER_MSVC32 1
#if defined( _M_X64 )
#define COMPILER_MSVC64 1
#endif
#endif
#if ( defined(LINUX) || defined(OSX) || defined(ANDROID) ) && !defined(POSIX)
#define POSIX
#endif
#if defined(_WIN32) && !defined(WINDED)
#if defined(_M_IX86)
#define __i386__ 1
#elif defined(_M_X64)
#define __x86_64__ 1
#endif
#endif
#if ( (defined(__GNUC__) && defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || defined(__LITTLE_ENDIAN__) || defined(__i386__) || defined( __x86_64__ ) || defined(__arm__) || defined(__arm64__) || defined(__aarch64__) || defined(_XBOX) ) && !defined(VALVE_LITTLE_ENDIAN)
#define VALVE_LITTLE_ENDIAN 1
#endif
#if ( (defined(__GNUC__) && defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) || defined(__BIG_ENDIAN__) || defined( _SGI_SOURCE ) || defined( _PS3 ) ) && !defined(VALVE_BIG_ENDIAN)
#define VALVE_BIG_ENDIAN 1
#endif
#if defined( VALVE_LITTLE_ENDIAN ) == defined( VALVE_BIG_ENDIAN )
#error "Cannot determine endianness of platform!"
#endif
// Detect C++11 support for "rvalue references" / "move semantics" / other C++11 (and up) stuff
#if defined(_MSC_VER)
#if _MSC_VER >= 1600
#define VALVE_RVALUE_REFS 1
#endif
#if _MSC_VER >= 1800
#define VALVE_INITIALIZER_LIST_SUPPORT 1
#define VALVE_EXPLICIT_CONVERSION_OP 1
#endif
#elif defined(__clang__)
#if __has_extension(cxx_rvalue_references)
#define VALVE_RVALUE_REFS 1
#endif
#if __has_feature(cxx_generalized_initializers)
#define VALVE_INITIALIZER_LIST_SUPPORT 1
#endif
#if __has_feature(cxx_explicit_conversions)
#define VALVE_EXPLICIT_CONVERSION_OP 1
#endif
#elif defined(__GNUC__)
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6 )
#if defined(__GXX_EXPERIMENTAL_CXX0X__)
#define VALVE_RVALUE_REFS 1
#define VALVE_INITIALIZER_LIST_SUPPORT 1
#define VALVE_EXPLICIT_CONVERSION_OP 1
#endif
#endif
#endif
#ifdef _RETAIL
#define IsRetail() true
#else
#define IsRetail() false
#endif
#ifdef _DEBUG
#define IsRelease() false
#define IsDebug() true
#else
#define IsRelease() true
#define IsDebug() false
#endif
#if defined( _XBOX_ONE )
#define IsXboxOne() true
#define IsConsole() true
#elif defined( NN_NINTENDO_SDK )
#if !defined(POSIX) && !defined(_WIN32)
#define POSIX
#endif
#define IsNintendoSwitch() true
#define IsConsole() true
#elif defined( _WIN32 )
#define IsWindows() true
#define IsPC() true
#elif defined( _PS3 )
#define IsConsole() true
#define IsPosix() true
#define IsPS3() true
#elif defined(POSIX)
#define IsPC() true
#define IsPosix() true
#ifdef LINUX
#define IsLinux() true
#endif
#ifdef OSX
#define SUPPORTS_IOPOLLINGHELPER
#define IsOSX() true
#endif
#else
#error Undefined platform
#endif
#ifndef IsWindows
#define IsWindows() false
#endif
#ifndef IsPC
#define IsPC() false
#endif
#ifndef IsConsole
#define IsConsole() false
#endif
#ifndef IsNintendoSwitch
#define IsNintendoSwitch() false
#endif
#ifndef IsXboxOne
#define IsXboxOne() false
#endif
#ifndef IsLinux
#define IsLinux() false
#endif
#ifndef IsPosix
#define IsPosix() false
#endif
#ifndef IsOSX
#define IsOSX() false
#endif
#ifndef IsPS3
#define IsPS3() false
#endif
#ifndef IsX360
#define IsX360() false
#endif
#ifndef IsARM
#ifdef __arm__
#define IsARM() true
#else
#define IsARM() false
#endif
#endif
#ifndef IsAndroid
#ifdef ANDROID
#define IsAndroid() true
#else
#define IsAndroid() false
#endif
#endif
#endif // #ifndef MINBASE_IDENTIFY_H
//#include "../minbase/minbase_decls.h"
///////////////////////////////////////////////////////////////////////////////////////
// minbase_decls.h
///////////////////////////////////////////////////////////////////////////////////////
//====== Copyright 1996-2012, Valve Corporation, All rights reserved. ======//
//
// Portable declaration decorations.
//
//==========================================================================//
#ifndef MINBASE_DECLS_H
#define MINBASE_DECLS_H
#pragma once
// Identification is needed everywhere but we don't want to include
// it over and over again so just make sure it was already included.
#ifndef MINBASE_IDENTIFY_H
#error Must include minbase_identify.h
#endif
// Use this to specify that a function is an override of a virtual function.
// This lets the compiler catch cases where you meant to override a virtual
// function but you accidentally changed the function signature and created
// an overloaded function. Usage in function declarations is like this:
// int GetData() const OVERRIDE;
#ifndef OVERRIDE
#define OVERRIDE override
#endif
// This can be used to ensure the size of pointers to members when declaring
// a pointer type for a class that has only been forward declared
#ifdef _MSC_VER
#define SINGLE_INHERITANCE __single_inheritance
#define MULTIPLE_INHERITANCE __multiple_inheritance
#else
#define SINGLE_INHERITANCE
#define MULTIPLE_INHERITANCE
#endif
#ifdef _MSC_VER
#define NO_VTABLE __declspec( novtable )
#else
#define NO_VTABLE
#endif
// This can be used to declare an abstract (interface only) class.
// Classes marked abstract should not be instantiated. If they are, and access violation will occur.
//
// Example of use:
//
// abstract_class CFoo
// {
// ...
// }
//
// MSDN __declspec(novtable) documentation: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_langref_novtable.asp
//
// Note: NJS: This is not enabled for regular PC, due to not knowing the implications of exporting a class with no no vtable.
// It's probable that this shouldn't be an issue, but an experiment should be done to verify this.
//
#ifndef _XBOX
#define abstract_class class
#else
#define abstract_class class NO_VTABLE
#endif
// C functions for external declarations that call the appropriate C++ methods
#ifndef EXPORT
#ifdef _WIN32
#define EXPORT _declspec( dllexport )
#else
#define EXPORT /* */
#endif
#endif
#if _MSC_VER >= 1400
#define NOALIAS __declspec(noalias)
#define RESTRICT __restrict
#define RESTRICT_FUNC __declspec(restrict)
#else // _MSC_VER >= 1400
#define NOALIAS
#define RESTRICT
#define RESTRICT_FUNC
#endif // _MSC_VER >= 1400
// Linux had a few areas where it didn't construct objects in the same order that Windows does.
// So when CVProfile::CVProfile() would access g_pMemAlloc, it would crash because the allocator wasn't initalized yet.
#if defined( GNUC ) || defined ( COMPILER_GCC ) || defined( COMPILER_SNC )
#define CONSTRUCT_EARLY __attribute__((init_priority(101)))
#else
#define CONSTRUCT_EARLY
#endif
#ifdef _WIN32
#define SELECTANY __declspec(selectany)
#elif defined(GNUC) || defined ( COMPILER_GCC ) || defined( COMPILER_SNC )
#define SELECTANY __attribute__((weak))
#else
#define SELECTANY static
#endif
#undef DLL_EXPORT
#undef DLL_IMPORT
#if defined(_WIN32) && !defined(_XBOX)
#define PLAT_DECL_EXPORT __declspec( dllexport )
#define PLAT_DECL_IMPORT __declspec( dllimport )
#elif defined(GNUC) || defined(COMPILER_GCC)
#define PLAT_DECL_EXPORT __attribute__((visibility("default")))
#define PLAT_DECL_IMPORT
#elif defined(_XBOX) || defined(COMPILER_SNC)
#define PLAT_DECL_EXPORT
#define PLAT_DECL_IMPORT
#else
#error "Unsupported Platform."
#endif
#if defined(_XBOX)
#define DLL_EXPORT extern
#define DLL_IMPORT extern
#define DLL_CLASS_EXPORT
#define DLL_CLASS_IMPORT
#define DLL_GLOBAL_EXPORT
#define DLL_GLOBAL_IMPORT
#else
// Used for dll exporting and importing
#define DLL_EXPORT extern "C" PLAT_DECL_EXPORT
#define DLL_IMPORT extern "C" PLAT_DECL_IMPORT
// Can't use extern "C" when DLL exporting a class
#define DLL_CLASS_EXPORT PLAT_DECL_EXPORT
#define DLL_CLASS_IMPORT PLAT_DECL_IMPORT
#define DLL_GLOBAL_EXPORT PLAT_DECL_EXPORT
#define DLL_GLOBAL_IMPORT extern PLAT_DECL_IMPORT
#endif
#ifdef FASTCALL
#undef FASTCALL
#endif
// Used for standard calling conventions
#if defined(_WIN32)
#define STDCALL __stdcall
#define FASTCALL __fastcall
#elif defined(_PS3)
#if defined( COMPILER_SNC )
#define STDCALL
#define __stdcall
#elif (CROSS_PLATFORM_VERSION >= 1) && !defined( PLATFORM_64BITS ) && !defined( COMPILER_PS3 )
#define STDCALL __attribute__ ((__stdcall__))
#else
#define STDCALL
#define __stdcall __attribute__ ((__stdcall__))
#endif
#define FASTCALL
#elif defined(POSIX)
#define __stdcall
#define __cdecl
#define STDCALL
#define FASTCALL
#endif
#if defined(_WIN32)
#define NOINLINE __declspec(noinline)
#define NORETURN __declspec(noreturn)
#define FORCEINLINE __forceinline
#elif defined(GNUC) || defined(COMPILER_GCC) || defined(COMPILER_SNC)
#define NOINLINE __attribute__ ((noinline))
#define NORETURN __attribute__ ((noreturn))
#if defined(COMPILER_GCC) || defined(COMPILER_SNC)
#define FORCEINLINE inline __attribute__ ((always_inline))
// GCC 3.4.1 has a bug in supporting forced inline of templated functions
// this macro lets us not force inlining in that case
#define FORCEINLINE_TEMPLATE inline
#else
#define FORCEINLINE inline
#define FORCEINLINE_TEMPLATE inline
#endif
#endif
// We have some template functions declared in header files that
// only need static scope. Older MSVC version lets you use 'static' qualifiers
// but GCC and new MSVC does not, where we need to use 'inline' to avoid multiple definitions.
#ifdef COMPILER_MSVC32
#if _MSC_VER <= 1910
#define STATIC_TEMPLATE_INLINE static
#else
#define STATIC_TEMPLATE_INLINE inline
#endif
#else
#define STATIC_TEMPLATE_INLINE inline
#endif
#if !defined(UNALIGNED)
#if defined(_M_IA64) || defined(_M_AMD64)
#define UNALIGNED __unaligned
#else
#define UNALIGNED
#endif
#endif
#endif // #ifndef MINBASE_DECLS_H
//#include "steamtypes.h"
///////////////////////////////////////////////////////////////////////////////////////
// steamtypes.h
///////////////////////////////////////////////////////////////////////////////////////
//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
//
// Purpose:
//
//======================= ======================================================
#ifndef STEAMTYPES_H
#define STEAMTYPES_H
#ifdef _WIN32
#pragma once
#endif
#define S_CALLTYPE __cdecl
// Steam-specific types. Defined here so this header file can be included in other code bases.
#ifndef WCHARTYPES_H
typedef unsigned char uint8;
#endif
#if defined( __GNUC__ ) && !defined(_WIN32) && !defined(POSIX)
#if __GNUC__ < 4
#error "Steamworks requires GCC 4.X (4.2 or 4.4 have been tested)"
#endif
#define POSIX 1
#endif
#if defined(__x86_64__) || defined(_WIN64) || defined(__aarch64__)
#define X64BITS
#endif
// Make sure VALVE_BIG_ENDIAN gets set on PS3, may already be set previously in Valve internal code.
#if !defined(VALVE_BIG_ENDIAN) && defined(_PS3)
#define VALVE_BIG_ENDIAN
#endif
typedef unsigned char uint8;
typedef signed char int8;
#if defined( _WIN32 ) && !defined( __GNUC__ )
typedef __int16 int16;
typedef unsigned __int16 uint16;
typedef __int32 int32;
typedef unsigned __int32 uint32;
typedef __int64 int64;
typedef unsigned __int64 uint64;
typedef int64 lint64;
typedef uint64 ulint64;
#ifdef X64BITS
typedef __int64 intp; // intp is an integer that can accomodate a pointer
typedef unsigned __int64 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *)
#else
typedef __int32 intp;
typedef unsigned __int32 uintp;
#endif
#else // _WIN32
typedef short int16;
typedef unsigned short uint16;
typedef int int32;
typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
// [u]int64 are actually defined as 'long long' and gcc 64-bit
// doesn't automatically consider them the same as 'long int'.
// Changing the types for [u]int64 is complicated by
// there being many definitions, so we just
// define a 'long int' here and use it in places that would
// otherwise confuse the compiler.
typedef long int lint64;
typedef unsigned long int ulint64;
#ifdef X64BITS
typedef long long intp;
typedef unsigned long long uintp;
#else
typedef int intp;
typedef unsigned int uintp;
#endif
#endif // else _WIN32
#ifdef API_GEN
# define STEAM_CLANG_ATTR(ATTR) __attribute__((annotate( ATTR )))
#else
# define STEAM_CLANG_ATTR(ATTR)
#endif
#define STEAM_METHOD_DESC(DESC) STEAM_CLANG_ATTR( "desc:" #DESC ";" )
#define STEAM_IGNOREATTR() STEAM_CLANG_ATTR( "ignore" )
#define STEAM_OUT_STRUCT() STEAM_CLANG_ATTR( "out_struct: ;" )
#define STEAM_OUT_STRING() STEAM_CLANG_ATTR( "out_string: ;" )
#define STEAM_OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) STEAM_CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" )
#define STEAM_OUT_ARRAY_COUNT(COUNTER, DESC) STEAM_CLANG_ATTR( "out_array_count:" #COUNTER ";desc:" #DESC )
#define STEAM_ARRAY_COUNT(COUNTER) STEAM_CLANG_ATTR( "array_count:" #COUNTER ";" )
#define STEAM_ARRAY_COUNT_D(COUNTER, DESC) STEAM_CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC )
#define STEAM_BUFFER_COUNT(COUNTER) STEAM_CLANG_ATTR( "buffer_count:" #COUNTER ";" )
#define STEAM_OUT_BUFFER_COUNT(COUNTER) STEAM_CLANG_ATTR( "out_buffer_count:" #COUNTER ";" )
#define STEAM_OUT_STRING_COUNT(COUNTER) STEAM_CLANG_ATTR( "out_string_count:" #COUNTER ";" )
#define STEAM_DESC(DESC) STEAM_CLANG_ATTR("desc:" #DESC ";")
#define STEAM_CALL_RESULT(RESULT_TYPE) STEAM_CLANG_ATTR("callresult:" #RESULT_TYPE ";")
#define STEAM_CALL_BACK(RESULT_TYPE) STEAM_CLANG_ATTR("callback:" #RESULT_TYPE ";")
const int k_cubSaltSize = 8;
typedef uint8 Salt_t[ k_cubSaltSize ];
//-----------------------------------------------------------------------------
// GID (GlobalID) stuff
// This is a globally unique identifier. It's guaranteed to be unique across all
// racks and servers for as long as a given universe persists.
//-----------------------------------------------------------------------------
// NOTE: for GID parsing/rendering and other utils, see gid.h
typedef uint64 GID_t;
const GID_t k_GIDNil = 0xffffffffffffffffull;
// For convenience, we define a number of types that are just new names for GIDs
typedef uint64 JobID_t; // Each Job has a unique ID
typedef GID_t TxnID_t; // Each financial transaction has a unique ID
const GID_t k_TxnIDNil = k_GIDNil;
const GID_t k_TxnIDUnknown = 0;
const JobID_t k_JobIDNil = 0xffffffffffffffffull;
// this is baked into client messages and interfaces as an int,
// make sure we never break this.
typedef uint32 PackageId_t;
const PackageId_t k_uPackageIdFreeSub = 0x0;
const PackageId_t k_uPackageIdInvalid = 0xFFFFFFFF;
typedef uint32 BundleId_t;
const BundleId_t k_uBundleIdInvalid = 0;
// this is baked into client messages and interfaces as an int,
// make sure we never break this.
typedef uint32 AppId_t;
const AppId_t k_uAppIdInvalid = 0x0;
typedef uint64 AssetClassId_t;
const AssetClassId_t k_ulAssetClassIdInvalid = 0x0;
typedef uint32 PhysicalItemId_t;
const PhysicalItemId_t k_uPhysicalItemIdInvalid = 0x0;
// this is baked into client messages and interfaces as an int,
// make sure we never break this. AppIds and DepotIDs also presently
// share the same namespace, but since we'd like to change that in the future
// I've defined it seperately here.
typedef uint32 DepotId_t;
const DepotId_t k_uDepotIdInvalid = 0x0;
// RTime32
// We use this 32 bit time representing real world time.
// It offers 1 second resolution beginning on January 1, 1970 (Unix time)
typedef uint32 RTime32;
typedef uint32 CellID_t;
const CellID_t k_uCellIDInvalid = 0xFFFFFFFF;
// handle to a Steam API call
typedef uint64 SteamAPICall_t;
const SteamAPICall_t k_uAPICallInvalid = 0x0;
typedef uint32 AccountID_t;
typedef uint32 PartnerId_t;
const PartnerId_t k_uPartnerIdInvalid = 0;
// ID for a depot content manifest
typedef uint64 ManifestId_t;
const ManifestId_t k_uManifestIdInvalid = 0;
// ID for cafe sites
typedef uint64 SiteId_t;
const SiteId_t k_ulSiteIdInvalid = 0;
// Party Beacon ID
typedef uint64 PartyBeaconID_t;
const PartyBeaconID_t k_ulPartyBeaconIdInvalid = 0;
#endif // STEAMTYPES_H
//#include "steamclientpublic.h"
///////////////////////////////////////////////////////////////////////////////////////
// steamclientpublic.h
///////////////////////////////////////////////////////////////////////////////////////
// General result codes
enum EResult
{
k_EResultOK = 1, // success
k_EResultFail = 2, // generic failure
k_EResultNoConnection = 3, // no/failed network connection
//k_EResultNoConnectionRetry = 4, // OBSOLETE - removed
k_EResultInvalidPassword = 5, // password/ticket is invalid
k_EResultLoggedInElsewhere = 6, // same user logged in elsewhere
k_EResultInvalidProtocolVer = 7, // protocol version is incorrect
k_EResultInvalidParam = 8, // a parameter is incorrect
k_EResultFileNotFound = 9, // file was not found
k_EResultBusy = 10, // called method busy - action not taken
k_EResultInvalidState = 11, // called object was in an invalid state
k_EResultInvalidName = 12, // name is invalid
k_EResultInvalidEmail = 13, // email is invalid
k_EResultDuplicateName = 14, // name is not unique
k_EResultAccessDenied = 15, // access is denied
k_EResultTimeout = 16, // operation timed out
k_EResultBanned = 17, // VAC2 banned
k_EResultAccountNotFound = 18, // account not found
k_EResultInvalidSteamID = 19, // steamID is invalid
k_EResultServiceUnavailable = 20, // The requested service is currently unavailable
k_EResultNotLoggedOn = 21, // The user is not logged on
k_EResultPending = 22, // Request is pending (may be in process, or waiting on third party)
k_EResultEncryptionFailure = 23, // Encryption or Decryption failed
k_EResultInsufficientPrivilege = 24, // Insufficient privilege
k_EResultLimitExceeded = 25, // Too much of a good thing
k_EResultRevoked = 26, // Access has been revoked (used for revoked guest passes)
k_EResultExpired = 27, // License/Guest pass the user is trying to access is expired
k_EResultAlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again
k_EResultDuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time
k_EResultAlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user
k_EResultIPNotFound = 31, // IP address not found
k_EResultPersistFailed = 32, // failed to write change to the data store
k_EResultLockingFailed = 33, // failed to acquire access lock for this operation
k_EResultLogonSessionReplaced = 34,
k_EResultConnectFailed = 35,
k_EResultHandshakeFailed = 36,
k_EResultIOFailure = 37,
k_EResultRemoteDisconnect = 38,
k_EResultShoppingCartNotFound = 39, // failed to find the shopping cart requested
k_EResultBlocked = 40, // a user didn't allow it
k_EResultIgnored = 41, // target is ignoring sender
k_EResultNoMatch = 42, // nothing matching the request found
k_EResultAccountDisabled = 43,
k_EResultServiceReadOnly = 44, // this service is not accepting content changes right now
k_EResultAccountNotFeatured = 45, // account doesn't have value, so this feature isn't available
k_EResultAdministratorOK = 46, // allowed to take this action, but only because requester is admin
k_EResultContentVersion = 47, // A Version mismatch in content transmitted within the Steam protocol.
k_EResultTryAnotherCM = 48, // The current CM can't service the user making a request, user should try another.
k_EResultPasswordRequiredToKickSession = 49,// You are already logged in elsewhere, this cached credential login has failed.
k_EResultAlreadyLoggedInElsewhere = 50, // You are already logged in elsewhere, you must wait
k_EResultSuspended = 51, // Long running operation (content download) suspended/paused
k_EResultCancelled = 52, // Operation canceled (typically by user: content download)
k_EResultDataCorruption = 53, // Operation canceled because data is ill formed or unrecoverable
k_EResultDiskFull = 54, // Operation canceled - not enough disk space.
k_EResultRemoteCallFailed = 55, // an remote call or IPC call failed
k_EResultPasswordUnset = 56, // Password could not be verified as it's unset server side
k_EResultExternalAccountUnlinked = 57, // External account (PSN, Facebook...) is not linked to a Steam account
k_EResultPSNTicketInvalid = 58, // PSN ticket was invalid
k_EResultExternalAccountAlreadyLinked = 59, // External account (PSN, Facebook...) is already linked to some other account, must explicitly request to replace/delete the link first
k_EResultRemoteFileConflict = 60, // The sync cannot resume due to a conflict between the local and remote files
k_EResultIllegalPassword = 61, // The requested new password is not legal
k_EResultSameAsPreviousValue = 62, // new value is the same as the old one ( secret question and answer )
k_EResultAccountLogonDenied = 63, // account login denied due to 2nd factor authentication failure
k_EResultCannotUseOldPassword = 64, // The requested new password is not legal
k_EResultInvalidLoginAuthCode = 65, // account login denied due to auth code invalid
k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent
k_EResultHardwareNotCapableOfIPT = 67, //
k_EResultIPTInitError = 68, //
k_EResultParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user
k_EResultFacebookQueryError = 70, // Facebook query returned an error
k_EResultExpiredLoginAuthCode = 71, // account login denied due to auth code expired
k_EResultIPLoginRestrictionFailed = 72,
k_EResultAccountLockedDown = 73,
k_EResultAccountLogonDeniedVerifiedEmailRequired = 74,
k_EResultNoMatchingURL = 75,
k_EResultBadResponse = 76, // parse failure, missing field, etc.
k_EResultRequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password
k_EResultValueOutOfRange = 78, // the value entered is outside the acceptable range
k_EResultUnexpectedError = 79, // something happened that we didn't expect to ever happen
k_EResultDisabled = 80, // The requested service has been configured to be unavailable
k_EResultInvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid !
k_EResultRestrictedDevice = 82, // The device being used is not allowed to perform this action
k_EResultRegionLocked = 83, // The action could not be complete because it is region restricted
k_EResultRateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent
k_EResultAccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login
k_EResultItemDeleted = 86, // The thing we're trying to access has been deleted
k_EResultAccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker
k_EResultTwoFactorCodeMismatch = 88, // two factor code mismatch
k_EResultTwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match
k_EResultAccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners
k_EResultNotModified = 91, // data not modified
k_EResultNoMobileDevice = 92, // the account does not have a mobile device associated with it
k_EResultTimeNotSynced = 93, // the time presented is out of range or tolerance
k_EResultSmsCodeFailed = 94, // SMS code failure (no match, none pending, etc.)
k_EResultAccountLimitExceeded = 95, // Too many accounts access this resource
k_EResultAccountActivityLimitExceeded = 96, // Too many changes to this account
k_EResultPhoneActivityLimitExceeded = 97, // Too many changes to this phone
k_EResultRefundToWallet = 98, // Cannot refund to payment method, must use wallet
k_EResultEmailSendFailure = 99, // Cannot send an email
k_EResultNotSettled = 100, // Can't perform operation till payment has settled
k_EResultNeedCaptcha = 101, // Needs to provide a valid captcha
k_EResultGSLTDenied = 102, // a game server login token owned by this token's owner has been banned
k_EResultGSOwnerDenied = 103, // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone)
k_EResultInvalidItemType = 104, // the type of thing we were requested to act on is invalid
k_EResultIPBanned = 105, // the ip address has been banned from taking this action
k_EResultGSLTExpired = 106, // this token has expired from disuse; can be reset for use
k_EResultInsufficientFunds = 107, // user doesn't have enough wallet funds to complete the action
k_EResultTooManyPending = 108, // There are too many of this thing pending already
k_EResultNoSiteLicensesFound = 109, // No site licenses found
k_EResultWGNetworkSendExceeded = 110, // the WG couldn't send a response because we exceeded max network send size
};
#ifdef NN_NINTENDO_SDK // We always static link on Nintendo
#define STEAMNETWORKINGSOCKETS_STATIC_LINK
#endif
#define STEAMNETWORKINGSOCKETS_INTERFACE
//!#if defined( STEAMNETWORKINGSOCKETS_STATIC_LINK )
//! #define STEAMNETWORKINGSOCKETS_INTERFACE extern "C"
//!#elif defined( STEAMNETWORKINGSOCKETS_FOREXPORT )
//! #define STEAMNETWORKINGSOCKETS_INTERFACE DLL_EXPORT
//!#else
//! #define STEAMNETWORKINGSOCKETS_INTERFACE DLL_IMPORT
//!#endif
// Doesn't really matter what these values are, but they need
// to be defined, and we might as well use the same values as Steam.
const int k_iSteamNetworkingSocketsCallbacks = 1220;
const int k_iSteamNetworkingMessagesCallbacks = 1250;
const int k_iSteamNetworkingUtilsCallbacks = 1280;
//
//----------------------------------------
#if defined( VALVE_CALLBACK_PACK_SMALL )
#pragma pack( push, 4 )
#elif defined( VALVE_CALLBACK_PACK_LARGE )
#pragma pack( push, 8 )
#else
#error "Must define VALVE_CALLBACK_PACK_SMALL or VALVE_CALLBACK_PACK_LARGE"
#endif
//!typedef struct SteamDatagramRelayAuthTicket SteamDatagramRelayAuthTicket;
//!typedef struct SteamDatagramHostedAddress SteamDatagramHostedAddress;
//!typedef struct SteamDatagramGameCoordinatorServerLogin SteamDatagramGameCoordinatorServerLogin;
//!typedef struct SteamNetConnectionStatusChangedCallback_t SteamNetConnectionStatusChangedCallback_t;
//!typedef struct SteamNetAuthenticationStatus_t SteamNetAuthenticationStatus_t;
//!typedef struct SteamRelayNetworkStatus_t SteamRelayNetworkStatus_t;
//!typedef struct SteamNetworkingMessagesSessionRequest_t SteamNetworkingMessagesSessionRequest_t;
//!typedef struct SteamNetworkingMessagesSessionFailed_t SteamNetworkingMessagesSessionFailed_t;
/// Handle used to identify a connection to a remote host.
typedef uint32 HSteamNetConnection;
const HSteamNetConnection k_HSteamNetConnection_Invalid = 0;
/// Handle used to identify a "listen socket". Unlike traditional
/// Berkeley sockets, a listen socket and a connection are two
/// different abstractions.
typedef uint32 HSteamListenSocket;
const HSteamListenSocket k_HSteamListenSocket_Invalid = 0;
/// Handle used to identify a poll group, used to query many
/// connections at once efficiently.
typedef uint32 HSteamNetPollGroup;
const HSteamNetPollGroup k_HSteamNetPollGroup_Invalid = 0;
/// Max length of diagnostic error message
const int k_cchMaxSteamNetworkingErrMsg = 1024;
/// Used to return English-language diagnostic error messages to caller.
/// (For debugging or spewing to a console, etc. Not intended for UI.)
typedef char SteamNetworkingErrMsg[ k_cchMaxSteamNetworkingErrMsg ];
/// Identifier used for a network location point of presence. (E.g. a Valve data center.)
/// Typically you won't need to directly manipulate these.
typedef uint32 SteamNetworkingPOPID;
/// A local timestamp. You can subtract two timestamps to get the number of elapsed
/// microseconds. This is guaranteed to increase over time during the lifetime
/// of a process, but not globally across runs. You don't need to worry about
/// the value wrapping around. Note that the underlying clock might not actually have
/// microsecond resolution.
typedef int64 SteamNetworkingMicroseconds;
/// Describe the status of a particular network resource
enum ESteamNetworkingAvailability
{
// Negative values indicate a problem.
//
// In general, we will not automatically retry unless you take some action that
// depends on of requests this resource, such as querying the status, attempting
// to initiate a connection, receive a connection, etc. If you do not take any
// action at all, we do not automatically retry in the background.
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.)
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
k_ESteamNetworkingAvailability_Previously = -100, // We tried and were successful at one time, but now it looks like we have a problem
k_ESteamNetworkingAvailability_Retrying = -10, // We previously failed and are currently retrying
// Not a problem, but not ready either
k_ESteamNetworkingAvailability_NeverTried = 1, // We don't know because we haven't ever checked/tried
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.)
k_ESteamNetworkingAvailability_Attempting = 3, // We're actively trying now, but are not yet successful.
k_ESteamNetworkingAvailability_Current = 100, // Resource is online/available
k_ESteamNetworkingAvailability_Unknown = 0, // Internal dummy/sentinel, or value is not applicable in this context
k_ESteamNetworkingAvailability__Force32bit = 0x7fffffff,
};
//
// Describing network hosts
//
/// Different methods of describing the identity of a network host
enum ESteamNetworkingIdentityType
{
// Dummy/empty/invalid.
// Plese note that if we parse a string that we don't recognize
// but that appears reasonable, we will NOT use this type. Instead
// we'll use k_ESteamNetworkingIdentityType_UnknownType.
k_ESteamNetworkingIdentityType_Invalid = 0,
//
// Basic platform-specific identifiers.
//
k_ESteamNetworkingIdentityType_SteamID = 16, // 64-bit CSteamID
//
// Special identifiers.
//
// Use their IP address (and port) as their "identity".
// These types of identities are always unauthenticated.
// They are useful for porting plain sockets code, and other
// situations where you don't care about authentication. In this
// case, the local identity will be "localhost",
// and the remote address will be their network address.
//
// We use the same type for either IPv4 or IPv6, and
// the address is always store as IPv6. We use IPv4
// mapped addresses to handle IPv4.
k_ESteamNetworkingIdentityType_IPAddress = 1,
// Generic string/binary blobs. It's up to your app to interpret this.
// This library can tell you if the remote host presented a certificate
// signed by somebody you have chosen to trust, with this identity on it.
// It's up to you to ultimately decide what this identity means.
k_ESteamNetworkingIdentityType_GenericString = 2,
k_ESteamNetworkingIdentityType_GenericBytes = 3,
// This identity type is used when we parse a string that looks like is a
// valid identity, just of a kind that we don't recognize. In this case, we
// can often still communicate with the peer! Allowing such identities
// for types we do not recognize useful is very useful for forward
// compatibility.
k_ESteamNetworkingIdentityType_UnknownType = 4,
// Make sure this enum is stored in an int.
k_ESteamNetworkingIdentityType__Force32bit = 0x7fffffff,
};
#pragma pack(push,1)
// Max length of the buffer needed to hold IP formatted using ToString, including '\0'
// ([0123:4567:89ab:cdef:0123:4567:89ab:cdef]:12345)
const int k_cchMaxStringIPAddr = 48;
/// Store an IP and port. IPv6 is always used; IPv4 is represented using
/// "IPv4-mapped" addresses: IPv4 aa.bb.cc.dd => IPv6 ::ffff:aabb:ccdd
/// (RFC 4291 section 2.5.5.2.)
struct SteamNetworkingIPAddr
{
//!void Clear(); // Set everything to zero. E.g. [::]:0
//!bool IsIPv6AllZeros() const; // Return true if the IP is ::0. (Doesn't check port.)
//!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
//!void SetIPv4( uint32 nIP, uint16 nPort ); // Sets to IPv4 mapped address. IP and port are in host byte order.
//!bool IsIPv4() const; // Return true if IP is mapped IPv4
//!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.
//!void SetIPv6LocalHost( uint16 nPort = 0); // Set to the IPv6 localhost address ::1, and the specified port.
//!bool IsLocalHost() const; // Return true if this identity is localhost. (Either IPv6 ::1, or IPv4 127.0.0.1)
// Max length of the buffer needed to hold IP formatted using ToString, including '\0'
// ([0123:4567:89ab:cdef:0123:4567:89ab:cdef]:12345)
//!enum { k_cchMaxStringIPAddr = 48 };
/// Print to a string, with or without the port. Mapped IPv4 addresses are printed
/// as dotted decimal (12.34.56.78), otherwise this will print the canonical
/// form according to RFC5952. If you include the port, IPv6 will be surrounded by
/// brackets, e.g. [::1:2]:80. Your buffer should be at least k_cchMaxStringIPAddr bytes
/// to avoid truncation
///
/// See also SteamNetworkingIdentityRender
//!inline void ToString( char *buf, size_t cbBuf, bool bWithPort ) const;
/// Parse an IP address and optional port. If a port is not present, it is set to 0.
/// (This means that you cannot tell if a zero port was explicitly specified.)
//!inline bool ParseString( const char *pszStr );
union
{
uint8 m_ipv6[ 16 ];
#ifndef API_GEN // API generator doesn't understand this. The bindings will just use the accessors
struct // IPv4 "mapped address" (rfc4038 section 4.2)
{
uint64 m_8zeros;
uint16 m_0000;
uint16 m_ffff;
uint8 m_ip[ 4 ]; // NOTE: As bytes, i.e. network byte order
} m_ipv4;
#endif
};
uint16 m_port; // Host byte order