/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2000 by Cisco Systems, Inc. All rights reserved.
*/
#ifndef _ISCSI_AUTHCLIENT_H
#define _ISCSI_AUTHCLIENT_H
/*
* This file is the include file for for iscsiAuthClient.c
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* Note: The ordering of these values are chosen to match
* the ordering of the keys as shown in the iSCSI spec.
* The table IscsiAuthClientKeyInfo in iscsiAuthClient.c
* must also match this order.
*/
enum iscsiAuthKeyType_t {
};
enum {
/*
* Common options for all keys.
*/
};
enum iscsiAuthNegRole_t {
};
/*
* Note: These values are chosen to map to the values sent
* in the iSCSI header.
*/
enum iscsiAuthVersion_t {
};
enum iscsiAuthStatus_t {
};
enum iscsiAuthDebugStatus_t {
};
enum iscsiAuthNodeType_t {
};
enum iscsiAuthPhase_t {
};
enum iscsiAuthLocalState_t {
};
enum iscsiAuthRemoteState_t {
};
typedef void IscsiAuthClientCallback(void *, void *, int);
struct iscsiAuthClientGlobalStats_t {
unsigned long requestSent;
unsigned long responseReceived;
};
struct iscsiAuthBufferDesc_t {
unsigned int length;
void *address;
};
struct iscsiAuthKey_t {
char *string;
};
struct iscsiAuthLargeBinaryKey_t {
unsigned int length;
unsigned char *largeBinary;
};
struct iscsiAuthKeyBlock_t {
char *stringBlock;
};
struct iscsiAuthStringBlock_t {
};
struct iscsiAuthLargeBinary_t {
};
struct iscsiAuthClient_t {
unsigned long signature;
void *glueHandle;
unsigned int authRequestId;
unsigned int authMethodCount;
unsigned int chapAlgorithmCount;
/*
* To indicate if remote authentication is enabled (0 = no 1 = yes)
* For the case of initiator, remote authentication enabled means
* enabling target authentication.
*/
int authRemote;
int passwordPresent;
unsigned int passwordLength;
unsigned int chapChallengeLength;
int ipSec;
int base64;
unsigned int authMethodValidCount;
const char *rejectOptionName;
const char *noneOptionName;
int recvInProgressFlag;
int recvEndCount;
void *userHandle;
void *messageHandle;
int negotiatedAuthMethod;
int authResponseFlag;
int authServerErrorFlag;
int transitBitSentFlag;
unsigned int sendChapIdentifier;
};
#ifdef __cplusplus
}
#endif
#include <sys/iscsi_authclientglue.h>
#ifdef __cplusplus
extern "C" {
#endif
extern int iscsiAuthClientInit(int, int, IscsiAuthBufferDesc *);
extern int iscsiAuthClientFinish(IscsiAuthClient *);
extern int iscsiAuthClientRecvBegin(IscsiAuthClient *);
extern int iscsiAuthClientRecvEnd(IscsiAuthClient *,
IscsiAuthClientCallback *, void *, void *);
extern const char *iscsiAuthClientGetKeyName(int);
extern int iscsiAuthClientGetNextKeyType(int *);
extern int iscsiAuthClientKeyNameToKeyType(const char *);
extern int iscsiAuthClientRecvKeyValue(IscsiAuthClient *, int, const char *);
extern int iscsiAuthClientSendKeyValue(IscsiAuthClient *, int, int *, char *,
unsigned int);
extern int iscsiAuthClientRecvTransitBit(IscsiAuthClient *, int);
extern int iscsiAuthClientSendTransitBit(IscsiAuthClient *, int *);
extern int iscsiAuthClientSetAuthMethodList(IscsiAuthClient *, unsigned int,
const int *);
extern int iscsiAuthClientSetAuthMethodNegRole(IscsiAuthClient *, int);
extern int iscsiAuthClientSetChapAlgorithmList(IscsiAuthClient *, unsigned int,
const int *);
extern int iscsiAuthClientSetUsername(IscsiAuthClient *, const char *);
extern int iscsiAuthClientSetPassword(IscsiAuthClient *, const unsigned char *,
unsigned int);
extern int iscsiAuthClientSetAuthRemote(IscsiAuthClient *, int);
extern int iscsiAuthClientSetGlueHandle(IscsiAuthClient *, void *);
extern int iscsiAuthClientSetMethodListName(IscsiAuthClient *, const char *);
extern int iscsiAuthClientSetIpSec(IscsiAuthClient *, int);
extern int iscsiAuthClientSetBase64(IscsiAuthClient *, int);
extern int iscsiAuthClientSetChapChallengeLength(IscsiAuthClient *,
unsigned int);
extern int iscsiAuthClientSetVersion(IscsiAuthClient *, int);
extern int iscsiAuthClientCheckPasswordNeeded(IscsiAuthClient *, int *);
extern int iscsiAuthClientGetAuthPhase(IscsiAuthClient *, int *);
extern int iscsiAuthClientGetAuthStatus(IscsiAuthClient *, int *);
extern int iscsiAuthClientAuthStatusPass(int);
extern int iscsiAuthClientGetAuthMethod(IscsiAuthClient *, int *);
extern int iscsiAuthClientGetChapAlgorithm(IscsiAuthClient *, int *);
extern int iscsiAuthClientGetChapUsername(IscsiAuthClient *, char *,
unsigned int);
extern int iscsiAuthClientSendStatusCode(IscsiAuthClient *, int *);
extern int iscsiAuthClientGetDebugStatus(IscsiAuthClient *, int *);
extern const char *iscsiAuthClientDebugStatusToText(int);
/*
* The following is called by platform dependent code.
*/
extern void iscsiAuthClientAuthResponse(IscsiAuthClient *, int);
/*
* The following routines are considered platform dependent,
* and need to be implemented for use by iscsiAuthClient.c.
*/
extern int iscsiAuthClientChapAuthRequest(IscsiAuthClient *, char *,
unsigned int,
unsigned char *, unsigned int, unsigned char *, unsigned int);
extern void iscsiAuthClientChapAuthCancel(IscsiAuthClient *);
extern int iscsiAuthClientTextToNumber(const char *, unsigned long *);
extern void iscsiAuthClientNumberToText(unsigned long, char *, unsigned int);
extern void iscsiAuthRandomSetData(unsigned char *, unsigned int);
extern void iscsiAuthMd5Init(IscsiAuthMd5Context *);
extern void iscsiAuthMd5Update(IscsiAuthMd5Context *, unsigned char *,
unsigned int);
extern void iscsiAuthMd5Final(unsigned char *, IscsiAuthMd5Context *);
extern int iscsiAuthClientData(unsigned char *, unsigned int *, unsigned char *,
unsigned int);
#ifdef __cplusplus
}
#endif
#endif /* _ISCSI_AUTHCLIENT_H */