Fix warnings during unit testing of BACnet secure connect node. (#1182)

This commit is contained in:
Steve Karg
2025-12-09 09:34:28 -06:00
committed by GitHub
parent b1c6a0e74b
commit 95cdec459e
39 changed files with 3206 additions and 36179 deletions
+3 -3
View File
@@ -1,4 +1,4 @@
This readme explains how to enable support of BACNet Secure Connect datalink
This readme explains how to enable support of BACnet Secure Connect datalink
(ANNEX AB BACnet Secure Connect in standard), how to set up the building
environment and clarifies some important moments regarding implementation
of that functionality.
@@ -7,7 +7,7 @@ By default the support of that functionality is turned off, to enable it
you need to set option BACDL_BSC=ON in CMakeLists.txt if cmake build system
is used or set BACDL_BSC=1 define in a case if using makefiles.
BACNet/SC standard uses websockets as a transport layer, so Windows/Linux/BSD
BACnet/SC standard uses websockets as a transport layer, so Windows/Linux/BSD
implementations use libwebsocket library. Implementation for Zephyr uses
native websocket API for the client side and mongoose library for the
server side. Websocket layer which is built on the top of libwebsockets
@@ -51,4 +51,4 @@ The current implementation does not support Certificate_Signing_Request_File
property of BACNET/SC netport and properties Operational_Certificate_File
and Issuer_Certificate_Files related to certificates are readonly and can't
be changed remotely. So, management of device certificates is out of the scope
of current BACNet/SC implementation.
of current BACnet/SC implementation.
+2 -2
View File
@@ -1,6 +1,6 @@
/**
* @file
* @brief Configuration file of BACNet/SC datalink.
* @brief Configuration file of BACnet/SC datalink.
* @author Kirill Neznamov <kirill.neznamov@dsr-corporation.com>
* @date August 2022
* @copyright SPDX-License-Identifier: MIT
@@ -58,7 +58,7 @@
#define BSC_CONF_WEBSOCKET_RX_BUFFER_LEN BVLC_SC_NPDU_SIZE_CONF
#endif
/* THIS should not be changed, most of BACNet/SC devices must have */
/* THIS should not be changed, most of BACnet/SC devices must have */
/* hub connector, it uses 2 connections */
#ifndef BSC_CONF_HUB_CONNECTOR_CONNECTIONS_NUM
#define BSC_CONF_HUB_CONNECTOR_CONNECTIONS_NUM (BSC_CONF_HUB_CONNECTORS_NUM * 2)
+4 -4
View File
@@ -191,7 +191,7 @@ bool bsc_init(char *ifname)
/**
* @brief Blocking thread-safe bsc_cleanup() function
* de-initializes BACNet/SC datalink.
* de-initializes BACnet/SC datalink.
*/
void bsc_cleanup(void)
{
@@ -293,7 +293,7 @@ static void bsc_remove_packet(size_t packet_size)
/**
* @brief Blocking thread-safe bsc_receive() function
* receives NPDUs transferred over BACNet/SC
* receives NPDUs transferred over BACnet/SC
* from a node specified by it's virtual MAC address as
* defined in Clause AB.1.5.2.
* @param src - source VMAC address
@@ -375,7 +375,7 @@ uint16_t bsc_receive(
/**
* @brief Function can be used to retrieve broadcast
* VMAC address for BACNet/SC node.
* VMAC address for BACnet/SC node.
* @param dest - value of broadcast VMAC address
*/
void bsc_get_broadcast_address(BACNET_ADDRESS *dest)
@@ -392,7 +392,7 @@ void bsc_get_broadcast_address(BACNET_ADDRESS *dest)
/**
* @brief Function can be used to retrieve local
* VMAC address of initialized BACNet/SC datalink.
* VMAC address of initialized BACnet/SC datalink.
* @param my_address - value of local VMAC address
*/
void bsc_get_my_address(BACNET_ADDRESS *my_address)
+19 -19
View File
@@ -1,6 +1,6 @@
/**
* @file
* @brief BACNet/SC datalink public interface API.
* @brief BACnet/SC datalink public interface API.
* @author Kirill Neznamov <kirill.neznamov@dsr-corporation.com>
* @date October 2022
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
@@ -16,10 +16,10 @@
/**
* @brief Blocking thread-safe bsc_init() function
* initializes BACNet/SC datalink in accordence with value of properties
* from BACNet/SC Network Port Object (sc_netport.h). That means that
* initializes BACnet/SC datalink in accordence with value of properties
* from BACnet/SC Network Port Object (sc_netport.h). That means that
* user must initialize and set corresponded properties required for
* configuration of BACNet/SC datalink before calling of that function.
* configuration of BACnet/SC datalink before calling of that function.
* According to "Addendum cc" to ANSI/ASHRAE Standard 135-2020
* https://bacnet.org/wp-content/uploads/sites/4/2022/08/Add-135-2020cc.pdf
* most important properties are:
@@ -45,7 +45,7 @@ bool bsc_init(char *ifname);
/**
* @brief Blocking thread-safe bsc_cleanup() function
* de-initializes BACNet/SC datalink.
* de-initializes BACnet/SC datalink.
*/
BACNET_STACK_EXPORT
void bsc_cleanup(void);
@@ -60,13 +60,13 @@ bool bsc_cert_files_check(uint32_t netport_instance);
/**
* @brief Blocking thread-safe bsc_send_pdu() function
* sends pdu over BACNet/SC to node specified by
* sends pdu over BACnet/SC to node specified by
* destination address param.
*
* @param dest [in] BACNet/SC node's virtual MAC address as
* @param dest [in] BACnet/SC node's virtual MAC address as
* defined in Clause AB.1.5.2.
* Can be broadcast.
* @param npdu_data [in] BACNet/SC datalink does not use that
* @param npdu_data [in] BACnet/SC datalink does not use that
* parameter. Added for backward
* compatibility.
* @param pdu [in] protocol data unit to be sent.
@@ -83,7 +83,7 @@ int bsc_send_pdu(
/**
* @brief Blocking thread-safe bsc_receive() function
* receives NPDUs transferred over BACNet/SC
* receives NPDUs transferred over BACnet/SC
* from a node specified by it's virtual MAC address as
* defined in Clause AB.1.5.2.
*
@@ -101,7 +101,7 @@ uint16_t bsc_receive(
/**
* @brief Function can be used to retrieve broadcast
* VMAC address for BACNet/SC node.
* VMAC address for BACnet/SC node.
*
* @param addr [out] Value of broadcast VMAC address.
*/
@@ -111,7 +111,7 @@ void bsc_get_broadcast_address(BACNET_ADDRESS *addr);
/**
* @brief Function can be used to retrieve local
* VMAC address of initialized BACNet/SC datalink.
* VMAC address of initialized BACnet/SC datalink.
* If function called when datalink is not started,
* my_address filled by empty vmac address
* X'000000000000' as it defined in clause AB.1.5.2
@@ -123,11 +123,11 @@ BACNET_STACK_EXPORT
void bsc_get_my_address(BACNET_ADDRESS *my_address);
/**
* @brief Function checks if BACNet/SC direct connection is
* established with remote BACNet/SC node.
* @brief Function checks if BACnet/SC direct connection is
* established with remote BACnet/SC node.
* User can check the status of connection using either
* destination vmac or list of destination urls.
* @param dest BACNet/SC vmac of remote node to check direct
* @param dest BACnet/SC vmac of remote node to check direct
* connection status.
* @param urls this array represents the possible URIs of a
* remote node for acceptance of direct connections.
@@ -143,22 +143,22 @@ bool bsc_direct_connection_established(
/**
* @brief Function starts process of establishing of a
* direct BACNet/SC connection to node identified by
* direct BACnet/SC connection to node identified by
* either urls or dest parameter. User should note that
* if dest parameter is used, local node tries to resolve
* it (e.g.to get URIs related to dest vmac from all existent
* BACNet/SC nodes in network). As a result the process of
* establishing of a BACNet/SC connection by dest may
* BACnet/SC nodes in network). As a result the process of
* establishing of a BACnet/SC connection by dest may
* take unpredictable amount of time depending on a current
* network configuration.
* @param dest BACNet/SC vmac of remote node to check direct
* @param dest BACnet/SC vmac of remote node to check direct
* connection status.
* @param urls this array represents the possible URIs of a
* remote node for acceptance of direct connections.
* Can contain 1 elem.
* @param urls_cnt - size of urls array.
*
* @return BSC_SC_SUCCESS if process of a establishing of a BACNet/SC
* @return BSC_SC_SUCCESS if process of a establishing of a BACnet/SC
* connection was started successfully, otherwise returns
* any retcode from BSC_SC_RET enum.
*/
+2 -2
View File
@@ -1,8 +1,8 @@
/**
* @file
* @brief BACNet secure connect hub connector API.
* @brief BACnet secure connect hub connector API.
* In general, user should not use that API directly,
* BACNet/SC datalink API should be used.
* BACnet/SC datalink API should be used.
* @author Kirill Neznamov <kirill.neznamov@dsr-corporation.com>
* @date July 2022
* @copyright SPDX-License-Identifier: MIT
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* @file
* @brief BACNet hub function API.
* @brief BACnet hub function API.
* @author Kirill Neznamov <kirill.neznamov@dsr-corporation.com>
* @date July 2022
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
+2 -2
View File
@@ -1,8 +1,8 @@
/**
* @file
* @brief BACNet secure connect hub function API.
* @brief BACnet secure connect hub function API.
* In general, user should not use that API directly,
* BACNet/SC datalink API should be used.
* BACnet/SC datalink API should be used.
* @author Kirill Neznamov <kirill.neznamov@dsr-corporation.com>
* @date July 2022
* @copyright SPDX-License-Identifier: MIT
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* @file
* @brief BACNet secure connect node switch function API.
* @brief BACnet secure connect node switch function API.
* @author Kirill Neznamov <kirill.neznamov@dsr-corporation.com>
* @date October 2022
* @copyright SPDX-License-Identifier: GPL-2\.0-or-later WITH GCC-exception-2.0
+2 -2
View File
@@ -1,8 +1,8 @@
/**
* @file
* @brief BACNet secure connect node switch function API.
* @brief BACnet secure connect node switch function API.
* In general, user should not use that API directly,
* BACNet/SC datalink API should be used.
* BACnet/SC datalink API should be used.
* @author Kirill Neznamov <kirill\.neznamov@dsr-corporation\.com>
* @date October 2022
* @copyright SPDX-License-Identifier: MIT
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* @file
* @brief BACNet secure connect node API.
* @brief BACnet secure connect node API.
* @author Kirill Neznamov <kirill\.neznamov@dsr-corporation\.com>
* @date October 2022
* @copyright SPDX-License-Identifier: MIT
+2 -2
View File
@@ -1,8 +1,8 @@
/**
* @file
* @brief BACNet secure connect node API.
* @brief BACnet secure connect node API.
* In general, user should not use that API directly,
* BACNet/SC datalink API should be used.
* BACnet/SC datalink API should be used.
* @author Kirill Neznamov <kirill\.neznamov@dsr-corporation\.com>
* @date October 2022
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
+1 -1
View File
@@ -1,6 +1,6 @@
/**
* @file
* @brief BACNet secure connect main include header.
* @brief BACnet secure connect main include header.
* @author Kirill Neznamov <kirill\.neznamov@dsr-corporation\.com>
* @date August 2022
* @copyright SPDX-License-Identifier: MIT
+1 -1
View File
@@ -1,7 +1,7 @@
/**
* @file
* @brief BACNet secure connect API.
* @brief BACnet secure connect API.
* @author Kirill Neznamov <kirill\.neznamov@dsr-corporation\.com>
* @date May 2022
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
+7 -7
View File
@@ -1,8 +1,8 @@
/**
* @file
* @brief BACNet secure connect socket API.
* @brief BACnet secure connect socket API.
* In general, user should not use that API directly,
* BACNet/SC datalink API should be used.
* BACnet/SC datalink API should be used.
* @author Kirill Neznamov <kirill\.neznamov@dsr-corporation\.com>
* @date December 2022
* @copyright SPDX-License-Identifier: MIT
@@ -217,7 +217,7 @@ void bsc_deinit_ctx(BSC_SOCKET_CTX *ctx);
/**
* @brief bsc_connect() function starts connect operation for a
* specified BACNet socket. The function call be called only
* specified BACnet socket. The function call be called only
* for initiator context otherwise BSC_SC_INVALID_OPERATION
* error is returned. As a result if bsc_connect() was
* succeeded for given param c, that leads to emitting of
@@ -231,7 +231,7 @@ void bsc_deinit_ctx(BSC_SOCKET_CTX *ctx);
* event is emitted.
*
* @param ctx - socket context.
* @param c - BACNet socket descriptor .
* @param c - BACnet socket descriptor .
* @param url - url to connect to. For example: wss://example.com:8080.
*
* @return error code from BSC_SC_RET enum.
@@ -254,11 +254,11 @@ void bsc_disconnect(BSC_SOCKET *c);
/**
* @brief bsc_send() function schedules transmitting of pdu to
* another BACNet socket. The function may be used only
* another BACnet socket. The function may be used only
* when the socket is in a connected state
* otherwise BSC_SC_INVALID_OPERATION error is returned.
*
* @param c - BACNet socket descriptor initialized by bsc_accept() or
* @param c - BACnet socket descriptor initialized by bsc_accept() or
* bsc_connect() calls.
* @param pdu - pointer to a data to send.
* @param pdu_len - size in bytes of data to send.
@@ -288,7 +288,7 @@ void bsc_socket_maintenance_timer(uint16_t seconds);
* @brief bsc_socket_get_peer_addr() function gets information
* about remote peer address only for socket with acceptor cotext.
*
* @param c - BACNet socket descriptor initialized by bsc_accept() call.
* @param c - BACnet socket descriptor initialized by bsc_accept() call.
* @param data - pointer to a struct holding address information.
* @param pdu_len - size in bytes of data to send.
*
+49 -49
View File
@@ -152,7 +152,7 @@ static bool bvlc_sc_validate_options_headers(
if (option == BVLC_SC_OPTION_TYPE_SECURE_PATH) {
if (validation_type == BACNET_PDU_DEST_OPTION_VALIDATION) {
/* According BACNet standard secure path header option can be
/* According BACnet standard secure path header option can be
added only to data options. (AB.2.3.1 Secure Path Header
Option) */
*error_code = ERROR_CODE_HEADER_ENCODING_ERROR;
@@ -274,7 +274,7 @@ static size_t bvlc_sc_add_option(
if (!to_data_option &&
(sc_option[0] & BVLC_SC_HEADER_OPTION_TYPE_MASK) ==
BVLC_SC_OPTION_TYPE_SECURE_PATH) {
/* According BACNet standard secure path header option can be added
/* According BACnet standard secure path header option can be added
only to data options. (AB.2.3.1 Secure Path Header Option) */
return 0;
}
@@ -408,7 +408,7 @@ size_t bvlc_sc_add_option_to_data_options(
/**
* @brief Function encodes proprietary header option in correspondence
* of BACNet standard AB.2.3.2 Proprietary Header Options.
* of BACnet standard AB.2.3.2 Proprietary Header Options.
* Any proprietary header option shall consist of the
* following fields:
*
@@ -479,7 +479,7 @@ size_t bvlc_sc_encode_proprietary_option(
/**
* @brief Function encodes security path header option in correspondence
* of BACNet standard AB.2.3.1 Secure Path Header Option.
* of BACnet standard AB.2.3.1 Secure Path Header Option.
* Any proprietary header option shall consist of the
* following fields:
*
@@ -605,7 +605,7 @@ static void bvlc_sc_decode_proprietary_option(
/**
* @brief encode BVLC-SC header
*
* BACNet standard AB.2.2 BVLC-SC Header Format:
* BACnet standard AB.2.2 BVLC-SC Header Format:
* BVLC Function 1-octet BVLC function code
* Control Flags 1-octet Control flags
* Message ID 2-octets Message identifier
@@ -659,7 +659,7 @@ static size_t bvlc_sc_encode_common(
}
/**
* @brief Function encodes the BVLC-Result message according BACNet standard
* @brief Function encodes the BVLC-Result message according BACnet standard
* AB.2.4.1 BVLC-Result Format.
*
* BVLC Function 1-octet (X'00') BVLC-Result
@@ -811,7 +811,7 @@ size_t bvlc_sc_encode_result(
}
/**
* @brief Function decodes the BVLC-Result message according BACNet standard
* @brief Function decodes the BVLC-Result message according BACnet standard
* AB.2.4.1 BVLC-Result Format.
* @param payload - pointer to the decoded data
* @param packed_payload - pointer to the packed data
@@ -907,7 +907,7 @@ static bool bvlc_sc_decode_result(
/**
* @brief Function encodes the Encapsulated-NPDU message according
* BACNet standard AB.2.5 Encapsulated-NPDU.
* BACnet standard AB.2.5 Encapsulated-NPDU.
*
* BVLC Function 1-octet (X'01') Encapsulated-NPDU
* Control Flags 1-octet Control flags.
@@ -959,7 +959,7 @@ size_t bvlc_sc_encode_encapsulated_npdu(
}
/**
* @brief Function encodes the Address-Resolution message according BACNet
* @brief Function encodes the Address-Resolution message according BACnet
* standard AB.2.6 Address-Resolution
*
* BVLC Function 1-octet (X'02') Address-Resolution
@@ -998,7 +998,7 @@ size_t bvlc_sc_encode_address_resolution(
/**
* @brief Function encodes the Address-Resolution-ACK message according
* BACNet standard AB.2.7.1 Address-Resolution-ACK Format.
* BACnet standard AB.2.7.1 Address-Resolution-ACK Format.
*
* BVLC Function 1-octet (X'03') Address-Resolution-ACK
* Control Flags 1-octet Control flags.
@@ -1061,7 +1061,7 @@ size_t bvlc_sc_encode_address_resolution_ack(
/**
* @brief Function encodes the Advertisement message according
* BACNet standard AB.2.8.1 Advertisement Format.
* BACnet standard AB.2.8.1 Advertisement Format.
*
* BVLC Function 1-octet (X'04') Advertisement
* Control Flags 1-octet Control flags.
@@ -1133,7 +1133,7 @@ size_t bvlc_sc_encode_advertisiment(
/**
* @brief Function encodes the Advertisement-Solicitation message according
* BACNet standard AB.2.9.1 Advertisement-Solicitation Format.
* BACnet standard AB.2.9.1 Advertisement-Solicitation Format.
* @param payload - pointer to the decoded data
* @param packed_payload - pointer to packed data
* @param packed_payload_len - size of packed data
@@ -1189,7 +1189,7 @@ static bool bvlc_sc_decode_advertisiment(
/**
* @brief Function encodes the Advertisement-Solicitation message according
* BACNet standard AB.2.9.1 Advertisement-Solicitation Format.
* BACnet standard AB.2.9.1 Advertisement-Solicitation Format.
*
* BVLC Function 1-octet (X'05') Advertisement
* Control Flags 1-octet Control flags.
@@ -1227,7 +1227,7 @@ size_t bvlc_sc_encode_advertisiment_solicitation(
/**
* @brief Function encodes the Connect-Request message according
* BACNet standard AB.2.10.1 Connect-Request Format.
* BACnet standard AB.2.10.1 Connect-Request Format.
*
* BVLC Function 1-octet (X'06') Advertisement
* Control Flags 1-octet Control flags.
@@ -1302,7 +1302,7 @@ size_t bvlc_sc_encode_connect_request(
/**
* @brief Function decodes the Connect-Request message according
* BACNet standard AB.2.10.1 Connect-Request Format.
* BACnet standard AB.2.10.1 Connect-Request Format.
* @param payload - pointer to the decoded data
* @param packed_payload - pointer to the packed data
* @param packed_payload_len - size of the packed data
@@ -1346,7 +1346,7 @@ static bool bvlc_sc_decode_connect_request(
/**
* @brief Function encodes the Connect-Accept message according
* BACNet standard AB.2.11.1 Connect-Accept Format.
* BACnet standard AB.2.11.1 Connect-Accept Format.
*
* BVLC Function 1-octet (X'07') Advertisement
* Control Flags 1-octet Control flags.
@@ -1421,7 +1421,7 @@ size_t bvlc_sc_encode_connect_accept(
/**
* @brief Function decodes the Connect-Accept message according
* BACNet standard AB.2.11.1 Connect-Accept Format.
* BACnet standard AB.2.11.1 Connect-Accept Format.
* @param payload - pointer to the decoded data
* @param packed_payload - pointer to the packed data
* @param packed_payload_len - size of the packed data
@@ -1466,7 +1466,7 @@ static bool bvlc_sc_decode_connect_accept(
/**
* @brief Function encodes the Disconnect-Request message according
* BACNet standard AB.2.12.1 Disconnect-Request Format.
* BACnet standard AB.2.12.1 Disconnect-Request Format.
*
* BVLC Function 1-octet (X'08') Advertisement
* Control Flags 1-octet Control flags.
@@ -1497,7 +1497,7 @@ size_t bvlc_sc_encode_disconnect_request(
/**
* @brief Function encodes the Disconnect-ACK message according
* BACNet standard AB.2.13.1 Disconnect-ACK Format.
* BACnet standard AB.2.13.1 Disconnect-ACK Format.
*
* BVLC Function 1-octet (X'09') Advertisement
* Control Flags 1-octet Control flags.
@@ -1528,7 +1528,7 @@ bvlc_sc_encode_disconnect_ack(uint8_t *pdu, size_t pdu_len, uint16_t message_id)
/**
* @brief Function encodes the Heartbeat-Request message according
* BACNet standard AB.2.14.1 Heartbeat-Request Format.
* BACnet standard AB.2.14.1 Heartbeat-Request Format.
*
* BVLC Function 1-octet (X'0A') Advertisement
* Control Flags 1-octet Control flags.
@@ -1559,7 +1559,7 @@ size_t bvlc_sc_encode_heartbeat_request(
/**
* @brief Function encodes the Heartbeat-ACK message according
* BACNet standard AB.2.15.1 Heartbeat-ACK Format.
* BACnet standard AB.2.15.1 Heartbeat-ACK Format.
*
* BVLC Function 1-octet (X'0B') Advertisement
* Control Flags 1-octet Control flags.
@@ -1589,7 +1589,7 @@ bvlc_sc_encode_heartbeat_ack(uint8_t *pdu, size_t pdu_len, uint16_t message_id)
}
/**
* @brief Function encodes the Proprietary Message according BACNet standard
* @brief Function encodes the Proprietary Message according BACnet standard
* AB.2.16.1 Proprietary Message Format.
*
* BVLC Function 1-octet (X'0C') Proprietary-Message.
@@ -1660,7 +1660,7 @@ size_t bvlc_sc_encode_proprietary_message(
}
/**
* @brief Function decodes the Proprietary Message according BACNet standard
* @brief Function decodes the Proprietary Message according BACnet standard
* AB.2.16.1 Proprietary Message Format.
* @param payload - pointer to the decoded data
* @param packed_payload - pointer to the packed data
@@ -1872,10 +1872,10 @@ bvlc_sc_decode_data_options_if_exists(BVLC_SC_DECODED_MESSAGE *message)
}
/**
* @brief Function decodes BACNet/SC message.
* @brief Function decodes BACnet/SC message.
*
* @param buf - A buffer which holds BACNet/SC PDU.
* @param buf_len - length of a buffer which holds BACNet/SC PDU.
* @param buf - A buffer which holds BACnet/SC PDU.
* @param buf_len - length of a buffer which holds BACnet/SC PDU.
* @param message- pointer to structure for decoded data.
* @param error-code - the value of parameter is filled if function returns
* false. Check BACNET_ERROR_CLASS enum.
@@ -2164,13 +2164,13 @@ bool bvlc_sc_decode_message(
}
/**
* @brief Function removes destination address of BACNet/SC message
* @brief Function removes destination address of BACnet/SC message
* and sets originating address instead of it.
* It does it job only if message has destination address
* and does not have origination address, otherwise pdu
* stays unchanged.
* @param pdu - BACNet/SC PDU.
* @param pdu_len - length of a buffer which holds BACNet/SC PDU.
* @param pdu - BACnet/SC PDU.
* @param pdu_len - length of a buffer which holds BACnet/SC PDU.
* @param orig- origination vmac.
*/
void bvlc_sc_remove_dest_set_orig(
@@ -2188,11 +2188,11 @@ void bvlc_sc_remove_dest_set_orig(
}
/**
* @brief Function changes or adds originating address into BACNet/SC message.
* @brief Function changes or adds originating address into BACnet/SC message.
* It is assumed that ppdu points to buffer with pdu that has
* BSC_PRE bytes behind.
* @param ppdu - pointer to buffer which holds BACNet/SC PDU.
* @param pdu_len - length of a buffer which holds BACNet/SC PDU.
* @param ppdu - pointer to buffer which holds BACnet/SC PDU.
* @param pdu_len - length of a buffer which holds BACnet/SC PDU.
* @param orig- origination vmac.
* @return new pdu length if function succeeded and ppdu points to beginning of
* changed pdu, otherwise returns old pdu_len and ppdu is not changed.
@@ -2238,10 +2238,10 @@ bool bvlc_sc_is_vmac_broadcast(BACNET_SC_VMAC_ADDRESS *vmac)
/**
* @brief Function checks if it is needed to send BVLC result
* response message for given decoded BACNet/SC message.
* response message for given decoded BACnet/SC message.
* In a case of errors, standard requires to send such kind
* of responses for unicast messages of specific types.
* @param dm - pointer to decoded BACNet/SC message.
* @param dm - pointer to decoded BACnet/SC message.
* @return true if vmac is broadcast, otherwise returns false.
*/
bool bvlc_sc_need_send_bvlc_result(BVLC_SC_DECODED_MESSAGE *dm)
@@ -2261,11 +2261,11 @@ bool bvlc_sc_need_send_bvlc_result(BVLC_SC_DECODED_MESSAGE *dm)
}
/**
* @brief Function checks if destination address of input BACNet/SC
* @brief Function checks if destination address of input BACnet/SC
* message is broadcast.
* @param pdu- buffer with BACNet/SC message.
* @param pdu_len- length of buffer of BACNet/SC message.
* @return true if destination address of input BACNet/SC
* @param pdu- buffer with BACnet/SC message.
* @param pdu_len- length of buffer of BACnet/SC message.
* @return true if destination address of input BACnet/SC
* is broadcast, otherwise returns false.
*/
bool bvlc_sc_pdu_has_dest_broadcast(uint8_t *pdu, size_t pdu_len)
@@ -2286,12 +2286,12 @@ bool bvlc_sc_pdu_has_dest_broadcast(uint8_t *pdu, size_t pdu_len)
}
/**
* @brief Function checks if input BACNet/SC message has
* @brief Function checks if input BACnet/SC message has
* destination address field.
* @param pdu- buffer with BACNet/SC message.
* @param pdu_len- length of buffer of BACNet/SC message.
* @param pdu- buffer with BACnet/SC message.
* @param pdu_len- length of buffer of BACnet/SC message.
* @return true if destination address is presented in
* input BACNet/SC message, otherwise returns false.
* input BACnet/SC message, otherwise returns false.
*/
bool bvlc_sc_pdu_has_no_dest(uint8_t *pdu, size_t pdu_len)
{
@@ -2305,10 +2305,10 @@ bool bvlc_sc_pdu_has_no_dest(uint8_t *pdu, size_t pdu_len)
/**
* @brief Function puts destination address of
* BACNet/SC message into vmac if message
* BACnet/SC message into vmac if message
* contains it.
* @param pdu- buffer with BACNet/SC message.
* @param pdu_len- length of buffer of BACNet/SC message.
* @param pdu- buffer with BACnet/SC message.
* @param pdu_len- length of buffer of BACnet/SC message.
* @return true if destination address is presented and was
* placed into vmac, otherwise returns false.
*/
@@ -2332,13 +2332,13 @@ bool bvlc_sc_pdu_get_dest(
/**
* @brief Function removes originating and destination
* address fields from input BACNet/SC message.
* @param ppdu- pointer to buffer of BACNet/SC message.
* @param pdu_len- length of buffer of BACNet/SC message.
* address fields from input BACnet/SC message.
* @param ppdu- pointer to buffer of BACnet/SC message.
* @param pdu_len- length of buffer of BACnet/SC message.
* @return new length of changed pdu if originating or destination
* addresses were removed or old pdu length if
* pdu was not changed. If pdu was changed, ppdu contains
* updated pointer to buffer to modified BACNet/SC message.
* updated pointer to buffer to modified BACnet/SC message.
*/
size_t bvlc_sc_remove_orig_and_dest(uint8_t **ppdu, size_t pdu_len)
{
+2 -2
View File
@@ -31,7 +31,7 @@
#if !defined(USER_DEFINED_BVLC_SC_HEADER_OPTION_MAX)
#define BVLC_SC_HEADER_OPTION_MAX \
4 /* though BACNet standard does not limit number of option headers \
4 /* though BACnet standard does not limit number of option headers \
the implementation defines max value */
#else
#define BVLC_SC_HEADER_OPTION_MAX USER_DEFINED_BVLC_SC_HEADER_OPTION_MAX
@@ -39,7 +39,7 @@
#if BVLC_SC_NPDU_SIZE > BVLC_SC_NPDU_MAX_SIZE
#error \
"Maximum NPDU Length on BACNet/SC Data Link must be <= BVLC_SC_NPDU_MAX_SIZE"
"Maximum NPDU Length on BACnet/SC Data Link must be <= BVLC_SC_NPDU_MAX_SIZE"
#endif
/*
+5 -5
View File
@@ -144,10 +144,10 @@ typedef void (*BSC_WEBSOCKET_SRV_DISPATCH)(
* BSC_WEBSOCKET_CONNECTED in a case if connection established successfully or
* BSC_WEBSOCKET_DISCONNECTED if connection attempt failed.
*
* @param type - type of BACNet/SC connection, check
* BSC_WEBSOCKET_CONNECTION_TYPE enum. According BACNet standard
* @param type - type of BACnet/SC connection, check
* BSC_WEBSOCKET_CONNECTION_TYPE enum. According BACnet standard
* different type of connections require different websocket protocols.
* @param url - BACNet/SC server URL. For example: wss://example.com:8080.
* @param url - BACnet/SC server URL. For example: wss://example.com:8080.
* @param ca_cert - pointer to certificate authority (CA) cert in PEM or DER
* format.
* @param ca_cert_size - size in bytes of CA cert.
@@ -253,13 +253,13 @@ BSC_WEBSOCKET_RET bws_cli_dispatch_send(
/**
* @brief Asynchronous bws_srv_start() function triggers process of
* starting of a websocket server on a specified port for specified
* BACNet websocket protocol. At present time peer can have only 2
* BACnet websocket protocol. At present time peer can have only 2
* instances of server: onerelates to BSC_WEBSOCKET_HUB_PROTOCOL and
* the other to BSC_WEBSOCKET_HUB_PROTOCOL. When process completes,
* dispatch_func() is called with BSC_WEBSOCKET_SERVER_STARTED
* event.
*
* @param proto - type of BACNet websocket protocol defined in
* @param proto - type of BACnet websocket protocol defined in
* BSC_WEBSOCKET_PROTOCOL enum.
* @param port - port number.
* @param iface - name of interface to bind to. If the parameter is NULL
+2 -2
View File
@@ -30,7 +30,7 @@ void bacapp_timestamp_sequence_set(BACNET_TIMESTAMP *dest, uint16_t sequenceNum)
* from a time structure.
*
* @param dest Pointer to the destination time stamp structure.
* @param btime Pointer to the BACNet time structure.
* @param btime Pointer to the BACnet time structure.
*/
void bacapp_timestamp_time_set(BACNET_TIMESTAMP *dest, const BACNET_TIME *btime)
{
@@ -44,7 +44,7 @@ void bacapp_timestamp_time_set(BACNET_TIMESTAMP *dest, const BACNET_TIME *btime)
* from a date/time structure.
*
* @param dest Pointer to the destination time stamp structure.
* @param bdateTime Pointer to the BACNet date/time structure.
* @param bdateTime Pointer to the BACnet date/time structure.
*/
void bacapp_timestamp_datetime_set(
BACNET_TIMESTAMP *dest, const BACNET_DATE_TIME *bdateTime)