f60dc044fd97c1ba73f539f5504e26319768524c
[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
22  info=(t_info *)ptr;
23
24  info->count++;
25
26  printf("---> package %d --- %s\n",
27         info->count,
28         ctime((const time_t*)&(pcap_header->ts.tv_sec)));
29  if(info->mode&MODE_ASCIIOUT) {
30   puts("content in ascii:");
31   for(i=0;i<pcap_header->caplen;i++) printf("%c ",package[i]);
32   puts("");
33  }
34  if(info->mode&MODE_HEXOUT) {
35   puts("content in ascii:");
36   for(i=0;i<pcap_header->caplen;i++) printf("%x ",package[i]);
37   puts("");
38  }
39
40 }