blob: 36cd6080c3f4a16b20332a3480b1733e3a7fa3d2 [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;
Pau Espin Pedrol92016772019-03-18 17:24:34 +010016 /* list of 'struct osysmon_cmd' */
17 struct llist_head shellcmds;
Harald Welte1a36f332018-06-04 17:36:33 +020018 /* list of 'struct ctrl client' */
19 struct llist_head ctrl_clients;
Max9a852f22019-01-31 15:58:57 +010020 /* list of 'struct openvpn_client' */
21 struct llist_head openvpn_clients;
Harald Welte9e7fe002018-06-04 20:09:26 +020022 /* list of 'struct netdev' */
23 struct llist_head netdevs;
Harald Welte81e20232018-06-04 21:25:56 +020024 /* list of 'struct osysmon_file' */
25 struct llist_head files;
Pau Espin Pedrol92016772019-03-18 17:24:34 +010026 /* list of ping contexts */
Max8066a412019-01-28 23:59:03 +010027 struct ping_state *pings;
Harald Welte3e5ab692018-06-04 04:26:20 +020028};
Harald Welte1a36f332018-06-04 17:36:33 +020029
30extern struct osysmon_state *g_oss;
31
32
33
34enum osysmon_vty_node {
35 CTRL_CLIENT_NODE = _LAST_OSMOVTY_NODE + 1,
36 CTRL_CLIENT_GETVAR_NODE,
Harald Welte9e7fe002018-06-04 20:09:26 +020037 NETDEV_NODE,
Max9a852f22019-01-31 15:58:57 +010038 OPENVPN_NODE,
Max8066a412019-01-28 23:59:03 +010039 PING_NODE,
Harald Welte1a36f332018-06-04 17:36:33 +020040};
41
Harald Welte1a36f332018-06-04 17:36:33 +020042int osysmon_ctrl_go_parent(struct vty *vty);
43int osysmon_ctrl_init();
44int osysmon_ctrl_poll(struct value_node *parent);
Harald Welte32f7a992018-06-04 18:07:33 +020045
Harald Welte9e7fe002018-06-04 20:09:26 +020046int osysmon_rtnl_go_parent(struct vty *vty);
47int osysmon_rtnl_init();
48int osysmon_rtnl_poll(struct value_node *parent);
49
Harald Welte32f7a992018-06-04 18:07:33 +020050int osysmon_sysinfo_init();
51int osysmon_sysinfo_poll(struct value_node *parent);
Harald Welte81e20232018-06-04 21:25:56 +020052
Max8066a412019-01-28 23:59:03 +010053int osysmon_ping_init();
54int osysmon_ping_poll(struct value_node *parent);
55
Max9a852f22019-01-31 15:58:57 +010056int osysmon_openvpn_init();
57int osysmon_openvpn_poll(struct value_node *parent);
58
Harald Welte81e20232018-06-04 21:25:56 +020059int osysmon_file_init();
60int osysmon_file_poll(struct value_node *parent);
Pau Espin Pedrol92016772019-03-18 17:24:34 +010061
62int osysmon_shellcmd_init();
63int osysmon_shellcmd_poll(struct value_node *parent);