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  * 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 
49 };
50 
57 struct libiscsi_context;
58 
63 struct libiscsi_node {
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 ;
72 };
73 
85 };
86 
93  union {
95  } ;
96 };
97 
106 
114 PUBLIC void libiscsi_cleanup(struct libiscsi_context *context);
115 
142  const char *address, int port, const struct libiscsi_auth_info *auth_info,
143  int *nr_found, struct libiscsi_node **found_nodes);
144 
168  int *nr_found, struct libiscsi_node **found_nodes);
169 
182  const struct libiscsi_auth_info *auth_info);
183 
208  const struct libiscsi_node *node,
209  const struct libiscsi_auth_info *auth_info);
210 
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 
263  const struct libiscsi_node *node,
264  const char *parameter, const char *value);
265 
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 
302  int dhcp ;
310 };
311 
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
libiscsi network config struct
Definition: libiscsi.h:301
libiscsi CHAP authentication information struct
Definition: libiscsi.h:80
char iface_name[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:303
char * value
Definition: libiscsi.c:51
char mac_address[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:304
char iface[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:71
char secondary_dns[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:309
generic libiscsi authentication information struct
Definition: libiscsi.h:91
char netmask[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:306
libiscsi_auth_t
supported authentication methods
Definition: libiscsi.h:46
Definition: libiscsi.h:48
int libiscsi_get_firmware_network_config(struct libiscsi_network_config *config)
Get network configuration information from iscsi firmware.
Definition: libiscsi.c:574
char reverse_username[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:83
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:358
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:117
char ip_address[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:305
#define PUBLIC
Definition: libiscsi.h:33
struct libiscsi_chap_auth_info chap
Definition: libiscsi.h:94
int tpgt
Definition: libiscsi.h:65
char address[NI_MAXHOST]
Definition: libiscsi.h:69
const char * parameter
Definition: libiscsi.c:50
char primary_dns[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:308
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:285
char name[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:64
int libiscsi_get_firmware_initiator_name(char *initiatorname)
Get the initiator name (iqn) from the iscsi firmware.
Definition: libiscsi.c:600
int libiscsi_node_login(struct libiscsi_context *context, const struct libiscsi_node *node)
Login to an iSCSI node.
Definition: libiscsi.c:421
char gateway[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:307
Definition: libiscsi.c:47
void libiscsi_cleanup(struct libiscsi_context *context)
Cleanup libiscsi used resource.
Definition: libiscsi.c:89
char username[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:81
const char * libiscsi_get_error_string(struct libiscsi_context *context)
Get human readable string describing the last libiscsi error.
Definition: libiscsi.c:561
enum libiscsi_auth_t method
Definition: libiscsi.h:92
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:472
struct libiscsi_context * libiscsi_init(void)
Initalize libiscsi.
Definition: libiscsi.c:64
int dhcp
Definition: libiscsi.h:302
char reverse_password[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:84
iSCSI node record
Definition: libiscsi.h:63
int port
Definition: libiscsi.h:70
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:315
#define LIBISCSI_VALUE_MAXLEN
Maximum length for iSCSI values.
Definition: libiscsi.h:40
char password[LIBISCSI_VALUE_MAXLEN]
Definition: libiscsi.h:82
int libiscsi_node_logout(struct libiscsi_context *context, const struct libiscsi_node *node)
Logout of an iSCSI node.
Definition: libiscsi.c:456
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:201
Definition: libiscsi.h:47
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:537

Generated for libiscsi by doxygen 1.8.5