diff options
Diffstat (limited to 'src/setup/gnunet-setup-options.c')
-rw-r--r-- | src/setup/gnunet-setup-options.c | 2580 |
1 files changed, 2580 insertions, 0 deletions
diff --git a/src/setup/gnunet-setup-options.c b/src/setup/gnunet-setup-options.c new file mode 100644 index 00000000..ae2c436e --- /dev/null +++ b/src/setup/gnunet-setup-options.c | |||
@@ -0,0 +1,2580 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | (C) 2010, 2011 Christian Grothoff (and other contributing authors) | ||
4 | |||
5 | GNUnet is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 2, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with GNUnet; see the file COPYING. If not, write to the | ||
17 | Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
18 | Boston, MA 02111-1307, USA. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file src/gnunet-setup-options.c | ||
23 | * @brief configuration details | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "gnunet-setup-options.h" | ||
27 | #include <gnunet/gnunet_util_lib.h> | ||
28 | #include <gdk/gdkkeysyms.h> | ||
29 | |||
30 | /** | ||
31 | * Regular expression for YES | ||
32 | */ | ||
33 | #define REX_YES "^YES$" | ||
34 | |||
35 | /** | ||
36 | * Regular expression for NO | ||
37 | */ | ||
38 | #define REX_NO "^NO$" | ||
39 | |||
40 | |||
41 | /** | ||
42 | * Initialize a toggle button based on an options 'yes/no' value. | ||
43 | * | ||
44 | * @param cls closure | ||
45 | * @param section section with the value | ||
46 | * @param option option name | ||
47 | * @param value value as a string | ||
48 | * @param widget widget to initialize | ||
49 | * @param cfg configuration handle | ||
50 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
51 | */ | ||
52 | static int | ||
53 | load_yes_no (const void *cls, | ||
54 | const char *section, | ||
55 | const char *option, | ||
56 | const char *value, | ||
57 | GObject *widget, | ||
58 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
59 | { | ||
60 | GtkToggleButton *button; | ||
61 | |||
62 | button = GTK_TOGGLE_BUTTON (widget); | ||
63 | if (button == NULL) | ||
64 | return GNUNET_SYSERR; | ||
65 | gtk_toggle_button_set_active (button, | ||
66 | (0 == strcasecmp (value, "YES")) ? TRUE : FALSE); | ||
67 | return GNUNET_OK; | ||
68 | } | ||
69 | |||
70 | |||
71 | /** | ||
72 | * Set a yes/no option based on a toggle button. | ||
73 | * | ||
74 | * @param cls closure | ||
75 | * @param section section with the value | ||
76 | * @param option option name | ||
77 | * @param widget widget to initialize | ||
78 | * @param cfg configuration handle to update | ||
79 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
80 | */ | ||
81 | static int | ||
82 | save_yes_no (const void *cls, | ||
83 | const char *section, | ||
84 | const char *option, | ||
85 | GObject *widget, | ||
86 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
87 | { | ||
88 | GtkToggleButton *button; | ||
89 | gboolean mode; | ||
90 | |||
91 | button = GTK_TOGGLE_BUTTON (widget); | ||
92 | if (button == NULL) | ||
93 | return GNUNET_SYSERR; | ||
94 | mode = gtk_toggle_button_get_active (button); | ||
95 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
96 | section, option, | ||
97 | mode == TRUE ? "YES" : "NO"); | ||
98 | return GNUNET_OK; | ||
99 | } | ||
100 | |||
101 | |||
102 | /** | ||
103 | * Initialize a GtkFileChooser based on a filename option. | ||
104 | * | ||
105 | * @param cls closure | ||
106 | * @param section section with the value | ||
107 | * @param option option name | ||
108 | * @param value value as a string | ||
109 | * @param widget widget to initialize | ||
110 | * @param cfg configuration handle | ||
111 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
112 | */ | ||
113 | static int | ||
114 | load_filename (const void *cls, | ||
115 | const char *section, | ||
116 | const char *option, | ||
117 | const char *value, | ||
118 | GObject *widget, | ||
119 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
120 | { | ||
121 | GtkFileChooser *chooser; | ||
122 | |||
123 | chooser = GTK_FILE_CHOOSER (widget); | ||
124 | if (chooser == NULL) | ||
125 | return GNUNET_SYSERR; | ||
126 | gtk_file_chooser_set_filename (chooser, | ||
127 | value); | ||
128 | return GNUNET_OK; | ||
129 | } | ||
130 | |||
131 | |||
132 | /** | ||
133 | * Set filename option based on a file chooser. | ||
134 | * | ||
135 | * @param cls closure | ||
136 | * @param section section with the value | ||
137 | * @param option option name | ||
138 | * @param widget widget to initialize | ||
139 | * @param cfg configuration handle to update | ||
140 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
141 | */ | ||
142 | static int | ||
143 | save_filename (const void *cls, | ||
144 | const char *section, | ||
145 | const char *option, | ||
146 | GObject *widget, | ||
147 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
148 | { | ||
149 | GtkFileChooser *chooser; | ||
150 | gchar *fn; | ||
151 | |||
152 | chooser = GTK_FILE_CHOOSER (widget); | ||
153 | if (chooser == NULL) | ||
154 | return GNUNET_SYSERR; | ||
155 | fn = gtk_file_chooser_get_filename (chooser); | ||
156 | if (fn == NULL) | ||
157 | fn = g_strdup (""); | ||
158 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
159 | section, option, | ||
160 | fn); | ||
161 | g_free (fn); | ||
162 | return GNUNET_OK; | ||
163 | } | ||
164 | |||
165 | |||
166 | /** | ||
167 | * Initialize a GtkEntry based on a text option. | ||
168 | * | ||
169 | * @param cls closure | ||
170 | * @param section section with the value | ||
171 | * @param option option name | ||
172 | * @param value value as a string | ||
173 | * @param widget widget to initialize | ||
174 | * @param cfg configuration handle | ||
175 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
176 | */ | ||
177 | static int | ||
178 | load_text (const void *cls, | ||
179 | const char *section, | ||
180 | const char *option, | ||
181 | const char *value, | ||
182 | GObject *widget, | ||
183 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
184 | { | ||
185 | GtkEntry *entry; | ||
186 | |||
187 | entry = GTK_ENTRY (widget); | ||
188 | if (entry == NULL) | ||
189 | return GNUNET_SYSERR; | ||
190 | gtk_entry_set_text (entry, | ||
191 | value); | ||
192 | return GNUNET_OK; | ||
193 | } | ||
194 | |||
195 | |||
196 | /** | ||
197 | * Set text option based on a GtkEntry. | ||
198 | * | ||
199 | * @param cls closure | ||
200 | * @param section section with the value | ||
201 | * @param option option name | ||
202 | * @param widget widget to initialize | ||
203 | * @param cfg configuration handle to update | ||
204 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
205 | */ | ||
206 | static int | ||
207 | save_text (const void *cls, | ||
208 | const char *section, | ||
209 | const char *option, | ||
210 | GObject *widget, | ||
211 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
212 | { | ||
213 | GtkEntry *entry; | ||
214 | const gchar *txt; | ||
215 | |||
216 | entry = GTK_ENTRY (widget); | ||
217 | if (entry == NULL) | ||
218 | return GNUNET_SYSERR; | ||
219 | txt = gtk_entry_get_text (entry); | ||
220 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
221 | section, option, | ||
222 | txt); | ||
223 | return GNUNET_OK; | ||
224 | } | ||
225 | |||
226 | |||
227 | #if 0 | ||
228 | /** | ||
229 | * Initialize a GtkComboBox based on a text option. | ||
230 | * | ||
231 | * @param cls closure | ||
232 | * @param section section with the value | ||
233 | * @param option option name | ||
234 | * @param value value as a string | ||
235 | * @param widget widget to initialize | ||
236 | * @param cfg configuration handle | ||
237 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
238 | */ | ||
239 | static int | ||
240 | load_combo_text (const void *cls, | ||
241 | const char *section, | ||
242 | const char *option, | ||
243 | const char *value, | ||
244 | GObject *widget, | ||
245 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
246 | { | ||
247 | GtkComboBoxText *cb; | ||
248 | |||
249 | cb = GTK_COMBO_BOX_TEXT (widget); | ||
250 | if (NULL == cb) | ||
251 | return GNUNET_SYSERR; | ||
252 | gtk_combo_box_text_append_text (cb, value); | ||
253 | return GNUNET_OK; | ||
254 | } | ||
255 | |||
256 | |||
257 | /** | ||
258 | * Set text option based on a GtkComboBox. | ||
259 | * | ||
260 | * @param cls closure | ||
261 | * @param section section with the value | ||
262 | * @param option option name | ||
263 | * @param widget widget to initialize | ||
264 | * @param cfg configuration handle to update | ||
265 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
266 | */ | ||
267 | static int | ||
268 | save_combo_text (const void *cls, | ||
269 | const char *section, | ||
270 | const char *option, | ||
271 | GObject *widget, | ||
272 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
273 | { | ||
274 | GtkComboBox *cb; | ||
275 | gchar *c; | ||
276 | |||
277 | cb = GTK_COMBO_BOX (widget); | ||
278 | if (NULL == cb) | ||
279 | return GNUNET_SYSERR; | ||
280 | c = gtk_combo_box_get_active_text (cb); | ||
281 | GNUNET_CONFIGURATION_set_value_string (cfg, section, option, c); | ||
282 | g_free (c); | ||
283 | return GNUNET_OK; | ||
284 | } | ||
285 | #endif | ||
286 | |||
287 | |||
288 | /** | ||
289 | * Initialize a GtkSpinButton based on a numeric option. | ||
290 | * | ||
291 | * @param cls closure | ||
292 | * @param section section with the value | ||
293 | * @param option option name | ||
294 | * @param value value as a string | ||
295 | * @param widget widget to initialize | ||
296 | * @param cfg configuration handle | ||
297 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
298 | */ | ||
299 | static int | ||
300 | load_number (const void *cls, | ||
301 | const char *section, | ||
302 | const char *option, | ||
303 | const char *value, | ||
304 | GObject *widget, | ||
305 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
306 | { | ||
307 | GtkSpinButton *spin; | ||
308 | unsigned int number; | ||
309 | |||
310 | spin = GTK_SPIN_BUTTON (widget); | ||
311 | if (spin == NULL) | ||
312 | return GNUNET_SYSERR; | ||
313 | if (1 != sscanf (value, "%u", &number)) | ||
314 | return GNUNET_SYSERR; | ||
315 | gtk_spin_button_set_value (spin, | ||
316 | number); | ||
317 | return GNUNET_OK; | ||
318 | } | ||
319 | |||
320 | |||
321 | /** | ||
322 | * Set numeric option based on a spin button. | ||
323 | * | ||
324 | * @param cls closure | ||
325 | * @param section section with the value | ||
326 | * @param option option name | ||
327 | * @param widget widget to initialize | ||
328 | * @param cfg configuration handle to update | ||
329 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
330 | */ | ||
331 | static int | ||
332 | save_number (const void *cls, | ||
333 | const char *section, | ||
334 | const char *option, | ||
335 | GObject *widget, | ||
336 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
337 | { | ||
338 | GtkSpinButton *spin; | ||
339 | |||
340 | spin = GTK_SPIN_BUTTON (widget); | ||
341 | if (spin == NULL) | ||
342 | return GNUNET_SYSERR; | ||
343 | GNUNET_CONFIGURATION_set_value_number (cfg, | ||
344 | section, option, | ||
345 | gtk_spin_button_get_value_as_int (spin)); | ||
346 | return GNUNET_OK; | ||
347 | } | ||
348 | |||
349 | |||
350 | /** | ||
351 | * Initialize a toggle button based on the existence of a word | ||
352 | * in an option value. | ||
353 | * | ||
354 | * @param cls word to test for (conat char *) | ||
355 | * @param section section with the value | ||
356 | * @param option option name | ||
357 | * @param value value as a string | ||
358 | * @param widget widget to initialize | ||
359 | * @param cfg configuration handle | ||
360 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
361 | */ | ||
362 | static int | ||
363 | load_option_list (const void *cls, | ||
364 | const char *section, | ||
365 | const char *option, | ||
366 | const char *value, | ||
367 | GObject *widget, | ||
368 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
369 | { | ||
370 | const char *word = cls; | ||
371 | char *t; | ||
372 | char *w; | ||
373 | GtkToggleButton *button; | ||
374 | int found; | ||
375 | |||
376 | button = GTK_TOGGLE_BUTTON (widget); | ||
377 | if (button == NULL) | ||
378 | return GNUNET_SYSERR; | ||
379 | found = GNUNET_NO; | ||
380 | t = GNUNET_strdup (value); | ||
381 | w = strtok (t, " "); | ||
382 | while (w != NULL) | ||
383 | { | ||
384 | if (0 == strcmp (w, word)) | ||
385 | { | ||
386 | found = GNUNET_YES; | ||
387 | break; | ||
388 | } | ||
389 | w = strtok (NULL, " "); | ||
390 | } | ||
391 | GNUNET_free (t); | ||
392 | gtk_toggle_button_set_active (button, | ||
393 | found); | ||
394 | return GNUNET_OK; | ||
395 | } | ||
396 | |||
397 | |||
398 | /** | ||
399 | * Add or remove a word from a sentence based on a toggle button's yes/no value. | ||
400 | * | ||
401 | * @param cls word to add or remove for (conat char *) | ||
402 | * @param section section with the value | ||
403 | * @param option option name | ||
404 | * @param widget widget to initialize | ||
405 | * @param cfg configuration handle to update | ||
406 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
407 | */ | ||
408 | static int | ||
409 | save_option_list (const void *cls, | ||
410 | const char *section, | ||
411 | const char *option, | ||
412 | GObject *widget, | ||
413 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
414 | { | ||
415 | const char *word = cls; | ||
416 | GtkToggleButton *button; | ||
417 | gboolean mode; | ||
418 | |||
419 | button = GTK_TOGGLE_BUTTON (widget); | ||
420 | if (button == NULL) | ||
421 | return GNUNET_SYSERR; | ||
422 | mode = gtk_toggle_button_get_active (button); | ||
423 | if (mode == TRUE) | ||
424 | GNUNET_CONFIGURATION_append_value_filename (cfg, | ||
425 | section, | ||
426 | option, | ||
427 | word); | ||
428 | else | ||
429 | GNUNET_CONFIGURATION_remove_value_filename (cfg, | ||
430 | section, | ||
431 | option, | ||
432 | word); | ||
433 | return GNUNET_OK; | ||
434 | } | ||
435 | |||
436 | |||
437 | /** | ||
438 | * User pressed a key in a sensitive tree view with a list store. | ||
439 | * Check if it was the 'delete' key and if so remove the selected | ||
440 | * row. | ||
441 | * | ||
442 | * @param tv tree view emitting the signal | ||
443 | * @param event key stroke data | ||
444 | * @param user_data not used | ||
445 | * @return TRUE to stop other handlers from being invoked | ||
446 | */ | ||
447 | gboolean | ||
448 | GNUNET_setup_treeview_key_press_event_cb (GtkTreeView *tv, | ||
449 | GdkEventKey *event, | ||
450 | gpointer user_data) | ||
451 | { | ||
452 | GtkListStore *ls; | ||
453 | GtkTreeModel *tm; | ||
454 | GtkTreeSelection *sel; | ||
455 | GtkTreeIter iter; | ||
456 | gboolean editable; | ||
457 | |||
458 | if ( (event->type != GDK_KEY_PRESS) || | ||
459 | (event->state != 0) || | ||
460 | (event->keyval != GDK_Delete) ) | ||
461 | return FALSE; | ||
462 | ls = GTK_LIST_STORE (gtk_tree_view_get_model (tv)); | ||
463 | if (ls == NULL) | ||
464 | { | ||
465 | GNUNET_break (0); | ||
466 | return FALSE; | ||
467 | } | ||
468 | sel = gtk_tree_view_get_selection (tv); | ||
469 | if (TRUE != | ||
470 | gtk_tree_selection_get_selected (sel, | ||
471 | &tm, | ||
472 | &iter)) | ||
473 | return FALSE; | ||
474 | gtk_tree_model_get (tm, &iter, 1, &editable, -1); | ||
475 | if (TRUE == editable) | ||
476 | return FALSE; /* likely currently editing... */ | ||
477 | gtk_list_store_remove (ls, &iter); | ||
478 | gtk_tree_model_get_iter_first (tm, &iter); | ||
479 | gtk_tree_selection_select_iter (sel, &iter); | ||
480 | return FALSE; | ||
481 | } | ||
482 | |||
483 | |||
484 | /** | ||
485 | * Initialize a GtkListStore by tokenizing the value into strings. | ||
486 | * | ||
487 | * @param cls closure (unused) | ||
488 | * @param section section with the value | ||
489 | * @param option option name | ||
490 | * @param value value as a string | ||
491 | * @param widget widget to initialize | ||
492 | * @param cfg configuration handle | ||
493 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
494 | */ | ||
495 | static int | ||
496 | load_string_list_store (const void *cls, | ||
497 | const char *section, | ||
498 | const char *option, | ||
499 | const char *value, | ||
500 | GObject *widget, | ||
501 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
502 | { | ||
503 | char *t; | ||
504 | char *w; | ||
505 | GtkListStore *ls; | ||
506 | GtkTreeIter iter; | ||
507 | |||
508 | ls = GTK_LIST_STORE (widget); | ||
509 | if (ls == NULL) | ||
510 | return GNUNET_SYSERR; | ||
511 | t = GNUNET_strdup (value); | ||
512 | w = strtok (t, " "); | ||
513 | while (w != NULL) | ||
514 | { | ||
515 | gtk_list_store_insert_with_values (ls, | ||
516 | &iter, | ||
517 | G_MAXINT, | ||
518 | 0, w, | ||
519 | 1, FALSE, | ||
520 | -1); | ||
521 | w = strtok (NULL, " "); | ||
522 | } | ||
523 | GNUNET_free (t); | ||
524 | gtk_list_store_insert_with_values (ls, | ||
525 | &iter, | ||
526 | G_MAXINT, | ||
527 | 0, "", | ||
528 | 1, TRUE, | ||
529 | -1); | ||
530 | return GNUNET_OK; | ||
531 | } | ||
532 | |||
533 | |||
534 | /** | ||
535 | * The GtkCellRenderer has emmited the 'edited' signal. | ||
536 | * | ||
537 | * | ||
538 | * @param cls closure (unused) | ||
539 | * @param section section with the value (NULL) | ||
540 | * @param option option name (NULL) | ||
541 | * @param widget the cell renderer | ||
542 | * @param cfg configuration handle to update | ||
543 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
544 | */ | ||
545 | static int | ||
546 | save_string_list_store (const void *cls, | ||
547 | const char *section, | ||
548 | const char *option, | ||
549 | GObject *widget, | ||
550 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
551 | { | ||
552 | GtkTreeModel *tm; | ||
553 | GtkTreeIter iter; | ||
554 | char *value; | ||
555 | char *n; | ||
556 | gchar *val; | ||
557 | |||
558 | tm = GTK_TREE_MODEL (widget); | ||
559 | if (tm == NULL) | ||
560 | return GNUNET_SYSERR; | ||
561 | value = NULL; | ||
562 | if (TRUE == gtk_tree_model_get_iter_first (tm, &iter)) | ||
563 | { | ||
564 | do | ||
565 | { | ||
566 | gtk_tree_model_get (tm, | ||
567 | &iter, | ||
568 | 0, &val, | ||
569 | -1); | ||
570 | if (value == NULL) | ||
571 | { | ||
572 | value = GNUNET_strdup (val); | ||
573 | } | ||
574 | else | ||
575 | { | ||
576 | GNUNET_asprintf (&n, | ||
577 | "%s %s", | ||
578 | value, | ||
579 | val); | ||
580 | GNUNET_free (value); | ||
581 | value = n; | ||
582 | } | ||
583 | g_free (val); | ||
584 | } | ||
585 | while (TRUE == gtk_tree_model_iter_next (tm, &iter)); | ||
586 | } | ||
587 | if (value == NULL) | ||
588 | value = GNUNET_strdup (""); | ||
589 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
590 | section, | ||
591 | option, | ||
592 | value); | ||
593 | GNUNET_free (value); | ||
594 | return GNUNET_OK; | ||
595 | } | ||
596 | |||
597 | |||
598 | /** | ||
599 | * Check if the section represents a DNS entry and then update the | ||
600 | * GtkListStore accordingly. | ||
601 | * | ||
602 | * @param cls the list store to modify | ||
603 | * @param section name of the section | ||
604 | */ | ||
605 | static void | ||
606 | add_dns_entry_to_list_store (void *cls, const char *section) | ||
607 | { | ||
608 | GtkListStore *ls = cls; | ||
609 | GtkTreeIter iter; | ||
610 | char *sld; | ||
611 | char *hostname; | ||
612 | char *hostport; | ||
613 | char *redirect; | ||
614 | char *cpy; | ||
615 | gboolean udp; | ||
616 | |||
617 | if (NULL == section) | ||
618 | { | ||
619 | gtk_list_store_insert_with_values (ls, | ||
620 | &iter, | ||
621 | G_MAXINT, | ||
622 | 0, "", | ||
623 | 1, (guint) 80, | ||
624 | 2, (guint) 8080, | ||
625 | 3, "localhost", | ||
626 | 4, "tcp", | ||
627 | -1); | ||
628 | return; | ||
629 | } | ||
630 | |||
631 | if ( (8 > strlen (section)) || | ||
632 | (0 != strcmp (".gnunet.", section + ((strlen (section) - 8)))) ) | ||
633 | return; | ||
634 | sld = GNUNET_strdup (section); | ||
635 | sld[strlen (section) - 8] = '\0'; | ||
636 | udp = FALSE; | ||
637 | do | ||
638 | { | ||
639 | if (GNUNET_OK == | ||
640 | GNUNET_CONFIGURATION_get_value_string (cfg, section, | ||
641 | (TRUE == udp) | ||
642 | ? "UDP_REDIRECTS" | ||
643 | : "TCP_REDIRECTS", | ||
644 | &cpy)) | ||
645 | { | ||
646 | for (redirect = strtok (cpy, " "); redirect != NULL; | ||
647 | redirect = strtok (NULL, " ")) | ||
648 | { | ||
649 | if (NULL == (hostname = strstr (redirect, ":"))) | ||
650 | { | ||
651 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
652 | _("Option `%s' is not formatted correctly!\n"), | ||
653 | redirect); | ||
654 | continue; | ||
655 | } | ||
656 | hostname[0] = '\0'; | ||
657 | hostname++; | ||
658 | if (NULL == (hostport = strstr (hostname, ":"))) | ||
659 | { | ||
660 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
661 | _("Option `%s' is not formatted correctly!\n"), | ||
662 | redirect); | ||
663 | continue; | ||
664 | } | ||
665 | hostport[0] = '\0'; | ||
666 | hostport++; | ||
667 | |||
668 | int local_port = atoi (redirect); | ||
669 | if (!((local_port > 0) && (local_port < 65536))) | ||
670 | { | ||
671 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
672 | _("`%s' is not a valid port number!\n"), | ||
673 | redirect); | ||
674 | continue; | ||
675 | } | ||
676 | int host_port = atoi (hostport); | ||
677 | if (!((host_port > 0) && (host_port < 65536))) | ||
678 | { | ||
679 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
680 | _("`%s' is not a valid port number!\n"), | ||
681 | hostport); | ||
682 | continue; | ||
683 | } | ||
684 | gtk_list_store_insert_with_values (ls, | ||
685 | &iter, | ||
686 | 0, | ||
687 | 0, sld, | ||
688 | 1, (guint) local_port, | ||
689 | 2, (guint) host_port, | ||
690 | 3, hostname, | ||
691 | 4, (TRUE == udp) ? "udp" : "tcp", | ||
692 | -1); | ||
693 | } | ||
694 | GNUNET_free (cpy); | ||
695 | } | ||
696 | udp = !udp; | ||
697 | } | ||
698 | while (udp != FALSE); | ||
699 | GNUNET_free (sld); | ||
700 | } | ||
701 | |||
702 | |||
703 | /** | ||
704 | * Initialize the GtkListModel with the VPN's DNS service specification. | ||
705 | * | ||
706 | * @param cls NULL | ||
707 | * @param section section with the value (NULL) | ||
708 | * @param option option name (NULL) | ||
709 | * @param value value as a string (NULL) | ||
710 | * @param widget widget to initialize (the GtkTreeView) | ||
711 | * @param cfg configuration handle | ||
712 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
713 | */ | ||
714 | static int | ||
715 | load_vpn_dns_configuration (const void *cls, | ||
716 | const char *section, | ||
717 | const char *option, | ||
718 | const char *value, | ||
719 | GObject *widget, | ||
720 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
721 | { | ||
722 | GtkTreeView *tv; | ||
723 | GtkListStore *ls; | ||
724 | |||
725 | tv = GTK_TREE_VIEW (widget); | ||
726 | if (tv == NULL) | ||
727 | { | ||
728 | GNUNET_break (0); | ||
729 | return GNUNET_SYSERR; | ||
730 | } | ||
731 | ls = GTK_LIST_STORE (gtk_tree_view_get_model (tv)); | ||
732 | GNUNET_CONFIGURATION_iterate_sections (cfg, | ||
733 | &add_dns_entry_to_list_store, | ||
734 | ls); | ||
735 | /* finally, add empty entry */ | ||
736 | add_dns_entry_to_list_store (ls, NULL); | ||
737 | return GNUNET_OK; | ||
738 | } | ||
739 | |||
740 | |||
741 | /** | ||
742 | * Records we use to build DNS information lists. | ||
743 | */ | ||
744 | struct DnsInfo | ||
745 | { | ||
746 | struct DnsInfo *next; | ||
747 | char *section; | ||
748 | char *altnames; | ||
749 | char *tcpred; | ||
750 | char *udpred; | ||
751 | unsigned long long ttl; | ||
752 | }; | ||
753 | |||
754 | |||
755 | /** | ||
756 | * Function called for each section in the configuration. | ||
757 | * Gather existing ttl, section names and altnames. | ||
758 | * | ||
759 | * @param cls 'struct DnsInfo**' to create | ||
760 | * @param section name of a section in the configuration | ||
761 | */ | ||
762 | static void | ||
763 | collect_dns_sections (void *cls, | ||
764 | const char *section) | ||
765 | { | ||
766 | struct DnsInfo **base = cls; | ||
767 | struct DnsInfo *pos; | ||
768 | |||
769 | if ( (8 > strlen (section)) || | ||
770 | (0 != strcmp (".gnunet.", section + ((strlen (section) - 8)))) ) | ||
771 | return; | ||
772 | pos = GNUNET_malloc (sizeof (struct DnsInfo)); | ||
773 | pos->section = GNUNET_strdup (section); | ||
774 | if (GNUNET_OK != | ||
775 | GNUNET_CONFIGURATION_get_value_number (cfg, section, "TTL", &pos->ttl)) | ||
776 | pos->ttl = 3600000; | ||
777 | if (GNUNET_OK != | ||
778 | GNUNET_CONFIGURATION_get_value_string (cfg, section, "ALTERNATIVE_NAMES", &pos->altnames)) | ||
779 | pos->altnames = NULL; | ||
780 | pos->tcpred = GNUNET_strdup (""); | ||
781 | pos->udpred = GNUNET_strdup (""); | ||
782 | pos->next = *base; | ||
783 | *base = pos; | ||
784 | } | ||
785 | |||
786 | |||
787 | /** | ||
788 | * Function called for each section in the configuration. | ||
789 | * Removes those ending in '.gnunet.'. | ||
790 | * | ||
791 | * @param cls unused | ||
792 | * @param section name of a section in the configuration | ||
793 | */ | ||
794 | static void | ||
795 | remove_dns_sections (void *cls, | ||
796 | const char *section) | ||
797 | { | ||
798 | if ( (8 > strlen (section)) || | ||
799 | (0 != strcmp (".gnunet.", section + ((strlen (section) - 8)))) ) | ||
800 | return; | ||
801 | GNUNET_CONFIGURATION_remove_section (cfg, section); | ||
802 | } | ||
803 | |||
804 | |||
805 | /** | ||
806 | * Given the list store and the data in it, update the | ||
807 | * configuration file accordingly. | ||
808 | * | ||
809 | * @param tm model to use | ||
810 | */ | ||
811 | static void | ||
812 | update_vpn_dns_configuration (GtkTreeModel *tm) | ||
813 | { | ||
814 | GtkTreeIter iter; | ||
815 | gchar *hostname; | ||
816 | guint srcport; | ||
817 | guint targetport; | ||
818 | gchar *targethost; | ||
819 | gchar *tcpudp; | ||
820 | char *tmp; | ||
821 | struct DnsInfo *head; | ||
822 | struct DnsInfo *pos; | ||
823 | |||
824 | head = NULL; | ||
825 | GNUNET_CONFIGURATION_iterate_sections (cfg, | ||
826 | &collect_dns_sections, | ||
827 | &head); | ||
828 | if (TRUE == | ||
829 | gtk_tree_model_get_iter_first (tm, &iter)) | ||
830 | do | ||
831 | { | ||
832 | gtk_tree_model_get (tm, &iter, | ||
833 | 0, &hostname, | ||
834 | 1, &srcport, | ||
835 | 2, &targetport, | ||
836 | 3, &targethost, | ||
837 | 4, &tcpudp, | ||
838 | -1); | ||
839 | if (0 != strlen (hostname)) | ||
840 | { | ||
841 | pos = head; | ||
842 | GNUNET_asprintf (&tmp, | ||
843 | "%s.gnunet.", | ||
844 | hostname); | ||
845 | while ( (NULL != pos) && | ||
846 | (0 != strcasecmp (tmp, pos->section)) ) | ||
847 | pos = pos->next; | ||
848 | if (pos == NULL) | ||
849 | { | ||
850 | pos = GNUNET_malloc (sizeof (struct DnsInfo)); | ||
851 | pos->section = tmp; | ||
852 | pos->ttl = 3600000; | ||
853 | pos->altnames = NULL; | ||
854 | pos->tcpred = GNUNET_strdup (""); | ||
855 | pos->udpred = GNUNET_strdup (""); | ||
856 | pos->next = head; | ||
857 | head = pos; | ||
858 | } | ||
859 | else | ||
860 | { | ||
861 | GNUNET_free (tmp); | ||
862 | } | ||
863 | |||
864 | GNUNET_asprintf (&tmp, | ||
865 | "%u:%s:%u %s", | ||
866 | srcport, | ||
867 | targethost, | ||
868 | targetport, | ||
869 | (0 == strcasecmp ("tcp", tcpudp)) ? pos->tcpred : pos->udpred); | ||
870 | if (0 == strcasecmp ("tcp", tcpudp)) | ||
871 | { | ||
872 | GNUNET_free (pos->tcpred); | ||
873 | pos->tcpred = tmp; | ||
874 | } | ||
875 | else | ||
876 | { | ||
877 | GNUNET_free (pos->udpred); | ||
878 | pos->udpred = tmp; | ||
879 | } | ||
880 | } | ||
881 | g_free (tcpudp); | ||
882 | g_free (hostname); | ||
883 | g_free (targethost); | ||
884 | } | ||
885 | while (TRUE == gtk_tree_model_iter_next (tm, &iter)); | ||
886 | GNUNET_CONFIGURATION_iterate_sections (cfg, | ||
887 | &remove_dns_sections, | ||
888 | NULL); | ||
889 | while (NULL != head) | ||
890 | { | ||
891 | pos = head; | ||
892 | head = pos->next; | ||
893 | if (pos->altnames != NULL) | ||
894 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
895 | pos->section, | ||
896 | "ALTERNATIVE_NAMES", | ||
897 | pos->altnames); | ||
898 | if (strlen (pos->udpred) > 0) | ||
899 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
900 | pos->section, | ||
901 | "UDP_REDIRECTS", | ||
902 | pos->udpred); | ||
903 | if (strlen (pos->tcpred) > 0) | ||
904 | GNUNET_CONFIGURATION_set_value_string (cfg, | ||
905 | pos->section, | ||
906 | "TCP_REDIRECTS", | ||
907 | pos->tcpred); | ||
908 | GNUNET_CONFIGURATION_set_value_number (cfg, | ||
909 | pos->section, | ||
910 | "TTL", | ||
911 | pos->ttl); | ||
912 | GNUNET_free_non_null (pos->altnames); | ||
913 | GNUNET_free (pos->tcpred); | ||
914 | GNUNET_free (pos->udpred); | ||
915 | GNUNET_free (pos->section); | ||
916 | GNUNET_free (pos); | ||
917 | } | ||
918 | } | ||
919 | |||
920 | |||
921 | /** | ||
922 | * The user has edited the DNS name of a service we're offering. | ||
923 | * Update the GtkTreeModel (at the given path) and update the | ||
924 | * respective service entry in the configuration file. Finally, | ||
925 | * if the edited path is for a "fresh" entry, create another empty | ||
926 | * one at the bottom. If the hostname was set to empty, remove | ||
927 | * the entire entry from the configuration and the model. | ||
928 | * | ||
929 | * @param renderer GtkCellRendererText that changed | ||
930 | * @param path GtkTreePath identifying where in the Model the change is | ||
931 | * @param new_text the new text that was stored in the line | ||
932 | * @param user_data NULL | ||
933 | */ | ||
934 | static void | ||
935 | save_vpn_dns_service_dnsname (GtkCellRendererText *renderer, | ||
936 | gchar *path, | ||
937 | gchar *new_text, | ||
938 | gpointer user_data) | ||
939 | { | ||
940 | GtkTreeModel *tm; | ||
941 | GtkListStore *ls; | ||
942 | GtkTreeIter iter; | ||
943 | gchar *old; | ||
944 | |||
945 | tm = GTK_TREE_MODEL (gtk_builder_get_object (builder, | ||
946 | "vpn_dns_config_liststore")); | ||
947 | if (NULL == tm) | ||
948 | { | ||
949 | GNUNET_break (0); | ||
950 | return; | ||
951 | } | ||
952 | ls = GTK_LIST_STORE (tm); | ||
953 | if (NULL == ls) | ||
954 | { | ||
955 | GNUNET_break (0); | ||
956 | return; | ||
957 | } | ||
958 | if (TRUE != gtk_tree_model_get_iter_from_string (tm, &iter, path)) | ||
959 | { | ||
960 | GNUNET_break (0); | ||
961 | return; | ||
962 | } | ||
963 | gtk_tree_model_get (tm, &iter, | ||
964 | 0, &old, | ||
965 | -1); | ||
966 | if ( (0 != strlen (old)) && | ||
967 | (0 == strlen (new_text)) ) | ||
968 | { | ||
969 | /* deletion */ | ||
970 | gtk_list_store_remove (ls, &iter); | ||
971 | g_free (old); | ||
972 | return; | ||
973 | } | ||
974 | /* update model */ | ||
975 | gtk_list_store_set (ls, &iter, | ||
976 | 0, new_text, | ||
977 | -1); | ||
978 | /* update configuration */ | ||
979 | update_vpn_dns_configuration (tm); | ||
980 | if ( (0 == strlen (old)) && | ||
981 | (0 != strlen (new_text)) ) | ||
982 | { | ||
983 | /* need another empty entry at the end for future expansion */ | ||
984 | add_dns_entry_to_list_store (GTK_LIST_STORE (tm), NULL); | ||
985 | } | ||
986 | g_free (old); | ||
987 | } | ||
988 | |||
989 | |||
990 | /** | ||
991 | * Initialize the GtkListModel with the VPN's DNS service specification. | ||
992 | * | ||
993 | * @param cls NULL | ||
994 | * @param section section with the value (NULL) | ||
995 | * @param option option name (NULL) | ||
996 | * @param widget widget to initialize (the GtkTreeView) | ||
997 | * @param cfg configuration handle | ||
998 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
999 | */ | ||
1000 | static int | ||
1001 | vpn_dns_service_dnsname_install_edited_handler (const void *cls, | ||
1002 | const char *section, | ||
1003 | const char *option, | ||
1004 | GObject *widget, | ||
1005 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
1006 | { | ||
1007 | static int once; | ||
1008 | GtkCellRendererText *rt; | ||
1009 | |||
1010 | rt = GTK_CELL_RENDERER_TEXT(widget); | ||
1011 | if (NULL == rt) | ||
1012 | return GNUNET_SYSERR; | ||
1013 | if (0 != once++) | ||
1014 | return GNUNET_OK; | ||
1015 | g_signal_connect (rt, | ||
1016 | "edited", | ||
1017 | G_CALLBACK (&save_vpn_dns_service_dnsname), | ||
1018 | NULL); | ||
1019 | return GNUNET_OK; | ||
1020 | } | ||
1021 | |||
1022 | |||
1023 | /** | ||
1024 | * The user has edited the DNS name of a service we're offering. | ||
1025 | * Update the GtkTreeModel (at the given path) and update the | ||
1026 | * respective service entry in the configuration file. Finally, | ||
1027 | * if the edited path is for a "fresh" entry, create another empty | ||
1028 | * one at the bottom. If the hostname was set to empty, remove | ||
1029 | * the entire entry from the configuration and the model. | ||
1030 | * | ||
1031 | * @param renderer GtkCellRendererText that changed | ||
1032 | * @param path GtkTreePath identifying where in the Model the change is | ||
1033 | * @param new_text the new text that was stored in the line | ||
1034 | * @param user_data NULL | ||
1035 | */ | ||
1036 | static void | ||
1037 | save_vpn_dns_service_tcpudp (GtkCellRendererText *renderer, | ||
1038 | gchar *path, | ||
1039 | gchar *new_text, | ||
1040 | gpointer user_data) | ||
1041 | { | ||
1042 | GtkTreeModel *tm; | ||
1043 | GtkListStore *ls; | ||
1044 | GtkTreeIter iter; | ||
1045 | |||
1046 | if ( (0 != strcasecmp ("tcp", new_text)) && | ||
1047 | (0 != strcasecmp ("udp", new_text)) ) | ||
1048 | { | ||
1049 | /* FIXME: warn... */ | ||
1050 | return; | ||
1051 | } | ||
1052 | tm = GTK_TREE_MODEL (gtk_builder_get_object (builder, | ||
1053 | "vpn_dns_config_liststore")); | ||
1054 | if (NULL == tm) | ||
1055 | { | ||
1056 | GNUNET_break (0); | ||
1057 | return; | ||
1058 | } | ||
1059 | ls = GTK_LIST_STORE (tm); | ||
1060 | if (NULL == ls) | ||
1061 | { | ||
1062 | GNUNET_break (0); | ||
1063 | return; | ||
1064 | } | ||
1065 | if (TRUE != gtk_tree_model_get_iter_from_string (tm, &iter, path)) | ||
1066 | { | ||
1067 | GNUNET_break (0); | ||
1068 | return; | ||
1069 | } | ||
1070 | /* update model */ | ||
1071 | gtk_list_store_set (ls, &iter, | ||
1072 | 4, new_text, | ||
1073 | -1); | ||
1074 | /* update configuration */ | ||
1075 | update_vpn_dns_configuration (tm); | ||
1076 | } | ||
1077 | |||
1078 | |||
1079 | /** | ||
1080 | * Initialize the GtkListModel with the VPN's DNS service specification. | ||
1081 | * | ||
1082 | * @param cls NULL | ||
1083 | * @param section section with the value (NULL) | ||
1084 | * @param option option name (NULL) | ||
1085 | * @param widget widget to initialize (the GtkTreeView) | ||
1086 | * @param cfg configuration handle | ||
1087 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
1088 | */ | ||
1089 | static int | ||
1090 | vpn_dns_service_tcpudp_install_edited_handler (const void *cls, | ||
1091 | const char *section, | ||
1092 | const char *option, | ||
1093 | GObject *widget, | ||
1094 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
1095 | { | ||
1096 | static int once; | ||
1097 | GtkCellRendererText *rt; | ||
1098 | |||
1099 | rt = GTK_CELL_RENDERER_TEXT(widget); | ||
1100 | if (NULL == rt) | ||
1101 | return GNUNET_SYSERR; | ||
1102 | if (0 != once++) | ||
1103 | return GNUNET_OK; | ||
1104 | g_signal_connect (rt, | ||
1105 | "edited", | ||
1106 | G_CALLBACK (&save_vpn_dns_service_tcpudp), | ||
1107 | NULL); | ||
1108 | return GNUNET_OK; | ||
1109 | } | ||
1110 | |||
1111 | |||
1112 | /** | ||
1113 | * The user has edited the DNS name of a service we're offering. | ||
1114 | * Update the GtkTreeModel (at the given path) and update the | ||
1115 | * respective service entry in the configuration file. Finally, | ||
1116 | * if the edited path is for a "fresh" entry, create another empty | ||
1117 | * one at the bottom. If the hostname was set to empty, remove | ||
1118 | * the entire entry from the configuration and the model. | ||
1119 | * | ||
1120 | * @param renderer GtkCellRendererText that changed | ||
1121 | * @param path GtkTreePath identifying where in the Model the change is | ||
1122 | * @param new_text the new text that was stored in the line | ||
1123 | * @param user_data NULL | ||
1124 | */ | ||
1125 | static void | ||
1126 | save_vpn_dns_service_sourceport (GtkCellRendererText *renderer, | ||
1127 | gchar *path, | ||
1128 | gchar *new_text, | ||
1129 | gpointer user_data) | ||
1130 | { | ||
1131 | GtkTreeModel *tm; | ||
1132 | GtkListStore *ls; | ||
1133 | GtkTreeIter iter; | ||
1134 | int port; | ||
1135 | |||
1136 | port = atoi (new_text); | ||
1137 | if ( (port < 1) || (port > UINT16_MAX) ) | ||
1138 | { | ||
1139 | /* invalid port, FIXME: warn */ | ||
1140 | return; | ||
1141 | } | ||
1142 | tm = GTK_TREE_MODEL (gtk_builder_get_object (builder, | ||
1143 | "vpn_dns_config_liststore")); | ||
1144 | if (NULL == tm) | ||
1145 | { | ||
1146 | GNUNET_break (0); | ||
1147 | return; | ||
1148 | } | ||
1149 | ls = GTK_LIST_STORE (tm); | ||
1150 | if (NULL == ls) | ||
1151 | { | ||
1152 | GNUNET_break (0); | ||
1153 | return; | ||
1154 | } | ||
1155 | if (TRUE != gtk_tree_model_get_iter_from_string (tm, &iter, path)) | ||
1156 | { | ||
1157 | GNUNET_break (0); | ||
1158 | return; | ||
1159 | } | ||
1160 | /* update model */ | ||
1161 | gtk_list_store_set (ls, &iter, | ||
1162 | 1, (guint) port, | ||
1163 | -1); | ||
1164 | /* update configuration */ | ||
1165 | update_vpn_dns_configuration (tm); | ||
1166 | } | ||
1167 | |||
1168 | |||
1169 | /** | ||
1170 | * Initialize the GtkListModel with the VPN's DNS service specification. | ||
1171 | * | ||
1172 | * @param cls NULL | ||
1173 | * @param section section with the value (NULL) | ||
1174 | * @param option option name (NULL) | ||
1175 | * @param widget widget to initialize (the GtkTreeView) | ||
1176 | * @param cfg configuration handle | ||
1177 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
1178 | */ | ||
1179 | static int | ||
1180 | vpn_dns_service_sourceport_install_edited_handler (const void *cls, | ||
1181 | const char *section, | ||
1182 | const char *option, | ||
1183 | GObject *widget, | ||
1184 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
1185 | { | ||
1186 | static int once; | ||
1187 | GtkCellRendererText *rt; | ||
1188 | |||
1189 | rt = GTK_CELL_RENDERER_TEXT(widget); | ||
1190 | if (NULL == rt) | ||
1191 | return GNUNET_SYSERR; | ||
1192 | if (0 != once++) | ||
1193 | return GNUNET_OK; | ||
1194 | g_signal_connect (rt, | ||
1195 | "edited", | ||
1196 | G_CALLBACK (&save_vpn_dns_service_sourceport), | ||
1197 | NULL); | ||
1198 | return GNUNET_OK; | ||
1199 | } | ||
1200 | |||
1201 | |||
1202 | /** | ||
1203 | * The user has edited the DNS name of a service we're offering. | ||
1204 | * Update the GtkTreeModel (at the given path) and update the | ||
1205 | * respective service entry in the configuration file. Finally, | ||
1206 | * if the edited path is for a "fresh" entry, create another empty | ||
1207 | * one at the bottom. If the hostname was set to empty, remove | ||
1208 | * the entire entry from the configuration and the model. | ||
1209 | * | ||
1210 | * @param renderer GtkCellRendererText that changed | ||
1211 | * @param path GtkTreePath identifying where in the Model the change is | ||
1212 | * @param new_text the new text that was stored in the line | ||
1213 | * @param user_data NULL | ||
1214 | */ | ||
1215 | static void | ||
1216 | save_vpn_dns_service_targethostname (GtkCellRendererText *renderer, | ||
1217 | gchar *path, | ||
1218 | gchar *new_text, | ||
1219 | gpointer user_data) | ||
1220 | { | ||
1221 | GtkTreeModel *tm; | ||
1222 | GtkListStore *ls; | ||
1223 | GtkTreeIter iter; | ||
1224 | |||
1225 | tm = GTK_TREE_MODEL (gtk_builder_get_object (builder, | ||
1226 | "vpn_dns_config_liststore")); | ||
1227 | if (NULL == tm) | ||
1228 | { | ||
1229 | GNUNET_break (0); | ||
1230 | return; | ||
1231 | } | ||
1232 | ls = GTK_LIST_STORE (tm); | ||
1233 | if (NULL == ls) | ||
1234 | { | ||
1235 | GNUNET_break (0); | ||
1236 | return; | ||
1237 | } | ||
1238 | if (TRUE != gtk_tree_model_get_iter_from_string (tm, &iter, path)) | ||
1239 | { | ||
1240 | GNUNET_break (0); | ||
1241 | return; | ||
1242 | } | ||
1243 | /* update model */ | ||
1244 | gtk_list_store_set (ls, &iter, | ||
1245 | 3, new_text, | ||
1246 | -1); | ||
1247 | /* update configuration */ | ||
1248 | update_vpn_dns_configuration (tm); | ||
1249 | } | ||
1250 | |||
1251 | |||
1252 | /** | ||
1253 | * Initialize the GtkListModel with the VPN's DNS service specification. | ||
1254 | * | ||
1255 | * @param cls NULL | ||
1256 | * @param section section with the value (NULL) | ||
1257 | * @param option option name (NULL) | ||
1258 | * @param widget widget to initialize (the GtkTreeView) | ||
1259 | * @param cfg configuration handle | ||
1260 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
1261 | */ | ||
1262 | static int | ||
1263 | vpn_dns_service_targethostname_install_edited_handler (const void *cls, | ||
1264 | const char *section, | ||
1265 | const char *option, | ||
1266 | GObject *widget, | ||
1267 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
1268 | { | ||
1269 | static int once; | ||
1270 | GtkCellRendererText *rt; | ||
1271 | |||
1272 | rt = GTK_CELL_RENDERER_TEXT(widget); | ||
1273 | if (NULL == rt) | ||
1274 | return GNUNET_SYSERR; | ||
1275 | if (0 != once++) | ||
1276 | return GNUNET_OK; | ||
1277 | g_signal_connect (rt, | ||
1278 | "edited", | ||
1279 | G_CALLBACK (&save_vpn_dns_service_targethostname), | ||
1280 | NULL); | ||
1281 | return GNUNET_OK; | ||
1282 | } | ||
1283 | |||
1284 | |||
1285 | /** | ||
1286 | * The user has edited the DNS name of a service we're offering. | ||
1287 | * Update the GtkTreeModel (at the given path) and update the | ||
1288 | * respective service entry in the configuration file. Finally, | ||
1289 | * if the edited path is for a "fresh" entry, create another empty | ||
1290 | * one at the bottom. If the hostname was set to empty, remove | ||
1291 | * the entire entry from the configuration and the model. | ||
1292 | * | ||
1293 | * @param renderer GtkCellRendererText that changed | ||
1294 | * @param path GtkTreePath identifying where in the Model the change is | ||
1295 | * @param new_text the new text that was stored in the line | ||
1296 | * @param user_data NULL | ||
1297 | */ | ||
1298 | static void | ||
1299 | save_vpn_dns_service_targetport (GtkCellRendererText *renderer, | ||
1300 | gchar *path, | ||
1301 | gchar *new_text, | ||
1302 | gpointer user_data) | ||
1303 | { | ||
1304 | GtkTreeModel *tm; | ||
1305 | GtkListStore *ls; | ||
1306 | GtkTreeIter iter; | ||
1307 | int port; | ||
1308 | |||
1309 | port = atoi (new_text); | ||
1310 | if ( (port < 1) || (port > UINT16_MAX) ) | ||
1311 | { | ||
1312 | /* invalid port, FIXME: warn */ | ||
1313 | return; | ||
1314 | } | ||
1315 | tm = GTK_TREE_MODEL (gtk_builder_get_object (builder, | ||
1316 | "vpn_dns_config_liststore")); | ||
1317 | if (NULL == tm) | ||
1318 | { | ||
1319 | GNUNET_break (0); | ||
1320 | return; | ||
1321 | } | ||
1322 | ls = GTK_LIST_STORE (tm); | ||
1323 | if (NULL == ls) | ||
1324 | { | ||
1325 | GNUNET_break (0); | ||
1326 | return; | ||
1327 | } | ||
1328 | if (TRUE != gtk_tree_model_get_iter_from_string (tm, &iter, path)) | ||
1329 | { | ||
1330 | GNUNET_break (0); | ||
1331 | return; | ||
1332 | } | ||
1333 | /* update model */ | ||
1334 | gtk_list_store_set (ls, &iter, | ||
1335 | 2, (guint) port, | ||
1336 | -1); | ||
1337 | /* update configuration */ | ||
1338 | update_vpn_dns_configuration (tm); | ||
1339 | } | ||
1340 | |||
1341 | |||
1342 | /** | ||
1343 | * Initialize the GtkListModel with the VPN's DNS service specification. | ||
1344 | * | ||
1345 | * @param cls NULL | ||
1346 | * @param section section with the value (NULL) | ||
1347 | * @param option option name (NULL) | ||
1348 | * @param widget widget to initialize (the GtkTreeView) | ||
1349 | * @param cfg configuration handle | ||
1350 | * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem | ||
1351 | */ | ||
1352 | static int | ||
1353 | vpn_dns_service_targetport_install_edited_handler (const void *cls, | ||
1354 | const char *section, | ||
1355 | const char *option, | ||
1356 | GObject *widget, | ||
1357 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
1358 | { | ||
1359 | static int once; | ||
1360 | GtkCellRendererText *rt; | ||
1361 | |||
1362 | rt = GTK_CELL_RENDERER_TEXT(widget); | ||
1363 | if (NULL == rt) | ||
1364 | return GNUNET_SYSERR; | ||
1365 | if (0 != once++) | ||
1366 | return GNUNET_OK; | ||
1367 | g_signal_connect (rt, | ||
1368 | "edited", | ||
1369 | G_CALLBACK (&save_vpn_dns_service_targetport), | ||
1370 | NULL); | ||
1371 | return GNUNET_OK; | ||
1372 | } | ||
1373 | |||
1374 | |||
1375 | /** | ||
1376 | * Hide "min connected friends" option if in F2F-only mode. | ||
1377 | */ | ||
1378 | static struct GNUNET_SETUP_VisibilitySpecification hide_min_connected_friends[] = | ||
1379 | { | ||
1380 | { "GNUNET_setup_minimum_friends_label", NULL, REX_YES }, | ||
1381 | { "GNUNET_setup_minimum_friends_spinbutton", NULL, REX_YES }, | ||
1382 | { NULL, NULL, NULL } | ||
1383 | }; | ||
1384 | |||
1385 | |||
1386 | /** | ||
1387 | * Hide "hostlist" options if hostlist is not in use. | ||
1388 | */ | ||
1389 | static struct GNUNET_SETUP_VisibilitySpecification hide_hostlist_options[] = | ||
1390 | { | ||
1391 | { "GNUNET_setup_hostlist_client_enable_checkbutton", "(^| )hostlist($| )", NULL }, | ||
1392 | { "GNUNET_setup_hostlist_client_learn_checkbutton", "(^| )hostlist($| )", NULL }, | ||
1393 | { "GNUNET_setup_hostlist_options_hbox", "(^| )hostlist($| )", NULL }, | ||
1394 | { "GNUNET_setup_hostlist_frame", "(^| )hostlist($| )", NULL }, | ||
1395 | { NULL, NULL, NULL } | ||
1396 | }; | ||
1397 | |||
1398 | |||
1399 | /** | ||
1400 | * Hide "exit" options if VPN exit is not in use. | ||
1401 | */ | ||
1402 | static struct GNUNET_SETUP_VisibilitySpecification hide_exit_options[] = | ||
1403 | { | ||
1404 | { "GNUNET_setup_vpn_exit_frame", "(^| )exit($| )", NULL }, | ||
1405 | { "GNUNET_setup_vpn_service_configuration_frame", "(^| )exit($| )", NULL }, | ||
1406 | { NULL, NULL, NULL } | ||
1407 | }; | ||
1408 | |||
1409 | |||
1410 | /** | ||
1411 | * Hide "hostlist" server options if hostlist server is not in use. | ||
1412 | */ | ||
1413 | static struct GNUNET_SETUP_VisibilitySpecification hide_hostlist_server_options[] = | ||
1414 | { | ||
1415 | { "GNUNET_setup_hostlist_advertise_checkbutton", "(^| )-p($| )", NULL }, | ||
1416 | { "GNUNET_setup_hostlist_port_label", "(^| )-p($| )", NULL }, | ||
1417 | { "GNUNET_setup_hostlist_server_port_spin_button", "(^| )-p($| )", NULL }, | ||
1418 | { NULL, NULL, NULL } | ||
1419 | }; | ||
1420 | |||
1421 | |||
1422 | |||
1423 | /** | ||
1424 | * Hide "fs tab" if FS not active. | ||
1425 | */ | ||
1426 | static struct GNUNET_SETUP_VisibilitySpecification hide_fs_tab[] = | ||
1427 | { | ||
1428 | { "GNUNET_setup_fs_main_vbox", "(^| )fs($| )", NULL }, | ||
1429 | { NULL, NULL, NULL } | ||
1430 | }; | ||
1431 | |||
1432 | |||
1433 | |||
1434 | /** | ||
1435 | * Hide "vpn tab" if VPN not active. | ||
1436 | */ | ||
1437 | static struct GNUNET_SETUP_VisibilitySpecification hide_vpn_tab[] = | ||
1438 | { | ||
1439 | { "GNUNET_setup_vpn_vbox", "(^| )vpn($| )", NULL }, | ||
1440 | { NULL, NULL, NULL } | ||
1441 | }; | ||
1442 | |||
1443 | |||
1444 | |||
1445 | /** | ||
1446 | * Hide "tcp tab" if TCP not active. | ||
1447 | */ | ||
1448 | static struct GNUNET_SETUP_VisibilitySpecification hide_tcp_tab[] = | ||
1449 | { | ||
1450 | { "GNUNET_setup_transport_tcp_vbox", "(^| )tcp($| )", NULL }, | ||
1451 | { NULL, NULL, NULL } | ||
1452 | }; | ||
1453 | |||
1454 | |||
1455 | /** | ||
1456 | * Hide "udp tab" if UDP not active. | ||
1457 | */ | ||
1458 | static struct GNUNET_SETUP_VisibilitySpecification hide_udp_tab[] = | ||
1459 | { | ||
1460 | { "GNUNET_setup_transport_udp_vbox", "(^| )udp($| )", NULL }, | ||
1461 | { NULL, NULL, NULL } | ||
1462 | }; | ||
1463 | |||
1464 | |||
1465 | /** | ||
1466 | * Hide "http tab" if HTTP not active. | ||
1467 | */ | ||
1468 | static struct GNUNET_SETUP_VisibilitySpecification hide_http_tab[] = | ||
1469 | { | ||
1470 | { "GNUNET_setup_transport_http_vbox", "(^| )http($| )", NULL }, | ||
1471 | { NULL, NULL, NULL } | ||
1472 | }; | ||
1473 | |||
1474 | |||
1475 | /** | ||
1476 | * Hide "https tab" if HTTPS not active. | ||
1477 | */ | ||
1478 | static struct GNUNET_SETUP_VisibilitySpecification hide_https_tab[] = | ||
1479 | { | ||
1480 | { "GNUNET_setup_transport_https_vbox", "(^| )https($| )", NULL }, | ||
1481 | { NULL, NULL, NULL } | ||
1482 | }; | ||
1483 | |||
1484 | |||
1485 | /** | ||
1486 | * Hide "dv tab" if DV not active. | ||
1487 | */ | ||
1488 | static struct GNUNET_SETUP_VisibilitySpecification hide_dv_tab[] = | ||
1489 | { | ||
1490 | { "GNUNET_setup_transport_dv_vbox", "(^| )dv($| )", NULL }, | ||
1491 | { NULL, NULL, NULL } | ||
1492 | }; | ||
1493 | |||
1494 | |||
1495 | /** | ||
1496 | * Hide "wlan tab" if WLAN not active. | ||
1497 | */ | ||
1498 | static struct GNUNET_SETUP_VisibilitySpecification hide_wlan_tab[] = | ||
1499 | { | ||
1500 | { "GNUNET_setup_transport_wlan_vbox", "(^| )wlan($| )", NULL }, | ||
1501 | { NULL, NULL, NULL } | ||
1502 | }; | ||
1503 | |||
1504 | |||
1505 | /** | ||
1506 | * Hide "sqlite datastore" tab if sqlite not active. | ||
1507 | */ | ||
1508 | static struct GNUNET_SETUP_VisibilitySpecification hide_sqlite_datastore_tab[] = | ||
1509 | { | ||
1510 | { "GNUNET_setup_fs_datastore_sqlite_label", "^sqlite$", NULL }, | ||
1511 | { NULL, NULL, NULL } | ||
1512 | }; | ||
1513 | |||
1514 | |||
1515 | /** | ||
1516 | * Hide "mysql datastore" tab if mysql not active. | ||
1517 | */ | ||
1518 | static struct GNUNET_SETUP_VisibilitySpecification hide_mysql_datastore_tab[] = | ||
1519 | { | ||
1520 | { "GNUNET_setup_datastore_mysql_vbox", "^mysql$", NULL }, | ||
1521 | { NULL, NULL, NULL } | ||
1522 | }; | ||
1523 | |||
1524 | |||
1525 | /** | ||
1526 | * Hide "postgres datastore" tab if postgres not active. | ||
1527 | */ | ||
1528 | static struct GNUNET_SETUP_VisibilitySpecification hide_postgres_datastore_tab[] = | ||
1529 | { | ||
1530 | { "GNUNET_setup_datastore_postgres_hbox", "^postgres$", NULL }, | ||
1531 | { NULL, NULL, NULL } | ||
1532 | }; | ||
1533 | |||
1534 | |||
1535 | /** | ||
1536 | * Hide "sqlite datacache" tab if sqlite not active. | ||
1537 | */ | ||
1538 | static struct GNUNET_SETUP_VisibilitySpecification hide_sqlite_datacache_tab[] = | ||
1539 | { | ||
1540 | { "GNUNET_setup_fs_datacache_sqlite_label", "^sqlite$", NULL }, | ||
1541 | { NULL, NULL, NULL } | ||
1542 | }; | ||
1543 | |||
1544 | |||
1545 | /** | ||
1546 | * Hide "mysql datacache" tab if mysql not active. | ||
1547 | */ | ||
1548 | static struct GNUNET_SETUP_VisibilitySpecification hide_mysql_datacache_tab[] = | ||
1549 | { | ||
1550 | { "GNUNET_setup_datacache_mysql_vbox", "^mysql$", NULL }, | ||
1551 | { NULL, NULL, NULL } | ||
1552 | }; | ||
1553 | |||
1554 | |||
1555 | /** | ||
1556 | * Hide "postgres datacache" tab if postgres not active. | ||
1557 | */ | ||
1558 | static struct GNUNET_SETUP_VisibilitySpecification hide_postgres_datacache_tab[] = | ||
1559 | { | ||
1560 | { "GNUNET_setup_datacache_postgres_hbox", "^postgres$", NULL }, | ||
1561 | { NULL, NULL, NULL } | ||
1562 | }; | ||
1563 | |||
1564 | |||
1565 | /** | ||
1566 | * Hide advertised TCP port if port is zero. | ||
1567 | */ | ||
1568 | static struct GNUNET_SETUP_VisibilitySpecification hide_all_tcp_options[] = | ||
1569 | { | ||
1570 | { "GNUNET_setup_transport_tcp_adv_port_hbox", NULL, "^0$" }, | ||
1571 | { NULL, NULL, NULL } | ||
1572 | }; | ||
1573 | |||
1574 | |||
1575 | /** | ||
1576 | * Hide NATed peer options. | ||
1577 | */ | ||
1578 | static struct GNUNET_SETUP_VisibilitySpecification toggle_nat_options[] = | ||
1579 | { | ||
1580 | { "GNUNET_setup_transport_hole_punched_checkbutton", "^YES$", NULL }, | ||
1581 | { "GNUNET_setup_transport_upnp_enable_checkbutton", "^YES$", NULL }, | ||
1582 | { "GNUNET_setup_transport_icmp_server_enable_checkbutton", "^YES$", NULL }, | ||
1583 | { "GNUNET_setup_transport_external_ip_hbox", "^YES$", NULL }, | ||
1584 | { NULL, NULL, NULL } | ||
1585 | }; | ||
1586 | |||
1587 | /** | ||
1588 | * Hide hole-punched NATed peer options. | ||
1589 | */ | ||
1590 | static struct GNUNET_SETUP_VisibilitySpecification toggle_nat_punched_options[] = | ||
1591 | { | ||
1592 | { "GNUNET_setup_transport_upnp_enable_checkbutton", "^NO$", NULL }, | ||
1593 | { "GNUNET_setup_transport_icmp_server_enable_checkbutton", "^NO$", NULL }, | ||
1594 | { NULL, NULL, NULL } | ||
1595 | }; | ||
1596 | |||
1597 | |||
1598 | /** | ||
1599 | * Hide internal IP options. | ||
1600 | */ | ||
1601 | static struct GNUNET_SETUP_VisibilitySpecification toggle_internal_ip[] = | ||
1602 | { | ||
1603 | { "GNUNET_setup_transport_internal_ip_hbox", "^YES$", NULL }, | ||
1604 | { NULL, NULL, NULL } | ||
1605 | }; | ||
1606 | |||
1607 | |||
1608 | /** | ||
1609 | * Option specification data. | ||
1610 | */ | ||
1611 | const struct GNUNET_SETUP_OptionSpecification option_specifications[] = | ||
1612 | { | ||
1613 | |||
1614 | /* GENERAL TAB */ | ||
1615 | |||
1616 | { | ||
1617 | "GNUNET_setup_friends_only_checkbutton", | ||
1618 | "toggled", | ||
1619 | "topology", | ||
1620 | "FRIENDS-ONLY", | ||
1621 | gettext_noop ("Should GNUnet exclusively connect to friends?"), | ||
1622 | "https://gnunet.org/configuration-f2f", | ||
1623 | &load_yes_no, | ||
1624 | &save_yes_no, NULL, | ||
1625 | hide_min_connected_friends | ||
1626 | }, | ||
1627 | |||
1628 | { | ||
1629 | "GNUNET_setup_friends_filechooserbutton", | ||
1630 | "selection-changed", | ||
1631 | "topology", | ||
1632 | "FRIENDS", | ||
1633 | gettext_noop ("Friends file containing the list of friendly peers"), | ||
1634 | "https://gnunet.org/configuration-f2f", | ||
1635 | &load_filename, | ||
1636 | &save_filename, NULL, | ||
1637 | NULL | ||
1638 | }, | ||
1639 | |||
1640 | { | ||
1641 | "GNUNET_setup_minimum_friends_spinbutton", | ||
1642 | "value-changed", | ||
1643 | "topology", | ||
1644 | "MINIMUM-FRIENDS", | ||
1645 | gettext_noop ("Minimum number of friendly connections"), | ||
1646 | "https://gnunet.org/configuration-f2f", | ||
1647 | &load_number, | ||
1648 | &save_number, NULL, | ||
1649 | NULL | ||
1650 | }, | ||
1651 | |||
1652 | { | ||
1653 | "GNUNET_setup_general_services_topology_checkbutton", | ||
1654 | "toggled", | ||
1655 | "arm", | ||
1656 | "DEFAULTSERVICES", | ||
1657 | gettext_noop ("Topology should always be loaded"), | ||
1658 | "https://gnunet.org/configuration-topology", | ||
1659 | &load_option_list, | ||
1660 | &save_option_list, "topology", | ||
1661 | NULL | ||
1662 | }, | ||
1663 | |||
1664 | { | ||
1665 | "GNUNET_setup_general_services_hostlist_checkbutton", | ||
1666 | "toggled", | ||
1667 | "arm", | ||
1668 | "DEFAULTSERVICES", | ||
1669 | gettext_noop ("Should hostlist support be started automatically on startup?"), | ||
1670 | "https://gnunet.org/configuration-hostlist", | ||
1671 | &load_option_list, | ||
1672 | &save_option_list, "hostlist", | ||
1673 | hide_hostlist_options | ||
1674 | }, | ||
1675 | |||
1676 | |||
1677 | { | ||
1678 | "GNUNET_setup_general_services_fs_checkbutton", | ||
1679 | "toggled", | ||
1680 | "arm", | ||
1681 | "DEFAULTSERVICES", | ||
1682 | gettext_noop ("Should file-sharing be started automatically on startup?"), | ||
1683 | "https://gnunet.org/configuration-fs", | ||
1684 | &load_option_list, | ||
1685 | &save_option_list, "fs", | ||
1686 | hide_fs_tab | ||
1687 | }, | ||
1688 | |||
1689 | { | ||
1690 | "GNUNET_setup_general_services_vpn_checkbutton", | ||
1691 | "toggled", | ||
1692 | "arm", | ||
1693 | "DEFAULTSERVICES", | ||
1694 | gettext_noop ("Should the VPN be started automatically on startup?"), | ||
1695 | "https://gnunet.org/configuration-vpn", | ||
1696 | &load_option_list, | ||
1697 | &save_option_list, "vpn", | ||
1698 | hide_vpn_tab | ||
1699 | }, | ||
1700 | |||
1701 | { | ||
1702 | "GNUNET_setup_hostlist_client_enable_checkbutton", | ||
1703 | "toggled", | ||
1704 | "hostlist", | ||
1705 | "OPTIONS", | ||
1706 | gettext_noop ("Should GNUnet learn about other peers using hostlists"), | ||
1707 | "https://gnunet.org/configuration-hostlist", | ||
1708 | &load_option_list, | ||
1709 | &save_option_list, "-b", | ||
1710 | NULL | ||
1711 | }, | ||
1712 | |||
1713 | { | ||
1714 | "GNUNET_setup_hostlist_client_learn_checkbutton", | ||
1715 | "toggled", | ||
1716 | "hostlist", | ||
1717 | "OPTIONS", | ||
1718 | gettext_noop ("Should GNUnet learn hostlists from other peers"), | ||
1719 | "https://gnunet.org/configuration-hostlist", | ||
1720 | &load_option_list, | ||
1721 | &save_option_list, "-e", | ||
1722 | NULL | ||
1723 | }, | ||
1724 | |||
1725 | { | ||
1726 | "GNUNET_setup_hostlist_offer_hostlist_checkbutton", | ||
1727 | "toggled", | ||
1728 | "hostlist", | ||
1729 | "OPTIONS", | ||
1730 | gettext_noop ("Should this peer offer a hostlist to other peers"), | ||
1731 | "https://gnunet.org/configuration-hostlist-server", | ||
1732 | &load_option_list, | ||
1733 | &save_option_list, "-p", | ||
1734 | hide_hostlist_server_options | ||
1735 | }, | ||
1736 | |||
1737 | { | ||
1738 | "GNUNET_setup_hostlist_advertise_checkbutton", | ||
1739 | "toggled", | ||
1740 | "hostlist", | ||
1741 | "OPTIONS", | ||
1742 | gettext_noop ("Should this peer advertise its hostlist to other peers"), | ||
1743 | "https://gnunet.org/configuration-hostlist-server", | ||
1744 | &load_option_list, | ||
1745 | &save_option_list, "-a", | ||
1746 | NULL | ||
1747 | }, | ||
1748 | |||
1749 | { | ||
1750 | "GNUNET_setup_hostlist_server_port_spin_button", | ||
1751 | "value-changed", | ||
1752 | "hostlist", | ||
1753 | "HTTPPORT", | ||
1754 | gettext_noop ("Port this peers hostlist should be offered on"), | ||
1755 | "https://gnunet.org/configuration-hostlist-server", | ||
1756 | &load_number, | ||
1757 | &save_number, NULL, | ||
1758 | NULL | ||
1759 | }, | ||
1760 | |||
1761 | { | ||
1762 | "GNUNET_setup_hostlist_url_liststore", | ||
1763 | "row-changed", | ||
1764 | "hostlist", | ||
1765 | "SERVERS", | ||
1766 | NULL, NULL, | ||
1767 | &load_string_list_store, | ||
1768 | &save_string_list_store, NULL, | ||
1769 | NULL | ||
1770 | }, | ||
1771 | |||
1772 | { | ||
1773 | "GNUNET_setup_hostlist_url_treeview", | ||
1774 | NULL, NULL, NULL, /* FIXME */ | ||
1775 | gettext_noop ("Known hostlist URLs"), | ||
1776 | "https://gnunet.org/configuration-hostlist", | ||
1777 | NULL, NULL, NULL, /* FIXME */ | ||
1778 | NULL | ||
1779 | }, | ||
1780 | |||
1781 | { | ||
1782 | "GNUNET_setup_bandwidth_out_spinbutton", | ||
1783 | "value-changed", | ||
1784 | "core", | ||
1785 | "TOTAL_QUOTA_OUT", | ||
1786 | gettext_noop ("How many bytes per second are we allowed to transmit?"), | ||
1787 | "https://gnunet.org/configuration-bandwidth", | ||
1788 | &load_number, | ||
1789 | &save_number, NULL, | ||
1790 | NULL | ||
1791 | }, | ||
1792 | |||
1793 | { | ||
1794 | "GNUNET_setup_bandwidth_in_spinbutton", | ||
1795 | "value-changed", | ||
1796 | "core", | ||
1797 | "TOTAL_QUOTA_IN", | ||
1798 | gettext_noop ("How many bytes per second are we allowed to receive?"), | ||
1799 | "https://gnunet.org/configuration-bandwidth", | ||
1800 | &load_number, | ||
1801 | &save_number, NULL, | ||
1802 | NULL | ||
1803 | }, | ||
1804 | |||
1805 | /* Transport TAB */ | ||
1806 | |||
1807 | { | ||
1808 | "GNUNET_setup_transport_tcp_checkbutton", | ||
1809 | "toggled", | ||
1810 | "transport", | ||
1811 | "PLUGINS", | ||
1812 | gettext_noop ("Enable communication via TCP"), | ||
1813 | "https://gnunet.org/configuration-tcp", | ||
1814 | &load_option_list, | ||
1815 | &save_option_list, "tcp", | ||
1816 | hide_tcp_tab | ||
1817 | }, | ||
1818 | |||
1819 | { | ||
1820 | "GNUNET_setup_transport_udp_checkbutton", | ||
1821 | "toggled", | ||
1822 | "transport", | ||
1823 | "PLUGINS", | ||
1824 | gettext_noop ("Enable communication via UDP"), | ||
1825 | "https://gnunet.org/configuration-udp", | ||
1826 | &load_option_list, | ||
1827 | &save_option_list, "udp", | ||
1828 | hide_udp_tab | ||
1829 | }, | ||
1830 | |||
1831 | { | ||
1832 | "GNUNET_setup_transport_http_checkbutton", | ||
1833 | "toggled", | ||
1834 | "transport", | ||
1835 | "PLUGINS", | ||
1836 | gettext_noop ("Enable communication via HTTP"), | ||
1837 | "https://gnunet.org/configuration-http", | ||
1838 | &load_option_list, | ||
1839 | &save_option_list, "http", | ||
1840 | hide_http_tab | ||
1841 | }, | ||
1842 | |||
1843 | { | ||
1844 | "GNUNET_setup_transport_https_checkbutton", | ||
1845 | "toggled", | ||
1846 | "transport", | ||
1847 | "PLUGINS", | ||
1848 | gettext_noop ("Enable communication via HTTPS"), | ||
1849 | "https://gnunet.org/configuration-https", | ||
1850 | &load_option_list, | ||
1851 | &save_option_list, "https", | ||
1852 | hide_https_tab | ||
1853 | }, | ||
1854 | |||
1855 | { | ||
1856 | "GNUNET_setup_transport_dv_checkbutton", | ||
1857 | "toggled", | ||
1858 | "transport", | ||
1859 | "PLUGINS", | ||
1860 | gettext_noop ("Enable communication via DV"), | ||
1861 | "https://gnunet.org/configuration-dv", | ||
1862 | &load_option_list, | ||
1863 | &save_option_list, "dv", | ||
1864 | hide_dv_tab | ||
1865 | }, | ||
1866 | |||
1867 | { | ||
1868 | "GNUNET_setup_transport_wlan_checkbutton", | ||
1869 | "toggled", | ||
1870 | "transport", | ||
1871 | "PLUGINS", | ||
1872 | gettext_noop ("Enable communication via WLAN"), | ||
1873 | "https://gnunet.org/configuration-wlan", | ||
1874 | &load_option_list, | ||
1875 | &save_option_list, "wlan", | ||
1876 | hide_wlan_tab | ||
1877 | }, | ||
1878 | |||
1879 | { | ||
1880 | "GNUNET_setup_transport_tcp_port_spinbutton", | ||
1881 | "value-changed", | ||
1882 | "transport-tcp", | ||
1883 | "PORT", | ||
1884 | gettext_noop ("Port we bind to for TCP"), | ||
1885 | "https://gnunet.org/configuration-tcp", | ||
1886 | &load_number, | ||
1887 | &save_number, NULL, | ||
1888 | hide_all_tcp_options | ||
1889 | }, | ||
1890 | |||
1891 | { | ||
1892 | "GNUNET_setup_transport_tcp_adv_port_spinbutton", | ||
1893 | "value-changed", | ||
1894 | "transport-tcp", | ||
1895 | "ADVERTISED_PORT", | ||
1896 | gettext_noop ("Port visible to other peers"), | ||
1897 | "https://gnunet.org/configuration-tcp", | ||
1898 | &load_number, | ||
1899 | &save_number, NULL, | ||
1900 | NULL | ||
1901 | }, | ||
1902 | |||
1903 | { | ||
1904 | "GNUNET_setup_transport_nat_checkbutton", | ||
1905 | "toggled", | ||
1906 | "nat", | ||
1907 | "BEHIND_NAT", | ||
1908 | gettext_noop ("Check if this peer is behind a NAT"), | ||
1909 | "https://gnunet.org/configuration-nat", | ||
1910 | &load_yes_no, | ||
1911 | &save_yes_no, NULL, | ||
1912 | toggle_nat_options | ||
1913 | }, | ||
1914 | |||
1915 | { | ||
1916 | "GNUNET_setup_transport_hole_punched_checkbutton", | ||
1917 | "toggled", | ||
1918 | "nat", | ||
1919 | "PUNCHED_NAT", | ||
1920 | gettext_noop ("Check if the NAT has been hole-punched manually"), | ||
1921 | "https://gnunet.org/configuration-nat", | ||
1922 | &load_yes_no, | ||
1923 | &save_yes_no, NULL, | ||
1924 | toggle_nat_punched_options | ||
1925 | }, | ||
1926 | |||
1927 | { | ||
1928 | "GNUNET_setup_transport_upnp_enable_checkbutton", | ||
1929 | "toggled", | ||
1930 | "nat", | ||
1931 | "ENABLE_UPNP", | ||
1932 | gettext_noop ("Enable NAT traversal with UPnP/PMP"), | ||
1933 | "https://gnunet.org/configuration-nat", | ||
1934 | &load_yes_no, | ||
1935 | &save_yes_no, NULL, | ||
1936 | NULL, | ||
1937 | }, | ||
1938 | |||
1939 | { | ||
1940 | "GNUNET_setup_transport_icmp_server_enable_checkbutton", | ||
1941 | "toggled", | ||
1942 | "nat", | ||
1943 | "ENABLE_ICMP_SERVER", | ||
1944 | gettext_noop ("Enable NAT traversal with ICMP as server"), | ||
1945 | "https://gnunet.org/configuration-nat", | ||
1946 | &load_yes_no, | ||
1947 | &save_yes_no, NULL, | ||
1948 | NULL, | ||
1949 | }, | ||
1950 | |||
1951 | { | ||
1952 | "GNUNET_setup_transport_external_ip_address_entry", | ||
1953 | "changed", | ||
1954 | "nat", | ||
1955 | "EXTERNAL_ADDRESS", | ||
1956 | gettext_noop ("External (public) IP address of the NAT"), | ||
1957 | "https://gnunet.org/configuration-nat", | ||
1958 | &load_text, | ||
1959 | &save_text, NULL, | ||
1960 | NULL | ||
1961 | }, | ||
1962 | |||
1963 | { | ||
1964 | "GNUNET_setup_transport_icmp_client_enable_checkbutton", | ||
1965 | "toggled", | ||
1966 | "nat", | ||
1967 | "ENABLE_ICMP_CLIENT", | ||
1968 | gettext_noop ("Enable NAT traversal with ICMP as client"), | ||
1969 | "https://gnunet.org/configuration-nat", | ||
1970 | &load_yes_no, | ||
1971 | &save_yes_no, NULL, | ||
1972 | toggle_internal_ip | ||
1973 | }, | ||
1974 | |||
1975 | { | ||
1976 | "GNUNET_setup_transport_internal_ip_entry", | ||
1977 | "changed", | ||
1978 | "nat", | ||
1979 | "INTERNAL_ADDRESS", | ||
1980 | gettext_noop ("Internal (private) IP address of the NAT"), | ||
1981 | "https://gnunet.org/configuration-nat", | ||
1982 | &load_text, | ||
1983 | &save_text, NULL, | ||
1984 | NULL | ||
1985 | }, | ||
1986 | |||
1987 | { | ||
1988 | "GNUNET_setup_transport_disable_ipv6_checkbutton", | ||
1989 | "toggled", | ||
1990 | "nat", | ||
1991 | "DISABLEV6", | ||
1992 | gettext_noop ("Disable IPv6 support"), | ||
1993 | "https://gnunet.org/configuration-ipv6", | ||
1994 | &load_yes_no, | ||
1995 | &save_yes_no, NULL, | ||
1996 | NULL, | ||
1997 | }, | ||
1998 | |||
1999 | { | ||
2000 | "GNUNET_setup_transport_udp_port_spinbutton", | ||
2001 | "value-changed", | ||
2002 | "transport-udp", | ||
2003 | "PORT", | ||
2004 | gettext_noop ("Port for inbound UDP packets, use 0 if behind NAT"), | ||
2005 | "https://gnunet.org/configuration-udp", | ||
2006 | &load_number, | ||
2007 | &save_number, NULL, | ||
2008 | NULL | ||
2009 | }, | ||
2010 | |||
2011 | { | ||
2012 | "GNUNET_setup_transport_http_port_spinbutton", | ||
2013 | "value-changed", | ||
2014 | "transport-http", | ||
2015 | "PORT", | ||
2016 | gettext_noop ("Port for inbound HTTP connections, use 0 if behind NAT"), | ||
2017 | "https://gnunet.org/configuration-http", | ||
2018 | &load_number, | ||
2019 | &save_number, NULL, | ||
2020 | NULL | ||
2021 | }, | ||
2022 | |||
2023 | { | ||
2024 | "GNUNET_setup_transport_https_port_spinbutton", | ||
2025 | "value-changed", | ||
2026 | "transport-https", | ||
2027 | "PORT", | ||
2028 | gettext_noop ("Port for inbound HTTPS connections, use 0 if behind NAT"), | ||
2029 | "https://gnunet.org/configuration-https", | ||
2030 | &load_number, | ||
2031 | &save_number, NULL, | ||
2032 | NULL | ||
2033 | }, | ||
2034 | |||
2035 | /* FS TAB */ | ||
2036 | |||
2037 | { | ||
2038 | "GNUNET_setup_fs_datastore_sqlite_radiobutton", | ||
2039 | "toggled", | ||
2040 | "datastore", | ||
2041 | "DATABASE", | ||
2042 | gettext_noop ("Use sqLite to store file-sharing content"), | ||
2043 | "https://gnunet.org/configuration-datastore", | ||
2044 | &load_option_list /* abuse! */, | ||
2045 | &save_option_list /* abuse! */, "sqlite", | ||
2046 | hide_sqlite_datastore_tab | ||
2047 | }, | ||
2048 | |||
2049 | { | ||
2050 | "GNUNET_setup_fs_datastore_mysql_radiobutton", | ||
2051 | "toggled", | ||
2052 | "datastore", | ||
2053 | "DATABASE", | ||
2054 | gettext_noop ("Use MySQL to store file-sharing content"), | ||
2055 | "https://gnunet.org/configuration-datastore", | ||
2056 | &load_option_list /* abuse! */, | ||
2057 | &save_option_list /* abuse! */, "mysql", | ||
2058 | hide_mysql_datastore_tab | ||
2059 | }, | ||
2060 | |||
2061 | { | ||
2062 | "GNUNET_setup_fs_datastore_postgres_radiobutton", | ||
2063 | "toggled", | ||
2064 | "datastore", | ||
2065 | "DATABASE", | ||
2066 | gettext_noop ("Use Postgres to store file-sharing content"), | ||
2067 | "https://gnunet.org/configuration-datastore", | ||
2068 | &load_option_list /* abuse! */, | ||
2069 | &save_option_list /* abuse! */, "postgres", | ||
2070 | hide_postgres_datastore_tab | ||
2071 | }, | ||
2072 | |||
2073 | { | ||
2074 | "GNUNET_setup_datastore_mysql_database_name_entry", | ||
2075 | "changed", | ||
2076 | "datastore-mysql", | ||
2077 | "DATABASE", | ||
2078 | gettext_noop ("Name for the MySQL database"), | ||
2079 | "https://gnunet.org/configuration-datastore", | ||
2080 | &load_text, | ||
2081 | &save_text, NULL, | ||
2082 | NULL | ||
2083 | }, | ||
2084 | |||
2085 | { | ||
2086 | "GNUNET_setup_datastore_mysql_config_file_filechooserbutton", | ||
2087 | "selection-changed", | ||
2088 | "datastore-mysql", | ||
2089 | "CONFIG", | ||
2090 | gettext_noop ("Configuration file for MySQL access"), | ||
2091 | "http://dev.mysql.com/doc/refman/5.5/en/option-files.html", | ||
2092 | &load_filename, | ||
2093 | &save_filename, NULL, | ||
2094 | NULL | ||
2095 | }, | ||
2096 | |||
2097 | { | ||
2098 | "GNUNET_setup_datastore_mysql_username_entry", | ||
2099 | "changed", | ||
2100 | "datastore-mysql", | ||
2101 | "USER", | ||
2102 | gettext_noop ("Username for MySQL access"), | ||
2103 | "https://gnunet.org/configuration-datastore", | ||
2104 | &load_text, | ||
2105 | &save_text, NULL, | ||
2106 | NULL | ||
2107 | }, | ||
2108 | |||
2109 | { | ||
2110 | "GNUNET_setup_datastore_mysql_password_entry", | ||
2111 | "changed", | ||
2112 | "datastore-mysql", | ||
2113 | "PASSWORD", | ||
2114 | gettext_noop ("Password for MySQL access"), | ||
2115 | "https://gnunet.org/configuration-datastore", | ||
2116 | &load_text, | ||
2117 | &save_text, NULL, | ||
2118 | NULL | ||
2119 | }, | ||
2120 | |||
2121 | { | ||
2122 | "GNUNET_setup_datastore_mysql_hostname_entry", | ||
2123 | "changed", | ||
2124 | "datastore-mysql", | ||
2125 | "HOST", | ||
2126 | gettext_noop ("Name of host running MySQL database"), | ||
2127 | "https://gnunet.org/configuration-datastore", | ||
2128 | &load_text, | ||
2129 | &save_text, NULL, | ||
2130 | NULL | ||
2131 | }, | ||
2132 | |||
2133 | { | ||
2134 | "GNUNET_setup_datastore_mysql_port_spinbutton", | ||
2135 | "value-changed", | ||
2136 | "datastore-mysql", | ||
2137 | "PORT", | ||
2138 | gettext_noop ("Port of MySQL database"), | ||
2139 | "https://gnunet.org/configuration-datastore", | ||
2140 | &load_number, | ||
2141 | &save_number, NULL, | ||
2142 | NULL | ||
2143 | }, | ||
2144 | |||
2145 | { | ||
2146 | "GNUNET_setup_datastore_postgres_config_entry", | ||
2147 | "changed", | ||
2148 | "datastore-postgres", | ||
2149 | "CONFIG", | ||
2150 | gettext_noop ("Configuration for Postgres (passed to PQconnectdb)"), | ||
2151 | "http://www.postgresql.org/docs/8.1/static/libpq.html#LIBPQ-CONNECT", | ||
2152 | &load_text, | ||
2153 | &save_text, NULL, | ||
2154 | NULL | ||
2155 | }, | ||
2156 | |||
2157 | |||
2158 | { | ||
2159 | "GNUNET_setup_fs_migration_from_checkbutton", | ||
2160 | "toggled", | ||
2161 | "fs", | ||
2162 | "CONTENT_PUSHING", | ||
2163 | gettext_noop ("Should we try to push our content to other peers?"), | ||
2164 | "https://gnunet.org/configuration-fs", | ||
2165 | &load_yes_no, | ||
2166 | &save_yes_no, NULL, | ||
2167 | NULL | ||
2168 | }, | ||
2169 | |||
2170 | { | ||
2171 | "GNUNET_setup_fs_migration_to_checkbutton", | ||
2172 | "toggled", | ||
2173 | "fs", | ||
2174 | "CONTENT_CACHING", | ||
2175 | gettext_noop ("Are we allowed to cache content received from other peers?"), | ||
2176 | "https://gnunet.org/configuration-fs", | ||
2177 | &load_yes_no, | ||
2178 | &save_yes_no, NULL, | ||
2179 | NULL | ||
2180 | }, | ||
2181 | |||
2182 | { | ||
2183 | "GNUNET_setup_fs_datacache_sqlite_radiobutton", | ||
2184 | "toggled", | ||
2185 | "dhtcache", | ||
2186 | "DATABASE", | ||
2187 | gettext_noop ("Use sqLite to cache DHT data"), | ||
2188 | "https://gnunet.org/configuration-datacache", | ||
2189 | &load_option_list /* abuse! */, | ||
2190 | &save_option_list /* abuse! */, "sqlite", | ||
2191 | hide_sqlite_datacache_tab | ||
2192 | }, | ||
2193 | |||
2194 | { | ||
2195 | "GNUNET_setup_fs_datacache_mysql_radiobutton", | ||
2196 | "toggled", | ||
2197 | "dhtcache", | ||
2198 | "DATABASE", | ||
2199 | gettext_noop ("Use MySQL to cache DHT data"), | ||
2200 | "https://gnunet.org/configuration-datacache", | ||
2201 | &load_option_list /* abuse! */, | ||
2202 | &save_option_list /* abuse! */, "mysql", | ||
2203 | hide_mysql_datacache_tab | ||
2204 | }, | ||
2205 | |||
2206 | { | ||
2207 | "GNUNET_setup_fs_datacache_postgres_radiobutton", | ||
2208 | "toggled", | ||
2209 | "dhtcache", | ||
2210 | "DATABASE", | ||
2211 | gettext_noop ("Use Postgres to cache DHT data"), | ||
2212 | "https://gnunet.org/configuration-datacache", | ||
2213 | &load_option_list /* abuse! */, | ||
2214 | &save_option_list /* abuse! */, "postgres", | ||
2215 | hide_postgres_datacache_tab | ||
2216 | }, | ||
2217 | |||
2218 | { | ||
2219 | "GNUNET_setup_datacache_mysql_database_name_entry", | ||
2220 | "changed", | ||
2221 | "datacache-mysql", | ||
2222 | "DATABASE", | ||
2223 | gettext_noop ("Name for the MySQL database"), | ||
2224 | "https://gnunet.org/configuration-datacache", | ||
2225 | &load_text, | ||
2226 | &save_text, NULL, | ||
2227 | NULL | ||
2228 | }, | ||
2229 | |||
2230 | { | ||
2231 | "GNUNET_setup_datacache_mysql_config_file_filechooserbutton", | ||
2232 | "selection-changed", | ||
2233 | "datacache-mysql", | ||
2234 | "CONFIG", | ||
2235 | gettext_noop ("Configuration file for MySQL access"), | ||
2236 | "http://dev.mysql.com/doc/refman/5.5/en/option-files.html", | ||
2237 | &load_filename, | ||
2238 | &save_filename, NULL, | ||
2239 | NULL | ||
2240 | }, | ||
2241 | |||
2242 | { | ||
2243 | "GNUNET_setup_datacache_mysql_username_entry", | ||
2244 | "changed", | ||
2245 | "datacache-mysql", | ||
2246 | "USER", | ||
2247 | gettext_noop ("Username for MySQL access"), | ||
2248 | "https://gnunet.org/configuration-datacache", | ||
2249 | &load_text, | ||
2250 | &save_text, NULL, | ||
2251 | NULL | ||
2252 | }, | ||
2253 | |||
2254 | { | ||
2255 | "GNUNET_setup_datacache_mysql_password_entry", | ||
2256 | "changed", | ||
2257 | "datacache-mysql", | ||
2258 | "PASSWORD", | ||
2259 | gettext_noop ("Password for MySQL access"), | ||
2260 | "https://gnunet.org/configuration-datacache", | ||
2261 | &load_text, | ||
2262 | &save_text, NULL, | ||
2263 | NULL | ||
2264 | }, | ||
2265 | |||
2266 | { | ||
2267 | "GNUNET_setup_datacache_mysql_hostname_entry", | ||
2268 | "changed", | ||
2269 | "datacache-mysql", | ||
2270 | "HOST", | ||
2271 | gettext_noop ("Name of host running MySQL database"), | ||
2272 | "https://gnunet.org/configuration-datacache", | ||
2273 | &load_text, | ||
2274 | &save_text, NULL, | ||
2275 | NULL | ||
2276 | }, | ||
2277 | |||
2278 | { | ||
2279 | "GNUNET_setup_transport_wlan_interface_entry", | ||
2280 | "changed", | ||
2281 | "transport-wlan", | ||
2282 | "INTERFACE", | ||
2283 | gettext_noop ("Name of monitoring interface to use (monX)"), | ||
2284 | "https://gnunet.org/configuration-wlan", | ||
2285 | &load_text, | ||
2286 | &save_text, NULL, | ||
2287 | NULL | ||
2288 | }, | ||
2289 | |||
2290 | { | ||
2291 | "GNUNET_setup_datacache_mysql_port_spinbutton", | ||
2292 | "value-changed", | ||
2293 | "datacache-mysql", | ||
2294 | "PORT", | ||
2295 | gettext_noop ("Port of MySQL database"), | ||
2296 | "https://gnunet.org/configuration-datacache", | ||
2297 | &load_number, | ||
2298 | &save_number, NULL, | ||
2299 | NULL | ||
2300 | }, | ||
2301 | |||
2302 | { | ||
2303 | "GNUNET_setup_datacache_postgres_config_entry", | ||
2304 | "changed", | ||
2305 | "datacache-postgres", | ||
2306 | "CONFIG", | ||
2307 | gettext_noop ("Configuration for Postgres (passed to PQconnectdb)"), | ||
2308 | "http://www.postgresql.org/docs/8.1/static/libpq.html#LIBPQ-CONNECT", | ||
2309 | &load_text, | ||
2310 | &save_text, NULL, | ||
2311 | NULL | ||
2312 | }, | ||
2313 | |||
2314 | { | ||
2315 | "GNUNET_setup_vpn_master_interface_entry", | ||
2316 | "changed", | ||
2317 | "vpn", | ||
2318 | "IFNAME", | ||
2319 | gettext_noop ("Name of the virtual interface the GNUnet VPN should create"), | ||
2320 | "https://gnunet.org/configuration-vpn", | ||
2321 | &load_text, | ||
2322 | &save_text, NULL, | ||
2323 | NULL | ||
2324 | }, | ||
2325 | |||
2326 | { | ||
2327 | "GNUNET_setup_vpn_master_interface_v4_ip_entry", | ||
2328 | "changed", | ||
2329 | "vpn", | ||
2330 | "IPV4ADDR", | ||
2331 | gettext_noop ("IPv4 address to use for the VPN interface"), | ||
2332 | "https://gnunet.org/configuration-vpn", | ||
2333 | &load_text, | ||
2334 | &save_text, NULL, | ||
2335 | NULL | ||
2336 | }, | ||
2337 | |||
2338 | { | ||
2339 | "GNUNET_setup_vpn_master_interface_v4_mask_entry", | ||
2340 | "changed", | ||
2341 | "vpn", | ||
2342 | "IPV4MASK", | ||
2343 | gettext_noop ("IPv4 network mask to use for the VPN interface"), | ||
2344 | "https://gnunet.org/configuration-vpn", | ||
2345 | &load_text, | ||
2346 | &save_text, NULL, | ||
2347 | NULL | ||
2348 | }, | ||
2349 | |||
2350 | { | ||
2351 | "GNUNET_setup_vpn_master_interface_v6_ip_entry", | ||
2352 | "changed", | ||
2353 | "vpn", | ||
2354 | "IPV6ADDR", | ||
2355 | gettext_noop ("IPv6 address to use for the VPN interface"), | ||
2356 | "https://gnunet.org/configuration-vpn", | ||
2357 | &load_text, | ||
2358 | &save_text, NULL, | ||
2359 | NULL | ||
2360 | }, | ||
2361 | |||
2362 | { | ||
2363 | "GNUNET_setup_vpn_master_interface_v6_mask_spinbutton", | ||
2364 | "value-changed", | ||
2365 | "vpn", | ||
2366 | "IPV6MASK", | ||
2367 | gettext_noop ("IPv6 network prefix length to use for the VPN interface"), | ||
2368 | "https://gnunet.org/configuration-vpn", | ||
2369 | &load_number, | ||
2370 | &save_number, NULL, | ||
2371 | NULL | ||
2372 | }, | ||
2373 | |||
2374 | { | ||
2375 | "GNUNET_setup_vpn_master_vdns_server_entry", | ||
2376 | "changed", | ||
2377 | "vpn", | ||
2378 | "VIRTDNS", | ||
2379 | gettext_noop ("IP address of the virtual DNS server that resolves through GNUnet (use in resolve.conf if you want to resolve through some GNUnet DNS Exit)"), | ||
2380 | "https://gnunet.org/configuration-vpn", | ||
2381 | &load_text, | ||
2382 | &save_text, NULL, | ||
2383 | NULL | ||
2384 | }, | ||
2385 | |||
2386 | { | ||
2387 | "GNUNET_setup_vpn_enable_vpn_exit_checkbutton", | ||
2388 | "toggled", | ||
2389 | "arm", | ||
2390 | "DEFAULTSERVICES", | ||
2391 | gettext_noop ("Activate the VPN exit to provide services and/or to enable others to use your Internet connection"), | ||
2392 | "https://gnunet.org/configuration-exit", | ||
2393 | &load_option_list, | ||
2394 | &save_option_list, "exit", | ||
2395 | hide_exit_options | ||
2396 | }, | ||
2397 | |||
2398 | { | ||
2399 | "GNUNET_setup_vpn_enable_dns_exit_checkbutton", | ||
2400 | "toggled", | ||
2401 | "dns", | ||
2402 | "PROVIDE_EXIT", | ||
2403 | gettext_noop ("Allow other peers to perform DNS resolutions using your Internet connection"), | ||
2404 | "https://gnunet.org/configuration-dns", | ||
2405 | &load_yes_no, | ||
2406 | &save_yes_no, NULL, | ||
2407 | NULL | ||
2408 | }, | ||
2409 | |||
2410 | { | ||
2411 | "GNUNET_setup_vpn_exit_interface_name_entry", | ||
2412 | "changed", | ||
2413 | "exit", | ||
2414 | "IFNAME", | ||
2415 | gettext_noop ("Name of the virtual interface the GNUnet exit service should create for traffic exiting the VPN to the Internet"), | ||
2416 | "https://gnunet.org/configuration-exit", | ||
2417 | &load_text, | ||
2418 | &save_text, NULL, | ||
2419 | NULL | ||
2420 | }, | ||
2421 | |||
2422 | { | ||
2423 | "GNUNET_setup_vpn_exit_interface_v4_ip_entry", | ||
2424 | "changed", | ||
2425 | "exit", | ||
2426 | "IPV4ADDR", | ||
2427 | gettext_noop ("IPv4 address to use for the VPN Exit interface"), | ||
2428 | "https://gnunet.org/configuration-exit", | ||
2429 | &load_text, | ||
2430 | &save_text, NULL, | ||
2431 | NULL | ||
2432 | }, | ||
2433 | |||
2434 | { | ||
2435 | "GNUNET_setup_vpn_exit_interface_v4_mask_entry", | ||
2436 | "changed", | ||
2437 | "exit", | ||
2438 | "IPV4MASK", | ||
2439 | gettext_noop ("IPv4 network mask to use for the VPN Exit interface"), | ||
2440 | "https://gnunet.org/configuration-exit", | ||
2441 | &load_text, | ||
2442 | &save_text, NULL, | ||
2443 | NULL | ||
2444 | }, | ||
2445 | |||
2446 | { | ||
2447 | "GNUNET_setup_vpn_exit_interface_v6_ip_entry", | ||
2448 | "changed", | ||
2449 | "exit", | ||
2450 | "IPV6ADDR", | ||
2451 | gettext_noop ("IPv6 address to use for the VPN Exit interface"), | ||
2452 | "https://gnunet.org/configuration-exit", | ||
2453 | &load_text, | ||
2454 | &save_text, NULL, | ||
2455 | NULL | ||
2456 | }, | ||
2457 | |||
2458 | { | ||
2459 | "GNUNET_setup_vpn_exit_interface_v6_mask_spinbutton", | ||
2460 | "value-changed", | ||
2461 | "exit", | ||
2462 | "IPV6MASK", | ||
2463 | gettext_noop ("IPv6 network prefix length to use for the VPN Exit interface"), | ||
2464 | "https://gnunet.org/configuration-exit", | ||
2465 | &load_number, | ||
2466 | &save_number, NULL, | ||
2467 | NULL | ||
2468 | }, | ||
2469 | |||
2470 | |||
2471 | { | ||
2472 | "GNUNET_setup_vpn_exit_enable_udp_checkbutton", | ||
2473 | "toggled", | ||
2474 | "exit", | ||
2475 | "ENABLE_UDP", | ||
2476 | gettext_noop ("Allow other users to use your Internet connection for UDP traffic (via the Exit interface)"), | ||
2477 | "https://gnunet.org/configuration-exit", | ||
2478 | &load_yes_no, | ||
2479 | &save_yes_no, NULL, | ||
2480 | NULL | ||
2481 | }, | ||
2482 | |||
2483 | { | ||
2484 | "GNUNET_setup_vpn_exit_enable_tcp_checkbutton", | ||
2485 | "toggled", | ||
2486 | "exit", | ||
2487 | "ENABLE_TCP", | ||
2488 | gettext_noop ("Allow other users to use your Internet connection for TCP traffic (via the Exit interface)"), | ||
2489 | "https://gnunet.org/configuration-exit", | ||
2490 | &load_yes_no, | ||
2491 | &save_yes_no, NULL, | ||
2492 | NULL | ||
2493 | }, | ||
2494 | |||
2495 | /* DNS treeview */ | ||
2496 | |||
2497 | { | ||
2498 | "GNUNET_setup_vpn_dns_service_treeview", | ||
2499 | NULL, | ||
2500 | NULL, | ||
2501 | NULL, | ||
2502 | gettext_noop ("Specification of .gnunet hostnames and services offered by this peer"), | ||
2503 | "https://gnunet.org/configuration-dns", | ||
2504 | &load_vpn_dns_configuration, | ||
2505 | NULL, NULL, | ||
2506 | NULL | ||
2507 | }, | ||
2508 | |||
2509 | { | ||
2510 | "GNUNET_setup_vpn_dns_service_dnsname_cellrenderertext", | ||
2511 | "editing-started", | ||
2512 | NULL, | ||
2513 | NULL, | ||
2514 | NULL, | ||
2515 | "https://gnunet.org/configuration-dns", | ||
2516 | NULL, | ||
2517 | &vpn_dns_service_dnsname_install_edited_handler, | ||
2518 | NULL, | ||
2519 | NULL | ||
2520 | }, | ||
2521 | |||
2522 | { | ||
2523 | "GNUNET_setup_vpn_dns_service_tcpudp_cellrenderertext", | ||
2524 | "editing-started", | ||
2525 | NULL, | ||
2526 | NULL, | ||
2527 | NULL, | ||
2528 | "https://gnunet.org/configuration-dns", | ||
2529 | NULL, | ||
2530 | &vpn_dns_service_tcpudp_install_edited_handler, | ||
2531 | NULL, | ||
2532 | NULL | ||
2533 | }, | ||
2534 | |||
2535 | { | ||
2536 | "GNUNET_setup_vpn_dns_service_sourceport_cellrenderertext", | ||
2537 | "editing-started", | ||
2538 | NULL, | ||
2539 | NULL, | ||
2540 | NULL, | ||
2541 | "https://gnunet.org/configuration-dns", | ||
2542 | NULL, | ||
2543 | &vpn_dns_service_sourceport_install_edited_handler, | ||
2544 | NULL, | ||
2545 | NULL | ||
2546 | }, | ||
2547 | |||
2548 | { | ||
2549 | "GNUNET_setup_vpn_dns_service_targethostname_cellrenderertext", | ||
2550 | "editing-started", | ||
2551 | NULL, | ||
2552 | NULL, | ||
2553 | NULL, | ||
2554 | "https://gnunet.org/configuration-dns", | ||
2555 | NULL, | ||
2556 | &vpn_dns_service_targethostname_install_edited_handler, | ||
2557 | NULL, | ||
2558 | NULL | ||
2559 | }, | ||
2560 | |||
2561 | { | ||
2562 | "GNUNET_setup_vpn_dns_service_targetport_cellrenderertext", | ||
2563 | "editing-started", | ||
2564 | NULL, | ||
2565 | NULL, | ||
2566 | NULL, | ||
2567 | "https://gnunet.org/configuration-dns", | ||
2568 | NULL, | ||
2569 | &vpn_dns_service_targetport_install_edited_handler, | ||
2570 | NULL, | ||
2571 | NULL | ||
2572 | }, | ||
2573 | |||
2574 | /* END of list */ | ||
2575 | |||
2576 | { NULL, NULL, NULL, NULL, NULL, | ||
2577 | NULL, NULL, NULL, NULL } | ||
2578 | }; | ||
2579 | |||
2580 | /* end of gnunet-setup-options.c */ | ||