rstp_procedures.c File Reference

RSTP state machine procedures. More...

#include "rstp/rstp.h"
#include "rstp/rstp_procedures.h"
#include "rstp/rstp_conditions.h"
#include "rstp/rstp_bpdu.h"
#include "rstp/rstp_misc.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   RSTP_TRACE_LEVEL
 

Functions

bool_t rstpBetterOrSameInfo (RstpBridgePort *port, RstpInfoIs newInfoIs)
 Compare Spanning Tree information (17.21.1) More...
 
void rstpClearReselectTree (RstpBridgeContext *context)
 Clear reselect for all ports of the bridge (17.21.2) More...
 
void rstpDisableForwarding (RstpBridgePort *port)
 Stop forwarding frames through the port (17.21.3) More...
 
void rstpDisableLearning (RstpBridgePort *port)
 Stop learning from frames received on the port (17.21.4) More...
 
void rstpEnableForwarding (RstpBridgePort *port)
 Start forwarding frames through the port (17.21.5) More...
 
void rstpEnableLearning (RstpBridgePort *port)
 Start learning from frames received on the port (17.21.6) More...
 
void rstpNewTcWhile (RstpBridgePort *port)
 Update the value of tcWhile (17.21.7) More...
 
RstpRcvdInfo rstpRcvInfo (RstpBridgePort *port)
 Decode message priority and timer values from the received BPDU (17.21.8) More...
 
void rstpRecordAgreement (RstpBridgePort *port)
 Record agreement (17.21.9) More...
 
void rstpRecordDispute (RstpBridgePort *port)
 Record dispute (17.21.10) More...
 
void rstpRecordProposal (RstpBridgePort *port)
 Record proposal (17.21.11) More...
 
void rstpRecordPriority (RstpBridgePort *port)
 Record priority (17.21.12) More...
 
void rstpRecordTimes (RstpBridgePort *port)
 Set portTimes variable (17.21.13) More...
 
void rstpSetSyncTree (RstpBridgeContext *context)
 Set sync for all ports of the bridge (17.21.14) More...
 
void rstpSetReRootTree (RstpBridgeContext *context)
 Set reRoot for all ports of the bridge (17.21.15) More...
 
void rstpSetSelectedTree (RstpBridgeContext *context)
 Set the selected variable for all ports of the bridge (17.21.16) More...
 
void rstpSetTcFlags (RstpBridgePort *port)
 Update rcvdTc, rcvdTcAck and rcvdTcn flags (17.21.17) More...
 
void rstpSetTcPropTree (RstpBridgePort *port)
 Set tcProp for all ports except the port that called the procedure (17.21.18) More...
 
void rstpTxConfig (RstpBridgePort *port)
 Transmit a Configuration BPDU (17.21.19) More...
 
void rstpTxRstp (RstpBridgePort *port)
 Transmit a Rapid Spanning Tree BPDU (17.21.20) More...
 
void rstpTxTcn (RstpBridgePort *port)
 Transmit a Topology Change Notification BPDU (17.21.21) More...
 
void rstpUpdtBpduVersion (RstpBridgePort *port)
 Update rcvdSTP and rcvdRSTP variables depending on BPDU version (17.21.22) More...
 
void rstpUpdtRcvdInfoWhile (RstpBridgePort *port)
 Update the Received Info timer (17.21.23) More...
 
void rstpUpdtRoleDisabledTree (RstpBridgeContext *context)
 Set the selectedRole to DisabledPort for all ports of the bridge (17.21.24) More...
 
void rstpUpdtRolesTree (RstpBridgeContext *context)
 Update spanning tree information and port roles (17.21.25) More...
 

Variables

const RstpParamName rstpPortRoles []
 

Detailed Description

RSTP state machine procedures.

License

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

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

This file is part of CycloneSTP 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.4

Definition in file rstp_procedures.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   RSTP_TRACE_LEVEL

Definition at line 32 of file rstp_procedures.c.

Function Documentation

◆ rstpBetterOrSameInfo()

bool_t rstpBetterOrSameInfo ( RstpBridgePort port,
RstpInfoIs  newInfoIs 
)

Compare Spanning Tree information (17.21.1)

Parameters
[in]portPointer to the bridge port context
[in]newInfoIsProcedure's parameter
Returns
Boolean

Definition at line 63 of file rstp_procedures.c.

◆ rstpClearReselectTree()

void rstpClearReselectTree ( RstpBridgeContext context)

Clear reselect for all ports of the bridge (17.21.2)

Parameters
[in]contextPointer to the RSTP bridge context

Definition at line 102 of file rstp_procedures.c.

◆ rstpDisableForwarding()

void rstpDisableForwarding ( RstpBridgePort port)

Stop forwarding frames through the port (17.21.3)

Parameters
[in]portPointer to the bridge port context

Definition at line 120 of file rstp_procedures.c.

◆ rstpDisableLearning()

void rstpDisableLearning ( RstpBridgePort port)

Stop learning from frames received on the port (17.21.4)

Parameters
[in]portPointer to the bridge port context

Definition at line 132 of file rstp_procedures.c.

◆ rstpEnableForwarding()

void rstpEnableForwarding ( RstpBridgePort port)

Start forwarding frames through the port (17.21.5)

Parameters
[in]portPointer to the bridge port context

Definition at line 147 of file rstp_procedures.c.

◆ rstpEnableLearning()

void rstpEnableLearning ( RstpBridgePort port)

Start learning from frames received on the port (17.21.6)

Parameters
[in]portPointer to the bridge port context

Definition at line 166 of file rstp_procedures.c.

◆ rstpNewTcWhile()

void rstpNewTcWhile ( RstpBridgePort port)

Update the value of tcWhile (17.21.7)

