xref: /openbmc/linux/include/uapi/linux/genetlink.h (revision f329a0eb)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _UAPI__LINUX_GENERIC_NETLINK_H
3 #define _UAPI__LINUX_GENERIC_NETLINK_H
4 
5 #include <linux/types.h>
6 #include <linux/netlink.h>
7 
8 #define GENL_NAMSIZ	16	/* length of family name */
9 
10 #define GENL_MIN_ID	NLMSG_MIN_TYPE
11 #define GENL_MAX_ID	1023
12 
13 struct genlmsghdr {
14 	__u8	cmd;
15 	__u8	version;
16 	__u16	reserved;
17 };
18 
19 #define GENL_HDRLEN	NLMSG_ALIGN(sizeof(struct genlmsghdr))
20 
21 #define GENL_ADMIN_PERM		0x01
22 #define GENL_CMD_CAP_DO		0x02
23 #define GENL_CMD_CAP_DUMP	0x04
24 #define GENL_CMD_CAP_HASPOL	0x08
25 #define GENL_UNS_ADMIN_PERM	0x10
26 
27 /*
28  * List of reserved static generic netlink identifiers:
29  */
30 #define GENL_ID_CTRL		NLMSG_MIN_TYPE
31 #define GENL_ID_VFS_DQUOT	(NLMSG_MIN_TYPE + 1)
32 #define GENL_ID_PMCRAID		(NLMSG_MIN_TYPE + 2)
33 /* must be last reserved + 1 */
34 #define GENL_START_ALLOC	(NLMSG_MIN_TYPE + 3)
35 
36 /**************************************************************************
37  * Controller
38  **************************************************************************/
39 
40 enum {
41 	CTRL_CMD_UNSPEC,
42 	CTRL_CMD_NEWFAMILY,
43 	CTRL_CMD_DELFAMILY,
44 	CTRL_CMD_GETFAMILY,
45 	CTRL_CMD_NEWOPS,
46 	CTRL_CMD_DELOPS,
47 	CTRL_CMD_GETOPS,
48 	CTRL_CMD_NEWMCAST_GRP,
49 	CTRL_CMD_DELMCAST_GRP,
50 	CTRL_CMD_GETMCAST_GRP, /* unused */
51 	CTRL_CMD_GETPOLICY,
52 	__CTRL_CMD_MAX,
53 };
54 
55 #define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1)
56 
57 enum {
58 	CTRL_ATTR_UNSPEC,
59 	CTRL_ATTR_FAMILY_ID,
60 	CTRL_ATTR_FAMILY_NAME,
61 	CTRL_ATTR_VERSION,
62 	CTRL_ATTR_HDRSIZE,
63 	CTRL_ATTR_MAXATTR,
64 	CTRL_ATTR_OPS,
65 	CTRL_ATTR_MCAST_GROUPS,
66 	CTRL_ATTR_POLICY,
67 	CTRL_ATTR_OP_POLICY,
68 	CTRL_ATTR_OP,
69 	__CTRL_ATTR_MAX,
70 };
71 
72 #define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
73 
74 enum {
75 	CTRL_ATTR_OP_UNSPEC,
76 	CTRL_ATTR_OP_ID,
77 	CTRL_ATTR_OP_FLAGS,
78 	__CTRL_ATTR_OP_MAX,
79 };
80 
81 #define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
82 
83 enum {
84 	CTRL_ATTR_MCAST_GRP_UNSPEC,
85 	CTRL_ATTR_MCAST_GRP_NAME,
86 	CTRL_ATTR_MCAST_GRP_ID,
87 	__CTRL_ATTR_MCAST_GRP_MAX,
88 };
89 
90 #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
91 
92 enum {
93 	CTRL_ATTR_POLICY_UNSPEC,
94 	CTRL_ATTR_POLICY_DO,
95 	CTRL_ATTR_POLICY_DUMP,
96 
97 	__CTRL_ATTR_POLICY_DUMP_MAX,
98 	CTRL_ATTR_POLICY_DUMP_MAX = __CTRL_ATTR_POLICY_DUMP_MAX - 1
99 };
100 
101 #define CTRL_ATTR_POLICY_MAX (__CTRL_ATTR_POLICY_DUMP_MAX - 1)
102 
103 #endif /* _UAPI__LINUX_GENERIC_NETLINK_H */
104