xref: /titanic_50/usr/src/cmd/isns/isnsadm/isnsadm.h (revision cd3e933325e68e23516a196a8fea7f49b1e497c3)
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 #ifndef _ISNSADM_H
27 #define	_ISNSADM_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <string.h>
36 #include <libintl.h>
37 #include <unistd.h>
38 #include <sys/types.h>
39 #include <netinet/in.h>
40 #include <inttypes.h>
41 #include <cmdparse.h>
42 
43 #ifdef _BIG_ENDIAN
44 #define	htonll(x)   (x)
45 #define	ntohll(x)   (x)
46 #else
47 #define	htonll(x)   ((((unsigned long long)htonl(x)) << 32) + htonl(x >> 32))
48 #define	ntohll(x)   ((((unsigned long long)ntohl(x)) << 32) + ntohl(x >> 32))
49 #endif
50 
51 /* DEFINES */
52 /* subcommands */
53 #define	LISTNODE		SUBCOMMAND(0)
54 #define	LISTDD			SUBCOMMAND(1)
55 #define	LISTDDSET		SUBCOMMAND(2)
56 #define	CREATEDD		SUBCOMMAND(3)
57 #define	CREATEDDSET		SUBCOMMAND(4)
58 #define	DELETEDD		SUBCOMMAND(5)
59 #define	DELETEDDSET		SUBCOMMAND(6)
60 #define	ADDNODE			SUBCOMMAND(7)
61 #define	ADDDD			SUBCOMMAND(8)
62 #define	REMOVENODE		SUBCOMMAND(9)
63 #define	REMOVEDD		SUBCOMMAND(10)
64 #define	MODIFYDD		SUBCOMMAND(11)
65 #define	MODIFYDDSET		SUBCOMMAND(12)
66 #define	ENABLEDDSET		SUBCOMMAND(13)
67 #define	DISABLEDDSET		SUBCOMMAND(14)
68 #define	SHOWCONFIG		SUBCOMMAND(15)
69 
70 /* reader lookup return value definition */
71 #define	NO_MATCH		0
72 #define	READER_MATCH		1
73 #define	END_READER_MATCH	2
74 
75 /* Association Request type */
76 typedef enum {
77 	dd_to_node,
78 	node_to_dd,
79 	dd_to_ddset,
80 	ddset_to_dd
81 } association_t;
82 
83 /* Modify Requet type */
84 typedef enum {
85 	dd_name_change,
86 	ddset_name_change,
87 	dds_state_change,
88 	dd_bootlist_feature_change
89 } modify_type;
90 
91 #define	COMMAND_SYNTAX_FAILED	1
92 
93 /*  msg code */
94 typedef enum {
95     SUBCOMMAND_SUCCESS = 200,
96     SUCCESS_WITH_NO_OBJECT,
97     ERROR_PARTIAL_SUCCESS,
98     ERROR_PARTIAL_FAILURE,
99     ERROR_NO_ADDITIONAL_PARTIAL_FAILIRE_INFO,
100     ERROR_XML_READER_NULL,
101     ERROR_XML_RESPONSE_ERROR,
102     ERROR_XML_NAME_ATTR_NOT_FOUND,
103     ERROR_XML_ID_ATTR_NOT_FOUND,
104     ERROR_XML_TYPE_ATTR_NOT_FOUND,
105     ERROR_XML_ALIAS_ATTR_NOT_FOUND,
106     ERROR_XML_DD_OBJECT_NOT_FOUND,
107     ERROR_XML_DD_SET_OBJECT_NOT_FOUND,
108     ERROR_XML_STATUS_ELEM_NOT_FOUND,
109     ERROR_XML_MESSAGE_ELEM_NOT_FOUND,
110     ERROR_XML_ISNSSERVER_ELEM_NOT_FOUND,
111     ERROR_XML_CREATE_BUFFER_FAILED,
112     ERROR_XML_CREATE_WRITER_FAILED,
113     ERROR_XML_START_DOC_FAILED,
114     ERROR_XML_END_DOC_FAILED,
115     ERROR_XML_START_ELEMENT_FAILED,
116     ERROR_XML_WRITE_ELEMENT_FAILED,
117     ERROR_XML_END_ELEMENT_FAILED,
118     ERROR_XML_WRITE_ATTRIBUTE_FAILED,
119     ERROR_XML_STRDUP_FAILED,
120     ERROR_XML_ADD_CHILD_FAILED,
121     ERROR_XML_PARSE_MEMORY_FAILED,
122     ERROR_XML_XPATH_NEW_CONTEXT_FAILED,
123     ERROR_DOOR_CALL_FAILED,
124     ERROR_DOOR_OPEN_FAILED,
125     ERROR_ISNS_SMF_SERVICE_NOT_ONLINE,
126     ERROR_MALLOC_FAILED,
127     ERROR_DDMEMBER_NOT_FOUND,
128     ERROR_DDSETMEMBER_NOT_FOUND,
129     ERROR_DDMEMBER_ALREADY_EXIST,
130     ERROR_DDSETMEMBER_ALREADY_EXIST,
131     ERROR_OPERATION_NOT_ALLOWED_FOR_DEFAULT_DD,
132     ERROR_OPERATION_NOT_ALLOWED_FOR_DEFAULT_DDSET,
133     ERROR_DD_NAME_IN_USE,
134     ERROR_DDSET_NAME_IN_USE,
135     ERROR_SERVER_BUSY,
136     ERROR_SERVER_INTERNAL_ERROR,
137     UNKNOWN
138 } msg_code_t;
139 
140 /* proto type */
141 char *getTextMessage(msg_code_t code);
142 
143 #ifdef	__cplusplus
144 }
145 #endif
146 
147 #endif /* _ISNSADM_H */
148