Feature/refactor bacnet ipv4 add unit tests (#64)

* refactor BACnet/IPv4 BVLC into encode-decode library with unit tests
Added Read-Broadcast-Distribution-Table encoding and unit test.
Added Read-Broadcast-Distribution-Table-Ack encoding and unit test.
Added Read-Foreign-Device-Table-Ack encoding and unit test.
Added some BDT/FDT diff copy functions with unit tests
Added some FDT add and delete entry functions with unit tests
Added some BDT set append and clear entry functions with unit tests
Added some BIPv4 address conversion functions with unit tests
Added non-BBMD handling unit test
Added basic unit test for BBMD handler
Added BBMD broadcast mask get set and unit tests
Added IPv6 maintenance timer.
Added ReadFDT app
Fixed ReadBDT app
Added Who-Is to Makefile for individual app build
Fixed debugging code blocks projects by swapping bip.c for h_bbmd.c module.
Ported BACnet/IPv4 to refactored BVLC for Linux, BSD, Windows
Fix datalink debug for DLENV module
Improve BIPv4 linux driver debug info
Added BDT mask functions
Reduce debug info clutter in Who-Is app by using environment option
Fix TTL seconds upper bounds addition
Fix CIDR prefix calculation on Linux BIPv4.
Convert BSD BIPv4 to BVLCv4
Fix CMake build for BIPv4 (Linux, BSD, Windows)
Added [U]nsigned to 0xBAC0 constants
Cleanup POSIX and Win32 API sockets
Remove unnecessary file scope variable initialization
Fix routed NPDU to depend on datalink; fix warning
Remove OS dependent network code from gateway
Enable BBMD client in library by default
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
Co-authored-by: Steve Karg <steve.karg@legrand.us>
This commit is contained in:
Steve Karg
2020-04-04 11:31:54 -05:00
committed by GitHub
parent 0ce6368b43
commit eedfa58a55
51 changed files with 7178 additions and 2978 deletions
+11 -7
View File
@@ -44,7 +44,7 @@
/** @file bip.c Configuration and Operations for BACnet/IP */
/* port to use - stored in network byte order */
static uint16_t BIP_Port = 0xBAC0;
static uint16_t BIP_Port = 0xBAC0U;
static bool BIP_Port_Changed;
/* IP Address - stored in network byte order */
static struct in_addr BIP_Address;
@@ -102,13 +102,17 @@ uint32_t bip_get_broadcast_addr(
return BIP_Broadcast_Address.s_addr;
}
/**
* @brief Set the BACnet IPv4 UDP port number
* @param port - IPv4 UDP port number - in host byte order
*/
void bip_set_port(
uint16_t port)
{ /* in network byte order */
if (BIP_Port != port) {
{
if (BIP_Port != htons(port)) {
BIP_Port_Changed = true;
BIP_Port = port;
}
BIP_Port = htons(port);
}
}
bool bip_port_changed(void)
@@ -116,11 +120,11 @@ bool bip_port_changed(void)
return BIP_Port_Changed;
}
/* returns network byte order */
/* returns host byte order */
uint16_t bip_get_port(
void)
{
return BIP_Port;
return ntohs(BIP_Port);
}
static void bip_mac_to_addr(