2023-09-04 12:21:37 +02:00
|
|
|
/* Node type: OMA Next Generation Services Interface 10 (NGSI) (FIWARE context broker).
|
2015-09-19 18:54:27 +02:00
|
|
|
*
|
2015-09-21 17:13:50 +02:00
|
|
|
* 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.
|
2015-09-19 18:54:27 +02:00
|
|
|
*
|
|
|
|
* @see https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/FI-WARE_NGSI-10_Open_RESTful_API_Specification
|
2015-09-21 17:13:50 +02:00
|
|
|
* @see http://technical.openmobilealliance.org/Technical/Release_Program/docs/NGSI/V1_0-20120529-A/OMA-TS-NGSI_Context_Management-V1_0-20120529-A.pdf
|
2022-03-15 09:18:01 -04:00
|
|
|
* Author: Steffen Vogel <post@steffenvogel.de>
|
2022-03-15 09:28:57 -04:00
|
|
|
* SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
|
2022-07-04 18:20:03 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2017-03-03 20:20:13 -04:00
|
|
|
*/
|
|
|
|
|
2017-02-16 09:04:12 -03:00
|
|
|
#pragma once
|
2015-09-19 18:54:27 +02:00
|
|
|
|
|
|
|
#include <curl/curl.h>
|
2015-09-21 17:13:50 +02:00
|
|
|
#include <jansson.h>
|
2015-09-19 18:54:27 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
#include <villas/list.hpp>
|
2020-03-04 13:06:28 +01:00
|
|
|
#include <villas/task.hpp>
|
2015-09-19 18:54:27 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
2018-07-03 21:51:48 +02:00
|
|
|
// Forward declarations
|
2021-08-10 10:12:48 -04:00
|
|
|
class NodeCompat;
|
2015-09-19 18:54:27 +02:00
|
|
|
|
|
|
|
struct ngsi {
|
2023-09-07 11:46:39 +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
|
|
|
|
2023-09-07 11:46:39 +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.
|
2020-08-17 12:52:08 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
double timeout; // HTTP timeout in seconds
|
|
|
|
double rate; // Rate used for polling.
|
2015-10-11 13:22:58 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
struct Task task; // Timer for periodic events.
|
|
|
|
int ssl_verify; // Boolean flag whether SSL server certificates should be verified or not.
|
2015-09-21 17:13:50 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
struct curl_slist *headers; // List of HTTP request headers for libcurl
|
2015-10-11 13:22:58 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
struct {
|
|
|
|
CURL *curl; // libcurl: handle
|
|
|
|
struct List
|
|
|
|
signals; // A mapping between indices of the VILLASnode samples and the attributes in ngsi::context
|
|
|
|
} in, out;
|
2015-09-19 18:54:27 +02:00
|
|
|
};
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int ngsi_type_start(SuperNode *sn);
|
|
|
|
|
2018-07-16 08:08:17 +02:00
|
|
|
int ngsi_type_stop();
|
2015-09-19 18:54:27 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int ngsi_parse(NodeCompat *n, json_t *json);
|
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
char *ngsi_print(NodeCompat *n);
|
2021-08-10 10:12:48 -04:00
|
|
|
|
|
|
|
int ngsi_init(NodeCompat *n);
|
|
|
|
|
|
|
|
int ngsi_destroy(NodeCompat *n);
|
2015-09-19 18:54:27 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int ngsi_start(NodeCompat *n);
|
2015-09-19 18:54:27 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int ngsi_stop(NodeCompat *n);
|
2015-09-19 18:54:27 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int ngsi_reverse(NodeCompat *n);
|
2015-09-19 18:54:27 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
int ngsi_read(NodeCompat *n, struct Sample *const smps[], unsigned cnt);
|
2020-08-17 12:52:08 +02:00
|
|
|
|
2023-09-07 11:46:39 +02:00
|
|
|
int ngsi_write(NodeCompat *n, struct Sample *const smps[], unsigned cnt);
|
2015-09-19 18:54:27 +02:00
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int ngsi_poll_fds(NodeCompat *n, int fds[]);
|
2015-09-19 18:54:27 +02:00
|
|
|
|
2023-08-28 09:34:02 +02:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|