[270] | 1 | /*
|
---|
| 2 | * TINET (TCP/IP Protocol Stack)
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 2001-2009 by Dep. of Computer Science and Engineering
|
---|
| 5 | * Tomakomai National College of Technology, JAPAN
|
---|
| 6 | *
|
---|
| 7 | * ä¸è¨èä½æ¨©è
|
---|
| 8 | ã¯ï¼ä»¥ä¸ã® (1)ï½(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
| 9 | * ã«ãã£ã¦å
|
---|
| 10 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
| 11 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
| 12 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
| 13 | å¸ï¼ä»¥ä¸ï¼
|
---|
| 14 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 15 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 16 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 17 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 18 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 19 | * ç¨ã§ããå½¢ã§åé
|
---|
| 20 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 21 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 22 | * è
|
---|
| 23 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 24 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 25 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 26 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 27 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®æ¡ä»¶ãæºãããã¨ï¼
|
---|
| 28 | * (a) åé
|
---|
| 29 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 30 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 31 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 32 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 33 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 34 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 35 | 責ãããã¨ï¼
|
---|
| 36 | *
|
---|
| 37 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 38 | ã
|
---|
| 39 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
| 40 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
| 41 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
| 42 | *
|
---|
| 43 | * @(#) $Id: ppp_fsm.h 270 2017-02-09 04:03:47Z coas-nagasima $
|
---|
| 44 | */
|
---|
| 45 |
|
---|
| 46 | /*
|
---|
| 47 | * fsm.h - {Link, IP} Control Protocol Finite State Machine definitions.
|
---|
| 48 | *
|
---|
| 49 | * Copyright (c) 1989 Carnegie Mellon University.
|
---|
| 50 | * All rights reserved.
|
---|
| 51 | *
|
---|
| 52 | * Redistribution and use in source and binary forms are permitted
|
---|
| 53 | * provided that the above copyright notice and this paragraph are
|
---|
| 54 | * duplicated in all such forms and that any documentation,
|
---|
| 55 | * advertising materials, and other materials related to such
|
---|
| 56 | * distribution and use acknowledge that the software was developed
|
---|
| 57 | * by Carnegie Mellon University. The name of the
|
---|
| 58 | * University may not be used to endorse or promote products derived
|
---|
| 59 | * from this software without specific prior written permission.
|
---|
| 60 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
---|
| 61 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
---|
| 62 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 63 | *
|
---|
| 64 | * $FreeBSD: src/usr.sbin/pppd/fsm.h,v 1.6.2.1 1999/08/29 15:47:00 peter Exp $
|
---|
| 65 | */
|
---|
| 66 |
|
---|
| 67 | /*
|
---|
| 68 | * Written by Toshiharu OHNO (tony-o@iij.ad.jp)
|
---|
| 69 | *
|
---|
| 70 | * Copyright (C) 1993, Internet Initiative Japan, Inc. All rights reserverd.
|
---|
| 71 | *
|
---|
| 72 | * Redistribution and use in source and binary forms are permitted
|
---|
| 73 | * provided that the above copyright notice and this paragraph are
|
---|
| 74 | * duplicated in all such forms and that any documentation,
|
---|
| 75 | * advertising materials, and other materials related to such
|
---|
| 76 | * distribution and use acknowledge that the software was developed
|
---|
| 77 | * by the Internet Initiative Japan. The name of the
|
---|
| 78 | * IIJ may not be used to endorse or promote products derived
|
---|
| 79 | * from this software without specific prior written permission.
|
---|
| 80 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
---|
| 81 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
---|
| 82 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
| 83 | *
|
---|
| 84 | * $FreeBSD: src/usr.sbin/ppp/fsm.h,v 1.23 1999/12/27 11:54:53 brian Exp $
|
---|
| 85 | *
|
---|
| 86 | * TODO:
|
---|
| 87 | */
|
---|
| 88 |
|
---|
| 89 | #ifndef _PPP_FSM_H_
|
---|
| 90 | #define _PPP_FSM_H_
|
---|
| 91 |
|
---|
| 92 | #ifdef SUPPORT_PPP
|
---|
| 93 |
|
---|
| 94 | /*
|
---|
| 95 | * ç¶æ
|
---|
| 96 | 管çæ§é ä½
|
---|
| 97 | */
|
---|
| 98 |
|
---|
| 99 | struct t_ppp_fsm_callbacks;
|
---|
| 100 |
|
---|
| 101 | typedef struct t_fsm {
|
---|
| 102 | struct t_ppp_fsm_callbacks *callbacks; /* ã³ã¼ã«ããã¯é¢æ°*/
|
---|
| 103 | uint16_t proto; /* ãããã³ã« */
|
---|
| 104 | uint8_t state; /* FSM ã®ç¶æ
|
---|
| 105 | */
|
---|
| 106 | uint8_t id; /* ç¾å¨ã® ID */
|
---|
| 107 | uint8_t reqid; /* è¦æ± ID */
|
---|
| 108 | uint8_t seen_ack; /* è¦æ±ã«å¯¾ãæ£å¸¸ãª ACK/NAK/REJ ãåä¿¡ */
|
---|
| 109 | int8_t failures; /* é»èªãã NAK æ° */
|
---|
| 110 | int8_t retrans; /* Configure-Request ã¾ãã¯ã */
|
---|
| 111 | /* Terminate-Request ã®åéåæ° */
|
---|
| 112 | } __attribute__((packed, aligned(2)))T_PPP_FSM;
|
---|
| 113 |
|
---|
| 114 | #define T_PPP_FSM_DEFINED
|
---|
| 115 |
|
---|
| 116 | /*
|
---|
| 117 | * ã³ã¼ã«ããã¯é¢æ°æ§é ä½
|
---|
| 118 | */
|
---|
| 119 |
|
---|
| 120 | typedef struct t_ppp_fsm_callbacks {
|
---|
| 121 | void (*resetci) (T_PPP_FSM *); /* èªæ§ææ
|
---|
| 122 | å ±ããªã»ããããã */
|
---|
| 123 | int_t (*cilen) (T_PPP_FSM *); /* æ§ææ
|
---|
| 124 | å ±ã®é·ããè¿ãã */
|
---|
| 125 | void (*addci) (T_PPP_FSM *, T_NET_BUF *);
|
---|
| 126 | /* èªæ§ææ
|
---|
| 127 | å ±ã追å ããã */
|
---|
| 128 | bool_t (*ackci) (T_PPP_FSM *, T_NET_BUF *);
|
---|
| 129 | /* ACK ãåä¿¡ããã¨ãã®å¦ç */
|
---|
| 130 | int_t (*nakci) (T_PPP_FSM *, T_NET_BUF *);
|
---|
| 131 | /* NAK ãåä¿¡ããã¨ãã®å¦ç */
|
---|
| 132 | int_t (*rejci) (T_PPP_FSM *, T_NET_BUF *);
|
---|
| 133 | /* REJ ãåä¿¡ããã¨ãã®å¦ç */
|
---|
| 134 | int_t (*reqci) (T_PPP_FSM *, T_NET_BUF *, T_NET_BUF *);
|
---|
| 135 | /* ç¸æã®æ§ææ
|
---|
| 136 | å ±ã確èªããã */
|
---|
| 137 | void (*up) (T_PPP_FSM *); /* ãªã³ã¯ã®æ¥ç¶ã確ç«ããã */
|
---|
| 138 | void (*down) (T_PPP_FSM *); /* ãªã³ã¯ã®æ¥ç¶ã解æ¾ããã */
|
---|
| 139 | void (*starting)(T_PPP_FSM *); /* ä¸ä½å±¤ãéå§ããã */
|
---|
| 140 | void (*finished)(T_PPP_FSM *); /* ä¸ä½å±¤ãçµäºããã */
|
---|
| 141 | void (*retrans) (T_PPP_FSM *); /* åéããã */
|
---|
| 142 | /* ä¸æ㪠CP ãåä¿¡ããã¨ãã®å¦ç */
|
---|
| 143 | bool_t (*extcode)(T_PPP_FSM *, uint8_t, uint8_t, T_NET_BUF *);
|
---|
| 144 | } __attribute__((packed, aligned(2)))T_PPP_FSM_CALLBACKS;
|
---|
| 145 |
|
---|
| 146 | /*
|
---|
| 147 | * FSM ã®ç¶æ
|
---|
| 148 |
|
---|
| 149 | */
|
---|
| 150 |
|
---|
| 151 | #define PPP_FSM_INITIAL 0 /* æªæ¥ç¶ãæªãªã¼ãã³ */
|
---|
| 152 | #define PPP_FSM_STARTING 1 /* æªæ¥ç¶ããªã¼ãã³ */
|
---|
| 153 | #define PPP_FSM_CLOSED 2 /* æ¥ç¶ã æªãªã¼ãã³ */
|
---|
| 154 | #define PPP_FSM_STOPPED 3 /* ãªã¼ãã³ãåæå¾
|
---|
| 155 | ã¡ */
|
---|
| 156 | #define PPP_FSM_CLOSING 4 /* åæä¸ãæªãªã¼ãã³ */
|
---|
| 157 | #define PPP_FSM_STOPPING 5 /* åæä¸ããªã¼ãã³ */
|
---|
| 158 | #define PPP_FSM_REQSENT 6 /* Config REQ éä¿¡æ¸ã¿ */
|
---|
| 159 | #define PPP_FSM_ACKRCVD 7 /* Config ACK åä¿¡æ¸ã¿ */
|
---|
| 160 | #define PPP_FSM_ACKSENT 8 /* Config ACK éä¿¡æ¸ã¿ */
|
---|
| 161 | #define PPP_FSM_OPENED 9 /* æ¥ç¶ãéä¿¡å¯è½ */
|
---|
| 162 |
|
---|
| 163 | /*
|
---|
| 164 | * ãªã¼ãã³æã®åä½ã¢ã¼ã
|
---|
| 165 | */
|
---|
| 166 |
|
---|
| 167 | #define PPP_OPEN_PASSIVE false /* ååãªã¼ãã³ */
|
---|
| 168 | #define PPP_OPEN_ACTIVE true /* è½åãªã¼ãã³ */
|
---|
| 169 |
|
---|
| 170 | /*
|
---|
| 171 | * åéãã¿ã¤ã ã¢ã¦ãã®æ¢å®å¤
|
---|
| 172 | */
|
---|
| 173 |
|
---|
| 174 | #define DEF_PPP_TIMEOUT (3*NET_TIMER_HZ)
|
---|
| 175 | /* RFC1661 ã§ã¯ 3 ç§ */
|
---|
| 176 | #define MAX_PPP_TERMINATES 2 /* Terminate-Requests ã®æ大åéåæ° */
|
---|
| 177 | /* RFC1661 ã§ã¯ 2 å */
|
---|
| 178 | #define MAX_PPP_CONFIGURES 10 /* Configure-Requests ã®æ大åéåæ° */
|
---|
| 179 | /* RFC1661 ã§ã¯ 10 å */
|
---|
| 180 | #define MAX_PPP_FAILURES 5 /* Configure-NAK ã®æ大é»èªåæ° */
|
---|
| 181 | /* RFC1661 ã§ã¯ 5 å */
|
---|
| 182 |
|
---|
| 183 | /*
|
---|
| 184 | * é¢æ°
|
---|
| 185 | */
|
---|
| 186 |
|
---|
| 187 | extern void fsm_init (T_PPP_FSM *fsm);
|
---|
| 188 | extern void fsm_lowerup (T_PPP_FSM *fsm);
|
---|
| 189 | extern void fsm_lowerdown(T_PPP_FSM *fsm);
|
---|
| 190 | extern void fsm_open (T_PPP_FSM *fsm);
|
---|
| 191 | extern void fsm_close (T_PPP_FSM *fsm);
|
---|
| 192 | extern void fsm_input (T_PPP_FSM *fsm, T_NET_BUF *data);
|
---|
| 193 | extern void fsm_protreject(T_PPP_FSM *fsm);
|
---|
| 194 |
|
---|
| 195 | /*
|
---|
| 196 | * å¤æ°
|
---|
| 197 | */
|
---|
| 198 |
|
---|
| 199 | extern uint8_t ppp_open_mode;
|
---|
| 200 |
|
---|
| 201 | #endif /* of #ifdef SUPPORT_PPP */
|
---|
| 202 |
|
---|
| 203 | #endif /* of #ifndef _PPP_FSM_H_ */
|
---|