*Update to Mangos 6938. (Only build for VC9)
--HG-- branch : trunk
This commit is contained in:
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
|
||||
*
|
||||
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/** \file
|
||||
\ingroup realmd
|
||||
*/
|
||||
|
||||
#ifndef _AUTHCODES_H
|
||||
#define _AUTHCODES_H
|
||||
|
||||
enum eAuthResults
|
||||
{
|
||||
REALM_AUTH_SUCCESS = 0x00,
|
||||
REALM_AUTH_FAILURE = 0x01, ///< Unable to connect
|
||||
REALM_AUTH_UNKNOWN1 = 0x02, ///< Unable to connect
|
||||
REALM_AUTH_ACCOUNT_BANNED = 0x03, ///< This <game> account has been closed and is no longer available for use. Please go to <site>/banned.html for further information.
|
||||
REALM_AUTH_NO_MATCH = 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 <site> for more information
|
||||
REALM_AUTH_UNKNOWN2 = 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 <site> for more information
|
||||
REALM_AUTH_ACCOUNT_IN_USE = 0x06, ///< This account is already logged into <game>. Please check the spelling and try again.
|
||||
REALM_AUTH_PREPAID_TIME_LIMIT = 0x07, ///< You have used up your prepaid time for this account. Please purchase more to continue playing
|
||||
REALM_AUTH_SERVER_FULL = 0x08, ///< Could not log in to <game> at this time. Please try again later.
|
||||
REALM_AUTH_WRONG_BUILD_NUMBER = 0x09, ///< Unable to validate game version. This may be caused by file corruption or interference of another program. Please visit <site> for more information and possible solutions to this issue.
|
||||
REALM_AUTH_UPDATE_CLIENT = 0x0a, ///< Downloading
|
||||
REALM_AUTH_UNKNOWN3 = 0x0b, ///< Unable to connect
|
||||
REALM_AUTH_ACCOUNT_FREEZED = 0x0c, ///< This <game> account has been temporarily suspended. Please go to <site>/banned.html for further information
|
||||
REALM_AUTH_UNKNOWN4 = 0x0d, ///< Unable to connect
|
||||
REALM_AUTH_UNKNOWN5 = 0x0e, ///< Connected.
|
||||
REALM_AUTH_PARENTAL_CONTROL = 0x0f ///< Access to this account has been blocked by parental controls. Your settings may be changed in your account preferences at <site>
|
||||
};
|
||||
|
||||
enum LoginResult
|
||||
{
|
||||
LOGIN_OK = 0x00,
|
||||
LOGIN_FAILED = 0x01,
|
||||
LOGIN_FAILED2 = 0x02,
|
||||
LOGIN_BANNED = 0x03,
|
||||
LOGIN_UNKNOWN_ACCOUNT = 0x04,
|
||||
LOGIN_UNKNOWN_ACCOUNT3 = 0x05,
|
||||
LOGIN_ALREADYONLINE = 0x06,
|
||||
LOGIN_NOTIME = 0x07,
|
||||
LOGIN_DBBUSY = 0x08,
|
||||
LOGIN_BADVERSION = 0x09,
|
||||
LOGIN_DOWNLOAD_FILE = 0x0A,
|
||||
LOGIN_FAILED3 = 0x0B,
|
||||
LOGIN_SUSPENDED = 0x0C,
|
||||
LOGIN_FAILED4 = 0x0D,
|
||||
LOGIN_CONNECTED = 0x0E,
|
||||
LOGIN_PARENTALCONTROL = 0x0F,
|
||||
LOGIN_LOCKED_ENFORCED = 0x10,
|
||||
};
|
||||
|
||||
// we need to stick to 1 version or half of the stuff will work for someone
|
||||
// others will not and opposite
|
||||
// will only support WoW and WoW:TBC 2.4.3 client build 8606...
|
||||
|
||||
#define EXPECTED_TRINITY_CLIENT_BUILD {8606, 0}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
|
||||
*
|
||||
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/// \addtogroup realmd
|
||||
/// @{
|
||||
/// \file
|
||||
|
||||
#ifndef _AUTHSOCKET_H
|
||||
#define _AUTHSOCKET_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Auth/BigNumber.h"
|
||||
#include "sockets/TcpSocket.h"
|
||||
#include "sockets/SocketHandler.h"
|
||||
#include "sockets/ListenSocket.h"
|
||||
#include "sockets/Utility.h"
|
||||
#include "sockets/Parse.h"
|
||||
#include "sockets/Socket.h"
|
||||
#include "zthread/Mutex.h"
|
||||
|
||||
/// Handle login commands
|
||||
class AuthSocket: public TcpSocket
|
||||
{
|
||||
public:
|
||||
const static int s_BYTE_SIZE = 32;
|
||||
|
||||
AuthSocket(ISocketHandler& h);
|
||||
~AuthSocket();
|
||||
|
||||
void OnAccept();
|
||||
void OnRead();
|
||||
|
||||
bool _HandleLogonChallenge();
|
||||
bool _HandleLogonProof();
|
||||
bool _HandleReconnectChallenge();
|
||||
bool _HandleReconnectProof();
|
||||
bool _HandleRealmList();
|
||||
//data transfer handle for patch
|
||||
|
||||
bool _HandleXferResume();
|
||||
bool _HandleXferCancel();
|
||||
bool _HandleXferAccept();
|
||||
|
||||
void _SetVSFields(const std::string& rI);
|
||||
|
||||
FILE *pPatch;
|
||||
ZThread::Mutex patcherLock;
|
||||
bool IsLag();
|
||||
|
||||
private:
|
||||
|
||||
BigNumber N, s, g, v;
|
||||
BigNumber b, B;
|
||||
BigNumber K;
|
||||
BigNumber _reconnectProof;
|
||||
|
||||
bool _authed;
|
||||
|
||||
std::string _login;
|
||||
std::string _safelogin;
|
||||
|
||||
// Since GetLocaleByName() is _NOT_ bijective, we have to store the locale as a string. Otherwise we can't differ
|
||||
// between enUS and enGB, which is important for the patch system
|
||||
std::string _localizationName;
|
||||
uint16 _build;
|
||||
AccountTypes _accountSecurityLevel;
|
||||
};
|
||||
#endif
|
||||
/// @}
|
||||
@@ -1,345 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
|
||||
*
|
||||
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/// \addtogroup realmd Realm Daemon
|
||||
/// @{
|
||||
/// \file
|
||||
|
||||
#include "Common.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "RealmList.h"
|
||||
|
||||
#include "Config/ConfigEnv.h"
|
||||
#include "Log.h"
|
||||
#include "sockets/ListenSocket.h"
|
||||
#include "AuthSocket.h"
|
||||
#include "SystemConfig.h"
|
||||
#include "Util.h"
|
||||
|
||||
// Format is YYYYMMDDRR where RR is the change in the conf file
|
||||
// for that day.
|
||||
#ifndef _REALMDCONFVERSION
|
||||
# define _REALMDCONFVERSION 2007062001
|
||||
#endif
|
||||
|
||||
#ifndef _TRINITY_REALM_CONFIG
|
||||
# define _TRINITY_REALM_CONFIG "trinityrealm.conf"
|
||||
#endif //_TRINITY_REALM_CONFIG
|
||||
|
||||
#ifdef WIN32
|
||||
#include "ServiceWin32.h"
|
||||
char serviceName[] = "realmd";
|
||||
char serviceLongName[] = "Trinity realm service";
|
||||
char serviceDescription[] = "Massive Network Game Object Server";
|
||||
/*
|
||||
* -1 - not in service mode
|
||||
* 0 - stopped
|
||||
* 1 - running
|
||||
* 2 - paused
|
||||
*/
|
||||
int m_ServiceStatus = -1;
|
||||
#endif
|
||||
|
||||
bool StartDB(std::string &dbstring);
|
||||
void UnhookSignals();
|
||||
void HookSignals();
|
||||
|
||||
bool stopEvent = false; ///< Setting it to true stops the server
|
||||
RealmList m_realmList; ///< Holds the list of realms for this server
|
||||
|
||||
DatabaseType dbRealmServer; ///< Accessor to the realm server database
|
||||
|
||||
/// Print out the usage string for this program on the console.
|
||||
void usage(const char *prog)
|
||||
{
|
||||
sLog.outString("Usage: \n %s [<options>]\n"
|
||||
" -c config_file use config_file as configuration file\n\r"
|
||||
#ifdef WIN32
|
||||
" Running as service functions:\n\r"
|
||||
" --service run as service\n\r"
|
||||
" -s install install service\n\r"
|
||||
" -s uninstall uninstall service\n\r"
|
||||
#endif
|
||||
,prog);
|
||||
}
|
||||
|
||||
/// Launch the realm server
|
||||
extern int main(int argc, char **argv)
|
||||
{
|
||||
///- Command line parsing to get the configuration file name
|
||||
char const* cfg_file = _TRINITY_REALM_CONFIG;
|
||||
int c=1;
|
||||
while( c < argc )
|
||||
{
|
||||
if( strcmp(argv[c],"-c") == 0)
|
||||
{
|
||||
if( ++c >= argc )
|
||||
{
|
||||
sLog.outError("Runtime-Error: -c option requires an input argument");
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
cfg_file = argv[c];
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
////////////
|
||||
//Services//
|
||||
////////////
|
||||
if( strcmp(argv[c],"-s") == 0)
|
||||
{
|
||||
if( ++c >= argc )
|
||||
{
|
||||
sLog.outError("Runtime-Error: -s option requires an input argument");
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if( strcmp(argv[c],"install") == 0)
|
||||
{
|
||||
if (WinServiceInstall())
|
||||
sLog.outString("Installing service");
|
||||
return 1;
|
||||
}
|
||||
else if( strcmp(argv[c],"uninstall") == 0)
|
||||
{
|
||||
if(WinServiceUninstall())
|
||||
sLog.outString("Uninstalling service");
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
sLog.outError("Runtime-Error: unsupported option %s",argv[c]);
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if( strcmp(argv[c],"--service") == 0)
|
||||
{
|
||||
WinServiceRun();
|
||||
}
|
||||
////
|
||||
#endif
|
||||
++c;
|
||||
}
|
||||
|
||||
if (!sConfig.SetSource(cfg_file))
|
||||
{
|
||||
sLog.outError("Could not find configuration file %s.", cfg_file);
|
||||
return 1;
|
||||
}
|
||||
sLog.outString("Using configuration file %s.", cfg_file);
|
||||
|
||||
///- Check the version of the configuration file
|
||||
uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);
|
||||
if (confVersion < _REALMDCONFVERSION)
|
||||
{
|
||||
sLog.outError("*****************************************************************************");
|
||||
sLog.outError(" WARNING: Your trinityrealm.conf version indicates your conf file is out of date!");
|
||||
sLog.outError(" Please check for updates, as your current default values may cause");
|
||||
sLog.outError(" strange behavior.");
|
||||
sLog.outError("*****************************************************************************");
|
||||
clock_t pause = 3000 + clock();
|
||||
|
||||
while (pause > clock()) {}
|
||||
}
|
||||
|
||||
sLog.outString( "%s (realm-daemon)", _FULLVERSION );
|
||||
sLog.outString( "<Ctrl-C> to stop.\n" );
|
||||
|
||||
/// realmd PID file creation
|
||||
std::string pidfile = sConfig.GetStringDefault("PidFile", "");
|
||||
if(!pidfile.empty())
|
||||
{
|
||||
uint32 pid = CreatePIDFile(pidfile);
|
||||
if( !pid )
|
||||
{
|
||||
sLog.outError( "Cannot create PID file %s.\n", pidfile.c_str() );
|
||||
return 1;
|
||||
}
|
||||
|
||||
sLog.outString( "Daemon PID: %u\n", pid );
|
||||
}
|
||||
|
||||
///- Initialize the database connection
|
||||
std::string dbstring;
|
||||
if(!StartDB(dbstring))
|
||||
return 1;
|
||||
|
||||
///- Get the list of realms for the server
|
||||
m_realmList.Initialize(sConfig.GetIntDefault("RealmsStateUpdateDelay", 20));
|
||||
if (m_realmList.size() == 0)
|
||||
{
|
||||
sLog.outError("No valid realms specified.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
///- Launch the listening network socket
|
||||
port_t rmport = sConfig.GetIntDefault( "RealmServerPort", DEFAULT_REALMSERVER_PORT );
|
||||
std::string bind_ip = sConfig.GetStringDefault("BindIP", "0.0.0.0");
|
||||
|
||||
SocketHandler h;
|
||||
ListenSocket<AuthSocket> authListenSocket(h);
|
||||
if ( authListenSocket.Bind(bind_ip.c_str(),rmport))
|
||||
{
|
||||
sLog.outError( "Trinity realm can not bind to %s:%d",bind_ip.c_str(), rmport );
|
||||
return 1;
|
||||
}
|
||||
|
||||
h.Add(&authListenSocket);
|
||||
|
||||
///- Catch termination signals
|
||||
HookSignals();
|
||||
|
||||
///- Handle affinity for multiple processors and process priority on Windows
|
||||
#ifdef WIN32
|
||||
{
|
||||
HANDLE hProcess = GetCurrentProcess();
|
||||
|
||||
uint32 Aff = sConfig.GetIntDefault("UseProcessors", 0);
|
||||
if(Aff > 0)
|
||||
{
|
||||
ULONG_PTR appAff;
|
||||
ULONG_PTR sysAff;
|
||||
|
||||
if(GetProcessAffinityMask(hProcess,&appAff,&sysAff))
|
||||
{
|
||||
ULONG_PTR curAff = Aff & appAff; // remove non accessible processors
|
||||
|
||||
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))
|
||||
sLog.outString("Using processors (bitmask, hex): %x", curAff);
|
||||
else
|
||||
sLog.outError("Can't set used processors (hex): %x", curAff);
|
||||
}
|
||||
}
|
||||
sLog.outString();
|
||||
}
|
||||
|
||||
bool Prio = sConfig.GetBoolDefault("ProcessPriority", false);
|
||||
|
||||
if(Prio)
|
||||
{
|
||||
if(SetPriorityClass(hProcess,HIGH_PRIORITY_CLASS))
|
||||
sLog.outString("TrinityRealm process priority class set to HIGH");
|
||||
else
|
||||
sLog.outError("ERROR: Can't set realmd process priority class.");
|
||||
sLog.outString();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// maximum counter for next ping
|
||||
uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / 100000));
|
||||
uint32 loopCounter = 0;
|
||||
|
||||
///- Wait for termination signal
|
||||
while (!stopEvent)
|
||||
{
|
||||
|
||||
h.Select(0, 100000);
|
||||
|
||||
if( (++loopCounter) == numLoops )
|
||||
{
|
||||
loopCounter = 0;
|
||||
sLog.outDetail("Ping MySQL to keep connection alive");
|
||||
delete dbRealmServer.Query("SELECT 1 FROM realmlist LIMIT 1");
|
||||
}
|
||||
#ifdef WIN32
|
||||
if (m_ServiceStatus == 0) stopEvent = true;
|
||||
while (m_ServiceStatus == 2) Sleep(1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
///- Wait for the delay thread to exit
|
||||
dbRealmServer.HaltDelayThread();
|
||||
|
||||
///- Remove signal handling before leaving
|
||||
UnhookSignals();
|
||||
|
||||
sLog.outString( "Halting process..." );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// Handle termination signals
|
||||
/** Put the global variable stopEvent to 'true' if a termination signal is caught **/
|
||||
void OnSignal(int s)
|
||||
{
|
||||
switch (s)
|
||||
{
|
||||
case SIGINT:
|
||||
case SIGTERM:
|
||||
stopEvent = true;
|
||||
break;
|
||||
#ifdef _WIN32
|
||||
case SIGBREAK:
|
||||
stopEvent = true;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
signal(s, OnSignal);
|
||||
}
|
||||
|
||||
/// Initialize connection to the database
|
||||
bool StartDB(std::string &dbstring)
|
||||
{
|
||||
if(!sConfig.GetString("LoginDatabaseInfo", &dbstring))
|
||||
{
|
||||
sLog.outError("Database not specified");
|
||||
return false;
|
||||
}
|
||||
|
||||
sLog.outString("Database: %s", dbstring.c_str() );
|
||||
if(!dbRealmServer.Initialize(dbstring.c_str()))
|
||||
{
|
||||
sLog.outError("Cannot connect to database");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Define hook 'OnSignal' for all termination signals
|
||||
void HookSignals()
|
||||
{
|
||||
signal(SIGINT, OnSignal);
|
||||
signal(SIGTERM, OnSignal);
|
||||
#ifdef _WIN32
|
||||
signal(SIGBREAK, OnSignal);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// Unhook the signals before leaving
|
||||
void UnhookSignals()
|
||||
{
|
||||
signal(SIGINT, 0);
|
||||
signal(SIGTERM, 0);
|
||||
#ifdef _WIN32
|
||||
signal(SIGBREAK, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// @}
|
||||
@@ -1,72 +0,0 @@
|
||||
# Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
|
||||
#
|
||||
# Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
## Build realm list daemon as standalone program
|
||||
bin_PROGRAMS = trinity-realm
|
||||
|
||||
## Preprocessor flags
|
||||
trinity_realm_CPPFLAGS = \
|
||||
$(MYSQL_INCLUDES) \
|
||||
$(POSTGRE_INCLUDES) \
|
||||
$(TRINI_INCLUDES) \
|
||||
-I$(top_srcdir)/dep/include \
|
||||
-I$(top_srcdir)/src/framework \
|
||||
-I$(top_srcdir)/src/shared \
|
||||
-D_TRINITY_REALM_CONFIG='"$(sysconfdir)/trinityrealm.conf"'
|
||||
|
||||
## Sources
|
||||
trinity_realm_SOURCES = \
|
||||
$(srcdir)/AuthCodes.h \
|
||||
$(srcdir)/AuthSocket.cpp \
|
||||
$(srcdir)/AuthSocket.h \
|
||||
$(srcdir)/Main.cpp \
|
||||
$(srcdir)/RealmList.cpp \
|
||||
$(srcdir)/RealmList.h
|
||||
|
||||
## Convenience libs to add
|
||||
trinity_realm_LDADD = \
|
||||
$(top_builddir)/src/shared/libshared.a \
|
||||
$(top_builddir)/src/framework/libmangosframework.a \
|
||||
$(top_builddir)/dep/src/sockets/libmangossockets.a \
|
||||
$(top_builddir)/dep/src/zthread/libZThread.la
|
||||
|
||||
## Linker flags
|
||||
trinity_realm_LDFLAGS = $(MYSQL_LIBS) $(POSTGRE_LIBS) $(ZLIB) $(COMPATLIB) $(SSLLIB) $(TRINI_LIBS)
|
||||
|
||||
## Additional files to install
|
||||
sysconf_DATA = \
|
||||
trinityrealm.conf.dist
|
||||
|
||||
## Prevend overwrite of the config file, if its already installed
|
||||
install-data-hook:
|
||||
@list='$(sysconf_DATA)'; for p in $$list; do \
|
||||
dest=`echo $$p | sed -e s/.dist//`; \
|
||||
if test -f $(DESTDIR)$(sysconfdir)/$$dest; then \
|
||||
echo "$@ will not overwrite existing $(DESTDIR)$(sysconfdir)/$$dest"; \
|
||||
else \
|
||||
echo " $(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$dest"; \
|
||||
$(INSTALL_DATA) $(srcdir)/$$p $(DESTDIR)$(sysconfdir)/$$dest; \
|
||||
fi; \
|
||||
done
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
EXTRA_DIST = trinityrealm.conf.dist
|
||||
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
|
||||
*
|
||||
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/** \file
|
||||
\ingroup realmd
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "RealmList.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "Database/DatabaseEnv.h"
|
||||
|
||||
INSTANTIATE_SINGLETON_1( RealmList );
|
||||
|
||||
extern DatabaseType dbRealmServer;
|
||||
|
||||
RealmList::RealmList( ) : m_UpdateInterval(0), m_NextUpdateTime(time(NULL))
|
||||
{
|
||||
}
|
||||
|
||||
/// Load the realm list from the database
|
||||
void RealmList::Initialize(uint32 updateInterval)
|
||||
{
|
||||
m_UpdateInterval = updateInterval;
|
||||
|
||||
///- Get the content of the realmlist table in the database
|
||||
UpdateRealms(true);
|
||||
}
|
||||
|
||||
void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu)
|
||||
{
|
||||
///- Create new if not exist or update existed
|
||||
Realm& realm = m_realms[name];
|
||||
|
||||
realm.m_ID = ID;
|
||||
realm.name = name;
|
||||
realm.icon = icon;
|
||||
realm.color = color;
|
||||
realm.timezone = timezone;
|
||||
realm.allowedSecurityLevel = allowedSecurityLevel;
|
||||
realm.populationLevel = popu;
|
||||
|
||||
///- Append port to IP address.
|
||||
std::ostringstream ss;
|
||||
ss << address << ":" << port;
|
||||
realm.address = ss.str();
|
||||
}
|
||||
|
||||
void RealmList::UpdateIfNeed()
|
||||
{
|
||||
// maybe disabled or updated recently
|
||||
if(!m_UpdateInterval || m_NextUpdateTime > time(NULL))
|
||||
return;
|
||||
|
||||
m_NextUpdateTime = time(NULL) + m_UpdateInterval;
|
||||
|
||||
// Clears Realm list
|
||||
m_realms.clear();
|
||||
|
||||
// Get the content of the realmlist table in the database
|
||||
UpdateRealms(false);
|
||||
}
|
||||
|
||||
void RealmList::UpdateRealms(bool init)
|
||||
{
|
||||
sLog.outDetail("Updating Realm List...");
|
||||
|
||||
QueryResult *result = dbRealmServer.Query( "SELECT id, name, address, port, icon, color, timezone, allowedSecurityLevel, population FROM realmlist WHERE color <> 3 ORDER BY name" );
|
||||
|
||||
///- Circle through results and add them to the realm map
|
||||
if(result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
|
||||
uint8 allowedSecurityLevel = fields[7].GetUInt8();
|
||||
|
||||
UpdateRealm(fields[0].GetUInt32(), fields[1].GetCppString(),fields[2].GetCppString(),fields[3].GetUInt32(),fields[4].GetUInt8(), fields[5].GetUInt8(), fields[6].GetUInt8(), (allowedSecurityLevel <= SEC_ADMINISTRATOR ? AccountTypes(allowedSecurityLevel) : SEC_ADMINISTRATOR), fields[8].GetFloat() );
|
||||
if(init)
|
||||
sLog.outString("Added realm \"%s\".", fields[1].GetString());
|
||||
} while( result->NextRow() );
|
||||
delete result;
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
|
||||
*
|
||||
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/// \addtogroup realmd
|
||||
/// @{
|
||||
/// \file
|
||||
|
||||
#ifndef _REALMLIST_H
|
||||
#define _REALMLIST_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
/// Storage object for a realm
|
||||
struct Realm
|
||||
{
|
||||
std::string name;
|
||||
std::string address;
|
||||
uint8 icon;
|
||||
uint8 color;
|
||||
uint8 timezone;
|
||||
uint32 m_ID;
|
||||
AccountTypes allowedSecurityLevel;
|
||||
float populationLevel;
|
||||
};
|
||||
|
||||
/// Storage object for the list of realms on the server
|
||||
class RealmList
|
||||
{
|
||||
public:
|
||||
typedef std::map<std::string, Realm> RealmMap;
|
||||
|
||||
RealmList();
|
||||
~RealmList() {}
|
||||
|
||||
void Initialize(uint32 updateInterval);
|
||||
|
||||
void UpdateIfNeed();
|
||||
|
||||
RealmMap::const_iterator begin() const { return m_realms.begin(); }
|
||||
RealmMap::const_iterator end() const { return m_realms.end(); }
|
||||
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, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu);
|
||||
private:
|
||||
RealmMap m_realms; ///< Internal map of realms
|
||||
uint32 m_UpdateInterval;
|
||||
time_t m_NextUpdateTime;
|
||||
};
|
||||
#endif
|
||||
/// @}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 133 KiB |
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "windows.h" //"afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_APPICON ICON "TrinityRealm.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Neutre (Par défaut système) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUSD)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_SYS_DEFAULT
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 0,4,6743,685
|
||||
PRODUCTVERSION 0,4,6743,685
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x0L
|
||||
FILETYPE 0x0L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "080004b0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "TrinityRealm"
|
||||
VALUE "FileVersion", "0, 4, 6743, 685"
|
||||
VALUE "InternalName", "TrinityRealm"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2008"
|
||||
VALUE "OriginalFilename", "TrinityRealm.exe"
|
||||
VALUE "ProductName", "TrinityRealm"
|
||||
VALUE "ProductVersion", "0, 4, 6743, 685"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x800, 1200
|
||||
END
|
||||
END
|
||||
#endif
|
||||
@@ -1,15 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by TrinityCore.rc
|
||||
//
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,116 +0,0 @@
|
||||
##########################################
|
||||
# Trinity Core realmd configuration file #
|
||||
##########################################
|
||||
ConfVersion=2007062001
|
||||
|
||||
###################################################################################################################
|
||||
# REALMD SETTINGS
|
||||
#
|
||||
# LoginDatabaseInfo
|
||||
# Database connection settings for the realm server.
|
||||
# Default: hostname;port;username;password;database
|
||||
# .;somenumber;username;password;database - use named pipes at Windows
|
||||
# Named pipes: mySQL required adding "enable-named-pipe" to [mysqld] section my.ini
|
||||
# .;/path/to/unix_socket;username;password;database - use Unix sockets at Unix/Linux
|
||||
# Unix sockets: experimental, not tested
|
||||
#
|
||||
# LogsDir
|
||||
# Logs directory setting.
|
||||
# Important: Logs dir must exists, or all logs be disable
|
||||
# Default: "" - no log directory prefix, if used log names isn't absolute path then logs will be
|
||||
# stored in current directory for run program.
|
||||
#
|
||||
# MaxPingTime
|
||||
# Settings for maximum database-ping interval (minutes between pings)
|
||||
#
|
||||
# RealmServerPort
|
||||
# Default RealmServerPort
|
||||
#
|
||||
# BindIP
|
||||
# Bind Realm Server to IP/hostname
|
||||
#
|
||||
# PidFile
|
||||
# Realmd daemon PID file
|
||||
# Default: "" - do not create PID file
|
||||
# "./realmd.pid" - create PID file (recommended name)
|
||||
#
|
||||
# LogLevel
|
||||
# Server console level of logging
|
||||
# 0 = Minimum; 1 = Error; 2 = Detail; 3 = Full/Debug
|
||||
# Default: 0
|
||||
#
|
||||
# LogTime
|
||||
# Include time in server console output [hh:mm:ss]
|
||||
# Default: 0 (no time)
|
||||
# 1 (print time)
|
||||
#
|
||||
# LogFile
|
||||
# Logfile name
|
||||
# Default: "realmd.log"
|
||||
# "" - empty name disable creating log file
|
||||
#
|
||||
# LogTimestamp
|
||||
# Logfile with timestamp of server start in name
|
||||
# Default: 0 - no timestamp in name
|
||||
# 1 - add timestamp in name in form Logname_YYYY-MM-DD_HH-MM-SS.Ext for Logname.Ext
|
||||
#
|
||||
# LogFileLevel
|
||||
# Server file level of logging
|
||||
# 0 = Minimum; 1 = Error; 2 = Detail; 3 = Full/Debug
|
||||
# Default: 0
|
||||
#
|
||||
# LogColors
|
||||
# Color for messages (format "normal_color details_color debug_color error_color)
|
||||
# Colors: 0 - BLACK, 1 - RED, 2 - GREEN, 3 - BROWN, 4 - BLUE, 5 - MAGENTA, 6 - CYAN, 7 - GREY,
|
||||
# 8 - YELLOW, 9 - LRED, 10 - LGREEN, 11 - LBLUE, 12 - LMAGENTA, 13 - LCYAN, 14 - WHITE
|
||||
# Default: "" - none colors
|
||||
# "13 7 11 9" - for example :)
|
||||
#
|
||||
# UseProcessors
|
||||
# Used processors mask for multi-processors system (Used only at Windows)
|
||||
# Default: 0 (selected by OS)
|
||||
# number (bitmask value of selected processors)
|
||||
#
|
||||
# ProcessPriority
|
||||
# Process proirity setting (Used only at Windows)
|
||||
# Default: 1 (HIGH)
|
||||
# 0 (Normal)
|
||||
#
|
||||
# RealmsStateUpdateDelay
|
||||
# Realm list Update up delay (updated at realm list request if delay expired).
|
||||
# Default: 20
|
||||
# 0 (Disabled)
|
||||
#
|
||||
# WrongPass.MaxCount
|
||||
# Number of login attemps with wrong password before the account or IP is banned
|
||||
# Default: 0 (Never ban)
|
||||
#
|
||||
# WrongPass.BanTime
|
||||
# Duration of the ban in seconds (0 means permanent ban)
|
||||
# Default: 600
|
||||
#
|
||||
# WrongPass.BanType
|
||||
# Ban the IP or account on which login is attempted
|
||||
# Default: 0 (Ban IP)
|
||||
# 1 (Ban Account)
|
||||
#
|
||||
###################################################################################################################
|
||||
|
||||
LoginDatabaseInfo = "127.0.0.1;3306;trinity;trinity;realmd"
|
||||
LogsDir = ""
|
||||
MaxPingTime = 30
|
||||
RealmServerPort = 3724
|
||||
BindIP = "0.0.0.0"
|
||||
PidFile = ""
|
||||
LogLevel = 0
|
||||
LogTime = 0
|
||||
LogFile = "realmd.log"
|
||||
LogTimestamp = 0
|
||||
LogFileLevel = 0
|
||||
LogColors = ""
|
||||
UseProcessors = 0
|
||||
ProcessPriority = 1
|
||||
RealmsStateUpdateDelay = 20
|
||||
WrongPass.MaxCount = 0
|
||||
WrongPass.BanTime = 600
|
||||
WrongPass.BanType = 0
|
||||
Reference in New Issue
Block a user