Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
util.cpp File Reference
#include "util.h"
#include "chainparams.h"
#include "netbase.h"
#include "sync.h"
#include "ui_interface.h"
#include "uint256.h"
#include "version.h"
#include <stdarg.h>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <algorithm>
#include <fcntl.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/foreach.hpp>
#include <boost/program_options/detail/config_file.hpp>
#include <boost/program_options/parsers.hpp>
#include <openssl/crypto.h>
#include <openssl/rand.h>
+ Include dependency graph for util.cpp:

Go to the source code of this file.

Classes

class  CInit
 

Functions

void locking_callback (int mode, int i, const char *file, int line)
 
void RandAddSeed ()
 
void RandAddSeedPerfmon ()
 
uint64_t GetRand (uint64_t nMax)
 
int GetRandInt (int nMax)
 
uint256 GetRandHash ()
 
static void DebugPrintInit ()
 
bool LogAcceptCategory (const char *category)
 
int LogPrintStr (const std::string &str)
 
string FormatMoney (int64_t n, bool fPlus)
 
bool ParseMoney (const string &str, int64_t &nRet)
 
bool ParseMoney (const char *pszIn, int64_t &nRet)
 
static string safeChars ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890 .,;_/:?@")
 
string SanitizeString (const string &str)
 
bool IsHex (const string &str)
 
vector< unsigned char > ParseHex (const char *psz)
 
vector< unsigned char > ParseHex (const string &str)
 
static void InterpretNegativeSetting (string name, map< string, string > &mapSettingsRet)
 
void ParseParameters (int argc, const char *const argv[])
 
std::string GetArg (const std::string &strArg, const std::string &strDefault)
 Return string argument or default value. More...
 
int64_t GetArg (const std::string &strArg, int64_t nDefault)
 Return integer argument or default value. More...
 
bool GetBoolArg (const std::string &strArg, bool fDefault)
 Return boolean argument or default value. More...
 
bool SoftSetArg (const std::string &strArg, const std::string &strValue)
 Set an argument if it doesn't already have a value. More...
 
bool SoftSetBoolArg (const std::string &strArg, bool fValue)
 Set a boolean argument if it doesn't already have a value. More...
 
string EncodeBase64 (const unsigned char *pch, size_t len)
 
string EncodeBase64 (const string &str)
 
vector< unsigned char > DecodeBase64 (const char *p, bool *pfInvalid)
 
string DecodeBase64 (const string &str)
 
string EncodeBase32 (const unsigned char *pch, size_t len)
 
string EncodeBase32 (const string &str)
 
vector< unsigned char > DecodeBase32 (const char *p, bool *pfInvalid)
 
string DecodeBase32 (const string &str)
 
bool WildcardMatch (const char *psz, const char *mask)
 
bool WildcardMatch (const string &str, const string &mask)
 
static std::string FormatException (std::exception *pex, const char *pszThread)
 
void LogException (std::exception *pex, const char *pszThread)
 
void PrintExceptionContinue (std::exception *pex, const char *pszThread)
 
boost::filesystem::path GetDefaultDataDir ()
 
const boost::filesystem::path & GetDataDir (bool fNetSpecific)
 
void ClearDatadirCache ()
 
boost::filesystem::path GetConfigFile ()
 
void ReadConfigFile (map< string, string > &mapSettingsRet, map< string, vector< string > > &mapMultiSettingsRet)
 
boost::filesystem::path GetPidFile ()
 
void CreatePidFile (const boost::filesystem::path &path, pid_t pid)
 
bool RenameOver (boost::filesystem::path src, boost::filesystem::path dest)
 
bool TryCreateDirectory (const boost::filesystem::path &p)
 
void FileCommit (FILE *fileout)
 
bool TruncateFile (FILE *file, unsigned int length)
 
int RaiseFileDescriptorLimit (int nMinFD)
 
void AllocateFileRange (FILE *file, unsigned int offset, unsigned int length)
 
void ShrinkDebugFile ()
 
int64_t GetTime ()
 
void SetMockTime (int64_t nMockTimeIn)
 
int64_t GetTimeOffset ()
 
int64_t GetAdjustedTime ()
 
void AddTimeData (const CNetAddr &ip, int64_t nTime)
 
void seed_insecure_rand (bool fDeterministic)
 Seed insecure_rand using the random pool. More...
 
string FormatVersion (int nVersion)
 
string FormatFullVersion ()
 
std::string FormatSubVersion (const std::string &name, int nClientVersion, const std::vector< std::string > &comments)
 
boost::filesystem::path GetTempPath ()
 
void runCommand (std::string strCommand)
 
void RenameThread (const char *name)
 
void SetupEnvironment ()
 
std::string DateTimeStrFormat (const char *pszFormat, int64_t nTime)
 

Variables

map< string, string > mapArgs
 
map< string, vector< string > > mapMultiArgs
 
bool fDebug = false
 
bool fPrintToConsole = false
 
bool fPrintToDebugLog = true
 
bool fDaemon = false
 
bool fServer = false
 
string strMiscWarning
 
bool fNoListen = false
 
bool fLogTimestamps = false
 
volatile bool fReopenDebugLog = false
 
CClientUIInterface uiInterface
 
static CCriticalSection ** ppmutexOpenSSL
 
class CInit instance_of_cinit
 
static boost::once_flag debugPrintInitFlag = BOOST_ONCE_INIT
 
static FILE * fileout = NULL
 
static boost::mutex * mutexDebugLog = NULL
 
const signed char p_util_hexdigit [256]
 
static boost::filesystem::path pathCached [CChainParams::MAX_NETWORK_TYPES+1]
 
static CCriticalSection csPathCached
 
static int64_t nMockTime = 0
 
static CCriticalSection cs_nTimeOffset
 
static int64_t nTimeOffset = 0
 
uint32_t insecure_rand_Rz = 11
 MWC RNG of George Marsaglia This is intended to be fast. More...
 
uint32_t insecure_rand_Rw = 11
 

Function Documentation

void AddTimeData ( const CNetAddr ip,
int64_t  nTime 
)

Definition at line 1241 of file util.cpp.

References _(), abs64(), fDebug, GetTime(), CMedianFilter< T >::input(), LOCK, LogPrintf, CMedianFilter< T >::median(), CClientUIInterface::MSG_WARNING, nTimeOffset, CMedianFilter< T >::size(), CMedianFilter< T >::sorted(), strMiscWarning, and CClientUIInterface::ThreadSafeMessageBox.

Referenced by ProcessMessage().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void AllocateFileRange ( FILE *  file,
unsigned int  offset,
unsigned int  length 
)

Definition at line 1140 of file util.cpp.

Referenced by FindBlockPos(), and FindUndoPos().

+ Here is the caller graph for this function:

void ClearDatadirCache ( )

Definition at line 1006 of file util.cpp.

References CChainParams::MAX_NETWORK_TYPES, and pathCached.

Referenced by ReadConfigFile().

+ Here is the caller graph for this function:

void CreatePidFile ( const boost::filesystem::path &  path,
pid_t  pid 
)

Definition at line 1053 of file util.cpp.

Referenced by AppInit().

+ Here is the caller graph for this function:

std::string DateTimeStrFormat ( const char *  pszFormat,
int64_t  nTime 
)
static void DebugPrintInit ( )
static

Definition at line 228 of file util.cpp.

References fileout, GetDataDir(), and mutexDebugLog.

Referenced by LogPrintStr().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector<unsigned char> DecodeBase32 ( const char *  p,
bool *  pfInvalid 
)

Definition at line 751 of file util.cpp.

Referenced by DecodeBase32(), and CNetAddr::SetSpecial().

+ Here is the caller graph for this function:

string DecodeBase32 ( const string &  str)

Definition at line 868 of file util.cpp.

References DecodeBase32().

+ Here is the call graph for this function:

vector<unsigned char> DecodeBase64 ( const char *  p,
bool *  pfInvalid 
)

Definition at line 598 of file util.cpp.

Referenced by DecodeBase64(), HTTPAuthorized(), SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked(), and verifymessage().

+ Here is the caller graph for this function:

string DecodeBase64 ( const string &  str)

Definition at line 681 of file util.cpp.

References DecodeBase64().

+ Here is the call graph for this function:

string EncodeBase32 ( const unsigned char *  pch,
size_t  len 
)

Definition at line 687 of file util.cpp.

Referenced by EncodeBase32(), and CNetAddr::ToStringIP().

+ Here is the caller graph for this function:

string EncodeBase32 ( const string &  str)

Definition at line 746 of file util.cpp.

References EncodeBase32().

+ Here is the call graph for this function:

string EncodeBase64 ( const unsigned char *  pch,
size_t  len 
)

Definition at line 547 of file util.cpp.

Referenced by CallRPC(), EncodeBase64(), SignVerifyMessageDialog::on_signMessageButton_SM_clicked(), and signmessage().

+ Here is the caller graph for this function:

string EncodeBase64 ( const string &  str)

Definition at line 593 of file util.cpp.

References EncodeBase64().

+ Here is the call graph for this function:

void FileCommit ( FILE *  fileout)

Definition at line 1092 of file util.cpp.

Referenced by FlushBlockFile(), CAddrDB::Write(), and WriteBlockToDisk().

+ Here is the caller graph for this function:

static std::string FormatException ( std::exception *  pex,
const char *  pszThread 
)
static

Definition at line 911 of file util.cpp.

References MAX_PATH, and strprintf.

Referenced by LogException(), and PrintExceptionContinue().

+ Here is the caller graph for this function:

string FormatFullVersion ( )

Definition at line 1325 of file util.cpp.

References CLIENT_BUILD.

Referenced by AppInit(), AppInit2(), AppInitRPC(), ClientModel::formatFullVersion(), HelpMessageDialog::HelpMessageDialog(), HTTPPost(), and HTTPReply().

+ Here is the caller graph for this function:

string FormatMoney ( int64_t  n,
bool  fPlus 
)

Definition at line 308 of file util.cpp.

References COIN, and strprintf.

Referenced by HelpMessage(), CWallet::SelectCoinsMinConf(), CWallet::SendMoney(), and COutput::ToString().

+ Here is the caller graph for this function:

std::string FormatSubVersion ( const std::string &  name,
int  nClientVersion,
const std::vector< std::string > &  comments 
)

Definition at line 1331 of file util.cpp.

References FormatVersion().

Referenced by CAlert::AppliesToMe(), and CNode::PushVersion().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

string FormatVersion ( int  nVersion)

Definition at line 1317 of file util.cpp.

References strprintf.

Referenced by FormatSubVersion().

+ Here is the caller graph for this function:

int64_t GetAdjustedTime ( )

Definition at line 1236 of file util.cpp.

References GetTime(), and GetTimeOffset().

Referenced by CAddrMan::Add_(), CWallet::AddToWallet(), CheckBlock(), ConnectNode(), TransactionDesc::FormatTxStatus(), GetLocalAddress(), IsFinalTx(), CAlert::IsInEffect(), movecmd(), ProcessMessage(), CNode::PushVersion(), CAlert::RelayTo(), ThreadOpenConnections(), TransactionRecord::updateStatus(), and UpdateTime().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string GetArg ( const std::string &  strArg,
const std::string &  strDefault 
)

Return string argument or default value.

Parameters
strArgArgument to get (e.g. "-foo")
default(e.g. "1")
Returns
command-line argument or default value

Definition at line 505 of file util.cpp.

Referenced by AcceptToMemoryPool(), ActivateBestChain(), CWallet::AddToWallet(), AppInit2(), CNode::Ban(), CallRPC(), CheckForkWarningConditions(), CreateNewBlock(), CNode::EndMessage(), CDB::Flush(), GetConfigFile(), GetListenPort(), getmininginfo(), GetPidFile(), initTranslations(), PaymentServer::LoadRootCAs(), Misbehaving(), CWallet::NewKeyPool(), Intro::pickDataDirectory(), CAlert::ProcessAlert(), ProcessMessage(), PruneOrphanBlocks(), ReceiveFloodSize(), SendBufferSize(), CSignatureCache::Set(), StartRPCThreads(), CWallet::TopUpKeyPool(), and verifychain().

+ Here is the caller graph for this function:

int64_t GetArg ( const std::string &  strArg,
int64_t  nDefault 
)

Return integer argument or default value.

Parameters
strArgArgument to get (e.g. "-foo")
default(e.g. 1)
Returns
command-line argument (0 if invalid number) or default value

Definition at line 512 of file util.cpp.

References atoi64().

+ Here is the call graph for this function:

bool GetBoolArg ( const std::string &  strArg,
bool  fDefault 
)

Return boolean argument or default value.

Parameters
strArgArgument to get (e.g. "-foo")
default(true or false)
Returns
command-line argument or default value

Definition at line 519 of file util.cpp.

References atoi().

Referenced by AppInit(), AppInit2(), BitcoinGUI::BitcoinGUI(), CallRPC(), mastercore::checkExpiredAlerts(), CreateNewBlock(), CRPCTable::execute(), GetWarnings(), HelpMessage(), InitBlockIndex(), BitcoinApplication::initializeResult(), InterpretNegativeSetting(), main(), mastercore_init(), CDBEnv::Open(), Intro::pickDataDirectory(), SelectParamsFromCommandLine(), StartNode(), StartRPCThreads(), ThreadDNSAddressSeed(), and ThreadFlushWalletDB().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

boost::filesystem::path GetConfigFile ( )

Definition at line 1012 of file util.cpp.

References GetArg(), and GetDataDir().

Referenced by CallRPC(), ReadConfigFile(), and StartRPCThreads().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const boost::filesystem::path& GetDataDir ( bool  fNetSpecific)

Definition at line 973 of file util.cpp.

References CChainParams::DataDir(), GetDefaultDataDir(), LOCK, CChainParams::MAX_NETWORK_TYPES, CChainParams::NetworkID(), Params(), and pathCached.

Referenced by AppInit(), AppInit2(), AppInitRPC(), BackupWallet(), CAddrDB::CAddrDB(), CDB::CDB(), CheckDiskSpace(), DebugPrintInit(), mastercore::dumpCrowdsaleInfo(), GetConfigFile(), GetPidFile(), CMPTransaction::interpretPacket(), ipcServerName(), LogPrintStr(), main(), mastercore_init(), mp_DebugPrintInit(), mp_LogPrintStr(), GUIUtil::openDebugLogfile(), OpenDiskFile(), ShrinkDebugFile(), shrinkDebugFile(), StartRPCThreads(), ThreadImport(), and CAddrDB::Write().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

boost::filesystem::path GetDefaultDataDir ( )

Definition at line 941 of file util.cpp.

References TryCreateDirectory().

Referenced by AppInit2(), GetDataDir(), and Intro::getDefaultDataDirectory().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

boost::filesystem::path GetPidFile ( )

Definition at line 1045 of file util.cpp.

References GetArg(), and GetDataDir().

Referenced by AppInit(), and Shutdown().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint64_t GetRand ( uint64_t  nMax)

Definition at line 186 of file util.cpp.

Referenced by mastercore::ClassB_send(), CMainParams::CMainParams(), CNode::EndMessage(), CNode::Fuzz(), GetRandInt(), ProcessMessage(), CWallet::ResendWalletTransactions(), ThreadDNSAddressSeed(), and ThreadMessageHandler().

+ Here is the caller graph for this function:

uint256 GetRandHash ( )

Definition at line 206 of file util.cpp.

Referenced by LimitOrphanTxSize(), ProcessMessage(), SendMessages(), and CSignatureCache::Set().

+ Here is the caller graph for this function:

int GetRandInt ( int  nMax)

Definition at line 201 of file util.cpp.

References GetRand().

Referenced by CAddrMan::Add_(), CAddrMan::GetAddr_(), CAddrMan::Good_(), CAddrMan::Select_(), CWallet::SelectCoinsMinConf(), CAddrMan::SelectTried(), and CAddrMan::ShrinkNew().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

boost::filesystem::path GetTempPath ( )

Definition at line 1359 of file util.cpp.

References LogPrintf, and MAX_PATH.

int64_t GetTime ( )
int64_t GetTimeOffset ( )

Definition at line 1230 of file util.cpp.

References LOCK, and nTimeOffset.

Referenced by GetAdjustedTime(), getinfo(), and getnetworkinfo().

+ Here is the caller graph for this function:

static void InterpretNegativeSetting ( string  name,
map< string, string > &  mapSettingsRet 
)
static

Definition at line 445 of file util.cpp.

References GetBoolArg().

Referenced by ParseParameters(), and ReadConfigFile().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool IsHex ( const string &  str)

Definition at line 409 of file util.cpp.

References HexDigit().

Referenced by _createmultisig_redeemScript(), lockunspent(), ParseHashV(), and ParseHexV().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void locking_callback ( int  mode,
int  i,
const char *  file,
int  line 
)

Definition at line 104 of file util.cpp.

References ENTER_CRITICAL_SECTION, and LEAVE_CRITICAL_SECTION.

Referenced by CInit::CInit().

+ Here is the caller graph for this function:

bool LogAcceptCategory ( const char *  category)

Definition at line 240 of file util.cpp.

References fDebug.

Referenced by LogPrint().

+ Here is the caller graph for this function:

void LogException ( std::exception *  pex,
const char *  pszThread 
)

Definition at line 927 of file util.cpp.

References FormatException(), and LogPrintf.

+ Here is the call graph for this function:

int LogPrintStr ( const std::string &  str)

Definition at line 268 of file util.cpp.

References DateTimeStrFormat(), DebugPrintInit(), debugPrintInitFlag, fileout, fLogTimestamps, fPrintToConsole, fPrintToDebugLog, fReopenDebugLog, GetDataDir(), GetTime(), and mutexDebugLog.

Referenced by error(), and LogPrint().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector<unsigned char> ParseHex ( const char *  psz)

Definition at line 419 of file util.cpp.

References HexDigit().

Referenced by _createmultisig_redeemScript(), mastercore::ClassB_send(), CMainParams::CMainParams(), CTestNetParams::CTestNetParams(), ParseHex(), ParseHexV(), parseTransaction(), CDBEnv::Salvage(), sendrawtx_MP(), and submitblock().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vector<unsigned char> ParseHex ( const string &  str)

Definition at line 440 of file util.cpp.

References ParseHex().

+ Here is the call graph for this function:

bool ParseMoney ( const string &  str,
int64_t &  nRet 
)

Definition at line 332 of file util.cpp.

References ParseMoney().

Referenced by AppInit2(), and ParseMoney().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool ParseMoney ( const char *  pszIn,
int64_t &  nRet 
)

Definition at line 337 of file util.cpp.

References atoi64(), CENT, and COIN.

+ Here is the call graph for this function:

void ParseParameters ( int  argc,
const char *const  argv[] 
)

Definition at line 460 of file util.cpp.

References InterpretNegativeSetting(), and PAIRTYPE.

Referenced by AppInit(), AppInitRPC(), and main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void PrintExceptionContinue ( std::exception *  pex,
const char *  pszThread 
)

Definition at line 933 of file util.cpp.

References FormatException(), LogPrintf, and strMiscWarning.

