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