gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r3321 - in GNUnet: . contrib src/setup/lib


From: grothoff
Subject: [GNUnet-SVN] r3321 - in GNUnet: . contrib src/setup/lib
Date: Fri, 25 Aug 2006 23:04:13 -0700 (PDT)

Author: grothoff
Date: 2006-08-25 23:04:09 -0700 (Fri, 25 Aug 2006)
New Revision: 3321

Modified:
   GNUnet/contrib/config-daemon.scm
   GNUnet/src/setup/lib/tree.c
   GNUnet/todo
Log:
making advanced visibility change work

Modified: GNUnet/contrib/config-daemon.scm
===================================================================
--- GNUnet/contrib/config-daemon.scm    2006-08-26 05:25:21 UTC (rev 3320)
+++ GNUnet/contrib/config-daemon.scm    2006-08-26 06:04:09 UTC (rev 3321)
@@ -51,8 +51,8 @@
 
 (define (meta-exp builder) 
  (builder
-   (_ "Meta")
-   (_ "EXPERIMENTAL")
+   "Meta"
+   "EXPERIMENTAL"
    (_ "Prompt for development and/or incomplete code")
    (_
 "If EXPERIMENTAL is set to NO, options for experimental code are not
@@ -82,8 +82,8 @@
 
 (define (meta-adv builder) 
  (builder
-   (_ "Meta")
-   (_ "ADVANCED")
+   "Meta"
+   "ADVANCED"
    (_ "Show options for advanced users")
    (_
 "These are options that maybe difficult to understand for the beginner.
@@ -95,29 +95,82 @@
    #f
    'always) )
 
-
-
 (define (meta builder)
  (builder
-   (_ "Meta") 
+   "Meta"
    "" 
    (_ "Meta-configuration") 
    (_ "Which level of configuration should be available")
-   (list (meta-exp builder) (meta-adv builder) )
+   (list 
+     (meta-exp builder)
+     (meta-adv builder) 
+   )
    #t
    #f
    #f
    'always) )
 
+;; General menu
+
+(define (general-helloexpires builder)
+ (builder
+  "GNUNETD"
+  "HELLOEXPIRES"
+  (_ "How many minutes should peer advertisements last?")
+  (_
+"How many minutes is the current IP valid?  (GNUnet will sign HELLO
+messages with this expiration timeline. If you are on dialup, 60 (for
+1 hour) is suggested. If you are having a static IP address, you may
+want to set this to a large value (say 14400).  The default is 1440 (1
+day). If your IP changes periodically, you will want to choose the
+expiration to be smaller than the frequency with which your IP
+changes." )
+  '()
+  #t
+  1440
+  (cons 1 14400)
+  'advanced) )
+
+(define (general-loglevel builder)
+ (builder
+  "GNUNETD"
+  "LOGLEVEL"
+  (_ "Log level")
+  (_ "How verbose should the logging of errors be?")
+  '()
+  #t
+  "WARNING"
+  (list "NOTHING" "DEBUG" "STATUS" "INFO" "WARNING" "ERROR" "FATAL")
+  'always) )
+
+(define (general builder)
+ (builder
+  "GNUNETD"
+  ""
+  (_ "General settings")
+  (_ "Settings that change the behavior of GNUnet in general")
+  (list 
+    (general-helloexpires builder) 
+    (general-loglevel builder) 
+  )
+  #t
+  #f
+  #f
+  'always) )
+
+
 ;; main-menu
 
 (define (main builder)
  (builder 
-  (_ "Root")
+  "Root"
   ""
   (_ "Root node")
   (nohelp)
-  (list (meta builder) )
+  (list 
+    (meta builder)
+    (general builder) 
+  )
   #t 
   #f 
   #f 
@@ -139,8 +192,14 @@
 ;; the tree builder but this time scan use the "i" tags to determine
 ;; how the visibility needs to change
 
-(define (gnunet-config-change ctx root changed)
- 0)
+(define (gnunet-config-change ctx)
+ (let ((advanced (get-option ctx "Meta" "ADVANCED")))
+   (main
+     (lambda (a b c d e f g h i) 
+        (begin 
+          (if (eq? i 'advanced)
+            (change-visible ctx a b advanced)
+            'nothing ) ) ) ) ) )
 
 ;; Example: (change-visible ctx "FOO" "BAR" #t)
 

Modified: GNUnet/src/setup/lib/tree.c
===================================================================
--- GNUnet/src/setup/lib/tree.c 2006-08-26 05:25:21 UTC (rev 3320)
+++ GNUnet/src/setup/lib/tree.c 2006-08-26 06:04:09 UTC (rev 3321)
@@ -112,8 +112,8 @@
 }
 
 SCM get_option(SCM smob,
-              SCM option,
-              SCM section) {
+              SCM section,
+              SCM option) {
   TC * tc;
   char * opt;
   char * sec;
@@ -151,8 +151,8 @@
  * tree (and notify listeners about change).
  */
 SCM change_visible(SCM smob,
-                  SCM option,
                   SCM section,
+                  SCM option,
                   SCM yesno) {
   TC * tc;
   char * opt;
@@ -168,7 +168,7 @@
   tc    = (TC *) SCM_SMOB_DATA(smob);
   opt = scm_to_locale_string(option);
   sec = scm_to_locale_string(section);
-  val = scm_is_true(scm_boolean_p(yesno)) ? 1 : 0;
+  val = scm_is_true(yesno) ? 1 : 0;
   t = tree_lookup(tc->root,
                  sec,
                  opt);
@@ -176,10 +176,6 @@
     t->visible = val;
     tc->vcl(tc->ctx,
            t);  
-    fprintf(stderr,
-           "Changing visibility of entry `%s' in section `%s'\n",
-           opt,
-           sec);
   } else {
     fprintf(stderr,
            _("Internal error: entry `%s' in section `%s' not found for 
visibility change!\n"),
@@ -243,7 +239,9 @@
     /* no checks */
   } else {
     SCM_ASSERT(0, 
-              range, SCM_ARG7, "build_tree_node"); /* invalid type */
+              range,
+              SCM_ARG7, 
+              "build_tree_node"); /* invalid type */
   }
 
   /* construct C object */
@@ -320,18 +318,10 @@
   return ret;
 }
 
-struct NCI {
-  TC * tc;
-  struct GNS_Tree * root;
-  struct GNS_Tree * change;
-};
-
 static void *
 notify_change_internal(void * cls) {
-  struct NCI * n = cls;
+  TC * tc = cls;
   SCM smob_ctx;
-  SCM smob_root;
-  SCM smob_chng;
   SCM proc;
 
   /* I hope that loading of "specification" from
@@ -339,10 +329,8 @@
      Otherwise we have to re-do this here */
   scm_c_primitive_load("/home/grothoff/share/GNUnet/config-daemon.scm");
   proc = scm_variable_ref(scm_c_lookup("gnunet-config-change"));
-  smob_ctx = box_tc(n->tc);
-  smob_root = box_tree(n->root);
-  smob_chng = box_tree(n->change);
-  scm_apply_3(proc, smob_ctx, smob_root, smob_chng, SCM_EOL);
+  smob_ctx = box_tc(tc);
+  scm_apply_1(proc, smob_ctx, SCM_EOL);
   return NULL;
 }
 
@@ -359,15 +347,11 @@
                        struct GNS_Tree * root,
                        struct GNS_Tree * change) {
   TC tc;
-  struct NCI n;
   
   tc.vcl = vcl;
   tc.ctx = ctx;
   tc.root = root;
-  n.tc = &tc;
-  n.root = root;
-  n.change = change;
-  scm_with_guile(&notify_change_internal, &n);
+  scm_with_guile(&notify_change_internal, &tc);
 }
 
 static void * init_helper(void * unused) {

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2006-08-26 05:25:21 UTC (rev 3320)
+++ GNUnet/todo 2006-08-26 06:04:09 UTC (rev 3321)
@@ -35,14 +35,12 @@
       must still be revised to match new API!
     + rest: vpn
     + low priority: chat, dht, testbed
-  * setup:
-    + main binary compiles, plugins are missing
-      consider reorganization (subdirectories):
-      - gtk
-      - curses
-      - text
-      - util (add src/include header with decent API!)
-      - main (just plugin loader)
+  * setup missing:
+    + gtk config
+    + gtk wizard
+    + ncurses config
+    + ncurses wizard
+    + scm specification of configuration
 - adapt util testcases and main GNUnet codebase
 - use new util to improve error handling capabilities
 - use new util to clean up gnunet-setup





reply via email to

[Prev in Thread] Current Thread [Next in Thread]