Annotation of embedaddon/strongswan/src/libimcv/rest/rest.h, revision 1.1
1.1 ! misho 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 rest_t rest
! 21: * @{ @ingroup imv_swima
! 22: */
! 23:
! 24: #ifndef REST_H_
! 25: #define REST_H_
! 26:
! 27: #ifdef USE_JSON
! 28:
! 29: #include <library.h>
! 30: #include <json.h>
! 31:
! 32: typedef struct rest_t rest_t;
! 33:
! 34: /**
! 35: * Public REST interface
! 36: */
! 37: struct rest_t {
! 38:
! 39: /**
! 40: * Send an HTTP GET request returning a JSON object
! 41: *
! 42: * @param jresp JSON object in HTTP
! 43: * @return Status (SUCCESS or FAILED)
! 44: */
! 45: status_t (*get)(rest_t *this, char *command, json_object **jresp);
! 46:
! 47: /**
! 48: * Send an HTTP POST request including a JSON object
! 49: *
! 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)
! 53: */
! 54: status_t (*post)(rest_t *this, char *command, json_object *jreq,
! 55: json_object **jresp);
! 56:
! 57: /**
! 58: * Destroy rest_t object
! 59: */
! 60: void (*destroy)(rest_t *this);
! 61:
! 62: };
! 63:
! 64: /**
! 65: * Create an rest_t instance
! 66: *
! 67: * @param uri REST URI (http://username:password@hostname[:port]/api/)
! 68: * @param timeout Timeout of the REST connection
! 69: */
! 70: rest_t* rest_create(char *uri, u_int timeout);
! 71:
! 72: #endif /* USE_JSON */
! 73:
! 74: #endif /** REST_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>