xref: /openbmc/linux/net/handshake/genl.c (revision 9134211f)
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 
6 #include <net/netlink.h>
7 #include <net/genetlink.h>
8 
9 #include "genl.h"
10 
11 #include <uapi/linux/handshake.h>
12 
13 /* HANDSHAKE_CMD_ACCEPT - do */
14 static const struct nla_policy handshake_accept_nl_policy[HANDSHAKE_A_ACCEPT_HANDLER_CLASS + 1] = {
15 	[HANDSHAKE_A_ACCEPT_HANDLER_CLASS] = NLA_POLICY_MAX(NLA_U32, 2),
16 };
17 
18 /* HANDSHAKE_CMD_DONE - do */
19 static const struct nla_policy handshake_done_nl_policy[HANDSHAKE_A_DONE_REMOTE_AUTH + 1] = {
20 	[HANDSHAKE_A_DONE_STATUS] = { .type = NLA_U32, },
21 	[HANDSHAKE_A_DONE_SOCKFD] = { .type = NLA_U32, },
22 	[HANDSHAKE_A_DONE_REMOTE_AUTH] = { .type = NLA_U32, },
23 };
24 
25 /* Ops table for handshake */
26 static const struct genl_split_ops handshake_nl_ops[] = {
27 	{
28 		.cmd		= HANDSHAKE_CMD_ACCEPT,
29 		.doit		= handshake_nl_accept_doit,
30 		.policy		= handshake_accept_nl_policy,
31 		.maxattr	= HANDSHAKE_A_ACCEPT_HANDLER_CLASS,
32 		.flags		= GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
33 	},
34 	{
35 		.cmd		= HANDSHAKE_CMD_DONE,
36 		.doit		= handshake_nl_done_doit,
37 		.policy		= handshake_done_nl_policy,
38 		.maxattr	= HANDSHAKE_A_DONE_REMOTE_AUTH,
39 		.flags		= GENL_CMD_CAP_DO,
40 	},
41 };
42 
43 static const struct genl_multicast_group handshake_nl_mcgrps[] = {
44 	[HANDSHAKE_NLGRP_NONE] = { "none", },
45 	[HANDSHAKE_NLGRP_TLSHD] = { "tlshd", },
46 };
47 
48 struct genl_family handshake_nl_family __ro_after_init = {
49 	.name		= HANDSHAKE_FAMILY_NAME,
50 	.version	= HANDSHAKE_FAMILY_VERSION,
51 	.netnsok	= true,
52 	.parallel_ops	= true,
53 	.module		= THIS_MODULE,
54 	.split_ops	= handshake_nl_ops,
55 	.n_split_ops	= ARRAY_SIZE(handshake_nl_ops),
56 	.mcgrps		= handshake_nl_mcgrps,
57 	.n_mcgrps	= ARRAY_SIZE(handshake_nl_mcgrps),
58 };
59