summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-02 12:21:26 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:55 +0300
commitfe4f4d4e33ba04f05b9b316c9a262c5bd35e5b70 (patch)
treede81575c0c3889a4362b3ebcd9c65d4d1f54f28a /src/net
parent3f483c84d47d872b51406d841d92ac50f08a190c (diff)
downloadmanaverse-fe4f4d4e33ba04f05b9b316c9a262c5bd35e5b70.tar.gz
manaverse-fe4f4d4e33ba04f05b9b316c9a262c5bd35e5b70.tar.bz2
manaverse-fe4f4d4e33ba04f05b9b316c9a262c5bd35e5b70.tar.xz
manaverse-fe4f4d4e33ba04f05b9b316c9a262c5bd35e5b70.zip
add packet comments into login handler.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/ea/loginhandler.cpp36
-rw-r--r--src/net/eathena/loginhandler.cpp8
-rw-r--r--src/net/tmwa/loginhandler.cpp40
3 files changed, 41 insertions, 43 deletions
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<uint8_t>(
- 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<unsigned int>(code));
switch (code)
diff --git a/src/net/eathena/loginhandler.cpp b/src/net/eathena/loginhandler.cpp
index 00d6e3d40..d031a9f13 100644
--- a/src/net/eathena/loginhandler.cpp
+++ b/src/net/eathena/loginhandler.cpp
@@ -161,13 +161,13 @@ void LoginHandler::requestUpdateHosts()
{
MessageOut outMsg(CMSG_SEND_CLIENT_INFO);
outMsg.writeInt8(CLIENT_PROTOCOL_VERSION);
- outMsg.writeInt8(0); // unused
+ outMsg.writeInt8(0, "unused");
}
void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const
{
- const int len = msg.readInt16() - 4;
- const std::string updateHost = msg.readString(len);
+ const int len = msg.readInt16("len") - 4;
+ const std::string updateHost = msg.readString(len, "host");
splitToStringVector(loginData.updateHosts, updateHost, '|');
FOR_EACH (StringVectIter, it, loginData.updateHosts)
@@ -189,7 +189,7 @@ void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const
void LoginHandler::processLoginError2(Net::MessageIn &msg) const
{
- const uint32_t code = msg.readInt32();
+ const uint32_t code = msg.readInt32("error");
logger->log("Login::error code: %u", code);
switch (code)
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index 4f589bbb9..f60a7d934 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -132,8 +132,8 @@ void LoginHandler::changePassword(const std::string &restrict username
const
{
MessageOut outMsg(CMSG_CHAR_PASSWORD_CHANGE);
- outMsg.writeStringNoLog(oldPassword, 24);
- outMsg.writeStringNoLog(newPassword, 24);
+ outMsg.writeStringNoLog(oldPassword, 24, "old password");
+ outMsg.writeStringNoLog(newPassword, 24, "new password");
}
void LoginHandler::sendLoginRegister(const std::string &restrict username,
@@ -143,9 +143,9 @@ void LoginHandler::sendLoginRegister(const std::string &restrict username,
if (email.empty())
{
MessageOut outMsg(CMSG_LOGIN_REGISTER);
- outMsg.writeInt32(0); // client version
- outMsg.writeString(username, 24);
- outMsg.writeStringNoLog(password, 24);
+ outMsg.writeInt32(0, "client version");
+ outMsg.writeString(username, 24, "login");
+ outMsg.writeStringNoLog(password, 24, "password");
/*
* eAthena calls the last byte "client version 2", but it isn't used at
@@ -153,14 +153,14 @@ void LoginHandler::sendLoginRegister(const std::string &restrict username,
* 0 - can handle the 0x63 "update host" packet
* 1 - defaults to the first char-server (instead of the last)
*/
- outMsg.writeInt8(0x03);
+ outMsg.writeInt8(0x03, "flags");
}
else
{
MessageOut outMsg(CMSG_LOGIN_REGISTER2);
- outMsg.writeInt32(0); // client version
- outMsg.writeString(username, 24);
- outMsg.writeStringNoLog(password, 24);
+ outMsg.writeInt32(0, "client version");
+ outMsg.writeString(username, 24, "login");
+ outMsg.writeStringNoLog(password, 24, "password");
/*
* eAthena calls the last byte "client version 2", but it isn't used at
@@ -168,8 +168,8 @@ void LoginHandler::sendLoginRegister(const std::string &restrict username,
* 0 - can handle the 0x63 "update host" packet
* 1 - defaults to the first char-server (instead of the last)
*/
- outMsg.writeInt8(0x03);
- outMsg.writeString(email, 24);
+ outMsg.writeInt8(0x03, "flags");
+ outMsg.writeString(email, 24, "email");
}
}
@@ -182,7 +182,7 @@ void LoginHandler::requestUpdateHosts()
{
MessageOut outMsg(CMSG_SEND_CLIENT_INFO);
outMsg.writeInt8(CLIENT_PROTOCOL_VERSION);
- outMsg.writeInt8(0); // unused
+ outMsg.writeInt8(0, "unused");
}
void LoginHandler::processServerVersion(Net::MessageIn &msg)
@@ -193,31 +193,31 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg)
const uint8_t b4 = msg.readUInt8(); // L
if (b1 == 255 && b2 == 'E' && b3 == 'V' && b4 == 'L')
{
- const unsigned int options = msg.readUInt8();
+ const unsigned int options = msg.readUInt8("options");
mRegistrationEnabled = options & FLAG_REGISTRATION;
- msg.skip(2); // 0 unused
- serverVersion = msg.readUInt8();
+ msg.skip(2, "unused");
+ serverVersion = msg.readUInt8("server version");
tmwServerVersion = 0;
if (serverVersion >= 5)
requestUpdateHosts();
}
else if (b1 == 255)
{ // old TMWA
- const unsigned int options = msg.readInt32();
+ const unsigned int options = msg.readInt32("options");
mRegistrationEnabled = options & FLAG_REGISTRATION;
serverVersion = 0;
tmwServerVersion = 0;
}
else if (b1 >= 0x0d)
{ // new TMWA
- const unsigned int options = msg.readInt32();
+ const unsigned int options = msg.readInt32("options");
mRegistrationEnabled = options & FLAG_REGISTRATION;
serverVersion = 0;
tmwServerVersion = (b1 << 16) | (b2 << 8) | b3;
}
else
{ // eAthena
- const unsigned int options = msg.readInt32();
+ const unsigned int options = msg.readInt32("options");
mRegistrationEnabled = options & FLAG_REGISTRATION;
serverVersion = 0;
tmwServerVersion = 0;
@@ -241,8 +241,8 @@ void LoginHandler::processServerVersion(Net::MessageIn &msg)
void LoginHandler::processUpdateHost2(Net::MessageIn &msg) const
{
- const int len = msg.readInt16() - 4;
- const std::string updateHost = msg.readString(len);
+ const int len = msg.readInt16("len") - 4;
+ const std::string updateHost = msg.readString(len, "host");
splitToStringVector(loginData.updateHosts, updateHost, '|');
FOR_EACH (StringVectIter, it, loginData.updateHosts)