gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-twister] branch master updated (d174a73 -> d40f539)


From: gnunet
Subject: [GNUnet-SVN] [taler-twister] branch master updated (d174a73 -> d40f539)
Date: Tue, 27 Feb 2018 16:04:30 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a change to branch master
in repository twister.

    from d174a73  test whether status code has been hacked
     new 508e397  indent
     new d40f539  comment.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/include/taler_twister_service.h | 35 ++++++++++++++------------
 src/test/test_twister_webserver.c   | 47 ++++++++++++++++++++--------------
 src/twister/taler-twister-service.c | 22 ++++++++--------
 src/twister/taler-twister.c         | 50 ++++++++++++++++++++-----------------
 src/twister/twister_api.c           | 40 ++++++++++++++++-------------
 5 files changed, 107 insertions(+), 87 deletions(-)

diff --git a/src/include/taler_twister_service.h 
b/src/include/taler_twister_service.h
index 281822b..a5c0e4c 100644
--- a/src/include/taler_twister_service.h
+++ b/src/include/taler_twister_service.h
@@ -3,19 +3,19 @@
       Copyright (C) 2018 Taler Systems SA
 
       Taler is free software; you can redistribute it and/or modify
-      it under the terms of the GNU General Public License as published
-      by the Free Software Foundation; either version 3, or (at your
-      option) any later version.
+      it under the terms of the GNU General Public License as
+      published by the Free Software Foundation; either version 3,
+      or (at your option) any later version.
 
       Taler is distributed in the hope that it will be useful, but
       WITHOUT ANY WARRANTY; without even the implied warranty of
-      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-      General Public License for more details.
+      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+      the GNU General Public License for more details.
 
-      You should have received a copy of the GNU General Public License
-      along with Taler; see the file COPYING.  If not, write to the
-      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-      Boston, MA 02110-1301, USA.
+      You should have received a copy of the GNU General Public
+      License along with Taler; see the file COPYING.  If not,
+      write to the Free Software Foundation, Inc., 51 Franklin
+      Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #ifndef TALER_TWISTER_SERVICE_H_
@@ -53,7 +53,8 @@ struct TALER_TWISTER_Handle;
  * @return handle to use in #TALER_TWISTER_disconnect to disconnect
  */
 struct TALER_TWISTER_Handle *
-TALER_TWISTER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
+TALER_TWISTER_connect
+  (const struct GNUNET_CONFIGURATION_Handle *cfg);
 
 
 /**
@@ -81,10 +82,11 @@ struct TALER_TWISTER_Operation;
  * @return operation handle (to possibly abort)
  */
 struct TALER_TWISTER_Operation *
-TALER_TWISTER_change_response_code (struct TALER_TWISTER_Handle *h,
-                                    unsigned int new_rc,
-                                    GNUNET_SCHEDULER_TaskCallback cb,
-                                    void *cb_cls);
+TALER_TWISTER_change_response_code
+  (struct TALER_TWISTER_Handle *h,
+   unsigned int new_rc,
+   GNUNET_SCHEDULER_TaskCallback cb,
+   void *cb_cls);
 
 
 /**
@@ -92,13 +94,14 @@ TALER_TWISTER_change_response_code (struct 
TALER_TWISTER_Handle *h,
  * changes requested by the operation, or not!  Must be called
  * before the operations callback was invoked.
  *
- * @param op operation to cancel, operation's callback will not be called
+ * @param op operation to cancel, operation's callback will not
+ *        be called
  */
 void
 TALER_TWISTER_cancel (struct TALER_TWISTER_Operation *op);
 
 
