- #if !defined(AFX_NETPAGE_H__C77F0230_6639_481A_BA99_F5F02A463877__INCLUDED_)
- #define AFX_NETPAGE_H__C77F0230_6639_481A_BA99_F5F02A463877__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- // NetPage.h : header file
- //
- #include "Winsock2.h"
- #pragma comment(lib, "Ws2_32.lib")
- typedef struct _PROTN2T //协议的名称结构
- {
- int proto ;
- char *pprototext ;
- }PROTN2T ;
- #define PROTO_NUM 11 //协议数
- /* The IP header */
- typedef struct _IPHEADER { //ip协议头结构
- unsigned char header_len:4;
- unsigned char version:4;
- unsigned char tos; // type of service
- unsigned short total_len; // length of the packet
- unsigned short ident; // unique identifier
- unsigned short flags;
- unsigned char ttl;
- unsigned char proto; // protocol ( IP , TCP, UDP etc)
- unsigned short checksum;
- unsigned int sourceIP;
- unsigned int destIP;
- }IPHEADER;
- #define IP_VER 4 /* IP version */
- #define IP_HEAD_LEN 5 /* IP head length */
- #define IP_SERV_TYPE 0 /* IP service type */
- #define IP_PROTO_TCP 6 /* TCP protocol */
- #define IP_PROTO_UDP 17 /* UDP protocol */
- #define IP_PROTO_ICMP 1 /* ICMP protocol */
- #define IP_PAD 0 /* IP pseudohead padding */
- #define IP_MF 0x4000 /* IP MF */
- #define IP_DF 0x2000 /* IP DF */
- #define IP_FLAG_MASK 0x1fff /* IP flagoffset mask */
- #define IP_HEAD_BYTE_LEN 20 /* IP head length in byte */
- #define TCP_HEAD_LEN 5 /* TCP head length */
- #define TCP_URG 0x20 /* TCP URG */
- #define TCP_ACK 0x10 /* TCP ACK */
- #define TCP_PSH 0x08 /* TCP PSH */
- #define TCP_RST 0x04 /* TCP RST */
- #define TCP_SYN 0x02 /* TCP SYN */
- #define TCP_FIN 0x01 /* TCP FIN */
- #define TCP_HEAD_BYTE_LEN 20 /* TCP head length in byte */
- #define UDP_HEAD_LEN 8 /* UDP head length */
- #define PSEUDO_HEAD_LEN 12 /* Pseudo head length */
- #define ICMP_HEAD_LEN 4 /* ICMP head length */
- struct TCPPacketHead { //tcp协议头结构
- WORD SourPort;
- WORD DestPort;
- DWORD SeqNo;
- DWORD AckNo;
- BYTE HLen;
- BYTE Flag;
- WORD WndSize;
- WORD ChkSum;
- WORD UrgPtr;
- };
- struct ICMPPacketHead { //icmp协议头结构
- BYTE Type;
- BYTE Code;
- WORD ChkSum;
- };
- struct UDPPacketHead { //udp协议头结构
- WORD SourPort;
- WORD DestPort;
- WORD Len;
- WORD ChkSum;
- };
- /////////////////////////////////////////////////////////////////////////////
- // CNetPage dialog
- class CNetPage : public CPropertyPage
- {
- DECLARE_DYNCREATE(CNetPage)
- // Construction
- public:
- BOOL OnInitDialog();
- void close_thread();
- void AddData(CString s0, CString s1, CString s2, CString s3, CString s4, CString s5 ,CString s6);
- CNetPage();
- ~CNetPage();
- // Dialog Data
- //{{AFX_DATA(CNetPage)
- enum { IDD = IDD_DIALOG_NET };
- CListCtrl m_ctrList;
- CIPAddressCtrl m_ip2;
- CIPAddressCtrl m_ip1;
- CButton m_start;
- BOOL m_check1;
- BOOL m_check2;
- BOOL m_check3;
- //}}AFX_DATA
- // Overrides
- // ClassWizard generate virtual function overrides
- //{{AFX_VIRTUAL(CNetPage)
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- //}}AFX_VIRTUAL
- // Implementation
- protected:
- HICON m_hIcon;
- // AF added members and methods
- DWORD m_ipsource ; // IP in net format
- DWORD m_iphostsource ; // same IP in host format
- DWORD m_iphost;
- DWORD m_ipcheckedhost;
- SOCKET m_s ;
- DWORD m_threadID ;
- BOOL m_Multihomed ;
- BOOL m_Local ;
- CDWordArray m_IPArr ;
- // Generated message map functions
- //{{AFX_MSG(CNetPage)
- afx_msg void OnButton1();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- friend UINT threadFunc ( LPVOID p ) ;
- };
- //{{AFX_INSERT_LOCATION}}
- // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
- #endif // !defined(AFX_NETPAGE_H__C77F0230_6639_481A_BA99_F5F02A463877__INCLUDED_)