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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*
27  * isnsadm_msg.c : handles the text message.
28  *
29  */
30 
31 
32 #include "isnsadm.h"
33 
getTextMessage(msg_code_t code)34 char *getTextMessage(msg_code_t code) {
35 	switch (code) {
36 		case UNKNOWN:
37 		    return (gettext("Error: Unknown Failure"));
38 		case ERROR_PARTIAL_SUCCESS:
39 		    return (gettext("\nError: one or more objects failed to "
40 		    "be processed.\nCheck the missing object from the "
41 		    "response and issue the operation individaully to get "
42 		    "the specific error information."));
43 		case ERROR_PARTIAL_FAILURE:
44 		    return (gettext("Error: one or more objects failed to "
45 		    "be processed.\nCheck the following failed object "
46 		    "and issue the operation individaully to get the specific "
47 		    "error information."));
48 		case ERROR_NO_ADDITIONAL_PARTIAL_FAILIRE_INFO:
49 		    return (gettext("No additional information avaialble from "
50 			"the response."));
51 		case ERROR_XML_READER_NULL:
52 		    return (gettext
53 			("Error: XML reader not set for respone document."));
54 		case ERROR_XML_RESPONSE_ERROR:
55 		    return (gettext
56 			("Error: Failed to get expected XML element."));
57 		case ERROR_XML_NAME_ATTR_NOT_FOUND:
58 		    return (gettext
59 			("Error: Name attribute not found in reponse."));
60 		case ERROR_XML_ID_ATTR_NOT_FOUND:
61 		    return (gettext
62 			("Error: Index attribute not found in reponse."));
63 		case ERROR_XML_TYPE_ATTR_NOT_FOUND:
64 		    return (gettext
65 			("Error: Node type not found in reponse."));
66 		case ERROR_XML_ALIAS_ATTR_NOT_FOUND:
67 		    return (gettext
68 			("Error: Node Alias not found in reponse."));
69 		case ERROR_XML_DD_OBJECT_NOT_FOUND:
70 		    return (gettext
71 		    ("Error: Discovery Domain object not found in reponse."));
72 		case ERROR_XML_DD_SET_OBJECT_NOT_FOUND:
73 		    return (gettext
74 		    ("Error: Discovery Domain Set object not found in "
75 		    "reponse."));
76 		case ERROR_XML_STATUS_ELEM_NOT_FOUND:
77 		    return (gettext
78 			("Error: Failed to get the status from the server."));
79 		case ERROR_XML_MESSAGE_ELEM_NOT_FOUND:
80 		    return (gettext
81 			("Error: Failed to get the error information."));
82 		case ERROR_XML_ISNSSERVER_ELEM_NOT_FOUND:
83 		    return (gettext
84 			("Error: Config information not found in reponse."));
85 		case ERROR_XML_CREATE_WRITER_FAILED:
86 		    return (gettext
87 			("Error: Failed to create the xml writer."));
88 		case ERROR_XML_CREATE_BUFFER_FAILED:
89 		    return (gettext
90 			("Error: Creating the buffer for XML writer."));
91 		case ERROR_XML_START_DOC_FAILED:
92 		    return (gettext
93 			("Error: Failed to create xml start doc."));
94 		case ERROR_XML_END_DOC_FAILED:
95 		    return (gettext
96 			("Error: Failed to create xml end doc."));
97 		case ERROR_XML_START_ELEMENT_FAILED:
98 		    return (gettext
99 			("Error: Failed to create xml start element."));
100 		case ERROR_XML_WRITE_ELEMENT_FAILED:
101 		    return (gettext
102 			("Error: Failed to create xml write element."));
103 		case ERROR_XML_END_ELEMENT_FAILED:
104 		    return (gettext
105 			("Error: Failed to create xml end element."));
106 		case ERROR_XML_WRITE_ATTRIBUTE_FAILED:
107 		    return (gettext
108 			("Error: Failed to write an xml attribute."));
109 		case ERROR_XML_STRDUP_FAILED:
110 		    return (gettext
111 			("Error: xml strdup failed."));
112 		case ERROR_XML_PARSE_MEMORY_FAILED:
113 		    return (gettext
114 			("Error: xml parse memory failed."));
115 		case ERROR_XML_XPATH_NEW_CONTEXT_FAILED:
116 		    return (gettext
117 			("Error: xml xpath context setup failed."));
118 		case ERROR_XML_ADD_CHILD_FAILED:
119 		    return (gettext
120 			("Error: xml add child failed."));
121 		case ERROR_DOOR_CALL_FAILED:
122 		    return (gettext
123 			("Error: call on the door to send a request to the "
124 			"server failed."));
125 		case ERROR_DOOR_OPEN_FAILED:
126 		    return (gettext
127 			("Error: open on the door to communicate to the "
128 			"server failed."));
129 		case ERROR_ISNS_SMF_SERVICE_NOT_ONLINE:
130 		    return (gettext
131 			("Error: network/isns_server smf(7) "
132 			"service is not online."));
133 		case ERROR_MALLOC_FAILED:
134 		    return (gettext
135 			("Error: memory allocation failed."));
136 		case ERROR_DDMEMBER_NOT_FOUND:
137 		    return (gettext
138 			("Error: no such Discovery Domain membership exist."));
139 		case ERROR_DDSETMEMBER_NOT_FOUND:
140 		    return (gettext
141 			("Error: no such Discovery Domain Set "
142 			"membership exist."));
143 		case ERROR_DDMEMBER_ALREADY_EXIST:
144 		    return (gettext
145 			("Error: Discovery Domain membership already exist."));
146 		case ERROR_DDSETMEMBER_ALREADY_EXIST:
147 		    return (gettext
148 			("Error: Discovery Domain Set membership "
149 			"already exist."));
150 		case ERROR_OPERATION_NOT_ALLOWED_FOR_DEFAULT_DD:
151 		    return (gettext
152 			("Error: operation not allowed for the Default "
153 			"Discovery Domain."));
154 		case ERROR_OPERATION_NOT_ALLOWED_FOR_DEFAULT_DDSET:
155 		    return (gettext
156 			("Error: operation not allowed for the Default "
157 			"Discovery Domain Set."));
158 		case ERROR_DD_NAME_IN_USE:
159 		    return (gettext
160 			("Error: Discovery Domain name already exists."));
161 		case ERROR_DDSET_NAME_IN_USE:
162 		    return (gettext
163 			("Error: Discovery Domain Set name already exist."));
164 		case ERROR_SERVER_BUSY:
165 		    return (gettext
166 			("Error: server reported busy status."));
167 		case ERROR_SERVER_INTERNAL_ERROR:
168 		    return (gettext
169 			("Error: server reported internal error status."));
170 		default:
171 		    return (gettext
172 			("Unknown error."));
173 	}
174 }
175