-merge branch 'master' into identity_oidc
[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 under the
6   terms of the GNU General Public License as published by the Free Software
7   Foundation; either version 3, or (at your option) any later version.
8
9   GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
10   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12
13   You should have received a copy of the GNU General Public License along with
14   GNUnet; see the file COPYING.  If not, If not, see <http://www.gnu.org/licenses/>
15 */
16 /**
17  * @file gnunet_jsonapi_util.h
18  * @brief utility functions for jsonapi
19  * @author Martin Schanzenbach
20  */
21 #ifndef GNUNET_JSONAPI_UTIL_H
22 #define GNUNET_JSONAPI_UTIL_H
23
24 #include "gnunet_util_lib.h"
25 #include "gnunet_rest_lib.h"
26 #include "gnunet_jsonapi_lib.h"
27
28
29 /**
30  * Check rest request for validity
31  *
32  * @param req handle to the request
33  * @return GNUNET_OK if valid
34  */
35 int
36 GNUNET_JSONAPI_check_request_acceptable (struct GNUNET_REST_RequestHandle *req);
37
38 /**
39  * Check rest request for validity
40  *
41  * @param req handle to the request
42  * @return GNUNET_OK if valid
43  */
44 int
45 GNUNET_JSONAPI_check_request_supported (struct GNUNET_REST_RequestHandle *req);
46
47
48 /**
49  * Handle jsonapi rest request. Checks request headers for jsonapi compliance
50  *
51  * @param req rest request handle
52  * @param handler rest request handlers
53  * @param cls closure
54  * @return GNUNET_OK if successful
55  */
56 int
57 GNUNET_JSONAPI_handle_request (struct GNUNET_REST_RequestHandle *req,
58                                const struct GNUNET_REST_RequestHandler *handlers,
59                                struct GNUNET_REST_RequestHandlerError *err,
60                                void *cls);
61
62 #endif