mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
Format code
This commit is contained in:
parent
cfa2251ae3
commit
da1c22eb93
9 changed files with 607 additions and 687 deletions
101
src/main.c
101
src/main.c
|
|
@ -1,66 +1,63 @@
|
|||
#include <stdio.h>
|
||||
#include <libubus.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "ubus.h"
|
||||
#include "datastorage.h"
|
||||
#include "networksocket.h"
|
||||
#include "ubus.h"
|
||||
|
||||
#define BUFSIZE 17
|
||||
#define BUFSIZE_DIR 255
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *ubus_socket = NULL;
|
||||
int ch;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *ubus_socket = NULL;
|
||||
int ch;
|
||||
char opt_broadcast_ip[BUFSIZE];
|
||||
char opt_broadcast_port[BUFSIZE];
|
||||
char opt_hostapd_dir[BUFSIZE_DIR];
|
||||
|
||||
char opt_broadcast_ip[BUFSIZE];
|
||||
char opt_broadcast_port[BUFSIZE];
|
||||
char opt_hostapd_dir[BUFSIZE_DIR];
|
||||
|
||||
while ((ch = getopt(argc, argv, "cs:p:i:b:o:h:")) != -1) {
|
||||
switch (ch) {
|
||||
case 's':
|
||||
ubus_socket = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
snprintf(opt_broadcast_port,BUFSIZE,"%s",optarg);
|
||||
printf("broadcast port: %s\n", opt_broadcast_port);
|
||||
break;
|
||||
case 'i':
|
||||
snprintf(opt_broadcast_ip,BUFSIZE,"%s",optarg);
|
||||
printf("broadcast ip: %s\n", opt_broadcast_ip);
|
||||
break;
|
||||
case 'o':
|
||||
snprintf(sort_string,SORT_NUM,"%s",optarg);
|
||||
printf("sort string: %s\n", sort_string);
|
||||
case 'h':
|
||||
snprintf(opt_hostapd_dir,BUFSIZE_DIR,"%s",optarg);
|
||||
printf("hostapd dir: %s\n", opt_hostapd_dir);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (pthread_mutex_init(&list_mutex, NULL) != 0)
|
||||
{
|
||||
printf("\n mutex init failed\n");
|
||||
return 1;
|
||||
while ((ch = getopt(argc, argv, "cs:p:i:b:o:h:")) != -1) {
|
||||
switch (ch) {
|
||||
case 's':
|
||||
ubus_socket = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
snprintf(opt_broadcast_port, BUFSIZE, "%s", optarg);
|
||||
printf("broadcast port: %s\n", opt_broadcast_port);
|
||||
break;
|
||||
case 'i':
|
||||
snprintf(opt_broadcast_ip, BUFSIZE, "%s", optarg);
|
||||
printf("broadcast ip: %s\n", opt_broadcast_ip);
|
||||
break;
|
||||
case 'o':
|
||||
snprintf(sort_string, SORT_NUM, "%s", optarg);
|
||||
printf("sort string: %s\n", sort_string);
|
||||
case 'h':
|
||||
snprintf(opt_hostapd_dir, BUFSIZE_DIR, "%s", optarg);
|
||||
printf("hostapd dir: %s\n", opt_hostapd_dir);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
init_socket_runopts(opt_broadcast_ip, opt_broadcast_port);
|
||||
|
||||
pthread_t tid;
|
||||
pthread_create(&tid, NULL, &remove_thread, NULL);
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
dawn_init_ubus(ubus_socket, opt_hostapd_dir);
|
||||
|
||||
// free ressources
|
||||
pthread_mutex_destroy(&list_mutex);
|
||||
free_list(probe_list_head);
|
||||
|
||||
return 0;
|
||||
if (pthread_mutex_init(&list_mutex, NULL) != 0) {
|
||||
printf("\n mutex init failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
init_socket_runopts(opt_broadcast_ip, opt_broadcast_port);
|
||||
|
||||
pthread_t tid;
|
||||
pthread_create(&tid, NULL, &remove_thread, NULL);
|
||||
|
||||
dawn_init_ubus(ubus_socket, opt_hostapd_dir);
|
||||
|
||||
// free ressources
|
||||
pthread_mutex_destroy(&list_mutex);
|
||||
free_list(probe_list_head);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue