xref: /illumos-gate/usr/src/cmd/dcs/sparc/sun4u/dcs_msg.c (revision 2a8bcb4e)
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 (c) 2000 by Sun Microsystems, Inc.
24*7c478bd9Sstevel@tonic-gate  * All rights reserved.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*
28*7c478bd9Sstevel@tonic-gate  * This file is a module that handles the logging features of the
29*7c478bd9Sstevel@tonic-gate  * DCS. All error messages that are generated by the DCS are kept in
30*7c478bd9Sstevel@tonic-gate  * a static array and accessed through one of the access functions
31*7c478bd9Sstevel@tonic-gate  * defined in this file.
32*7c478bd9Sstevel@tonic-gate  */
33*7c478bd9Sstevel@tonic-gate 
34*7c478bd9Sstevel@tonic-gate #include <stdlib.h>
35*7c478bd9Sstevel@tonic-gate #include <stdio.h>
36*7c478bd9Sstevel@tonic-gate #include <stdarg.h>
37*7c478bd9Sstevel@tonic-gate #include <string.h>
38*7c478bd9Sstevel@tonic-gate #include <errno.h>
39*7c478bd9Sstevel@tonic-gate #include <assert.h>
40*7c478bd9Sstevel@tonic-gate #include <syslog.h>
41*7c478bd9Sstevel@tonic-gate #include <libintl.h>
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #include "dcs.h"
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate 
46*7c478bd9Sstevel@tonic-gate #define	SYSLOG_FMT	"<%d> %s"
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate /*
50*7c478bd9Sstevel@tonic-gate  * This is an array of strings representing all of the error and
51*7c478bd9Sstevel@tonic-gate  * informational messages that are used by the DCS. This includes
52*7c478bd9Sstevel@tonic-gate  * messages that are logged using syslog(3C) and those that are
53*7c478bd9Sstevel@tonic-gate  * displayed to the user through a message callback.
54*7c478bd9Sstevel@tonic-gate  */
55*7c478bd9Sstevel@tonic-gate static const char *dcs_err_fmt[] = {
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate 	/*
58*7c478bd9Sstevel@tonic-gate 	 * Network Errors:
59*7c478bd9Sstevel@tonic-gate 	 */
60*7c478bd9Sstevel@tonic-gate 	/* DCS_INIT_ERR	    */ "network initialization failed",
61*7c478bd9Sstevel@tonic-gate 	/* DCS_NO_PORT	    */ "failed to acquire reserved port",
62*7c478bd9Sstevel@tonic-gate 	/* DCS_CONNECT_ERR  */ "connection attempt failed",
63*7c478bd9Sstevel@tonic-gate 	/* DCS_RECEIVE_ERR  */ "unable to receive message",
64*7c478bd9Sstevel@tonic-gate 	/* DCS_OP_REPLY_ERR */ "unable to send message for %s operation",
65*7c478bd9Sstevel@tonic-gate 	/* DCS_NO_SERV	    */ "%s service not found, using reserved port 665",
66*7c478bd9Sstevel@tonic-gate 	/* DCS_DISCONNECT   */ "client disconnected",
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate 	/*
69*7c478bd9Sstevel@tonic-gate 	 * Session Errors:
70*7c478bd9Sstevel@tonic-gate 	 */
71*7c478bd9Sstevel@tonic-gate 	/* DCS_SES_HAND_ERR */ "failed to start a new session handler",
72*7c478bd9Sstevel@tonic-gate 	/* DCS_ABORT_ERR    */ "abort attempt of session, %d, unsuccessful",
73*7c478bd9Sstevel@tonic-gate 	/* DCS_VER_INVAL    */ "unsupported message protocol version %d.%d",
74*7c478bd9Sstevel@tonic-gate 	/* DCS_SES_ABORTED  */ "session aborted",
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate 	/*
77*7c478bd9Sstevel@tonic-gate 	 * DR Request Errors:
78*7c478bd9Sstevel@tonic-gate 	 */
79*7c478bd9Sstevel@tonic-gate 	/* DCS_UNKNOWN_OP   */ "unknown operation requested",
80*7c478bd9Sstevel@tonic-gate 	/* DCS_OP_FAILED    */ "operation failed",
81*7c478bd9Sstevel@tonic-gate 	/* DCS_SEQ_INVAL    */ "invalid session establishment sequence",
82*7c478bd9Sstevel@tonic-gate 	/* DCS_NO_SES_ESTBL */ "%s operation issued before session established",
83*7c478bd9Sstevel@tonic-gate 	/* DCS_MSG_INVAL    */ "received an invalid message",
84*7c478bd9Sstevel@tonic-gate 	/* DCS_CONF_CB_ERR  */ "confirm callback failed, aborting operation",
85*7c478bd9Sstevel@tonic-gate 	/* DCS_MSG_CB_ERR   */ "message callback failed, continuing",
86*7c478bd9Sstevel@tonic-gate 	/* DCS_BAD_RETRY    */ "retry value invalid (%d)",
87*7c478bd9Sstevel@tonic-gate 	/* DCS_BAD_TIMEOUT  */ "timeout value invalid (%d)",
88*7c478bd9Sstevel@tonic-gate 	/* DCS_RETRY	    */ "retrying operation, attempt %d",
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate 	/*
91*7c478bd9Sstevel@tonic-gate 	 * General Errors:
92*7c478bd9Sstevel@tonic-gate 	 */
93*7c478bd9Sstevel@tonic-gate 	/* DCS_NO_PRIV	    */ "permission denied",
94*7c478bd9Sstevel@tonic-gate 	/* DCS_INT_ERR	    */ "internal error: %s: %s",
95*7c478bd9Sstevel@tonic-gate 	/* DCS_UNKNOWN_ERR  */ "unrecognized error reported",
96*7c478bd9Sstevel@tonic-gate 	/* DCS_BAD_OPT	    */ "illegal option (-%c), exiting",
97*7c478bd9Sstevel@tonic-gate 	/* DCS_BAD_OPT_ARG  */ "illegal argument to -%c flag (%s), %s",
98*7c478bd9Sstevel@tonic-gate 	/* DCS_CFGA_UNKNOWN */ "configuration administration unknown error",
99*7c478bd9Sstevel@tonic-gate 	/* DCS_CFGA_ERR	    */ "%s: %s",
100*7c478bd9Sstevel@tonic-gate 	/* DCS_RSRC_ERR	    */ "resource info init error (%d)",
101*7c478bd9Sstevel@tonic-gate 	/* DCS_MSG_COUNT    */ NULL
102*7c478bd9Sstevel@tonic-gate };
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate /*
106*7c478bd9Sstevel@tonic-gate  * dcs_log_msg:
107*7c478bd9Sstevel@tonic-gate  *
108*7c478bd9Sstevel@tonic-gate  * Based on an error code, construct an error string and output it to
109*7c478bd9Sstevel@tonic-gate  * a logfile using syslog(3C). Note that the string will not be localized.
110*7c478bd9Sstevel@tonic-gate  */
111*7c478bd9Sstevel@tonic-gate void
dcs_log_msg(int priority,int err_code,...)112*7c478bd9Sstevel@tonic-gate dcs_log_msg(int priority, int err_code, ...)
113*7c478bd9Sstevel@tonic-gate {
114*7c478bd9Sstevel@tonic-gate 	va_list	vap;
115*7c478bd9Sstevel@tonic-gate 	char	err_str[MAX_MSG_LEN];
116*7c478bd9Sstevel@tonic-gate 	char	syslog_str[MAX_MSG_LEN];
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate 
119*7c478bd9Sstevel@tonic-gate 	/* check if error code is out of bounds */
120*7c478bd9Sstevel@tonic-gate 	if ((err_code < 0) || (err_code >= DCS_MSG_COUNT)) {
121*7c478bd9Sstevel@tonic-gate 		syslog(LOG_NOTICE, dcs_err_fmt[DCS_UNKNOWN_ERR]);
122*7c478bd9Sstevel@tonic-gate 		return;
123*7c478bd9Sstevel@tonic-gate 	}
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate 	va_start(vap, err_code);
126*7c478bd9Sstevel@tonic-gate 	(void) vsnprintf(err_str, MAX_MSG_LEN, dcs_err_fmt[err_code], vap);
127*7c478bd9Sstevel@tonic-gate 	va_end(vap);
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate 	/* prepend session identifier */
130*7c478bd9Sstevel@tonic-gate 	snprintf(syslog_str, MAX_MSG_LEN, SYSLOG_FMT, curr_ses_id(), err_str);
131*7c478bd9Sstevel@tonic-gate 
132*7c478bd9Sstevel@tonic-gate 	syslog(priority, syslog_str);
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate 	if (standalone) {
135*7c478bd9Sstevel@tonic-gate 		fprintf(stderr, "%s\n", syslog_str);
136*7c478bd9Sstevel@tonic-gate 	}
137*7c478bd9Sstevel@tonic-gate }
138*7c478bd9Sstevel@tonic-gate 
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate /*
141*7c478bd9Sstevel@tonic-gate  * dcs_strerror:
142*7c478bd9Sstevel@tonic-gate  *
143*7c478bd9Sstevel@tonic-gate  * Return the format string associated with a supplied DCS specific
144*7c478bd9Sstevel@tonic-gate  * error code. dgettext(3C) is used to retrieve the localized version
145*7c478bd9Sstevel@tonic-gate  * of the format string.
146*7c478bd9Sstevel@tonic-gate  */
147*7c478bd9Sstevel@tonic-gate const char *
dcs_strerror(int err_code)148*7c478bd9Sstevel@tonic-gate dcs_strerror(int err_code)
149*7c478bd9Sstevel@tonic-gate {
150*7c478bd9Sstevel@tonic-gate 	/* check if code is out of bounds */
151*7c478bd9Sstevel@tonic-gate 	if ((err_code < 0) || (err_code >= DCS_MSG_COUNT)) {
152*7c478bd9Sstevel@tonic-gate 		return (dgettext(TEXT_DOMAIN, dcs_err_fmt[DCS_UNKNOWN_ERR]));
153*7c478bd9Sstevel@tonic-gate 	}
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate 	return (dgettext(TEXT_DOMAIN, dcs_err_fmt[err_code]));
156*7c478bd9Sstevel@tonic-gate }
157*7c478bd9Sstevel@tonic-gate 
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate /*
160*7c478bd9Sstevel@tonic-gate  * dcs_cfga_str:
161*7c478bd9Sstevel@tonic-gate  *
162*7c478bd9Sstevel@tonic-gate  * Assemble a string that describes a particular libcfgadm error code.
163*7c478bd9Sstevel@tonic-gate  * This string will contain both the platform dependent and platform
164*7c478bd9Sstevel@tonic-gate  * independent message strings available from a libcfgadm function call.
165*7c478bd9Sstevel@tonic-gate  * The resulting string will be localized indirectly through the call
166*7c478bd9Sstevel@tonic-gate  * to config_strerror() and the localized error string returned from
167*7c478bd9Sstevel@tonic-gate  * the libcfgadm operation.
168*7c478bd9Sstevel@tonic-gate  */
169*7c478bd9Sstevel@tonic-gate char *
dcs_cfga_str(char ** err_strp,int err_code)170*7c478bd9Sstevel@tonic-gate dcs_cfga_str(char **err_strp, int err_code)
171*7c478bd9Sstevel@tonic-gate {
172*7c478bd9Sstevel@tonic-gate 	const char	*ep;
173*7c478bd9Sstevel@tonic-gate 	char		*buf;
174*7c478bd9Sstevel@tonic-gate 	char		*err_str;
175*7c478bd9Sstevel@tonic-gate 
176*7c478bd9Sstevel@tonic-gate 
177*7c478bd9Sstevel@tonic-gate 	/*
178*7c478bd9Sstevel@tonic-gate 	 * Extract the platform specific message passed as
179*7c478bd9Sstevel@tonic-gate 	 * a parameter, or use NULL to signal that no error
180*7c478bd9Sstevel@tonic-gate 	 * string was passed.
181*7c478bd9Sstevel@tonic-gate 	 */
182*7c478bd9Sstevel@tonic-gate 	if (err_strp && *err_strp) {
183*7c478bd9Sstevel@tonic-gate 		err_str = *err_strp;
184*7c478bd9Sstevel@tonic-gate 	} else {
185*7c478bd9Sstevel@tonic-gate 		err_str = NULL;
186*7c478bd9Sstevel@tonic-gate 	}
187*7c478bd9Sstevel@tonic-gate 
188*7c478bd9Sstevel@tonic-gate 	buf = (char *)malloc(MAX_MSG_LEN);
189*7c478bd9Sstevel@tonic-gate 
190*7c478bd9Sstevel@tonic-gate 	if (buf == NULL) {
191*7c478bd9Sstevel@tonic-gate 		dcs_log_msg(LOG_ERR, DCS_INT_ERR, "malloc", strerror(errno));
192*7c478bd9Sstevel@tonic-gate 		return (NULL);
193*7c478bd9Sstevel@tonic-gate 	}
194*7c478bd9Sstevel@tonic-gate 
195*7c478bd9Sstevel@tonic-gate 	/* get the platform independent message */
196*7c478bd9Sstevel@tonic-gate 	ep = config_strerror(err_code);
197*7c478bd9Sstevel@tonic-gate 
198*7c478bd9Sstevel@tonic-gate 	if (ep == NULL) {
199*7c478bd9Sstevel@tonic-gate 		ep = dgettext(TEXT_DOMAIN, dcs_err_fmt[DCS_CFGA_UNKNOWN]);
200*7c478bd9Sstevel@tonic-gate 	}
201*7c478bd9Sstevel@tonic-gate 
202*7c478bd9Sstevel@tonic-gate 	/*
203*7c478bd9Sstevel@tonic-gate 	 * Check if a platform specific message was provided, and
204*7c478bd9Sstevel@tonic-gate 	 * generate the appropriate message.
205*7c478bd9Sstevel@tonic-gate 	 */
206*7c478bd9Sstevel@tonic-gate 	if ((err_str != NULL) && (*err_str != '\0')) {
207*7c478bd9Sstevel@tonic-gate 		snprintf(buf, MAX_MSG_LEN, "%s: %s\n", ep, err_str);
208*7c478bd9Sstevel@tonic-gate 	} else {
209*7c478bd9Sstevel@tonic-gate 		snprintf(buf, MAX_MSG_LEN, "%s\n", ep);
210*7c478bd9Sstevel@tonic-gate 	}
211*7c478bd9Sstevel@tonic-gate 
212*7c478bd9Sstevel@tonic-gate 	return (buf);
213*7c478bd9Sstevel@tonic-gate }
214*7c478bd9Sstevel@tonic-gate 
215*7c478bd9Sstevel@tonic-gate 
216*7c478bd9Sstevel@tonic-gate /*
217*7c478bd9Sstevel@tonic-gate  * dcs_dbg:
218*7c478bd9Sstevel@tonic-gate  *
219*7c478bd9Sstevel@tonic-gate  * Output a debugging message to a logfile using syslog(3C). The bits
220*7c478bd9Sstevel@tonic-gate  * in the debug mask specify the category of the message. They have
221*7c478bd9Sstevel@tonic-gate  * the following meanings:
222*7c478bd9Sstevel@tonic-gate  *
223*7c478bd9Sstevel@tonic-gate  * 		0x1 - the string contains basic information
224*7c478bd9Sstevel@tonic-gate  *		0x2 - the string contains message information
225*7c478bd9Sstevel@tonic-gate  *		0x4 - the string contains session information
226*7c478bd9Sstevel@tonic-gate  *		0x8 - the string contains state information
227*7c478bd9Sstevel@tonic-gate  *
228*7c478bd9Sstevel@tonic-gate  * The debug mask is compared to the global value of dcs_debug which is
229*7c478bd9Sstevel@tonic-gate  * set through a command line option. This determines whether or not
230*7c478bd9Sstevel@tonic-gate  * to output the message to the logfile.
231*7c478bd9Sstevel@tonic-gate  */
232*7c478bd9Sstevel@tonic-gate void
dcs_dbg(int dbg_mask,char * fmt,...)233*7c478bd9Sstevel@tonic-gate dcs_dbg(int dbg_mask, char *fmt, ...)
234*7c478bd9Sstevel@tonic-gate {
235*7c478bd9Sstevel@tonic-gate 	va_list		vap;
236*7c478bd9Sstevel@tonic-gate 	char		err_str[MAX_MSG_LEN];
237*7c478bd9Sstevel@tonic-gate 	char		syslog_str[MAX_MSG_LEN];
238*7c478bd9Sstevel@tonic-gate 
239*7c478bd9Sstevel@tonic-gate 
240*7c478bd9Sstevel@tonic-gate 	if ((dcs_debug & dbg_mask) == 0) {
241*7c478bd9Sstevel@tonic-gate 		return;
242*7c478bd9Sstevel@tonic-gate 	}
243*7c478bd9Sstevel@tonic-gate 
244*7c478bd9Sstevel@tonic-gate 	va_start(vap, fmt);
245*7c478bd9Sstevel@tonic-gate 	(void) vsnprintf(err_str, MAX_MSG_LEN, fmt, vap);
246*7c478bd9Sstevel@tonic-gate 	va_end(vap);
247*7c478bd9Sstevel@tonic-gate 
248*7c478bd9Sstevel@tonic-gate 	/* prepend session identifier */
249*7c478bd9Sstevel@tonic-gate 	snprintf(syslog_str, MAX_MSG_LEN, SYSLOG_FMT, curr_ses_id(), err_str);
250*7c478bd9Sstevel@tonic-gate 
251*7c478bd9Sstevel@tonic-gate 	syslog(LOG_DEBUG, syslog_str);
252*7c478bd9Sstevel@tonic-gate 
253*7c478bd9Sstevel@tonic-gate 	if (standalone) {
254*7c478bd9Sstevel@tonic-gate 		fprintf(stderr, "%s\n", syslog_str);
255*7c478bd9Sstevel@tonic-gate 	}
256*7c478bd9Sstevel@tonic-gate }
257*7c478bd9Sstevel@tonic-gate 
258*7c478bd9Sstevel@tonic-gate 
259*7c478bd9Sstevel@tonic-gate /*
260*7c478bd9Sstevel@tonic-gate  * print_msg_hdr:
261*7c478bd9Sstevel@tonic-gate  *
262*7c478bd9Sstevel@tonic-gate  * Print selected information from the header for a given message. The
263*7c478bd9Sstevel@tonic-gate  * information logged includes the information needed to track the flow
264*7c478bd9Sstevel@tonic-gate  * of messages: opcode, send/receive, request/reply, and success/failure.
265*7c478bd9Sstevel@tonic-gate  */
266*7c478bd9Sstevel@tonic-gate void
print_msg_hdr(dcs_msg_type_t type,rdr_msg_hdr_t * hdr)267*7c478bd9Sstevel@tonic-gate print_msg_hdr(dcs_msg_type_t type, rdr_msg_hdr_t *hdr)
268*7c478bd9Sstevel@tonic-gate {
269*7c478bd9Sstevel@tonic-gate 	static char *type_str[] = {
270*7c478bd9Sstevel@tonic-gate 		"INVALID TYPE",
271*7c478bd9Sstevel@tonic-gate 		"RDR_REQUEST",
272*7c478bd9Sstevel@tonic-gate 		"RDR_REPLY"
273*7c478bd9Sstevel@tonic-gate 	};
274*7c478bd9Sstevel@tonic-gate 
275*7c478bd9Sstevel@tonic-gate 	static char *op_str[] = {
276*7c478bd9Sstevel@tonic-gate 		"RDR_INVALID_OP",
277*7c478bd9Sstevel@tonic-gate 		"RDR_SES_REQ",
278*7c478bd9Sstevel@tonic-gate 		"RDR_SES_ESTBL",
279*7c478bd9Sstevel@tonic-gate 		"RDR_SES_END",
280*7c478bd9Sstevel@tonic-gate 		"RDR_CONF_CHANGE_STATE",
281*7c478bd9Sstevel@tonic-gate 		"RDR_CONF_PRIVATE_FUNC",
282*7c478bd9Sstevel@tonic-gate 		"RDR_CONF_TEST",
283*7c478bd9Sstevel@tonic-gate 		"RDR_CONF_LIST_EXT",
284*7c478bd9Sstevel@tonic-gate 		"RDR_CONF_HELP",
285*7c478bd9Sstevel@tonic-gate 		"RDR_CONF_AP_ID_CMP",
286*7c478bd9Sstevel@tonic-gate 		"RDR_CONF_ABORT_CMD",
287*7c478bd9Sstevel@tonic-gate 		"RDR_CONF_CONFIRM_CALLBACK",
288*7c478bd9Sstevel@tonic-gate 		"RDR_CONF_MSG_CALLBACK",
289*7c478bd9Sstevel@tonic-gate 		"RDR_RSRC_INFO"
290*7c478bd9Sstevel@tonic-gate 	};
291*7c478bd9Sstevel@tonic-gate 
292*7c478bd9Sstevel@tonic-gate 	assert(hdr);
293*7c478bd9Sstevel@tonic-gate 
294*7c478bd9Sstevel@tonic-gate 	/* clamp an invalid opcode */
295*7c478bd9Sstevel@tonic-gate 	if (hdr->message_opcode >= RDR_NUM_OPS) {
296*7c478bd9Sstevel@tonic-gate 		hdr->message_opcode = 0;
297*7c478bd9Sstevel@tonic-gate 	}
298*7c478bd9Sstevel@tonic-gate 
299*7c478bd9Sstevel@tonic-gate 	/* clamp an invalid type */
300*7c478bd9Sstevel@tonic-gate 	if (hdr->data_type > RDR_REPLY) {
301*7c478bd9Sstevel@tonic-gate 		hdr->data_type = 0;
302*7c478bd9Sstevel@tonic-gate 	}
303*7c478bd9Sstevel@tonic-gate 
304*7c478bd9Sstevel@tonic-gate 	DCS_DBG(DBG_MSG, "message %s: <%s, %s%s>",
305*7c478bd9Sstevel@tonic-gate 	    (type == DCS_RECEIVE) ? "received" : "sent",
306*7c478bd9Sstevel@tonic-gate 	    op_str[hdr->message_opcode],
307*7c478bd9Sstevel@tonic-gate 	    type_str[hdr->data_type],
308*7c478bd9Sstevel@tonic-gate 	    ((hdr->data_type == RDR_REQUEST) ||
309*7c478bd9Sstevel@tonic-gate 	    (hdr->message_opcode == RDR_CONF_AP_ID_CMP)) ? "" :
310*7c478bd9Sstevel@tonic-gate 	    (hdr->status == RDR_SUCCESS) ? ", RDR_SUCCESS" :
311*7c478bd9Sstevel@tonic-gate 	    ", RDR_FAILED");
312*7c478bd9Sstevel@tonic-gate }
313