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