-#if 0                           /* keep Emacsens' auto-indent happy */
+#if 0                   /* keep Emacsens' auto-indent happy */
 {
 #endif
 #ifdef __cplusplus
diff --git a/src/test/test_twister_webserver.c 
b/src/test/test_twister_webserver.c
index d4ea655..238155a 100644
--- a/src/test/test_twister_webserver.c
+++ b/src/test/test_twister_webserver.c
@@ -4,19 +4,19 @@
      Copyright (C) 2018 Taler Systems SA
 
      Taler is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     it under the terms of the GNU General Public License as
+     published by the Free Software Foundation; either version 3,
+     or (at your option) any later version.
 
      Taler is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
 
-     You should have received a copy of the GNU General Public License
-     along with Taler; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
+     You should have received a copy of the GNU General Public
+     License along with Taler; see the file COPYING.  If not,
+     write to the Free Software Foundation, Inc., 51 Franklin
+     Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -37,10 +37,11 @@
 #define PORT 8080
 
 static int
-answer_to_connection (void *cls, struct MHD_Connection *connection,
-                      const char *url, const char *method,
-                      const char *version, const char *upload_data,
-                      size_t *upload_data_size, void **con_cls)
+answer_to_connection
+  (void *cls, struct MHD_Connection *connection,
+   const char *url, const char *method,
+   const char *version, const char *upload_data,
+   size_t *upload_data_size, void **con_cls)
 {
   const char *page = "<html><body>Hello, browser!</body></html>";
   struct MHD_Response *response;
@@ -53,23 +54,31 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
   (void)upload_data_size;  /* Unused. Silent compiler warning. */
   (void)con_cls;           /* Unused. Silent compiler warning. */
 
-  response =
-    MHD_create_response_from_buffer (strlen (page), (void *) page, 
-                                    MHD_RESPMEM_PERSISTENT);
+  response = MHD_create_response_from_buffer
+    (strlen (page),
+     (void *) page, 
+     MHD_RESPMEM_PERSISTENT);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
 
   return ret;
 }
 
-
+/**
+ * This minimalist Web server listens on port PORT and responds
+ * with a HTTP status 200 OK and some static "hello world" body,
+ * _always_.
+ */
 int
 main (void)
 {
   struct MHD_Daemon *daemon;
 
-  daemon = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, 
PORT, NULL, NULL,
-                             &answer_to_connection, NULL, MHD_OPTION_END);
+  daemon = MHD_start_daemon (MHD_USE_AUTO
+                             | MHD_USE_INTERNAL_POLLING_THREAD,
+                             PORT, NULL, NULL,
+                             &answer_to_connection, NULL,
+                             MHD_OPTION_END);
   if (NULL == daemon)
     return 1;
   sleep (UINT_MAX);
diff --git a/src/twister/taler-twister-service.c 
b/src/twister/taler-twister-service.c
index 328b5d7..99a1e25 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -4,27 +4,27 @@
      Copyright (C) 2018 Taler Systems SA
 
      GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     it under the terms of the GNU General Public License as
+     published by the Free Software Foundation; either version 3,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
 
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
+     You should have received a copy of the GNU General Public
+     License along with GNUnet; see the file COPYING.  If not,
+     write to the Free Software Foundation, Inc., 51 Franklin
+     Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
 /**
  * @author Martin Schanzenbach
  * @author Christian Grothoff
  * @author Marcello Stanisci
  * @file src/twister/taler-twister-service.c
- * @brief HTTP proxy that acts as a man in the middle making changes to
- *        requests or responses
+ * @brief HTTP proxy that acts as a man in the
+ *        middle making changes to requests or responses
  */
 #include "platform.h"
 #include <microhttpd.h>
diff --git a/src/twister/taler-twister.c b/src/twister/taler-twister.c
index f8aaf95..6eec9a8 100644
--- a/src/twister/taler-twister.c
+++ b/src/twister/taler-twister.c
@@ -3,20 +3,20 @@
       Copyright (C) 2008--2014, 2016 GNUnet e.V.
       Copyright (C) 2018 Taler Systems SA
 
-      Taler is free software; you can redistribute it and/or modify
-      it under the terms of the GNU General Public License as published
-      by the Free Software Foundation; either version 3, or (at your
-      option) any later version.
+      Taler is free software; you can redistribute it and/or
+      modify it under the terms of the GNU General Public License
+      as published by the Free Software Foundation; either version
+      3, or (at your option) any later version.
 
       Taler is distributed in the hope that it will be useful, but
       WITHOUT ANY WARRANTY; without even the implied warranty of
-      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-      General Public License for more details.
+      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+      See the GNU General Public License for more details.
 
-      You should have received a copy of the GNU General Public License
-      along with Taler; see the file COPYING.  If not, write to the
-      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-      Boston, MA 02110-1301, USA.
+      You should have received a copy of the GNU General Public
+      License along with Taler; see the file COPYING.  If not,
+      write to the Free Software Foundation, Inc., 51 Franklin
+      Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -39,8 +39,8 @@ static struct TALER_TWISTER_Handle *tth;
 static int status;
 
 /**
- * What response code value should twister hack into the connection?
- * 0 for no change.
+ * What response code value should twister hack into the
+ * connection? 0 for no change.
  */
 static unsigned int hack_response_code;
 
@@ -83,7 +83,10 @@ handle_acknowledgement (void *cls)
 
 
 /**
- * Actual main function that runs the emulation.
+ * Actual main function that runs the emulation.  Just call
+ * the relevant API function - based on the CL option we read
+ * here - which then sends the twister service the message about
+ * the hack to do.
  *
  * @param cls unused
  * @param args remaining args, unused
@@ -106,11 +109,11 @@ run (void *cls,
     return;
   }
   if ( (0 != hack_response_code) &&
-       (NULL !=
-        TALER_TWISTER_change_response_code (tth,
-                                            hack_response_code,
-                                            &handle_acknowledgement,
-                                            NULL)) )
+       (NULL != TALER_TWISTER_change_response_code
+         (tth,
+          hack_response_code,
+          &handle_acknowledgement,
+          NULL)) )
     num_ops++;
 
   /* TODO: add other operations here */
@@ -135,11 +138,12 @@ main (int argc,
       char *const *argv)
 {
   struct GNUNET_GETOPT_CommandLineOption options[] = {
-    GNUNET_GETOPT_option_uint ('r',
-                               "responsecode",
-                               "STATUS",
-                               gettext_noop ("set the next response code to 
STATUS"),
-                               &hack_response_code),
+    GNUNET_GETOPT_option_uint
+      ('r',
+       "responsecode",
+       "STATUS",
+       gettext_noop ("set the next response code to STATUS"),
+       &hack_response_code),
     GNUNET_GETOPT_OPTION_END
   };
 
diff --git a/src/twister/twister_api.c b/src/twister/twister_api.c
index b791bc7..78f0427 100644
--- a/src/twister/twister_api.c
+++ b/src/twister/twister_api.c
@@ -4,19 +4,19 @@
      Copyright (C) 2018 Taler Systems SA
 
      Taler is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     it under the terms of the GNU General Public License as
+     published by the Free Software Foundation; either version 3,
+     or (at your option) any later version.
 
      Taler is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
-     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+     See the GNU General Public License for more details.
 
-     You should have received a copy of the GNU General Public License
-     along with Taler; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
+     You should have received a copy of the GNU General Public
+     License along with Taler; see the file COPYING.  If not,
+     write to the Free Software Foundation, Inc., 51 Franklin
+     Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -30,7 +30,8 @@
 #include "taler_twister_service.h"
 #include "twister.h"
 
-#define LOG(kind,...) GNUNET_log_from (kind, "twister-api",__VA_ARGS__)
+#define LOG(kind,...) \
+  GNUNET_log_from (kind, "twister-api",__VA_ARGS__)
 
 
 
@@ -208,10 +209,11 @@ TALER_TWISTER_cancel (struct TALER_TWISTER_Operation *op)
  * @return operation handle (to possibly abort)
  */
 struct TALER_TWISTER_Operation *
-TALER_TWISTER_change_response_code (struct TALER_TWISTER_Handle *h,
-                                    unsigned int new_rc,
-                                    GNUNET_SCHEDULER_TaskCallback cb,
-                                    void *cb_cls)
+TALER_TWISTER_change_response_code
+  (struct TALER_TWISTER_Handle *h,
+   unsigned int new_rc,
+   GNUNET_SCHEDULER_TaskCallback cb,
+   void *cb_cls)
 {
   struct TALER_TWISTER_Operation *op;
   struct GNUNET_MQ_Envelope *env;
@@ -224,11 +226,13 @@ TALER_TWISTER_change_response_code (struct 
TALER_TWISTER_Handle *h,
   GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
                                     h->op_tail,
                                     op);
-  env = GNUNET_MQ_msg (src,
-                       TWISTER_MESSAGE_TYPE_SET_RESPONSE_CODE);
+  /* Prepare *env*elope. */
+  env = GNUNET_MQ_msg
+    (src, TWISTER_MESSAGE_TYPE_SET_RESPONSE_CODE);
+  /* Put data into the envelope. */
   src->response_code = htonl ((uint32_t) new_rc);
-  GNUNET_MQ_send (h->mq,
-                  env);
+  /* Send message. */
+  GNUNET_MQ_send (h->mq, env);
   return op;
 }
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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