stp_mgmt.c File Reference

Management of the STP bridge. More...

#include "stp/stp.h"
#include "stp/stp_procedures.h"
#include "stp/stp_conditions.h"
#include "stp/stp_misc.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   STP_TRACE_LEVEL
 

Functions

error_t stpMgmtSetBridgePriority (StpBridgeContext *context, uint16_t value, bool_t commit)
 Set bridge priority. More...
 
error_t stpMgmtSetBridgeMaxAge (StpBridgeContext *context, uint_t value, bool_t commit)
 Set Bridge Max Age parameter. More...
 
error_t stpMgmtSetBridgeHelloTime (StpBridgeContext *context, uint_t value, bool_t commit)
 Set Bridge Hello Time parameter. More...
 
error_t stpMgmtSetBridgeForwardDelay (StpBridgeContext *context, uint_t value, bool_t commit)
 Set Bridge Forward Delay parameter. More...
 
error_t stpMgmtSetAgeingTime (StpBridgeContext *context, uint_t value, bool_t commit)
 Set Ageing Time parameter. More...
 
error_t stpMgmtGetNumPorts (StpBridgeContext *context, uint_t *value)
 Get the number of ports. More...
 
error_t stpMgmtGetBridgeAddr (StpBridgeContext *context, MacAddr *value)
 Get the MAC address assigned to the bridge. More...
 
error_t stpMgmtGetBridgePriority (StpBridgeContext *context, uint16_t *value)
 Get the assigned bridge priority. More...
 
error_t stpMgmtGetBridgeMaxAge (StpBridgeContext *context, uint_t *value)
 Get the assigned value of the Bridge Max Age parameter. More...
 
error_t stpMgmtGetBridgeHelloTime (StpBridgeContext *context, uint_t *value)
 Get the assigned value of the Bridge Hello Time parameter. More...
 
error_t stpMgmtGetBridgeForwardDelay (StpBridgeContext *context, uint_t *value)
 Get the assigned value of the Bridge Forward Delay parameter. More...
 
error_t stpMgmtGetHoldTime (StpBridgeContext *context, uint_t *value)
 Get the assigned value of the Hold Time parameter. More...
 
error_t stpMgmtGetAgeingTime (StpBridgeContext *context, uint_t *value)
 Get the assigned value of the Ageing Time parameter. More...
 
error_t stpMgmtGetDesignatedRoot (StpBridgeContext *context, StpBridgeId *value)
 Get the bridge identifier of the root of the spanning tree. More...
 
error_t stpMgmtGetRootPathCost (StpBridgeContext *context, uint32_t *value)
 Get the current cost of the path to the root. More...
 
error_t stpMgmtGetRootPort (StpBridgeContext *context, uint16_t *value)
 Get the current root port. More...
 
error_t stpMgmtGetMaxAge (StpBridgeContext *context, uint_t *value)
 Get the current Max Age value. More...
 
error_t stpMgmtGetHelloTime (StpBridgeContext *context, uint_t *value)
 Get the current Hello Time value. More...
 
error_t stpMgmtGetForwardDelay (StpBridgeContext *context, uint_t *value)
 Get the current Forward Delay value. More...
 
error_t stpMgmtGetTopologyChanges (StpBridgeContext *context, uint_t *value)
 Get the number of topology changes. More...
 
error_t stpMgmtGetTimeSinceTopologyChange (StpBridgeContext *context, uint_t *value)
 Get the time since a topology change was last detected. More...
 
error_t stpMgmtSetPortPriority (StpBridgeContext *context, uint_t portIndex, uint8_t value, bool_t commit)
 Set port priority. More...
 
error_t stpMgmtSetAdminPortState (StpBridgeContext *context, uint_t portIndex, bool_t value, bool_t commit)
 Set administrative bridge port state. More...
 
error_t stpMgmtSetPortPathCost (StpBridgeContext *context, uint_t portIndex, uint32_t value, bool_t commit)
 Set administrative port path cost. More...
 
