本文整理汇总了C++中SSLeay_version函数的典型用法代码示例。如果您正苦于以下问题:C++ SSLeay_version函数的具体用法?C++ SSLeay_version怎么用?C++ SSLeay_version使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SSLeay_version函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
/// Launch the auth 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)
{
printf("Runtime-Error: -c option requires an input argument\n");
usage(argv[0]);
return 1;
}
else
cfg_file = argv[c];
}
++c;
}
if (!ConfigMgr::Load(cfg_file))
{
printf("Invalid or missing configuration file : %s\n", cfg_file);
printf("Verify that the file exists and has \'[authserver]\' written in the top of the file!\n");
return 1;
}
sLog->outInfo(LOG_FILTER_AUTHSERVER, "NotaTank Rev1 (authserver) aka our first release!", _FULLVERSION);
sLog->outInfo(LOG_FILTER_AUTHSERVER, "<Ctrl-C> to stop.\n");
sLog->outInfo(LOG_FILTER_AUTHSERVER, "Using configuration file NotaTank Config.", cfg_file);
sLog->outWarn(LOG_FILTER_AUTHSERVER, "%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true);
#else
ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);
#endif
sLog->outDebug(LOG_FILTER_AUTHSERVER, "Max allowed open files is %d", ACE::max_handles());
// authserver PID file creation
std::string pidfile = ConfigMgr::GetStringDefault("PidFile", "");
if (!pidfile.empty())
{
uint32 pid = CreatePIDFile(pidfile);
if (!pid)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Cannot create PID file %s.\n", pidfile.c_str());
return 1;
}
sLog->outInfo(LOG_FILTER_AUTHSERVER, "Daemon PID: %u\n", pid);
}
// Initialize the database connection
if (!StartDB())
return 1;
// Get the list of realms for the server
sRealmList->Initialize(ConfigMgr::GetIntDefault("RealmsStateUpdateDelay", 20));
if (sRealmList->size() == 0)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "No valid realms specified.");
return 1;
}
// Launch the listening network socket
RealmAcceptor acceptor;
int32 rmport = ConfigMgr::GetIntDefault("RealmServerPort", 3724);
if (rmport < 0 || rmport > 0xFFFF)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Specified port out of allowed range (1-65535)");
return 1;
}
std::string bind_ip = ConfigMgr::GetStringDefault("BindIP", "0.0.0.0");
ACE_INET_Addr bind_addr(uint16(rmport), bind_ip.c_str());
if (acceptor.open(bind_addr, ACE_Reactor::instance(), ACE_NONBLOCK) == -1)
{
sLog->outError(LOG_FILTER_AUTHSERVER, "Auth server can not bind to %s:%d", bind_ip.c_str(), rmport);
return 1;
}
// Initialise the signal handlers
AuthServerSignalHandler SignalINT, SignalTERM;
// Register authservers's signal handlers
ACE_Sig_Handler Handler;
Handler.register_handler(SIGINT, &SignalINT);
Handler.register_handler(SIGTERM, &SignalTERM);
///- Handle affinity for multiple processors and process priority on Windows
#ifdef _WIN32
{
HANDLE hProcess = GetCurrentProcess();
//.........这里部分代码省略.........
示例2: main
/// Launch the Trinity server
extern int main(int argc, char **argv) {
///- Command line parsing to get the configuration file name
char const* cfg_file = _FRENCHCORE_CORE_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("Invalid or missing configuration file : %s", cfg_file);
sLog->outError(
"Verify that the file exists and has \'[worldserver]' written in the top of the file!");
return 1;
}
sLog->outString("Using configuration file %s.", cfg_file);
sLog->outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT,
SSLeay_version(SSLEAY_VERSION));
sLog->outDetail("Using ACE: %s", ACE_VERSION);
///- and run the 'Master'
/// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd?
int ret = sMaster->Run();
// at sMaster return function exist with codes
// 0 - normal shutdown
// 1 - shutdown at error
// 2 - restart command used, this code can be used by restarter for restart Trinityd
return ret;
}
示例3: main
//.........这里部分代码省略.........
return 1;
}
#ifndef WIN32 // posix daemon commands need apply after config read
switch (serviceDaemonMode)
{
case 'r':
startDaemon();
break;
case 's':
stopDaemon();
break;
}
#endif
sLog.Initialize();
sLog.outString("%s [realm-daemon]", REVISION_NR);
sLog.outString("<Ctrl-C> to stop.\n");
sLog.outString("Using configuration file %s.", cfg_file);
///- Check the version of the configuration file
uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);
if (confVersion < REALMD_CONFIG_VERSION)
{
sLog.outError("*****************************************************************************");
sLog.outError(" WARNING: Your realmd.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("*****************************************************************************");
Log::WaitBeforeContinueIfNeed();
}
DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
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]");
}
DETAIL_LOG("Using ACE: %s", ACE_VERSION);
#if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL)
ACE_Reactor::instance(new ACE_Reactor(new ACE_Dev_Poll_Reactor(ACE::max_handles(), 1), 1), true);
#else
ACE_Reactor::instance(new ACE_Reactor(new ACE_TP_Reactor(), true), true);
#endif
sLog.outBasic("Max allowed open files is %d", ACE::max_handles());
/// realmd PID file creation
std::string pidfile = sConfig.GetStringDefault("PidFile", "");
if (!pidfile.empty())
{
uint32 pid = CreatePIDFile(pidfile);
if (!pid)
{
sLog.outError("Can not create PID file %s.\n", pidfile.c_str());
Log::WaitBeforeContinueIfNeed();
return 1;
}
sLog.outString("Daemon PID: %u\n", pid);
}
///- Initialize the database connection
示例4: main
/// Launch the realm server
extern int main(int argc, char **argv)
{
sLog.SetLogDB(false);
///- Command line parsing to get the configuration file name
char const* cfg_file = _RIBON_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( "(logon-daemon) Revision: %s ", _FULLVERSION );
sLog.outString( "Build Date: %s", __DATE__ );
sLog.outString( "Build Time: %s", __TIME__ );
sLog.outString( "<Ctrl-C> to stop.\n" );
sLog.outString( "'########::'####:'########:::'#######::'##::: ##:");
sLog.outString( " ##.... ##:. ##:: ##.... ##:'##.... ##: ###:: ##:");
sLog.outString( " ##:::: ##:: ##:: ##:::: ##: ##:::: ##: ####: ##:");
sLog.outString( " ########::: ##:: ########:: ##:::: ##: ## ## ##:");
sLog.outString( " ##.. ##:::: ##:: ##.... ##: ##:::: ##: ##. ####:");
sLog.outString( " ##::. ##::: ##:: ##:::: ##: ##:::: ##: ##:. ###:");
sLog.outString( " ##:::. ##:'####: ########::. #######:: ##::. ##:");
sLog.outString( "..:::::..::....::........::::.......:::..::::..::");
sLog.outString( " L O G O N");
sLog.outString( "http://www.dark-resurrection.de/wowsp/ \n");
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 RibonLogon.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.outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
//.........这里部分代码省略.........
示例5: main
//.........这里部分代码省略.........
case 'S':
if(strcmp(optarg, "hex")==0)
sType = SFMT_HEX;
else if(strcmp(optarg, "str")==0)
sType = SFMT_STR;
else if (strcmp(optarg, "base64"))
sType = SFMT_B64;
else
{
printf("ERROR: For -S (saltfmt) argument %s unknown.\n", optarg);
return -6;
}
break;
case '?':
puts("Case ?");fflush;
if (optopt == 'c')
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
else if (isprint (optopt))
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
else
fprintf (stderr,
"Unknown option character `\\x%x'.\n",
optopt);
return 1;
default:
puts("Case default");fflush;
break;//abort ();
}
if (help)
{
printf("Compiled with OpenSSL version: %s\n",OPENSSL_VERSION_TEXT);
printf("Running with OpenSSL version: %s\n",SSLeay_version(SSLEAY_VERSION));
printf("Example: %s -a SHA-512 -p password -s salt -i 131072 -o 64\n",argv[0]);
puts("\nOptions: ");
puts(" -h help");
puts(" -v Verbose");
puts(" -a algo algorithm, valid values SHA-512|SHA-384|SHA-256|SHA-224|SHA-1|SHA-1nat|MD5 Note that in particular, SHA-384 and SHA-512 use 64-bit operations which as of 2014 penalize GPU's (attackers) much, much more than CPU's (you). Use one of these two if at all possible.");
puts(" -p password Password to hash");
puts(" -P passwordfmt NOT YET IMPLEMENTED - always string");
puts(" -s salt Salt for the hash. Should be long and cryptographically random.");
puts(" -S saltfmt hex: for Hex (default) / str: for String / base64: for Base64 string format");
puts(" -i iterations Number of iterations, as high as you can handle the delay for, at least 16384 recommended.");
puts(" -o bytes Number of bytes of output; for password hashing, keep less than or equal to native hash size (MD5 <=16, SHA-1 <=20, SHA-256 <=32, SHA-512 <=64)");
//puts(" -O outputfmt Output format NOT YET IMPLEMENTED - always HEX (lowercase)");
puts(" -O outputfmt Output format:");
puts(" - hex: Lowercase Hex (default)");
puts(" - Hex: Uppercase Hex");
puts(" - hexc: Lowercase Hex with : deliminated");
puts(" - Hexc: Uppercase Hex with : deliminated");
puts(" - base64: Base64");
puts(" - bin: Binary");
puts(" -e hash Expected hash (in the same format as outputfmt) results in output of 0 <actual> <expected> = different, 1 = same NOT YET IMPLEMENTED");
puts(" -n Interactive mode; NOT YET IMPLEMENTED");
}
if (verbose)
{
printf("Interpreted arguments: algo %i password %s salt %s iterations %i outputbytes %i\n\n",algo,pass,salt,iterations,outputBytes);
}
if (algo <= 0)
{
puts("You must select a known algorithm identifier.");
示例6: main
/// Launch the mangos server
extern int main(int argc, char **argv)
{
// - Construct Memory Manager Instance
MaNGOS::Singleton<MemoryManager>::Instance();
//char *leak = new char[1000]; // test leak detection
///- Command line parsing
char const* cfg_file = _MANGOSD_CONFIG;
#ifdef WIN32
char const *options = ":c:s:";
#else
char const *options = ":c:";
#endif
ACE_Get_Opt cmd_opts(argc, argv, options);
cmd_opts.long_option("version", 'v');
int option;
while ((option = cmd_opts()) != EOF)
{
switch (option)
{
case 'c':
cfg_file = cmd_opts.opt_arg();
break;
case 'v':
printf("%s\n", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID));
return 0;
#ifdef WIN32
case 's':
{
const char *mode = cmd_opts.opt_arg();
if (!strcmp(mode, "install"))
{
if (WinServiceInstall())
sLog.outString("Installing service");
return 1;
}
else if (!strcmp(mode, "uninstall"))
{
if (WinServiceUninstall())
sLog.outString("Uninstalling service");
return 1;
}
else if (!strcmp(mode, "run"))
WinServiceRun();
else
{
sLog.outError("Runtime-Error: -%c unsupported argument %s", cmd_opts.opt_opt(), mode);
usage(argv[0]);
Log::WaitBeforeContinueIfNeed();
return 1;
}
break;
}
#endif
case ':':
sLog.outError("Runtime-Error: -%c option requires an input argument", cmd_opts.opt_opt());
usage(argv[0]);
Log::WaitBeforeContinueIfNeed();
return 1;
default:
sLog.outError("Runtime-Error: bad format of commandline arguments");
usage(argv[0]);
Log::WaitBeforeContinueIfNeed();
return 1;
}
}
if (!sConfig.SetSource(cfg_file))
{
sLog.outError("Could not find configuration file %s.", cfg_file);
Log::WaitBeforeContinueIfNeed();
return 1;
}
sLog.outString( "%s [world-daemon]", _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_NR,REVISION_ID) );
sLog.outString( "<Ctrl-C> to stop.\n\n" );
sLog.outTitle( "___ ___ _ _ ___ ");
sLog.outTitle( "| \\/ | | | (_) / |");
sLog.outTitle( "| . . |_ _ ___| |_ ___ _ __ _ __ _ / /| |");
sLog.outTitle( "| |\\/| | | | / __| __/ _ \\ '__| |/ _` | / /_| |");
sLog.outTitle( "| | | | |_| \\__ \\ || __/ | | | (_| | \\___ |");
sLog.outTitle( "\\_| |_/\\__, |___/\\__\\___|_| |_|\\__,_| |_/");
sLog.outTitle( " __/ | ");
sLog.outTitle( " |___/ http://www.mysteriaserver.sk/wow/ ");
sLog.outTitle( "");
sLog.outString("Using configuration file %s.", cfg_file);
DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
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]");
//.........这里部分代码省略.........
示例7: parseOpt
int LshttpdMain::init(int argc, char *argv[])
{
int ret;
ServerProcessConfig &procConfig = ServerProcessConfig::getInstance();
if (argc > 1)
parseOpt(argc, argv);
if (getServerRoot(argc, argv) != 0)
{
//LS_ERROR("Failed to determine the root directory of server!" ));
fprintf(stderr,
"Can't determine the Home of LiteSpeed Web Server, exit!\n");
return 1;
}
mkdir(DEFAULT_TMP_DIR, 0755);
if (testRunningServer() != 0)
return 2;
if (m_pServer->configServerBasics(0, m_pBuilder->getRoot()))
return 1;
if (!MainServerConfig::getInstance().getDisableLogRotateAtStartup())
LOG4CXX_NS::LogRotate::roll(HttpLog::getErrorLogger()->getAppender(),
procConfig.getUid(),
procConfig.getGid(), 1);
if (procConfig.getUid() <= 10 || procConfig.getGid() < 10)
{
MainServerConfig &MainServerConfigObj = MainServerConfig::getInstance();
LS_ERROR("It is not allowed to run LiteSpeed web server on behalf of a "
"privileged user/group, user id must not be "
"less than 50 and group id must not be less than 10."
"UID of user '%s' is %d, GID of group '%s' is %d. "
"Please fix above problem first!",
MainServerConfigObj.getUser(), procConfig.getUid(),
MainServerConfigObj.getGroup(), procConfig.getGid());
return 1;
}
changeOwner();
plainconf::flushErrorLog();
LS_NOTICE("Loading %s ...", HttpServerVersion::getVersion());
LS_NOTICE("Using [%s]", SSLeay_version(SSLEAY_VERSION));
if (!m_noDaemon)
{
if (Daemonize::daemonize(1, 1))
return 3;
LS_DBG_L("Daemonized!");
#ifndef RUN_TEST
Daemonize::close();
#endif
}
enableCoreDump();
if (testRunningServer() != 0)
return 2;
m_pid = getpid();
if (m_pidFile.writePid(m_pid))
return 2;
startAdminSocket();
ret = config();
if (ret)
{
LS_ERROR("Fatal error in configuration, exit!");
fprintf(stderr, "[ERROR] Fatal error in configuration, shutdown!\n");
return ret;
}
removeOldRtreport();
{
char achBuf[8192];
if (procConfig.getChroot() != NULL)
{
PidFile pidfile;
ConfigCtx::getCurConfigCtx()->getAbsolute(achBuf, PID_FILE, 0);
pidfile.writePidFile(achBuf, m_pid);
}
}
#if defined(__FreeBSD__)
//setproctitle( "%s", "lshttpd" );
#else
argv[1] = NULL;
strcpy(argv[0], "openlitespeed (lshttpd - main)");
#endif
//if ( !m_noCrashGuard && ( m_pBuilder->getCrashGuard() ))
s_iCpuCount = PCUtil::getNumProcessors();
//Server init done
if (GlobalServerSessionHooks->isEnabled(LSI_HKPT_MAIN_INITED))
GlobalServerSessionHooks->runCallbackNoParam(LSI_HKPT_MAIN_INITED, NULL);
if (!m_noCrashGuard && (MainServerConfig::getInstance().getCrashGuard()))
//.........这里部分代码省略.........
示例8: id_response
/*
* Output the ID response.
* We do NOT close the parameter list so other stuff can be added later.
*/
EXPORTED void id_response(struct protstream *pout)
{
struct utsname os;
const char *sasl_imp;
int sasl_ver;
char env_buf[MAXIDVALUELEN+1];
prot_printf(pout, "* ID ("
"\"name\" \"Cyrus IMAPD\""
" \"version\" \"%s\""
" \"vendor\" \"Project Cyrus\""
" \"support-url\" \"http://www.cyrusimap.org\"",
CYRUS_VERSION);
/* add the os info */
if (uname(&os) != -1)
prot_printf(pout,
" \"os\" \"%s\""
" \"os-version\" \"%s\"",
os.sysname, os.release);
#ifdef ID_SAVE_CMDLINE
/* add the command line info */
prot_printf(pout, " \"command\" \"%s\"", id_resp_command);
if (strlen(id_resp_arguments)) {
prot_printf(pout, " \"arguments\" \"%s\"", id_resp_arguments);
} else {
prot_printf(pout, " \"arguments\" NIL");
}
#endif
/* SASL information */
snprintf(env_buf, MAXIDVALUELEN,"Built w/Cyrus SASL %d.%d.%d",
SASL_VERSION_MAJOR, SASL_VERSION_MINOR, SASL_VERSION_STEP);
sasl_version(&sasl_imp, &sasl_ver);
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; Running w/%s %d.%d.%d", sasl_imp,
(sasl_ver & 0xFF000000) >> 24,
(sasl_ver & 0x00FF0000) >> 16,
(sasl_ver & 0x0000FFFF));
/* add the environment info */
#ifdef DB_VERSION_STRING
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; Built w/%s", DB_VERSION_STRING);
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; Running w/%s", db_version(NULL, NULL, NULL));
#endif
#ifdef HAVE_SSL
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; Built w/%s", OPENSSL_VERSION_TEXT);
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; Running w/%s", SSLeay_version(SSLEAY_VERSION));
#ifdef EGD_SOCKET
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
" (with EGD)");
#endif
#endif
#ifdef HAVE_ZLIB
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; Built w/zlib %s", ZLIB_VERSION);
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; Running w/zlib %s", zlibVersion());
#endif
#ifdef USE_SIEVE
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; %s", SIEVE_VERSION);
#endif
#ifdef HAVE_LIBWRAP
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; TCP Wrappers");
#endif
#ifdef HAVE_UCDSNMP
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; UCD-SNMP %s", VersionInfo);
#endif
#ifdef HAVE_NETSNMP
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; NET-SNMP");
#endif
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; mmap = %s", map_method_desc);
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; lock = %s", lock_method_desc);
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; nonblock = %s", nonblock_method_desc);
#ifdef HAVE_KRB
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
" (%s)", krb4_version);
#endif
if (idle_method_desc)
snprintf(env_buf + strlen(env_buf), MAXIDVALUELEN - strlen(env_buf),
"; idle = %s", idle_method_desc);
prot_printf(pout, " \"environment\" \"%s\"", env_buf);
//.........这里部分代码省略.........
示例9: main
/// Launch the Trinity server
extern int main(int argc, char** argv)
{
///- Command line parsing to get the configuration file name
char const* cfg_file = _TRINITY_CORE_CONFIG;
int c = 1;
while (c < argc)
{
if (!strcmp(argv[c], "-c"))
{
if (++c >= argc)
{
printf("Runtime-Error: -c option requires an input argument");
usage(argv[0]);
return 1;
}
else
cfg_file = argv[c];
}
#ifdef _WIN32
if (strcmp(argv[c], "-s") == 0) // Services
{
if (++c >= argc)
{
printf("Runtime-Error: -s option requires an input argument");
usage(argv[0]);
return 1;
}
if (strcmp(argv[c], "install") == 0)
{
if (WinServiceInstall())
printf("Installing service\n");
return 1;
}
else if (strcmp(argv[c], "uninstall") == 0)
{
if (WinServiceUninstall())
printf("Uninstalling service\n");
return 1;
}
else
{
printf("Runtime-Error: unsupported option %s", argv[c]);
usage(argv[0]);
return 1;
}
}
if (strcmp(argv[c], "--service") == 0)
WinServiceRun();
#endif
++c;
}
if (!sConfigMgr->LoadInitial(cfg_file))
{
printf("Invalid or missing configuration file : %s\n", cfg_file);
printf("Verify that the file exists and has \'[worldserver]' written in the top of the file!\n");
return 1;
}
TC_LOG_INFO("server.worldserver", "Using configuration file %s.", cfg_file);
TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
TC_LOG_INFO("server.worldserver", "Using ACE version: %s", ACE_VERSION);
///- and run the 'Master'
/// @todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd?
int ret = sMaster->Run();
// at sMaster return function exist with codes
// 0 - normal shutdown
// 1 - shutdown at error
// 2 - restart command used, this code can be used by restarter for restart Trinityd
return ret;
}
示例10: ssl_openssl_version
/*
* Print OpenSSL version and build-time configuration to standard error and
* return.
*/
void
ssl_openssl_version(void)
{
fprintf(stderr, "compiled against %s (%lx)\n",
OPENSSL_VERSION_TEXT,
(long unsigned int)OPENSSL_VERSION_NUMBER);
fprintf(stderr, "rtlinked against %s (%lx)\n",
SSLeay_version(SSLEAY_VERSION),
SSLeay());
#ifndef OPENSSL_NO_TLSEXT
fprintf(stderr, "TLS Server Name Indication (SNI) supported\n");
#else /* OPENSSL_NO_TLSEXT */
fprintf(stderr, "TLS Server Name Indication (SNI) not supported\n");
#endif /* OPENSSL_NO_TLSEXT */
#ifdef OPENSSL_THREADS
#ifndef OPENSSL_NO_THREADID
fprintf(stderr, "OpenSSL is thread-safe with THREADID\n");
#else /* OPENSSL_NO_THREADID */
fprintf(stderr, "OpenSSL is thread-safe without THREADID\n");
#endif /* OPENSSL_NO_THREADID */
#else /* !OPENSSL_THREADS */
fprintf(stderr, "OpenSSL is not thread-safe\n");
#endif /* !OPENSSL_THREADS */
#ifdef SSL_MODE_RELEASE_BUFFERS
fprintf(stderr, "Using SSL_MODE_RELEASE_BUFFERS\n");
#else /* !SSL_MODE_RELEASE_BUFFERS */
fprintf(stderr, "Not using SSL_MODE_RELEASE_BUFFERS\n");
#endif /* !SSL_MODE_RELEASE_BUFFERS */
#if (OPENSSL_VERSION_NUMBER == 0x0090819fL) || \
(OPENSSL_VERSION_NUMBER == 0x100000bfL) || \
(OPENSSL_VERSION_NUMBER == 0x1000105fL)
fprintf(stderr, "Using direct access workaround when loading certs\n");
#endif /* OpenSSL 0.9.8y, 1.0.0k or 1.0.1e */
fprintf(stderr, "SSL/TLS protocol availability: %s\n",
SSL_PROTO_SUPPORT_S);
fprintf(stderr, "SSL/TLS algorithm availability:");
#ifndef OPENSSL_NO_RSA
fprintf(stderr, " RSA");
#else /* OPENSSL_NO_RSA */
fprintf(stderr, " !RSA");
#endif /* OPENSSL_NO_RSA */
#ifndef OPENSSL_NO_DSA
fprintf(stderr, " DSA");
#else /* OPENSSL_NO_DSA */
fprintf(stderr, " !DSA");
#endif /* OPENSSL_NO_DSA */
#ifndef OPENSSL_NO_ECDSA
fprintf(stderr, " ECDSA");
#else /* OPENSSL_NO_ECDSA */
fprintf(stderr, " !ECDSA");
#endif /* OPENSSL_NO_ECDSA */
#ifndef OPENSSL_NO_DH
fprintf(stderr, " DH");
#else /* OPENSSL_NO_DH */
fprintf(stderr, " !DH");
#endif /* OPENSSL_NO_DH */
#ifndef OPENSSL_NO_ECDH
fprintf(stderr, " ECDH");
#else /* OPENSSL_NO_ECDH */
fprintf(stderr, " !ECDH");
#endif /* OPENSSL_NO_ECDH */
#ifndef OPENSSL_NO_EC
fprintf(stderr, " EC");
#else /* OPENSSL_NO_EC */
fprintf(stderr, " !EC");
#endif /* OPENSSL_NO_EC */
fprintf(stderr, "\n");
fprintf(stderr, "OpenSSL option availability:");
#ifdef SSL_OP_NO_COMPRESSION
fprintf(stderr, " SSL_OP_NO_COMPRESSION");
#else /* !SSL_OP_NO_COMPRESSION */
fprintf(stderr, " !SSL_OP_NO_COMPRESSION");
#endif /* SSL_OP_NO_COMPRESSION */
#ifdef SSL_OP_NO_TICKET
fprintf(stderr, " SSL_OP_NO_TICKET");
#else /* !SSL_OP_NO_TICKET */
fprintf(stderr, " !SSL_OP_NO_TICKET");
#endif /* SSL_OP_NO_TICKET */
#ifdef SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION
fprintf(stderr, " SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION");
#else /* !SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION */
fprintf(stderr, " !SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION");
#endif /* !SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION */
#ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS
fprintf(stderr, " SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS");
#else /* !SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS */
fprintf(stderr, " !SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS");
#endif /* !SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS */
#ifdef SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION
fprintf(stderr, " SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION");
#else /* !SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION */
fprintf(stderr, " !SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION");
#endif /* !SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION */
//.........这里部分代码省略.........
示例11: HandleServerDebugCommand
static bool HandleServerDebugCommand(ChatHandler* handler, char const* /*args*/)
{
uint16 worldPort = uint16(sWorld->getIntConfig(CONFIG_PORT_WORLD));
std::string dbPortOutput;
{
uint16 dbPort = 0;
if (QueryResult res = LoginDatabase.PQuery("SELECT port FROM realmlist WHERE id = %u", realm.Id.Realm))
dbPort = (*res)[0].GetUInt16();
if (dbPort)
dbPortOutput = Trinity::StringFormat("Realmlist (Realm Id: %u) configured in port %" PRIu16, realm.Id.Realm, dbPort);
else
dbPortOutput = Trinity::StringFormat("Realm Id: %u not found in `realmlist` table. Please check your setup", realm.Id.Realm);
}
handler->PSendSysMessage("%s", GitRevision::GetFullVersion());
handler->PSendSysMessage("Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
handler->PSendSysMessage("Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
handler->PSendSysMessage("Using MySQL version: %s", MYSQL_SERVER_VERSION);
handler->PSendSysMessage("Using CMake version: %s", GitRevision::GetCMakeVersion());
handler->PSendSysMessage("Compiled on: %s", GitRevision::GetHostOSVersion());
uint32 updateFlags = sConfigMgr->GetIntDefault("Updates.EnableDatabases", DatabaseLoader::DATABASE_NONE);
if (!updateFlags)
handler->SendSysMessage("Automatic database updates are disabled for all databases!");
else
{
static char const* const databaseNames[3 /*TOTAL_DATABASES*/] =
{
"Auth",
"Characters",
"World"
};
std::string availableUpdateDatabases;
for (uint32 i = 0; i < 3 /* TOTAL_DATABASES*/; ++i)
{
if (!(updateFlags & (1 << i)))
continue;
availableUpdateDatabases += databaseNames[i];
if (i != 3 /*TOTAL_DATABASES*/ - 1)
availableUpdateDatabases += ", ";
}
handler->PSendSysMessage("Automatic database updates are enabled for the following databases: %s", availableUpdateDatabases.c_str());
}
handler->PSendSysMessage("Worldserver listening connections on port %" PRIu16, worldPort);
handler->PSendSysMessage("%s", dbPortOutput.c_str());
bool vmapIndoorCheck = sWorld->getBoolConfig(CONFIG_VMAP_INDOOR_CHECK);
bool vmapLOSCheck = VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled();
bool vmapHeightCheck = VMAP::VMapFactory::createOrGetVMapManager()->isHeightCalcEnabled();
bool mmapEnabled = sWorld->getBoolConfig(CONFIG_ENABLE_MMAPS);
std::string dataDir = sWorld->GetDataPath();
std::vector<std::string> subDirs;
subDirs.emplace_back("maps");
if (vmapIndoorCheck || vmapLOSCheck || vmapHeightCheck)
{
handler->PSendSysMessage("VMAPs status: Enabled. LineOfSight: %i, getHeight: %i, indoorCheck: %i", vmapLOSCheck, vmapHeightCheck, vmapIndoorCheck);
subDirs.emplace_back("vmaps");
}
else
handler->SendSysMessage("VMAPs status: Disabled");
if (mmapEnabled)
{
handler->SendSysMessage("MMAPs status: Enabled");
subDirs.emplace_back("mmaps");
}
else
handler->SendSysMessage("MMAPs status: Disabled");
for (std::string const& subDir : subDirs)
{
boost::filesystem::path mapPath(dataDir);
mapPath.append(subDir);
if (!boost::filesystem::exists(mapPath))
{
handler->PSendSysMessage("%s directory doesn't exist!. Using path: %s", subDir.c_str(), mapPath.generic_string().c_str());
continue;
}
auto end = boost::filesystem::directory_iterator();
std::size_t folderSize = std::accumulate(boost::filesystem::directory_iterator(mapPath), end, std::size_t(0), [](std::size_t val, boost::filesystem::path const& mapFile)
{
if (boost::filesystem::is_regular_file(mapFile))
val += boost::filesystem::file_size(mapFile);
return val;
});
handler->PSendSysMessage("%s directory located in %s. Total size: " SZFMTD " bytes", subDir.c_str(), mapPath.generic_string().c_str(), folderSize);
}
//.........这里部分代码省略.........
示例12: main
/// Launch the realm server
int main(int argc, char *argv[])
{
std::string configFile, serviceParameter;
boost::program_options::options_description desc("Allowed options");
desc.add_options()
("config,c", boost::program_options::value<std::string>(&configFile)->default_value(_REALMD_CONFIG), "configuration file")
("version,v", "print version and exit")
#ifdef _WIN32
("s", boost::program_options::value<std::string>(&serviceParameter), "<run, install, uninstall> service");
#else
("s", boost::program_options::value<std::string>(&serviceParameter), "<run, stop> service");
#endif
boost::program_options::variables_map vm;
try
{
boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
boost::program_options::notify(vm);
}
catch (boost::program_options::error const &e)
{
std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
std::cerr << desc << std::endl;
return 1;
}
#ifdef _WIN32 // windows service command need execute before config read
if (vm.count("s"))
{
switch (::tolower(serviceParameter[0]))
{
case 'i':
if (WinServiceInstall())
sLog.outString("Installing service");
return 1;
case 'u':
if (WinServiceUninstall())
sLog.outString("Uninstalling service");
return 1;
case 'r':
WinServiceRun();
break;
}
}
#endif
if (!sConfig.SetSource(configFile))
{
sLog.outError("Could not find configuration file %s.", configFile.c_str());
Log::WaitBeforeContinueIfNeed();
return 1;
}
#ifndef _WIN32 // posix daemon commands need apply after config read
if (vm.count("s"))
{
switch (::tolower(serviceParameter[0]))
{
case 'r':
startDaemon();
break;
case 's':
stopDaemon();
break;
}
}
#endif
sLog.Initialize();
sLog.outString("%s [realm-daemon]", _FULLVERSION(REVISION_DATE, REVISION_TIME, REVISION_ID));
sLog.outString("<Ctrl-C> to stop.\n");
sLog.outString("Using configuration file %s.", configFile.c_str());
///- Check the version of the configuration file
uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);
if (confVersion < _REALMDCONFVERSION)
{
sLog.outError("*****************************************************************************");
sLog.outError(" WARNING: Your realmd.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("*****************************************************************************");
Log::WaitBeforeContinueIfNeed();
}
DETAIL_LOG("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
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]");
}
/// realmd PID file creation
std::string pidfile = sConfig.GetStringDefault("PidFile");
if (!pidfile.empty())
//.........这里部分代码省略.........
示例13: QDialog
RPCConsole::RPCConsole(QWidget* parent) : QDialog(parent),
ui(new Ui::RPCConsole),
clientModel(0),
historyPtr(0),
cachedNodeid(-1),
peersTableContextMenu(0),
banTableContextMenu(0)
{
ui->setupUi(this);
GUIUtil::restoreWindowGeometry("nRPCConsoleWindow", this->size(), this);
#ifndef Q_OS_MAC
ui->openDebugLogfileButton->setIcon(QIcon(":/icons/export"));
#endif
// Install event filter for up and down arrow
ui->lineEdit->installEventFilter(this);
ui->messagesWidget->installEventFilter(this);
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
connect(ui->btnClearTrafficGraph, SIGNAL(clicked()), ui->trafficGraph, SLOT(clear()));
// Wallet Repair Buttons
connect(ui->btn_salvagewallet, SIGNAL(clicked()), this, SLOT(walletSalvage()));
connect(ui->btn_rescan, SIGNAL(clicked()), this, SLOT(walletRescan()));
connect(ui->btn_zapwallettxes1, SIGNAL(clicked()), this, SLOT(walletZaptxes1()));
connect(ui->btn_zapwallettxes2, SIGNAL(clicked()), this, SLOT(walletZaptxes2()));
connect(ui->btn_upgradewallet, SIGNAL(clicked()), this, SLOT(walletUpgrade()));
connect(ui->btn_reindex, SIGNAL(clicked()), this, SLOT(walletReindex()));
connect(ui->btn_resync, SIGNAL(clicked()), this, SLOT(walletResync()));
// set library version labels
ui->openSSLVersion->setText(SSLeay_version(SSLEAY_VERSION));
#ifdef ENABLE_WALLET
std::string strPathCustom = GetArg("-backuppath", "");
std::string strzXAPPathCustom = GetArg("-zxapbackuppath", "");
int nCustomBackupThreshold = GetArg("-custombackupthreshold", DEFAULT_CUSTOMBACKUPTHRESHOLD);
if(!strPathCustom.empty()) {
ui->wallet_custombackuppath->setText(QString::fromStdString(strPathCustom));
ui->wallet_custombackuppath_label->show();
ui->wallet_custombackuppath->show();
}
if(!strzXAPPathCustom.empty()) {
ui->wallet_customzxapbackuppath->setText(QString::fromStdString(strzXAPPathCustom));
ui->wallet_customzxapbackuppath_label->setVisible(true);
ui->wallet_customzxapbackuppath->setVisible(true);
}
if((!strPathCustom.empty() || !strzXAPPathCustom.empty()) && nCustomBackupThreshold > 0) {
ui->wallet_custombackupthreshold->setText(QString::fromStdString(std::to_string(nCustomBackupThreshold)));
ui->wallet_custombackupthreshold_label->setVisible(true);
ui->wallet_custombackupthreshold->setVisible(true);
}
ui->berkeleyDBVersion->setText(DbEnv::version(0, 0, 0));
ui->wallet_path->setText(QString::fromStdString(GetDataDir().string() + QDir::separator().toLatin1() + GetArg("-wallet", "wallet.dat")));
#else
ui->label_berkeleyDBVersion->hide();
ui->berkeleyDBVersion->hide();
#endif
// Register RPC timer interface
rpcTimerInterface = new QtRPCTimerInterface();
RPCRegisterTimerInterface(rpcTimerInterface);
startExecutor();
setTrafficGraphRange(INITIAL_TRAFFIC_GRAPH_MINS);
ui->peerHeading->setText(tr("Select a peer to view detailed information."));
clear();
}
示例14: main
/// Launch the Trinity server
extern int main(int argc, char **argv)
{
///- Command line parsing to get the configuration file name
char const* cfg_file = _PHANTOM_CORE_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]);
Log::WaitBeforeContinueIfNeed();
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]);
Log::WaitBeforeContinueIfNeed();
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);
sLog.outDetail("%s (Library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION));
sLog.outDetail("Using ACE: %s", ACE_VERSION);
///- and run the 'Master'
/// \todo Why do we need this 'Master'? Can't all of this be in the Main as for Realmd?
return sMaster.Run();
// at sMaster return function exist with codes
// 0 - normal shutdown
// 1 - shutdown at error
// 2 - restart command used, this code can be used by restarter for restart Trinityd
}
示例15: main
//.........这里部分代码省略.........
case 'v':
{
if (strncmp("verbose",option+1,1) == 0)
{
if (*option == '-')
{
g_verbose=1;
msock_set_debug(g_verbose);
}
}
break;
}
case 'q':
{
if (strncmp("quiet",option+1,1) == 0)
{
if (*option == '-')
{
g_quiet=1;
}
}
break;
}
case 'V':
{
(void) fprintf(stderr,"mailsend Version: %.1024s\n",MAILSEND_VERSION);
#ifdef HAVE_OPENSSL
(void) fprintf(stderr,"Compiled with OpenSSL: %s\n",
SSLeay_version(SSLEAY_VERSION));
#else
(void) fprintf(stderr,"Not Compiled OpenSSL, some auth methods will be unavailable\n");
#endif /* ! HAVE_OPENSSL */
rc = 0;
goto ExitProcessing;
break;
}
case 't':
{
if (strncmp("to",option+1,1) == 0)
{
if (*option == '-')
{
i++;
if (i == argc)
{
(void) fprintf(stderr,"Error: missing to addresses\n");
rc = 1;
goto ExitProcessing;
}
to=argv[i];
save_to=mutilsStrdup(to);
if (save_to == NULL)
{
errorMsg("memory allocation problem for -to");
rc = 1;
goto ExitProcessing;
}
save_to=fix_to(save_to);
to=fix_to(to);
/* collapse all spaces to a comma */