xref: /linux-6.15/include/uapi/linux/batman_adv.h (revision ca9f71f0)
1 /* Copyright (C) 2016 B.A.T.M.A.N. contributors:
2  *
3  * Matthias Schiffer
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 #ifndef _UAPI_LINUX_BATMAN_ADV_H_
19 #define _UAPI_LINUX_BATMAN_ADV_H_
20 
21 #define BATADV_NL_NAME "batadv"
22 
23 #define BATADV_NL_MCAST_GROUP_TPMETER	"tpmeter"
24 
25 /**
26  * enum batadv_nl_attrs - batman-adv netlink attributes
27  *
28  * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors
29  * @BATADV_ATTR_VERSION: batman-adv version string
30  * @BATADV_ATTR_ALGO_NAME: name of routing algorithm
31  * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface
32  * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface
33  * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface
34  * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface
35  * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface
36  * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv interface
37  * @BATADV_ATTR_ORIG_ADDRESS: originator mac address
38  * @BATADV_ATTR_TPMETER_RESULT: result of run (see batadv_tp_meter_status)
39  * @BATADV_ATTR_TPMETER_TEST_TIME: time (msec) the run took
40  * @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run
41  * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session
42  * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment
43  * @__BATADV_ATTR_AFTER_LAST: internal use
44  * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available
45  * @BATADV_ATTR_MAX: highest attribute number currently defined
46  */
47 enum batadv_nl_attrs {
48 	BATADV_ATTR_UNSPEC,
49 	BATADV_ATTR_VERSION,
50 	BATADV_ATTR_ALGO_NAME,
51 	BATADV_ATTR_MESH_IFINDEX,
52 	BATADV_ATTR_MESH_IFNAME,
53 	BATADV_ATTR_MESH_ADDRESS,
54 	BATADV_ATTR_HARD_IFINDEX,
55 	BATADV_ATTR_HARD_IFNAME,
56 	BATADV_ATTR_HARD_ADDRESS,
57 	BATADV_ATTR_ORIG_ADDRESS,
58 	BATADV_ATTR_TPMETER_RESULT,
59 	BATADV_ATTR_TPMETER_TEST_TIME,
60 	BATADV_ATTR_TPMETER_BYTES,
61 	BATADV_ATTR_TPMETER_COOKIE,
62 	BATADV_ATTR_PAD,
63 	/* add attributes above here, update the policy in netlink.c */
64 	__BATADV_ATTR_AFTER_LAST,
65 	NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
66 	BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1
67 };
68 
69 /**
70  * enum batadv_nl_commands - supported batman-adv netlink commands
71  *
72  * @BATADV_CMD_UNSPEC: unspecified command to catch errors
73  * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv device
74  * @BATADV_CMD_TP_METER: Start a tp meter session
75  * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session
76  * @__BATADV_CMD_AFTER_LAST: internal use
77  * @BATADV_CMD_MAX: highest used command number
78  */
79 enum batadv_nl_commands {
80 	BATADV_CMD_UNSPEC,
81 	BATADV_CMD_GET_MESH_INFO,
82 	BATADV_CMD_TP_METER,
83 	BATADV_CMD_TP_METER_CANCEL,
84 	/* add new commands above here */
85 	__BATADV_CMD_AFTER_LAST,
86 	BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1
87 };
88 
89 /**
90  * enum batadv_tp_meter_reason - reason of a tp meter test run stop
91  * @BATADV_TP_REASON_COMPLETE: sender finished tp run
92  * @BATADV_TP_REASON_CANCEL: sender was stopped during run
93  * @BATADV_TP_REASON_DST_UNREACHABLE: receiver could not be reached or didn't
94  *  answer
95  * @BATADV_TP_REASON_RESEND_LIMIT: (unused) sender retry reached limit
96  * @BATADV_TP_REASON_ALREADY_ONGOING: test to or from the same node already
97  *  ongoing
98  * @BATADV_TP_REASON_MEMORY_ERROR: test was stopped due to low memory
99  * @BATADV_TP_REASON_CANT_SEND: failed to send via outgoing interface
100  * @BATADV_TP_REASON_TOO_MANY: too many ongoing sessions
101  */
102 enum batadv_tp_meter_reason {
103 	BATADV_TP_REASON_COMPLETE		= 3,
104 	BATADV_TP_REASON_CANCEL			= 4,
105 	/* error status >= 128 */
106 	BATADV_TP_REASON_DST_UNREACHABLE	= 128,
107 	BATADV_TP_REASON_RESEND_LIMIT		= 129,
108 	BATADV_TP_REASON_ALREADY_ONGOING	= 130,
109 	BATADV_TP_REASON_MEMORY_ERROR		= 131,
110 	BATADV_TP_REASON_CANT_SEND		= 132,
111 	BATADV_TP_REASON_TOO_MANY		= 133,
112 };
113 
114 #endif /* _UAPI_LINUX_BATMAN_ADV_H_ */
115