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.h

97 lines
3.2 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>
* @copyright 2017, 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>
#include "list.h"
#include "msg.h"
#include "super_node.h"
#include "node.h"
struct node;
struct ngsi {
2015-10-11 13:22:58 +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
double timeout; /**< HTTP timeout in seconds */
2015-10-14 12:19:01 +02:00
double rate; /**< Rate used for polling. */
2015-10-11 13:22:58 +02:00
2015-10-14 12:19:01 +02:00
int tfd; /**< Timer */
int ssl_verify; /**< Boolean flag whether SSL server certificates should be verified or not. */
2015-10-11 13:22:58 +02:00
struct curl_slist *headers; /**< List of HTTP request headers for libcurl */
CURL *curl; /**< libcurl: handle */
2016-06-08 23:42:44 +02:00
struct list mapping; /**< A mapping between indices of the VILLASnode samples and the attributes in ngsi::context */
};
/** Initialize global NGSI settings and maps shared memory regions.
*
2017-04-18 17:58:23 +02:00
* @see node_type::init
*/
int ngsi_init(struct super_node *sn);
/** Free global NGSI settings and unmaps shared memory regions.
*
2017-04-18 17:58:23 +02:00
* @see node_type::deinit
*/
int ngsi_deinit();
2017-04-18 17:58:23 +02:00
/** @see node_type::parse */
int ngsi_parse(struct node *n, config_setting_t *cfg);
2017-04-18 17:58:23 +02:00
/** @see node_type::print */
char * ngsi_print(struct node *n);
2017-04-18 17:58:23 +02:00
/** @see node_type::open */
int ngsi_start(struct node *n);
2017-04-18 17:58:23 +02:00
/** @see node_type::close */
int ngsi_stop(struct node *n);
2017-04-18 17:58:23 +02:00
/** @see node_type::read */
2016-06-08 23:42:44 +02:00
int ngsi_read(struct node *n, struct sample *smps[], unsigned cnt);
2017-04-18 17:58:23 +02:00
/** @see node_type::write */
2016-06-08 23:42:44 +02:00
int ngsi_write(struct node *n, struct sample *smps[], unsigned cnt);
2017-02-16 09:04:12 -03:00
/** @} */