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/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2000 by Cisco Systems, Inc. All rights reserved.
2e0fe3efe5f9d579d4e44b3532d8e342c68b40cabing zhao - Sun Microsystems - Beijing China * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _ISCSIAUTHCLIENT_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _ISCSIAUTHCLIENT_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This file is the include file for for iscsiAuthClient.c
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
2e0fe3efe5f9d579d4e44b3532d8e342c68b40cabing zhao - Sun Microsystems - Beijing Chinaenum { iscsiAuthStringMaxLength = 512 };
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum { iscsiAuthStringBlockMaxLength = 1024 };
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum { iscsiAuthLargeBinaryMaxLength = 1024 };
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum { iscsiAuthRecvEndMaxCount = 10 };
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum { iscsiAuthClientSignature = 0x5984B2E3 };
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum { iscsiAuthChapResponseLength = 16 };
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: The ordering of these values are chosen to match
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the ordering of the keys as shown in the iSCSI spec.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The table IscsiAuthClientKeyInfo in iscsiAuthClient.c
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * must also match this order.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum iscsiAuthKeyType_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeNone = -1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeFirst = 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeAuthMethod = iscsiAuthKeyTypeFirst,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeChapAlgorithm,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeChapUsername,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeChapResponse,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeChapIdentifier,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeChapChallenge,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeMaxCount,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthKeyTypeLast = iscsiAuthKeyTypeMaxCount - 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthKeyType_t IscsiAuthKeyType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common options for all keys.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthOptionReject = -2,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthOptionNotPresent = -1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthOptionNone = 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthMethodChap = 2,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthMethodMaxCount = 2,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthChapAlgorithmMd5 = 5,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthChapAlgorithmMaxCount = 2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum iscsiAuthNegRole_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthNegRoleOriginator = 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthNegRoleResponder = 2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthNegRole_t IscsiAuthNegRole;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Note: These values are chosen to map to the values sent
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * in the iSCSI header.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum iscsiAuthVersion_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthVersionDraft8 = 2,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthVersionRfc = 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthVersion_t IscsiAuthVersion;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum iscsiAuthStatus_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthStatusNoError = 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthStatusError,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthStatusPass,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthStatusFail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthStatusContinue,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthStatusInProgress
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthStatus_t IscsiAuthStatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum iscsiAuthDebugStatus_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusNotSet = 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthPass,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthRemoteFalse,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthFail,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthMethodBad,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapAlgorithmBad,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusPasswordDecryptFailed,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusPasswordTooShortWithNoIpSec,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthServerError,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthStatusBad,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthPassNotValid,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusSendDuplicateSetKeyValue,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusSendStringTooLong,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusSendTooMuchData,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthMethodExpected,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapAlgorithmExpected,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapIdentifierExpected,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapChallengeExpected,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapResponseExpected,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapUsernameExpected,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthMethodNotPresent,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthMethodReject,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusAuthMethodNone,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapAlgorithmReject,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapChallengeReflected,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusPasswordIdentical,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusLocalPasswordNotSet,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapIdentifierBad,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapChallengeBad,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusChapResponseBad,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusUnexpectedKeyPresent,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusTbitSetIllegal,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusTbitSetPremature,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusRecvMessageCountLimit,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusRecvDuplicateSetKeyValue,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusRecvStringTooLong,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthDebugStatusRecvTooMuchData
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthDebugStatus_t IscsiAuthDebugStatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum iscsiAuthNodeType_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthNodeTypeInitiator = 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthNodeTypeTarget = 2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthNodeType_t IscsiAuthNodeType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum iscsiAuthPhase_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthPhaseConfigure = 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthPhaseNegotiate, /* Negotiating */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthPhaseAuthenticate, /* Authenticating */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthPhaseDone, /* Authentication done */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthPhaseError
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthPhase_t IscsiAuthPhase;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum iscsiAuthLocalState_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthLocalStateSendAlgorithm = 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthLocalStateRecvAlgorithm,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthLocalStateRecvChallenge,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthLocalStateDone,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthLocalStateError
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthLocalState_t IscsiAuthLocalState;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteenum iscsiAuthRemoteState_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthRemoteStateSendAlgorithm = 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthRemoteStateSendChallenge,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthRemoteStateRecvResponse,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthRemoteStateAuthRequest,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthRemoteStateDone,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iscsiAuthRemoteStateError
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef enum iscsiAuthRemoteState_t IscsiAuthRemoteState;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef void IscsiAuthClientCallback(void *, void *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct iscsiAuthClientGlobalStats_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned long requestSent;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned long responseReceived;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthClientGlobalStats_t IscsiAuthClientGlobalStats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct iscsiAuthBufferDesc_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *address;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthBufferDesc_t IscsiAuthBufferDesc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct iscsiAuthKey_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int present:1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int processed:1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int valueSet:1; /* 1 if the value is set to be valid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *string;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthKey_t IscsiAuthKey;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct iscsiAuthLargeBinaryKey_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int length;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char *largeBinary;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte };
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthLargeBinaryKey_t IscsiAuthLargeBinaryKey;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct iscsiAuthKeyBlock_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int transitBit:1; /* To transit: TRUE or FALSE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int duplicateSet:1; /* Set the value more than once */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int stringTooLong:1; /* Key value too long */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int tooMuchData:1; /* The keypair data blk overflows */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int blockLength:16; /* The length of the keypair data blk */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *stringBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthKey key[iscsiAuthKeyTypeMaxCount];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthKeyBlock_t IscsiAuthKeyBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct iscsiAuthStringBlock_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char stringBlock[iscsiAuthStringBlockMaxLength];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthStringBlock_t IscsiAuthStringBlock;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct iscsiAuthLargeBinary_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char largeBinary[iscsiAuthLargeBinaryMaxLength];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthLargeBinary_t IscsiAuthLargeBinary;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct iscsiAuthClient_t {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned long signature;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *glueHandle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct iscsiAuthClient_t *next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int authRequestId;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthNodeType nodeType;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int authMethodCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int authMethodList[iscsiAuthMethodMaxCount];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthNegRole authMethodNegRole;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int chapAlgorithmCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int chapAlgorithmList[iscsiAuthChapAlgorithmMaxCount];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * To indicate if remote authentication is enabled (0 = no 1 = yes)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For the case of initiator, remote authentication enabled means
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * enabling target authentication.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int authRemote;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char username[iscsiAuthStringMaxLength];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int passwordPresent;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int passwordLength;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char passwordData[iscsiAuthStringMaxLength];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char methodListName[iscsiAuthStringMaxLength];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthVersion version;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int chapChallengeLength;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ipSec;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int base64;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int authMethodValidCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int authMethodValidList[iscsiAuthMethodMaxCount];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int authMethodValidNegRole;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const char *rejectOptionName;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const char *noneOptionName;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int recvInProgressFlag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int recvEndCount;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthClientCallback *callback;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *userHandle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte void *messageHandle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthPhase phase;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthLocalState localState;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthRemoteState remoteState;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthStatus remoteAuthStatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthDebugStatus debugStatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int negotiatedAuthMethod;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int negotiatedChapAlgorithm;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int authResponseFlag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int authServerErrorFlag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int transitBitSentFlag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int sendChapIdentifier;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthLargeBinaryKey sendChapChallenge;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char chapUsername[iscsiAuthStringMaxLength];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int recvChapChallengeStatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthLargeBinaryKey recvChapChallenge;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char scratchKeyValue[iscsiAuthStringMaxLength];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthKeyBlock recvKeyBlock; /* Received keypair data */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthKeyBlock sendKeyBlock; /* Keypair data to be sent */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct iscsiAuthClient_t IscsiAuthClient;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <iscsiAuthClientGlue.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern IscsiAuthClientGlobalStats iscsiAuthClientGlobalStats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientInit(int, int, IscsiAuthBufferDesc *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientFinish(IscsiAuthClient *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientRecvBegin(IscsiAuthClient *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientRecvEnd(IscsiAuthClient *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte IscsiAuthClientCallback *, void *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const char *iscsiAuthClientGetKeyName(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetNextKeyType(int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientKeyNameToKeyType(const char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientRecvKeyValue(IscsiAuthClient *, int, const char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSendKeyValue(IscsiAuthClient *, int, int *, char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientRecvTransitBit(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSendTransitBit(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetAuthMethodList(IscsiAuthClient *, unsigned int,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetAuthMethodNegRole(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetChapAlgorithmList(IscsiAuthClient *, unsigned int,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte const int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetUsername(IscsiAuthClient *, const char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetPassword(IscsiAuthClient *, const unsigned char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetAuthRemote(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetGlueHandle(IscsiAuthClient *, void *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetMethodListName(IscsiAuthClient *, const char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetIpSec(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetBase64(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetChapChallengeLength(IscsiAuthClient *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSetVersion(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientCheckPasswordNeeded(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetAuthPhase(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetAuthStatus(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientAuthStatusPass(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetAuthMethod(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetChapAlgorithm(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetChapUsername(IscsiAuthClient *, char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientSendStatusCode(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientGetDebugStatus(IscsiAuthClient *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern const char *iscsiAuthClientDebugStatusToText(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The following is called by platform dependent code.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthClientAuthResponse(IscsiAuthClient *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The following routines are considered platform dependent,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and need to be implemented for use by iscsiAuthClient.c.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientChapAuthRequest(IscsiAuthClient *, char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned char *, unsigned int, unsigned char *, unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthClientChapAuthCancel(IscsiAuthClient *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientTextToNumber(const char *, unsigned long *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthClientNumberToText(unsigned long, char *, unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthRandomSetData(unsigned char *, unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthMd5Init(IscsiAuthMd5Context *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthMd5Update(IscsiAuthMd5Context *, unsigned char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern void iscsiAuthMd5Final(unsigned char *, IscsiAuthMd5Context *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int iscsiAuthClientData(unsigned char *, unsigned int *, unsigned char *,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _ISCSIAUTHCLIENT_H */