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

📄 define.h

📁 实现网络原始数据包的捕获和分析
💻 H
字号:
#ifndef _NET_MONITOR_KERNEL_DEFINE_H_
#define _NET_MONITOR_KERNEL_DEFINE_H_
#include "nb30.h"

typedef unsigned char byte;

typedef struct _ASTAT_
{
	
	ADAPTER_STATUS adapt;
	NAME_BUFFER    NameBuff [30];
	
}ASTAT, * PASTAT;


//定义ip报头
typedef struct _iphdr
{
	byte ver_len;		//版本4位,头长度4位,报头长度以32位为一个单位
	byte type;			//类型8位
	byte length[2];		//总长度,16位,指出报文的以字节为单位的总长度
						//报文长度不能超过65536个字接,否则认为报文遭到破坏
	byte id[2];			//报文标示,用于多于一个报文16位
	byte flag_offset[2];//标志,3位	数据块偏移13位
	byte time;			//生存时间,8位
	byte protocol;		//协议,8位
	byte crc_val[2];	//头校验和,16位
	byte src_addr[4];	//源地址,32位
	byte tar_addr[4];	//目标地址,32位
	byte options[4];	//选项和填充,32位
}IP_HEADER;

typedef struct _tcphdr
{
	byte source_port[2];	//发送端端口号,16位
	byte dest_port[2];		//接收端端口号,16位
	byte sequence_no[4];	//32位,标示消息端的数据位于全体数据块的某一字节的数字
	byte ack_no[4];			//32位,确认号,标示接收端对于发送端接收到数据块数值
	byte offset_reser_con[2];//数据偏移4位,预留6位,控制位6为
	byte window[2];			//窗口16位
	byte checksum[2];		//校验码,16位
	byte urgen_pointer[2];	//16位,紧急数据指针
	byte options[3];		//选祥和填充,32位
}TCP_HEADER;

#define SIO_RCVALL _WSAIOW(IOC_VENDOR,1)
#define IP_HDRINCL      2 /* header is included with data */


//参考资料 RFC 1700

