public class ipHeader
{
//4位首部长度+4位IP版本号
public Byte ip_verlen;
//8位服务类型TOS
public Byte ip_tos;
//16位数据包总长度(字节)
public UInt16 ip_totallength;
//16位标识
public UInt16 ip_id;
//3位标志位
public UInt16 ip_offset;
//8位生存时间 TTL
public Byte ip_ttl;
//8位协议(TCP, UDP, ICMP, Etc.) (1->ICMP, 2->IGMP, 6->TCP, 17->UDP)
public Byte ip_protocol;
//16位IP首部校验和
public UInt16 ip_checksum;
//32位源IP地址
public uint ip_srcaddr;
//32位目的IP地址
public uint ip_destaddr;
//其他协议数据包
public Byte[] dates;
int i = 0;
Array.Copy(_ip_verlen, 0, buffer, i, _ip_verlen.Length);
i += _ip_verlen.Length;
Array.Copy(_ip_tos, 0, buffer, i, _ip_tos.Length);
i += _ip_tos.Length;
Array.Copy(_ip_totallength, 0, buffer, i, _ip_totallength.Length);
i += _ip_totallength.Length;
Array.Copy(_ip_id, 0, buffer, i, _ip_id.Length);
i += _ip_id.Length;
Array.Copy(_ip_offset, 0, buffer, i, _ip_offset.Length);
i += _ip_offset.Length;
Array.Copy(_ip_ttl, 0, buffer, i, _ip_ttl.Length);
i += _ip_ttl.Length;
Array.Copy(_ip_protocol, 0, buffer, i, _ip_protocol.Length);
i += _ip_protocol.Length;
Array.Copy(_ip_checksum, 0, buffer, i, _ip_checksum.Length);
i += _ip_checksum.Length;
Array.Copy(_ip_srcaddr, 0, buffer, i, _ip_srcaddr.Length);
i += _ip_srcaddr.Length;
Array.Copy(_ip_destaddr, 0, buffer, i, _ip_destaddr.Length);
i += _ip_destaddr.Length;
Array.Copy(dates, 0, buffer, i, dates.Length);
i += dates.Length;