1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2#ifndef __LINUX_GENERIC_NETLINK_H
3#define __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
13struct 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
40enum {
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_MAX,
52};
53
54#define CTRL_CMD_MAX (__CTRL_CMD_MAX - 1)
55
56enum {
57 CTRL_ATTR_UNSPEC,
58 CTRL_ATTR_FAMILY_ID,
59 CTRL_ATTR_FAMILY_NAME,
60 CTRL_ATTR_VERSION,
61 CTRL_ATTR_HDRSIZE,
62 CTRL_ATTR_MAXATTR,
63 CTRL_ATTR_OPS,
64 CTRL_ATTR_MCAST_GROUPS,
65 __CTRL_ATTR_MAX,
66};
67
68#define CTRL_ATTR_MAX (__CTRL_ATTR_MAX - 1)
69
70enum {
71 CTRL_ATTR_OP_UNSPEC,
72 CTRL_ATTR_OP_ID,
73 CTRL_ATTR_OP_FLAGS,
74 __CTRL_ATTR_OP_MAX,
75};
76
77#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
78
79enum {
80 CTRL_ATTR_MCAST_GRP_UNSPEC,
81 CTRL_ATTR_MCAST_GRP_NAME,
82 CTRL_ATTR_MCAST_GRP_ID,
83 __CTRL_ATTR_MCAST_GRP_MAX,
84};
85
86#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
87
88
89#endif /* __LINUX_GENERIC_NETLINK_H */
90