In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
/ / i386 is little_endian.
# ifndef LITTLE_ENDIAN
# define LITTLE_ENDIAN (1) / / BYTE ORDER
# else
# error Redefine LITTLE_ORDER
# endif
/ / Mac header with a total length of 14 bytes
Typedef struct _ eth_hdr
{
Unsigned char dstmac [6]; / / destination mac address
Unsigned char srcmac [6]; / / Source mac address
Unsigned short eth_type; / / Ethernet type
} eth_hdr
/ / IP header with a total length of 20 bytes
Typedef struct _ ip_hdr
{
# if LITTLE_ENDIAN
Unsigned char ihl:4; / / header length
Unsigned char version:4, / / version
# else
Unsigned char version:4, / / version
Unsigned char ihl:4; / / header length
# endif
Unsigned char tos; / / Service type
Unsigned short tot_len; / / Total length
Unsigned short id; / / Flag
Unsigned short frag_off; / / fragment offset
Unsigned char ttl; / / time to live
Unsigned char protocol; / / protocol
Unsigned short chk_sum; / / Inspection and
Struct in_addr srcaddr; / / Source IP address
Struct in_addr dstaddr; / / destination IP address
} ip_hdr
/ / TCP header with a total length of 20 bytes
Typedef struct _ tcp_hdr
{
Unsigned short src_port; / / Source port number
Unsigned short dst_port; / / destination port number
Unsigned int seq_no; / / Serial number
Unsigned int ack_no; / / confirmation number
# if LITTLE_ENDIAN
Unsigned char reserved_1:4; / / preserves 4 of the 6-bit header length
Unsigned char thl:4; / / tcp header length
Unsigned char flag:6; / / 6-bit flag
Unsigned char reseverd_2:2; / / keep 2 of the 6 bits
# else
Unsigned char thl:4; / / tcp header length
Unsigned char reserved_1:4; / / preserves 4 of the 6-bit header length
Unsigned char reseverd_2:2; / / keep 2 of the 6 bits
Unsigned char flag:6; / / 6-bit flag
# endif
Unsigned short wnd_size; / / 16-bit window size
Unsigned short chk_sum; / / 16-bit TCP test and
Unsigned short urgt_p; / / 16 is an emergency pointer
} tcp_hdr
/ / UDP header with a total length of 8 bytes
Typedef struct _ udp_hdr
{
Unsigned short src_port; / / remote port number
Unsigned short dst_port; / / destination port number
Unsigned short uhl; / / udp header length
Unsigned short chk_sum; / / 16-bit udp test and
} udp_hdr
/ / ICMP header with a total length of 4 bytes
Typedef struct _ icmp_hdr
{
Unsigned char icmp_type; / / type
Unsigned char code; / / Code
Unsigned short chk_sum; / / 16-bit test sum
} icmp_hdr
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.