GNUnet  0.10.x
Data Structures | Macros | Functions
configuration.c File Reference

configuration management More...

#include "platform.h"
#include "gnunet_crypto_lib.h"
#include "gnunet_strings_lib.h"
#include "gnunet_configuration_lib.h"
#include "gnunet_disk_lib.h"
Include dependency graph for configuration.c:

Go to the source code of this file.

Data Structures

struct  ConfigEntry
 configuration entry More...
 
struct  ConfigSection
 configuration section More...
 
struct  GNUNET_CONFIGURATION_Handle
 configuration data More...
 
struct  DiffHandle
 Used for diffing a configuration object against the default one. More...
 

Macros

#define LOG(kind, ...)   GNUNET_log_from(kind, "util", __VA_ARGS__)
 
#define LOG_STRERROR_FILE(kind, syscall, filename)   GNUNET_log_from_strerror_file(kind, "util", syscall, filename)
 

Functions

struct GNUNET_CONFIGURATION_HandleGNUNET_CONFIGURATION_create ()
 Create a GNUNET_CONFIGURATION_Handle. More...
 
void GNUNET_CONFIGURATION_destroy (struct GNUNET_CONFIGURATION_Handle *cfg)
 Destroy configuration object. More...
 
int 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. More...
 
int GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, const char *mem, size_t size, const char *basedir)
 De-serializes configuration. More...
 
int 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. More...
 
int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Test if there are configuration options that were changed since the last save. More...
 
char * GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg, size_t *size)
 Serializes the given configuration. More...
 
int GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
 Write configuration file. More...
 
void GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CONFIGURATION_Iterator iter, void *iter_cls)
 Iterate over all options in the configuration. More...
 
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. More...
 
void GNUNET_CONFIGURATION_iterate_sections (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_CONFIGURATION_Section_Iterator iter, void *iter_cls)
 Iterate over all sections in the configuration. More...
 
void GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
 Remove the given section and all options in it. More...
 
static void copy_entry (void *cls, const char *section, const char *option, const char *value)
 Copy a configuration value to the given target configuration. More...
 
struct GNUNET_CONFIGURATION_HandleGNUNET_CONFIGURATION_dup (const struct GNUNET_CONFIGURATION_Handle *cfg)
 Duplicate an existing configuration object. More...
 
static struct ConfigSectionfind_section (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
 Find a section entry from a configuration. More...
 
static struct ConfigEntryfind_entry (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *key)
 Find an entry from a configuration. More...
 
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) and write the diffs in a diff-configuration object (the callback object). More...
 
struct GNUNET_CONFIGURATION_HandleGNUNET_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. More...
 
int 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. More...
 
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. More...
 
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. More...
 
int 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. More...
 
int 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. More...
 
int 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. More...
 
int 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. More...
 
int 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. More...
 
int 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. More...
 
int 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. More...
 
int 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. More...
 
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 the environtment "FOO" is set to "DIRECTORY". More...
 
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 the environtment "FOO" is set to "DIRECTORY". More...
 
int 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 a string. More...
 
int 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". More...
 
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. More...
 
static char * escape_name (const char *value)
 FIXME. More...
 
static int test_match (void *cls, const char *fn)
 FIXME. More...
 
int 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. More...
 
int 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. More...
 
static int parse_configuration_file (void *cls, const char *filename)
 Wrapper around GNUNET_CONFIGURATION_parse. More...
 
int GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, const char *defaults_d)
 Load default configuration. More...
 

Detailed Description

configuration management

Author
Christian Grothoff

Definition in file configuration.c.

Macro Definition Documentation

◆ LOG

#define LOG (   kind,
  ... 
)    GNUNET_log_from(kind, "util", __VA_ARGS__)

◆ LOG_STRERROR_FILE

#define LOG_STRERROR_FILE (   kind,
  syscall,
  filename 
)    GNUNET_log_from_strerror_file(kind, "util", syscall, filename)

Definition at line 35 of file configuration.c.

Function Documentation

◆ copy_entry()

static void copy_entry ( void *  cls,
const char *  section,
const char *  option,
const char *  value 
)
static

Copy a configuration value to the given target configuration.

Overwrites existing entries.

Parameters
clsthe destination configuration (struct GNUNET_CONFIGURATION_Handle *)
sectionsection for the value
optionoption name of the value
valuevalue to copy

Definition at line 679 of file configuration.c.

References GNUNET_CONFIGURATION_set_value_string().

Referenced by GNUNET_CONFIGURATION_dup().

