summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-11-14 19:58:36 +0100
committerChristian Grothoff <christian@grothoff.org>2019-11-14 19:58:36 +0100
commitb4891637798a96ba7d135951b8bf98b08bd3bc61 (patch)
tree203bfea72a2ba50acda7ba61b602417d421d1eab /src
parent3aee9f29243c659049a433a45f6631b4ca8309f6 (diff)
downloadsync-b4891637798a96ba7d135951b8bf98b08bd3bc61.tar.gz
sync-b4891637798a96ba7d135951b8bf98b08bd3bc61.tar.bz2
sync-b4891637798a96ba7d135951b8bf98b08bd3bc61.zip
fix ftbfs in lib/
Diffstat (limited to 'src')
-rw-r--r--src/lib/sync_api_upload.c2
-rw-r--r--src/sync/Makefile.am5
-rw-r--r--src/sync/sync-httpd.c44
-rw-r--r--src/sync/sync-httpd.h12
-rw-r--r--src/sync/sync-httpd_mhd.c44
-rw-r--r--src/sync/sync-httpd_mhd.h44
-rw-r--r--src/sync/sync-httpd_parsing.c65
-rw-r--r--src/sync/sync-httpd_parsing.h22
-rw-r--r--src/sync/sync-httpd_responses.c180
-rw-r--r--src/sync/sync-httpd_responses.h76
10 files changed, 244 insertions, 250 deletions
diff --git a/src/lib/sync_api_upload.c b/src/lib/sync_api_upload.c
index 353db1a..b09b01d 100644
--- a/src/lib/sync_api_upload.c
+++ b/src/lib/sync_api_upload.c
@@ -28,7 +28,7 @@
#include <microhttpd.h> /* just for HTTP status codes */
#include <gnunet/gnunet_util_lib.h>
#include <gnunet/gnunet_curl_lib.h>
-#include "anastasis_service.h"
+#include "sync_service.h"
/**
diff --git a/src/sync/Makefile.am b/src/sync/Makefile.am
index c703348..ad60afe 100644
--- a/src/sync/Makefile.am
+++ b/src/sync/Makefile.am
@@ -14,10 +14,9 @@ sync_httpd_SOURCES = \
sync-httpd_parsing.c sync-httpd_parsing.h \
sync-httpd_responses.c sync-httpd_responses.h \
sync-httpd_mhd.c sync-httpd_mhd.h \
- sync-httpd_policy.c sync-httpd_policy.h
-
+ sync-httpd_backup.c sync-httpd_backup.h
sync_httpd_LDADD = \
- $(top_builddir)/src/stasis/libsyncdb.la \
+ $(top_builddir)/src/syncdb/libsyncdb.la \
-lmicrohttpd \
-ljansson \
-lgnunetcurl \
diff --git a/src/sync/sync-httpd.c b/src/sync/sync-httpd.c
index d4f3830..beb0e20 100644
--- a/src/sync/sync-httpd.c
+++ b/src/sync/sync-httpd.c
@@ -26,7 +26,7 @@
#include "sync-httpd_parsing.h"
#include "sync-httpd_mhd.h"
#include "sync_database_lib.h"
-#include "sync-httpd_policy.h"
+#include "sync-httpd_backup.h"
/**
* Backlog for listen operation on unix-domain sockets.
@@ -41,7 +41,7 @@ static long long unsigned port;
/**
* Should a "Connection: close" header be added to each HTTP response?
*/
-int TMH_sync_connection_close;
+int SH_sync_connection_close;
/**
* Task running the HTTP server.
@@ -72,7 +72,7 @@ static mode_t unixpath_mode;
/**
* Connection handle to the our database
*/
-struct sync_DatabasePlugin *db;
+struct SYNC_DatabasePlugin *db;
/**
@@ -87,7 +87,7 @@ is_valid_correlation_id (const char *correlation_id)
if (strlen (correlation_id) >= 64)
return GNUNET_NO;
for (int i = 0; i < strlen (correlation_id); i++)
- if (! (isalnum (correlation_id[i]) ||(correlation_id[i] == '-')))
+ if (! (isalnum (correlation_id[i]) || (correlation_id[i] == '-')))
return GNUNET_NO;
return GNUNET_YES;
}
@@ -142,20 +142,20 @@ url_handler (void *cls,
size_t *upload_data_size,
void **con_cls)
{
- static struct TMH_RequestHandler handlers[] = {
+ static struct SH_RequestHandler handlers[] = {
/* Landing page, tell humans to go away. */
{ "/", MHD_HTTP_METHOD_GET, "text/plain",
"Hello, I'm sync. This HTTP server is not for humans.\n", 0,
- &TMH_MHD_handler_static_response, MHD_HTTP_OK },
+ &SH_MHD_handler_static_response, MHD_HTTP_OK },
{ "/agpl", MHD_HTTP_METHOD_GET, "text/plain",
NULL, 0,
- &TMH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND },
+ &SH_MHD_handler_agpl_redirect, MHD_HTTP_FOUND },
{NULL, NULL, NULL, NULL, 0, 0 }
};
- static struct TMH_RequestHandler h404 = {
+ static struct SH_RequestHandler h404 = {
"", NULL, "text/html",
"<html><title>404: not found</title></html>", 0,
- &TMH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
+ &SH_MHD_handler_static_response, MHD_HTTP_NOT_FOUND
};
struct TM_HandlerContext *hc;
@@ -200,13 +200,13 @@ url_handler (void *cls,
if (0 == strncmp (url,
"/backup/",
strlen ("/backup/")))
- {
+ {
// return handle_policy (...);
if (0 == strcmp (method, MHD_HTTP_METHOD_GET))
{
return sync_handler_backup_get (connection,
- url,
- con_cls);
+ url,
+ con_cls);
}
if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
{
@@ -219,7 +219,7 @@ url_handler (void *cls,
}
for (unsigned int i = 0; NULL != handlers[i].url; i++)
{
- struct TMH_RequestHandler *rh = &handlers[i];
+ struct SH_RequestHandler *rh = &handlers[i];
if ( (0 == strcmp (url,
rh->url)) &&
@@ -245,11 +245,11 @@ url_handler (void *cls,
return ret;
}
}
- return TMH_MHD_handler_static_response (&h404,
- connection,
- con_cls,
- upload_data,
- upload_data_size);
+ return SH_MHD_handler_static_response (&h404,
+ connection,
+ con_cls,
+ upload_data,
+ upload_data_size);
}
@@ -274,7 +274,7 @@ do_shutdown (void *cls)
}
if (NULL != db)
{
- sync_DB_plugin_unload (db);
+ SYNC_DB_plugin_unload (db);
db = NULL;
}
}
@@ -352,7 +352,7 @@ run_daemon (void *cls)
* the task processing MHD's activities to run immediately.
*/
void
-TMH_trigger_daemon ()
+SH_trigger_daemon ()
{
if (NULL != mhd_task)
{
@@ -448,7 +448,7 @@ run (void *cls,
"WARNING",
NULL));
if (NULL ==
- (db = sync_DB_plugin_load (config)))
+ (db = SYNC_DB_plugin_load (config)))
{
GNUNET_SCHEDULER_shutdown ();
return;
@@ -729,7 +729,7 @@ main (int argc,
GNUNET_GETOPT_option_flag ('C',
"connection-close",
"force HTTP connections to be closed after each request",
- &TMH_sync_connection_close),
+ &SH_sync_connection_close),
GNUNET_GETOPT_OPTION_END
};
diff --git a/src/sync/sync-httpd.h b/src/sync/sync-httpd.h
index 56ad155..53c4f40 100644
--- a/src/sync/sync-httpd.h
+++ b/src/sync/sync-httpd.h
@@ -28,7 +28,7 @@
/**
* @brief Struct describing an URL and the handler for it.
*/
-struct TMH_RequestHandler
+struct SH_RequestHandler
{
/**
@@ -67,7 +67,7 @@ struct TMH_RequestHandler
* @param[in,out] upload_data_size number of bytes (left) in @a upload_data
* @return MHD result code
*/
- int (*handler)(struct TMH_RequestHandler *rh,
+ int (*handler)(struct SH_RequestHandler *rh,
struct MHD_Connection *connection,
void **connection_cls,
const char *upload_data,
@@ -117,7 +117,7 @@ struct TM_HandlerContext
/**
* Which request handler is handling this request?
*/
- const struct TMH_RequestHandler *rh;
+ const struct SH_RequestHandler *rh;
/**
* Asynchronous request context id.
@@ -129,12 +129,12 @@ struct TM_HandlerContext
/**
* Should a "Connection: close" header be added to each HTTP response?
*/
-extern int TMH_sync_connection_close;
+extern int SH_sync_connection_close;
/**
* Handle to the database backend.
*/
-extern struct sync_DatabasePlugin *db;
+extern struct SYNC_DatabasePlugin *db;
/**
* Kick MHD to run now, to be called after MHD_resume_connection().
@@ -143,6 +143,6 @@ extern struct sync_DatabasePlugin *db;
* the task processing MHD's activities to run immediately.
*/
void
-TMH_trigger_daemon (void);
+SH_trigger_daemon (void);
#endif
diff --git a/src/sync/sync-httpd_mhd.c b/src/sync/sync-httpd_mhd.c
index 269316d..077105e 100644
--- a/src/sync/sync-httpd_mhd.c
+++ b/src/sync/sync-httpd_mhd.c
@@ -40,11 +40,11 @@
* @return MHD result code
*/
int
-TMH_MHD_handler_static_response (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size)
+SH_MHD_handler_static_response (struct SH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size)
{
struct MHD_Response *response;
int ret;
@@ -59,7 +59,7 @@ TMH_MHD_handler_static_response (struct TMH_RequestHandler *rh,
GNUNET_break (0);
return MHD_NO;
}
- TMH_RESPONSE_add_global_headers (response);
+ SH_RESPONSE_add_global_headers (response);
if (NULL != rh->mime_type)
(void) MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE,
@@ -84,11 +84,11 @@ TMH_MHD_handler_static_response (struct TMH_RequestHandler *rh,
* @return MHD result code
*/
int
-TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size)
+SH_MHD_handler_agpl_redirect (struct SH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size)
{
const char *agpl =
"This server is licensed under the Affero GPL. You will now be redirected to the source code.";
@@ -103,7 +103,7 @@ TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh,
GNUNET_break (0);
return MHD_NO;
}
- TMH_RESPONSE_add_global_headers (response);
+ SH_RESPONSE_add_global_headers (response);
if (NULL != rh->mime_type)
(void) MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE,
@@ -139,17 +139,17 @@ TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh,
* @return MHD result code
*/
int
-TMH_MHD_handler_send_json_pack_error (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size)
+SH_MHD_handler_send_json_pack_error (struct SH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size)
{
- return TMH_RESPONSE_reply_json_pack (connection,
- rh->response_code,
- "{s:s}",
- "error",
- rh->data);
+ return SH_RESPONSE_reply_json_pack (connection,
+ rh->response_code,
+ "{s:s}",
+ "error",
+ rh->data);
}
diff --git a/src/sync/sync-httpd_mhd.h b/src/sync/sync-httpd_mhd.h
index b157baa..36612ff 100644
--- a/src/sync/sync-httpd_mhd.h
+++ b/src/sync/sync-httpd_mhd.h
@@ -41,11 +41,11 @@
* @return MHD result code
*/
int
-TMH_MHD_handler_static_response (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size);
+SH_MHD_handler_static_response (struct SH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size);
/**
@@ -61,11 +61,11 @@ TMH_MHD_handler_static_response (struct TMH_RequestHandler *rh,
* @return MHD result code
*/
int
-TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size);
+SH_MHD_handler_agpl_redirect (struct SH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size);
/**
@@ -82,13 +82,13 @@ TMH_MHD_handler_agpl_redirect (struct TMH_RequestHandler *rh,
* @return MHD result code
*/
int
-TMH_MHD_helper_send_json_pack (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void *connection_cls,
- int response_code,
- int do_cache,
- const char *fmt,
- ...);
+SH_MHD_helper_send_json_pack (struct SH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void *connection_cls,
+ int response_code,
+ int do_cache,
+ const char *fmt,
+ ...);
/**
@@ -103,11 +103,11 @@ TMH_MHD_helper_send_json_pack (struct TMH_RequestHandler *rh,
* @return MHD result code
*/
int
-TMH_MHD_handler_send_json_pack_error (struct TMH_RequestHandler *rh,
- struct MHD_Connection *connection,
- void **connection_cls,
- const char *upload_data,
- size_t *upload_data_size);
+SH_MHD_handler_send_json_pack_error (struct SH_RequestHandler *rh,
+ struct MHD_Connection *connection,
+ void **connection_cls,
+ const char *upload_data,
+ size_t *upload_data_size);
#endif
diff --git a/src/sync/sync-httpd_parsing.c b/src/sync/sync-httpd_parsing.c
index 49d9f97..180f47c 100644
--- a/src/sync/sync-httpd_parsing.c
+++ b/src/sync/sync-httpd_parsing.c
@@ -16,7 +16,6 @@
License along with TALER; see the file COPYING. If not,
see <http://www.gnu.org/licenses/>
*/
-
/**
* @file sync-httpd_parsing.c
* @brief functions to parse incoming requests
@@ -67,8 +66,6 @@ struct Buffer
};
-
-
/**
* Free the data in a buffer. Does *not* free
* the buffer object itself.
@@ -83,16 +80,15 @@ buffer_deinit (struct Buffer *buf)
}
-
/**
* Function called whenever we are done with a request
* to clean up our state.
*
* @param con_cls value as it was left by
- * #TMH_PARSE_post_json(), to be cleaned up
+ * #SH_PARSE_post_json(), to be cleaned up
*/
void
-TMH_PARSE_post_cleanup_callback (void *con_cls)
+SH_PARSE_post_cleanup_callback (void *con_cls)
{
struct Buffer *r = con_cls;
@@ -109,7 +105,7 @@ TMH_PARSE_post_cleanup_callback (void *con_cls)
* realizes an MHD POST processor that will (incrementally) process
* JSON data uploaded to the HTTP server. It will store the
* required state in the @a con_cls, which must be cleaned up
- * using #TMH_PARSE_post_cleanup_callback().
+ * using #SH_PARSE_post_cleanup_callback().
*
* @param connection the MHD connection
* @param con_cls the closure (points to a `struct Buffer *`)
@@ -128,11 +124,11 @@ TMH_PARSE_post_cleanup_callback (void *con_cls)
* close HTTP session with MHD_NO)
*/
int
-TMH_PARSE_post_json (struct MHD_Connection *connection,
- void **con_cls,
- const char *upload_data,
- size_t *upload_data_size,
- json_t **json)
+SH_PARSE_post_json (struct MHD_Connection *connection,
+ void **con_cls,
+ const char *upload_data,
+ size_t *upload_data_size,
+ json_t **json)
{
enum GNUNET_JSON_PostResult pr;
@@ -146,7 +142,7 @@ TMH_PARSE_post_json (struct MHD_Connection *connection,
{
case GNUNET_JSON_PR_OUT_OF_MEMORY:
- return (MHD_NO == TMH_RESPONSE_reply_internal_error
+ return (MHD_NO == SH_RESPONSE_reply_internal_error
(connection,
TALER_EC_PARSER_OUT_OF_MEMORY,
"out of memory")) ? GNUNET_SYSERR : GNUNET_NO;
@@ -155,12 +151,12 @@ TMH_PARSE_post_json (struct MHD_Connection *connection,
return GNUNET_YES;
case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
- return (MHD_NO == TMH_RESPONSE_reply_request_too_large
+ return (MHD_NO == SH_RESPONSE_reply_request_too_large
(connection)) ? GNUNET_SYSERR : GNUNET_NO;
case GNUNET_JSON_PR_JSON_INVALID:
return (MHD_YES ==
- TMH_RESPONSE_reply_invalid_json (connection))
+ SH_RESPONSE_reply_invalid_json (connection))
? GNUNET_NO : GNUNET_SYSERR;
case GNUNET_JSON_PR_SUCCESS:
GNUNET_break (NULL != *json);
@@ -187,9 +183,9 @@ TMH_PARSE_post_json (struct MHD_Connection *connection,
* #GNUNET_SYSERR on internal error
*/
int
-TMH_PARSE_json_data (struct MHD_Connection *connection,
- const json_t *root,
- struct GNUNET_JSON_Specification *spec)
+SH_PARSE_json_data (struct MHD_Connection *connection,
+ const json_t *root,
+ struct GNUNET_JSON_Specification *spec)
{
int ret;
const char *error_json_name;
@@ -207,12 +203,12 @@ TMH_PARSE_json_data (struct MHD_Connection *connection,
"Parsing failed due to field '%s'\n",
error_json_name);
ret = (MHD_YES ==
- TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_BAD_REQUEST,
- "{s:s, s:s, s:I}",
- "error", "parse error",
- "field", error_json_name,
- "line", (json_int_t) error_line))
+ SH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_BAD_REQUEST,
+ "{s:s, s:s, s:I}",
+ "error", "parse error",
+ "field", error_json_name,
+ "line", (json_int_t) error_line))
? GNUNET_NO : GNUNET_SYSERR;
return ret;
}
@@ -220,7 +216,6 @@ TMH_PARSE_json_data (struct MHD_Connection *connection,
}
-
/**
* Extract base32crockford encoded data from request.
*
@@ -237,10 +232,10 @@ TMH_PARSE_json_data (struct MHD_Connection *connection,
* #GNUNET_SYSERR on internal error (error response could not be sent)
*/
int
-TMH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
- const char *param_name,
- void *out_data,
- size_t out_size)
+SH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
+ const char *param_name,
+ void *out_data,
+ size_t out_size)
{
const char *str;
@@ -250,9 +245,9 @@ TMH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
if (NULL == str)
{
return (MHD_NO ==
- TMH_RESPONSE_reply_arg_missing (connection,
- TALER_EC_PARAMETER_MISSING,
- param_name))
+ SH_RESPONSE_reply_arg_missing (connection,
+ TALER_EC_PARAMETER_MISSING,
+ param_name))
? GNUNET_SYSERR : GNUNET_NO;
}
if (GNUNET_OK !=
@@ -261,9 +256,9 @@ TMH_PARSE_mhd_request_arg_data (struct MHD_Connection *connection,
out_data,
out_size))
return (MHD_NO ==
- TMH_RESPONSE_reply_arg_invalid (connection,
- TALER_EC_PARAMETER_MALFORMED,
- param_name))
+ SH_RESPONSE_reply_arg_invalid (connection,
+ TALER_EC_PARAMETER_MALFORMED,
+ param_name))
? GNUNET_SYSERR : GNUNET_NO;
return GNUNET_OK;
}
diff --git a/src/sync/sync-httpd_parsing.h b/src/sync/sync-httpd_parsing.h
index b3c11cd..d7e5be3 100644
--- a/src/sync/sync-httpd_parsing.h
+++ b/src/sync/sync-httpd_parsing.h
@@ -33,7 +33,7 @@
* (incrementally) process JSON data uploaded to the HTTP
* server. It will store the required state in the
* "connection_cls", which must be cleaned up using
- * #TMH_PARSE_post_cleanup_callback().
+ * #SH_PARSE_post_cleanup_callback().
*
* @param connection the MHD connection
* @param con_cls the closure (points to a `struct Buffer *`)
@@ -52,11 +52,11 @@
* close HTTP session with MHD_NO)
*/
int
-TMH_PARSE_post_json (struct MHD_Connection *connection,
- void **con_cls,
- const char *upload_data,
- size_t *upload_data_size,
- json_t **json);
+SH_PARSE_post_json (struct MHD_Connection *connection,
+ void **con_cls,
+ const char *upload_data,
+ size_t *upload_data_size,
+ json_t **json);
/**
@@ -64,10 +64,10 @@ TMH_PARSE_post_json (struct MHD_Connection *connection,
* to clean up our state.
*
* @param con_cls value as it was left by
- * #TMH_PARSE_post_json(), to be cleaned up
+ * #SH_PARSE_post_json(), to be cleaned up
*/
void
-TMH_PARSE_post_cleanup_callback (void *con_cls);
+SH_PARSE_post_cleanup_callback (void *con_cls);
/**
@@ -85,9 +85,9 @@ TMH_PARSE_post_cleanup_callback (void *con_cls);
* #GNUNET_SYSERR on internal error
*/
int
-TMH_PARSE_json_data (struct MHD_Connection *connection,
- const json_t *root,
- struct GNUNET_JSON_Specification *spec);
+SH_PARSE_json_data (struct MHD_Connection *connection,
+ const json_t *root,
+ struct GNUNET_JSON_Specification *spec);
#endif /* TALER_MERCHANT_HTTPD_PARSING_H */
diff --git a/src/sync/sync-httpd_responses.c b/src/sync/sync-httpd_responses.c
index 6a95555..1cc787a 100644
--- a/src/sync/sync-httpd_responses.c
+++ b/src/sync/sync-httpd_responses.c
@@ -16,7 +16,7 @@
/**
* @file sync-httpd_responses.c
* @brief API for generating the various replies of the exchange; these
- * functions are called TMH_RESPONSE_reply_ and they generate
+ * functions are called SH_RESPONSE_reply_ and they generate
* and queue MHD response objects for a given connection.
* @author Florian Dold
* @author Benedikt Mueller
@@ -37,7 +37,7 @@
* @return MHD response object
*/
struct MHD_Response *
-TMH_RESPONSE_make_json (const json_t *json)
+SH_RESPONSE_make_json (const json_t *json)
{
struct MHD_Response *resp;
char *json_str;
@@ -75,14 +75,14 @@ TMH_RESPONSE_make_json (const json_t *json)
* @return MHD result code
*/
int
-TMH_RESPONSE_reply_json (struct MHD_Connection *connection,
- const json_t *json,
- unsigned int response_code)
+SH_RESPONSE_reply_json (struct MHD_Connection *connection,
+ const json_t *json,
+ unsigned int response_code)
{
struct MHD_Response *resp;
int ret;
- resp = TMH_RESPONSE_make_json (json);
+ resp = SH_RESPONSE_make_json (json);
if (NULL == resp)
return MHD_NO;
ret = MHD_queue_response (connection,
@@ -101,8 +101,8 @@ TMH_RESPONSE_reply_json (struct MHD_Connection *connection,
* @return MHD response object
*/
struct MHD_Response *
-TMH_RESPONSE_make_json_pack (const char *fmt,
- ...)
+SH_RESPONSE_make_json_pack (const char *fmt,
+ ...)
{
json_t *json;
va_list argp;
@@ -124,7 +124,7 @@ TMH_RESPONSE_make_json_pack (const char *fmt,
GNUNET_break (0);
return MHD_NO;
}
- ret = TMH_RESPONSE_make_json (json);
+ ret = SH_RESPONSE_make_json (json);
json_decref (json);
return ret;
}
@@ -141,10 +141,10 @@ TMH_RESPONSE_make_json_pack (const char *fmt,
* @return MHD result code
*/
int
-TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
- unsigned int response_code,
- const char *fmt,
- ...)
+SH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
+ unsigned int response_code,
+ const char *fmt,
+ ...)
{
json_t *json;
va_list argp;
@@ -166,9 +166,9 @@ TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
GNUNET_break (0);
return MHD_NO;
}
- ret = TMH_RESPONSE_reply_json (connection,
- json,
- response_code);
+ ret = SH_RESPONSE_reply_json (connection,
+ json,
+ response_code);
json_decref (json);
return ret;
}
@@ -182,12 +182,12 @@ TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
* @return a MHD response object
*/
struct MHD_Response *
-TMH_RESPONSE_make_error (enum TALER_ErrorCode ec,
- const char *hint)
+SH_RESPONSE_make_error (enum TALER_ErrorCode ec,
+ const char *hint)
{
- return TMH_RESPONSE_make_json_pack ("{s:I, s:s}",
- "code", (json_int_t) ec,
- "hint", hint);
+ return SH_RESPONSE_make_json_pack ("{s:I, s:s}",
+ "code", (json_int_t) ec,
+ "hint", hint);
}
@@ -200,15 +200,15 @@ TMH_RESPONSE_make_error (enum TALER_ErrorCode ec,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *hint)
+SH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *hint)
{
- return TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- "{s:I, s:s}",
- "code", (json_int_t) ec,
- "hint", hint);
+ return SH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ "{s:I, s:s}",
+ "code", (json_int_t) ec,
+ "hint", hint);
}
@@ -219,7 +219,7 @@ TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection)
+SH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection)
{
struct MHD_Response *resp;
int ret;
@@ -248,16 +248,16 @@ TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection)
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_rc (struct MHD_Connection *connection,
- unsigned int response_code,
- enum TALER_ErrorCode ec,
- const char *msg)
+SH_RESPONSE_reply_rc (struct MHD_Connection *connection,
+ unsigned int response_code,
+ enum TALER_ErrorCode ec,
+ const char *msg)
{
- return TMH_RESPONSE_reply_json_pack (connection,
- response_code,
- "{s:I, s:s}",
- "code", (json_int_t) ec,
- "error", msg);
+ return SH_RESPONSE_reply_json_pack (connection,
+ response_code,
+ "{s:I, s:s}",
+ "code", (json_int_t) ec,
+ "error", msg);
}
@@ -268,14 +268,14 @@ TMH_RESPONSE_reply_rc (struct MHD_Connection *connection,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection)
+SH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection)
{
- return TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_BAD_REQUEST,
- "{s:I, s:s}",
- "code",
- (json_int_t) TALER_EC_JSON_INVALID,
- "error", "invalid json");
+ return SH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_BAD_REQUEST,
+ "{s:I, s:s}",
+ "code",
+ (json_int_t) TALER_EC_JSON_INVALID,
+ "error", "invalid json");
}
@@ -289,15 +289,15 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection)
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_not_found (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *object)
+SH_RESPONSE_reply_not_found (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *object)
{
- return TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_NOT_FOUND,
- "{s:I, s:s}",
- "code", (json_int_t) ec,
- "error", object);
+ return SH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_NOT_FOUND,
+ "{s:I, s:s}",
+ "code", (json_int_t) ec,
+ "error", object);
}
@@ -310,15 +310,15 @@ TMH_RESPONSE_reply_not_found (struct MHD_Connection *connection,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_bad_request (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *issue)
+SH_RESPONSE_reply_bad_request (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *issue)
{
- return TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_BAD_REQUEST,
- "{s:I, s:s}",
- "code", (json_int_t) ec,
- "error", issue);
+ return SH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_BAD_REQUEST,
+ "{s:I, s:s}",
+ "code", (json_int_t) ec,
+ "error", issue);
}
@@ -330,9 +330,9 @@ TMH_RESPONSE_reply_bad_request (struct MHD_Connection *connection,
* @param response response to modify
*/
void
-TMH_RESPONSE_add_global_headers (struct MHD_Response *response)
+SH_RESPONSE_add_global_headers (struct MHD_Response *response)
{
- if (TMH_sync_connection_close)
+ if (SH_sync_connection_close)
GNUNET_break (MHD_YES ==
MHD_add_response_header (response,
MHD_HTTP_HEADER_CONNECTION,
@@ -349,15 +349,15 @@ TMH_RESPONSE_add_global_headers (struct MHD_Response *response)
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *hint)
+SH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *hint)
{
- return TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_BAD_REQUEST,
- "{s:I, s:s}",
- "code", (json_int_t) ec,
- "hint", hint);
+ return SH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_BAD_REQUEST,
+ "{s:I, s:s}",
+ "code", (json_int_t) ec,
+ "hint", hint);
}
@@ -370,16 +370,16 @@ TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *param_name)
+SH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *param_name)
{
- return TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_BAD_REQUEST,
- "{s:s, s:I, s:s}",
- "error", "missing parameter",
- "code", (json_int_t) ec,
- "parameter", param_name);
+ return SH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_BAD_REQUEST,
+ "{s:s, s:I, s:s}",
+ "error", "missing parameter",
+ "code", (json_int_t) ec,
+ "parameter", param_name);
}
@@ -392,16 +392,16 @@ TMH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *param_name)
+SH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *param_name)
{
- return TMH_RESPONSE_reply_json_pack (connection,
- MHD_HTTP_BAD_REQUEST,
- "{s:s, s:I, s:s}",
- "error", "invalid parameter",
- "code", (json_int_t) ec,
- "parameter", param_name);
+ return SH_RESPONSE_reply_json_pack (connection,
+ MHD_HTTP_BAD_REQUEST,
+ "{s:s, s:I, s:s}",
+ "error", "invalid parameter",
+ "code", (json_int_t) ec,
+ "parameter", param_name);
}
diff --git a/src/sync/sync-httpd_responses.h b/src/sync/sync-httpd_responses.h
index a98ba0d..c072590 100644
--- a/src/sync/sync-httpd_responses.h
+++ b/src/sync/sync-httpd_responses.h
@@ -16,7 +16,7 @@
/**
* @file sync-httpd_responses.h
* @brief API for generating the various replies of the exchange; these
- * functions are called TMH_RESPONSE_reply_ and they generate
+ * functions are called SH_RESPONSE_reply_ and they generate
* and queue MHD response objects for a given connection.
* @author Florian Dold
* @author Benedikt Mueller
@@ -38,7 +38,7 @@
* @return MHD response object
*/
struct MHD_Response *
-TMH_RESPONSE_make_json (const json_t *json);
+SH_RESPONSE_make_json (const json_t *json);
/**
@@ -50,9 +50,9 @@ TMH_RESPONSE_make_json (const json_t *json);
* @return MHD result code
*/
int
-TMH_RESPONSE_reply_json (struct MHD_Connection *connection,
- const json_t *json,
- unsigned int response_code);
+SH_RESPONSE_reply_json (struct MHD_Connection *connection,
+ const json_t *json,
+ unsigned int response_code);
/**
@@ -63,8 +63,8 @@ TMH_RESPONSE_reply_json (struct MHD_Connection *connection,
* @return MHD response object
*/
struct MHD_Response *
-TMH_RESPONSE_make_json_pack (const char *fmt,
- ...);
+SH_RESPONSE_make_json_pack (const char *fmt,
+ ...);
@@ -80,10 +80,10 @@ TMH_RESPONSE_make_json_pack (const char *fmt,
* @return MHD result code
*/
int
-TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
- unsigned int response_code,
- const char *fmt,
- ...);
+SH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
+ unsigned int response_code,
+ const char *fmt,
+ ...);
/**
@@ -94,8 +94,8 @@ TMH_RESPONSE_reply_json_pack (struct MHD_Connection *connection,
* @return a MHD response object
*/
struct MHD_Response *
-TMH_RESPONSE_make_error (enum TALER_ErrorCode ec,
- const char *hint);
+SH_RESPONSE_make_error (enum TALER_ErrorCode ec,
+ const char *hint);
/**
@@ -107,9 +107,9 @@ TMH_RESPONSE_make_error (enum TALER_ErrorCode ec,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *hint);
+SH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *hint);
@@ -121,7 +121,7 @@ TMH_RESPONSE_reply_internal_error (struct MHD_Connection *connection,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection);
+SH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection);
@@ -136,10 +136,10 @@ TMH_RESPONSE_reply_request_too_large (struct MHD_Connection *connection);
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_rc (struct MHD_Connection *connection,
- unsigned int response_code,
- enum TALER_ErrorCode ec,
- const char *msg);
+SH_RESPONSE_reply_rc (struct MHD_Connection *connection,
+ unsigned int response_code,
+ enum TALER_ErrorCode ec,
+ const char *msg);
@@ -150,7 +150,7 @@ TMH_RESPONSE_reply_rc (struct MHD_Connection *connection,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection);
+SH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection);
@@ -164,9 +164,9 @@ TMH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection);
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_not_found (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *object);
+SH_RESPONSE_reply_not_found (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *object);
@@ -179,9 +179,9 @@ TMH_RESPONSE_reply_not_found (struct MHD_Connection *connection,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_bad_request (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *issue);
+SH_RESPONSE_reply_bad_request (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *issue);
@@ -194,7 +194,7 @@ TMH_RESPONSE_reply_bad_request (struct MHD_Connection *connection,
* @param response response to modify
*/
void
-TMH_RESPONSE_add_global_headers (struct MHD_Response *response);
+SH_RESPONSE_add_global_headers (struct MHD_Response *response);
@@ -207,9 +207,9 @@ TMH_RESPONSE_add_global_headers (struct MHD_Response *response);
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *hint);
+SH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *hint);
@@ -223,9 +223,9 @@ TMH_RESPONSE_reply_external_error (struct MHD_Connection *connection,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *param_name);
+SH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *param_name);
/**
@@ -237,8 +237,8 @@ TMH_RESPONSE_reply_arg_missing (struct MHD_Connection *connection,
* @return a MHD result code
*/
int
-TMH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
- enum TALER_ErrorCode ec,
- const char *param_name);
+SH_RESPONSE_reply_arg_invalid (struct MHD_Connection *connection,
+ enum TALER_ErrorCode ec,
+ const char *param_name);
#endif