Greenbone Security Assistant
gsad_http_handler.h
Go to the documentation of this file.
1 /* Copyright (C) 2016-2021 Greenbone Networks GmbH
2  *
3  * SPDX-License-Identifier: AGPL-3.0-or-later
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as
7  * published by the Free Software Foundation, either version 3 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU 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 
24 #ifndef _GSAD_HTTP_HANDLER_H
25 #define _GSAD_HTTP_HANDLER_H
26 
27 #include "gsad_http.h"
28 
29 typedef struct http_handler http_handler_t;
30 
32 
33 typedef int (*http_handler_func_t) (http_connection_t *connection,
34  const char *method, const char *url,
35  gsad_connection_info_t *con_info,
36  http_handler_t *handler, void *data);
37 
40 
41 int
42 http_handler_next (http_connection_t *connection, const char *method,
43  const char *url, gsad_connection_info_t *con_info,
44  http_handler_t *handler, void *data);
45 
46 int
47 http_handler_start (http_connection_t *connection, const char *method,
48  const char *url, gsad_connection_info_t *con_info,
49  http_handler_t *handler, void *data);
50 
52 
53 void
55 
58 
59 void
61 
63 url_handler_new (const gchar *regexp, http_handler_t *handler);
64 
66 url_handler_add_func (http_handler_t *handlers, const gchar *regexp,
68 
71 
72 void
74 
75 void
77  http_handler_t *handler);
78 
79 #if MHD_VERSION < 0x00097002
80 int
81 #else
82 enum MHD_Result
83 #endif
84 handle_request (void *cls, http_connection_t *connection, const char *url,
85  const char *method, const char *version,
86  const char *upload_data, size_t *upload_data_size,
87  void **con_cls);
88 
89 #endif /* _GSAD_HTTP_HANDLER_H */
HTTP handling of GSA.
struct MHD_Connection http_connection_t
Definition: gsad_http.h:134
http_handler_t * handlers
Definition: gsad_http_handler.c:91
int handle_request(void *cls, http_connection_t *connection, const char *url, const char *method, const char *version, const char *upload_data, size_t *upload_data_size, void **con_cls)
HTTP request handler for GSAD.
Definition: gsad_http_handler.c:848
int(* http_handler_func_t)(http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data)
Definition: gsad_http_handler.h:33
void method_router_set_get_handler(http_handler_t *router, http_handler_t *handler)
Definition: gsad_http_handler.c:226
http_handler_t * init_http_handlers()
Definition: gsad_http_handler.c:757
http_handler_t * http_handler_new(http_handler_func_t)
Definition: gsad_http_handler.c:160
http_handler_t * http_handler_add(http_handler_t *handlers, http_handler_t *handler)
Definition: gsad_http_handler.c:94
int http_handler_next(http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data)
Definition: gsad_http_handler.c:126
void cleanup_http_handlers()
Definition: gsad_http_handler.c:816
http_handler_t * url_handler_new(const gchar *regexp, http_handler_t *handler)
Definition: gsad_http_handler.c:282
void(* http_handler_free_func_t)(http_handler_t *)
Definition: gsad_http_handler.h:31
int http_handler_start(http_connection_t *connection, const char *method, const char *url, gsad_connection_info_t *con_info, http_handler_t *handler, void *data)
Definition: gsad_http_handler.c:114
void http_handler_free(http_handler_t *handler)
Definition: gsad_http_handler.c:166
void method_router_set_post_handler(http_handler_t *router, http_handler_t *handler)
Definition: gsad_http_handler.c:233
http_handler_t * url_handler_add_func(http_handler_t *handlers, const gchar *regexp, http_handler_func_t handle)
Definition: gsad_http_handler.c:289
http_handler_t * method_router_new()
Definition: gsad_http_handler.c:216
Connection information.
Definition: gsad_http.h:125
Definition: gsad_http_handler.c:76
void * data
Definition: gsad_http_handler.c:80
http_handler_func_t handle
Definition: gsad_http_handler.c:78