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
28 extern "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 
50 };
51 
58 struct libiscsi_context;
59 
65  int abort_tmo;
69 };
70 
75 struct libiscsi_node {
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 
97 };
98 
104  int sid;
105 
108 
110  int tpgt;
111  char address[NI_MAXHOST];
112  int port;
113  char persistent_address[NI_MAXHOST];
115 };
116 
123  union {
125  } ;
126 };
127 
136 
144 PUBLIC 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 
266 PUBLIC int libiscsi_node_login(struct libiscsi_context *context,
267  const struct libiscsi_node *node);
268 
278 PUBLIC int libiscsi_node_logout(struct libiscsi_context *context,
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 
348 PUBLIC const char *libiscsi_get_error_string(struct libiscsi_context *context);
349 
350 
351 /************************** Utility functions *******************************/
352 
358  int dhcp ;
366 };
367 
382  struct libiscsi_network_config *config);
383 
392 PUBLIC int libiscsi_get_firmware_initiator_name(char *initiatorname);
393 
394 #undef PUBLIC
395 
396 #ifdef __cplusplus
397 }
398 #endif /* __cplusplus */
399 
400 #endif
iSCSI session
Definition: libiscsi.h:103
libiscsi network config struct
Definition: libiscsi.h:357
libiscsi CHAP authentication information struct
Definition: libiscsi.h:92
char iface_name[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:359
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_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
char * value
Definition: libiscsi.c:52
char mac_address[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:360
int abort_tmo
Definition: libiscsi.h:65
char persistent_address[NI_MAXHOST]
Definition: libiscsi.h:113
char iface[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:83
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
char secondary_dns[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:365
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
generic libiscsi authentication information struct
Definition: libiscsi.h:121
char netmask[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:362
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_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
libiscsi_auth_t
supported authentication methods
Definition: libiscsi.h:47
Definition: libiscsi.h:49
char reverse_username[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:95
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
PUBLIC void libiscsi_cleanup(struct libiscsi_context *context)
Cleanup libiscsi used resource.
Definition: libiscsi.c:90
char ip_address[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:361
#define PUBLIC
Definition: libiscsi.h:34
struct libiscsi_chap_auth_info chap
Definition: libiscsi.h:124
int tpgt
Definition: libiscsi.h:77
char address[NI_MAXHOST]
Definition: libiscsi.h:81
PUBLIC int libiscsi_get_firmware_initiator_name(char *initiatorname)
Get the initiator name (iqn) from the iscsi firmware.
Definition: libiscsi.c:728
const char * parameter
Definition: libiscsi.c:51
struct libiscsi_session_timeout tmo
Definition: libiscsi.h:106
char primary_dns[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:364
PUBLIC int libiscsi_get_firmware_network_config(struct libiscsi_network_config *config)
Get network configuration information from iscsi firmware.
Definition: libiscsi.c:702
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
int sid
Definition: libiscsi.h:104
int persistent_port
Definition: libiscsi.h:114
char name[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:76
int tgt_reset_tmo
Definition: libiscsi.h:68
iSCSI session timeouts
Definition: libiscsi.h:64
char gateway[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:363
Definition: libiscsi.c:48
char targetname[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:109
char username[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:93
int tpgt
Definition: libiscsi.h:110
enum libiscsi_auth_t method
Definition: libiscsi.h:122
char address[NI_MAXHOST]
Definition: libiscsi.h:111
int dhcp
Definition: libiscsi.h:358
PUBLIC int libiscsi_node_logout(struct libiscsi_context *context, const struct libiscsi_node *node)
Logout of an iSCSI node.
Definition: libiscsi.c:460
int port
Definition: libiscsi.h:112
int recovery_tmo
Definition: libiscsi.h:67
char reverse_password[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:96
iSCSI node record
Definition: libiscsi.h:75
PUBLIC const char * libiscsi_get_error_string(struct libiscsi_context *context)
Get human readable string describing the last libiscsi error.
Definition: libiscsi.c:689
int port
Definition: libiscsi.h:82
PUBLIC int libiscsi_node_login(struct libiscsi_context *context, const struct libiscsi_node *node)
Login to an iSCSI node.
Definition: libiscsi.c:425
PUBLIC struct libiscsi_context * libiscsi_init(void)
Initalize libiscsi.
Definition: libiscsi.c:65
int lu_reset_tmo
Definition: libiscsi.h:66
#define LIBISCSI_VALUE_MAXLEN
Maximum length for iSCSI values.
Definition: libiscsi.h:41
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
char password[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:94
struct libiscsi_chap_auth_info chap
Definition: libiscsi.h:107
Definition: libiscsi.h:48

Generated for libiscsi by doxygen 1.8.14