NotifyFilter.cpp
资源名称:hp_snmp3.zip [点击查看]
上传用户:czjinwang
上传日期:2007-01-12
资源大小:2484k
文件大小:4k
源码类别:
SNMP编程
开发平台:
Visual C++
- /*============================================================================
- Copyright (c) 1996
- Hewlett-Packard Company
- ATTENTION: USE OF THIS SOFTWARE IS SUBJECT TO THE FOLLOWING TERMS.
- Permission to use, copy, modify, distribute and/or sell this software
- and/or its documentation is hereby granted without fee. User agrees
- to display the above copyright notice and this license notice in all
- copies of the software and any documentation of the software. User
- agrees to assume all liability for the use of the software; Hewlett-Packard
- makes no representations about the suitability of this software for any
- purpose. It is provided "AS-IS without warranty of any kind,either express
- or implied. User hereby grants a royalty-free license to any and all
- derivatives based upon this software code base.
- =============================================================================*/
- #include "stdafx.h"
- #include "browser.h"
- #include "NotifyFilter.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // NotifyFilter dialog
- NotifyFilter::NotifyFilter(CWnd* pParent /*=NULL*/)
- : CDialog(NotifyFilter::IDD, pParent)
- {
- //{{AFX_DATA_INIT(NotifyFilter)
- m_authfail = FALSE;
- m_coldstart = FALSE;
- m_egploss = FALSE;
- m_linkdown = FALSE;
- m_linkup = FALSE;
- m_specific = FALSE;
- m_warmstart = FALSE;
- //}}AFX_DATA_INIT
- }
- void NotifyFilter::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(NotifyFilter)
- DDX_Check(pDX, IDC_AUTHFAIL, m_authfail);
- DDX_Check(pDX, IDC_COLDSTART, m_coldstart);
- DDX_Check(pDX, IDC_EGPLOSS, m_egploss);
- DDX_Check(pDX, IDC_LINKDOWN, m_linkdown);
- DDX_Check(pDX, IDC_LINKUP, m_linkup);
- DDX_Check(pDX, IDC_WARMSTART, m_warmstart);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(NotifyFilter, CDialog)
- //{{AFX_MSG_MAP(NotifyFilter)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // NotifyFilter message handlers
- BOOL NotifyFilter::OnInitDialog()
- {
- Oid coldStart("1.3.6.1.6.3.1.1.5.1");
- Oid warmStart("1.3.6.1.6.3.1.1.5.2");
- Oid linkUp("1.3.6.1.6.3.1.1.5.4");
- Oid linkDown("1.3.6.1.6.3.1.1.5.3");
- Oid authenticationFailure("1.3.6.1.6.3.1.1.5.5");
- Oid egpNeighborLoss("1.3.6.1.6.3.1.1.5.6");
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- // look at the filter param and check the appropriate boxes
- // look for specific ones
- if ( filters.find( coldStart))
- m_coldstart = TRUE;
- else
- m_coldstart = FALSE;
- if ( filters.find( warmStart))
- m_warmstart = TRUE;
- else
- m_warmstart = FALSE;
- if ( filters.find( linkUp))
- m_linkup = TRUE;
- else
- m_linkup = FALSE;
- if ( filters.find( linkDown))
- m_linkdown = TRUE;
- else
- m_linkdown = FALSE;
- if ( filters.find( authenticationFailure))
- m_authfail = TRUE;
- else
- m_authfail = FALSE;
- if ( filters.find( egpNeighborLoss))
- m_egploss = TRUE;
- else
- m_egploss = FALSE;
- UpdateData( FALSE);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void NotifyFilter::OnOK()
- {
- // TODO: Add extra validation here
- OidCollection new_filter;
- Oid coldStart("1.3.6.1.6.3.1.1.5.1");
- Oid warmStart("1.3.6.1.6.3.1.1.5.2");
- Oid linkUp("1.3.6.1.6.3.1.1.5.4");
- Oid linkDown("1.3.6.1.6.3.1.1.5.3");
- Oid authenticationFailure("1.3.6.1.6.3.1.1.5.5");
- Oid egpNeighborLoss("1.3.6.1.6.3.1.1.5.6");
- // assign the new values
- UpdateData( TRUE);
- if ( m_coldstart)
- new_filter += coldStart;
- if ( m_warmstart)
- new_filter += warmStart;
- if ( m_linkup)
- new_filter += linkUp;
- if ( m_linkdown)
- new_filter += linkDown;
- if ( m_authfail)
- new_filter += authenticationFailure;
- if ( m_egploss)
- new_filter += egpNeighborLoss;
- filters = new_filter;
- CDialog::OnOK();
- }