$NetBSD: libiscsi.3,v 1.8 2014/03/18 18:20:36 riastradh Exp $

Copyright (c) 2009 The NetBSD Foundation, Inc.
All rights reserved.

This manual page is derived from software contributed to The
NetBSD Foundation by Alistair Crooks (agc@NetBSD.org)

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

.Dd February 19, 2011 .Dt LIBISCSI 3 .Os .Sh NAME .Nm libiscsi .Nd iSCSI network storage protocol implementation .Sh LIBRARY .Lb libiscsi .Sh SYNOPSIS n iscsi.h .Ft int .Fo iscsi_target_set_defaults .Fa "iscsi_target_t *target" .Fc .Ft int .Fo iscsi_target_start .Fa "iscsi_target_t *target" .Fc .Ft int .Fo iscsi_target_listen .Fa "iscsi_target_t *target" .Fc .Ft int .Fo iscsi_target_shutdown .Fa "iscsi_target_t *target" .Fc .Ft void .Fo iscsi_target_write_pidfile .Fa "const char *filename" .Fc .Ft int .Fo iscsi_target_setvar .Fa "iscsi_target_t *target" "const char *name" "const char *value" .Fc .Ft char * .Fo iscsi_target_getvar .Fa "iscsi_target_t *target" "const char *name" .Fc .Ft int .Fo iscsi_initiator_set_defaults .Fa "iscsi_initiator_t *initiator" .Fc .Ft int .Fo iscsi_initiator_start .Fa "iscsi_initiator_t *initiator" .Fc .Ft int .Fo iscsi_initiator_discover .Fa "iscsi_initiator_t *initiator" "char *x" "uint64_t a" "int b" .Fc .Ft int .Fo iscsi_initiator_shutdown .Fa "iscsi_initiator_t *initiator" .Fc .Ft int .Fo iscsi_initiator_setvar .Fa "iscsi_initiator_t *initiator" "const char *name" "const char *value" .Fc .Ft char * .Fo iscsi_initiator_getvar .Fa "iscsi_initiator_t *initiator" "const char *name" .Fc .Sh DESCRIPTION .Nm is a library interface to the iSCSI target and initiator. This conforms to IETF RFC 3720. The corresponding command line utilities for .Nm are .Xr iscsi-initiator 8 and .Xr iscsi-target 8 .

p In normal operation, a process acting as a target (i.e. presenting storage to the network) will call .Fn iscsi_target_set_defaults and will then set various values using the .Fn iscsi_target_setvar function. The value of a variable can be retrieved at any time using the .Fn iscsi_target_getvar function. When all of the variables have been set, the .Fn iscsi_target_start function is called, and the block storage will be served up by the process.

p A useful illustration of the use of these functions can be found in the source code to the .Xr iscsi-target 8 utility.

p The .Nm library also provides an implementation of the client end of the iSCSI subsystem, which is known as the initiator. The process acting as an initiator will first call the .Fn iscsi_initiator_set_defaults function, to set default values for the initiator variables. Once all the values have been set to the user preferences using the .Fn iscsi_initiator_setvar function, then the .Fn iscsi_initiator_start function is called.

p The .Nm library can be used to perform iSCSI device discovery by calling the .Fn iscsi_initiator_discovery function. This will return a list of all the iSCSI targets which are serving up block storage according to the variables which have already been set. .Sh SEE ALSO .Xr iscsi-initiator 8 , .Xr iscsi-target 8 .Sh HISTORY The .Nm library first appeared in .Nx 4.0 . This programmatic interface to the iSCSI subsystem first appeared in .Nx 6.0 . .Sh AUTHORS .An Alistair Crooks Aq Mt agc@NetBSD.org .