aboutsummaryrefslogtreecommitdiff
path: root/src/include/taler_mhd_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-03-18 23:08:17 +0100
committerChristian Grothoff <christian@grothoff.org>2024-03-18 23:08:17 +0100
commit200bbfbefda8c67ec5196d7384b32e9fa33c4bb7 (patch)
tree65f6c5dc4213bf23e451a4ac7213f4fcd16ce1a3 /src/include/taler_mhd_lib.h
parent21648351b98856e02db146a5277552053291f226 (diff)
downloadexchange-200bbfbefda8c67ec5196d7384b32e9fa33c4bb7.tar.xz
add new TALER_MHD_parse_request_arg_snumber function to libtalermhd
Diffstat (limited to 'src/include/taler_mhd_lib.h')
-rw-r--r--src/include/taler_mhd_lib.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h
index c16772bff..d93bc1e14 100644
--- a/src/include/taler_mhd_lib.h
+++ b/src/include/taler_mhd_lib.h
@@ -522,6 +522,50 @@ TALER_MHD_parse_request_arg_number (struct MHD_Connection *connection,
/**
+ * Extract optional signed numeric limit argument from request.
+ *
+ * @param connection the MHD connection
+ * @param name name of the query parameter
+ * @param[out] val set to the signed value, unchanged if the
+ * option was not given
+ * @return #GNUNET_OK on success,
+ * #GNUNET_NO if an error was returned on @a connection (caller should return #MHD_YES) and
+ * #GNUNET_SYSERR if we failed to return an error (caller should return #MHD_NO)
+ */
+enum GNUNET_GenericReturnValue
+TALER_MHD_parse_request_arg_snumber (struct MHD_Connection *connection,
+ const char *name,
+ int64_t *val);
+
+
+/**
+ * Extract optional numeric argument from request.
+ * Macro that *returns* #MHD_YES/#MHD_NO if the
+ * requested argument existed but failed to parse.
+ *
+ * @param connection the MHD connection
+ * @param name name of the argument to parse
+ * @param[out] val set to the given numeric value,
+ * unchanged if value was not specified
+ */
+#define TALER_MHD_parse_request_snumber(connection,name,val) \
+ do { \
+ switch (TALER_MHD_parse_request_arg_snumber (connection, \
+ name, \
+ val)) \
+ { \
+ case GNUNET_SYSERR: \
+ GNUNET_break (0); \
+ return MHD_NO; \
+ case GNUNET_NO: \
+ GNUNET_break_op (0); \
+ case GNUNET_OK: \
+ break; \
+ } \
+ } while (0)
+
+
+/**
* Extract optional amount argument from request.
*
* @param connection the MHD connection