xref: /onnv-gate/usr/src/cmd/isns/isnsd/utils.c (revision 7836:4e95154b5b7a)
1*7836SJohn.Forte@Sun.COM /*
2*7836SJohn.Forte@Sun.COM  * CDDL HEADER START
3*7836SJohn.Forte@Sun.COM  *
4*7836SJohn.Forte@Sun.COM  * The contents of this file are subject to the terms of the
5*7836SJohn.Forte@Sun.COM  * Common Development and Distribution License (the "License").
6*7836SJohn.Forte@Sun.COM  * You may not use this file except in compliance with the License.
7*7836SJohn.Forte@Sun.COM  *
8*7836SJohn.Forte@Sun.COM  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7836SJohn.Forte@Sun.COM  * or http://www.opensolaris.org/os/licensing.
10*7836SJohn.Forte@Sun.COM  * See the License for the specific language governing permissions
11*7836SJohn.Forte@Sun.COM  * and limitations under the License.
12*7836SJohn.Forte@Sun.COM  *
13*7836SJohn.Forte@Sun.COM  * When distributing Covered Code, include this CDDL HEADER in each
14*7836SJohn.Forte@Sun.COM  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7836SJohn.Forte@Sun.COM  * If applicable, add the following below this CDDL HEADER, with the
16*7836SJohn.Forte@Sun.COM  * fields enclosed by brackets "[]" replaced with your own identifying
17*7836SJohn.Forte@Sun.COM  * information: Portions Copyright [yyyy] [name of copyright owner]
18*7836SJohn.Forte@Sun.COM  *
19*7836SJohn.Forte@Sun.COM  * CDDL HEADER END
20*7836SJohn.Forte@Sun.COM  */
21*7836SJohn.Forte@Sun.COM 
22*7836SJohn.Forte@Sun.COM /*
23*7836SJohn.Forte@Sun.COM  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24*7836SJohn.Forte@Sun.COM  * Use is subject to license terms.
25*7836SJohn.Forte@Sun.COM  */
26*7836SJohn.Forte@Sun.COM 
27*7836SJohn.Forte@Sun.COM #include <libintl.h>
28*7836SJohn.Forte@Sun.COM 
29*7836SJohn.Forte@Sun.COM #include "isns_utils.h"
30*7836SJohn.Forte@Sun.COM #include "isns_protocol.h"
31*7836SJohn.Forte@Sun.COM 
32*7836SJohn.Forte@Sun.COM char *
result_code_to_str(int code)33*7836SJohn.Forte@Sun.COM result_code_to_str(int code)
34*7836SJohn.Forte@Sun.COM {
35*7836SJohn.Forte@Sun.COM 	switch (code) {
36*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_SUCCESSFUL:
37*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Successful Operation"));
38*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_UNKNOWN_ERROR:
39*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Unknown Error"));
40*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_MSG_FORMAT_ERROR:
41*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Message Format Error"));
42*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_INVALID_REGIS:
43*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Invalid Registration"));
44*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_INVALID_QRY:
45*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Invalid Query"));
46*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_SRC_UNKNOWN:
47*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Source Unknown"));
48*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_SRC_ABSENT:
49*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Source Absent"));
50*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_SRC_UNAUTHORIZED:
51*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Source Unauthorized"));
52*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_NO_SUCH_ENTRY:
53*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("No Such Entry"));
54*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_VER_NOT_SUPPORTED:
55*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Version Not Supported"));
56*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_INTERNAL_ERROR:
57*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Internal Error"));
58*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_BUSY:
59*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Busy"));
60*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_OPTION_NOT_UNDERSTOOD:
61*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Option Not Understood"));
62*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_INVALID_UPDATE:
63*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Invalid Update"));
64*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_MSG_NOT_SUPPORTED:
65*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Message Not Supported"));
66*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_SCN_EVENT_REJECTED:
67*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("SCN Event Rejected"));
68*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_SCN_REGIS_REJECTED:
69*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("SCN Registration Rejected"));
70*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_ATTR_NOT_IMPL:
71*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Attribute Not Implemented"));
72*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_ESI_NOT_AVAILABLE:
73*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("ESI Not Available"));
74*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_INVALID_DEREGIS:
75*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Invalid Deregistration"));
76*7836SJohn.Forte@Sun.COM 	    case ISNS_RSP_REGIS_NOT_SUPPORTED:
77*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Registration Not Supported"));
78*7836SJohn.Forte@Sun.COM 	    case PARTIAL_SUCCESS:
79*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Partial_success"));
80*7836SJohn.Forte@Sun.COM 	    case PARTIAL_FAILURE:
81*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Partial failure"));
82*7836SJohn.Forte@Sun.COM 	    case ERR_DOOR_ALREADY_RUNNING:
83*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("iSNS managemnet door is already "
84*7836SJohn.Forte@Sun.COM 		    "running"));
85*7836SJohn.Forte@Sun.COM 	    case ERR_DOOR_CREATE_FAILED:
86*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Failed to create iSNS managemnet "
87*7836SJohn.Forte@Sun.COM 		    "door"));
88*7836SJohn.Forte@Sun.COM 	    case ERR_DOOR_MORE_SPACE:
89*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("More space needed to return the "
90*7836SJohn.Forte@Sun.COM 		    "response"));
91*7836SJohn.Forte@Sun.COM 	    case ERR_INVALID_MGMT_REQUEST:
92*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Invalid managmenet request"));
93*7836SJohn.Forte@Sun.COM 	    case ERR_NULL_XML_MESSAGE:
94*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Null XML request"));
95*7836SJohn.Forte@Sun.COM 	    case ERR_XML_VALID_OPERATION_NOT_FOUND:
96*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("XML Doc error: no valid operation "
97*7836SJohn.Forte@Sun.COM 		    "found"));
98*7836SJohn.Forte@Sun.COM 	    case ERR_XML_VALID_OBJECT_NOT_FOUND:
99*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("XML Doc error: no valid object "
100*7836SJohn.Forte@Sun.COM 		    "found"));
101*7836SJohn.Forte@Sun.COM 	    case ERR_XML_FAIL_TO_CREATE_WRITE_BUFFER:
102*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("failed to create XML witer buffer."));
103*7836SJohn.Forte@Sun.COM 	    case ERR_XML_FAIL_TO_GET_WRITEPTR:
104*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("failed to get XML writer pointer."));
105*7836SJohn.Forte@Sun.COM 	    case ERR_XML_INIT_READER_FAILED:
106*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("failed to initialize XML reader."));
107*7836SJohn.Forte@Sun.COM 	    case ERR_XML_PARSE_MEMORY_FAILED:
108*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("failed to parse XML doc in memory."));
109*7836SJohn.Forte@Sun.COM 	    case ERR_XML_FAILED_TO_SET_XPATH_CONTEXT:
110*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("failed to get XPATH context."));
111*7836SJohn.Forte@Sun.COM 	    case ERR_XML_FAILED_TO_REGISTER_NAMESPACE:
112*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("failed to register name space."));
113*7836SJohn.Forte@Sun.COM 	    case ERR_SYNTAX_MISSING_ROOT:
114*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("XML Syntax error: "
115*7836SJohn.Forte@Sun.COM 		    "isnsRequest root element missing"));
116*7836SJohn.Forte@Sun.COM 	    case ERR_SYNTAX_MISSING_NAME_ATTR:
117*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("XML Syntax error: missing a required "
118*7836SJohn.Forte@Sun.COM 		    " name attribute"));
119*7836SJohn.Forte@Sun.COM 	    case ERR_XML_OP_FAILED:
120*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("XML operation failed."));
121*7836SJohn.Forte@Sun.COM 	    case ERR_XML_STRDUP_FAILED:
122*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("XML strndup operation failed."));
123*7836SJohn.Forte@Sun.COM 	    case ERR_MALLOC_FAILED:
124*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("malloc failed."));
125*7836SJohn.Forte@Sun.COM 	    case ERR_DOOR_SERVER_DETECTED_INVALID_USER:
126*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Door server detected invalid user."));
127*7836SJohn.Forte@Sun.COM 	    case ERR_DOOR_SERVER_DETECTED_NOT_AUTHORIZED_USER:
128*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Door server detected unauthorized "
129*7836SJohn.Forte@Sun.COM 		    "user."));
130*7836SJohn.Forte@Sun.COM 	    case ERR_MATCHING_ISCSI_NODE_NOT_FOUND:
131*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Matching iSCSI Node not found."));
132*7836SJohn.Forte@Sun.COM 	    case ERR_MATCHING_NETWORK_ENTITY_NOT_FOUND:
133*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Network Entity not found."));
134*7836SJohn.Forte@Sun.COM 	    case ERR_NO_PORTAL_GROUP_FOUND:
135*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("No Portal Group not found."));
136*7836SJohn.Forte@Sun.COM 	    case ERR_MATCHING_PORTAL_NOT_FOUND:
137*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Matching Portal not found."));
138*7836SJohn.Forte@Sun.COM 	    case ERR_MATCHING_DD_NOT_FOUND:
139*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Matching Discovery Domain not "
140*7836SJohn.Forte@Sun.COM 		    "found."));
141*7836SJohn.Forte@Sun.COM 	    case ERR_MATCHING_DDSET_NOT_FOUND:
142*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Matching Discovery Domain Set "
143*7836SJohn.Forte@Sun.COM 		    "not found."));
144*7836SJohn.Forte@Sun.COM 	    case ERR_NO_ASSOCIATED_DD_FOUND:
145*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("No associated Discovery Domain "
146*7836SJohn.Forte@Sun.COM 		    "found."));
147*7836SJohn.Forte@Sun.COM 	    case ERR_NO_ASSOCIATED_DDSET_FOUND:
148*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("No associated Discovery Domain Set "
149*7836SJohn.Forte@Sun.COM 		    "found."));
150*7836SJohn.Forte@Sun.COM 	    case ERR_NO_SUCH_ASSOCIATION:
151*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("No such association."));
152*7836SJohn.Forte@Sun.COM 	    case ERR_ALREADY_ASSOCIATED:
153*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Member is already created."));
154*7836SJohn.Forte@Sun.COM 	    case ERR_NAME_IN_USE:
155*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Name is already in use."));
156*7836SJohn.Forte@Sun.COM 	    case ERR_DOOR_UCRED_FAILED:
157*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Failed to acquire user credentials "
158*7836SJohn.Forte@Sun.COM 		    "of management door caller"));
159*7836SJohn.Forte@Sun.COM 	    default:
160*7836SJohn.Forte@Sun.COM 		return ((char *)gettext("Unknown error code"));
161*7836SJohn.Forte@Sun.COM 	}
162*7836SJohn.Forte@Sun.COM }
163