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 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 7*10491SRishi.Srivatsavai@Sun.COM * Use is subject to license terms. 8*10491SRishi.Srivatsavai@Sun.COM * 9*10491SRishi.Srivatsavai@Sun.COM * This file is part of RSTP library. 10*10491SRishi.Srivatsavai@Sun.COM * 11*10491SRishi.Srivatsavai@Sun.COM * RSTP library is free software; you can redistribute it and/or modify it 12*10491SRishi.Srivatsavai@Sun.COM * under the terms of the GNU Lesser General Public License as published by the 13*10491SRishi.Srivatsavai@Sun.COM * Free Software Foundation; version 2.1 14*10491SRishi.Srivatsavai@Sun.COM * 15*10491SRishi.Srivatsavai@Sun.COM * RSTP library is distributed in the hope that it will be useful, but 16*10491SRishi.Srivatsavai@Sun.COM * WITHOUT ANY WARRANTY; without even the implied warranty of 17*10491SRishi.Srivatsavai@Sun.COM * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 18*10491SRishi.Srivatsavai@Sun.COM * General Public License for more details. 19*10491SRishi.Srivatsavai@Sun.COM * 20*10491SRishi.Srivatsavai@Sun.COM * You should have received a copy of the GNU Lesser General Public License 21*10491SRishi.Srivatsavai@Sun.COM * along with RSTP library; see the file COPYING. If not, write to the Free 22*10491SRishi.Srivatsavai@Sun.COM * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 23*10491SRishi.Srivatsavai@Sun.COM * 02111-1307, USA. 24*10491SRishi.Srivatsavai@Sun.COM **********************************************************************/ 25*10491SRishi.Srivatsavai@Sun.COM 26*10491SRishi.Srivatsavai@Sun.COM #ifndef __STP_VECTORS_H__ 27*10491SRishi.Srivatsavai@Sun.COM #define __STP_VECTORS_H__ 28*10491SRishi.Srivatsavai@Sun.COM 29*10491SRishi.Srivatsavai@Sun.COM /* This file defines callback vectors to be supplied by library user */ 30*10491SRishi.Srivatsavai@Sun.COM 31*10491SRishi.Srivatsavai@Sun.COM /* In the best case: clean all Learning entries with 32*10491SRishi.Srivatsavai@Sun.COM the vlan_id and the port (if 'exclude'=0) or for all ports, 33*10491SRishi.Srivatsavai@Sun.COM exclude the port (if ''exclude'=1). If 'port'=0, delete all 34*10491SRishi.Srivatsavai@Sun.COM entries with the vlan_id, don't care to 'exclude' */ 35*10491SRishi.Srivatsavai@Sun.COM typedef enum { 36*10491SRishi.Srivatsavai@Sun.COM LT_FLASH_ALL_PORTS_EXCLUDE_THIS, 37*10491SRishi.Srivatsavai@Sun.COM LT_FLASH_ONLY_THE_PORT 38*10491SRishi.Srivatsavai@Sun.COM } LT_FLASH_TYPE_T; 39*10491SRishi.Srivatsavai@Sun.COM 40*10491SRishi.Srivatsavai@Sun.COM struct stp_vectors { 41*10491SRishi.Srivatsavai@Sun.COM int (*flush_lt)(IN int port_index, IN int vlan_id, 42*10491SRishi.Srivatsavai@Sun.COM IN LT_FLASH_TYPE_T type, IN char* reason); 43*10491SRishi.Srivatsavai@Sun.COM 44*10491SRishi.Srivatsavai@Sun.COM /* for bridge id calculation */ 45*10491SRishi.Srivatsavai@Sun.COM void (*get_port_mac) (IN int port_index, OUT unsigned char* mac); 46*10491SRishi.Srivatsavai@Sun.COM 47*10491SRishi.Srivatsavai@Sun.COM unsigned long (*get_port_oper_speed) (IN unsigned int portNo); 48*10491SRishi.Srivatsavai@Sun.COM 49*10491SRishi.Srivatsavai@Sun.COM /* 1- Up, 0- Down */ 50*10491SRishi.Srivatsavai@Sun.COM int (*get_port_link_status) (IN int port_index); 51*10491SRishi.Srivatsavai@Sun.COM 52*10491SRishi.Srivatsavai@Sun.COM /* 1- Full, 0- Half */ 53*10491SRishi.Srivatsavai@Sun.COM int (*get_duplex) (IN int port_index); 54*10491SRishi.Srivatsavai@Sun.COM 55*10491SRishi.Srivatsavai@Sun.COM #ifdef STRONGLY_SPEC_802_1W 56*10491SRishi.Srivatsavai@Sun.COM int (*set_learning) (IN int port_index, IN int vlan_id, IN int enable); 57*10491SRishi.Srivatsavai@Sun.COM int (*set_forwarding) (IN int port_index, IN int vlan_id, 58*10491SRishi.Srivatsavai@Sun.COM IN int enable); 59*10491SRishi.Srivatsavai@Sun.COM #else 60*10491SRishi.Srivatsavai@Sun.COM /* 61*10491SRishi.Srivatsavai@Sun.COM * In many kinds of hardware the state of ports may 62*10491SRishi.Srivatsavai@Sun.COM * be changed with another method 63*10491SRishi.Srivatsavai@Sun.COM */ 64*10491SRishi.Srivatsavai@Sun.COM int (*set_port_state) (IN int port_index, IN int vlan_id, 65*10491SRishi.Srivatsavai@Sun.COM IN RSTP_PORT_STATE state); 66*10491SRishi.Srivatsavai@Sun.COM #endif 67*10491SRishi.Srivatsavai@Sun.COM 68*10491SRishi.Srivatsavai@Sun.COM int (*set_hardware_mode) (int vlan_id, UID_STP_MODE_T mode); 69*10491SRishi.Srivatsavai@Sun.COM int (*tx_bpdu) (IN int port_index, IN int vlan_id, 70*10491SRishi.Srivatsavai@Sun.COM IN unsigned char* bpdu, 71*10491SRishi.Srivatsavai@Sun.COM IN size_t bpdu_len); 72*10491SRishi.Srivatsavai@Sun.COM const char *(*get_port_name) (IN int port_index); 73*10491SRishi.Srivatsavai@Sun.COM int (*get_init_stpm_cfg) (IN int vlan_id, 74*10491SRishi.Srivatsavai@Sun.COM INOUT UID_STP_CFG_T* cfg); 75*10491SRishi.Srivatsavai@Sun.COM int (*get_init_port_cfg) (IN int vlan_id, 76*10491SRishi.Srivatsavai@Sun.COM IN int port_index, 77*10491SRishi.Srivatsavai@Sun.COM INOUT UID_STP_PORT_CFG_T* cfg); 78*10491SRishi.Srivatsavai@Sun.COM void (*trace)(const char *fmt, ...); 79*10491SRishi.Srivatsavai@Sun.COM }; 80*10491SRishi.Srivatsavai@Sun.COM 81*10491SRishi.Srivatsavai@Sun.COM #ifndef __STP_VECTORS_T__ 82*10491SRishi.Srivatsavai@Sun.COM #define __STP_VECTORS_T__ 83*10491SRishi.Srivatsavai@Sun.COM typedef struct stp_vectors STP_VECTORS_T; 84*10491SRishi.Srivatsavai@Sun.COM #endif 85*10491SRishi.Srivatsavai@Sun.COM 86*10491SRishi.Srivatsavai@Sun.COM #ifdef __STP_INTERNAL__ 87*10491SRishi.Srivatsavai@Sun.COM extern STP_VECTORS_T *stp_vectors; 88*10491SRishi.Srivatsavai@Sun.COM #endif 89*10491SRishi.Srivatsavai@Sun.COM 90*10491SRishi.Srivatsavai@Sun.COM #endif /* __STP_VECTORS_H__ */ 91