1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
--- a/src/sn_data.h
+++ b/src/sn_data.h
@@ -101,7 +101,7 @@
char IP[256];
unsigned long SNIFLEN; /* bytes we need to snif */
short DEST_PORT, SRC_PORT; /* destination port */
-char non_printable, *logging_device;
+char non_printable;
/**** Global data (packets) *************************************************/
int PROTO_HEAD; /* Base Protocol head length (ethernet, PPP ,....) */
@@ -147,43 +147,6 @@
/**** Global data (plugins) *************************************************/
char Plugin_Active[10];
-/**** Global data (interactive) *********************************************/
-#ifdef INCLUDE_INTERFACE
-
-/**** shared memory pointers ************************************************/
-char *SHARED, *connection_data, *timing, *running_connections,
- *logged_connections;
-int *LISTlength, *DATAlength, memory_id;
-unsigned int *TCP_nr_of_packets, *ICMP_nr_of_packets, *UDP_nr_of_packets;
-unsigned int *IP_nr_of_packets;
-unsigned long *TCP_bytes_in_packets, *UDP_bytes_in_packets;
-int *DESC_LEN;
-
-/**** data structures *******************************************************/
-struct snif_mask *mask;
-struct shared_logged_conn *log_conn;
-FILE *log_dev_stream;
-struct stat log_dev_stat;
-
-volatile int LOGGING=0, screen_busy=0;
-char PACKET_INFO;
-int POINTpos=0, LISTpos=0;
-unsigned char COLOR_AVAIL=0;
-
-/**** screen **************************************************************/
-int MASK_WINDOW_ROWS, MASK_WINDOW_COLS;
-int MAIN_WINDOW_ROWS, MAIN_WINDOW_COLS;
-int INFO_WINDOW_ROWS, INFO_WINDOW_COLS;
-int DATA_WINDOW_ROWS, DATA_WINDOW_COLS;
-int INFO_WINDOW_X, INFO_WINDOW_Y;
-int MASK_WINDOW_X, MASK_WINDOW_Y;
-int DATA_WINDOW_X, DATA_WINDOW_Y;
-
-WINDOW *menu_window;
-struct box_window data_box, main_box, mask_box, packets_box;
-int Pid=0;
-#endif
-
/* DEBUG section */
#ifdef DEBUG
FILE *debug_dev;
--- a/src/sn_global.h
+++ b/src/sn_global.h
@@ -4,7 +4,6 @@
/* currently some option data */
char SNIFMODE, DUMPMODE, PROTOCOLS, ASC, WILDCARD, CFG_FILE, NO_CHKSUM;
-char INTERACTIVE_EXTEND;
int LOGPARAM;
/* All option shit */
--- a/src/sn_interface.c
+++ b/src/sn_interface.c
@@ -18,37 +18,37 @@
#include "sn_generation.h"
#include "sn_resolv.h"
-/*** extern stuff ********/
-extern char *SHARED, *connection_data, *timing, *running_connections,
+/*** global stuff ********/
+char *SHARED, *connection_data, *timing, *running_connections,
*logged_connections;
-extern int *LISTlength, *DATAlength, memory_id;
-extern unsigned int *TCP_nr_of_packets, *ICMP_nr_of_packets, *UDP_nr_of_packets; unsigned int *IP_nr_of_packets;
-extern unsigned long *TCP_bytes_in_packets, *UDP_bytes_in_packets;
-extern int *DESC_LEN; /* For the connection desciption */
-
-extern char INTERACTIVE_EXTEND;
-
-extern struct snif_mask *mask;
-extern struct shared_logged_conn *log_conn;
-extern FILE *log_dev_stream;
-extern struct stat log_dev_stat;
-
-extern volatile int LOGGING, screen_busy;
-extern char PACKET_INFO;
-extern int POINTpos, LISTpos;
-extern unsigned char COLOR_AVAIL;
-
-extern WINDOW *menu_window;
-extern struct box_window data_box, main_box, mask_box, packets_box;
-extern int Pid;
-extern char *logging_device;
+int *LISTlength, *DATAlength, memory_id;
+unsigned int *TCP_nr_of_packets, *ICMP_nr_of_packets, *UDP_nr_of_packets; unsigned int *IP_nr_of_packets;
+unsigned long *TCP_bytes_in_packets, *UDP_bytes_in_packets;
+int *DESC_LEN; /* For the connection desciption */
+
+char INTERACTIVE_EXTEND;
+
+struct snif_mask *mask;
+struct shared_logged_conn *log_conn;
+FILE *log_dev_stream;
+struct stat log_dev_stat;
+
+volatile int LOGGING, screen_busy;
+char PACKET_INFO;
+int POINTpos, LISTpos;
+unsigned char COLOR_AVAIL;
+
+WINDOW *menu_window;
+struct box_window data_box, main_box, mask_box, packets_box;
+int Pid;
+char *logging_device;
/*** Screen Parameters ***/
-extern int MASK_WINDOW_ROWS, MASK_WINDOW_COLS, MAIN_WINDOW_ROWS, MAIN_WINDOW_COLS;
-extern int INFO_WINDOW_ROWS, INFO_WINDOW_COLS, DATA_WINDOW_ROWS, DATA_WINDOW_COLS;
-extern int INFO_WINDOW_X, INFO_WINDOW_Y, MASK_WINDOW_X, MASK_WINDOW_Y;
-extern int DATA_WINDOW_X, DATA_WINDOW_Y;
+int MASK_WINDOW_ROWS, MASK_WINDOW_COLS, MAIN_WINDOW_ROWS, MAIN_WINDOW_COLS;
+int INFO_WINDOW_ROWS, INFO_WINDOW_COLS, DATA_WINDOW_ROWS, DATA_WINDOW_COLS;
+int INFO_WINDOW_X, INFO_WINDOW_Y, MASK_WINDOW_X, MASK_WINDOW_Y;
+int DATA_WINDOW_X, DATA_WINDOW_Y;
/*** Sreen operations ***/
--- a/src/sn_interface.h
+++ b/src/sn_interface.h
@@ -1,9 +1,46 @@
/* Sniffit Data File */
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include "pcap.h"
typedef void (*sig_hand)(int ); /* sighandler_t gave errors, weird */
+/*** global stuff ********/
+extern unsigned int *IP_nr_of_packets;
+extern char *SHARED, *connection_data, *timing, *running_connections,
+ *logged_connections;
+extern int *LISTlength, *DATAlength, memory_id;
+extern unsigned int *TCP_nr_of_packets, *ICMP_nr_of_packets, *UDP_nr_of_packets;
+extern unsigned int *IP_nr_of_packets;
+extern unsigned long *TCP_bytes_in_packets, *UDP_bytes_in_packets;
+extern int *DESC_LEN; /* For the connection desciption */
+
+extern char INTERACTIVE_EXTEND;
+
+extern struct snif_mask *mask;
+extern struct shared_logged_conn *log_conn;
+extern FILE *log_dev_stream;
+extern struct stat log_dev_stat;
+
+extern volatile int LOGGING, screen_busy;
+extern char PACKET_INFO;
+extern int POINTpos, LISTpos;
+extern unsigned char COLOR_AVAIL;
+
+extern WINDOW *menu_window;
+extern struct box_window data_box, main_box, mask_box, packets_box;
+extern int Pid;
+extern char *logging_device;
+
+
+/*** Screen Parameters ***/
+extern int MASK_WINDOW_ROWS, MASK_WINDOW_COLS, MAIN_WINDOW_ROWS, MAIN_WINDOW_COLS;
+extern int INFO_WINDOW_ROWS, INFO_WINDOW_COLS, DATA_WINDOW_ROWS, DATA_WINDOW_COLS;
+extern int INFO_WINDOW_X, INFO_WINDOW_Y, MASK_WINDOW_X, MASK_WINDOW_Y;
+extern int DATA_WINDOW_X, DATA_WINDOW_Y;
+
int add_itemlist(char *, char *, char *);
void child_exit (void);
void clear_shared_mem(char);
|