mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
remove old thread stuff
This commit is contained in:
parent
bef2c699dd
commit
5705946da6
4 changed files with 1 additions and 66 deletions
|
@ -8,7 +8,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <libubox/uloop.h>
|
|
||||||
|
|
||||||
#ifndef ETH_ALEN
|
#ifndef ETH_ALEN
|
||||||
#define ETH_ALEN 6
|
#define ETH_ALEN 6
|
||||||
|
@ -92,8 +91,6 @@ void print_probe_entry(probe_entry entry);
|
||||||
|
|
||||||
void print_auth_entry(auth_entry entry);
|
void print_auth_entry(auth_entry entry);
|
||||||
|
|
||||||
void *remove_probe_array_thread(void *arg);
|
|
||||||
|
|
||||||
void uloop_add_data_cbs();
|
void uloop_add_data_cbs();
|
||||||
|
|
||||||
/* AP, Client */
|
/* AP, Client */
|
||||||
|
@ -155,14 +152,10 @@ void print_client_array();
|
||||||
|
|
||||||
void print_client_entry(client entry);
|
void print_client_entry(client entry);
|
||||||
|
|
||||||
void *remove_client_array_thread(void *arg);
|
|
||||||
|
|
||||||
ap insert_to_ap_array(ap entry);
|
ap insert_to_ap_array(ap entry);
|
||||||
|
|
||||||
void print_ap_array();
|
void print_ap_array();
|
||||||
|
|
||||||
void *remove_ap_array_thread(void *arg);
|
|
||||||
|
|
||||||
ap ap_array_get_ap(uint8_t bssid_addr[]);
|
ap ap_array_get_ap(uint8_t bssid_addr[]);
|
||||||
|
|
||||||
/* Utils */
|
/* Utils */
|
||||||
|
|
17
src/main.c
17
src/main.c
|
@ -1,32 +1,18 @@
|
||||||
#include <libubus.h>
|
#include <libubus.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <syslog.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "datastorage.h"
|
#include "datastorage.h"
|
||||||
#include "networksocket.h"
|
#include "networksocket.h"
|
||||||
#include "ubus.h"
|
#include "ubus.h"
|
||||||
#include "dawn_uci.h"
|
#include "dawn_uci.h"
|
||||||
#include "rssi.h"
|
#include "crypto.h"
|
||||||
|
|
||||||
#define BUFSIZE 17
|
#define BUFSIZE 17
|
||||||
#define BUFSIZE_DIR 256
|
#define BUFSIZE_DIR 256
|
||||||
|
|
||||||
|
|
||||||
#include "crypto.h"
|
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <dlfcn.h>s
|
|
||||||
|
|
||||||
void daemon_shutdown();
|
void daemon_shutdown();
|
||||||
|
|
||||||
void signal_handler(int sig);
|
void signal_handler(int sig);
|
||||||
|
@ -34,7 +20,6 @@ void signal_handler(int sig);
|
||||||
struct sigaction newSigAction;
|
struct sigaction newSigAction;
|
||||||
|
|
||||||
void daemon_shutdown() {
|
void daemon_shutdown() {
|
||||||
|
|
||||||
// kill threads
|
// kill threads
|
||||||
printf("Cancelling Threads!\n");
|
printf("Cancelling Threads!\n");
|
||||||
uloop_cancelled = true;
|
uloop_cancelled = true;
|
||||||
|
|
|
@ -565,19 +565,6 @@ void uloop_add_data_cbs()
|
||||||
uloop_timeout_add(&ap_timeout);
|
uloop_timeout_add(&ap_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *remove_probe_array_thread(void *arg) {
|
|
||||||
printf("Removing thread with time: %lu\n", *(long int *) arg);
|
|
||||||
time_t time_treshold = *(time_t *) arg;
|
|
||||||
while (1) {
|
|
||||||
sleep(time_treshold);
|
|
||||||
pthread_mutex_lock(&probe_array_mutex);
|
|
||||||
printf("[Thread] : Removing old entries!\n");
|
|
||||||
remove_old_probe_entries(time(0), time_treshold);
|
|
||||||
pthread_mutex_unlock(&probe_array_mutex);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void remove_probe_array_cb(struct uloop_timeout *t) {
|
void remove_probe_array_cb(struct uloop_timeout *t) {
|
||||||
pthread_mutex_lock(&probe_array_mutex);
|
pthread_mutex_lock(&probe_array_mutex);
|
||||||
printf("[Thread] : Removing old entries!\n");
|
printf("[Thread] : Removing old entries!\n");
|
||||||
|
@ -586,19 +573,6 @@ void remove_probe_array_cb(struct uloop_timeout *t) {
|
||||||
uloop_timeout_set(&probe_timeout, timeout_config.remove_probe * 1000);
|
uloop_timeout_set(&probe_timeout, timeout_config.remove_probe * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *remove_client_array_thread(void *arg) {
|
|
||||||
time_t time_treshold_client = *(time_t *) arg;
|
|
||||||
printf("Removing client thread with time: %lu\n", time_treshold_client);
|
|
||||||
while (1) {
|
|
||||||
sleep(time_treshold_client);
|
|
||||||
pthread_mutex_lock(&client_array_mutex);
|
|
||||||
printf("[Thread] : Removing old client entries!\n");
|
|
||||||
remove_old_client_entries(time(0), time_treshold_client);
|
|
||||||
pthread_mutex_unlock(&client_array_mutex);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void remove_client_array_cb(struct uloop_timeout *t)
|
void remove_client_array_cb(struct uloop_timeout *t)
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&client_array_mutex);
|
pthread_mutex_lock(&client_array_mutex);
|
||||||
|
@ -608,19 +582,6 @@ void remove_client_array_cb(struct uloop_timeout *t)
|
||||||
uloop_timeout_set(&client_timeout, timeout_config.update_client * 1000);
|
uloop_timeout_set(&client_timeout, timeout_config.update_client * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *remove_ap_array_thread(void *arg) {
|
|
||||||
time_t time_treshold_ap = *(time_t *) arg;
|
|
||||||
printf("Removing ap thread with time: %lu\n", time_treshold_ap);
|
|
||||||
while (1) {
|
|
||||||
sleep(time_treshold_ap);
|
|
||||||
pthread_mutex_lock(&ap_array_mutex);
|
|
||||||
printf("[Thread] : Removing old ap entries!\n");
|
|
||||||
remove_old_ap_entries(time(0), time_treshold_ap);
|
|
||||||
pthread_mutex_unlock(&ap_array_mutex);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void remove_ap_array_cb(struct uloop_timeout *t) {
|
void remove_ap_array_cb(struct uloop_timeout *t) {
|
||||||
pthread_mutex_lock(&ap_array_mutex);
|
pthread_mutex_lock(&ap_array_mutex);
|
||||||
printf("[ULOOP] : Removing old ap entries!\n");
|
printf("[ULOOP] : Removing old ap entries!\n");
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
|
|
||||||
static struct ubus_context *ctx = NULL;
|
static struct ubus_context *ctx = NULL;
|
||||||
static struct ubus_context *ctx_clients; /* own ubus conext otherwise strange behavior... */
|
static struct ubus_context *ctx_clients; /* own ubus conext otherwise strange behavior... */
|
||||||
//static struct ubus_context *ctx_hostapd;
|
|
||||||
|
|
||||||
static struct ubus_subscriber hostapd_event;
|
static struct ubus_subscriber hostapd_event;
|
||||||
static struct blob_buf b;
|
static struct blob_buf b;
|
||||||
|
@ -374,12 +373,10 @@ static int hostapd_notify(struct ubus_context *ctx, struct ubus_object *obj,
|
||||||
static int add_subscriber(char *name) {
|
static int add_subscriber(char *name) {
|
||||||
uint32_t id = 0;
|
uint32_t id = 0;
|
||||||
|
|
||||||
printf("DOING LOOKUP!\n");
|
|
||||||
if (ubus_lookup_id(ctx, name, &id)) {
|
if (ubus_lookup_id(ctx, name, &id)) {
|
||||||
fprintf(stderr, "Failed to look up test object for %s\n", name);
|
fprintf(stderr, "Failed to look up test object for %s\n", name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
printf("Lookup success!\n");
|
|
||||||
|
|
||||||
if(hostapd_array_check_id(id))
|
if(hostapd_array_check_id(id))
|
||||||
{
|
{
|
||||||
|
@ -466,7 +463,6 @@ int dawn_init_ubus(const char *ubus_socket, char *hostapd_dir) {
|
||||||
uloop_timeout_add(&hostapd_timer);
|
uloop_timeout_add(&hostapd_timer);
|
||||||
|
|
||||||
// remove probe
|
// remove probe
|
||||||
//uloop_timeout_add(&probe_timeout);
|
|
||||||
uloop_add_data_cbs();
|
uloop_add_data_cbs();
|
||||||
|
|
||||||
// get clients
|
// get clients
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue