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 char iface[LIBISCSI_VALUE_MAXLEN] ;
00072 };
00073
00080 struct libiscsi_chap_auth_info {
00081 char username[LIBISCSI_VALUE_MAXLEN] ;
00082 char password[LIBISCSI_VALUE_MAXLEN] ;
00083 char reverse_username[LIBISCSI_VALUE_MAXLEN] ;
00084 char reverse_password[LIBISCSI_VALUE_MAXLEN] ;
00085 };
00086
00091 struct libiscsi_auth_info {
00092 enum libiscsi_auth_t method ;
00093 union {
00094 struct libiscsi_chap_auth_info chap ;
00095 } ;
00096 };
00097
00105 PUBLIC struct libiscsi_context *libiscsi_init(void);
00106
00114 PUBLIC void libiscsi_cleanup(struct libiscsi_context *context);
00115
00141 PUBLIC int libiscsi_discover_sendtargets(struct libiscsi_context *context,
00142 const char *address, int port, const struct libiscsi_auth_info *auth_info,
00143 int *nr_found, struct libiscsi_node **found_nodes);
00144
00167 PUBLIC int libiscsi_discover_firmware(struct libiscsi_context *context,
00168 int *nr_found, struct libiscsi_node **found_nodes);
00169
00181 PUBLIC int libiscsi_verify_auth_info(struct libiscsi_context *context,
00182 const struct libiscsi_auth_info *auth_info);
00183
00207 PUBLIC int libiscsi_node_set_auth(struct libiscsi_context *context,
00208 const struct libiscsi_node *node,
00209 const struct libiscsi_auth_info *auth_info);
00210
00223 PUBLIC int libiscsi_node_get_auth(struct libiscsi_context *context,
00224 const struct libiscsi_node *node,
00225 struct libiscsi_auth_info *auth_info);
00226
00236 PUBLIC int libiscsi_node_login(struct libiscsi_context *context,
00237 const struct libiscsi_node *node);
00238
00248 PUBLIC int libiscsi_node_logout(struct libiscsi_context *context,
00249 const struct libiscsi_node *node);
00250
00262 PUBLIC int libiscsi_node_set_parameter(struct libiscsi_context *context,
00263 const struct libiscsi_node *node,
00264 const char *parameter, const char *value);
00265
00278 PUBLIC int libiscsi_node_get_parameter(struct libiscsi_context *context,
00279 const struct libiscsi_node *node, const char *parameter, char *value);
00280
00292 PUBLIC const char *libiscsi_get_error_string(struct libiscsi_context *context);
00293
00294
00295
00296
00301 struct libiscsi_network_config {
00302 int dhcp ;
00303 char iface_name[LIBISCSI_VALUE_MAXLEN] ;
00304 char mac_address[LIBISCSI_VALUE_MAXLEN] ;
00305 char ip_address[LIBISCSI_VALUE_MAXLEN] ;
00306 char netmask[LIBISCSI_VALUE_MAXLEN] ;
00307 char gateway[LIBISCSI_VALUE_MAXLEN] ;
00308 char primary_dns[LIBISCSI_VALUE_MAXLEN] ;
00309 char secondary_dns[LIBISCSI_VALUE_MAXLEN] ;
00310 };
00311
00325 PUBLIC int libiscsi_get_firmware_network_config(
00326 struct libiscsi_network_config *config);
00327
00336 PUBLIC int libiscsi_get_firmware_initiator_name(char *initiatorname);
00337
00338 #undef PUBLIC
00339
00340 #ifdef __cplusplus
00341 }
00342 #endif
00343
00344 #endif