36c5fee33fa8b822175d410202aebcf592c8d342mcneal * CDDL HEADER START
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * The contents of this file are subject to the terms of the
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Common Development and Distribution License (the "License").
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * You may not use this file except in compliance with the License.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * See the License for the specific language governing permissions
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * and limitations under the License.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * When distributing Covered Code, include this CDDL HEADER in each
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * If applicable, add the following below this CDDL HEADER, with the
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * fields enclosed by brackets "[]" replaced with your own identifying
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * information: Portions Copyright [yyyy] [name of copyright owner]
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * CDDL HEADER END
2e0fe3efe5f9d579d4e44b3532d8e342c68b40cabing zhao - Sun Microsystems - Beijing China * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
36c5fee33fa8b822175d410202aebcf592c8d342mcnealextern "C" {
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * iSCSI connection daemon
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Copyright (C) 2001 Cisco Systems, Inc.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * All rights reserved.
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * This file sets up definitions of messages and constants used by the
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * iSCSI protocol.
2e0fe3efe5f9d579d4e44b3532d8e342c68b40cabing zhao - Sun Microsystems - Beijing China#define ISCSI_MAX_C_USER_LEN 512
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* iSCSI listen port for incoming connections */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* assumes a pointer to a 3-byte array */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ntoh24(p) (((p)[0] << 16) | ((p)[1] << 8) | ((p)[2]))
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* assumes a pointer to a 3 byte array, and an integer value */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* for Login min, max, active version fields */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Min. and Max. length of a PDU we can support */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Padding word length */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Max. number of Key=Value pairs in a text message */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* text separtor between key value pairs exhanged in login */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap/* reserved text constants for Text Mode Negotiation */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_TEXT_NOTUNDERSTOOD "NotUnderstood"
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Reserved value for initiator/target task tag */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* maximum length for text keys/values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* most PDU types have a final bit */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Strings used during SendTargets requests
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* iSCSI Template Message Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Opcode encoding bits */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Client to Server Message Opcode values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Server to Client Message Opcode values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Command Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Additional Data (Command Dependent)
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Command PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Command Attribute values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Response Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Response or Sense Data (optional)
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* 10.2.2.3 - Extended CDB Additional Header Segment */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Command Response PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* iSCSI Status values. Valid if Rsp Selector bit is not set */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Asynchronous Event Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* iSCSI Event Indicator values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* NOP-Out Message */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* NOP-In Message */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Task Management Message Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Function values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Task Management Response Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Response values */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Maintained for backward compatibility.
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define SCSI_TCP_TM_RESP_NO_FAILOVER SCSI_TCP_TM_RESP_NO_ALLG_REASSN
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define SCSI_TCP_TM_RESP_IN_PRGRESS SCSI_TCP_TM_RESP_FUNC_NOT_SUPP
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Ready To Transfer Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Data Hdr */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SCSI Data Response Hdr */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Data Response PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Text Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Text - key=value pairs
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Text Response Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Text Response - key:value pairs
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login Header */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap uint8_t isid[ISCSI_ISID_LEN]; /* Initiator Session ID */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK 0x0C /* 2 bits */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK 0x03 /* 2 bits */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login Response Header */
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap uint8_t isid[ISCSI_ISID_LEN]; /* Initiator Session ID */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t status_class; /* see Login RSP ststus classes below */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t status_detail; /* see Login RSP Status details below */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login stage (phase) codes for CSG, NSG */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login Status response classes */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Login Status response detail codes */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Class-0 (Success) */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Class-1 (Redirection) */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Class-2 (Initiator Error) */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Class-3 (Target Error) */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Logout Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Logout PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* logout reason_code values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Logout Response Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal uint8_t response; /* see Logout response values below */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* logout response status values */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SNACK Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* SNACK PDU flags */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Reject Message Header */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Text - Rejected hdr
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Reason for Reject */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal/* Defaults as defined by the iSCSI specification */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_FIRST_BURST_LENGTH (64 * 1024) /* 64kbytes */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_MAX_BURST_LENGTH (256 * 1024) /* 256kbytes */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_DEFAULT_TIME_TO_RETAIN 20 /* 20 seconds */
1a1a84a324206b6b1f5f704ab166c4ebf78aed76Peter Dunlap#define ISCSI_DEFAULT_MAX_RECV_SEG_LEN (8 * 1024)
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap * Minimum values from the iSCSI specification
a6d42e7d71324c5193c3b94d57d96ba2925d52e1Peter Dunlap#define ISCSI_MIN_RECV_DATA_SEGMENT_LENGTH 0x200
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * Maximum values from the iSCSI specification
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_MAX_TPGT_VALUE 65535 /* 16 bit numeric */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal * iqn and eui name prefixes and related defines
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#define ISCSI_EUI_NAME_LEN 20 /* eui. plus 16 octets */
36c5fee33fa8b822175d410202aebcf592c8d342mcneal#endif /* _ISCSI_PROTOCOL_H */