⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p2p.c~

📁 rstp for switch in vxworks
💻 C~
字号:

/************************************************************************ 
 * RSTP library - Rapid Spanning Tree (802.1t, 802.1w) 
 * Copyright (C) 2001-2003 Optical Access 
 * Author: Alex Rozin 
 * 
 * This file is part of RSTP library. 
 * 
 * RSTP library is free software; you can redistribute it and/or modify it 
 * under the terms of the GNU Lesser General Public License as published by the 
 * Free Software Foundation; version 2.1 
 * 
 * RSTP library 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 Lesser 
 * General Public License for more details. 
 * 
 * You should have received a copy of the GNU Lesser General Public License 
 * along with RSTP library; see the file COPYING.  If not, write to the Free 
 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
 * 02111-1307, USA. 
 **********************************************************************/

/* Point To Point MAC mode selection machine : 6.4.3, 6.5.1 */

#include "base.h"
#include "stpm.h"
#include "stp_to.h"				/* for STP_OUT_get_duplex */

#define STATES { \
  CHOOSE(INIT),     \
  CHOOSE(RECOMPUTE),    \
  CHOOSE(STABLE),    \
}

#define INIT        2
#define RECOMPUTE   3
#define STABLE      4

#define GET_STATE_NAME STP_p2p_get_state_name
#include "choose.h"

/**************************************************************************
**
**
**
**************************************************************************/
static Bool computeP2P (struct net_bridge_port *port)
{

	/*adminPointToPointMac的值决定了operPointToPointMac的值,当
	 * adminPointToPointMac为auto时,则根据6.5.1来决秓perPointToPointMac  
	 */
	Bool bFlag;

	switch (port->adminPointToPointMac)
	{
		case P2P_FORCE_TRUE:
			bFlag = True;
			break;
		case P2P_FORCE_FALSE:
			bFlag = False;
			break;
		case P2P_AUTO:
/*bFlag = STP_OUT_get_duplex (port->port_no); *//*added by wl for debug 2003-03-04 */
			bFlag = True;
			break;
		default:
			break;
	}

	return bFlag;
}

/**************************************************************************
**
**
**
**************************************************************************/
void STP_p2p_enter_state (STATE_MACH_T * s)
{
	register struct net_bridge_port *port = s->owner.port;

	switch (s->State)
	{
		case BEGIN:
		case INIT:
			port->p2p_recompute = True;
			break;
		case RECOMPUTE:
			port->operPointToPointMac = computeP2P (port);
			port->p2p_recompute = False;
			break;
		case STABLE:
			break;
		default:
			break;
	}
}

/**************************************************************************
**
**
**
**************************************************************************/
Bool STP_p2p_check_conditions (STATE_MACH_T * s)
{
	register struct net_bridge_port *port = s->owner.port;
	Bool bFlag = False;

	/*P2P: Begin/INIT->STABLE->RECOMPUTE->STABLE */

	switch (s->State)
	{
		case BEGIN:
		case INIT:
			/*return STP_hop_2_state (s, STABLE); */
			bFlag = STP_hop_2_state (s, STABLE);
			break;
		case RECOMPUTE:
			/*return STP_hop_2_state (s, STABLE); */
			bFlag = STP_hop_2_state (s, STABLE);
			break;
		case STABLE:
			if (port->p2p_recompute)
			{
				bFlag = STP_hop_2_state (s, RECOMPUTE);
			}
			break;
		default:
			break;
	}
	return bFlag;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -