Commit Graph

218 Commits

Author SHA1 Message Date
Steve Karg e517df0d47 Bugfix/bacnet array encoding overflows (#414)
* Add common BACnetARRAY encode function to fix Device object list buffer overflow. Refactor device, analog-output, access-door and binary-output objects to use common BACnetARRAY encoder.

* Fix non-POSIX builds (win32).

* Cleanup some ports/stm32 build warnings
---------

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2023-04-13 20:43:54 -05:00
Steve Karg e95aed9b93 Added UTC option to BACnet TimeSync app (#396)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2023-02-08 13:12:44 -06:00
Steve Karg 236c2d1003 refactor BACnet Address utility functions (#390)
* refactor BACnet Address utility functions

---------

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2023-02-04 08:46:31 -06:00
Steve Karg 85976ee1f8 Correct the length for bad data crc in mstpcap (#393)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2023-02-03 11:04:53 -06:00
Steve Karg 225ffb0d4c Cleanup gateway example Makefile build (#380)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2023-01-09 13:40:33 -06:00
Steve Karg b91735af13 Bugfix/code clean using gcc warnings (#371)
* Enable extra GCC warnings to discover subtle bugs

* convert c++ comments to c comments

* cleanup pedantic compiler warnings

* Compile apps with GNU89 GNU99 GNU11 and GNU17

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-12-25 21:43:51 -06:00
Kari Argillander 28644040e7 Fix: Use memmove with overlapping data (#361)
We should use memmove instead of memcpy when things can overlap. I was looking little bit whole repo and this got my eye.
2022-11-29 14:31:26 -06:00
Patrick Grimm 593f6ef8aa Fix apps/router/Makefile add CFALGS (#352) 2022-11-16 16:06:06 -06:00
Steve Karg d76cca3fbc Removed the extraneous file from source tree. Thanks pc2005cz! (#344)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-09-29 11:20:40 -05:00
Steve Karg cc4911a185 make pretty 2022-09-10 10:32:50 -05:00
Ondřej Hruška 7cdab61d72 Schedule encoding/decoding (#319)
* schedule: add decode_daily_schedule() and encode_daily_schedule()

* schedule: encode/decode implemented + add to bacapp

* add safe encode/decode functions for timevalue, schedule function renaming

* fix unit tests build failing

* add IDEA and test temporary files to .gitignore

* try to make "deprecated" work in MSVC

* add WeeklySchedule compare function

* add bacnet_weeklyschedule_context_decode()

* Add basic test for WeeklySchedule

* Fix WeeklySchedule parsing and snprintf, decoder verified with real hardware

* try to fix windows build

* improve boolean parsing in 'bacapp_parse_application_data'

* add parse function for weekly schedule

* allow types > 16 in bacwp, show the decoded value before sending

* add bacapp binaries to gitignore

* remove bacwp logging

* Add error checking to bacapp_parse_application_data

* try to fix windows build

* fix avr build

* Fix error handling in RP Ack

* add singleDay flag

* show day name in single day weeklyschedule snprintf

* show weeklyschedule inner tag in snprintf

* improve weeklyschedule parsing and printing, supports type names now

* add weekly schedule to bacapp_decode_data

* move bacnet/bacnet_plat_compat.h to bacnet/basic/sys/platform.h

* disable tag limit also in bacwpm

* add ifdef's around strtoX helper functions in bacapp

* move strtox to BACAPP_PRINT_ENABLED ifdef in bacapp

* fix stm32 makefiles

* fix at91sam7s build

* use BACNET_UNSIGNED_INTEGER in BACnet_Short_Application_Data_Value

* fix capitalization in BACnet_Daily_Schedule

* add name to BACNET_TIME_VALUE struct

* change bacwp bacwpm to use bacapp_known_property_tag()

* fix some macros in bacdcode missing parentheses

* Remove dummy fields from BACNET_SHORT_APPLICATION_DATA_VALUE, replace remaining uses of upcasting (adds extra overhead but is maybe safer), rename short DV to Primitive

* fix new ci warnings

* more fixes for ancient C

* fix tests no longer building

* primitive value renamed to shorter name
2022-09-05 09:27:15 -05:00
Steve Karg 0cff12214b Remove and fix old usage of MAX_HEADER (#331)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-08-25 09:53:10 -05:00
Steve Karg 95b487ea6f Bugfix/c89 compile fixes (#327)
* Fix code to be able to compile with older C89 ANSI compilers

* Convert C++ comments to C89 comments.

* default to std=gnu89

* Fix to enable CMake 3.1 to build on Centos7

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-08-23 13:37:32 -05:00
Steve Karg 9011ab0520 Fix CentOS7 build with GCC 4.8 by specifying C99 standard. (#325)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-08-22 23:38:21 -05:00
Steve Karg c8671d54f7 Fix warnings found by splint (#324)
* Fix warnings found by splint

* Ignore Win32 Builder warnings about possible data loss for integers.

* Fix Windows build warnings

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-08-17 23:23:26 -05:00
Steve Karg a945588340 Bugfix/print property name units lighting (#313)
* Fix EPICS property name proprietary range

* Fix Lighting Command decode length

* add function to determine property name and units proprietary range

* improve test coverage for AI, AO, AV, BI, BO, BV, LO

* refactor common property encoding to proplist module

* add decoder for priority array

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-07-29 17:11:38 -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 ff6fcf456c Feature/bacrpm dnet mac adr destinations (#295)
* add dnet,mac,adr for bacrpm explicit destinations

* add usage help to readpropm for dnet,mac,dadr

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-06-12 15:02:20 -05:00
Steve Karg 6a8adcce3d Feature/writepropertymultiple error handler (#289)
* Added extended BACnet Error PDU handling for WPM

* Added BACnetObjectPropertyReference to bacapp module.

* Added unit testing for BACnetObjectPropertyReference

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-06-03 15:47:30 -05:00
Steve Karg ba0cbc1fb8 Feature/bacnet server client app example (#273)
* Create example server-client for R/W polling application example.

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-05-16 15:02:17 -05:00
gducerf 0963f65fc5 Update main.c (#241)
Corrected a double free. rpm_data must be updated as in apps/readpropm/main.c.
2022-03-14 16:24:48 -05:00
Alexander Wells b787173a56 Various minor fixes/improvements (#239)
Includes:
- Making "rpm_data_free" a public method and using it where appropriate
  - Includes fixing memory leak in epics demo application
    (note Valgrind indicates that there are more...)
- Fix typo in cov.c
- Allow NULL max_apdu parameter to address_get_by_device
- Add missing include to s_cov.h
2022-03-10 15:29:10 -06:00
Steve Karg 728b17f11f revert clang-tidy sprintf integer changes for bactext results (#233)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-02-28 14:58:11 -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 65c7425e0e Cleanup Makefile build on Win32 (#222)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-01-30 13:56:16 -06:00
Patrick Grimm 6fa5c4085e Fixed uci compile errors (#220)
* Fixed UCI=1 compile ld: warning: directory not found for option \-L/usr/local/lib,-luci'

Signed-off-by: Patrick Grimm <patrick@lunatiki.de>

* Fixed bsd compile error ld: unknown option: --gc-sections

Signed-off-by: Patrick Grimm <patrick@lunatiki.de>

* Revert "Fixed bsd compile error ld: unknown option: --gc-sections"

This reverts commit e186e396dadb1875018de8b0e738c05b04c8f7d7.

* Fixed UCI=1 Undefined symbols "_ucix_init" for bacserv

Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
2022-01-29 18:23:28 -06:00
Patrick Grimm 3ddc851876 Fixed bsd compile error ld: unknown option: --gc-sections (#217)
Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
2022-01-29 16:08:47 -06:00
Patrick Grimm 5daa34dae3 Change uci device_init from src to apps. it is more maintainable. (#219)
* Change uci device_init from src/bacnet/basic/object/device to apps/server to make it more maintainable

Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
2022-01-29 16:08:08 -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
Steve Karg 9c72572692 Feature/bacnet time sync override (#215)
* add --time and --date options to command line time sync for override

* remove PRINT_ENABLED compile overreach

* fix bacstr.c for non-PRINT_ENABLED compile

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-01-20 16:42:47 -06:00
Steve Karg 8847d7eea1 Fixed BACDL=none build for makefile building (#213)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2022-01-12 09:10:00 -06:00
Steve Karg 36bd46c5e8 Modify WhoIs app to use APDU timeout between repeated WhoIs. Add --timeout option to bypass BACNET_APDU_TIMEOUT environment variable (#201)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-10-13 11:44:03 -05:00
Steve Karg 88a3921c5b Issue 188 compile failed when bbmd enabled 0 (#200)
* Fix compile for BBMD=none

* Add compile for BBMD=none to pipeline

* remove appveyor. add codeql badge

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-10-13 10:37:01 -05:00
Steve Karg 73bfda54ed Add --retry C option for repeating Who-Is or I-Am C number of times (#199)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-10-12 10:32:41 -05:00
Steve Karg eff691aedd Bugfix/codeql initial fixes (#195)
* Fix to BVLC6 bounds checking

* Convert MSTP capture to use datetime library

* Convert timesync app to use datetime and mstimer library

* fix workflow per warning

* fix BSD mstimer init function name

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-09-17 09:21:26 -05:00
Steve Karg 541f4024fb Bugfix/network port object bdt required (#184)
* Added BDT encoding to network port object.

* Added BDT encoding rules from clause 21

* Added FDT encoding to network port object.

* added more unit tests for BVLC

* Fix network port and device object unit tests

* fix router build for bvlc dependencies

* fix router build for bvlc dependencies

* fix network port MSTP compile

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
Co-authored-by: Steve Karg <steve.karg@legrand.us>
2021-08-03 09:55:01 -05:00
Steve Karg 810a2f93de Feature/write property type check refactor (#182)
* refactor write-property tag check

* modify ports objects to use write-property tag check API

* modify example objects to use write-property tag check API

* Fix object unit test builds

* Fix and run unit ztests via CMake

* Enable unit testing on Travis CI

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-06-23 10:10:12 -05:00
Steve Karg b38d975f35 Bugfix/compiler warning (#172)
* Fix compiler and static analysis warning

* revise to use for loop pattern

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-05-21 09:00:40 -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 7664b744d9 Fix the gateway example routing and lookups. Thanks, Sam! (#163)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2021-04-02 14:12:49 -05:00
Stephen Dawson-Haggerty adf66f412d Fixes Issue #157 (Router segfaults) (#159)
Found a number of problems with the router when compiling on linux

* Expected malloc()'ed memory to be zeroed resulting in segfault
* IPC_NOWAIT in iplayer loop means incoming traffic will be delayed until outgoing traffic is received.
* When configured with two BIP interfaces, broadcast loops ensue because the broacast traffic is not correctly filtered.  I think the safest thing to do here is to use the SO_BINDTODEVICE setsockopt.
2021-03-11 14:54:11 -06: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 4b1794f93a Fix atomic readfile app when file reports zero length (#133)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2020-10-10 10:45:34 -05:00
Steve Karg cbaa106c59 Ignore FF padding in mstpcap (#120)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2020-09-17 09:59:48 -05:00
Steve Karg a7b2e94cb7 Added repeat option to Who-Is and I-Am app (#117)
Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2020-09-03 22:03:10 -05:00
Steve Karg f41b5377cc Added UTF8 multibyte to wide char printing in some apps (#106)
* Added UTF8 multibyte to wide char printing in some apps

* Fix test compile

* Reduce diff churn

Co-authored-by: Steve Karg <skarg@users.sourceforge.net>
2020-07-27 22:44:43 -05: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
radolin be57c73508 Set name after call to Init_Service_Handlers(), as it calls Device_Init() from device.c which overwrites it to SimpleServer (#98) 2020-06-19 07:50:54 -05:00