xref: /titanic_51/usr/src/cmd/picl/plugins/lib/picld_pluginutil/picld_pluginutil_impl.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 1999-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_PICLD_PLUGINUTIL_IMPL_H
28 #define	_PICLD_PLUGINUTIL_IMPL_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	PER_ALLOC_COUNT		256
37 #define	RECORD_SIZE_MAX		1024
38 #define	STARTING_INDEX		0
39 #define	SUPPORTED_VERSION_NUM	1.1
40 
41 /* reserved keyword (case insensitive) */
42 #define	KEYWORD_INT_TYPE	"int"
43 #define	KEYWORD_UINT_TYPE	"uint"
44 #define	KEYWORD_FLOAT_TYPE	"float"
45 #define	KEYWORD_STRING_TYPE	"string"
46 #define	KEYWORD_VOID_TYPE	"void"
47 #define	KEYWORD_READ_MODE	"r"
48 #define	KEYWORD_WRITE_MODE	"w"
49 #define	KEYWORD_READWRITE_MODE	"rw"
50 #define	KEYWORD_WITH_STR	"with"
51 
52 #define	WHITESPACE		" \t\n"
53 #define	RECORD_WHITESPACE	": \t\n"
54 #define	DOUBLE_QUOTE		"\""
55 
56 typedef	struct {
57 	char			*path;
58 } path_cmd_t;
59 
60 typedef	struct {
61 	picl_nodehdl_t		nodeh;
62 	char			*nodename;
63 	char			*classname;
64 } node_cmd_t;
65 
66 typedef	struct {
67 	picl_prophdl_t		proph;
68 	size_t			size;
69 	int			type;
70 	int			accessmode;
71 	char			*pname;
72 	void			*valbuf;
73 } prop_cmd_t;
74 
75 typedef	struct {
76 	picl_prophdl_t		proph;
77 	char			*pname;
78 	char			*dstnode;
79 } refprop_cmd_t;
80 
81 typedef	struct {
82 	picl_nodehdl_t		nodeh;
83 	char			*newnodename;
84 	char			*newnodeclass;
85 	char			*dstnode;
86 } refnode_cmd_t;
87 
88 typedef	struct {
89 	picl_prophdl_t		tblh;
90 	int			newtbl;
91 	char			*tname;
92 } table_cmd_t;
93 
94 typedef	struct {
95 	int			index;
96 	int			nproph;
97 	picl_prophdl_t		*prophs;
98 } row_cmd_t;
99 
100 typedef	struct {
101 	int32_t			level;
102 } verbose_cmd_t;
103 
104 typedef struct {
105 	int			type;
106 	union {
107 		path_cmd_t	path;
108 		node_cmd_t	node;
109 		prop_cmd_t	prop;
110 		refprop_cmd_t	refprop;
111 		refnode_cmd_t	refnode;
112 		table_cmd_t	table;
113 		row_cmd_t	row;
114 		verbose_cmd_t	verbose;
115 	} u;
116 } command_t;
117 
118 typedef struct {
119 	int		count;
120 	int		allocated;
121 	float		version_no;
122 	int		inside_node_block;
123 	int		verbose;
124 	const char	*fname;
125 	int		inside_table_block;
126 	int		current_tbl;
127 	int		inside_row_block;
128 	int		current_row;
129 	command_t	*commands;
130 } cmdbuf_t;
131 
132 #define	pathcmd_name		u.path.path
133 #define	nodecmd_nodeh		u.node.nodeh
134 #define	nodecmd_nodename	u.node.nodename
135 #define	nodecmd_classname	u.node.classname
136 #define	nodecmd_classname	u.node.classname
137 #define	propcmd_proph		u.prop.proph
138 #define	propcmd_pname		u.prop.pname
139 #define	propcmd_type		u.prop.type
140 #define	propcmd_accessmode	u.prop.accessmode
141 #define	propcmd_size		u.prop.size
142 #define	propcmd_valbuf		u.prop.valbuf
143 #define	refpropcmd_proph	u.refprop.proph
144 #define	refpropcmd_pname	u.refprop.pname
145 #define	refpropcmd_dstnode	u.refprop.dstnode
146 #define	refnodecmd_nodeh	u.refnode.nodeh
147 #define	refnodecmd_name		u.refnode.newnodename
148 #define	refnodecmd_class	u.refnode.newnodeclass
149 #define	refnodecmd_dstnode	u.refnode.dstnode
150 #define	tablecmd_tblh		u.table.tblh
151 #define	tablecmd_newtbl		u.table.newtbl
152 #define	tablecmd_tname		u.table.tname
153 #define	rowcmd_index		u.row.index
154 #define	rowcmd_nproph		u.row.nproph
155 #define	rowcmd_prophs		u.row.prophs
156 #define	verbosecmd_level	u.verbose.level
157 
158 #ifdef	__cplusplus
159 }
160 #endif
161 
162 #endif	/* _PICLD_PLUGINUTIL_IMPL_H */
163