1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00
VILLASnode/include/villas/nodes/ngsi.hpp

105 lines
3.6 KiB
C++
Raw Permalink Normal View History

/** Node type: OMA Next Generation Services Interface 10 (NGSI) (FIWARE context broker)
*
* This file implements the NGSI context interface. NGSI is RESTful HTTP is specified by
* the Open Mobile Alliance (OMA).
* It uses the standard operations of the NGSI 10 context information standard.
*
* @see https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_NGSI-10_Open_RESTful_API_Specification
* @see http://technical.openmobilealliance.org/Technical/Release_Program/docs/NGSI/V1_0-20120529-A/OMA-TS-NGSI_Context_Management-V1_0-20120529-A.pdf
* @file
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
2020-01-20 17:17:00 +01:00
* @copyright 2014-2020, Institute for Automation of Complex Power Systems, EONERC
2017-04-27 12:56:43 +02:00
* @license GNU General Public License (version 3)
*
* VILLASnode
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
2017-04-27 12:56:43 +02:00
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
2017-04-27 12:56:43 +02:00
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
/**
* @addtogroup ngsi FIRWARE NGSI 9/10 RESTful HTTP API
* @ingroup node
* @{
*/
2017-02-16 09:04:12 -03:00
#pragma once
#include <curl/curl.h>
#include <jansson.h>
2017-12-09 02:19:28 +08:00
#include <villas/list.h>
#include <villas/node.h>
2020-03-04 13:06:28 +01:00
#include <villas/task.hpp>
2018-07-03 21:51:48 +02:00
/* Forward declarations */
2020-08-25 21:00:52 +02:00
struct vnode;
struct ngsi {
2018-06-29 08:37:14 +02:00
const char *endpoint; /**< The NGSI context broker endpoint URL. */
const char *entity_id; /**< The context broker entity id related to this node */
const char *entity_type; /**< The type of the entity */
const char *access_token; /**< An optional authentication token which will be sent as HTTP header. */
2015-10-11 13:22:58 +02:00
bool create; /**< Weather we want to create the context element during startup. */
bool remove; /**< Weather we want to delete the context element during startup. */
2018-06-29 08:37:14 +02:00
double timeout; /**< HTTP timeout in seconds */
double rate; /**< Rate used for polling. */
2015-10-11 13:22:58 +02:00
2020-03-04 13:06:28 +01:00
struct Task task; /**< Timer for periodic events. */
2018-06-29 08:37:14 +02:00
int ssl_verify; /**< Boolean flag whether SSL server certificates should be verified or not. */
2018-06-29 08:37:14 +02:00
struct curl_slist *headers; /**< List of HTTP request headers for libcurl */
2015-10-11 13:22:58 +02:00
struct {
CURL *curl; /**< libcurl: handle */
struct vlist signals; /**< A mapping between indices of the VILLASnode samples and the attributes in ngsi::context */
} in, out;
};
/** Initialize global NGSI settings and maps shared memory regions.
*
* @see node_type::type_start
*/
2019-04-23 13:14:47 +02:00
int ngsi_type_start(villas::node::SuperNode *sn);
/** Free global NGSI settings and unmaps shared memory regions.
*
* @see node_type::type_stop
*/
int ngsi_type_stop();
2017-04-18 17:58:23 +02:00
/** @see node_type::parse */
2020-08-25 21:00:52 +02:00
int ngsi_parse(struct vnode *n, json_t *cfg);
2017-04-18 17:58:23 +02:00
/** @see node_type::print */
2020-08-25 21:00:52 +02:00
char * ngsi_print(struct vnode *n);
2020-01-21 14:27:28 +01:00
/** @see node_type::start */
2020-08-25 21:00:52 +02:00
int ngsi_start(struct vnode *n);
2020-01-21 14:27:28 +01:00
/** @see node_type::stop */
2020-08-25 21:00:52 +02:00
int ngsi_stop(struct vnode *n);
/** @see node_type::reverse */
2020-08-25 21:00:52 +02:00
int ngsi_reverse(struct vnode *n);
2017-04-18 17:58:23 +02:00
/** @see node_type::read */
2020-08-25 21:00:52 +02:00
int ngsi_read(struct vnode *n, struct sample *smps[], unsigned cnt, unsigned *release);
2017-04-18 17:58:23 +02:00
/** @see node_type::write */
2020-08-25 21:00:52 +02:00
int ngsi_write(struct vnode *n, struct sample *smps[], unsigned cnt, unsigned *release);
2018-06-29 08:37:14 +02:00
/** @} */