mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
Reformat code
This commit is contained in:
parent
fa52176cd8
commit
325cbc764c
6 changed files with 989 additions and 1048 deletions
114
src/main.c
114
src/main.c
|
|
@ -9,76 +9,76 @@
|
|||
#define BUFSIZE_DIR 255
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
const char *ubus_socket = NULL;
|
||||
int ch;
|
||||
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);
|
||||
hostapd_dir_glob = optarg;
|
||||
default:
|
||||
break;
|
||||
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);
|
||||
hostapd_dir_glob = optarg;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (pthread_mutex_init(&list_mutex, NULL) != 0) {
|
||||
printf("\n mutex init failed\n");
|
||||
return 1;
|
||||
}
|
||||
if (pthread_mutex_init(&list_mutex, NULL) != 0) {
|
||||
printf("\n mutex init failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pthread_mutex_init(&probe_array_mutex, NULL) != 0) {
|
||||
printf("\n mutex init failed\n");
|
||||
return 1;
|
||||
}
|
||||
if (pthread_mutex_init(&probe_array_mutex, NULL) != 0) {
|
||||
printf("\n mutex init failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (pthread_mutex_init(&client_array_mutex, NULL) != 0) {
|
||||
printf("\n mutex init failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
init_socket_runopts(opt_broadcast_ip, opt_broadcast_port, 1);
|
||||
if (pthread_mutex_init(&client_array_mutex, NULL) != 0) {
|
||||
printf("\n mutex init failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
pthread_t tid_probe;
|
||||
pthread_create(&tid_probe, NULL, &remove_array_thread, NULL);
|
||||
init_socket_runopts(opt_broadcast_ip, opt_broadcast_port, 1);
|
||||
|
||||
pthread_t tid_client;
|
||||
pthread_create(&tid_client, NULL, &remove_client_array_thread, NULL);
|
||||
pthread_t tid_probe;
|
||||
pthread_create(&tid_probe, NULL, &remove_array_thread, NULL);
|
||||
|
||||
pthread_t tid_get_client;
|
||||
pthread_create(&tid_get_client, NULL, &update_clients_thread, NULL);
|
||||
pthread_t tid_client;
|
||||
pthread_create(&tid_client, NULL, &remove_client_array_thread, NULL);
|
||||
|
||||
pthread_t tid_get_client;
|
||||
pthread_create(&tid_get_client, NULL, &update_clients_thread, NULL);
|
||||
|
||||
|
||||
|
||||
//pthread_create(&tid, NULL, &remove_thread, NULL);
|
||||
|
||||
dawn_init_ubus(ubus_socket, opt_hostapd_dir);
|
||||
//pthread_create(&tid, NULL, &remove_thread, NULL);
|
||||
|
||||
// free ressources
|
||||
pthread_mutex_destroy(&list_mutex);
|
||||
free_list(probe_list_head);
|
||||
dawn_init_ubus(ubus_socket, opt_hostapd_dir);
|
||||
|
||||
return 0;
|
||||
// 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