new ArgumentNullException();
}
if (raw.Length<20)
{
throw new ArgumentException();
}
this.m_Raw = raw;
this.m_Time = time;
this.m_HeaderLength = (raw[0] & 0xF) * 4;
if ((raw[0] & 0xF) < 5) {throw new ArgumentException();}
this.m_Precedence = (Precedence)((raw & 0xE0) >> 5);
this.m_Delay = (Delay)((raw & 0x10) >> 4);
this.m_Throughput = (Throughput)((raw & 0x8) >> 3);
this.m_Reliability = (Reliability)((raw & 0x4) >> 2);
this.m_TotalLength = raw * 256 + raw;
if ( ! (this.m_TotalLength == raw.Length)) { throw new ArgumentException();} // invalid size of packet;
this.m_Identification = raw * 256 + raw;
this.m_TimeToLive = raw;
m_Protocol = (Protocol)raw;
m_Checksum = new byte;
m_Checksum[0] = raw;
m_Checksum = raw;
try
{
m_SourceAddress = GetIPAddress(raw, 12);
m_DestinationAddress = GetIPAddress(raw, 16);
}
catch (Exception e)
{
throw;
}
if (m_Protocol == Protocol.Tcp || m_Protocol == Protocol.Udp)
{
m_SourcePort = raw[m_HeaderLength] * 256 + raw[m_HeaderLength + 1];
m_DestinationPort = raw[m_HeaderLength + 2] * 256 + raw[m_HeaderLength + 3];
}
else
{
m_SourcePort = -1;
m_DestinationPort = -1;
}
}
public string GetIPAddress(byte bArray, int nStart)
{
byte tmp = new byte;
if (bArray.Length > nStart + 2)
{
tmp[0] = bArray[nStart];
tmp = bArray[nStart + 1];
tmp = bArray[nStart + 2];
tmp = bArray[nStart + 3];
}
return tmp[0] + "." + tmp + "." + tmp + "." + tmp;
}
public int TotalLength
{
get { return m_TotalLength; }
}
public DateTime Time
{
get { return this.m_Time;
}
}
public Protocol Protocol
{
get { return this.m_Protocol; }
}
public string SourceAddress
{
get { return this.m_SourceAd