diff --git a/bacnet-stack/arf.h b/bacnet-stack/arf.h index cee8e75a..ab75ffee 100644 --- a/bacnet-stack/arf.h +++ b/bacnet-stack/arf.h @@ -48,14 +48,14 @@ typedef struct BACnet_Atomic_Read_File_Data { struct { - int fileStartPosition; - unsigned requestedOctetCount; + int32_t fileStartPosition; + uint32_t requestedOctetCount; } stream; struct { - int fileStartRecord; + int32_t fileStartRecord; // requested or returned record count - unsigned RecordCount; + uint32_t RecordCount; } record; } type; BACNET_OCTET_STRING fileData; diff --git a/bacnet-stack/awf.h b/bacnet-stack/awf.h index ec9cbfc7..136e703d 100644 --- a/bacnet-stack/awf.h +++ b/bacnet-stack/awf.h @@ -47,12 +47,12 @@ typedef struct BACnet_Atomic_Write_File_Data { struct { - int fileStartPosition; + int32_t fileStartPosition; } stream; struct { - int fileStartRecord; - unsigned returnedRecordCount; + int32_t fileStartRecord; + uint32_t returnedRecordCount; } record; } type; BACNET_OCTET_STRING fileData; diff --git a/bacnet-stack/bacapp.h b/bacnet-stack/bacapp.h index f7ba8fdc..5bb589ad 100644 --- a/bacnet-stack/bacapp.h +++ b/bacnet-stack/bacapp.h @@ -46,8 +46,8 @@ typedef struct BACnet_Application_Data_Value { /* NULL - not needed as it is encoded in the tag alone */ bool Boolean; - unsigned Unsigned_Int; - int Signed_Int; + uint32_t Unsigned_Int; + int32_t Signed_Int; float Real; double Double; BACNET_OCTET_STRING Octet_String; diff --git a/bacnet-stack/bacdcode.c b/bacnet-stack/bacdcode.c index 519ca6d2..8c7c985c 100644 --- a/bacnet-stack/bacdcode.c +++ b/bacnet-stack/bacdcode.c @@ -1110,10 +1110,10 @@ int encode_bacnet_unsigned(uint8_t * apdu, uint32_t value) int len = 0; // return value if (value < 0x100) { - apdu[0] = value; + apdu[0] = (uint8_t)value; len = 1; } else if (value < 0x10000) { - len = encode_unsigned16(&apdu[0],value); + len = encode_unsigned16(&apdu[0],(uint16_t)value); } else if (value < 0x1000000) { len = encode_unsigned24(&apdu[0],value); } else { @@ -1187,7 +1187,7 @@ int decode_unsigned(uint8_t * apdu, uint32_t len_value, uint32_t *value) // returns the number of apdu bytes consumed int decode_enumerated(uint8_t * apdu, uint32_t len_value, int *value) { - unsigned unsigned_value = 0; + uint32_t unsigned_value = 0; int len; len = decode_unsigned(apdu, len_value, &unsigned_value); @@ -1280,9 +1280,9 @@ int encode_bacnet_signed(uint8_t * apdu, int32_t value) octet is 0, and the first octet shall not be X'FF' if the most significant bit of the second octet is 1. */ if ((value >= -128) && (value < 128)) { - len = encode_signed8(&apdu[0],value); + len = encode_signed8(&apdu[0],(int8_t)value); } else if ((value >= -32768) && (value < 32768)) { - len = encode_signed16(&apdu[0],value); + len = encode_signed16(&apdu[0],(int16_t)value); } else if ((value > -8388608) && (value < 8388608)) { len = encode_signed24(&apdu[0],value); } else { diff --git a/bacnet-stack/demo/handler/h_arf.c b/bacnet-stack/demo/handler/h_arf.c index c71feb2b..8cb28c06 100644 --- a/bacnet-stack/demo/handler/h_arf.c +++ b/bacnet-stack/demo/handler/h_arf.c @@ -34,14 +34,12 @@ #include "apdu.h" #include "npdu.h" #include "abort.h" -#include "rp.h" +#include "arf.h" /* demo objects */ #include "device.h" #include "ai.h" #include "ao.h" -#if BACFILE #include "bacfile.h" -#endif void handler_atomic_read_file( uint8_t *service_request, diff --git a/bacnet-stack/demo/handler/h_iam.c b/bacnet-stack/demo/handler/h_iam.c index 559d5208..d3eedb4e 100644 --- a/bacnet-stack/demo/handler/h_iam.c +++ b/bacnet-stack/demo/handler/h_iam.c @@ -24,6 +24,7 @@ *********************************************************************/ #include #include +#include #include "config.h" #include "txbuf.h" #include "bacdef.h" diff --git a/bacnet-stack/demo/handler/h_wp.c b/bacnet-stack/demo/handler/h_wp.c index ef4103ec..e04c0601 100644 --- a/bacnet-stack/demo/handler/h_wp.c +++ b/bacnet-stack/demo/handler/h_wp.c @@ -43,8 +43,6 @@ #include "bacfile.h" #endif -static uint8_t Temp_Buf[MAX_APDU] = {0}; - void handler_write_property( uint8_t *service_request, uint16_t service_len, diff --git a/bacnet-stack/demo/handler/s_rp.c b/bacnet-stack/demo/handler/s_rp.c index d15224ef..daa63b0f 100644 --- a/bacnet-stack/demo/handler/s_rp.c +++ b/bacnet-stack/demo/handler/s_rp.c @@ -24,6 +24,7 @@ *********************************************************************/ #include #include +#include #include "config.h" #include "config.h" #include "txbuf.h" diff --git a/bacnet-stack/demo/handler/s_whois.c b/bacnet-stack/demo/handler/s_whois.c index 00c7102a..0f661d26 100644 --- a/bacnet-stack/demo/handler/s_whois.c +++ b/bacnet-stack/demo/handler/s_whois.c @@ -24,6 +24,7 @@ *********************************************************************/ #include #include +#include #include "config.h" #include "config.h" #include "txbuf.h" diff --git a/bacnet-stack/demo/handler/s_wp.c b/bacnet-stack/demo/handler/s_wp.c index 7316b161..8327b1b3 100644 --- a/bacnet-stack/demo/handler/s_wp.c +++ b/bacnet-stack/demo/handler/s_wp.c @@ -24,6 +24,7 @@ *********************************************************************/ #include #include +#include #include "config.h" #include "config.h" #include "txbuf.h" diff --git a/bacnet-stack/demo/object/device.c b/bacnet-stack/demo/object/device.c index 0165ac78..ba5c4a65 100644 --- a/bacnet-stack/demo/object/device.c +++ b/bacnet-stack/demo/object/device.c @@ -608,7 +608,8 @@ bool Device_Write_Property( case PROP_NUMBER_OF_APDU_RETRIES: if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { - Device_Set_Number_Of_APDU_Retries(wp_data->value.type.Unsigned_Int); + /* FIXME: bounds check? */ + Device_Set_Number_Of_APDU_Retries((uint8_t)wp_data->value.type.Unsigned_Int); status = true; } else @@ -621,7 +622,8 @@ bool Device_Write_Property( case PROP_APDU_TIMEOUT: if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { - Device_Set_APDU_Timeout(wp_data->value.type.Unsigned_Int); + /* FIXME: bounds check? */ + Device_Set_APDU_Timeout((uint16_t)wp_data->value.type.Unsigned_Int); status = true; } else @@ -634,7 +636,8 @@ bool Device_Write_Property( case PROP_VENDOR_IDENTIFIER: if (wp_data->value.tag == BACNET_APPLICATION_TAG_UNSIGNED_INT) { - Device_Set_Vendor_Identifier(wp_data->value.type.Unsigned_Int); + /* FIXME: bounds check? */ + Device_Set_Vendor_Identifier((uint16_t)wp_data->value.type.Unsigned_Int); status = true; } else diff --git a/bacnet-stack/demo/readfile/readfile.c b/bacnet-stack/demo/readfile/readfile.c index d930af5e..b0a98b94 100644 --- a/bacnet-stack/demo/readfile/readfile.c +++ b/bacnet-stack/demo/readfile/readfile.c @@ -27,7 +27,9 @@ #include #include #include +#include #include /* for time */ +#include #include "bactext.h" #include "iam.h" #include "arf.h" diff --git a/bacnet-stack/demo/readfile/readfile.ide b/bacnet-stack/demo/readfile/readfile.ide index 3d7b8ff4..2a179c9e 100644 Binary files a/bacnet-stack/demo/readfile/readfile.ide and b/bacnet-stack/demo/readfile/readfile.ide differ diff --git a/bacnet-stack/iam.c b/bacnet-stack/iam.c index d0b61fb1..cfa0f67b 100755 --- a/bacnet-stack/iam.c +++ b/bacnet-stack/iam.c @@ -90,7 +90,7 @@ int iam_decode_service_request( uint32_t object_instance = 0; uint8_t tag_number = 0; uint32_t len_value = 0; - unsigned int decoded_value = 0; + uint32_t decoded_value = 0; int decoded_integer = 0; // OBJECT ID - object id @@ -134,7 +134,7 @@ int iam_decode_service_request( if (decoded_value > 0xFFFF) return -1; if (pVendor_id) - *pVendor_id = decoded_value; + *pVendor_id = (uint16_t)decoded_value; return apdu_len; } diff --git a/bacnet-stack/ports/win32/bacnet.ide b/bacnet-stack/ports/win32/bacnet.ide index bd48e09a..dd35334a 100644 Binary files a/bacnet-stack/ports/win32/bacnet.ide and b/bacnet-stack/ports/win32/bacnet.ide differ diff --git a/bacnet-stack/ports/win32/bacnet/bacnet.dsp b/bacnet-stack/ports/win32/bacnet/bacnet.dsp index 1bf337b8..2a99065f 100644 --- a/bacnet-stack/ports/win32/bacnet/bacnet.dsp +++ b/bacnet-stack/ports/win32/bacnet/bacnet.dsp @@ -42,7 +42,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /I "c:\code\bacnet-stack\demo\object\\" /I "c:\code\bacnet-stack\demo\handler\\" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "BACDL_BIP" /FD /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" @@ -67,7 +67,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /I "c:\code\bacnet-stack\demo\object" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "BACDL_BIP" /FR /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "c:\code\bacnet-stack\demo\object" /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /I "c:\code\bacnet-stack\demo\object\\" /I "c:\code\bacnet-stack\demo\handler\\" /D "_DEBUG" /D "BACDL_BIP" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" @@ -161,7 +161,31 @@ SOURCE=..\..\..\demo\object\device.c # End Source File # Begin Source File -SOURCE=..\..\..\handlers.c +SOURCE=..\..\..\demo\handler\h_arf.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\demo\handler\h_arf_a.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\demo\handler\h_iam.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\demo\handler\h_rp.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\demo\handler\h_rp_a.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\demo\handler\h_whois.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\demo\handler\h_wp.c # End Source File # Begin Source File @@ -177,6 +201,10 @@ SOURCE=..\main.c # End Source File # Begin Source File +SOURCE=..\..\..\demo\handler\noserv.c +# End Source File +# Begin Source File + SOURCE=..\..\..\npdu.c # End Source File # Begin Source File @@ -193,10 +221,26 @@ SOURCE=..\..\..\rp.c # End Source File # Begin Source File +SOURCE=..\..\..\demo\handler\s_rp.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\demo\handler\s_whois.c +# End Source File +# Begin Source File + +SOURCE=..\..\..\demo\handler\s_wp.c +# End Source File +# Begin Source File + SOURCE=..\..\..\tsm.c # End Source File # Begin Source File +SOURCE=..\..\..\demo\handler\txbuf.c +# End Source File +# Begin Source File + SOURCE=..\..\..\whois.c # End Source File # Begin Source File diff --git a/bacnet-stack/ports/win32/bacnet/bacnet.ncb b/bacnet-stack/ports/win32/bacnet/bacnet.ncb index c01364cf..af86a066 100644 Binary files a/bacnet-stack/ports/win32/bacnet/bacnet.ncb and b/bacnet-stack/ports/win32/bacnet/bacnet.ncb differ diff --git a/bacnet-stack/ports/win32/bacnet/bacnet.opt b/bacnet-stack/ports/win32/bacnet/bacnet.opt index 099ee63f..aa9fe807 100644 Binary files a/bacnet-stack/ports/win32/bacnet/bacnet.opt and b/bacnet-stack/ports/win32/bacnet/bacnet.opt differ diff --git a/bacnet-stack/ports/win32/bacnet/bacnet.plg b/bacnet-stack/ports/win32/bacnet/bacnet.plg index bac923d2..8366d25f 100644 --- a/bacnet-stack/ports/win32/bacnet/bacnet.plg +++ b/bacnet-stack/ports/win32/bacnet/bacnet.plg @@ -8,36 +8,8 @@

Command Lines

Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58A.tmp" with contents [ -/nologo /MLd /W3 /Gm /GX /ZI /Od /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /I "c:\code\bacnet-stack\demo\object" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "BACDL_BIP" /FR"Debug/" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c -"C:\code\bacnet-stack\abort.c" -"C:\code\bacnet-stack\address.c" -"C:\code\bacnet-stack\apdu.c" -"C:\code\bacnet-stack\arf.c" -"C:\code\bacnet-stack\bacapp.c" -"C:\code\bacnet-stack\bacdcode.c" -"C:\code\bacnet-stack\bacerror.c" -"C:\code\bacnet-stack\bacstr.c" -"C:\code\bacnet-stack\bactext.c" -"C:\code\bacnet-stack\bigend.c" -"C:\code\bacnet-stack\ports\win32\bip-init.c" -"C:\code\bacnet-stack\bip.c" -"C:\code\bacnet-stack\crc.c" -"C:\code\bacnet-stack\datalink.c" -"C:\code\bacnet-stack\handlers.c" -"C:\code\bacnet-stack\iam.c" -"C:\code\bacnet-stack\indtext.c" +/nologo /MLd /W3 /Gm /GX /ZI /Od /I "c:\code\bacnet-stack\demo\object" /I "c:\code\bacnet-stack\\" /I "c:\code\bacnet-stack\ports\win32\\" /I "c:\code\bacnet-stack\demo\object\\" /I "c:\code\bacnet-stack\demo\handler\\" /D "_DEBUG" /D "BACDL_BIP" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR"Debug/" /Fo"Debug/" /Fd"Debug/" /FD /GZ /c "C:\code\bacnet-stack\ports\win32\main.c" -"C:\code\bacnet-stack\npdu.c" -"C:\code\bacnet-stack\reject.c" -"C:\code\bacnet-stack\ringbuf.c" -"C:\code\bacnet-stack\rp.c" -"C:\code\bacnet-stack\tsm.c" -"C:\code\bacnet-stack\whois.c" -"C:\code\bacnet-stack\wp.c" -"C:\code\bacnet-stack\demo\object\device.c" -"C:\code\bacnet-stack\demo\object\ai.c" -"C:\code\bacnet-stack\demo\object\ao.c" -"C:\code\bacnet-stack\demo\object\bacfile.c" ] Creating command line "cl.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58A.tmp" Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58B.tmp" with contents @@ -45,11 +17,14 @@ Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58B.tmp" with conten kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/bacnet.pdb" /debug /machine:I386 /out:"Debug/bacnet.exe" /pdbtype:sept ".\Debug\abort.obj" ".\Debug\address.obj" +".\Debug\ai.obj" +".\Debug\ao.obj" ".\Debug\apdu.obj" ".\Debug\arf.obj" ".\Debug\bacapp.obj" ".\Debug\bacdcode.obj" ".\Debug\bacerror.obj" +".\Debug\bacfile.obj" ".\Debug\bacstr.obj" ".\Debug\bactext.obj" ".\Debug\bigend.obj" @@ -57,7 +32,7 @@ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32 ".\Debug\bip.obj" ".\Debug\crc.obj" ".\Debug\datalink.obj" -".\Debug\handlers.obj" +".\Debug\device.obj" ".\Debug\iam.obj" ".\Debug\indtext.obj" ".\Debug\main.obj" @@ -68,69 +43,39 @@ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32 ".\Debug\tsm.obj" ".\Debug\whois.obj" ".\Debug\wp.obj" -".\Debug\device.obj" -".\Debug\ai.obj" -".\Debug\ao.obj" -".\Debug\bacfile.obj" +".\Debug\s_rp.obj" +".\Debug\s_whois.obj" +".\Debug\s_wp.obj" +".\Debug\txbuf.obj" +".\Debug\h_arf.obj" +".\Debug\h_arf_a.obj" +".\Debug\h_iam.obj" +".\Debug\h_rp.obj" +".\Debug\h_rp_a.obj" +".\Debug\h_whois.obj" +".\Debug\h_wp.obj" +".\Debug\noserv.obj" ] Creating command line "link.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58B.tmp"

Output Window

Compiling... -abort.c -address.c -apdu.c -arf.c -bacapp.c -bacdcode.c -bacerror.c -bacstr.c -bactext.c -bigend.c -bip-init.c -bip.c -crc.c -datalink.c -handlers.c -iam.c -indtext.c main.c c:\code\bacnet-stack\ports\win32\net.h(30) : warning C4005: 'STRICT' : macro redefinition c:\program files\microsoft visual studio\vc98\include\windef.h(15) : see previous definition of 'STRICT' -npdu.c -reject.c -Generating Code... -c:\code\bacnet-stack\npdu.c(332) : warning C4761: integral size mismatch in argument; conversion supplied -c:\code\bacnet-stack\handlers.c(194) : warning C4761: integral size mismatch in argument; conversion supplied -c:\code\bacnet-stack\handlers.c(271) : warning C4761: integral size mismatch in argument; conversion supplied -Compiling... -ringbuf.c -rp.c -tsm.c -whois.c -wp.c -device.c -ai.c -c:\code\bacnet-stack\demo\object\ai.c(76) : warning C4305: 'initializing' : truncation from 'const double ' to 'float ' -ao.c -c:\code\bacnet-stack\demo\object\ao.c(157) : warning C4305: 'initializing' : truncation from 'const double ' to 'float ' -bacfile.c -Generating Code... -c:\code\bacnet-stack\demo\object\bacfile.c(285) : warning C4761: integral size mismatch in argument; conversion supplied -c:\code\bacnet-stack\demo\object\device.c(611) : warning C4761: integral size mismatch in argument; conversion supplied -c:\code\bacnet-stack\demo\object\device.c(624) : warning C4761: integral size mismatch in argument; conversion supplied -c:\code\bacnet-stack\demo\object\device.c(637) : warning C4761: integral size mismatch in argument; conversion supplied -c:\code\bacnet-stack\wp.c(129) : warning C4761: integral size mismatch in argument; conversion supplied Linking... -Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58D.tmp" with contents +Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58C.tmp" with contents [ /nologo /o"Debug/bacnet.bsc" ".\Debug\abort.sbr" ".\Debug\address.sbr" +".\Debug\ai.sbr" +".\Debug\ao.sbr" ".\Debug\apdu.sbr" ".\Debug\arf.sbr" ".\Debug\bacapp.sbr" ".\Debug\bacdcode.sbr" ".\Debug\bacerror.sbr" +".\Debug\bacfile.sbr" ".\Debug\bacstr.sbr" ".\Debug\bactext.sbr" ".\Debug\bigend.sbr" @@ -138,7 +83,7 @@ Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58D.tmp" with conten ".\Debug\bip.sbr" ".\Debug\crc.sbr" ".\Debug\datalink.sbr" -".\Debug\handlers.sbr" +".\Debug\device.sbr" ".\Debug\iam.sbr" ".\Debug\indtext.sbr" ".\Debug\main.sbr" @@ -149,18 +94,26 @@ Creating temporary file "C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58D.tmp" with conten ".\Debug\tsm.sbr" ".\Debug\whois.sbr" ".\Debug\wp.sbr" -".\Debug\device.sbr" -".\Debug\ai.sbr" -".\Debug\ao.sbr" -".\Debug\bacfile.sbr"] -Creating command line "bscmake.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58D.tmp" +".\Debug\s_rp.sbr" +".\Debug\s_whois.sbr" +".\Debug\s_wp.sbr" +".\Debug\txbuf.sbr" +".\Debug\h_arf.sbr" +".\Debug\h_arf_a.sbr" +".\Debug\h_iam.sbr" +".\Debug\h_rp.sbr" +".\Debug\h_rp_a.sbr" +".\Debug\h_whois.sbr" +".\Debug\h_wp.sbr" +".\Debug\noserv.sbr"] +Creating command line "bscmake.exe @C:\DOCUME~1\stk01\LOCALS~1\Temp\RSP58C.tmp" Creating browse info file...

Output Window

Results

-bacnet.exe - 0 error(s), 11 warning(s) +bacnet.exe - 0 error(s), 1 warning(s) diff --git a/bacnet-stack/ports/win32/bip-init.c b/bacnet-stack/ports/win32/bip-init.c index 5dc0d1e0..4a3180a4 100644 --- a/bacnet-stack/ports/win32/bip-init.c +++ b/bacnet-stack/ports/win32/bip-init.c @@ -85,6 +85,12 @@ static void cleanup(void) WSACleanup(); } +void bip_set_interface(char *ifname) +{ + (void)ifname; + /* dummy function */ +} + bool bip_init(void) { int rv = 0; // return from socket lib calls diff --git a/bacnet-stack/ports/win32/main.c b/bacnet-stack/ports/win32/main.c index c0c16f4d..6987b210 100644 --- a/bacnet-stack/ports/win32/main.c +++ b/bacnet-stack/ports/win32/main.c @@ -24,7 +24,7 @@ *********************************************************************/ // This is one way to use the embedded BACnet stack under Win32 -// compiled with Borland C++ 5.02 +// compiled with Borland C++ 5.02 or Visual C++ 6.0 #include #include #include @@ -38,10 +38,14 @@ #include "apdu.h" #include "device.h" #include "handlers.h" +#include "client.h" #include "datalink.h" +#include "txbuf.h" // buffer used for receive static uint8_t Rx_Buf[MAX_MPDU] = {0}; +/* send a whois to see who is on the network */ +static bool Who_Is_Request = true; static void Read_Properties(void) { @@ -164,7 +168,7 @@ static void Init_Service_Handlers(void) // we need to handle who-is to support dynamic device binding apdu_set_unconfirmed_handler( SERVICE_UNCONFIRMED_WHO_IS, - WhoIsHandler); + handler_who_is); apdu_set_unconfirmed_handler( SERVICE_UNCONFIRMED_I_AM, LocalIAmHandler); @@ -172,18 +176,18 @@ static void Init_Service_Handlers(void) // set the handler for all the services we don't implement // It is required to send the proper reject message... apdu_set_unrecognized_service_handler_handler( - UnrecognizedServiceHandler); + handler_unrecognized_service); // we must implement read property - it's required! apdu_set_confirmed_handler( SERVICE_CONFIRMED_READ_PROPERTY, - ReadPropertyHandler); + handler_read_property); apdu_set_confirmed_handler( SERVICE_CONFIRMED_WRITE_PROPERTY, - WritePropertyHandler); + handler_write_property); // handle the data coming back from confirmed requests apdu_set_confirmed_ack_handler( SERVICE_CONFIRMED_READ_PROPERTY, - ReadPropertyAckHandler); + handler_read_property_ack); } static void print_address( @@ -274,11 +278,11 @@ int main(int argc, char *argv[]) if (I_Am_Request) { I_Am_Request = false; - Send_IAm(); + iam_send(&Handler_Transmit_Buffer[0]); } else if (Who_Is_Request) { Who_Is_Request = false; - Send_WhoIs(); + Send_WhoIs(-1,-1); } else { diff --git a/bacnet-stack/rp.c b/bacnet-stack/rp.c index 381a293e..e611a483 100644 --- a/bacnet-stack/rp.c +++ b/bacnet-stack/rp.c @@ -82,7 +82,7 @@ int rp_decode_service_request( uint32_t len_value_type = 0; int type = 0; // for decoding int property = 0; // for decoding - unsigned array_value = 0; // for decoding + uint32_t array_value = 0; // for decoding // check for value pointers if (apdu_len && data) @@ -198,7 +198,7 @@ int rp_ack_decode_service_request( int tag_len = 0; // length of tag decode int len = 0; // total length of decodes int object = 0, property = 0; // for decoding - unsigned array_value = 0; // for decoding + uint32_t array_value = 0; // for decoding // FIXME: check apdu_len against the len during decode // Tag 0: Object ID diff --git a/bacnet-stack/rpm.c b/bacnet-stack/rpm.c index 54eb385d..f661f32d 100644 --- a/bacnet-stack/rpm.c +++ b/bacnet-stack/rpm.c @@ -164,7 +164,7 @@ int rpm_decode_object_property( uint8_t tag_number = 0; uint32_t len_value_type = 0; int property = 0; /* for decoding */ - unsigned array_value = 0; /* for decoding */ + uint32_t array_value = 0; /* for decoding */ /* check for valid pointers */ if (apdu && apdu_len && object_property && array_index) @@ -396,7 +396,7 @@ int rpm_ack_decode_object_property( uint8_t tag_number = 0; uint32_t len_value_type = 0; int property = 0; /* for decoding */ - unsigned array_value = 0; /* for decoding */ + uint32_t array_value = 0; /* for decoding */ /* check for valid pointers */ if (apdu && apdu_len && object_property && array_index) diff --git a/bacnet-stack/whois.c b/bacnet-stack/whois.c index 5a18fa26..58537b03 100644 --- a/bacnet-stack/whois.c +++ b/bacnet-stack/whois.c @@ -79,7 +79,7 @@ int whois_decode_service_request( int len = 0; uint8_t tag_number = 0; uint32_t len_value = 0; - unsigned int decoded_value = 0; + uint32_t decoded_value = 0; // optional limits - must be used as a pair if (apdu_len) diff --git a/bacnet-stack/wp.c b/bacnet-stack/wp.c index 46f644ed..8582212b 100644 --- a/bacnet-stack/wp.c +++ b/bacnet-stack/wp.c @@ -88,7 +88,7 @@ int wp_decode_service_request( uint32_t len_value_type = 0; int type = 0; // for decoding int property = 0; // for decoding - unsigned unsigned_value = 0; + uint32_t unsigned_value = 0; // check for value pointers if (apdu_len && data) @@ -143,7 +143,8 @@ int wp_decode_service_request( { len += tag_len; len = decode_unsigned(&apdu[len], len_value_type, &unsigned_value); - data->priority = unsigned_value; + /* FIXME: bounds check */ + data->priority = (uint8_t)unsigned_value; } } }