2019-03-16 10:04:23 +01:00
|
|
|
/** Hook list functions
|
|
|
|
*
|
|
|
|
* This file includes some examples.
|
|
|
|
*
|
|
|
|
* @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
|
2019-03-16 10:04:23 +01: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.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* 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 hooks User-defined hook functions
|
|
|
|
* @ingroup path
|
|
|
|
* @{
|
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <jansson.h>
|
|
|
|
|
|
|
|
/* Forward declarations */
|
|
|
|
struct vlist;
|
|
|
|
struct sample;
|
2020-06-08 02:25:07 +02:00
|
|
|
struct vpath;
|
2020-08-25 21:00:52 +02:00
|
|
|
struct vnode;
|
2019-03-16 10:04:23 +01:00
|
|
|
|
2020-09-10 11:11:42 +02:00
|
|
|
int hook_list_init(struct vlist *hs) __attribute__ ((warn_unused_result));
|
2019-03-16 10:04:23 +01:00
|
|
|
|
2020-09-10 11:11:42 +02:00
|
|
|
int hook_list_destroy(struct vlist *hs) __attribute__ ((warn_unused_result));
|
2019-03-16 10:04:23 +01:00
|
|
|
|
|
|
|
/** Parses an object of hooks
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
*
|
|
|
|
* {
|
|
|
|
* stats = {
|
|
|
|
* output = "stdout"
|
|
|
|
* },
|
|
|
|
* skip_first = {
|
|
|
|
* seconds = 10
|
|
|
|
* },
|
|
|
|
* hooks = [ "print" ]
|
|
|
|
* }
|
|
|
|
*/
|
2020-08-25 21:00:52 +02:00
|
|
|
void hook_list_parse(struct vlist *hs, json_t *cfg, int mask, struct vpath *p, struct vnode *n);
|
2019-03-16 10:04:23 +01:00
|
|
|
|
2020-08-25 21:00:52 +02:00
|
|
|
void hook_list_prepare(struct vlist *hs, struct vlist *sigs, int mask, struct vpath *p, struct vnode *n);
|
2019-03-16 10:04:23 +01:00
|
|
|
|
|
|
|
int hook_list_prepare_signals(struct vlist *hs, struct vlist *signals);
|
|
|
|
|
2020-08-25 21:00:52 +02:00
|
|
|
int hook_list_add(struct vlist *hs, int mask, struct vpath *p, struct vnode *n);
|
2019-03-16 10:04:23 +01:00
|
|
|
|
|
|
|
int hook_list_process(struct vlist *hs, struct sample *smps[], unsigned cnt);
|
|
|
|
|
2019-06-11 18:32:58 +02:00
|
|
|
void hook_list_periodic(struct vlist *hs);
|
2019-03-16 10:04:23 +01:00
|
|
|
|
2019-06-11 18:32:58 +02:00
|
|
|
void hook_list_start(struct vlist *hs);
|
2019-03-16 10:04:23 +01:00
|
|
|
|
2019-06-11 18:32:58 +02:00
|
|
|
void hook_list_stop(struct vlist *hs);
|
2019-03-16 10:04:23 +01:00
|
|
|
|
|
|
|
struct vlist * hook_list_get_signals(struct vlist *hs);
|
2020-08-25 20:24:18 +02:00
|
|
|
|
|
|
|
json_t * hook_list_to_json(struct vlist *hs);
|