00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __LIBISCSI_H
00022 #define __LIBISCSI_H
00023
00024 #include <netdb.h>
00025
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029
00030 #if __GNUC__ >= 4
00031 #define PUBLIC __attribute__ ((visibility("default")))
00032 #else
00033 #define PUBLIC
00034 #endif
00035
00040 #define LIBISCSI_VALUE_MAXLEN 256
00041
00046 enum libiscsi_auth_t {
00047 libiscsi_auth_none ,
00048 libiscsi_auth_chap ,
00049 };
00050
00057 struct libiscsi_context;
00058
00063 struct libiscsi_node {
00064 char name[LIBISCSI_VALUE_MAXLEN] ;
00065 int tpgt ;
00066
00067
00068
00069 char address[NI_MAXHOST] ;
00070 int port ;
00071 };
00072
00079 struct libiscsi_chap_auth_info {
00080 char username[LIBISCSI_VALUE_MAXLEN] ;
00081 char password[LIBISCSI_VALUE_MAXLEN] ;
00082 char reverse_username[LIBISCSI_VALUE_MAXLEN] ;
00083 char reverse_password[LIBISCSI_VALUE_MAXLEN] ;
00084 };
00085
00090 struct libiscsi_auth_info {
00091 enum libiscsi_auth_t method ;
00092 union {
00093 struct libiscsi_chap_auth_info chap ;
00094 } ;
00095 };
00096
00104 PUBLIC struct libiscsi_context *libiscsi_init(void);
00105
00113 PUBLIC void libiscsi_cleanup(struct libiscsi_context *context);
00114
00140 PUBLIC int libiscsi_discover_sendtargets(struct libiscsi_context *context,
00141 const char *address, int port, const struct libiscsi_auth_info *auth_info,
00142 int *nr_found, struct libiscsi_node **found_nodes);
00143
00166 PUBLIC int libiscsi_discover_firmware(struct libiscsi_context *context,
00167 int *nr_found, struct libiscsi_node **found_nodes);
00168
00180 PUBLIC int libiscsi_verify_auth_info(struct libiscsi_context *context,
00181 const struct libiscsi_auth_info *auth_info);
00182
00206 PUBLIC int libiscsi_node_set_auth(struct libiscsi_context *context,
00207 const struct libiscsi_node *node,
00208 const struct libiscsi_auth_info *auth_info);
00209
00222 PUBLIC int libiscsi_node_get_auth(struct libiscsi_context *context,
00223 const struct libiscsi_node *node,
00224 struct libiscsi_auth_info *auth_info);
00225
00235 PUBLIC int libiscsi_node_login(struct libiscsi_context *context,
00236 const struct libiscsi_node *node);
00237
00247 PUBLIC int libiscsi_node_logout(struct libiscsi_context *context,
00248 const struct libiscsi_node *node);
00249
00261 PUBLIC int libiscsi_node_set_parameter(struct libiscsi_context *context,
00262 const struct libiscsi_node *node,
00263 const char *parameter, const char *value);
00264
00277 PUBLIC int libiscsi_node_get_parameter(struct libiscsi_context *context,
00278 const struct libiscsi_node *node, const char *parameter, char *value);
00279
00291 PUBLIC const char *libiscsi_get_error_string(struct libiscsi_context *context);
00292
00293
00294
00295
00300 struct libiscsi_network_config {
00301 int dhcp ;
00302 char iface_name[LIBISCSI_VALUE_MAXLEN] ;
00303 char mac_address[LIBISCSI_VALUE_MAXLEN] ;
00304 char ip_address[LIBISCSI_VALUE_MAXLEN] ;
00305 char netmask[LIBISCSI_VALUE_MAXLEN] ;
00306 char gateway[LIBISCSI_VALUE_MAXLEN] ;
00307 char primary_dns[LIBISCSI_VALUE_MAXLEN] ;
00308 char secondary_dns[LIBISCSI_VALUE_MAXLEN] ;
00309 };
00310
00324 PUBLIC int libiscsi_get_firmware_network_config(
00325 struct libiscsi_network_config *config);
00326
00335 PUBLIC int libiscsi_get_firmware_initiator_name(char *initiatorname);
00336
00337 #undef PUBLIC
00338
00339 #ifdef __cplusplus
00340 }
00341 #endif
00342
00343 #endif