1706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh/*-
2706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * Copyright (c) 1996 - 2001 Brian Somers <brian@Awfulhak.org>
3706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh *          based on work by Toshiharu OHNO <tony-o@iij.ad.jp>
4706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh *                           Internet Initiative Japan, Inc (IIJ)
5706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * All rights reserved.
6706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh *
7706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * Redistribution and use in source and binary forms, with or without
8706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * modification, are permitted provided that the following conditions
9706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * are met:
10706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * 1. Redistributions of source code must retain the above copyright
11706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh *    notice, this list of conditions and the following disclaimer.
12706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * 2. Redistributions in binary form must reproduce the above copyright
13706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh *    notice, this list of conditions and the following disclaimer in the
14706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh *    documentation and/or other materials provided with the distribution.
15706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh *
16706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * SUCH DAMAGE.
27706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh *
28706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh * $FreeBSD: src/usr.sbin/ppp/fsm.h,v 1.29.14.1 2010/12/21 17:10:29 kensmith Exp $
29706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh */
30706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
31706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh/*
32706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh *  State of machine
33706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh */
34706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_INITIAL	0
35706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_STARTING	1
36706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_CLOSED	2
37706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_STOPPED	3
38706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_CLOSING	4
39706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_STOPPING	5
40706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_REQSENT	6
41706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_ACKRCVD	7
42706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_ACKSENT	8
43706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_OPENED	9
44706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
45706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_MAX		10
46706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	ST_UNDEF	-1
47706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
48706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	MODE_REQ	0
49706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	MODE_NAK	1
50706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	MODE_REJ	2
51706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	MODE_NOP	3
52706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	MODE_ACK	4	/* pseudo mode for ccp negotiations */
53706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
54706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	OPEN_PASSIVE	-1
55706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
56706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define FSM_REQ_TIMER	1
57706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define FSM_TRM_TIMER	2
58706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
59706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define FSM_OPTLEN	100
60706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
61706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct fsm;
62706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
63706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct fsm_retry {
64706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_int timeout;                             /* FSM retry frequency */
65706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_int maxreq;                              /* Max Config REQ retries */
66706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_int maxtrm;                              /* Max Term REQ retries */
67706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh};
68706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
69706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct fsm_decode {
70706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_char ack[FSM_OPTLEN], *ackend;
71706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_char nak[FSM_OPTLEN], *nakend;
72706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_char rej[FSM_OPTLEN], *rejend;
73706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh};
74706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
75706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct fsm_callbacks {
76706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  int (*LayerUp)(struct fsm *);                 /* Layer is now up (tlu) */
77706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*LayerDown)(struct fsm *);              /* About to come down (tld) */
78706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*LayerStart)(struct fsm *);             /* Layer about to start (tls) */
79706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*LayerFinish)(struct fsm *);            /* Layer now down (tlf) */
80706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*InitRestartCounter)(struct fsm *, int);/* Set fsm timer load */
81706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*SendConfigReq)(struct fsm *);          /* Send REQ please */
82706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*SentTerminateReq)(struct fsm *);       /* Term REQ just sent */
83706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*SendTerminateAck)(struct fsm *, u_char); /* Send Term ACK please */
84706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*DecodeConfig)(struct fsm *, u_char *, u_char *, int,
85706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh                       struct fsm_decode *);    /* Deal with incoming data */
86706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  int (*RecvResetReq)(struct fsm *fp);          /* Reset output */
87706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*RecvResetAck)(struct fsm *fp, u_char); /* Reset input */
88706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh};
89706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
90706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct fsm_parent {
91706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*LayerStart) (void *, struct fsm *);         /* tls */
92706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*LayerUp) (void *, struct fsm *);            /* tlu */
93706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*LayerDown) (void *, struct fsm *);          /* tld */
94706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void (*LayerFinish) (void *, struct fsm *);        /* tlf */
95706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  void *object;
96706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh};
97706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
98706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct link;
99706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct bundle;
100706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
101706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct fsm {
102706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  const char *name;		/* Name of protocol */
103706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_short proto;		/* Protocol number */
104706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_short min_code;
105706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_short max_code;
106706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  int open_mode;		/* Delay before config REQ (-1 forever) */
107706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  unsigned state;		/* State of the machine */
108706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_char reqid;			/* Next request id */
109706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  int restart;			/* Restart counter value */
110706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
111706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  struct {
112706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh    int reqs;			/* Max config REQs before a close() */
113706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh    int naks;			/* Max config NAKs before a close() */
114706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh    int rejs;			/* Max config REJs before a close() */
115706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  } more;
116706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
117706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  struct pppTimer FsmTimer;	/* Restart Timer */
118706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  struct pppTimer OpenTimer;	/* Delay before opening */
119706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
120706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  /*
121706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh   * This timer times the ST_STOPPED state out after the given value
122706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh   * (specified via "set stopped ...").  Although this isn't specified in the
123706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh   * rfc, the rfc *does* say that "the application may use higher level
124706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh   * timers to avoid deadlock". The StoppedTimer takes effect when the other
125706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh   * side ABENDs rather than going into ST_ACKSENT (and sending the ACK),
126706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh   * causing ppp to time out and drop into ST_STOPPED.  At this point,
127706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh   * nothing will change this state :-(
128706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh   */
129706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  struct pppTimer StoppedTimer;
130706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  int LogLevel;
131706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
132706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  /* The link layer active with this FSM (may be our bundle below) */
133706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  struct link *link;
134706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
135706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  /* Our high-level link */
136706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  struct bundle *bundle;
137706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
138706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  const struct fsm_parent *parent;
139706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  const struct fsm_callbacks *fn;
140706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh};
141706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
142706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct fsmheader {
143706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_char code;			/* Request code */
144706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_char id;			/* Identification */
145706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_short length;		/* Length of packet */
146706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh};
147706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
148706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_CONFIGREQ	1
149706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_CONFIGACK	2
150706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_CONFIGNAK	3
151706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_CONFIGREJ	4
152706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_TERMREQ	5
153706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_TERMACK	6
154706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_CODEREJ	7
155706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_PROTOREJ	8
156706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_ECHOREQ	9	/* Used in LCP */
157706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_ECHOREP	10	/* Used in LCP */
158706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_DISCREQ	11
159706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_IDENT	12	/* Used in LCP Extension */
160706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_TIMEREM	13	/* Used in LCP Extension */
161706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_RESETREQ	14	/* Used in CCP */
162706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define	CODE_RESETACK	15	/* Used in CCP */
163706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
164706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct fsm_opt_hdr {
165706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_char id;
166706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_char len;
167706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh} __packed;
168706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
169706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define MAX_FSM_OPT_LEN 52
170706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehstruct fsm_opt {
171706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  struct fsm_opt_hdr hdr;
172706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  u_char data[MAX_FSM_OPT_LEN-2];
173706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh};
174706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
175706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh#define INC_FSM_OPT(ty, length, o)                      \
176706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  do {                                                  \
177706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh    (o)->hdr.id = (ty);                                 \
178706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh    (o)->hdr.len = (length);                            \
179706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh    (o) = (struct fsm_opt *)((u_char *)(o) + (length)); \
180706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh  } while (0)
181706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
182706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh
183706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_Init(struct fsm *, const char *, u_short, int, int, int,
184706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh                     struct bundle *, struct link *, const  struct fsm_parent *,
185706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yeh                     struct fsm_callbacks *, const char * const [3]);
186706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_Output(struct fsm *, u_int, u_int, u_char *, unsigned, int);
187706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_Open(struct fsm *);
188706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_Up(struct fsm *);
189706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_Down(struct fsm *);
190706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_Input(struct fsm *, struct mbuf *);
191706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_Close(struct fsm *);
192706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern int fsm_NullRecvResetReq(struct fsm *);
193706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_NullRecvResetAck(struct fsm *, u_char);
194706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_Reopen(struct fsm *);
195706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm2initial(struct fsm *);
196706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern const char *State2Nam(u_int);
197706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern struct fsm_opt *fsm_readopt(u_char **);
198706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_rej(struct fsm_decode *, const struct fsm_opt *);
199706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_ack(struct fsm_decode *, const struct fsm_opt *);
200706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_nak(struct fsm_decode *, const struct fsm_opt *);
201706e567fc5ff6b79738a5f470e5aa7b2cae76459Chia-chi Yehextern void fsm_opt_normalise(struct fsm_decode *);
202