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