libiscsi
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 * Copyright (C) 2015 Peter Hatina <phatina@redhat.com>
7 * maintained by open-iscsi@googlegroups.com
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published
11 * by the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * See the file COPYING included with this distribution for more details.
20 */
21
22#ifndef __LIBISCSI_H
23#define __LIBISCSI_H
24
25#include <netdb.h>
26
27#ifdef __cplusplus
28extern "C" {
29#endif /* __cplusplus */
30
31#if __GNUC__ >= 4
32#define PUBLIC __attribute__ ((visibility("default")))
33#else
34#define PUBLIC
35#endif
36
41#define LIBISCSI_VALUE_MAXLEN 256
42
51
58struct libiscsi_context;
59
70
77 int tpgt ;
78 /* Note open-iscsi has some code in place for multiple connections in one
79 node record and thus multiple address / port combi's, but this does not
80 get used anywhere, so we keep things simple and assume one connection */
81 char address[NI_MAXHOST] ;
82 int port ;
84};
85
98
116
123 union {
125 } ;
126};
127
136
144PUBLIC void libiscsi_cleanup(struct libiscsi_context *context);
145
172 const char *address, int port, const struct libiscsi_auth_info *auth_info,
173 int *nr_found, struct libiscsi_node **found_nodes);
174
198 int *nr_found, struct libiscsi_node **found_nodes);
199
212 const struct libiscsi_auth_info *auth_info);
213
238 const struct libiscsi_node *node,
239 const struct libiscsi_auth_info *auth_info);
240
254 const struct libiscsi_node *node,
255 struct libiscsi_auth_info *auth_info);
256
267 const struct libiscsi_node *node);
268
279 const struct libiscsi_node *node);
280
293 struct libiscsi_session_info **infos, int *nr_sessions);
294
304 struct libiscsi_session_info *info,
305 const char *session);
306
319 const struct libiscsi_node *node,
320 const char *parameter, const char *value);
321
335 const struct libiscsi_node *node, const char *parameter, char *value);
336
348PUBLIC const char *libiscsi_get_error_string(struct libiscsi_context *context);
349
350
351/************************** Utility functions *******************************/
352
367
382 struct libiscsi_network_config *config);
383
392PUBLIC int libiscsi_get_firmware_initiator_name(char *initiatorname);
393
394#undef PUBLIC
395
396#ifdef __cplusplus
397}
398#endif /* __cplusplus */
399
400#endif
PUBLIC void libiscsi_cleanup(struct libiscsi_context *context)
Cleanup libiscsi used resource.
Definition libiscsi.c:90
PUBLIC int libiscsi_get_firmware_initiator_name(char *initiatorname)
Get the initiator name (iqn) from the iscsi firmware.
Definition libiscsi.c:728
PUBLIC int libiscsi_node_get_parameter(struct libiscsi_context *context, const struct libiscsi_node *node, const char *parameter, char *value)
Get the value of an iSCSI parameter for the given node.
Definition libiscsi.c:665
PUBLIC int libiscsi_node_logout(struct libiscsi_context *context, const struct libiscsi_node *node)
Logout of an iSCSI node.
Definition libiscsi.c:460
PUBLIC int libiscsi_node_set_parameter(struct libiscsi_context *context, const struct libiscsi_node *node, const char *parameter, const char *value)
Set an iSCSI parameter for the given node.
Definition libiscsi.c:600
PUBLIC struct libiscsi_context * libiscsi_init(void)
Initalize libiscsi.
Definition libiscsi.c:65
PUBLIC int libiscsi_node_set_auth(struct libiscsi_context *context, const struct libiscsi_node *node, const struct libiscsi_auth_info *auth_info)
Set the authentication info for the given node.
Definition libiscsi.c:319
libiscsi_auth_t
supported authentication methods
Definition libiscsi.h:47
@ libiscsi_auth_chap
Definition libiscsi.h:49
@ libiscsi_auth_none
Definition libiscsi.h:48
PUBLIC int libiscsi_node_get_auth(struct libiscsi_context *context, const struct libiscsi_node *node, struct libiscsi_auth_info *auth_info)
Get the authentication info for the given node.
Definition libiscsi.c:362
PUBLIC const char * libiscsi_get_error_string(struct libiscsi_context *context)
Get human readable string describing the last libiscsi error.
Definition libiscsi.c:689
PUBLIC int libiscsi_verify_auth_info(struct libiscsi_context *context, const struct libiscsi_auth_info *auth_info)
Check validity of the given authentication info.
Definition libiscsi.c:289
PUBLIC int libiscsi_get_session_infos(struct libiscsi_context *context, struct libiscsi_session_info **infos, int *nr_sessions)
Get an array of iSCSI sessions.
Definition libiscsi.c:550
PUBLIC int libiscsi_discover_firmware(struct libiscsi_context *context, int *nr_found, struct libiscsi_node **found_nodes)
Read iSCSI node info from firmware and add them to the node db.
Definition libiscsi.c:204
#define LIBISCSI_VALUE_MAXLEN
Maximum length for iSCSI values.
Definition libiscsi.h:41
PUBLIC int libiscsi_get_firmware_network_config(struct libiscsi_network_config *config)
Get network configuration information from iscsi firmware.
Definition libiscsi.c:702
#define PUBLIC
Definition libiscsi.h:34
PUBLIC int libiscsi_get_session_info_by_id(struct libiscsi_context *context, struct libiscsi_session_info *info, const char *session)
Get session information by session ID.
Definition libiscsi.c:581
PUBLIC int libiscsi_node_login(struct libiscsi_context *context, const struct libiscsi_node *node)
Login to an iSCSI node.
Definition libiscsi.c:425
PUBLIC int libiscsi_discover_sendtargets(struct libiscsi_context *context, const char *address, int port, const struct libiscsi_auth_info *auth_info, int *nr_found, struct libiscsi_node **found_nodes)
Discover iSCSI nodes using sendtargets and add them to the node db.
Definition libiscsi.c:118
generic libiscsi authentication information struct
Definition libiscsi.h:121
struct libiscsi_chap_auth_info chap
Definition libiscsi.h:124
enum libiscsi_auth_t method
Definition libiscsi.h:122
libiscsi CHAP authentication information struct
Definition libiscsi.h:92
char username[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:93
char reverse_username[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:95
char password[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:94
char reverse_password[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:96
Definition libiscsi.c:48
char * value
Definition libiscsi.c:52
const char * parameter
Definition libiscsi.c:51
libiscsi network config struct
Definition libiscsi.h:357
char secondary_dns[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:365
int dhcp
Definition libiscsi.h:358
char gateway[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:363
char ip_address[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:361
char primary_dns[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:364
char iface_name[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:359
char mac_address[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:360
char netmask[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:362
iSCSI node record
Definition libiscsi.h:75
char iface[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:83
char name[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:76
char address[NI_MAXHOST]
Definition libiscsi.h:81
int tpgt
Definition libiscsi.h:77
int port
Definition libiscsi.h:82
iSCSI session
Definition libiscsi.h:103
struct libiscsi_chap_auth_info chap
Definition libiscsi.h:107
int port
Definition libiscsi.h:112
char address[NI_MAXHOST]
Definition libiscsi.h:111
char persistent_address[NI_MAXHOST]
Definition libiscsi.h:113
char targetname[LIBISCSI_VALUE_MAXLEN]
Definition libiscsi.h:109
int sid
Definition libiscsi.h:104
int tpgt
Definition libiscsi.h:110
int persistent_port
Definition libiscsi.h:114
struct libiscsi_session_timeout tmo
Definition libiscsi.h:106
iSCSI session timeouts
Definition libiscsi.h:64
int abort_tmo
Definition libiscsi.h:65
int recovery_tmo
Definition libiscsi.h:67
int lu_reset_tmo
Definition libiscsi.h:66
int tgt_reset_tmo
Definition libiscsi.h:68

Generated for libiscsi by doxygen 1.13.2