mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
The login response's stamps were a fixed list: START and CLIENT_OS at the
start, an ERROR or two, and IM_LOGIN_START / WORLD_COMMUNICATION_FINISH
appended to every response whatever happened. Now a Stamps list (new
dNet/Stamps.{h,cpp}: eStamps, Stamp and Stamps with Serialize /
Deserialize in the login response's layout, so server messages can carry
it too) is created when the login request arrives, and each step adds its
own stamp, with the time, where it happens: the request read (value: the
client's OS), the account lookup (found or not), the password check,
failed checks, the closed server and play key checks, database writes,
asking master for a world, master's answer, handing the session key to
master, and sending the player on. The response serializes whatever was
stamped; the auth server logs the list like the client does.
What the client does with stamps (1.10.64): PacketHandler_MSG_CLIENT_
LOGIN_RESPONSE @ 00b32f90 reads them (LoginResponse::ReadStamps @ 005ed3c0,
count = (size - 4) / 16) and only logs each with its name from
StampLookup @ 017e6e88 (the 39 eStamps names) and its time relative to the
first and previous stamp. Documented in Stamps.h.
Behaviour change: on success, master gets the session key just before the
client gets the response instead of just after, so the handoff can be
stamped (and master knows the key before the client can reach a world).
The client-facing layout is unchanged; tests pin the stamp bytes, check
the steps of a failed login in order, and round trip the list.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
#ifndef AUTHPACKETS_H
|
|
#define AUTHPACKETS_H
|
|
|
|
#define _VARIADIC_MAX 10
|
|
#include "dCommonVars.h"
|
|
#include "dNetCommon.h"
|
|
#include "magic_enum.hpp"
|
|
#include "BitStreamUtils.h"
|
|
#include "ClientPackets.h"
|
|
#include "MessageType/Auth.h"
|
|
|
|
enum class eLoginResponse : uint8_t;
|
|
enum class ServiceType : uint16_t;
|
|
class dServer;
|
|
|
|
enum class ClientOS : uint8_t {
|
|
UNKNOWN,
|
|
WINDOWS,
|
|
MACOS
|
|
};
|
|
|
|
enum class LanguageCodeID : uint16_t {
|
|
de_DE = 0x0407,
|
|
en_US = 0x0409,
|
|
en_GB = 0x0809
|
|
};
|
|
|
|
template <>
|
|
struct magic_enum::customize::enum_range<LanguageCodeID> {
|
|
static constexpr int min = 1031;
|
|
static constexpr int max = 2057;
|
|
};
|
|
|
|
|
|
namespace AuthPackets {
|
|
// Client -> auth server. The username and password, plus a description of the client's machine.
|
|
struct LoginRequest : public LUBitStream {
|
|
// Set by the dispatcher before Deserialize and Handle.
|
|
SystemAddress sysAddr = UNASSIGNED_SYSTEM_ADDRESS;
|
|
|
|
LUWString username{ 33 };
|
|
LUWString password{ 41 };
|
|
LanguageCodeID localeID{};
|
|
ClientOS clientOS{};
|
|
LUWString memoryStats{ 256 };
|
|
LUWString videoCard{ 128 };
|
|
// Processor
|
|
uint32_t numberOfProcessors{};
|
|
uint32_t processorType{};
|
|
uint16_t processorLevel{};
|
|
uint16_t processorRevision{};
|
|
// OS version
|
|
uint32_t osVersionInfoSize{};
|
|
uint32_t majorVersion{};
|
|
uint32_t minorVersion{};
|
|
uint32_t buildNumber{};
|
|
uint32_t platformID{};
|
|
|
|
LoginRequest() : LUBitStream(ServiceType::AUTH, MessageType::Auth::LOGIN_REQUEST) {}
|
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
|
void Handle() override;
|
|
};
|
|
|
|
// Handles a ServiceType::AUTH packet whose header has already been read from inStream.
|
|
void Handle(RakNet::BitStream& inStream, const SystemAddress& sysAddr, uint32_t packetID);
|
|
|
|
// Answers a login with a ClientPackets::LoginResponse filled from the server's settings (event gating, client
|
|
// version) and a new session key; on success also registers that session key with the master server.
|
|
void SendLoginResponse(dServer* server, const SystemAddress& sysAddr, eLoginResponse responseCode, const std::string& errorMsg, const std::string& wServerIP, uint16_t wServerPort, std::string username, Stamps& stamps);
|
|
void LoadClaimCodes();
|
|
}
|
|
|
|
#endif // AUTHPACKETS_H
|