fsm.h (28461) | fsm.h (28679) |
---|---|
1/* 2 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 3 * 4 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 5 * 6 * Redistribution and use in source and binary forms are permitted 7 * provided that the above copyright notice and this paragraph are 8 * duplicated in all such forms and that any documentation, 9 * advertising materials, and other materials related to such 10 * distribution and use acknowledge that the software was developed 11 * by the Internet Initiative Japan. The name of the 12 * IIJ may not be used to endorse or promote products derived 13 * from this software without specific prior written permission. 14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 17 * | 1/* 2 * Written by Toshiharu OHNO (tony-o@iij.ad.jp) 3 * 4 * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd. 5 * 6 * Redistribution and use in source and binary forms are permitted 7 * provided that the above copyright notice and this paragraph are 8 * duplicated in all such forms and that any documentation, 9 * advertising materials, and other materials related to such 10 * distribution and use acknowledge that the software was developed 11 * by the Internet Initiative Japan. The name of the 12 * IIJ may not be used to endorse or promote products derived 13 * from this software without specific prior written permission. 14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 17 * |
18 * $Id: fsm.h,v 1.8 1997/06/09 03:27:21 brian Exp $ | 18 * $Id: fsm.h,v 1.9 1997/08/20 23:47:43 brian Exp $ |
19 * 20 * TODO: 21 */ 22 23#ifndef _FSM_H_ 24#define _FSM_H_ 25 26#include "defs.h" --- 21 unchanged lines hidden (view full) --- 48#define MODE_NAK 1 49#define MODE_REJ 2 50#define MODE_NOP 3 51 52#define OPEN_ACTIVE 0 53#define OPEN_PASSIVE 1 54 55struct fsm { | 19 * 20 * TODO: 21 */ 22 23#ifndef _FSM_H_ 24#define _FSM_H_ 25 26#include "defs.h" --- 21 unchanged lines hidden (view full) --- 48#define MODE_NAK 1 49#define MODE_REJ 2 50#define MODE_NOP 3 51 52#define OPEN_ACTIVE 0 53#define OPEN_PASSIVE 1 54 55struct fsm { |
56 char *name; /* Name of protocol */ | 56 char *name; /* Name of protocol */ |
57 u_short proto; /* Protocol number */ 58 u_short max_code; | 57 u_short proto; /* Protocol number */ 58 u_short max_code; |
59 int open_mode; 60 int state; /* State of the machine */ 61 int reqid; /* Next request id */ 62 int restart; /* Restart counter value */ 63 int maxconfig; | 59 int open_mode; 60 int state; /* State of the machine */ 61 int reqid; /* Next request id */ 62 int restart; /* Restart counter value */ 63 int maxconfig; |
64 | 64 |
65 int reqcode; /* Request code sent */ | 65 int reqcode; /* Request code sent */ |
66 struct pppTimer FsmTimer; /* Restart Timer */ 67 68 /* 69 * This timer times the ST_STOPPED state out after the given value | 66 struct pppTimer FsmTimer; /* Restart Timer */ 67 68 /* 69 * This timer times the ST_STOPPED state out after the given value |
70 * (specified via "set stopped ..."). Although this isn't 71 * specified in the rfc, the rfc *does* say that "the application 72 * may use higher level timers to avoid deadlock". 73 * The StoppedTimer takes effect when the other side ABENDs rather 74 * than going into ST_ACKSENT (and sending the ACK), causing ppp to 75 * time out and drop into ST_STOPPED. At this point, nothing will 76 * change this state :-( | 70 * (specified via "set stopped ..."). Although this isn't specified in the 71 * rfc, the rfc *does* say that "the application may use higher level 72 * timers to avoid deadlock". The StoppedTimer takes effect when the other 73 * side ABENDs rather than going into ST_ACKSENT (and sending the ACK), 74 * causing ppp to time out and drop into ST_STOPPED. At this point, 75 * nothing will change this state :-( |
77 */ 78 struct pppTimer StoppedTimer; 79 int LogLevel; 80 | 76 */ 77 struct pppTimer StoppedTimer; 78 int LogLevel; 79 |
81 void (*LayerUp)(struct fsm *); 82 void (*LayerDown)(struct fsm *); 83 void (*LayerStart)(struct fsm *); 84 void (*LayerFinish)(struct fsm *); 85 void (*InitRestartCounter)(struct fsm *); 86 void (*SendConfigReq)(struct fsm *); 87 void (*SendTerminateReq)(struct fsm *); 88 void (*SendTerminateAck)(struct fsm *); 89 void (*DecodeConfig)(u_char *, int, int); | 80 void (*LayerUp) (struct fsm *); 81 void (*LayerDown) (struct fsm *); 82 void (*LayerStart) (struct fsm *); 83 void (*LayerFinish) (struct fsm *); 84 void (*InitRestartCounter) (struct fsm *); 85 void (*SendConfigReq) (struct fsm *); 86 void (*SendTerminateReq) (struct fsm *); 87 void (*SendTerminateAck) (struct fsm *); 88 void (*DecodeConfig) (u_char *, int, int); |
90}; 91 92struct fsmheader { | 89}; 90 91struct fsmheader { |
93 u_char code; /* Request code */ 94 u_char id; /* Identification */ 95 u_short length; /* Length of packet */ | 92 u_char code; /* Request code */ 93 u_char id; /* Identification */ 94 u_short length; /* Length of packet */ |
96}; 97 98#define CODE_CONFIGREQ 1 99#define CODE_CONFIGACK 2 100#define CODE_CONFIGNAK 3 101#define CODE_CONFIGREJ 4 102#define CODE_TERMREQ 5 103#define CODE_TERMACK 6 104#define CODE_CODEREJ 7 105#define CODE_PROTOREJ 8 | 95}; 96 97#define CODE_CONFIGREQ 1 98#define CODE_CONFIGACK 2 99#define CODE_CONFIGNAK 3 100#define CODE_CONFIGREJ 4 101#define CODE_TERMREQ 5 102#define CODE_TERMACK 6 103#define CODE_CODEREJ 7 104#define CODE_PROTOREJ 8 |
106#define CODE_ECHOREQ 9 /* Used in LCP */ 107#define CODE_ECHOREP 10 /* Used in LCP */ | 105#define CODE_ECHOREQ 9 /* Used in LCP */ 106#define CODE_ECHOREP 10 /* Used in LCP */ |
108#define CODE_DISCREQ 11 | 107#define CODE_DISCREQ 11 |
109#define CODE_IDENT 12 /* Used in LCP Extension */ 110#define CODE_TIMEREM 13 /* Used in LCP Extension */ 111#define CODE_RESETREQ 14 /* Used in CCP */ 112#define CODE_RESETACK 15 /* Used in CCP */ | 108#define CODE_IDENT 12 /* Used in LCP Extension */ 109#define CODE_TIMEREM 13 /* Used in LCP Extension */ 110#define CODE_RESETREQ 14 /* Used in CCP */ 111#define CODE_RESETACK 15 /* Used in CCP */ |
113 114struct fsmcodedesc { | 112 113struct fsmcodedesc { |
115 void (*action)(struct fsm *, struct fsmheader *, struct mbuf *); | 114 void (*action) (struct fsm *, struct fsmheader *, struct mbuf *); |
116 char *name; 117}; 118 119struct fsmconfig { 120 u_char type; 121 u_char length; 122}; 123 --- 13 unchanged lines hidden (view full) --- 137extern void FsmDown(struct fsm *); 138extern void FsmInput(struct fsm *, struct mbuf *); 139 140extern void FsmRecvConfigReq(struct fsm *, struct fsmheader *, struct mbuf *); 141extern void FsmRecvConfigAck(struct fsm *, struct fsmheader *, struct mbuf *); 142extern void FsmRecvConfigNak(struct fsm *, struct fsmheader *, struct mbuf *); 143extern void FsmRecvTermReq(struct fsm *, struct fsmheader *, struct mbuf *); 144extern void FsmRecvTermAck(struct fsm *, struct fsmheader *, struct mbuf *); | 115 char *name; 116}; 117 118struct fsmconfig { 119 u_char type; 120 u_char length; 121}; 122 --- 13 unchanged lines hidden (view full) --- 136extern void FsmDown(struct fsm *); 137extern void FsmInput(struct fsm *, struct mbuf *); 138 139extern void FsmRecvConfigReq(struct fsm *, struct fsmheader *, struct mbuf *); 140extern void FsmRecvConfigAck(struct fsm *, struct fsmheader *, struct mbuf *); 141extern void FsmRecvConfigNak(struct fsm *, struct fsmheader *, struct mbuf *); 142extern void FsmRecvTermReq(struct fsm *, struct fsmheader *, struct mbuf *); 143extern void FsmRecvTermAck(struct fsm *, struct fsmheader *, struct mbuf *); |
145extern void FsmClose(struct fsm *fp); | 144extern void FsmClose(struct fsm * fp); |
146 147extern struct fsm LcpFsm, IpcpFsm, CcpFsm; 148 | 145 146extern struct fsm LcpFsm, IpcpFsm, CcpFsm; 147 |
149#endif /* _FSM_H_ */ | 148#endif /* _FSM_H_ */ |