xref: /titanic_54/usr/src/head/config_admin.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 1998-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 _SYS_CONFIG_ADMIN_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_CONFIG_ADMIN_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate /*
33*7c478bd9Sstevel@tonic-gate  * config_admin.h
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * this file supports usage of the interfaces defined in
36*7c478bd9Sstevel@tonic-gate  * config_admin.3x. which are contained in /usr/lib/libcfgadm.so.1
37*7c478bd9Sstevel@tonic-gate  */
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate #include <sys/param.h>
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
42*7c478bd9Sstevel@tonic-gate extern "C" {
43*7c478bd9Sstevel@tonic-gate #endif
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate /*
47*7c478bd9Sstevel@tonic-gate  * Defined constants
48*7c478bd9Sstevel@tonic-gate  */
49*7c478bd9Sstevel@tonic-gate #define	CFGA_AP_LOG_ID_LEN	20
50*7c478bd9Sstevel@tonic-gate #define	CFGA_AP_PHYS_ID_LEN	MAXPATHLEN
51*7c478bd9Sstevel@tonic-gate #define	CFGA_INFO_LEN		4096
52*7c478bd9Sstevel@tonic-gate #define	CFGA_TYPE_LEN		12
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate #define	CFGA_CLASS_LEN		12
55*7c478bd9Sstevel@tonic-gate #define	CFGA_LOG_EXT_LEN	30
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate #define	CFGA_DYN_SEP		"::"
58*7c478bd9Sstevel@tonic-gate #define	CFGA_PHYS_EXT_LEN	(CFGA_AP_PHYS_ID_LEN + CFGA_LOG_EXT_LEN)
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate /*
62*7c478bd9Sstevel@tonic-gate  * Configuration change state commands
63*7c478bd9Sstevel@tonic-gate  */
64*7c478bd9Sstevel@tonic-gate typedef enum {
65*7c478bd9Sstevel@tonic-gate 	CFGA_CMD_NONE = 0,
66*7c478bd9Sstevel@tonic-gate 	CFGA_CMD_LOAD,
67*7c478bd9Sstevel@tonic-gate 	CFGA_CMD_UNLOAD,
68*7c478bd9Sstevel@tonic-gate 	CFGA_CMD_CONNECT,
69*7c478bd9Sstevel@tonic-gate 	CFGA_CMD_DISCONNECT,
70*7c478bd9Sstevel@tonic-gate 	CFGA_CMD_CONFIGURE,
71*7c478bd9Sstevel@tonic-gate 	CFGA_CMD_UNCONFIGURE
72*7c478bd9Sstevel@tonic-gate } cfga_cmd_t;
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate /*
75*7c478bd9Sstevel@tonic-gate  * Configuration states
76*7c478bd9Sstevel@tonic-gate  */
77*7c478bd9Sstevel@tonic-gate typedef enum {
78*7c478bd9Sstevel@tonic-gate 	CFGA_STAT_NONE = 0,
79*7c478bd9Sstevel@tonic-gate 	CFGA_STAT_EMPTY,
80*7c478bd9Sstevel@tonic-gate 	CFGA_STAT_DISCONNECTED,
81*7c478bd9Sstevel@tonic-gate 	CFGA_STAT_CONNECTED,
82*7c478bd9Sstevel@tonic-gate 	CFGA_STAT_UNCONFIGURED,
83*7c478bd9Sstevel@tonic-gate 	CFGA_STAT_CONFIGURED
84*7c478bd9Sstevel@tonic-gate } cfga_stat_t;
85*7c478bd9Sstevel@tonic-gate 
86*7c478bd9Sstevel@tonic-gate /*
87*7c478bd9Sstevel@tonic-gate  * Configuration conditions
88*7c478bd9Sstevel@tonic-gate  */
89*7c478bd9Sstevel@tonic-gate typedef enum {
90*7c478bd9Sstevel@tonic-gate 	CFGA_COND_UNKNOWN = 0,
91*7c478bd9Sstevel@tonic-gate 	CFGA_COND_OK,
92*7c478bd9Sstevel@tonic-gate 	CFGA_COND_FAILING,
93*7c478bd9Sstevel@tonic-gate 	CFGA_COND_FAILED,
94*7c478bd9Sstevel@tonic-gate 	CFGA_COND_UNUSABLE
95*7c478bd9Sstevel@tonic-gate } cfga_cond_t;
96*7c478bd9Sstevel@tonic-gate 
97*7c478bd9Sstevel@tonic-gate /*
98*7c478bd9Sstevel@tonic-gate  * Flags
99*7c478bd9Sstevel@tonic-gate  */
100*7c478bd9Sstevel@tonic-gate #define	CFGA_FLAG_FORCE		1
101*7c478bd9Sstevel@tonic-gate #define	CFGA_FLAG_VERBOSE	2
102*7c478bd9Sstevel@tonic-gate #define	CFGA_FLAG_LIST_ALL	4
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate typedef char cfga_ap_log_id_t[CFGA_AP_LOG_ID_LEN];
105*7c478bd9Sstevel@tonic-gate typedef char cfga_ap_phys_id_t[CFGA_AP_PHYS_ID_LEN];
106*7c478bd9Sstevel@tonic-gate typedef char cfga_info_t[CFGA_INFO_LEN];
107*7c478bd9Sstevel@tonic-gate typedef char cfga_type_t[CFGA_TYPE_LEN];
108*7c478bd9Sstevel@tonic-gate typedef int cfga_flags_t;
109*7c478bd9Sstevel@tonic-gate typedef int cfga_busy_t;
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate typedef char cfga_log_ext_t[CFGA_LOG_EXT_LEN];
113*7c478bd9Sstevel@tonic-gate typedef char cfga_phys_ext_t[CFGA_PHYS_EXT_LEN];
114*7c478bd9Sstevel@tonic-gate typedef char cfga_class_t[CFGA_CLASS_LEN];
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate typedef struct cfga_list_data {
117*7c478bd9Sstevel@tonic-gate 	cfga_log_ext_t 	ap_log_id;	/* Attachment point logical id */
118*7c478bd9Sstevel@tonic-gate 	cfga_phys_ext_t	ap_phys_id;	/* Attachment point physical id */
119*7c478bd9Sstevel@tonic-gate 	cfga_class_t 	ap_class;	/* Attachment point class */
120*7c478bd9Sstevel@tonic-gate 	cfga_stat_t	ap_r_state;	/* Receptacle state */
121*7c478bd9Sstevel@tonic-gate 	cfga_stat_t	ap_o_state;	/* Occupant state */
122*7c478bd9Sstevel@tonic-gate 	cfga_cond_t	ap_cond;	/* Attachment point condition */
123*7c478bd9Sstevel@tonic-gate 	cfga_busy_t	ap_busy;	/* Busy indicators */
124*7c478bd9Sstevel@tonic-gate 	time_t		ap_status_time;	/* Attachment point last change */
125*7c478bd9Sstevel@tonic-gate 	cfga_info_t	ap_info;	/* Miscellaneous information */
126*7c478bd9Sstevel@tonic-gate 	cfga_type_t	ap_type;	/* Occupant type */
127*7c478bd9Sstevel@tonic-gate } cfga_list_data_t;
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate /*
130*7c478bd9Sstevel@tonic-gate  * The following structure is retained for backward compatibility
131*7c478bd9Sstevel@tonic-gate  */
132*7c478bd9Sstevel@tonic-gate typedef struct cfga_stat_data {
133*7c478bd9Sstevel@tonic-gate 	cfga_ap_log_id_t ap_log_id;	/* Attachment point logical id */
134*7c478bd9Sstevel@tonic-gate 	cfga_ap_phys_id_t ap_phys_id;	/* Attachment point physical id */
135*7c478bd9Sstevel@tonic-gate 	cfga_stat_t	ap_r_state;	/* Receptacle state */
136*7c478bd9Sstevel@tonic-gate 	cfga_stat_t	ap_o_state;	/* Occupant state */
137*7c478bd9Sstevel@tonic-gate 	cfga_cond_t	ap_cond;	/* Attachment point condition */
138*7c478bd9Sstevel@tonic-gate 	cfga_busy_t	ap_busy;	/* Busy indicators */
139*7c478bd9Sstevel@tonic-gate 	time_t		ap_status_time;	/* Attachment point last change */
140*7c478bd9Sstevel@tonic-gate 	cfga_info_t	ap_info;	/* Miscellaneous information */
141*7c478bd9Sstevel@tonic-gate 	cfga_type_t	ap_type;	/* Occupant type */
142*7c478bd9Sstevel@tonic-gate } cfga_stat_data_t;
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate 
145*7c478bd9Sstevel@tonic-gate struct cfga_confirm {
146*7c478bd9Sstevel@tonic-gate 	int (*confirm)(void *appdata_ptr, const char *message);
147*7c478bd9Sstevel@tonic-gate 	void *appdata_ptr;
148*7c478bd9Sstevel@tonic-gate };
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate struct cfga_msg {
151*7c478bd9Sstevel@tonic-gate 	int (*message_routine)(void *appdata_ptr, const char *message);
152*7c478bd9Sstevel@tonic-gate 	void *appdata_ptr;
153*7c478bd9Sstevel@tonic-gate };
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate /*
156*7c478bd9Sstevel@tonic-gate  * Library function error codes returned by all functions below
157*7c478bd9Sstevel@tonic-gate  * except config_strerror which is used to decode the error
158*7c478bd9Sstevel@tonic-gate  * codes.
159*7c478bd9Sstevel@tonic-gate  */
160*7c478bd9Sstevel@tonic-gate typedef enum {
161*7c478bd9Sstevel@tonic-gate 	CFGA_OK = 0,
162*7c478bd9Sstevel@tonic-gate 	CFGA_NACK,
163*7c478bd9Sstevel@tonic-gate 	CFGA_NOTSUPP,
164*7c478bd9Sstevel@tonic-gate 	CFGA_OPNOTSUPP,
165*7c478bd9Sstevel@tonic-gate 	CFGA_PRIV,
166*7c478bd9Sstevel@tonic-gate 	CFGA_BUSY,
167*7c478bd9Sstevel@tonic-gate 	CFGA_SYSTEM_BUSY,
168*7c478bd9Sstevel@tonic-gate 	CFGA_DATA_ERROR,
169*7c478bd9Sstevel@tonic-gate 	CFGA_LIB_ERROR,
170*7c478bd9Sstevel@tonic-gate 	CFGA_NO_LIB,
171*7c478bd9Sstevel@tonic-gate 	CFGA_INSUFFICENT_CONDITION,
172*7c478bd9Sstevel@tonic-gate 	CFGA_INVAL,
173*7c478bd9Sstevel@tonic-gate 	CFGA_ERROR,
174*7c478bd9Sstevel@tonic-gate 	CFGA_APID_NOEXIST,
175*7c478bd9Sstevel@tonic-gate 	CFGA_ATTR_INVAL
176*7c478bd9Sstevel@tonic-gate } cfga_err_t;
177*7c478bd9Sstevel@tonic-gate 
178*7c478bd9Sstevel@tonic-gate 
179*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
180*7c478bd9Sstevel@tonic-gate 
181*7c478bd9Sstevel@tonic-gate /*
182*7c478bd9Sstevel@tonic-gate  * config_admin.3x library interfaces
183*7c478bd9Sstevel@tonic-gate  */
184*7c478bd9Sstevel@tonic-gate 
185*7c478bd9Sstevel@tonic-gate cfga_err_t config_change_state(cfga_cmd_t state_change_cmd, int num_ap_ids,
186*7c478bd9Sstevel@tonic-gate     char *const *ap_ids, const char *options, struct cfga_confirm *confp,
187*7c478bd9Sstevel@tonic-gate     struct cfga_msg *msgp, char **errstring, cfga_flags_t flags);
188*7c478bd9Sstevel@tonic-gate 
189*7c478bd9Sstevel@tonic-gate cfga_err_t config_private_func(const char *function, int num_ap_ids,
190*7c478bd9Sstevel@tonic-gate     char *const *ap_ids, const char *options, struct cfga_confirm *confp,
191*7c478bd9Sstevel@tonic-gate     struct cfga_msg *msgp, char **errstring, cfga_flags_t flags);
192*7c478bd9Sstevel@tonic-gate 
193*7c478bd9Sstevel@tonic-gate cfga_err_t config_test(int num_ap_ids, char *const *ap_ids,
194*7c478bd9Sstevel@tonic-gate     const char *options, struct cfga_msg *msgp, char **errstring,
195*7c478bd9Sstevel@tonic-gate     cfga_flags_t flags);
196*7c478bd9Sstevel@tonic-gate 
197*7c478bd9Sstevel@tonic-gate cfga_err_t config_list_ext(int num_ap_ids, char *const *ap_ids,
198*7c478bd9Sstevel@tonic-gate     struct cfga_list_data **ap_id_list, int *nlist, const char *options,
199*7c478bd9Sstevel@tonic-gate     const char *listopts, char **errstring, cfga_flags_t flags);
200*7c478bd9Sstevel@tonic-gate 
201*7c478bd9Sstevel@tonic-gate cfga_err_t config_help(int num_ap_ids, char *const *ap_ids,
202*7c478bd9Sstevel@tonic-gate     struct cfga_msg *msgp, const char *options, cfga_flags_t flags);
203*7c478bd9Sstevel@tonic-gate 
204*7c478bd9Sstevel@tonic-gate const char *config_strerror(cfga_err_t cfgerrnum);
205*7c478bd9Sstevel@tonic-gate 
206*7c478bd9Sstevel@tonic-gate int config_ap_id_cmp(const cfga_ap_log_id_t ap_id1,
207*7c478bd9Sstevel@tonic-gate     const cfga_ap_log_id_t ap_id2);
208*7c478bd9Sstevel@tonic-gate 
209*7c478bd9Sstevel@tonic-gate void config_unload_libs();
210*7c478bd9Sstevel@tonic-gate 
211*7c478bd9Sstevel@tonic-gate /*
212*7c478bd9Sstevel@tonic-gate  * The following two routines are retained only for backward compatibility
213*7c478bd9Sstevel@tonic-gate  */
214*7c478bd9Sstevel@tonic-gate cfga_err_t config_stat(int num_ap_ids, char *const *ap_ids,
215*7c478bd9Sstevel@tonic-gate     struct cfga_stat_data *buf, const char *options, char **errstring);
216*7c478bd9Sstevel@tonic-gate 
217*7c478bd9Sstevel@tonic-gate cfga_err_t config_list(struct cfga_stat_data **ap_di_list, int *nlist,
218*7c478bd9Sstevel@tonic-gate     const char *options, char **errstring);
219*7c478bd9Sstevel@tonic-gate 
220*7c478bd9Sstevel@tonic-gate 
221*7c478bd9Sstevel@tonic-gate #ifdef CFGA_PLUGIN_LIB
222*7c478bd9Sstevel@tonic-gate /*
223*7c478bd9Sstevel@tonic-gate  * Plugin library routine hooks - only to be used by the generic
224*7c478bd9Sstevel@tonic-gate  * library and plugin libraries (who must define CFGA_PLUGIN_LIB
225*7c478bd9Sstevel@tonic-gate  * prior to the inclusion of this header).
226*7c478bd9Sstevel@tonic-gate  */
227*7c478bd9Sstevel@tonic-gate 
228*7c478bd9Sstevel@tonic-gate cfga_err_t cfga_change_state(cfga_cmd_t, const char *, const char *,
229*7c478bd9Sstevel@tonic-gate     struct cfga_confirm *, struct cfga_msg *, char **, cfga_flags_t);
230*7c478bd9Sstevel@tonic-gate cfga_err_t cfga_private_func(const char *, const char *, const char *,
231*7c478bd9Sstevel@tonic-gate     struct cfga_confirm *, struct cfga_msg *, char **, cfga_flags_t);
232*7c478bd9Sstevel@tonic-gate cfga_err_t cfga_test(const char *, const char *, struct cfga_msg *,
233*7c478bd9Sstevel@tonic-gate     char **, cfga_flags_t);
234*7c478bd9Sstevel@tonic-gate cfga_err_t cfga_list_ext(const char *, struct cfga_list_data **, int *,
235*7c478bd9Sstevel@tonic-gate     const char *, const char *, char **, cfga_flags_t);
236*7c478bd9Sstevel@tonic-gate cfga_err_t cfga_help(struct cfga_msg *, const char *, cfga_flags_t);
237*7c478bd9Sstevel@tonic-gate int cfga_ap_id_cmp(const cfga_ap_log_id_t,
238*7c478bd9Sstevel@tonic-gate     const cfga_ap_log_id_t);
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate 
241*7c478bd9Sstevel@tonic-gate /*
242*7c478bd9Sstevel@tonic-gate  * Plugin version information.
243*7c478bd9Sstevel@tonic-gate  */
244*7c478bd9Sstevel@tonic-gate #define	CFGA_HSL_V1	1
245*7c478bd9Sstevel@tonic-gate #define	CFGA_HSL_V2	2
246*7c478bd9Sstevel@tonic-gate #define	CFGA_HSL_VERS	CFGA_HSL_V2
247*7c478bd9Sstevel@tonic-gate 
248*7c478bd9Sstevel@tonic-gate /*
249*7c478bd9Sstevel@tonic-gate  * The following two routines are retained only for backward compatibility.
250*7c478bd9Sstevel@tonic-gate  */
251*7c478bd9Sstevel@tonic-gate cfga_err_t cfga_stat(const char *, struct cfga_stat_data *,
252*7c478bd9Sstevel@tonic-gate     const char *, char **);
253*7c478bd9Sstevel@tonic-gate cfga_err_t cfga_list(const char *, struct cfga_stat_data **, int *,
254*7c478bd9Sstevel@tonic-gate     const char *, char **);
255*7c478bd9Sstevel@tonic-gate 
256*7c478bd9Sstevel@tonic-gate 
257*7c478bd9Sstevel@tonic-gate #endif /* CFGA_PLUGIN_LIB */
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate #else /* !defined __STDC__ */
260*7c478bd9Sstevel@tonic-gate 
261*7c478bd9Sstevel@tonic-gate extern const char *config_strerror();
262*7c478bd9Sstevel@tonic-gate extern int config_ap_id_cmp();
263*7c478bd9Sstevel@tonic-gate 
264*7c478bd9Sstevel@tonic-gate #endif /* __STDC__ */
265*7c478bd9Sstevel@tonic-gate 
266*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
267*7c478bd9Sstevel@tonic-gate }
268*7c478bd9Sstevel@tonic-gate #endif
269*7c478bd9Sstevel@tonic-gate 
270*7c478bd9Sstevel@tonic-gate #endif /* _SYS_CONFIG_ADMIN_H */
271