mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
datastorage/test: improve scalability and performance
datastorage: convert to linked lists and optimise use of pointers datastorage: AP, client, probe, auth entry and MAC list converted to linked list datastorage: functions adjusted to take pointers as parameters datastorage: optimised sort and search functions added mac_utils: struct dawn_mac added and comparisons adjusted general: adjust code to call new datastorage functions test_storage: large scale 100 AP, 3000 client, 70k probe added [fix commit] Signed-off-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
parent
2f585043c3
commit
7262cf02d0
20 changed files with 77420 additions and 1437 deletions
|
@ -2,6 +2,7 @@
|
|||
#define __DAWN_MAC_UTILS_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
|
||||
#define STR2MAC(a) &(a)[0], &(a)[1], &(a)[2], &(a)[3], &(a)[4], &(a)[5]
|
||||
|
@ -13,6 +14,22 @@
|
|||
#define ETH_ALEN 6
|
||||
#endif
|
||||
|
||||
// Simplify some handling of MAC addresses
|
||||
struct __attribute__((__packed__)) dawn_mac
|
||||
{
|
||||
uint8_t u8[ETH_ALEN];
|
||||
};
|
||||
|
||||
// Compare a raw MAC address to 00:00:00:00:00:00
|
||||
#define mac_is_null(a1) ((a1)[0] == 0) && ((a1)[1] == 0) && ((a1)[2] == 0) && ((a1)[3] == 0) && ((a1)[4] == 0) && ((a1)[5] == 0)
|
||||
|
||||
// For byte arrays outside MAC structure
|
||||
#define mac_is_equal(addr1, addr2) (memcmp(addr1, addr2, ETH_ALEN) == 0)
|
||||
|
||||
// For byte arrays inside MAC structure
|
||||
#define mac_compare_bb(addr1, addr2) memcmp((addr1).u8, (addr2).u8, ETH_ALEN)
|
||||
#define mac_is_equal_bb(addr1, addr2) (memcmp((addr1).u8, (addr2).u8, ETH_ALEN) == 0)
|
||||
|
||||
/**
|
||||
* Convert mac adress string to mac adress.
|
||||
* @param txt
|
||||
|
@ -21,23 +38,11 @@
|
|||
*/
|
||||
int hwaddr_aton(const char* txt, uint8_t* addr);
|
||||
|
||||
/**
|
||||
* Convert mac to use big characters.
|
||||
* @param in
|
||||
* @param out
|
||||
* @return
|
||||
*/
|
||||
int convert_mac(char* in, char* out);
|
||||
|
||||
/**
|
||||
* Write mac to a file.
|
||||
* @param path
|
||||
* @param addr
|
||||
*/
|
||||
void write_mac_to_file(char* path, uint8_t addr[]);
|
||||
|
||||
int mac_is_equal(const uint8_t addr1[], const uint8_t addr2[]);
|
||||
|
||||
int mac_is_greater(const uint8_t addr1[], const uint8_t addr2[]);
|
||||
void write_mac_to_file(char* path, struct dawn_mac addr);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue