diff options
Diffstat (limited to 'NorthstarDLL/masterserver.h')
-rw-r--r-- | NorthstarDLL/masterserver.h | 250 |
1 files changed, 125 insertions, 125 deletions
diff --git a/NorthstarDLL/masterserver.h b/NorthstarDLL/masterserver.h index aa31a4a5..856adaac 100644 --- a/NorthstarDLL/masterserver.h +++ b/NorthstarDLL/masterserver.h @@ -1,125 +1,125 @@ -#pragma once
-#include "convar.h"
-#include "serverpresence.h"
-#include <WinSock2.h>
-#include <string>
-#include <cstring>
-
-extern ConVar* Cvar_ns_masterserver_hostname;
-extern ConVar* Cvar_ns_curl_log_enable;
-
-struct RemoteModInfo
-{
- public:
- std::string Name;
- std::string Version;
-};
-
-class RemoteServerInfo
-{
- public:
- char id[33]; // 32 bytes + nullterminator
-
- // server info
- char name[64];
- std::string description;
- char map[32];
- char playlist[16];
- std::vector<RemoteModInfo> requiredMods;
-
- int playerCount;
- int maxPlayers;
-
- // connection stuff
- bool requiresPassword;
-
- public:
- RemoteServerInfo(
- const char* newId,
- const char* newName,
- const char* newDescription,
- const char* newMap,
- const char* newPlaylist,
- int newPlayerCount,
- int newMaxPlayers,
- bool newRequiresPassword);
-};
-
-struct RemoteServerConnectionInfo
-{
- public:
- char authToken[32];
-
- in_addr ip;
- unsigned short port;
-};
-
-struct MainMenuPromoData
-{
- public:
- std::string newInfoTitle1;
- std::string newInfoTitle2;
- std::string newInfoTitle3;
-
- std::string largeButtonTitle;
- std::string largeButtonText;
- std::string largeButtonUrl;
- int largeButtonImageIndex;
-
- std::string smallButton1Title;
- std::string smallButton1Url;
- int smallButton1ImageIndex;
-
- std::string smallButton2Title;
- std::string smallButton2Url;
- int smallButton2ImageIndex;
-};
-
-class MasterServerManager
-{
- private:
- bool m_bRequestingServerList = false;
- bool m_bAuthenticatingWithGameServer = false;
-
- public:
- char m_sOwnServerId[33];
- char m_sOwnServerAuthToken[33];
- char m_sOwnClientAuthToken[33];
-
- std::string m_sOwnModInfoJson;
-
- bool m_bOriginAuthWithMasterServerDone = false;
- bool m_bOriginAuthWithMasterServerInProgress = false;
-
- bool m_bRequireClientAuth = false;
- bool m_bSavingPersistentData = false;
-
- bool m_bScriptRequestingServerList = false;
- bool m_bSuccessfullyConnected = true;
-
- bool m_bNewgameAfterSelfAuth = false;
- bool m_bScriptAuthenticatingWithGameServer = false;
- bool m_bSuccessfullyAuthenticatedWithGameServer = false;
-
- bool m_bHasPendingConnectionInfo = false;
- RemoteServerConnectionInfo m_pendingConnectionInfo;
-
- std::vector<RemoteServerInfo> m_vRemoteServers;
-
- bool m_bHasMainMenuPromoData = false;
- MainMenuPromoData m_sMainMenuPromoData;
-
- public:
- MasterServerManager();
-
- void ClearServerList();
- void RequestServerList();
- void RequestMainMenuPromos();
- void AuthenticateOriginWithMasterServer(const char* uid, const char* originToken);
- void AuthenticateWithOwnServer(const char* uid, const char* playerToken);
- void AuthenticateWithServer(const char* uid, const char* playerToken, const char* serverId, const char* password);
- void WritePlayerPersistentData(const char* playerId, const char* pdata, size_t pdataSize);
-};
-
-extern MasterServerManager* g_pMasterServerManager;
-extern ConVar* Cvar_ns_masterserver_hostname;
+#pragma once +#include "convar.h" +#include "serverpresence.h" +#include <WinSock2.h> +#include <string> +#include <cstring> + +extern ConVar* Cvar_ns_masterserver_hostname; +extern ConVar* Cvar_ns_curl_log_enable; + +struct RemoteModInfo +{ + public: + std::string Name; + std::string Version; +}; + +class RemoteServerInfo +{ + public: + char id[33]; // 32 bytes + nullterminator + + // server info + char name[64]; + std::string description; + char map[32]; + char playlist[16]; + std::vector<RemoteModInfo> requiredMods; + + int playerCount; + int maxPlayers; + + // connection stuff + bool requiresPassword; + + public: + RemoteServerInfo( + const char* newId, + const char* newName, + const char* newDescription, + const char* newMap, + const char* newPlaylist, + int newPlayerCount, + int newMaxPlayers, + bool newRequiresPassword); +}; + +struct RemoteServerConnectionInfo +{ + public: + char authToken[32]; + + in_addr ip; + unsigned short port; +}; + +struct MainMenuPromoData +{ + public: + std::string newInfoTitle1; + std::string newInfoTitle2; + std::string newInfoTitle3; + + std::string largeButtonTitle; + std::string largeButtonText; + std::string largeButtonUrl; + int largeButtonImageIndex; + + std::string smallButton1Title; + std::string smallButton1Url; + int smallButton1ImageIndex; + + std::string smallButton2Title; + std::string smallButton2Url; + int smallButton2ImageIndex; +}; + +class MasterServerManager +{ + private: + bool m_bRequestingServerList = false; + bool m_bAuthenticatingWithGameServer = false; + + public: + char m_sOwnServerId[33]; + char m_sOwnServerAuthToken[33]; + char m_sOwnClientAuthToken[33]; + + std::string m_sOwnModInfoJson; + + bool m_bOriginAuthWithMasterServerDone = false; + bool m_bOriginAuthWithMasterServerInProgress = false; + + bool m_bRequireClientAuth = false; + bool m_bSavingPersistentData = false; + + bool m_bScriptRequestingServerList = false; + bool m_bSuccessfullyConnected = true; + + bool m_bNewgameAfterSelfAuth = false; + bool m_bScriptAuthenticatingWithGameServer = false; + bool m_bSuccessfullyAuthenticatedWithGameServer = false; + + bool m_bHasPendingConnectionInfo = false; + RemoteServerConnectionInfo m_pendingConnectionInfo; + + std::vector<RemoteServerInfo> m_vRemoteServers; + + bool m_bHasMainMenuPromoData = false; + MainMenuPromoData m_sMainMenuPromoData; + + public: + MasterServerManager(); + + void ClearServerList(); + void RequestServerList(); + void RequestMainMenuPromos(); + void AuthenticateOriginWithMasterServer(const char* uid, const char* originToken); + void AuthenticateWithOwnServer(const char* uid, const char* playerToken); + void AuthenticateWithServer(const char* uid, const char* playerToken, const char* serverId, const char* password); + void WritePlayerPersistentData(const char* playerId, const char* pdata, size_t pdataSize); +}; + +extern MasterServerManager* g_pMasterServerManager; +extern ConVar* Cvar_ns_masterserver_hostname; |