1
0
mirror of https://github.com/stargieg/bacnet-stack synced 2025-10-26 23:35:52 +08:00
bacnet-stack/ports/linux
Steve Karg 17058b23b3 [r3137] Adds two new functions to the ring buffer implementation, one to walk the ring by getting a pointer to the next element in the ring, and the other to Pop (remove) a specified element from somewhere in the ring and then move any elements up towards the head to fill the gap left. With these new functions in place, the Linux MS/TP datalink MSTP_Get_Reply() has been updated to walk the ring buffer to try to find the matching reply. If it is found then it is processed in the same way as usual, and then removed from the ring.
When a packet is received which expects a reply a copy is stored in the PDU ring buffer so it can be matched with the reply. Unfortunately when the reply is received it is only checked against the first entry in the ring buffer. This can cause a failure if a second packet expecting a reply has been received while waiting for the first reply to arrive.
This is a known issue in the bacnet-stack open source stack, and there is a outstanding FIXME in the latest version of the source code:

        /* The ANSWER_DATA_REQUEST state is entered when a  */
        /* BACnet Data Expecting Reply, a Test_Request, or  */
        /* a proprietary frame that expects a reply is received. */
        /* FIXME: MSTP_Get_Reply waits for a matching reply, but
           if the next queued message doesn't match, then we
           sit here for Treply_delay doing nothing */

The fix for this is to check all the messages in the PDU queue to see if any of them match, and if one does then handle it in the normal way. Thank you to Ian Smith of Abelon Systems Ltd. for the patch!
2018-03-25 15:59:10 +02:00
..
arcnet.c fork from http://sourceforge.net/projects/bacnet/ 2013-03-21 22:53:31 +01:00
bacnet_ipv6.lua update to r3056 from https://sourceforge.net/p/bacnet/code/3056/tree/trunk/bacnet-stack/ add ipv6 and schedule support 2016-10-30 16:16:03 +01:00
bacsec_linux.c update to r3056 from https://sourceforge.net/p/bacnet/code/3056/tree/trunk/bacnet-stack/ add ipv6 and schedule support 2016-10-30 16:16:03 +01:00
bip-init.c [r3117] Changes to clean up compile warnings 2017-04-05 22:11:31 +02:00
bip6.c change ipv6 broadcast from BIP6_MULTICAST_SITE_LOCAL to BIP6_MULTICAST_GLOBAL interop with yabe 2016-10-30 23:19:30 +01:00
dlmstp_linux.c [r3137] Adds two new functions to the ring buffer implementation, one to walk the ring by getting a pointer to the next element in the ring, and the other to Pop (remove) a specified element from somewhere in the ring and then move any elements up towards the head to fill the gap left. With these new functions in place, the Linux MS/TP datalink MSTP_Get_Reply() has been updated to walk the ring buffer to try to find the matching reply. If it is found then it is processed in the same way as usual, and then removed from the ring. 2018-03-25 15:59:10 +02:00
dlmstp_linux.h fix compile issue with musl libc 2016-12-10 10:43:36 +01:00
dlmstp.c update to r3056 from https://sourceforge.net/p/bacnet/code/3056/tree/trunk/bacnet-stack/ add ipv6 and schedule support 2016-10-30 16:16:03 +01:00
dlmstp.mak fork from http://sourceforge.net/projects/bacnet/ 2013-03-21 22:53:31 +01:00
ethernet.c update to r3056 from https://sourceforge.net/p/bacnet/code/3056/tree/trunk/bacnet-stack/ add ipv6 and schedule support 2016-10-30 16:16:03 +01:00
mstpsnap.c update to r3056 from https://sourceforge.net/p/bacnet/code/3056/tree/trunk/bacnet-stack/ add ipv6 and schedule support 2016-10-30 16:16:03 +01:00
mstpsnap.mak update to r3056 from https://sourceforge.net/p/bacnet/code/3056/tree/trunk/bacnet-stack/ add ipv6 and schedule support 2016-10-30 16:16:03 +01:00
net.h update to r3056 from https://sourceforge.net/p/bacnet/code/3056/tree/trunk/bacnet-stack/ add ipv6 and schedule support 2016-10-30 16:16:03 +01:00
readme.txt fork from http://sourceforge.net/projects/bacnet/ 2013-03-21 22:53:31 +01:00
rs485.c [r3066] Added Wireshark 2.x extcap live capture for mstpcap on Linux. 2016-11-01 19:29:15 +01:00
rs485.h update to r3056 from https://sourceforge.net/p/bacnet/code/3056/tree/trunk/bacnet-stack/ add ipv6 and schedule support 2016-10-30 16:16:03 +01:00
rs485.mak update to r3056 from https://sourceforge.net/p/bacnet/code/3056/tree/trunk/bacnet-stack/ add ipv6 and schedule support 2016-10-30 16:16:03 +01:00
rx_fsm.c fork from http://sourceforge.net/projects/bacnet/ 2013-03-21 22:53:31 +01:00
rx_fsm.mak fork from http://sourceforge.net/projects/bacnet/ 2013-03-21 22:53:31 +01:00
timer.c fork from http://sourceforge.net/projects/bacnet/ 2013-03-21 22:53:31 +01:00
timer.h fork from http://sourceforge.net/projects/bacnet/ 2013-03-21 22:53:31 +01:00

This is a port to Linux for testing.
The unit tests can be run via the test.sh script.