xref: /titanic_51/usr/src/cmd/isns/isnsd/isns_mgmt.h (revision 24fe0b3bf671e123467ce1df0b67cadd3614c8e4)
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 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _ISNS_MGMT_H
28 #define	_ISNS_MGMT_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <pthread.h>
35 #include <libxml/xmlstring.h>
36 
37 #define	ISNS_DOOR_NAME	"/var/run/isns_server_door"
38 #define	ISNS_ADMIN_WRITE_AUTH	"solaris.isnsmgr.write"
39 #define	ISNS_MAX_LABEL_LEN	50
40 #define	ISNS_MAX_NAME_LEN	256
41 #define	DOOR_DEFAULT_BUF_SIZE	4096
42 #define	MAX_DATA_COUNT	100
43 
44 
45 /* macro */
46 #define	XMLNCMP(x, y) (xmlStrncasecmp(xmlTextReaderConstName(x), \
47 	(const xmlChar *)y, xmlStrlen(xmlTextReaderConstName(x))))
48 #define	XMLNCMPVAL(x, y) (xmlStrncasecmp(xmlTextReaderConstValue(x), \
49 	(const xmlChar *)y, xmlStrlen(xmlTextReaderConstName(x))))
50 
51 /* operation element names */
52 #define	ISNSREQUEST	"isnsRequest"
53 #define	ISNSRESPONSE	"isnsResponse"
54 #define	RESULT		"result"
55 #define	GET		"get"
56 #define	ENUMERATE	"enumerate"
57 #define	GETASSOCIATED	"getAssociated"
58 #define	CREATEMODIFY	"createModify"
59 #define	DELETE		"delete"
60 
61 /* object element names */
62 #define	ISNSOBJECT	"isnsObject"
63 #define	ASSOCIATION	"Association"
64 #define	ISNSSERVER	"isnsServer"
65 #define	NODEOBJECT	"Node"
66 #define	DDOBJECT	"DiscoveryDomain"
67 #define	DDSETOBJECT	"DiscoveryDomainSet"
68 #define	DDOBJECTMEMBER	"DiscoveryDomainMember"
69 #define	DDSETOBJECTMEMBER	"DiscoveryDomainSetMember"
70 
71 /* iSNS NODE attribute element names - Network Entity */
72 #define	XMLNSATTR	"xmlns"
73 #define	XMLNSATTRVAL	"http://www.sun.com/schema/isnsmanagement"
74 
75 /* iSNS NODE attribute element names - Network Entity */
76 #define	NETWORKENTITY	"Network_Entity"
77 #define	ENTITYID	"Entity_ID"
78 #define	ENTITYPROTOCOL	"Entity_Protocol"
79 #define	MANAGEMENTIPADDR	"Management_IP_Addr"
80 #define	ENTITYREGTIMESTAMP	"Entity_Reg_Timestamp"
81 #define	PROTOCOLVERSIONRANGE	"Protocol_Version_Range"
82 #define	PROTOCOLMINVERSION	"minVersion"
83 #define	PROTOCOLMAXVERSION	"maxVersion"
84 #define	REGISTRATIONPERIOD	"Registration_Period"
85 
86 /* iSNS NODE attribute element names - Portal element names */
87 #define	SCNSUBSCRIPTION		"SCN_Subscription"
88 #define	SCNINITSELFONLY		"Initiator and Self information only"
89 #define	SCNTARGETSELFONLY	"Target and Self information only"
90 #define	SCNMGMTREG		"Management Registration/SCN"
91 #define	SCNOBJECTREMOVED	"Object Removed"
92 #define	SCNOBJECTADDED		"Object Added"
93 #define	SCNOBJECTUPDATED	"Object Updated"
94 #define	SCNMEMBERREMOVED	"DD/DD-Set Member Removed"
95 #define	SCNMEMBERADDED		"DD/DD-Set Member Added"
96 
97 #define	PORTAL		"Portal"
98 #define	REGISTRATIONPERIOD	"Registration_Period"
99 #define	IPADDR			"IP_Addr"
100 #define	UDPTCPPORT		"UDP_TCP_port"
101 #define	PORTTYPE		"Port_Type"
102 #define	UDPPORT			"UDP"
103 #define	TCPPORT			"TCP"
104 #define	PORTNUMBER		"Port_Number"
105 #define	GROUPTAG		"Group_Tag"
106 #define	SYMBOLICNAME		"Symbolic_Name"
107 #define	ESIINTERVAL		"ESI_Interval"
108 #define	ESIPORT			"ESI_Port"
109 #define	SCNPORT			"SCN_Port"
110 
111 /* iSNS DD set state element */
112 #define	ENABLEDELEM		"Enabled"
113 
114 /* iSNS DD Boot List element */
115 #define	BOOTLISTENABLEDELEM	"BootList_Enabled"
116 
117 /* iSNS server config elements */
118 #define	DATASTORELOCATION	"datastoreLocation"
119 #define	ESIRETRYTHRESHOLD	"esiRetryThreshold"
120 #define	DEFAULTDDDDSETENABLED	"defaultDD_DDsetEnabled"
121 #define	MANAGEMENTSCNENABLED	"managementSCNEnabled"
122 #define	CANCONTROLNODEMODIFYDDDDSET "canControlNodeModifyDD_DDset"
123 #define	CANINTIATORNODEMODIFYDDDDSET	"canIntiatorNodeModifyDD_DDset"
124 #define	CANTARGETNODEMODIFYDDDDSET  "canTargetNodeModifyDD_DDset"
125 #define	CONTROLNODENAME		"controlNodeName"
126 
127 /* object element type names */
128 #define	ISNSOBJECTTYPE	"isnsObjectType"
129 #define	ASSOCIATIONTYPE	"AssociationType"
130 
131 /* attribute  names */
132 #define	NAMEATTR	"name"
133 #define	IDATTR		"id"
134 #define	TYPEATTR	"type"
135 #define	ALIASATTR	"alias"
136 #define	NODENAMEATTR	"NodeName"
137 #define	DDNAMEATTR	"DDName"
138 #define	DDSETNAMEATTR	"DDsetName"
139 #define	EMPTYSTR	""
140 
141 /* Node type value names */
142 #define	INITIATORTYPE	"Initiator"
143 #define	TARGETTYPE	"Target"
144 #define	CONTROLNODETYPE	"Control"
145 #define	CONTROLNODETARGETTYPE	"Control/Target"
146 #define	CONTROLNODEINITIATORTYPE	"Control/Initiator"
147 #define	UNKNOWNTYPE	"Unknown"
148 
149 /* response related element names. */
150 #define	RESULTELEMENT	"result"
151 #define	STATUSELEMENT	"status"
152 #define	MESSAGEELEMENT	"message"
153 
154 /* response related element names. */
155 #define	XMLTRUE		"true"
156 #define	XMLFALSE	"false"
157 
158 typedef enum {
159     get_op = 100,
160     enumerate_op,
161     getAssociated_op,
162     createModify_op,
163     delete_op
164 } request_op;
165 
166 typedef enum {
167     member_to_container,
168     container_to_member
169 } association_req_t;
170 
171 typedef struct {
172     char *op_str;
173     request_op op_id;
174 } op_table_entry_t;
175 
176 typedef enum {
177     Node = 100,
178     DiscoveryDomain,
179     DiscoveryDomainSet,
180     DiscoveryDomainMember,
181     DiscoveryDomainSetMember,
182     ServerConfig
183 } object_type;
184 
185 typedef struct {
186     char *obj_str;
187     object_type obj_id;
188 } obj_table_entry_t;
189 
190 typedef struct thr_elem {
191     pthread_t   thr_id;
192     xmlChar	*doc;
193     struct thr_elem	*next;
194 } thr_elem_t;
195 
196 /*
197  * request entry with interger and string value
198  */
199 typedef struct {
200 	request_op  op;
201 	object_type obj;
202 } operation_t;
203 
204 typedef struct {
205 	xmlChar	*container;
206 	xmlChar	*member;
207 } assoc_pair_t;
208 
209 typedef struct {
210 	xmlChar	*name;
211 	uint32_t    *id;
212 	boolean_t   *enabled;
213 } object_attrlist_t;
214 
215 typedef union {
216 	xmlChar **data;
217 	assoc_pair_t    **pair;
218 	object_attrlist_t   **attrlist;
219 } req_data_ut;
220 
221 typedef struct {
222 	operation_t	op_info;
223 	association_req_t	assoc_req;
224 	uint_t		count;
225 	req_data_ut	req_data;
226 } request_t;
227 
228 #ifdef __cplusplus
229 }
230 #endif
231 
232 #endif /* _ISNS_MGMT_H */
233