xref: /illumos-gate/usr/src/lib/libpicl/picl2door.h (revision 20a7641f9918de8574b8b3b47dbe35c4bfc78df1)
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 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_PICL2DOOR_H
28 #define	_PICL2DOOR_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #define	PICLD_DOOR_VERSION	1
35 #define	PICLD_DOOR	"/var/run/picld_door"
36 #define	PICLD_DOOR_COOKIE	((void *)(0xdeaffeed ^ PICLD_DOOR_VERSION))
37 
38 /*
39  * PICL service calls
40  */
41 typedef enum {
42 	PICL_CNUM_INIT = 0x1,		/* initialize */
43 	PICL_CNUM_FINI,			/* fini */
44 	PICL_CNUM_GETROOT,		/* get root node */
45 	PICL_CNUM_GETATTRVAL, 		/* get attr val */
46 	PICL_CNUM_GETATTRVALBYNAME,	/* get attr val by name */
47 	PICL_CNUM_GETATTRINFO,		/* get attribute information */
48 	PICL_CNUM_GETFIRSTATTR, 	/* get first attribute */
49 	PICL_CNUM_GETNEXTATTR, 		/* get next attribute */
50 	PICL_CNUM_GETATTRBYNAME,	/* get attr by name */
51 	PICL_CNUM_GETATTRBYROW,		/* get attr by row */
52 	PICL_CNUM_GETATTRBYCOL,		/* get attr by column */
53 	PICL_CNUM_SETATTRVAL, 		/* set attribute's value */
54 	PICL_CNUM_SETATTRVALBYNAME,	/* set attr val by name */
55 	PICL_CNUM_PING,			/* ping daemon */
56 	PICL_CNUM_WAIT,			/* wait n seconds for refresh */
57 	PICL_CNUM_ERROR,		/* error response */
58 	PICL_CNUM_FINDNODE,		/* find node */
59 	PICL_CNUM_NODEBYPATH,		/* get node by path */
60 	PICL_CNUM_FRUTREEPARENT		/* get frutree parent */
61 } picl_callnumber_t;
62 
63 typedef	union {
64 		picl_nodehdl_t	nodeh;
65 		picl_prophdl_t	proph;
66 		char		str[1];
67 } propval_t;
68 #define	ret_buf		u.str
69 #define	ret_nodeh	u.nodeh
70 #define	ret_proph	u.proph
71 
72 /*
73  * Generic picl service request argument
74  */
75 typedef struct {
76 	picl_callnumber_t	cnum;	/* service call number */
77 	char			buf[4];	/* buffer containing input arguments */
78 } picl_req_t;
79 
80 typedef struct {
81 	picl_callnumber_t	cnum;	/* service call number */
82 	char			buf[4];	/* buffer containing the results */
83 } picl_ret_t;
84 
85 	/*
86 	 * PICL initialize
87 	 */
88 typedef struct {
89 	picl_callnumber_t	cnum;	/* PICL_CNUM_INIT */
90 	unsigned int		clrev;	/* client's ID and revision number */
91 } picl_reqinit_t;
92 
93 typedef struct {
94 	picl_callnumber_t	cnum;	/* PICL_CNUM_INIT */
95 	int			rev;	/* PICL daemon's revision number */
96 } picl_retinit_t;
97 
98 
99 	/*
100 	 * PICL shutdown
101 	 */
102 typedef struct {
103 	picl_callnumber_t	cnum;		/* PICL_CNUM_FINI */
104 } picl_reqfini_t;
105 
106 typedef struct {
107 	picl_callnumber_t	cnum;		/* PICL_CNUM_FINI */
108 } picl_retfini_t;
109 
110 	/*
111 	 * PICL get root
112 	 */
113 typedef struct {
114 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETROOT */
115 } picl_reqroot_t;
116 
117 typedef struct {
118 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETROOT */
119 	picl_nodehdl_t		rnode;		/* root handle */
120 } picl_retroot_t;
121 
122 	/*
123 	 * PICL get attr val
124 	 */
125 typedef struct {
126 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRVAL */
127 	picl_prophdl_t		attr;		/* attribute handle */
128 	uint32_t		bufsize;	/* value buffer size */
129 } picl_reqattrval_t;
130 
131 typedef struct {
132 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRVAL */
133 	picl_prophdl_t		attr;		/* attribute handle */
134 	uint32_t		nbytes;		/* return value size */
135 	propval_t 		u;
136 } picl_retattrval_t;
137 
138 	/*
139 	 * PICL get attr val by name
140 	 */
141 typedef struct {
142 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRVALBYNAME */
143 	picl_nodehdl_t		nodeh;		/* node handle */
144 						/* attribute name */
145 	char			propname[PICL_PROPNAMELEN_MAX];
146 	uint32_t		bufsize;	/* buffer size */
147 } picl_reqattrvalbyname_t;
148 
149 typedef struct {
150 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRVALBYNAME */
151 	picl_nodehdl_t		nodeh;		/* node handle */
152 						/* attribute name */
153 	char			propname[PICL_PROPNAMELEN_MAX];
154 	uint32_t		nbytes;		/* return value size */
155 	propval_t		u;		/* return value */
156 } picl_retattrvalbyname_t;
157 
158 	/*
159 	 * PICL get attr info
160 	 */
161 typedef struct {
162 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRINFO */
163 	picl_prophdl_t		attr;		/* attribute handle */
164 } picl_reqattrinfo_t;
165 
166 typedef struct {
167 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRINFO */
168 	picl_prophdl_t		attr;		/* attribute handle */
169 	picl_prop_type_t	type;		/* attribute type */
170 	unsigned int		accessmode;	/* access mode */
171 	uint32_t		size;		/* value size */
172 						/* attr name */
173 	char			name[PICL_PROPNAMELEN_MAX];
174 } picl_retattrinfo_t;
175 
176 	/*
177 	 * PICL get first attr
178 	 */
179 typedef struct {
180 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETFIRSTATTR */
181 	picl_nodehdl_t		nodeh;		/* node handle */
182 } picl_reqfirstattr_t;
183 
184 typedef struct {
185 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETFIRSTATTR */
186 	picl_nodehdl_t		nodeh;		/* node handle */
187 	picl_prophdl_t		attr;		/* first attribute handle */
188 } picl_retfirstattr_t;
189 
190 	/*
191 	 * PICL get next attr
192 	 */
193 typedef struct {
194 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETNEXTATTR */
195 	picl_prophdl_t		attr;		/* attribute handle */
196 } picl_reqnextattr_t;
197 
198 typedef struct {
199 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETNEXTATTR */
200 	picl_prophdl_t		attr;		/* attribute handle */
201 	picl_prophdl_t		nextattr;	/* next attribute handle */
202 } picl_retnextattr_t;
203 
204 	/*
205 	 * PICL get attr by name
206 	 */
207 typedef struct {
208 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRBYNAME */
209 	picl_nodehdl_t		nodeh;		/* node handle */
210 						/* attr name */
211 	char			propname[PICL_PROPNAMELEN_MAX];
212 } picl_reqattrbyname_t;
213 
214 typedef struct {
215 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRBYNAME */
216 	picl_nodehdl_t		nodeh;		/* node handle */
217 						/* attr name */
218 	char			propname[PICL_PROPNAMELEN_MAX];
219 	picl_prophdl_t		attr;		/* attr handle */
220 } picl_retattrbyname_t;
221 
222 	/*
223 	 * PICL get attr by row
224 	 */
225 typedef struct {
226 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRBYROW */
227 	picl_prophdl_t		attr;		/* attr handle */
228 } picl_reqattrbyrow_t;
229 
230 typedef struct {
231 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRBYROW */
232 	picl_prophdl_t		attr;		/* attr handle */
233 	picl_prophdl_t		rowattr;	/* attr by row handle */
234 } picl_retattrbyrow_t;
235 
236 	/*
237 	 * PICL get attr by column
238 	 */
239 typedef struct {
240 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRBYCOL */
241 	picl_prophdl_t		attr;		/* attr handle */
242 } picl_reqattrbycol_t;
243 
244 typedef struct {
245 	picl_callnumber_t	cnum;		/* PICL_CNUM_GETATTRBYCOL */
246 	picl_prophdl_t		attr;		/* attr handle */
247 	picl_prophdl_t		colattr;	/* attr by col handle */
248 } picl_retattrbycol_t;
249 
250 	/*
251 	 * PICL set attr val
252 	 */
253 typedef struct {
254 	picl_callnumber_t	cnum;		/* PICL_CNUM_SETATTRVAL */
255 	picl_prophdl_t		attr;		/* attribute handle */
256 	uint32_t		bufsize;	/* value buffer size */
257 	char			valbuf[1];
258 } picl_reqsetattrval_t;
259 
260 typedef struct {
261 	picl_callnumber_t	cnum;		/* PICL_CNUM_SETATTRVAL */
262 	picl_prophdl_t		attr;		/* attribute handle */
263 } picl_retsetattrval_t;
264 
265 	/*
266 	 * PICL set attr val by name
267 	 */
268 typedef struct {
269 	picl_callnumber_t	cnum;		/* PICL_CNUM_SETATTRVALBYNAME */
270 	picl_nodehdl_t		nodeh;		/* node handle */
271 						/* attr name */
272 	char			propname[PICL_PROPNAMELEN_MAX];
273 	uint32_t		bufsize;	/* buffer size */
274 	char			valbuf[1];
275 } picl_reqsetattrvalbyname_t;
276 
277 typedef struct {
278 	picl_callnumber_t	cnum;		/* PICL_CNUM_SETATTRVALBYNAME */
279 	picl_nodehdl_t		nodeh;		/* node handle */
280 						/* attr name */
281 	char			propname[PICL_PROPNAMELEN_MAX];
282 } picl_retsetattrvalbyname_t;
283 
284 	/*
285 	 * PICL ping
286 	 */
287 typedef struct {
288 	picl_callnumber_t	cnum;		/* PICL_CNUM_PING */
289 } picl_reqping_t;
290 
291 typedef struct {
292 	picl_callnumber_t	cnum;		/* PICL_CNUM_PING */
293 } picl_retping_t;
294 
295 	/*
296 	 * PICL wait
297 	 */
298 typedef struct {
299 	picl_callnumber_t	cnum;		/* PICL_CNUM_WAIT */
300 	unsigned int		secs;		/* number of seconds */
301 } picl_reqwait_t;
302 
303 typedef struct {
304 	picl_callnumber_t	cnum;		/* PICL_CNUM_WAIT service */
305 	unsigned int		secs;		/* input seconds */
306 	int			retcode;	/* return code */
307 } picl_retwait_t;
308 
309 	/*
310 	 * PICL find node
311 	 */
312 typedef struct {
313 	picl_callnumber_t	cnum;		/* PICL_CNUM_FINDNODE */
314 	picl_nodehdl_t		nodeh;		/* top node handle */
315 						/* property name */
316 	char			propname[PICL_PROPNAMELEN_MAX];
317 	picl_prop_type_t	ptype;		/* property type */
318 	uint32_t		valsize;	/* size of prop value */
319 	char			valbuf[1];	/* prop value */
320 } picl_reqfindnode_t;
321 
322 typedef struct {
323 	picl_callnumber_t	cnum;		/* PICL_CNUM_FINDNODE */
324 	picl_nodehdl_t		rnodeh;		/* matched node */
325 } picl_retfindnode_t;
326 
327 	/*
328 	 * PICL get node by path
329 	 */
330 typedef struct {
331 	picl_callnumber_t	cnum;		/* PICL_CNUM_NODEBYPATH */
332 	uint32_t		psize;		/* size of path */
333 	char			pathbuf[PATH_MAX];	/* picl path */
334 } picl_reqnodebypath_t;
335 
336 typedef struct {
337 	picl_callnumber_t	cnum;		/* PICL_CNUM_NODEBYPATH */
338 	picl_nodehdl_t		nodeh;		/* node handle */
339 } picl_retnodebypath_t;
340 
341 	/*
342 	 * PICL get frutree parent
343 	 */
344 typedef struct {
345 	picl_callnumber_t	cnum;		/* PICL_CNUM_FRUTREEPARENT */
346 	picl_nodehdl_t		devh;		/* dev node handle */
347 } picl_reqfruparent_t;
348 
349 typedef struct {
350 	picl_callnumber_t	cnum;		/* PICL_CNUM_FRUTREEPARENT */
351 	picl_nodehdl_t		fruh;		/* fru parent handle */
352 } picl_retfruparent_t;
353 
354 	/*
355 	 * PICL error return
356 	 */
357 typedef struct {
358 	picl_callnumber_t	cnum;		/* PICL_CNUM_ERROR */
359 	picl_callnumber_t	in_cnum;	/* requested service number */
360 	picl_errno_t		errnum;		/* return error code */
361 } picl_reterror_t;
362 
363 typedef union {
364 	picl_req_t		in;			/* req arguments */
365 	picl_ret_t		out;			/* out results */
366 
367 	picl_reqinit_t		req_init;		/* req initialize */
368 	picl_retinit_t		ret_init;		/* ret initialize */
369 
370 	picl_reqfini_t		req_fini;		/* req fini */
371 	picl_retfini_t		ret_fini;		/* ret fini */
372 
373 	picl_reqroot_t		req_root;		/* req root node */
374 	picl_retroot_t		ret_root;		/* ret root node */
375 
376 	picl_reqattrval_t	req_attrval;		/* req attr value */
377 	picl_retattrval_t	ret_attrval;		/* ret attr value */
378 
379 						/* req attr val by name */
380 	picl_reqattrvalbyname_t	req_attrvalbyname;
381 						/* ret attr val by name */
382 	picl_retattrvalbyname_t	ret_attrvalbyname;
383 
384 	picl_reqattrinfo_t    	req_attrinfo;		/* req attr info */
385 	picl_retattrinfo_t    	ret_attrinfo;		/* ret attr info */
386 
387 	picl_reqfirstattr_t	req_firstattr;		/* req first attr */
388 	picl_retfirstattr_t	ret_firstattr;		/* ret first attr */
389 
390 	picl_reqnextattr_t	req_nextattr;		/* req next attr */
391 	picl_retnextattr_t	ret_nextattr;		/* ret next attr */
392 
393 	picl_reqattrbyname_t	req_attrbyname;		/* req attr by name */
394 	picl_retattrbyname_t	ret_attrbyname;		/* ret attr by name */
395 
396 	picl_reqattrbyrow_t	req_attrbyrow;		/* req attr by row */
397 	picl_retattrbyrow_t	ret_attrbyrow;		/* ret attr by row */
398 
399 	picl_reqattrbycol_t	req_attrbycol;		/* req attr by col */
400 	picl_retattrbycol_t	ret_attrbycol;		/* ret attr by col */
401 
402 						/* set attribute value */
403 	picl_reqsetattrval_t	req_setattrval;
404 						/* ret set attribute value */
405 	picl_retsetattrval_t	ret_setattrval;
406 
407 						/* set attr val by name */
408 	picl_reqsetattrvalbyname_t	req_setattrvalbyname;
409 						/* set attr val by name */
410 	picl_retsetattrvalbyname_t	ret_setattrvalbyname;
411 
412 	picl_reqping_t		req_ping;		/* req ping */
413 	picl_retping_t		ret_ping;		/* ret ping */
414 
415 	picl_reqwait_t		req_wait;		/* req wait */
416 	picl_retwait_t		ret_wait;		/* ret wait */
417 
418 	picl_reqfindnode_t	req_findnode;	/* req find node */
419 	picl_retfindnode_t	ret_findnode;	/* ret find node */
420 
421 	picl_reqnodebypath_t	req_nodebypath;	/* get node by path */
422 	picl_retnodebypath_t	ret_nodebypath;	/* ret node by path */
423 
424 	picl_reqfruparent_t	req_fruparent;	/* get frutree parent */
425 	picl_retfruparent_t	ret_fruparent;	/* ret frutree parent */
426 
427 	picl_reterror_t		ret_error;		/* return error */
428 } picl_service_t;
429 
430 #ifdef	__cplusplus
431 }
432 #endif
433 
434 #endif	/* _PICL2DOOR_H */
435