Deleted Added
full compact
fsm.c (31343) fsm.c (31514)
1/*
2 * PPP Finite State Machine for LCP/IPCP
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
1/*
2 * PPP Finite State Machine for LCP/IPCP
3 *
4 * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
5 *
6 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
7 *
8 * Redistribution and use in source and binary forms are permitted
9 * provided that the above copyright notice and this paragraph are
10 * duplicated in all such forms and that any documentation,
11 * advertising materials, and other materials related to such
12 * distribution and use acknowledge that the software was developed
13 * by the Internet Initiative Japan, Inc. The name of the
14 * IIJ may not be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
18 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 *
20 * $Id: fsm.c,v 1.21 1997/11/11 23:23:11 brian Exp $
20 * $Id: fsm.c,v 1.22 1997/11/22 03:37:31 brian Exp $
21 *
22 * TODO:
23 * o Refer loglevel for log output
24 * o Better option log display
25 */
26#include <sys/param.h>
27#include <netinet/in.h>
28

--- 10 unchanged lines hidden (view full) ---

39#include "hdlc.h"
40#include "lqr.h"
41#include "lcpproto.h"
42#include "lcp.h"
43#include "ccp.h"
44#include "modem.h"
45#include "loadalias.h"
46#include "vars.h"
21 *
22 * TODO:
23 * o Refer loglevel for log output
24 * o Better option log display
25 */
26#include <sys/param.h>
27#include <netinet/in.h>
28

--- 10 unchanged lines hidden (view full) ---

39#include "hdlc.h"
40#include "lqr.h"
41#include "lcpproto.h"
42#include "lcp.h"
43#include "ccp.h"
44#include "modem.h"
45#include "loadalias.h"
46#include "vars.h"
47#include "pred.h"
48
49u_char AckBuff[200];
50u_char NakBuff[200];
51u_char RejBuff[100];
52u_char ReqBuff[200];
53u_char *ackp = NULL;
54u_char *nakp = NULL;
55u_char *rejp = NULL;

--- 674 unchanged lines hidden (view full) ---

730 FsmOutput(fp, CODE_RESETACK, fp->reqid, NULL, 0);
731 pfree(bp);
732}
733
734static void
735FsmRecvResetAck(struct fsm * fp, struct fsmheader * lhp, struct mbuf * bp)
736{
737 LogPrintf(fp->LogLevel, "RecvResetAck\n");
47
48u_char AckBuff[200];
49u_char NakBuff[200];
50u_char RejBuff[100];
51u_char ReqBuff[200];
52u_char *ackp = NULL;
53u_char *nakp = NULL;
54u_char *rejp = NULL;

--- 674 unchanged lines hidden (view full) ---

729 FsmOutput(fp, CODE_RESETACK, fp->reqid, NULL, 0);
730 pfree(bp);
731}
732
733static void
734FsmRecvResetAck(struct fsm * fp, struct fsmheader * lhp, struct mbuf * bp)
735{
736 LogPrintf(fp->LogLevel, "RecvResetAck\n");
738 Pred1Init(1); /* Initialize Input part */
737 CcpResetInput();
739 fp->reqid++;
740 pfree(bp);
741}
742
738 fp->reqid++;
739 pfree(bp);
740}
741
743struct fsmcodedesc FsmCodes[] = {
742static const struct fsmcodedesc FsmCodes[] = {
744 {FsmRecvConfigReq, "Configure Request",},
745 {FsmRecvConfigAck, "Configure Ack",},
746 {FsmRecvConfigNak, "Configure Nak",},
747 {FsmRecvConfigRej, "Configure Reject",},
748 {FsmRecvTermReq, "Terminate Request",},
749 {FsmRecvTermAck, "Terminate Ack",},
750 {FsmRecvCodeRej, "Code Reject",},
751 {FsmRecvProtoRej, "Protocol Reject",},

--- 6 unchanged lines hidden (view full) ---

758 {FsmRecvResetAck, "Reset Ack",},
759};
760
761void
762FsmInput(struct fsm * fp, struct mbuf * bp)
763{
764 int len;
765 struct fsmheader *lhp;
743 {FsmRecvConfigReq, "Configure Request",},
744 {FsmRecvConfigAck, "Configure Ack",},
745 {FsmRecvConfigNak, "Configure Nak",},
746 {FsmRecvConfigRej, "Configure Reject",},
747 {FsmRecvTermReq, "Terminate Request",},
748 {FsmRecvTermAck, "Terminate Ack",},
749 {FsmRecvCodeRej, "Code Reject",},
750 {FsmRecvProtoRej, "Protocol Reject",},

--- 6 unchanged lines hidden (view full) ---

757 {FsmRecvResetAck, "Reset Ack",},
758};
759
760void
761FsmInput(struct fsm * fp, struct mbuf * bp)
762{
763 int len;
764 struct fsmheader *lhp;
766 struct fsmcodedesc *codep;
765 const struct fsmcodedesc *codep;
767
768 len = plength(bp);
769 if (len < sizeof(struct fsmheader)) {
770 pfree(bp);
771 return;
772 }
773 lhp = (struct fsmheader *) MBUF_CTOP(bp);
774 if (lhp->code == 0 || lhp->code > fp->max_code) {

--- 15 unchanged lines hidden ---
766
767 len = plength(bp);
768 if (len < sizeof(struct fsmheader)) {
769 pfree(bp);
770 return;
771 }
772 lhp = (struct fsmheader *) MBUF_CTOP(bp);
773 if (lhp->code == 0 || lhp->code > fp->max_code) {

--- 15 unchanged lines hidden ---