示例#1
0
void handle_packet(u_char *args,const struct pcap_pkthdr* pkthdr,const u_char* packet)
{
    u_int16_t type = handle_ethernet(args,pkthdr,packet);
    if(type == ETHERTYPE_IP)
    {
        handle_IP(args,pkthdr,packet);
    }
}
示例#2
0
文件: sipcap.c 项目: farrokhi/sipcap
void process_packet(u_char *args, const struct pcap_pkthdr *header, const u_char *packet) 
{
	pkt_count++;

    u_int16_t type = handle_ethernet(args, header, packet);

    if (type != ETHERTYPE_IP) return;
    handle_IP(args, header, packet);

}
示例#3
0
void my_callback(u_char *args,const struct pcap_pkthdr* pkthdr,const u_char*
        packet)
{
    u_int16_t type = handle_ethernet(args,pkthdr,packet);

    if(type == ETHERTYPE_IP)
    {/* handle IP packet */
    }else if(type == ETHERTYPE_ARP)
    {/* handle arp packet */
    }
    else if(type == ETHERTYPE_REVARP)
    {/* handle reverse arp packet */
    }/* ignorw */
}
示例#4
0
文件: libpcap.c 项目: isangelawu/NAT
/* looking at ernet headers */
void my_callback(u_char *args,const struct pcap_pkthdr* pkthdr,const u_char*
        packet)
{
    printf("---- start packet\n");
    u_int16_t type = handle_ethernet(args,pkthdr,packet);

    if(type == ETHERTYPE_IP)
    {/* handle IP packet */
        handle_IP(args,pkthdr,packet);
    }else if(type == ETHERTYPE_ARP)
    {/* handle arp packet */
    }
    else if(type == ETHERTYPE_REVARP)
    {/* handle reverse arp packet */
    }
    printf("---- end packet\n");
}
示例#5
0
void my_callback(u_char *args,const struct pcap_pkthdr *hdr, const u_char *packet){
   uint16_t type = handle_ethernet(args,hdr,packet);
   uint16_t ipproto = -1;
   uint16_t pld_l =0;

   printf("type eth: %d\n",type);

   if(type == ETHERTYPE_IP){
      ipproto = handle_IP(args,hdr,packet);
   } else if (type == ETHERTYPE_ARP) {
      printf("ARP\n");
   }
   if(ipproto == 17)
      pld_l = handle_UDP(args,hdr,packet);
   else if(ipproto == 6){
      //pld_l = handle_TCP(args,hdr,packet);
   }
   printf("length pld: %d\n",pld_l);
   if(pld_l > 0)
      handle_PLD(args,hdr,packet);

}