info view mode introduced (still buggy)
[my-code/hdw-sniff.git] / main.h
1 /*
2  * main.h - main header file
3  *
4  * author: hackbard@hackdaworld.dyndns.org
5  *
6  */
7
8 #ifndef MAIN_H
9 #define MAIN_H
10
11 #define _GNU_SOURCE
12 #include <stdio.h>
13 #include <string.h>
14 #include <stdlib.h>
15 #include <sys/socket.h>
16 #include <time.h>
17 #include <netinet/in.h>
18 #include <arpa/inet.h>
19 #include <pcap.h>
20 #include <sys/types.h>
21 #include <sys/stat.h>
22 #include <fcntl.h>
23 #include <unistd.h>
24 #include <sys/ioctl.h>
25 #include <sys/time.h>
26
27 #include <linux/wireless.h>
28
29 #include "parse.h"
30
31 #include "event.h"
32 #include "display.h"
33 #include "input.h"
34 #include "list.h"
35
36 #define SYSCALL_MAX 32
37 #define MESSAGE_MAX 64
38 #define CHANNEL_MAX 13
39 #define MAX_DEV_CHARS 6
40 #define MAX_SYSCALL_CHARS 64
41
42 #define HDW_SNIFF_MAX_WIDTH 80
43 #define HDW_SNIFF_MAX_HEIGHT 8
44
45 #define HOP_SEC 0
46 #define HOP_USEC 200000
47
48 #define GUI_OFFSET_STA 1
49 #define GUI_OFFSET_SSID 19
50 #define GUI_OFFSET_AP 39
51 #define GUI_OFFSET_WEP 44
52 #define GUI_OFFSET_MGMT 50
53 #define GUI_OFFSET_CTRL 57
54 #define GUI_OFFSET_DATA 64
55 #define GUI_OFFSET_ACTIVE 71
56
57 /* modes */
58 #define MODE_MONITOR (1<<0)
59 #define MODE_WLANNG (1<<1)
60 #define MODE_QUIT (1<<2)
61 #define MODE_HEXOUT (1<<3)
62 #define MODE_ASCIIOUT (1<<4)
63
64 #define MAX_BYTE_WEP 13 /* maximal 104 bit key */
65
66 #define VIEW_ALL 0x00
67 #define VIEW_SINGLE 0x01
68
69 /* type definitions */
70 typedef struct s_info {
71   t_event event;
72   t_display display;
73   char *clean_line;
74   int c_line,c_page;
75   unsigned char view;
76   t_input input;
77   int count; /* count packages */
78   int count_m;
79   int count_c;
80   int count_d;
81   unsigned char mode; /* monitoring/managed mode */
82   char device[MAX_DEV_CHARS]; /* sniffed devie */
83   int log_fd; /* file descriptor for logfile */
84   int pcap_fd; /* fd for reading pcap events */
85   int dump_fd; /* fd for dumping received packages */
86   int current_channel;
87   int channel_hop_fd;
88   pcap_t *pcap_handle;
89   t_list sniffed_sta;
90   int view_table;
91 } t_info;
92
93 /* function prototypes */
94 void parse_package(unsigned char *ptr,const struct pcap_pkthdr *pcap_header,const unsigned char *package);
95 int display_console(t_info *info,char *string);
96
97 #endif