aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_rest_lib.h
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2015-03-25 17:19:54 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2015-03-25 17:19:54 +0000
commit19c380f237708910a12f14e98960919e9fe6d865 (patch)
tree0f5ede8bd4b834b0acd083423c2828cadb4b3665 /src/include/gnunet_rest_lib.h
parent5afc084a9c29b980bf00fddd7372fa15db63de76 (diff)
downloadgnunet-19c380f237708910a12f14e98960919e9fe6d865.tar.gz
gnunet-19c380f237708910a12f14e98960919e9fe6d865.zip
-more rest handling
Diffstat (limited to 'src/include/gnunet_rest_lib.h')
-rw-r--r--src/include/gnunet_rest_lib.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/include/gnunet_rest_lib.h b/src/include/gnunet_rest_lib.h
index 19a0168e5..cc02f01d0 100644
--- a/src/include/gnunet_rest_lib.h
+++ b/src/include/gnunet_rest_lib.h
@@ -36,6 +36,52 @@
36 36
37#define GNUNET_REST_JSONAPI_KEY_TYPE "type" 37#define GNUNET_REST_JSONAPI_KEY_TYPE "type"
38 38
39#define GNUNET_REST_HANDLER_END {NULL, NULL, NULL}
40
41struct RestConnectionDataHandle
42{
43 struct GNUNET_CONTAINER_MultiHashMap *url_param_map;
44 const char *method;
45 const char *url;
46 const char *data;
47 size_t data_size;
48
49};
50
51struct GNUNET_REST_RestConnectionHandler
52{
53 /**
54 * Http method to handle
55 */
56 const char *method;
57
58 /**
59 * Namespace to handle
60 */
61 const char *namespace;
62
63 /**
64 * callback handler
65 */
66 void (*proc) (struct RestConnectionDataHandle *handle,
67 const char *url,
68 void *cls);
69
70};
71
72
73/**
74 * Iterator called on obtained result for a REST result.
75 *
76 * @param cls closure
77 * @param resp the response
78 * @param status status code (HTTP)
79 */
80typedef void (*GNUNET_REST_ResultProcessor) (void *cls,
81 struct MHD_Response *resp,
82 int status);
83
84
39/** 85/**
40 * Resource structs for JSON API 86 * Resource structs for JSON API
41 */ 87 */
@@ -152,5 +198,9 @@ GNUNET_REST_namespace_match (const char *url, const char *namespace);
152GNUNET_REST_create_json_response (const char *data); 198GNUNET_REST_create_json_response (const char *data);
153 199
154 200
201int
202GNUNET_REST_handle_request (struct RestConnectionDataHandle *conn,
203 const struct GNUNET_REST_RestConnectionHandler *handlers,
204 void *cls);
155 205
156#endif 206#endif