aboutsummaryrefslogtreecommitdiff
path: root/src/jsonapi/jsonapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jsonapi/jsonapi.c')
-rw-r--r--src/jsonapi/jsonapi.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/src/jsonapi/jsonapi.c b/src/jsonapi/jsonapi.c
deleted file mode 100644
index f7fcd972a..000000000
--- a/src/jsonapi/jsonapi.c
+++ /dev/null
@@ -1,82 +0,0 @@
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 jsonapi/jsonapi.c
20 * @brief functions to generate specifciations for JSONAPI parsing
21 * @author Martin Schanzenbach
22 */
23#include "platform.h"
24#include "gnunet_json_lib.h"
25#include "gnunet_rest_lib.h"
26
27/**
28 * TODO move this to jsonapi-utils
29 */
30
31/**
32 * Check rest request for validity
33 *
34 * @param req handle to the request
35 * @return GNUNET_OK if valid
36 */
37int
38GNUNET_JSONAPI_check_request_acceptable (struct GNUNET_REST_RequestHandle *req)
39{
40 //TODO
41 return GNUNET_OK;
42}
43
44/**
45 * Check rest request for validity
46 *
47 * @param req handle to the request
48 * @return GNUNET_OK if valid
49 */
50int
51GNUNET_JSONAPI_check_request_supported (struct GNUNET_REST_RequestHandle *req)
52{
53 //TODO
54 return GNUNET_OK;
55}
56
57/**
58 * Handle jsonapi rest request. Checks request headers for jsonapi compliance
59 *
60 * @param req rest request handle
61 * @param handler rest request handlers
62 * @param cls closure
63 * @return GNUNET_OK if successful
64 */
65int
66GNUNET_JSONAPI_handle_request (struct GNUNET_REST_RequestHandle *handle,
67 const struct GNUNET_REST_RequestHandler *handlers,
68 struct GNUNET_REST_RequestHandlerError *err,
69 void *cls)
70{
71 if (GNUNET_OK != GNUNET_JSONAPI_check_request_acceptable (handle))
72 {
73 err->error_code = MHD_HTTP_NOT_ACCEPTABLE;
74 return GNUNET_SYSERR;
75 }
76 if (GNUNET_OK != GNUNET_JSONAPI_check_request_supported (handle))
77 {
78 err->error_code = MHD_HTTP_UNSUPPORTED_MEDIA_TYPE;
79 return GNUNET_SYSERR;
80 }
81 return GNUNET_REST_handle_request (handle, handlers, err, cls);
82}