imv-swima: Created SWIMA IMV plugin
[strongswan.git] / src / libimcv / plugins / imv_swima / imv_swima_rest.h
1 /*
2 * Copyright (C) 2017 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup imv_swima imv_swima
18 * @ingroup libimcv_plugins
19 *
20 * @defgroup imv_swima_rest_t imv_swima_rest
21 * @{ @ingroup imv_swima
22 */
23
24 #ifndef IMV_SWIMA_REST_H_
25 #define IMV_SWIMA_REST_H_
26
27 #include <library.h>
28
29 #include <json.h>
30
31 typedef struct imv_swima_rest_t imv_swima_rest_t;
32
33 /**
34 * Public REST interface
35 */
36 struct imv_swima_rest_t {
37
38 /**
39 * Post a HTTP request including a JSON object
40 *
41 * @param jreq JSON object in HTTP request
42 * @param jresp JSON object in HTTP response if NEED_MORE
43 * @return Status (SUCCESS, NEED_MORE or FAILED)
44 */
45 status_t (*post)(imv_swima_rest_t *this, char *command, json_object *jreq,
46 json_object **jresp);
47
48 /**
49 * Destroy imv_swima_rest_t object
50 */
51 void (*destroy)(imv_swima_rest_t *this);
52
53 };
54
55 /**
56 * Create an imv_swima_rest_t instance
57 *
58 * @param uri REST URI (http://username:password@hostname[:port]/api/)
59 * @param timeout Timeout of the REST connection
60 */
61 imv_swima_rest_t* imv_swima_rest_create(char *uri, u_int timeout);
62
63 #endif /** IMV_SWIMA_REST_H_ @}*/