libiscsi
Main Page
Namespaces
Data Structures
Files
File List
Globals
libiscsi.h
Go to the documentation of this file.
1
/*
2
* iSCSI Administration library
3
*
4
* Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved.
5
* Copyright (C) 2008-2009 Hans de Goede <hdegoede@redhat.com>
6
* maintained by open-iscsi@googlegroups.com
7
*
8
* This program is free software; you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published
10
* by the Free Software Foundation; either version 2 of the License, or
11
* (at your option) any later version.
12
*
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
17
*
18
* See the file COPYING included with this distribution for more details.
19
*/
20
21
#ifndef __LIBISCSI_H
22
#define __LIBISCSI_H
23
24
#include <netdb.h>
25
26
#ifdef __cplusplus
27
extern
"C"
{
28
#endif
/* __cplusplus */
29
30
#if __GNUC__ >= 4
31
#define PUBLIC __attribute__ ((visibility("default")))
32
#else
33
#define PUBLIC
34
#endif
35
40
#define LIBISCSI_VALUE_MAXLEN 256
41
46
enum
libiscsi_auth_t
{
47
libiscsi_auth_none
,
48
libiscsi_auth_chap
,
49
};
50
57
struct
libiscsi_context
;
58
63
struct
libiscsi_node
{
64
char
name
[
LIBISCSI_VALUE_MAXLEN
] ;
65
int
tpgt
;
66
/* Note open-iscsi has some code in place for multiple connections in one
67
node record and thus multiple address / port combi's, but this does not
68
get used anywhere, so we keep things simple and assume one connection */
69
char
address
[NI_MAXHOST] ;
70
int
port
;
71
char
iface
[
LIBISCSI_VALUE_MAXLEN
] ;
72
};
73
80
struct
libiscsi_chap_auth_info
{
81
char
username
[
LIBISCSI_VALUE_MAXLEN
] ;
82
char
password
[
LIBISCSI_VALUE_MAXLEN
] ;
83
char
reverse_username
[
LIBISCSI_VALUE_MAXLEN
] ;
84
char
reverse_password
[
LIBISCSI_VALUE_MAXLEN
] ;
85
};
86
91
struct
libiscsi_auth_info
{
92
enum
libiscsi_auth_t
method
;
93
union
{
94
struct
libiscsi_chap_auth_info
chap
;
95
} ;
96
};
97
105
PUBLIC
struct
libiscsi_context
*
libiscsi_init
(
void
);
106
114
PUBLIC
void
libiscsi_cleanup
(
struct
libiscsi_context
*context);
115
141
PUBLIC
int
libiscsi_discover_sendtargets
(
struct
libiscsi_context
*context,
142
const
char
*address,
int
port,
const
struct
libiscsi_auth_info
*auth_info,
143
int
*nr_found,
struct
libiscsi_node
**found_nodes);
144
167
PUBLIC
int
libiscsi_discover_firmware
(
struct
libiscsi_context
*context,
168
int
*nr_found,
struct
libiscsi_node
**found_nodes);
169
181
PUBLIC
int
libiscsi_verify_auth_info
(
struct
libiscsi_context
*context,
182
const
struct
libiscsi_auth_info
*auth_info);
183
207
PUBLIC
int
libiscsi_node_set_auth
(
struct
libiscsi_context
*context,
208
const
struct
libiscsi_node
*node,
209
const
struct
libiscsi_auth_info
*auth_info);
210
223
PUBLIC
int
libiscsi_node_get_auth
(
struct
libiscsi_context
*context,
224
const
struct
libiscsi_node
*node,
225
struct
libiscsi_auth_info
*auth_info);
226
236
PUBLIC
int
libiscsi_node_login
(
struct
libiscsi_context
*context,
237
const
struct
libiscsi_node
*node);
238
248
PUBLIC
int
libiscsi_node_logout
(
struct
libiscsi_context
*context,
249
const
struct
libiscsi_node
*node);
250
262
PUBLIC
int
libiscsi_node_set_parameter
(
struct
libiscsi_context
*context,
263
const
struct
libiscsi_node
*node,
264
const
char
*
parameter
,
const
char
*
value
);
265
278
PUBLIC
int
libiscsi_node_get_parameter
(
struct
libiscsi_context
*context,
279
const
struct
libiscsi_node
*node,
const
char
*
parameter
,
char
*
value
);
280
292
PUBLIC
const
char
*
libiscsi_get_error_string
(
struct
libiscsi_context
*context);
293
294
295
/************************** Utility functions *******************************/
296
301
struct
libiscsi_network_config
{
302
int
dhcp
;
303
char
iface_name
[
LIBISCSI_VALUE_MAXLEN
] ;
304
char
mac_address
[
LIBISCSI_VALUE_MAXLEN
] ;
305
char
ip_address
[
LIBISCSI_VALUE_MAXLEN
] ;
306
char
netmask
[
LIBISCSI_VALUE_MAXLEN
] ;
307
char
gateway
[
LIBISCSI_VALUE_MAXLEN
] ;
308
char
primary_dns
[
LIBISCSI_VALUE_MAXLEN
] ;
309
char
secondary_dns
[
LIBISCSI_VALUE_MAXLEN
] ;
310
};
311
325
PUBLIC
int
libiscsi_get_firmware_network_config
(
326
struct
libiscsi_network_config
*config);
327
336
PUBLIC
int
libiscsi_get_firmware_initiator_name
(
char
*initiatorname);
337
338
#undef PUBLIC
339
340
#ifdef __cplusplus
341
}
342
#endif
/* __cplusplus */
343
344
#endif
Generated on Tue Jul 2 2013 12:32:50 for libiscsi by
1.8.3