1*10491SRishi.Srivatsavai@Sun.COM /************************************************************************ 2*10491SRishi.Srivatsavai@Sun.COM * RSTP library - Rapid Spanning Tree (802.1t, 802.1w) 3*10491SRishi.Srivatsavai@Sun.COM * Copyright (C) 2001-2003 Optical Access 4*10491SRishi.Srivatsavai@Sun.COM * Author: Alex Rozin 5*10491SRishi.Srivatsavai@Sun.COM * 6*10491SRishi.Srivatsavai@Sun.COM * This file is part of RSTP library. 7*10491SRishi.Srivatsavai@Sun.COM * 8*10491SRishi.Srivatsavai@Sun.COM * RSTP library is free software; you can redistribute it and/or modify it 9*10491SRishi.Srivatsavai@Sun.COM * under the terms of the GNU Lesser General Public License as published by the 10*10491SRishi.Srivatsavai@Sun.COM * Free Software Foundation; version 2.1 11*10491SRishi.Srivatsavai@Sun.COM * 12*10491SRishi.Srivatsavai@Sun.COM * RSTP library is distributed in the hope that it will be useful, but 13*10491SRishi.Srivatsavai@Sun.COM * WITHOUT ANY WARRANTY; without even the implied warranty of 14*10491SRishi.Srivatsavai@Sun.COM * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 15*10491SRishi.Srivatsavai@Sun.COM * General Public License for more details. 16*10491SRishi.Srivatsavai@Sun.COM * 17*10491SRishi.Srivatsavai@Sun.COM * You should have received a copy of the GNU Lesser General Public License 18*10491SRishi.Srivatsavai@Sun.COM * along with RSTP library; see the file COPYING. If not, write to the Free 19*10491SRishi.Srivatsavai@Sun.COM * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 20*10491SRishi.Srivatsavai@Sun.COM * 02111-1307, USA. 21*10491SRishi.Srivatsavai@Sun.COM **********************************************************************/ 22*10491SRishi.Srivatsavai@Sun.COM 23*10491SRishi.Srivatsavai@Sun.COM /* External management communication API definitions */ 24*10491SRishi.Srivatsavai@Sun.COM 25*10491SRishi.Srivatsavai@Sun.COM #ifndef _UID_STP_H__ 26*10491SRishi.Srivatsavai@Sun.COM #define _UID_STP_H__ 27*10491SRishi.Srivatsavai@Sun.COM 28*10491SRishi.Srivatsavai@Sun.COM #define STP_DBG 1 29*10491SRishi.Srivatsavai@Sun.COM 30*10491SRishi.Srivatsavai@Sun.COM #define NAME_LEN 20 31*10491SRishi.Srivatsavai@Sun.COM 32*10491SRishi.Srivatsavai@Sun.COM typedef enum { 33*10491SRishi.Srivatsavai@Sun.COM STP_DISABLED, 34*10491SRishi.Srivatsavai@Sun.COM STP_ENABLED 35*10491SRishi.Srivatsavai@Sun.COM } UID_STP_MODE_T; 36*10491SRishi.Srivatsavai@Sun.COM 37*10491SRishi.Srivatsavai@Sun.COM typedef struct { 38*10491SRishi.Srivatsavai@Sun.COM unsigned short prio; 39*10491SRishi.Srivatsavai@Sun.COM unsigned char addr[6]; 40*10491SRishi.Srivatsavai@Sun.COM } UID_BRIDGE_ID_T; 41*10491SRishi.Srivatsavai@Sun.COM 42*10491SRishi.Srivatsavai@Sun.COM typedef struct { 43*10491SRishi.Srivatsavai@Sun.COM char vlan_name[NAME_LEN]; /* name of the VLAN, key of the bridge */ 44*10491SRishi.Srivatsavai@Sun.COM char action; /* 1-create, 0- delete */ 45*10491SRishi.Srivatsavai@Sun.COM } UID_STP_BR_CTRL_T; 46*10491SRishi.Srivatsavai@Sun.COM 47*10491SRishi.Srivatsavai@Sun.COM #define BR_CFG_STATE (1L << 0) 48*10491SRishi.Srivatsavai@Sun.COM #define BR_CFG_PRIO (1L << 1) 49*10491SRishi.Srivatsavai@Sun.COM #define BR_CFG_AGE (1L << 2) 50*10491SRishi.Srivatsavai@Sun.COM #define BR_CFG_HELLO (1L << 3) 51*10491SRishi.Srivatsavai@Sun.COM #define BR_CFG_DELAY (1L << 4) 52*10491SRishi.Srivatsavai@Sun.COM #define BR_CFG_FORCE_VER (1L << 5) 53*10491SRishi.Srivatsavai@Sun.COM #define BR_CFG_AGE_MODE (1L << 6) 54*10491SRishi.Srivatsavai@Sun.COM #define BR_CFG_AGE_TIME (1L << 7) 55*10491SRishi.Srivatsavai@Sun.COM #define BR_CFG_HOLD_TIME (1L << 8) 56*10491SRishi.Srivatsavai@Sun.COM #define BR_CFG_ALL BR_CFG_STATE | \ 57*10491SRishi.Srivatsavai@Sun.COM BR_CFG_PRIO | \ 58*10491SRishi.Srivatsavai@Sun.COM BR_CFG_AGE | \ 59*10491SRishi.Srivatsavai@Sun.COM BR_CFG_HELLO | \ 60*10491SRishi.Srivatsavai@Sun.COM BR_CFG_DELAY | \ 61*10491SRishi.Srivatsavai@Sun.COM BR_CFG_FORCE_VER | \ 62*10491SRishi.Srivatsavai@Sun.COM BR_CFG_AGE_MODE | \ 63*10491SRishi.Srivatsavai@Sun.COM BR_CFG_AGE_TIME | \ 64*10491SRishi.Srivatsavai@Sun.COM BR_CFG_HOLD_TIME 65*10491SRishi.Srivatsavai@Sun.COM 66*10491SRishi.Srivatsavai@Sun.COM typedef struct { 67*10491SRishi.Srivatsavai@Sun.COM /* service data */ 68*10491SRishi.Srivatsavai@Sun.COM unsigned long field_mask; /* which fields to change */ 69*10491SRishi.Srivatsavai@Sun.COM UID_STP_MODE_T stp_enabled; 70*10491SRishi.Srivatsavai@Sun.COM char vlan_name[NAME_LEN]; /* name of the VLAN, key of the bridge */ 71*10491SRishi.Srivatsavai@Sun.COM 72*10491SRishi.Srivatsavai@Sun.COM /* protocol data */ 73*10491SRishi.Srivatsavai@Sun.COM int bridge_priority; 74*10491SRishi.Srivatsavai@Sun.COM int max_age; 75*10491SRishi.Srivatsavai@Sun.COM int hello_time; 76*10491SRishi.Srivatsavai@Sun.COM int forward_delay; 77*10491SRishi.Srivatsavai@Sun.COM int force_version; 78*10491SRishi.Srivatsavai@Sun.COM int hold_time; 79*10491SRishi.Srivatsavai@Sun.COM } UID_STP_CFG_T; 80*10491SRishi.Srivatsavai@Sun.COM 81*10491SRishi.Srivatsavai@Sun.COM typedef struct { 82*10491SRishi.Srivatsavai@Sun.COM /* service data */ 83*10491SRishi.Srivatsavai@Sun.COM char vlan_name[NAME_LEN]; /* name of the VLAN, key of the bridge */ 84*10491SRishi.Srivatsavai@Sun.COM unsigned long vlan_id; 85*10491SRishi.Srivatsavai@Sun.COM UID_STP_MODE_T stp_enabled; 86*10491SRishi.Srivatsavai@Sun.COM 87*10491SRishi.Srivatsavai@Sun.COM /* protocol data */ 88*10491SRishi.Srivatsavai@Sun.COM UID_BRIDGE_ID_T designated_root; 89*10491SRishi.Srivatsavai@Sun.COM unsigned long root_path_cost; 90*10491SRishi.Srivatsavai@Sun.COM 91*10491SRishi.Srivatsavai@Sun.COM unsigned long timeSince_Topo_Change; /* 14.8.1.1.3.b: TBD */ 92*10491SRishi.Srivatsavai@Sun.COM unsigned long Topo_Change_Count; /* 14.8.1.1.3.c: TBD */ 93*10491SRishi.Srivatsavai@Sun.COM unsigned char Topo_Change; /* 14.8.1.1.3.d: TBD */ 94*10491SRishi.Srivatsavai@Sun.COM 95*10491SRishi.Srivatsavai@Sun.COM unsigned short root_port; 96*10491SRishi.Srivatsavai@Sun.COM int max_age; 97*10491SRishi.Srivatsavai@Sun.COM int hello_time; 98*10491SRishi.Srivatsavai@Sun.COM int forward_delay; 99*10491SRishi.Srivatsavai@Sun.COM UID_BRIDGE_ID_T bridge_id; 100*10491SRishi.Srivatsavai@Sun.COM } UID_STP_STATE_T; 101*10491SRishi.Srivatsavai@Sun.COM 102*10491SRishi.Srivatsavai@Sun.COM typedef enum { 103*10491SRishi.Srivatsavai@Sun.COM UID_PORT_DISABLED = 0, 104*10491SRishi.Srivatsavai@Sun.COM UID_PORT_DISCARDING, 105*10491SRishi.Srivatsavai@Sun.COM UID_PORT_LEARNING, 106*10491SRishi.Srivatsavai@Sun.COM UID_PORT_FORWARDING, 107*10491SRishi.Srivatsavai@Sun.COM UID_PORT_NON_STP, 108*10491SRishi.Srivatsavai@Sun.COM UID_PORT_BADSDU 109*10491SRishi.Srivatsavai@Sun.COM } RSTP_PORT_STATE; 110*10491SRishi.Srivatsavai@Sun.COM 111*10491SRishi.Srivatsavai@Sun.COM typedef unsigned short UID_PORT_ID; 112*10491SRishi.Srivatsavai@Sun.COM 113*10491SRishi.Srivatsavai@Sun.COM typedef enum { 114*10491SRishi.Srivatsavai@Sun.COM P2P_FORCE_TRUE, 115*10491SRishi.Srivatsavai@Sun.COM P2P_FORCE_FALSE, 116*10491SRishi.Srivatsavai@Sun.COM P2P_AUTO 117*10491SRishi.Srivatsavai@Sun.COM } ADMIN_P2P_T; 118*10491SRishi.Srivatsavai@Sun.COM 119*10491SRishi.Srivatsavai@Sun.COM #define PT_CFG_STATE (1L << 0) 120*10491SRishi.Srivatsavai@Sun.COM #define PT_CFG_COST (1L << 1) 121*10491SRishi.Srivatsavai@Sun.COM #define PT_CFG_PRIO (1L << 2) 122*10491SRishi.Srivatsavai@Sun.COM #define PT_CFG_P2P (1L << 3) 123*10491SRishi.Srivatsavai@Sun.COM #define PT_CFG_EDGE (1L << 4) 124*10491SRishi.Srivatsavai@Sun.COM #define PT_CFG_MCHECK (1L << 5) 125*10491SRishi.Srivatsavai@Sun.COM #define PT_CFG_NON_STP (1L << 6) 126*10491SRishi.Srivatsavai@Sun.COM #ifdef STP_DBG 127*10491SRishi.Srivatsavai@Sun.COM #define PT_CFG_DBG_SKIP_RX (1L << 16) 128*10491SRishi.Srivatsavai@Sun.COM #define PT_CFG_DBG_SKIP_TX (1L << 17) 129*10491SRishi.Srivatsavai@Sun.COM #endif 130*10491SRishi.Srivatsavai@Sun.COM 131*10491SRishi.Srivatsavai@Sun.COM #define PT_CFG_ALL PT_CFG_STATE | \ 132*10491SRishi.Srivatsavai@Sun.COM PT_CFG_COST | \ 133*10491SRishi.Srivatsavai@Sun.COM PT_CFG_PRIO | \ 134*10491SRishi.Srivatsavai@Sun.COM PT_CFG_P2P | \ 135*10491SRishi.Srivatsavai@Sun.COM PT_CFG_EDGE | \ 136*10491SRishi.Srivatsavai@Sun.COM PT_CFG_MCHECK | \ 137*10491SRishi.Srivatsavai@Sun.COM PT_CFG_NON_STP 138*10491SRishi.Srivatsavai@Sun.COM 139*10491SRishi.Srivatsavai@Sun.COM #define ADMIN_PORT_PATH_COST_AUTO 0 140*10491SRishi.Srivatsavai@Sun.COM 141*10491SRishi.Srivatsavai@Sun.COM typedef struct { 142*10491SRishi.Srivatsavai@Sun.COM /* service data */ 143*10491SRishi.Srivatsavai@Sun.COM unsigned long field_mask; /* which fields to change */ 144*10491SRishi.Srivatsavai@Sun.COM char vlan_name[NAME_LEN]; /* name of the VLAN, key of the bridge */ 145*10491SRishi.Srivatsavai@Sun.COM 146*10491SRishi.Srivatsavai@Sun.COM /* protocol data */ 147*10491SRishi.Srivatsavai@Sun.COM int port_priority; 148*10491SRishi.Srivatsavai@Sun.COM unsigned long admin_port_path_cost; /* ADMIN_PORT_PATH_COST_AUTO - auto sence */ 149*10491SRishi.Srivatsavai@Sun.COM ADMIN_P2P_T admin_point2point; 150*10491SRishi.Srivatsavai@Sun.COM unsigned char admin_edge; 151*10491SRishi.Srivatsavai@Sun.COM unsigned char admin_non_stp; /* 1- doesn't participate in STP, 1 - regular */ 152*10491SRishi.Srivatsavai@Sun.COM #ifdef STP_DBG 153*10491SRishi.Srivatsavai@Sun.COM unsigned int skip_rx; 154*10491SRishi.Srivatsavai@Sun.COM unsigned int skip_tx; 155*10491SRishi.Srivatsavai@Sun.COM #endif 156*10491SRishi.Srivatsavai@Sun.COM 157*10491SRishi.Srivatsavai@Sun.COM } UID_STP_PORT_CFG_T; 158*10491SRishi.Srivatsavai@Sun.COM 159*10491SRishi.Srivatsavai@Sun.COM typedef struct { 160*10491SRishi.Srivatsavai@Sun.COM /* service data */ 161*10491SRishi.Srivatsavai@Sun.COM char vlan_name[NAME_LEN]; /* name of the VLAN, key of the bridge */ 162*10491SRishi.Srivatsavai@Sun.COM unsigned int port_no; /* key of the entry */ 163*10491SRishi.Srivatsavai@Sun.COM 164*10491SRishi.Srivatsavai@Sun.COM /* protocol data */ 165*10491SRishi.Srivatsavai@Sun.COM UID_PORT_ID port_id; 166*10491SRishi.Srivatsavai@Sun.COM RSTP_PORT_STATE state; 167*10491SRishi.Srivatsavai@Sun.COM unsigned long path_cost; 168*10491SRishi.Srivatsavai@Sun.COM 169*10491SRishi.Srivatsavai@Sun.COM UID_BRIDGE_ID_T designated_root; 170*10491SRishi.Srivatsavai@Sun.COM unsigned long designated_cost; 171*10491SRishi.Srivatsavai@Sun.COM UID_BRIDGE_ID_T designated_bridge; 172*10491SRishi.Srivatsavai@Sun.COM UID_PORT_ID designated_port; 173*10491SRishi.Srivatsavai@Sun.COM 174*10491SRishi.Srivatsavai@Sun.COM #if 0 175*10491SRishi.Srivatsavai@Sun.COM int infoIs; 176*10491SRishi.Srivatsavai@Sun.COM unsigned short handshake_flags; 177*10491SRishi.Srivatsavai@Sun.COM #endif 178*10491SRishi.Srivatsavai@Sun.COM 179*10491SRishi.Srivatsavai@Sun.COM unsigned long rx_cfg_bpdu_cnt; 180*10491SRishi.Srivatsavai@Sun.COM unsigned long rx_rstp_bpdu_cnt; 181*10491SRishi.Srivatsavai@Sun.COM unsigned long rx_tcn_bpdu_cnt; 182*10491SRishi.Srivatsavai@Sun.COM int fdWhile; /* 17.15.1 */ 183*10491SRishi.Srivatsavai@Sun.COM int helloWhen; /* 17.15.2 */ 184*10491SRishi.Srivatsavai@Sun.COM int mdelayWhile; /* 17.15.3 */ 185*10491SRishi.Srivatsavai@Sun.COM int rbWhile; /* 17.15.4 */ 186*10491SRishi.Srivatsavai@Sun.COM int rcvdInfoWhile;/* 17.15.5 */ 187*10491SRishi.Srivatsavai@Sun.COM int rrWhile; /* 17.15.6 */ 188*10491SRishi.Srivatsavai@Sun.COM int tcWhile; /* 17.15.7 */ 189*10491SRishi.Srivatsavai@Sun.COM int txCount; /* 17.18.40 */ 190*10491SRishi.Srivatsavai@Sun.COM int lnkWhile; 191*10491SRishi.Srivatsavai@Sun.COM 192*10491SRishi.Srivatsavai@Sun.COM unsigned long uptime; /* 14.8.2.1.3.a */ 193*10491SRishi.Srivatsavai@Sun.COM unsigned long oper_port_path_cost; 194*10491SRishi.Srivatsavai@Sun.COM unsigned char role; 195*10491SRishi.Srivatsavai@Sun.COM unsigned char oper_point2point; 196*10491SRishi.Srivatsavai@Sun.COM unsigned char oper_edge; 197*10491SRishi.Srivatsavai@Sun.COM unsigned char oper_stp_neigb; 198*10491SRishi.Srivatsavai@Sun.COM unsigned char top_change_ack; 199*10491SRishi.Srivatsavai@Sun.COM unsigned char tc; 200*10491SRishi.Srivatsavai@Sun.COM } UID_STP_PORT_STATE_T; 201*10491SRishi.Srivatsavai@Sun.COM 202*10491SRishi.Srivatsavai@Sun.COM #endif 203