Webserver+3d print
cyclone_tcp/ppp/ppp_fsm.h@0:8918a71cdbe9, 2017-02-04 (annotated)
- Committer:
- Sergunb
- Date:
- Sat Feb 04 18:15:49 2017 +0000
- Revision:
- 0:8918a71cdbe9
nothing else
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sergunb | 0:8918a71cdbe9 | 1 | /** |
Sergunb | 0:8918a71cdbe9 | 2 | * @file ppp_fsm.h |
Sergunb | 0:8918a71cdbe9 | 3 | * @brief PPP finite state machine |
Sergunb | 0:8918a71cdbe9 | 4 | * |
Sergunb | 0:8918a71cdbe9 | 5 | * @section License |
Sergunb | 0:8918a71cdbe9 | 6 | * |
Sergunb | 0:8918a71cdbe9 | 7 | * Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved. |
Sergunb | 0:8918a71cdbe9 | 8 | * |
Sergunb | 0:8918a71cdbe9 | 9 | * This file is part of CycloneTCP Open. |
Sergunb | 0:8918a71cdbe9 | 10 | * |
Sergunb | 0:8918a71cdbe9 | 11 | * This program is free software; you can redistribute it and/or |
Sergunb | 0:8918a71cdbe9 | 12 | * modify it under the terms of the GNU General Public License |
Sergunb | 0:8918a71cdbe9 | 13 | * as published by the Free Software Foundation; either version 2 |
Sergunb | 0:8918a71cdbe9 | 14 | * of the License, or (at your option) any later version. |
Sergunb | 0:8918a71cdbe9 | 15 | * |
Sergunb | 0:8918a71cdbe9 | 16 | * This program is distributed in the hope that it will be useful, |
Sergunb | 0:8918a71cdbe9 | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Sergunb | 0:8918a71cdbe9 | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Sergunb | 0:8918a71cdbe9 | 19 | * GNU General Public License for more details. |
Sergunb | 0:8918a71cdbe9 | 20 | * |
Sergunb | 0:8918a71cdbe9 | 21 | * You should have received a copy of the GNU General Public License |
Sergunb | 0:8918a71cdbe9 | 22 | * along with this program; if not, write to the Free Software Foundation, |
Sergunb | 0:8918a71cdbe9 | 23 | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
Sergunb | 0:8918a71cdbe9 | 24 | * |
Sergunb | 0:8918a71cdbe9 | 25 | * @author Oryx Embedded SARL (www.oryx-embedded.com) |
Sergunb | 0:8918a71cdbe9 | 26 | * @version 1.7.6 |
Sergunb | 0:8918a71cdbe9 | 27 | **/ |
Sergunb | 0:8918a71cdbe9 | 28 | |
Sergunb | 0:8918a71cdbe9 | 29 | #ifndef _PPP_FSM_H |
Sergunb | 0:8918a71cdbe9 | 30 | #define _PPP_FSM_H |
Sergunb | 0:8918a71cdbe9 | 31 | |
Sergunb | 0:8918a71cdbe9 | 32 | //Dependencies |
Sergunb | 0:8918a71cdbe9 | 33 | #include "core/net.h" |
Sergunb | 0:8918a71cdbe9 | 34 | #include "ppp/ppp.h" |
Sergunb | 0:8918a71cdbe9 | 35 | |
Sergunb | 0:8918a71cdbe9 | 36 | |
Sergunb | 0:8918a71cdbe9 | 37 | /** |
Sergunb | 0:8918a71cdbe9 | 38 | * @brief This-Layer-Up callback function |
Sergunb | 0:8918a71cdbe9 | 39 | **/ |
Sergunb | 0:8918a71cdbe9 | 40 | |
Sergunb | 0:8918a71cdbe9 | 41 | typedef void (*PppThisLayerUp)(PppContext *context); |
Sergunb | 0:8918a71cdbe9 | 42 | |
Sergunb | 0:8918a71cdbe9 | 43 | |
Sergunb | 0:8918a71cdbe9 | 44 | /** |
Sergunb | 0:8918a71cdbe9 | 45 | * @brief This-Layer-Down callback function |
Sergunb | 0:8918a71cdbe9 | 46 | **/ |
Sergunb | 0:8918a71cdbe9 | 47 | |
Sergunb | 0:8918a71cdbe9 | 48 | typedef void (*PppThisLayerDown)(PppContext *context); |
Sergunb | 0:8918a71cdbe9 | 49 | |
Sergunb | 0:8918a71cdbe9 | 50 | |
Sergunb | 0:8918a71cdbe9 | 51 | /** |
Sergunb | 0:8918a71cdbe9 | 52 | * @brief This-Layer-Started callback function |
Sergunb | 0:8918a71cdbe9 | 53 | **/ |
Sergunb | 0:8918a71cdbe9 | 54 | |
Sergunb | 0:8918a71cdbe9 | 55 | typedef void (*PppThisLayerStarted)(PppContext *context); |
Sergunb | 0:8918a71cdbe9 | 56 | |
Sergunb | 0:8918a71cdbe9 | 57 | |
Sergunb | 0:8918a71cdbe9 | 58 | /** |
Sergunb | 0:8918a71cdbe9 | 59 | * @brief This-Layer-Finished callback function |
Sergunb | 0:8918a71cdbe9 | 60 | **/ |
Sergunb | 0:8918a71cdbe9 | 61 | |
Sergunb | 0:8918a71cdbe9 | 62 | typedef void (*PppThisLayerFinished)(PppContext *context); |
Sergunb | 0:8918a71cdbe9 | 63 | |
Sergunb | 0:8918a71cdbe9 | 64 | |
Sergunb | 0:8918a71cdbe9 | 65 | /** |
Sergunb | 0:8918a71cdbe9 | 66 | * @brief Initialize-Restart-Count callback function |
Sergunb | 0:8918a71cdbe9 | 67 | **/ |
Sergunb | 0:8918a71cdbe9 | 68 | |
Sergunb | 0:8918a71cdbe9 | 69 | typedef void (*PppInitRestartCount)(PppContext *context, uint_t value); |
Sergunb | 0:8918a71cdbe9 | 70 | |
Sergunb | 0:8918a71cdbe9 | 71 | |
Sergunb | 0:8918a71cdbe9 | 72 | /** |
Sergunb | 0:8918a71cdbe9 | 73 | * @brief Zero-Restart-Count callback function |
Sergunb | 0:8918a71cdbe9 | 74 | **/ |
Sergunb | 0:8918a71cdbe9 | 75 | |
Sergunb | 0:8918a71cdbe9 | 76 | typedef void (*PppZeroRestartCount)(PppContext *context); |
Sergunb | 0:8918a71cdbe9 | 77 | |
Sergunb | 0:8918a71cdbe9 | 78 | |
Sergunb | 0:8918a71cdbe9 | 79 | /** |
Sergunb | 0:8918a71cdbe9 | 80 | * @brief Send-Configure-Request callback function |
Sergunb | 0:8918a71cdbe9 | 81 | **/ |
Sergunb | 0:8918a71cdbe9 | 82 | |
Sergunb | 0:8918a71cdbe9 | 83 | typedef error_t (*PppSendConfigureReq)(PppContext *context); |
Sergunb | 0:8918a71cdbe9 | 84 | |
Sergunb | 0:8918a71cdbe9 | 85 | |
Sergunb | 0:8918a71cdbe9 | 86 | /** |
Sergunb | 0:8918a71cdbe9 | 87 | * @brief Send-Configure-Ack callback function |
Sergunb | 0:8918a71cdbe9 | 88 | **/ |
Sergunb | 0:8918a71cdbe9 | 89 | |
Sergunb | 0:8918a71cdbe9 | 90 | typedef error_t (*PppSendConfigureAck)(PppContext *context, |
Sergunb | 0:8918a71cdbe9 | 91 | const PppConfigurePacket *configureReqPacket); |
Sergunb | 0:8918a71cdbe9 | 92 | |
Sergunb | 0:8918a71cdbe9 | 93 | |
Sergunb | 0:8918a71cdbe9 | 94 | /** |
Sergunb | 0:8918a71cdbe9 | 95 | * @brief Send-Configure-Nak callback function |
Sergunb | 0:8918a71cdbe9 | 96 | **/ |
Sergunb | 0:8918a71cdbe9 | 97 | |
Sergunb | 0:8918a71cdbe9 | 98 | typedef error_t (*PppSendConfigureNak)(PppContext *context, |
Sergunb | 0:8918a71cdbe9 | 99 | const PppConfigurePacket *configureReqPacket); |
Sergunb | 0:8918a71cdbe9 | 100 | |
Sergunb | 0:8918a71cdbe9 | 101 | |
Sergunb | 0:8918a71cdbe9 | 102 | /** |
Sergunb | 0:8918a71cdbe9 | 103 | * @brief Send-Configure-Reject callback function |
Sergunb | 0:8918a71cdbe9 | 104 | **/ |
Sergunb | 0:8918a71cdbe9 | 105 | |
Sergunb | 0:8918a71cdbe9 | 106 | typedef error_t (*PppSendConfigureRej)(PppContext *context, |
Sergunb | 0:8918a71cdbe9 | 107 | const PppConfigurePacket *configureReqPacket); |
Sergunb | 0:8918a71cdbe9 | 108 | |
Sergunb | 0:8918a71cdbe9 | 109 | |
Sergunb | 0:8918a71cdbe9 | 110 | /** |
Sergunb | 0:8918a71cdbe9 | 111 | * @brief Send-Terminate-Request callback function |
Sergunb | 0:8918a71cdbe9 | 112 | **/ |
Sergunb | 0:8918a71cdbe9 | 113 | |
Sergunb | 0:8918a71cdbe9 | 114 | typedef error_t (*PppSendTerminateReq)(PppContext *context); |
Sergunb | 0:8918a71cdbe9 | 115 | |
Sergunb | 0:8918a71cdbe9 | 116 | |
Sergunb | 0:8918a71cdbe9 | 117 | /** |
Sergunb | 0:8918a71cdbe9 | 118 | * @brief Send-Terminate-Ack callback function |
Sergunb | 0:8918a71cdbe9 | 119 | **/ |
Sergunb | 0:8918a71cdbe9 | 120 | |
Sergunb | 0:8918a71cdbe9 | 121 | typedef error_t (*PppSendTerminateAck)(PppContext *context, |
Sergunb | 0:8918a71cdbe9 | 122 | const PppTerminatePacket *terminateReqPacket); |
Sergunb | 0:8918a71cdbe9 | 123 | |
Sergunb | 0:8918a71cdbe9 | 124 | |
Sergunb | 0:8918a71cdbe9 | 125 | /** |
Sergunb | 0:8918a71cdbe9 | 126 | * @brief Send-Code-Reject callback function |
Sergunb | 0:8918a71cdbe9 | 127 | **/ |
Sergunb | 0:8918a71cdbe9 | 128 | |
Sergunb | 0:8918a71cdbe9 | 129 | typedef error_t (*PppSendCodeRej)(PppContext *context, |
Sergunb | 0:8918a71cdbe9 | 130 | const PppPacket *packet); |
Sergunb | 0:8918a71cdbe9 | 131 | |
Sergunb | 0:8918a71cdbe9 | 132 | |
Sergunb | 0:8918a71cdbe9 | 133 | /** |
Sergunb | 0:8918a71cdbe9 | 134 | * @brief Send-Echo-Reply callback function |
Sergunb | 0:8918a71cdbe9 | 135 | **/ |
Sergunb | 0:8918a71cdbe9 | 136 | |
Sergunb | 0:8918a71cdbe9 | 137 | typedef error_t (*PppSendEchoRep)(PppContext *context, |
Sergunb | 0:8918a71cdbe9 | 138 | const PppEchoPacket *echoReqPacket); |
Sergunb | 0:8918a71cdbe9 | 139 | |
Sergunb | 0:8918a71cdbe9 | 140 | |
Sergunb | 0:8918a71cdbe9 | 141 | /** |
Sergunb | 0:8918a71cdbe9 | 142 | *@brief PPP FSM actions |
Sergunb | 0:8918a71cdbe9 | 143 | **/ |
Sergunb | 0:8918a71cdbe9 | 144 | |
Sergunb | 0:8918a71cdbe9 | 145 | typedef struct |
Sergunb | 0:8918a71cdbe9 | 146 | { |
Sergunb | 0:8918a71cdbe9 | 147 | PppThisLayerUp thisLayerUp; |
Sergunb | 0:8918a71cdbe9 | 148 | PppThisLayerDown thisLayerDown; |
Sergunb | 0:8918a71cdbe9 | 149 | PppThisLayerStarted thisLayerStarted; |
Sergunb | 0:8918a71cdbe9 | 150 | PppThisLayerFinished thisLayerFinished; |
Sergunb | 0:8918a71cdbe9 | 151 | PppInitRestartCount initRestartCount; |
Sergunb | 0:8918a71cdbe9 | 152 | PppZeroRestartCount zeroRestartCount; |
Sergunb | 0:8918a71cdbe9 | 153 | PppSendConfigureReq sendConfigureReq; |
Sergunb | 0:8918a71cdbe9 | 154 | PppSendConfigureAck sendConfigureAck; |
Sergunb | 0:8918a71cdbe9 | 155 | PppSendConfigureNak sendConfigureNak; |
Sergunb | 0:8918a71cdbe9 | 156 | PppSendConfigureRej sendConfigureRej; |
Sergunb | 0:8918a71cdbe9 | 157 | PppSendTerminateReq sendTerminateReq; |
Sergunb | 0:8918a71cdbe9 | 158 | PppSendTerminateAck sendTerminateAck; |
Sergunb | 0:8918a71cdbe9 | 159 | PppSendCodeRej sendCodeRej; |
Sergunb | 0:8918a71cdbe9 | 160 | PppSendEchoRep sendEchoRep; |
Sergunb | 0:8918a71cdbe9 | 161 | } PppCallbacks; |
Sergunb | 0:8918a71cdbe9 | 162 | |
Sergunb | 0:8918a71cdbe9 | 163 | |
Sergunb | 0:8918a71cdbe9 | 164 | //PPP FSM events |
Sergunb | 0:8918a71cdbe9 | 165 | void pppUpEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 166 | const PppCallbacks *callbacks); |
Sergunb | 0:8918a71cdbe9 | 167 | |
Sergunb | 0:8918a71cdbe9 | 168 | void pppDownEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 169 | const PppCallbacks *callbacks); |
Sergunb | 0:8918a71cdbe9 | 170 | |
Sergunb | 0:8918a71cdbe9 | 171 | void pppOpenEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 172 | const PppCallbacks *callbacks); |
Sergunb | 0:8918a71cdbe9 | 173 | |
Sergunb | 0:8918a71cdbe9 | 174 | void pppCloseEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 175 | const PppCallbacks *callbacks); |
Sergunb | 0:8918a71cdbe9 | 176 | |
Sergunb | 0:8918a71cdbe9 | 177 | void pppTimeoutEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 178 | const PppCallbacks *callbacks); |
Sergunb | 0:8918a71cdbe9 | 179 | |
Sergunb | 0:8918a71cdbe9 | 180 | void pppRcvConfigureReqEvent(PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks, |
Sergunb | 0:8918a71cdbe9 | 181 | const PppConfigurePacket *configureReqPacket, PppCode code); |
Sergunb | 0:8918a71cdbe9 | 182 | |
Sergunb | 0:8918a71cdbe9 | 183 | void pppRcvConfigureAckEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 184 | const PppCallbacks *callbacks); |
Sergunb | 0:8918a71cdbe9 | 185 | |
Sergunb | 0:8918a71cdbe9 | 186 | void pppRcvConfigureNakEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 187 | const PppCallbacks *callbacks); |
Sergunb | 0:8918a71cdbe9 | 188 | |
Sergunb | 0:8918a71cdbe9 | 189 | void pppRcvTerminateReqEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 190 | const PppCallbacks *callbacks, const PppTerminatePacket *terminateReqPacket); |
Sergunb | 0:8918a71cdbe9 | 191 | |
Sergunb | 0:8918a71cdbe9 | 192 | void pppRcvTerminateAckEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 193 | const PppCallbacks *callbacks); |
Sergunb | 0:8918a71cdbe9 | 194 | |
Sergunb | 0:8918a71cdbe9 | 195 | void pppRcvUnknownCodeEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 196 | const PppCallbacks *callbacks, const PppPacket *packet); |
Sergunb | 0:8918a71cdbe9 | 197 | |
Sergunb | 0:8918a71cdbe9 | 198 | void pppRcvCodeRejEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 199 | const PppCallbacks *callbacks, bool_t acceptable); |
Sergunb | 0:8918a71cdbe9 | 200 | |
Sergunb | 0:8918a71cdbe9 | 201 | void pppRcvEchoReqEvent(PppContext *context, PppFsm *fsm, |
Sergunb | 0:8918a71cdbe9 | 202 | const PppCallbacks *callbacks, const PppEchoPacket *echoReqPacket); |
Sergunb | 0:8918a71cdbe9 | 203 | |
Sergunb | 0:8918a71cdbe9 | 204 | void pppChangeState(PppFsm *fsm, PppState newState); |
Sergunb | 0:8918a71cdbe9 | 205 | |
Sergunb | 0:8918a71cdbe9 | 206 | #endif |
Sergunb | 0:8918a71cdbe9 | 207 |