/* IEEE 802.3 stuff -- i will concentrate on .11 stuff before! */
#include <netinet/if_ether.h> /* for ethhdr struct */
#include <netinet/ip.h> /* ip */
-#include <netinet/in.h> /* in_addr */
+#include <netinet/in.h> /* in_addr , inet_ntoa */
/* IEEE 802.11 stuff -- will become one include later ... */
#include "ieee80211.h" /* from hunz's aeolus, short hostap_wlan.h */
/* parse the arguments */
if(argc<3) {
- printf("usage: %s <interface> <monitor mode> <logfile>\n",argv[0]);
+ printf("usage: %s <interface> <monitor mode> <logfile>\n",
+ argv[0]);
return 0;
}
if(argc!=4) {
/* grab a package until user breaks */
count=0;
p_count=&count;
- pcap_dispatch(pcap_handle,-1,(pcap_handler)pcap_process,
- (u_char *)&p_count);
+ pcap_loop(pcap_handle,-1,pcap_process,(u_char *)p_count);
}
++(*p_count);
printf("\n");
- printf("---> package %d ---- %s",count,
- ctime((const time_t*)pcap_header->ts.tv_sec));
+ printf("---> package %d ---- %s",*p_count,
+ ctime((const time_t*)&(pcap_header->ts.tv_sec)));
printf("pcap header: ");
printf("capture length=%d ",pcap_header->caplen);
printf("length(off wire)=%d\n",pcap_header->len);
/* is ieee802.11 ? -- we assume yes :) */
- /* ... */
+ if(atoi(argv[2])==1 && (strncmp(argv[1],"wlan",4)==0)) {
+ printf("debug: ieee802.11\n");
+ }
/* ieee802.3 */
printf("time2live = %x ip_proto = %x\n",ntohs(ip_hdr->ip_ttl),
ntohs(ip_hdr->ip_p));
printf("chksum: %x\n",ntohs(ip_hdr->ip_sum));
-
-
}
printf("all_hex_dump:\n");
for(i=sizeof(struct ethhdr);i<pcap_header->caplen;i++)
printf("%x ",*(package+i));
+ printf("\n");
}