30 #define LOG(kind, ...) GNUNET_log_from (kind, "util", __VA_ARGS__)
32 #define LOG_STRERROR_FILE(kind, syscall, filename) \
33 GNUNET_log_from_strerror_file (kind, "util", syscall, filename)
404 while ((pos != NULL) && (0 != strcasecmp (section, pos->
name)))
413 return strcmp (*((
const char **) a), *((
const char **) b));
424 const char *path_or_glob,
426 const char *restrict_section,
427 const char *source_filename,
428 unsigned int source_lineno)
430 char *inline_path = NULL;
440 GNUNET_assert (! (path_is_glob && (NULL != restrict_section)));
442 if (NULL == source_filename)
445 "Refusing to parse inline configurations, "
446 "not allowed without source filename!\n");
451 if (
'/' == *path_or_glob)
458 char *source_realpath;
461 source_realpath = realpath (source_filename,
463 if (NULL == source_realpath)
471 endsep = strrchr (source_realpath,
'/');
478 free (source_realpath);
486 "processing config glob '%s'\n",
497 for (
int i = 0; i < nret; i++)
509 else if (NULL != restrict_section)
533 if (0 == stat (sfn, &istat))
535 struct passwd *pw = getpwuid (istat.st_uid);
536 struct group *gr = getgrgid (istat.st_gid);
537 char *pwname = (NULL == pw) ?
"<unknown>" : pw->pw_name;
538 char *grname = (NULL == gr) ?
"<unknown>" : gr->gr_name;
593 "Configuration file '%s' loaded with @inline-secret@ "
594 "does not contain section '%s'.\n",
625 if (NULL != other_cfg)
659 "Section '%s' is marked as inaccessible, because the configuration "
660 " file that contains the section can't be read. Attempts to use "
661 "option '%s' will fail.\n",
667 while ((pos != NULL) && (0 != strcasecmp (
key, pos->
key)))
687 unsigned int hint_line)
695 e->hint_lineno = hint_line;
703 const char *source_filename)
714 char *line_orig = NULL;
720 while (r_bytes <
size)
728 to_read =
size - r_bytes;
729 pos = memchr (&mem[r_bytes],
'\n', to_read);
733 line_size = to_read);
734 r_bytes += line_size;
739 line_size = (pos - &mem[r_bytes]));
740 r_bytes += line_size + 1;
747 for (
size_t i = 0; i < line_size; i++)
761 for (
size_t i = line_size - 1;
762 (i >= 1) && (isspace ((
unsigned char)
line[i]));
767 for (;
line[0] !=
'\0' && (isspace ((
unsigned char)
line[0]));
line++)
771 if ( (
'#' ==
line[0]) ||
778 char *
end = strchr (
line + 1,
'@');
786 "Illegal directive in line %u (parsing restricted section %s)\n"),
796 _ (
"Bad directive in line %u\n"),
802 directive =
line + 1;
804 if (0 == strcasecmp (directive,
807 const char *path =
end + 1;
810 for (; isspace (*path); path++)
820 else if (0 == strcasecmp (directive,
823 const char *path =
end + 1;
826 for (; isspace (*path); path++)
836 else if (0 == strcasecmp (directive,
839 char *secname =
end + 1;
844 for (; isspace (*secname); secname++)
847 secname_end = strchr (secname,
' ');
849 if (NULL == secname_end)
852 _ (
"Bad inline-secret directive in line %u\n"),
858 path = secname_end + 1;
861 for (; isspace (*path); path++)
874 _ (
"Unknown or malformed directive '%s' in line %u\n"),
887 if ( (
'[' ==
line[0]) &&
888 (
']' ==
line[line_size - 1]) )
891 line[line_size - 1] =
'\0';
897 if (NULL != (eq = strchr (
line,
'=')))
905 "Syntax error while deserializing in line %u (option without section)\n"),
914 for (i = strlen (tag) - 1;
915 (i >= 1) && (isspace ((
unsigned char) tag[i]));
921 while (isspace ((
unsigned char)
value[0]))
923 for (i = strlen (
value) - 1;
924 (i >= 1) && (isspace ((
unsigned char)
value[i]));
930 if ( (
'"' ==
value[0]) &&
955 _ (
"Syntax error while deserializing in line %u\n"),
993 for (; NULL != cf; parent = cf, cf = cf->
prev)
996 if (cf->level >= lvl)
999 if ( (NULL == cf->source_filename) || (NULL ==
filename))
1001 if (0 == strcmp (cf->source_filename,
filename))
1006 "Forbidden direct cyclic configuration import (%s -> %s)\n",
1007 cf->source_filename,
1012 "Forbidden indirect cyclic configuration import (%s -> ... -> %s -> %s)\n",
1013 cf->source_filename,
1039 "Error while determining the file size of `%s'\n",
1053 if ((sret < 0) || (
fs != (
size_t) sret))
1068 _ (
"Failed to parse configuration file `%s'\n"),
1098 if (0 != strcasecmp (
"PATHS",
1101 return ( (0 == strcasecmp (
"DATADIR",
1103 (0 == strcasecmp (
"LIBDIR",
1105 (0 == strcasecmp (
"BINDIR",
1107 (0 == strcasecmp (
"PREFIX",
1109 (0 == strcasecmp (
"LOCALEDIR",
1111 (0 == strcasecmp (
"ICONDIR",
1113 (0 == strcasecmp (
"DOCDIR",
1115 (0 == strcasecmp (
"DEFAULTCONFIG",
1117 (0 == strcasecmp (
"LIBEXECDIR",
1139 if (sec->inaccessible)
1142 m_size += strlen (sec->name) + 3;
1150 if (NULL != ent->val)
1154 while (NULL != (pos = strstr (pos,
"\n")))
1161 m_size += strlen (ent->key) + strlen (ent->val) + 4;
1194 if (NULL != ent->val)
1197 strcpy (val, ent->val);
1198 while (NULL != (pos = strstr (val,
"\n")))
1200 memmove (&pos[2], &pos[1], strlen (&pos[1]));
1227 "#\n# Configuration file diagnostics\n#\n");
1229 "# Entry point: %s\n",
1233 "#\n# Files Loaded:\n");
1241 for (
unsigned int i = 0; i < cfil->level; i++)
1244 if (0 != cfil->level)
1250 cfil->source_filename);
1252 if (NULL != cfil->hint_restrict_section)
1254 " (%s secret section %s)",
1255 cfil->hint_inaccessible
1258 cfil->hint_restrict_section);
1271 if (sec->hint_secret_filename)
1273 "# secret section from %s\n# secret file stat %s\n",
1274 sec->hint_secret_filename,
1275 sec->hint_secret_stat);
1276 if (sec->hint_inlined_from_filename)
1279 "# inlined from %s:%u\n",
1280 sec->hint_inlined_from_filename,
1281 sec->hint_inlined_from_line);
1286 if (sec->inaccessible)
1289 "# <section contents inaccessible>\n\n\n");
1299 if (NULL != ent->val)
1303 strcpy (val, ent->val);
1304 while (NULL != (pos = strstr (val,
"\n")))
1306 memmove (&pos[2], &pos[1], strlen (&pos[1]));
1310 if (NULL != ent->hint_filename)
1366 if (((ssize_t)
size) !=
1402 if (NULL != epos->val)
1413 const char *section,
1421 while ((spos != NULL) && (0 != strcasecmp (spos->
name, section)))
1428 "Section '%s' is marked as inaccessible, because the configuration "
1429 " file that contains the section can't be read.\n",
1433 for (epos = spos->
entries; NULL != epos; epos = epos->
next)
1434 if (NULL != epos->
val)
1435 iter (iter_cls, spos->
name, epos->
key, epos->
val);
1449 while (
next != NULL)
1453 iter (iter_cls, spos->
name);
1460 const char *section)
1468 while (NULL != spos)
1470 if (0 == strcasecmp (section, spos->
name))
1476 while (NULL != (ent = spos->
entries))
1509 const char *section,
1542 const char *section,
1550 if ((NULL != entNew) && (NULL != entNew->
val) &&
1551 (0 == strcmp (entNew->
val,
value)))
1589 const char *section,
1631 const char *section,
1633 unsigned long long number)
1645 const char *section,
1647 unsigned long long *
number)
1665 const char *section,
1685 const char *section,
1701 _ (
"Not a valid relative time specification"));
1709 const char *section,
1711 unsigned long long *
size)
1736 const char *section,
1742 if ((NULL == (
e =
find_entry (
cfg, section, option))) || (NULL ==
e->val))
1755 const char *section,
1765 for (i = 0; NULL !=
choices[i]; i++)
1766 if (0 == strcasecmp (
choices[i],
e->val))
1771 _ (
"Configuration value '%s' for '%s'"
1772 " in section '%s' is not in set of legal choices\n"),
1785 const char *section,
1817 const char *section,
1822 if ((NULL == (
e =
find_entry (
cfg, section, option))) || (NULL ==
e->val))
1866 "Recursive expansion suspected, aborting $-expansion for term `%s'\n"),
1898 _ (
"Missing closing `%s' in option `%s'\n"),
1911 def = strchr (orig,
':');
1916 if ((
'-' == *def) || (
'=' == *def))
1928 while ((orig[i] !=
'/') && (orig[i] !=
'\\') && (orig[i] !=
'\0') &&
1931 if (orig[i] ==
'\0')
1937 erased_char = orig[i];
1938 erased_pos = &orig[i];
1940 post = &orig[i + 1];
1944 "Split into `%s' and `%s' with default %s\n",
1961 *erased_pos = erased_char;
1964 "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined as an environmental variable\n"),
1973 if ((erased_pos) && (
'}' != erased_char))
1999 for (i = 0;
'\0' != orig[i]; i++)
2006 len = strlen (dup) + 1;
2018 const char *section,
2043 const char *section,
2046 static const char *yesno[] = {
"YES",
"NO", NULL };
2054 if (
val == yesno[0])
2063 const char *section,
2082 while (pos[0] ==
' ')
2084 if (strlen (pos) == 0)
2087 while ((
end[0] !=
' ') && (
end[0] !=
'\0'))
2095 memmove (
end, &
end[1], strlen (&
end[1]) + 1);
2110 if (strlen (pos) > 0)
2113 if ((cb != NULL) && (
GNUNET_OK != cb (cb_cls, pos)))
2142 memset (escaped, 0, strlen (
value) * 2 + 1);
2145 while (rpos[0] !=
'\0')
2176 const char *of = cls;
2185 const char *section,
2206 if (strlen (old) > 0)
2208 strcat (nw, escaped);
2220 const char *section,
2237 while (pos[0] ==
' ')
2239 if (strlen (pos) == 0)
2242 while ((
end[0] !=
' ') && (
end[0] !=
'\0'))
2266 if (0 == strcmp (pos, match))
2269 memmove (pos, &
end[1], strlen (&
end[1]) + 1);
2295 const char *defaults_d)
2307 qsort (files_context.
files,
2311 for (
unsigned int i = 0; i < files_context.
files_length; i++)
2318 if ((NULL == ext) || (0 != strcmp (ext,
".conf")))
2331 for (
size_t i = 0; i < files_context.
files_length; i++)
2346 const char *xdg =
getenv (
"XDG_CONFIG_HOME");
2388 const char *xdg =
getenv (
"XDG_CONFIG_HOME");
2389 char *cfgname = NULL;
2424 "Unable to top-level configuration file.\n");
2434 "Loading top-level configuration from '%s'\n",
2463 const char *base_config_varname;
2480 if ((NULL != base_config_varname)
2481 && (NULL != (baseconfig =
getenv (base_config_varname))))
2506 "Failed to load base configuration from '%s'\n",
2517 "Failed to load configuration from file '%s'\n",
struct GNUNET_MQ_Envelope * env
static bool do_skip(const char *sec, const char *key)
Should we skip this configuration entry when serializing?
static struct ConfigEntry * find_entry(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *key)
Find an entry from a configuration.
static void compare_entries(void *cls, const char *section, const char *option, const char *value)
A callback function, compares entries from two configurations (default against a new configuration) a...
enum GNUNET_GenericReturnValue handle_inline(struct GNUNET_CONFIGURATION_Handle *cfg, const char *path_or_glob, bool path_is_glob, const char *restrict_section, const char *source_filename, unsigned int source_lineno)
Handle an inline directive.
static char * expand_dollar(const struct GNUNET_CONFIGURATION_Handle *cfg, char *orig, unsigned int depth)
Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" where either in the "PATHS" section or...
static enum GNUNET_GenericReturnValue test_match(void *cls, const char *fn)
FIXME.
static int pstrcmp(const void *a, const void *b)
static struct ConfigSection * find_section(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
Find a section entry from a configuration.
static char * escape_name(const char *value)
FIXME.
static void copy_entry(void *cls, const char *section, const char *option, const char *value)
Copy a configuration value to the given target configuration.
static int collect_files_cb(void *cls, const char *filename)
Function called with a filename.
static void set_entry_hint(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *hint_filename, unsigned int hint_line)
Set a configuration hint.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
static int ret
Return value of the commandline.
static size_t data_size
Number of bytes in data.
static struct GNUNET_ARM_Handle * h
Connection with ARM.
static int start
Set if we are to start default services (including ARM).
static int list
Set if we should print a list of currently running services.
static int end
Set if we are to shutdown all services (including ARM).
static struct Experiment * e
static int prefix
If printing the value of PREFIX has been requested.
static char * line
Desired phone line (string to be converted to a hash).
static void cleanup(void *cls)
Function scheduled as very last function, cleans up after us.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_FS_Handle * fs
Handle to FS service.
static OpusEncoder * enc
OPUS encoder.
static struct in_addr dummy
Target "dummy" address of the packet we pretend to respond to.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
static char * value
Value of the record to add/remove.
static int result
Global testing status.
static struct GNUNET_OS_Process * p
Helper process we started.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_data(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, void *buf, size_t buf_size)
Get Crockford32-encoded fixed-size binary data from a configuration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_is_dirty(const struct GNUNET_CONFIGURATION_Handle *cfg)
Test if there are configuration options that were changed since the last save.
void GNUNET_CONFIGURATION_set_value_string(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *value)
Set a configuration value that should be a string.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_append_value_filename(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *value)
Append a filename to a configuration value that represents a list of filenames.
char * GNUNET_CONFIGURATION_serialize_diagnostics(const struct GNUNET_CONFIGURATION_Handle *cfg)
Serializes the given configuration with diagnostics information.
char * GNUNET_CONFIGURATION_serialize(const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
Serializes the given configuration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
void GNUNET_CONFIGURATION_remove_section(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
Remove the given section and all options in it.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_default(void)
Return GNUnet's default configuration.
enum GNUNET_GenericReturnValue(* GNUNET_CONFIGURATION_Callback)(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
Signature of a function to be run with a configuration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create()
Create a new configuration object.
void GNUNET_CONFIGURATION_iterate_sections(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CONFIGURATION_SectionIterator iter, void *iter_cls)
Iterate over all sections in the configuration.
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
void GNUNET_CONFIGURATION_iterate(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CONFIGURATION_Iterator iter, void *iter_cls)
Iterate over all options in the configuration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_remove_value_filename(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *value)
Remove a filename from a configuration value that represents a list of filenames.
void(* GNUNET_CONFIGURATION_SectionIterator)(void *cls, const char *section)
Function to iterate over section.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_deserialize(struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, size_t size, const char *source_filename)
De-serializes configuration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_size(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *size)
Get a configuration value that should be a size in bytes.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_yesno(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Get a configuration value that should be in a set of "YES" or "NO".
char * GNUNET_CONFIGURATION_expand_dollar(const struct GNUNET_CONFIGURATION_Handle *cfg, char *orig)
Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" where either in the "PATHS" section or...
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
void GNUNET_CONFIGURATION_set_value_number(struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long number)
Set a configuration value that should be a number.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_get_diff(const struct GNUNET_CONFIGURATION_Handle *cfg_default, const struct GNUNET_CONFIGURATION_Handle *cfg_new)
Compute configuration with only entries that have been changed.
int GNUNET_CONFIGURATION_load(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Load configuration (starts with defaults, then loads system-specific configuration).
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_parse(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Parse a configuration file, add all of the options in the file to the configuration environment.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_float(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, float *number)
Get a configuration value that should be a floating point number.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_load_from(struct GNUNET_CONFIGURATION_Handle *cfg, const char *defaults_d)
Load default configuration.
int GNUNET_CONFIGURATION_iterate_value_filenames(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, GNUNET_FileNameCallback cb, void *cb_cls)
Iterate over the set of filenames stored in a configuration value.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_parse_and_run(const char *filename, GNUNET_CONFIGURATION_Callback cb, void *cb_cls)
Parse a configuration file filename and run the function cb with the resulting configuration object.
char * GNUNET_CONFIGURATION_default_filename(void)
Return the filename of the default configuration filename that is used when no explicit configuration...
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_have_value(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Test if we have a value for a particular option.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_choice(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, const char *const *choices, const char **value)
Get a configuration value that should be in a set of predefined strings.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_write(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Write configuration file.
void(* GNUNET_CONFIGURATION_Iterator)(void *cls, const char *section, const char *option, const char *value)
Function to iterate over options.
void GNUNET_CONFIGURATION_iterate_section_values(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, GNUNET_CONFIGURATION_Iterator iter, void *iter_cls)
Iterate over values of a section in the configuration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_write_diffs(const struct GNUNET_CONFIGURATION_Handle *cfg_default, const struct GNUNET_CONFIGURATION_Handle *cfg_new, const char *filename)
Write only configuration entries that have been changed to configuration file.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_dup(const struct GNUNET_CONFIGURATION_Handle *cfg)
Duplicate an existing configuration object.
void GNUNET_CONFIGURATION_enable_diagnostics(struct GNUNET_CONFIGURATION_Handle *cfg)
Enable extra diagnostics.
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
int GNUNET_DISK_glob(const char *glob_pattern, GNUNET_FileNameCallback callback, void *callback_cls)
Find all files matching a glob pattern.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory).
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test_read(const char *fil)
Check that fil corresponds to a filename and the file has read permissions.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_size(const char *filename, uint64_t *size, int include_symbolic_links, int single_file_mode)
Get the size of the file (or directory) of the given file (in bytes).
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_remove(const char *filename)
Remove all files in a directory (rm -rf).
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_test(const char *fil, int is_readable)
Test if fil is a directory and listable.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_create_for_file(const char *filename)
Create the directory structure for storing a file.
ssize_t GNUNET_DISK_fn_read(const char *fn, void *result, size_t len)
Read the contents of a binary file into a buffer.
int GNUNET_DISK_directory_scan(const char *dir_name, GNUNET_FileNameCallback callback, void *callback_cls)
Scan a directory for files.
@ GNUNET_DISK_OPEN_WRITE
Open the file for writing.
@ GNUNET_DISK_OPEN_TRUNCATE
Truncate file if it exists.
@ GNUNET_DISK_OPEN_CREATE
Create file if it doesn't exist.
@ GNUNET_DISK_PERM_USER_READ
Owner can read.
@ GNUNET_DISK_PERM_GROUP_READ
Group can read.
@ GNUNET_DISK_PERM_GROUP_WRITE
Group can write.
@ GNUNET_DISK_PERM_USER_WRITE
Owner can write.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
enum GNUNET_GenericReturnValue(* GNUNET_FileNameCallback)(void *cls, const char *filename)
Function called with a filename.
char * GNUNET_buffer_reap_str(struct GNUNET_Buffer *buf)
Clear the buffer and return the string it contained.
#define GNUNET_log(kind,...)
void GNUNET_buffer_write_fstr(struct GNUNET_Buffer *buf, const char *fmt,...) __attribute__((format(printf
Write a 0-terminated formatted string to a buffer, excluding the 0-terminator.
void GNUNET_buffer_write_str(struct GNUNET_Buffer *buf, const char *str)
Write a 0-terminated string to a buffer, excluding the 0-terminator.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
void GNUNET_log_config_invalid(enum GNUNET_ErrorType kind, const char *section, const char *option, const char *required)
Log error message about invalid configuration option value.
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
int int GNUNET_asprintf(char **buf, const char *format,...) __attribute__((format(printf
Like asprintf, just portable.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_array_grow(arr, size, tsize)
Grow a well-typed (!) array.
#define GNUNET_strndup(a, length)
Wrapper around GNUNET_xstrndup_.
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_realloc(ptr, size)
Wrapper around realloc.
#define GNUNET_array_append(arr, len, element)
Append an element to an array (growing the array by one).
#define GNUNET_free(ptr)
Wrapper around free.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_default(void)
Return default project data used by 'libgnunetutil' for GNUnet.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_get(void)
char * GNUNET_OS_installation_get_path(enum GNUNET_OS_InstallationPathKind dirkind)
Get the path to a specific GNUnet installation directory or, with GNUNET_OS_IPK_SELF_PREFIX,...
void GNUNET_OS_init(const struct GNUNET_OS_ProjectData *pd)
Setup OS subsystem with project data.
@ GNUNET_OS_IPK_ICONDIR
Return the prefix of the path with application icons (share/icons/).
@ GNUNET_OS_IPK_DATADIR
Return the directory where data is installed (share/gnunet/)
@ GNUNET_OS_IPK_DOCDIR
Return the prefix of the path with documentation files, including the license (share/doc/gnunet/).
@ GNUNET_OS_IPK_LOCALEDIR
Return the directory where translations are installed (share/locale/)
@ GNUNET_OS_IPK_LIBDIR
Return the directory where libraries are installed.
@ GNUNET_OS_IPK_PREFIX
Return the "PREFIX" directory given to configure.
@ GNUNET_OS_IPK_BINDIR
Return the directory where the program binaries are installed.
@ GNUNET_OS_IPK_LIBEXECDIR
Return the directory where helper binaries are installed (lib/gnunet/libexec/)
char * GNUNET_STRINGS_filename_expand(const char *fil)
Complete filename (a la shell) from abbrevition.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_fancy_time_to_relative(const char *fancy_time, struct GNUNET_TIME_Relative *rtime)
Convert a given fancy human-readable time to our internal representation.
enum GNUNET_GenericReturnValue GNUNET_STRINGS_fancy_size_to_bytes(const char *fancy_size, unsigned long long *size)
Convert a given fancy human-readable size to bytes.
static unsigned int size
Size of the "table".
Closure to collect_files_cb.
char ** files
Collected files from globbing.
unsigned int files_length
Size of the files array.
char * hint_filename
Diagnostics information for the filename.
struct ConfigEntry * next
This is a linked list.
char * key
key for this entry
unsigned int hint_lineno
Diagnostics information for the line number.
char * val
current, committed value
char * hint_restrict_section
Was this configuration file parsed via @inline-secret@?
char * source_filename
Source filename.
bool hint_inaccessible
Was this configuration file inaccessible?
unsigned int level
Level in the tree of loaded config files.
char * name
name of the section
char * hint_inlined_from_filename
For secret sections: Where was this inlined from?
struct ConfigEntry * entries
entries in the section
bool inaccessible
Is the configuration section marked as inaccessible?
struct ConfigSection * next
This is a linked list.
char * hint_secret_filename
Diagnostics hint for the secret file.
unsigned int hint_inlined_from_line
For secret sections: Where was this inlined from?
char * hint_secret_stat
Extra information regarding permissions of the secret file.
Used for diffing a configuration object against the default one.
const struct GNUNET_CONFIGURATION_Handle * cfg_default
struct GNUNET_CONFIGURATION_Handle * cfgDiff
Dynamically growing buffer.
struct ConfigFile * loaded_files_tail
Linked list of loaded files.
bool load_called
Was the configuration ever loaded via GNUNET_CONFIGURATION_load?
unsigned int current_nest_level
Current nesting level of file loading.
struct ConfigSection * sections
Configuration sections.
struct ConfigFile * loaded_files_head
Linked list of loaded files.
char * main_filename
Name of the entry point configuration file.
enum GNUNET_GenericReturnValue dirty
Modification indication since last save GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on err...
bool diagnostics
Enable diagnostics.
const char * restrict_section
When parsing into this configuration, and this value is non-NULL, only parse sections of the same nam...
Handle used to access files (and pipes).
Project-specific data used to help the OS subsystem find installation paths.
const char * base_config_varname
Name of an environment variable that can be used to override the location from which default configur...
const char * project_dirname
Name of the project that is used in the "libexec" prefix, For example, "gnunet".
const char * user_config_file
Configuration file name to use (if $XDG_CONFIG_HOME is not set).
const char * config_file
Configuration file name (in $XDG_CONFIG_HOME) to use.
Time for relative time used by GNUnet, in microseconds.