Webserver+3d print

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ppp_fsm.h Source File

ppp_fsm.h

Go to the documentation of this file.
00001 /**
00002  * @file ppp_fsm.h
00003  * @brief PPP finite state machine
00004  *
00005  * @section License
00006  *
00007  * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.
00008  *
00009  * This file is part of CycloneTCP Open.
00010  *
00011  * This program is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU General Public License
00013  * as published by the Free Software Foundation; either version 2
00014  * of the License, or (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software Foundation,
00023  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00024  *
00025  * @author Oryx Embedded SARL (www.oryx-embedded.com)
00026  * @version 1.7.6
00027  **/
00028 
00029 #ifndef _PPP_FSM_H
00030 #define _PPP_FSM_H
00031 
00032 //Dependencies
00033 #include "core/net.h"
00034 #include "ppp/ppp.h"
00035 
00036 
00037 /**
00038  * @brief This-Layer-Up callback function
00039  **/
00040 
00041 typedef void (*PppThisLayerUp)(PppContext *context);
00042 
00043 
00044 /**
00045  * @brief This-Layer-Down callback function
00046  **/
00047 
00048 typedef void (*PppThisLayerDown)(PppContext *context);
00049 
00050 
00051 /**
00052  * @brief This-Layer-Started callback function
00053  **/
00054 
00055 typedef void (*PppThisLayerStarted)(PppContext *context);
00056 
00057 
00058 /**
00059  * @brief This-Layer-Finished callback function
00060  **/
00061 
00062 typedef void (*PppThisLayerFinished)(PppContext *context);
00063 
00064 
00065 /**
00066  * @brief Initialize-Restart-Count callback function
00067  **/
00068 
00069 typedef void (*PppInitRestartCount)(PppContext *context, uint_t value);
00070 
00071 
00072 /**
00073  * @brief Zero-Restart-Count callback function
00074  **/
00075 
00076 typedef void (*PppZeroRestartCount)(PppContext *context);
00077 
00078 
00079 /**
00080  * @brief Send-Configure-Request callback function
00081  **/
00082 
00083 typedef error_t (*PppSendConfigureReq)(PppContext *context);
00084 
00085 
00086 /**
00087  * @brief Send-Configure-Ack callback function
00088  **/
00089 
00090 typedef error_t (*PppSendConfigureAck)(PppContext *context,
00091    const PppConfigurePacket *configureReqPacket);
00092 
00093 
00094 /**
00095  * @brief Send-Configure-Nak callback function
00096  **/
00097 
00098 typedef error_t (*PppSendConfigureNak)(PppContext *context,
00099    const PppConfigurePacket *configureReqPacket);
00100 
00101 
00102 /**
00103  * @brief Send-Configure-Reject callback function
00104  **/
00105 
00106 typedef error_t (*PppSendConfigureRej)(PppContext *context,
00107    const PppConfigurePacket *configureReqPacket);
00108 
00109 
00110 /**
00111  * @brief Send-Terminate-Request callback function
00112  **/
00113 
00114 typedef error_t (*PppSendTerminateReq)(PppContext *context);
00115 
00116 
00117 /**
00118  * @brief Send-Terminate-Ack callback function
00119  **/
00120 
00121 typedef error_t (*PppSendTerminateAck)(PppContext *context,
00122    const PppTerminatePacket *terminateReqPacket);
00123 
00124 
00125 /**
00126  * @brief Send-Code-Reject callback function
00127  **/
00128 
00129 typedef error_t (*PppSendCodeRej)(PppContext *context,
00130    const PppPacket *packet);
00131 
00132 
00133 /**
00134  * @brief Send-Echo-Reply callback function
00135  **/
00136 
00137 typedef error_t (*PppSendEchoRep)(PppContext *context,
00138    const PppEchoPacket *echoReqPacket);
00139 
00140 
00141 /**
00142  *@brief PPP FSM actions
00143  **/
00144 
00145 typedef struct
00146 {
00147    PppThisLayerUp thisLayerUp;
00148    PppThisLayerDown thisLayerDown;
00149    PppThisLayerStarted thisLayerStarted;
00150    PppThisLayerFinished thisLayerFinished;
00151    PppInitRestartCount initRestartCount;
00152    PppZeroRestartCount zeroRestartCount;
00153    PppSendConfigureReq sendConfigureReq;
00154    PppSendConfigureAck sendConfigureAck;
00155    PppSendConfigureNak sendConfigureNak;
00156    PppSendConfigureRej sendConfigureRej;
00157    PppSendTerminateReq sendTerminateReq;
00158    PppSendTerminateAck sendTerminateAck;
00159    PppSendCodeRej sendCodeRej;
00160    PppSendEchoRep sendEchoRep;
00161 } PppCallbacks;
00162 
00163 
00164 //PPP FSM events
00165 void pppUpEvent(PppContext *context, PppFsm *fsm,
00166    const PppCallbacks *callbacks);
00167 
00168 void pppDownEvent(PppContext *context, PppFsm *fsm,
00169    const PppCallbacks *callbacks);
00170 
00171 void pppOpenEvent(PppContext *context, PppFsm *fsm,
00172    const PppCallbacks *callbacks);
00173 
00174 void pppCloseEvent(PppContext *context, PppFsm *fsm,
00175    const PppCallbacks *callbacks);
00176 
00177 void pppTimeoutEvent(PppContext *context, PppFsm *fsm,
00178    const PppCallbacks *callbacks);
00179 
00180 void pppRcvConfigureReqEvent(PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks,
00181    const PppConfigurePacket *configureReqPacket, PppCode code);
00182 
00183 void pppRcvConfigureAckEvent(PppContext *context, PppFsm *fsm,
00184    const PppCallbacks *callbacks);
00185 
00186 void pppRcvConfigureNakEvent(PppContext *context, PppFsm *fsm,
00187    const PppCallbacks *callbacks);
00188 
00189 void pppRcvTerminateReqEvent(PppContext *context, PppFsm *fsm,
00190    const PppCallbacks *callbacks, const PppTerminatePacket *terminateReqPacket);
00191 
00192 void pppRcvTerminateAckEvent(PppContext *context, PppFsm *fsm,
00193    const PppCallbacks *callbacks);
00194 
00195 void pppRcvUnknownCodeEvent(PppContext *context, PppFsm *fsm,
00196    const PppCallbacks *callbacks, const PppPacket *packet);
00197 
00198 void pppRcvCodeRejEvent(PppContext *context, PppFsm *fsm,
00199    const PppCallbacks *callbacks, bool_t acceptable);
00200 
00201 void pppRcvEchoReqEvent(PppContext *context, PppFsm *fsm,
00202    const PppCallbacks *callbacks, const PppEchoPacket *echoReqPacket);
00203 
00204 void pppChangeState(PppFsm *fsm, PppState newState);
00205 
00206 #endif
00207