error_t stpMgmtGetPortAddr (StpBridgeContext *context, uint_t portIndex, MacAddr *value)
 Get the MAC address assigned to the port. More...
 
error_t stpMgmtGetPortPriority (StpBridgeContext *context, uint_t portIndex, uint8_t *value)
 Get the priority assigned to the port. More...
 
error_t stpMgmtGetAdminPortState (StpBridgeContext *context, uint_t portIndex, bool_t *value)
 Get the administrative port state. More...
 
error_t stpMgmtGetMacOperState (StpBridgeContext *context, uint_t portIndex, bool_t *value)
 Get the current MAC operational state. More...
 
error_t stpMgmtGetPortPathCost (StpBridgeContext *context, uint_t portIndex, uint32_t *value)
 Get the current value of the port path cost. More...
 
error_t stpMgmtGetPortState (StpBridgeContext *context, uint_t portIndex, StpPortState *value)
 Get the current state of the port. More...
 
error_t stpMgmtGetPortRole (StpBridgeContext *context, uint_t portIndex, StpPortRole *value)
 Get the assigned role of the port. More...
 
error_t stpMgmtGetPortDesignatedRoot (StpBridgeContext *context, uint_t portIndex, StpBridgeId *value)
 Get the bridge identifier of the designated root bridge. More...
 
error_t stpMgmtGetPortDesignatedCost (StpBridgeContext *context, uint_t portIndex, uint32_t *value)
 Get the designated cost of the port. More...
 
error_t stpMgmtGetPortDesignatedBridge (StpBridgeContext *context, uint_t portIndex, StpBridgeId *value)
 Get the bridge identifier of the designated bridge. More...
 
error_t stpMgmtGetPortDesignatedPort (StpBridgeContext *context, uint_t portIndex, uint16_t *value)
 Get the port identifier of the designated bridge. More...
 
error_t stpMgmtGetForwardTransitions (StpBridgeContext *context, uint_t portIndex, uint_t *value)
 Get the number of times the port has transitioned to Forwarding state. More...
 

Detailed Description

Management of the STP bridge.

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.0

Definition in file stp_mgmt.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   STP_TRACE_LEVEL

Definition at line 32 of file stp_mgmt.c.

Function Documentation

◆ stpMgmtGetAdminPortState()

error_t stpMgmtGetAdminPortState ( StpBridgeContext context,
uint_t  portIndex,
bool_t value 
)

Get the administrative port state.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valueAdministrative port state
Returns
Error code

Definition at line 999 of file stp_mgmt.c.

◆ stpMgmtGetAgeingTime()

error_t stpMgmtGetAgeingTime ( StpBridgeContext context,
uint_t value 
)

Get the assigned value of the Ageing Time parameter.

Parameters
[in]contextPointer to the STP bridge context
[out]valueValue of the Ageing Time parameter
Returns
Error code

Definition at line 502 of file stp_mgmt.c.

◆ stpMgmtGetBridgeAddr()

error_t stpMgmtGetBridgeAddr ( StpBridgeContext context,
MacAddr value 
)

Get the MAC address assigned to the bridge.

Parameters
[in]contextPointer to the STP bridge context
[out]valueMAC address of the bridge
Returns
Error code

Definition at line 376 of file stp_mgmt.c.

◆ stpMgmtGetBridgeForwardDelay()

error_t stpMgmtGetBridgeForwardDelay ( StpBridgeContext context,
uint_t value 
)

Get the assigned value of the Bridge Forward Delay parameter.

Parameters
[in]contextPointer to the STP bridge context
[out]valueValue of the Bridge Forward Delay parameter, in seconds
Returns
Error code

Definition at line 460 of file stp_mgmt.c.

◆ stpMgmtGetBridgeHelloTime()

error_t stpMgmtGetBridgeHelloTime ( StpBridgeContext context,
uint_t value 
)

Get the assigned value of the Bridge Hello Time parameter.

Parameters
[in]contextPointer to the STP bridge context
[out]valueValue of the Bridge Hello Time parameter, in seconds
Returns
Error code

Definition at line 439 of file stp_mgmt.c.

◆ stpMgmtGetBridgeMaxAge()

error_t stpMgmtGetBridgeMaxAge ( StpBridgeContext context,
uint_t value 
)

Get the assigned value of the Bridge Max Age parameter.

Parameters
[in]contextPointer to the STP bridge context
[out]valueValue of the Bridge Max Age parameter, in seconds
Returns
Error code

Definition at line 418 of file stp_mgmt.c.

◆ stpMgmtGetBridgePriority()

error_t stpMgmtGetBridgePriority ( StpBridgeContext context,
uint16_t *  value 
)

Get the assigned bridge priority.

Parameters
[in]contextPointer to the STP bridge context
[out]valueBridge priority
Returns
Error code

Definition at line 397 of file stp_mgmt.c.

◆ stpMgmtGetDesignatedRoot()

error_t stpMgmtGetDesignatedRoot ( StpBridgeContext context,
StpBridgeId value 
)

Get the bridge identifier of the root of the spanning tree.

Parameters
[in]contextPointer to the STP bridge context
[out]valueBridge identifier
Returns
Error code

Definition at line 523 of file stp_mgmt.c.

◆ stpMgmtGetForwardDelay()

error_t stpMgmtGetForwardDelay ( StpBridgeContext context,
uint_t value 
)

Get the current Forward Delay value.

Parameters
[in]contextPointer to the STP bridge context
[out]valueForward Delay value, in seconds
Returns
Error code

Definition at line 633 of file stp_mgmt.c.

◆ stpMgmtGetForwardTransitions()

error_t stpMgmtGetForwardTransitions ( StpBridgeContext context,
uint_t  portIndex,
uint_t value 
)

Get the number of times the port has transitioned to Forwarding state.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valueNumber of transitions to Forwarding state
Returns
Error code

Definition at line 1356 of file stp_mgmt.c.

◆ stpMgmtGetHelloTime()

error_t stpMgmtGetHelloTime ( StpBridgeContext context,
uint_t value 
)

Get the current Hello Time value.

Parameters
[in]contextPointer to the STP bridge context
[out]valueHello Time value, in seconds
Returns
Error code

Definition at line 610 of file stp_mgmt.c.

◆ stpMgmtGetHoldTime()

error_t stpMgmtGetHoldTime ( StpBridgeContext context,
uint_t value 
)

Get the assigned value of the Hold Time parameter.

Parameters
[in]contextPointer to the STP bridge context
[out]valueValue of the Transmit Hold Count parameter
Returns
Error code

Definition at line 481 of file stp_mgmt.c.

◆ stpMgmtGetMacOperState()

error_t stpMgmtGetMacOperState ( StpBridgeContext context,
uint_t  portIndex,
bool_t value 
)

Get the current MAC operational state.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valueMAC operational state
Returns
Error code

Definition at line 1031 of file stp_mgmt.c.

◆ stpMgmtGetMaxAge()

error_t stpMgmtGetMaxAge ( StpBridgeContext context,
uint_t value 
)

Get the current Max Age value.

Parameters
[in]contextPointer to the STP bridge context
[out]valueMax Age value, in seconds
Returns
Error code

Definition at line 588 of file stp_mgmt.c.

◆ stpMgmtGetNumPorts()

error_t stpMgmtGetNumPorts ( StpBridgeContext context,
uint_t value 
)

Get the number of ports.

Parameters
[in]contextPointer to the STP bridge context
[out]valueNumber of ports
Returns
Error code

Definition at line 356 of file stp_mgmt.c.

◆ stpMgmtGetPortAddr()

error_t stpMgmtGetPortAddr ( StpBridgeContext context,
uint_t  portIndex,
MacAddr value 
)

Get the MAC address assigned to the port.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valueMAC address of the individual MAC entity for the port
Returns
Error code

Definition at line 935 of file stp_mgmt.c.

◆ stpMgmtGetPortDesignatedBridge()

error_t stpMgmtGetPortDesignatedBridge ( StpBridgeContext context,
uint_t  portIndex,
StpBridgeId value 
)