683 {
684  struct GNUNET_CONFIGURATION_Handle *dst = cls;
685 
687 }
static char * section
Name of the section.
Definition: gnunet-config.c:33
static char * value
Value of the record to add/remove.
static char * option
Name of the option.
Definition: gnunet-config.c:38
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.
configuration data
Definition: configuration.c:83
Here is the call graph for this function:
Here is the caller graph for this function:

◆ find_section()

static struct ConfigSection* find_section ( const struct GNUNET_CONFIGURATION_Handle cfg,
const char *  section 
)
static

Find a section entry from a configuration.

Parameters
cfgconfiguration to search in
sectionname of the section to look for
Returns
matching entry, NULL if not found

Definition at line 715 of file configuration.c.

References ConfigSection::name, ConfigSection::next, and GNUNET_CONFIGURATION_Handle::sections.

Referenced by find_entry(), and GNUNET_CONFIGURATION_set_value_string().

717 {
718  struct ConfigSection *pos;
719 
720  pos = cfg->sections;
721  while ((pos != NULL) && (0 != strcasecmp(section, pos->name)))
722  pos = pos->next;
723  return pos;
724 }
static char * section
Name of the section.
Definition: gnunet-config.c:33
char * name
name of the section
Definition: configuration.c:76
struct ConfigSection * sections
Configuration sections.
Definition: configuration.c:87
configuration section
Definition: configuration.c:62
struct ConfigSection * next
This is a linked list.
Definition: configuration.c:66
Here is the caller graph for this function:

◆ find_entry()

static struct ConfigEntry* find_entry ( const struct GNUNET_CONFIGURATION_Handle cfg,
const char *  section,
const char *  key 
)
static

Find an entry from a configuration.

Parameters
cfghandle to the configuration
sectionsection the option is in
keythe option
Returns
matching entry, NULL if not found

Definition at line 736 of file configuration.c.

References ConfigSection::entries, find_section(), ConfigEntry::key, and ConfigEntry::next.

Referenced by compare_entries(), GNUNET_CONFIGURATION_get_value_choice(), GNUNET_CONFIGURATION_get_value_float(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_size(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_CONFIGURATION_have_value(), and GNUNET_CONFIGURATION_set_value_string().

739 {
740  struct ConfigSection *sec;
741  struct ConfigEntry *pos;
742 
743  if (NULL == (sec = find_section(cfg, section)))
744  return NULL;
745  pos = sec->entries;
746  while ((pos != NULL) && (0 != strcasecmp(key, pos->key)))
747  pos = pos->next;
748  return pos;
749 }
struct ConfigEntry * entries
entries in the section
Definition: configuration.c:71
configuration entry
Definition: configuration.c:41
static char * section
Name of the section.
Definition: gnunet-config.c:33
static struct ConfigSection * find_section(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section)
Find a section entry from a configuration.
struct GNUNET_HashCode key
The key used in the DHT.
struct ConfigEntry * next
This is a linked list.
Definition: configuration.c:45
configuration section
Definition: configuration.c:62
char * key
key for this entry
Definition: configuration.c:50
Here is the call graph for this function:
Here is the caller graph for this function:

◆ compare_entries()

static void compare_entries ( void *  cls,
const char *  section,
const char *  option,
const char *  value 
)
static

A callback function, compares entries from two configurations (default against a new configuration) and write the diffs in a diff-configuration object (the callback object).

Parameters
clsthe diff configuration (struct DiffHandle *)
sectionsection for the value (of the default conf.)
optionoption name of the value (of the default conf.)
valuevalue to copy (of the default conf.)

Definition at line 763 of file configuration.c.

References DiffHandle::cfg_default, DiffHandle::cfgDiff, find_entry(), GNUNET_CONFIGURATION_set_value_string(), and ConfigEntry::val.

Referenced by GNUNET_CONFIGURATION_get_diff().

767 {
768  struct DiffHandle *dh = cls;
769  struct ConfigEntry *entNew;
770 
771  entNew = find_entry(dh->cfg_default, section, option);
772  if ((NULL != entNew) && (NULL != entNew->val) &&
773  (0 == strcmp(entNew->val, value)))
774  return;
776 }
configuration entry
Definition: configuration.c:41
static struct ConfigEntry * find_entry(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *key)
Find an entry from a configuration.
struct GNUNET_CONFIGURATION_Handle * cfgDiff
static char * section
Name of the section.
Definition: gnunet-config.c:33
static char * value
Value of the record to add/remove.
static char * option
Name of the option.
Definition: gnunet-config.c:38
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.
Used for diffing a configuration object against the default one.
const struct GNUNET_CONFIGURATION_Handle * cfg_default
char * val
current, commited value
Definition: configuration.c:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ expand_dollar()

static char* expand_dollar ( const struct GNUNET_CONFIGURATION_Handle cfg,
char *  orig,
unsigned int  depth 
)
static

Expand an expression of the form "$FOO/BAR" to "DIRECTORY/BAR" where either in the "PATHS" section or the environtment "FOO" is set to "DIRECTORY".

We also support default expansion, i.e. ${VARIABLE:-default} will expand to $VARIABLE if VARIABLE is set in PATHS or the environment, and otherwise to "default". Note that "default" itself can also be a $-expression, thus "${VAR1:-{$VAR2}}" will expand to VAR1 and if that is not defined to VAR2.

Parameters
cfgconfiguration to use for path expansion
origstring to $-expand (will be freed!)
depthrecursion depth, used to detect recursive expansions
Returns
$-expanded string

Definition at line 1165 of file configuration.c.

References _, end, env, getenv(), GNUNET_CONFIGURATION_expand_dollar(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_WARNING, GNUNET_free, GNUNET_free_non_null, GNUNET_malloc, GNUNET_OK, GNUNET_realloc, GNUNET_strdup, len, LOG, result, and start.

Referenced by GNUNET_CONFIGURATION_expand_dollar().

1168 {
1169  int i;
1170  char *prefix;
1171  char *result;
1172  char *start;
1173  const char *post;
1174  const char *env;
1175  char *def;
1176  char *end;
1177  unsigned int lopen;
1178  char erased_char;
1179  char *erased_pos;
1180  size_t len;
1181 
1182  if (NULL == orig)
1183  return NULL;
1184  if (depth > 128)
1185  {
1187  _(
1188  "Recursive expansion suspected, aborting $-expansion for term `%s'\n"),
1189  orig);
1190  return orig;
1191  }
1192  LOG(GNUNET_ERROR_TYPE_DEBUG, "Asked to $-expand %s\n", orig);
1193  if ('$' != orig[0])
1194  {
1195  LOG(GNUNET_ERROR_TYPE_DEBUG, "Doesn't start with $ - not expanding\n");
1196  return orig;
1197  }
1198  erased_char = 0;
1199  erased_pos = NULL;
1200  if ('{' == orig[1])
1201  {
1202  start = &orig[2];
1203  lopen = 1;
1204  end = &orig[1];
1205  while (lopen > 0)
1206  {
1207  end++;
1208  switch (*end)
1209  {
1210  case '}':
1211  lopen--;
1212  break;
1213 
1214  case '{':
1215  lopen++;
1216  break;
1217 
1218  case '\0':
1220  _("Missing closing `%s' in option `%s'\n"),
1221  "}",
1222  orig);
1223  return orig;
1224 
1225  default:
1226  break;
1227  }
1228  }
1229  erased_char = *end;
1230  erased_pos = end;
1231  *end = '\0';
1232  post = end + 1;
1233  def = strchr(orig, ':');
1234  if (NULL != def)
1235  {
1236  *def = '\0';
1237  def++;
1238  if (('-' == *def) || ('=' == *def))
1239  def++;
1240  def = GNUNET_strdup(def);
1241  }
1242  }
1243  else
1244  {
1245  start = &orig[1];
1246  def = NULL;
1247  i = 0;
1248  while ((orig[i] != '/') && (orig[i] != '\\') && (orig[i] != '\0') &&
1249  (orig[i] != ' '))
1250  i++;
1251  if (orig[i] == '\0')
1252  {
1253  post = "";
1254  }
1255  else
1256  {
1257  erased_char = orig[i];
1258  erased_pos = &orig[i];
1259  orig[i] = '\0';
1260  post = &orig[i + 1];
1261  }
1262  }
1264  "Split into `%s' and `%s' with default %s\n",
1265  start,
1266  post,
1267  def);
1268  if (GNUNET_OK !=
1269  GNUNET_CONFIGURATION_get_value_string(cfg, "PATHS", start, &prefix))
1270  {
1271  if (NULL == (env = getenv(start)))
1272  {
1273  /* try default */
1274  def = expand_dollar(cfg, def, depth + 1);
1275  env = def;
1276  }
1277  if (NULL == env)
1278  {
1279  start = GNUNET_strdup(start);
1280  if (erased_pos)
1281  *erased_pos = erased_char;
1283  _(
1284  "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined as an environmental variable\n"),
1285  start,
1286  orig);
1287  GNUNET_free(start);
1288  return orig;
1289  }
1290  prefix = GNUNET_strdup(env);
1291  }
1292  prefix = GNUNET_CONFIGURATION_expand_dollar(cfg, prefix);
1293  if ((erased_pos) && ('}' != erased_char))
1294  {
1295  len = strlen(prefix) + 1;
1296  prefix = GNUNET_realloc(prefix, len + 1);
1297  prefix[len - 1] = erased_char;
1298  prefix[len] = '\0';
1299  }
1300  result = GNUNET_malloc(strlen(prefix) + strlen(post) + 1);
1301  strcpy(result, prefix);
1302  strcat(result, post);
1303  GNUNET_free_non_null(def);
1304  GNUNET_free(prefix);
1305  GNUNET_free(orig);
1306  return result;
1307 }
static int end
Set if we are to shutdown all services (including ARM).
Definition: gnunet-arm.c:34
static int start
Set if we are to start default services (including ARM).
Definition: gnunet-arm.c:39
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...
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define _(String)
GNU gettext support macro.
Definition: platform.h:181
#define GNUNET_realloc(ptr, size)
Wrapper around realloc.
static int result
Global testing status.
#define LOG(kind,...)
Definition: configuration.c:33
int 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.
char * getenv()
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
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...
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
uint16_t len
length of data (which is always a uint32_t, but presumably this can be used to specify that fewer byt...
Here is the call graph for this function:
Here is the caller graph for this function:

◆ escape_name()

static char* escape_name ( const char *  value)
static

FIXME.

Parameters
valueFIXME
Returns
FIXME

Definition at line 1499 of file configuration.c.

References GNUNET_malloc, and value.

Referenced by GNUNET_CONFIGURATION_append_value_filename(), and GNUNET_CONFIGURATION_remove_value_filename().

1500 {
1501  char *escaped;
1502  const char *rpos;
1503  char *wpos;
1504 
1505  escaped = GNUNET_malloc(strlen(value) * 2 + 1);
1506  memset(escaped, 0, strlen(value) * 2 + 1);
1507  rpos = value;
1508  wpos = escaped;
1509  while (rpos[0] != '\0')
1510  {
1511  switch (rpos[0])
1512  {
1513  case '\\':
1514  case ' ':
1515  wpos[0] = '\\';
1516  wpos[1] = rpos[0];
1517  wpos += 2;
1518  break;
1519 
1520  default:
1521  wpos[0] = rpos[0];
1522  wpos++;
1523  }
1524  rpos++;
1525  }
1526  return escaped;
1527 }
static char * value
Value of the record to add/remove.
#define GNUNET_malloc(size)
Wrapper around malloc.
Here is the caller graph for this function:

◆ test_match()

static int test_match ( void *  cls,
const char *  fn 
)
static

FIXME.

Parameters
clsstring we compare with (const char*)
fnfilename we are currently looking at
Returns
GNUNET_OK if the names do not match, GNUNET_SYSERR if they do

Definition at line 1538 of file configuration.c.

References GNUNET_OK, and GNUNET_SYSERR.

Referenced by GNUNET_CONFIGURATION_append_value_filename().

1539 {
1540  const char *of = cls;
1541 
1542  return (0 == strcmp(of, fn)) ? GNUNET_SYSERR : GNUNET_OK;
1543 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
static char * fn
Filename of the unique file.
#define GNUNET_SYSERR
Definition: gnunet_common.h:76
Here is the caller graph for this function:

◆ parse_configuration_file()

static int parse_configuration_file ( void *  cls,
const char *  filename 
)
static

Wrapper around GNUNET_CONFIGURATION_parse.

Called on each file in a directory, we trigger parsing on those files that end with ".conf".

Parameters
clsthe cfg
filenamefile to parse
Returns
GNUNET_OK on success

Definition at line 1691 of file configuration.c.

References cfg, GNUNET_CONFIGURATION_parse(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_OK, and ret.

Referenced by GNUNET_CONFIGURATION_load_from().

1692 {
1693  struct GNUNET_CONFIGURATION_Handle *cfg = cls;
1694  char *ext;
1695  int ret;
1696 
1697  /* Examine file extension */
1698  ext = strrchr(filename, '.');
1699  if ((NULL == ext) || (0 != strcmp(ext, ".conf")))
1700  {
1701  GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Skipping file `%s'\n", filename);
1702  return GNUNET_OK;
1703  }
1704 
1706  return ret;
1707 }
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:75
int 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...
static int ret
Final status code.
Definition: gnunet-arm.c:89
static char * filename
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
configuration data
Definition: configuration.c:83
#define GNUNET_log(kind,...)
Here is the call graph for this function:
Here is the caller graph for this function: