]>
git.ipfire.org Git - thirdparty/strongswan.git/blob - src/libimcv/rest/rest.h
2 * Copyright (C) 2017 Andreas Steffen
4 * Copyright (C) secunet Security Networks AG
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 * @defgroup imv_swima imv_swima
19 * @ingroup libimcv_plugins
21 * @defgroup rest_t rest
22 * @{ @ingroup imv_swima
33 typedef struct rest_t rest_t
;
36 * Public REST interface
41 * Send an HTTP GET request returning a JSON object
43 * @param jresp JSON object in HTTP
44 * @return Status (SUCCESS or FAILED)
46 status_t (*get
)(rest_t
*this, char *command
, json_object
**jresp
);
49 * Send an HTTP POST request including a JSON object
51 * @param jreq JSON object in HTTP request
52 * @param jresp JSON object in HTTP response if NEED_MORE
53 * @return Status (SUCCESS, NEED_MORE or FAILED)
55 status_t (*post
)(rest_t
*this, char *command
, json_object
*jreq
,
59 * Destroy rest_t object
61 void (*destroy
)(rest_t
*this);
66 * Create an rest_t instance
68 * @param uri REST URI (http://username:password@hostname[:port]/api/)
69 * @param timeout Timeout of the REST connection
71 rest_t
* rest_create(char *uri
, u_int timeout
);
75 #endif /** REST_H_ @}*/