diff options
Diffstat (limited to 'src/mhd')
-rw-r--r-- | src/mhd/mhd_parsing.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/mhd/mhd_parsing.c b/src/mhd/mhd_parsing.c index b1f8417e4..381b064fa 100644 --- a/src/mhd/mhd_parsing.c +++ b/src/mhd/mhd_parsing.c @@ -210,6 +210,42 @@ TALER_MHD_parse_request_arg_timeout (struct MHD_Connection *connection, enum GNUNET_GenericReturnValue +TALER_MHD_parse_request_arg_number (struct MHD_Connection *connection, + const char *name, + uint64_t *off) +{ + const char *ts; + char dummy; + unsigned long long num; + + ts = MHD_lookup_connection_value (connection, + MHD_GET_ARGUMENT_KIND, + name); + if (NULL == ts) + return GNUNET_OK; + if (1 != + sscanf (ts, + "%llu%c", + &num, + &dummy)) + { + MHD_RESULT mret; + + GNUNET_break_op (0); + mret = TALER_MHD_reply_with_error (connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_PARAMETER_MALFORMED, + name); + return (MHD_YES == mret) + ? GNUNET_NO + : GNUNET_SYSERR; + } + *off = (uint64_t) num; + return GNUNET_OK; +} + + +enum GNUNET_GenericReturnValue TALER_MHD_parse_json_data (struct MHD_Connection *connection, const json_t *root, struct GNUNET_JSON_Specification *spec) |