diff --git a/src/event/Types.hpp b/src/event/Types.hpp index 447b520..adb25c8 100644 --- a/src/event/Types.hpp +++ b/src/event/Types.hpp @@ -36,7 +36,7 @@ enum EVENTID { EVENT_ID_26 = 26, EVENT_ID_27 = 27, EVENT_ID_28 = 28, - EVENT_ID_29 = 29, + EVENT_ID_NET_AUTH_CHALLENGE = 29, EVENT_ID_30 = 30, EVENT_ID_31 = 31, EVENT_ID_32 = 32, diff --git a/src/net/connection/NetClient.cpp b/src/net/connection/NetClient.cpp index 62f50c1..aae5007 100644 --- a/src/net/connection/NetClient.cpp +++ b/src/net/connection/NetClient.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -24,7 +25,24 @@ void NETEVENTQUEUE::AddEvent(EVENTID eventId, void* conn, NetClient* client, con } void NetClient::AuthChallengeHandler(WowConnection* conn, CDataStore* msg) { - // TODO + auto challenge = static_cast(SMemAlloc(sizeof(AuthenticationChallenge), __FILE__, __LINE__, 0x0)); + + uint32_t v14; + msg->Get(v14); + + msg->Get(challenge->uint0); + + // TODO calculate client seed? + + if (conn == this->m_serverConnection) { + this->m_netEventQueue->AddEvent(EVENT_ID_NET_AUTH_CHALLENGE, conn, this, challenge, sizeof(AuthenticationChallenge)); + } else if (conn == this->m_redirectConnection) { + // TODO + } else { + conn->Disconnect(); + } + + delete challenge; } void NetClient::Connect(const char* addrStr) { diff --git a/src/net/connection/NetClient.hpp b/src/net/connection/NetClient.hpp index 42dec31..7e745d2 100644 --- a/src/net/connection/NetClient.hpp +++ b/src/net/connection/NetClient.hpp @@ -14,6 +14,12 @@ class WowConnection; typedef int32_t (*MESSAGE_HANDLER)(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg); +struct AuthenticationChallenge { + uint32_t uint0; + uint32_t uint4; + uint64_t uint8; +}; + class NETEVENTQUEUENODE : public TSLinkedNode { public: }; @@ -45,6 +51,7 @@ class NetClient : public WowConnectionResponse { void* m_handlerParams[NUM_MSG_TYPES]; NETEVENTQUEUE* m_netEventQueue = nullptr; WowConnection* m_serverConnection = nullptr; + WowConnection* m_redirectConnection = nullptr; uint32_t m_pingSent = 0; uint32_t m_pingSequence = 0; uint32_t m_latency[16];