Get the bridge identifier of the designated bridge.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valueBridge identifier
Returns
Error code

Definition at line 1290 of file stp_mgmt.c.

◆ stpMgmtGetPortDesignatedCost()

error_t stpMgmtGetPortDesignatedCost ( StpBridgeContext context,
uint_t  portIndex,
uint32_t *  value 
)

Get the designated cost of the port.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valueDesignated cost of the port
Returns
Error code

Definition at line 1257 of file stp_mgmt.c.

◆ stpMgmtGetPortDesignatedPort()

error_t stpMgmtGetPortDesignatedPort ( StpBridgeContext context,
uint_t  portIndex,
uint16_t *  value 
)

Get the port identifier of the designated bridge.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valuePort identifier
Returns
Error code

Definition at line 1323 of file stp_mgmt.c.

◆ stpMgmtGetPortDesignatedRoot()

error_t stpMgmtGetPortDesignatedRoot ( StpBridgeContext context,
uint_t  portIndex,
StpBridgeId value 
)

Get the bridge identifier of the designated root bridge.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valueBridge identifier
Returns
Error code

Definition at line 1223 of file stp_mgmt.c.

◆ stpMgmtGetPortPathCost()

error_t stpMgmtGetPortPathCost ( StpBridgeContext context,
uint_t  portIndex,
uint32_t *  value 
)

Get the current value of the port path cost.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valuePort path cost
Returns
Error code

Definition at line 1063 of file stp_mgmt.c.

◆ stpMgmtGetPortPriority()

error_t stpMgmtGetPortPriority ( StpBridgeContext context,
uint_t  portIndex,
uint8_t *  value 
)

Get the priority assigned to the port.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valuePort priority
Returns
Error code

Definition at line 967 of file stp_mgmt.c.

◆ stpMgmtGetPortRole()

error_t stpMgmtGetPortRole ( StpBridgeContext context,
uint_t  portIndex,
StpPortRole value 
)

Get the assigned role of the port.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valuePort role
Returns
Error code

Definition at line 1171 of file stp_mgmt.c.

◆ stpMgmtGetPortState()

error_t stpMgmtGetPortState ( StpBridgeContext context,
uint_t  portIndex,
StpPortState value 
)

Get the current state of the port.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[out]valuePort state
Returns
Error code

Definition at line 1096 of file stp_mgmt.c.

◆ stpMgmtGetRootPathCost()

error_t stpMgmtGetRootPathCost ( StpBridgeContext context,
uint32_t *  value 
)

Get the current cost of the path to the root.

Parameters
[in]contextPointer to the STP bridge context
[out]valueRoot path cost
Returns
Error code

Definition at line 545 of file stp_mgmt.c.

◆ stpMgmtGetRootPort()

error_t stpMgmtGetRootPort ( StpBridgeContext context,
uint16_t *  value 
)

Get the current root port.

Parameters
[in]contextPointer to the STP bridge context
[out]valuePort number
Returns
Error code

Definition at line 566 of file stp_mgmt.c.

◆ stpMgmtGetTimeSinceTopologyChange()

error_t stpMgmtGetTimeSinceTopologyChange ( StpBridgeContext context,
uint_t value 
)

Get the time since a topology change was last detected.

Parameters
[in]contextPointer to the STP bridge context
[out]valueTime since a topology change was last detected
Returns
Error code

Definition at line 676 of file stp_mgmt.c.

◆ stpMgmtGetTopologyChanges()

error_t stpMgmtGetTopologyChanges ( StpBridgeContext context,
uint_t value 
)

Get the number of topology changes.

Parameters
[in]contextPointer to the STP bridge context
[out]valueNumber of topology changes
Returns
Error code

Definition at line 655 of file stp_mgmt.c.

◆ stpMgmtSetAdminPortState()

error_t stpMgmtSetAdminPortState ( StpBridgeContext context,
uint_t  portIndex,
bool_t  value,
bool_t  commit 
)

Set administrative bridge port state.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[in]valueAdministrative bridge port state
[in]commitIf this flag is TRUE, the bridge verifies the parameter value and commits the change if the value is valid. If FALSE, the bridge only performs the verification and does not take any further action
Returns
Error code

