diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-06-18 14:09:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-06-18 14:09:55 +0000 |
commit | 200aaa0dd6813f19eb7ed67a0fdc301d091fc2d7 (patch) | |
tree | f89388586fbf00a3b7c985b2b28bb74abda3a364 /src/hostlist/gnunet-daemon-hostlist.c | |
parent | 640ae593fd34d27034f994a2e945a8942f1a4d5d (diff) | |
download | gnunet-200aaa0dd6813f19eb7ed67a0fdc301d091fc2d7.tar.gz gnunet-200aaa0dd6813f19eb7ed67a0fdc301d091fc2d7.zip |
localization
of scopes
Diffstat (limited to 'src/hostlist/gnunet-daemon-hostlist.c')
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist.c | 75 |
1 files changed, 31 insertions, 44 deletions
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index bbc0d7e08..300a767b5 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c | |||
@@ -87,40 +87,17 @@ static struct GNUNET_CORE_Handle *core; | |||
87 | /** | 87 | /** |
88 | * Handle to the hostlist client's advertisement handler | 88 | * Handle to the hostlist client's advertisement handler |
89 | */ | 89 | */ |
90 | static GNUNET_CORE_MessageCallback client_adv_handler = NULL; | 90 | static GNUNET_CORE_MessageCallback client_adv_handler; |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * Handle to hostlist client's connect handler | 93 | * Handle to hostlist client's connect handler |
94 | */ | 94 | */ |
95 | static GNUNET_CORE_ConnectEventHandler client_ch = NULL; | 95 | static GNUNET_CORE_ConnectEventHandler client_ch; |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Handle to hostlist client's disconnect handler | 98 | * Handle to hostlist client's disconnect handler |
99 | */ | 99 | */ |
100 | static GNUNET_CORE_DisconnectEventHandler client_dh = NULL; | 100 | static GNUNET_CORE_DisconnectEventHandler client_dh; |
101 | |||
102 | /** | ||
103 | * gnunet-daemon-hostlist command line options. | ||
104 | */ | ||
105 | static struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
106 | #if HAVE_MHD | ||
107 | { 'a', "advertise", NULL, | ||
108 | gettext_noop ("advertise our hostlist to other peers"), | ||
109 | GNUNET_NO, &GNUNET_GETOPT_set_one, &advertising }, | ||
110 | #endif | ||
111 | { 'b', "bootstrap", NULL, | ||
112 | gettext_noop ("bootstrap using hostlists (it is highly recommended that you always use this option)"), | ||
113 | GNUNET_NO, &GNUNET_GETOPT_set_one, &bootstrapping }, | ||
114 | { 'e', "enable-learning", NULL, | ||
115 | gettext_noop ("enable learning about hostlist servers from other peers"), | ||
116 | GNUNET_NO, &GNUNET_GETOPT_set_one, &learning}, | ||
117 | #if HAVE_MHD | ||
118 | { 'p', "provide-hostlist", NULL, | ||
119 | gettext_noop ("provide a hostlist server"), | ||
120 | GNUNET_NO, &GNUNET_GETOPT_set_one, &provide_hostlist}, | ||
121 | #endif | ||
122 | GNUNET_GETOPT_OPTION_END | ||
123 | }; | ||
124 | 101 | ||
125 | /** | 102 | /** |
126 | * A HOSTLIST_ADV message is used to exchange information about | 103 | * A HOSTLIST_ADV message is used to exchange information about |
@@ -253,22 +230,6 @@ cleaning_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
253 | } | 230 | } |
254 | } | 231 | } |
255 | 232 | ||
256 | /** | ||
257 | * List of handlers if we are learning. | ||
258 | */ | ||
259 | static struct GNUNET_CORE_MessageHandler learn_handlers[] = { | ||
260 | { &advertisement_handler, GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT, 0}, | ||
261 | { NULL, 0, 0 } | ||
262 | }; | ||
263 | |||
264 | |||
265 | /** | ||
266 | * List of handlers if we are not learning. | ||
267 | */ | ||
268 | static struct GNUNET_CORE_MessageHandler no_learn_handlers[] = { | ||
269 | { NULL, 0, 0 } | ||
270 | }; | ||
271 | |||
272 | 233 | ||
273 | /** | 234 | /** |
274 | * Main function that will be run. | 235 | * Main function that will be run. |
@@ -286,6 +247,13 @@ run (void *cls, | |||
286 | const char *cfgfile, | 247 | const char *cfgfile, |
287 | const struct GNUNET_CONFIGURATION_Handle * cfg) | 248 | const struct GNUNET_CONFIGURATION_Handle * cfg) |
288 | { | 249 | { |
250 | static const struct GNUNET_CORE_MessageHandler learn_handlers[] = { | ||
251 | { &advertisement_handler, GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT, 0}, | ||
252 | { NULL, 0, 0 } | ||
253 | }; | ||
254 | static const struct GNUNET_CORE_MessageHandler no_learn_handlers[] = { | ||
255 | { NULL, 0, 0 } | ||
256 | }; | ||
289 | if ( (! bootstrapping) && | 257 | if ( (! bootstrapping) && |
290 | (! learning) | 258 | (! learning) |
291 | #if HAVE_MHD | 259 | #if HAVE_MHD |
@@ -348,9 +316,28 @@ run (void *cls, | |||
348 | int | 316 | int |
349 | main (int argc, char *const *argv) | 317 | main (int argc, char *const *argv) |
350 | { | 318 | { |
351 | int ret; | 319 | static const struct GNUNET_GETOPT_CommandLineOption options[] = { |
352 | GNUNET_log_setup ("hostlist","DEBUG",NULL); | 320 | #if HAVE_MHD |
321 | { 'a', "advertise", NULL, | ||
322 | gettext_noop ("advertise our hostlist to other peers"), | ||
323 | GNUNET_NO, &GNUNET_GETOPT_set_one, &advertising }, | ||
324 | #endif | ||
325 | { 'b', "bootstrap", NULL, | ||
326 | gettext_noop ("bootstrap using hostlists (it is highly recommended that you always use this option)"), | ||
327 | GNUNET_NO, &GNUNET_GETOPT_set_one, &bootstrapping }, | ||
328 | { 'e', "enable-learning", NULL, | ||
329 | gettext_noop ("enable learning about hostlist servers from other peers"), | ||
330 | GNUNET_NO, &GNUNET_GETOPT_set_one, &learning}, | ||
331 | #if HAVE_MHD | ||
332 | { 'p', "provide-hostlist", NULL, | ||
333 | gettext_noop ("provide a hostlist server"), | ||
334 | GNUNET_NO, &GNUNET_GETOPT_set_one, &provide_hostlist}, | ||
335 | #endif | ||
336 | GNUNET_GETOPT_OPTION_END | ||
337 | }; | ||
353 | 338 | ||
339 | int ret; | ||
340 | GNUNET_log_setup ("hostlist", "WARNING", NULL); | ||
354 | ret = (GNUNET_OK == | 341 | ret = (GNUNET_OK == |
355 | GNUNET_PROGRAM_run (argc, | 342 | GNUNET_PROGRAM_run (argc, |
356 | argv, | 343 | argv, |