File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / mpd / src / chap.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 08:44:29 2013 UTC (10 years, 11 months ago) by misho
Branches: mpd, MAIN
CVS tags: v5_9p16, v5_9, v5_8p7, v5_8p1_cross, v5_8p1, v5_8, v5_7p0, v5_7, v5_6, HEAD
5.7

    1: 
    2: /*
    3:  * chap.h
    4:  *
    5:  * Written by Toshiharu OHNO <tony-o@iij.ad.jp>
    6:  * Copyright (c) 1993, Internet Initiative Japan, Inc. All rights reserved.
    7:  * See ``COPYRIGHT.iij''
    8:  * 
    9:  * Rewritten by Archie Cobbs <archie@freebsd.org>
   10:  * Copyright (c) 1995-1999 Whistle Communications, Inc. All rights reserved.
   11:  * See ``COPYRIGHT.whistle''
   12:  */
   13: 
   14: #ifndef _CHAP_H_
   15: #define	_CHAP_H_
   16: 
   17: #include "mbuf.h"
   18: #include "timer.h"
   19: 
   20: /*
   21:  * DEFINITIONS
   22:  */
   23: 
   24:   #define CHAP_CHALLENGE	1
   25:   #define CHAP_RESPONSE		2
   26:   #define CHAP_SUCCESS		3
   27:   #define CHAP_FAILURE		4
   28:   #define CHAP_MS_V1_CHANGE_PW	5
   29:   #define CHAP_MS_V2_CHANGE_PW	7
   30: 
   31:   #define CHAP_MAX_NAME		64
   32:   #define CHAP_MAX_VAL		64
   33: 
   34:   #define CHAP_ALG_MD5		0x05
   35:   #define CHAP_ALG_MSOFT	0x80
   36:   #define CHAP_ALG_MSOFTv2	0x81
   37: 
   38:   #define CHAP_MSOFT_CHAL_LEN	8
   39:   #define CHAP_MSOFTv2_CHAL_LEN	16
   40:   #define CHAP_MSOFTv2_RESP_LEN	24
   41: 
   42:   #define MSCHAP_ERROR_RESTRICTED_LOGON_HOURS	646 
   43:   #define MSCHAP_ERROR_ACCT_DISABLED		647 
   44:   #define MSCHAP_ERROR_PASSWD_EXPIRED		648 
   45:   #define MSCHAP_ERROR_NO_DIALIN_PERMISSION	649 
   46:   #define MSCHAP_ERROR_AUTHENTICATION_FAILURE	691 
   47:   #define MSCHAP_ERROR_CHANGING_PASSWORD	709
   48: 
   49:   struct chapinfo
   50:   {
   51:     int			proto;				/* CHAP, EAP */
   52:     short		next_id;			/* Packet id */
   53:     short		retry;				/* Resend count */
   54:     struct pppTimer	chalTimer;			/* Challenge timer */
   55:     struct pppTimer	respTimer;			/* Reponse timer */
   56:     u_char		*resp;				/* Response packet */
   57:     short		resp_len;			/* Response length */
   58:     u_char		resp_id;			/* Response ID */
   59:   };
   60:   typedef struct chapinfo	*ChapInfo;
   61: 
   62:   struct chapparams
   63:   {
   64:     u_char		chal_data[CHAP_MAX_VAL];	/* Challenge sent */
   65:     u_char		value[CHAP_MAX_VAL];		/* Chap packet */
   66:     int			chal_len;			/* Challenge length */
   67:     int			value_len;			/* Packet length */
   68:   };
   69:   typedef struct chapparams	*ChapParams;
   70: 
   71:   struct mschapvalue {
   72:     u_char	lmHash[24];
   73:     u_char	ntHash[24];
   74:     u_char	useNT;
   75:   };
   76: 
   77:   struct mschapv2value {
   78:     u_char	peerChal[16];
   79:     u_char	reserved[8];
   80:     u_char	ntHash[24];
   81:     u_char	flags;
   82:   };
   83:   
   84:   struct mschapv2value_cpw {
   85:     u_char	encryptedPass[516];
   86:     u_char	encryptedHash[16];
   87:     u_char	peerChal[16];
   88:     u_char	reserved[8];
   89:     u_char	ntResponse[24];    
   90:     u_char	flags[2];
   91:   };
   92:  
   93:   struct authdata;
   94: /*
   95:  * FUNCTIONS
   96:  */
   97: 
   98:   extern void	ChapStart(Link l, int which);
   99:   extern void	ChapStop(ChapInfo chap);
  100:   extern void	ChapInput(Link l, struct authdata *auth, const u_char *pkt, u_short len);
  101:   extern void	ChapSendChallenge(Link l);
  102:   extern void	ChapChalTimeout(void *ptr);
  103:   extern const	char *ChapCode(int code, char *buf, size_t len);
  104:   extern void	ChapInputFinish(Link l, struct authdata *auth);
  105: 
  106: #endif
  107: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>