source: azure_iot_hub/trunk/asp3_dcre/tinet/net/ppp_fsm.h@ 388

Last change on this file since 388 was 388, checked in by coas-nagasima, 5 years ago

Azure IoT Hub Device C SDK を使ったサンプルの追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 7.5 KB
Line 
1/*
2 * TINET (TCP/IP Protocol Stack)
3 *
4 * Copyright (C) 2001-2017 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 388 2019-05-22 11:25:18Z 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
99struct t_ppp_fsm_callbacks;
100
101typedef 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 } T_PPP_FSM;
113
114#define T_PPP_FSM_DEFINED
115
116/*
117 * コールバック関数構造体
118 */
119
120typedef 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 } 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
187extern void fsm_init (T_PPP_FSM *fsm);
188extern void fsm_lowerup (T_PPP_FSM *fsm);
189extern void fsm_lowerdown(T_PPP_FSM *fsm);
190extern void fsm_open (T_PPP_FSM *fsm);
191extern void fsm_close (T_PPP_FSM *fsm);
192extern void fsm_input (T_PPP_FSM *fsm, T_NET_BUF *data);
193extern void fsm_protreject(T_PPP_FSM *fsm);
194
195/*
196 * 変数
197 */
198
199extern uint8_t ppp_open_mode;
200
201#endif /* of #ifdef SUPPORT_PPP */
202
203#endif /* of #ifndef _PPP_FSM_H_ */
Note: See TracBrowser for help on using the repository browser.