mikroSDK Reference Manual
ppp_fsm.h
Go to the documentation of this file.
1
31#ifndef _PPP_FSM_H
32#define _PPP_FSM_H
33
34//Dependencies
35#include "core/net.h"
36#include "ppp/ppp.h"
37
38//C++ guard
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43
48typedef void (*PppThisLayerUp)(PppContext *context);
49
50
55typedef void (*PppThisLayerDown)(PppContext *context);
56
57
62typedef void (*PppThisLayerStarted)(PppContext *context);
63
64
69typedef void (*PppThisLayerFinished)(PppContext *context);
70
71
76typedef void (*PppInitRestartCount)(PppContext *context, uint_t value);
77
78
83typedef void (*PppZeroRestartCount)(PppContext *context);
84
85
90typedef error_t (*PppSendConfigureReq)(PppContext *context);
91
92
97typedef error_t (*PppSendConfigureAck)(PppContext *context,
98 const PppConfigurePacket *configureReqPacket);
99
100
105typedef error_t (*PppSendConfigureNak)(PppContext *context,
106 const PppConfigurePacket *configureReqPacket);
107
108
113typedef error_t (*PppSendConfigureRej)(PppContext *context,
114 const PppConfigurePacket *configureReqPacket);
115
116
121typedef error_t (*PppSendTerminateReq)(PppContext *context);
122
123
128typedef error_t (*PppSendTerminateAck)(PppContext *context,
129 const PppTerminatePacket *terminateReqPacket);
130
131
136typedef error_t (*PppSendCodeRej)(PppContext *context,
137 const PppPacket *packet);
138
139
144typedef error_t (*PppSendEchoRep)(PppContext *context,
145 const PppEchoPacket *echoReqPacket);
146
147
152typedef struct
153{
154 PppThisLayerUp thisLayerUp;
155 PppThisLayerDown thisLayerDown;
156 PppThisLayerStarted thisLayerStarted;
157 PppThisLayerFinished thisLayerFinished;
158 PppInitRestartCount initRestartCount;
159 PppZeroRestartCount zeroRestartCount;
160 PppSendConfigureReq sendConfigureReq;
161 PppSendConfigureAck sendConfigureAck;
162 PppSendConfigureNak sendConfigureNak;
163 PppSendConfigureRej sendConfigureRej;
164 PppSendTerminateReq sendTerminateReq;
165 PppSendTerminateAck sendTerminateAck;
166 PppSendCodeRej sendCodeRej;
167 PppSendEchoRep sendEchoRep;
169
170
171//PPP FSM events
172void pppUpEvent(PppContext *context, PppFsm *fsm,
173 const PppCallbacks *callbacks);
174
175void pppDownEvent(PppContext *context, PppFsm *fsm,
176 const PppCallbacks *callbacks);
177
178void pppOpenEvent(PppContext *context, PppFsm *fsm,
179 const PppCallbacks *callbacks);
180
181void pppCloseEvent(PppContext *context, PppFsm *fsm,
182 const PppCallbacks *callbacks);
183
184void pppTimeoutEvent(PppContext *context, PppFsm *fsm,
185 const PppCallbacks *callbacks);
186
187void pppRcvConfigureReqEvent(PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks,
188 const PppConfigurePacket *configureReqPacket, PppCode code);
189
190void pppRcvConfigureAckEvent(PppContext *context, PppFsm *fsm,
191 const PppCallbacks *callbacks);
192
193void pppRcvConfigureNakEvent(PppContext *context, PppFsm *fsm,
194 const PppCallbacks *callbacks);
195
196void pppRcvTerminateReqEvent(PppContext *context, PppFsm *fsm,
197 const PppCallbacks *callbacks, const PppTerminatePacket *terminateReqPacket);
198
199void pppRcvTerminateAckEvent(PppContext *context, PppFsm *fsm,
200 const PppCallbacks *callbacks);
201
202void pppRcvUnknownCodeEvent(PppContext *context, PppFsm *fsm,
203 const PppCallbacks *callbacks, const PppPacket *packet);
204
205void pppRcvCodeRejEvent(PppContext *context, PppFsm *fsm,
206 const PppCallbacks *callbacks, bool_t acceptable);
207
208void pppRcvEchoReqEvent(PppContext *context, PppFsm *fsm,
209 const PppCallbacks *callbacks, const PppEchoPacket *echoReqPacket);
210
211void pppChangeState(PppFsm *fsm, PppState newState);
212
213//C++ guard
214#ifdef __cplusplus
215}
216#endif
217
218#endif
error_t
Error codes.
Definition error.h:43
TCP/IP stack core.
PPP (Point-to-Point Protocol)
PppState
LCP/NCP states.
Definition ppp.h:179
PppCode
Code field values.
Definition ppp.h:215
error_t(* PppSendConfigureRej)(PppContext *context, const PppConfigurePacket *configureReqPacket)
Send-Configure-Reject callback function.
Definition ppp_fsm.h:113
error_t(* PppSendConfigureReq)(PppContext *context)
Send-Configure-Request callback function.
Definition ppp_fsm.h:90
error_t(* PppSendTerminateReq)(PppContext *context)
Send-Terminate-Request callback function.
Definition ppp_fsm.h:121
void(* PppThisLayerFinished)(PppContext *context)
This-Layer-Finished callback function.
Definition ppp_fsm.h:69
error_t(* PppSendConfigureNak)(PppContext *context, const PppConfigurePacket *configureReqPacket)
Send-Configure-Nak callback function.
Definition ppp_fsm.h:105
error_t(* PppSendTerminateAck)(PppContext *context, const PppTerminatePacket *terminateReqPacket)
Send-Terminate-Ack callback function.
Definition ppp_fsm.h:128
void(* PppZeroRestartCount)(PppContext *context)
Zero-Restart-Count callback function.
Definition ppp_fsm.h:83
void(* PppInitRestartCount)(PppContext *context, uint_t value)
Initialize-Restart-Count callback function.
Definition ppp_fsm.h:76
void(* PppThisLayerDown)(PppContext *context)
This-Layer-Down callback function.
Definition ppp_fsm.h:55
error_t(* PppSendEchoRep)(PppContext *context, const PppEchoPacket *echoReqPacket)
Send-Echo-Reply callback function.
Definition ppp_fsm.h:144
error_t(* PppSendCodeRej)(PppContext *context, const PppPacket *packet)
Send-Code-Reject callback function.
Definition ppp_fsm.h:136
void(* PppThisLayerStarted)(PppContext *context)
This-Layer-Started callback function.
Definition ppp_fsm.h:62
error_t(* PppSendConfigureAck)(PppContext *context, const PppConfigurePacket *configureReqPacket)
Send-Configure-Ack callback function.
Definition ppp_fsm.h:97
void(* PppThisLayerUp)(PppContext *context)
This-Layer-Up callback function.
Definition ppp_fsm.h:48
PPP FSM actions.
Definition ppp_fsm.h:153
PPP finite state machine.
Definition ppp.h:396