diff --git a/src/realmd/AuthCodes.h b/src/realmd/AuthCodes.h index c64898a47..4071a7425 100644 --- a/src/realmd/AuthCodes.h +++ b/src/realmd/AuthCodes.h @@ -62,7 +62,7 @@ enum AuthResult WOW_FAIL_BANNED = 0x03, ///< This account has been closed and is no longer available for use. Please go to /banned.html for further information. WOW_FAIL_UNKNOWN_ACCOUNT = 0x04, ///< The information you have entered is not valid. Please check the spelling of the account name and password. If you need help in retrieving a lost or stolen password, see for more information WOW_FAIL_INCORRECT_PASSWORD = 0x05, ///< The information you have entered is not valid. Please check the spelling of the account name and password. If you need help in retrieving a lost or stolen password, see for more information - // client reject next login attempts after this error, so in code used WOW_FAIL_UNKNOWN_ACCOUNT for both cases + // client reject next login attempts after this error, so in code used WOW_FAIL_UNKNOWN_ACCOUNT for both cases WOW_FAIL_ALREADY_ONLINE = 0x06, ///< This account is already logged into . Please check the spelling and try again. WOW_FAIL_NO_TIME = 0x07, ///< You have used up your prepaid time for this account. Please purchase more to continue playing WOW_FAIL_DB_BUSY = 0x08, ///< Could not log in to at this time. Please try again later. diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index 2e48344aa..0054080a5 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -148,14 +148,14 @@ typedef struct XFER_INIT uint8 fileName[5]; // fileName[fileNameLen] uint64 file_size; // file size (bytes) uint8 md5[MD5_DIGEST_LENGTH]; // MD5 -}XFER_INIT; +} XFER_INIT; typedef struct AuthHandler { eAuthCmd cmd; uint32 status; bool (AuthSocket::*handler)(void); -}AuthHandler; +} AuthHandler; // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some paltform #if defined( __GNUC__ ) @@ -194,7 +194,7 @@ AuthSocket::AuthSocket() /// Close patch file descriptor before leaving AuthSocket::~AuthSocket() { - if(patch_ != ACE_INVALID_HANDLE) + if (patch_ != ACE_INVALID_HANDLE) ACE_OS::close(patch_); } @@ -210,7 +210,7 @@ void AuthSocket::OnRead() uint8 _cmd; while (1) { - if(!recv_soft((char *)&_cmd, 1)) + if (!recv_soft((char*)&_cmd, 1)) return; size_t i; @@ -223,12 +223,12 @@ void AuthSocket::OnRead() (_authed && table[i].status == STATUS_AUTHED))) { DEBUG_LOG("[Auth] got data for cmd %u recv length %u", - (uint32)_cmd, (uint32)recv_len()); + (uint32)_cmd, (uint32)recv_len()); if (!(*this.*table[i].handler)()) { DEBUG_LOG("Command handler failed for cmd %u recv length %u", - (uint32)_cmd, (uint32)recv_len()); + (uint32)_cmd, (uint32)recv_len()); return; } @@ -269,17 +269,17 @@ void AuthSocket::_SetVSFields(const std::string& rI) x.SetBinary(sha.GetDigest(), sha.GetLength()); v = g.ModExp(x, N); // No SQL injection (username escaped) - const char *v_hex, *s_hex; + const char* v_hex, *s_hex; v_hex = v.AsHexStr(); s_hex = s.AsHexStr(); - LoginDatabase.PExecute("UPDATE account SET v = '%s', s = '%s' WHERE username = '%s'", v_hex, s_hex, _safelogin.c_str() ); + LoginDatabase.PExecute("UPDATE account SET v = '%s', s = '%s' WHERE username = '%s'", v_hex, s_hex, _safelogin.c_str()); OPENSSL_free((void*)v_hex); OPENSSL_free((void*)s_hex); } void AuthSocket::SendProof(Sha1Hash sha) { - switch(_build) + switch (_build) { case 5875: // 1.12.1 case 6005: // 1.12.2 @@ -290,7 +290,7 @@ void AuthSocket::SendProof(Sha1Hash sha) proof.error = 0; proof.unk2 = 0x00; - send((char *)&proof, sizeof(proof)); + send((char*)&proof, sizeof(proof)); break; } case 8606: // 2.4.3 @@ -309,7 +309,7 @@ void AuthSocket::SendProof(Sha1Hash sha) proof.surveyId = 0x00000000; proof.unkFlags = 0x0000; - send((char *)&proof, sizeof(proof)); + send((char*)&proof, sizeof(proof)); break; } } @@ -326,10 +326,10 @@ bool AuthSocket::_HandleLogonChallenge() std::vector buf; buf.resize(4); - recv((char *)&buf[0], 4); + recv((char*)&buf[0], 4); EndianConvert(*((uint16*)(buf[0]))); - uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; + uint16 remaining = ((sAuthLogonChallenge_C*)&buf[0])->size; DEBUG_LOG("[AuthChallenge] got header, body is %#04x bytes", remaining); if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (recv_len() < remaining)) @@ -338,10 +338,10 @@ bool AuthSocket::_HandleLogonChallenge() //No big fear of memory outage (size is int16, i.e. < 65536) buf.resize(remaining + buf.size() + 1); buf[buf.size() - 1] = 0; - sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0]; + sAuthLogonChallenge_C* ch = (sAuthLogonChallenge_C*)&buf[0]; ///- Read the remaining of the packet - recv((char *)&buf[4], remaining); + recv((char*)&buf[4], remaining); DEBUG_LOG("[AuthChallenge] got full packet, %#04x bytes", ch->size); DEBUG_LOG("[AuthChallenge] name(%d): '%s'", ch->I_len, ch->I); @@ -375,9 +375,9 @@ bool AuthSocket::_HandleLogonChallenge() // No SQL injection possible (paste the IP address as passed by the socket) std::string address = get_remote_address(); LoginDatabase.escape_string(address); - QueryResult *result = LoginDatabase.PQuery("SELECT unbandate FROM ip_banned WHERE " - // permanent still banned - "(unbandate = bandate OR unbandate > UNIX_TIMESTAMP()) AND ip = '%s'", address.c_str()); + QueryResult* result = LoginDatabase.PQuery("SELECT unbandate FROM ip_banned WHERE " + // permanent still banned + "(unbandate = bandate OR unbandate > UNIX_TIMESTAMP()) AND ip = '%s'", address.c_str()); if (result) { pkt << (uint8)WOW_FAIL_BANNED; @@ -389,16 +389,16 @@ bool AuthSocket::_HandleLogonChallenge() ///- Get the account details from the account table // No SQL injection (escaped user name) - result = LoginDatabase.PQuery("SELECT sha_pass_hash,id,locked,last_ip,gmlevel,v,s FROM account WHERE username = '%s'",_safelogin.c_str ()); - if( result ) + result = LoginDatabase.PQuery("SELECT sha_pass_hash,id,locked,last_ip,gmlevel,v,s FROM account WHERE username = '%s'",_safelogin.c_str()); + if (result) { ///- If the IP is 'locked', check that the player comes indeed from the correct IP address bool locked = false; - if((*result)[2].GetUInt8() == 1) // if ip is locked + if ((*result)[2].GetUInt8() == 1) // if ip is locked { DEBUG_LOG("[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), (*result)[3].GetString()); DEBUG_LOG("[AuthChallenge] Player address is '%s'", get_remote_address().c_str()); - if ( strcmp((*result)[3].GetString(),get_remote_address().c_str()) ) + if (strcmp((*result)[3].GetString(),get_remote_address().c_str())) { DEBUG_LOG("[AuthChallenge] Account IP differs"); pkt << (uint8) WOW_FAIL_SUSPENDED; @@ -417,19 +417,19 @@ bool AuthSocket::_HandleLogonChallenge() if (!locked) { ///- If the account is banned, reject the logon attempt - QueryResult *banresult = LoginDatabase.PQuery("SELECT bandate,unbandate FROM account_banned WHERE " - "id = %u AND active = 1 AND (unbandate > UNIX_TIMESTAMP() OR unbandate = bandate)", (*result)[1].GetUInt32()); - if(banresult) + QueryResult* banresult = LoginDatabase.PQuery("SELECT bandate,unbandate FROM account_banned WHERE " + "id = %u AND active = 1 AND (unbandate > UNIX_TIMESTAMP() OR unbandate = bandate)", (*result)[1].GetUInt32()); + if (banresult) { - if((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64()) + if ((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64()) { pkt << (uint8) WOW_FAIL_BANNED; - BASIC_LOG("[AuthChallenge] Banned account %s tries to login!",_login.c_str ()); + BASIC_LOG("[AuthChallenge] Banned account %s tries to login!",_login.c_str()); } else { pkt << (uint8) WOW_FAIL_SUSPENDED; - BASIC_LOG("[AuthChallenge] Temporarily banned account %s tries to login!",_login.c_str ()); + BASIC_LOG("[AuthChallenge] Temporarily banned account %s tries to login!",_login.c_str()); } delete banresult; @@ -446,7 +446,7 @@ bool AuthSocket::_HandleLogonChallenge() DEBUG_LOG("database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str()); // multiply with 2, bytes are stored as hexstring - if(databaseV.size() != s_BYTE_SIZE*2 || databaseS.size() != s_BYTE_SIZE*2) + if (databaseV.size() != s_BYTE_SIZE*2 || databaseS.size() != s_BYTE_SIZE*2) _SetVSFields(rI); else { @@ -477,13 +477,13 @@ bool AuthSocket::_HandleLogonChallenge() uint8 securityFlags = 0; pkt << uint8(securityFlags); // security flags (0x0...0x04) - if(securityFlags & 0x01) // PIN input + if (securityFlags & 0x01) // PIN input { pkt << uint32(0); pkt << uint64(0) << uint64(0); // 16 bytes hash? } - if(securityFlags & 0x02) // Matrix input + if (securityFlags & 0x02) // Matrix input { pkt << uint8(0); pkt << uint8(0); @@ -492,7 +492,7 @@ bool AuthSocket::_HandleLogonChallenge() pkt << uint64(0); } - if(securityFlags & 0x04) // Security token input + if (securityFlags & 0x04) // Security token input { pkt << uint8(1); } @@ -501,10 +501,10 @@ bool AuthSocket::_HandleLogonChallenge() _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; _localizationName.resize(4); - for(int i = 0; i < 4; ++i) + for (int i = 0; i < 4; ++i) _localizationName[i] = ch->country[4-i-1]; - BASIC_LOG("[AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", _login.c_str (), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName)); + BASIC_LOG("[AuthChallenge] account %s is using '%c%c%c%c' locale (%u)", _login.c_str(), ch->country[3], ch->country[2], ch->country[1], ch->country[0], GetLocaleByName(_localizationName)); } } delete result; @@ -524,14 +524,14 @@ bool AuthSocket::_HandleLogonProof() DEBUG_LOG("Entering _HandleLogonProof"); ///- Read the packet sAuthLogonProof_C lp; - if(!recv((char *)&lp, sizeof(sAuthLogonProof_C))) + if (!recv((char*)&lp, sizeof(sAuthLogonProof_C))) return false; ///- Check if the client has one of the expected version numbers bool valid_version = FindBuildInfo(_build) != NULL; ///
  • If the client has no valid version - if(!valid_version) + if (!valid_version) { if (this->patch_ != ACE_INVALID_HANDLE) return false; @@ -672,7 +672,7 @@ bool AuthSocket::_HandleLogonProof() ///- Update the sessionkey, last_ip, last login time and reset number of failed logins in the account table for this account // No SQL injection (escaped user name) and IP address as received by socket const char* K_hex = K.AsHexStr(); - LoginDatabase.PExecute("UPDATE account SET sessionkey = '%s', last_ip = '%s', last_login = NOW(), locale = '%u', failed_logins = 0 WHERE username = '%s'", K_hex, get_remote_address().c_str(), GetLocaleByName(_localizationName), _safelogin.c_str() ); + LoginDatabase.PExecute("UPDATE account SET sessionkey = '%s', last_ip = '%s', last_login = NOW(), locale = '%u', failed_logins = 0 WHERE username = '%s'", K_hex, get_remote_address().c_str(), GetLocaleByName(_localizationName), _safelogin.c_str()); OPENSSL_free((void*)K_hex); ///- Finish SRP6 and send the final result to the client @@ -698,40 +698,40 @@ bool AuthSocket::_HandleLogonProof() char data[2] = { CMD_AUTH_LOGON_PROOF, WOW_FAIL_UNKNOWN_ACCOUNT}; send(data, sizeof(data)); } - BASIC_LOG("[AuthChallenge] account %s tried to login with wrong password!",_login.c_str ()); + BASIC_LOG("[AuthChallenge] account %s tried to login with wrong password!",_login.c_str()); uint32 MaxWrongPassCount = sConfig.GetIntDefault("WrongPass.MaxCount", 0); - if(MaxWrongPassCount > 0) + if (MaxWrongPassCount > 0) { //Increment number of failed logins by one and if it reaches the limit temporarily ban that account or IP LoginDatabase.PExecute("UPDATE account SET failed_logins = failed_logins + 1 WHERE username = '%s'",_safelogin.c_str()); - if(QueryResult *loginfail = LoginDatabase.PQuery("SELECT id, failed_logins FROM account WHERE username = '%s'", _safelogin.c_str())) + if (QueryResult* loginfail = LoginDatabase.PQuery("SELECT id, failed_logins FROM account WHERE username = '%s'", _safelogin.c_str())) { Field* fields = loginfail->Fetch(); uint32 failed_logins = fields[1].GetUInt32(); - if( failed_logins >= MaxWrongPassCount ) + if (failed_logins >= MaxWrongPassCount) { uint32 WrongPassBanTime = sConfig.GetIntDefault("WrongPass.BanTime", 600); bool WrongPassBanType = sConfig.GetBoolDefault("WrongPass.BanType", false); - if(WrongPassBanType) + if (WrongPassBanType) { uint32 acc_id = fields[0].GetUInt32(); LoginDatabase.PExecute("INSERT INTO account_banned VALUES ('%u',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+'%u','MaNGOS realmd','Failed login autoban',1)", - acc_id, WrongPassBanTime); + acc_id, WrongPassBanTime); BASIC_LOG("[AuthChallenge] account %s got banned for '%u' seconds because it failed to authenticate '%u' times", - _login.c_str(), WrongPassBanTime, failed_logins); + _login.c_str(), WrongPassBanTime, failed_logins); } else { std::string current_ip = get_remote_address(); LoginDatabase.escape_string(current_ip); LoginDatabase.PExecute("INSERT INTO ip_banned VALUES ('%s',UNIX_TIMESTAMP(),UNIX_TIMESTAMP()+'%u','MaNGOS realmd','Failed login autoban')", - current_ip.c_str(), WrongPassBanTime); + current_ip.c_str(), WrongPassBanTime); BASIC_LOG("[AuthChallenge] IP %s got banned for '%u' seconds because account %s failed to authenticate '%u' times", - current_ip.c_str(), WrongPassBanTime, _login.c_str(), failed_logins); + current_ip.c_str(), WrongPassBanTime, _login.c_str(), failed_logins); } } delete loginfail; @@ -752,10 +752,10 @@ bool AuthSocket::_HandleReconnectChallenge() std::vector buf; buf.resize(4); - recv((char *)&buf[0], 4); + recv((char*)&buf[0], 4); EndianConvert(*((uint16*)(buf[0]))); - uint16 remaining = ((sAuthLogonChallenge_C *)&buf[0])->size; + uint16 remaining = ((sAuthLogonChallenge_C*)&buf[0])->size; DEBUG_LOG("[ReconnectChallenge] got header, body is %#04x bytes", remaining); if ((remaining < sizeof(sAuthLogonChallenge_C) - buf.size()) || (recv_len() < remaining)) @@ -764,10 +764,10 @@ bool AuthSocket::_HandleReconnectChallenge() //No big fear of memory outage (size is int16, i.e. < 65536) buf.resize(remaining + buf.size() + 1); buf[buf.size() - 1] = 0; - sAuthLogonChallenge_C *ch = (sAuthLogonChallenge_C*)&buf[0]; + sAuthLogonChallenge_C* ch = (sAuthLogonChallenge_C*)&buf[0]; ///- Read the remaining of the packet - recv((char *)&buf[4], remaining); + recv((char*)&buf[4], remaining); DEBUG_LOG("[ReconnectChallenge] got full packet, %#04x bytes", ch->size); DEBUG_LOG("[ReconnectChallenge] name(%d): '%s'", ch->I_len, ch->I); @@ -779,7 +779,7 @@ bool AuthSocket::_HandleReconnectChallenge() EndianConvert(ch->build); _build = ch->build; - QueryResult *result = LoginDatabase.PQuery ("SELECT sessionkey FROM account WHERE username = '%s'", _safelogin.c_str ()); + QueryResult* result = LoginDatabase.PQuery("SELECT sessionkey FROM account WHERE username = '%s'", _safelogin.c_str()); // Stop if the account is not found if (!result) @@ -789,8 +789,8 @@ bool AuthSocket::_HandleReconnectChallenge() return false; } - Field* fields = result->Fetch (); - K.SetHexStr (fields[0].GetString ()); + Field* fields = result->Fetch(); + K.SetHexStr(fields[0].GetString()); delete result; ///- Sending response @@ -810,7 +810,7 @@ bool AuthSocket::_HandleReconnectProof() DEBUG_LOG("Entering _HandleReconnectProof"); ///- Read the packet sAuthReconnectProof_C lp; - if(!recv((char *)&lp, sizeof(sAuthReconnectProof_C))) + if (!recv((char*)&lp, sizeof(sAuthReconnectProof_C))) return false; if (_login.empty() || !_reconnectProof.GetNumBytes() || !K.GetNumBytes()) @@ -859,8 +859,8 @@ bool AuthSocket::_HandleRealmList() ///- Get the user id (else close the connection) // No SQL injection (escaped user name) - QueryResult *result = LoginDatabase.PQuery("SELECT id,sha_pass_hash FROM account WHERE username = '%s'",_safelogin.c_str()); - if(!result) + QueryResult* result = LoginDatabase.PQuery("SELECT id,sha_pass_hash FROM account WHERE username = '%s'",_safelogin.c_str()); + if (!result) { sLog.outError("[ERROR] user %s tried to login and we cannot find him in the database.",_login.c_str()); close_connection(); @@ -888,9 +888,9 @@ bool AuthSocket::_HandleRealmList() return true; } -void AuthSocket::LoadRealmlist(ByteBuffer &pkt, uint32 acctid) +void AuthSocket::LoadRealmlist(ByteBuffer& pkt, uint32 acctid) { - switch(_build) + switch (_build) { case 5875: // 1.12.1 case 6005: // 1.12.2 @@ -898,15 +898,15 @@ void AuthSocket::LoadRealmlist(ByteBuffer &pkt, uint32 acctid) pkt << uint32(0); // unused value pkt << uint8(sRealmList.size()); - for(RealmList::RealmMap::const_iterator i = sRealmList.begin(); i != sRealmList.end(); ++i) + for (RealmList::RealmMap::const_iterator i = sRealmList.begin(); i != sRealmList.end(); ++i) { uint8 AmountOfCharacters; // No SQL injection. id of realm is controlled by the database. - QueryResult *result = LoginDatabase.PQuery( "SELECT numchars FROM realmcharacters WHERE realmid = '%d' AND acctid='%u'", i->second.m_ID, acctid); - if( result ) + QueryResult* result = LoginDatabase.PQuery("SELECT numchars FROM realmcharacters WHERE realmid = '%d' AND acctid='%u'", i->second.m_ID, acctid); + if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); AmountOfCharacters = fields[0].GetUInt8(); delete result; } @@ -959,15 +959,15 @@ void AuthSocket::LoadRealmlist(ByteBuffer &pkt, uint32 acctid) pkt << uint32(0); // unused value pkt << uint16(sRealmList.size()); - for(RealmList::RealmMap::const_iterator i = sRealmList.begin(); i != sRealmList.end(); ++i) + for (RealmList::RealmMap::const_iterator i = sRealmList.begin(); i != sRealmList.end(); ++i) { uint8 AmountOfCharacters; // No SQL injection. id of realm is controlled by the database. - QueryResult *result = LoginDatabase.PQuery( "SELECT numchars FROM realmcharacters WHERE realmid = '%d' AND acctid='%u'", i->second.m_ID, acctid); - if( result ) + QueryResult* result = LoginDatabase.PQuery("SELECT numchars FROM realmcharacters WHERE realmid = '%d' AND acctid='%u'", i->second.m_ID, acctid); + if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); AmountOfCharacters = fields[0].GetUInt8(); delete result; } @@ -1021,15 +1021,15 @@ bool AuthSocket::_HandleXferResume() { DEBUG_LOG("Entering _HandleXferResume"); - if(recv_len() < 9) + if (recv_len() < 9) return false; recv_skip(1); uint64 start_pos; - recv((char *)&start_pos, 8); + recv((char*)&start_pos, 8); - if(patch_ == ACE_INVALID_HANDLE) + if (patch_ == ACE_INVALID_HANDLE) { close_connection(); return false; @@ -1037,13 +1037,13 @@ bool AuthSocket::_HandleXferResume() ACE_OFF_T file_size = ACE_OS::filesize(patch_); - if(file_size == -1 || start_pos >= (uint64)file_size) + if (file_size == -1 || start_pos >= (uint64)file_size) { close_connection(); return false; } - if(ACE_OS::lseek(patch_, start_pos, SEEK_SET) == -1) + if (ACE_OS::lseek(patch_, start_pos, SEEK_SET) == -1) { close_connection(); return false; @@ -1083,7 +1083,7 @@ void AuthSocket::InitPatch() patch_ = ACE_INVALID_HANDLE; - if(handler->open() == -1) + if (handler->open() == -1) { handler->close(); close_connection(); diff --git a/src/realmd/AuthSocket.h b/src/realmd/AuthSocket.h index 7416df89f..9e5ab0641 100644 --- a/src/realmd/AuthSocket.h +++ b/src/realmd/AuthSocket.h @@ -42,7 +42,7 @@ class AuthSocket: public BufferedSocket void OnAccept(); void OnRead(); void SendProof(Sha1Hash sha); - void LoadRealmlist(ByteBuffer &pkt, uint32 acctid); + void LoadRealmlist(ByteBuffer& pkt, uint32 acctid); bool _HandleLogonChallenge(); bool _HandleLogonProof(); diff --git a/src/realmd/BufferedSocket.cpp b/src/realmd/BufferedSocket.cpp index 5b3811be8..3a6ce7eb9 100644 --- a/src/realmd/BufferedSocket.cpp +++ b/src/realmd/BufferedSocket.cpp @@ -40,14 +40,14 @@ BufferedSocket::BufferedSocket(void): { } -/*virtual*/ int BufferedSocket::open(void * arg) +/*virtual*/ int BufferedSocket::open(void* arg) { - if(Base::open(arg) == -1) + if (Base::open(arg) == -1) return -1; ACE_INET_Addr addr; - if(peer().get_remote_addr(addr) == -1) + if (peer().get_remote_addr(addr) == -1) return -1; char address[1024]; @@ -71,9 +71,9 @@ size_t BufferedSocket::recv_len(void) const return this->input_buffer_.length(); } -bool BufferedSocket::recv_soft(char *buf, size_t len) +bool BufferedSocket::recv_soft(char* buf, size_t len) { - if(this->input_buffer_.length() < len) + if (this->input_buffer_.length() < len) return false; ACE_OS::memcpy(buf, this->input_buffer_.rd_ptr(), len); @@ -81,11 +81,11 @@ bool BufferedSocket::recv_soft(char *buf, size_t len) return true; } -bool BufferedSocket::recv(char *buf, size_t len) +bool BufferedSocket::recv(char* buf, size_t len) { bool ret = this->recv_soft(buf, len); - if(ret) + if (ret) this->recv_skip(len); return ret; @@ -96,26 +96,26 @@ void BufferedSocket::recv_skip(size_t len) this->input_buffer_.rd_ptr(len); } -ssize_t BufferedSocket::noblk_send(ACE_Message_Block &message_block) +ssize_t BufferedSocket::noblk_send(ACE_Message_Block& message_block) { const size_t len = message_block.length(); - if(len == 0) + if (len == 0) return -1; // Try to send the message directly. ssize_t n = this->peer().send(message_block.rd_ptr(), len, MSG_NOSIGNAL); - if(n < 0) + if (n < 0) { - if(errno == EWOULDBLOCK) + if (errno == EWOULDBLOCK) // Blocking signal return 0; else // Error return -1; } - else if(n == 0) + else if (n == 0) { // Can this happen ? return -1; @@ -125,35 +125,35 @@ ssize_t BufferedSocket::noblk_send(ACE_Message_Block &message_block) return n; } -bool BufferedSocket::send(const char *buf, size_t len) +bool BufferedSocket::send(const char* buf, size_t len) { - if(buf == NULL || len == 0) + if (buf == NULL || len == 0) return true; ACE_Data_Block db( - len, - ACE_Message_Block::MB_DATA, - (const char*)buf, - 0, - 0, - ACE_Message_Block::DONT_DELETE, - 0); + len, + ACE_Message_Block::MB_DATA, + (const char*)buf, + 0, + 0, + ACE_Message_Block::DONT_DELETE, + 0); ACE_Message_Block message_block( - &db, - ACE_Message_Block::DONT_DELETE, - 0); + &db, + ACE_Message_Block::DONT_DELETE, + 0); message_block.wr_ptr(len); - if(this->msg_queue()->is_empty()) + if (this->msg_queue()->is_empty()) { // Try to send it directly. ssize_t n = this->noblk_send(message_block); - if(n < 0) + if (n < 0) return false; - else if(n == len) + else if (n == len) return true; // adjust how much bytes we sent @@ -163,16 +163,16 @@ bool BufferedSocket::send(const char *buf, size_t len) } // enqueue the message, note: clone is needed cause we cant enqueue stuff on the stack - ACE_Message_Block *mb = message_block.clone(); + ACE_Message_Block* mb = message_block.clone(); - if(this->msg_queue()->enqueue_tail(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + if (this->msg_queue()->enqueue_tail(mb, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1) { mb->release(); return false; } // tell reactor to call handle_output() when we can send more data - if(this->reactor()->schedule_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1) + if (this->reactor()->schedule_wakeup(this, ACE_Event_Handler::WRITE_MASK) == -1) return false; return true; @@ -180,26 +180,26 @@ bool BufferedSocket::send(const char *buf, size_t len) /*virtual*/ int BufferedSocket::handle_output(ACE_HANDLE /*= ACE_INVALID_HANDLE*/) { - ACE_Message_Block *mb = 0; + ACE_Message_Block* mb = 0; - if(this->msg_queue()->is_empty()) + if (this->msg_queue()->is_empty()) { // if no more data to send, then cancel notification this->reactor()->cancel_wakeup(this, ACE_Event_Handler::WRITE_MASK); return 0; } - if(this->msg_queue()->dequeue_head(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + if (this->msg_queue()->dequeue_head(mb, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1) return -1; ssize_t n = this->noblk_send(*mb); - if(n < 0) + if (n < 0) { mb->release(); return -1; } - else if(n == mb->length()) + else if (n == mb->length()) { mb->release(); return 1; @@ -208,7 +208,7 @@ bool BufferedSocket::send(const char *buf, size_t len) { mb->rd_ptr(n); - if(this->msg_queue()->enqueue_head(mb, (ACE_Time_Value *) &ACE_Time_Value::zero) == -1) + if (this->msg_queue()->enqueue_head(mb, (ACE_Time_Value*) &ACE_Time_Value::zero) == -1) { mb->release(); return -1; @@ -226,12 +226,12 @@ bool BufferedSocket::send(const char *buf, size_t len) ssize_t n = this->peer().recv(this->input_buffer_.wr_ptr(), space); - if(n < 0) + if (n < 0) { // blocking signal or error return errno == EWOULDBLOCK ? 0 : -1; } - else if(n == 0) + else if (n == 0) { // EOF return -1; diff --git a/src/realmd/BufferedSocket.h b/src/realmd/BufferedSocket.h index 017c0d3d4..05b07b96f 100644 --- a/src/realmd/BufferedSocket.h +++ b/src/realmd/BufferedSocket.h @@ -46,15 +46,15 @@ class BufferedSocket: public ACE_Svc_Handler virtual ~BufferedSocket(void); size_t recv_len(void) const; - bool recv_soft(char *buf, size_t len); - bool recv(char *buf, size_t len); + bool recv_soft(char* buf, size_t len); + bool recv(char* buf, size_t len); void recv_skip(size_t len); - bool send(const char *buf, size_t len); + bool send(const char* buf, size_t len); const std::string& get_remote_address(void) const; - virtual int open(void *); + virtual int open(void*); void close_connection(void); @@ -62,10 +62,10 @@ class BufferedSocket: public ACE_Svc_Handler virtual int handle_output(ACE_HANDLE = ACE_INVALID_HANDLE); virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, - ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); + ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK); private: - ssize_t noblk_send(ACE_Message_Block &message_block); + ssize_t noblk_send(ACE_Message_Block& message_block); private: ACE_Message_Block input_buffer_; diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 9db9f6854..e3b68ce1d 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -67,31 +67,31 @@ bool stopEvent = false; ///< Setting it to t DatabaseType LoginDatabase; ///< Accessor to the realm server database /// Print out the usage string for this program on the console. -void usage(const char *prog) +void usage(const char* prog) { sLog.outString("Usage: \n %s []\n" - " -v, --version print version and exist\n\r" - " -c config_file use config_file as configuration file\n\r" - #ifdef WIN32 - " Running as service functions:\n\r" - " -s run run as service\n\r" - " -s install install service\n\r" - " -s uninstall uninstall service\n\r" - #else - " Running as daemon functions:\n\r" - " -s run run as daemon\n\r" - " -s stop stop daemon\n\r" - #endif - ,prog); + " -v, --version print version and exist\n\r" + " -c config_file use config_file as configuration file\n\r" +#ifdef WIN32 + " Running as service functions:\n\r" + " -s run run as service\n\r" + " -s install install service\n\r" + " -s uninstall uninstall service\n\r" +#else + " Running as daemon functions:\n\r" + " -s run run as daemon\n\r" + " -s stop stop daemon\n\r" +#endif + ,prog); } /// Launch the realm server -extern int main(int argc, char **argv) +extern int main(int argc, char** argv) { ///- Command line parsing char const* cfg_file = _REALMD_CONFIG; - char const *options = ":c:s:"; + char const* options = ":c:s:"; ACE_Get_Opt cmd_opts(argc, argv, options); cmd_opts.long_option("version", 'v'); @@ -112,7 +112,7 @@ extern int main(int argc, char **argv) case 's': { - const char *mode = cmd_opts.opt_arg(); + const char* mode = cmd_opts.opt_arg(); if (!strcmp(mode, "run")) serviceDaemonMode = 'r'; @@ -185,8 +185,8 @@ extern int main(int argc, char **argv) sLog.Initialize(); - sLog.outString( "%s [realm-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) ); - sLog.outString( " to stop.\n" ); + sLog.outString("%s [realm-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID)); + sLog.outString(" to stop.\n"); sLog.outString("Using configuration file %s.", cfg_file); ///- Check the version of the configuration file @@ -202,7 +202,7 @@ extern int main(int argc, char **argv) } DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); - if (SSLeay() < 0x009080bfL ) + if (SSLeay() < 0x009080bfL) { DETAIL_LOG("WARNING: Outdated version of OpenSSL lib. Logins to server may not work!"); DETAIL_LOG("WARNING: Minimal required version [OpenSSL 0.9.8k]"); @@ -220,21 +220,21 @@ extern int main(int argc, char **argv) /// realmd PID file creation std::string pidfile = sConfig.GetStringDefault("PidFile", ""); - if(!pidfile.empty()) + if (!pidfile.empty()) { uint32 pid = CreatePIDFile(pidfile); - if( !pid ) + if (!pid) { - sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() ); + sLog.outError("Cannot create PID file %s.\n", pidfile.c_str()); Log::WaitBeforeContinueIfNeed(); return 1; } - sLog.outString( "Daemon PID: %u\n", pid ); + sLog.outString("Daemon PID: %u\n", pid); } ///- Initialize the database connection - if(!StartDB()) + if (!StartDB()) { Log::WaitBeforeContinueIfNeed(); return 1; @@ -264,7 +264,7 @@ extern int main(int argc, char **argv) ACE_INET_Addr bind_addr(rmport, bind_ip.c_str()); - if(acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1) + if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1) { sLog.outError("MaNGOS realmd can not bind to %s:%d", bind_ip.c_str(), rmport); Log::WaitBeforeContinueIfNeed(); @@ -275,27 +275,27 @@ extern int main(int argc, char **argv) HookSignals(); ///- Handle affinity for multiple processors and process priority on Windows - #ifdef WIN32 +#ifdef WIN32 { HANDLE hProcess = GetCurrentProcess(); uint32 Aff = sConfig.GetIntDefault("UseProcessors", 0); - if(Aff > 0) + if (Aff > 0) { ULONG_PTR appAff; ULONG_PTR sysAff; - if(GetProcessAffinityMask(hProcess,&appAff,&sysAff)) + if (GetProcessAffinityMask(hProcess,&appAff,&sysAff)) { ULONG_PTR curAff = Aff & appAff; // remove non accessible processors - if(!curAff ) + if (!curAff) { sLog.outError("Processors marked in UseProcessors bitmask (hex) %x not accessible for realmd. Accessible processors bitmask (hex): %x",Aff,appAff); } else { - if(SetProcessAffinityMask(hProcess,curAff)) + if (SetProcessAffinityMask(hProcess,curAff)) sLog.outString("Using processors (bitmask, hex): %x", curAff); else sLog.outError("Can't set used processors (hex): %x", curAff); @@ -306,27 +306,27 @@ extern int main(int argc, char **argv) bool Prio = sConfig.GetBoolDefault("ProcessPriority", false); - if(Prio) + if (Prio) { - if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS)) + if (SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS)) sLog.outString("realmd process priority class set to HIGH"); else sLog.outError("Can't set realmd process priority class."); sLog.outString(); } } - #endif +#endif //server has started up successfully => enable async DB requests LoginDatabase.AllowAsyncTransactions(); // maximum counter for next ping - uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / 100000)); + uint32 numLoops = (sConfig.GetIntDefault("MaxPingTime", 30) * (MINUTE * 1000000 / 100000)); uint32 loopCounter = 0; - #ifndef WIN32 +#ifndef WIN32 detachDaemon(); - #endif +#endif ///- Wait for termination signal while (!stopEvent) { @@ -336,7 +336,7 @@ extern int main(int argc, char **argv) if (ACE_Reactor::instance()->run_reactor_event_loop(interval) == -1) break; - if( (++loopCounter) == numLoops ) + if ((++loopCounter) == numLoops) { loopCounter = 0; DETAIL_LOG("Ping MySQL to keep connection alive"); @@ -354,7 +354,7 @@ extern int main(int argc, char **argv) ///- Remove signal handling before leaving UnhookSignals(); - sLog.outString( "Halting process..." ); + sLog.outString("Halting process..."); return 0; } @@ -368,11 +368,11 @@ void OnSignal(int s) case SIGTERM: stopEvent = true; break; - #ifdef _WIN32 +#ifdef _WIN32 case SIGBREAK: stopEvent = true; break; - #endif +#endif } signal(s, OnSignal); @@ -382,7 +382,7 @@ void OnSignal(int s) bool StartDB() { std::string dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", ""); - if(dbstring.empty()) + if (dbstring.empty()) { sLog.outError("Database not specified"); return false; @@ -390,13 +390,13 @@ bool StartDB() sLog.outString("Login Database total connections: %i", 1 + 1); - if(!LoginDatabase.Initialize(dbstring.c_str())) + if (!LoginDatabase.Initialize(dbstring.c_str())) { sLog.outError("Cannot connect to database"); return false; } - if(!LoginDatabase.CheckRequiredField("realmd_db_version",REVISION_DB_REALMD)) + if (!LoginDatabase.CheckRequiredField("realmd_db_version",REVISION_DB_REALMD)) { ///- Wait for already started DB delay threads to end LoginDatabase.HaltDelayThread(); @@ -411,9 +411,9 @@ void HookSignals() { signal(SIGINT, OnSignal); signal(SIGTERM, OnSignal); - #ifdef _WIN32 +#ifdef _WIN32 signal(SIGBREAK, OnSignal); - #endif +#endif } /// Unhook the signals before leaving @@ -421,9 +421,9 @@ void UnhookSignals() { signal(SIGINT, 0); signal(SIGTERM, 0); - #ifdef _WIN32 +#ifdef _WIN32 signal(SIGBREAK, 0); - #endif +#endif } /// @} diff --git a/src/realmd/PatchHandler.cpp b/src/realmd/PatchHandler.cpp index 503f61024..bc0af705c 100644 --- a/src/realmd/PatchHandler.cpp +++ b/src/realmd/PatchHandler.cpp @@ -64,20 +64,20 @@ PatchHandler::PatchHandler(ACE_HANDLE socket, ACE_HANDLE patch) PatchHandler::~PatchHandler() { - if(patch_fd_ != ACE_INVALID_HANDLE) + if (patch_fd_ != ACE_INVALID_HANDLE) ACE_OS::close(patch_fd_); } int PatchHandler::open(void*) { - if(get_handle() == ACE_INVALID_HANDLE || patch_fd_ == ACE_INVALID_HANDLE) + if (get_handle() == ACE_INVALID_HANDLE || patch_fd_ == ACE_INVALID_HANDLE) return -1; int nodelay = 0; if (-1 == peer().set_option(ACE_IPPROTO_TCP, - TCP_NODELAY, - &nodelay, - sizeof(nodelay))) + TCP_NODELAY, + &nodelay, + sizeof(nodelay))) { return -1; } @@ -85,9 +85,9 @@ int PatchHandler::open(void*) #if defined(TCP_CORK) int cork = 1; if (-1 == peer().set_option(ACE_IPPROTO_TCP, - TCP_CORK, - &cork, - sizeof(cork))) + TCP_CORK, + &cork, + sizeof(cork))) { return -1; } @@ -111,19 +111,19 @@ int PatchHandler::svc(void) ssize_t r; - while((r = ACE_OS::read(patch_fd_, data.data, sizeof(data.data))) > 0) + while ((r = ACE_OS::read(patch_fd_, data.data, sizeof(data.data))) > 0) { data.data_size = (ACE_UINT16)r; - if(peer().send((const char*)&data, - ((size_t) r) + sizeof(data) - sizeof(data.data), - flags) == -1) + if (peer().send((const char*)&data, + ((size_t) r) + sizeof(data) - sizeof(data.data), + flags) == -1) { return -1; } } - if(r == -1) + if (r == -1) { return -1; } @@ -133,7 +133,7 @@ int PatchHandler::svc(void) PatchCache::~PatchCache() { - for (Patches::iterator i = patches_.begin (); i != patches_.end (); i++) + for (Patches::iterator i = patches_.begin(); i != patches_.end(); i++) delete i->second; } @@ -152,10 +152,10 @@ void PatchCache::LoadPatchMD5(const char* szFileName) // Try to open the patch file std::string path = "./patches/"; path += szFileName; - FILE * pPatch = fopen(path.c_str (), "rb"); + FILE* pPatch = fopen(path.c_str(), "rb"); sLog.outDebug("Loading patch info from %s", path.c_str()); - if(!pPatch) + if (!pPatch) return; // Calculate the MD5 hash @@ -166,7 +166,7 @@ void PatchCache::LoadPatchMD5(const char* szFileName) ACE_UINT8 buf[check_chunk_size]; - while(!feof (pPatch)) + while (!feof(pPatch)) { size_t read = fread(buf, 1, check_chunk_size, pPatch); MD5_Update(&ctx, buf, read); @@ -176,13 +176,13 @@ void PatchCache::LoadPatchMD5(const char* szFileName) // Store the result in the internal patch hash map patches_[path] = new PATCH_INFO; - MD5_Final((ACE_UINT8 *) & patches_[path]->md5, &ctx); + MD5_Final((ACE_UINT8*) & patches_[path]->md5, &ctx); } -bool PatchCache::GetHash(const char * pat, ACE_UINT8 mymd5[MD5_DIGEST_LENGTH]) +bool PatchCache::GetHash(const char* pat, ACE_UINT8 mymd5[MD5_DIGEST_LENGTH]) { - for (Patches::iterator i = patches_.begin (); i != patches_.end (); i++) - if (!stricmp(pat, i->first.c_str ())) + for (Patches::iterator i = patches_.begin(); i != patches_.end(); i++) + if (!stricmp(pat, i->first.c_str())) { memcpy(mymd5, i->second->md5, MD5_DIGEST_LENGTH); return true; @@ -195,18 +195,18 @@ void PatchCache::LoadPatchesInfo() { ACE_DIR* dirp = ACE_OS::opendir(ACE_TEXT("./patches/")); - if(!dirp) + if (!dirp) return; ACE_DIRENT* dp; - while((dp = ACE_OS::readdir(dirp)) != NULL) + while ((dp = ACE_OS::readdir(dirp)) != NULL) { int l = strlen(dp->d_name); if (l < 8) continue; - if(!memcmp(&dp->d_name[l - 4], ".mpq", 4)) + if (!memcmp(&dp->d_name[l - 4], ".mpq", 4)) LoadPatchMD5(dp->d_name); } diff --git a/src/realmd/PatchHandler.h b/src/realmd/PatchHandler.h index aa69d8faa..6a14a4293 100644 --- a/src/realmd/PatchHandler.h +++ b/src/realmd/PatchHandler.h @@ -63,7 +63,7 @@ class PatchCache } void LoadPatchMD5(const char*); - bool GetHash(const char * pat, ACE_UINT8 mymd5[MD5_DIGEST_LENGTH]); + bool GetHash(const char* pat, ACE_UINT8 mymd5[MD5_DIGEST_LENGTH]); private: void LoadPatchesInfo(); diff --git a/src/realmd/RealmList.cpp b/src/realmd/RealmList.cpp index 5dc4b0e18..e29b21f98 100644 --- a/src/realmd/RealmList.cpp +++ b/src/realmd/RealmList.cpp @@ -27,7 +27,7 @@ #include "Policies/SingletonImp.h" #include "Database/DatabaseEnv.h" -INSTANTIATE_SINGLETON_1( RealmList ); +INSTANTIATE_SINGLETON_1(RealmList); extern DatabaseType LoginDatabase; @@ -35,7 +35,8 @@ extern DatabaseType LoginDatabase; // if you need more from old build then add it in cases in realmd sources code // list sorted from high to low build and first build used as low bound for accepted by default range (any > it will accepted by realmd at least) -static RealmBuildInfo ExpectedRealmdClientBuilds[] = { +static RealmBuildInfo ExpectedRealmdClientBuilds[] = +{ {12340, 3, 3, 5, 'a'}, // highest supported build, also auto accept all above for simplify future supported builds testing {11723, 3, 3, 3, 'a'}, {11403, 3, 3, 2, ' '}, @@ -54,15 +55,15 @@ RealmBuildInfo const* FindBuildInfo(uint16 _build) return &ExpectedRealmdClientBuilds[0]; // continue from 1 with explicit equal check - for(int i = 1; ExpectedRealmdClientBuilds[i].build; ++i) - if(_build == ExpectedRealmdClientBuilds[i].build) + for (int i = 1; ExpectedRealmdClientBuilds[i].build; ++i) + if (_build == ExpectedRealmdClientBuilds[i].build) return &ExpectedRealmdClientBuilds[i]; // none appropriate build return NULL; } -RealmList::RealmList( ) : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) +RealmList::RealmList() : m_UpdateInterval(0), m_NextUpdateTime(time(NULL)) { } @@ -81,7 +82,7 @@ void RealmList::Initialize(uint32 updateInterval) UpdateRealms(true); } -void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags realmflags, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, const std::string& builds) +void RealmList::UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags realmflags, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, const std::string& builds) { ///- Create new if not exist or update existed Realm& realm = m_realms[name]; @@ -124,7 +125,7 @@ void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::stri void RealmList::UpdateIfNeed() { // maybe disabled or updated recently - if(!m_UpdateInterval || m_NextUpdateTime > time(NULL)) + if (!m_UpdateInterval || m_NextUpdateTime > time(NULL)) return; m_NextUpdateTime = time(NULL) + m_UpdateInterval; @@ -141,14 +142,14 @@ void RealmList::UpdateRealms(bool init) DETAIL_LOG("Updating Realm List..."); //// 0 1 2 3 4 5 6 7 8 9 - QueryResult *result = LoginDatabase.Query( "SELECT id, name, address, port, icon, realmflags, timezone, allowedSecurityLevel, population, realmbuilds FROM realmlist WHERE (realmflags & 1) = 0 ORDER BY name" ); + QueryResult* result = LoginDatabase.Query("SELECT id, name, address, port, icon, realmflags, timezone, allowedSecurityLevel, population, realmbuilds FROM realmlist WHERE (realmflags & 1) = 0 ORDER BY name"); ///- Circle through results and add them to the realm map - if(result) + if (result) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint8 allowedSecurityLevel = fields[7].GetUInt8(); @@ -166,9 +167,10 @@ void RealmList::UpdateRealms(bool init) (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), fields[8].GetFloat(), fields[9].GetCppString()); - if(init) + if (init) sLog.outString("Added realm \"%s\"", fields[1].GetString()); - } while( result->NextRow() ); + } + while (result->NextRow()); delete result; } } diff --git a/src/realmd/RealmList.h b/src/realmd/RealmList.h index 6e1f92a1e..23832fd75 100644 --- a/src/realmd/RealmList.h +++ b/src/realmd/RealmList.h @@ -72,7 +72,7 @@ class RealmList uint32 size() const { return m_realms.size(); } private: void UpdateRealms(bool init); - void UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags realmflags, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, const std::string& builds); + void UpdateRealm(uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, RealmFlags realmflags, uint8 timezone, AccountTypes allowedSecurityLevel, float popu, const std::string& builds); private: RealmMap m_realms; ///< Internal map of realms uint32 m_UpdateInterval;