xref: /illumos-gate/usr/src/uts/sun4u/opl/sys/sckm_io.h (revision 7c478bd9)
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 #ifndef	_SYS_SCKM_IO_H
28 #define	_SYS_SCKM_IO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * This header file defines the interface between the sckmd daemon and
38  * the sckmdrv driver.
39  */
40 
41 #include <sys/types.h>
42 
43 #define	SCKM_IOC	('s' << 8)
44 
45 enum sckm_ioctl {
46 	SCKM_IOCTL_GETREQ = SCKM_IOC,
47 	SCKM_IOCTL_STATUS
48 };
49 
50 /*
51  * Structure passed by sckmd daemon to the sckmdrv driver during
52  * a SCKM_IOCTL_GETREQ ioctl call.
53  */
54 typedef struct sckm_ioctl_getreq {
55 	uint64_t transid;	/* returned by driver */
56 	uint32_t type;		/* message type */
57 	caddr_t buf;		/* user buffer to store msg */
58 	uint32_t buf_len;	/* size of buf */
59 } sckm_ioctl_getreq_t;
60 
61 #if defined(_SYSCALL32)
62 typedef struct sckm_ioctl_getreq_32 {
63 	uint64_t transid;	/* returned by driver */
64 	uint32_t type;		/* message type */
65 	caddr32_t buf;		/* user buffer to store msg */
66 	uint32_t buf_len;	/* size of buf */
67 } sckm_ioctl_getreq32_t;
68 #endif /* defined(_SYSCALL32) */
69 
70 /*
71  * Structure passed by sckmd daemon to the sckmdrv driver during
72  * a SCKM_IOCTL_STATUS ioctl call.
73  */
74 typedef struct sckm_ioctl_status {
75 	uint64_t transid;		/* set by daemon */
76 	uint32_t status;		/* execution status */
77 	uint32_t sadb_msg_errno;	/* PF_KEY errno, if applicable */
78 	uint32_t sadb_msg_version;	/* PF_KEY version, if applicable */
79 } sckm_ioctl_status_t;
80 
81 /*
82  * Valid request types returned by the SCKM_IOCTL_GETREQ ioctl.
83  */
84 #define	SCKM_IOCTL_REQ_SADB		0x0	/* SADB message */
85 
86 /*
87  * Valid values for the status field of the sckm_ioctl_status structure.
88  */
89 #define	SCKM_IOCTL_STAT_SUCCESS		0x0	/* operation success */
90 #define	SCKM_IOCTL_STAT_ERR_PFKEY	0x1	/* PF_KEY error */
91 #define	SCKM_IOCTL_STAT_ERR_REQ		0x2	/* invalid request */
92 #define	SCKM_IOCTL_STAT_ERR_VERSION	0x3	/* not supp. PF_KEY version */
93 #define	SCKM_IOCTL_STAT_ERR_TIMEOUT	0x4	/* no response from PF_KEY */
94 #define	SCKM_IOCTL_STAT_ERR_OTHER	0x5	/* other daemon error */
95 #define	SCKM_IOCTL_STAT_ERR_SADB_TYPE	0x6	/* bad SADB msg type */
96 
97 #ifdef	__cplusplus
98 }
99 #endif
100 
101 #endif /* _SYS_SCKM_IO_H */
102