curl: reschedule uses GNUNET_CURL_perform2.
[oweals/gnunet.git] / src / include / gnunet_jsonapi_util.h
1 /*
2   This file is part of GNUnet
3   Copyright (C) 2014, 2015, 2016 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 /**
19  * @file gnunet_jsonapi_util.h
20  * @brief utility functions for jsonapi
21  * @author Martin Schanzenbach
22  */
23 #ifndef GNUNET_JSONAPI_UTIL_H
24 #define GNUNET_JSONAPI_UTIL_H
25
26 #include "gnunet_util_lib.h"
27 #include "gnunet_rest_lib.h"
28 #include "gnunet_jsonapi_lib.h"
29
30
31 /**
32  * Check rest request for validity
33  *
34  * @param req handle to the request
35  * @return GNUNET_OK if valid
36  */
37 int
38 GNUNET_JSONAPI_check_request_acceptable (struct GNUNET_REST_RequestHandle *req);
39
40 /**
41  * Check rest request for validity
42  *
43  * @param req handle to the request
44  * @return GNUNET_OK if valid
45  */
46 int
47 GNUNET_JSONAPI_check_request_supported (struct GNUNET_REST_RequestHandle *req);
48
49
50 /**
51  * Handle jsonapi rest request. Checks request headers for jsonapi compliance
52  *
53  * @param req rest request handle
54  * @param handler rest request handlers
55  * @param cls closure
56  * @return GNUNET_OK if successful
57  */
58 int
59 GNUNET_JSONAPI_handle_request (struct GNUNET_REST_RequestHandle *req,
60                                const struct GNUNET_REST_RequestHandler *handlers,
61                                struct GNUNET_REST_RequestHandlerError *err,
62                                void *cls);
63
64 #endif