iPXE
iscsi.h
Go to the documentation of this file.
00001 #ifndef _IPXE_ISCSI_H
00002 #define _IPXE_ISCSI_H
00003 
00004 /** @file
00005  *
00006  * iSCSI protocol
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <stdint.h>
00013 #include <ipxe/socket.h>
00014 #include <ipxe/scsi.h>
00015 #include <ipxe/chap.h>
00016 #include <ipxe/refcnt.h>
00017 #include <ipxe/xfer.h>
00018 #include <ipxe/process.h>
00019 #include <ipxe/acpi.h>
00020 #include <ipxe/settings.h>
00021 
00022 /** Default iSCSI port */
00023 #define ISCSI_PORT 3260
00024 
00025 /**
00026  * iSCSI segment lengths
00027  *
00028  * iSCSI uses an icky structure with one one-byte field (a dword
00029  * count) and one three-byte field (a byte count).  This structure,
00030  * and the accompanying macros, relieve some of the pain.
00031  */
00032 union iscsi_segment_lengths {
00033         struct {
00034                 /** The AHS length (measured in dwords) */
00035                 uint8_t ahs_len;
00036                 /** The data length (measured in bytes), in network
00037                  * byte order
00038                  */
00039                 uint8_t data_len[3];
00040         } bytes;
00041         /** The data length (measured in bytes), in network byte
00042          * order, with ahs_len as the first byte.
00043          */
00044         uint32_t ahs_and_data_len;
00045 };
00046 
00047 /** The length of the additional header segment, in dwords */
00048 #define ISCSI_AHS_LEN( segment_lengths ) \
00049         ( (segment_lengths).bytes.ahs_len )
00050 
00051 /** The length of the data segment, in bytes, excluding any padding */
00052 #define ISCSI_DATA_LEN( segment_lengths ) \
00053         ( ntohl ( (segment_lengths).ahs_and_data_len ) & 0xffffff )
00054 
00055 /** The padding of the data segment, in bytes */
00056 #define ISCSI_DATA_PAD_LEN( segment_lengths ) \
00057         ( ( 0 - (segment_lengths).bytes.data_len[2] ) & 0x03 )
00058 
00059 /** Set additional header and data segment lengths */
00060 #define ISCSI_SET_LENGTHS( segment_lengths, ahs_len, data_len ) do {    \
00061         (segment_lengths).ahs_and_data_len =                            \
00062                 htonl ( data_len | ( ahs_len << 24 ) );                 \
00063         } while ( 0 )
00064 
00065 /**
00066  * iSCSI basic header segment common fields
00067  *
00068  */
00069 struct iscsi_bhs_common {
00070         /** Opcode */
00071         uint8_t opcode;
00072         /** Flags */
00073         uint8_t flags;
00074         /** Fields specific to the PDU type */
00075         uint8_t other_a[2];
00076         /** Segment lengths */
00077         union iscsi_segment_lengths lengths;
00078         /** Fields specific to the PDU type */
00079         uint8_t other_b[8];
00080         /** Initiator Task Tag */
00081         uint32_t itt;
00082         /** Fields specific to the PDU type */
00083         uint8_t other_c[28];
00084 };
00085 
00086 /** Opcode mask */
00087 #define ISCSI_OPCODE_MASK 0x3f
00088 
00089 /** Immediate delivery */
00090 #define ISCSI_FLAG_IMMEDIATE 0x40
00091 
00092 /** Final PDU of a sequence */
00093 #define ISCSI_FLAG_FINAL 0x80
00094 
00095 /** iSCSI tag magic marker */
00096 #define ISCSI_TAG_MAGIC 0x18ae0000
00097 
00098 /** iSCSI reserved tag value */
00099 #define ISCSI_TAG_RESERVED 0xffffffff
00100 
00101 /**
00102  * iSCSI basic header segment common request fields
00103  *
00104  */
00105 struct iscsi_bhs_common_response {
00106         /** Opcode */
00107         uint8_t opcode;
00108         /** Flags */
00109         uint8_t flags;
00110         /** Fields specific to the PDU type */
00111         uint8_t other_a[2];
00112         /** Segment lengths */
00113         union iscsi_segment_lengths lengths;
00114         /** Fields specific to the PDU type */
00115         uint8_t other_b[8];
00116         /** Initiator Task Tag */
00117         uint32_t itt;
00118         /** Fields specific to the PDU type */
00119         uint8_t other_c[4];
00120         /** Status sequence number */
00121         uint32_t statsn;
00122         /** Expected command sequence number */
00123         uint32_t expcmdsn;
00124         /** Fields specific to the PDU type */
00125         uint8_t other_d[16];
00126 };
00127 
00128 /**
00129  * iSCSI login request basic header segment
00130  *
00131  */
00132 struct iscsi_bhs_login_request {
00133         /** Opcode */
00134         uint8_t opcode;
00135         /** Flags */
00136         uint8_t flags;
00137         /** Maximum supported version number */
00138         uint8_t version_max;
00139         /** Minimum supported version number */
00140         uint8_t version_min;
00141         /** Segment lengths */
00142         union iscsi_segment_lengths lengths;
00143         /** Initiator session ID (IANA format) enterprise number and flags */
00144         uint32_t isid_iana_en;
00145         /** Initiator session ID (IANA format) qualifier */
00146         uint16_t isid_iana_qual;
00147         /** Target session identifying handle */
00148         uint16_t tsih;
00149         /** Initiator Task Tag */
00150         uint32_t itt;
00151         /** Connection ID */
00152         uint16_t cid;
00153         /** Reserved */
00154         uint16_t reserved_a;
00155         /** Command sequence number */
00156         uint32_t cmdsn;
00157         /** Expected status sequence number */
00158         uint32_t expstatsn;
00159         /** Reserved */
00160         uint8_t reserved_b[16];
00161 };
00162 
00163 /** Login request opcode */
00164 #define ISCSI_OPCODE_LOGIN_REQUEST 0x03
00165 
00166 /** Willingness to transition to next stage */
00167 #define ISCSI_LOGIN_FLAG_TRANSITION 0x80
00168 
00169 /** Key=value pairs continued in subsequent request */
00170 #define ISCSI_LOGIN_FLAG_CONTINUE 0x40
00171 
00172 /* Current stage values and mask */
00173 #define ISCSI_LOGIN_CSG_MASK 0x0c
00174 #define ISCSI_LOGIN_CSG_SECURITY_NEGOTIATION 0x00
00175 #define ISCSI_LOGIN_CSG_OPERATIONAL_NEGOTIATION 0x04
00176 #define ISCSI_LOGIN_CSG_FULL_FEATURE_PHASE 0x0c
00177 
00178 /* Next stage values and mask */
00179 #define ISCSI_LOGIN_NSG_MASK 0x03
00180 #define ISCSI_LOGIN_NSG_SECURITY_NEGOTIATION 0x00
00181 #define ISCSI_LOGIN_NSG_OPERATIONAL_NEGOTIATION 0x01
00182 #define ISCSI_LOGIN_NSG_FULL_FEATURE_PHASE 0x03
00183 
00184 /** ISID IANA format marker */
00185 #define ISCSI_ISID_IANA 0x40000000
00186 
00187 /** Fen Systems Ltd. IANA enterprise number
00188  *
00189  * Permission is hereby granted to use Fen Systems Ltd.'s IANA
00190  * enterprise number with this iSCSI implementation.
00191  */
00192 #define IANA_EN_FEN_SYSTEMS 10019
00193 
00194 /**
00195  * iSCSI login response basic header segment
00196  *
00197  */
00198 struct iscsi_bhs_login_response {
00199         /** Opcode */
00200         uint8_t opcode;
00201         /** Flags */
00202         uint8_t flags;
00203         /** Maximum supported version number */
00204         uint8_t version_max;
00205         /** Minimum supported version number */
00206         uint8_t version_min;
00207         /** Segment lengths */
00208         union iscsi_segment_lengths lengths;
00209         /** Initiator session ID (IANA format) enterprise number and flags */
00210         uint32_t isid_iana_en;
00211         /** Initiator session ID (IANA format) qualifier */
00212         uint16_t isid_iana_qual;
00213         /** Target session identifying handle */
00214         uint16_t tsih;
00215         /** Initiator Task Tag */
00216         uint32_t itt;
00217         /** Reserved */
00218         uint32_t reserved_a;
00219         /** Status sequence number */
00220         uint32_t statsn;
00221         /** Expected command sequence number */
00222         uint32_t expcmdsn;
00223         /** Maximum command sequence number */
00224         uint32_t maxcmdsn;
00225         /** Status class */
00226         uint8_t status_class;
00227         /** Status detail */
00228         uint8_t status_detail;
00229         /** Reserved */
00230         uint8_t reserved_b[10];
00231 };
00232 
00233 /** Login response opcode */
00234 #define ISCSI_OPCODE_LOGIN_RESPONSE 0x23
00235 
00236 /* Login response status codes */
00237 #define ISCSI_STATUS_SUCCESS                    0x00
00238 #define ISCSI_STATUS_REDIRECT                   0x01
00239 #define ISCSI_STATUS_INITIATOR_ERROR            0x02
00240 #define ISCSI_STATUS_INITIATOR_ERROR_AUTHENTICATION     0x01
00241 #define ISCSI_STATUS_INITIATOR_ERROR_AUTHORISATION      0x02
00242 #define ISCSI_STATUS_INITIATOR_ERROR_NOT_FOUND          0x03
00243 #define ISCSI_STATUS_INITIATOR_ERROR_REMOVED            0x04
00244 #define ISCSI_STATUS_TARGET_ERROR               0x03
00245 #define ISCSI_STATUS_TARGET_ERROR_UNAVAILABLE           0x01
00246 #define ISCSI_STATUS_TARGET_ERROR_NO_RESOURCES          0x02
00247 
00248 /**
00249  * iSCSI SCSI command basic header segment
00250  *
00251  */
00252 struct iscsi_bhs_scsi_command {
00253         /** Opcode */
00254         uint8_t opcode;
00255         /** Flags */
00256         uint8_t flags;
00257         /** Reserved */
00258         uint16_t reserved_a;
00259         /** Segment lengths */
00260         union iscsi_segment_lengths lengths;
00261         /** SCSI Logical Unit Number */
00262         struct scsi_lun lun;
00263         /** Initiator Task Tag */
00264         uint32_t itt;
00265         /** Expected data transfer length */
00266         uint32_t exp_len;
00267         /** Command sequence number */
00268         uint32_t cmdsn;
00269         /** Expected status sequence number */
00270         uint32_t expstatsn;
00271         /** SCSI Command Descriptor Block (CDB) */
00272         union scsi_cdb cdb;
00273 };
00274 
00275 /** SCSI command opcode */
00276 #define ISCSI_OPCODE_SCSI_COMMAND 0x01
00277 
00278 /** Command will read data */
00279 #define ISCSI_COMMAND_FLAG_READ 0x40
00280 
00281 /** Command will write data */
00282 #define ISCSI_COMMAND_FLAG_WRITE 0x20
00283 
00284 /* Task attributes */
00285 #define ISCSI_COMMAND_ATTR_UNTAGGED 0x00
00286 #define ISCSI_COMMAND_ATTR_SIMPLE 0x01
00287 #define ISCSI_COMMAND_ATTR_ORDERED 0x02
00288 #define ISCSI_COMMAND_ATTR_HEAD_OF_QUEUE 0x03
00289 #define ISCSI_COMMAND_ATTR_ACA 0x04
00290 
00291 /**
00292  * iSCSI SCSI response basic header segment
00293  *
00294  */
00295 struct iscsi_bhs_scsi_response {
00296         /** Opcode */
00297         uint8_t opcode;
00298         /** Flags */
00299         uint8_t flags;
00300         /** Response code */
00301         uint8_t response;
00302         /** SCSI status code */
00303         uint8_t status;
00304         /** Segment lengths */
00305         union iscsi_segment_lengths lengths;
00306         /** Reserved */
00307         uint8_t reserved_a[8];
00308         /** Initiator Task Tag */
00309         uint32_t itt;
00310         /** SNACK tag */
00311         uint32_t snack;
00312         /** Status sequence number */
00313         uint32_t statsn;
00314         /** Expected command sequence number */
00315         uint32_t expcmdsn;
00316         /** Maximum command sequence number */
00317         uint32_t maxcmdsn;
00318         /** Expected data sequence number */
00319         uint32_t expdatasn;
00320         /** Bidirectional read residual count */
00321         uint32_t bidi_residual_count;
00322         /** Residual count */
00323         uint32_t residual_count;
00324 };
00325 
00326 /** SCSI response opcode */
00327 #define ISCSI_OPCODE_SCSI_RESPONSE 0x21
00328 
00329 /** SCSI command completed at target */
00330 #define ISCSI_RESPONSE_COMMAND_COMPLETE 0x00
00331 
00332 /** SCSI target failure */
00333 #define ISCSI_RESPONSE_TARGET_FAILURE 0x01
00334 
00335 /** Data overflow occurred */
00336 #define ISCSI_RESPONSE_FLAG_OVERFLOW 0x20
00337 
00338 /** Data underflow occurred */
00339 #define ISCSI_RESPONSE_FLAG_UNDERFLOW 0x40
00340 
00341 /**
00342  * iSCSI data-in basic header segment
00343  *
00344  */
00345 struct iscsi_bhs_data_in {
00346         /** Opcode */
00347         uint8_t opcode;
00348         /** Flags */
00349         uint8_t flags;
00350         /** Reserved */
00351         uint8_t reserved_a;
00352         /** SCSI status code */
00353         uint8_t status;
00354         /** Segment lengths */
00355         union iscsi_segment_lengths lengths;
00356         /** Logical Unit Number */
00357         struct scsi_lun lun;
00358         /** Initiator Task Tag */
00359         uint32_t itt;
00360         /** Target Transfer Tag */
00361         uint32_t ttt;
00362         /** Status sequence number */
00363         uint32_t statsn;
00364         /** Expected command sequence number */
00365         uint32_t expcmdsn;
00366         /** Maximum command sequence number */
00367         uint32_t maxcmdsn;
00368         /** Data sequence number */
00369         uint32_t datasn;
00370         /** Buffer offset */
00371         uint32_t offset;
00372         /** Residual count */
00373         uint32_t residual_count;
00374 };
00375 
00376 /** Data-in opcode */
00377 #define ISCSI_OPCODE_DATA_IN 0x25
00378 
00379 /** Data requires acknowledgement */
00380 #define ISCSI_DATA_FLAG_ACKNOWLEDGE 0x40
00381 
00382 /** Data overflow occurred */
00383 #define ISCSI_DATA_FLAG_OVERFLOW 0x04
00384 
00385 /** Data underflow occurred */
00386 #define ISCSI_DATA_FLAG_UNDERFLOW 0x02
00387 
00388 /** SCSI status code and overflow/underflow flags are valid */
00389 #define ISCSI_DATA_FLAG_STATUS 0x01
00390 
00391 /**
00392  * iSCSI data-out basic header segment
00393  *
00394  */
00395 struct iscsi_bhs_data_out {
00396         /** Opcode */
00397         uint8_t opcode;
00398         /** Flags */
00399         uint8_t flags;
00400         /** Reserved */
00401         uint16_t reserved_a;
00402         /** Segment lengths */
00403         union iscsi_segment_lengths lengths;
00404         /** Logical Unit Number */
00405         struct scsi_lun lun;
00406         /** Initiator Task Tag */
00407         uint32_t itt;
00408         /** Target Transfer Tag */
00409         uint32_t ttt;
00410         /** Reserved */
00411         uint32_t reserved_b;
00412         /** Expected status sequence number */
00413         uint32_t expstatsn;
00414         /** Reserved */
00415         uint32_t reserved_c;
00416         /** Data sequence number */
00417         uint32_t datasn;
00418         /** Buffer offset */
00419         uint32_t offset;
00420         /** Reserved */
00421         uint32_t reserved_d;
00422 };
00423 
00424 /** Data-out opcode */
00425 #define ISCSI_OPCODE_DATA_OUT 0x05
00426 
00427 /**
00428  * iSCSI request to transfer basic header segment
00429  *
00430  */
00431 struct iscsi_bhs_r2t {
00432         /** Opcode */
00433         uint8_t opcode;
00434         /** Flags */
00435         uint8_t flags;
00436         /** Reserved */
00437         uint16_t reserved_a;
00438         /** Segment lengths */
00439         union iscsi_segment_lengths lengths;
00440         /** Logical Unit Number */
00441         struct scsi_lun lun;
00442         /** Initiator Task Tag */
00443         uint32_t itt;
00444         /** Target Transfer Tag */
00445         uint32_t ttt;
00446         /** Status sequence number */
00447         uint32_t statsn;
00448         /** Expected command sequence number */
00449         uint32_t expcmdsn;
00450         /** Maximum command sequence number */
00451         uint32_t maxcmdsn;
00452         /** R2T sequence number */
00453         uint32_t r2tsn;
00454         /** Buffer offset */
00455         uint32_t offset;
00456         /** Desired data transfer length */
00457         uint32_t len;
00458 };
00459 
00460 /** R2T opcode */
00461 #define ISCSI_OPCODE_R2T 0x31
00462 
00463 /**
00464  * iSCSI NOP-In basic header segment
00465  *
00466  */
00467 struct iscsi_nop_in {
00468         /** Opcode */
00469         uint8_t opcode;
00470         /** Reserved */
00471         uint8_t reserved_a[3];
00472         /** Segment lengths */
00473         union iscsi_segment_lengths lengths;
00474         /** Logical Unit Number */
00475         struct scsi_lun lun;
00476         /** Initiator Task Tag */
00477         uint32_t itt;
00478         /** Target Transfer Tag */
00479         uint32_t ttt;
00480         /** Status sequence number */
00481         uint32_t statsn;
00482         /** Expected command sequence number */
00483         uint32_t expcmdsn;
00484         /** Maximum command sequence number */
00485         uint32_t maxcmdsn;
00486         /** Reserved */
00487         uint8_t reserved_b[12];
00488 };
00489 
00490 /** NOP-In opcode */
00491 #define ISCSI_OPCODE_NOP_IN 0x20
00492 
00493 /**
00494  * An iSCSI basic header segment
00495  */
00496 union iscsi_bhs {
00497         struct iscsi_bhs_common common;
00498         struct iscsi_bhs_common_response common_response;
00499         struct iscsi_bhs_login_request login_request;
00500         struct iscsi_bhs_login_response login_response;
00501         struct iscsi_bhs_scsi_command scsi_command;
00502         struct iscsi_bhs_scsi_response scsi_response;
00503         struct iscsi_bhs_data_in data_in;
00504         struct iscsi_bhs_data_out data_out;
00505         struct iscsi_bhs_r2t r2t;
00506         struct iscsi_nop_in nop_in;
00507         unsigned char bytes[ sizeof ( struct iscsi_bhs_common ) ];
00508 };
00509 
00510 /** State of an iSCSI TX engine */
00511 enum iscsi_tx_state {
00512         /** Nothing to send */
00513         ISCSI_TX_IDLE = 0,
00514         /** Sending the basic header segment */
00515         ISCSI_TX_BHS,
00516         /** Sending the additional header segment */
00517         ISCSI_TX_AHS,
00518         /** Sending the data segment */
00519         ISCSI_TX_DATA,
00520 };
00521 
00522 /** State of an iSCSI RX engine */
00523 enum iscsi_rx_state {
00524         /** Receiving the basic header segment */
00525         ISCSI_RX_BHS = 0,
00526         /** Receiving the additional header segment */
00527         ISCSI_RX_AHS,
00528         /** Receiving the data segment */
00529         ISCSI_RX_DATA,
00530         /** Receiving the data segment padding */
00531         ISCSI_RX_DATA_PADDING,
00532 };
00533 
00534 /** An iSCSI session */
00535 struct iscsi_session {
00536         /** Reference counter */
00537         struct refcnt refcnt;
00538 
00539         /** SCSI command-issuing interface */
00540         struct interface control;
00541         /** SCSI command interface */
00542         struct interface data;
00543         /** Transport-layer socket */
00544         struct interface socket;
00545 
00546         /** Initiator IQN */
00547         char *initiator_iqn;
00548         /** Target address */
00549         char *target_address;
00550         /** Target port */
00551         unsigned int target_port;
00552         /** Target IQN */
00553         char *target_iqn;
00554 
00555         /** Session status
00556          *
00557          * This is the bitwise-OR of zero or more ISCSI_STATUS_XXX
00558          * constants.
00559          */
00560         int status;
00561 
00562         /** Initiator username (if any) */
00563         char *initiator_username;
00564         /** Initiator password (if any) */
00565         char *initiator_password;
00566         /** Target username (if any) */
00567         char *target_username;
00568         /** Target password (if any) */
00569         char *target_password;
00570         /** CHAP challenge (for target auth only)
00571          *
00572          * This is a block of random data; the first byte is used as
00573          * the CHAP identifier (CHAP_I) and the remainder as the CHAP
00574          * challenge (CHAP_C).
00575          */
00576         unsigned char chap_challenge[17];
00577         /** CHAP response (used for both initiator and target auth) */
00578         struct chap_response chap;
00579 
00580         /** Initiator session ID (IANA format) qualifier
00581          *
00582          * This is part of the ISID.  It is generated randomly
00583          * whenever a new connection is opened.
00584          */
00585         uint16_t isid_iana_qual;
00586         /** Initiator task tag
00587          *
00588          * This is the tag of the current command.  It is incremented
00589          * whenever a new command is started.
00590          */
00591         uint32_t itt;
00592         /** Target transfer tag
00593          *
00594          * This is the tag attached to a sequence of data-out PDUs in
00595          * response to an R2T.
00596          */
00597         uint32_t ttt;
00598         /** Transfer offset
00599          *
00600          * This is the offset for an in-progress sequence of data-out
00601          * PDUs in response to an R2T.
00602          */
00603         uint32_t transfer_offset;
00604         /** Transfer length
00605          *
00606          * This is the length for an in-progress sequence of data-out
00607          * PDUs in response to an R2T.
00608          */
00609         uint32_t transfer_len;
00610         /** Command sequence number
00611          *
00612          * This is the sequence number of the current command, used to
00613          * fill out the CmdSN field in iSCSI request PDUs.  It is
00614          * updated with the value of the ExpCmdSN field whenever we
00615          * receive an iSCSI response PDU containing such a field.
00616          */
00617         uint32_t cmdsn;
00618         /** Status sequence number
00619          *
00620          * This is the most recent status sequence number present in
00621          * the StatSN field of an iSCSI response PDU containing such a
00622          * field.  Whenever we send an iSCSI request PDU, we fill out
00623          * the ExpStatSN field with this value plus one.
00624          */
00625         uint32_t statsn;
00626         
00627         /** Basic header segment for current TX PDU */
00628         union iscsi_bhs tx_bhs;
00629         /** State of the TX engine */
00630         enum iscsi_tx_state tx_state;
00631         /** TX process */
00632         struct process process;
00633 
00634         /** Basic header segment for current RX PDU */
00635         union iscsi_bhs rx_bhs;
00636         /** State of the RX engine */
00637         enum iscsi_rx_state rx_state;
00638         /** Byte offset within the current RX state */
00639         size_t rx_offset;
00640         /** Length of the current RX state */
00641         size_t rx_len;
00642         /** Buffer for received data (not always used) */
00643         void *rx_buffer;
00644 
00645         /** Current SCSI command, if any */
00646         struct scsi_cmd *command;
00647 
00648         /** Target socket address (for boot firmware table) */
00649         struct sockaddr target_sockaddr;
00650         /** SCSI LUN (for boot firmware table) */
00651         struct scsi_lun lun;
00652         /** ACPI descriptor */
00653         struct acpi_descriptor desc;
00654 };
00655 
00656 /** iSCSI session is currently in the security negotiation phase */
00657 #define ISCSI_STATUS_SECURITY_NEGOTIATION_PHASE         \
00658         ( ISCSI_LOGIN_CSG_SECURITY_NEGOTIATION |        \
00659           ISCSI_LOGIN_NSG_OPERATIONAL_NEGOTIATION )
00660 
00661 /** iSCSI session is currently in the operational parameter
00662  * negotiation phase
00663  */
00664 #define ISCSI_STATUS_OPERATIONAL_NEGOTIATION_PHASE      \
00665         ( ISCSI_LOGIN_CSG_OPERATIONAL_NEGOTIATION |     \
00666           ISCSI_LOGIN_NSG_FULL_FEATURE_PHASE )
00667 
00668 /** iSCSI session is currently in the full feature phase */
00669 #define ISCSI_STATUS_FULL_FEATURE_PHASE ISCSI_LOGIN_CSG_FULL_FEATURE_PHASE
00670 
00671 /** Mask for all iSCSI session phases */
00672 #define ISCSI_STATUS_PHASE_MASK ( ISCSI_LOGIN_CSG_MASK | ISCSI_LOGIN_NSG_MASK )
00673 
00674 /** iSCSI session needs to send the initial security negotiation strings */
00675 #define ISCSI_STATUS_STRINGS_SECURITY 0x0100
00676 
00677 /** iSCSI session needs to send the CHAP_A string */
00678 #define ISCSI_STATUS_STRINGS_CHAP_ALGORITHM 0x0200
00679 
00680 /** iSCSI session needs to send the CHAP response */
00681 #define ISCSI_STATUS_STRINGS_CHAP_RESPONSE 0x0400
00682 
00683 /** iSCSI session needs to send the mutual CHAP challenge */
00684 #define ISCSI_STATUS_STRINGS_CHAP_CHALLENGE 0x0800
00685 
00686 /** iSCSI session needs to send the operational negotiation strings */
00687 #define ISCSI_STATUS_STRINGS_OPERATIONAL 0x1000
00688 
00689 /** Mask for all iSCSI "needs to send" flags */
00690 #define ISCSI_STATUS_STRINGS_MASK 0xff00
00691 
00692 /** Target has requested forward (initiator) authentication */
00693 #define ISCSI_STATUS_AUTH_FORWARD_REQUIRED 0x00010000
00694 
00695 /** Initiator requires target (reverse) authentication */
00696 #define ISCSI_STATUS_AUTH_REVERSE_REQUIRED 0x00020000
00697 
00698 /** Target authenticated itself correctly */
00699 #define ISCSI_STATUS_AUTH_REVERSE_OK 0x00040000
00700 
00701 /** Default initiator IQN prefix */
00702 #define ISCSI_DEFAULT_IQN_PREFIX "iqn.2010-04.org.ipxe"
00703 
00704 extern const struct setting
00705 initiator_iqn_setting __setting ( SETTING_SANBOOT_EXTRA, initiator-iqn );
00706 
00707 #endif /* _IPXE_ISCSI_H */