fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Meng * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _ISCSI_DOOR_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _ISCSI_DOOR_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_REQ_SIGNATURE 0x53435349
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_REQ_VERSION_1 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_MAX_DATA_SIZE 8192
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_GETIPNODEBYNAME_REQ 0x0000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_GETIPNODEBYNAME_CNF 0x4000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_ERROR_IND 0x8000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_STATUS_SUCCESS 0x00000000
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_STATUS_REQ_LENGTH 0x00000001
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_STATUS_REQ_FORMAT 0x00000002
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_STATUS_REQ_INVALID 0x00000003
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_STATUS_REQ_VERSION 0x00000004
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define ISCSI_DOOR_STATUS_MORE 0x00000005
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _iscsi_door_msg_hdr {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t signature;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t version;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t opcode;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} iscsi_door_msg_hdr_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _getipnodebyname_req {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_door_msg_hdr_t hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t name_offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t name_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t af;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t flags;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} getipnodebyname_req_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct _getipnodebyname_cnf {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_door_msg_hdr_t hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t h_size_needed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t h_addr_list_offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t h_addr_list_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t h_addrtype;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t h_addrlen;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t h_name_offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t h_name_len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t h_alias_list_offset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t h_alias_list_length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int32_t error_num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} getipnodebyname_cnf_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef union _iscsi_door_req {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_door_msg_hdr_t hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getipnodebyname_req_t ginbn_req;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} iscsi_door_req_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef union _iscsi_door_cnf {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_door_msg_hdr_t hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte getipnodebyname_cnf_t ginbn_cnf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} iscsi_door_cnf_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef union _iscsi_door_ind {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_door_msg_hdr_t hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_door_msg_hdr_t error_ind;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} iscsi_door_ind_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef union _iscsi_door_msg {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_door_msg_hdr_t hdr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_door_req_t req;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_door_cnf_t cnf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsi_door_ind_t ind;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} iscsi_door_msg_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef _KERNEL
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Defines copied from netdb.h */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define HOST_NOT_FOUND 1 /* Authoritive Answer Host not found */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NO_RECOVERY 3 /* Non recoverable errors,FORMERR,REFUSED,NOTIMP */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NO_DATA 4 /* Valid name, no data record of requested type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NO_ADDRESS NO_DATA /* no address, look for MX record */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define AI_V4MAPPED 0x0001 /* IPv4 mapped addresses if no IPv6 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define AI_ALL 0x0002 /* IPv6 and IPv4 mapped addresses */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define AI_ADDRCONFIG 0x0004 /* AAAA or A records only if IPv6/IPv4 cnfgd */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct hostent {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *h_name; /* official name of host */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char **h_aliases; /* alias list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int h_addrtype; /* host address type */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int h_length; /* length of address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char **h_addr_list; /* list of addresses from name server */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_door_ini(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_door_term(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteboolean_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteiscsi_door_bind(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int did
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Mengvoid
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Mengiscsi_door_unbind(void);
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Meng
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortekfreehostent(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct hostent *hptr
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct hostent *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortekgetipnodebyname(
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const char *name,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int af,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int flags,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int *error_num
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else /* !_KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define kfreehostent freehostent
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define kgetipnodebyname getipnodebyname
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _KERNEL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Meng/*
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Meng * iSCSI initiator SMF service status in kernel
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Meng */
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Meng#define ISCSI_SERVICE_ENABLED 0x0
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Meng#define ISCSI_SERVICE_DISABLED 0x1
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Meng#define ISCSI_SERVICE_TRANSITION 0x2
4246c8e92ef9ad6ada2b992b7af02832ff071bf7Jack Meng
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _ISCSI_DOOR_H */