mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
chore(net): rearrange defines and enums for clarity
This commit is contained in:
parent
2d3327d3ae
commit
a85bd4809f
@ -486,9 +486,9 @@ void CGlueMgr::PollLoginServerLogin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case LOGIN_STATE_CHECKINGVERSIONS: {
|
case LOGIN_STATE_CHECKINGVERSIONS: {
|
||||||
uint8_t versionChecksum[VERSION_CHECKSUM_LEN];
|
uint8_t versionChecksum[LOGIN_VERSION_CHECKSUM_LEN];
|
||||||
auto versionChallenge = ClientServices::LoginConnection()->GetVersionChallenge();
|
auto versionChallenge = ClientServices::LoginConnection()->GetVersionChallenge();
|
||||||
ChecksumExecutables(versionChallenge, VERSION_CHALLENGE_LEN, versionChecksum);
|
ChecksumExecutables(versionChallenge, LOGIN_VERSION_CHALLENGE_LEN, versionChecksum);
|
||||||
|
|
||||||
ClientServices::LoginConnection()->ProveVersion(versionChecksum);
|
ClientServices::LoginConnection()->ProveVersion(versionChecksum);
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
#define GLUE_C_GLUE_MGR_HPP
|
#define GLUE_C_GLUE_MGR_HPP
|
||||||
|
|
||||||
#include "event/Event.hpp"
|
#include "event/Event.hpp"
|
||||||
|
#include "net/Login.hpp"
|
||||||
#include "net/Types.hpp"
|
#include "net/Types.hpp"
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
class CDataStore;
|
class CDataStore;
|
||||||
class CSimpleTop;
|
class CSimpleTop;
|
||||||
|
|||||||
@ -3,5 +3,6 @@
|
|||||||
|
|
||||||
#include "net/login/BattlenetLogin.hpp"
|
#include "net/login/BattlenetLogin.hpp"
|
||||||
#include "net/login/GruntLogin.hpp"
|
#include "net/login/GruntLogin.hpp"
|
||||||
|
#include "net/login/Types.hpp"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -3,76 +3,6 @@
|
|||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#define VERSION_CHALLENGE_LEN 16
|
|
||||||
#define VERSION_CHECKSUM_LEN 20
|
|
||||||
|
|
||||||
enum LOGIN_RESULT {
|
|
||||||
LOGIN_OK = 0,
|
|
||||||
LOGIN_INVALID_CHALLENGE_MESSAGE = 1,
|
|
||||||
LOGIN_SRP_ERROR = 2,
|
|
||||||
LOGIN_INVALID_PROOF_MESSAGE = 3,
|
|
||||||
LOGIN_BAD_SERVER_PROOF = 4,
|
|
||||||
LOGIN_INVALID_RECODE_MESSAGE = 5,
|
|
||||||
LOGIN_BAD_SERVER_RECODE_PROOF = 6,
|
|
||||||
LOGIN_UNKNOWN_ACCOUNT = 7,
|
|
||||||
LOGIN_UNKNOWN_ACCOUNT_PIN = 8,
|
|
||||||
LOGIN_UNKNOWN_ACCOUNT_CALL = 9,
|
|
||||||
LOGIN_INCORRECT_PASSWORD = 10,
|
|
||||||
LOGIN_FAILED = 11,
|
|
||||||
LOGIN_SERVER_DOWN = 12,
|
|
||||||
LOGIN_BANNED = 13,
|
|
||||||
LOGIN_BADVERSION = 14,
|
|
||||||
LOGIN_ALREADYONLINE = 15,
|
|
||||||
LOGIN_NOTIME = 16,
|
|
||||||
LOGIN_DBBUSY = 17,
|
|
||||||
LOGIN_SUSPENDED = 18,
|
|
||||||
LOGIN_PARENTALCONTROL = 19,
|
|
||||||
LOGIN_LOCKED_ENFORCED = 20,
|
|
||||||
LOGIN_RESULT_21 = 21, // DISCONNECTED
|
|
||||||
LOGIN_ACCOUNT_CONVERTED = 22,
|
|
||||||
LOGIN_ANTI_INDULGENCE = 23,
|
|
||||||
LOGIN_EXPIRED = 24,
|
|
||||||
LOGIN_TRIAL_EXPIRED = 25,
|
|
||||||
LOGIN_NO_GAME_ACCOUNT = 26,
|
|
||||||
LOGIN_AUTH_OUTAGE = 27,
|
|
||||||
LOGIN_GAME_ACCOUNT_LOCKED = 28,
|
|
||||||
LOGIN_NO_BATTLENET_MANAGER = 29,
|
|
||||||
LOGIN_NO_BATTLENET_APPLICATION = 30,
|
|
||||||
LOGIN_MALFORMED_ACCOUNT_NAME = 31,
|
|
||||||
LOGIN_USE_GRUNT = 32,
|
|
||||||
LOGIN_TOO_FAST = 33,
|
|
||||||
LOGIN_CHARGEBACK = 34,
|
|
||||||
LOGIN_IGR_WITHOUT_BNET = 35,
|
|
||||||
LOGIN_UNLOCKABLE_LOCK = 36,
|
|
||||||
LOGIN_CONVERSION_REQUIRED = 37,
|
|
||||||
LOGIN_UNABLE_TO_DOWNLOAD_MODULE = 38,
|
|
||||||
LOGIN_NO_GAME_ACCOUNTS_IN_REGION = 39,
|
|
||||||
LOGIN_ACCOUNT_LOCKED = 40,
|
|
||||||
LOGIN_RESULT_MAX = 41,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum LOGIN_STATE {
|
|
||||||
LOGIN_STATE_INITIALIZED = 0,
|
|
||||||
LOGIN_STATE_CONNECTING = 1,
|
|
||||||
LOGIN_STATE_HANDSHAKING = 2,
|
|
||||||
LOGIN_STATE_AUTHENTICATING = 3,
|
|
||||||
LOGIN_STATE_AUTHENTICATED = 4,
|
|
||||||
LOGIN_STATE_FAILED = 5,
|
|
||||||
LOGIN_STATE_DOWNLOADFILE = 6,
|
|
||||||
LOGIN_STATE_FIRST_SECURITY = 7,
|
|
||||||
LOGIN_STATE_PIN = 8,
|
|
||||||
LOGIN_STATE_PIN_WAIT = 9,
|
|
||||||
LOGIN_STATE_MATRIX = 10,
|
|
||||||
LOGIN_STATE_MATRIX_WAIT = 11,
|
|
||||||
LOGIN_STATE_TOKEN = 12,
|
|
||||||
LOGIN_STATE_TOKEN_WAIT = 13,
|
|
||||||
LOGIN_STATE_CHECKINGVERSIONS = 14,
|
|
||||||
LOGIN_STATE_15 = 15, // RESPONSE_CONNECTED
|
|
||||||
LOGIN_STATE_DISCONNECTED = 16,
|
|
||||||
LOGIN_STATE_SURVEY = 17,
|
|
||||||
LOGIN_STATE_MAX = 18,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum NETMESSAGE {
|
enum NETMESSAGE {
|
||||||
MSG_NULL_ACTION = 0x0000,
|
MSG_NULL_ACTION = 0x0000,
|
||||||
CMSG_BOOTME = 0x0001,
|
CMSG_BOOTME = 0x0001,
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
#include "net/connection/WowConnection.hpp"
|
#include "net/connection/WowConnection.hpp"
|
||||||
#include "net/grunt/ClientResponse.hpp"
|
#include "net/grunt/ClientResponse.hpp"
|
||||||
#include "net/grunt/Command.hpp"
|
#include "net/grunt/Command.hpp"
|
||||||
|
#include "net/login/Types.hpp"
|
||||||
#include "net/srp/SRP6_Random.hpp"
|
#include "net/srp/SRP6_Random.hpp"
|
||||||
#include <common/MD5.hpp>
|
#include <common/MD5.hpp>
|
||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
@ -114,13 +115,13 @@ int32_t Grunt::ClientLink::CmdAuthLogonChallenge(CDataStore& msg) {
|
|||||||
uint8_t* salt;
|
uint8_t* salt;
|
||||||
uint8_t* versionChallenge;
|
uint8_t* versionChallenge;
|
||||||
|
|
||||||
if (!CanRead(msg, largeSafePrimeLen + SALT_LEN + VERSION_CHALLENGE_LEN)) {
|
if (!CanRead(msg, largeSafePrimeLen + SALT_LEN + LOGIN_VERSION_CHALLENGE_LEN)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.GetDataInSitu(reinterpret_cast<void*&>(largeSafePrime), largeSafePrimeLen);
|
msg.GetDataInSitu(reinterpret_cast<void*&>(largeSafePrime), largeSafePrimeLen);
|
||||||
msg.GetDataInSitu(reinterpret_cast<void*&>(salt), SALT_LEN);
|
msg.GetDataInSitu(reinterpret_cast<void*&>(salt), SALT_LEN);
|
||||||
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), VERSION_CHALLENGE_LEN);
|
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), LOGIN_VERSION_CHALLENGE_LEN);
|
||||||
|
|
||||||
uint8_t logonFlags;
|
uint8_t logonFlags;
|
||||||
|
|
||||||
@ -353,7 +354,7 @@ int32_t Grunt::ClientLink::CmdAuthReconnectChallenge(CDataStore& msg) {
|
|||||||
// Reconnect challenge success (result == 0)
|
// Reconnect challenge success (result == 0)
|
||||||
|
|
||||||
msg.GetDataInSitu(reinterpret_cast<void*&>(reconnectKey), RECONNECT_KEY_LEN);
|
msg.GetDataInSitu(reinterpret_cast<void*&>(reconnectKey), RECONNECT_KEY_LEN);
|
||||||
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), VERSION_CHALLENGE_LEN);
|
msg.GetDataInSitu(reinterpret_cast<void*&>(versionChallenge), LOGIN_VERSION_CHALLENGE_LEN);
|
||||||
|
|
||||||
if (!msg.IsValid()) {
|
if (!msg.IsValid()) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -645,7 +646,7 @@ void Grunt::ClientLink::ProveVersion(const uint8_t* versionChecksum) {
|
|||||||
|
|
||||||
SHA1_Init(&sha1);
|
SHA1_Init(&sha1);
|
||||||
SHA1_Update(&sha1, this->m_srpClient.clientPublicKey, sizeof(this->m_srpClient.clientPublicKey));
|
SHA1_Update(&sha1, this->m_srpClient.clientPublicKey, sizeof(this->m_srpClient.clientPublicKey));
|
||||||
SHA1_Update(&sha1, versionChecksum, VERSION_CHECKSUM_LEN);
|
SHA1_Update(&sha1, versionChecksum, LOGIN_VERSION_CHECKSUM_LEN);
|
||||||
SHA1_Final(clientVersionProof, &sha1);
|
SHA1_Final(clientVersionProof, &sha1);
|
||||||
|
|
||||||
command.PutData(clientVersionProof, sizeof(clientVersionProof));
|
command.PutData(clientVersionProof, sizeof(clientVersionProof));
|
||||||
@ -695,7 +696,7 @@ void Grunt::ClientLink::ProveVersion(const uint8_t* versionChecksum) {
|
|||||||
|
|
||||||
SHA1_Init(&sha1);
|
SHA1_Init(&sha1);
|
||||||
SHA1_Update(&sha1, clientSalt, sizeof(clientSalt));
|
SHA1_Update(&sha1, clientSalt, sizeof(clientSalt));
|
||||||
SHA1_Update(&sha1, versionChecksum, VERSION_CHECKSUM_LEN);
|
SHA1_Update(&sha1, versionChecksum, LOGIN_VERSION_CHECKSUM_LEN);
|
||||||
SHA1_Final(clientVersionProof, &sha1);
|
SHA1_Final(clientVersionProof, &sha1);
|
||||||
|
|
||||||
command.PutData(clientVersionProof, sizeof(clientVersionProof));
|
command.PutData(clientVersionProof, sizeof(clientVersionProof));
|
||||||
|
|||||||
@ -2,10 +2,12 @@
|
|||||||
#define NET_GRUNT_CLIENT_RESPONSE_HPP
|
#define NET_GRUNT_CLIENT_RESPONSE_HPP
|
||||||
|
|
||||||
#include "net/grunt/Grunt.hpp"
|
#include "net/grunt/Grunt.hpp"
|
||||||
#include "net/Types.hpp"
|
#include "net/login/Types.hpp"
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
class CDataStore;
|
class CDataStore;
|
||||||
class LoginResponse;
|
class LoginResponse;
|
||||||
|
struct NETADDR;
|
||||||
|
|
||||||
class Grunt::ClientResponse {
|
class Grunt::ClientResponse {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -96,7 +96,7 @@ const uint8_t* GruntLogin::GetVersionChallenge() {
|
|||||||
void GruntLogin::GetVersionProof(const uint8_t* versionChallenge) {
|
void GruntLogin::GetVersionProof(const uint8_t* versionChallenge) {
|
||||||
if (this->IsReconnect()) {
|
if (this->IsReconnect()) {
|
||||||
// During reconnect, version challenge is ignored and version checksum is zeroed out
|
// During reconnect, version challenge is ignored and version checksum is zeroed out
|
||||||
uint8_t versionChecksum[VERSION_CHECKSUM_LEN] = {};
|
uint8_t versionChecksum[LOGIN_VERSION_CHECKSUM_LEN] = {};
|
||||||
|
|
||||||
this->m_clientLink->ProveVersion(versionChecksum);
|
this->m_clientLink->ProveVersion(versionChecksum);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -4,12 +4,12 @@
|
|||||||
#include "net/grunt/ClientResponse.hpp"
|
#include "net/grunt/ClientResponse.hpp"
|
||||||
#include "net/grunt/Grunt.hpp"
|
#include "net/grunt/Grunt.hpp"
|
||||||
#include "net/login/Login.hpp"
|
#include "net/login/Login.hpp"
|
||||||
#include "net/Types.hpp"
|
#include "net/login/Types.hpp"
|
||||||
|
|
||||||
class GruntLogin : public Login {
|
class GruntLogin : public Login {
|
||||||
public:
|
public:
|
||||||
// Member variables
|
// Member variables
|
||||||
uint8_t m_versionChallenge[VERSION_CHALLENGE_LEN];
|
uint8_t m_versionChallenge[LOGIN_VERSION_CHALLENGE_LEN];
|
||||||
Grunt::ClientLink* m_clientLink = nullptr;
|
Grunt::ClientLink* m_clientLink = nullptr;
|
||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#ifndef NET_LOGIN_LOGIN_RESPONSE_HPP
|
#ifndef NET_LOGIN_LOGIN_RESPONSE_HPP
|
||||||
#define NET_LOGIN_LOGIN_RESPONSE_HPP
|
#define NET_LOGIN_LOGIN_RESPONSE_HPP
|
||||||
|
|
||||||
|
#include "net/login/Types.hpp"
|
||||||
#include "net/Types.hpp"
|
#include "net/Types.hpp"
|
||||||
#include <storm/Array.hpp>
|
#include <storm/Array.hpp>
|
||||||
|
|
||||||
|
|||||||
74
src/net/login/Types.hpp
Normal file
74
src/net/login/Types.hpp
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#ifndef NET_LOGIN_TYPES_HPP
|
||||||
|
#define NET_LOGIN_TYPES_HPP
|
||||||
|
|
||||||
|
#define LOGIN_VERSION_CHALLENGE_LEN 16
|
||||||
|
#define LOGIN_VERSION_CHECKSUM_LEN 20
|
||||||
|
|
||||||
|
enum LOGIN_RESULT {
|
||||||
|
LOGIN_OK = 0,
|
||||||
|
LOGIN_INVALID_CHALLENGE_MESSAGE = 1,
|
||||||
|
LOGIN_SRP_ERROR = 2,
|
||||||
|
LOGIN_INVALID_PROOF_MESSAGE = 3,
|
||||||
|
LOGIN_BAD_SERVER_PROOF = 4,
|
||||||
|
LOGIN_INVALID_RECODE_MESSAGE = 5,
|
||||||
|
LOGIN_BAD_SERVER_RECODE_PROOF = 6,
|
||||||
|
LOGIN_UNKNOWN_ACCOUNT = 7,
|
||||||
|
LOGIN_UNKNOWN_ACCOUNT_PIN = 8,
|
||||||
|
LOGIN_UNKNOWN_ACCOUNT_CALL = 9,
|
||||||
|
LOGIN_INCORRECT_PASSWORD = 10,
|
||||||
|
LOGIN_FAILED = 11,
|
||||||
|
LOGIN_SERVER_DOWN = 12,
|
||||||
|
LOGIN_BANNED = 13,
|
||||||
|
LOGIN_BADVERSION = 14,
|
||||||
|
LOGIN_ALREADYONLINE = 15,
|
||||||
|
LOGIN_NOTIME = 16,
|
||||||
|
LOGIN_DBBUSY = 17,
|
||||||
|
LOGIN_SUSPENDED = 18,
|
||||||
|
LOGIN_PARENTALCONTROL = 19,
|
||||||
|
LOGIN_LOCKED_ENFORCED = 20,
|
||||||
|
LOGIN_RESULT_21 = 21, // DISCONNECTED
|
||||||
|
LOGIN_ACCOUNT_CONVERTED = 22,
|
||||||
|
LOGIN_ANTI_INDULGENCE = 23,
|
||||||
|
LOGIN_EXPIRED = 24,
|
||||||
|
LOGIN_TRIAL_EXPIRED = 25,
|
||||||
|
LOGIN_NO_GAME_ACCOUNT = 26,
|
||||||
|
LOGIN_AUTH_OUTAGE = 27,
|
||||||
|
LOGIN_GAME_ACCOUNT_LOCKED = 28,
|
||||||
|
LOGIN_NO_BATTLENET_MANAGER = 29,
|
||||||
|
LOGIN_NO_BATTLENET_APPLICATION = 30,
|
||||||
|
LOGIN_MALFORMED_ACCOUNT_NAME = 31,
|
||||||
|
LOGIN_USE_GRUNT = 32,
|
||||||
|
LOGIN_TOO_FAST = 33,
|
||||||
|
LOGIN_CHARGEBACK = 34,
|
||||||
|
LOGIN_IGR_WITHOUT_BNET = 35,
|
||||||
|
LOGIN_UNLOCKABLE_LOCK = 36,
|
||||||
|
LOGIN_CONVERSION_REQUIRED = 37,
|
||||||
|
LOGIN_UNABLE_TO_DOWNLOAD_MODULE = 38,
|
||||||
|
LOGIN_NO_GAME_ACCOUNTS_IN_REGION = 39,
|
||||||
|
LOGIN_ACCOUNT_LOCKED = 40,
|
||||||
|
LOGIN_RESULT_MAX = 41,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum LOGIN_STATE {
|
||||||
|
LOGIN_STATE_INITIALIZED = 0,
|
||||||
|
LOGIN_STATE_CONNECTING = 1,
|
||||||
|
LOGIN_STATE_HANDSHAKING = 2,
|
||||||
|
LOGIN_STATE_AUTHENTICATING = 3,
|
||||||
|
LOGIN_STATE_AUTHENTICATED = 4,
|
||||||
|
LOGIN_STATE_FAILED = 5,
|
||||||
|
LOGIN_STATE_DOWNLOADFILE = 6,
|
||||||
|
LOGIN_STATE_FIRST_SECURITY = 7,
|
||||||
|
LOGIN_STATE_PIN = 8,
|
||||||
|
LOGIN_STATE_PIN_WAIT = 9,
|
||||||
|
LOGIN_STATE_MATRIX = 10,
|
||||||
|
LOGIN_STATE_MATRIX_WAIT = 11,
|
||||||
|
LOGIN_STATE_TOKEN = 12,
|
||||||
|
LOGIN_STATE_TOKEN_WAIT = 13,
|
||||||
|
LOGIN_STATE_CHECKINGVERSIONS = 14,
|
||||||
|
LOGIN_STATE_15 = 15, // RESPONSE_CONNECTED
|
||||||
|
LOGIN_STATE_DISCONNECTED = 16,
|
||||||
|
LOGIN_STATE_SURVEY = 17,
|
||||||
|
LOGIN_STATE_MAX = 18,
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in New Issue
Block a user