Lines Matching full:fsm
50 #include "fsm.h"
80 static void CcpSendConfigReq(struct fsm *);
81 static void CcpSentTerminateReq(struct fsm *);
82 static void CcpSendTerminateAck(struct fsm *, u_char);
83 static void CcpDecodeConfig(struct fsm *, u_char *, u_char *, int,
85 static void CcpLayerStart(struct fsm *);
86 static void CcpLayerFinish(struct fsm *);
87 static int CcpLayerUp(struct fsm *);
88 static void CcpLayerDown(struct fsm *);
89 static void CcpInitRestartCounter(struct fsm *, int);
90 static int CcpRecvResetReq(struct fsm *);
91 static void CcpRecvResetAck(struct fsm *, u_char);
169 prompt_Printf(arg->prompt, "%s: %s [%s]\n", l->name, ccp->fsm.name, in ccp_ReportStatus()
170 State2Nam(ccp->fsm.state)); in ccp_ReportStatus()
171 if (ccp->fsm.state == ST_OPENED) { in ccp_ReportStatus()
193 prompt_Printf(arg->prompt, "FSM retry = %us, max %u Config" in ccp_ReportStatus()
194 " REQ%s, %u Term REQ%s\n", ccp->cfg.fsm.timeout, in ccp_ReportStatus()
195 ccp->cfg.fsm.maxreq, ccp->cfg.fsm.maxreq == 1 ? "" : "s", in ccp_ReportStatus()
196 ccp->cfg.fsm.maxtrm, ccp->cfg.fsm.maxtrm == 1 ? "" : "s"); in ccp_ReportStatus()
237 ccp->fsm.fn = &ccp_Callbacks; in ccp_SetupCallbacks()
238 ccp->fsm.FsmTimer.name = ccp_TimerNames[0]; in ccp_SetupCallbacks()
239 ccp->fsm.OpenTimer.name = ccp_TimerNames[1]; in ccp_SetupCallbacks()
240 ccp->fsm.StoppedTimer.name = ccp_TimerNames[2]; in ccp_SetupCallbacks()
249 fsm_Init(&ccp->fsm, "CCP", PROTO_CCP, 1, CCP_MAXCODE, LogCCP, in ccp_Init()
254 ccp->cfg.fsm.timeout = DEF_FSMRETRY; in ccp_Init()
255 ccp->cfg.fsm.maxreq = DEF_FSMTRIES; in ccp_Init()
256 ccp->cfg.fsm.maxtrm = DEF_FSMTRIES; in ccp_Init()
274 ccp->fsm.open_mode = 0; in ccp_Setup()
304 (*algorithm[f]->Required)(&ccp->fsm)) in ccp_Required()
317 if (ccp->fsm.state == ST_OPENED && ccp->out.algorithm >= 0) in ccp_MTUOverhead()
324 CcpInitRestartCounter(struct fsm *fp, int what) in CcpInitRestartCounter()
326 /* Set fsm timer load */ in CcpInitRestartCounter()
329 fp->FsmTimer.load = ccp->cfg.fsm.timeout * SECTICKS; in CcpInitRestartCounter()
332 fp->restart = ccp->cfg.fsm.maxreq; in CcpInitRestartCounter()
335 fp->restart = ccp->cfg.fsm.maxtrm; in CcpInitRestartCounter()
344 CcpSendConfigReq(struct fsm *fp) in CcpSendConfigReq()
399 ccp_SendResetReq(struct fsm *fp) in ccp_SendResetReq()
410 CcpSentTerminateReq(struct fsm *fp __unused) in CcpSentTerminateReq()
412 /* Term REQ just sent by FSM */ in CcpSentTerminateReq()
416 CcpSendTerminateAck(struct fsm *fp, u_char id) in CcpSendTerminateAck()
423 CcpRecvResetReq(struct fsm *fp) in CcpRecvResetReq()
433 CcpLayerStart(struct fsm *fp) in CcpLayerStart()
439 fp->more.reqs = fp->more.naks = fp->more.rejs = ccp->cfg.fsm.maxreq * 3; in CcpLayerStart()
443 CcpLayerDown(struct fsm *fp) in CcpLayerDown()
471 CcpLayerFinish(struct fsm *fp) in CcpLayerFinish()
490 if (fp->link->lcp.fsm.state == ST_OPENED) in CcpLayerFinish()
492 fsm_Close(&fp->link->lcp.fsm); in CcpLayerFinish()
498 CcpLayerUp(struct fsm *fp) in CcpLayerUp()
507 (*algorithm[f]->Required)(&ccp->fsm) && in CcpLayerUp()
518 fsm_Close(&fp->link->lcp.fsm); in CcpLayerUp()
556 fp->more.reqs = fp->more.naks = fp->more.rejs = ccp->cfg.fsm.maxreq * 3; in CcpLayerUp()
566 CcpDecodeConfig(struct fsm *fp, u_char *cp, u_char *end, int mode_type, in CcpDecodeConfig()
644 fsm_Close(&fp->link->lcp.fsm); in CcpDecodeConfig()
655 fsm_Close(&fp->link->lcp.fsm); in CcpDecodeConfig()
679 fsm_Input(&l->ccp.fsm, bp); in ccp_Input()
683 l->ccp.fsm.link->name, bundle_PhaseName(bundle)); in ccp_Input()
690 CcpRecvResetAck(struct fsm *fp, u_char id) in CcpRecvResetAck()
722 if (l->ccp.fsm.state != ST_OPENED) { in ccp_LayerPush()
755 if (l->ccp.fsm.state == ST_OPENED) { in ccp_LayerPull()
760 fsm_Output(&l->ccp.fsm, CODE_RESETREQ, l->ccp.reset_sent, NULL, 0, in ccp_LayerPull()
790 return !link2physical(ccp->fsm.link) || !ccp->fsm.bundle->ncp.mp.active ? in ccp_Proto()
801 ccp->fsm.open_mode = 0; in ccp_SetOpenMode()
805 ccp->fsm.open_mode = OPEN_PASSIVE; /* Go straight to ST_STOPPED ? */ in ccp_SetOpenMode()
815 ccp_DefaultUsable(struct fsm *fp __unused) in ccp_DefaultUsable()
821 ccp_DefaultRequired(struct fsm *fp __unused) in ccp_DefaultRequired()