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

View file

@ -1,28 +1,29 @@
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <libubox/blobmsg_json.h>
#include "networksocket.h"
#include "datastorage.h"
#include "multicastsocket.h"
#include "broadcastsocket.h"
#include "ubus.h"
#include "msghandler.h"
#include "crypto.h"
#include "datastorage.h"
#include "networksocket.h"
/* Network Defines */
#define MAX_RECV_STRING 2048
/* Network Attributes */
int sock;
struct sockaddr_in addr;
const char *ip;
unsigned short port;
char recv_string[MAX_RECV_STRING + 1];
int recv_string_len;
int multicast_socket;
static int sock;
static struct sockaddr_in addr;
static const char *ip;
static unsigned short port;
static char recv_string[MAX_RECV_STRING + 1];
static int recv_string_len;
static int multicast_socket;
static pthread_mutex_t send_mutex;
void *receive_msg(void *args);
@ -102,7 +103,7 @@ void *receive_msg_enc(void *args) {
if (!base64_dec_str){
fprintf(stderr, "Received network error: not enought memory\n");
return 0;
}
}
int base64_dec_length = b64_decode(recv_string, base64_dec_str, B64_DECODE_LEN(strlen(recv_string)));
char *dec = gcrypt_decrypt_msg(base64_dec_str, base64_dec_length);
if (!dec){
@ -147,7 +148,7 @@ int send_string_enc(char *msg) {
fprintf(stderr, "sendto() error: not enought memory\n");
pthread_mutex_unlock(&send_mutex);
exit(EXIT_FAILURE);
}
}
char *base64_enc_str = malloc(B64_ENCODE_LEN(length_enc));
if (!base64_enc_str){
@ -155,7 +156,7 @@ int send_string_enc(char *msg) {
fprintf(stderr, "sendto() error: not enought memory\n");
pthread_mutex_unlock(&send_mutex);
exit(EXIT_FAILURE);
}
}
size_t base64_enc_length = b64_encode(enc, length_enc, base64_enc_str, B64_ENCODE_LEN(length_enc));
if (sendto(sock,