blob: fdae8c45b98eb919f8340e96c65414b908a4fd9c [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>
8#include <linux/if.h>
9
Harald Welte1a36f332018-06-04 17:36:33 +020010#include "value_node.h"
11
Harald Welte3e5ab692018-06-04 04:26:20 +020012/* information gathered from sysinfo(2) */
13struct osysmon_state_sysinfo {
14 unsigned long uptime_secs;
15 unsigned long loads[3];
16 unsigned long freeram;
17};
18
19/* one network interface */
20struct osysmon_state_iface {
21 char name[IFNAMSIZ+1];
22 uint32_t flags; /* enum net_device_flags IFF_* */
23 uint8_t hwasddr[6];
24 uint32_t ipaddr;
25};
26
27/* information gathered from RTNL via libmnl */
28struct osysmon_state_rtnl {
29 struct osysmon_state_iface iface[8];
30 unsigned int num_iface;
31 struct {
32 char *ifname;
33 uint32_t ipaddr;
34 } default_route;
35};
36
Harald Welte1a36f332018-06-04 17:36:33 +020037#if 0
Harald Welte3e5ab692018-06-04 04:26:20 +020038struct osysmon_state_gbproxy {
39 char ns_state[32];
40 char bssgp_state[32];
41};
42
43struct osysmon_state_bts {
44 bool rf_locked;
45};
46
47struct osysmon_state_bsc {
48 struct osysmon_state_bts bts[8];
49 unsigned int num_bts;
50 char a_state[32];
51};
Harald Welte1a36f332018-06-04 17:36:33 +020052#endif
Harald Welte3e5ab692018-06-04 04:26:20 +020053
54struct osysmon_state {
55 struct osysmon_state_sysinfo sysinfo;
56 struct osysmon_state_rtnl rtnl;
Harald Welte1a36f332018-06-04 17:36:33 +020057
58 /* list of 'struct ctrl client' */
59 struct llist_head ctrl_clients;
Harald Welte3e5ab692018-06-04 04:26:20 +020060};
Harald Welte1a36f332018-06-04 17:36:33 +020061
62extern struct osysmon_state *g_oss;
63
64
65
66enum osysmon_vty_node {
67 CTRL_CLIENT_NODE = _LAST_OSMOVTY_NODE + 1,
68 CTRL_CLIENT_GETVAR_NODE,
69};
70
71
72int osysmon_ctrl_go_parent(struct vty *vty);
73int osysmon_ctrl_init();
74int osysmon_ctrl_poll(struct value_node *parent);