• Home
  • Raw
  • Download

Lines Matching refs:ccp

163   struct ccp *ccp;  in ccp_ReportStatus()  local
167 ccp = &l->ccp; in ccp_ReportStatus()
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()
173 protoname(ccp->my_proto), protoname(ccp->his_proto)); in ccp_ReportStatus()
175 ccp->uncompout, ccp->compout, in ccp_ReportStatus()
176 ccp->compin, ccp->uncompin); in ccp_ReportStatus()
179 if (ccp->in.algorithm != -1) in ccp_ReportStatus()
181 (*algorithm[ccp->in.algorithm]->Disp)(&ccp->in.opt)); in ccp_ReportStatus()
183 if (ccp->out.algorithm != -1) { in ccp_ReportStatus()
184 o = &ccp->out.opt; in ccp_ReportStatus()
185 for (f = 0; f < ccp->out.algorithm; f++) in ccp_ReportStatus()
186 if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg])) in ccp_ReportStatus()
189 (*algorithm[ccp->out.algorithm]->Disp)(&(*o)->val)); 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()
198 prompt_Printf(arg->prompt, "incoming = %d, ", ccp->cfg.deflate.in.winsize); in ccp_ReportStatus()
199 prompt_Printf(arg->prompt, "outgoing = %d\n", ccp->cfg.deflate.out.winsize); in ccp_ReportStatus()
202 if (ccp->cfg.mppe.keybits) in ccp_ReportStatus()
203 prompt_Printf(arg->prompt, "%d bits, ", ccp->cfg.mppe.keybits); in ccp_ReportStatus()
206 switch (ccp->cfg.mppe.state) { in ccp_ReportStatus()
218 ccp->cfg.mppe.required ? ", required" : ""); in ccp_ReportStatus()
222 command_ShowNegval(ccp->cfg.neg[CCP_NEG_DEFLATE])); in ccp_ReportStatus()
224 command_ShowNegval(ccp->cfg.neg[CCP_NEG_PRED1])); in ccp_ReportStatus()
226 command_ShowNegval(ccp->cfg.neg[CCP_NEG_DEFLATE24])); in ccp_ReportStatus()
229 command_ShowNegval(ccp->cfg.neg[CCP_NEG_MPPE])); in ccp_ReportStatus()
235 ccp_SetupCallbacks(struct ccp *ccp) in ccp_SetupCallbacks() argument
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()
244 ccp_Init(struct ccp *ccp, struct bundle *bundle, struct link *l, in ccp_Init() argument
249 fsm_Init(&ccp->fsm, "CCP", PROTO_CCP, 1, CCP_MAXCODE, LogCCP, in ccp_Init()
252 ccp->cfg.deflate.in.winsize = 0; in ccp_Init()
253 ccp->cfg.deflate.out.winsize = 15; 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()
257 ccp->cfg.neg[CCP_NEG_DEFLATE] = NEG_ENABLED|NEG_ACCEPTED; in ccp_Init()
258 ccp->cfg.neg[CCP_NEG_PRED1] = NEG_ENABLED|NEG_ACCEPTED; in ccp_Init()
259 ccp->cfg.neg[CCP_NEG_DEFLATE24] = 0; in ccp_Init()
261 ccp->cfg.mppe.keybits = 0; in ccp_Init()
262 ccp->cfg.mppe.state = MPPE_ANYSTATE; in ccp_Init()
263 ccp->cfg.mppe.required = 0; in ccp_Init()
264 ccp->cfg.neg[CCP_NEG_MPPE] = NEG_ENABLED|NEG_ACCEPTED; in ccp_Init()
267 ccp_Setup(ccp); in ccp_Init()
271 ccp_Setup(struct ccp *ccp) in ccp_Setup() argument
274 ccp->fsm.open_mode = 0; in ccp_Setup()
275 ccp->his_proto = ccp->my_proto = -1; in ccp_Setup()
276 ccp->reset_sent = ccp->last_reset = -1; in ccp_Setup()
277 ccp->in.algorithm = ccp->out.algorithm = -1; in ccp_Setup()
278 ccp->in.state = ccp->out.state = NULL; in ccp_Setup()
279 ccp->in.opt.hdr.id = -1; in ccp_Setup()
280 ccp->out.opt = NULL; in ccp_Setup()
281 ccp->his_reject = ccp->my_reject = 0; in ccp_Setup()
282 ccp->uncompout = ccp->compout = 0; in ccp_Setup()
283 ccp->uncompin = ccp->compin = 0; in ccp_Setup()
298 ccp_Required(struct ccp *ccp) in ccp_Required() argument
303 if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg]) && in ccp_Required()
304 (*algorithm[f]->Required)(&ccp->fsm)) in ccp_Required()
315 ccp_MTUOverhead(struct ccp *ccp) in ccp_MTUOverhead() argument
317 if (ccp->fsm.state == ST_OPENED && ccp->out.algorithm >= 0) in ccp_MTUOverhead()
318 return algorithm[ccp->out.algorithm]->o.MTUOverhead; in ccp_MTUOverhead()
327 struct ccp *ccp = fsm2ccp(fp); in CcpInitRestartCounter() local
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()
347 struct ccp *ccp = fsm2ccp(fp); in CcpSendConfigReq() local
354 o = &ccp->out.opt; in CcpSendConfigReq()
355 alloc = ccp->his_reject == 0 && ccp->out.opt == NULL; in CcpSendConfigReq()
356 ccp->my_proto = -1; in CcpSendConfigReq()
357 ccp->out.algorithm = -1; in CcpSendConfigReq()
359 if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg]) && in CcpSendConfigReq()
360 !REJECTED(ccp, algorithm[f]->id) && in CcpSendConfigReq()
364 for (o = &ccp->out.opt; *o != NULL; o = &(*o)->next) in CcpSendConfigReq()
378 (*algorithm[f]->o.OptInit)(fp->bundle, &(*o)->val, &ccp->cfg); in CcpSendConfigReq()
388 ccp->my_proto = (*o)->val.hdr.id; in CcpSendConfigReq()
389 ccp->out.algorithm = f; in CcpSendConfigReq()
402 struct ccp *ccp = fsm2ccp(fp); in ccp_SendResetReq() local
404 ccp->reset_sent = fp->reqid; in ccp_SendResetReq()
405 ccp->last_reset = -1; in ccp_SendResetReq()
426 struct ccp *ccp = fsm2ccp(fp); in CcpRecvResetReq() local
427 if (ccp->out.state == NULL) in CcpRecvResetReq()
429 return (*algorithm[ccp->out.algorithm]->o.Reset)(ccp->out.state); in CcpRecvResetReq()
436 struct ccp *ccp = fsm2ccp(fp); in CcpLayerStart() local
439 fp->more.reqs = fp->more.naks = fp->more.rejs = ccp->cfg.fsm.maxreq * 3; in CcpLayerStart()
446 struct ccp *ccp = fsm2ccp(fp); in CcpLayerDown() local
450 if (ccp->in.state != NULL) { in CcpLayerDown()
451 (*algorithm[ccp->in.algorithm]->i.Term)(ccp->in.state); in CcpLayerDown()
452 ccp->in.state = NULL; in CcpLayerDown()
453 ccp->in.algorithm = -1; in CcpLayerDown()
455 if (ccp->out.state != NULL) { in CcpLayerDown()
456 (*algorithm[ccp->out.algorithm]->o.Term)(ccp->out.state); in CcpLayerDown()
457 ccp->out.state = NULL; in CcpLayerDown()
458 ccp->out.algorithm = -1; in CcpLayerDown()
460 ccp->his_reject = ccp->my_reject = 0; in CcpLayerDown()
462 while (ccp->out.opt) { in CcpLayerDown()
463 next = ccp->out.opt->next; in CcpLayerDown()
464 free(ccp->out.opt); in CcpLayerDown()
465 ccp->out.opt = next; in CcpLayerDown()
467 ccp_Setup(ccp); in CcpLayerDown()
474 struct ccp *ccp = fsm2ccp(fp); in CcpLayerFinish() local
483 while (ccp->out.opt) { in CcpLayerFinish()
484 next = ccp->out.opt->next; in CcpLayerFinish()
485 free(ccp->out.opt); in CcpLayerFinish()
486 ccp->out.opt = next; in CcpLayerFinish()
489 if (ccp_Required(ccp)) { in CcpLayerFinish()
501 struct ccp *ccp = fsm2ccp(fp); in CcpLayerUp() local
506 if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg]) && in CcpLayerUp()
507 (*algorithm[f]->Required)(&ccp->fsm) && in CcpLayerUp()
508 (ccp->in.algorithm != (int)f || ccp->out.algorithm != (int)f)) { in CcpLayerUp()
516 ccp->his_proto = ccp->my_proto = -1; in CcpLayerUp()
524 if (ccp->in.state == NULL && ccp->in.algorithm >= 0 && in CcpLayerUp()
525 ccp->in.algorithm < (int)NALGORITHMS) { in CcpLayerUp()
526 ccp->in.state = (*algorithm[ccp->in.algorithm]->i.Init) in CcpLayerUp()
527 (fp->bundle, &ccp->in.opt); in CcpLayerUp()
528 if (ccp->in.state == NULL) { in CcpLayerUp()
530 fp->link->name, protoname(ccp->his_proto)); in CcpLayerUp()
531 ccp->his_proto = ccp->my_proto = -1; in CcpLayerUp()
537 o = &ccp->out.opt; in CcpLayerUp()
538 if (ccp->out.algorithm > 0) in CcpLayerUp()
539 for (f = 0; f < (unsigned)ccp->out.algorithm; f++) in CcpLayerUp()
540 if (IsEnabled(ccp->cfg.neg[algorithm[f]->Neg])) in CcpLayerUp()
543 if (ccp->out.state == NULL && ccp->out.algorithm >= 0 && in CcpLayerUp()
544 ccp->out.algorithm < (int)NALGORITHMS) { in CcpLayerUp()
545 ccp->out.state = (*algorithm[ccp->out.algorithm]->o.Init) in CcpLayerUp()
547 if (ccp->out.state == NULL) { in CcpLayerUp()
549 fp->link->name, protoname(ccp->my_proto)); in CcpLayerUp()
550 ccp->his_proto = ccp->my_proto = -1; in CcpLayerUp()
556 fp->more.reqs = fp->more.naks = fp->more.rejs = ccp->cfg.fsm.maxreq * 3; in CcpLayerUp()
559 fp->link->name, protoname(ccp->my_proto), ccp->my_proto, in CcpLayerUp()
560 protoname(ccp->his_proto), ccp->his_proto); in CcpLayerUp()
570 struct ccp *ccp = fsm2ccp(fp); in CcpDecodeConfig() local
576 ccp->in.algorithm = -1; /* In case we've received two REQs in a row */ in CcpDecodeConfig()
596 ccp->my_reject |= (1 << opt->hdr.id); in CcpDecodeConfig()
604 if (IsAccepted(ccp->cfg.neg[algorithm[f]->Neg]) && in CcpDecodeConfig()
606 ccp->in.algorithm == -1) { in CcpDecodeConfig()
607 memcpy(&ccp->in.opt, opt, opt->hdr.len); in CcpDecodeConfig()
608 switch ((*algorithm[f]->i.Set)(fp->bundle, &ccp->in.opt, &ccp->cfg)) { in CcpDecodeConfig()
610 fsm_rej(dec, &ccp->in.opt); in CcpDecodeConfig()
613 fsm_nak(dec, &ccp->in.opt); in CcpDecodeConfig()
616 fsm_ack(dec, &ccp->in.opt); in CcpDecodeConfig()
617 ccp->his_proto = opt->hdr.id; in CcpDecodeConfig()
618 ccp->in.algorithm = (int)f; /* This one'll do :-) */ in CcpDecodeConfig()
626 for (o = ccp->out.opt; o != NULL; o = o->next) in CcpDecodeConfig()
634 if ((*algorithm[f]->o.Set)(fp->bundle, &o->val, &ccp->cfg) == in CcpDecodeConfig()
636 ccp->my_proto = algorithm[f]->id; in CcpDecodeConfig()
638 ccp->his_reject |= (1 << opt->hdr.id); in CcpDecodeConfig()
639 ccp->my_proto = -1; in CcpDecodeConfig()
650 ccp->his_reject |= (1 << opt->hdr.id); in CcpDecodeConfig()
651 ccp->my_proto = -1; in CcpDecodeConfig()
665 if (ccp->in.state == NULL) { in CcpDecodeConfig()
666 ccp->his_proto = -1; in CcpDecodeConfig()
667 ccp->in.algorithm = -1; in CcpDecodeConfig()
679 fsm_Input(&l->ccp.fsm, bp); in ccp_Input()
683 l->ccp.fsm.link->name, bundle_PhaseName(bundle)); in ccp_Input()
693 struct ccp *ccp = fsm2ccp(fp); in CcpRecvResetAck() local
695 if (ccp->reset_sent != -1) { in CcpRecvResetAck()
696 if (id != ccp->reset_sent) { in CcpRecvResetAck()
698 " ignored\n", fp->link->name, id, ccp->reset_sent); in CcpRecvResetAck()
702 } else if (id == ccp->last_reset) in CcpRecvResetAck()
711 ccp->last_reset = ccp->reset_sent; in CcpRecvResetAck()
712 ccp->reset_sent = -1; in CcpRecvResetAck()
713 if (ccp->in.state != NULL) in CcpRecvResetAck()
714 (*algorithm[ccp->in.algorithm]->i.Reset)(ccp->in.state); in CcpRecvResetAck()
722 if (l->ccp.fsm.state != ST_OPENED) { in ccp_LayerPush()
723 if (ccp_Required(&l->ccp)) { in ccp_LayerPush()
730 } else if (l->ccp.out.state != NULL) { in ccp_LayerPush()
731 bp = (*algorithm[l->ccp.out.algorithm]->o.Write) in ccp_LayerPush()
732 (l->ccp.out.state, &l->ccp, l, pri, proto, bp); in ccp_LayerPush()
755 if (l->ccp.fsm.state == ST_OPENED) { in ccp_LayerPull()
758 if (l->ccp.reset_sent != -1) in ccp_LayerPull()
760 fsm_Output(&l->ccp.fsm, CODE_RESETREQ, l->ccp.reset_sent, NULL, 0, in ccp_LayerPull()
762 else if (l->ccp.in.state != NULL) { in ccp_LayerPull()
763 bp = (*algorithm[l->ccp.in.algorithm]->i.Read) in ccp_LayerPull()
764 (l->ccp.in.state, &l->ccp, proto, bp); in ccp_LayerPull()
777 } else if (PROTO_COMPRESSIBLE(*proto) && l->ccp.in.state != NULL) { in ccp_LayerPull()
779 (*algorithm[l->ccp.in.algorithm]->i.DictSetup) in ccp_LayerPull()
780 (l->ccp.in.state, &l->ccp, *proto, bp); in ccp_LayerPull()
788 ccp_Proto(struct ccp *ccp) in ccp_Proto() argument
790 return !link2physical(ccp->fsm.link) || !ccp->fsm.bundle->ncp.mp.active ? in ccp_Proto()
795 ccp_SetOpenMode(struct ccp *ccp) in ccp_SetOpenMode() argument
800 if (IsEnabled(ccp->cfg.neg[f])) { in ccp_SetOpenMode()
801 ccp->fsm.open_mode = 0; in ccp_SetOpenMode()
805 ccp->fsm.open_mode = OPEN_PASSIVE; /* Go straight to ST_STOPPED ? */ in ccp_SetOpenMode()
808 if (IsAccepted(ccp->cfg.neg[f])) in ccp_SetOpenMode()