]>
git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libimcv/rest/rest.h
2 * Copyright (C) 2017 Andreas Steffen
3 * HSR Hochschule fuer Technik Rapperswil
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>.
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
17 * @defgroup imv_swima imv_swima
18 * @ingroup libimcv_plugins
20 * @defgroup rest_t rest
21 * @{ @ingroup imv_swima
32 typedef struct rest_t rest_t
;
35 * Public REST interface
40 * Send an HTTP GET request returning a JSON object
42 * @param jresp JSON object in HTTP
43 * @return Status (SUCCESS or FAILED)
45 status_t (*get
)(rest_t
*this, char *command
, json_object
**jresp
);
48 * Send an HTTP POST request including a JSON object
50 * @param jreq JSON object in HTTP request
51 * @param jresp JSON object in HTTP response if NEED_MORE
52 * @return Status (SUCCESS, NEED_MORE or FAILED)
54 status_t (*post
)(rest_t
*this, char *command
, json_object
*jreq
,
58 * Destroy rest_t object
60 void (*destroy
)(rest_t
*this);
65 * Create an rest_t instance
67 * @param uri REST URI (http://username:password@hostname[:port]/api/)
68 * @param timeout Timeout of the REST connection
70 rest_t
* rest_create(char *uri
, u_int timeout
);
74 #endif /** REST_H_ @}*/