stp_bpdu.c File Reference

BPDU processing. More...

#include "stp/stp.h"
#include "stp/stp_operation.h"
#include "stp/stp_bpdu.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

void stpProcessLlcFrame (NetInterface *interface, EthHeader *ethHeader, const uint8_t *data, size_t length, NetRxAncillary *ancillary, void *param)
 Process incoming LLC frame. More...
 
error_t stpProcessBpdu (StpBridgePort *port, const StpBpdu *bpdu, size_t length)
 Process incoming bridge protocol data unit. More...
 
error_t stpSendBpdu (StpBridgePort *port, const StpBpdu *bpdu, size_t length)
 Send bridge protocol data unit. More...
 
error_t stpDumpBpdu (const StpBpdu *bpdu, size_t length)
 Dump BPDU for debugging purpose. More...
 
void stpDumpFlags (uint8_t flags)
 Dump Flags field for debugging purpose. More...
 

Variables

const MacAddr STP_BRIDGE_GROUP_ADDR = {{{0x01, 0x80, 0xC2, 0x00, 0x00, 0x00}}}
 
const StpParamName stpProtocolVersions []
 
const StpParamName stpBpduTypes []
 

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

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   STP_TRACE_LEVEL

Definition at line 32 of file stp_bpdu.c.

Function Documentation

◆ stpDumpBpdu()

error_t stpDumpBpdu ( const StpBpdu 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 267 of file stp_bpdu.c.

◆ stpDumpFlags()

void stpDumpFlags ( uint8_t  flags)

Dump Flags field for debugging purpose.

Parameters
[in]flagsValue of the Flags field

Definition at line 337 of file stp_bpdu.c.

◆ stpProcessBpdu()

error_t stpProcessBpdu ( StpBridgePort port,
const StpBpdu 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 130 of file stp_bpdu.c.

◆ stpProcessLlcFrame()

void stpProcessLlcFrame ( 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 STP bridge context

Definition at line 72 of file stp_bpdu.c.

◆ stpSendBpdu()

error_t stpSendBpdu ( StpBridgePort port,
const StpBpdu 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 186 of file stp_bpdu.c.

Variable Documentation

◆ STP_BRIDGE_GROUP_ADDR

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

Definition at line 45 of file stp_bpdu.c.

◆ stpBpduTypes

const StpParamName stpBpduTypes[]
Initial value:
=
{
{STP_BPDU_TYPE_CONFIG, "CONFIG"},
}
@ STP_BPDU_TYPE_CONFIG
Definition: stp_bpdu.h:57
@ STP_BPDU_TYPE_TCN
Definition: stp_bpdu.h:58

Definition at line 54 of file stp_bpdu.c.

◆ stpProtocolVersions

const StpParamName stpProtocolVersions[]
Initial value:
=
{
}
@ STP_PROTOCOL_VERSION
STP version.
Definition: stp_common.h:97

Definition at line 48 of file stp_bpdu.c.