Bugfix/confirmed handlers empty service request (#885)

* Added reject in all confirmed service handlers, except GetEventInformation, when confirmed services with zero length occur which rejects with required parameters are missing message.

* Refactored errno use in service using debug_perror. Changed debug_perror usage to debug_fprintf. 

* Updated file and function headers in basic/service modules.

* Changed NDPU priority on confirmed messages to use requested NDPU priority.

* Renamed debug_aprintf to debug_printf_stdout for clarity.

* Convert most debug_fprintf usage to debug_print to reduce text bloat in AVR build
This commit is contained in:
Steve Karg
2025-01-05 10:09:39 -06:00
committed by GitHub
parent 1f41e2c933
commit 94b3809a58
135 changed files with 1166 additions and 1609 deletions
+10 -12
View File
@@ -1,11 +1,10 @@
/**************************************************************************
*
* Copyright (C) 2005 Steve Karg
*
* SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
*
*********************************************************************/
/* linux Ethernet/IP specific */
/**
* @file
* @brief Initializes BACnet/IP interface (Linux).
* @author Steve Karg <skarg@users.sourceforge.net>
* @date 2005
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
*/
#include <asm/types.h>
#include <netinet/ether.h>
#include <netinet/in.h>
@@ -23,6 +22,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
/* BACnet specific */
#include "bacnet/bacdcode.h"
#include "bacnet/bacint.h"
@@ -31,8 +31,6 @@
#include "bacnet/basic/bbmd/h_bbmd.h"
#include "bacport.h"
/** @file linux/bip-init.c Initializes BACnet/IP interface (Linux). */
/* unix sockets */
static int BIP_Socket = -1;
static int BIP_Broadcast_Socket = -1;
@@ -273,7 +271,7 @@ uint8_t bip_get_subnet_prefix(void)
* @param mtu_len - the number of bytes of data to send
*
* @return Upon successful completion, returns the number of bytes sent.
* Otherwise, -1 shall be returned and errno set to indicate the error.
* Otherwise, -1 shall be returned to indicate the error.
*/
int bip_send_mpdu(
const BACNET_IP_ADDRESS *dest, const uint8_t *mtu, uint16_t mtu_len)
@@ -425,7 +423,7 @@ uint16_t bip_receive(
* @param mtu - the bytes of data to send
* @param mtu_len - the number of bytes of data to send
* @return Upon successful completion, returns the number of bytes sent.
* Otherwise, -1 shall be returned and errno set to indicate the error.
* Otherwise, -1 shall be returned to indicate the error.
*/
int bip_send_pdu(
BACNET_ADDRESS *dest,
+10 -9
View File
@@ -1,15 +1,16 @@
/**************************************************************************
*
* Copyright (C) 2016 Steve Karg
*
* SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
*
*********************************************************************/
/**
* @file
* @brief Initializes BACnet/IP interface (Linux).
* @author Steve Karg <skarg@users.sourceforge.net>
* @date 2016
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
*/
#include <ifaddrs.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h> /* for standard integer types uint8_t etc. */
#include <stdbool.h> /* for the standard bool type. */
#include <errno.h>
#include "bacnet/bacdcode.h"
#include "bacnet/config.h"
#include "bacnet/datalink/bip6.h"
@@ -234,7 +235,7 @@ bool bip6_get_broadcast_addr(BACNET_IP6_ADDRESS *addr)
* @param mtu_len - the number of bytes of data to send
*
* @return Upon successful completion, returns the number of bytes sent.
* Otherwise, -1 shall be returned and errno set to indicate the error.
* Otherwise, -1 shall be returned to indicate the error.
*/
int bip6_send_mpdu(
const BACNET_IP6_ADDRESS *dest, const uint8_t *mtu, uint16_t mtu_len)
@@ -278,7 +279,7 @@ int bip6_send_mpdu(
* @param pdu - the bytes of data to send
* @param pdu_len - the number of bytes of data to send
* @return Upon successful completion, returns the number of bytes sent.
* Otherwise, -1 shall be returned and errno set to indicate the error.
* Otherwise, -1 shall be returned to indicate the error.
*/
int bip6_send_pdu(
BACNET_ADDRESS *dest,
-1
View File
@@ -11,7 +11,6 @@
#include <pthread.h>
#include <stdbool.h>
#include <unistd.h>
#include <errno.h>
#include "bacnet/basic/sys/debug.h"
#include "bacnet/datalink/bsc/bsc-event.h"
+8 -11
View File
@@ -1,11 +1,11 @@
/**************************************************************************
*
* Copyright (C) 2008 Steve Karg <skarg@users.sourceforge.net>
* Updated by Nikola Jelic 2011 <nikola.jelic@euroicc.com>
*
* SPDX-License-Identifier: MIT
*
*********************************************************************/
/**
* @file
* @brief Provides Linux-specific DataLink functions for MS/TP.
* @author Steve Karg <skarg@users.sourceforge.net>
* @author Nikola Jelic 2011 <nikola.jelic@euroicc.com>
* @date 2008
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
*/
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
@@ -27,9 +27,6 @@
/* port specific */
#include "rs485.h"
/** @file linux/dlmstp.c Provides Linux-specific DataLink functions for MS/TP.
*/
/* Number of MS/TP Packets Rx/Tx */
uint16_t MSTP_Packets = 0;
+8 -11
View File
@@ -1,10 +1,10 @@
/**************************************************************************
*
* Copyright (C) 2008 Steve Karg <skarg@users.sourceforge.net>
*
* SPDX-License-Identifier: MIT
*
*********************************************************************/
/**
* @file
* @brief Provides Linux-specific DataLink functions for MS/TP.
* @author Steve Karg <skarg@users.sourceforge.net>
* @date 2008
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
*/
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
@@ -12,6 +12,7 @@
#include <string.h>
#include <stdio.h>
#include <time.h>
#include <errno.h>
/* BACnet Stack defines - first */
#include "bacnet/bacdef.h"
/* BACnet Stack API */
@@ -27,10 +28,6 @@
/* OS Specific include */
#include "bacport.h"
/** @file linux/dlmstp_port.c Provides Linux-specific DataLink functions for
* MS/TP.
*/
#define BACNET_PDU_CONTROL_BYTE_OFFSET 1
#define BACNET_DATA_EXPECTING_REPLY_BIT 2
#define BACNET_DATA_EXPECTING_REPLY(control) \