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

📄 test2dlg.h

📁 用VC编写的IP冲突防护器,借此可以熟悉网络编程.
💻 H
字号:
// test2Dlg.h : header file
//

#if !defined(AFX_TEST2DLG_H__656E088B_F087_4AB3_97BE_414E3748FDC7__INCLUDED_)
#define AFX_TEST2DLG_H__656E088B_F087_4AB3_97BE_414E3748FDC7__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "pcap.h"
#include "Packet32.h"
#include <string.h>
#include "Ntddndis.h"
#include <windowsx.h>

/////////////////////////////////////////////////////////////////////////////
// CTest2Dlg dialog



class CTest2Dlg : public CDialog
{
// Construction
public:
	VOID SetIPAndMac(int SelectedAdapterNum);
	void convertMac (u_char *str_mac,u_char *network_mac);
	CTest2Dlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CTest2Dlg)
	enum { IDD = IDD_TEST2_DIALOG };
	CListBox	m_AdapterList2;
	CIPAddressCtrl	m_SRCIP;
	CString	m_FakedMac;
	long	m_SendCount;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CTest2Dlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL
	
	pcap_if_t *alldevs;
    pcap_if_t *d,*prev;
	CString	  error;
	char	  errbuf[PCAP_ERRBUF_SIZE];
	CString	  AdapterDes;
	int		  i;
	pcap_t *adhandle;
	
	DWORD			LocalIPtmp,LocalIP;
	sockaddr_in		*sockaddr_in_ptr;
	int				SelectedAdapterIndex;
	LPADAPTER		AdapterObject;
	PPACKET_OID_DATA OidData;
	BOOLEAN			flag;
	u_char			*pmac;
	NetType			LinkInfo;
	
	struct 		ArpPacket 
	{
		/* Ethernet header */
    	u_char 		ether_dstmac[6]; /* Destination host address */
    	u_char 		ether_srcmac[6]; /* Source host address */
    	u_short 	ether_type;                  /* IP? ARP? RARP? etc */
	
		/* ARP Packet Content */
	   	u_short 	hardwaretype;   
    	u_short 	protocoltype;
    	u_char		h_len;	  //length of hardware address(mac)	
    	u_char		p_len;    //length of protocol address(ip)
    	u_short 	op;		  //arp request or reply
    	u_char 		s_ha[6];  //source mac            
    	u_char 		s_pa[4];  //source ip
    	u_char 		t_ha[6];  //target mac           
    	u_char 		t_pa[4];  //target ip
		u_char		padding[18];
	};
	ArpPacket	packet;

// Implementation
protected:
	HICON m_hIcon;
	
	// Generated message map functions
	//{{AFX_MSG(CTest2Dlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnClose();
	afx_msg void OnStart();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnStop();
	afx_msg void OnSelchangeAdapterList();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_TEST2DLG_H__656E088B_F087_4AB3_97BE_414E3748FDC7__INCLUDED_)

⌨️ 快捷键说明

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