test_storage: extend test harness; datastorage: two bug fixes

datastorage (bug fix): deleting expired array item would fail to test next item
test_storage: extended to cover all required datastorage entry points
test_storage: added ability to read script file
test_storage: added new and revised test scripts
TESTING.md: added to describe testing approach
general: added various TODO notes on things to come back to
general: revised #includes to make each "self-compiling"
general: revised #includes to minimise usage across source files
general: moved declarations and defintions to simplify and rationalise code
datastorage: refactor to support scalability testing
datastorage: made independent of time() calls to support testing
datastorage: fixed redundant use of both SORT_NUM and SORT_LENGTH defines
datastorage: fake kicking to test clients move between access points
msghandler: new module to reduce compile time interdependencies
mshhandler: (issue #100?) fixed SEGV memcpy() in dump_client() using strncpy()
ubus: merged uface into ubus
mac_utils: new module for MAC address utilites
test_header: added target to help #include rationalisation

Tested-by: Nick Hainke <vincent@systemli.org>
This commit is contained in:
Ian Clowes 2020-05-27 19:25:04 +01:00 committed by Polynomialdivision
parent 0f63e00c43
commit 67c3ed0d0a
46 changed files with 2947 additions and 1476 deletions

43
src/include/mac_utils.h Normal file
View file

@ -0,0 +1,43 @@
#ifndef __DAWN_MAC_UTILS_H
#define __DAWN_MAC_UTILS_H
#include <stdint.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]
#define MACSTR "%02X:%02X:%02X:%02X:%02X:%02X"
#define MACSTRLOWER "%02x:%02x:%02x:%02x:%02x:%02x"
#ifndef ETH_ALEN
#define ETH_ALEN 6
#endif
/**
* Convert mac adress string to mac adress.
* @param txt
* @param addr
* @return
*/
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[]);
#endif