![]() |
Anoncoin
0.9.4
P2P Digital Currency
|
#include "compat.h"
#include "serialize.h"
#include "tinyformat.h"
#include <cstdio>
#include <exception>
#include <map>
#include <stdarg.h>
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
#include <sys/resource.h>
#include <sys/time.h>
#include <sys/types.h>
#include <boost/filesystem/path.hpp>
#include <boost/thread.hpp>
Go to the source code of this file.
Classes | |
class | CMedianFilter< T > |
Median filter over a stream of values. More... | |
Macros | |
#define | BEGIN(a) ((char*)&(a)) |
#define | END(a) ((char*)&((&(a))[1])) |
#define | UBEGIN(a) ((unsigned char*)&(a)) |
#define | UEND(a) ((unsigned char*)&((&(a))[1])) |
#define | ARRAYLEN(array) (sizeof(array)/sizeof((array)[0])) |
#define | PAIRTYPE(t1, t2) std::pair<t1, t2> |
#define | MAX_PATH 1024 |
#define | MSG_NOSIGNAL 0 |
#define | strprintf tfm::format |
#define | LogPrintf(...) LogPrint(NULL, __VA_ARGS__) |
#define | MAKE_ERROR_AND_LOG_FUNC(n) |
#define | PRIO_MAX 20 |
#define | THREAD_PRIORITY_LOWEST PRIO_MAX |
#define | THREAD_PRIORITY_BELOW_NORMAL 2 |
#define | THREAD_PRIORITY_NORMAL 0 |
#define | THREAD_PRIORITY_ABOVE_NORMAL (-2) |
Functions | |
template<size_t nBytes, typename T > | |
T * | alignup (T *p) |
void | MilliSleep (int64_t n) |
void | RandAddSeed () |
void | RandAddSeedPerfmon () |
void | SetupEnvironment () |
bool | LogAcceptCategory (const char *category) |
int | LogPrintStr (const std::string &str) |
void | LogException (std::exception *pex, const char *pszThread) |
void | PrintExceptionContinue (std::exception *pex, const char *pszThread) |
std::string | FormatMoney (int64_t n, bool fPlus=false) |
bool | ParseMoney (const std::string &str, int64_t &nRet) |
bool | ParseMoney (const char *pszIn, int64_t &nRet) |
std::string | SanitizeString (const std::string &str) |
std::vector< unsigned char > | ParseHex (const char *psz) |
std::vector< unsigned char > | ParseHex (const std::string &str) |
bool | IsHex (const std::string &str) |
std::vector< unsigned char > | DecodeBase64 (const char *p, bool *pfInvalid=NULL) |
std::string | DecodeBase64 (const std::string &str) |
std::string | EncodeBase64 (const unsigned char *pch, size_t len) |
std::string | EncodeBase64 (const std::string &str) |
std::vector< unsigned char > | DecodeBase32 (const char *p, bool *pfInvalid=NULL) |
std::string | DecodeBase32 (const std::string &str) |
std::string | EncodeBase32 (const unsigned char *pch, size_t len) |
std::string | EncodeBase32 (const std::string &str) |
void | ParseParameters (int argc, const char *const argv[]) |
bool | WildcardMatch (const char *psz, const char *mask) |
bool | WildcardMatch (const std::string &str, const std::string &mask) |
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) |
bool | RenameOver (boost::filesystem::path src, boost::filesystem::path dest) |
bool | TryCreateDirectory (const boost::filesystem::path &p) |
boost::filesystem::path | GetDefaultDataDir () |
const boost::filesystem::path & | GetDataDir (bool fNetSpecific=true) |
boost::filesystem::path | GetConfigFile () |
boost::filesystem::path | GetQtStyleFile () |
boost::filesystem::path | GetPidFile () |
void | CreatePidFile (const boost::filesystem::path &path, pid_t pid) |
void | ReadConfigFile (std::map< std::string, std::string > &mapSettingsRet, std::map< std::string, std::vector< std::string > > &mapMultiSettingsRet) |
boost::filesystem::path | GetTempPath () |
void | ShrinkDebugFile () |
int | GetRandInt (int nMax) |
uint64_t | GetRand (uint64_t nMax) |
uint256 | GetRandHash () |
int64_t | GetTime () |
void | SetMockTime (int64_t nMockTimeIn) |
int64_t | GetAdjustedTime () |
int64_t | GetTimeOffset () |
void | AddTimeData (const CNetAddr &ip, int64_t nTime) |
void | runCommand (std::string strCommand) |
std::string | i64tostr (int64_t n) |
std::string | itostr (int n) |
int64_t | atoi64 (const char *psz) |
int64_t | atoi64 (const std::string &str) |
int | atoi (const std::string &str) |
int | roundint (double d) |
int64_t | roundint64 (double d) |
int64_t | abs64 (int64_t n) |
template<typename T > | |
std::string | HexStr (const T itbegin, const T itend, bool fSpaces=false) |
template<typename T > | |
std::string | HexStr (const T &vch, bool fSpaces=false) |
template<typename T > | |
void | PrintHex (const T pbegin, const T pend, const char *pszFormat="%s", bool fSpaces=true) |
void | PrintHex (const std::vector< unsigned char > &vch, const char *pszFormat="%s", bool fSpaces=true) |
int64_t | GetPerformanceCounter () |
int64_t | GetTimeMillis () |
int64_t | GetTimeMicros () |
std::string | DateTimeStrFormat (const char *pszFormat, int64_t nTime) |
template<typename T > | |
void | skipspaces (T &it) |
bool | IsSwitchChar (char c) |
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... | |
void | seed_insecure_rand (bool fDeterministic=false) |
Seed insecure_rand using the random pool. More... | |
template<typename T > | |
bool | TimingResistantEqual (const T &a, const T &b) |
Timing-attack-resistant comparison. More... | |
void | SetThreadPriority (int nPriority) |
void | RenameThread (const char *name) |
uint32_t | ByteReverse (uint32_t value) |
template<typename Callable > | |
void | LoopForever (const char *name, Callable func, int64_t msecs) |
template<typename Callable > | |
void | TraceThread (const char *name, Callable func) |
Variables | |
std::map< std::string, std::string > | mapArgs |
std::map< std::string, std::vector< std::string > > | mapMultiArgs |
bool | fDebug |
bool | fPrintToConsole |
bool | fPrintToDebugLog |
bool | fServer |
std::string | strMiscWarning |
bool | fNoListen |
bool | fLogTimestamps |
volatile bool | fReopenDebugLog |
uint32_t | insecure_rand_Rz |
MWC RNG of George Marsaglia This is intended to be fast. More... | |
uint32_t | insecure_rand_Rw |
#define MAKE_ERROR_AND_LOG_FUNC | ( | n | ) |
|
inline |
void AddTimeData | ( | const CNetAddr & | ip, |
int64_t | nTime | ||
) |
void AllocateFileRange | ( | FILE * | file, |
unsigned int | offset, | ||
unsigned int | length | ||
) |
|
inline |
|
inline |
|
inline |
void CreatePidFile | ( | const boost::filesystem::path & | path, |
pid_t | pid | ||
) |
std::string DateTimeStrFormat | ( | const char * | pszFormat, |
int64_t | nTime | ||
) |
std::vector<unsigned char> DecodeBase32 | ( | const char * | p, |
bool * | pfInvalid = NULL |
||
) |
std::string DecodeBase32 | ( | const std::string & | str | ) |
std::vector<unsigned char> DecodeBase64 | ( | const char * | p, |
bool * | pfInvalid = NULL |
||
) |
std::string DecodeBase64 | ( | const std::string & | str | ) |
std::string EncodeBase32 | ( | const unsigned char * | pch, |
size_t | len | ||
) |
std::string EncodeBase32 | ( | const std::string & | str | ) |
std::string EncodeBase64 | ( | const unsigned char * | pch, |
size_t | len | ||
) |
std::string EncodeBase64 | ( | const std::string & | str | ) |
void FileCommit | ( | FILE * | fileout | ) |
std::string FormatMoney | ( | int64_t | n, |
bool | fPlus = false |
||
) |
int64_t GetAdjustedTime | ( | ) |
std::string GetArg | ( | const std::string & | strArg, |
const std::string & | strDefault | ||
) |
int64_t GetArg | ( | const std::string & | strArg, |
int64_t | nDefault | ||
) |
bool GetBoolArg | ( | const std::string & | strArg, |
bool | fDefault | ||
) |
boost::filesystem::path GetConfigFile | ( | ) |
const boost::filesystem::path& GetDataDir | ( | bool | fNetSpecific = true | ) |
boost::filesystem::path GetDefaultDataDir | ( | ) |
|
inline |
boost::filesystem::path GetPidFile | ( | ) |
boost::filesystem::path GetQtStyleFile | ( | ) |
uint64_t GetRand | ( | uint64_t | nMax | ) |
uint256 GetRandHash | ( | ) |
int GetRandInt | ( | int | nMax | ) |
int64_t GetTime | ( | ) |
|
inline |
|
inline |
int64_t GetTimeOffset | ( | ) |
std::string HexStr | ( | const T | itbegin, |
const T | itend, | ||
bool | fSpaces = false |
||
) |
|
inline |
bool IsHex | ( | const std::string & | str | ) |
|
inline |
|
inline |
void LogException | ( | std::exception * | pex, |
const char * | pszThread | ||
) |
int LogPrintStr | ( | const std::string & | str | ) |
void LoopForever | ( | const char * | name, |
Callable | func, | ||
int64_t | msecs | ||
) |
|
inline |
std::vector<unsigned char> ParseHex | ( | const char * | psz | ) |
std::vector<unsigned char> ParseHex | ( | const std::string & | str | ) |
bool ParseMoney | ( | const std::string & | str, |
int64_t & | nRet | ||
) |
bool ParseMoney | ( | const char * | pszIn, |
int64_t & | nRet | ||
) |
void ParseParameters | ( | int | argc, |
const char *const | argv[] | ||
) |
void PrintExceptionContinue | ( | std::exception * | pex, |
const char * | pszThread | ||
) |
void PrintHex | ( | const T | pbegin, |
const T | pend, | ||
const char * | pszFormat = "%s" , |
||
bool | fSpaces = true |
||
) |
|
inline |
int RaiseFileDescriptorLimit | ( | int | nMinFD | ) |
void RandAddSeed | ( | ) |
void RandAddSeedPerfmon | ( | ) |
void ReadConfigFile | ( | std::map< std::string, std::string > & | mapSettingsRet, |
std::map< std::string, std::vector< std::string > > & | mapMultiSettingsRet | ||
) |
bool RenameOver | ( | boost::filesystem::path | src, |
boost::filesystem::path | dest | ||
) |
void RenameThread | ( | const char * | name | ) |
|
inline |
void runCommand | ( | std::string | strCommand | ) |
std::string SanitizeString | ( | const std::string & | str | ) |
void seed_insecure_rand | ( | bool | fDeterministic = false | ) |
|
inline |
void SetupEnvironment | ( | ) |
void ShrinkDebugFile | ( | ) |
bool SoftSetArg | ( | const std::string & | strArg, |
const std::string & | strValue | ||
) |
bool SoftSetBoolArg | ( | const std::string & | strArg, |
bool | fValue | ||
) |
Set a boolean argument if it doesn't already have a value.
strArg | Argument to set (e.g. "-foo") |
fValue | Value (e.g. false) |
Definition at line 539 of file util.cpp.
bool TimingResistantEqual | ( | const T & | a, |
const T & | b | ||
) |
void TraceThread | ( | const char * | name, |
Callable | func | ||
) |
bool TryCreateDirectory | ( | const boost::filesystem::path & | p | ) |
bool WildcardMatch | ( | const char * | psz, |
const char * | mask | ||
) |
bool WildcardMatch | ( | const std::string & | str, |
const std::string & | mask | ||
) |
uint32_t insecure_rand_Rz |
std::map<std::string, std::vector<std::string> > mapMultiArgs |