gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libebics] 01/02: Introduce HTTP API (draft).


From: gnunet
Subject: [GNUnet-SVN] [libebics] 01/02: Introduce HTTP API (draft).
Date: Wed, 17 Oct 2018 15:42:27 +0200

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

marcello pushed a commit to branch master
in repository libebics.

commit 3ec6a0baeb80672b932b363115d0dcbbee84e0a2
Author: Marcello Stanisci <address@hidden>
AuthorDate: Wed Oct 17 15:39:23 2018 +0200

    Introduce HTTP API (draft).
---
 src/Makefile.am                    | 26 +++++++++++++++++++-------
 src/{tests.c => dump_tests.c}      |  0
 src/libebics.c                     | 31 +++++++++++++++++++++++++++++++
 src/libebics.h                     | 38 ++++++++++++++++++++++++++++++++------
 src/{tests.c => sandboxes_tests.c} |  4 ----
 5 files changed, 82 insertions(+), 17 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 0240689..c2b6509 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -36,19 +36,31 @@ AM_TESTS_ENVIRONMENT = \
   export EBICS_PREFIX=$(prefix);
 
 check_PROGRAMS = \
-  tests
+  dump_tests \
+       sandbox_tests
 
-TESTS = \
-  $(check_PROGRAMS)
+dump_tests_SOURCES = \
+  dump_tests.c
 
-tests_SOURCES = \
-  tests.c
+dump_tests_LDADD = \
+  libebics.la \
+  -lgnunetutil
+
+dump_tests_CPPFLAGS = \
+  $(XML_CPPFLAGS) \
+  $(XMLSEC1_CFLAGS) \
+  $(LIBGCRYPT_CFLAGS) \
+  $(GNUTLS_CFLAGS) \
+  $(ZLIB_CFLAGS)
+
+sandbox_tests_SOURCES = \
+  sandbox_tests.c
 
-tests_LDADD = \
+sandbox_tests_LDADD = \
   libebics.la \
   -lgnunetutil
 
-tests_CPPFLAGS = \
+sandbox_tests_CPPFLAGS = \
   $(XML_CPPFLAGS) \
   $(XMLSEC1_CFLAGS) \
   $(LIBGCRYPT_CFLAGS) \
diff --git a/src/tests.c b/src/dump_tests.c
similarity index 100%
copy from src/tests.c
copy to src/dump_tests.c
diff --git a/src/libebics.c b/src/libebics.c
index ff2ab36..cd8d8e0 100644
--- a/src/libebics.c
+++ b/src/libebics.c
@@ -947,3 +947,34 @@ EBICS_generate_message_camt053
                         instance);
   return instance;
 }
+
+/**
+ * Prepare and POSTs a EBICS HTTPS message to the bank.
+ *
+ * @param document the document to POST
+ * @param URL url of the EBICS endpoint
+ * @param cb callback to pass the response data
+ * @return EBICS_SUCCESS / EBICS_ERROR
+ */
+int
+EBICS_send_message (const struct EBICS_genex_document *document,
+                    const char url,
+                    EBICS_ResponseCallback cb)
+{
+
+  int size;
+  xmlChar *buf;
+
+  xmlDocDumpFormatMemoryEnc (document->document,
+                             &buf,
+                             &size,
+                             "UTF-8",
+                             GNUNET_NO);
+  LOG (EBICS_LOGLEVEL_DEBUG,
+       "Upcoming body: %s\n",
+       buf);
+
+  xmlFree (buf);
+
+  return EBICS_SUCCESS;
+}
diff --git a/src/libebics.h b/src/libebics.h
index 0d30e7f..c731ac0 100644
--- a/src/libebics.h
+++ b/src/libebics.h
@@ -104,14 +104,14 @@ EBICS_close_library ();
  * Customize a bunch of standard values in the tree (including
  * the HostID).
  *
- * @param headerArgs contains values for the "header" sub-tree.
  * @param header_args TODO
  * @param ini_args TODO
  * @return pointer to a freshly allocated document, NULL upon errors.
  */
 struct EBICS_genex_document *
-EBICS_generate_message_ini (struct EBICS_ARGS_build_header *header_args,
-                            struct EBICS_ARGS_build_content_ini *ini_args);
+EBICS_generate_message_ini
+  (struct EBICS_ARGS_build_header *header_args,
+   struct EBICS_ARGS_build_content_ini *ini_args);
 
 /**
  * Generator of HIA messages.
@@ -121,8 +121,9 @@ EBICS_generate_message_ini (struct EBICS_ARGS_build_header 
*header_args,
  * @return pointer to a freshly allocated document, NULL upon errors.
  */
 struct EBICS_genex_document *
-EBICS_generate_message_hia (struct EBICS_ARGS_build_header *header_args,
-                            struct EBICS_ARGS_build_content_hia *hia_args);
+EBICS_generate_message_hia
+  (struct EBICS_ARGS_build_header *header_args,
+   struct EBICS_ARGS_build_content_hia *hia_args);
 
 /**
  * Generator of HPB messages.
@@ -131,7 +132,8 @@ EBICS_generate_message_hia (struct EBICS_ARGS_build_header 
*header_args,
  * @return pointer to a freshly allocated document, NULL upon errors.
  */
 struct EBICS_genex_document *
-EBICS_generate_message_hpb (struct EBICS_ARGS_build_header *header_args);
+EBICS_generate_message_hpb
+  (struct EBICS_ARGS_build_header *header_args);
 
 /**
  * Generator of CAMT.053 messages.
@@ -144,4 +146,28 @@ struct EBICS_genex_document *
 EBICS_generate_message_camt053
   (struct EBICS_ARGS_build_header *header_args,
    struct EBICS_ARGS_build_content_camt053 *camt053_args);
+
+
+/**
+ * Callback used to process the response of a bank.
+ * 
+ * @param TODO need the body itself!
+ * @param http_status HTTP response code.
+ */
+typedef void
+(*EBICS_ResponseCallback) (long http_status);
+
+/**
+ * Prepare and POSTs a EBICS HTTPS message to the bank.
+ *
+ * @param document the document to POST
+ * @param URL url of the EBICS endpoint
+ * @param cb callback to pass the response data
+ * @return EBICS_SUCCESS / EBICS_ERROR
+ */
+int
+EBICS_send_message (const struct EBICS_genex_document *document,
+                    const char url,
+                    EBICS_ResponseCallback cb);
+
 #endif
diff --git a/src/tests.c b/src/sandboxes_tests.c
similarity index 96%
rename from src/tests.c
rename to src/sandboxes_tests.c
index a14e612..6e32635 100644
--- a/src/tests.c
+++ b/src/sandboxes_tests.c
@@ -92,7 +92,6 @@ main (int argc,
     return EBICS_ERROR;
   }
 
-  util_dump_message (msg);
   GNUNET_free (msg);
 
   /**
@@ -107,7 +106,6 @@ main (int argc,
     return EBICS_ERROR;
   }
   
-  util_dump_message (msg);
   GNUNET_free (msg);
 
   /**
@@ -121,7 +119,6 @@ main (int argc,
     return EBICS_ERROR;
   }
   
-  util_dump_message (msg);
   GNUNET_free (msg);
 
   /**
@@ -160,7 +157,6 @@ main (int argc,
     return EBICS_ERROR;
   }
 
-  util_dump_message (msg);
   GNUNET_free (msg);
 
   EBICS_close_library ();

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



reply via email to

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