update overlay to have ps controls too
[carveJwlIkooP6JGAAIwe30JlM.git] / gameserver.h
1 #pragma once
2 #define VG_SERVER
3
4 #include "vg/vg_platform.h"
5 #include "vg/vg_steam.h"
6 #include "vg/vg_steam_networking.h"
7 #include "vg/vg_steam_http.h"
8 #include "vg/vg_steam_auth.h"
9 #include "network_msg.h"
10 #include "network_common.h"
11 #include <sys/socket.h>
12
13 #define CLIENT_KNOWLEDGE_SAME_WORLD0 0x1
14 #define CLIENT_KNOWLEDGE_SAME_WORLD1 0x2
15 #define CLIENT_KNOWLEDGE_FRIENDS 0x4 /* TODO? */
16
17 struct {
18 HSteamNetPollGroup client_group;
19 EServerMode auth_mode;
20
21 struct gameserver_client {
22 int active;
23 u32 version;
24 int authenticated;
25 HSteamNetConnection connection;
26 char username[ NETWORK_USERNAME_MAX ];
27
28 u8 instance;
29
30 struct gameserver_item {
31 char uid[ADDON_UID_MAX];
32 u32 hash;
33 }
34 items[k_netmsg_playeritem_max];
35
36 char region[ NETWORK_REGION_MAX ];
37 u32 region_flags;
38
39 u64 steamid;
40 }
41 clients[ NETWORK_MAX_PLAYERS ];
42
43 u8 client_knowledge_mask[ (NETWORK_MAX_PLAYERS*(NETWORK_MAX_PLAYERS-1))/2 ];
44 u8 app_symmetric_key[ k_nSteamEncryptedAppTicketSymmetricKeyLen ];
45
46 /* TODO: Consider removing this */
47 int monitor_fd;
48 int monitor_clients[ 4 ];
49
50 bool loopback_test;
51 }
52 static gameserver = {
53 .auth_mode = eServerModeAuthentication
54 };
55
56 static ISteamNetworkingSockets *hSteamNetworkingSockets = NULL;