|
|
在ping程序的ICMP报头解析过程中:void CPing: ecodeICMPHeader(char *buf, int bytes, SOCKADDR_IN *from)
{
IpHeader *iphdr = NULL;
IcmpHeader *icmphdr = NULL;
unsigned short iphdrlen;
DWORD tick;
static int icmpcount = 0;
iphdr = (IpHeader *)buf;
// Number of 32-bit words * 4 = bytes
iphdrlen = iphdr->h_len * 4;
tick = GetTickCount();
if ((iphdrlen == MAX_IP_HDR_SIZE) && (!icmpcount))
DecodeIPOptions(buf, bytes);
CString temp;
if (bytes < iphdrlen + ICMP_MIN)
{
temp.Format("Too few bytes from %s \r\n",inet_ntoa(from->sin_addr));
m_dlg->m_result+=temp;
m_dlg->SetDlgItemText(IDC_EDIT2,m_dlg->m_result);
}
icmphdr = (IcmpHeader*)(buf + iphdrlen);
这里 iphdrlen = iphdr->h_len * 4;和 icmphdr = (IcmpHeader*)(buf + iphdrlen);
这两条语句是什么意思啊?
我看了很长时间也不明白,请各位高手指教! |
|