Some utils facilitating the view into the internals for the sampler needed for evaluation. More...
Go to the source code of this file.
Macros | |
#define | TO_FILE 0 |
#define | to_file(file_name, ...) |
This function is used to facilitate writing important information to disk. More... | |
#define | to_file_w_len(file_name, len, ...) |
Functions | |
char * | auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key) |
struct GNUNET_CRYPTO_AuthKey | string_to_auth_key (const char *str) |
struct GNUNET_DISK_FileHandle * | get_file_handle (const char *name) |
Get file handle. More... | |
int | close_all_files () |
Close all files that were opened with get_file_handle. More... | |
char * | store_prefix_file_name (const unsigned int index, const char *prefix) |
void | to_file_raw (const char *file_name, const char *buf, size_t size_buf) |
void | to_file_raw_unaligned (const char *file_name, const char *buf, size_t size_buf, unsigned bits_needed) |
uint32_t | fac (uint32_t x) |
Factorial. More... | |
uint32_t | binom (uint32_t n, uint32_t k) |
Binomial coefficient (n choose k) More... | |
Some utils facilitating the view into the internals for the sampler needed for evaluation.
Definition in file rps-test_util.h.
#define TO_FILE 0 |
Definition at line 31 of file rps-test_util.h.
#define to_file | ( | file_name, | |
... | |||
) |
This function is used to facilitate writing important information to disk.
Definition at line 65 of file rps-test_util.h.
#define to_file_w_len | ( | file_name, | |
len, | |||
... | |||
) |
Definition at line 83 of file rps-test_util.h.
char * auth_key_to_string | ( | struct GNUNET_CRYPTO_AuthKey | auth_key | ) |
Definition at line 380 of file rps-test_util.c.
References end, GNUNET_break, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_malloc, GNUNET_snprintf(), GNUNET_STRINGS_data_to_string(), GNUNET_CRYPTO_AuthKey::key, LOG, and size.
struct GNUNET_CRYPTO_AuthKey string_to_auth_key | ( | const char * | str | ) |
Definition at line 426 of file rps-test_util.c.
References GNUNET_ERROR_TYPE_WARNING, GNUNET_OK, GNUNET_STRINGS_string_to_data(), GNUNET_CRYPTO_AuthKey::key, and LOG.
struct GNUNET_DISK_FileHandle * get_file_handle | ( | const char * | name | ) |
Get file handle.
If necessary, create file handle and store it with the other file handles.
name | Name of the file |
Definition at line 74 of file rps-test_util.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CRYPTO_hash(), GNUNET_DISK_file_open(), GNUNET_DISK_OPEN_APPEND, GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_GROUP_READ, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_NO, GNUNET_YES, LOG, name, and open_files.
int close_all_files | ( | ) |
Close all files that were opened with get_file_handle.
Definition at line 151 of file rps-test_util.c.
References close_files_iter(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_YES, open_files, and ret.
Referenced by shutdown_task().
char * store_prefix_file_name | ( | const unsigned int | index, |
const char * | prefix | ||
) |
Definition at line 464 of file rps-test_util.c.
References ensure_folder_exist(), file_name, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_malloc, GNUNET_snprintf(), GNUNET_SYSERR, and prefix.
void to_file_raw | ( | const char * | file_name, |
const char * | buf, | ||
size_t | size_buf | ||
) |
Definition at line 169 of file rps-test_util.c.
References removetrailingwhitespace::f, file_name, GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_write(), GNUNET_DISK_OPEN_APPEND, GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_GROUP_READ, GNUNET_DISK_PERM_OTHER_READ, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_WARNING, GNUNET_YES, and LOG.
Referenced by to_file_raw_unaligned().
void to_file_raw_unaligned | ( | const char * | file_name, |
const char * | buf, | ||
size_t | size_buf, | ||
unsigned | bits_needed | ||
) |
Definition at line 213 of file rps-test_util.c.
References B2B, B2B_PAT, buf_unaligned, file_name, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MIN, LOG, num_bits_buf_unaligned, and to_file_raw().
uint32_t fac | ( | uint32_t | x | ) |
Factorial.
x | Number of which to compute the factorial |
Definition at line 516 of file rps-test_util.c.
References fac().
Referenced by binom(), and fac().
uint32_t binom | ( | uint32_t | n, |
uint32_t | k | ||
) |
Binomial coefficient (n choose k)
n | |
k |
Definition at line 535 of file rps-test_util.c.
References fac().