📄 pgsniff.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: sniffdef.c
*
* Purpose: Sniffer module UI definitions
*
* Author: Jenda Jao
*
* Date: Jan 08, 2002
*
* 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 "ttyio.h"
#include "eng_io.h"
#include "pisniff.h"
// assign fix label
DIRECT_MEMTYPE_CODE SFixLabel aSFixLabelSniff[] = {
{{2,26}, g_strSniffCfg, 0},
{{3,26}, "=", 29},
{{5,13}, "Port Monitoring Mode :", 0},
{{24,2}, g_strHelpMsg, 0},
{{7,13}, "Monitoring Port :", 0},
{{9,13}, "Monitored Port :", 0},
{{10,13}, "-", 56},
};
// assign var label
DIRECT_MEMTYPE_CODE SItem aSVarLabelSniffPort[] = {
{{11,13}, &g_SIListboxLogPortName, "", ITEM_LISTBOX, REPEAT_TYPE_RECT_SINGLE, LINK_TYPE_NONE, ROW_NUM_IN_3_FIELD, 20}
};
// assign item
DIRECT_MEMTYPE_CODE SItemListbox SIListboxSniffMode = {
g_pSSniffPageCfg,
0, 1, 0,
g_aszSniffModeCfg, 4
};
DIRECT_MEMTYPE_CODE SItemVarListbox SIListboxSniffDestPort = {
g_pSSniffPageCfg,
2, 7, 0,
g_aszPortNameTable, &(g_pSSniffPageCfg->SStrTblMap)
};
DIRECT_MEMTYPE_CODE SItemListbox SIListboxSniffSourcePort = {
((PBYTE)g_pSSniffPageCfg)+1,
0, 0, 1,
g_aszMonitorNotCfg, 2
};
// all items
DIRECT_MEMTYPE_CODE SItem aSItemSniff[] = {
{{ 5,36}, &SIListboxSniffMode, g_strChgModeMsg, ITEM_LISTBOX, REPEAT_TYPE_NONE, LINK_TYPE_LISTBOX},
{{ 7,31}, &SIListboxSniffDestPort, g_strSniffCfgMsg, ITEM_VAR_LISTBOX, REPEAT_TYPE_NONE, LINK_TYPE_NONE},
{{11,20}, &SIListboxSniffSourcePort, g_strSniffCfgMsg, ITEM_LISTBOX, REPEAT_TYPE_RECT_SINGLE, LINK_TYPE_NONE, ROW_NUM_IN_3_FIELD, 20}
};
// action
DIRECT_MEMTYPE_CODE SActItem aSActionSniff[] = {
{{22, 12}, g_strActionQuit, PAACT_bQuit},
{{22, 22}, g_strActionEdit, PASNF_bEditSniff},
{{22, 32}, g_strActionSave, PASNF_bSaveSniff},
};
// sniff enable page
DIRECT_MEMTYPE_CODE SPage g_SPageSniffEbl = {
aSFixLabelSniff, 7,
aSVarLabelSniffPort, 1,
aSItemSniff, 3,
aSActionSniff, 3,
PASNF_bLoadSniff
};
// sniff disable page
DIRECT_MEMTYPE_CODE SPage g_SPageSniffDis = {
aSFixLabelSniff, 4,
0, 0,
aSItemSniff, 1,
aSActionSniff, 3,
PASNF_bLoadSniff
};
//////////////////////////////////////////////////////////////////////////
#define g_SniffMode g_pSSniffPageCfg->f2Mode
static BYTE DIRECT_MEMTYPE_CODE s_abySniffPageID[] = {PAGE_SNIFF_DISABLE, PAGE_SNIFF_ENABLE, PAGE_SNIFF_ENABLE, PAGE_SNIFF_ENABLE};
BOOL PASNF_bChangePage(void) DIRECT_FUNTYPE_REENT
{
if (g_byCurPageID != s_abySniffPageID[g_SniffMode])
{
g_byCurPageID = s_abySniffPageID[g_SniffMode];
if (g_byCurPageID != PAGE_SNIFF_DISABLE)
g_byTotalLineNum = g_byLogIdNum;
return RELOAD_PAGE;
}
return DONT_RELOAD_PAGE;
}
BOOL PASNF_bLoadSniff(void) DIRECT_FUNTYPE_REENT
#ifndef __ASIC_VT6524
{
PISNF_vInitPage(g_pSSniffPageCfg);
if (g_pSSniffPageCfg->SStrTblMap.byListNum == 0) // avoid that all port are trunked
{
PIMSG_vPutMsgThenPause(SNIFF_OP_ALL_PORT_TRUNKED);
g_byCurPageID = g_abyPreviousPageID[g_byCurPageID]; // jump to previous page
return RELOAD_PAGE;
}
PASNF_bChangePage();
return DONT_RELOAD_PAGE;
}
#else
{
if (g_bySingleMegaLogIdNum==0) // avoid all port are trunked
{
PIMSG_vPutMsgThenPause(SNIFF_OP_ALL_PORT_TRUNKED);
g_byCurPageID = g_abyPreviousPageID[g_byCurPageID]; // jump to previous page
return RELOAD_PAGE;
}
PISNF_vInitPage(g_pSSniffPageCfg);
PASNF_bChangePage();
// for ui engine
g_pSSniffPageCfg->SStrTblMap.byListNum = g_bySingleMegaLogIdNum;
g_pSSniffPageCfg->SStrTblMap.abyListIndex = g_abyLogIdList;
return DONT_RELOAD_PAGE;
}
#endif
BOOL PASNF_bEditSniff(void) DIRECT_FUNTYPE_REENT
{
if (PAACT_bEdit())
return RELOAD_PAGE;
// deal with dynamic page
if (PASNF_bChangePage())
ENGvPrintPage(); // in this page, changing page may not reload config, just re-print page only
return DONT_RELOAD_PAGE;
}
BOOL PASNF_bSaveSniff(void) DIRECT_FUNTYPE_REENT
{
BYTE byErrCode;
PIMSG_vPutSavingMsg();
byErrCode = PISNF_bySavePage(g_pSSniffPageCfg);
PIMSG_vPutMsgThenPause(byErrCode);
if (byErrCode == OP_OK)
g_bDataDirty = 0;
return DONT_RELOAD_PAGE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -