dumping packages by now, not more (to be continued)
[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 #define SYSCALL_MAX 32
32 #define CHANNEL_MAX 13
33 #define MAX_DEV_CHARS 6
34 #define MAX_SYSCALL_CHARS 64
35
36 #define HOP_SEC 0
37 #define HOP_USEC 200000
38
39 /* modes */
40 #define MODE_MONITOR (1<<0)
41 #define MODE_WLANNG (1<<1)
42 #define MODE_QUIT (1<<2)
43 #define MODE_HEXOUT (1<<3)
44 #define MODE_ASCIIOUT (1<<4)
45
46 #define MAX_BYTE_WEP 13 /* maximal 104 bit key */
47
48 /* type definitions */
49 typedef struct s_info {
50   int count; /* count packages */
51   unsigned char mode; /* monitoring/managed mode */
52   char device[MAX_DEV_CHARS]; /* sniffed devie */
53   int logfile_fd; /* file descriptof for logfile */
54   int pcap_fd; /* fd for reading pcap events */
55   int current_channel;
56   int channel_hop_fd;
57   char key[13]; /* wep key */
58   pcap_t *pcap_handle;
59 } t_info;
60
61
62 /* function prototypes */
63 int usage(void); 
64 int get_user_event(t_info *info);
65 int hop_channel(t_info *info);
66
67 #endif