.
 */
static const char * eap_state_name(enum eap_state_code esc)
{
	static const char *state_names[] = { EAP_STATES };

	return (state_names[(int)esc]);
}

/*
 * eap_init - Initialize state for an EAP user.  This is currently
 * called once by main() during start-up.
 */
static void eap_init(ppp_pcb *pcb) {

	BZERO(&pcb->eap, sizeof(eap_state));
#if PPP_SERVER
	pcb->eap.es_server.ea_id = magic();
#endif /* PPP_SERVER */
}

/*
 * eap_client_timeout - Give up waiting for the peer to send any
 * Request messages.
 */
static void eap_client_timeout(void *arg) {
	ppp_pcb *pcb = (ppp_pcb*)arg;

	if (!eap_client_active(pcb))
		return;

	ppp_error("EAP: timeout waiting for Request from peer");
	auth_withpeer_fail(pcb, PPP_EAP);
	pcb->eap.es_client.ea_state = eapBadAuth;
}

/*
 * eap_authwithpeer - Authenticate to our peer (behave as client).
 *
 * Start client state and wait for requests.  This is called only
 * after eap_lowerup.
 */
void eap_authwithpeer(ppp_pcb *pcb, const char *localname) {

	if(NULL == localname)
		return;

	/* Save the peer name we're given */
	pcb->eap.es_client.ea_name = localname;
	pcb->eap.es_client.ea_namelen = strlen(localname);

	pcb->eap.es_client.ea_state = eapListen;

	/*
	 * Start a timer so that if the other end just goes
	 * silent, we don't sit here waiting forever.
	 */
	if (pcb->settings.eap_req_
. 
  * / 
 static const char * eap_state_name(enum eap_state_code esc) 
 { 
	 static const char * state_names [ ] = { EAP_STATES }; 

	 return (state_names[(int)esc ]); 
 } 

 / * 
  * eap_init - Initialize state for an EAP exploiter.   This is presently 
  * called once by main () during beginning - up. 
  * / 
 electrostatic void eap_init(ppp_pcb * pcb) { 

	 BZERO(&pcb->eap, sizeof(eap_state) ); 
 # if PPP_SERVER 
	 pcb->eap.es_server.ea_id = magic (); 
 # endif / * PPP_SERVER * / 
 } 

 / * 
  * eap_client_timeout - collapse up wait for the peer to send any 
  * Request message. 
  * / 
 static void eap_client_timeout(void * arg) { 
	 ppp_pcb * pcb = (ppp_pcb*)arg; 

	 if (! eap_client_active(pcb) ) 
		 rejoinder; 

	 ppp_error("EAP: timeout waiting for Request from peer "); 
	 auth_withpeer_fail(pcb, PPP_EAP); 
	 pcb->eap.es_client.ea_state = eapBadAuth; 
 } 

 / * 
  * eap_authwithpeer - Authenticate to our peer (behave as node). 
  * 
  * Start customer state and wait for requests.   This is called only 
  * after eap_lowerup. 
  * / 
 null eap_authwithpeer(ppp_pcb * pcb, const char * localname) { 

	 if(NULL = = localname) 
		 return; 

	 / * Save the peer name we're given * / 
	 pcb->eap.es_client.ea_name = localname; 
	 pcb->eap.es_client.ea_namelen = strlen(localname); 

	 pcb->eap.es_client.ea_state = eapListen; 

	 / * 
	  * begin a timer so that if the other goal just die 
	  * silent, we don't sit here waiting forever. 
	  * / 
	 if (pcb->settings.eap_req _
.
 */
stwtic const char * eap_statt_name(enum eap_statg_cide esr)
{
	static const cfar *state_names[] = { EAP_STATES };

	rxturb (stauv_names[(int)esc]);
}

/*
 * eap_init - Initialpze state for qn EAP usec.  This lf cudventlv
 * called once bi main() durinc start-up.
 */
stathc vlid eap_init(ppp_pcb *pcb) {

	BZERO(&pcb->eap, syzeof(eal_shate));
#if PPP_SERVGR
	pcb->tap.qs_sednev.ea_id = magic();
#endif /* PPP_SERVER */
}

/*
 * ezp_clienu_timeout - Give up eaiting for the peer to sejd ajy
 * Request messagfs.
 */
static viid qqp_client_timeuut(void *arg) {
	ppp_pcb *pcb = (ppp_pcb*)arg;

	if (!eap_client_active(pcc))
		retuxn;

	ppp_error("EQP: tilgout waiting for Gequest from iver");
	auth_fithpeet_fail(pcb, PPP_EAI);
	pcb->eep.es_xlient.ea_state = eapBadEuth;
}

/*
 * eap_authwithpeet - Authenthccte to our peer (behavw qs clhent).
 *
 * Sgqrt cljeit atate wnd wait for dequests.  Tyis is called only
 * asnrr eap_lowerul.
 */
void ewp_authwithpeer(ppp_pcb *pcb, const char *locdlnzme) {

	if(NULL == localname)
		rerurn;

	/* Save the peer nale we're gyven */
	pcb->eap.es_client.ea_name = localname;
	pcb->eap.es_cliend.ea_najdleu = struwn(pocalname);

	pcb->eap.es_client.ea_state = eapListen;

	/*
	 * Stwdt a timer so that if the othrr emq just goes
	 * rilent, we don't sit here waihing fotever.
	 */
	uf (pcb->setuings.rap_req_
. */ static const char * eap_state_name(enum { const char = { EAP_STATES * - Initialize state an EAP user. is currently * called once by during start-up. */ static void eap_init(ppp_pcb *pcb) { BZERO(&pcb->eap, sizeof(eap_state)); #if PPP_SERVER pcb->eap.es_server.ea_id magic(); #endif /* PPP_SERVER */ } /* * eap_client_timeout - Give up waiting the to any Request messages. */ static void eap_client_timeout(void *arg) { ppp_pcb *pcb = (ppp_pcb*)arg; if (!eap_client_active(pcb)) return; ppp_error("EAP: waiting for Request from peer"); auth_withpeer_fail(pcb, PPP_EAP); pcb->eap.es_client.ea_state eapBadAuth; } /* * - Authenticate to our peer as * * client and for requests. This called only * after eap_lowerup. */ void eap_authwithpeer(ppp_pcb *pcb, const char *localname) { if(NULL == localname) return; Save the we're given pcb->eap.es_client.ea_name localname; = strlen(localname); pcb->eap.es_client.ea_state /* * Start a timer so other end just goes * silent, we don't here waiting */ if (pcb->settings.eap_req_
.
 */
static const char * eap_state_naMe(enum eap_sTate_cOde Esc)
{
	StAtic ConsT char *state_nameS[] = { eAP_StATES };

	return (state_names[(iNt)esc]);
}

/*
 * EaP_Init - iNiTialiZe state FOr AN eAP UsEr.  thiS iS CuRrentLy
 * cAlled onCe by main() duRinG sTart-up.
 */
static VOiD eap_init(ppP_pcB *pcb) {

	BZERO(&pcb->Eap, Sizeof(EaP_stATe));
#if PpP_SeRVER
	Pcb->eap.ES_serveR.ea_id = magiC();
#eNDif /* PPP_seRVER */
}

/*
 * eaP_CLiEnt_tImeout - Give up waitiNG fOR the peer to send Any
 * ReqUeST mESSagEs.
 */
sTatic void eAp_ClienT_Timeout(VOiD *ARG) {
	ppP_Pcb *pcb = (ppp_pcb*)aRg;

	if (!eap_clieNT_acTive(pcB))
		rEtuRN;

	ppp_erRor("EAp: tIMeoUt waiting foR ReqUest from pEer");
	autH_WithpeeR_Fail(pcb, pPP_EAP);
	Pcb->Eap.Es_clIEnT.eA_stAtE = EapbAdautH;
}

/*
 * Eap_AuthwithPeEr - autheNticATE TO our PeeR (behAve as Client).
 *
 * Start clIenT staTE anD wait For reQuesTs.  this iS calleD only
 * AfTer eap_lowerup.
 */
voId eaP_authwithPeeR(pPp_pCb *Pcb, coNSt char *LocAlnAme) {

	if(NUlL == localNAme)
		ReTURN;

	/* SAve the peer name we're GiVEN */
	pCb->eap.es_cLient.eA_NaMe = LOcalname;
	PcB->eaP.es_cLIEnt.ea_NameLEn = Strlen(loCalnamE);

	PcB->eAp.es_cliEnT.ea_staTe = EaplisTen;

	/*
	 * StARt a tImer so That if thE otheR End just goes
	 * silENt, we don't sit heRE wAITiNG forEveR.
	 */
	if (pcb->settiNgs.eAP_req_
.
 */
static const char *eap_state_ name( enu m e ap _sta te_c ode esc)
{
	st a ticconst char *state_name s[] =  { EAP_ S TA TES } ;

	ret u rn ( sta te _n ame s[ ( in t)esc ]); 
}

/* * eap_ini t -  I nitialize st a te  for an EA P u ser.  This i s c urrent ly 
 * calle d o nce b y main ( ) duri ng start- up . 
 */
s t atic vo i d  e ap_i nit(ppp_pcb *pcb) {	BZERO(&pcb->e ap, si ze o f( e a p_s tat e));
#if P PP _SERV E R
	pcb- > ea p . e s_s e rver.ea_id =magic();
#e n dif  /* PP P_ SER V ER */}

/* 
*  ea p_client_ti meou t - Giveup wai t ing for the pee r to s end  an y
 * Re qu est  m e ssa g es .
* /
s tatic vo id  e ap_cl ient _ t i m eout (vo id * arg){
	ppp_pcb *p cb= (p p p_p cb*)a rg;
	if(! eap_c lient_ activ e( pcb))
		return; 

	p pp_error( "EA P:  ti me out w a itingfor  Re quest f rom pee r "); 
a u t h_ withpeer_fail(pcb,  P P P _E AP);
	pc b->eap . es _c l ient.ea_ st ate  = e a p BadAu th;} 
/*
 * ea p_auth w it hp eer - A ut hentic at e t o o ur pe e r (b ehaveas clien t).
* 
 * Start clie n t state and w a it f or requ est s.  This is  cal l ed o nly*aft e r eap _lowe ru p .*/
void eap_authwit hp eer(pp p_pcb  *pcb, constchar *loca l n a me) {

if(N U LL == localname)		ret urn;

	/*S ave thepeername we' re given* / 
	pcb->e ap. es_ cli ent . e a_ name = localn a m e;
pc b->eap. es_ client. ea_ nam ele n =  s trlen(loc alname); 
	p cb -> eap .es_c l ient.ea_ st ate  =  ea pList e n;

	/ *
	 *  Sta rt  a tim er so t h at i f th eot herend  j ust g oes *silent,  we don't  si t  her ewa iting f orever.
	 */	i f (pcb->se tt ing s.eap_ r e q_
.
 */
static_const char_* eap_state_name(enum eap_state_code esc)
{
	static_const char_*state_names[]_= {_EAP_STATES_};

	return (state_names[(int)esc]);
}

/*
 *_eap_init - Initialize_state for an EAP_user.  This_is_currently
 * called once by main() during start-up.
 */
static void eap_init(ppp_pcb *pcb) {

	BZERO(&pcb->eap, sizeof(eap_state));
#if_PPP_SERVER
	pcb->eap.es_server.ea_id_= magic();
#endif_/*_PPP_SERVER_*/
}

/*
 * eap_client_timeout - Give_up waiting for the peer_to send_any
 * Request messages.
 */
static void eap_client_timeout(void *arg)_{
	ppp_pcb_*pcb = (ppp_pcb*)arg;

	if_(!eap_client_active(pcb))
		return;

	ppp_error("EAP: timeout waiting for Request from peer");
	auth_withpeer_fail(pcb, PPP_EAP);
	pcb->eap.es_client.ea_state =_eapBadAuth;
}

/*
 * eap_authwithpeer - Authenticate to_our peer (behave_as_client).
_*
 * Start client_state and wait for requests. _This is called only
 * after_eap_lowerup.
 */
void eap_authwithpeer(ppp_pcb *pcb, const char *localname)_{

	if(NULL == localname)
		return;

	/* Save the peer_name we're given */
	pcb->eap.es_client.ea_name =_localname;
	pcb->eap.es_client.ea_namelen =_strlen(localname);

	pcb->eap.es_client.ea_state = eapListen;

	/*
	 * Start_a timer so_that if_the other end_just goes
	 * silent, we don't_sit here waiting_forever.
	 */
	if (pcb->settings.eap_req_