xref: /illumos-gate/usr/src/uts/sun4u/opl/sys/sckm_io.h (revision 1fa2a66491e7d8ae0be84e7da4da8e812480c710)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 /*
28  * Copyright 2019 Peter Tribble.
29  */
30 
31 #ifndef	_SYS_SCKM_IO_H
32 #define	_SYS_SCKM_IO_H
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * This header file defines the interface between the sckmd daemon and
40  * the sckmdrv driver.
41  */
42 
43 #include <sys/types.h>
44 
45 #define	SCKM_IOC	('s' << 8)
46 
47 enum sckm_ioctl {
48 	SCKM_IOCTL_GETREQ = SCKM_IOC,
49 	SCKM_IOCTL_STATUS
50 };
51 
52 /*
53  * Structure passed by sckmd daemon to the sckmdrv driver during
54  * a SCKM_IOCTL_GETREQ ioctl call.
55  */
56 typedef struct sckm_ioctl_getreq {
57 	uint64_t transid;	/* returned by driver */
58 	uint32_t type;		/* message type */
59 	caddr_t buf;		/* user buffer to store msg */
60 	uint32_t buf_len;	/* size of buf */
61 } sckm_ioctl_getreq_t;
62 
63 #if defined(_SYSCALL32)
64 typedef struct sckm_ioctl_getreq_32 {
65 	uint64_t transid;	/* returned by driver */
66 	uint32_t type;		/* message type */
67 	caddr32_t buf;		/* user buffer to store msg */
68 	uint32_t buf_len;	/* size of buf */
69 } sckm_ioctl_getreq32_t;
70 #endif /* defined(_SYSCALL32) */
71 
72 /*
73  * Structure passed by sckmd daemon to the sckmdrv driver during
74  * a SCKM_IOCTL_STATUS ioctl call.
75  */
76 typedef struct sckm_ioctl_status {
77 	uint64_t transid;		/* set by daemon */
78 	uint32_t status;		/* execution status */
79 	uint32_t sadb_msg_errno;	/* PF_KEY errno, if applicable */
80 	uint32_t sadb_msg_version;	/* PF_KEY version, if applicable */
81 } sckm_ioctl_status_t;
82 
83 /*
84  * Valid request types returned by the SCKM_IOCTL_GETREQ ioctl.
85  */
86 #define	SCKM_IOCTL_REQ_SADB		0x0	/* SADB message */
87 
88 /*
89  * Valid values for the status field of the sckm_ioctl_status structure.
90  */
91 #define	SCKM_IOCTL_STAT_SUCCESS		0x0	/* operation success */
92 #define	SCKM_IOCTL_STAT_ERR_PFKEY	0x1	/* PF_KEY error */
93 #define	SCKM_IOCTL_STAT_ERR_REQ		0x2	/* invalid request */
94 #define	SCKM_IOCTL_STAT_ERR_VERSION	0x3	/* not supp. PF_KEY version */
95 #define	SCKM_IOCTL_STAT_ERR_TIMEOUT	0x4	/* no response from PF_KEY */
96 #define	SCKM_IOCTL_STAT_ERR_OTHER	0x5	/* other daemon error */
97 #define	SCKM_IOCTL_STAT_ERR_SADB_TYPE	0x6	/* bad SADB msg type */
98 
99 #ifdef	__cplusplus
100 }
101 #endif
102 
103 #endif /* _SYS_SCKM_IO_H */
104