summaryrefslogtreecommitdiff
path: root/usr/src/cmd/isns/isnsd/utils.c
blob: 099a2f225e0a6538395a2154d811fadc020c02be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License (the "License").
 * You may not use this file except in compliance with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */

/*
 * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#include <libintl.h>

#include "isns_utils.h"
#include "isns_protocol.h"

char *
result_code_to_str(int code)
{
	switch (code) {
	    case ISNS_RSP_SUCCESSFUL:
		return ((char *)gettext("Successful Operation"));
	    case ISNS_RSP_UNKNOWN_ERROR:
		return ((char *)gettext("Unknown Error"));
	    case ISNS_RSP_MSG_FORMAT_ERROR:
		return ((char *)gettext("Message Format Error"));
	    case ISNS_RSP_INVALID_REGIS:
		return ((char *)gettext("Invalid Registration"));
	    case ISNS_RSP_INVALID_QRY:
		return ((char *)gettext("Invalid Query"));
	    case ISNS_RSP_SRC_UNKNOWN:
		return ((char *)gettext("Source Unknown"));
	    case ISNS_RSP_SRC_ABSENT:
		return ((char *)gettext("Source Absent"));
	    case ISNS_RSP_SRC_UNAUTHORIZED:
		return ((char *)gettext("Source Unauthorized"));
	    case ISNS_RSP_NO_SUCH_ENTRY:
		return ((char *)gettext("No Such Entry"));
	    case ISNS_RSP_VER_NOT_SUPPORTED:
		return ((char *)gettext("Version Not Supported"));
	    case ISNS_RSP_INTERNAL_ERROR:
		return ((char *)gettext("Internal Error"));
	    case ISNS_RSP_BUSY:
		return ((char *)gettext("Busy"));
	    case ISNS_RSP_OPTION_NOT_UNDERSTOOD:
		return ((char *)gettext("Option Not Understood"));
	    case ISNS_RSP_INVALID_UPDATE:
		return ((char *)gettext("Invalid Update"));
	    case ISNS_RSP_MSG_NOT_SUPPORTED:
		return ((char *)gettext("Message Not Supported"));
	    case ISNS_RSP_SCN_EVENT_REJECTED:
		return ((char *)gettext("SCN Event Rejected"));
	    case ISNS_RSP_SCN_REGIS_REJECTED:
		return ((char *)gettext("SCN Registration Rejected"));
	    case ISNS_RSP_ATTR_NOT_IMPL:
		return ((char *)gettext("Attribute Not Implemented"));
	    case ISNS_RSP_ESI_NOT_AVAILABLE:
		return ((char *)gettext("ESI Not Available"));
	    case ISNS_RSP_INVALID_DEREGIS:
		return ((char *)gettext("Invalid Deregistration"));
	    case ISNS_RSP_REGIS_NOT_SUPPORTED:
		return ((char *)gettext("Registration Not Supported"));
	    case PARTIAL_SUCCESS:
		return ((char *)gettext("Partial_success"));
	    case PARTIAL_FAILURE:
		return ((char *)gettext("Partial failure"));
	    case ERR_DOOR_ALREADY_RUNNING:
		return ((char *)gettext("iSNS managemnet door is already "
		    "running"));
	    case ERR_DOOR_CREATE_FAILED:
		return ((char *)gettext("Failed to create iSNS managemnet "
		    "door"));
	    case ERR_DOOR_MORE_SPACE:
		return ((char *)gettext("More space needed to return the "
		    "response"));
	    case ERR_INVALID_MGMT_REQUEST:
		return ((char *)gettext("Invalid managmenet request"));
	    case ERR_NULL_XML_MESSAGE:
		return ((char *)gettext("Null XML request"));
	    case ERR_XML_VALID_OPERATION_NOT_FOUND:
		return ((char *)gettext("XML Doc error: no valid operation "
		    "found"));
	    case ERR_XML_VALID_OBJECT_NOT_FOUND:
		return ((char *)gettext("XML Doc error: no valid object "
		    "found"));
	    case ERR_XML_FAIL_TO_CREATE_WRITE_BUFFER:
		return ((char *)gettext("failed to create XML witer buffer."));
	    case ERR_XML_FAIL_TO_GET_WRITEPTR:
		return ((char *)gettext("failed to get XML writer pointer."));
	    case ERR_XML_INIT_READER_FAILED:
		return ((char *)gettext("failed to initialize XML reader."));
	    case ERR_XML_PARSE_MEMORY_FAILED:
		return ((char *)gettext("failed to parse XML doc in memory."));
	    case ERR_XML_FAILED_TO_SET_XPATH_CONTEXT:
		return ((char *)gettext("failed to get XPATH context."));
	    case ERR_XML_FAILED_TO_REGISTER_NAMESPACE:
		return ((char *)gettext("failed to register name space."));
	    case ERR_SYNTAX_MISSING_ROOT:
		return ((char *)gettext("XML Syntax error: "
		    "isnsRequest root element missing"));
	    case ERR_SYNTAX_MISSING_NAME_ATTR:
		return ((char *)gettext("XML Syntax error: missing a required "
		    " name attribute"));
	    case ERR_XML_OP_FAILED:
		return ((char *)gettext("XML operation failed."));
	    case ERR_XML_STRDUP_FAILED:
		return ((char *)gettext("XML strndup operation failed."));
	    case ERR_MALLOC_FAILED:
		return ((char *)gettext("malloc failed."));
	    case ERR_DOOR_SERVER_DETECTED_INVALID_USER:
		return ((char *)gettext("Door server detected invalid user."));
	    case ERR_DOOR_SERVER_DETECTED_NOT_AUTHORIZED_USER:
		return ((char *)gettext("Door server detected unauthorized "
		    "user."));
	    case ERR_MATCHING_ISCSI_NODE_NOT_FOUND:
		return ((char *)gettext("Matching iSCSI Node not found."));
	    case ERR_MATCHING_NETWORK_ENTITY_NOT_FOUND:
		return ((char *)gettext("Network Entity not found."));
	    case ERR_NO_PORTAL_GROUP_FOUND:
		return ((char *)gettext("No Portal Group not found."));
	    case ERR_MATCHING_PORTAL_NOT_FOUND:
		return ((char *)gettext("Matching Portal not found."));
	    case ERR_MATCHING_DD_NOT_FOUND:
		return ((char *)gettext("Matching Discovery Domain not "
		    "found."));
	    case ERR_MATCHING_DDSET_NOT_FOUND:
		return ((char *)gettext("Matching Discovery Domain Set "
		    "not found."));
	    case ERR_NO_ASSOCIATED_DD_FOUND:
		return ((char *)gettext("No associated Discovery Domain "
		    "found."));
	    case ERR_NO_ASSOCIATED_DDSET_FOUND:
		return ((char *)gettext("No associated Discovery Domain Set "
		    "found."));
	    case ERR_NO_SUCH_ASSOCIATION:
		return ((char *)gettext("No such association."));
	    case ERR_ALREADY_ASSOCIATED:
		return ((char *)gettext("Member is already created."));
	    case ERR_NAME_IN_USE:
		return ((char *)gettext("Name is already in use."));
	    case ERR_DOOR_UCRED_FAILED:
		return ((char *)gettext("Failed to acquire user credentials "
		    "of management door caller"));
	    default:
		return ((char *)gettext("Unknown error code"));
	}
}