xref: /onnv-gate/usr/src/cmd/isns/isnsd/isns_obj.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_OBJ_H
28*7836SJohn.Forte@Sun.COM #define	_ISNS_OBJ_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 #define	ENTITY_KEY		ISNS_EID_ATTR_ID
35*7836SJohn.Forte@Sun.COM #define	ISCSI_KEY		ISNS_ISCSI_NAME_ATTR_ID
36*7836SJohn.Forte@Sun.COM #define	PORTAL_KEY1		ISNS_PORTAL_IP_ADDR_ATTR_ID
37*7836SJohn.Forte@Sun.COM #define	PORTAL_KEY2		ISNS_PORTAL_PORT_ATTR_ID
38*7836SJohn.Forte@Sun.COM #define	PG_KEY1			ISNS_PG_ISCSI_NAME_ATTR_ID
39*7836SJohn.Forte@Sun.COM #define	PG_KEY2			ISNS_PG_PORTAL_IP_ADDR_ATTR_ID
40*7836SJohn.Forte@Sun.COM #define	PG_KEY3			ISNS_PG_PORTAL_PORT_ATTR_ID
41*7836SJohn.Forte@Sun.COM #define	PG_PGT			ISNS_PG_TAG_ATTR_ID
42*7836SJohn.Forte@Sun.COM #define	DD_KEY			ISNS_DD_ID_ATTR_ID
43*7836SJohn.Forte@Sun.COM #define	DDS_KEY			ISNS_DD_SET_ID_ATTR_ID
44*7836SJohn.Forte@Sun.COM 
45*7836SJohn.Forte@Sun.COM #define	ENTITY_END		ISNS_ENTITY_CERT_ATTR_ID
46*7836SJohn.Forte@Sun.COM #define	ISCSI_END		ISNS_ISCSI_AUTH_METHOD_ATTR_ID
47*7836SJohn.Forte@Sun.COM #define	PORTAL_END		ISNS_PORTAL_CERT_ATTR_ID
48*7836SJohn.Forte@Sun.COM #define	PG_END			ISNS_PG_NEXT_ID_ATTR_ID
49*7836SJohn.Forte@Sun.COM #define	DD_END			ISNS_DD_FEATURES_ATTR_ID
50*7836SJohn.Forte@Sun.COM #define	DDS_END			ISNS_DD_SET_STATUS_ATTR_ID
51*7836SJohn.Forte@Sun.COM 
52*7836SJohn.Forte@Sun.COM #define	IS_ENTITY_KEY(ID)	((ID) == ENTITY_KEY)
53*7836SJohn.Forte@Sun.COM #define	IS_ISCSI_KEY(ID)	((ID) == ISCSI_KEY)
54*7836SJohn.Forte@Sun.COM #define	IS_PORTAL_KEY1(ID)	((ID) == PORTAL_KEY1)
55*7836SJohn.Forte@Sun.COM #define	IS_PORTAL_KEY2(ID)	((ID) == PORTAL_KEY2)
56*7836SJohn.Forte@Sun.COM #define	IS_PG_KEY1(ID)		((ID) == PG_KEY1)
57*7836SJohn.Forte@Sun.COM #define	IS_PG_KEY2(ID)		((ID) == PG_KEY2)
58*7836SJohn.Forte@Sun.COM #define	IS_PG_KEY3(ID)		((ID) == PG_KEY3)
59*7836SJohn.Forte@Sun.COM #define	IS_PG_PGT(ID)		((ID) == PG_PGT)
60*7836SJohn.Forte@Sun.COM 
61*7836SJohn.Forte@Sun.COM #define	IS_ENTITY_ATTR(ID) \
62*7836SJohn.Forte@Sun.COM 	((ID) > ENTITY_KEY && (ID) <= ENTITY_END)
63*7836SJohn.Forte@Sun.COM #define	IS_ISCSI_ATTR(ID) \
64*7836SJohn.Forte@Sun.COM 	((ID) > ISCSI_KEY && (ID) <= ISCSI_END)
65*7836SJohn.Forte@Sun.COM #define	IS_PORTAL_ATTR(ID) \
66*7836SJohn.Forte@Sun.COM 	((ID) > PORTAL_KEY2 && (ID) <= PORTAL_END)
67*7836SJohn.Forte@Sun.COM #define	IS_PG_ATTR(ID) \
68*7836SJohn.Forte@Sun.COM 	((ID) > PG_KEY1 && (ID) <= PG_END)
69*7836SJohn.Forte@Sun.COM 
70*7836SJohn.Forte@Sun.COM /* functions */
71*7836SJohn.Forte@Sun.COM int obj_tab_init(struct cache *);
72*7836SJohn.Forte@Sun.COM 
73*7836SJohn.Forte@Sun.COM uint32_t set_obj_uid(void *, uint32_t);
74*7836SJohn.Forte@Sun.COM int extract_attr(isns_attr_t *, const isns_tlv_t *, int);
75*7836SJohn.Forte@Sun.COM int assign_attr(isns_attr_t *, const isns_attr_t *);
76*7836SJohn.Forte@Sun.COM void free_one_object(isns_obj_t *);
77*7836SJohn.Forte@Sun.COM void free_object(isns_obj_t *);
78*7836SJohn.Forte@Sun.COM isns_obj_t *obj_calloc(int);
79*7836SJohn.Forte@Sun.COM isns_obj_t *make_default_entity();
80*7836SJohn.Forte@Sun.COM int reg_get_entity(
81*7836SJohn.Forte@Sun.COM 	isns_obj_t **,
82*7836SJohn.Forte@Sun.COM 	isns_tlv_t **,
83*7836SJohn.Forte@Sun.COM 	uint16_t *
84*7836SJohn.Forte@Sun.COM );
85*7836SJohn.Forte@Sun.COM int reg_get_obj(
86*7836SJohn.Forte@Sun.COM 	isns_obj_t **,
87*7836SJohn.Forte@Sun.COM 	isns_attr_t *,
88*7836SJohn.Forte@Sun.COM 	isns_tlv_t **,
89*7836SJohn.Forte@Sun.COM 	uint16_t *
90*7836SJohn.Forte@Sun.COM );
91*7836SJohn.Forte@Sun.COM int reg_auth_src(isns_type_t, uint32_t, uchar_t *);
92*7836SJohn.Forte@Sun.COM int set_parent_obj(isns_obj_t *, uint32_t);
93*7836SJohn.Forte@Sun.COM int buff_child_obj(const isns_type_t, const isns_type_t,
94*7836SJohn.Forte@Sun.COM 	const void *, void const***);
95*7836SJohn.Forte@Sun.COM int update_child_obj(const isns_type_t, const uint32_t,
96*7836SJohn.Forte@Sun.COM 	void const***, int);
97*7836SJohn.Forte@Sun.COM int update_ref_obj(const isns_obj_t *);
98*7836SJohn.Forte@Sun.COM int verify_ref_obj(const isns_type_t, const uint32_t,
99*7836SJohn.Forte@Sun.COM 	void const***);
100*7836SJohn.Forte@Sun.COM int update_deref_obj(isns_obj_t *);
101*7836SJohn.Forte@Sun.COM uint32_t set_child_number(isns_obj_t *, int, uint16_t);
102*7836SJohn.Forte@Sun.COM 
103*7836SJohn.Forte@Sun.COM int key_cmp(lookup_ctrl_t *, isns_obj_t *);
104*7836SJohn.Forte@Sun.COM int register_object(isns_obj_t *, uint32_t *, int *);
105*7836SJohn.Forte@Sun.COM int register_assoc(isns_obj_t *, uint32_t *);
106*7836SJohn.Forte@Sun.COM int dereg_assoc(lookup_ctrl_t *);
107*7836SJohn.Forte@Sun.COM int dereg_object(lookup_ctrl_t *, int);
108*7836SJohn.Forte@Sun.COM int dereg_downwards(isns_obj_t *);
109*7836SJohn.Forte@Sun.COM int data_sync(int);
110*7836SJohn.Forte@Sun.COM 
111*7836SJohn.Forte@Sun.COM uint32_t obj_hval(void *, uint16_t, uint32_t *);
112*7836SJohn.Forte@Sun.COM int is_obj_equal(isns_obj_t *, isns_obj_t *);
113*7836SJohn.Forte@Sun.COM uint32_t get_obj_uid(const void *);
114*7836SJohn.Forte@Sun.COM uint32_t is_obj_there(lookup_ctrl_t *);
115*7836SJohn.Forte@Sun.COM uint32_t is_parent_there(uchar_t *);
116*7836SJohn.Forte@Sun.COM void *assoc_clone(void *, int);
117*7836SJohn.Forte@Sun.COM int obj_cmp(void *, void *, int);
118*7836SJohn.Forte@Sun.COM int add_object(void *);
119*7836SJohn.Forte@Sun.COM int replace_object(void *, void *, uint32_t *, int);
120*7836SJohn.Forte@Sun.COM #ifdef DEBUG
121*7836SJohn.Forte@Sun.COM void obj_dump(void *);
122*7836SJohn.Forte@Sun.COM uint32_t *get_child_n(isns_obj_t *, int);
123*7836SJohn.Forte@Sun.COM uint32_t get_ref_n(isns_obj_t *, int);
124*7836SJohn.Forte@Sun.COM #endif
125*7836SJohn.Forte@Sun.COM uint32_t get_ref_t(isns_obj_t *, isns_type_t);
126*7836SJohn.Forte@Sun.COM 
127*7836SJohn.Forte@Sun.COM uint32_t *const get_parent_p(const isns_obj_t *);
128*7836SJohn.Forte@Sun.COM uint32_t get_parent_uid(const isns_obj_t *);
129*7836SJohn.Forte@Sun.COM uint32_t *get_child_t(isns_obj_t *, int);
130*7836SJohn.Forte@Sun.COM int is_obj_online(const isns_obj_t *);
131*7836SJohn.Forte@Sun.COM 
132*7836SJohn.Forte@Sun.COM uint32_t get_timestamp(void);
133*7836SJohn.Forte@Sun.COM 
134*7836SJohn.Forte@Sun.COM #ifdef __cplusplus
135*7836SJohn.Forte@Sun.COM }
136*7836SJohn.Forte@Sun.COM #endif
137*7836SJohn.Forte@Sun.COM 
138*7836SJohn.Forte@Sun.COM #endif /* _ISNS_OBJ_H */
139