xref: /illumos-gate/usr/src/cmd/dcs/sparc/sun4u/remote_cfg.h (revision 86d949f9497332fe19be6b5d711d265eb957439f)
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 (c) 2000 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _REMOTE_CFG_H
28 #define	_REMOTE_CFG_H
29 
30 /*
31  * WARNING: The contents of this file are shared by all projects
32  * that  wish to  perform  remote  Dynamic Reconfiguration  (DR)
33  * operations. Copies of this file can be found in the following
34  * locations:
35  *
36  *	Project	    Location
37  *	-------	    --------
38  *	Solaris	    usr/src/cmd/dcs/sparc/sun4u/%M%
39  *	SMS	    src/sms/lib/librdr/%M%
40  *
41  * In order for proper communication to occur,  the files in the
42  * above locations must match exactly. Any changes that are made
43  * to this file should  be made to all of the files in the list.
44  */
45 
46 /*
47  * This file contains definitions for a transport layer interface socket
48  * interface between a domain configuration server (DCS) and a domain
49  * configuration agent (DCA). The domain configuration server resides
50  * within Solaris on a domain. The domain configuration agent resides on
51  * the system controller.
52  */
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 
59 /*
60  * The data_type field indicates whether the message is REQUEST
61  * or REPLY.
62  */
63 typedef enum {
64 	RDR_REQUEST = 1,
65 	RDR_REPLY
66 } rdr_msg_data_type_t;
67 
68 
69 /*
70  * The error_msg_ctl field indicates whether error messages
71  * should be generated or not. See the errstring argument in
72  * the config_admin(3CFGADM) man page.
73  */
74 typedef enum {
75 	RDR_GENERATE_ERR_MSGS = 1,
76 	RDR_DONT_GENERATE_ERR_MSGS
77 } rdr_error_msg_ctl_t;
78 
79 
80 /*
81  * The list_msg_ctl field indicates whether a list should
82  * be generated for all attachment points in the device tree or
83  * only those attachment points specified in the message. See
84  * the comment on the first two arguments for config_list_ext
85  * in the config_admin(3CFGADM) man page.
86  */
87 typedef enum {
88 	RDR_LIST_ONLY_PARAM_APS = 1,
89 	RDR_LIST_ALL_APS
90 } rdr_list_msg_control_t;
91 
92 
93 /*
94  * The permissions field indicates if the list_ext command should
95  * filter out attachment points that the remote user doesn't have
96  * sufficient access permissions to view.
97  */
98 typedef enum {
99 	RDR_NOT_PRIVILEGED = 0,
100 	RDR_PRIVILEGED
101 } rdr_list_permission_control_t;
102 
103 
104 /*
105  * The message_opcode value of the message indicates the purpose
106  * of the request. The defined values for message_opcode are:
107  */
108 typedef enum {
109 	RDR_SES_REQ = 1,	   /* Session open.			   */
110 	RDR_SES_ESTBL,		   /* Session Establishment.		   */
111 	RDR_SES_END,		   /* Session end.			   */
112 	RDR_CONF_CHANGE_STATE,	   /* Change state of an attachment point. */
113 	RDR_CONF_PRIVATE_FUNC,	   /* Invoke h/w specific func.		   */
114 	RDR_CONF_TEST,		   /* Test the system board.		   */
115 	RDR_CONF_LIST_EXT,	   /* Listing interface.		   */
116 	RDR_CONF_HELP,		   /* Request output of localized help msg */
117 	RDR_CONF_AP_ID_CMP,	   /* Compare two attachment point ids.	   */
118 	RDR_CONF_ABORT_CMD,	   /* Abort the current config command.	   */
119 	RDR_CONF_CONFIRM_CALLBACK, /* Confirm call-back.		   */
120 	RDR_CONF_MSG_CALLBACK,	   /* Message call-back.		   */
121 	RDR_RSRC_INFO,		   /* System board resource info.	   */
122 	RDR_NUM_OPS
123 } rdr_msg_opcode_t;
124 
125 
126 /*
127  * The status is valid only if the data_type is REPLY. The possible
128  * values for status are, FAILED or SUCCESS.
129  */
130 typedef enum {
131 	RDR_SUCCESS = 0,
132 	RDR_FAILED
133 } dr_msg_status_t;
134 
135 
136 /*
137  * The following typedefs define message formats for use in the
138  * rdr_msg_type_t union. The rdr_msg_type_t union contains the
139  * majority of the information in the messages sent between the
140  * DCS and DCA.
141  *
142  * Some types require variable length data to follow the fixed
143  * length information in the struct. If this is required, a
144  * comment is placed at the end of the struct that shows the
145  * contents of that information along with the required number
146  * of bytes.
147  *
148  * All *_size fields are the length of the string + 1 to account
149  * for NULL termination.
150  */
151 
152 
153 typedef struct {
154 	unsigned int		locale_size;
155 	/* locale string (locale_size bytes)	 */
156 } rdr_ses_req_t;
157 
158 
159 typedef struct {
160 	unsigned long		session_id;
161 } rdr_ses_req_reply_t;
162 
163 
164 typedef struct {
165 	unsigned int		num_ap_ids;
166 	unsigned int		ap_id_char_size;
167 	unsigned int		options_size;
168 	unsigned long		confirm_callback_id;
169 	unsigned long		confirm_appdata_ptr;
170 	unsigned long		msg_callback_id;
171 	unsigned long		msg_appdata_ptr;
172 	unsigned long		flags;
173 	unsigned long		timeval;
174 	unsigned short 		state_change_cmd;
175 	unsigned short		error_msg_ctl;
176 	char			retries;
177 	char			pad_byte1;
178 	/* ap id strings (ap_id_char_size bytes) */
179 	/* option string (options_size bytes)	 */
180 } rdr_change_state_t;
181 
182 
183 typedef struct {
184 	unsigned int		errstring_size;
185 	/* error string (errstring_size bytes)	 */
186 } rdr_change_state_reply_t;
187 
188 
189 typedef struct {
190 	unsigned int		num_ap_ids;
191 	unsigned int		ap_id_char_size;
192 	unsigned int		options_size;
193 	unsigned int		function_size;
194 	unsigned long		confirm_callback_id;
195 	unsigned long		confirm_appdata_ptr;
196 	unsigned long		msg_callback_id;
197 	unsigned long		msg_appdata_ptr;
198 	unsigned long		flags;
199 	unsigned short		error_msg_ctl;
200 	char			pad_byte1;
201 	char			pad_byte2;
202 	/* ap id strings (ap_id_char_size bytes) */
203 	/* option string (options_size bytes)	 */
204 	/* function string (function_size bytes) */
205 } rdr_private_func_t;
206 
207 
208 typedef struct {
209 	unsigned int		errstring_size;
210 	/* error string (errstring_size bytes)	 */
211 } rdr_private_func_reply_t;
212 
213 
214 typedef struct {
215 	unsigned int		num_ap_ids;
216 	unsigned int		ap_id_char_size;
217 	unsigned int		options_size;
218 	unsigned long		msg_callback_id;
219 	unsigned long		msg_appdata_ptr;
220 	unsigned long		flags;
221 	unsigned short		error_msg_ctl;
222 	char			pad_byte1;
223 	char			pad_byte2;
224 	/* ap id strings (ap_id_char_size bytes) */
225 	/* option string (options_size bytes)	 */
226 } rdr_test_t;
227 
228 
229 typedef struct {
230 	unsigned int		errstring_size;
231 	/* error string (errstring_size bytes)	 */
232 } rdr_test_reply_t;
233 
234 
235 typedef struct {
236 	unsigned int		num_ap_ids;
237 	unsigned int		ap_id_char_size;
238 	unsigned int		options_size;
239 	unsigned int		listopts_size;
240 	unsigned short		error_msg_ctl;
241 	unsigned short		list_msg_ctl;
242 	unsigned long		flags;
243 	unsigned int		permissions;
244 	/* ap id strings (ap_id_char_size bytes) */
245 	/* option string (options_size bytes)	 */
246 	/* list opt string (listopts_size bytes) */
247 } rdr_list_ext_t;
248 
249 
250 /*
251  * The num_ap_ids is the total number of ap_ids in the sequence of
252  * messages for the list_ext reply. The list data array is an
253  * array of cfga_list_data_t (see config_admin (3CFGA)) structs
254  * that has num_ap_ids elements.
255  */
256 typedef struct {
257 	unsigned int		num_ap_ids;
258 	unsigned int		errstring_size;
259 	/* list data array (num_ap_ids elements) */
260 	/* error string (errstring_size bytes)	 */
261 } rdr_list_ext_reply_t;
262 
263 
264 typedef struct {
265 	unsigned int		num_ap_ids;
266 	unsigned int		ap_id_char_size;
267 	unsigned long 		msg_callback_id;
268 	unsigned long		msg_appdata_ptr;
269 	unsigned int		options_size;
270 	unsigned long 		flags;
271 	/* ap id strings (ap_id_char_size bytes) */
272 	/* option string (options_size bytes)	 */
273 } rdr_help_t;
274 
275 
276 typedef struct {
277 	unsigned int		ap_id1_size;
278 	unsigned int		ap_id2_size;
279 	/* ap id 1 string (ap_id1_size bytes)	 */
280 	/* ap id 2 string (ap_id1_size bytes)	 */
281 } rdr_ap_id_cmp_t;
282 
283 
284 typedef struct {
285 	unsigned long		session_id;
286 } rdr_abort_cmd_t;
287 
288 
289 typedef struct {
290 	unsigned long		confirm_callback_id;
291 	unsigned long		appdata_ptr;
292 	unsigned int		message_size;
293 	/* prompt message (message_size bytes)	 */
294 } rdr_confirm_callback_t;
295 
296 
297 typedef struct {
298 	unsigned long		confirm_callback_id;
299 	unsigned long		appdata_ptr;
300 	int			response;
301 } rdr_confirm_callback_reply_t;
302 
303 
304 typedef struct {
305 	unsigned long		msg_callback_id;
306 	unsigned long		appdata_ptr;
307 	unsigned int		message_size;
308 	/* user message (message_size bytes)	 */
309 } rdr_msg_callback_t;
310 
311 
312 typedef struct {
313 	unsigned int		num_ap_ids;
314 	unsigned int		ap_id_char_size;
315 	int			flags;
316 	/* ap id strings (ap_id_char_size bytes) */
317 } rdr_rsrc_info_t;
318 
319 
320 typedef struct {
321 	unsigned long		packed_hdl_size;
322 	/* rsrc info buf (packed_hdl_size bytes) */
323 } rdr_rsrc_info_reply_t;
324 
325 
326 typedef union {
327 	rdr_ses_req_t			ses_req;
328 	rdr_ses_req_reply_t		ses_req_reply;
329 	rdr_change_state_t 		change_state;
330 	rdr_change_state_reply_t 	change_state_reply;
331 	rdr_private_func_t 		private_func;
332 	rdr_private_func_reply_t	private_func_reply;
333 	rdr_test_t			test;
334 	rdr_test_reply_t		test_reply;
335 	rdr_list_ext_t			list_ext;
336 	rdr_list_ext_reply_t		list_ext_reply;
337 	rdr_help_t			help;
338 	rdr_ap_id_cmp_t			ap_id_cmp;
339 	rdr_abort_cmd_t			abort;
340 	rdr_confirm_callback_t		confirm_callback;
341 	rdr_confirm_callback_reply_t	confirm_callback_reply;
342 	rdr_msg_callback_t		msg_callback;
343 	rdr_rsrc_info_t			rsrc_info;
344 	rdr_rsrc_info_reply_t		rsrc_info_reply;
345 } rdr_msg_type_t;
346 
347 
348 /*
349  * The RDR message will contain the following members:
350  */
351 typedef struct {
352 	unsigned long	data_length;
353 
354 	/* Message Op, Type, and Status */
355 	unsigned char	message_opcode;		/* rdr_msg_opcode_t 	*/
356 	unsigned char	data_type;		/* rdr_msg_data_type_t	*/
357 	char		pad_byte1;
358 	char		pad_byte2;
359 	unsigned long	status;			/* rdr_msg_status_t	*/
360 
361 	/* These are for security and version */
362 	unsigned long	random_req;
363 	unsigned long	random_resp;
364 
365 	unsigned short	major_version;
366 	unsigned short	minor_version;
367 } rdr_msg_hdr_t;
368 
369 
370 /*
371  * The RDR message body:
372  */
373 typedef struct {
374 	rdr_msg_hdr_t 	app;
375 	rdr_msg_type_t	conf;
376 } rdr_msg_t;
377 
378 
379 #ifdef __cplusplus
380 }
381 #endif
382 
383 #endif /* _REMOTE_CFG_H */
384