Definition at line 774 of file stp_mgmt.c.

◆ stpMgmtSetAgeingTime()

error_t stpMgmtSetAgeingTime ( StpBridgeContext context,
uint_t  value,
bool_t  commit 
)

Set Ageing Time parameter.

Parameters
[in]contextPointer to the STP bridge context
[in]valueValue of the Ageing Time parameter
[in]commitIf this flag is TRUE, the bridge verifies the parameter value and commits the change if the value is valid. If FALSE, the bridge only performs the verification and does not take any further action
Returns
Error code

Definition at line 314 of file stp_mgmt.c.

◆ stpMgmtSetBridgeForwardDelay()

error_t stpMgmtSetBridgeForwardDelay ( StpBridgeContext context,
uint_t  value,
bool_t  commit 
)

Set Bridge Forward Delay parameter.

Parameters
[in]contextPointer to the STP bridge context
[in]valueValue of the Bridge Forward Delay parameter, in seconds
[in]commitIf this flag is TRUE, the bridge verifies the parameter value and commits the change if the value is valid. If FALSE, the bridge only performs the verification and does not take any further action
Returns
Error code

Definition at line 253 of file stp_mgmt.c.

◆ stpMgmtSetBridgeHelloTime()

error_t stpMgmtSetBridgeHelloTime ( StpBridgeContext context,
uint_t  value,
bool_t  commit 
)

Set Bridge Hello Time parameter.

Parameters
[in]contextPointer to the STP bridge context
[in]valueValue of the Bridge Hello Time parameter, in seconds
[in]commitIf this flag is TRUE, the bridge verifies the parameter value and commits the change if the value is valid. If FALSE, the bridge only performs the verification and does not take any further action
Returns
Error code

Definition at line 198 of file stp_mgmt.c.

◆ stpMgmtSetBridgeMaxAge()

error_t stpMgmtSetBridgeMaxAge ( StpBridgeContext context,
uint_t  value,
bool_t  commit 
)

Set Bridge Max Age parameter.

Parameters
[in]contextPointer to the STP bridge context
[in]valueValue of the Bridge Max Age parameter, in seconds
[in]commitIf this flag is TRUE, the bridge verifies the parameter value and commits the change if the value is valid. If FALSE, the bridge only performs the verification and does not take any further action
Returns
Error code

Definition at line 137 of file stp_mgmt.c.

◆ stpMgmtSetBridgePriority()

error_t stpMgmtSetBridgePriority ( StpBridgeContext context,
uint16_t  value,
bool_t  commit 
)

Set bridge priority.

Parameters
[in]contextPointer to the STP bridge context
[in]valueBridge priority
[in]commitIf this flag is TRUE, the bridge verifies the parameter value and commits the change if the value is valid. If FALSE, the bridge only performs the verification and does not take any further action
Returns
Error code

Definition at line 55 of file stp_mgmt.c.

◆ stpMgmtSetPortPathCost()

error_t stpMgmtSetPortPathCost ( StpBridgeContext context,
uint_t  portIndex,
uint32_t  value,
bool_t  commit 
)

Set administrative port path cost.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[in]valueAdministrative port path cost
[in]commitIf this flag is TRUE, the bridge verifies the parameter value and commits the change if the value is valid. If FALSE, the bridge only performs the verification and does not take any further action
Returns
Error code

Definition at line 886 of file stp_mgmt.c.

◆ stpMgmtSetPortPriority()

error_t stpMgmtSetPortPriority ( StpBridgeContext context,
uint_t  portIndex,
uint8_t  value,
bool_t  commit 
)

Set port priority.

Parameters
[in]contextPointer to the STP bridge context
[in]portIndexPort index
[in]valuePort priority
[in]commitIf this flag is TRUE, the bridge verifies the parameter value and commits the change if the value is valid. If FALSE, the bridge only performs the verification and does not take any further action
Returns
Error code

Definition at line 702 of file stp_mgmt.c.