aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-06-11 05:30:19 +0000
committerChristian Grothoff <christian@grothoff.org>2009-06-11 05:30:19 +0000
commit8db4f9403d80faa67eaf85a2d077c35670596c4d (patch)
tree8aca077b466b92c2d6a296e186bad56f78f08f88
parent4acd295ad6076d3c33f62d40324106d3308850ca (diff)
downloadgnunet-8db4f9403d80faa67eaf85a2d077c35670596c4d.tar.gz
gnunet-8db4f9403d80faa67eaf85a2d077c35670596c4d.zip
get time cfg api added
-rw-r--r--TODO24
-rw-r--r--src/include/gnunet_configuration_lib.h12
-rw-r--r--src/util/configuration.c18
-rw-r--r--src/util/service.c10
4 files changed, 48 insertions, 16 deletions
diff --git a/TODO b/TODO
index 40a81dee5..1fedcbca3 100644
--- a/TODO
+++ b/TODO
@@ -7,7 +7,6 @@ Core:
7 => bootstrap should use plugins, possible multiple at the same time! 7 => bootstrap should use plugins, possible multiple at the same time!
8 8
9Util: 9Util:
10* consider adding "get_time" to "configuration" API
11* improve disk API [Nils] 10* improve disk API [Nils]
12 11
13TESTCASES WANTED: 12TESTCASES WANTED:
@@ -52,7 +51,7 @@ that would cause them to be executed and check that they are working:
52 - handle_transport_notify_disconnect 51 - handle_transport_notify_disconnect
53 52
54 53
55PHASE #2: (Goal: recover basic core functionality) 54PHASE #2: (Goal: recover basic file-sharing functionality)
56 55
57Datastores: 56Datastores:
58* implement sqlite-based sqstore/datastore service 57* implement sqlite-based sqstore/datastore service
@@ -70,15 +69,7 @@ Applications:
70* FS / fs-libs 69* FS / fs-libs
71 70
72Databases: 71Databases:
73* mysql & postgres backend 72* have ONE backend working
74
75Transports:
76* UDP backend (need LIBRARY to support (de)fragmentation!)
77* HTTP backend
78* Testing:
79 + Testcases for set_quota, timeouts, disconnects, transmit_ready_cancel
80 + Better coverage of gnunet-service-transport (hello validation)
81 + direct test of plugins compliance to plugin API
82 73
83 74
84PHASE #3: (Goal: ready for pre-release) [completion-goal: end of 2009] 75PHASE #3: (Goal: ready for pre-release) [completion-goal: end of 2009]
@@ -90,6 +81,17 @@ PHASE #3: (Goal: ready for pre-release) [completion-goal: end of 2009]
90* tracekit 81* tracekit
91* vpn 82* vpn
92 83
84Transports:
85* UDP backend (need LIBRARY to support (de)fragmentation!)
86* HTTP backend
87* Testing:
88 + Testcases for set_quota, timeouts, disconnects, transmit_ready_cancel
89 + Better coverage of gnunet-service-transport (hello validation)
90 + direct test of plugins compliance to plugin API
91
92Databases:
93* sqlite, mysql & postgres backend
94
93 95
94 96
95Minor TODO items: 97Minor TODO items:
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index fefc6884a..3f7d099ce 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -38,6 +38,7 @@ extern "C"
38#endif 38#endif
39 39
40#include "gnunet_common.h" 40#include "gnunet_common.h"
41#include "gnunet_time_lib.h"
41 42
42/** 43/**
43 * A configuration object. 44 * A configuration object.
@@ -99,6 +100,17 @@ int GNUNET_CONFIGURATION_get_value_number (struct GNUNET_CONFIGURATION_Handle
99 unsigned long long *number); 100 unsigned long long *number);
100 101
101/** 102/**
103 * Get a configuration value that should be a relative time.
104 *
105 * @param time set to the time value stored in the configuration
106 * @return GNUNET_OK on success, GNUNET_SYSERR on error
107 */
108int GNUNET_CONFIGURATION_get_value_time (struct GNUNET_CONFIGURATION_Handle
109 *cfg, const char *section,
110 const char *option,
111 struct GNUNET_TIME_Relative *time);
112
113/**
102 * Test if we have a value for a particular option 114 * Test if we have a value for a particular option
103 * @return GNUNET_YES if so, GNUNET_NO if not. 115 * @return GNUNET_YES if so, GNUNET_NO if not.
104 */ 116 */
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 4413b0377..eacbdbf05 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -402,6 +402,24 @@ GNUNET_CONFIGURATION_get_value_number (struct GNUNET_CONFIGURATION_Handle
402} 402}
403 403
404int 404int
405GNUNET_CONFIGURATION_get_value_time (struct GNUNET_CONFIGURATION_Handle
406 *cfg, const char *section,
407 const char *option,
408 struct GNUNET_TIME_Relative *time)
409{
410 unsigned long long num;
411 int ret;
412
413 ret = GNUNET_CONFIGURATION_get_value_number (cfg,
414 section,
415 option,
416 &num);
417 if (ret == GNUNET_OK)
418 time->value = (uint64_t) num;
419 return ret;
420}
421
422int
405GNUNET_CONFIGURATION_get_value_string (struct GNUNET_CONFIGURATION_Handle 423GNUNET_CONFIGURATION_get_value_string (struct GNUNET_CONFIGURATION_Handle
406 *cfg, const char *section, 424 *cfg, const char *section,
407 const char *option, char **value) 425 const char *option, char **value)
diff --git a/src/util/service.c b/src/util/service.c
index 8d72a749a..732dbe9af 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -754,7 +754,7 @@ static int
754setup_service (struct GNUNET_SERVICE_Context *sctx) 754setup_service (struct GNUNET_SERVICE_Context *sctx)
755{ 755{
756 unsigned long long maxbuf; 756 unsigned long long maxbuf;
757 unsigned long long idleout; 757 struct GNUNET_TIME_Relative idleout;
758 char *hostname; 758 char *hostname;
759 unsigned long long port; 759 unsigned long long port;
760 int disablev6; 760 int disablev6;
@@ -768,12 +768,12 @@ setup_service (struct GNUNET_SERVICE_Context *sctx)
768 sctx->serviceName, "TIMEOUT")) 768 sctx->serviceName, "TIMEOUT"))
769 { 769 {
770 if (GNUNET_OK != 770 if (GNUNET_OK !=
771 GNUNET_CONFIGURATION_get_value_number (sctx->cfg, 771 GNUNET_CONFIGURATION_get_value_time (sctx->cfg,
772 sctx->serviceName, 772 sctx->serviceName,
773 "TIMEOUT", &idleout)) 773 "TIMEOUT", &idleout))
774 return GNUNET_SYSERR; 774 return GNUNET_SYSERR;
775 775
776 sctx->timeout.value = idleout; 776 sctx->timeout = idleout;
777 } 777 }
778 else 778 else
779 sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL; 779 sctx->timeout = GNUNET_TIME_UNIT_FOREVER_REL;