#define PROTOCOL_ICMP			1	//ICMP
#define PROTOCOL_IGMP			2	//Internet Group Management
#define PROTOCOL_GGP			3	//Gateway-to-Gateway           
#define PROTOCOL_IP				4	//IP in IP (encasulation)
#define PROTOCOL_ST				5	//Stream
#define PROTOCOL_TCP			6	//Transmission Control          
#define PROTOCOL_UCL			7	//UCL
#define PROTOCOL_EGP			8	//Exterior Gateway Protocol
#define PROTOCOL_IGP			9	//any private interior gateway 
#define PROTOCOL_BBN_RCC_MON	10	//BBN RCC Monitoring
#define PROTOCOL_NVP_II			11	//Network Voice Protocol
#define PROTOCOL_PUP			12	//PUP
#define PROTOCOL_ARGUS			13  //ARGUS       
#define PROTOCOL_EMCON			14	//EMCON         
#define PROTOCOL_XNET			15	//Cross Net Debugger
#define PROTOCOL_CHAOS			16	//Chaos
#define PROTOCOL_UDP			17	//User Datagram
#define PROTOCOL_MUX			18	//Multiplexing          
#define PROTOCOL_DCN_MEAS		19	//DCN Measurement Subsystems          
#define PROTOCOL_HMP			20	//Host Monitoring
#define PROTOCOL_PRM			21  //Packet Radio Measurement
#define PROTOCOL_XNS_IDP		22  //XEROX NS IDP
#define PROTOCOL_TRUNK_1		23  //Trunk-1    
#define PROTOCOL_TRUNK_2		24  //Trunk-2    
#define PROTOCOL_LEAF_1			25  //Leaf-1
#define PROTOCOL_LEAF_2			26  //Leaf-2
#define PROTOCOL_RDP			27  //Reliable Data Protocol
#define PROTOCOL_IRTP			28  //Internet Reliable Transaction
#define PROTOCOL_ISO_TP4		29  //ISO Transport Protocol Class
#define PROTOCOL_NETBLT			30  //Bulk Data Transfer Protocol
#define PROTOCOL_MFE_NSP		31  //MFE Network Services Protocol
#define PROTOCOL_MERIT_INP		32  //MERIT Internodal Protocol    
#define PROTOCOL_SEP			33  //Sequential Exchange Protocol    
#define PROTOCOL_3PC			34  //Third Party Connect Protocol      
#define PROTOCOL_IDPR			35  //Inter-Domain Policy Routing Protocol          
#define PROTOCOL_XTP			36  //XTP              
#define PROTOCOL_DDP			37  //Datagram Delivery Protocol
#define PROTOCOL_IDPR_CMTP		38  //IDPR Control Message Transport Proto
#define PROTOCOL_TPTP			39  //TP++ Transport Protocol    
#define PROTOCOL_IL				40  //IL Transport Protocol       
#define PROTOCOL_SIP			41  //Simple Internet Protocol          
#define PROTOCOL_SDRP			42  //Source Demand Routing Protocol
#define PROTOCOL_SIP_SR			43  //SIP Source Route
#define PROTOCOL_SIP_FRAG		44  //SIP Fragment    
#define PROTOCOL_IDRP			45  //Inter-Domain Routing Protocol
#define PROTOCOL_RSVP			46  //IReservation Protocol
#define PROTOCOL_GRE			47  //General Routing Encapsulation
#define PROTOCOL_MHRP			48  //Mobile Host Routing Protocol
#define PROTOCOL_BNA			49  //BNA
#define PROTOCOL_SIPP_ESP		50  //SIPP Encap Security Payload
#define PROTOCOL_SIPP_AH		51  //SIPP Authentication Header
#define PROTOCOL_I_NLSP			52  //Integrated Net Layer Security
#define PROTOCOL_SWIPE			53  //IP with Encryption
#define PROTOCOL_NHRP			54  //NBMA Next Hop Resolution Protocol
#define PROTOCOL_AHIP			61  //any host internal protocol
#define PROTOCOL_CFTP			62  //CFTP
#define PROTOCOL_ALN			63	//any local network
#define PROTOCOL_SAT_EXPAK		64	//SATNET and Backroom EXPAK
#define PROTOCOL_KRYPTOLAN		65	//Kryptolan
#define PROTOCOL_RVD			66	//MIT Remote Virtual Disk Protocol
#define PROTOCOL_IPPC			67	//Internet Pluribus Packet Core
#define PROTOCOL_ADFS			68	//any distributed file system
#define PROTOCOL_SAT_MON		69	//SATNET Monitoring
#define PROTOCOL_VISA			70	//VISA Protocol
#define PROTOCOL_IPCV			71	//Internet Packet Core Utility 
#define PROTOCOL_CPNX			72	//Computer Protocol Network Executive
#define PROTOCOL_CPHB			73	//Computer Protocol Heart Beat
#define PROTOCOL_WSN			74	//Wang Span Network
#define PROTOCOL_PVP			75	//Packet Video Protocol 
#define PROTOCOL_BR_SAT_MON		76	//Backroom SATNET Monitoring 
#define PROTOCOL_SUN_ND			77	//SUN ND PROTOCOL-Temporary
#define PROTOCOL_WB_MON			78	//WIDEBAND Monitoring
#define PROTOCOL_WB_EXPAK		79	//WIDEBAND EXPAK
#define PROTOCOL_ISO_IP			80	//ISO Internet Protocol
#define PROTOCOL_VMTP			81	//VMTP
#define PROTOCOL_SECURE_VMTP	82	//SECURE-VMTP 
#define PROTOCOL_VINES			83	//VINES
#define PROTOCOL_TTP			84	//TTP
#define PROTOCOL_NSFNET_IGP		85	//NSFNET-IGP 
#define PROTOCOL_DGP			86	// Dissimilar Gateway Protocol
#define PROTOCOL_TCF			87	//TCF
#define PROTOCOL_IGRP			88	//IGRP
#define PROTOCOL_OSPFIGP		89	//OSPFIGP
#define PROTOCOL_Sprite_RPC		90	//Sprite RPC Protocol
#define PROTOCOL_LARP			91	//Locus Address Resolution Protocol
#define PROTOCOL_MTP			92	//Multicast Transport Protocol
#define PROTOCOL_AX25			93	//AX.25 Frames
#define PROTOCOL_IPIP			94	//IP-within-IP Encapsulation Protocol
#define PROTOCOL_MICP			95	//Mobile Internetworking Control Pro.
#define PROTOCOL_SCC_SP			96	//Semaphore Communications Sec. Pro.
#define PROTOCOL_ETHERIP		97	//Ethernet-within-IP Encapsulation
#define PROTOCOL_ENCAP			98	//Encapsulation Header
#define PROTOCOL_APES			99	//any private encryption scheme
#define PROTOCOL_GMTP			100	//GMTP
    
   

#endif

⌨️ 快捷键说明

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