70 static const char *ppperr_strerr[] = {
84 static void fsm_timeout (
void *);
85 static void fsm_rconfreq (
fsm *, u_char, u_char *,
int);
86 static void fsm_rconfack (
fsm *,
int, u_char *,
int);
87 static void fsm_rconfnakrej (
fsm *,
int,
int, u_char *,
int);
88 static void fsm_rtermreq (
fsm *,
int, u_char *,
int);
89 static void fsm_rtermack (
fsm *);
90 static void fsm_rcoderej (
fsm *, u_char *,
int);
91 static void fsm_sconfreq (
fsm *,
int);
93 #define PROTO_NAME(f) ((f)->callbacks->proto_name)
123 int oldState = f->
state;
144 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
148 PROTO_NAME(f), oldState, ppperr_strerr[oldState], f->
state, ppperr_strerr[f->
state]));
160 int oldState = f->
state;
178 UNTIMEOUT(fsm_timeout, f);
186 UNTIMEOUT(fsm_timeout, f);
198 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
202 PROTO_NAME(f), oldState, ppperr_strerr[oldState], f->
state, ppperr_strerr[f->
state]));
212 int oldState = f->
state;
247 PROTO_NAME(f), oldState, ppperr_strerr[oldState], f->
state, ppperr_strerr[f->
state]));
258 terminate_layer(
fsm *f,
int nextstate)
273 int oldState = f->
state;
295 UNTIMEOUT(fsm_timeout, f);
311 PROTO_NAME(f), reason, oldState, ppperr_strerr[oldState], f->
state, ppperr_strerr[f->
state]));
319 fsm_timeout(
void *arg)
328 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
338 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
352 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
359 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
373 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
384 u_char *inp = inpacket;
417 FSMDEBUG(
LOG_INFO, (
"fsm_input(%s):%d,%d,%d\n", PROTO_NAME(f), code,
id, l));
423 fsm_rconfreq(f,
id, inp, len);
427 fsm_rconfack(f,
id, inp, len);
432 fsm_rconfnakrej(f, code,
id, inp, len);
436 fsm_rtermreq(f,
id, inp, len);
444 fsm_rcoderej(f, inp, len);
462 fsm_rconfreq(
fsm *f, u_char
id, u_char *inp,
int len)
464 int code, reject_if_disagree;
467 PROTO_NAME(f),
id, f->
state, ppperr_strerr[f->
state]));
506 fsm_sdata(f, (u_char)code,
id, inp, len);
510 UNTIMEOUT(fsm_timeout, f);
535 fsm_rconfack(
fsm *f,
int id, u_char *inp,
int len)
538 PROTO_NAME(f),
id, f->
state, ppperr_strerr[f->
state]));
546 PROTO_NAME(f), len));
564 UNTIMEOUT(fsm_timeout, f);
570 UNTIMEOUT(fsm_timeout, f);
594 fsm_rconfnakrej(
fsm *f,
int code,
int id, u_char *inp,
int len)
596 int (*proc) (
fsm *, u_char *, int);
600 PROTO_NAME(f),
id, f->
state, ppperr_strerr[f->
state]));
606 if (!proc || !((ret = proc(f, inp, len)))) {
609 PROTO_NAME(f), (code==
CONFNAK?
"Nak":
"reject"), len));
623 UNTIMEOUT(fsm_timeout, f);
633 UNTIMEOUT(fsm_timeout, f);
654 fsm_rtermreq(
fsm *f,
int id, u_char *p,
int len)
659 PROTO_NAME(f),
id, f->
state, ppperr_strerr[f->
state]));
693 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
697 UNTIMEOUT(fsm_timeout, f);
705 UNTIMEOUT(fsm_timeout, f);
724 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
733 fsm_rcoderej(
fsm *f, u_char *inp,
int len)
738 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
747 PROTO_NAME(f), code,
id));
765 UNTIMEOUT(fsm_timeout, f);
778 UNTIMEOUT(fsm_timeout, f);
803 PROTO_NAME(f), f->
state, ppperr_strerr[f->
state]));
812 fsm_sconfreq(
fsm *f,
int retransmit)
857 PROTO_NAME(f), f->
reqid));
867 fsm_sdata(
fsm *f, u_char code, u_char
id, u_char *data,
int datalen)
873 outp = outpacket_buf[f->
unit];
874 if (datalen > peer_mru[f->
unit] - (
int)HEADERLEN) {
877 if (datalen && data != outp + PPP_HDRLEN + HEADERLEN) {
878 BCOPY(data, outp + PPP_HDRLEN + HEADERLEN, datalen);
884 PUTSHORT(outlen, outp);
885 pppWrite(f->
unit, outpacket_buf[f->
unit], outlen + PPP_HDRLEN);
887 PROTO_NAME(f), code,
id, outlen));