gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r28345 - gnunet/src/experimentation


From: gnunet
Subject: [GNUnet-SVN] r28345 - gnunet/src/experimentation
Date: Thu, 1 Aug 2013 10:50:53 +0200

Author: wachs
Date: 2013-08-01 10:50:53 +0200 (Thu, 01 Aug 2013)
New Revision: 28345

Modified:
   gnunet/src/experimentation/gnunet-daemon-experimentation.c
   gnunet/src/experimentation/gnunet-daemon-experimentation.h
   gnunet/src/experimentation/gnunet-daemon-experimentation_capabilities.c
   gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
   gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
   gnunet/src/experimentation/gnunet-daemon-experimentation_scheduler.c
   gnunet/src/experimentation/gnunet-daemon-experimentation_storage.c
Log:
refactoring since names are too long


Modified: gnunet/src/experimentation/gnunet-daemon-experimentation.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation.c  2013-08-01 
08:14:24 UTC (rev 28344)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation.c  2013-08-01 
08:50:53 UTC (rev 28345)
@@ -55,11 +55,11 @@
 {
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Experimentation daemon shutting down 
...\n"));
 
-  GNUNET_EXPERIMENTATION_scheduler_stop ();
-  GNUNET_EXPERIMENTATION_nodes_stop ();
-  GNUNET_EXPERIMENTATION_experiments_stop ();
-  GNUNET_EXPERIMENTATION_storage_stop ();
-  GNUNET_EXPERIMENTATION_capabilities_stop ();
+  GED_scheduler_stop ();
+  GED_nodes_stop ();
+  GED_experiments_stop ();
+  GED_storage_stop ();
+  GED_capabilities_stop ();
 }
 
 
@@ -85,18 +85,18 @@
                return;
        }
 
-       GNUNET_EXPERIMENTATION_capabilities_start ();
+       GED_capabilities_start ();
 
-       GNUNET_EXPERIMENTATION_storage_start ();
+       GED_storage_start ();
 
-       if (GNUNET_SYSERR == GNUNET_EXPERIMENTATION_experiments_start ())
+       if (GNUNET_SYSERR == GED_experiments_start ())
        {
          GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
          return;
        }
 
-       GNUNET_EXPERIMENTATION_nodes_start ();
-  GNUNET_EXPERIMENTATION_scheduler_start ();
+       GED_nodes_start ();
+  GED_scheduler_start ();
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task,
                                 NULL);
 }

Modified: gnunet/src/experimentation/gnunet-daemon-experimentation.h
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation.h  2013-08-01 
08:14:24 UTC (rev 28344)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation.h  2013-08-01 
08:50:53 UTC (rev 28345)
@@ -209,24 +209,24 @@
 };
 
 int
-GNUNET_EXPERIMENTATION_nodes_rts (struct Node *n);
+GED_nodes_rts (struct Node *n);
 
 int
-GNUNET_EXPERIMENTATION_nodes_request_start (struct Node *n, struct Experiment 
*e);
+GED_nodes_request_start (struct Node *n, struct Experiment *e);
 
 
 /**
  * Start the nodes management
  */
 void
-GNUNET_EXPERIMENTATION_nodes_start ();
+GED_nodes_start ();
 
 
 /**
  * Stop the nodes management
  */
 void
-GNUNET_EXPERIMENTATION_nodes_stop ();
+GED_nodes_stop ();
 
 
 /**
@@ -236,7 +236,7 @@
  * @return the string to print
  */
 const char *
-GNUNET_EXPERIMENTATION_capability_to_str (uint32_t cap);
+GED_capability_to_str (uint32_t cap);
 
 
 /**
@@ -247,21 +247,21 @@
  * @return GNUNET_YES or GNUNET_NO
  */
 int
-GNUNET_EXPERIMENTATION_capabilities_have (uint32_t have, uint32_t desired);
+GED_capabilities_have (uint32_t have, uint32_t desired);
 
 
 /**
  * Start the detecting capabilities
  */
 void
-GNUNET_EXPERIMENTATION_capabilities_start ();
+GED_capabilities_start ();
 
 
 /**
  * Stop the detecting capabilities
  */
 void
-GNUNET_EXPERIMENTATION_capabilities_stop ();
+GED_capabilities_stop ();
 
 
 /**
@@ -270,13 +270,13 @@
  * @return GNUNET_YES or GNUNET_NO
  */
 int
-GNUNET_EXPERIMENTATION_experiments_issuer_accepted (struct GNUNET_PeerIdentity 
*issuer_ID);
+GED_experiments_issuer_accepted (struct GNUNET_PeerIdentity *issuer_ID);
 
 
 typedef void (*GNUNET_EXPERIMENTATION_experiments_get_cb) (struct Node *n, 
struct Experiment *e);
 
 void
-GNUNET_EXPERIMENTATION_experiments_get (struct Node *n,
+GED_experiments_get (struct Node *n,
                                                                                
                                                                                
struct GNUNET_PeerIdentity *issuer,
                                                                                
                                                                                
GNUNET_EXPERIMENTATION_experiments_get_cb get_cb);
 
@@ -286,41 +286,69 @@
  * @return GNUNET_OK on success, GNUNET_SYSERR on error
  */
 int
-GNUNET_EXPERIMENTATION_experiments_start ();
+GED_experiments_start ();
 
 
 /**
  * Stop experiments management
  */
 void
-GNUNET_EXPERIMENTATION_experiments_stop ();
+GED_experiments_stop ();
 
+/**
+ * Handle a START message from a remote node
+ *
+ * @param n the node
+ * @param e the experiment
+ */
+void
+GED_scheduler_handle_start (struct Node *n, struct Experiment *e);
 
+
 /**
+ * Handle a START_ACL message from a remote node
+ *
+ * @param n the node
+ * @param e the experiment
+ */
+void
+GED_scheduler_handle_start_ack (struct Node *n, struct Experiment *e);
+
+/**
+ * Handle a STOP message from a remote node
+ *
+ * @param n the node
+ * @param e the experiment
+ */
+void
+GED_scheduler_handle_stop (struct Node *n, struct Experiment *e);
+
+
+/**
  * Start the scheduler component
  */
 void
-GNUNET_EXPERIMENTATION_scheduler_add (struct Node *n, struct Experiment *e);
+GED_scheduler_add (struct Node *n, struct Experiment *e);
 
 /**
  * Start the scheduler component
  */
 void
-GNUNET_EXPERIMENTATION_scheduler_start ();
+GED_scheduler_start ();
 
 
 /**
  * Stop the scheduler component
  */
 void
-GNUNET_EXPERIMENTATION_scheduler_stop ();
+GED_scheduler_stop ();
 
 
 /**
  * Start the storage component
  */
 void
-GNUNET_EXPERIMENTATION_storage_start ();
+GED_storage_start ();
 
 
 
@@ -328,7 +356,7 @@
  * Stop the storage component
  */
 void
-GNUNET_EXPERIMENTATION_storage_stop ();
+GED_storage_stop ();
 
 
 /* end of gnunet-daemon-experimentation.h */

Modified: 
gnunet/src/experimentation/gnunet-daemon-experimentation_capabilities.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_capabilities.c     
2013-08-01 08:14:24 UTC (rev 28344)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_capabilities.c     
2013-08-01 08:50:53 UTC (rev 28345)
@@ -57,7 +57,7 @@
  * @return the string to print
  */
 const char *
-GNUNET_EXPERIMENTATION_capability_to_str (uint32_t cap)
+GED_capability_to_str (uint32_t cap)
 {
        char * capstr[] = GNUNET_EXPERIMENTATION_capabilities_string;
        unsigned index = 0;
@@ -89,7 +89,7 @@
  * @return GNUNET_YES or GNUNET_NO
  */
 int
-GNUNET_EXPERIMENTATION_capabilities_have (uint32_t have, uint32_t desired)
+GED_capabilities_have (uint32_t have, uint32_t desired)
 {
        if (desired == (desired & have))
                return GNUNET_YES;
@@ -102,7 +102,7 @@
  * Start the detecting capabilities
  */
 void
-GNUNET_EXPERIMENTATION_capabilities_start ()
+GED_capabilities_start ()
 {
        char *plugins;
   char *pos;
@@ -152,10 +152,10 @@
   {
                index = 1;
                index = index << c1;
-               if (GNUNET_YES == GNUNET_EXPERIMENTATION_capabilities_have 
(GSE_node_capabilities, index))
+               if (GNUNET_YES == GED_capabilities_have (GSE_node_capabilities, 
index))
                {
                        GNUNET_log (GNUNET_ERROR_TYPE_INFO, "We have `%s'\n",
-                                       
GNUNET_EXPERIMENTATION_capability_to_str(index));
+                                       GED_capability_to_str(index));
                }
   }
 }
@@ -165,7 +165,7 @@
  * Stop the detecting capabilities
  */
 void
-GNUNET_EXPERIMENTATION_capabilities_stop ()
+GED_capabilities_stop ()
 {
 
 }

Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c      
2013-08-01 08:14:24 UTC (rev 28344)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_experiments.c      
2013-08-01 08:50:53 UTC (rev 28345)
@@ -133,7 +133,7 @@
  * @return GNUNET_YES or GNUNET_NO
  */
 int
-GNUNET_EXPERIMENTATION_experiments_issuer_accepted (struct GNUNET_PeerIdentity 
*issuer_ID)
+GED_experiments_issuer_accepted (struct GNUNET_PeerIdentity *issuer_ID)
 {
        if (GNUNET_CONTAINER_multihashmap_contains (valid_issuers, 
&issuer_ID->hashPubKey))
                return GNUNET_YES;
@@ -164,7 +164,7 @@
 
 
 void
-GNUNET_EXPERIMENTATION_experiments_get (struct Node *n,
+GED_experiments_get (struct Node *n,
                                                                                
                                                                                
struct GNUNET_PeerIdentity *issuer,
                                                                                
                                                                                
GNUNET_EXPERIMENTATION_experiments_get_cb get_cb)
 {
@@ -355,7 +355,7 @@
  * Start experiments management
  */
 int
-GNUNET_EXPERIMENTATION_experiments_start ()
+GED_experiments_start ()
 {
        struct Issuer *i;
        char *issuers;
@@ -395,7 +395,7 @@
   if (0 == GNUNET_CONTAINER_multihashmap_size (valid_issuers))
   {
                GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("No valid experiment 
issuers configured! Set value to peer id of issuer! Exit...\n"));
-               GNUNET_EXPERIMENTATION_experiments_stop ();
+               GED_experiments_stop ();
                return GNUNET_SYSERR;
   }
   GNUNET_STATISTICS_set (GSE_stats, "# issuer", 
GNUNET_CONTAINER_multihashmap_size (valid_issuers), GNUNET_NO);
@@ -444,7 +444,7 @@
  * Stop experiments management
  */
 void
-GNUNET_EXPERIMENTATION_experiments_stop ()
+GED_experiments_stop ()
 {
        if (NULL != GSE_my_issuer)
        {

Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c    
2013-08-01 08:14:24 UTC (rev 28344)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_nodes.c    
2013-08-01 08:50:53 UTC (rev 28345)
@@ -316,7 +316,7 @@
                        GNUNET_i2s (&n->id));
 
        /* Tell the scheduler to add a node with an experiment */
-       GNUNET_EXPERIMENTATION_scheduler_add (n, e);
+       GED_scheduler_add (n, e);
        counter ++;
 }
 
@@ -338,7 +338,7 @@
        for (c1 = 0; c1 < n->issuer_count; c1++)
        {
 
-               GNUNET_EXPERIMENTATION_experiments_get (n, &n->issuer_id[c1], 
&get_experiments_cb);
+               GED_experiments_get (n, &n->issuer_id[c1], &get_experiments_cb);
        }
 }
 
@@ -416,7 +416,7 @@
        ic_accepted = 0;
        for (c1 = 0; c1 < ic; c1++)
        {
-               if (GNUNET_YES == 
GNUNET_EXPERIMENTATION_experiments_issuer_accepted(&rmi[c1].issuer_id))
+               if (GNUNET_YES == 
GED_experiments_issuer_accepted(&rmi[c1].issuer_id))
                        ic_accepted ++;
        }
        GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Request from peer `%s' with %u 
issuers, we accepted %u issuer \n"),
@@ -426,7 +426,7 @@
        c2 = 0;
        for (c1 = 0; c1 < ic; c1++)
        {
-                       if (GNUNET_YES == 
GNUNET_EXPERIMENTATION_experiments_issuer_accepted(&rmi[c1].issuer_id))
+                       if (GNUNET_YES == 
GED_experiments_issuer_accepted(&rmi[c1].issuer_id))
                        {
                                n->issuer_id[c2] = rmi[c1].issuer_id;
                                c2 ++;
@@ -524,7 +524,7 @@
        ic_accepted = 0;
        for (c1 = 0; c1 < ic; c1++)
        {
-               if (GNUNET_YES == 
GNUNET_EXPERIMENTATION_experiments_issuer_accepted(&rmi[c1].issuer_id))
+               if (GNUNET_YES == 
GED_experiments_issuer_accepted(&rmi[c1].issuer_id))
                        ic_accepted ++;
        }
        GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Response from peer `%s' with %u 
issuers, we accepted %u issuer \n"),
@@ -534,7 +534,7 @@
        c2 = 0;
        for (c1 = 0; c1 < ic; c1++)
        {
-                       if (GNUNET_YES == 
GNUNET_EXPERIMENTATION_experiments_issuer_accepted(&rmi[c1].issuer_id))
+                       if (GNUNET_YES == 
GED_experiments_issuer_accepted(&rmi[c1].issuer_id))
                        {
                                n->issuer_id[c2] = rmi[c1].issuer_id;
                                c2 ++;
@@ -555,9 +555,7 @@
 static void handle_start (const struct GNUNET_PeerIdentity *peer,
                                                                                
                                 const struct GNUNET_MessageHeader *message)
 {
-fprintf (stderr, "FIXME\n");
-       GNUNET_STATISTICS_update (GSE_stats, "# experiments running",
-                       1, GNUNET_NO);
+       GED_scheduler_handle_start (NULL, NULL);
 }
 
 /**
@@ -569,7 +567,7 @@
 static void handle_start_ack (const struct GNUNET_PeerIdentity *peer,
                                                                                
                                 const struct GNUNET_MessageHeader *message)
 {
-
+       GED_scheduler_handle_start_ack (NULL, NULL);
 }
 
 /**
@@ -581,7 +579,7 @@
 static void handle_stop (const struct GNUNET_PeerIdentity *peer,
                                                                                
                                 const struct GNUNET_MessageHeader *message)
 {
-
+       GED_scheduler_handle_stop (NULL, NULL);
 }
 
 /**
@@ -712,7 +710,7 @@
 }
 
 int
-GNUNET_EXPERIMENTATION_nodes_rts (struct Node *n)
+GED_nodes_rts (struct Node *n)
 {
        if (NULL == n->cth)
                return GNUNET_YES;
@@ -727,7 +725,7 @@
  * @return GNUNET_NO if core was busy with sending, GNUNET_OK otherwise
  */
 int
-GNUNET_EXPERIMENTATION_nodes_request_start (struct Node *n, struct Experiment 
*e)
+GED_nodes_request_start (struct Node *n, struct Experiment *e)
 {
        struct ExperimentStartCtx *e_ctx;
 
@@ -762,7 +760,7 @@
  * Start the nodes management
  */
 void
-GNUNET_EXPERIMENTATION_nodes_start ()
+GED_nodes_start ()
 {
        /* Connecting to core service to find partners */
        ch = GNUNET_CORE_connect (GSE_cfg, NULL,
@@ -787,7 +785,7 @@
  * Stop the nodes management
  */
 void
-GNUNET_EXPERIMENTATION_nodes_stop ()
+GED_nodes_stop ()
 {
   if (NULL != ch)
   {

Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_scheduler.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_scheduler.c        
2013-08-01 08:14:24 UTC (rev 28344)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_scheduler.c        
2013-08-01 08:50:53 UTC (rev 28345)
@@ -104,7 +104,7 @@
 
        se->task = GNUNET_SCHEDULER_NO_TASK;
 
-       if (GNUNET_NO == GNUNET_EXPERIMENTATION_nodes_rts (se->n))
+       if (GNUNET_NO == GED_nodes_rts (se->n))
        {
                se->state = BUSY;
                backoff = GNUNET_TIME_UNIT_SECONDS;
@@ -120,7 +120,7 @@
        if (NOT_RUNNING == se->state)
        {
                        /* Send start message */
-                       GNUNET_EXPERIMENTATION_nodes_request_start (se->n, 
se->e);
+                       GED_nodes_request_start (se->n, se->e);
                        se->state = REQUESTED;
                        se->task = GNUNET_SCHEDULER_add_delayed 
(EXP_RESPONSE_TIMEOUT, &request_timeout, se);
 
@@ -161,29 +161,50 @@
 }
 
 /**
- * Start the scheduler component
+ * Handle a START message from a remote node
+ *
+ * @param n the node
+ * @param e the experiment
  */
 void
-GNUNET_EXPERIMENTATION_scheduler_handle_start (struct Node *n, struct 
Experiment *e)
+GED_scheduler_handle_start (struct Node *n, struct Experiment *e)
 {
 
 }
 
+/**
+ * Handle a START_ACL message from a remote node
+ *
+ * @param n the node
+ * @param e the experiment
+ */
+void
+GED_scheduler_handle_start_ack (struct Node *n, struct Experiment *e)
+{
 
+}
+
+
 /**
- * Start the scheduler component
+ * Handle a STOP message from a remote node
+ *
+ * @param n the node
+ * @param e the experiment
  */
 void
-GNUNET_EXPERIMENTATION_scheduler_handle_stop (struct Node *n, struct 
Experiment *e)
+GED_scheduler_handle_stop (struct Node *n, struct Experiment *e)
 {
 
 }
 
 /**
- * Start the scheduler component
+ * Add a new experiment for a node
+ *
+ * @param n the node
+ * @param e the experiment
  */
 void
-GNUNET_EXPERIMENTATION_scheduler_add (struct Node *n, struct Experiment *e)
+GED_scheduler_add (struct Node *n, struct Experiment *e)
 {
        struct ScheduledExperiment *se;
        struct GNUNET_TIME_Relative start;
@@ -216,7 +237,7 @@
  * Start the scheduler component
  */
 void
-GNUNET_EXPERIMENTATION_scheduler_start ()
+GED_scheduler_start ()
 {
        experiments_requested = 0;
        experiments_scheduled = 0;
@@ -227,7 +248,7 @@
  * Stop the scheduler component
  */
 void
-GNUNET_EXPERIMENTATION_scheduler_stop ()
+GED_scheduler_stop ()
 {
        struct ScheduledExperiment *cur;
        struct ScheduledExperiment *next;

Modified: gnunet/src/experimentation/gnunet-daemon-experimentation_storage.c
===================================================================
--- gnunet/src/experimentation/gnunet-daemon-experimentation_storage.c  
2013-08-01 08:14:24 UTC (rev 28344)
+++ gnunet/src/experimentation/gnunet-daemon-experimentation_storage.c  
2013-08-01 08:50:53 UTC (rev 28345)
@@ -36,7 +36,7 @@
  * Start the storage component
  */
 void
-GNUNET_EXPERIMENTATION_storage_start ()
+GED_storage_start ()
 {
 
 }
@@ -46,7 +46,7 @@
  * Stop the storage component
  */
 void
-GNUNET_EXPERIMENTATION_storage_stop ()
+GED_storage_stop ()
 {
 
 }




reply via email to

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