xref: /linux/net/handshake/genl.c (revision 513480da5e9c8f55b4f8f5e89f386e26188fbb3f)
1 // SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)
2 /* Do not edit directly, auto-generated from: */
3 /*	Documentation/netlink/specs/handshake.yaml */
4 /* YNL-GEN kernel source */
5 /* To regenerate run: tools/net/ynl/ynl-regen.sh */
6 
7 #include <net/netlink.h>
8 #include <net/genetlink.h>
9 
10 #include "genl.h"
11 
12 #include <uapi/linux/handshake.h>
13 #include <linux/err.h>
14 
15 /* HANDSHAKE_CMD_ACCEPT - do */
16 static const struct nla_policy handshake_accept_nl_policy[HANDSHAKE_A_ACCEPT_HANDLER_CLASS + 1] = {
17 	[HANDSHAKE_A_ACCEPT_HANDLER_CLASS] = NLA_POLICY_MAX(NLA_U32, 2),
18 };
19 
20 /* HANDSHAKE_CMD_DONE - do */
21 static const struct nla_policy handshake_done_nl_policy[HANDSHAKE_A_DONE_REMOTE_AUTH + 1] = {
22 	[HANDSHAKE_A_DONE_STATUS] = NLA_POLICY_MAX(NLA_U32, MAX_ERRNO),
23 	[HANDSHAKE_A_DONE_SOCKFD] = { .type = NLA_S32, },
24 	[HANDSHAKE_A_DONE_REMOTE_AUTH] = { .type = NLA_U32, },
25 };
26 
27 /* Ops table for handshake */
28 static const struct genl_split_ops handshake_nl_ops[] = {
29 	{
30 		.cmd		= HANDSHAKE_CMD_ACCEPT,
31 		.doit		= handshake_nl_accept_doit,
32 		.policy		= handshake_accept_nl_policy,
33 		.maxattr	= HANDSHAKE_A_ACCEPT_HANDLER_CLASS,
34 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
35 	},
36 	{
37 		.cmd		= HANDSHAKE_CMD_DONE,
38 		.doit		= handshake_nl_done_doit,
39 		.policy		= handshake_done_nl_policy,
40 		.maxattr	= HANDSHAKE_A_DONE_REMOTE_AUTH,
41 		.flags		= GENL_CMD_CAP_DO,
42 	},
43 };
44 
45 static const struct genl_multicast_group handshake_nl_mcgrps[] = {
46 	[HANDSHAKE_NLGRP_NONE] = { "none", },
47 	[HANDSHAKE_NLGRP_TLSHD] = { "tlshd", },
48 };
49 
50 struct genl_family handshake_nl_family __ro_after_init = {
51 	.name		= HANDSHAKE_FAMILY_NAME,
52 	.version	= HANDSHAKE_FAMILY_VERSION,
53 	.netnsok	= true,
54 	.parallel_ops	= true,
55 	.module		= THIS_MODULE,
56 	.split_ops	= handshake_nl_ops,
57 	.n_split_ops	= ARRAY_SIZE(handshake_nl_ops),
58 	.mcgrps		= handshake_nl_mcgrps,
59 	.n_mcgrps	= ARRAY_SIZE(handshake_nl_mcgrps),
60 };
61