如何为此添加UDP标头.... [英] How do I add a UDP header to this....
本文介绍了如何为此添加UDP标头....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
typedef struct _IP_HEADER_
{
BYTE ver_ihl; // Version (4 bits) and Internet Header Length (4 bits)
BYTE type; // Type of Service (8 bits)
WORD length; // Total size of packet (header + data)(16 bits)
WORD packet_id; // (16 bits)
WORD flags_foff; // Flags (3 bits) and Fragment Offset (13 bits)
BYTE time_to_live; // (8 bits)
BYTE protocol; // (8 bits)
WORD hdr_chksum; // Header check sum (16 bits)
DWORD source_ip; // Source Address (32 bits)
DWORD destination_ip; // Destination Address (32 bits)
} IPHEADER;
typedef struct _TCP_HEADER_
{
WORD source_port; // (16 bits)
WORD destination_port; // (16 bits)
DWORD seq_number; // Sequence Number (32 bits)
DWORD ack_number; // Acknowledgment Number (32 bits)
WORD info_ctrl; // Data Offset (4 bits), Reserved (6 bits), Control bits (6 bits)
WORD window; // (16 bits)
WORD checksum; // (16 bits)
WORD urgent_pointer; // (16 bits)
} TCPHEADER;
typedef struct _ICMP_HEADER_
{
BYTE type; // (8 bits)
BYTE code; // (8 bits)
WORD checksum; // (16 bits)
} ICMPHEADER;
推荐答案
因此 [ ^ ].
这里是您所要询问的很好的图形表示形式:
http://nmap.org/book/tcpip-ref.html [
Here''s a good graphical representation of what you''re asking about:
http://nmap.org/book/tcpip-ref.html[^]
If I understood your follow up question to Richard correctly, the "preceeding words" are type definitions:
typedef unsigned char BYTE; // 1byte
typedef unsigned short WORD; // 2bytes
typedef unsigned long DWORD; // 4bytes
这篇关于如何为此添加UDP标头....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文