1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1999-2002 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_PICLD_PLUGINUTIL_IMPL_H
28*7c478bd9Sstevel@tonic-gate #define	_PICLD_PLUGINUTIL_IMPL_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
31*7c478bd9Sstevel@tonic-gate extern "C" {
32*7c478bd9Sstevel@tonic-gate #endif
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #define	PER_ALLOC_COUNT		256
35*7c478bd9Sstevel@tonic-gate #define	RECORD_SIZE_MAX		1024
36*7c478bd9Sstevel@tonic-gate #define	STARTING_INDEX		0
37*7c478bd9Sstevel@tonic-gate #define	SUPPORTED_VERSION_NUM	1.1
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate /* reserved keyword (case insensitive) */
40*7c478bd9Sstevel@tonic-gate #define	KEYWORD_INT_TYPE	"int"
41*7c478bd9Sstevel@tonic-gate #define	KEYWORD_UINT_TYPE	"uint"
42*7c478bd9Sstevel@tonic-gate #define	KEYWORD_FLOAT_TYPE	"float"
43*7c478bd9Sstevel@tonic-gate #define	KEYWORD_STRING_TYPE	"string"
44*7c478bd9Sstevel@tonic-gate #define	KEYWORD_VOID_TYPE	"void"
45*7c478bd9Sstevel@tonic-gate #define	KEYWORD_READ_MODE	"r"
46*7c478bd9Sstevel@tonic-gate #define	KEYWORD_WRITE_MODE	"w"
47*7c478bd9Sstevel@tonic-gate #define	KEYWORD_READWRITE_MODE	"rw"
48*7c478bd9Sstevel@tonic-gate #define	KEYWORD_WITH_STR	"with"
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate #define	WHITESPACE		" \t\n"
51*7c478bd9Sstevel@tonic-gate #define	RECORD_WHITESPACE	": \t\n"
52*7c478bd9Sstevel@tonic-gate #define	DOUBLE_QUOTE		"\""
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate typedef	struct {
55*7c478bd9Sstevel@tonic-gate 	char			*path;
56*7c478bd9Sstevel@tonic-gate } path_cmd_t;
57*7c478bd9Sstevel@tonic-gate 
58*7c478bd9Sstevel@tonic-gate typedef	struct {
59*7c478bd9Sstevel@tonic-gate 	picl_nodehdl_t		nodeh;
60*7c478bd9Sstevel@tonic-gate 	char			*nodename;
61*7c478bd9Sstevel@tonic-gate 	char			*classname;
62*7c478bd9Sstevel@tonic-gate } node_cmd_t;
63*7c478bd9Sstevel@tonic-gate 
64*7c478bd9Sstevel@tonic-gate typedef	struct {
65*7c478bd9Sstevel@tonic-gate 	picl_prophdl_t		proph;
66*7c478bd9Sstevel@tonic-gate 	size_t			size;
67*7c478bd9Sstevel@tonic-gate 	int			type;
68*7c478bd9Sstevel@tonic-gate 	int			accessmode;
69*7c478bd9Sstevel@tonic-gate 	char			*pname;
70*7c478bd9Sstevel@tonic-gate 	void			*valbuf;
71*7c478bd9Sstevel@tonic-gate } prop_cmd_t;
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate typedef	struct {
74*7c478bd9Sstevel@tonic-gate 	picl_prophdl_t		proph;
75*7c478bd9Sstevel@tonic-gate 	char			*pname;
76*7c478bd9Sstevel@tonic-gate 	char			*dstnode;
77*7c478bd9Sstevel@tonic-gate } refprop_cmd_t;
78*7c478bd9Sstevel@tonic-gate 
79*7c478bd9Sstevel@tonic-gate typedef	struct {
80*7c478bd9Sstevel@tonic-gate 	picl_nodehdl_t		nodeh;
81*7c478bd9Sstevel@tonic-gate 	char			*newnodename;
82*7c478bd9Sstevel@tonic-gate 	char			*newnodeclass;
83*7c478bd9Sstevel@tonic-gate 	char			*dstnode;
84*7c478bd9Sstevel@tonic-gate } refnode_cmd_t;
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate typedef	struct {
87*7c478bd9Sstevel@tonic-gate 	picl_prophdl_t		tblh;
88*7c478bd9Sstevel@tonic-gate 	int			newtbl;
89*7c478bd9Sstevel@tonic-gate 	char			*tname;
90*7c478bd9Sstevel@tonic-gate } table_cmd_t;
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate typedef	struct {
93*7c478bd9Sstevel@tonic-gate 	int			index;
94*7c478bd9Sstevel@tonic-gate 	int			nproph;
95*7c478bd9Sstevel@tonic-gate 	picl_prophdl_t		*prophs;
96*7c478bd9Sstevel@tonic-gate } row_cmd_t;
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate typedef	struct {
99*7c478bd9Sstevel@tonic-gate 	int32_t			level;
100*7c478bd9Sstevel@tonic-gate } verbose_cmd_t;
101*7c478bd9Sstevel@tonic-gate 
102*7c478bd9Sstevel@tonic-gate typedef struct {
103*7c478bd9Sstevel@tonic-gate 	int			type;
104*7c478bd9Sstevel@tonic-gate 	union {
105*7c478bd9Sstevel@tonic-gate 		path_cmd_t	path;
106*7c478bd9Sstevel@tonic-gate 		node_cmd_t	node;
107*7c478bd9Sstevel@tonic-gate 		prop_cmd_t	prop;
108*7c478bd9Sstevel@tonic-gate 		refprop_cmd_t	refprop;
109*7c478bd9Sstevel@tonic-gate 		refnode_cmd_t	refnode;
110*7c478bd9Sstevel@tonic-gate 		table_cmd_t	table;
111*7c478bd9Sstevel@tonic-gate 		row_cmd_t	row;
112*7c478bd9Sstevel@tonic-gate 		verbose_cmd_t	verbose;
113*7c478bd9Sstevel@tonic-gate 	} u;
114*7c478bd9Sstevel@tonic-gate } command_t;
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate typedef struct {
117*7c478bd9Sstevel@tonic-gate 	int		count;
118*7c478bd9Sstevel@tonic-gate 	int		allocated;
119*7c478bd9Sstevel@tonic-gate 	float		version_no;
120*7c478bd9Sstevel@tonic-gate 	int		inside_node_block;
121*7c478bd9Sstevel@tonic-gate 	int		verbose;
122*7c478bd9Sstevel@tonic-gate 	const char	*fname;
123*7c478bd9Sstevel@tonic-gate 	int		inside_table_block;
124*7c478bd9Sstevel@tonic-gate 	int		current_tbl;
125*7c478bd9Sstevel@tonic-gate 	int		inside_row_block;
126*7c478bd9Sstevel@tonic-gate 	int		current_row;
127*7c478bd9Sstevel@tonic-gate 	command_t	*commands;
128*7c478bd9Sstevel@tonic-gate } cmdbuf_t;
129*7c478bd9Sstevel@tonic-gate 
130*7c478bd9Sstevel@tonic-gate #define	pathcmd_name		u.path.path
131*7c478bd9Sstevel@tonic-gate #define	nodecmd_nodeh		u.node.nodeh
132*7c478bd9Sstevel@tonic-gate #define	nodecmd_nodename	u.node.nodename
133*7c478bd9Sstevel@tonic-gate #define	nodecmd_classname	u.node.classname
134*7c478bd9Sstevel@tonic-gate #define	nodecmd_classname	u.node.classname
135*7c478bd9Sstevel@tonic-gate #define	propcmd_proph		u.prop.proph
136*7c478bd9Sstevel@tonic-gate #define	propcmd_pname		u.prop.pname
137*7c478bd9Sstevel@tonic-gate #define	propcmd_type		u.prop.type
138*7c478bd9Sstevel@tonic-gate #define	propcmd_accessmode	u.prop.accessmode
139*7c478bd9Sstevel@tonic-gate #define	propcmd_size		u.prop.size
140*7c478bd9Sstevel@tonic-gate #define	propcmd_valbuf		u.prop.valbuf
141*7c478bd9Sstevel@tonic-gate #define	refpropcmd_proph	u.refprop.proph
142*7c478bd9Sstevel@tonic-gate #define	refpropcmd_pname	u.refprop.pname
143*7c478bd9Sstevel@tonic-gate #define	refpropcmd_dstnode	u.refprop.dstnode
144*7c478bd9Sstevel@tonic-gate #define	refnodecmd_nodeh	u.refnode.nodeh
145*7c478bd9Sstevel@tonic-gate #define	refnodecmd_name		u.refnode.newnodename
146*7c478bd9Sstevel@tonic-gate #define	refnodecmd_class	u.refnode.newnodeclass
147*7c478bd9Sstevel@tonic-gate #define	refnodecmd_dstnode	u.refnode.dstnode
148*7c478bd9Sstevel@tonic-gate #define	tablecmd_tblh		u.table.tblh
149*7c478bd9Sstevel@tonic-gate #define	tablecmd_newtbl		u.table.newtbl
150*7c478bd9Sstevel@tonic-gate #define	tablecmd_tname		u.table.tname
151*7c478bd9Sstevel@tonic-gate #define	rowcmd_index		u.row.index
152*7c478bd9Sstevel@tonic-gate #define	rowcmd_nproph		u.row.nproph
153*7c478bd9Sstevel@tonic-gate #define	rowcmd_prophs		u.row.prophs
154*7c478bd9Sstevel@tonic-gate #define	verbosecmd_level	u.verbose.level
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
157*7c478bd9Sstevel@tonic-gate }
158*7c478bd9Sstevel@tonic-gate #endif
159*7c478bd9Sstevel@tonic-gate 
160*7c478bd9Sstevel@tonic-gate #endif	/* _PICLD_PLUGINUTIL_IMPL_H */
161