void CVDBMgr::x_Init(void) { if ( rc_t rc = VDBManagerMakeRead(x_InitPtr(), 0) ) { *x_InitPtr() = 0; NCBI_THROW2(CSraException, eInitFailed, "Cannot open VDBManager", rc); } uint32_t sdk_ver; if ( rc_t rc = VDBManagerVersion(*this, &sdk_ver) ) { NCBI_THROW2(CSraException, eInitFailed, "Cannot get VDBManager version", rc); } CKNSManager kns_mgr(CVFSManager(*this)); CNcbiOstrstream str; CNcbiApplication* app = CNcbiApplication::Instance(); if ( app ) { str << app->GetAppName() << ": " << app->GetVersion().Print() << "; "; } #if NCBI_PACKAGE str << "Package: " << NCBI_PACKAGE_NAME << ' ' << NCBI_PACKAGE_VERSION << "; "; #endif str << "C++ "; #ifdef NCBI_PRODUCTION_VER str << NCBI_PRODUCTION_VER << "/"; #endif #ifdef NCBI_DEVELOPMENT_VER str << NCBI_DEVELOPMENT_VER; #endif string prefix = CNcbiOstrstreamToString(str); KNSManagerSetUserAgent(kns_mgr, "%s; SRA Toolkit %V", prefix.c_str(), sdk_ver); // redirect VDB log to C++ Toolkit if ( s_GetDiagHandler() ) { KLogInit(); KLogLevelSet(klogDebug); KLogLibHandlerSet(VDBLogWriter, 0); } if ( app ) { string host = app->GetConfig().GetString("CONN", "HTTP_PROXY_HOST", kEmptyStr); int port = app->GetConfig().GetInt("CONN", "HTTP_PROXY_PORT", 0); if ( !host.empty() && port != 0 ) { if ( rc_t rc = KNSManagerSetHTTPProxyPath(kns_mgr, "%s:%d", host.c_str(), port) ) { NCBI_THROW2(CSraException, eInitFailed, "Cannot set KNSManager proxy parameters", rc); } KNSManagerSetHTTPProxyEnabled(kns_mgr, true); } } }
/******************************************************************** helper function to display the version of the vdb-manager ********************************************************************/ rc_t vdh_show_manager_version( const VDBManager *my_manager ) { uint32_t version; rc_t rc = VDBManagerVersion( my_manager, &version ); DISP_RC( rc, "VDBManagerVersion() failed" ); if ( rc == 0 ) { PLOGMSG ( klogInfo, ( klogInfo, "manager-version = $(maj).$(min).$(rel)", "vers=0x%X,maj=%u,min=%u,rel=%u", version, version >> 24, ( version >> 16 ) & 0xFF, version & 0xFFFF )); }
static rc_t CC ReportSOFTWARE(const ReportFuncs *f, uint32_t indent, const char *argv_0, const char *date, ver_t tool_ver ) { rc_t rc = 0; Report* self = NULL; ReportGet(&self); assert(self); reportOpen(indent, "SOFTWARE", 0); if (self->mgr) { uint32_t version = 0; rc = VDBManagerVersion(self->mgr, &version); if (rc != 0) { reportOpen(indent + 1, "Library", 0); reportError(indent + 2, rc, "VDBManagerVersion"); reportClose(indent + 1, "Library"); } else { report(indent + 1, "VDBLibrary", 1, "vers", 'V', version); } } { rc_t rc2 = ReportBuild(f, indent + 1, self->mgr); if (rc == 0 && rc2 != 0) { rc = rc2; } } if (argv_0) { const char tag[] = "Tool"; reportOpen(indent + 1, tag, 3, "date", 's', date, "name", 's', argv_0, "vers", 'V', tool_ver); { rc_t rc2 = ReportBinary(f, indent + 2, argv_0); if (rc == 0 && rc2 != 0) { rc = rc2; } } reportClose(indent + 1, tag); } reportClose(indent, "SOFTWARE"); return rc; }