Referenced by AppInit(), CommandLineRPC(), BitcoinCore::handleRunawayException(), LoopForever(), main(), ProcessMessages(), and TraceThread().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int RaiseFileDescriptorLimit ( int  nMinFD)

Definition at line 1119 of file util.cpp.

Referenced by AppInit2().

+ Here is the caller graph for this function:

void RandAddSeed ( )

Definition at line 151 of file util.cpp.

References GetPerformanceCounter().

Referenced by CInit::CInit(), and RandAddSeedPerfmon().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void RandAddSeedPerfmon ( )

Definition at line 159 of file util.cpp.

References GetTime(), LogPrint(), and RandAddSeed().

Referenced by AppInit2(), CWallet::EncryptWallet(), CWallet::GenerateNewKey(), and ProcessMessage().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ReadConfigFile ( map< string, string > &  mapSettingsRet,
map< string, vector< string > > &  mapMultiSettingsRet 
)

Definition at line 1019 of file util.cpp.

References ClearDatadirCache(), GetConfigFile(), and InterpretNegativeSetting().

Referenced by AppInit(), AppInitRPC(), and main().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool RenameOver ( boost::filesystem::path  src,
boost::filesystem::path  dest 
)

Definition at line 1064 of file util.cpp.

Referenced by ThreadImport(), and CAddrDB::Write().

+ Here is the caller graph for this function:

void RenameThread ( const char *  name)

Definition at line 1388 of file util.cpp.

Referenced by LoopForever(), Shutdown(), ThreadFlushWalletDB(), ThreadImport(), ThreadScriptCheck(), and TraceThread().

+ Here is the caller graph for this function:

void runCommand ( std::string  strCommand)

Definition at line 1381 of file util.cpp.

References LogPrintf.

Referenced by ActivateBestChain(), CWallet::AddToWallet(), CheckForkWarningConditions(), and CAlert::ProcessAlert().

+ Here is the caller graph for this function:

static string safeChars ( abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890 .,
;_/:?@"   
)
static

Referenced by SanitizeString().

+ Here is the caller graph for this function:

string SanitizeString ( const string &  str)

Definition at line 380 of file util.cpp.

References safeChars().

Referenced by CAlert::ProcessAlert(), and ProcessMessage().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void seed_insecure_rand ( bool  fDeterministic = false)

Seed insecure_rand using the random pool.

Parameters
DeterministicUse a determinstic seed

Definition at line 1298 of file util.cpp.

References insecure_rand_Rw, and insecure_rand_Rz.

Referenced by ApproximateBestSubset().

+ Here is the caller graph for this function:

void SetMockTime ( int64_t  nMockTimeIn)

Definition at line 1222 of file util.cpp.

References nMockTime.

void SetupEnvironment ( )

Definition at line 1412 of file util.cpp.

Referenced by main().

+ Here is the caller graph for this function:

void ShrinkDebugFile ( )

Definition at line 1182 of file util.cpp.

References GetDataDir().

Referenced by AppInit2().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool SoftSetArg ( const std::string &  strArg,
const std::string &  strValue 
)

Set an argument if it doesn't already have a value.

Parameters
strArgArgument to set (e.g. "-foo")
strValueValue (e.g. "1")
Returns
true if argument gets set, false if it already had a value

Definition at line 530 of file util.cpp.

Referenced by OptionsModel::Init(), Intro::pickDataDirectory(), and SoftSetBoolArg().

+ Here is the caller graph for this function:

bool SoftSetBoolArg ( const std::string &  strArg,
bool  fValue 
)

Set a boolean argument if it doesn't already have a value.

Parameters
strArgArgument to set (e.g. "-foo")
fValueValue (e.g. false)
Returns
true if argument gets set, false if it already had a value

Definition at line 538 of file util.cpp.

References SoftSetArg().

Referenced by AppInit(), AppInit2(), OptionsModel::Init(), and CWalletDB::LoadWallet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool TruncateFile ( FILE *  file,
unsigned int  length 
)

Definition at line 1109 of file util.cpp.

Referenced by FlushBlockFile().

+ Here is the caller graph for this function:

bool TryCreateDirectory ( const boost::filesystem::path &  p)

Definition at line 1078 of file util.cpp.

Referenced by CLevelDBWrapper::CLevelDBWrapper(), GetDefaultDataDir(), CDBEnv::Open(), and Intro::pickDataDirectory().

+ Here is the caller graph for this function:

bool WildcardMatch ( const char *  psz,
const char *  mask 
)

Definition at line 875 of file util.cpp.

References WildcardMatch().

Referenced by ClientAllowed(), and WildcardMatch().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WildcardMatch ( const string &  str,
const string &  mask 
)

Definition at line 899 of file util.cpp.

References WildcardMatch().

+ Here is the call graph for this function:

Variable Documentation

CCriticalSection cs_nTimeOffset
static

Definition at line 1227 of file util.cpp.

CCriticalSection csPathCached
static

Definition at line 971 of file util.cpp.

boost::once_flag debugPrintInitFlag = BOOST_ONCE_INIT
static

Definition at line 222 of file util.cpp.

Referenced by LogPrintStr().

bool fDaemon = false

Definition at line 94 of file util.cpp.

bool fDebug = false
FILE* fileout = NULL
static

Definition at line 225 of file util.cpp.

Referenced by DebugPrintInit(), and LogPrintStr().

bool fLogTimestamps = false

Definition at line 98 of file util.cpp.

Referenced by AppInit2(), LogPrintStr(), and mp_LogPrintStr().

bool fNoListen = false

Definition at line 97 of file util.cpp.

Referenced by AppInit2(), GetLocal(), ProcessMessage(), and SendMessages().

bool fPrintToConsole = false

Definition at line 92 of file util.cpp.

Referenced by AppInit2(), LogPrintStr(), and mp_LogPrintStr().

bool fPrintToDebugLog = true

Definition at line 93 of file util.cpp.

Referenced by LogPrintStr(), and mp_LogPrintStr().

volatile bool fReopenDebugLog = false

Definition at line 99 of file util.cpp.

Referenced by HandleSIGHUP(), LogPrintStr(), and mp_LogPrintStr().

bool fServer = false

Definition at line 95 of file util.cpp.

Referenced by AppInit2().

uint32_t insecure_rand_Rw = 11

Definition at line 1297 of file util.cpp.

Referenced by insecure_rand(), and seed_insecure_rand().

uint32_t insecure_rand_Rz = 11

MWC RNG of George Marsaglia This is intended to be fast.

It has a period of 2^59.3, though the least significant 16 bits only have a period of about 2^30.1.

Returns
random value

Definition at line 1296 of file util.cpp.

Referenced by insecure_rand(), and seed_insecure_rand().

class CInit instance_of_cinit
map<string, string> mapArgs
map<string, vector<string> > mapMultiArgs
boost::mutex* mutexDebugLog = NULL
static

Definition at line 226 of file util.cpp.

Referenced by DebugPrintInit(), and LogPrintStr().

int64_t nMockTime = 0
static

Definition at line 1213 of file util.cpp.

Referenced by GetTime(), and SetMockTime().

int64_t nTimeOffset = 0
static

Definition at line 1228 of file util.cpp.

Referenced by AddTimeData(), and GetTimeOffset().

const signed char p_util_hexdigit[256]
Initial value:
=
{ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,
-1,0xa,0xb,0xc,0xd,0xe,0xf,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,0xa,0xb,0xc,0xd,0xe,0xf,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, }

Definition at line 391 of file util.cpp.

Referenced by HexDigit().

boost::filesystem::path pathCached[CChainParams::MAX_NETWORK_TYPES+1]
static

Definition at line 970 of file util.cpp.

Referenced by ClearDatadirCache(), and GetDataDir().

CCriticalSection** ppmutexOpenSSL
static

Definition at line 103 of file util.cpp.

string strMiscWarning
CClientUIInterface uiInterface