begin to parse frame ctl hdr + listing sta's
[my-code/hdw-sniff.git] / parse.c
1 /*
2  * parse.c - parsing of pcap packages
3  *
4  * author: hackbard@hackdaworld.dyndns.org
5  *
6  */
7
8 #include "parse.h"
9 //#include "802.11b.h"
10 #include "main.h"
11
12 /* all the parsing stuff will go here
13  *
14  * different protocols should get to seperated files though ...
15  */
16
17 void parse_package(unsigned char *ptr,const struct pcap_pkthdr *pcap_header,const unsigned char *package) {
18
19   t_info *info;
20   int i;
21   t_sta sniffed_sta;
22   int ret;
23
24   info=(t_info *)ptr;
25
26   info->count++;
27
28   if(info->dump_fd!=0) {
29     ret=write(info->dump_fd,pcap_header,sizeof(struct pcap_pkthdr));
30     if(ret!=sizeof(struct pcap_pkthdr))
31       display_console(info->display,"warning, pcap header write failed!");
32     ret=write(info->dump_fd,package,pcap_header->caplen);
33     if(ret!=pcap_header->caplen)
34       display_console(info->display,"warning, package write failed!");
35   }
36   
37   /* maybe there is offset to the actual ieee802.11 frame,
38      for example prism header ... */
39
40
41   /* go on parsing frame ctl header here ... */
42
43   return 23;
44
45 }