Monero
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
tools Namespace Reference

Various Tools. More...

Namespaces

 anonymous_namespace{util.cpp}
 
 anonymous_namespace{wallet2.cpp}
 
 base58
 
 detail
 
 dns_utils
 
 error
 
 wallet_rpc
 

Classes

struct  close_file
 Functional class for closing C file handles. More...
 
class  DNSResolver
 Provides high-level access to DNS resolution. More...
 
struct  DNSResolverData
 
struct  download_thread_control
 
class  file_locker
 
class  hashchain
 
class  i_wallet2_callback
 
class  LoggingPerformanceTimer
 
struct  login
 
class  NodeRPCProxy
 
class  password_container
 
class  PerformanceTimer
 
class  private_file
 A file restricted to process owner AND process. Deletes file on destruction. More...
 
class  ringdb
 
class  scoped_message_writer
 
class  scoped_ptr
 
class  signal_handler
 Defines a signal handler for win32 and *nix. More...
 
class  string_copy
 
class  t_http_connection
 
class  t_rpc_client
 
class  threadpool
 A global thread pool. More...
 
struct  tx_dust_policy
 
class  wallet2
 
class  wallet_keys_unlocker
 
class  wallet_rpc_server
 

Typedefs

typedef class scoped_ptr< ub_result, ub_resolve_free > ub_result_ptr
 
typedef std::shared_ptr< download_thread_controldownload_async_handle
 

Enumerations

enum  { EVARINT_OVERFLOW = -1, EVARINT_REPRESENT = -2 }
 Error codes for varint. More...
 

Functions

template<typename F >
void apply_permutation (std::vector< size_t > permutation, const F &swap)
 
template<typename T >
void apply_permutation (const std::vector< size_t > &permutation, std::vector< T > &v)
 
template<class t_object >
bool serialize_obj_to_file (t_object &obj, const std::string &file_path)
 
template<class t_object >
bool unserialize_obj_from_file (t_object &obj, const std::string &file_path)
 
std::string ipv4_to_string (const char *src, size_t len)
 
std::string ipv6_to_string (const char *src, size_t len)
 
std::string txt_to_string (const char *src, size_t len)
 
static void download_thread (download_async_handle control)
 
bool download (const std::string &path, const std::string &url, std::function< bool(const std::string &, const std::string &, size_t, ssize_t)> cb)
 
download_async_handle download_async (const std::string &path, const std::string &url, std::function< void(const std::string &, const std::string &, bool)> result, std::function< bool(const std::string &, const std::string &, size_t, ssize_t)> progress)
 
bool download_finished (const download_async_handle &control)
 
bool download_error (const download_async_handle &control)
 
bool download_wait (const download_async_handle &control)
 
bool download_cancel (const download_async_handle &control)
 
uint64_t get_tick_count ()
 
uint64_t ticks_to_ns (uint64_t ticks)
 
void set_performance_timer_log_level (el::Level level)
 
uint64_t get_ticks_per_ns ()
 
scoped_message_writer success_msg_writer (bool color=true)
 
scoped_message_writer msg_writer (epee::console_colors color=epee::console_color_default)
 
scoped_message_writer fail_msg_writer ()
 
void set_stack_trace_log (const std::string &log)
 
void log_stack_trace (const char *msg)
 
bool check_updates (const std::string &software, const std::string &buildtag, std::string &version, std::string &hash)
 
std::string get_update_url (const std::string &software, const std::string &subdir, const std::string &buildtag, const std::string &version, bool user)
 
std::string get_nix_version_display_string ()
 
std::string get_os_version_string ()
 Returns the OS version string. More...
 
std::string get_default_data_dir ()
 Returns the default data directory. More...
 
bool create_directories_if_necessary (const std::string &path)
 creates directories for a path More...
 
std::error_code replace_file (const std::string &replacement_name, const std::string &replaced_name)
 std::rename wrapper for nix and something strange for windows. More...
 
static bool unbound_built_with_threads ()
 
bool sanitize_locale ()
 
static void setup_crash_dump ()
 
bool disable_core_dumps ()
 
bool on_startup ()
 
void set_strict_default_file_permissions (bool strict)
 
boost::optional< boolis_hdd (const char *file_path)
 
void set_max_concurrency (unsigned n)
 
unsigned get_max_concurrency ()
 
bool is_local_address (const std::string &address)
 
int vercmp (const char *v0, const char *v1)
 
bool sha256sum (const uint8_t *data, size_t len, crypto::hash &hash)
 
bool sha256sum (const std::string &filename, crypto::hash &hash)
 
boost::optional< std::pair< uint32_t, uint32_t > > parse_subaddress_lookahead (const std::string &str)
 
std::string glob_to_regex (const std::string &val)
 
template<typename OutputIt , typename T >
std::enable_if< std::is_integral< T >::value &&std::is_unsigned< T >::value, void >::type write_varint (OutputIt &&dest, T i)
 writes a varint to a stream. More...
 
