mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
Add insert into client array
This commit is contained in:
parent
fa132d4acc
commit
85744e3fa3
3 changed files with 56 additions and 9 deletions
|
@ -54,7 +54,7 @@ typedef struct client_s {
|
|||
|
||||
#define ARRAY_CLIENT_LEN 1000
|
||||
|
||||
struct probe_entry_s client_array[ARRAY_CLIENT_LEN];
|
||||
struct client_s client_array[ARRAY_CLIENT_LEN];
|
||||
pthread_mutex_t client_array_mutex;
|
||||
|
||||
void client_array_insert(client entry);
|
||||
|
|
|
@ -11,15 +11,64 @@ int mac_is_greater(uint8_t addr1[], uint8_t addr2[]);
|
|||
void print_probe_entry(probe_entry entry);
|
||||
void remove_old_probe_entries(time_t current_time, long long int threshold);
|
||||
|
||||
int client_array_go_next(char sort_order[], int i, client entry,
|
||||
client next_entry);
|
||||
int client_array_go_next_help(char sort_order[], int i, client entry,
|
||||
client next_entry);
|
||||
|
||||
int probe_entry_last = -1;
|
||||
int client_entry_last = -1;
|
||||
|
||||
int client_array_go_next_help(char sort_order[], int i, client entry,
|
||||
client next_entry) {
|
||||
switch (sort_order[i]) {
|
||||
// bssid-mac
|
||||
case 'b':
|
||||
return mac_is_greater(entry.bssid_addr, next_entry.bssid_addr) &&
|
||||
mac_is_equal(entry.client_addr, next_entry.client_addr);
|
||||
break;
|
||||
|
||||
// client-mac
|
||||
case 'c':
|
||||
return mac_is_greater(entry.client_addr, next_entry.client_addr);
|
||||
break;
|
||||
|
||||
// frequency
|
||||
// mac is 5 ghz or 2.4 ghz?
|
||||
// case 'f':
|
||||
// return //entry.freq < next_entry.freq &&
|
||||
// entry.freq < 5000 &&
|
||||
// next_entry.freq >= 5000 &&
|
||||
// //entry.freq < 5 &&
|
||||
// mac_is_equal(entry.client_addr, next_entry.client_addr);
|
||||
// break;
|
||||
|
||||
// signal strength (RSSI)
|
||||
//case 's':
|
||||
// return entry.signal < next_entry.signal &&
|
||||
// mac_is_equal(entry.client_addr, next_entry.client_addr);
|
||||
// break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int client_array_go_next(char sort_order[], int i, client entry,
|
||||
client next_entry) {
|
||||
int conditions = 1;
|
||||
for (int j = 0; j < i; j++) {
|
||||
i &= !(client_array_go_next(sort_order, j, entry, next_entry));
|
||||
}
|
||||
return conditions && client_array_go_next_help(sort_order, i, entry, next_entry);
|
||||
}
|
||||
|
||||
void client_array_insert(client entry)
|
||||
{
|
||||
/*
|
||||
if(client_entry_last == -1)
|
||||
{
|
||||
probe_array[0] = entry;
|
||||
client_array[0] = entry;
|
||||
client_entry_last++;
|
||||
return;
|
||||
}
|
||||
|
@ -27,7 +76,7 @@ void client_array_insert(client entry)
|
|||
int i;
|
||||
for(i = 0; i <= client_entry_last; i++)
|
||||
{
|
||||
if(!go_next(sort_string, SORT_NUM, entry, probe_array[i]))
|
||||
if(!client_array_go_next("bs", 2, entry, client_array[i]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -36,15 +85,15 @@ void client_array_insert(client entry)
|
|||
{
|
||||
if(j + 1 <= ARRAY_LEN)
|
||||
{
|
||||
probe_array[j + 1] = probe_array[j];
|
||||
client_array[j + 1] = client_array[j];
|
||||
}
|
||||
}
|
||||
probe_array[i] = entry;
|
||||
client_array[i] = entry;
|
||||
|
||||
if(client_entry_last < ARRAY_LEN)
|
||||
{
|
||||
client_entry_last++;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
client* client_array_delete(client entry)
|
||||
|
|
|
@ -246,12 +246,10 @@ dump_client(struct blob_attr **tb, uint8_t client_addr[], const char* bssid_addr
|
|||
|
||||
sprintf(mac_buf_ap, "%x:%x:%x:%x:%x:%x", MAC2STR(client_entry.bssid_addr));
|
||||
sprintf(mac_buf_client, "%x:%x:%x:%x:%x:%x", MAC2STR(client_entry.client_addr));
|
||||
printf("Testing client mac: %s\n", client_entry.client_addr);
|
||||
|
||||
printf("Client Address: %s\n", mac_buf_client);
|
||||
printf("AP Address: %s\n", mac_buf_ap);
|
||||
|
||||
|
||||
//hwaddr_aton(client_addr, client_entry.client_addr);
|
||||
|
||||
if (tb[CLIENT_AUTH]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue