#ifndef __SECUPASS_AUTH_H__
#define __SECUPASS_AUTH_H__

#ifndef NULL
#define NULL 0
#endif
//声明C名称修饰
#ifdef __cplusplus
extern "C" {
#endif
#define		MAX_HOSTLEN					20		//主机ip最大长度(*.*.*.*格式)
#define		MAX_SHARELEN				20		//共享密钥最大长度
#define		MAX_PWDLEN					128		//密码最大长度
#define		MAX_PACKETLEN				512		//请求包最大长度
#define		RD_ERROR_SUCCESS			0		//成功
#define		RD_ERROR_INVALID_USERNAME	-1		//用户名不可用
#define		RD_ERROR_INVALID_PWD		-2		//密码不可用
#define		RD_ERROR_INVALIDHOST		-3		//认证服务不可用
#define		RD_ERROR_INVALIDPCNAME		-4		//得到计算机名失败
#define		RD_ERROR_GENRAFAILED		-5		//生成请求认证字失败
#define		RD_ERROR_GENPWDFAILED		-6		//生成密码密文失败
#define		RD_ERROR_CREATEPKTFAILED	-7		//生成认证数据包失败
#define		RD_ERROR_CREATESOCKETFAILED -8		//初始化套接字失败
#define		RD_ERROR_SENDDATAFAILED		-9		//发送数据失败
#define		RD_ERROR_RECVDATAFAILED		-10		//接受数据失败
#define		RD_ERROR_INVALIDPKT			-11		//无效数据包
#define		RD_ERROR_NORESPONSE			-12		//请求无响应
#define		RD_ERROR_AUTHFAILED			-13		//接入请求失败
#define		RD_ERROR_GETCHALLENGEFAILED -14		//获得挑战失败
#define     RD_ERROR_REMOTESOCKETCLOSED -15		//服务套接字关闭
#define     RD_ERROR_INITSOCKFAILED		-16		//wsastartup失败
	
#define		RD_ERROR_CHALLENGENEED		1		//需要回应挑战
	
	

//////////////////////////////////////////////////////////
#define		RD_REQUESTCODE_AUTH		1		//请求接入
#define		RD_REQUESTCODE_ACCEPT	2		//认证成功
#define		RD_REQUESTCODE_REJECT	3		//接入拒绝
#define		RD_REQUESTCODE_CHALLENGE 11		//挑战应答
	
#ifndef NULL
#define NULL 0
#endif
/************************************************************************/
/* function: secuauth (OTP Authentication Interface)
/* params  : char *phost -- authentication server
/*			 char *pshare -- share key between authentication server and the client
/*			 int nsharelen -- length of the share key
/*			 char *pszusername -- username to be authenticated
/*			 int nusernamelen -- length of the username
/*			 char *pszpassword -- password for authentication (OTP/OTP+PIN)
/*			 int npasswordlen -- length og the password
/*			 int *pnchallenge -- receive the challenge
/*			 int *pbvalidresponse -- weather get response message
/*			 char *presponse -- buffer to save the response message
/*			 int nmaxbuflen -- the max length of the response buffer
/*			 unsigned short uport -- port of the authentication service
/*			 int nwaittime -- max waite time for the server response	
/************************************************************************/

int secuauth(char *phost, char *pshare, int nsharelen, char *pszusername, int nusernamelen, 
			 char *pszpassword, int npasswordlen, int *pnchallenge, int *pbvalidresponse,
			 char *presponse/* = NULL*/, int nmaxbuflen/* = 0*/,
			 unsigned short uport/* = 1812*/, int nwaittime/* = 3*/);

//声明C名称修饰
#ifdef __cplusplus
}
#endif
#endif