rssi-display.c
963 Bytes
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
#include "rssi-display.h"
#include "rssi_list.h"
#include "pcap-thread.h"
#include "http-server.h"
volatile sig_atomic_t got_sigint;
Element * rssi_list;
sem_t synchro;
pthread_t pcap_thread;
int * pcap_ret;
/* Callback function when a SIGNAL is raised.
*
* Input: SIGNAL id.
* Output: None.
*/
void sigInt_received(int sig) {
got_sigint=0;
printf("\nStop sniffing\n");
exit(-1);
}
int main (int argc, char *argv[]) {
// Sem Init
sem_init(&synchro,3,0);
sem_post(&synchro);
// SIGINT handler
signal(SIGINT, sigInt_received);
/* Sniff Thread with provided pcap func */
printf("\nStart Sniffing\n");
pthread_create(&pcap_thread, NULL, pcap_function, (void *)"wlan0"); //wlan0-1 is in monitor or wlan ? uci show not same as iw dev
/* MicroHTTPD */
//printf("[+] Start MicroHTTP daemon.\n");
start_microhttpd();
/* Wait for results*/
//pthread_join ( pcap_thread, (void**)&pcap_ret);
return 0;
}