www.pudn.com > zhuabao.rar > Set.cpp
// Set.cpp : implementation file
//
#include "stdafx.h"
#include "packetreplay.h"
#include "Set.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSet dialog
extern int mAllProto;
extern int mAllDestIP;
extern int mAllSourIP;
extern int mAllSourPort;
extern int mAllDestPort;
extern int mDestPort;
extern int mSourPort;
extern CString m_strDIP;
extern CString m_strSIP;
CSet::CSet(CWnd* pParent /*=NULL*/)
: CDialog(CSet::IDD, pParent)
{
//{{AFX_DATA_INIT(CSet)
m_AllProto = mAllProto;
m_AllDestIP = mAllDestIP;
m_AllSourIP = mAllSourIP;
m_AllSourPort = mAllSourPort;
m_AllDestPort = mAllDestPort;
m_DestPort = mDestPort;
m_SourPort = mSourPort;
//}}AFX_DATA_INIT
}
void CSet::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CSet)
DDX_Control(pDX, IDC_SIPADD, m_SourIP);
DDX_Control(pDX, IDC_DIPADD, m_DestIP);
DDX_Radio(pDX, IDC_ALLPROTO, m_AllProto);
DDX_Radio(pDX, IDC_ALLDIP, m_AllDestIP);
DDX_Radio(pDX, IDC_ALLSIP, m_AllSourIP);
DDX_Radio(pDX, IDC_ALLSPORT, m_AllSourPort);
DDX_Radio(pDX, IDC_ALLDPORT, m_AllDestPort);
DDX_Text(pDX, IDC_EDITDPORT, m_DestPort);
DDV_MinMaxInt(pDX, m_DestPort, 0, 65535);
DDX_Text(pDX, IDC_EDITSPORT, m_SourPort);
DDV_MinMaxInt(pDX, m_SourPort, 0, 65535);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CSet, CDialog)
//{{AFX_MSG_MAP(CSet)
ON_BN_CLICKED(IDC_ALLPROTO, OnAllproto)
ON_BN_CLICKED(IDC_TCP, OnTcp)
ON_BN_CLICKED(IDC_UDP, OnUdp)
ON_BN_CLICKED(IDC_ICMP, OnIcmp)
ON_BN_CLICKED(IDC_OTHER, OnOther)
ON_BN_CLICKED(IDC_ALLSIP, OnAllsip)
ON_BN_CLICKED(IDC_SIP, OnSip)
ON_BN_CLICKED(IDC_ALLDIP, OnAlldip)
ON_BN_CLICKED(IDC_DIP, OnDip)
ON_BN_CLICKED(IDC_ALLSPORT, OnAllsport)
ON_BN_CLICKED(IDC_SPORT, OnSport)
ON_BN_CLICKED(IDC_ALLDPORT, OnAlldport)
ON_BN_CLICKED(IDC_DPORT, OnDport)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSet message handlers
BOOL CSet::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if(m_AllSourIP==0)GetDlgItem(IDC_SIPADD)->EnableWindow(FALSE);
if(m_AllDestIP==0)GetDlgItem(IDC_DIPADD)->EnableWindow(FALSE);
if(m_AllSourPort==0)GetDlgItem(IDC_EDITSPORT)->EnableWindow(FALSE);
if(m_AllDestPort==0)GetDlgItem(IDC_EDITDPORT)->EnableWindow(FALSE);
m_SourIP.SetWindowText(m_strSIP);
m_DestIP.SetWindowText(m_strDIP);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CSet::OnAllproto()
{
// TODO: Add your control notification handler code here
m_AllProto = 0;
}
void CSet::OnTcp()
{
// TODO: Add your control notification handler code here
m_AllProto = 1;
}
void CSet::OnUdp()
{
// TODO: Add your control notification handler code here
m_AllProto = 2;
}
void CSet::OnIcmp()
{
// TODO: Add your control notification handler code here
m_AllProto = 3;
}
void CSet::OnOther()
{
// TODO: Add your control notification handler code here
m_AllProto = 4;
}
void CSet::OnAllsip()
{
// TODO: Add your control notification handler code here
m_AllSourIP = 0;
GetDlgItem(IDC_SIPADD)->EnableWindow(FALSE);
}
void CSet::OnSip()
{
// TODO: Add your control notification handler code here
m_AllSourIP = 1;
GetDlgItem(IDC_SIPADD)->EnableWindow(TRUE);
}
void CSet::OnAlldip()
{
// TODO: Add your control notification handler code here
m_AllDestIP = 0;
GetDlgItem(IDC_DIPADD)->EnableWindow(FALSE);
}
void CSet::OnDip()
{
// TODO: Add your control notification handler code here
m_AllDestIP = 1;
GetDlgItem(IDC_DIPADD)->EnableWindow(TRUE);
}
void CSet::OnAllsport()
{
// TODO: Add your control notification handler code here
m_AllSourPort = 0;
GetDlgItem(IDC_EDITSPORT)->EnableWindow(FALSE);
}
void CSet::OnSport()
{
// TODO: Add your control notification handler code here
m_AllSourPort = 1;
GetDlgItem(IDC_EDITSPORT)->EnableWindow(TRUE);
}
void CSet::OnAlldport()
{
// TODO: Add your control notification handler code here
m_AllDestPort = 0;
GetDlgItem(IDC_EDITDPORT)->EnableWindow(FALSE);
}
void CSet::OnDport()
{
// TODO: Add your control notification handler code here
m_AllDestPort = 1;
GetDlgItem(IDC_EDITDPORT)->EnableWindow(TRUE);
}
void CSet::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
m_SourIP.GetWindowText(m_strSIP);
m_DestIP.GetWindowText(m_strDIP);
mAllProto = m_AllProto;
mAllDestIP = m_AllDestIP;
mAllSourIP = m_AllSourIP;
mAllSourPort = m_AllSourPort;
mAllDestPort = m_AllDestPort;
mDestPort = m_DestPort;
mSourPort = m_SourPort;
CDialog::OnOK();
}