Bugfix/router mstp builds (#630)

* Fixed example app router-ipv6 to build under ports/win32

* Fixed example app router-mstp to build under ports/win32 with MinGW

* Added win32 builds of router-ipv6 and router-mstp to the Github pipeline
This commit is contained in:
Steve Karg
2024-04-30 13:52:00 -05:00
committed by GitHub
parent b90b14e5f6
commit 96222574f8
11 changed files with 221 additions and 210 deletions
+17 -27
View File
@@ -37,27 +37,13 @@
#include <stdio.h>
#include <stdlib.h>
#include "bacnet/bacdef.h"
#include "bacnet/basic/sys/debug.h"
#include "bacnet/basic/sys/keylist.h"
/* me! */
#include "bacnet/basic/bbmd6/vmac.h"
/* enable debugging */
static bool VMAC_Debug = false;
#if PRINT_ENABLED
#include <stdarg.h>
#include <stdio.h>
#define PRINTF(...) \
if (VMAC_Debug) { \
fprintf(stderr, __VA_ARGS__); \
fflush(stderr); \
}
#else
#define PRINTF(...)
#if !defined UNUSED
#define UNUSED(x) ((void)(x))
#endif
#endif // PRINT_ENABLED
/**
* @brief Enable debugging if print is enabled
@@ -115,7 +101,10 @@ bool VMAC_Add(uint32_t device_id, struct vmac_data *src)
index = Keylist_Data_Add(VMAC_List, device_id, pVMAC);
if (index >= 0) {
status = true;
PRINTF("VMAC %u added.\n", (unsigned int)device_id);
if (VMAC_Debug) {
debug_fprintf(
stderr, "VMAC %u added.\n", (unsigned int)device_id);
}
}
}
}
@@ -261,20 +250,21 @@ void VMAC_Cleanup(void)
if (VMAC_List) {
do {
#if PRINT_ENABLED
uint32_t device_id;
Keylist_Index_Key(VMAC_List, index, &device_id);
#endif
if (VMAC_Debug) {
Keylist_Index_Key(VMAC_List, index, &device_id);
}
pVMAC = Keylist_Data_Delete_By_Index(VMAC_List, index);
if (pVMAC) {
#if PRINT_ENABLED
PRINTF("VMAC List: %lu [", (unsigned long)device_id);
/* print the MAC */
for (i = 0; i < pVMAC->mac_len; i++) {
PRINTF("%02X", pVMAC->mac[i]);
if (VMAC_Debug) {
debug_fprintf(
stderr, "VMAC List: %lu [", (unsigned long)device_id);
/* print the MAC */
for (i = 0; i < pVMAC->mac_len; i++) {
debug_fprintf(stderr, "%02X", pVMAC->mac[i]);
}
debug_fprintf(stderr, "]\n");
}
PRINTF("]\n");
#endif
free(pVMAC);
}
} while (pVMAC);
@@ -291,6 +281,6 @@ void VMAC_Init(void)
VMAC_List = Keylist_Create();
if (VMAC_List) {
atexit(VMAC_Cleanup);
PRINTF("VMAC List initialized.\n");
debug_fprintf(stderr, "VMAC List initialized.\n");
}
}