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