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