template<typename T >
std::string get_varint_data (const T &v)
 Returns the string that represents the varint. More...
 
static uint64_t decodeRct (const rct::rctSig &rv, const crypto::key_derivation &derivation, unsigned int i, rct::key &mask, hw::device &hwdev)
 
static uint32_t get_count_above (const std::vector< wallet2::transfer_details > &transfers, const std::vector< size_t > &indices, uint64_t threshold)
 
static std::string ptx_to_string (const tools::wallet2::pending_tx &ptx)
 
template<typename T >
static bool is_error_value (const T &val)
 
static bool is_error_value (const std::string &s)
 
template<typename T , typename V >
static bool fill (T &where, V s)
 
template<typename T , typename V >
static bool fill (std::list< T > &where, V s)
 
static uint64_t total_amount (const tools::wallet2::pending_tx &ptx)
 

Variables

static const int DNS_CLASS_IN = 1
 
static const int DNS_TYPE_A = 1
 
static const int DNS_TYPE_TXT = 16
 
static const int DNS_TYPE_AAAA = 8
 
el::Level performance_timer_log_level = el::Level::Debug
 
static __thread std::vector< LoggingPerformanceTimer * > * performance_timers = NULL
 
static const std::chrono::seconds rpc_timeout = std::chrono::minutes(3) + std::chrono::seconds(30)
 
const size_t MAX_SPLIT_ATTEMPTS = 30
 

Detailed Description

Various Tools.

Typedef Documentation

◆ download_async_handle

◆ ub_result_ptr

typedef class scoped_ptr< ub_result, ub_resolve_free > tools::ub_result_ptr

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Error codes for varint.

Enumerator
EVARINT_OVERFLOW 
EVARINT_REPRESENT 

Function Documentation

◆ apply_permutation() [1/2]

template<typename F >
void tools::apply_permutation ( std::vector< size_t >  permutation,
const F swap 
)

◆ apply_permutation() [2/2]

template<typename T >
void tools::apply_permutation ( const std::vector< size_t > &  permutation,
std::vector< T > &  v 
)

◆ check_updates()

bool tools::check_updates ( const std::string &  software,
const std::string &  buildtag,
std::string &  version,
std::string &  hash 
)

◆ create_directories_if_necessary()

bool tools::create_directories_if_necessary ( const std::string &  path)

creates directories for a path

wrapper around boost::filesyste::create_directories.
(ensure-directory-exists): greenspun's tenth rule in action!

◆ decodeRct()

static uint64_t tools::decodeRct ( const rct::rctSig rv,
const crypto::key_derivation derivation,
unsigned int  i,
rct::key mask,
hw::device hwdev 
)
static

◆ disable_core_dumps()

bool tools::disable_core_dumps ( )

◆ download()

bool tools::download ( const std::string &  path,
const std::string &  url,
std::function< bool(const std::string &, const std::string &, size_t, ssize_t)>  cb 
)

◆ download_async()

download_async_handle tools::download_async ( const std::string &  path,
const std::string &  url,
std::function< void(const std::string &, const std::string &, bool)>  result,
std::function< bool(const std::string &, const std::string &, size_t, ssize_t)>  progress 
)

◆ download_cancel()

bool tools::download_cancel ( const download_async_handle control)

◆ download_error()

bool tools::download_error ( const download_async_handle control)

◆ download_finished()

bool tools::download_finished ( const download_async_handle control)

◆ download_thread()

static void tools::download_thread ( download_async_handle  control)
static

◆ download_wait()

bool tools::download_wait ( const download_async_handle control)

◆ fail_msg_writer()

scoped_message_writer tools::fail_msg_writer ( )
inline

◆ fill() [1/2]

template<typename T , typename V >
static bool tools::fill ( T where,
s 
)
static

◆ fill() [2/2]

template<typename T , typename V >
static bool tools::fill ( std::list< T > &  where,
s 
)
static

◆ get_count_above()

static uint32_t tools::get_count_above ( const std::vector< wallet2::transfer_details > &  transfers,
const std::vector< size_t > &  indices,
uint64_t  threshold 
)
static

◆ get_default_data_dir()

std::string tools::get_default_data_dir ( )

Returns the default data directory.

Windows < Vista: C:\Documents and Settings\Username\Application Data\CRYPTONOTE_NAME

Windows >= Vista: C:\Users\Username\AppData\Roaming\CRYPTONOTE_NAME

Mac: ~/Library/Application Support/CRYPTONOTE_NAME

Unix: ~/.CRYPTONOTE_NAME

◆ get_max_concurrency()

unsigned tools::get_max_concurrency ( )

◆ get_nix_version_display_string()

std::string tools::get_nix_version_display_string ( )

◆ get_os_version_string()

std::string tools::get_os_version_string ( )

Returns the OS version string.

