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

📄 pgstp.c

📁 vt6528芯片交换机API函数和文档运行程序
💻 C
字号:
/*
 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
 * All rights reserved.
 *
 * This software is copyrighted by and is the sole property of
 * VIA Networking Technologies, Inc. This software may only be used
 * in accordance with the corresponding license agreement. Any unauthorized
 * use, duplication, transmission, distribution, or disclosure of this
 * software is expressly forbidden.
 *
 * This software is provided by VIA Networking Technologies, Inc. "as is"
 * and any express or implied warranties, including, but not limited to, the
 * implied warranties of merchantability and fitness for a particular purpose
 * are disclaimed. In no event shall VIA Networking Technologies, Inc.
 * be liable for any direct, indirect, incidental, special, exemplary, or
 * consequential damages.
 *
 *
 * File:    pgstp.c
 *
 * Purpose: Spanning Tree module UI definitions
 *
 * Author:  Freeya Lin
 *
 * Date:    Dec 11, 2003
 *
 * Functions:
 *
 * Revision History:
 *
 */


#include "engine.h"
#include "eng_act.h"
#include "allpages.h"
#include "piportmp.h"
#include "pigencfg.h"
#include "str.h"
#include "cfgstr.h"
#include "pgsniff.h"
#include "gen_act.h"
#include "pimsg.h"

#include "eng_io.h"
#include "pgstp.h"
#include "cfgstr.h"
#include "pistp.h"


char strSTPTitle1[] = "Port       State";

// assign fix label
SFixLabel aSFixLabelSTP[] = {
    {{ 2,26}, g_strProvSTP, 0},
    {{ 3,26}, "=", 29},
    {{ 5,3}, "Spanning Tree protocol  :", 0},
    {{24, 2}, g_strHelpMsg, 0},
    {{6,3}, strSTPTitle1, 0},        
    {{6,43}, strSTPTitle1, 0},        
    {{7, 3}, "-", 21},
    {{7,43}, "-", 21},
};

// assign var label
SItem aSVarLabelSTPPortNum[] = {
    {{8,3}, &g_SIListboxLogPortName, "", ITEM_LISTBOX, REPEAT_TYPE_RECT_SINGLE, LINK_TYPE_NONE, ROW_NUM_IN_2_FIELD, 40}
};

// assign item
SItemListbox aSIListboxSTP[] = {
    {(PUINT8)g_pSSTPPageCfg, 0, 7, 0, g_aszStpMstpSel, 2},
    {(PUINT8)g_pSSTPPageCfg->abySTPPortState, 0, 2, 3, g_aszSTPPortStateSel, 5}
};

SItem aSItemSTPPortState[] = {
    {{ 5,30}, aSIListboxSTP,    "", ITEM_LISTBOX,  REPEAT_TYPE_NONE, LINK_TYPE_LISTBOX},
    {{ 8,14}, aSIListboxSTP+1,  "", ITEM_LISTBOX,  REPEAT_TYPE_RECT_SINGLE, LINK_TYPE_NONE, ROW_NUM_IN_2_FIELD, 40}
};

// action
SActItem aSActionProvSTPMenu[] = {
    {{22, 12}, g_strActionQuit, PAACT_bQuit},
    {{22, 22}, g_strActionEdit, PASTP_bEditSTP},
    {{22, 32}, g_strActionSave, PASTP_bSaveSTP},
};


// sniff enable page
SPage g_SPageSTPEn = {
    aSFixLabelSTP, 8,
    aSVarLabelSTPPortNum, 1,
    aSItemSTPPortState, 2,
    aSActionProvSTPMenu, 3,
    PASTP_bLoadSTP
};

// sniff disable page
SPage g_SPageSTPDis = {
    aSFixLabelSTP, 4,
    0, 0,
    aSItemSTPPortState, 1,
    aSActionProvSTPMenu, 3,
    PASTP_bLoadSTP
};

//////////////////////////////////////////////////////////////////////////

#define g_STPMode         g_pSSTPPageCfg->byMode   

static UINT8 sg_abySTPPageID[] = {PAGE_PROV_STP_DISABLE, PAGE_PROV_STP_ENABLE};

BOOL PASTP_bChangePage(void)
{
    if (g_byCurPageID != sg_abySTPPageID[g_STPMode])
    {
        g_byCurPageID = sg_abySTPPageID[g_STPMode];

        if (g_byCurPageID != PAGE_PROV_STP_DISABLE)
            g_wTotalLineNum = g_byLogIdNum;

        return RELOAD_PAGE;
    }

    return DONT_RELOAD_PAGE;
}

BOOL PASTP_bLoadSTP(void)
{   
    PISTP_vInitPage(g_pSSTPPageCfg);

    PASTP_bChangePage();

    return DONT_RELOAD_PAGE;
}

BOOL PASTP_bEditSTP(void)
{
    if (PAACT_bEdit())
        return RELOAD_PAGE;

    // deal with dynamic page
    if (PASTP_bChangePage())
        ENGvPrintPage();        // in this page, changing page may not reload config, just re-print page only

    return DONT_RELOAD_PAGE;
}

BOOL PASTP_bSaveSTP(void)
{
    UINT8 byErrCode;
    PIMSG_vPutSavingMsg();
    byErrCode = PISTP_bySavePage(g_pSSTPPageCfg);
    PIMSG_vPutMsgThenPause(byErrCode);

    if (byErrCode == OP_OK)
        g_bDataDirty = 0;


    return DONT_RELOAD_PAGE;
}



⌨️ 快捷键说明

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