Parameters
[in]portPointer to the bridge port context

Definition at line 181 of file rstp_procedures.c.

◆ rstpRcvInfo()

RstpRcvdInfo rstpRcvInfo ( RstpBridgePort port)

Decode message priority and timer values from the received BPDU (17.21.8)

Parameters
[in]portPointer to the bridge port context
Returns
State of the received Spanning Tree information

Definition at line 220 of file rstp_procedures.c.

◆ rstpRecordAgreement()

void rstpRecordAgreement ( RstpBridgePort port)

Record agreement (17.21.9)

Parameters
[in]portPointer to the bridge port context

Definition at line 364 of file rstp_procedures.c.

◆ rstpRecordDispute()

void rstpRecordDispute ( RstpBridgePort port)

Record dispute (17.21.10)

Parameters
[in]portPointer to the bridge port context

Definition at line 392 of file rstp_procedures.c.

◆ rstpRecordPriority()

void rstpRecordPriority ( RstpBridgePort port)

Record priority (17.21.12)

Parameters
[in]portPointer to the bridge port context

Definition at line 444 of file rstp_procedures.c.

◆ rstpRecordProposal()

void rstpRecordProposal ( RstpBridgePort port)

Record proposal (17.21.11)

Parameters
[in]portPointer to the bridge port context

Definition at line 415 of file rstp_procedures.c.

◆ rstpRecordTimes()

void rstpRecordTimes ( RstpBridgePort port)

Set portTimes variable (17.21.13)

Parameters
[in]portPointer to the bridge port context

Definition at line 457 of file rstp_procedures.c.

◆ rstpSetReRootTree()

void rstpSetReRootTree ( RstpBridgeContext context)

Set reRoot for all ports of the bridge (17.21.15)

Parameters
[in]contextPointer to the RSTP bridge context

Definition at line 501 of file rstp_procedures.c.

◆ rstpSetSelectedTree()

void rstpSetSelectedTree ( RstpBridgeContext context)

Set the selected variable for all ports of the bridge (17.21.16)

Parameters
[in]contextPointer to the RSTP bridge context

Definition at line 519 of file rstp_procedures.c.

◆ rstpSetSyncTree()

void rstpSetSyncTree ( RstpBridgeContext context)

Set sync for all ports of the bridge (17.21.14)

Parameters
[in]contextPointer to the RSTP bridge context

Definition at line 483 of file rstp_procedures.c.

◆ rstpSetTcFlags()

void rstpSetTcFlags ( RstpBridgePort port)

Update rcvdTc, rcvdTcAck and rcvdTcn flags (17.21.17)

Parameters
[in]portPointer to the bridge port context

Definition at line 550 of file rstp_procedures.c.

◆ rstpSetTcPropTree()

void rstpSetTcPropTree ( RstpBridgePort port)

Set tcProp for all ports except the port that called the procedure (17.21.18)

Parameters
[in]portPointer to the bridge port context

Definition at line 591 of file rstp_procedures.c.

◆ rstpTxConfig()

void rstpTxConfig ( RstpBridgePort port)

Transmit a Configuration BPDU (17.21.19)

Parameters
[in]portPointer to the bridge port context

Definition at line 616 of file rstp_procedures.c.

◆ rstpTxRstp()

void rstpTxRstp ( RstpBridgePort port)

Transmit a Rapid Spanning Tree BPDU (17.21.20)

Parameters
[in]portPointer to the bridge port context

Definition at line 666 of file rstp_procedures.c.

◆ rstpTxTcn()

void rstpTxTcn ( RstpBridgePort port)

Transmit a Topology Change Notification BPDU (17.21.21)

Parameters
[in]portPointer to the bridge port context

Definition at line 764 of file rstp_procedures.c.

◆ rstpUpdtBpduVersion()

void rstpUpdtBpduVersion ( RstpBridgePort port)

Update rcvdSTP and rcvdRSTP variables depending on BPDU version (17.21.22)

Parameters
[in]portPointer to the bridge port context

Definition at line 783 of file rstp_procedures.c.

◆ rstpUpdtRcvdInfoWhile()

void rstpUpdtRcvdInfoWhile ( RstpBridgePort port)

Update the Received Info timer (17.21.23)

Parameters
[in]portPointer to the bridge port context

Definition at line 815 of file rstp_procedures.c.

◆ rstpUpdtRoleDisabledTree()

void rstpUpdtRoleDisabledTree ( RstpBridgeContext context)

Set the selectedRole to DisabledPort for all ports of the bridge (17.21.24)

Parameters
[in]contextPointer to the RSTP bridge context

Definition at line 838 of file rstp_procedures.c.

◆ rstpUpdtRolesTree()

void rstpUpdtRolesTree ( RstpBridgeContext context)

Update spanning tree information and port roles (17.21.25)

Parameters
[in]contextPointer to the RSTP bridge context

Definition at line 856 of file rstp_procedures.c.

Variable Documentation

◆ rstpPortRoles

const RstpParamName rstpPortRoles[]
Initial value:
=
{
{STP_PORT_ROLE_DISABLED, "Disabled"},
{STP_PORT_ROLE_ROOT, "Root"},
{STP_PORT_ROLE_DESIGNATED, "Designated"},
{STP_PORT_ROLE_ALTERNATE, "Alternate"},
}

Definition at line 46 of file rstp_procedures.c.

@ STP_PORT_ROLE_BACKUP
Definition: stp_common.h:128
@ STP_PORT_ROLE_ALTERNATE
Definition: stp_common.h:127
@ STP_PORT_ROLE_ROOT
Definition: stp_common.h:125
@ STP_PORT_ROLE_DESIGNATED
Definition: stp_common.h:126
@ STP_PORT_ROLE_DISABLED
Definition: stp_common.h:124