commit ac345410dcbb3fbeb41b78803a1dba70767473e9
parent 1d8fc9992074bdfe8b3505937f89d6de5eb63019
Author: Joris Vink <joris@coders.se>
Date: Sun, 20 Jul 2014 00:43:32 +0200
Add support for fetching parameters as 64bit integers.
Diffstat:
2 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/includes/http.h b/includes/http.h
@@ -34,6 +34,8 @@
#define HTTP_ARG_TYPE_INT32 4
#define HTTP_ARG_TYPE_UINT32 5
#define HTTP_ARG_TYPE_STRING 6
+#define HTTP_ARG_TYPE_INT64 7
+#define HTTP_ARG_TYPE_UINT64 8
struct http_header {
char *header;
@@ -103,6 +105,13 @@ struct http_arg {
#define http_argument_get_int32(n, o) \
http_argument_type(req, n, o, NULL, HTTP_ARG_TYPE_INT32)
+#define http_argument_get_uint64(n, o) \
+ http_argument_type(req, n, o, NULL, HTTP_ARG_TYPE_UINT64)
+
+#define http_argument_get_int64(n, o) \
+ http_argument_type(req, n, o, NULL, HTTP_ARG_TYPE_INT64)
+
+
struct http_file {
char *name;
char *filename;
diff --git a/src/http.c b/src/http.c
@@ -633,6 +633,12 @@ http_argument_get(struct http_request *req, const char *name,
case HTTP_ARG_TYPE_UINT32:
COPY_AS_INTTYPE(0, UINT_MAX, u_int32_t);
return (KORE_RESULT_OK);
+ case HTTP_ARG_TYPE_INT64:
+ COPY_AS_INTTYPE(LONG_MIN, LONG_MAX, u_int64_t);
+ break;
+ case HTTP_ARG_TYPE_UINT64:
+ COPY_AS_INTTYPE(0, ULONG_MAX, u_int64_t);
+ break;
case HTTP_ARG_TYPE_STRING:
CACHE_STRING();
*out = q->s_value;