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>
This commit is contained in:
Steve Karg
2022-06-01 15:42:50 -05:00
committed by GitHub
parent 810bfefb34
commit f147283293
76 changed files with 3474 additions and 2791 deletions
+2
View File
@@ -81,6 +81,7 @@ CORESRC = $(BACNET_CORE)/abort.c \
$(BACNET_CORE)/bacaddr.c \
$(BACNET_CORE)/bacapp.c \
$(BACNET_CORE)/bacdcode.c \
$(BACNET_CORE)/bacdevobjpropref.c \
$(BACNET_CORE)/bacerror.c \
$(BACNET_CORE)/bacint.c \
$(BACNET_CORE)/bacreal.c \
@@ -90,6 +91,7 @@ CORESRC = $(BACNET_CORE)/abort.c \
$(BACNET_CORE)/dcc.c \
$(BACNET_CORE)/iam.c \
$(BACNET_CORE)/ihave.c \
$(BACNET_CORE)/hostnport.c \
$(BACNET_CORE)/lighting.c \
$(BACNET_CORE)/memcopy.c \
$(BACNET_CORE)/npdu.c \
+1204 -1105
View File
File diff suppressed because it is too large Load Diff
+8
View File
@@ -359,6 +359,10 @@
<SubType>compile</SubType>
<Link>BACnet Core\bacdcode.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacdevobjpropref.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacdevobjpropref.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacerror.c">
<SubType>compile</SubType>
<Link>BACnet Core\bacerror.c</Link>
@@ -395,6 +399,10 @@
<SubType>compile</SubType>
<Link>BACnet Core\ihave.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\hostnport.c">
<SubType>compile</SubType>
<Link>BACnet Core\hostnport.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\lighting.c">
<SubType>compile</SubType>
<Link>BACnet Core\lighting.c</Link>
+3
View File
@@ -4442,6 +4442,9 @@
<file>
<name>$PROJ_DIR$\mstimer-init.c</name>
</file>
<file>
<name>$PROJ_DIR$\netport.c</name>
</file>
<file>
<name>$PROJ_DIR$\rs485.c</name>
</file>
+1
View File
@@ -38,6 +38,7 @@ Goto lib/stack and copy the requested files from Steve code :
h_whois.c
h_wp.c
iam.c
hostnport.c
lighting.c
memcopy.c
noserv.c
@@ -1,8 +1,6 @@
#
#Mon May 30 09:47:38 CDT 2016
default.com-microchip-mplab-nbide-toolchainC18-C18LanguageToolchain.md5=21ae92f54c0f89bc027339aedc19b7f9
default.languagetoolchain.dir=C\:\\Program Files (x86)\\Microchip\\mplabc18\\v3.40\\bin
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=ef199adcc8f049579a105cca20571dcb
default.languagetoolchain.version=3.40
host.platform=windows
conf.ids=default
#Sun Aug 22 10:50:21 CDT 2021
configurations-xml=76d5fe9d80d284cbe317219a22001b30
com-microchip-mplab-nbide-embedded-makeproject-MakeProject.md5=9db8f8a224aa17d0023ea7f468f871dc
host.platform=linux
conf.ids=
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<configurationDescriptor version="62">
<configurationDescriptor version="65">
<logicalFolder name="root" displayName="root" projectFiles="true">
<logicalFolder name="HeaderFiles"
displayName="Header Files"
@@ -94,15 +94,25 @@
<languageToolchainVersion>3.40</languageToolchainVersion>
<platform>3</platform>
</toolsSet>
<packs>
<pack name="PIC18Fxxxx_DFP" vendor="Microchip" version="1.2.26"/>
</packs>
<ScriptingSettings>
</ScriptingSettings>
<compileType>
<linkerTool>
<linkerLibItems>
</linkerLibItems>
</linkerTool>
<archiverTool>
</archiverTool>
<loading>
<useAlternateLoadableFile>false</useAlternateLoadableFile>
<parseOnProdLoad>false</parseOnProdLoad>
<alternateLoadableFile></alternateLoadableFile>
</loading>
<subordinates>
</subordinates>
</compileType>
<makeCustomizationType>
<makeCustomizationPreStepEnabled>false</makeCustomizationPreStepEnabled>
@@ -10,7 +10,20 @@
<cpp-extensions/>
<header-extensions>h</header-extensions>
<sourceEncoding>ISO-8859-1</sourceEncoding>
<asminc-extensions/>
<make-dep-projects/>
<sourceRootList>
<sourceRootElem>../</sourceRootElem>
</sourceRootList>
<confList>
<confElem>
<name>default</name>
<type>2</type>
</confElem>
</confList>
<formatting>
<project-formatting-style>false</project-formatting-style>
</formatting>
</data>
</configuration>
</project>
+2
View File
@@ -55,6 +55,7 @@ BACNET_SRC = \
$(BACNET_CORE)/bacaddr.c \
$(BACNET_CORE)/bacapp.c \
$(BACNET_CORE)/bacdcode.c \
$(BACNET_CORE)/bacdevobjpropref.c \
$(BACNET_CORE)/bacerror.c \
$(BACNET_CORE)/bacint.c \
$(BACNET_CORE)/bacreal.c \
@@ -63,6 +64,7 @@ BACNET_SRC = \
$(BACNET_CORE)/dcc.c \
$(BACNET_CORE)/iam.c \
$(BACNET_CORE)/ihave.c \
$(BACNET_CORE)/hostnport.c \
$(BACNET_CORE)/lighting.c \
$(BACNET_CORE)/memcopy.c \
$(BACNET_CORE)/npdu.c \
+6
View File
@@ -1057,6 +1057,9 @@
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\bacdcode.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\bacdevobjpropref.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\bacerror.c</name>
</file>
@@ -1078,6 +1081,9 @@
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\ihave.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\hostnport.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\lighting.c</name>
</file>
+2
View File
@@ -53,6 +53,7 @@ BACNET_SRC = \
$(BACNET_CORE)/bacaddr.c \
$(BACNET_CORE)/bacapp.c \
$(BACNET_CORE)/bacdcode.c \
$(BACNET_CORE)/bacdevobjpropref.c \
$(BACNET_CORE)/bacerror.c \
$(BACNET_CORE)/bacint.c \
$(BACNET_CORE)/bacreal.c \
@@ -61,6 +62,7 @@ BACNET_SRC = \
$(BACNET_CORE)/dcc.c \
$(BACNET_CORE)/iam.c \
$(BACNET_CORE)/ihave.c \
$(BACNET_CORE)/hostnport.c \
$(BACNET_CORE)/lighting.c \
$(BACNET_CORE)/memcopy.c \
$(BACNET_CORE)/npdu.c \
+3
View File
@@ -1090,6 +1090,9 @@
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\ihave.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\hostnport.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\src\bacnet\lighting.c</name>
</file>
@@ -198,6 +198,7 @@
<ClCompile Include="..\..\..\..\src\bacnet\indtext.c" />
<ClCompile Include="..\..\..\..\src\bacnet\basic\sys\key.c" />
<ClCompile Include="..\..\..\..\src\bacnet\basic\sys\keylist.c" />
<ClCompile Include="..\..\..\..\src\bacnet\hostnport.c" />
<ClCompile Include="..\..\..\..\src\bacnet\lighting.c" />
<ClCompile Include="..\..\..\..\src\bacnet\lso.c" />
<ClCompile Include="..\..\..\..\src\bacnet\memcopy.c" />
@@ -90,6 +90,9 @@
<ClCompile Include="..\..\..\..\src\bacnet\indtext.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\bacnet\hostnport.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\src\bacnet\lighting.c">
<Filter>Source Files</Filter>
</ClCompile>
+8
View File
@@ -586,6 +586,10 @@
<None Include="ASF\common\drivers\nvm\common_nvm.h">
<SubType>compile</SubType>
</None>
<Compile Include="..\..\src\bacnet\hostnport.c">
<SubType>compile</SubType>
<Link>bacnet-stack\hostnport.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\lighting.c">
<SubType>compile</SubType>
<Link>bacnet-stack\lighting.c</Link>
@@ -768,6 +772,10 @@
<SubType>compile</SubType>
<Link>bacnet-stack\bacdcode.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacdevobjpropref.c">
<SubType>compile</SubType>
<Link>bacnet-stack\bacdevobjpropref.c</Link>
</Compile>
<Compile Include="..\..\src\bacnet\bacerror.c">
<SubType>compile</SubType>
<Link>bacnet-stack\bacerror.c</Link>
+1 -1
View File
@@ -166,7 +166,7 @@ bool bacnet_name_write_unique(uint16_t offset,
bool status = false;
size_t length = 0;
uint8_t encoding = 0;
int duplicate_type = 0;
BACNET_OBJECT_TYPE duplicate_type = 0;
uint32_t duplicate_instance = 0;
length = characterstring_length(char_string);