xref: /netbsd-src/external/bsd/iscsi/dist/src/lib/libiscsi.3 (revision 6cb10275d08f045e872662c371fe2f2724f2f6e6)
1.\" $NetBSD: libiscsi.3,v 1.8 2014/03/18 18:20:36 riastradh Exp $
2.\"
3.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This manual page is derived from software contributed to The
7.\" NetBSD Foundation by Alistair Crooks (agc@NetBSD.org)
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd February 19, 2011
31.Dt LIBISCSI 3
32.Os
33.Sh NAME
34.Nm libiscsi
35.Nd iSCSI network storage protocol implementation
36.Sh LIBRARY
37.Lb libiscsi
38.Sh SYNOPSIS
39.In iscsi.h
40.Ft int
41.Fo iscsi_target_set_defaults
42.Fa "iscsi_target_t *target"
43.Fc
44.Ft int
45.Fo iscsi_target_start
46.Fa "iscsi_target_t *target"
47.Fc
48.Ft int
49.Fo iscsi_target_listen
50.Fa "iscsi_target_t *target"
51.Fc
52.Ft int
53.Fo iscsi_target_shutdown
54.Fa "iscsi_target_t *target"
55.Fc
56.Ft void
57.Fo iscsi_target_write_pidfile
58.Fa "const char *filename"
59.Fc
60.Ft int
61.Fo iscsi_target_setvar
62.Fa "iscsi_target_t *target" "const char *name" "const char *value"
63.Fc
64.Ft char *
65.Fo iscsi_target_getvar
66.Fa "iscsi_target_t *target" "const char *name"
67.Fc
68.Ft int
69.Fo iscsi_initiator_set_defaults
70.Fa "iscsi_initiator_t *initiator"
71.Fc
72.Ft int
73.Fo iscsi_initiator_start
74.Fa "iscsi_initiator_t *initiator"
75.Fc
76.Ft int
77.Fo iscsi_initiator_discover
78.Fa "iscsi_initiator_t *initiator" "char *x" "uint64_t a" "int b"
79.Fc
80.Ft int
81.Fo iscsi_initiator_shutdown
82.Fa "iscsi_initiator_t *initiator"
83.Fc
84.Ft int
85.Fo iscsi_initiator_setvar
86.Fa "iscsi_initiator_t *initiator" "const char *name" "const char *value"
87.Fc
88.Ft char *
89.Fo iscsi_initiator_getvar
90.Fa "iscsi_initiator_t *initiator" "const char *name"
91.Fc
92.Sh DESCRIPTION
93.Nm
94is a library interface to the iSCSI target and initiator.
95This conforms to IETF RFC 3720.
96The corresponding command line utilities for
97.Nm
98are
99.Xr iscsi-initiator 8
100and
101.Xr iscsi-target 8 .
102.Pp
103In normal operation, a process acting as
104a target (i.e. presenting storage to the network)
105will call
106.Fn iscsi_target_set_defaults
107and will then set various values using the
108.Fn iscsi_target_setvar
109function.
110The value of a variable can be retrieved
111at any time using the
112.Fn iscsi_target_getvar
113function.
114When all of the variables have been set,
115the
116.Fn iscsi_target_start
117function is called, and the block storage will be
118served up by the process.
119.Pp
120A useful illustration of the use of these functions
121can be found in the source code to the
122.Xr iscsi-target 8
123utility.
124.Pp
125The
126.Nm
127library also provides an implementation of the client
128end of the iSCSI subsystem, which is known as the
129initiator.
130The process acting as an initiator will first call the
131.Fn iscsi_initiator_set_defaults
132function, to set default values for the initiator variables.
133Once all the values have been set to the user preferences
134using the
135.Fn iscsi_initiator_setvar
136function, then the
137.Fn iscsi_initiator_start
138function is called.
139.Pp
140The
141.Nm
142library can be used to perform iSCSI device discovery
143by calling the
144.Fn iscsi_initiator_discovery
145function.
146This will return a list of all the iSCSI targets which
147are serving up block storage according to the variables
148which have already been set.
149.Sh SEE ALSO
150.Xr iscsi-initiator 8 ,
151.Xr iscsi-target 8
152.Sh HISTORY
153The
154.Nm
155library first appeared in
156.Nx 4.0 .
157This programmatic interface to the
158iSCSI subsystem
159first appeared in
160.Nx 6.0 .
161.Sh AUTHORS
162.An Alistair Crooks Aq Mt agc@NetBSD.org .
163