Make it possible to select multiple datalinks (#717)
* datalink/dlenv: Rename addr -> addr6 when ipv6 If we are building this file with BACDL_BIP6 and BACDL_BIP enabled we get two definitions for addr. For this reason rename other addr6 so there will be no conflict. * config: Reorder MAX_APDU selection so biggest is first When multiple datalinks are selected we should guess biggest MAX_APDU. To do that we need to order selection based on biggest to lowest. With this change MAX_APDU should be more correct most of the times and user does not need to specifie that by hand. * Make it possible to select multiple datalinks Before we had option to select all datalinks. Many times you however do not need all datalinks but just some. Change logic so that it does not matter if user selects multiple datalinks. Now user just select what they want and everything should just work. * dlenv: Move variables start of function Because we use C89 we need to move variables start of block. * datalink: Hide strings.h because Windows Windows does not support strings.h. Hide it from it. --------- Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
@@ -551,9 +551,15 @@ void dlenv_maintenance_timer(uint16_t elapsed_seconds)
|
||||
*/
|
||||
void dlenv_init(void)
|
||||
{
|
||||
#if defined(BACDL_BIP)
|
||||
BACNET_IP_ADDRESS addr;
|
||||
#endif
|
||||
#if defined(BACDL_BIP6)
|
||||
BACNET_IP6_ADDRESS addr6;
|
||||
#endif
|
||||
char *pEnv = NULL;
|
||||
|
||||
#if defined(BACDL_ALL)
|
||||
#if defined(BACDL_MULTIPLE)
|
||||
pEnv = getenv("BACNET_DATALINK");
|
||||
if (pEnv) {
|
||||
datalink_set(pEnv);
|
||||
@@ -562,7 +568,6 @@ void dlenv_init(void)
|
||||
}
|
||||
#endif
|
||||
#if defined(BACDL_BIP6)
|
||||
BACNET_IP6_ADDRESS addr;
|
||||
pEnv = getenv("BACNET_BIP6_DEBUG");
|
||||
if (pEnv) {
|
||||
bip6_debug_enable();
|
||||
@@ -571,14 +576,14 @@ void dlenv_init(void)
|
||||
pEnv = getenv("BACNET_BIP6_BROADCAST");
|
||||
if (pEnv) {
|
||||
bvlc6_address_set(
|
||||
&addr, (uint16_t)strtol(pEnv, NULL, 0), 0, 0, 0, 0, 0, 0,
|
||||
&addr6, (uint16_t)strtol(pEnv, NULL, 0), 0, 0, 0, 0, 0, 0,
|
||||
BIP6_MULTICAST_GROUP_ID);
|
||||
bip6_set_broadcast_addr(&addr);
|
||||
bip6_set_broadcast_addr(&addr6);
|
||||
} else {
|
||||
bvlc6_address_set(
|
||||
&addr, BIP6_MULTICAST_SITE_LOCAL, 0, 0, 0, 0, 0, 0,
|
||||
&addr6, BIP6_MULTICAST_SITE_LOCAL, 0, 0, 0, 0, 0, 0,
|
||||
BIP6_MULTICAST_GROUP_ID);
|
||||
bip6_set_broadcast_addr(&addr);
|
||||
bip6_set_broadcast_addr(&addr6);
|
||||
}
|
||||
pEnv = getenv("BACNET_BIP6_PORT");
|
||||
if (pEnv) {
|
||||
@@ -588,7 +593,6 @@ void dlenv_init(void)
|
||||
}
|
||||
#endif
|
||||
#if defined(BACDL_BIP)
|
||||
BACNET_IP_ADDRESS addr;
|
||||
pEnv = getenv("BACNET_IP_DEBUG");
|
||||
if (pEnv) {
|
||||
bip_debug_enable();
|
||||
|
||||
Reference in New Issue
Block a user