GNUnet  0.19.4
gnunet_rest_lib.h
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet
3  Copyright (C) 2010-2015 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
20 
34 #ifndef GNUNET_REST_LIB_H
35 #define GNUNET_REST_LIB_H
36 
37 
38 #include "gnunet_util_lib.h"
39 #include <microhttpd.h>
40 
41 #define GNUNET_REST_HANDLER_END { NULL, NULL, NULL }
42 
44 {
49 
54 
58  const char *method;
59 
63  const char *url;
64 
68  const char *data;
69 
73  size_t data_size;
74 };
75 
77 {
79  char*error_text;
80 };
81 
83 {
87  const char *method;
88 
92  const char *namespace;
93 
98  const char *url,
99  void *cls);
100 };
101 
102 
110 typedef void (*GNUNET_REST_ResultProcessor) (void *cls,
111  struct MHD_Response *resp,
112  int status);
113 
121 int
122 GNUNET_REST_namespace_match (const char *url, const char *namespace);
123 
130 struct MHD_Response*
131 GNUNET_REST_create_response (const char *data);
132 
133 
134 int
136  const struct GNUNET_REST_RequestHandler *handlers,
138  void *cls);
139 
140 
141 #endif
142  /* end of group */
144  /* end of group addition */
static struct GNUNET_CADET_MessageHandler handlers[]
Handlers, for diverse services.
static struct GNUNET_DNS_Handle * handle
Handle to transport service.
uint32_t data
The data value.
uint16_t status
See PRISM_STATUS_*-constants.
struct MHD_Response * GNUNET_REST_create_response(const char *data)
Create REST MHD response.
Definition: rest.c:44
int GNUNET_REST_handle_request(struct GNUNET_REST_RequestHandle *conn, const struct GNUNET_REST_RequestHandler *handlers, struct GNUNET_REST_RequestHandlerError *err, void *cls)
Definition: rest.c:64
void(* GNUNET_REST_ResultProcessor)(void *cls, struct MHD_Response *resp, int status)
Iterator called on obtained result for a REST result.
int GNUNET_REST_namespace_match(const char *url, const char *namespace)
Check if namespace is in URL.
Definition: rest.c:37
Internal representation of the hash map.
struct GNUNET_CONTAINER_MultiHashMap * header_param_map
Map of headers.
const char * data
The POST data.
const char * url
The url as string.
const char * method
The HTTP method as MHD value (see microhttpd.h)
struct GNUNET_CONTAINER_MultiHashMap * url_param_map
Map of url parameters.
size_t data_size
The POST data size.
void(* proc)(struct GNUNET_REST_RequestHandle *handle, const char *url, void *cls)
Namespace to handle.
const char * method
Http method to handle.