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  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _PERSISTENT_H
27 #define	_PERSISTENT_H
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 
34 #include <iscsi.h>
35 
36 /*
37  * Data Structures
38  */
39 
40 typedef struct persistent_param {
41 	uint32_t		p_bitmap;	/* parameter override bitmap */
42 	iscsi_login_params_t	p_params;
43 } persistent_param_t;
44 
45 typedef struct persistent_tunable_param {
46 	uint32_t		p_bitmap;	/* parameter override bitmap */
47 	iscsi_tunable_params_t	p_params;
48 } persistent_tunable_param_t;
49 
50 /*
51  * Function Prototypes
52  */
53 void		persistent_init();
54 boolean_t	persistent_load();
55 void		persistent_fini(void);
56 boolean_t	persistent_disc_meth_set(iSCSIDiscoveryMethod_t method);
57 iSCSIDiscoveryMethod_t	persistent_disc_meth_get(void);
58 boolean_t	persistent_disc_meth_clear(iSCSIDiscoveryMethod_t method);
59 boolean_t	persistent_initiator_name_set(char *p);
60 boolean_t	persistent_initiator_name_get(char *p, int size);
61 boolean_t	persistent_alias_name_set(char *p);
62 boolean_t	persistent_alias_name_get(char *p, int size);
63 boolean_t	persistent_static_addr_set(char *node, entry_t *e);
64 boolean_t	persistent_static_addr_next(void **v, char *node, entry_t *e);
65 boolean_t	persistent_static_addr_clear(uint32_t oid);
66 void		persistent_static_addr_lock(void);
67 void		persistent_static_addr_unlock(void);
68 boolean_t	persistent_isns_addr_set(entry_t *e);
69 boolean_t	persistent_isns_addr_next(void **v, entry_t *e);
70 boolean_t	persistent_isns_addr_clear(entry_t *e);
71 void		persistent_isns_addr_lock(void);
72 void		persistent_isns_addr_unlock(void);
73 boolean_t	persistent_disc_addr_set(entry_t *e);
74 boolean_t	persistent_disc_addr_next(void **v, entry_t *e);
75 boolean_t	persistent_disc_addr_clear(entry_t *e);
76 void		persistent_disc_addr_lock(void);
77 void		persistent_disc_addr_unlock(void);
78 boolean_t	persistent_param_set(char *node, persistent_param_t *param);
79 boolean_t	persistent_param_get(char *node, persistent_param_t *param);
80 boolean_t	persistent_param_next(void **v, char *node,
81 		    persistent_param_t *param);
82 boolean_t	persistent_param_clear(char *node);
83 void		persistent_param_lock(void);
84 void		persistent_param_unlock(void);
85 boolean_t	persistent_chap_set(char *node, iscsi_chap_props_t *chap);
86 boolean_t	persistent_chap_get(char *node, iscsi_chap_props_t *chap);
87 boolean_t	persistent_chap_next(void **v,  char *node,
88 		    iscsi_chap_props_t *chap);
89 boolean_t	persistent_chap_clear(char *node);
90 void		persistent_chap_lock(void);
91 void		persistent_chap_unlock(void);
92 boolean_t	persistent_radius_set(iscsi_radius_props_t *radius);
93 iscsi_nvfile_status_t	persistent_radius_get(iscsi_radius_props_t *radius);
94 boolean_t	persistent_auth_set(char *node, iscsi_auth_props_t *auth);
95 boolean_t	persistent_auth_get(char *node, iscsi_auth_props_t *auth);
96 boolean_t	persistent_auth_next(void **v, char *node,
97 		    iscsi_auth_props_t *auth);
98 boolean_t	persistent_auth_clear(char *node);
99 void		persistent_auth_lock(void);
100 void		persistent_auth_unlock(void);
101 void		persistent_dump_data(void);
102 boolean_t	persistent_set_config_session(char *node,
103 		    iscsi_config_sess_t *ics);
104 boolean_t	persistent_get_config_session(char *node,
105 		    iscsi_config_sess_t *ics);
106 boolean_t	persistent_get_tunable_param(char *node,
107 		    persistent_tunable_param_t *tpsg);
108 boolean_t	persistent_set_tunable_param(char *node,
109 		    persistent_tunable_param_t *tpss);
110 
111 #ifdef __cplusplus
112 }
113 #endif
114 
115 #endif /* _PERSISTENT_H */
116