TCP-IP资料整理——IP|TCP|UDP Heade…

来源:互联网 发布:软件套什么定额 编辑:程序博客网 时间:2024/06/08 05:14

为了方便学习查阅TCP-IP,特意收集整理了点IP|TCP|UDP头的视图和结构体。下面的图片中文的是截自《详解TCP-IP》汉化电子版,注释是把几个站上的给综合了一下。

***********************************************************************************TheFuckCutline********************************************************************************
***

IP头视图
TCP-IP资料整理鈥斺擨P|TCP|UDP <wbr>Header <wbr>Struct&PIC
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
IP头结构体

typedef struct_IPHeader                    //20字节的IP
{
   UCHAR    iphVerLen;         // 4
位首部长度+4IP版本号           | Version (4 bits) + Internet header length (4bits)
   UCHAR    ipTOS;               // 8
位服务类型                                 | TOS Typeof service
   USHORT   ipLength;           // 16
位封包总长度,即整个IP报的长度  | Total length
   USHORT   ipID;                  // 16
位封包标识,惟一标识发送的每一个数据报     | Identification
   USHORT   ipFlags;            // 3
位标志位+13报片偏移                | Flags (3 bits) + Fragmentoffset (13 bits)
   UCHAR    ipTTL;               // 8
位生存时间,就是TTL                | Time tolive
   UCHAR    ipProtocol;           //8
位协议,TCPUDPICMP         | Protocol
   USHORT   ipChecksum;    //16
IP首部校验和                  | Header checksum
   ULONG    ipSource;         //32
位源IP地址                      | Source address
   ULONG    ipDestination;            //32
位目标IP地址                    | Destination address
} IPHeader,*PIPHeader;      


***********************************************************************************TheFuckCutline***********************************************************************************

TCP头视图
TCP-IP资料整理鈥斺擨P|TCP|UDP <wbr>Header <wbr>Struct&PIC
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

TCP头结构体


typedef struct_TCPHeader          //20字节的TCP
{
      USHORTsourcePort;           //16
位源端口号   | Source port
      USHORTdestinationPort;      //16
位目的端口号 |Destination port
      ULONGsequenceNumber;      // 32
位序列号     | Sequence Number
      ULONG acknowledgeNumber;   // 32
位确认号     | Acknowledgement number
      UCHAR  dataoffset;                        // 
4位表示数据偏移,低6位保留字 |Header length
      UCHAR  flags;                  //6
位标志位      | packet flags
      USHORTwindows;                    //16
位窗口大小   | Window size
      USHORTchecksum;                  //16
位校验和     | Header Checksum
      USHORTurgentPointer;        //16
位紧急数据偏移量  | Urgent pointer...still don'tknow what thisis...
} TCPHeader,*PTCPHeader;      

                                              

*************
**********************************************************************TheFuckCutline***********************************************************************************

UDP头视图
TCP-IP资料整理鈥斺擨P|TCP|UDP <wbr>Header <wbr>Struct&PIC
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UDP头结构体

typedef struct_UDPHeader
{
      USHORT              sourcePort;          // 16
位源端口号  | Source port
      USHORT              destinationPort;     // 16
位目的端口号 |Destinationport     
      USHORT              len;                  //16
位封包长度  | Sequence Number
      USHORT              checksum;            // 16
位校验和    | Acknowledgement number
} UDPHeader,*PUDPHeader;                   



***********************************************************************************TheFuckCutline***********************************************************************************


零魂(zerosoul)整理制作。
http://hi.baidu.com/0soul
0 0
原创粉丝点击