fsm.c (a33b2ef772181930eb0cd97c51cd8b058fecbf70) fsm.c (09206a6f2a9728d53ca1ba4272ae7f4f02b67fac)
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.29 1998/06/15 19:06:42 brian Exp $
20 * $Id: fsm.c,v 1.30 1998/06/16 19:40:36 brian Exp $
21 *
22 * TODO:
23 */
24
25#include <sys/types.h>
26#include <netinet/in.h>
27#include <netinet/in_systm.h>
28#include <netinet/ip.h>

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

114 struct fsm *fp = (struct fsm *)v;
115
116 log_Printf(fp->LogLevel, "%s: Stopped timer expired\n", fp->link->name);
117 if (fp->OpenTimer.state == TIMER_RUNNING) {
118 log_Printf(LogWARN, "%s: %s: aborting open delay due to stopped timer\n",
119 fp->link->name, fp->name);
120 timer_Stop(&fp->OpenTimer);
121 }
21 *
22 * TODO:
23 */
24
25#include <sys/types.h>
26#include <netinet/in.h>
27#include <netinet/in_systm.h>
28#include <netinet/ip.h>

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

114 struct fsm *fp = (struct fsm *)v;
115
116 log_Printf(fp->LogLevel, "%s: Stopped timer expired\n", fp->link->name);
117 if (fp->OpenTimer.state == TIMER_RUNNING) {
118 log_Printf(LogWARN, "%s: %s: aborting open delay due to stopped timer\n",
119 fp->link->name, fp->name);
120 timer_Stop(&fp->OpenTimer);
121 }
122 if (fp->state == ST_STOPPED) {
123 /* Force ourselves back to initial */
124 fsm_Down(fp);
125 fsm_Close(fp);
126 }
122 if (fp->state == ST_STOPPED)
123 fsm2initial(fp);
127}
128
129void
130fsm_Init(struct fsm *fp, const char *name, u_short proto, int mincode,
131 int maxcode, int maxcfg, int LogLevel, struct bundle *bundle,
132 struct link *l, const struct fsm_parent *parent,
133 struct fsm_callbacks *fn, const char *timer_names[3])
134{

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

954}
955
956void
957fsm_NullRecvResetAck(struct fsm *fp, u_char id)
958{
959 log_Printf(fp->LogLevel, "%s: Oops - received unexpected reset ack\n",
960 fp->link->name);
961}
124}
125
126void
127fsm_Init(struct fsm *fp, const char *name, u_short proto, int mincode,
128 int maxcode, int maxcfg, int LogLevel, struct bundle *bundle,
129 struct link *l, const struct fsm_parent *parent,
130 struct fsm_callbacks *fn, const char *timer_names[3])
131{

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

951}
952
953void
954fsm_NullRecvResetAck(struct fsm *fp, u_char id)
955{
956 log_Printf(fp->LogLevel, "%s: Oops - received unexpected reset ack\n",
957 fp->link->name);
958}
959
960void
961fsm2initial(struct fsm *fp)
962{
963 if (fp->state == ST_STOPPED)
964 fsm_Close(fp);
965 if (fp->state > ST_INITIAL)
966 fsm_Down(fp);
967 if (fp->state > ST_INITIAL)
968 fsm_Close(fp);
969}