1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
.\" $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
.In 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 .
.Pp
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.
.Pp
A useful illustration of the use of these functions
can be found in the source code to the
.Xr iscsi-target 8
utility.
.Pp
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.
.Pp
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 .
|