This is a wrapper around the primitives get_windows_version_display_string() and get_nix_version_display_string()

◆ get_tick_count()

uint64_t tools::get_tick_count ( )

◆ get_ticks_per_ns()

uint64_t tools::get_ticks_per_ns ( )

◆ get_update_url()

std::string tools::get_update_url ( const std::string &  software,
const std::string &  subdir,
const std::string &  buildtag,
const std::string &  version,
bool  user 
)

◆ get_varint_data()

template<typename T >
std::string tools::get_varint_data ( const T v)

Returns the string that represents the varint.

◆ glob_to_regex()

std::string tools::glob_to_regex ( const std::string &  val)

◆ ipv4_to_string()

std::string tools::ipv4_to_string ( const char *  src,
size_t  len 
)

◆ ipv6_to_string()

std::string tools::ipv6_to_string ( const char *  src,
size_t  len 
)

◆ is_error_value() [1/2]

template<typename T >
static bool tools::is_error_value ( const T val)
static

◆ is_error_value() [2/2]

static bool tools::is_error_value ( const std::string &  s)
static

◆ is_hdd()

boost::optional< bool > tools::is_hdd ( const char *  file_path)

◆ is_local_address()

bool tools::is_local_address ( const std::string &  address)

◆ log_stack_trace()

void tools::log_stack_trace ( const char *  msg)

◆ msg_writer()

scoped_message_writer tools::msg_writer ( epee::console_colors  color = epee::console_color_default)
inline

◆ on_startup()

bool tools::on_startup ( )

◆ parse_subaddress_lookahead()

boost::optional< std::pair< uint32_t, uint32_t > > tools::parse_subaddress_lookahead ( const std::string &  str)

◆ ptx_to_string()

static std::string tools::ptx_to_string ( const tools::wallet2::pending_tx ptx)
static

◆ replace_file()

std::error_code tools::replace_file ( const std::string &  replacement_name,
const std::string &  replaced_name 
)

std::rename wrapper for nix and something strange for windows.

◆ sanitize_locale()

bool tools::sanitize_locale ( )

◆ serialize_obj_to_file()

template<class t_object >
bool tools::serialize_obj_to_file ( t_object &  obj,
const std::string &  file_path 
)

◆ set_max_concurrency()

void tools::set_max_concurrency ( unsigned  n)

◆ set_performance_timer_log_level()

void tools::set_performance_timer_log_level ( el::Level  level)

◆ set_stack_trace_log()

void tools::set_stack_trace_log ( const std::string &  log)

◆ set_strict_default_file_permissions()

void tools::set_strict_default_file_permissions ( bool  strict)

◆ setup_crash_dump()

static void tools::setup_crash_dump ( )
static

◆ sha256sum() [1/2]

bool tools::sha256sum ( const uint8_t *  data,
size_t  len,
crypto::hash hash 
)

◆ sha256sum() [2/2]

bool tools::sha256sum ( const std::string &  filename,
crypto::hash hash 
)

◆ success_msg_writer()

scoped_message_writer tools::success_msg_writer ( bool  color = true)
inline

◆ ticks_to_ns()

uint64_t tools::ticks_to_ns ( uint64_t  ticks)

◆ total_amount()

static uint64_t tools::total_amount ( const tools::wallet2::pending_tx ptx)
static

◆ txt_to_string()

std::string tools::txt_to_string ( const char *  src,
size_t  len 
)

◆ unbound_built_with_threads()

static bool tools::unbound_built_with_threads ( )
static

◆ unserialize_obj_from_file()

template<class t_object >
bool tools::unserialize_obj_from_file ( t_object &  obj,
const std::string &  file_path 
)

◆ vercmp()

int tools::vercmp ( const char *  v0,
const char *  v1 
)

◆ write_varint()

template<typename OutputIt , typename T >
std::enable_if<std::is_integral<T>::value && std::is_unsigned<T>::value, void>::type tools::write_varint ( OutputIt &&  dest,
T  i 
)

writes a varint to a stream.

Variable Documentation

◆ DNS_CLASS_IN

const int tools::DNS_CLASS_IN = 1
static

◆ DNS_TYPE_A

const int tools::DNS_TYPE_A = 1
static

◆ DNS_TYPE_AAAA

const int tools::DNS_TYPE_AAAA = 8
static

◆ DNS_TYPE_TXT

const int tools::DNS_TYPE_TXT = 16
static

◆ MAX_SPLIT_ATTEMPTS

const size_t tools::MAX_SPLIT_ATTEMPTS = 30

◆ performance_timer_log_level

el::Level tools::performance_timer_log_level = el::Level::Debug

◆ performance_timers

__thread std::vector<LoggingPerformanceTimer*>* tools::performance_timers = NULL
static

◆ rpc_timeout

const std::chrono::seconds tools::rpc_timeout = std::chrono::minutes(3) + std::chrono::seconds(30)
static