//源MAC为本网卡MAC,则出包计数加1
if(macaddress[0]==pkt_data[6]&&macaddress[1]==pkt_data[7]&&
macaddress[2]==pkt_data[8]&&macaddress[3]==pkt_data[9]&&
macaddress[4]==pkt_data[10]&&macaddress[5]==pkt_data[11])
{
outcount++;
}
sprintf(s,"出包:%lu",outcount);
static1->SetWindowText(s);
sprintf(s,"入包:%lu",incount);
static2->SetWindowText(s);
//找到数据包链表的末尾
cur_pack=allpacket;
while(1)
{
if(cur_pack->next==NULL)
break;
cur_pack=cur_pack->next;
}
//为捕获到的数据包生成新节点,并加至数据包链表末尾
new_pack=new packetstru;
new_pack->datalen=header->len;
for(i=1;i<=header->len;i++)
new_pack->data[i-1]=pkt_data[i-1];
new_pack->clearflag=0;
new_pack->showflag=1;
new_pack->tick=GetTickCount();
new_pack->next=NULL;
cur_pack->next=new_pack;
} }
|