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