Commit Graph

42 Commits

Author SHA1 Message Date
Steve Karg f641aacddb Bugfix/deprecate decode tag number and value (#481)
* 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>
2023-09-08 11:39:27 -05:00
anthony-crystalpeak fcc9647983 AFL + Libfuzzer harnesses (#455)
* Package fuzzers

* Provide ability to remove main

* Don't build fuzzers by default
2023-07-17 10:06:32 -05:00
Steve Karg ced9dff0f2 Added AddListElement and RemoveListElement services (#418)
* Added AddListElement and RemoveListElement services

Added list-element codec and unit tests.
Added BACnetDestination codec and unit tests.
Added RecipientList handling to NotificationClass object.
Added AddListElement and RemoveListElement client example app.

* Fix defects found by scan-build and CPPCHECK

* Update ports errors found during CI builds

* Update zephy os test build missing files in CMakeLists

---------

Co-authored-by: Ondřej Hruška <ondra@ondrovo.com>
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2023-04-16 14:12:11 -05:00
Steve Karg 64d1461549 fix spelling errors 2022-10-29 12:28:21 -05:00
Steve Karg 1f41341c09 Feature/what is network number handling (#304)
* Add What-Is-Network-Number handling.

Add What-Is-Network-Number and Network-Number-Is network layer handling.
Refactor npdu_encode_npdu_network() from router specific code.
Add unit test for NDPU network message
Add app for What-Is-Network-Number
Add app for Network-Number-Is
Add send helper for What-Is-Network-Number
Add send helper for Network-Number-Is

* added sys/debug.c to ports builds for use of debug_printf() in npdu handler.

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-07-14 15:34:45 -05:00
Steve Karg 38d213b47c Feature/color objects color command (#302)
* added BACnetColorCommand and BACnetxyColor encoding and unit testing

* Added Color object and unit testing.

* Added Color Temperature object and Unit test

* Fix BVLC unit test warning.

* add port Makefile for extra types

* added RGB to and from CIE xy utility in sys folder, and add unit tests.

* added cmake-win32 target

* Change RP and RPM to use known property decoder.

Add color object RP and RPM decoding and printing
Fix RPM print for new reserved range above 4194303
Change default protocol-revision to 24 for Color object

* Integrate Color and Color Temperature objects into demo apps

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-07-13 09:54:36 -05:00
Steve Karg f147283293 Feature/apdu null length returned (#285)
* Add APDU as NULL to get BACnet type lengths.

* Fix bacapp copy test to succeed

* fix BACnet REAL and DOUBLE decode

* Add unit test for NULL APDU encoding for length

* Add unit tests for bacapp context

* refactor host-n-port to hostnport.c module

* fix BVLC decoder

* additional unit testing for bacapp

* include bacdevobjpropref module in builds

* simplify bacapp snprintf to be able to return length

* adjust compiler for variable-length arrays

* fix bug found by scan-build

Authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-06-01 15:42:50 -05:00
Steve Karg 85d3b72b36 Update Makefile to fix scan-build race condition 2022-04-25 20:37:35 -05:00
Steve Karg c9d42d268e Bugfix/fix splint warnings (#250)
* Fix SPLINT to perform static defect analysis

Fix the SPLINT invocation in Makefile
Fix C files where SPLINT detected problems.
Remove UCIX check from SPLINT
Use SPLINT friendly parsing code disable for bacsec

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-04-12 13:00:29 -05:00
Steve Karg 12a5e48b3e Bugfix/btl mstp local broadcast discard (#248)
* Discard Confirmed PDU DNER on local broadcast. Discard DER on local broacast.

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-04-02 08:44:04 -05:00
Steve Karg 14e6ba3619 add splint Makefile target 2022-03-30 08:25:12 -05:00
Steve Karg 902949a192 update LwIP BACnet/IP abstraction (#246)
* update LwIP BACnet/IP abstraction. Integrate LwIP build with continuous integration.

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-03-29 17:47:44 -05:00
Steve Karg 5b07b484d4 Bugfix/cppcheck error code fixes (#244)
* Add flawfinder. Add error code for exit status.

* fix errors found by cppcheck

* fix initialization warning in unit test compile

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-03-28 10:29:52 -05:00
Steve Karg c3a4c229fe Issue 87 execute tests with GitHub ci (#234)
* Enable lcov coverage in unit testing via cmake.

* fix pipeline build error

* add compile options for unit test to silence some warnings

* remove all BAC_TEST unit tests in src/bacnet/ folder. They are now in test/bacnet/ folders using ztest.

* removed key.c - only used for unit test.

* produce XML test result output for parsing

* produce junit XML test result output

* change lint workflow to quality

* update readme badge for quality results

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-02-28 20:09:46 -06:00
Steve Karg d0fe77c030 Bugfix/clang tidy applied 2022 (#232)
* clang-tidy applied fixes to src folder
* clang-tidy applied fixes to apps folder

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-02-27 19:14:17 -06:00
Steve Karg 5e70eeecfc Issue 10 ci add support for code spelling checks (#231)
* added make targets spell and codespell for spelling checks

* fix spelling errors detected by codespell

* added codespell to github workflow

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-02-27 16:02:17 -06:00
Steve Karg 65c7425e0e Cleanup Makefile build on Win32 (#222)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-01-30 13:56:16 -06:00
Steve Karg 295f127c2b Feature/makefile add apps library (#218)
* add BACnet stack library at apps/lib

* convert apps to use apps/lib for smaller binary

* fix -DBACDL_ALL=1 build

* fix piface build

* datalink MAX_MPDU and MAX_HEADER cleanup

* add bip6 to git workflow

* fix system library dependency of BACnet library

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-01-29 15:55:40 -06:00
Greg Shue 8b8ef8f338 Issue 187 enable skipped ztest suites (#189)
* Fix some ztests that were skipped

* Expose bacapp_same_value()

* Fix bacapp, ptransfer tests

* Fix bugs in Load_Control object & tests

* refactor days functions from datetime module

* fix legacy ctests

* Add bacnet/basic/sys/days.[ch] to Zephyr build

* Update ztest to match from Zephyr v2.6.0; update ringbuf, datetime to build

* Fixup ztest test for object/acc

* Fix bvlc_address_from_ascii; enable/fix bvlc test

* Comment cleanup

* test/bacnet/basic/object/lc partially enabled

* Fix bacapp_decode_data_len return status on erroneous input

* fix ztest include fatal error

* fix ztest strsignal reference fatal error

* fix zassert_mem_equal reference syntax error

* fix zassert_mem_equal reference syntax error

Co-authored-by: Gregory Shue <gregory.shue@legrand.us>
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-08-16 17:29:40 -05:00
Steve Karg 4b9e154256 Feature/mstp extended frames cobs encoding (#183)
* added COBS encode and decode from BACnet standard

* Add unit tests for COBS encoding and decoding

* Improve COBS unit test and API.

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-07-30 16:16:12 -05:00
Steve Karg 89d7af707e Fix FreeBSD 11 compile via gmake gcc (#180)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-06-12 19:27:29 -05:00
Steve Karg 4349e53203 Added cppcheck of BACnet source into pipeline (#171)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-05-21 09:00:57 -05:00
Steve Karg cea8c0e64c Added ethernet target for Makefile and Travis (#173)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-05-21 09:00:21 -05:00
Steve Karg a4fe367ac0 Added write BDT application (#170)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-04-23 13:46:21 -05:00
Steve Karg a7bc145c43 Feature/alarm ack application (#164)
* Added alarm-ack application

* fix error and simple ack handling for event notification

* Added ack-alarm application

* Update CMake for ack-alarm

* update example objects for alarm and events

* Allow repeated ack-alarm for same transition

* add event state API. Fix COV event state.

* add event state API to AV. Fix COV event state.

* Use event time for ack notification

* Enable notifications for all transitions by default. For testing.

* Use unconfirmed device notification to 4194303 for testing.

* initialize local vars

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-04-22 08:33:04 -05:00
Steve Karg 117db88ce6 Feature/confirmed event notification app (#153)
* Initial ConfirmedEventNotification app

* Fixed event argument processing

* Adjust event argument processing.

Move the common event arguments
Enable text lookup for some event arguments.

* Fix CMAKE for event app.

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-02-10 10:58:47 -06:00
Steve Karg 37abc561a8 Added stm32f4xx port to root Makefile (#138)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2020-11-06 11:31:48 -06:00
Steve Karg de7f7e9782 Feature/router mstp example app (#101)
* Ported router-ipv6 app to router-mstp

* Fixed router-ipv6 build

* Added router-ipv6 and router-mstp to pipeline

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2020-07-02 22:46:13 -05:00
Steve Karg fdd49f1791 Feature/make pretty apps and ports (#80)
* Added pretty-apps and pretty-ports make targets

* pretty-fied apps folder C files

* Pretty-fied ports folder C and H files

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2020-04-30 10:13:11 -05:00
Steve Karg d7918bb2ea Feature/add bbmd unit tests (#65)
* Added som BBMD IPv4 and IPv6 unit tests

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2020-04-11 22:58:07 -05:00
Steve Karg eedfa58a55 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>
2020-04-04 11:31:54 -05:00
Steve Karg cf24303128 add mstp targets into Makefile. Add mstp as stage in CI jobs. (#41)
* add mstp targets into Makefile. Add mstp as stage in CI jobs.
2020-02-02 10:02:00 -06:00
Steve Karg 914f502cff Bugfix/add makefile lint fix warnings (#39)
* fix warnings indicated by scan-build lint tool

* add lint target to makefile using scan-build tool

* add lint into build script stages (note: uses scan-build-7)

* fix potential use of memory after it is freed
2020-01-28 18:48:29 -06:00
Steve Karg 738ef825b0 Feature/port arm build check (#34)
* add GCC ARM compiler to travis pre-script and add some ARM ports to job
2020-01-19 19:43:50 -06:00
Steve Karg 63899e6606 Fix gateway app build (#22) 2020-01-15 08:02:15 -06:00
Steve Karg ed3f0982a3 Bug #61: add strict decoding for TimeSynchronization 2020-01-07 08:19:02 -06:00
Steve Karg d50c190957 Issue 2 move folders and use deep path include file names to prevent collisions (#4)
* moving folders and files and adjust server demo build

* Fix Makefile for apps/server on Linux

* fix unit test source file folders

* fix datetime convert UTC functions. Add Code::Blocks project for datetime testing

* added some ignore extensions

* disable parallel make option

* fix build for abort, dcc, and epics apps

* fix build for dcc, epics, error, and getevent apps.

* Fixed building of all apps

* fix the ipv4 to ipv6 router app build

* Change indent style from Google to Webkit

* make pretty to re-format style

* removed common Makefile since we already had one and two was too many

* remove scripts from root folder that are no longer maintained or used

* remove mercurial EOL and ignore files for git repo

* remove .vscodeconfig files from repo

* tweak clang-format style

* clang-format src and apps with tweaked style

* added clang-tidy to fix readability if braces in src

* result of make tidy for src and apps

* fix clang-tidy mangling

* Added code::blocks project for BACnet server simulation

* added code::blocks linux project for WhoIs app

* update text files for EOL

* fix EOL in some files

* fixed make win32 apps for older gcc

* Removed Borland C++ Makefile in apps. Unable to maintain support for Borland C++ compiler.

* created codeblocks project for apps/epics for Windows

* fixing ports/xplained to work with new data structure.

* fix ports/xplained example for Atmel Studio compile

* fix ports/stm32f10x example for gcc Makefile compile

* fix ports/stm32f10x example for IAR EWARM compile

* fix ports/xplained timer callback

* fix ports/bdk_atxx_mspt build with subdirs

* fix ports/bdk_atxx_mspt build with subdirs

* updated git ignore for IAR build artifacts

* updated gitignore for non-tracked files and folders

* fixed bdk-atxx4-mstp port for Rowley Crossworks project file

* fixed bdk-atxx4-mstp port for GCC AVR Makefile

* fixed atmega168 port for IAR AVR and GCC AVR Makefile

* fixed at91sam7s port for IAR ARM and GCC ARM Makefile

* removed unmaintainable DOS, RTOS32, and atmega8 ports.  Updated rx62n (untested).

* changed arm7 to uip port
2019-12-13 15:19:10 -06:00
Steve Karg da91a11454 added clang-format file and make pretty. Removed previous indent tools. 2019-10-24 16:22:16 -05:00
Steve Karg 1abc4d93b8 Fix make test. Undo CI change for parallel. 2019-10-19 15:27:12 -05:00
Steve Karg d465e9409b cleanup Makefile for test. Cleanup CI stages. 2019-10-19 14:52:31 -05:00
Steve Karg 8d109a51ba Encapsulate unit test Makefile for CI 2019-10-09 08:11:06 -05:00
Steve Karg a42e8f507c adjust root folder 2019-10-08 23:47:53 -05:00