Print this page
NO_COMMENT


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at src/sun_nws/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at src/sun_nws/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _ISCSI_PROTOCOL_H
  28 #define _ISCSI_PROTOCOL_H
  29 
  30 #pragma ident   "@(#)iscsi_protocol.h   1.7     05/12/07 SMI"
  31 
  32 #ifdef __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 /*
  37  * iSCSI connection daemon
  38  * Copyright (C) 2001 Cisco Systems, Inc.
  39  * All rights reserved.
  40  *
  41  * This file sets up definitions of messages and constants used by the
  42  * iSCSI protocol.
  43  *
  44  */
  45 
  46 #include <sys/types.h>
  47 #include <sys/isa_defs.h>
  48 
  49 /* iSCSI listen port for incoming connections */
  50 #define ISCSI_LISTEN_PORT 3260


  62 
  63 /* for Login min, max, active version fields */
  64 #define ISCSI_MIN_VERSION       0x00
  65 #define ISCSI_DRAFT8_VERSION    0x02
  66 #define ISCSI_DRAFT20_VERSION   0x00
  67 #define ISCSI_MAX_VERSION       0x02
  68 
  69 /* Min. and Max. length of a PDU we can support */
  70 #define ISCSI_MIN_PDU_LENGTH    (8 << 9)  /* 4KB */
  71 #define ISCSI_MAX_PDU_LENGTH    (0xffffffff)    /* Huge */
  72 
  73 /* Padding word length */
  74 #define ISCSI_PAD_WORD_LEN              4
  75 
  76 /* Max. number of Key=Value pairs in a text message */
  77 #define ISCSI_MAX_KEY_VALUE_PAIRS       8192
  78 
  79 /* text separtor between key value pairs exhanged in login */
  80 #define ISCSI_TEXT_SEPARATOR    '='
  81 






  82 /* Reserved value for initiator/target task tag */
  83 #define ISCSI_RSVD_TASK_TAG     0xffffffff
  84 
  85 /* maximum length for text keys/values */
  86 #define KEY_MAXLEN 64
  87 #define VALUE_MAXLEN 255
  88 #define TARGET_NAME_MAXLEN    VALUE_MAXLEN
  89 
  90 #define ISCSI_DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH 8192
  91 
  92 /* most PDU types have a final bit */
  93 #define ISCSI_FLAG_FINAL                0x80
  94 
  95 /*
  96  * Strings used during SendTargets requests
  97  */
  98 #define ISCSI_TEXT_SEPARATOR    '='
  99 #define TARGETNAME "TargetName="
 100 #define TARGETADDRESS "TargetAddress="
 101 


 633 /* Defaults as defined by the iSCSI specification */
 634 #define ISCSI_DEFAULT_IMMEDIATE_DATA            TRUE
 635 #define ISCSI_DEFAULT_INITIALR2T                TRUE
 636 #define ISCSI_DEFAULT_FIRST_BURST_LENGTH        (64 * 1024) /* 64kbytes */
 637 #define ISCSI_DEFAULT_MAX_BURST_LENGTH          (256 * 1024) /* 256kbytes */
 638 #define ISCSI_DEFAULT_DATA_PDU_IN_ORDER         TRUE
 639 #define ISCSI_DEFAULT_DATA_SEQUENCE_IN_ORDER    TRUE
 640 #define ISCSI_DEFAULT_TIME_TO_WAIT              2 /* 2 seconds */
 641 #define ISCSI_DEFAULT_TIME_TO_RETAIN            20 /* 20 seconds */
 642 #define ISCSI_DEFAULT_HEADER_DIGEST             ISCSI_DIGEST_NONE
 643 #define ISCSI_DEFAULT_DATA_DIGEST               ISCSI_DIGEST_NONE
 644 #define ISCSI_DEFAULT_MAX_RECV_SEG_LEN          (8 * 1024)
 645 #define ISCSI_DEFAULT_MAX_XMIT_SEG_LEN          (8 * 1024)
 646 #define ISCSI_DEFAULT_MAX_CONNECTIONS           1
 647 #define ISCSI_DEFAULT_MAX_OUT_R2T               1
 648 #define ISCSI_DEFAULT_ERROR_RECOVERY_LEVEL      0
 649 #define ISCSI_DEFAULT_IFMARKER                  FALSE
 650 #define ISCSI_DEFAULT_OFMARKER                  FALSE
 651 
 652 /*













 653  * Maximum values from the iSCSI specification
 654  */
 655 #define ISCSI_MAX_HEADER_DIGEST                 3
 656 #define ISCSI_MAX_DATA_DIGEST                   3
 657 #define ISCSI_MAX_TIME2RETAIN                   3600
 658 #define ISCSI_MAX_TIME2WAIT                     3600
 659 #define ISCSI_MAX_ERROR_RECOVERY_LEVEL          2
 660 #define ISCSI_MAX_FIRST_BURST_LENGTH            0xffffff
 661 #define ISCSI_MAX_BURST_LENGTH                  0xffffff
 662 #define ISCSI_MAX_CONNECTIONS                   65535
 663 #define ISCSI_MAX_OUTSTANDING_R2T               65535
 664 #define ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH      0xffffff
 665 #define ISCSI_MAX_TPGT_VALUE                    65535 /* 16 bit numeric */
 666 
 667 /*
 668  * iqn and eui name prefixes and related defines
 669  */
 670 #define ISCSI_IQN_NAME_PREFIX                   "iqn"
 671 #define ISCSI_EUI_NAME_PREFIX                   "eui"
 672 #define ISCSI_EUI_NAME_LEN                      20 /* eui. plus 16 octets */


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License, Version 1.0 only
   6  * (the "License").  You may not use this file except in compliance
   7  * with the License.
   8  *
   9  * You can obtain a copy of the license at src/sun_nws/OPENSOLARIS.LICENSE
  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at src/sun_nws/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _ISCSI_PROTOCOL_H
  28 #define _ISCSI_PROTOCOL_H
  29 
  30 #pragma ident   "@(#)iscsi_protocol.h   1.10    08/02/29 SMI"
  31 
  32 #ifdef __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 /*
  37  * iSCSI connection daemon
  38  * Copyright (C) 2001 Cisco Systems, Inc.
  39  * All rights reserved.
  40  *
  41  * This file sets up definitions of messages and constants used by the
  42  * iSCSI protocol.
  43  *
  44  */
  45 
  46 #include <sys/types.h>
  47 #include <sys/isa_defs.h>
  48 
  49 /* iSCSI listen port for incoming connections */
  50 #define ISCSI_LISTEN_PORT 3260


  62 
  63 /* for Login min, max, active version fields */
  64 #define ISCSI_MIN_VERSION       0x00
  65 #define ISCSI_DRAFT8_VERSION    0x02
  66 #define ISCSI_DRAFT20_VERSION   0x00
  67 #define ISCSI_MAX_VERSION       0x02
  68 
  69 /* Min. and Max. length of a PDU we can support */
  70 #define ISCSI_MIN_PDU_LENGTH    (8 << 9)  /* 4KB */
  71 #define ISCSI_MAX_PDU_LENGTH    (0xffffffff)    /* Huge */
  72 
  73 /* Padding word length */
  74 #define ISCSI_PAD_WORD_LEN              4
  75 
  76 /* Max. number of Key=Value pairs in a text message */
  77 #define ISCSI_MAX_KEY_VALUE_PAIRS       8192
  78 
  79 /* text separtor between key value pairs exhanged in login */
  80 #define ISCSI_TEXT_SEPARATOR    '='
  81 
  82 /* reserved text constants for Text Mode Negotiation */
  83 #define ISCSI_TEXT_NONE                 "None"
  84 #define ISCSI_TEXT_REJECT               "Reject"
  85 #define ISCSI_TEXT_IRRELEVANT           "Irrelevant"
  86 #define ISCSI_TEXT_NOTUNDERSTOOD        "NotUnderstood"
  87 
  88 /* Reserved value for initiator/target task tag */
  89 #define ISCSI_RSVD_TASK_TAG     0xffffffff
  90 
  91 /* maximum length for text keys/values */
  92 #define KEY_MAXLEN 64
  93 #define VALUE_MAXLEN 255
  94 #define TARGET_NAME_MAXLEN    VALUE_MAXLEN
  95 
  96 #define ISCSI_DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH 8192
  97 
  98 /* most PDU types have a final bit */
  99 #define ISCSI_FLAG_FINAL                0x80
 100 
 101 /*
 102  * Strings used during SendTargets requests
 103  */
 104 #define ISCSI_TEXT_SEPARATOR    '='
 105 #define TARGETNAME "TargetName="
 106 #define TARGETADDRESS "TargetAddress="
 107 


 639 /* Defaults as defined by the iSCSI specification */
 640 #define ISCSI_DEFAULT_IMMEDIATE_DATA            TRUE
 641 #define ISCSI_DEFAULT_INITIALR2T                TRUE
 642 #define ISCSI_DEFAULT_FIRST_BURST_LENGTH        (64 * 1024) /* 64kbytes */
 643 #define ISCSI_DEFAULT_MAX_BURST_LENGTH          (256 * 1024) /* 256kbytes */
 644 #define ISCSI_DEFAULT_DATA_PDU_IN_ORDER         TRUE
 645 #define ISCSI_DEFAULT_DATA_SEQUENCE_IN_ORDER    TRUE
 646 #define ISCSI_DEFAULT_TIME_TO_WAIT              2 /* 2 seconds */
 647 #define ISCSI_DEFAULT_TIME_TO_RETAIN            20 /* 20 seconds */
 648 #define ISCSI_DEFAULT_HEADER_DIGEST             ISCSI_DIGEST_NONE
 649 #define ISCSI_DEFAULT_DATA_DIGEST               ISCSI_DIGEST_NONE
 650 #define ISCSI_DEFAULT_MAX_RECV_SEG_LEN          (8 * 1024)
 651 #define ISCSI_DEFAULT_MAX_XMIT_SEG_LEN          (8 * 1024)
 652 #define ISCSI_DEFAULT_MAX_CONNECTIONS           1
 653 #define ISCSI_DEFAULT_MAX_OUT_R2T               1
 654 #define ISCSI_DEFAULT_ERROR_RECOVERY_LEVEL      0
 655 #define ISCSI_DEFAULT_IFMARKER                  FALSE
 656 #define ISCSI_DEFAULT_OFMARKER                  FALSE
 657 
 658 /*
 659  * Minimum values from the iSCSI specification
 660  */
 661 
 662 #define ISCSI_MIN_TIME2RETAIN                   0
 663 #define ISCSI_MIN_TIME2WAIT                     0
 664 #define ISCSI_MIN_ERROR_RECOVERY_LEVEL          0
 665 #define ISCSI_MIN_RECV_DATA_SEGMENT_LENGTH      0x200
 666 #define ISCSI_MIN_FIRST_BURST_LENGTH            0x200
 667 #define ISCSI_MIN_MAX_BURST_LENGTH              0x200
 668 #define ISCSI_MIN_CONNECTIONS                   1
 669 #define ISCSI_MIN_MAX_OUTSTANDING_R2T           1
 670 
 671 /*
 672  * Maximum values from the iSCSI specification
 673  */
 674 #define ISCSI_MAX_HEADER_DIGEST                 3
 675 #define ISCSI_MAX_DATA_DIGEST                   3
 676 #define ISCSI_MAX_TIME2RETAIN                   3600
 677 #define ISCSI_MAX_TIME2WAIT                     3600
 678 #define ISCSI_MAX_ERROR_RECOVERY_LEVEL          2
 679 #define ISCSI_MAX_FIRST_BURST_LENGTH            0xffffff
 680 #define ISCSI_MAX_BURST_LENGTH                  0xffffff
 681 #define ISCSI_MAX_CONNECTIONS                   65535
 682 #define ISCSI_MAX_OUTSTANDING_R2T               65535
 683 #define ISCSI_MAX_RECV_DATA_SEGMENT_LENGTH      0xffffff
 684 #define ISCSI_MAX_TPGT_VALUE                    65535 /* 16 bit numeric */
 685 
 686 /*
 687  * iqn and eui name prefixes and related defines
 688  */
 689 #define ISCSI_IQN_NAME_PREFIX                   "iqn"
 690 #define ISCSI_EUI_NAME_PREFIX                   "eui"
 691 #define ISCSI_EUI_NAME_LEN                      20 /* eui. plus 16 octets */