include $(INTLEMU_SUBDIRS) \
util \
arm \
- datacache \
- datastore \
fragmentation \
hello \
peerinfo \
resolver \
statistics \
+ datacache \
+ datastore \
template \
transport \
core \
void *cls;
char *service_name;
struct GNUNET_CLIENT_Connection *client;
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_TIME_Absolute timeout;
uint16_t type;
};
*/
static void
change_service (const char *service_name,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_TIME_Relative timeout,
GNUNET_ARM_Callback cb, void *cb_cls, uint16_t type)
*/
void
GNUNET_ARM_start_service (const char *service_name,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_TIME_Relative timeout,
GNUNET_ARM_Callback cb, void *cb_cls)
*/
void
GNUNET_ARM_stop_service (const char *service_name,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_TIME_Relative timeout,
GNUNET_ARM_Callback cb, void *cb_cls)
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
if (term != NULL)
{
/**
* Our configuration
*/
-static struct GNUNET_CONFIGURATION_Handle *cfg;
+static const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Our scheduler.
GNUNET_YES,
GNUNET_SCHEDULER_PRIORITY_IDLE,
GNUNET_SCHEDULER_NO_TASK,
- MAINT_FREQUENCY, &maint, cfg);
+ MAINT_FREQUENCY, &maint, NULL);
/* check for services that died (WAITPID) */
prev = NULL;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
struct GNUNET_SERVER_Handle *server,
- struct GNUNET_CONFIGURATION_Handle *c)
+ const struct GNUNET_CONFIGURATION_Handle *c)
{
char *defaultservices;
char *pos;
static struct GNUNET_SCHEDULER_Handle *sched;
-static struct GNUNET_CONFIGURATION_Handle *cfg;
+static const struct GNUNET_CONFIGURATION_Handle *cfg;
static int ok = 1;
task (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *c)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *c)
{
cfg = c;
sched = s;
/**
* Configuration we're using.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Closure for the various callbacks.
*/
void
GNUNET_CORE_connect (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TIME_Relative timeout,
void *cls,
GNUNET_CORE_StartupCallback init,
/**
* Our configuration.
*/
-struct GNUNET_CONFIGURATION_Handle *cfg;
+const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Our server.
static void
run (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
- struct GNUNET_SERVER_Handle *serv, struct GNUNET_CONFIGURATION_Handle *c)
+ struct GNUNET_SERVER_Handle *serv,
+ const struct GNUNET_CONFIGURATION_Handle *c)
{
#if 0
unsigned long long qin;
* Function called during shutdown. Clean up our state.
*/
static void
-cleanup (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg)
+cleanup (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
if (my_private_key != NULL)
GNUNET_CRYPTO_rsa_key_free (my_private_key);
struct PeerContext
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_CORE_Handle *ch;
struct GNUNET_PeerIdentity id;
struct GNUNET_TRANSPORT_Handle *th;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_assert (ok == 1);
OKPP;
struct PeerContext
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_CORE_Handle *ch;
struct GNUNET_PeerIdentity id;
#if START_ARM
run (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_assert (ok == 1);
OKPP;
/**
* Our configuration.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Configuration section to use.
*/
struct GNUNET_DATACACHE_Handle *
GNUNET_DATACACHE_create (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section)
{
int fd;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_DATACACHE_Handle *h;
GNUNET_HashCode k;
/**
* Configuration to use.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Configuration section to use.
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_DATACACHE_Handle *h;
GNUNET_HashCode k;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_DATACACHE_Handle *h;
GNUNET_HashCode k;
/**
* Our configuration.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Our scheduler.
* @param sched scheduler to use
* @return handle to use to access the service
*/
-struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (struct
+struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (const struct
GNUNET_CONFIGURATION_Handle
*cfg,
struct
/**
* Our configuration.
*/
-struct GNUNET_CONFIGURATION_Handle *cfg;
+const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Our scheduler.
run (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
struct GNUNET_SERVER_Handle *server,
- struct GNUNET_CONFIGURATION_Handle *c)
+ const struct GNUNET_CONFIGURATION_Handle *c)
{
char *fn;
unsigned int bf_size;
struct CpsRunContext
{
struct GNUNET_SCHEDULER_Handle *sched;
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
enum RunPhase phase;
int j;
unsigned long long size;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct CpsRunContext *crc;
struct GNUNET_TIME_Absolute start;
struct GNUNET_TIME_Absolute end;
struct GNUNET_SCHEDULER_Handle *sched;
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_DATASTORE_PluginFunctions * api;
const char *msg;
enum RunPhase phase;
*/
static void
unload_plugin (struct GNUNET_DATASTORE_PluginFunctions * api,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
char *name;
char *libname;
* Load the datastore plugin.
*/
static struct GNUNET_DATASTORE_PluginFunctions *
-load_plugin (struct GNUNET_CONFIGURATION_Handle *cfg,
+load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SCHEDULER_Handle *sched)
{
static struct GNUNET_DATASTORE_PluginEnvironment env;
struct GNUNET_SCHEDULER_Handle *s,
char *const *args,
const char *cfgfile,
- struct GNUNET_CONFIGURATION_Handle *c)
+ const struct GNUNET_CONFIGURATION_Handle *c)
{
struct GNUNET_DATASTORE_PluginFunctions *api;
struct CpsRunContext *crc;
/**
* Configuration to use.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Scheduler to use.
* @return GNUNET_OK on success
*/
static int
-database_setup (struct GNUNET_CONFIGURATION_Handle *cfg,
+database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct Plugin *plugin)
{
sqlite3_stmt *stmt;
int rid;
int *iptr;
struct GNUNET_SCHEDULER_Handle *sched;
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
void *data;
size_t size;
enum RunPhase phase;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct CpsRunContext *crc;
int i;
int found;
struct GNUNET_SCHEDULER_Handle *sched;
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
void *data;
size_t size;
enum RunPhase phase;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct CpsRunContext *crc;
struct GNUNET_SCHEDULER_Handle * sched,
char *const *args,
const char *cfgfile,
- struct GNUNET_CONFIGURATION_Handle * cfg)
+ const struct GNUNET_CONFIGURATION_Handle * cfg)
{
GNUNET_CORE_ClientEventHandler ch = NULL;
GNUNET_CORE_ClientEventHandler dh = NULL;
/**
* Our configuration.
*/
-static struct GNUNET_CONFIGURATION_Handle *cfg;
+static const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Our scheduler.
* Start downloading hostlists from hostlist servers as necessary.
*/
int
-GNUNET_HOSTLIST_client_start (struct GNUNET_CONFIGURATION_Handle *c,
+GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_SCHEDULER_Handle *s,
struct GNUNET_STATISTICS_Handle *st,
GNUNET_CORE_ClientEventHandler *ch,
* @return GNUNET_OK on success
*/
int
-GNUNET_HOSTLIST_client_start (struct GNUNET_CONFIGURATION_Handle *c,
+GNUNET_HOSTLIST_client_start (const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_SCHEDULER_Handle *s,
struct GNUNET_STATISTICS_Handle *st,
GNUNET_CORE_ClientEventHandler *ch,
/**
* Our configuration.
*/
-static struct GNUNET_CONFIGURATION_Handle *cfg;
+static const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Our scheduler.
* @return GNUNET_OK on success
*/
int
-GNUNET_HOSTLIST_server_start (struct GNUNET_CONFIGURATION_Handle *c,
+GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_SCHEDULER_Handle *s,
struct GNUNET_STATISTICS_Handle *st)
{
* @return GNUNET_OK on success
*/
int
-GNUNET_HOSTLIST_server_start (struct GNUNET_CONFIGURATION_Handle *c,
+GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c,
struct GNUNET_SCHEDULER_Handle *s,
struct GNUNET_STATISTICS_Handle *st);
*/
void
GNUNET_ARM_start_service (const char *service_name,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_TIME_Relative timeout,
GNUNET_ARM_Callback cb, void *cb_cls);
*/
void
GNUNET_ARM_stop_service (const char *service_name,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_TIME_Relative timeout,
GNUNET_ARM_Callback cb, void *cb_cls);
*sched,
const char
*service_name,
- struct
+ const struct
GNUNET_CONFIGURATION_Handle
*cfg);
*/
void GNUNET_CLIENT_service_test (struct GNUNET_SCHEDULER_Handle *sched,
const char *service,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TIME_Relative timeout,
GNUNET_SCHEDULER_Task task, void *task_cls);
* changed since the last save.
* @return GNUNET_NO if clean, GNUNET_YES if dirty, GNUNET_SYSERR on error (i.e. last save failed)
*/
-int GNUNET_CONFIGURATION_is_dirty (struct GNUNET_CONFIGURATION_Handle *cfg);
+int GNUNET_CONFIGURATION_is_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
* Get a configuration value that should be a number.
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_CONFIGURATION_get_value_number (struct GNUNET_CONFIGURATION_Handle
+int GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle
*cfg, const char *section,
const char *option,
unsigned long long *number);
* @param time set to the time value stored in the configuration
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_CONFIGURATION_get_value_time (struct GNUNET_CONFIGURATION_Handle
+int GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle
*cfg, const char *section,
const char *option,
struct GNUNET_TIME_Relative *time);
* Test if we have a value for a particular option
* @return GNUNET_YES if so, GNUNET_NO if not.
*/
-int GNUNET_CONFIGURATION_have_value (struct GNUNET_CONFIGURATION_Handle *cfg,
+int GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section, const char *option);
/**
* value, or NULL if option is not specified
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_CONFIGURATION_get_value_string (struct GNUNET_CONFIGURATION_Handle
+int GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle
*cfg, const char *section,
const char *option, char **value);
* value, or NULL if option is not specified
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_CONFIGURATION_get_value_filename (struct
+int GNUNET_CONFIGURATION_get_value_filename (const struct
GNUNET_CONFIGURATION_Handle *cfg,
const char *section,
const char *option,
*
* @return number of filenames iterated over, -1 on error
*/
-int GNUNET_CONFIGURATION_iterate_value_filenames (struct
+int GNUNET_CONFIGURATION_iterate_value_filenames (const struct
GNUNET_CONFIGURATION_Handle
*cfg,
const char *section,
* or NULL if option is not specified and no default given
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
-int GNUNET_CONFIGURATION_get_value_choice (struct GNUNET_CONFIGURATION_Handle
+int GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle
*cfg, const char *section,
const char *option,
const char **choices,
*
* @return GNUNET_YES, GNUNET_NO or if option has no valid value, GNUNET_SYSERR
*/
-int GNUNET_CONFIGURATION_get_value_yesno (struct GNUNET_CONFIGURATION_Handle
+int GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle
*cfg, const char *section,
const char *option);
* @param old string to $-expand (will be freed!)
* @return $-expanded string
*/
-char *GNUNET_CONFIGURATION_expand_dollar (struct GNUNET_CONFIGURATION_Handle
+char *GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle
*cfg, char *old);
/**
*/
void
GNUNET_CORE_connect (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TIME_Relative timeout,
void *cls,
GNUNET_CORE_StartupCallback init,
*/
struct GNUNET_DATACACHE_Handle *
GNUNET_DATACACHE_create (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section);
* @param sched scheduler to use
* @return handle to use to access the service
*/
-struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (struct
+struct GNUNET_DATASTORE_Handle *GNUNET_DATASTORE_connect (const struct
GNUNET_CONFIGURATION_Handle
*cfg,
struct
* private directory name.
* @return the constructed filename
*/
-char *GNUNET_DISK_get_home_filename (struct GNUNET_CONFIGURATION_Handle *cfg,
+char *GNUNET_DISK_get_home_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *serviceName, ...);
*/
struct GNUNET_FS_Handle *
GNUNET_FS_start (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *client_name,
GNUNET_FS_ProgressCallback upcb,
void *upcb_cls);
*/
const struct GNUNET_GETOPT_CommandLineOption *allOptions;
- /**
- * For configuration
- */
- struct GNUNET_CONFIGURATION_Handle *cfg;
-
/**
* Original command line
*/
* Parse the command line.
*
* @param binaryName name of the binary / application with options
- * @param cfg for storing/accessing configuration data
* @param allOptions defined options and handlers
* @param argc number of arguments
* @param argv actual arguments
* argument, or GNUNET_SYSERR on error
*/
int GNUNET_GETOPT_run (const char *binaryName,
- struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_GETOPT_CommandLineOption
*allOptions, unsigned int argc, char *const *argv);
* @return -1 on error, otherwise load value (between 0 and 100,
* (100 is equivalent to full load for one CPU)
*/
-int GNUNET_OS_load_cpu_get (struct GNUNET_CONFIGURATION_Handle *cfg);
+int GNUNET_OS_load_cpu_get (const struct GNUNET_CONFIGURATION_Handle *cfg);
+
/**
* Get the current IO load.
* 100 means that we spend all of our cycles waiting for
* the disk)
*/
-int GNUNET_OS_load_disk_get (struct GNUNET_CONFIGURATION_Handle *cfg);
+int GNUNET_OS_load_disk_get (const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
* @param hello the verified (!) HELLO message
*/
void
-GNUNET_PEERINFO_add_peer (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_PEERINFO_add_peer (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SCHEDULER_Handle *sched,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Message *hello);
* @param callback_cls closure for callback
*/
void
-GNUNET_PEERINFO_for_all (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_PEERINFO_for_all (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SCHEDULER_Handle *sched,
const struct GNUNET_PeerIdentity *peer,
int trust_delta,
struct GNUNET_SCHEDULER_Handle * sched,
char *const *args,
const char *cfgfile,
- struct GNUNET_CONFIGURATION_Handle *
+ const struct GNUNET_CONFIGURATION_Handle *
cfg);
* @param delta by how much should the rating be changed?
* @return new rating of the namespace
*/
-int GNUNET_PSEUDONYM_rank (struct GNUNET_CONFIGURATION_Handle *cfg,
+int GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * pseudonym, int delta);
/**
*
* @param pseudonym the pseudonym's identifier
*/
-void GNUNET_PSEUDONYM_add (struct GNUNET_CONFIGURATION_Handle *cfg,
+void GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * pseudo,
const struct GNUNET_CONTAINER_MetaData *meta);
/**
* List all known pseudonyms.
*/
-int GNUNET_PSEUDONYM_list_all (struct GNUNET_CONFIGURATION_Handle *cfg,
+int GNUNET_PSEUDONYM_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_PSEUDONYM_Iterator iterator,
void *closure);
* Register callback to be invoked whenever we discover
* a new pseudonym.
*/
-int GNUNET_PSEUDONYM_discovery_callback_register (struct
+int GNUNET_PSEUDONYM_discovery_callback_register (const struct
GNUNET_CONFIGURATION_Handle
*cfg,
GNUNET_PSEUDONYM_Iterator
*
* @return NULL on failure (should never happen)
*/
-char *GNUNET_PSEUDONYM_id_to_name (struct GNUNET_CONFIGURATION_Handle *cfg,
+char *GNUNET_PSEUDONYM_id_to_name (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * pseudo);
/**
*
* @return GNUNET_OK on success
*/
-int GNUNET_PSEUDONYM_name_to_id (struct GNUNET_CONFIGURATION_Handle *cfg,
+int GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *hname, GNUNET_HashCode * psid);
*/
void
GNUNET_RESOLVER_ip_get (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *hostname,
int domain,
struct GNUNET_TIME_Relative timeout,
*/
void
GNUNET_RESOLVER_hostname_resolve (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
int domain,
struct GNUNET_TIME_Relative timeout,
GNUNET_RESOLVER_AddressCallback callback,
* @param cls closure for callback
*/
void GNUNET_RESOLVER_hostname_get (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct sockaddr *sa,
socklen_t salen,
int do_resolve,
typedef void (*GNUNET_SERVICE_Main) (void *cls,
struct GNUNET_SCHEDULER_Handle * sched,
struct GNUNET_SERVER_Handle * server,
- struct GNUNET_CONFIGURATION_Handle *
+ const struct GNUNET_CONFIGURATION_Handle *
cfg);
* @param cfg configuration to use
*/
typedef void (*GNUNET_SERVICE_Term) (void *cls,
- struct GNUNET_CONFIGURATION_Handle *
+ const struct GNUNET_CONFIGURATION_Handle *
cfg);
struct
GNUNET_SCHEDULER_Handle
*sched,
- struct
+ const struct
GNUNET_CONFIGURATION_Handle
*cfg);
struct GNUNET_STATISTICS_Handle
*GNUNET_STATISTICS_create (struct GNUNET_SCHEDULER_Handle *sched,
const char *subsystem,
- struct GNUNET_CONFIGURATION_Handle *cfg);
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
*
* @param cls closure
* @param id identifier for the daemon, NULL on error
- * @param d handle to the daemon, NULL if starting the daemon failed
+ * @param d handle for the daemon
+ * @param emsg error message (NULL on success)
*/
typedef void (*GNUNET_TESTING_NotifyDaemonRunning)(void *cls,
const struct GNUNET_PeerIdentity *id,
- struct GNUNET_TESTING_Daemon *d);
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct GNUNET_TESTING_Daemon *d,
+ const char *emsg);
/**
* Starts a GNUnet daemon.
*
+ * @param sched scheduler to use
+ * @param cfg configuration to use
* @param service_home directory to use as the service home directory
* @param transports transport services that should be loaded
* @param applications application services and daemons that should be started
* (use NULL for localhost).
* @param cb function to call with the result
* @param cb_cls closure for cb
+ * @return handle to the daemon (actual start will be completed asynchronously)
*/
-void
+struct GNUNET_TESTING_Daemon *
GNUNET_TESTING_daemon_start (struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_CONFIGURATION_Handle *cfg,
const char *service_home,
* particular operation was completed the testing library.
*
* @param cls closure
- * @param success GNUNET_YES on success
+ * @param emsg NULL on success
*/
typedef void (*GNUNET_TESTING_NotifyCompletion)(void *cls,
- int success);
+ const char *emsg);
/**
void * cb_cls);
+/**
+ * Changes the configuration of a GNUnet daemon.
+ *
+ * @param d the daemon that should be modified
+ * @param cfg the new configuration for the daemon
+ * @param cb function called once the configuration was changed
+ * @param cb_cls closure for cb
+ */
+void GNUNET_TESTING_daemon_reconfigure (struct GNUNET_TESTING_Daemon *d,
+ struct GNUNET_CONFIGURATION_Handle *cfg,
+ GNUNET_TESTING_NotifyCompletion cb,
+ void * cb_cls);
+
+
/**
* Establish a connection between two GNUnet daemons.
*
* @param d1 handle for the first daemon
* @param d2 handle for the second daemon
+ * @param timeout how long is the connection attempt
+ * allowed to take?
* @param cb function to call at the end
* @param cb_cls closure for cb
*/
void GNUNET_TESTING_daemons_connect (struct GNUNET_TESTING_Daemon *d1,
struct GNUNET_TESTING_Daemon *d2,
+ struct GNUNET_TIME_Relative timeout,
GNUNET_TESTING_NotifyCompletion cb,
void *cb_cls);
* be computed by adding delta each time (zero
* times for the first peer).
*
+ * @param sched scheduler to use
+ * @param cfg configuration to use
* @param total number of daemons to start
- * @param service_home_prefix path to use as the prefix for the home of the services
+ * @param service_home_prefix path to use as the prefix for the home of the services;
+ * a number will be added for the different peers
* @param transports which transports should all peers use
* @param applications which applications should be used?
- * @param timeout how long is this allowed to take?
* @param cb function to call on each daemon that was started
* @param cb_cls closure for cb
* @param cbe function to call at the end
struct GNUNET_TRANSPORT_Handle *GNUNET_TRANSPORT_connect (struct
GNUNET_SCHEDULER_Handle
*sched,
- struct
+ const struct
GNUNET_CONFIGURATION_Handle
*cfg, void *cls,
GNUNET_TRANSPORT_ReceiveCallback
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_CRYPTO_RsaPrivateKey *priv;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_SERVER_Handle *server,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_filename (cfg,
* @param expiration when the HELLO will expire
*/
void
-GNUNET_PEERINFO_add_peer (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_PEERINFO_add_peer (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SCHEDULER_Handle *sched,
const struct GNUNET_PeerIdentity *peer,
const struct GNUNET_HELLO_Message *hello)
* @param callback_cls closure for callback
*/
void
-GNUNET_PEERINFO_for_all (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_PEERINFO_for_all (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_SCHEDULER_Handle *sched,
const struct GNUNET_PeerIdentity *peer,
int trust_delta,
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_HELLO_Message *hello;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_SERVER_Handle *server,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_SERVER_add_handlers (server, handlers);
}
*/
void
GNUNET_RESOLVER_ip_get (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *hostname,
int domain,
struct GNUNET_TIME_Relative timeout,
*/
void
GNUNET_RESOLVER_hostname_get (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
const struct sockaddr *sa,
socklen_t salen,
int do_resolve,
*/
void
GNUNET_RESOLVER_hostname_resolve (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
int domain,
struct GNUNET_TIME_Relative timeout,
GNUNET_RESOLVER_AddressCallback callback,
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct sockaddr_in sa;
struct GNUNET_TIME_Relative timeout =
*/
static void
load (struct GNUNET_SERVER_Handle *server,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
char *fn;
struct GNUNET_DISK_FileHandle *fh;
* @param cfg configuration to use
*/
static void
-save (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg)
+save (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct StatsEntry *pos;
char *fn;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_SERVER_Handle *server,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_SERVER_add_handlers (server, handlers);
load (server, cfg);
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_STATISTICS_Handle *h;
unsigned long long val;
/**
* Configuration to use.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Socket (if available).
struct GNUNET_STATISTICS_Handle *
GNUNET_STATISTICS_create (struct GNUNET_SCHEDULER_Handle *sched,
const char *subsystem,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_STATISTICS_Handle *ret;
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
h = GNUNET_STATISTICS_create (sched, "test-statistics-api", cfg);
run_more (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
h = GNUNET_STATISTICS_create (sched, "test-statistics-api", cfg);
GNUNET_STATISTICS_get (h, NULL, "test-3",
* @param cfg configuration to use
*/
static void
-finish (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg)
+finish (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
/* FIXME */
}
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_SERVER_Handle *server,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
/* FIXME: do setup here */
GNUNET_SERVER_add_handlers (server, handlers);
run (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
/* main code here */
}
/**
* Our configuration.
*/
-static struct GNUNET_CONFIGURATION_Handle * cfg;
+static const struct GNUNET_CONFIGURATION_Handle * cfg;
/**
* Handle to the core API.
* Read the friends file.
*/
static void
-read_friends_file (struct GNUNET_CONFIGURATION_Handle *cfg)
+read_friends_file (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
char *fn;
char *data;
struct GNUNET_SCHEDULER_Handle * s,
char *const *args,
const char *cfgfile,
- struct GNUNET_CONFIGURATION_Handle * c)
+ const struct GNUNET_CONFIGURATION_Handle * c)
{
struct GNUNET_CORE_MessageHandler handlers[] =
{
/**
* Our configuration.
*/
-struct GNUNET_CONFIGURATION_Handle *cfg;
+const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Linked list of all clients to this service.
static void
run (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
- struct GNUNET_SERVER_Handle *serv, struct GNUNET_CONFIGURATION_Handle *c)
+ struct GNUNET_SERVER_Handle *serv,
+ const struct GNUNET_CONFIGURATION_Handle *c)
{
char *plugs;
char *pos;
* @param cfg configuration to use
*/
static void
-unload_plugins (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg)
+unload_plugins (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct TransportPlugin *plug;
struct AddressList *al;
/**
* Configuration to use.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Scheduler to use.
/**
* Our configuration.
*/
-struct GNUNET_CONFIGURATION_Handle *cfg;
+const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Number of neighbours we'd like to have.
* @param cfg configuration to use
*/
static void
-unload_plugins (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg)
+unload_plugins (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_assert (NULL == GNUNET_PLUGIN_unload ("libgnunet_plugin_transport_tcp",api));
if (my_private_key != NULL)
struct GNUNET_SCHEDULER_Handle *s,
char *const *args,
const char *cfgfile,
- struct GNUNET_CONFIGURATION_Handle *c)
+ const struct GNUNET_CONFIGURATION_Handle *c)
{
unsigned long long tneigh;
char *keyfile;
struct PeerContext
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_TRANSPORT_Handle *th;
struct GNUNET_PeerIdentity id;
#if START_ARM
run (void *cls,
struct GNUNET_SCHEDULER_Handle *s,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_assert (ok == 1);
OKPP;
/**
* My configuration.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Linked list of the current neighbours of this peer.
*/
struct GNUNET_TRANSPORT_Handle *
GNUNET_TRANSPORT_connect (struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
void *cls,
GNUNET_TRANSPORT_ReceiveCallback rec,
GNUNET_TRANSPORT_NotifyConnect nc,
struct GNUNET_CLIENT_Connection *
GNUNET_CLIENT_connect (struct GNUNET_SCHEDULER_Handle *sched,
const char *service_name,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_CLIENT_Connection *ret;
struct GNUNET_NETWORK_SocketHandle *sock;
void
GNUNET_CLIENT_service_test (struct GNUNET_SCHEDULER_Handle *sched,
const char *service,
- struct GNUNET_CONFIGURATION_Handle *cfg,
+ const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_TIME_Relative timeout,
GNUNET_SCHEDULER_Task task, void *task_cls)
{
}
int
-GNUNET_CONFIGURATION_test_dirty (struct GNUNET_CONFIGURATION_Handle *cfg)
+GNUNET_CONFIGURATION_test_dirty (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
return cfg->dirty;
}
static struct ConfigSection *
-findSection (struct GNUNET_CONFIGURATION_Handle *data, const char *section)
+findSection (const struct GNUNET_CONFIGURATION_Handle *data, const char *section)
{
struct ConfigSection *pos;
static struct ConfigEntry *
-findEntry (struct GNUNET_CONFIGURATION_Handle *data,
+findEntry (const struct GNUNET_CONFIGURATION_Handle *data,
const char *section, const char *key)
{
struct ConfigSection *sec;
}
int
-GNUNET_CONFIGURATION_get_value_number (struct GNUNET_CONFIGURATION_Handle
+GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle
*cfg, const char *section,
const char *option,
unsigned long long *number)
}
int
-GNUNET_CONFIGURATION_get_value_time (struct GNUNET_CONFIGURATION_Handle
+GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle
*cfg, const char *section,
const char *option,
struct GNUNET_TIME_Relative *time)
}
int
-GNUNET_CONFIGURATION_get_value_string (struct GNUNET_CONFIGURATION_Handle
+GNUNET_CONFIGURATION_get_value_string (const struct GNUNET_CONFIGURATION_Handle
*cfg, const char *section,
const char *option, char **value)
{
}
int
-GNUNET_CONFIGURATION_get_value_choice (struct GNUNET_CONFIGURATION_Handle
+GNUNET_CONFIGURATION_get_value_choice (const struct GNUNET_CONFIGURATION_Handle
*cfg, const char *section,
const char *option,
const char **choices,
* @return GNUNET_YES if so, GNUNET_NO if not.
*/
int
-GNUNET_CONFIGURATION_have_value (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_CONFIGURATION_have_value (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section, const char *option)
{
struct ConfigEntry *e;
* @return $-expanded string
*/
char *
-GNUNET_CONFIGURATION_expand_dollar (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_CONFIGURATION_expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg,
char *orig)
{
int i;
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
-GNUNET_CONFIGURATION_get_value_filename (struct GNUNET_CONFIGURATION_Handle
+GNUNET_CONFIGURATION_get_value_filename (const struct GNUNET_CONFIGURATION_Handle
*data, const char *section,
const char *option, char **value)
{
* @return GNUNET_YES, GNUNET_NO or GNUNET_SYSERR
*/
int
-GNUNET_CONFIGURATION_get_value_yesno (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_CONFIGURATION_get_value_yesno (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *section, const char *option)
{
static const char *yesno[] = { "YES", "NO", NULL };
* @return number of filenames iterated over, -1 on error
*/
int
-GNUNET_CONFIGURATION_iterate_value_filenames (struct
+GNUNET_CONFIGURATION_iterate_value_filenames (const struct
GNUNET_CONFIGURATION_Handle
*cfg, const char *section,
const char *option,
* a directory, end the last argument in '/' (or pass
* DIR_SEPARATOR_STR as the last argument before NULL).
*
+ * @param cfg configuration to use (determines HOME)
* @param serviceName name of the service
* @param varargs is NULL-terminated list of
* path components to append to the
* @return the constructed filename
*/
char *
-GNUNET_DISK_get_home_filename (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_DISK_get_home_filename (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *serviceName, ...)
{
const char *c;
*/
int
GNUNET_GETOPT_run (const char *binaryOptions,
- struct GNUNET_CONFIGURATION_Handle *cfg,
const struct GNUNET_GETOPT_CommandLineOption *allOptions,
unsigned int argc, char *const *argv)
{
clpc.allOptions = allOptions;
clpc.argv = argv;
clpc.argc = argc;
- clpc.cfg = cfg;
count = 0;
while (allOptions[count].name != NULL)
count++;
* that lock has already been obtained.
*/
static void
-updateAgedLoad (struct GNUNET_CONFIGURATION_Handle *cfg)
+updateAgedLoad (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
static struct GNUNET_TIME_Absolute lastCall;
* (100 is equivalent to full load)
*/
int
-GNUNET_OS_load_cpu_get (struct GNUNET_CONFIGURATION_Handle *cfg)
+GNUNET_OS_load_cpu_get (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
unsigned long long maxCPULoad;
int ret;
* (100 is equivalent to full load)
*/
int
-GNUNET_OS_load_disk_get (struct GNUNET_CONFIGURATION_Handle *cfg)
+GNUNET_OS_load_disk_get (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
unsigned long long maxIOLoad;
int ret;
/**
* Configuration to use.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
};
char *loglev;
int ret;
unsigned int cnt;
+ struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_GETOPT_CommandLineOption defoptions[] = {
GNUNET_GETOPT_OPTION_CFG_FILE (&cc.cfgfile),
GNUNET_GETOPT_OPTION_HELP (binaryHelp),
loglev = NULL;
cc.task = task;
cc.task_cls = task_cls;
- cc.cfg = GNUNET_CONFIGURATION_create ();
+ cc.cfg = cfg = GNUNET_CONFIGURATION_create ();
/* prepare */
#if ENABLE_NLS
qsort (allopts, cnt, sizeof (struct GNUNET_GETOPT_CommandLineOption),
&cmd_sorter);
loglev = GNUNET_strdup ("WARNING");
- if ((-1 == (ret = GNUNET_GETOPT_run (binaryName,
- cc.cfg,
+ if ((-1 == (ret = GNUNET_GETOPT_run (binaryName,
allopts,
(unsigned int) argc, argv))) ||
((GNUNET_OK !=
GNUNET_log_setup (binaryName,
loglev,
NULL)) ||
- (GNUNET_OK != GNUNET_CONFIGURATION_load (cc.cfg, cc.cfgfile))))
+ (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cc.cfgfile))))
{
GNUNET_free_non_null (cc.cfgfile);
GNUNET_SCHEDULER_run (&program_main, &cc);
/* clean up */
- GNUNET_CONFIGURATION_destroy (cc.cfg);
+ GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_free_non_null (cc.cfgfile);
GNUNET_free (loglev);
return GNUNET_OK;
* a new pseudonym.
*/
int
-GNUNET_PSEUDONYM_discovery_callback_register (struct
+GNUNET_PSEUDONYM_discovery_callback_register (const struct
GNUNET_CONFIGURATION_Handle
*cfg,
GNUNET_PSEUDONYM_Iterator
* pseudonym identifier and directory prefix.
*/
static char *
-get_data_filename (struct GNUNET_CONFIGURATION_Handle
+get_data_filename (const struct GNUNET_CONFIGURATION_Handle
*cfg, const char *prefix, const GNUNET_HashCode * psid)
{
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
}
static void
-write_pseudonym_info (struct GNUNET_CONFIGURATION_Handle *cfg,
+write_pseudonym_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * nsid,
const struct GNUNET_CONTAINER_MetaData *meta,
int32_t ranking, const char *ns_name)
}
static int
-read_info (struct GNUNET_CONFIGURATION_Handle *cfg,
+read_info (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * nsid,
struct GNUNET_CONTAINER_MetaData **meta,
int32_t * ranking, char **ns_name)
* @return NULL on failure (should never happen)
*/
char *
-GNUNET_PSEUDONYM_id_to_name (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_PSEUDONYM_id_to_name (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * nsid)
{
struct GNUNET_CONTAINER_MetaData *meta;
* @return GNUNET_OK on success
*/
int
-GNUNET_PSEUDONYM_name_to_id (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_PSEUDONYM_name_to_id (const struct GNUNET_CONFIGURATION_Handle *cfg,
const char *ns_uname, GNUNET_HashCode * nsid)
{
size_t slen;
{
GNUNET_PSEUDONYM_Iterator iterator;
void *closure;
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
};
static int
* List all available pseudonyms.
*/
int
-GNUNET_PSEUDONYM_list_all (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_PSEUDONYM_list_all (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_PSEUDONYM_Iterator iterator, void *closure)
{
struct ListPseudonymClosure cls;
* @return new rating of the pseudonym
*/
int
-GNUNET_PSEUDONYM_rank (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_PSEUDONYM_rank (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * nsid, int delta)
{
struct GNUNET_CONTAINER_MetaData *meta;
* @param id the pseudonym identifier
*/
void
-GNUNET_PSEUDONYM_add (struct GNUNET_CONFIGURATION_Handle *cfg,
+GNUNET_PSEUDONYM_add (const struct GNUNET_CONFIGURATION_Handle *cfg,
const GNUNET_HashCode * id,
const struct GNUNET_CONTAINER_MetaData *meta)
{
/**
* Our configuration.
*/
- struct GNUNET_CONFIGURATION_Handle *cfg;
+ const struct GNUNET_CONFIGURATION_Handle *cfg;
/**
* Handle for the server.
char *logfile;
int do_daemonize;
struct GNUNET_SERVICE_Context sctx;
+ struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_GETOPT_CommandLineOption service_options[] = {
GNUNET_GETOPT_OPTION_CFG_FILE (&cfg_fn),
{'d', "daemonize", NULL,
sctx.maxbuf = GNUNET_SERVER_MAX_MESSAGE_SIZE;
sctx.task = task;
sctx.serviceName = serviceName;
- sctx.cfg = GNUNET_CONFIGURATION_create ();
+ sctx.cfg = cfg = GNUNET_CONFIGURATION_create ();
/* setup subsystems */
if ((GNUNET_SYSERR ==
- GNUNET_GETOPT_run (serviceName,
- sctx.cfg,
+ GNUNET_GETOPT_run (serviceName,
service_options,
argc,
argv)) ||
(GNUNET_OK !=
GNUNET_log_setup (serviceName, loglev, logfile)) ||
(GNUNET_OK !=
- GNUNET_CONFIGURATION_load (sctx.cfg, cfg_fn)) ||
+ GNUNET_CONFIGURATION_load (cfg, cfg_fn)) ||
(GNUNET_OK !=
setup_service (&sctx)) ||
((do_daemonize == 1) &&
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "write");
GNUNET_break (0 == CLOSE (sctx.ready_confirm_fd));
}
- GNUNET_CONFIGURATION_destroy (sctx.cfg);
+ GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_free_non_null (sctx.addr);
GNUNET_free_non_null (logfile);
GNUNET_free (loglev);
if (sctx.server != NULL)
GNUNET_SERVER_destroy (sctx.server);
GNUNET_free_non_null (sctx.my_handlers);
- GNUNET_CONFIGURATION_destroy (sctx.cfg);
+ GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_free_non_null (sctx.addr);
GNUNET_free_non_null (logfile);
GNUNET_free (loglev);
struct GNUNET_SERVICE_Context *
GNUNET_SERVICE_start (const char *serviceName,
struct GNUNET_SCHEDULER_Handle *sched,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
int i;
struct GNUNET_SERVICE_Context *sctx;
static int
testMinimal ()
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
char *const emptyargv[] = {
"test",
NULL
GNUNET_GETOPT_OPTION_END
};
- cfg = GNUNET_CONFIGURATION_create ();
- if (1 != GNUNET_GETOPT_run ("test", cfg, emptyoptionlist, 1, emptyargv))
- {
- GNUNET_CONFIGURATION_destroy (cfg);
- return 1;
- }
- GNUNET_CONFIGURATION_destroy (cfg);
+ if (1 != GNUNET_GETOPT_run ("test", emptyoptionlist, 1, emptyargv))
+ return 1;
return 0;
}
static int
testVerbose ()
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
char *const myargv[] = {
"test",
"-V",
GNUNET_GETOPT_OPTION_END
};
- cfg = GNUNET_CONFIGURATION_create ();
- if (3 != GNUNET_GETOPT_run ("test", cfg, verboseoptionlist, 4, myargv))
+ if (3 != GNUNET_GETOPT_run ("test", verboseoptionlist, 4, myargv))
{
GNUNET_break (0);
- GNUNET_CONFIGURATION_destroy (cfg);
return 1;
}
- GNUNET_CONFIGURATION_destroy (cfg);
if (vflags != 2)
{
GNUNET_break (0);
static int
testVersion ()
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
char *const myargv[] = {
"test_getopt",
"-v",
GNUNET_GETOPT_OPTION_END
};
- cfg = GNUNET_CONFIGURATION_create ();
if (-1 != GNUNET_GETOPT_run ("test_getopt",
- cfg, versionoptionlist, 2, myargv))
+ versionoptionlist, 2, myargv))
{
GNUNET_break (0);
- GNUNET_CONFIGURATION_destroy (cfg);
return 1;
}
- GNUNET_CONFIGURATION_destroy (cfg);
return 0;
}
static int
testAbout ()
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
char *const myargv[] = {
"test_getopt",
"-h",
GNUNET_GETOPT_OPTION_END
};
- cfg = GNUNET_CONFIGURATION_create ();
if (-1 != GNUNET_GETOPT_run ("test_getopt",
- cfg, aboutoptionlist, 2, myargv))
+ aboutoptionlist, 2, myargv))
{
GNUNET_break (0);
- GNUNET_CONFIGURATION_destroy (cfg);
return 1;
}
- GNUNET_CONFIGURATION_destroy (cfg);
return 0;
}
static int
testLogOpts ()
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
char *const myargv[] = {
"test_getopt",
"-l", "filename",
GNUNET_GETOPT_OPTION_END
};
- cfg = GNUNET_CONFIGURATION_create ();
- if (5 != GNUNET_GETOPT_run ("test_getopt", cfg, logoptionlist, 5, myargv))
+ if (5 != GNUNET_GETOPT_run ("test_getopt", logoptionlist, 5, myargv))
{
GNUNET_break (0);
- GNUNET_CONFIGURATION_destroy (cfg);
return 1;
}
GNUNET_assert (fn != NULL);
- GNUNET_CONFIGURATION_destroy (cfg);
if ((0 != strcmp (level, "WARNING")) || (0 != strcmp (fn, "filename")))
{
GNUNET_break (0);
static int
testFlagNum ()
{
- struct GNUNET_CONFIGURATION_Handle *cfg;
char *const myargv[] = {
"test_getopt",
"-f",
GNUNET_GETOPT_OPTION_END
};
- cfg = GNUNET_CONFIGURATION_create ();
- if (6 != GNUNET_GETOPT_run ("test_getopt", cfg, logoptionlist, 6, myargv))
+ if (6 != GNUNET_GETOPT_run ("test_getopt", logoptionlist, 6, myargv))
{
GNUNET_break (0);
- GNUNET_CONFIGURATION_destroy (cfg);
return 1;
}
- GNUNET_CONFIGURATION_destroy (cfg);
if ((1 != flag) || (42 != num) || (42 != lnum))
{
GNUNET_break (0);
runner (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
int *ok = cls;
GNUNET_assert (setme == 1);
static void
ready (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+ const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
struct GNUNET_CLIENT_Connection *client;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service confirmed running\n");
runner (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_SERVER_Handle *server,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Service initializing\n");
GNUNET_SERVER_add_handlers (server, myhandlers);
GNUNET_CLIENT_service_test (sched,
"test_service",
- cfg, GNUNET_TIME_UNIT_SECONDS, &ready, cfg);
+ cfg, GNUNET_TIME_UNIT_SECONDS, &ready, (void*) cfg);
}
static void
-term (void *cls, struct GNUNET_CONFIGURATION_Handle *cfg)
+term (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
int *ok = cls;
*ok = 0;
static void
ready6 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+ const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
struct GNUNET_CLIENT_Connection *client;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "V6 ready\n");
runner6 (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
struct GNUNET_SERVER_Handle *server,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Initializing v6 service\n");
GNUNET_SERVER_add_handlers (server, myhandlers);
GNUNET_CLIENT_service_test (sched,
"test_service6",
- cfg, GNUNET_TIME_UNIT_SECONDS, &ready6, cfg);
+ cfg, GNUNET_TIME_UNIT_SECONDS, &ready6, (void*) cfg);
}
/**
start_stop_main (void *cls,
struct GNUNET_SCHEDULER_Handle *sched,
char *const *args,
- const char *cfgfile, struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *cfgfile,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
int *ret = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,