gnunet-svn
[Top][All Lists]
Advanced

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

[taler-donau] branch master updated: added get charities route to httpd


From: gnunet
Subject: [taler-donau] branch master updated: added get charities route to httpd
Date: Sun, 07 Jan 2024 15:04:39 +0100

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

johannes-casaburi pushed a commit to branch master
in repository donau.

The following commit(s) were added to refs/heads/master by this push:
     new 081427c  added get charities route to httpd
081427c is described below

commit 081427c8f1e4c7e2d5315add1b69a1973e07d649
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
AuthorDate: Sun Jan 7 15:03:47 2024 +0100

    added get charities route to httpd
---
 contrib/gana                          |  2 +-
 src/donau/Makefile.am                 |  3 ++-
 src/donau/donau-httpd.c               | 16 ++++++++++++----
 src/donau/donau-httpd_charity.h       | 17 ++++++++++++++---
 src/donau/donau-httpd_get-charities.c |  9 ++++++---
 5 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/contrib/gana b/contrib/gana
index 6d3fb42..40f6cf1 160000
--- a/contrib/gana
+++ b/contrib/gana
@@ -1 +1 @@
-Subproject commit 6d3fb428f0a2dd5bc5f35516ea77c32c2cf0ecfa
+Subproject commit 40f6cf1015231663064eda98aa1e403cddd7b970
diff --git a/src/donau/Makefile.am b/src/donau/Makefile.am
index b294804..1225358 100644
--- a/src/donau/Makefile.am
+++ b/src/donau/Makefile.am
@@ -38,7 +38,8 @@ donau_httpd_LDADD = \
 donau_httpd_SOURCES = \
   donau-httpd.c donau-httpd.h \
   donau-httpd_keys.c donau-httpd_keys.h \
-  donau-httpd_config.c donau-httpd_config.h
+  donau-httpd_config.c donau-httpd_config.h \
+  donau-httpd_get-charities.c donau_httpd_charity.h
 
 # Testcases
 
diff --git a/src/donau/donau-httpd.c b/src/donau/donau-httpd.c
index 54c750d..8ce6ec8 100644
--- a/src/donau/donau-httpd.c
+++ b/src/donau/donau-httpd.c
@@ -35,6 +35,7 @@
 #include "donau_util.h"
 #include "donau-httpd_config.h"
 #include "donau-httpd_keys.h"
+#include "donau-httpd_charity.h"
 
 /**
  * Backlog for listen operation on unix domain sockets.
@@ -50,7 +51,7 @@
  * Above what request latency do we start to log?
  */
  #define WARN_LATENCY GNUNET_TIME_relative_multiply ( \
-    GNUNET_TIME_UNIT_MILLISECONDS, 500)
+           GNUNET_TIME_UNIT_MILLISECONDS, 500)
 
 /**
  * Are clients allowed to request /keys for times other than the
@@ -429,13 +430,20 @@ handle_mhd_request (void *cls,
     {
       .url = "keys",
       .method = MHD_HTTP_METHOD_GET,
-      .handler.get = &DH_keys_get_handler,
-      .nargs = 1
+      .handler.get = &DH_keys_get_handler// ,
+                     // .nargs = 1
+    },
+    /* GET charities */
+    {
+      .url = "charities",
+      .method = MHD_HTTP_METHOD_GET,
+      .handler.get = &DH_handler_charities_get
     },
     /**
     etc
 
-    Add routes here
+    Add routes here (also make sure to add the
+    corresponding lines in the makefile)
     */
     /* mark end of list */
     {
diff --git a/src/donau/donau-httpd_charity.h b/src/donau/donau-httpd_charity.h
index 2e54cf1..4210cfa 100644
--- a/src/donau/donau-httpd_charity.h
+++ b/src/donau/donau-httpd_charity.h
@@ -18,11 +18,11 @@
  * @brief Handle /charity requests
  * @author Johannes Casaburi
  */
-#ifndef TALER_EXCHANGE_HTTPD_AML_DECISION_H
-#define TALER_EXCHANGE_HTTPD_AML_DECISION_H
+#ifndef DONAU_HTTPD_CHARITY_H
+#define DONAU_HTTPD_CHARITY_H
 
 #include <microhttpd.h>
-#include "donau-httpd.h"
+// #include "donau-httpd.h"
 
 
 /**
@@ -50,5 +50,16 @@ DH_handler_charity_get (
   struct DH_RequestContext *rc,
   const char *const args[]);
 
+/**
+ * Handle a GET "/charities" request.
+ *
+ * @param rc request context
+ * @param args GET arguments (should be one)
+ * @return MHD result code
+ */
+MHD_RESULT
+DH_handler_charities_get (
+  struct DH_RequestContext *rc,
+  const char *const args[]);
 
 #endif
diff --git a/src/donau/donau-httpd_get-charities.c 
b/src/donau/donau-httpd_get-charities.c
index 8fd523e..1719c43 100644
--- a/src/donau/donau-httpd_get-charities.c
+++ b/src/donau/donau-httpd_get-charities.c
@@ -18,7 +18,7 @@
  * @brief Return charities
  * @author Johannes Casaburi
  */
-#include "platform.h"
+#include "taler/platform.h"
 #include <gnunet/gnunet_util_lib.h>
 #include <jansson.h>
 #include <microhttpd.h>
@@ -43,7 +43,10 @@
  * @param cls closure
  */
 static void
-charities_cb (void *cls)
+charities_cb (
+  void *cls,
+  const char *charity_url,
+  const char *charity_name)
 {
   json_t *charities = cls;
 
@@ -62,7 +65,7 @@ charities_cb (void *cls)
 
 MHD_RESULT
 DH_handler_charities_get (
-  struct TEH_RequestContext *rc,
+  struct DH_RequestContext *rc,
   const char *const args[])
 {
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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