mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add comments on newly added code
This commit is contained in:
parent
22c82d6f1d
commit
b37a3bdeba
@ -52,7 +52,13 @@ static const char JWT_PUBLIC_KEY[] =
|
||||
"dwIDAQAB\n"
|
||||
"-----END PUBLIC KEY-----\n";
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------------
|
||||
// Purpose: check whether this client is authorized to join this server
|
||||
// Input : *playerName -
|
||||
// *reasonBuf -
|
||||
// reasonBufLen -
|
||||
// Output : true if authorized, false otherwise
|
||||
//---------------------------------------------------------------------------------
|
||||
bool CClient::Authenticate(const char* const playerName, char* const reasonBuf, const size_t reasonBufLen)
|
||||
{
|
||||
#ifndef CLIENT_DLL
|
||||
|
@ -164,6 +164,11 @@ bool CClientState::VProcessServerTick(CClientState* pClientState, SVC_ServerTick
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Purpose: get authentication token for current connection context
|
||||
// Input : *connectParams -
|
||||
// Output : true on success, false otherwise
|
||||
//------------------------------------------------------------------------------
|
||||
bool CClientState::Authenticate(connectparams_t* connectParams) const
|
||||
{
|
||||
string msToken; // token returned by the masterserver authorising the client to play online
|
||||
|
@ -312,7 +312,17 @@ bool CPylon::CheckForBan(const string& ipAddress, const uint64_t nucleusId, cons
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CPylon::AuthForConnection(const uint64_t nucleusId, const char* ipAddress, const char* authCode, string& outToken, string& outMessage) const
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: authenticate for 'this' particular connection.
|
||||
// Input : nucleusId -
|
||||
// *ipAddress -
|
||||
// *authCode -
|
||||
// &outToken -
|
||||
// &outMessage -
|
||||
// Output : true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CPylon::AuthForConnection(const uint64_t nucleusId, const char* ipAddress,
|
||||
const char* authCode, string& outToken, string& outMessage) const
|
||||
{
|
||||
rapidjson::Document requestJson;
|
||||
requestJson.SetObject();
|
||||
@ -341,6 +351,11 @@ bool CPylon::AuthForConnection(const uint64_t nucleusId, const char* ipAddress,
|
||||
return false;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: checks if the EULA response fields are valid.
|
||||
// Input : &doc -
|
||||
// Output : true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
static bool ValidateEULAData(const rapidjson::Document& doc)
|
||||
{
|
||||
if (!doc.HasMember("data") || !doc["data"].IsObject())
|
||||
@ -360,11 +375,20 @@ static bool ValidateEULAData(const rapidjson::Document& doc)
|
||||
return true;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: checks if the accepted EULA is up to date.
|
||||
// Output : true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
static bool IsEULAUpToDate()
|
||||
{
|
||||
return (eula_version_accepted->GetInt() == eula_version->GetInt());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Gets the EULA from master server.
|
||||
// Input : &outData -
|
||||
// Output : True on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CPylon::GetEULA(MSEulaData_t& outData) const
|
||||
{
|
||||
rapidjson::Document requestJson;
|
||||
@ -533,7 +557,6 @@ bool CPylon::QueryServer(const char* endpoint, const char* request,
|
||||
void CPylon::ExtractError(const rapidjson::Document& resultJson, string& outMessage,
|
||||
CURLINFO status, const char* errorText) const
|
||||
{
|
||||
|
||||
if (resultJson.IsObject() && resultJson.HasMember("error") &&
|
||||
resultJson["error"].IsString())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user