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

📄 stp-8021d-d17.c

📁 基于vxworks操作系统,Tornado2.0平台,生成树STP源码.直接在其对应的设备中添加即可.
💻 C
📖 第 1 页 / 共 4 页
字号:
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void start_hello_timer
    (
    void
    )
{
    hello_timer.value = (Time_t) Zero;
    hello_timer.active = True;
}

/*******************************************************************************
* stop_hello_timer  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void stop_hello_timer
    (
    void
    )
{
    hello_timer.active = False;
}

/*******************************************************************************
* hello_timer_expired  -
*
* INPUTS:
* <parameters and functions>
*
* RETURNS:
* <values modified>
*
* ERRORS:
* <values returned and why (do not include VxWorks ERRNO types here)>
*
* ERRNO:
* <comma separated list of errno values, no comments needed>
*
* SEE_ALSO:
* <optional, cross reference to other modules, subroutines or documentation>
*
* NOMANUAL <this will be removed later>
*/
Boolean hello_timer_expired
    (
    void
    )
{    
    if (hello_timer.active && (++hello_timer.value >= bridge_info.hello_time))
    {
        hello_timer.active = False;
        return (True);
    }
    return (False);
}

/*******************************************************************************
* start_tcn_timer  -
*
* INPUTS:
* <parameters and functions>
*
* RETURNS:
* <values modified>
*
* ERRORS:
* <values returned and why (do not include VxWorks ERRNO types here)>
*
* ERRNO:
* <comma separated list of errno values, no comments needed>
*
* SEE_ALSO:
* <optional, cross reference to other modules, subroutines or documentation>
*
* NOMANUAL <this will be removed later>
*/
void start_tcn_timer
    (
    void
    )
{
    tcn_timer.value = (Time_t) Zero;
    tcn_timer.active = True;
}

/*******************************************************************************
* stop_tcn_timer  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void stop_tcn_timer
    (
    void
    )
{
    tcn_timer.active = False;
}

/*******************************************************************************
* tcn_timer_expired  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
Boolean tcn_timer_expired
    (
    void
    )
{
    if (tcn_timer.active && (++tcn_timer.value >= bridge_info.bridge_hello_time))
    {
        tcn_timer.active = False;
        return (True);
    }
    return (False);
}

/*******************************************************************************
* start_topology_change_timer  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void start_topology_change_timer
    (
    void
    )
{
    since_topology_change.value = (Time_t) Zero;
    since_topology_change.active = True;

    topology_change_timer.value = (Time_t) Zero;
    topology_change_timer.active = True;
}

/*******************************************************************************
* stop_topology_change_timer  -
*
* INPUTS:
* <parameters and functions>
*
* RETURNS:
* <values modified>
*
* ERRORS:
* <values returned and why (do not include VxWorks ERRNO types here)>
*
* ERRNO:
* <comma separated list of errno values, no comments needed>
*
* SEE_ALSO:
* <optional, cross reference to other modules, subroutines or documentation>
*
* NOMANUAL <this will be removed later>
*/
void stop_topology_change_timer
    (
    void
    )
{
    topology_change_timer.active = False;
}

/*******************************************************************************
* topology_change_timer_expired  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
Boolean topology_change_timer_expired
    (
    void
    )
{
    if (topology_change_timer.active
        && (++topology_change_timer.value
            >= bridge_info.topology_change_time
        )
        )
    {
        topology_change_timer.active = False;
        /* aaaa sysAgentSend1493Trap(SNMP_TRAP_1493_NEWROOT);*/
        return (True);
    }
    return (False);
}

/*******************************************************************************
* start_message_age_timer  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void start_message_age_timer
    (
    Int port_no,
    Time_t message_age
    )
{
    message_age_timer[port_no].value = message_age;
    message_age_timer[port_no].active = True;
}

/*******************************************************************************
* stop_message_age_timer  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void stop_message_age_timer
    (
    Int port_no
    )
{
    message_age_timer[port_no].active = False;
}

/*******************************************************************************
* message_age_timer_expired  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
Boolean message_age_timer_expired
    (
    Int port_no
    )
{
    if (message_age_timer[port_no].active &&
        (++message_age_timer[port_no].value >= bridge_info.max_age))
    {
        message_age_timer[port_no].active = False;
        return (True);
    }
    return (False);
}

/*******************************************************************************
* start_forward_delay_timer  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void start_forward_delay_timer
    (
    Int port_no
    )
{
    forward_delay_timer[port_no].value = Zero;
    forward_delay_timer[port_no].active = True;
}

/*******************************************************************************
* stop_forward_delay_timer  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void stop_forward_delay_timer
    (
    Int port_no
    )
{
    forward_delay_timer[port_no].active = False;
}

/*******************************************************************************
* forward_delay_timer_expired  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
Boolean forward_delay_timer_expired
    (
    Int port_no
    )
{
    if (forward_delay_timer[port_no].active &&
        (++forward_delay_timer[port_no].value >= bridge_info.forward_delay))
    {
        forward_delay_timer[port_no].active = False;
        return (True);
    }
    return (False);
}

/*******************************************************************************
* start_hold_timer  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void start_hold_timer
    (
    Int port_no
    )
{
    hold_timer[port_no].value = Zero;
    hold_timer[port_no].active = True;
}

/*******************************************************************************
* stop_hold_timer  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void stop_hold_timer
    (
    Int port_no
    )
{
    hold_timer[port_no].active = False;
}

/*******************************************************************************
* hold_timer_expired  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
Boolean hold_timer_expired
    (
    Int port_no
    )
{
    if (hold_timer[port_no].active &&
        (++hold_timer[port_no].value >= bridge_info.hold_time))
    {
        hold_timer[port_no].active = False;
        return (True);
    }
    return (False);
}



/* added XACT, if any bridge parms are updated then this may 
 * ** cause spanning tree to reset */

/*******************************************************************************
* bridgeParmsUpdated  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void bridgeParmsUpdated
    (
    void
    )       /* (8.8.4)        */
                                                           /* (8.8.4.1)      */
{
    Int changed = 0;

    configuration_update();     /* (8.8.4.4)      */

    port_state_selection();     /* (8.8.4.5)      */

    if ((root_bridge()))        /* (8.8.4.6)      */
    {
        if (bridge_info.max_age != bridge_info.bridge_max_age)
        {
            bridge_info.max_age = bridge_info.bridge_max_age;   /* (8.8.4.6.1)    */
            changed++;
        }


        if (bridge_info.hello_time != bridge_info.bridge_hello_time)
        {
            bridge_info.hello_time = bridge_info.bridge_hello_time;
            changed++;
        }


        if (bridge_info.forward_delay != bridge_info.bridge_forward_delay)
        {
            bridge_info.forward_delay = bridge_info.bridge_forward_delay;
            changed++;
        }

        if (!changed)           /* nothing changed */
            return;

        topology_change_detection();    /* (8.8.4.6.2)    */

        stop_tcn_timer();       /* (8.8.4.6.3)    */

        config_bpdu_generation();   /* (8.8.4.6.4)    */

        start_hello_timer();
    }
}

/*******************************************************************************
* linkDown_port  -
*
* INPUTS:
*
* RETURNS:
*
* ERRORS:
*
* ERRNO:
*
* NOMANUAL <this will be removed later>
*/
void linkDown_port
    (
    Int port_no
    )       /* (8.8.3)       */
{
    Boolean root;

    port_info[port_no].portLinkBlockSet = TRUE;

    root = root_bridge();

    become_designated_port(port_no);    /* (8.8.3.1)      */

    set_port_state(port_no, Blocking);  /* (8.8.3.2)      */

    port_info[port_no].topology_change_acknowledge = False;     /* (8.8.3.3)      */

    port_info[port_no].config_pending = False;  /* (8.8.3.4)      */

    stop_message_age_timer(port_no);    /* (8.8.3.5)      */

    stop_forward_delay_timer(port_no);  /* (8.8.3.6)      */

    configuration_update();     /* (8.8.3.7)      */

    port_state_selection();     /* (8.8.3.8)      */

    if ((root_bridge()) && (!root))     /* (8.8.3.9)      */
    {
        bridge_info.max_age = bridge_info.bridge_max_age;   /* (8.8.3.9.1)    */
        bridge_info.hello_time = bridge_info.bridge_hello_time;
        bridge_info.forward_delay = bridge_info.bridge_forward_delay;

        topology_change_detection();    /* (8.8.3.9.2)    */

        stop_tcn_timer();       /* (8.8.3.9.3)    */

        config_bpdu_generation();   /* (8.8.3.9.4)    */

        start_hello_timer();
    }
}

/*lint -e(750) -e(766) */

⌨️ 快捷键说明

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