policy: only send preferred candidate with transition request
[project/usteer.git] / remote.h
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
14 *
15 * Copyright (C) 2020 embedd.ch
16 * Copyright (C) 2020 Felix Fietkau <nbd@nbd.name>
17 * Copyright (C) 2020 John Crispin <john@phrozen.org>
18 */
19
20 #ifndef __APMGR_REMOTE_H
21 #define __APMGR_REMOTE_H
22
23 #include <libubox/blob.h>
24
25 enum {
26 APMSG_ID,
27 APMSG_SEQ,
28 APMSG_NODES,
29 APMSG_HOST_INFO,
30 __APMSG_MAX
31 };
32
33 struct apmsg {
34 uint32_t id;
35 uint32_t seq;
36 struct blob_attr *nodes;
37 struct blob_attr *host_info;
38 };
39
40 enum {
41 APMSG_NODE_NAME,
42 APMSG_NODE_FREQ,
43 APMSG_NODE_N_ASSOC,
44 APMSG_NODE_STATIONS,
45 APMSG_NODE_NOISE,
46 APMSG_NODE_LOAD,
47 APMSG_NODE_SSID,
48 APMSG_NODE_MAX_ASSOC,
49 APMSG_NODE_RRM_NR,
50 APMSG_NODE_NODE_INFO,
51 APMSG_NODE_BSSID,
52 APMSG_NODE_CHANNEL,
53 APMSG_NODE_OP_CLASS,
54 __APMSG_NODE_MAX
55 };
56
57 struct apmsg_node {
58 const char *name;
59 const char *ssid;
60 const char *bssid;
61 int freq;
62 int channel;
63 int op_class;
64 int n_assoc;
65 int max_assoc;
66 int noise;
67 int load;
68 struct blob_attr *stations;
69 struct blob_attr *rrm_nr;
70 struct blob_attr *node_info;
71 };
72
73 enum {
74 APMSG_STA_ADDR,
75 APMSG_STA_SIGNAL,
76 APMSG_STA_TIMEOUT,
77 APMSG_STA_SEEN,
78 APMSG_STA_CONNECTED,
79 APMSG_STA_LAST_CONNECTED,
80 __APMSG_STA_MAX
81 };
82
83 struct apmsg_sta {
84 uint8_t addr[6];
85
86 bool connected;
87 int signal;
88 int timeout;
89 int seen;
90 int last_connected;
91 };
92
93 bool parse_apmsg(struct apmsg *msg, struct blob_attr *data);
94 bool parse_apmsg_node(struct apmsg_node *msg, struct blob_attr *data);
95 bool parse_apmsg_sta(struct apmsg_sta *msg, struct blob_attr *data);
96
97 #endif