ppp_fsm.h File Reference

PPP finite state machine. More...

#include "core/net.h"
#include "ppp/ppp.h"

Go to the source code of this file.

Data Structures

struct  PppCallbacks
 PPP FSM actions. More...
 

Typedefs

typedef void(* PppThisLayerUp) (PppContext *context)
 This-Layer-Up callback function. More...
 
typedef void(* PppThisLayerDown) (PppContext *context)
 This-Layer-Down callback function. More...
 
typedef void(* PppThisLayerStarted) (PppContext *context)
 This-Layer-Started callback function. More...
 
typedef void(* PppThisLayerFinished) (PppContext *context)
 This-Layer-Finished callback function. More...
 
typedef void(* PppInitRestartCount) (PppContext *context, uint_t value)
 Initialize-Restart-Count callback function. More...
 
typedef void(* PppZeroRestartCount) (PppContext *context)
 Zero-Restart-Count callback function. More...
 
typedef error_t(* PppSendConfigureReq) (PppContext *context)
 Send-Configure-Request callback function. More...
 
typedef error_t(* PppSendConfigureAck) (PppContext *context, const PppConfigurePacket *configureReqPacket)
 Send-Configure-Ack callback function. More...
 
typedef error_t(* PppSendConfigureNak) (PppContext *context, const PppConfigurePacket *configureReqPacket)
 Send-Configure-Nak callback function. More...
 
typedef error_t(* PppSendConfigureRej) (PppContext *context, const PppConfigurePacket *configureReqPacket)
 Send-Configure-Reject callback function. More...
 
typedef error_t(* PppSendTerminateReq) (PppContext *context)
 Send-Terminate-Request callback function. More...
 
typedef error_t(* PppSendTerminateAck) (PppContext *context, const PppTerminatePacket *terminateReqPacket)
 Send-Terminate-Ack callback function. More...
 
typedef error_t(* PppSendCodeRej) (PppContext *context, const PppPacket *packet)
 Send-Code-Reject callback function. More...
 
typedef error_t(* PppSendEchoRep) (PppContext *context, const PppEchoPacket *echoReqPacket)
 Send-Echo-Reply callback function. More...
 

Functions

void pppUpEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks)
 Process Up event. More...
 
void pppDownEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks)
 Process Down event. More...
 
void pppOpenEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks)
 Process Open event. More...
 
void pppCloseEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks)
 Process Close event. More...
 
void pppTimeoutEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks)
 Process Timeout event. More...
 
void pppRcvConfigureReqEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks, const PppConfigurePacket *configureReqPacket, PppCode code)
 Process Receive-Configure-Request event. More...
 
void pppRcvConfigureAckEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks)
 Process Receive-Configure-Ack event. More...
 
void pppRcvConfigureNakEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks)
 Process Receive-Configure-Nak event. More...
 
void pppRcvTerminateReqEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks, const PppTerminatePacket *terminateReqPacket)
 Process Receive-Terminate-Req event. More...
 
void pppRcvTerminateAckEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks)
 Process Receive-Terminate-Ack event. More...
 
void pppRcvUnknownCodeEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks, const PppPacket *packet)
 Process Receive-Unknown-Code event. More...
 
void pppRcvCodeRejEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks, bool_t acceptable)
 Process Receive-Code-Reject or Receive-Protocol-Reject event. More...
 
void pppRcvEchoReqEvent (PppContext *context, PppFsm *fsm, const PppCallbacks *callbacks, const PppEchoPacket *echoReqPacket)
 Process Receive-Echo-Request event. More...
 
void pppChangeState (PppFsm *fsm, PppState newState)
 Update PPP FSM state. More...
 

Detailed Description

PPP finite state machine.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file ppp_fsm.h.

Typedef Documentation

◆ PppInitRestartCount

typedef void(* PppInitRestartCount) (PppContext *context, uint_t value)

Initialize-Restart-Count callback function.

Definition at line 76 of file ppp_fsm.h.

◆ PppSendCodeRej

typedef error_t(* PppSendCodeRej) (PppContext *context, const PppPacket *packet)

Send-Code-Reject callback function.

Definition at line 136 of file ppp_fsm.h.

◆ PppSendConfigureAck

typedef error_t(* PppSendConfigureAck) (PppContext *context, const PppConfigurePacket *configureReqPacket)

Send-Configure-Ack callback function.

Definition at line 97 of file ppp_fsm.h.

◆ PppSendConfigureNak

typedef error_t(* PppSendConfigureNak) (PppContext *context, const PppConfigurePacket *configureReqPacket)

Send-Configure-Nak callback function.

Definition at line 105 of file ppp_fsm.h.

◆ PppSendConfigureRej

typedef error_t(* PppSendConfigureRej) (PppContext *context, const PppConfigurePacket *configureReqPacket)

Send-Configure-Reject callback function.

Definition at line 113 of file ppp_fsm.h.

◆ PppSendConfigureReq

typedef error_t(* PppSendConfigureReq) (PppContext *context)

Send-Configure-Request callback function.

Definition at line 90 of file ppp_fsm.h.

◆ PppSendEchoRep

typedef error_t(* PppSendEchoRep) (PppContext *context, const PppEchoPacket *echoReqPacket)

Send-Echo-Reply callback function.

Definition at line 144 of file ppp_fsm.h.

◆ PppSendTerminateAck

typedef error_t(* PppSendTerminateAck) (PppContext *context, const PppTerminatePacket *terminateReqPacket)

Send-Terminate-Ack callback function.

Definition at line 128 of file ppp_fsm.h.

◆ PppSendTerminateReq

typedef error_t(* PppSendTerminateReq) (PppContext *context)

Send-Terminate-Request callback function.

Definition at line 121 of file ppp_fsm.h.

◆ PppThisLayerDown

typedef void(* PppThisLayerDown) (PppContext *context)

This-Layer-Down callback function.

Definition at line 55 of file ppp_fsm.h.

◆ PppThisLayerFinished

typedef void(* PppThisLayerFinished) (PppContext *context)

This-Layer-Finished callback function.

Definition at line 69 of file ppp_fsm.h.

◆ PppThisLayerStarted

typedef void(* PppThisLayerStarted) (PppContext *context)

This-Layer-Started callback function.

Definition at line 62 of file ppp_fsm.h.

◆ PppThisLayerUp

typedef void(* PppThisLayerUp) (PppContext *context)

This-Layer-Up callback function.

Definition at line 48 of file ppp_fsm.h.

◆ PppZeroRestartCount

typedef void(* PppZeroRestartCount) (PppContext *context)

Zero-Restart-Count callback function.

Definition at line 83 of file ppp_fsm.h.

Function Documentation

◆ pppChangeState()

void pppChangeState ( PppFsm fsm,
PppState  newState 
)

Update PPP FSM state.

Parameters
[in,out]fsmFinite state machine
[in]newStateNew PPP state to switch to

Definition at line 924 of file ppp_fsm.c.

◆ pppCloseEvent()

void pppCloseEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks 
)

Process Close event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions

Definition at line 189 of file ppp_fsm.c.

◆ pppDownEvent()

void pppDownEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks 
)

Process Down event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions

Definition at line 84 of file ppp_fsm.c.

◆ pppOpenEvent()

void pppOpenEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks 
)

Process Open event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions

Definition at line 135 of file ppp_fsm.c.

◆ pppRcvCodeRejEvent()

void pppRcvCodeRejEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks,
bool_t  acceptable 
)

Process Receive-Code-Reject or Receive-Protocol-Reject event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions
[in]acceptableThis parameter tells whether the rejected value is acceptable or catastrophic

Definition at line 792 of file ppp_fsm.c.

◆ pppRcvConfigureAckEvent()

void pppRcvConfigureAckEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks 
)

Process Receive-Configure-Ack event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions

Definition at line 524 of file ppp_fsm.c.

◆ pppRcvConfigureNakEvent()

void pppRcvConfigureNakEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks 
)

Process Receive-Configure-Nak event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions

Definition at line 586 of file ppp_fsm.c.

◆ pppRcvConfigureReqEvent()

void pppRcvConfigureReqEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks,
const PppConfigurePacket configureReqPacket,
PppCode  code 
)

Process Receive-Configure-Request event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions
[in]configureReqPacketConfigure-Request packet received from the peer
[in]codeTells whether the configuration options are acceptable

Definition at line 335 of file ppp_fsm.c.

◆ pppRcvEchoReqEvent()

void pppRcvEchoReqEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks,
const PppEchoPacket echoReqPacket 
)

Process Receive-Echo-Request event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions
[in]echoReqPacketEcho-Request packet received from the peer

Definition at line 889 of file ppp_fsm.c.

◆ pppRcvTerminateAckEvent()

void pppRcvTerminateAckEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks 
)

Process Receive-Terminate-Ack event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions

Definition at line 697 of file ppp_fsm.c.

◆ pppRcvTerminateReqEvent()

void pppRcvTerminateReqEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks,
const PppTerminatePacket terminateReqPacket 
)

Process Receive-Terminate-Req event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions
[in]terminateReqPacketTerminate-Request packet received from the peer

Definition at line 648 of file ppp_fsm.c.

◆ pppRcvUnknownCodeEvent()

void pppRcvUnknownCodeEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks,
const PppPacket packet 
)

Process Receive-Unknown-Code event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions
[in]packetUn-interpretable packet received from the peer

Definition at line 757 of file ppp_fsm.c.

◆ pppTimeoutEvent()

void pppTimeoutEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks 
)

Process Timeout event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions

Definition at line 257 of file ppp_fsm.c.

◆ pppUpEvent()

void pppUpEvent ( PppContext context,
PppFsm fsm,
const PppCallbacks callbacks 
)

Process Up event.

Parameters
[in]contextPPP context
[in,out]fsmFinite state machine
[in]callbacksFSM actions

Definition at line 50 of file ppp_fsm.c.