xref: /illumos-gate/usr/src/lib/libiscsit/common/libiscsit.h (revision 1b8adde7ba7d5e04395c141c5400dc2cffd7d809)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_LIBISCSIT_H
27 #define	_LIBISCSIT_H
28 
29 #ifndef _KERNEL
30 #include <libnvpair.h>
31 #include <sys/socket.h>
32 #endif
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #define	ISCSIT_MODNAME		"iscsit"
39 #define	ISCSIT_NODE		"/devices/pseudo/iscsit@0:iscsit"
40 
41 #define	MAX_TPGT	256
42 #define	CFG_TPGTLIST	"tpgt-list"
43 
44 /*
45  * Object Hierarchy
46  *
47  *  _______________________
48  * |                       |
49  * |  iSCSI Target Config  |
50  * |      it_config_t      |
51  * |_______________________|
52  *    |     |
53  *    |     |
54  *    |     |      ________     ________              ________
55  *    |     |     |        |   |        |            |        |
56  *    |     |     | Target |-->| Target |--  - -  -->| Target |
57  *    |     |     |________|   |________|            |________|
58  *    |     |           |
59  *    |     |           |
60  *    |     |           |
61  *    |     |           |       ______              ______
62  *    |     |           |      |      |            |      |
63  *    |     |           +----->| TPGT |--  - -  -->| TPGT |
64  *    |     |                  |______|            |______|
65  *    |     |                       |                   |
66  *    |  +--+                       |                   |
67  *    |  |   _______     _______    |         ______    |
68  *    |  |  |       |   |       |<--+        |      |<--+
69  *    |  +->|  TPG  |-->|  TPG  |--  - -  -->| TPG  |
70  *    |     |_______|   |_______|            |______|
71  *    |
72  *    |      ___________     ___________              ___________
73  *    |     |           |   |           |            |           |
74  *    +---->| Initiator |-->| Initiator |--  - -  -->| Initiator |
75  *          |  Context  |   |  Context  |            |  Context  |
76  *          |___________|   |___________|            |___________|
77  *
78  *
79  * it_config_t includes a list of global properties
80  *
81  * Targets include a list of properties which override the global properties
82  * if set
83  *
84  * Initiators also include a list of properties but never inherit properties
85  * from the global config.
86  */
87 
88 /*  Maximum size of a Target Portal Group name */
89 #define	MAX_TPG_NAMELEN		256		/* XXX */
90 
91 /* Maximum size of an iSCSI Target Node name */
92 #define	MAX_ISCSI_NODENAMELEN	256		/* XXX */
93 
94 /*
95  * A target portal group tag is a binding between a target and a target
96  * portal group along with a numerical value associated with that binding.
97  * The numerical identifier is used as the 'target portal group tag' defined
98  * in RFC3720.
99  *
100  *  tpgt_tpg_name	The name of the target portal group associated with
101  *			this target portal group tag.
102  *  tpgt_generation	Generation number which is incremented each time the
103  *			structure changes.
104  *  tpgt_next		Next target portal group tag in th list of target portal
105  *			group tags.  If tpgt_next is NUL, then this is the last
106  *			target portal group in the list.
107  *  tpgt_tag		A numerical identifier that uniquely identifies a
108  *			target portal group within the associated target node.
109  */
110 typedef struct it_tpgt_s {
111 	char			tpgt_tpg_name[MAX_TPG_NAMELEN];
112 	uint64_t		tpgt_generation;
113 	struct it_tpgt_s	*tpgt_next;
114 	uint16_t		tpgt_tag;
115 } it_tpgt_t;
116 
117 /*
118  * An iSCSI target node is represented by an it_tgt_structure.  Each
119  * target node includes a list of associated target portal group tags
120  * and a list of properties.
121  *
122  *  tgt_name		The iSCSI target node name in either IQN or EUI
123  *			format (see RFC3720).
124  *  tgt_generation	Generation number which is incremented each time
125  *			the structure changes.
126  *  tgt_next		Next target in the list of targets.  If tgt_next
127  *			is NULL, then this is the last target in the list.
128  *  tgt_tpgt_list	A linked list representing the current target
129  *			portal group tags associated with this target.
130  *  tgt_tpgt_count	The number of currently defined target portal
131  *			group tags.
132  *  tgt_properties	An nvlist representation of the properties
133  *			associated with this target.  This list can be
134  *			manipulated using libnvpair(3lib), and should be
135  *			validated and stored using it_tgt_setprop().
136  *
137  * Target nvlist Properties:
138  *
139  *  nvlist Key		Type		Valid Values
140  *  --------------------------------------------------------------------
141  *  targetchapuser	string		any string or "none" to remove
142  *  targetchapsecret	string		string of at least 12 characters
143  *					but not more than 255 characters.
144  *					secret will be base64 encoded when
145  *					stored.
146  *  alias		string		any string or "none" to remove
147  *  auth		string		"radius", "chap", or "none"
148  *
149  */
150 typedef struct it_tgt_s {
151 	char			tgt_name[MAX_ISCSI_NODENAMELEN];
152 	uint64_t		tgt_generation;
153 	struct it_tgt_s		*tgt_next;
154 	it_tpgt_t		*tgt_tpgt_list;
155 	uint32_t		tgt_tpgt_count;
156 	nvlist_t		*tgt_properties;
157 } it_tgt_t;
158 
159 /*
160  * A target portal is represented by an IP address and a listening
161  * TCP port.
162  *
163  *  portal_addr		sockaddr_storage structure representing the
164  *			IPv4 or IPv6 address and TCP port associated
165  *			with the portal.
166  *  portal_next		Next portal in the list of portals.  If
167  *			portal_next is NULL, this is the last portal
168  *			in the list.
169  */
170 typedef struct it_portal_s {
171 	struct sockaddr_storage portal_addr;
172 	struct it_portal_s	*next;
173 } it_portal_t;
174 
175 /*
176  * A portal is an IP address and TCP port and a portal group is a set
177  * of portals.  Each defined portal belongs to exactly one portal group.
178  * Applications can associate a target portal group with a particular
179  * target using a target portal group name.  Initiators can only connect
180  * to targets through the portals associated with the target's target
181  * portal group tags.
182  *
183  *  tpg_name		Identifier for the target portal group.
184  *  tpg_generation	Generation number which is incremented each
185  *			time this structure changes.
186  *  tpg_next		Next target portal group in the list of target
187  *			portal groups.  If tpg_next is NULL, this is the
188  *			last target portal group in the list.
189  *  tpg_portal_count	Number of it_portal_t structures in the list.
190  *  tpg_portal_list	Linked list of it_portal_t structures.
191  */
192 typedef struct it_tpg_s {
193 	char			tpg_name[MAX_TPG_NAMELEN];
194 	uint64_t		tpg_generation;
195 	struct it_tpg_s		*tpg_next;
196 	uint32_t		tpg_portal_count;
197 	it_portal_t		*tpg_portal_list;
198 } it_tpg_t;
199 
200 /*
201  * A context representing a remote iSCSI initiator node.  The purpose
202  * of this structure is to maintain information specific to a remote
203  * initiator such as the CHAP username and CHAP secret.
204  *
205  *  ini_name		the iSCSI node name of the remote initiator.
206  *  ini_generation	Generation number which is incremented each
207  *			time this structure changes.
208  *  ini_next		Next initiator in the list of initiators.
209  *			If ini_next is NULL, this is the last initiator
210  *			in the list.
211  *  ini_properties	Name/Value list containing the properties
212  *			associated with the initiator context.  This list
213  *			can be manipulated using libnvpair(3lib), and should
214  *			be validated and stored using it_ini_setprop().
215  *
216  * Initiator nvlist Properties:
217  *
218  *  nvlist Key		Type		Valid Values
219  *  --------------------------------------------------------------------
220  *  chapuser		string		any string
221  *  chapsecret		string		string of at least 12 characters
222  *					but not more than 255 characters.
223  *					secret will be base64 encoded when
224  *					stored.
225  */
226 typedef struct it_ini_s {
227 	char		ini_name[MAX_ISCSI_NODENAMELEN];
228 	uint64_t	ini_generation;
229 	struct it_ini_s	*ini_next;
230 	nvlist_t	*ini_properties;
231 } it_ini_t;
232 
233 
234 /*
235  * This structure represents a complete configuration for the iscsit
236  * port provider.  In addition to the global configuration, it_config_t
237  * includes lists of child objects including targets, target portal
238  * groups and initiator contexts.  Each object includes a "generation"
239  * value which is used by the iscsit kernel driver to identify changes
240  * from one configuration update to the next.
241  *
242  *  stmf_token		A uint64_t that contains the value returned from a
243  *			successful call to stmfGetProviderDataProt(3STMF).
244  *			This token is used to verify that the configuration
245  *			data persistently stored in COMSTAR has not been
246  *			modified since this version was loaded.
247  *  config_version	Version number for this configuration structure
248  *  config_tgt_list	Linked list of target contexts representing the
249  *			currently defined targets.  Applications can add
250  *			targets to or remove targets from this list using
251  *			the it_tgt_create and it_tgt_delete functions.
252  *  config_tgt_count	The number of currently defined targets.
253  *  config_tpg_list	Linked list of target portal group contexts.
254  *			Applications can add or remove target portal groups
255  *			to/from this list using the it_tpg_create and
256  *			it_tpg_delete functions.
257  *  config_tpg_count	The number of currently defined target portal groups
258  *  config_ini_list	Linked list of initiator contexts.  Applications
259  *			can add initiator contexts or remove initiator
260  *			contexts from this list using the it_ini_create
261  *			and it_ini_delete functions.
262  *  config_ini_count	The number of currently defined initiator contexts.
263  *  config_global_properties
264  *			Name/Value list representing the current global
265  *			property settings.  This list can be manipulated
266  *			using libnvpair(3lib), and should be validated
267  *			and stored using it_config_setprop().
268  *  config_isns_svr_list
269  *			Linked list of currently defined iSNS servers.
270  *			Applications can add or remove iSNS servers by
271  *			using the it_config_setprop() function and changing
272  *			the array of iSNS servers stored in the "isnsserver"
273  *			property.
274  *  config_isns_svr_count
275  *			The number of currently defined iSNS servers.
276  *
277  * Global nvlist Properties:
278  *
279  *  nvlist Key		Type		Valid Values
280  *  --------------------------------------------------------------------
281  *  alias		string		any string
282  *  auth		string		"radius", "chap", or "none"
283  *  isns		boolean		B_TRUE, B_FALSE
284  *  isnsserver		string array	Array of portal specifications of
285  *					the form IPaddress:port.  Port
286  *					is optional; if not specified, the
287  *					default iSNS port number of 3205 will
288  *					be used.  IPv6 addresses should
289  *					be enclosed in square brackets '[' ']'.
290  *					If "none" is specified, all defined
291  *					iSNS servers will be removed from the
292  *					configuration.
293  *  radiusserver	string		IPaddress:port specification as
294  *					described for 'isnsserver'.
295  *  radiussecret	string		string of at least 12 characters
296  *					but not more than 255 characters.
297  *					secret will be base64 encoded when
298  *					stored.
299  */
300 typedef struct it_config_s {
301 	uint64_t		stmf_token;
302 	uint32_t		config_version;
303 	it_tgt_t		*config_tgt_list;
304 	uint32_t		config_tgt_count;
305 	it_tpg_t		*config_tpg_list;
306 	uint32_t		config_tpg_count;
307 	it_ini_t		*config_ini_list;
308 	uint32_t		config_ini_count;
309 	it_portal_t		*config_isns_svr_list;
310 	uint32_t		config_isns_svr_count;
311 	nvlist_t		*config_global_properties;
312 } it_config_t;
313 
314 /*
315  * Function:  it_config_load()
316  *
317  * Allocate and create an it_config_t structure representing the
318  * current iSCSI configuration.  This structure is compiled using
319  * the 'provider' data returned by stmfGetProviderData().  If there
320  * is no provider data associated with iscsit, the it_config_t
321  * structure will be set to a default configuration.
322  *
323  * Parameters:
324  *    cfg		A C representation of the current iSCSI configuration
325  *
326  * Return Values:
327  *    0			Success
328  *    ENOMEM		Could not allocate resources
329  *    EINVAL		Invalid parameter
330  */
331 int
332 it_config_load(it_config_t **cfg);
333 
334 /*
335  * Function:  it_config_commit()
336  *
337  * Informs the iscsit service that the configuration has changed and
338  * commits the new configuration to persistent store by calling
339  * stmfSetProviderData.  This function can be called multiple times
340  * during a configuration sequence if necessary.
341  *
342  * Parameters:
343  *    cfg		A C representation of the current iSCSI configuration
344  *
345  * Return Values:
346  *    0			Success
347  *    ENOMEM		Could not allocate resources
348  *    EINVAL		Invalid it_config_t structure
349  *    STMF_ERROR_SERVICE_DATA_VERSION	Configuration was updated by another
350  *			client.  See stmfSetProviderDataProt().
351  */
352 int
353 it_config_commit(it_config_t *cfg);
354 
355 /*
356  * Function:  it_config_setprop()
357  *
358  * Validate the provided property list and set the global properties
359  * for iSCSI Target.  If errlist is not NULL, returns detailed
360  * errors for each property that failed.  The format for errorlist
361  * is key = property, value = error string.
362  *
363  * Parameters:
364  *
365  *    cfg		The current iSCSI configuration obtained from
366  *			it_config_load()
367  *    proplist		nvlist_t containing properties for this target.
368  *    errlist		(optional)  nvlist_t of errors encountered when
369  *			validating the properties.
370  *
371  * Return Values:
372  *    0			Success
373  *    ENOMEM		Could not allocate resources
374  *    EINVAL		Invalid property
375  *
376  */
377 int
378 it_config_setprop(it_config_t *cfg, nvlist_t *proplist, nvlist_t **errlist);
379 
380 /*
381  * Function:  it_config_free()
382  *
383  * Free any resources associated with the it_config_t structure.
384  *
385  * Parameters:
386  *    cfg		A C representation of the current iSCSI configuration
387  */
388 void
389 it_config_free(it_config_t *cfg);
390 
391 /*
392  * Function:  it_tgt_create()
393  *
394  * Allocate and create an it_tgt_t structure representing a new iSCSI
395  * target node.  If tgt_name is NULL, then a unique target node name will
396  * be generated automatically.  Otherwise, the value of tgt_name will be
397  * used as the target node name.  The new it_tgt_t structure is added to
398  * the target list (cfg_tgt_list) in the configuration structure, and the
399  * new target will not be instantiated until the modified configuration
400  * is committed by calling it_config_commit().
401  *
402  * Parameters:
403  *    cfg		The current iSCSI configuration obtained from
404  *			it_config_load()
405  *    tgt		Pointer to an iSCSI target structure
406  *    tgt_name		The target node name for the target to be created.
407  *			The name must be in either IQN or EUI format.  If
408  *			this value is NULL, a node name will be generated
409  *			automatically in IQN format.
410  *
411  * Return Values:
412  *    0			Success
413  *    ENOMEM		Could not allocate resources
414  *    EINVAL		Invalid parameter
415  *    EEXIST		The requested target node name is already configured
416  *    EFAULT		Invalid iSCSI target name
417  */
418 int
419 it_tgt_create(it_config_t *cfg, it_tgt_t **tgt, char *tgt_name);
420 
421 /*
422  * Function:  it_tgt_setprop()
423  *
424  * Validate the provided property list and set the properties for
425  * the specified target.  If errlist is not NULL, returns detailed
426  * errors for each property that failed.  The format for errorlist
427  * is key = property, value = error string.
428  *
429  * Parameters:
430  *
431  *    cfg		The current iSCSI configuration obtained from
432  *			it_config_load()
433  *    tgt		Pointer to an iSCSI target structure
434  *    proplist		nvlist_t containing properties for this target.
435  *    errlist		(optional)  nvlist_t of errors encountered when
436  *			validating the properties.
437  *
438  * Return Values:
439  *    0			Success
440  *    ENOMEM		Could not allocate resources
441  *    EINVAL		Invalid property
442  *
443  */
444 int
445 it_tgt_setprop(it_config_t *cfg, it_tgt_t *tgt, nvlist_t *proplist,
446     nvlist_t **errlist);
447 
448 
449 /*
450  * Function:  it_tgt_delete()
451  *
452  * Delete target represented by 'tgt', where 'tgt' is an existing
453  * it_tgt_t structure within the configuration 'cfg'.  The target removal
454  * will not take effect until the modified configuration is committed
455  * by calling it_config_commit().
456  *
457  * Parameters:
458  *    cfg		The current iSCSI configuration obtained from
459  *			it_config_load()
460  *    tgt		Pointer to an iSCSI target structure
461  *    force		Set the target to offline before removing it from
462  *			the config.  If not specified, the operation will
463  *			fail if the target is determined to be online.
464  *
465  * Return Values:
466  *    0			Success
467  *    EBUSY		Target is online
468  */
469 int
470 it_tgt_delete(it_config_t *cfg, it_tgt_t *tgt, boolean_t force);
471 
472 /*
473  * Function:  it_tpgt_create()
474  *
475  * Allocate and create an it_tpgt_t structure representing a new iSCSI
476  * target portal group tag.  The new it_tpgt_t structure is added to the
477  * target tpgt list (tgt_tpgt_list) in the it_tgt_t structure.  The new
478  * target portal group tag will not be instantiated until the modified
479  * configuration is committed by calling it_config_commit().
480  *
481  * Parameters:
482  *    cfg		The current iSCSI configuration obtained from
483  *			it_config_load()
484  *    tgt		Pointer to the iSCSI target structure associated
485  *			with the target portal group tag
486  *    tpgt		Pointer to a target portal group tag structure
487  *    tpg_name		The name of the TPG to be associated with this TPGT
488  *    tpgt_tag		16-bit numerical identifier for this TPGT.  Valid
489  *			values are 2 through 65535.  If tpgt_tag is '0',
490  *			this function will assign an appropriate tag number.
491  *			If tpgt_tag is != 0, and the requested number is
492  *			unavailable, another value will be chosen.
493  *
494  * Return Values:
495  *    0			Success
496  *    ENOMEM		Could not allocate resources
497  *    EINVAL		Invalid parameter
498  *    EEXIST		Specified TPG is already associated with the target
499  *    E2BIG		All tag numbers already in use
500  */
501 int
502 it_tpgt_create(it_config_t *cfg, it_tgt_t *tgt, it_tpgt_t **tpgt,
503     char *tpg_name, uint16_t tpgt_tag);
504 
505 /*
506  * Function:  it_tpgt_delete()
507  *
508  * Delete the target portal group tag represented by 'tpgt', where
509  * 'tpgt' is an existing is_tpgt_t structure within the target 'tgt'.
510  * The target portal group tag removal will not take effect until the
511  * modified configuation is committed by calling it_config_commit().
512  *
513  * Parameters:
514  *    cfg		The current iSCSI configuration obtained from
515  *			it_config_load()
516  *    tgt		Pointer to the iSCSI target structure associated
517  *			with the target portal group tag
518  *    tpgt		Pointer to a target portal group tag structure
519  */
520 void
521 it_tpgt_delete(it_config_t *cfg, it_tgt_t *tgt, it_tpgt_t *tpgt);
522 
523 /*
524  * Function:  it_tpg_create()
525  *
526  * Allocate and create an it_tpg_t structure representing a new iSCSI
527  * target portal group.  The new it_tpg_t structure is added to the global
528  * tpg list (cfg_tgt_list) in the it_config_t structure.  The new target
529  * portal group will not be instantiated until the modified configuration
530  * is committed by calling it_config_commit().
531  *
532  * Parameters:
533  *    cfg		The current iSCSI configuration obtained from
534  *			it_config_load()
535  *    tpg		Pointer to the it_tpg_t structure representing
536  *			the target portal group
537  *    tpg_name		Identifier for the target portal group
538  *    portal_ip_port	A string containing an appropriatedly formatted
539  *			IP address:port.  Both IPv4 and IPv6 addresses are
540  *			permitted.  This value becomes the first portal in
541  *			the TPG -- applications can add additional values
542  *			using it_portal_create() before committing the TPG.
543  * Return Values:
544  *    0			Success
545  *    ENOMEM		Cannot allocate resources
546  *    EINVAL		Invalid parameter
547  *    EEXIST		Portal already configured for another portal group
548  *			associated with this target.
549  */
550 int
551 it_tpg_create(it_config_t *cfg, it_tpg_t **tpg, char *tpg_name,
552     char *portal_ip_port);
553 
554 /*
555  * Function:  it_tpg_delete()
556  *
557  * Delete target portal group represented by 'tpg', where 'tpg' is an
558  * existing it_tpg_t structure within the global configuration 'cfg'.
559  * The target portal group removal will not take effect until the
560  * modified configuration is committed by calling it_config_commit().
561  *
562  * Parameters:
563  *    cfg		The current iSCSI configuration obtained from
564  *			it_config_load()
565  *    tpg		Pointer to the it_tpg_t structure representing
566  *			the target portal group
567  *    force		Remove this target portal group even if it's
568  *			associated with one or more targets.
569  *
570  * Return Values:
571  *    0			Success
572  *    EINVAL		Invalid parameter
573  *    EBUSY		Portal group associated with one or more targets.
574  */
575 int
576 it_tpg_delete(it_config_t *cfg, it_tpg_t *tpg, boolean_t force);
577 
578 /*
579  * Function:  it_portal_create()
580  *
581  * Add an it_portal_t structure representing a new portal to the specified
582  * target portal group.  The change to the target portal group will not take
583  * effect until the modified configuration is committed by calling
584  * it_config_commit().
585  *
586  * Parameters:
587  *    cfg		The current iSCSI configration obtained from
588  *			it_config_load()
589  *    tpg		Pointer to the it_tpg_t structure representing the
590  *			target portal group or "none" to remove
591  *    portal		Pointer to the it_portal_t structure representing
592  *			the portal
593  *    portal_ip_port	A string containing an appropriately formatted
594  *			IP address or IP address:port in either IPv4 or
595  *			IPv6 format.
596  * Return Values:
597  *    0			Success
598  *    ENOMEM		Could not allocate resources
599  *    EINVAL		Invalid parameter
600  *    EEXIST		Portal already configured for another portal group
601  */
602 int
603 it_portal_create(it_config_t *cfg, it_tpg_t *tpg, it_portal_t **portal,
604     char *portal_ip_port);
605 
606 /*
607  * Function:  it_portal_delete()
608  *
609  * Remove the specified portal from the specified target portal group.
610  * The portal removal will not take effect until the modified configuration
611  * is committed by calling it_config_commit().
612  *
613  * Parameters:
614  *    cfg		The current iSCSI configration obtained from
615  *			it_config_load()
616  *    tpg		Pointer to the it_tpg_t structure representing the
617  *			target portal group
618  *    portal		Pointer to the it_portal_t structure representing
619  *			the portal
620  */
621 void
622 it_portal_delete(it_config_t *cfg, it_tpg_t *tpg, it_portal_t *portal);
623 
624 /*
625  * Function:  it_ini_create()
626  *
627  * Add an initiator context to the global configuration. The new
628  * initiator context will not be instantiated until the modified
629  * configuration is committed by calling it_config_commit().
630  *
631  * Parameters:
632  *    cfg		The current iSCSI configration obtained from
633  *			it_config_load()
634  *    ini		Pointer to the it_ini_t structure representing
635  *			the initiator context.
636  *    ini_node_name	The iSCSI node name of the remote initiator.
637  *
638  * Return Values:
639  *    0			Success
640  *    ENOMEM		Could not allocate resources
641  *    EINVAL		Invalid parameter.
642  *    EEXIST		Initiator already configured
643  *    EFAULT		Invalid initiator name
644  */
645 int
646 it_ini_create(it_config_t *cfg, it_ini_t **ini, char *ini_node_name);
647 
648 /*
649  * Function:  it_ini_setprop()
650  *
651  * Validate the provided property list and set the initiator properties.
652  * If errlist is not NULL, returns detailed errors for each property
653  * that failed.  The format for errorlist is
654  *		 key = property, value = error string.
655  *
656  * Parameters:
657  *
658  *    ini		The initiator being updated.
659  *    proplist		nvlist_t containing properties for this target.
660  *    errlist		(optional)  nvlist_t of errors encountered when
661  *			validating the properties.
662  *
663  * Return Values:
664  *    0			Success
665  *    ENOMEM		Could not allocate resources
666  *    EINVAL		Invalid property
667  *
668  */
669 int
670 it_ini_setprop(it_ini_t *ini, nvlist_t *proplist, nvlist_t **errlist);
671 
672 /*
673  * Function:  it_ini_delete()
674  *
675  * Remove the specified initiator context from the global configuration.
676  * The removal will not take effect until the modified configuration is
677  * committed by calling it_config_commit().
678  *
679  * Parameters:
680  *    cfg		The current iSCSI configration obtained from
681  *			it_config_load()
682  *    ini		Pointer to the it_ini_t structure representing
683  *			the initiator context.
684  */
685 void
686 it_ini_delete(it_config_t *cfg, it_ini_t *ini);
687 
688 /*
689  * Function:  it_config_free()
690  *
691  * Free any resources associated with the it_config_t structure.
692  *
693  * Parameters:
694  *    cfg       A C representation of the current iSCSI configuration
695  */
696 void
697 it_config_free(it_config_t *cfg);
698 
699 /*
700  * Function:  it_tgt_free()
701  *
702  * Frees an it_tgt_t structure.  If tgt_next is not NULL, frees
703  * all structures in the list.
704  */
705 void
706 it_tgt_free(it_tgt_t *tgt);
707 
708 /*
709  * Function:  it_tpgt_free()
710  *
711  * Deallocates resources of an it_tpgt_t structure.  If tpgt->next
712  * is not NULL, frees all members of the list.
713  */
714 void
715 it_tpgt_free(it_tpgt_t *tpgt);
716 
717 /*
718  * Function:  it_tpg_free()
719  *
720  * Deallocates resources associated with an it_tpg_t structure.
721  * If tpg->next is not NULL, frees all members of the list.
722  */
723 void
724 it_tpg_free(it_tpg_t *tpg);
725 
726 /*
727  * Function:  it_ini_free()
728  *
729  * Deallocates resources of an it_ini_t structure. If ini->next is
730  * not NULL, frees all members of the list.
731  */
732 void
733 it_ini_free(it_ini_t *ini);
734 
735 /*
736  * Function:  validate_iscsi_name()
737  *
738  * Ensures the passed-in string is a valid IQN or EUI iSCSI name
739  */
740 boolean_t
741 validate_iscsi_name(char *in_name);
742 
743 #ifdef	__cplusplus
744 }
745 #endif
746 
747 #endif	/* _LIBISCSIT_H */
748