* ci: Fix compile warning as errors was not correct
We want to enable warning as errors both Windows and Linux. This is
easiest to do with cmake option as -Werror does not work with MSVC. Also
it is self explaining what it does so no comment needed.
* dlmstp_linux: Fix -Wdeclaration-after-statement compiler warnings
Make dlmstp_linux C89/C90 combatible
```
/bacnet-stack/ports/linux/dlmstp_linux.c: In function ‘Timer_Silence’:
/bacnet-stack/ports/linux/dlmstp_linux.c:56:5: warning:
ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
56 | int32_t res;
| ^~~~~~~
/bacnet-stack/ports/linux/dlmstp_linux.c: In function ‘dlmstp_init’:
/bacnet-stack/ports/linux/dlmstp_linux.c:795:5: warning:
ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
795 | struct termios newtio;
| ^~~~~~
```
* Fix warnings produces by MSVC
Now that we have enabled /Wall for MSVC we get some warnings with it
which can be easily fixed.
We get following warnings:
```
src\bacnet\bacstr.c(223,39): warning C4127: conditional expression is constant
apps\router-mstp\main.c(1123,1): warning C4702: unreachable code
apps\epics\main.c(885,53): warning C4459: declaration of 'myState' hides global declaration
```
* cmake: Use /Wall with MSVC
Make MSVC to build cleanly with Wall. This might matter for some Windows
developers. And you never know if MSVC will find more bugs.
* cmake: Improve router build
Router build gives some warnings as it is not C90 compatible. It is ok
that example is not following C90 rules. Also it is annoing to new user
to build this cmake as first error usually is that libconfig is not
found. Let's just give warning about this so first build will usually go
smoother.
---------
Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
* 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
* Added dependent BACnet stack headers into bacdef.h file.
* Changed bacdef.h and other stack includes in c/h files to have a common pattern.
* Moved bits.h, bytes.h, and bacnet_stack_exports.h under bacnet/basic/sys/ folder.
* Fix routing to a remote network in the router-mstp example.
The net, len and adr fields of remote_dest are not initialized
although they are used by the npdu_encode_pdu function in
case of "Routing to another Router". Thank you, Eugene!
* Fixed handling of received MS/TP extended frames.
mstp_port->DataLength should be set to the actual length of decoded data.
* Fix MSTP_Master_Node_FSM and MSTP_Slave_Node_FSM for extended frames.
BACNET_EXTENDED_DATA frames should be treated the same as
their corresponding BACNET_DATA frames.
* Fixed MSTP COBS frame encoding
cobs_frame_encode writes the encoded data to the
beginning of the buffer, overwriting the frame header.
The frame header is constructed before COBS frame encoding,
so it contains the wrong Frame Type and Data Length.
* Added extended frame client unit test
* Fix router-ipv6 application for remote networks
* added or updated secure the BACnet primitive value decoders - the core codecs - named bacnet_x_decode(), bacnet_x_application_decode() and bacnet_x_context_decode where x is one of the 13 BACnet primitive value names. The updated API includes an APDU size to prevent over-reading of an APDU buffer while decoding. Improved or added unit test code coverage for the BACnet primitive value decoders.
* marked the insecure decoding API as 'deprecated' which is defined in src/bacnet/basic/sys/platform.h and can be disabled during a build.
* added secure decoders for BACnetTimeValue, BACnetHostNPort, BACnetTimeStamp, BACnetAddress, and Weekly_Schedule and improved unit test code coverage.
* improved test code coverage for BACnet objects and properties.
* secured AtomicReadFile and AtomicWriteFile service decoders and improved unit test code coverage.
* secured BACnet Error service decoder and improved unit test code coverage.
---------
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>