?? listendlg.h
字號:
// listenDlg.h : header file
//
#if !defined(AFX_LISTENDLG_H__02B25220_7DB0_45A8_91FB_650EE99648D1__INCLUDED_)
#define AFX_LISTENDLG_H__02B25220_7DB0_45A8_91FB_650EE99648D1__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CListenDlg dialog
#include "NewList.h"
#include "IpDataShow.h"
#define STATUS_FAILED 0xFFFF //定義異常出錯代碼
#define MAX_PACK_LEN 65535 //接收的最大IP報文
#define MAX_ADDR_LEN 16 //點分十進制地址的最大長度
#define MAX_PROTO_TEXT_LEN 16 //子協議名稱(如"TCP")最大長度
#define MAX_PROTO_NUM 12 //子協議數量
#define MAX_HOSTNAME_LAN 255 //最大主機名長度
#define CMD_PARAM_HELP true
typedef struct _tagPROTOMAP
{
int ProtoNum;
char ProtoText[MAX_PROTO_TEXT_LEN];
}PROTOMAP;
static PROTOMAP ProtoMap[MAX_PROTO_NUM]=
{
{ IPPROTO_IP , "IP " },
{ IPPROTO_ICMP , "ICMP" },
{ IPPROTO_IGMP , "IGMP" },
{ IPPROTO_GGP , "GGP " },
{ IPPROTO_TCP , "TCP " },
{ IPPROTO_PUP , "PUP " },
{ IPPROTO_UDP , "UDP " },
{ IPPROTO_IDP , "IDP " },
{ IPPROTO_ND , "NP " },
{ IPPROTO_RAW , "RAW " },
{ IPPROTO_MAX , "MAX " },
{ NULL , "" }
};
typedef struct _iphdr
{
unsigned char h_lenver; //4位首部長度+4位IP版本號
unsigned char tos; //8位服務類型TOS
unsigned short total_len; //16位總長度(字節)
unsigned short ident; //16位標識
unsigned short frag_and_flags; //3位標志位
unsigned char ttl; //8位生存時間 TTL
unsigned char proto; //8位協議 (TCP, UDP 或其他)
unsigned short checksum; //16位IP首部校驗和
unsigned int sourceIP; //32位源IP地址
unsigned int destIP; //32位目的IP地址
}IP_HEADER;
typedef struct _tcphdr //定義TCP首部
{
USHORT th_sport; //16位源端口
USHORT th_dport; //16位目的端口
unsigned int th_seq; //32位序列號
unsigned int th_ack; //32位確認號
unsigned char th_lenres; //4位首部長度/6位保留字
unsigned char th_flag; //6位標志位
USHORT th_win; //16位窗口大小
USHORT th_sum; //16位校驗和
USHORT th_urp; //16位緊急數據偏移量
}TCP_HEADER;
typedef struct _icmphdr //定義ICMP首部
{
BYTE i_type; //8位類型
BYTE i_code; //8位代碼
USHORT i_cksum; //16位校驗和
USHORT i_id; //識別號(一般用進程號作為識別號)
USHORT i_seq; //報文序列號
ULONG timestamp; //時間戳
}ICMP_HEADER;
typedef struct _udphdr //定義UDP首部
{
unsigned short uh_sport; //16位源端口
unsigned short uh_dport; //16位目的端口
unsigned short uh_len; //16位長度
unsigned short uh_sum; //16位校驗和
} UDP_HEADER;
typedef struct _ipdata
{
int len;
char *buf;
}IPDATA;
class CListenDlg : public CDialog
{
// Construction
public:
void DelListBuf();
BOOL m_IsAllProto; //選中全部協議
BOOL m_IsAllIp; //選中全部IP
BOOL m_IsAllPort; //選中全部端口
char m_szProto[16]; //得到用戶選擇的協議
char* m_HostIp; //本機IP
void ShowIpInfo(char *pData,int len); //將IP包拆分后進行顯示
int m_ihLen; //IP包頭長度
CRITICAL_SECTION m_ls; //臨界區結構
char m_szDestPort[16]; //得到IP包中目標協議
char m_szSourcePort[16]; //得到IP包中源協議
char m_szTTL[16]; //得到IP包中TTL
char m_szDestIP[16]; //得到IP包中目標IP
char m_szSourceIP[16]; //得到IP包中源IP
char m_szProtocol[16]; //得到IP包中協議
char * CheckProtocol(int iProtocol); //得到協議名
void SplitIpPack(char* pData,int len); //拆分IP包
SOCKET m_RawSock; //SOCK
int CreateSock(); //設置SOCK
BOOL InitSock(); //加載SOCK.DLL
BOOL SetClipboard(char* pData); //寫入剪貼板
CListenDlg(CWnd* pParent = NULL); // standard constructor
CIpDataShow m_IpShowDlg;
// Dialog Data
//{{AFX_DATA(CListenDlg)
enum { IDD = IDD_LISTEN_DIALOG };
CNewList m_NewList;
int m_iWprot;
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CListenDlg)
public:
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CListenDlg)
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnButton1();
afx_msg void OnButton3();
afx_msg void OnRadio2();
afx_msg void OnRadio3();
afx_msg void OnRadio1();
afx_msg void OnRadio4();
afx_msg void OnRadio5();
afx_msg void OnRadio6();
afx_msg void OnRadio7();
afx_msg void OnRadio8();
afx_msg void OnCopySip();
afx_msg void OnCopyDip();
afx_msg void OnSysCommand( UINT nID, LPARAM lParam );
afx_msg void OnSelchangeList1();
afx_msg void OnDestroy();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_LISTENDLG_H__02B25220_7DB0_45A8_91FB_650EE99648D1__INCLUDED_)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -