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

📄 data.h

📁 匿名通信代码
💻 H
字号:
/*MAC address*/
typedef struct mac_address
{
	u_char mac1;
	u_char mac2;
	u_char mac3;
	u_char mac4;
	u_char mac5;
	u_char mac6;
}mac_address;

/*DATA_LINK header*/
typedef struct data_link_header
{
	mac_address smac;/*source mac address*/
	mac_address dmac;/*destination mac address*/
	u_short type;/*the type field*/
}data_link_header;

/* 4 bytes IP address */
typedef struct ip_address
{
 u_char byte1;
 u_char byte2;
 u_char byte3;
 u_char byte4;
}ip_address;

/* IPv4 header */
typedef struct ip_header
{
 u_char ver_ihl;  /* Version (4 bits) + Internet header length (4 bits)*/
 u_char tos;      /* Type of service */
 u_short tlen;    /* Total length */
 u_short identification; /* Identification */
 u_short flags_fo;       /* Flags (3 bits) + Fragment offset (13 bits)*/
 u_char ttl;      /* Time to live */
 u_char proto;    /* Protocol */
 u_short crc;     /* Header checksum */
 ip_address saddr;/* Source address */
 ip_address daddr;/* Destination address */
 u_int op_pad;    /* Option + Padding */
}ip_header;

/* UDP header */
typedef struct udp_header
{
 u_short sport;   /* Source port */
 u_short dport;   /* Destination port */
 u_short len;     /* Datagram length */
 u_short crc;     /* Checksum */
}udp_header;

/*TCP header*/
typedef struct tcp_header
{
	u_short sport; /*Source port*/
	u_short dport; /*Destination port*/
    u_int seq_num; /*Sequence number*/
	u_int ack_num; /*Acknowlegement number*/
	u_short data_res_bit;/*Data Excursion + Reservation + URG + ACK + PSH + RST + SYN + FIN*/
	u_short window; /*Window*/
	u_short crc; /*Checksum*/
	u_short urg; /*Urgency point*/
	u_int op_pad; /*Option + Padding*/
}tcp_header;

/*the arp protocol*/
typedef struct arp_proto
{
	u_short hard_type;/*hardware type*/
	u_short proto_type;/*protocol type*/
	u_char hard_size;/*hardware size*/
	u_char proto_size;/*protocol size*/
	u_short opcode;/*operation type*/
	mac_address send_mac_addr;/*sender mac address*/
	ip_address send_ip_addr;/*sender ip address*/
	mac_address target_mac_addr;/*target mac address*/
	ip_address target_ip_addr;/*target ip address*/
}arp_proto;

⌨️ 快捷键说明

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