#include "platform.h"
#include <microhttpd.h>
#include "gnunet_util_lib.h"
+#include "gnunet_mhd_compat.h"
/**
* Error page to display if submitted GNS key is invalid.
/**
* Main request handler.
*/
-static int
+static MHD_RESULT
access_handler_callback (void *cls,
struct MHD_Connection *connection,
const char *url,
struct stat st;
struct MHD_Response *response;
int fd;
- int ret;
+ MHD_RESULT ret;
const char *gpg_fp = MHD_lookup_connection_value (connection,
MHD_GET_ARGUMENT_KIND,
#include "gnunet_gns_service.h"
#include "gnunet_identity_service.h"
#include "gns.h"
-
+#include "gnunet_mhd_compat.h"
/**
* Default Socks5 listen port.
* #MHD_NO if the socket must be closed due to a serious
* error while handling the request
*/
-static int
+static MHD_RESULT
create_response (void *cls,
struct MHD_Connection *con,
const char *url,
gnunet_json_lib.h \
gnunet_load_lib.h \
gnunet_cadet_service.h \
+ gnunet_mhd_compat.h \
gnunet_microphone_lib.h \
gnunet_mst_lib.h \
gnunet_mq_lib.h \
--- /dev/null
+/*
+ This file is part of GNUnet.
+ Copyright (C) 2020 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ 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
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+
+/**
+ * @author Christian Grothoff
+ *
+ * @file
+ * MHD compatibility definitions for warning-less compile of
+ * our code against MHD before and after #MHD_VERSION 0x00097002.
+ */
+#include <microhttpd.h>
+
+#if MHD_VERSION >= 0x00097002
+/**
+ * Data type to use for functions return an "MHD result".
+ */
+#define MHD_RESULT enum MHD_Result
+
+#else
+
+/**
+ * Data type to use for functions return an "MHD result".
+ */
+#define MHD_RESULT int
+
+#endif
#include "gnunet_identity_service.h"
#include "gnunet_gnsrecord_lib.h"
#include "gnunet_namestore_service.h"
+#include "gnunet_mhd_compat.h"
/**
* Invalid method page.
* specified offset
* @param off offset of data in the overall value
* @param size number of bytes in data available
- * @return MHD_YES to continue iterating,
- * MHD_NO to abort the iteration
+ * @return #MHD_YES to continue iterating,
+ * #MHD_NO to abort the iteration
*/
-static int
+static MHD_RESULT
post_iterator (void *cls,
enum MHD_ValueKind kind,
const char *key,
* #MHD_NO if the socket must be closed due to a serious
* error while handling the request
*/
-static int
+static MHD_RESULT
create_response (void *cls,
struct MHD_Connection *connection,
const char *url,
struct MHD_Response *response;
struct Request *request;
struct GNUNET_CRYPTO_EcdsaPublicKey pub;
- int ret;
+ MHD_RESULT ret;
(void) cls;
(void) version;
{
struct GNUNET_CRYPTO_RsaSignature **sig = dst;
size_t len;
- const char *res;
+ const void *res;
int fnum;
(void) cls;
#include <microhttpd.h>
#include "gnunet_util_lib.h"
#include "gnunet_rest_plugin.h"
-
+#include "gnunet_mhd_compat.h"
/**
* Default Socks5 listen port.
}
-static int
+static MHD_RESULT
post_data_iter (void *cls,
enum MHD_ValueKind kind,
const char *key,
* @a upload_data provided; the method must update this
* value to the number of bytes NOT processed;
* @param con_cls pointer to location where we store the 'struct Request'
- * @return MHD_YES if the connection was handled successfully,
- * MHD_NO if the socket must be closed due to a serious
+ * @return #MHD_YES if the connection was handled successfully,
+ * #MHD_NO if the socket must be closed due to a serious
* error while handling the request
*/
-static int
+static MHD_RESULT
create_response (void *cls,
struct MHD_Connection *con,
const char *url,
rest_conndata_handle);
con_handle->pp = MHD_create_post_processor (con,
65536,
- post_data_iter,
+ &post_data_iter,
rest_conndata_handle);
if (*upload_data_size)
{
allow_headers);
}
run_mhd_now ();
- int ret = MHD_queue_response (con, con_handle->status, con_handle->response);
- cleanup_handle (con_handle);
- return ret;
+ {
+ MHD_RESULT ret = MHD_queue_response (con,
+ con_handle->status,
+ con_handle->response);
+ cleanup_handle (con_handle);
+ return ret;
+ }
}
#include "plugin_transport_http_common.h"
#include <microhttpd.h>
#include <regex.h>
-
+#include "gnunet_mhd_compat.h"
#if BUILD_HTTPS
#define PLUGIN_NAME "https_server"
* @param upload_data upload data
* @param upload_data_size size of @a upload_data
* @param httpSessionCache the session cache to remember the connection
- * @return MHD_YES if connection is accepted, MHD_NO on reject
+ * @return #MHD_YES if connection is accepted, #MHD_NO on reject
*/
-static int
+static MHD_RESULT
server_access_cb (void *cls,
struct MHD_Connection *mhd_connection,
const char *url,
struct ServerRequest *sc = *httpSessionCache;
struct GNUNET_ATS_Session *s;
struct MHD_Response *response;
- int res = MHD_YES;
+ MHD_RESULT res = MHD_YES;
LOG (GNUNET_ERROR_TYPE_DEBUG,
_ (
* @param cls plugin as closure
* @param addr address of incoming connection
* @param addr_len number of bytes in @a addr
- * @return MHD_YES if connection is accepted, MHD_NO if connection is rejected
+ * @return #MHD_YES if connection is accepted, #MHD_NO if connection is rejected
*/
-static int
+static MHD_RESULT
server_accept_cb (void *cls,
const struct sockaddr *addr,
socklen_t addr_len)