fsm.h (37160) | fsm.h (44305) |
---|---|
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.18 1998/06/20 00:19:38 brian Exp $ | 18 * $Id: fsm.h,v 1.19 1998/06/25 22:33:24 brian Exp $ |
19 * 20 * TODO: 21 */ 22 23/* 24 * State of machine 25 */ 26#define ST_INITIAL 0 --- 13 unchanged lines hidden (view full) --- 40#define MODE_REQ 0 41#define MODE_NAK 1 42#define MODE_REJ 2 43#define MODE_NOP 3 44#define MODE_ACK 4 /* pseudo mode for ccp negotiations */ 45 46#define OPEN_PASSIVE -1 47 | 19 * 20 * TODO: 21 */ 22 23/* 24 * State of machine 25 */ 26#define ST_INITIAL 0 --- 13 unchanged lines hidden (view full) --- 40#define MODE_REQ 0 41#define MODE_NAK 1 42#define MODE_REJ 2 43#define MODE_NOP 3 44#define MODE_ACK 4 /* pseudo mode for ccp negotiations */ 45 46#define OPEN_PASSIVE -1 47 |
48#define FSM_REQ_TIMER 1 49#define FSM_TRM_TIMER 2 50 |
|
48struct fsm; 49 | 51struct fsm; 52 |
53struct fsm_retry { 54 u_int timeout; /* FSM retry frequency */ 55 u_int maxreq; /* Max Config REQ retries */ 56 u_int maxtrm; /* Max Term REQ retries */ 57}; 58 |
|
50struct fsm_decode { 51 u_char ack[100], *ackend; 52 u_char nak[100], *nakend; 53 u_char rej[100], *rejend; 54}; 55 56struct fsm_callbacks { 57 int (*LayerUp) (struct fsm *); /* Layer is now up (tlu) */ 58 void (*LayerDown) (struct fsm *); /* About to come down (tld) */ 59 void (*LayerStart) (struct fsm *); /* Layer about to start up (tls) */ 60 void (*LayerFinish) (struct fsm *); /* Layer now down (tlf) */ | 59struct fsm_decode { 60 u_char ack[100], *ackend; 61 u_char nak[100], *nakend; 62 u_char rej[100], *rejend; 63}; 64 65struct fsm_callbacks { 66 int (*LayerUp) (struct fsm *); /* Layer is now up (tlu) */ 67 void (*LayerDown) (struct fsm *); /* About to come down (tld) */ 68 void (*LayerStart) (struct fsm *); /* Layer about to start up (tls) */ 69 void (*LayerFinish) (struct fsm *); /* Layer now down (tlf) */ |
61 void (*InitRestartCounter) (struct fsm *); /* Set fsm timer load */ | 70 void (*InitRestartCounter) (struct fsm *, int); /* Set fsm timer load */ |
62 void (*SendConfigReq) (struct fsm *); /* Send REQ please */ 63 void (*SentTerminateReq) (struct fsm *); /* Term REQ just sent */ 64 void (*SendTerminateAck) (struct fsm *, u_char); /* Send Term ACK please */ 65 void (*DecodeConfig) (struct fsm *, u_char *, int, int, struct fsm_decode *); 66 /* Deal with incoming data */ 67 void (*RecvResetReq) (struct fsm *fp); /* Reset output */ 68 void (*RecvResetAck) (struct fsm *fp, u_char); /* Reset input */ 69}; --- 13 unchanged lines hidden (view full) --- 83 const char *name; /* Name of protocol */ 84 u_short proto; /* Protocol number */ 85 u_short min_code; 86 u_short max_code; 87 int open_mode; /* Delay before config REQ (-1 forever) */ 88 int state; /* State of the machine */ 89 u_char reqid; /* Next request id */ 90 int restart; /* Restart counter value */ | 71 void (*SendConfigReq) (struct fsm *); /* Send REQ please */ 72 void (*SentTerminateReq) (struct fsm *); /* Term REQ just sent */ 73 void (*SendTerminateAck) (struct fsm *, u_char); /* Send Term ACK please */ 74 void (*DecodeConfig) (struct fsm *, u_char *, int, int, struct fsm_decode *); 75 /* Deal with incoming data */ 76 void (*RecvResetReq) (struct fsm *fp); /* Reset output */ 77 void (*RecvResetAck) (struct fsm *fp, u_char); /* Reset input */ 78}; --- 13 unchanged lines hidden (view full) --- 92 const char *name; /* Name of protocol */ 93 u_short proto; /* Protocol number */ 94 u_short min_code; 95 u_short max_code; 96 int open_mode; /* Delay before config REQ (-1 forever) */ 97 int state; /* State of the machine */ 98 u_char reqid; /* Next request id */ 99 int restart; /* Restart counter value */ |
91 int maxconfig; /* Max config REQ before a close() */ | |
92 | 100 |
101 struct { 102 int reqs; /* Max config REQs before a close() */ 103 int naks; /* Max config NAKs before a close() */ 104 int rejs; /* Max config REJs before a close() */ 105 } more; 106 |
|
93 struct pppTimer FsmTimer; /* Restart Timer */ 94 struct pppTimer OpenTimer; /* Delay before opening */ 95 96 /* 97 * This timer times the ST_STOPPED state out after the given value 98 * (specified via "set stopped ..."). Although this isn't specified in the 99 * rfc, the rfc *does* say that "the application may use higher level 100 * timers to avoid deadlock". The StoppedTimer takes effect when the other --- 37 unchanged lines hidden (view full) --- 138#define CODE_RESETACK 15 /* Used in CCP */ 139 140/* Minimum config req size. This struct is *only* used for it's size */ 141struct fsmconfig { 142 u_char type; 143 u_char length; 144}; 145 | 107 struct pppTimer FsmTimer; /* Restart Timer */ 108 struct pppTimer OpenTimer; /* Delay before opening */ 109 110 /* 111 * This timer times the ST_STOPPED state out after the given value 112 * (specified via "set stopped ..."). Although this isn't specified in the 113 * rfc, the rfc *does* say that "the application may use higher level 114 * timers to avoid deadlock". The StoppedTimer takes effect when the other --- 37 unchanged lines hidden (view full) --- 152#define CODE_RESETACK 15 /* Used in CCP */ 153 154/* Minimum config req size. This struct is *only* used for it's size */ 155struct fsmconfig { 156 u_char type; 157 u_char length; 158}; 159 |
146extern void fsm_Init(struct fsm *, const char *, u_short, int, int, int, int, | 160extern void fsm_Init(struct fsm *, const char *, u_short, int, int, int, |
147 struct bundle *, struct link *, const struct fsm_parent *, 148 struct fsm_callbacks *, const char *[3]); 149extern void fsm_Output(struct fsm *, u_int, u_int, u_char *, int); 150extern void fsm_Open(struct fsm *); 151extern void fsm_Up(struct fsm *); 152extern void fsm_Down(struct fsm *); 153extern void fsm_Input(struct fsm *, struct mbuf *); 154extern void fsm_Close(struct fsm *); 155extern void fsm_NullRecvResetReq(struct fsm *); 156extern void fsm_NullRecvResetAck(struct fsm *, u_char); 157extern void fsm_Reopen(struct fsm *); 158extern void fsm2initial(struct fsm *); 159extern const char *State2Nam(u_int); | 161 struct bundle *, struct link *, const struct fsm_parent *, 162 struct fsm_callbacks *, const char *[3]); 163extern void fsm_Output(struct fsm *, u_int, u_int, u_char *, int); 164extern void fsm_Open(struct fsm *); 165extern void fsm_Up(struct fsm *); 166extern void fsm_Down(struct fsm *); 167extern void fsm_Input(struct fsm *, struct mbuf *); 168extern void fsm_Close(struct fsm *); 169extern void fsm_NullRecvResetReq(struct fsm *); 170extern void fsm_NullRecvResetAck(struct fsm *, u_char); 171extern void fsm_Reopen(struct fsm *); 172extern void fsm2initial(struct fsm *); 173extern const char *State2Nam(u_int); |