rstp_bpdu.c File Reference

BPDU processing. More...

#include "rstp/rstp.h"
#include "rstp/rstp_fsm.h"
#include "rstp/rstp_bpdu.h"
#include "rstp/rstp_conditions.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

void rstpProcessLlcFrame (NetInterface *interface, EthHeader *ethHeader, const uint8_t *data, size_t length, NetRxAncillary *ancillary, void *param)
 Process incoming LLC frame. More...
 
error_t rstpProcessBpdu (RstpBridgePort *port, const RstpBpdu *bpdu, size_t length)
 Process incoming bridge protocol data unit. More...
 
error_t rstpValidateConfigBpdu (RstpBridgePort *port, const RstpBpdu *bpdu, size_t length)
 Validate Configuration BPDU. More...
 
error_t rstpSendBpdu (RstpBridgePort *port, const RstpBpdu *bpdu, size_t length)
 Send bridge protocol data unit. More...
 
error_t rstpDumpBpdu (const RstpBpdu *bpdu, size_t length)
 Dump BPDU for debugging purpose. More...
 
void rstpDumpFlags (uint8_t flags)
 Dump Flags field for debugging purpose. More...
 

Variables

const MacAddr RSTP_BRIDGE_GROUP_ADDR = {{{0x01, 0x80, 0xC2, 0x00, 0x00, 0x00}}}
 
const RstpParamName rstpProtocolVersions []
 
const RstpParamName rstpBpduTypes []
 

Detailed Description

BPDU processing.

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 rstp_bpdu.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   RSTP_TRACE_LEVEL

Definition at line 32 of file rstp_bpdu.c.

Function Documentation

◆ rstpDumpBpdu()

error_t rstpDumpBpdu ( const RstpBpdu bpdu,
size_t  length 
)

Dump BPDU for debugging purpose.

Parameters
[in]bpduPointer to the BPDU to dump
[in]lengthLength of the BPDU, in bytes
Returns
Error code

Definition at line 389 of file rstp_bpdu.c.

◆ rstpDumpFlags()

void rstpDumpFlags ( uint8_t  flags)

Dump Flags field for debugging purpose.

Parameters
[in]flagsValue of the Flags field

Definition at line 466 of file rstp_bpdu.c.

◆ rstpProcessBpdu()

error_t rstpProcessBpdu ( RstpBridgePort port,
const RstpBpdu bpdu,
size_t  length 
)

Process incoming bridge protocol data unit.

Parameters
[in]portPointer to the bridge port context
[in]bpduPointer to the received BPDU
[in]lengthLength of the BPDU, in bytes
Returns
Error code

Definition at line 134 of file rstp_bpdu.c.

◆ rstpProcessLlcFrame()

void rstpProcessLlcFrame ( NetInterface interface,
EthHeader ethHeader,
const uint8_t *  data,
size_t  length,
NetRxAncillary ancillary,
void *  param 
)

Process incoming LLC frame.

Parameters
[in]interfaceUnderlying network interface
[in]ethHeaderPointer to the Ethernet header
[in]dataPointer to the LLC frame
[in]lengthLength of the LLC frame, in bytes
[in]ancillaryAdditional options passed to the stack along with the packet
[in]paramPointer to the RSTP bridge context

Definition at line 75 of file rstp_bpdu.c.

◆ rstpSendBpdu()

error_t rstpSendBpdu ( RstpBridgePort port,
const RstpBpdu bpdu,
size_t  length 
)

Send bridge protocol data unit.

Parameters
[in]portPointer to the bridge port context
[in]bpduPointer to the BPDU to be transmitted
[in]lengthLength of the BPDU, in bytes
Returns
Error code

Definition at line 308 of file rstp_bpdu.c.

◆ rstpValidateConfigBpdu()

error_t rstpValidateConfigBpdu ( RstpBridgePort port,
const RstpBpdu bpdu,
size_t  length 
)

Validate Configuration BPDU.

Parameters
[in]portPointer to the bridge port context
[in]bpduPointer to the received Configuration BPDU
[in]lengthLength of the Configuration BPDU, in bytes
Returns
Error code

Definition at line 271 of file rstp_bpdu.c.

Variable Documentation

◆ RSTP_BRIDGE_GROUP_ADDR

const MacAddr RSTP_BRIDGE_GROUP_ADDR = {{{0x01, 0x80, 0xC2, 0x00, 0x00, 0x00}}}

Definition at line 46 of file rstp_bpdu.c.

◆ rstpBpduTypes

const RstpParamName rstpBpduTypes[]
Initial value:
=
{
{RSTP_BPDU_TYPE_CONFIG, "CONFIG"},
}
@ RSTP_BPDU_TYPE_TCN
Definition: rstp_bpdu.h:59
@ RSTP_BPDU_TYPE_RST
Definition: rstp_bpdu.h:60
@ RSTP_BPDU_TYPE_CONFIG
Definition: rstp_bpdu.h:58

Definition at line 56 of file rstp_bpdu.c.

◆ rstpProtocolVersions

const RstpParamName rstpProtocolVersions[]
Initial value:
=
{
}
@ STP_PROTOCOL_VERSION
STP version.
Definition: stp_common.h:97
@ RSTP_PROTOCOL_VERSION
RSTP version.
Definition: stp_common.h:98

Definition at line 49 of file rstp_bpdu.c.