📄 roletrns.c.bak
字号:
mn_fd_printf(cl_serv_console_fd,"roletrn:DESIGNATED_PORT\r\n");
port->role = DesignatedPort;
#ifdef STP_DBG
if (this->debug)
STP_port_trace_flags ("DESIGNATED_PORT\r\n", port);
#endif
break;
case DESIGNATED_LISTEN:
mn_fd_printf(cl_serv_console_fd,"roletrn:DESIGNATED_LISTEN\r\n");
port->learn = port->forward = False;
port->fdWhile = stpm->rootTimes.ForwardDelay;
#ifdef STP_DBG
if (this->debug)
STP_port_trace_flags ("DESIGNATED_LISTEN\r\n", port);
#endif
break;
case DESIGNATED_LEARN:
mn_fd_printf(cl_serv_console_fd,"roletrn:DESIGN_LEARN\r\n");
port->learn = True;
port->fdWhile = stpm->rootTimes.ForwardDelay;
#ifdef STP_DBG
if (this->debug)
STP_port_trace_flags ("DESIGNATED_LEARN\r\n", port);
#endif
break;
case DESIGNATED_FORWARD:
mn_fd_printf(cl_serv_console_fd,"roletrn:DESIGN_FORWARD\r\n");
port->forward = True;
port->fdWhile = 0;
#ifdef STP_DBG
if (this->debug)
STP_port_trace_flags ("DESIGNATED_FORWARD\r\n", port);
#endif
break;
};
}
/************************************************************************************
函数名称:
输入参数:
输出参数:
功能描述: Port Role Transitions 状态转移函数
返回值 :
备注 :17.23
作者 :
日期 :
************************************************************************************/
Bool STP_roletrns_check_conditions (STATE_MACH_T * this)
{
register struct net_bridge_port *port = this->owner.port;
register struct net_bridge *stpm;
Bool allSynced;
Bool allReRooted;
stpm = port->br;
if (BEGIN == this->State)
{
return STP_hop_2_state (this, INIT_PORT);
}
if (port->role != port->selectedRole && port->selected && !port->updtInfo)
{
/*进入图17-15,17-16,17-17的主要的状态*/
switch (port->selectedRole)
{
case DisabledPort:
case AlternatePort:
case BackupPort:
#if 0 /* def STP_DBG */
if (this->debug)
{
stp_trace ("hop to BLOCK_PORT role=%d selectedRole=%d",
(int) port->role, (int) port->selectedRole);
}
#endif
mn_fd_printf(cl_serv_console_fd,"roletrn: To BLOCK_PORT\r\n");
return STP_hop_2_state (this, BLOCK_PORT);
case RootPort:
mn_fd_printf(cl_serv_console_fd,"roletrn: To ROOT_PORT\r\n");
return STP_hop_2_state (this, ROOT_PORT);
case DesignatedPort:
mn_fd_printf(cl_serv_console_fd,"roletrn: To DESIGNATED_PORT\r\n");
return STP_hop_2_state (this, DESIGNATED_PORT);
default:
return False;
}
}
switch (this->State)
{
/* 17.23.1 */
case INIT_PORT:
mn_fd_printf(cl_serv_console_fd,"roletrn: INIT_PORT To BLOCK_PORT\r\n");
return STP_hop_2_state (this, BLOCK_PORT);
case BLOCK_PORT:
if (!port->selected || port->updtInfo)
break;
if (!port->learning && !port->forwarding)
{
mn_fd_printf(cl_serv_console_fd,"roletrn: BLOCK_PORT TO BLOCKED_PORT\r\n");
return STP_hop_2_state (this, BLOCKED_PORT);
}
break;
case BLOCKED_PORT:
mn_fd_printf(cl_serv_console_fd,"roletrn: BLOCK_PORT TO ");
if (!port->selected || port->updtInfo)
break;
if (port->fdWhile != stpm->rootTimes.ForwardDelay || port->sync ||
port->reRoot || !port->synced)
{
mn_fd_printf(cl_serv_console_fd,"BLOCKED_PORT\r\n ");
return STP_hop_2_state (this, BLOCKED_PORT);
}
if (port->rbWhile != 2 * stpm->rootTimes.HelloTime &&
port->role == BackupPort)
{
mn_fd_printf(cl_serv_console_fd,"BACKUP_PORT\r\n ");
return STP_hop_2_state (this, BACKUP_PORT);
}
break;
case BACKUP_PORT:
mn_fd_printf(cl_serv_console_fd,"roletrn: BACKUP_PORT TO BLOCKED_PORT\r\n");
return STP_hop_2_state (this, BLOCKED_PORT);
/* 17.23.2 */
case ROOT_PROPOSED:
mn_fd_printf(cl_serv_console_fd,"roletrn: ROOT_PROPOSED TO ROOT_PORT\r\n");
return STP_hop_2_state (this, ROOT_PORT);
case ROOT_AGREED:
mn_fd_printf(cl_serv_console_fd,"roletrn: ROOT_AGREED TO ROOT_PORT\r\n");
return STP_hop_2_state (this, ROOT_PORT);
case REROOT:
mn_fd_printf(cl_serv_console_fd,"roletrn: REROOT TO ROOT_PORT\r\n");
return STP_hop_2_state (this, ROOT_PORT);
case ROOT_PORT:
mn_fd_printf(cl_serv_console_fd,"roletrn: ROOT_PORT TO ");
if (!port->selected || port->updtInfo)
break;
if (!port->forward && !port->reRoot)
{
mn_fd_printf(cl_serv_console_fd,"REROOT\r\n");
return STP_hop_2_state (this, REROOT);
}
allSynced = compute_all_synced (port);
if ((port->proposed && allSynced) || (!port->synced && allSynced))
{
mn_fd_printf(cl_serv_console_fd,"ROOT_AGREED\r\n");
return STP_hop_2_state (this, ROOT_AGREED);
}
if (port->proposed && !port->synced)
{
mn_fd_printf(cl_serv_console_fd,"ROOT_PROPOSED\r\n");
return STP_hop_2_state (this, ROOT_PROPOSED);
}
allReRooted = compute_re_rooted (port);
if ((!port->fdWhile || ((allReRooted && !port->rbWhile) &&
stpm->ForceVersion >= 2)) && port->learn &&
!port->forward)
{
mn_fd_printf(cl_serv_console_fd,"ROOT_FORWARD\r\n");
return STP_hop_2_state (this, ROOT_FORWARD);
}
if ((!port->fdWhile || ((allReRooted && !port->rbWhile) &&
stpm->ForceVersion >= 2)) && !port->learn)
{
mn_fd_printf(cl_serv_console_fd,"ROOT_LEARN\r\n");
return STP_hop_2_state (this, ROOT_LEARN);
}
if (port->reRoot && port->forward)
{
mn_fd_printf(cl_serv_console_fd,"REROOTED\r\n");
return STP_hop_2_state (this, REROOTED);
}
if (port->rrWhile != stpm->rootTimes.ForwardDelay)
{
mn_fd_printf(cl_serv_console_fd,"ROOT_PORT\r\n");
return STP_hop_2_state (this, ROOT_PORT);
}
break;
case REROOTED:
mn_fd_printf(cl_serv_console_fd,"roletrn: REROOTED TO ROOT_PORT\r\n");
return STP_hop_2_state (this, ROOT_PORT);
case ROOT_LEARN:
mn_fd_printf(cl_serv_console_fd,"roletrn: ROOT_LEARN TO ROOT_PORT\r\n");
return STP_hop_2_state (this, ROOT_PORT);
case ROOT_FORWARD:
mn_fd_printf(cl_serv_console_fd,"roletrn: ROOT_FORWARD TO ROOT_PORT\r\n");
return STP_hop_2_state (this, ROOT_PORT);
/* 17.23.3 */
case DESIGNATED_PROPOSE:
mn_fd_printf(cl_serv_console_fd,"roletrn: DESI_PROPSE TO DESI_PORT\r\n");
return STP_hop_2_state (this, DESIGNATED_PORT);
case DESIGNATED_SYNCED:
mn_fd_printf(cl_serv_console_fd,"roletrn: DESI_SYNCED TO DESI_PORT\r\n");
return STP_hop_2_state (this, DESIGNATED_PORT);
case DESIGNATED_RETIRED:
mn_fd_printf(cl_serv_console_fd,"roletrn: DESI_RETIED TO DESI_PORT\r\n");
return STP_hop_2_state (this, DESIGNATED_PORT);
case DESIGNATED_PORT:
mn_fd_printf(cl_serv_console_fd,"roletrn: DESI_PORT TO ");
if (!port->selected || port->updtInfo)
break;
if (!port->forward && !port->agreed && !port->proposing &&
!port->operEdge)
{
mn_fd_printf(cl_serv_console_fd,"DESIGNATED_PROPSE");
return STP_hop_2_state (this, DESIGNATED_PROPOSE);
}
if (!port->rrWhile && port->reRoot)
{
mn_fd_printf(cl_serv_console_fd,"DESIGNATED_RETIRED");
return STP_hop_2_state (this, DESIGNATED_RETIRED);
}
if (!port->learning && !port->forwarding && !port->synced)
{
mn_fd_printf(cl_serv_console_fd,"DESIGNATED_SYNCED");
return STP_hop_2_state (this, DESIGNATED_SYNCED);
}
if (port->agreed && !port->synced)
{
mn_fd_printf(cl_serv_console_fd,"DESIGNATED_SYNCED");
return STP_hop_2_state (this, DESIGNATED_SYNCED);
}
if (port->operEdge && !port->synced)
{
mn_fd_printf(cl_serv_console_fd,"DESIGNATED_SYNCED");
return STP_hop_2_state (this, DESIGNATED_SYNCED);
}
if (port->sync && port->synced)
{
mn_fd_printf(cl_serv_console_fd,"DESIGNATED_SYNCED");
return STP_hop_2_state (this, DESIGNATED_SYNCED);
}
if ((!port->fdWhile || port->agreed || port->operEdge) &&
(!port->rrWhile || !port->reRoot) && !port->sync && (port->learn
&& !port->forward))
{
mn_fd_printf(cl_serv_console_fd,"DESIGNATED_FORWARD");
return STP_hop_2_state (this, DESIGNATED_FORWARD);
}
if ((!port->fdWhile || port->agreed || port->operEdge) &&
(!port->rrWhile || !port->reRoot) && !port->sync &&
!port->learn)
{
mn_fd_printf(cl_serv_console_fd,"DESIGNATED_LEARN");
return STP_hop_2_state (this, DESIGNATED_LEARN);
}
if (((port->sync && !port->synced) || (port->reRoot &&
port->rrWhile)) && !port->operEdge && (port->learn ||
port->forward))
{
mn_fd_printf(cl_serv_console_fd,"DESIGNATED_LISTEN");
return STP_hop_2_state (this, DESIGNATED_LISTEN);
}
break;
case DESIGNATED_LISTEN:
mn_fd_printf(cl_serv_console_fd,"roletrn: DESI_LISTEN TO DESI_PORT\r\n");
return STP_hop_2_state (this, DESIGNATED_PORT);
case DESIGNATED_LEARN:
mn_fd_printf(cl_serv_console_fd,"roletrn: DESI_LEARN TO DESI_PORT\r\n");
return STP_hop_2_state (this, DESIGNATED_PORT);
case DESIGNATED_FORWARD:
mn_fd_printf(cl_serv_console_fd,"roletrn: DESI_FORWARD TO DESI_PORT\r\n");
return STP_hop_2_state (this, DESIGNATED_PORT);
};
return False;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -