aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-07-26 21:20:11 +0000
committerChristian Grothoff <christian@grothoff.org>2009-07-26 21:20:11 +0000
commit7bc466bbdb8b64cac68c5ee59eb7ab6b9d85c420 (patch)
treedc415457e57f9cfda58eb22ca400a941ebcf602e /src/util
parent4f8ba34b32328bd99b2f0c2ff9a2372712022b32 (diff)
downloadgnunet-7bc466bbdb8b64cac68c5ee59eb7ab6b9d85c420.tar.gz
gnunet-7bc466bbdb8b64cac68c5ee59eb7ab6b9d85c420.zip
const-ing of config-handles
Diffstat (limited to 'src/util')
-rw-r--r--src/util/client.c4
-rw-r--r--src/util/configuration.c24
-rw-r--r--src/util/disk.c3
-rw-r--r--src/util/getopt.c2
-rw-r--r--src/util/os_load.c6
-rw-r--r--src/util/program.c12
-rw-r--r--src/util/pseudonym.c20
-rw-r--r--src/util/service.c16
-rw-r--r--src/util/test_getopt.c40
-rw-r--r--src/util/test_program.c3
-rw-r--r--src/util/test_service.c18
11 files changed, 62 insertions, 86 deletions
diff --git a/src/util/client.c b/src/util/client.c
index 7d380fa5c..ab50d9d4d 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -124,7 +124,7 @@ struct GNUNET_CLIENT_Connection
124struct GNUNET_CLIENT_Connection * 124struct GNUNET_CLIENT_Connection *
125GNUNET_CLIENT_connect (struct GNUNET_SCHEDULER_Handle *sched, 125GNUNET_CLIENT_connect (struct GNUNET_SCHEDULER_Handle *sched,
126 const char *service_name, 126 const char *service_name,
127 struct GNUNET_CONFIGURATION_Handle *cfg) 127 const struct GNUNET_CONFIGURATION_Handle *cfg)
128{ 128{
129 struct GNUNET_CLIENT_Connection *ret; 129 struct GNUNET_CLIENT_Connection *ret;
130 struct GNUNET_NETWORK_SocketHandle *sock; 130 struct GNUNET_NETWORK_SocketHandle *sock;
@@ -455,7 +455,7 @@ write_test (void *cls, size_t size, void *buf)
455void 455void
456GNUNET_CLIENT_service_test (struct GNUNET_SCHEDULER_Handle *sched, 456GNUNET_CLIENT_service_test (struct GNUNET_SCHEDULER_Handle *sched,
457 const char *service, 457 const char *service,
458 struct GNUNET_CONFIGURATION_Handle *cfg, 458 const struct GNUNET_CONFIGURATION_Handle *cfg,
459 struct GNUNET_TIME_Relative timeout, 459 struct GNUNET_TIME_Relative timeout,
460 GNUNET_SCHEDULER_Task task, void *task_cls) 460 GNUNET_SCHEDULER_Task task, void *task_cls)
461{ 461{
diff --git a/src/util/configuration.c b/src/util/configuration.c
index eacbdbf05..769d2aadc 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -235,7 +235,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
235} 235}
236 236
237int 237int
238GNUNET_CONFIGURATION_test_dirty (struct GNUNET_CONFIGURATION_Handle *cfg) 238GNUNET_CONFIGURATION_test_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg)
239{ 239{
240 return cfg->dirty; 240 return cfg->dirty;
241} 241}
@@ -316,7 +316,7 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *data,
316 316
317 317
318static struct ConfigSection * 318static struct ConfigSection *
319findSection (struct GNUNET_CONFIGURATION_Handle *data, const char *section) 319findSection (const struct GNUNET_CONFIGURATION_Handle *data, const char *section)
320{ 320{
321 struct ConfigSection *pos; 321 struct ConfigSection *pos;
322 322
@@ -328,7 +328,7 @@ findSection (struct GNUNET_CONFIGURATION_Handle *data, const char *section)
328 328
329 329
330static struct ConfigEntry * 330static struct ConfigEntry *
331findEntry (struct GNUNET_CONFIGURATION_Handle *data, 331findEntry (const struct GNUNET_CONFIGURATION_Handle *data,
332 const char *section, const char *key) 332 const char *section, const char *key)
333{ 333{
334 struct ConfigSection *sec; 334 struct ConfigSection *sec;
@@ -386,7 +386,7 @@ GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle
386} 386}
387 387
388int 388int
389GNUNET_CONFIGURATION_get_value_number (struct GNUNET_CONFIGURATION_Handle 389GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle
390 *cfg, const char *section, 390 *cfg, const char *section,
391 const char *option, 391 const char *option,
392 unsigned long long *number) 392 unsigned long long *number)
@@ -402,7 +402,7 @@ GNUNET_CONFIGURATION_get_value_number (struct GNUNET_CONFIGURATION_Handle
402} 402}
403 403
404int 404int
405GNUNET_CONFIGURATION_get_value_time (struct GNUNET_CONFIGURATION_Handle 405GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle
406 *cfg, const char *section, 406 *cfg, const char *section,
407 const char *option, 407 const char *option,
408 struct GNUNET_TIME_Relative *time) 408 struct GNUNET_TIME_Relative *time)
@@ -420,7 +420,7 @@ GNUNET_CONFIGURATION_get_value_time (struct GNUNET_CONFIGURATION_Handle
420} 420}
421 421
422int 422int
423GNUNET_CONFIGURATION_get_value_string (struct GNUNET_CONFIGURATION_Handle 423GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle
424 *cfg, const char *section, 424 *cfg, const char *section,
425 const char *option, char **value) 425 const char *option, char **value)
426{ 426{
@@ -437,7 +437,7 @@ GNUNET_CONFIGURATION_get_value_string (struct GNUNET_CONFIGURATION_Handle
437} 437}
438 438
439int 439int
440GNUNET_CONFIGURATION_get_value_choice (struct GNUNET_CONFIGURATION_Handle 440GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle
441 *cfg, const char *section, 441 *cfg, const char *section,
442 const char *option, 442 const char *option,
443 const char **choices, 443 const char **choices,
@@ -473,7 +473,7 @@ GNUNET_CONFIGURATION_get_value_choice (struct GNUNET_CONFIGURATION_Handle
473 * @return GNUNET_YES if so, GNUNET_NO if not. 473 * @return GNUNET_YES if so, GNUNET_NO if not.
474 */ 474 */
475int 475int
476GNUNET_CONFIGURATION_have_value (struct GNUNET_CONFIGURATION_Handle *cfg, 476GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
477 const char *section, const char *option) 477 const char *section, const char *option)
478{ 478{
479 struct ConfigEntry *e; 479 struct ConfigEntry *e;
@@ -491,7 +491,7 @@ GNUNET_CONFIGURATION_have_value (struct GNUNET_CONFIGURATION_Handle *cfg,
491 * @return $-expanded string 491 * @return $-expanded string
492 */ 492 */
493char * 493char *
494GNUNET_CONFIGURATION_expand_dollar (struct GNUNET_CONFIGURATION_Handle *cfg, 494GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg,
495 char *orig) 495 char *orig)
496{ 496{
497 int i; 497 int i;
@@ -543,7 +543,7 @@ GNUNET_CONFIGURATION_expand_dollar (struct GNUNET_CONFIGURATION_Handle *cfg,
543 * @return GNUNET_OK on success, GNUNET_SYSERR on error 543 * @return GNUNET_OK on success, GNUNET_SYSERR on error
544 */ 544 */
545int 545int
546GNUNET_CONFIGURATION_get_value_filename (struct GNUNET_CONFIGURATION_Handle 546GNUNET_CONFIGURATION_get_value_filename (const struct GNUNET_CONFIGURATION_Handle
547 *data, const char *section, 547 *data, const char *section,
548 const char *option, char **value) 548 const char *option, char **value)
549{ 549{
@@ -574,7 +574,7 @@ GNUNET_CONFIGURATION_get_value_filename (struct GNUNET_CONFIGURATION_Handle
574 * @return GNUNET_YES, GNUNET_NO or GNUNET_SYSERR 574 * @return GNUNET_YES, GNUNET_NO or GNUNET_SYSERR
575 */ 575 */
576int 576int
577GNUNET_CONFIGURATION_get_value_yesno (struct GNUNET_CONFIGURATION_Handle *cfg, 577GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle *cfg,
578 const char *section, const char *option) 578 const char *section, const char *option)
579{ 579{
580 static const char *yesno[] = { "YES", "NO", NULL }; 580 static const char *yesno[] = { "YES", "NO", NULL };
@@ -597,7 +597,7 @@ GNUNET_CONFIGURATION_get_value_yesno (struct GNUNET_CONFIGURATION_Handle *cfg,
597 * @return number of filenames iterated over, -1 on error 597 * @return number of filenames iterated over, -1 on error
598 */ 598 */
599int 599int
600GNUNET_CONFIGURATION_iterate_value_filenames (struct 600GNUNET_CONFIGURATION_iterate_value_filenames (const struct
601 GNUNET_CONFIGURATION_Handle 601 GNUNET_CONFIGURATION_Handle
602 *cfg, const char *section, 602 *cfg, const char *section,
603 const char *option, 603 const char *option,
diff --git a/src/util/disk.c b/src/util/disk.c
index b0f92c7f2..ff4aff1f7 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1132,6 +1132,7 @@ GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h)
1132 * a directory, end the last argument in '/' (or pass 1132 * a directory, end the last argument in '/' (or pass
1133 * DIR_SEPARATOR_STR as the last argument before NULL). 1133 * DIR_SEPARATOR_STR as the last argument before NULL).
1134 * 1134 *
1135 * @param cfg configuration to use (determines HOME)
1135 * @param serviceName name of the service 1136 * @param serviceName name of the service
1136 * @param varargs is NULL-terminated list of 1137 * @param varargs is NULL-terminated list of
1137 * path components to append to the 1138 * path components to append to the
@@ -1139,7 +1140,7 @@ GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h)
1139 * @return the constructed filename 1140 * @return the constructed filename
1140 */ 1141 */
1141char * 1142char *
1142GNUNET_DISK_get_home_filename (struct GNUNET_CONFIGURATION_Handle *cfg, 1143GNUNET_DISK_get_home_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
1143 const char *serviceName, ...) 1144 const char *serviceName, ...)
1144{ 1145{
1145 const char *c; 1146 const char *c;
diff --git a/src/util/getopt.c b/src/util/getopt.c
index e069e76f7..799146e77 100644
--- a/src/util/getopt.c
+++ b/src/util/getopt.c
@@ -997,7 +997,6 @@ GNgetopt_long (int argc,
997 */ 997 */
998int 998int
999GNUNET_GETOPT_run (const char *binaryOptions, 999GNUNET_GETOPT_run (const char *binaryOptions,
1000 struct GNUNET_CONFIGURATION_Handle *cfg,
1001 const struct GNUNET_GETOPT_CommandLineOption *allOptions, 1000 const struct GNUNET_GETOPT_CommandLineOption *allOptions,
1002 unsigned int argc, char *const *argv) 1001 unsigned int argc, char *const *argv)
1003{ 1002{
@@ -1017,7 +1016,6 @@ GNUNET_GETOPT_run (const char *binaryOptions,
1017 clpc.allOptions = allOptions; 1016 clpc.allOptions = allOptions;
1018 clpc.argv = argv; 1017 clpc.argv = argv;
1019 clpc.argc = argc; 1018 clpc.argc = argc;
1020 clpc.cfg = cfg;
1021 count = 0; 1019 count = 0;
1022 while (allOptions[count].name != NULL) 1020 while (allOptions[count].name != NULL)
1023 count++; 1021 count++;
diff --git a/src/util/os_load.c b/src/util/os_load.c
index d1115e33f..21e74eb49 100644
--- a/src/util/os_load.c
+++ b/src/util/os_load.c
@@ -517,7 +517,7 @@ updateUsage ()
517 * that lock has already been obtained. 517 * that lock has already been obtained.
518 */ 518 */
519static void 519static void
520updateAgedLoad (struct GNUNET_CONFIGURATION_Handle *cfg) 520updateAgedLoad (const struct GNUNET_CONFIGURATION_Handle *cfg)
521{ 521{
522 static struct GNUNET_TIME_Absolute lastCall; 522 static struct GNUNET_TIME_Absolute lastCall;
523 523
@@ -573,7 +573,7 @@ updateAgedLoad (struct GNUNET_CONFIGURATION_Handle *cfg)
573 * (100 is equivalent to full load) 573 * (100 is equivalent to full load)
574 */ 574 */
575int 575int
576GNUNET_OS_load_cpu_get (struct GNUNET_CONFIGURATION_Handle *cfg) 576GNUNET_OS_load_cpu_get (const struct GNUNET_CONFIGURATION_Handle *cfg)
577{ 577{
578 unsigned long long maxCPULoad; 578 unsigned long long maxCPULoad;
579 int ret; 579 int ret;
@@ -596,7 +596,7 @@ GNUNET_OS_load_cpu_get (struct GNUNET_CONFIGURATION_Handle *cfg)
596 * (100 is equivalent to full load) 596 * (100 is equivalent to full load)
597 */ 597 */
598int 598int
599GNUNET_OS_load_disk_get (struct GNUNET_CONFIGURATION_Handle *cfg) 599GNUNET_OS_load_disk_get (const struct GNUNET_CONFIGURATION_Handle *cfg)
600{ 600{
601 unsigned long long maxIOLoad; 601 unsigned long long maxIOLoad;
602 int ret; 602 int ret;
diff --git a/src/util/program.c b/src/util/program.c
index c8ebfc4eb..0cff324f8 100644
--- a/src/util/program.c
+++ b/src/util/program.c
@@ -63,7 +63,7 @@ struct CommandContext
63 /** 63 /**
64 * Configuration to use. 64 * Configuration to use.
65 */ 65 */
66 struct GNUNET_CONFIGURATION_Handle *cfg; 66 const struct GNUNET_CONFIGURATION_Handle *cfg;
67 67
68}; 68};
69 69
@@ -127,6 +127,7 @@ GNUNET_PROGRAM_run (int argc,
127 char *loglev; 127 char *loglev;
128 int ret; 128 int ret;
129 unsigned int cnt; 129 unsigned int cnt;
130 struct GNUNET_CONFIGURATION_Handle *cfg;
130 struct GNUNET_GETOPT_CommandLineOption defoptions[] = { 131 struct GNUNET_GETOPT_CommandLineOption defoptions[] = {
131 GNUNET_GETOPT_OPTION_CFG_FILE (&cc.cfgfile), 132 GNUNET_GETOPT_OPTION_CFG_FILE (&cc.cfgfile),
132 GNUNET_GETOPT_OPTION_HELP (binaryHelp), 133 GNUNET_GETOPT_OPTION_HELP (binaryHelp),
@@ -139,7 +140,7 @@ GNUNET_PROGRAM_run (int argc,
139 loglev = NULL; 140 loglev = NULL;
140 cc.task = task; 141 cc.task = task;
141 cc.task_cls = task_cls; 142 cc.task_cls = task_cls;
142 cc.cfg = GNUNET_CONFIGURATION_create (); 143 cc.cfg = cfg = GNUNET_CONFIGURATION_create ();
143 144
144 /* prepare */ 145 /* prepare */
145#if ENABLE_NLS 146#if ENABLE_NLS
@@ -169,15 +170,14 @@ GNUNET_PROGRAM_run (int argc,
169 qsort (allopts, cnt, sizeof (struct GNUNET_GETOPT_CommandLineOption), 170 qsort (allopts, cnt, sizeof (struct GNUNET_GETOPT_CommandLineOption),
170 &cmd_sorter); 171 &cmd_sorter);
171 loglev = GNUNET_strdup ("WARNING"); 172 loglev = GNUNET_strdup ("WARNING");
172 if ((-1 == (ret = GNUNET_GETOPT_run (binaryName, 173 if ((-1 == (ret = GNUNET_GETOPT_run (binaryName,
173 cc.cfg,
174 allopts, 174 allopts,
175 (unsigned int) argc, argv))) || 175 (unsigned int) argc, argv))) ||
176 ((GNUNET_OK != 176 ((GNUNET_OK !=
177 GNUNET_log_setup (binaryName, 177 GNUNET_log_setup (binaryName,
178 loglev, 178 loglev,
179 NULL)) || 179 NULL)) ||
180 (GNUNET_OK != GNUNET_CONFIGURATION_load (cc.cfg, cc.cfgfile)))) 180 (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cc.cfgfile))))
181 181
182 { 182 {
183 GNUNET_free_non_null (cc.cfgfile); 183 GNUNET_free_non_null (cc.cfgfile);
@@ -192,7 +192,7 @@ GNUNET_PROGRAM_run (int argc,
192 GNUNET_SCHEDULER_run (&program_main, &cc); 192 GNUNET_SCHEDULER_run (&program_main, &cc);
193 193
194 /* clean up */ 194 /* clean up */
195 GNUNET_CONFIGURATION_destroy (cc.cfg); 195 GNUNET_CONFIGURATION_destroy (cfg);
196 GNUNET_free_non_null (cc.cfgfile); 196 GNUNET_free_non_null (cc.cfgfile);
197 GNUNET_free (loglev); 197 GNUNET_free (loglev);
198 return GNUNET_OK; 198 return GNUNET_OK;
diff --git a/src/util/pseudonym.c b/src/util/pseudonym.c
index 52351c2c8..5bf336060 100644
--- a/src/util/pseudonym.c
+++ b/src/util/pseudonym.c
@@ -64,7 +64,7 @@ internal_notify (const GNUNET_HashCode * id,
64 * a new pseudonym. 64 * a new pseudonym.
65 */ 65 */
66int 66int
67GNUNET_PSEUDONYM_discovery_callback_register (struct 67GNUNET_PSEUDONYM_discovery_callback_register (const struct
68 GNUNET_CONFIGURATION_Handle 68 GNUNET_CONFIGURATION_Handle
69 *cfg, 69 *cfg,
70 GNUNET_PSEUDONYM_Iterator 70 GNUNET_PSEUDONYM_Iterator
@@ -115,7 +115,7 @@ GNUNET_PSEUDONYM_discovery_callback_unregister (GNUNET_PSEUDONYM_Iterator
115 * pseudonym identifier and directory prefix. 115 * pseudonym identifier and directory prefix.
116 */ 116 */
117static char * 117static char *
118get_data_filename (struct GNUNET_CONFIGURATION_Handle 118get_data_filename (const struct GNUNET_CONFIGURATION_Handle
119 *cfg, const char *prefix, const GNUNET_HashCode * psid) 119 *cfg, const char *prefix, const GNUNET_HashCode * psid)
120{ 120{
121 struct GNUNET_CRYPTO_HashAsciiEncoded enc; 121 struct GNUNET_CRYPTO_HashAsciiEncoded enc;
@@ -131,7 +131,7 @@ get_data_filename (struct GNUNET_CONFIGURATION_Handle
131} 131}
132 132
133static void 133static void
134write_pseudonym_info (struct GNUNET_CONFIGURATION_Handle *cfg, 134write_pseudonym_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
135 const GNUNET_HashCode * nsid, 135 const GNUNET_HashCode * nsid,
136 const struct GNUNET_CONTAINER_MetaData *meta, 136 const struct GNUNET_CONTAINER_MetaData *meta,
137 int32_t ranking, const char *ns_name) 137 int32_t ranking, const char *ns_name)
@@ -179,7 +179,7 @@ write_pseudonym_info (struct GNUNET_CONFIGURATION_Handle *cfg,
179} 179}
180 180
181static int 181static int
182read_info (struct GNUNET_CONFIGURATION_Handle *cfg, 182read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
183 const GNUNET_HashCode * nsid, 183 const GNUNET_HashCode * nsid,
184 struct GNUNET_CONTAINER_MetaData **meta, 184 struct GNUNET_CONTAINER_MetaData **meta,
185 int32_t * ranking, char **ns_name) 185 int32_t * ranking, char **ns_name)
@@ -273,7 +273,7 @@ read_info (struct GNUNET_CONFIGURATION_Handle *cfg,
273 * @return NULL on failure (should never happen) 273 * @return NULL on failure (should never happen)
274 */ 274 */
275char * 275char *
276GNUNET_PSEUDONYM_id_to_name (struct GNUNET_CONFIGURATION_Handle *cfg, 276GNUNET_PSEUDONYM_id_to_name (const struct GNUNET_CONFIGURATION_Handle *cfg,
277 const GNUNET_HashCode * nsid) 277 const GNUNET_HashCode * nsid)
278{ 278{
279 struct GNUNET_CONTAINER_MetaData *meta; 279 struct GNUNET_CONTAINER_MetaData *meta;
@@ -356,7 +356,7 @@ GNUNET_PSEUDONYM_id_to_name (struct GNUNET_CONFIGURATION_Handle *cfg,
356 * @return GNUNET_OK on success 356 * @return GNUNET_OK on success
357 */ 357 */
358int 358int
359GNUNET_PSEUDONYM_name_to_id (struct GNUNET_CONFIGURATION_Handle *cfg, 359GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
360 const char *ns_uname, GNUNET_HashCode * nsid) 360 const char *ns_uname, GNUNET_HashCode * nsid)
361{ 361{
362 size_t slen; 362 size_t slen;
@@ -408,7 +408,7 @@ struct ListPseudonymClosure
408{ 408{
409 GNUNET_PSEUDONYM_Iterator iterator; 409 GNUNET_PSEUDONYM_Iterator iterator;
410 void *closure; 410 void *closure;
411 struct GNUNET_CONFIGURATION_Handle *cfg; 411 const struct GNUNET_CONFIGURATION_Handle *cfg;
412}; 412};
413 413
414static int 414static int
@@ -443,7 +443,7 @@ list_pseudonym_helper (void *cls, const char *fullname)
443 * List all available pseudonyms. 443 * List all available pseudonyms.
444 */ 444 */
445int 445int
446GNUNET_PSEUDONYM_list_all (struct GNUNET_CONFIGURATION_Handle *cfg, 446GNUNET_PSEUDONYM_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg,
447 GNUNET_PSEUDONYM_Iterator iterator, void *closure) 447 GNUNET_PSEUDONYM_Iterator iterator, void *closure)
448{ 448{
449 struct ListPseudonymClosure cls; 449 struct ListPseudonymClosure cls;
@@ -470,7 +470,7 @@ GNUNET_PSEUDONYM_list_all (struct GNUNET_CONFIGURATION_Handle *cfg,
470 * @return new rating of the pseudonym 470 * @return new rating of the pseudonym
471 */ 471 */
472int 472int
473GNUNET_PSEUDONYM_rank (struct GNUNET_CONFIGURATION_Handle *cfg, 473GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
474 const GNUNET_HashCode * nsid, int delta) 474 const GNUNET_HashCode * nsid, int delta)
475{ 475{
476 struct GNUNET_CONTAINER_MetaData *meta; 476 struct GNUNET_CONTAINER_MetaData *meta;
@@ -513,7 +513,7 @@ merge_meta_helper (EXTRACTOR_KeywordType type, const char *data, void *cls)
513 * @param id the pseudonym identifier 513 * @param id the pseudonym identifier
514 */ 514 */
515void 515void
516GNUNET_PSEUDONYM_add (struct GNUNET_CONFIGURATION_Handle *cfg, 516GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
517 const GNUNET_HashCode * id, 517 const GNUNET_HashCode * id,
518 const struct GNUNET_CONTAINER_MetaData *meta) 518 const struct GNUNET_CONTAINER_MetaData *meta)
519{ 519{
diff --git a/src/util/service.c b/src/util/service.c
index 0569a0fde..a976fab78 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -420,7 +420,7 @@ struct GNUNET_SERVICE_Context
420 /** 420 /**
421 * Our configuration. 421 * Our configuration.
422 */ 422 */
423 struct GNUNET_CONFIGURATION_Handle *cfg; 423 const struct GNUNET_CONFIGURATION_Handle *cfg;
424 424
425 /** 425 /**
426 * Handle for the server. 426 * Handle for the server.
@@ -1264,6 +1264,7 @@ GNUNET_SERVICE_run (int argc,
1264 char *logfile; 1264 char *logfile;
1265 int do_daemonize; 1265 int do_daemonize;
1266 struct GNUNET_SERVICE_Context sctx; 1266 struct GNUNET_SERVICE_Context sctx;
1267 struct GNUNET_CONFIGURATION_Handle *cfg;
1267 struct GNUNET_GETOPT_CommandLineOption service_options[] = { 1268 struct GNUNET_GETOPT_CommandLineOption service_options[] = {
1268 GNUNET_GETOPT_OPTION_CFG_FILE (&cfg_fn), 1269 GNUNET_GETOPT_OPTION_CFG_FILE (&cfg_fn),
1269 {'d', "daemonize", NULL, 1270 {'d', "daemonize", NULL,
@@ -1286,18 +1287,17 @@ GNUNET_SERVICE_run (int argc,
1286 sctx.maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE; 1287 sctx.maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE;
1287 sctx.task = task; 1288 sctx.task = task;
1288 sctx.serviceName = serviceName; 1289 sctx.serviceName = serviceName;
1289 sctx.cfg = GNUNET_CONFIGURATION_create (); 1290 sctx.cfg = cfg = GNUNET_CONFIGURATION_create ();
1290 /* setup subsystems */ 1291 /* setup subsystems */
1291 if ((GNUNET_SYSERR == 1292 if ((GNUNET_SYSERR ==
1292 GNUNET_GETOPT_run (serviceName, 1293 GNUNET_GETOPT_run (serviceName,
1293 sctx.cfg,
1294 service_options, 1294 service_options,
1295 argc, 1295 argc,
1296 argv)) || 1296 argv)) ||
1297 (GNUNET_OK != 1297 (GNUNET_OK !=
1298 GNUNET_log_setup (serviceName, loglev, logfile)) || 1298 GNUNET_log_setup (serviceName, loglev, logfile)) ||
1299 (GNUNET_OK != 1299 (GNUNET_OK !=
1300 GNUNET_CONFIGURATION_load (sctx.cfg, cfg_fn)) || 1300 GNUNET_CONFIGURATION_load (cfg, cfg_fn)) ||
1301 (GNUNET_OK != 1301 (GNUNET_OK !=
1302 setup_service (&sctx)) || 1302 setup_service (&sctx)) ||
1303 ((do_daemonize == 1) && 1303 ((do_daemonize == 1) &&
@@ -1310,7 +1310,7 @@ GNUNET_SERVICE_run (int argc,
1310 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "write"); 1310 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "write");
1311 GNUNET_break (0 == CLOSE (sctx.ready_confirm_fd)); 1311 GNUNET_break (0 == CLOSE (sctx.ready_confirm_fd));
1312 } 1312 }
1313 GNUNET_CONFIGURATION_destroy (sctx.cfg); 1313 GNUNET_CONFIGURATION_destroy (cfg);
1314 GNUNET_free_non_null (sctx.addr); 1314 GNUNET_free_non_null (sctx.addr);
1315 GNUNET_free_non_null (logfile); 1315 GNUNET_free_non_null (logfile);
1316 GNUNET_free (loglev); 1316 GNUNET_free (loglev);
@@ -1339,7 +1339,7 @@ GNUNET_SERVICE_run (int argc,
1339 if (sctx.server != NULL) 1339 if (sctx.server != NULL)
1340 GNUNET_SERVER_destroy (sctx.server); 1340 GNUNET_SERVER_destroy (sctx.server);
1341 GNUNET_free_non_null (sctx.my_handlers); 1341 GNUNET_free_non_null (sctx.my_handlers);
1342 GNUNET_CONFIGURATION_destroy (sctx.cfg); 1342 GNUNET_CONFIGURATION_destroy (cfg);
1343 GNUNET_free_non_null (sctx.addr); 1343 GNUNET_free_non_null (sctx.addr);
1344 GNUNET_free_non_null (logfile); 1344 GNUNET_free_non_null (logfile);
1345 GNUNET_free (loglev); 1345 GNUNET_free (loglev);
@@ -1364,7 +1364,7 @@ GNUNET_SERVICE_run (int argc,
1364struct GNUNET_SERVICE_Context * 1364struct GNUNET_SERVICE_Context *
1365GNUNET_SERVICE_start (const char *serviceName, 1365GNUNET_SERVICE_start (const char *serviceName,
1366 struct GNUNET_SCHEDULER_Handle *sched, 1366 struct GNUNET_SCHEDULER_Handle *sched,
1367 struct GNUNET_CONFIGURATION_Handle *cfg) 1367 const struct GNUNET_CONFIGURATION_Handle *cfg)
1368{ 1368{
1369 int i; 1369 int i;
1370 struct GNUNET_SERVICE_Context *sctx; 1370 struct GNUNET_SERVICE_Context *sctx;
diff --git a/src/util/test_getopt.c b/src/util/test_getopt.c
index 89e7be863..7168dd8c1 100644
--- a/src/util/test_getopt.c
+++ b/src/util/test_getopt.c
@@ -31,7 +31,6 @@
31static int 31static int
32testMinimal () 32testMinimal ()
33{ 33{
34 struct GNUNET_CONFIGURATION_Handle *cfg;
35 char *const emptyargv[] = { 34 char *const emptyargv[] = {
36 "test", 35 "test",
37 NULL 36 NULL
@@ -40,13 +39,8 @@ testMinimal ()
40 GNUNET_GETOPT_OPTION_END 39 GNUNET_GETOPT_OPTION_END
41 }; 40 };
42 41
43 cfg = GNUNET_CONFIGURATION_create (); 42 if (1 != GNUNET_GETOPT_run ("test", emptyoptionlist, 1, emptyargv))
44 if (1 != GNUNET_GETOPT_run ("test", cfg, emptyoptionlist, 1, emptyargv)) 43 return 1;
45 {
46 GNUNET_CONFIGURATION_destroy (cfg);
47 return 1;
48 }
49 GNUNET_CONFIGURATION_destroy (cfg);
50 44
51 return 0; 45 return 0;
52} 46}
@@ -54,7 +48,6 @@ testMinimal ()
54static int 48static int
55testVerbose () 49testVerbose ()
56{ 50{
57 struct GNUNET_CONFIGURATION_Handle *cfg;
58 char *const myargv[] = { 51 char *const myargv[] = {
59 "test", 52 "test",
60 "-V", 53 "-V",
@@ -68,14 +61,11 @@ testVerbose ()
68 GNUNET_GETOPT_OPTION_END 61 GNUNET_GETOPT_OPTION_END
69 }; 62 };
70 63
71 cfg = GNUNET_CONFIGURATION_create (); 64 if (3 != GNUNET_GETOPT_run ("test", verboseoptionlist, 4, myargv))
72 if (3 != GNUNET_GETOPT_run ("test", cfg, verboseoptionlist, 4, myargv))
73 { 65 {
74 GNUNET_break (0); 66 GNUNET_break (0);
75 GNUNET_CONFIGURATION_destroy (cfg);
76 return 1; 67 return 1;
77 } 68 }
78 GNUNET_CONFIGURATION_destroy (cfg);
79 if (vflags != 2) 69 if (vflags != 2)
80 { 70 {
81 GNUNET_break (0); 71 GNUNET_break (0);
@@ -87,7 +77,6 @@ testVerbose ()
87static int 77static int
88testVersion () 78testVersion ()
89{ 79{
90 struct GNUNET_CONFIGURATION_Handle *cfg;
91 char *const myargv[] = { 80 char *const myargv[] = {
92 "test_getopt", 81 "test_getopt",
93 "-v", 82 "-v",
@@ -98,22 +87,18 @@ testVersion ()
98 GNUNET_GETOPT_OPTION_END 87 GNUNET_GETOPT_OPTION_END
99 }; 88 };
100 89
101 cfg = GNUNET_CONFIGURATION_create ();
102 if (-1 != GNUNET_GETOPT_run ("test_getopt", 90 if (-1 != GNUNET_GETOPT_run ("test_getopt",
103 cfg, versionoptionlist, 2, myargv)) 91 versionoptionlist, 2, myargv))
104 { 92 {
105 GNUNET_break (0); 93 GNUNET_break (0);
106 GNUNET_CONFIGURATION_destroy (cfg);
107 return 1; 94 return 1;
108 } 95 }
109 GNUNET_CONFIGURATION_destroy (cfg);
110 return 0; 96 return 0;
111} 97}
112 98
113static int 99static int
114testAbout () 100testAbout ()
115{ 101{
116 struct GNUNET_CONFIGURATION_Handle *cfg;
117 char *const myargv[] = { 102 char *const myargv[] = {
118 "test_getopt", 103 "test_getopt",
119 "-h", 104 "-h",
@@ -124,22 +109,18 @@ testAbout ()
124 GNUNET_GETOPT_OPTION_END 109 GNUNET_GETOPT_OPTION_END
125 }; 110 };
126 111
127 cfg = GNUNET_CONFIGURATION_create ();
128 if (-1 != GNUNET_GETOPT_run ("test_getopt", 112 if (-1 != GNUNET_GETOPT_run ("test_getopt",
129 cfg, aboutoptionlist, 2, myargv)) 113 aboutoptionlist, 2, myargv))
130 { 114 {
131 GNUNET_break (0); 115 GNUNET_break (0);
132 GNUNET_CONFIGURATION_destroy (cfg);
133 return 1; 116 return 1;
134 } 117 }
135 GNUNET_CONFIGURATION_destroy (cfg);
136 return 0; 118 return 0;
137} 119}
138 120
139static int 121static int
140testLogOpts () 122testLogOpts ()
141{ 123{
142 struct GNUNET_CONFIGURATION_Handle *cfg;
143 char *const myargv[] = { 124 char *const myargv[] = {
144 "test_getopt", 125 "test_getopt",
145 "-l", "filename", 126 "-l", "filename",
@@ -154,15 +135,12 @@ testLogOpts ()
154 GNUNET_GETOPT_OPTION_END 135 GNUNET_GETOPT_OPTION_END
155 }; 136 };
156 137
157 cfg = GNUNET_CONFIGURATION_create (); 138 if (5 != GNUNET_GETOPT_run ("test_getopt", logoptionlist, 5, myargv))
158 if (5 != GNUNET_GETOPT_run ("test_getopt", cfg, logoptionlist, 5, myargv))
159 { 139 {
160 GNUNET_break (0); 140 GNUNET_break (0);
161 GNUNET_CONFIGURATION_destroy (cfg);
162 return 1; 141 return 1;
163 } 142 }
164 GNUNET_assert (fn != NULL); 143 GNUNET_assert (fn != NULL);
165 GNUNET_CONFIGURATION_destroy (cfg);
166 if ((0 != strcmp (level, "WARNING")) || (0 != strcmp (fn, "filename"))) 144 if ((0 != strcmp (level, "WARNING")) || (0 != strcmp (fn, "filename")))
167 { 145 {
168 GNUNET_break (0); 146 GNUNET_break (0);
@@ -178,7 +156,6 @@ testLogOpts ()
178static int 156static int
179testFlagNum () 157testFlagNum ()
180{ 158{
181 struct GNUNET_CONFIGURATION_Handle *cfg;
182 char *const myargv[] = { 159 char *const myargv[] = {
183 "test_getopt", 160 "test_getopt",
184 "-f", 161 "-f",
@@ -199,14 +176,11 @@ testFlagNum ()
199 GNUNET_GETOPT_OPTION_END 176 GNUNET_GETOPT_OPTION_END
200 }; 177 };
201 178
202 cfg = GNUNET_CONFIGURATION_create (); 179 if (6 != GNUNET_GETOPT_run ("test_getopt", logoptionlist, 6, myargv))
203 if (6 != GNUNET_GETOPT_run ("test_getopt", cfg, logoptionlist, 6, myargv))
204 { 180 {
205 GNUNET_break (0); 181 GNUNET_break (0);
206 GNUNET_CONFIGURATION_destroy (cfg);
207 return 1; 182 return 1;
208 } 183 }
209 GNUNET_CONFIGURATION_destroy (cfg);
210 if ((1 != flag) || (42 != num) || (42 != lnum)) 184 if ((1 != flag) || (42 != num) || (42 != lnum))
211 { 185 {
212 GNUNET_break (0); 186 GNUNET_break (0);
diff --git a/src/util/test_program.c b/src/util/test_program.c
index dee602e2a..5c58123b5 100644
--- a/src/util/test_program.c
+++ b/src/util/test_program.c
@@ -41,7 +41,8 @@ static void
41runner (void *cls, 41runner (void *cls,
42 struct GNUNET_SCHEDULER_Handle *sched, 42 struct GNUNET_SCHEDULER_Handle *sched,
43 char *const *args, 43 char *const *args,
44 const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg) 44 const char *cfgfile,
45 const struct GNUNET_CONFIGURATION_Handle *cfg)
45{ 46{
46 int *ok = cls; 47 int *ok = cls;
47 GNUNET_assert (setme == 1); 48 GNUNET_assert (setme == 1);
diff --git a/src/util/test_service.c b/src/util/test_service.c
index 233c23ccf..e8e3f8741 100644
--- a/src/util/test_service.c
+++ b/src/util/test_service.c
@@ -74,7 +74,7 @@ build_msg (void *cls, size_t size, void *buf)
74static void 74static void
75ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 75ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
76{ 76{
77 struct GNUNET_CONFIGURATION_Handle *cfg = cls; 77 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
78 struct GNUNET_CLIENT_Connection *client; 78 struct GNUNET_CLIENT_Connection *client;
79 79
80 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service confirmed running\n"); 80 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service confirmed running\n");
@@ -108,17 +108,18 @@ static void
108runner (void *cls, 108runner (void *cls,
109 struct GNUNET_SCHEDULER_Handle *sched, 109 struct GNUNET_SCHEDULER_Handle *sched,
110 struct GNUNET_SERVER_Handle *server, 110 struct GNUNET_SERVER_Handle *server,
111 struct GNUNET_CONFIGURATION_Handle *cfg) 111 const struct GNUNET_CONFIGURATION_Handle *cfg)
112{ 112{
113 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service initializing\n"); 113 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service initializing\n");
114 GNUNET_SERVER_add_handlers (server, myhandlers); 114 GNUNET_SERVER_add_handlers (server, myhandlers);
115 GNUNET_CLIENT_service_test (sched, 115 GNUNET_CLIENT_service_test (sched,
116 "test_service", 116 "test_service",
117 cfg, GNUNET_TIME_UNIT_SECONDS, &ready, cfg); 117 cfg, GNUNET_TIME_UNIT_SECONDS, &ready, (void*) cfg);
118} 118}
119 119
120static void 120static void
121term (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg) 121term (void *cls,
122 const struct GNUNET_CONFIGURATION_Handle *cfg)
122{ 123{
123 int *ok = cls; 124 int *ok = cls;
124 *ok = 0; 125 *ok = 0;
@@ -157,7 +158,7 @@ check ()
157static void 158static void
158ready6 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 159ready6 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
159{ 160{
160 struct GNUNET_CONFIGURATION_Handle *cfg = cls; 161 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
161 struct GNUNET_CLIENT_Connection *client; 162 struct GNUNET_CLIENT_Connection *client;
162 163
163 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "V6 ready\n"); 164 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "V6 ready\n");
@@ -176,13 +177,13 @@ static void
176runner6 (void *cls, 177runner6 (void *cls,
177 struct GNUNET_SCHEDULER_Handle *sched, 178 struct GNUNET_SCHEDULER_Handle *sched,
178 struct GNUNET_SERVER_Handle *server, 179 struct GNUNET_SERVER_Handle *server,
179 struct GNUNET_CONFIGURATION_Handle *cfg) 180 const struct GNUNET_CONFIGURATION_Handle *cfg)
180{ 181{
181 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initializing v6 service\n"); 182 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initializing v6 service\n");
182 GNUNET_SERVER_add_handlers (server, myhandlers); 183 GNUNET_SERVER_add_handlers (server, myhandlers);
183 GNUNET_CLIENT_service_test (sched, 184 GNUNET_CLIENT_service_test (sched,
184 "test_service6", 185 "test_service6",
185 cfg, GNUNET_TIME_UNIT_SECONDS, &ready6, cfg); 186 cfg, GNUNET_TIME_UNIT_SECONDS, &ready6, (void*) cfg);
186} 187}
187 188
188/** 189/**
@@ -252,7 +253,8 @@ static void
252start_stop_main (void *cls, 253start_stop_main (void *cls,
253 struct GNUNET_SCHEDULER_Handle *sched, 254 struct GNUNET_SCHEDULER_Handle *sched,
254 char *const *args, 255 char *const *args,
255 const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg) 256 const char *cfgfile,
257 const struct GNUNET_CONFIGURATION_Handle *cfg)
256{ 258{
257 int *ret = cls; 259 int *ret = cls;
258 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 260 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,