vlds.h revision 7697:ef43d2dd0b19
10Sduke/*
20Sduke * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef	_SYS_VLDS_H_
28#define	_SYS_VLDS_H_
29
30#include <sys/types.h>
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/*
37 * LDOMS Domain Services Device Driver
38 */
39
40/*
41 * ioctl info for vlds device
42 */
43
44#define	VLDSIOC		('d' << 16 | 's' << 8)
45
46#define	VLDS_SVC_REG	(VLDSIOC | 1)	/* Register DS Service */
47#define	VLDS_UNREG_HDL	(VLDSIOC | 2)	/* Unregister DS Service by Handle */
48#define	VLDS_HDL_LOOKUP	(VLDSIOC | 3)	/* Lookup DS Handle(s) by Service id */
49#define	VLDS_DMN_LOOKUP	(VLDSIOC | 4)	/* Lookup DS Domain id by Handle */
50#define	VLDS_SEND_MSG	(VLDSIOC | 5)	/* Send DS Message by Handle */
51#define	VLDS_RECV_MSG	(VLDSIOC | 6)	/* Receive DS Message by Handle */
52#define	VLDS_HDL_ISREADY (VLDSIOC | 7)	/* Handle ready for data transfers */
53#define	VLDS_DOM_NAM2HDL (VLDSIOC | 8)	/* Domain Name to Handle translation */
54#define	VLDS_DOM_HDL2NAM (VLDSIOC | 9)	/* Handle ready for data transfers */
55
56/* vlds_reg_flags */
57#define	VLDS_REG_CLIENT		0x01	/* Register as client */
58#define	VLDS_REGCB_VALID	0x02	/* User supplied Register callback */
59#define	VLDS_UNREGCB_VALID	0x04	/* User supplied Unregister callback */
60#define	VLDS_DATACB_VALID	0x08	/* User supplied Data callback */
61#define	VLDS_ANYCB_VALID	(VLDS_REGCB_VALID | VLDS_UNREGCB_VALID | \
62				    VLDS_DATACB_VALID)
63
64#define	VLDS_MAX_VERS		20	/* Max no. of vlds_ver_t entries */
65
66/*
67 * The following are declared so that they are size-invariant.
68 */
69
70/* String arguments to ioctl */
71typedef struct vlds_string_arg {
72	uint64_t	vlds_strp;
73	uint64_t	vlds_strlen;
74} vlds_string_t;
75
76/* Version array (used by VLDS_SVC_REG) */
77typedef struct vlds_ver {
78	uint16_t	vlds_major;
79	uint16_t	vlds_minor;
80} vlds_ver_t;
81
82/* Capability structure (used by VLDS_SVC_REG) */
83typedef struct vlds_cap {
84	vlds_string_t	vlds_service;
85	uint64_t	vlds_nver;
86	uint64_t	vlds_versp;
87} vlds_cap_t;
88
89/*
90 * VLDS_SVC_REG
91 */
92typedef struct vlds_svc_reg_arg {
93	uint64_t	vlds_hdlp;	/* DS Service Handle ptr. (returned) */
94	uint64_t	vlds_capp;	/* DS Capability Structure ptr. */
95	uint64_t	vlds_reg_flags;	/* DS reg flags */
96} vlds_svc_reg_arg_t;
97
98/*
99 * VLDS_UNREG_HDL
100 */
101typedef struct vlds_unreg_hdl_arg {
102	uint64_t	vlds_hdl;	/* DS Service Handle */
103} vlds_unreg_hdl_arg_t;
104
105/*
106 * VLDS_DMN_LOOKUP
107 */
108typedef struct vlds_dmn_lookup_arg {
109	uint64_t	vlds_hdl;	/* DS Service Handle */
110	uint64_t	vlds_dhdlp;	/* DS Domain hdl ptr. (returned) */
111} vlds_dmn_lookup_arg_t;
112
113/*
114 * VLDS_HDL_LOOKUP
115 */
116typedef struct vlds_hdl_lookup_arg {
117	vlds_string_t	vlds_service;	/* DS Service Name */
118	uint64_t	vlds_isclient;	/* DS Client flag */
119	uint64_t	vlds_hdlsp;	/* DS Handle array ptr */
120	uint64_t	vlds_maxhdls;	/* DS Max no. of hdls to return */
121	uint64_t	vlds_nhdlsp;	/* DS No. of hdls returned */
122} vlds_hdl_lookup_arg_t;
123
124/*
125 * VLDS_SEND_MSG
126 */
127typedef struct vlds_send_msg_arg {
128	uint64_t	vlds_hdl;	/* DS Service Handle */
129	uint64_t	vlds_bufp;	/* buffer */
130	uint64_t	vlds_buflen;	/* message length/buffer size */
131} vlds_send_msg_arg_t;
132
133/*
134 * VLDS_RECV_MSG
135 */
136typedef struct vlds_recv_msg_arg {
137	uint64_t	vlds_hdl;	/* DS Service Handle */
138	uint64_t	vlds_bufp;	/* buffer */
139	uint64_t	vlds_buflen;	/* message length/buffer size */
140	uint64_t	vlds_msglenp;	/* ptr to returned message length */
141} vlds_recv_msg_arg_t;
142
143/*
144 * VLDS_HDL_ISREADY
145 */
146typedef struct vlds_hdl_isready_arg {
147	uint64_t	vlds_hdl;	/* DS Service Handle */
148	uint64_t	vlds_isreadyp;	/* Ptr to isready flag */
149} vlds_hdl_isready_arg_t;
150
151/*
152 * VLDS_DOM_NAM2HDL
153 */
154typedef struct vlds_dom_nam2hdl_arg {
155	vlds_string_t	vlds_domain_name; /* Domain Name string */
156	uint64_t	vlds_dhdlp;	/* ptr to returned Domain Handle */
157} vlds_dom_nam2hdl_arg_t;
158
159/*
160 * VLDS_DOM_HDL2NAM
161 */
162typedef struct vlds_dom_hdl2nam_arg {
163	uint64_t	vlds_dhdl;	/* Domain Handle */
164	vlds_string_t	vlds_domain_name; /* returned Domain Name string */
165} vlds_dom_hdl2nam_arg_t;
166
167/*
168 * Machine Description Constants for vlds driver.
169 */
170#define	VLDS_MD_ROOT_NODE_NAME	"domain-services"
171#define	VLDS_MD_PORT_NODE_NAME	"domain-services-port"
172
173/*
174 * VLDS Sysevent defines.
175 * VLDS System Event Channel names are of the form:
176 *    sun.com:vlds:pid<pid_number>
177 */
178#define	VLDS_SYSEV_CHAN_FMT		"sun.com:vlds:pid%06d"
179#define	VLDS_SYSEV_MAX_CHAN_NAME	32
180
181#define	EC_VLDS		"EC_vlds"	/* LDOMS Domain Services event class */
182
183/*
184 * EC_VLDS subclass definitions - supporting attributes (name/value pairs) are
185 * found in sys/sysevent/vlds.h
186 */
187#define	ESC_VLDS_REGISTER	"ESC_VLDS_register"
188#define	ESC_VLDS_UNREGISTER	"ESC_VLDS_unregister"
189#define	ESC_VLDS_DATA		"ESC_VLDS_data"
190
191/*
192 * Event type EC_VLDS
193 *	Event Class	- EC_VLDS
194 *	Event Sub-Class	- ESC_VLDS_REGISTER
195 *	Event Publisher	- SUNW:kern:[ds_module_name]
196 *	Attribute Name	- VLDS_HDL
197 *	Attribute Type  - SE_DATA_TYPE_UINT64
198 *	Attribute Value	- [Domain Service Handle]
199 *	Attribute Name	- VLDS_VER_MAJOR
200 *	Attribute Type	- SE_DATA_TYPE_UINT16
201 *	Attribute Value	- [major version of the DS interface]
202 *	Attribute Name	- VLDS_VER_MINOR
203 *	Attribute Type	- SE_DATA_TYPE_UINT16
204 *	Attribute Value	- [minor version of the DS interface]
205 *	Attribute Name	- VLDS_DOMAIN_HDL
206 *	Attribute Type	- SE_DATA_TYPE_UINT64
207 *	Attribute Value	- [Domain handle of registered service]
208 *	Attribute Name	- VLDS_SERVICE_ID
209 *	Attribute Type	- SE_DATA_TYPE_STRING
210 *	Attribute Value	- [Service name of registered service]
211 *	Attribute Name	- VLDS_ISCLIENT
212 *	Attribute Type	- SE_DATA_TYPE_BOOLEAN_VALUE
213 *	Attribute Value	- [Service is client or provider]
214 *
215 *	Event Class	- EC_VLDS
216 *	Event Sub-Class	- ESC_VLDS_UNREGISTER
217 *	Event Publisher	- SUNW:kern:[ds_module_name]
218 *	Attribute Name	- VLDS_HDL
219 *	Attribute Type  - SE_DATA_TYPE_UINT64
220 *	Attribute Value	- [Domain Service Handle]
221 *
222 *	Event Class	- EC_VLDS
223 *	Event Sub-Class	- ESC_VLDS_DATA
224 *	Event Publisher	- SUNW:kern:[ds_module_name]
225 *	Attribute Name	- VLDS_HDL
226 *	Attribute Type  - SE_DATA_TYPE_UINT64
227 *	Attribute Value	- [Domain Service Handle]
228 *	Attribute Name	- VLDS_DATA
229 *	Attribute Type  - SE_DATA_TYPE_BYTE_ARRAY
230 *	Attribute Value	- [Data array passed to user]
231 */
232
233#define	VLDS_HDL	"vlds_hdl"		/* service handle */
234#define	VLDS_VER_MAJOR	"vlds_ver_major"	/* major version */
235#define	VLDS_VER_MINOR	"vlds_ver_minor"	/* minor version */
236#define	VLDS_DOMAIN_HDL	"vlds_domain_hdl"	/* domain handle */
237#define	VLDS_SERVICE_ID	"vlds_service_id"	/* service id */
238#define	VLDS_ISCLIENT	"vlds_isclient"		/* service is client */
239#define	VLDS_DATA	"vlds_data"		/* data buffer */
240
241#ifdef __cplusplus
242}
243#endif
244
245#endif /* _SYS_VLDS_H_ */
246