1N/A/************************************************************************
1N/A * RSTP library - Rapid Spanning Tree (802.1t, 802.1w)
1N/A * Copyright (C) 2001-2003 Optical Access
1N/A * Author: Alex Rozin
1N/A *
1N/A * This file is part of RSTP library.
1N/A *
1N/A * RSTP library is free software; you can redistribute it and/or modify it
1N/A * under the terms of the GNU Lesser General Public License as published by the
1N/A * Free Software Foundation; version 2.1
1N/A *
1N/A * RSTP library is distributed in the hope that it will be useful, but
1N/A * WITHOUT ANY WARRANTY; without even the implied warranty of
1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
1N/A * General Public License for more details.
1N/A *
1N/A * You should have received a copy of the GNU Lesser General Public License
1N/A * along with RSTP library; see the file COPYING. If not, write to the Free
1N/A * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1N/A * 02111-1307, USA.
1N/A **********************************************************************/
1N/A
1N/A/* BPDU formats: 9.1 - 9.3, 17.28 */
1N/A
1N/A#ifndef _STP_BPDU_H__
1N/A#define _STP_BPDU_H__
1N/A
1N/A#define MIN_BPDU 7
1N/A#define BPDU_L_SAP 0x42
1N/A#define LLC_UI 0x03
1N/A#define BPDU_PROTOCOL_ID 0x0000
1N/A#define BPDU_VERSION_ID 0x00
1N/A#define BPDU_VERSION_RAPID_ID 0x02
1N/A
1N/A#define BPDU_TOPO_CHANGE_TYPE 0x80
1N/A#define BPDU_CONFIG_TYPE 0x00
1N/A#define BPDU_RSTP 0x02
1N/A
1N/A#define TOPOLOGY_CHANGE_BIT 0x01
1N/A#define PROPOSAL_BIT 0x02
1N/A#define PORT_ROLE_OFFS 2 /* 0x04 & 0x08 */
1N/A#define PORT_ROLE_MASK (0x03 << PORT_ROLE_OFFS)
1N/A#define LEARN_BIT 0x10
1N/A#define FORWARD_BIT 0x20
1N/A#define AGREEMENT_BIT 0x40
1N/A#define TOPOLOGY_CHANGE_ACK_BIT 0x80
1N/A
1N/A#define RSTP_PORT_ROLE_UNKN 0x00
1N/A#define RSTP_PORT_ROLE_ALTBACK 0x01
1N/A#define RSTP_PORT_ROLE_ROOT 0x02
1N/A#define RSTP_PORT_ROLE_DESGN 0x03
1N/A
1N/Atypedef struct mac_header_t {
1N/A unsigned char dst_mac[6];
1N/A unsigned char src_mac[6];
1N/A} MAC_HEADER_T;
1N/A
1N/Atypedef struct eth_header_t {
1N/A unsigned char len8023[2];
1N/A unsigned char dsap;
1N/A unsigned char ssap;
1N/A unsigned char llc;
1N/A} ETH_HEADER_T;
1N/A
1N/Atypedef struct bpdu_header_t {
1N/A unsigned char protocol[2];
1N/A unsigned char version;
1N/A unsigned char bpdu_type;
1N/A} BPDU_HEADER_T;
1N/A
1N/Atypedef struct bpdu_body_t {
1N/A unsigned char flags;
1N/A unsigned char root_id[8];
1N/A unsigned char root_path_cost[4];
1N/A unsigned char bridge_id[8];
1N/A unsigned char port_id[2];
1N/A unsigned char message_age[2];
1N/A unsigned char max_age[2];
1N/A unsigned char hello_time[2];
1N/A unsigned char forward_delay[2];
1N/A} BPDU_BODY_T;
1N/A
1N/Atypedef struct stp_bpdu_t {
1N/A ETH_HEADER_T eth;
1N/A BPDU_HEADER_T hdr;
1N/A BPDU_BODY_T body;
1N/A unsigned char ver_1_len[2];
1N/A} BPDU_T;
1N/A
1N/A#endif /* _STP_BPDU_H__ */