Author: grothoff Date: 2006-08-06 21:47:47 -0700 (Sun, 06 Aug 2006) New Revision: 3213
Modified: GNUnet/src/applications/tbench/Makefile.am GNUnet/src/applications/tbench/gnunet-tbench.c GNUnet/src/applications/tbench/tbench.c GNUnet/src/applications/tbench/tbench.h GNUnet/src/include/gnunet_util_getopt.h GNUnet/src/util/getopt/setoption.c GNUnet/todo Log: fixing tbench Modified: GNUnet/src/applications/tbench/Makefile.am =================================================================== --- GNUnet/src/applications/tbench/Makefile.am 2006-08-07 03:51:48 UTC (rev 3212) +++ GNUnet/src/applications/tbench/Makefile.am 2006-08-07 04:47:47 UTC (rev 3213) @@ -3,23 +3,28 @@ plugindir = $(libdir)/GNUnet LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/util/network_client/libgnunetutil_network_client.la \ + $(top_builddir)/src/util/loggers/libgnunetutil_logging.la \ + $(top_builddir)/src/util/crypto/libgnunetutil_crypto.la \ + $(top_builddir)/src/util/config_impl/libgnunetutil_config.la bin_PROGRAMS = \ gnunet-tbench plugin_LTLIBRARIES = \ libgnunetmodule_tbench.la - gnunet_tbench_SOURCES = \ gnunet-tbench.c \ tbench.h + + libgnunetmodule_tbench_la_SOURCES = \ tbench.c\ tbench.h libgnunetmodule_tbench_la_LIBADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la libgnunetmodule_tbench_la_LDFLAGS = \ -export-dynamic -avoid-version -module @@ -35,12 +40,18 @@ tbenchtest.c tbenchtest_LDADD = \ $(top_builddir)/src/applications/stats/libgnunetstats_api.la \ + $(top_builddir)/src/util/network_client/libgnunetutil_network_client.la \ + $(top_builddir)/src/util/loggers/libgnunetutil_logging.la \ + $(top_builddir)/src/util/config_impl/libgnunetutil_config.la \ $(top_builddir)/src/util/libgnunetutil.la tbenchtest_udp_SOURCES = \ tbenchtest_udp.c tbenchtest_udp_LDADD = \ $(top_builddir)/src/applications/stats/libgnunetstats_api.la \ + $(top_builddir)/src/util/network_client/libgnunetutil_network_client.la \ + $(top_builddir)/src/util/loggers/libgnunetutil_logging.la \ + $(top_builddir)/src/util/config_impl/libgnunetutil_config.la \ $(top_builddir)/src/util/libgnunetutil.la EXTRA_DIST = \ Modified: GNUnet/src/applications/tbench/gnunet-tbench.c =================================================================== --- GNUnet/src/applications/tbench/gnunet-tbench.c 2006-08-07 03:51:48 UTC (rev 3212) +++ GNUnet/src/applications/tbench/gnunet-tbench.c 2006-08-07 04:47:47 UTC (rev 3213) @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2001, 2002, 2004, 2005 Christian Grothoff (and other contributing authors) + (C) 2001, 2002, 2004, 2005, 2006 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -26,10 +26,12 @@ #include "platform.h" #include "gnunet_protocols.h" +#include "gnunet_util_network_client.h" +#include "gnunet_util_config_impl.h" +#include "gnunet_util_error_loggers.h" +#include "gnunet_util_crypto.h" #include "tbench.h" -#define TBENCH_VERSION "0.1.1" - #define DEFAULT_MESSAGE_SIZE 10 #define DEFAULT_TIMEOUT (2 * cronSECONDS) #define DEFAULT_SPACING 0 @@ -37,161 +39,52 @@ #define OF_HUMAN_READABLE 0 #define OF_GNUPLOT_INPUT 1 -static unsigned int messageSize = DEFAULT_MESSAGE_SIZE; -static unsigned int messageCnt = 1; +static unsigned long long messageSize = DEFAULT_MESSAGE_SIZE; +static unsigned long long messageCnt = 1; static char * messageReceiver; -static unsigned int messageIterations = 1; -static unsigned int messageTrainSize = 1; +static unsigned long long messageIterations = 1; +static unsigned long long messageTrainSize = 1; static cron_t messageTimeOut = DEFAULT_TIMEOUT; static cron_t messageSpacing = DEFAULT_SPACING; -static unsigned int outputFormat = OF_HUMAN_READABLE; +static int outputFormat = OF_HUMAN_READABLE; + /** - * Parse the options, set the timeout. - * @param argc the number of options - * @param argv the option list (including keywords) - * @return OK on error, SYSERR if we should exit + * All gnunet-tbench command line options */ -static int parseOptions(int argc, - char ** argv) { - int option_index; - int c; +static struct CommandLineOption gnunettbenchOptions[] = { + COMMAND_LINE_OPTION_CFG_FILE, /* -c */ + COMMAND_LINE_OPTION_HELP(gettext_noop("Start GNUnet transport benchmarking tool.")), /* -h */ + { 'g', "gnuplot", NULL, + gettext_noop("output in gnuplot format"), 0, + &gnunet_getopt_configure_set_one, &outputFormat }, + COMMAND_LINE_OPTION_HOSTNAME, /* -H */ + { 'i', "iterations", "ITER", + gettext_noop("number of iterations"), 1, + &gnunet_getopt_configure_set_ulong, &messageIterations }, + COMMAND_LINE_OPTION_LOGGING, /* -L */ + { 'n', "msg", "MESSAGES", + gettext_noop("number of messages to use per iteration"), 1, + &gnunet_getopt_configure_set_ulong, &messageCnt }, + { 'r', "rec", "RECEIVER", + gettext_noop("receiver host identifier (ENC file name)"), 1, + &gnunet_getopt_configure_set_string, &messageReceiver }, + { 's', "size", "SIZE", + gettext_noop("message size"), 1, + &gnunet_getopt_configure_set_ulong, &messageSize }, + { 'S', "space", "SPACE", + gettext_noop("sleep for SPACE ms after each a message block"), 1, + &gnunet_getopt_configure_set_ulong, &messageTrainSize }, + { 't', "timeout", "TIMEOUT", + gettext_noop("time to wait for the completion of an iteration (in ms)"), 1, + &gnunet_getopt_configure_set_ulong, &messageTimeOut }, + COMMAND_LINE_OPTION_VERSION(PACKAGE_VERSION), /* -v */ + { 'X', "xspace", "COUNT", + gettext_noop("number of messages in a message block"), 1, + &gnunet_getopt_configure_set_ulong, &messageSpacing }, + COMMAND_LINE_OPTION_END, +}; - FREENONNULL(setConfigurationString("GNUNETD", - "LOGFILE", - NULL)); - while (1) { - static struct GNoption long_options[] = { - LONG_DEFAULT_OPTIONS, - { "gnuplot", 0, 0, 'g' }, - { "iterations", 1, 0, 'i'}, - { "msg", 1, 0, 'n'}, - { "rec", 1, 0, 'r'}, - { "size", 1, 0, 's' }, - { "space", 1, 0, 'S' }, - { "timeout", 1, 0, 't' }, - { "xspace", 1, 0, 'X' }, - { 0,0,0,0 } - }; - option_index=0; - c = GNgetopt_long(argc, - argv, - "vhdc:L:H:n:s:r:i:t:S:X:g", - long_options, - &option_index); - if (c == -1) - break; /* No more flags to process*/ - if (YES == parseDefaultOptions(c, GNoptarg)) - continue; - switch(c) { - case 'g': - outputFormat = OF_GNUPLOT_INPUT; - break; - case 'h': { - static Help help[] = { - HELP_CONFIG, - HELP_HELP, - { 'g', "gnuplot", NULL, - gettext_noop("output in gnuplot format") }, - HELP_LOGLEVEL, - { 'i', "iterations", "ITER", - gettext_noop("number of iterations") }, - { 'n', "msg", "MESSAGES", - gettext_noop("number of messages to use per iteration") }, - { 'r', "rec", "RECEIVER", - gettext_noop("receiver host identifier (ENC file name)") }, - { 's', "size", "SIZE", - gettext_noop("message size") }, - { 'S', "space", "SPACE", - gettext_noop("sleep for SPACE ms after each a message block") }, - { 't', "timeout", "TIMEOUT", - gettext_noop("time to wait for the completion of an iteration (in ms)") }, - HELP_VERSION, - { 'X', "xspace", "COUNT", - gettext_noop("number of messages in a message block") }, - HELP_END, - }; - formatHelp("gnunet-tbench [OPTIONS]", - _("Start GNUnet transport benchmarking tool."), - help); - return SYSERR; - } - case 'i': - if(1 != sscanf(GNoptarg, - "%ud", - &messageIterations)){ - GE_LOG(ectx, GE_ERROR | GE_IMMEDIATE | GE_USER, - _("You must pass a number to the `%s' option.\n"), - "-i"); - return SYSERR; - } - break; - case 'n': - if(1 != sscanf(GNoptarg, - "%ud", - &messageCnt)){ - GE_LOG(ectx, GE_ERROR | GE_IMMEDIATE | GE_USER, - _("You must pass a number to the `%s' option.\n"), - "-n"); - return SYSERR; - } - break; - case 'r': - messageReceiver = STRDUP(GNoptarg); - break; - case 's': - if(1 != sscanf(GNoptarg, - "%ud", - &messageSize)){ - GE_LOG(ectx, GE_ERROR | GE_IMMEDIATE | GE_USER, - _("You must pass a number to the `%s' option.\n"), - "-s"); - return SYSERR; - } - break; - case 'S': - if(1 != sscanf(GNoptarg, - "%ud", - &messageTrainSize)){ - GE_LOG(ectx, GE_ERROR | GE_IMMEDIATE | GE_USER, - _("You must pass a number to the `%s' option.\n"), - "-S"); - return SYSERR; - } - break; - case 't': - if(1 != SSCANF(GNoptarg, - "%llud", - &messageTimeOut)){ - GE_LOG(ectx, GE_ERROR | GE_IMMEDIATE | GE_USER, - _("You must pass a number to the `%s' option.\n"), - "-t"); - return SYSERR; - } - break; - case 'v': - printf("GNUnet v%s, gnunet-tbench v%s\n", - VERSION, - TBENCH_VERSION); - return SYSERR; - case 'X': - if(1 != SSCANF(GNoptarg, - "%llud", - &messageSpacing)){ - GE_LOG(ectx, GE_ERROR | GE_IMMEDIATE | GE_USER, - _("You must pass a number to the `%s' option.\n"), - "-X"); - return SYSERR; - } - break; - default: - GE_LOG(ectx, GE_ERROR | GE_IMMEDIATE | GE_USER, - _("Use --help to get a list of options.\n")); - return -1; - } /* end of parsing commandline */ - } /* while (1) */ - return OK; -} /** * Tool to benchmark the performance of the P2P transports. @@ -200,18 +93,44 @@ * @param argv command line arguments * @return return value from gnunetsearch: 0: ok, -1: error */ -int main(int argc, char ** argv) { - GNUNET_TCP_SOCKET * sock; +int main(int argc, + const char ** argv) { + struct ClientServerConnection * sock; CS_tbench_request_MESSAGE msg; CS_tbench_reply_MESSAGE * buffer; float messagesPercentLoss; - if (SYSERR == initUtil(argc, argv, &parseOptions)) - return 0; /* parse error, --help, etc. */ - sock = getClientSocket(); - if (sock == NULL) - errexit(_("Could not connect to gnunetd.\n")); + struct GE_Context * ectx; + struct GC_Configuration * cfg; + ectx = GE_create_context_stderr(NO, + GE_WARNING | GE_ERROR | GE_FATAL | + GE_USER | GE_ADMIN | GE_DEVELOPER | + GE_IMMEDIATE | GE_BULK); + GE_setDefaultContext(ectx); + cfg = GC_create_C_impl(); + GE_ASSERT(ectx, cfg != NULL); + os_init(ectx); + if (-1 == gnunet_parse_options("gnunet-tbench", + ectx, + cfg, + gnunettbenchOptions, + (unsigned int) argc, + argv)) { + GC_free(cfg); + GE_free_context(ectx); + return -1; + } + sock = client_connection_create(ectx, + cfg); + if (sock == NULL) { + fprintf(stderr, + _("Error establishing connection with gnunetd.\n")); + GC_free(cfg); + GE_free_context(ectx); + return 1; + } + msg.header.size = htons(sizeof(CS_tbench_request_MESSAGE)); msg.header.type = htons(CS_PROTO_tbench_REQUEST); msg.msgSize = htonl(messageSize); @@ -221,23 +140,36 @@ msg.trainSize = htonl(messageTrainSize); msg.timeOut = htonll(messageTimeOut); msg.priority = htonl(5); - if (messageReceiver == NULL) - errexit(_("You must specify a receiver!\n")); + if (messageReceiver == NULL) { + fprintf(stderr, + _("You must specify a receiver!\n")); + connection_destroy(sock); + GC_free(cfg); + GE_free_context(ectx); + return 1; + } if (OK != enc2hash(messageReceiver, - &msg.receiverId.hashPubKey)) - errexit(_("Invalid receiver peer ID specified (`%s' is not valid name).\n"), + &msg.receiverId.hashPubKey)) { + fprintf(stderr, + _("Invalid receiver peer ID specified (`%s' is not valid name).\n"), messageReceiver); + connection_destroy(sock); + GC_free(cfg); + GE_free_context(ectx); + return 1; + } FREE(messageReceiver); - if (SYSERR == writeToSocket(sock, - &msg.header)) + if (SYSERR == connection_write(sock, + &msg.header)) return -1; buffer = NULL; - if (OK == readFromSocket(sock, - (CS_MESSAGE_HEADER**)&buffer)) { - GE_ASSERT(ectx, ntohs(buffer->header.size) == - sizeof(CS_tbench_reply_MESSAGE)); + if (OK == connection_read(sock, + (MESSAGE_HEADER**)&buffer)) { + GE_ASSERT(ectx, + ntohs(buffer->header.size) == + sizeof(CS_tbench_reply_MESSAGE)); if ((float)buffer->mean_loss <= 0){ GE_BREAK(ectx, 0); messagesPercentLoss = 0.0; @@ -278,8 +210,9 @@ } else printf(_("\nDid not receive the message from gnunetd. Is gnunetd running?\n")); - releaseClientSocket(sock); - doneUtil(); + connection_destroy(sock); + GC_free(cfg); + GE_free_context(ectx); return 0; } Modified: GNUnet/src/applications/tbench/tbench.c =================================================================== --- GNUnet/src/applications/tbench/tbench.c 2006-08-07 03:51:48 UTC (rev 3212) +++ GNUnet/src/applications/tbench/tbench.c 2006-08-07 04:47:47 UTC (rev 3213) @@ -1,6 +1,6 @@ /* This file is part of GNUnet. - (C) 2001, 2002, 2004, 2005 Christian Grothoff (and other contributing authors) + (C) 2001, 2002, 2004, 2005, 2006 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published @@ -43,7 +43,7 @@ * transport performance. */ typedef struct { - P2P_MESSAGE_HEADER header; + MESSAGE_HEADER header; unsigned int iterationNum; unsigned int packetNum; unsigned int priority; @@ -54,11 +54,11 @@ /** * Lock for access to semaphores. */ -static Mutex lock; +static struct MUTEX * lock; -static Semaphore * presem; +static struct SEMAPHORE * presem; -static Semaphore * postsem; +static struct SEMAPHORE * postsem; /** * What was the packet number we received? @@ -70,6 +70,7 @@ * that replies match the current request series). */ static unsigned int currIteration; + static unsigned int currNounce; /** @@ -77,6 +78,7 @@ */ static int timeoutOccured; +static struct GE_Context * ectx; static CoreAPIForApplication * coreAPI; @@ -93,9 +95,9 @@ if (blocking == YES) { if (timeoutOccured == YES) return results->lossCount; - SEMAPHORE_DOWN(postsem); + SEMAPHORE_DOWN(postsem, YES); } else { - if (OK != SEMAPHORE_DOWN_NONBLOCKING(postsem)) + if (OK != SEMAPHORE_DOWN(postsem, NO)) return results->lossCount; } do { @@ -119,7 +121,7 @@ #endif } SEMAPHORE_UP(presem); - } while (OK == SEMAPHORE_DOWN_NONBLOCKING(postsem)); + } while (OK == SEMAPHORE_DOWN(postsem, NO)); return results->lossCount; } @@ -128,8 +130,8 @@ * around and send it back. */ static int handleTBenchReq(const PeerIdentity * sender, - const P2P_MESSAGE_HEADER * message) { - P2P_MESSAGE_HEADER * reply; + const MESSAGE_HEADER * message) { + MESSAGE_HEADER * reply; const P2P_tbench_MESSAGE * msg; if ( ntohs(message->size) < sizeof(P2P_tbench_MESSAGE)) { @@ -168,7 +170,7 @@ * We received a tbench-reply. Check and count stats. */ static int handleTBenchReply(const PeerIdentity * sender, - const P2P_MESSAGE_HEADER * message) { + const MESSAGE_HEADER * message) { const P2P_tbench_MESSAGE * pmsg; if (ntohs(message->size) < sizeof(P2P_tbench_MESSAGE)) { @@ -189,13 +191,13 @@ htonl(pmsg->iterationNum), htonl(pmsg->nounce)); #endif - MUTEX_LOCK(&lock); + MUTEX_LOCK(lock); if ( (timeoutOccured == NO) && (presem != NULL) && (postsem != NULL) && (htonl(pmsg->iterationNum) == currIteration) && (htonl(pmsg->nounce) == currNounce) ) { - SEMAPHORE_DOWN(presem); + SEMAPHORE_DOWN(presem, YES); lastPacketNumber = ntohl(pmsg->packetNum); SEMAPHORE_UP(postsem); } else { @@ -207,14 +209,15 @@ currIteration); #endif } - MUTEX_UNLOCK(&lock); + MUTEX_UNLOCK(lock); return OK; } /** * Cron-job helper function to signal timeout. */ -static void semaUp(Semaphore * sem) { +static void semaUp(void * cls) { + struct SEMAPHORE * sem = cls; timeoutOccured = YES; SEMAPHORE_UP(sem); } @@ -222,8 +225,8 @@ /** * Handle client request (main function) */ -static int csHandleTBenchRequest(ClientHandle client, - const CS_MESSAGE_HEADER * message) { +static int csHandleTBenchRequest(struct ClientHandle * client, + const MESSAGE_HEADER * message) { CS_tbench_request_MESSAGE * msg; CS_tbench_reply_MESSAGE reply; P2P_tbench_MESSAGE * p2p; @@ -275,7 +278,7 @@ p2p->header.type = htons(P2P_PROTO_tbench_REQUEST); p2p->priority = msg->priority; - MUTEX_LOCK(&lock); + MUTEX_LOCK(lock); for (iteration=0;iteration<iterations;iteration++) { results[iteration].maxPacketNumber = msgCnt; results[iteration].packetsReceived = MALLOC(msgCnt); @@ -300,18 +303,19 @@ p2p->crc = htonl(crc32N(&p2p[1], size - sizeof(P2P_tbench_MESSAGE))); - MUTEX_UNLOCK(&lock); /* allow receiving */ + MUTEX_UNLOCK(lock); /* allow receiving */ - cronTime(&startTime); + startTime = get_time(); endTime = startTime + ntohll(msg->timeOut); timeoutOccured = NO; - addCronJob((CronJob)&semaUp, - ntohll(msg->timeOut) * cronMILLIS, - 0, - postsem); + cron_add_job(coreAPI->cron, + &semaUp, + ntohll(msg->timeOut) * cronMILLIS, + 0, + postsem); for (packetNum=0;packetNum<msgCnt;packetNum++){ - cronTime(&now); + now = get_time(); if (now > endTime) break; /* timeout */ @@ -332,8 +336,9 @@ (htonl(msg->trainSize) != 0) && (packetNum % htonl(msg->trainSize)) == 0) { delayStart = now; - while ( (cronTime(&now) < (delayStart+delay)) && + while ( (get_time() < (delayStart+delay)) && (timeoutOccured == NO) ) { + now = get_time(); if (delayStart + delay - now > 5 * cronMILLIS) { pollResults(&results[iteration], NO); PTHREAD_SLEEP(5 * cronMILLIS); @@ -346,10 +351,10 @@ earlyEnd = get_time(); } while ( (timeoutOccured == NO) && - (cronTime(&now) < endTime) ) { + (get_time() < endTime) ) { if ( (0 == pollResults(&results[iteration], YES) ) && (earlyEnd == 0) ) - earlyEnd = now; + earlyEnd = get_time(); PTHREAD_SLEEP(5 * cronMILLIS); } @@ -357,24 +362,26 @@ timeoutOccured = YES; SEMAPHORE_UP(presem); - MUTEX_LOCK(&lock); + MUTEX_LOCK(lock); if (earlyEnd == 0) earlyEnd = now; results[iteration].totalTime = earlyEnd - startTime; FREE(results[iteration].packetsReceived); - suspendCron(); - delCronJob((CronJob)&semaUp, - 0, - postsem); - resumeCron(); + cron_suspend(coreAPI->cron, + NO); + cron_del_job(coreAPI->cron, + &semaUp, + 0, + postsem); + cron_resume_jobs(coreAPI->cron, + NO); SEMAPHORE_DESTROY(presem); SEMAPHORE_DESTROY(postsem); presem = NULL; postsem = NULL; - } - MUTEX_UNLOCK(&lock); + MUTEX_UNLOCK(lock); sum_loss = 0; sum_time = 0; @@ -432,7 +439,8 @@ int initialize_module_tbench(CoreAPIForApplication * capi) { int ok = OK; - MUTEX_CREATE(&lock); + ectx = capi->ectx; + lock = MUTEX_CREATE(NO); coreAPI = capi; if (SYSERR == capi->registerHandler(P2P_PROTO_tbench_REPLY, &handleTBenchReply)) @@ -457,7 +465,8 @@ &handleTBenchReply); coreAPI->unregisterClientHandler(CS_PROTO_tbench_REQUEST, &csHandleTBenchRequest); - MUTEX_DESTROY(&lock); + MUTEX_DESTROY(lock); + lock = NULL; coreAPI = NULL; } Modified: GNUnet/src/applications/tbench/tbench.h =================================================================== --- GNUnet/src/applications/tbench/tbench.h 2006-08-07 03:51:48 UTC (rev 3212) +++ GNUnet/src/applications/tbench/tbench.h 2006-08-07 04:47:47 UTC (rev 3213) @@ -31,7 +31,7 @@ * Client requests peer to perform some profiling. */ typedef struct { - CS_MESSAGE_HEADER header; + MESSAGE_HEADER header; /** * How big is each message (plus headers). * Note that GNUnet is limited to 64k messages. @@ -75,7 +75,7 @@ * Response from server with statistics. */ typedef struct { - CS_MESSAGE_HEADER header; + MESSAGE_HEADER header; unsigned int max_loss; unsigned int min_loss; float mean_loss; Modified: GNUnet/src/include/gnunet_util_getopt.h =================================================================== --- GNUnet/src/include/gnunet_util_getopt.h 2006-08-07 03:51:48 UTC (rev 3212) +++ GNUnet/src/include/gnunet_util_getopt.h 2006-08-07 04:47:47 UTC (rev 3213) @@ -207,6 +207,21 @@ const char * option, const char * value); +int gnunet_getopt_configure_set_ulong(CommandLineProcessorContext * ctx, + void * scls, + const char * option, + const char * value); + +int gnunet_getopt_configure_set_one(CommandLineProcessorContext * ctx, + void * scls, + const char * option, + const char * value); + +int gnunet_getopt_configure_set_string(CommandLineProcessorContext * ctx, + void * scls, + const char * option, + const char * value); + int gnunet_getopt_configure_increment_value(CommandLineProcessorContext * ctx, void * scls, const char * option, Modified: GNUnet/src/util/getopt/setoption.c =================================================================== --- GNUnet/src/util/getopt/setoption.c 2006-08-07 03:51:48 UTC (rev 3212) +++ GNUnet/src/util/getopt/setoption.c 2006-08-07 04:47:47 UTC (rev 3213) @@ -88,4 +88,40 @@ return ret; } +int gnunet_getopt_configure_set_one(CommandLineProcessorContext * ctx, + void * scls, + const char * option, + const char * value) { + int * val = scls; + val = 1; + return OK; +} + +int gnunet_getopt_configure_set_string(CommandLineProcessorContext * ctx, + void * scls, + const char * option, + const char * value) { + char ** val = scls; + if (value == NULL) + return SYSERR; + *val = STRDUP(value); + return OK; +} + +int gnunet_getopt_configure_set_ulong(CommandLineProcessorContext * ctx, + void * scls, + const char * option, + const char * value) { + unsigned long long * val = scls; + if (1 != SSCANF(value, "%llu", val)) { + GE_LOG(ctx->ectx, + GE_ERROR | GE_IMMEDIATE | GE_USER, + _("You must pass a number to the `%s' option.\n"), + "-X"); + return SYSERR; + } + return OK; +} + + /* end of setoption.c */ Modified: GNUnet/todo =================================================================== --- GNUnet/todo 2006-08-07 03:51:48 UTC (rev 3212) +++ GNUnet/todo 2006-08-07 04:47:47 UTC (rev 3213) @@ -26,11 +26,11 @@ * applications: + fragmentation, identity, pingpong, session, transport, stats, topology_default, state, getoption, advertising, - traffic, ecrs_core, template compile + traffic, ecrs_core, template, tbench compile + bootstrap_http: maybe switch to libwww? + for fs: fs (18500), gap (2800) + rest: sqstore_mysql, dht, chat, kvstore_sqlite, - sqstore_mysql, rpc, tbench, testbed, + sqstore_mysql, rpc, testbed, topology_f2f, vpn, tracekit * setup: + nothing compiles _______________________________________________ GNUnet-SVN mailing list GNUnet-SVN@gnu.org http://lists.gnu.org/mailman/listinfo/gnunet-svn