blob: 2f82c471441267fa383fcc92bc1d02ce609e374d [file] [log] [blame]
Harald Welte3e5ab692018-06-04 04:26:20 +02001#pragma once
2
3#include <osmocom/core/select.h>
4#include <osmocom/core/utils.h>
Harald Welte1a36f332018-06-04 17:36:33 +02005#include <osmocom/vty/command.h>
Harald Welte3e5ab692018-06-04 04:26:20 +02006
7#include <stdbool.h>
Harald Welte3e5ab692018-06-04 04:26:20 +02008
Harald Welte1a36f332018-06-04 17:36:33 +02009#include "value_node.h"
10
Harald Welte9e7fe002018-06-04 20:09:26 +020011struct rtnl_client_state;
Max8066a412019-01-28 23:59:03 +010012struct ping_state;
Harald Welte3e5ab692018-06-04 04:26:20 +020013
14struct osysmon_state {
Harald Welte9e7fe002018-06-04 20:09:26 +020015 struct rtnl_client_state *rcs;
Harald Welte1a36f332018-06-04 17:36:33 +020016 /* list of 'struct ctrl client' */
17 struct llist_head ctrl_clients;
Max9a852f22019-01-31 15:58:57 +010018 /* list of 'struct openvpn_client' */
19 struct llist_head openvpn_clients;
Harald Welte9e7fe002018-06-04 20:09:26 +020020 /* list of 'struct netdev' */
21 struct llist_head netdevs;
Harald Welte81e20232018-06-04 21:25:56 +020022 /* list of 'struct osysmon_file' */
23 struct llist_head files;
Max8066a412019-01-28 23:59:03 +010024 struct ping_state *pings;
Harald Welte3e5ab692018-06-04 04:26:20 +020025};
Harald Welte1a36f332018-06-04 17:36:33 +020026
27extern struct osysmon_state *g_oss;
28
29
30
31enum osysmon_vty_node {
32 CTRL_CLIENT_NODE = _LAST_OSMOVTY_NODE + 1,
33 CTRL_CLIENT_GETVAR_NODE,
Harald Welte9e7fe002018-06-04 20:09:26 +020034 NETDEV_NODE,
Max9a852f22019-01-31 15:58:57 +010035 OPENVPN_NODE,
Max8066a412019-01-28 23:59:03 +010036 PING_NODE,
Harald Welte1a36f332018-06-04 17:36:33 +020037};
38
39
40int osysmon_ctrl_go_parent(struct vty *vty);
41int osysmon_ctrl_init();
42int osysmon_ctrl_poll(struct value_node *parent);
Harald Welte32f7a992018-06-04 18:07:33 +020043
Harald Welte9e7fe002018-06-04 20:09:26 +020044int osysmon_rtnl_go_parent(struct vty *vty);
45int osysmon_rtnl_init();
46int osysmon_rtnl_poll(struct value_node *parent);
47
Harald Welte32f7a992018-06-04 18:07:33 +020048int osysmon_sysinfo_init();
49int osysmon_sysinfo_poll(struct value_node *parent);
Harald Welte81e20232018-06-04 21:25:56 +020050
Max8066a412019-01-28 23:59:03 +010051int osysmon_ping_init();
52int osysmon_ping_poll(struct value_node *parent);
53
Max9a852f22019-01-31 15:58:57 +010054int osysmon_openvpn_init();
55int osysmon_openvpn_poll(struct value_node *parent);
56
Harald Welte81e20232018-06-04 21:25:56 +020057int osysmon_file_init();
58int osysmon_file_poll(struct value_node *parent);