[9750] Add structure of SMSG_REDIRECT_CLIENT (0x50D).

Thanks to TOM_RUS for help with research.
This commit is contained in:
XTZGZoReX 2010-04-15 09:11:18 +02:00
parent 5d84dbb492
commit ef979daddc
11 changed files with 51 additions and 11 deletions

View file

@ -35,6 +35,8 @@
#include "BattleGroundMgr.h"
#include "MapManager.h"
#include "SocialMgr.h"
#include "Auth/AuthCrypt.h"
#include "Auth/HMACSHA1.h"
#include "zlib/zlib.h"
/// WorldSession constructor
@ -856,3 +858,22 @@ void WorldSession::SetPlayer( Player *plr )
if(_player)
m_GUIDLow = _player->GetGUIDLow();
}
void WorldSession::SendRedirectClient(std::string& ip, uint16 port)
{
uint32 ip2 = ACE_OS::inet_addr(ip.c_str());
WorldPacket pkt(SMSG_REDIRECT_CLIENT, 4 + 2 + 4 + 20);
pkt << uint32(ip2); // inet_addr(ipstr)
pkt << uint16(port); // port
pkt << uint32(GetLatency()); // latency-related?
HMACSHA1 sha1(20, m_Socket->GetSessionKey().AsByteArray());
sha1.UpdateData((uint8*)&ip2, 4);
sha1.UpdateData((uint8*)&port, 2);
sha1.Finalize();
pkt.append(sha1.GetDigest(), 20); // hmacsha1(ip+port) w/ sessionkey as seed
SendPacket(&pkt);
}