From fe4f4d4e33ba04f05b9b316c9a262c5bd35e5b70 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 2 Sep 2014 12:21:26 +0300 Subject: add packet comments into login handler. --- src/net/ea/loginhandler.cpp | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'src/net/ea/loginhandler.cpp') diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index ece10c725..24c9d8e09 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -136,7 +136,7 @@ void LoginHandler::clearWorlds() void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) const { // 0: acc not found, 1: success, 2: password mismatch, 3: pass too short - const uint8_t errMsg = msg.readUInt8(); + const uint8_t errMsg = msg.readUInt8("result code"); // Successful pass change if (errMsg == 1) { @@ -171,7 +171,7 @@ void LoginHandler::procecessCharPasswordResponse(Net::MessageIn &msg) const void LoginHandler::processUpdateHost(Net::MessageIn &msg) { - const int len = msg.readInt16() - 4; + const int len = msg.readInt16("len") - 4; mUpdateHost = msg.readString(len); if (!checkPath(mUpdateHost)) @@ -187,37 +187,35 @@ void LoginHandler::processUpdateHost(Net::MessageIn &msg) void LoginHandler::processLoginData(Net::MessageIn &msg) { - // Skip the length word - msg.skip(2); // size + msg.skip(2, "len"); clearWorlds(); const int worldCount = (msg.getLength() - 47) / 32; - mToken.session_ID1 = msg.readInt32(); - mToken.account_ID = msg.readInt32(); - mToken.session_ID2 = msg.readInt32(); - msg.skip(4); // old ip - loginData.lastLogin = msg.readString(24); - msg.skip(2); // 0 unused bytes + mToken.session_ID1 = msg.readInt32("session id1"); + mToken.account_ID = msg.readInt32("accound id"); + mToken.session_ID2 = msg.readInt32("session id2"); + msg.readInt32("old ip"); + loginData.lastLogin = msg.readString(24, "last login"); + msg.skip(2, "unused"); -// msg.skip(30); // unknown // reserve bits for future usage mToken.sex = Being::intToGender(static_cast( - msg.readUInt8() & 3U)); + msg.readUInt8("gender") & 3U)); for (int i = 0; i < worldCount; i++) { WorldInfo *const world = new WorldInfo; - world->address = msg.readInt32(); - world->port = msg.readInt16(); - world->name = msg.readString(20); - world->online_users = msg.readInt16(); + world->address = msg.readInt32("ip address"); + world->port = msg.readInt16("port"); + world->name = msg.readString(20, "name"); + world->online_users = msg.readInt16("online number"); config.setValue("updatehost", mUpdateHost); world->updateHost = mUpdateHost; - msg.skip(2); // maintenance - msg.skip(2); // new + msg.skip(2, "maintenance"); + msg.skip(2, "new"); logger->log("Network: Server: %s (%s:%d)", world->name.c_str(), ipToString(world->address), world->port); @@ -229,7 +227,7 @@ void LoginHandler::processLoginData(Net::MessageIn &msg) void LoginHandler::processLoginError(Net::MessageIn &msg) const { - const uint8_t code = msg.readUInt8(); + const uint8_t code = msg.readUInt8("error"); logger->log("Login::error code: %u", static_cast(code)); switch (code) -- cgit v1.2.3-70-g09d2