Strip tabs and trailing white spaces, and fix end of files (#748)
* format: Strip trailing whitespaces
We want to get rid of trailing whitespaces completly as they make just git
noice. Much better to start using automated tools to get rid of them once and
not getting them back again. This way git history will be cleaner and review
easier.
Commit was generated with:
pre-commit run --all-files trailing-whitespace
* format: Files should have exactly one new line end of them
It is good practice that every file has one new line. It is not now days so
mandatory but it also is not nice if file has lot of newlines end of it. We will
use pre-commit which takes automatically care about this so let's fix all.
Commit was generated with:
pre-commit run --all-files end-of-file-fixer
* format: Convert tabs to spaces
Project mostly use spaces over tabs. When mixing tabs and spaces this usually
makes formatting issues and also when changing those in commits it will make lot
of git noise. We will force spaces most of the time and use pre-commit to fix.
Commit was generated with:
pre-commit run --all-files remove-tabs
---------
Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* @file
|
||||
* @brief BACnet Security Wrapper module from Clause 24 of the BACnet Standard.
|
||||
* @author Nikola Jelic <nikola.jelic@euroicc.com>
|
||||
* @date 2015
|
||||
* @date 2015
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#include <stdbool.h>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @file
|
||||
* @brief BACnet Security Wrapper module from Clause 24 of the BACnet Standard.
|
||||
* @author Nikola Jelic <nikola.jelic@euroicc.com>
|
||||
* @date 2015
|
||||
* @date 2015
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
*/
|
||||
#ifndef BACNET_SECURITY_H
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* @author Steve Karg
|
||||
* @date 2015
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
* @details Implementation of the Network Layer using BACnet/IPv6 as the transport,
|
||||
* @details Implementation of the Network Layer using BACnet/IPv6 as the transport,
|
||||
* as described in ASHRAE 135 Annex J.
|
||||
* The functions described here fulfill the roles defined generically at the
|
||||
* DataLink level by serving as the implementation of the function templates.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @file
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date February 2023
|
||||
* @brief Implementation of the Network Layer using BACnet MS/TP transport
|
||||
* @brief Implementation of the Network Layer using BACnet MS/TP transport
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
* @defgroup DLMSTP BACnet MS/TP DataLink Network Layer
|
||||
* @ingroup DataLink
|
||||
@@ -670,7 +670,7 @@ void dlmstp_set_baud_rate(uint32_t baud)
|
||||
/* Tframe_abort=60 bit times, not to exceed 100 milliseconds.*/
|
||||
if (MSTP_Port->Tframe_abort <= 7) {
|
||||
/* within baud range, so auto-calculate range based on baud */
|
||||
MSTP_Port->Tframe_abort = 1+((60*1000UL)/baud);
|
||||
MSTP_Port->Tframe_abort = 1+((60*1000UL)/baud);
|
||||
}
|
||||
/* Tturnaround=40 bit times */
|
||||
MSTP_Port->Tturnaround_timeout = 1 + ((Tturnaround * 1000) / baud);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief API for the Network Layer using BACnet MS/TP as the transport
|
||||
* @brief API for the Network Layer using BACnet MS/TP as the transport
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2004
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @file
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2004
|
||||
* @brief Implementation of the Network Layer using BACnet Ethernet transport
|
||||
* @brief Implementation of the Network Layer using BACnet Ethernet transport
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
* @defgroup DL_ETHERNET BACnet Ethernet DataLink Network Layer
|
||||
* @ingroup DataLink
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief Implementation of the finite state machines
|
||||
* @brief Implementation of the finite state machines
|
||||
* and BACnet Master-Slave Twisted Pair (MS/TP) functions
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2003
|
||||
* @details This clause describes a Master-Slave/Token-Passing (MS/TP)
|
||||
* @details This clause describes a Master-Slave/Token-Passing (MS/TP)
|
||||
* data link protocol, which provides the same services to the network layer
|
||||
* as ISO 8802-2 Logical Link Control. It uses services provided by the
|
||||
* EIA-485 physical layer. Relevant clauses of EIA-485 are deemed to be
|
||||
@@ -14,7 +14,7 @@
|
||||
* and no parity.
|
||||
* (b) An EIA-485 transceiver whose driver may be disabled.
|
||||
* (c) A timer with a resolution of five milliseconds or less
|
||||
*
|
||||
*
|
||||
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
|
||||
* @defgroup DLMSTP BACnet MS/TP DataLink Network Layer
|
||||
* @ingroup DataLink
|
||||
|
||||
+20
-20
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief API for the BACnet MS/TP finite state machines and their data
|
||||
* @brief API for the BACnet MS/TP finite state machines and their data
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2004
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
@@ -76,7 +76,7 @@ struct mstp_port_struct_t {
|
||||
uint8_t HeaderCRC;
|
||||
/* Used to store the actual CRC from the header. */
|
||||
uint8_t HeaderCRCActual;
|
||||
/* Used as an index by the Receive State Machine,
|
||||
/* Used as an index by the Receive State Machine,
|
||||
up to a maximum value of InputBufferSize. */
|
||||
uint32_t Index;
|
||||
/* An array of octets, used to store octets as they are received.
|
||||
@@ -87,9 +87,9 @@ struct mstp_port_struct_t {
|
||||
hold contiguous memory. */
|
||||
uint8_t *InputBuffer;
|
||||
uint16_t InputBufferSize;
|
||||
/* "Next Station," the MAC address of the node to which
|
||||
/* "Next Station," the MAC address of the node to which
|
||||
This Station passes */
|
||||
/* the token. If the Next_Station is unknown, Next_Station
|
||||
/* the token. If the Next_Station is unknown, Next_Station
|
||||
shall be equal to */
|
||||
/* This_Station. */
|
||||
uint8_t Next_Station;
|
||||
@@ -99,10 +99,10 @@ struct mstp_port_struct_t {
|
||||
/* A counter of transmission retries used for Token and Poll For Master
|
||||
transmission. */
|
||||
unsigned RetryCount;
|
||||
/* A timer with nominal 5 millisecond resolution used to measure
|
||||
and generate silence on the medium between octets. It is
|
||||
incremented by a timer process and is cleared by the Receive
|
||||
State Machine when activity is detected and by the SendFrame
|
||||
/* A timer with nominal 5 millisecond resolution used to measure
|
||||
and generate silence on the medium between octets. It is
|
||||
incremented by a timer process and is cleared by the Receive
|
||||
State Machine when activity is detected and by the SendFrame
|
||||
procedure as each octet is transmitted. */
|
||||
/* Since the timer resolution is limited and the timer is not necessarily
|
||||
synchronized to other machine events, a timer value of N will actually
|
||||
@@ -122,9 +122,9 @@ struct mstp_port_struct_t {
|
||||
/* Used to store the Source Address of a received frame. */
|
||||
uint8_t SourceAddress;
|
||||
|
||||
/* The number of tokens received by this node. When this counter
|
||||
/* The number of tokens received by this node. When this counter
|
||||
reaches the value Npoll, the node polls the address range between
|
||||
TS and NS for additional master nodes. TokenCount is set to zero
|
||||
TS and NS for additional master nodes. TokenCount is set to zero
|
||||
at the end of the polling process. */
|
||||
unsigned TokenCount;
|
||||
|
||||
@@ -186,8 +186,8 @@ struct mstp_port_struct_t {
|
||||
Tframe_abort = 1 + ((60*1000UL)/RS485_Baud); */
|
||||
uint8_t Tframe_abort;
|
||||
|
||||
/* The maximum time a node may wait after reception of a frame that
|
||||
expects a reply before sending the first octet of a reply or
|
||||
/* The maximum time a node may wait after reception of a frame that
|
||||
expects a reply before sending the first octet of a reply or
|
||||
Reply Postponed frame: 250 milliseconds. */
|
||||
uint8_t Treply_delay;
|
||||
|
||||
@@ -197,15 +197,15 @@ struct mstp_port_struct_t {
|
||||
larger values for this timeout, not to exceed 300 milliseconds.) */
|
||||
uint16_t Treply_timeout;
|
||||
|
||||
/* The minimum time without a DataAvailable or ReceiveError event
|
||||
that a node must wait for a remote node to begin using a token
|
||||
or replying to a Poll For Master frame: 20 milliseconds.
|
||||
(Implementations may use larger values for this timeout,
|
||||
/* The minimum time without a DataAvailable or ReceiveError event
|
||||
that a node must wait for a remote node to begin using a token
|
||||
or replying to a Poll For Master frame: 20 milliseconds.
|
||||
(Implementations may use larger values for this timeout,
|
||||
not to exceed 35 milliseconds.) */
|
||||
uint8_t Tusage_timeout;
|
||||
|
||||
/* The minimum time after the end of the stop bit of the final
|
||||
octet of a received frame before a node may enable its
|
||||
/* The minimum time after the end of the stop bit of the final
|
||||
octet of a received frame before a node may enable its
|
||||
EIA-485 driver: 40 bit times.
|
||||
40 bits is 4 octets including a start and stop bit with each octet.
|
||||
turnaround_time_milliseconds = (Tturnaround*1000UL)/RS485_Baud; */
|
||||
@@ -233,7 +233,7 @@ BACNET_STACK_EXPORT
|
||||
bool MSTP_Line_Active(struct mstp_port_struct_t *mstp_port);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t MSTP_Create_Frame(uint8_t *buffer,
|
||||
uint16_t MSTP_Create_Frame(uint8_t *buffer,
|
||||
uint16_t buffer_len,
|
||||
uint8_t frame_type,
|
||||
uint8_t destination,
|
||||
@@ -243,7 +243,7 @@ uint16_t MSTP_Create_Frame(uint8_t *buffer,
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
void MSTP_Create_And_Send_Frame(
|
||||
struct mstp_port_struct_t *mstp_port,
|
||||
struct mstp_port_struct_t *mstp_port,
|
||||
uint8_t frame_type,
|
||||
uint8_t destination,
|
||||
uint8_t source,
|
||||
|
||||
@@ -49,12 +49,12 @@
|
||||
/* frame specific data */
|
||||
#define MSTP_PREAMBLE_X55 (0x55)
|
||||
/* The length of the data portion of a Test_Request, Test_Response,
|
||||
BACnet Data Expecting Reply, or BACnet Data Not Expecting Reply frame
|
||||
may range from 0 to 501 octets.
|
||||
The length of the data portion of a proprietary frame shall
|
||||
BACnet Data Expecting Reply, or BACnet Data Not Expecting Reply frame
|
||||
may range from 0 to 501 octets.
|
||||
The length of the data portion of a proprietary frame shall
|
||||
be in the range of 2 to 501 octets.*/
|
||||
#define MSTP_FRAME_NPDU_MAX 501
|
||||
/* COBS-encoded frames data parameter length is between
|
||||
/* COBS-encoded frames data parameter length is between
|
||||
502 and 1497 octets, inclusive */
|
||||
#define MSTP_EXTENDED_FRAME_NPDU_MAX 1497
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* @file
|
||||
* @brief Enumerations to text for BACnet Master-Slave Twisted Pair (MS/TP)
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2007
|
||||
* @date 2007
|
||||
* @copyright SPDX-License-Identifier: GPL-2.0-or-later WITH GCC-exception-2.0
|
||||
* @defgroup DLMSTP BACnet MS/TP DataLink Network Layer
|
||||
* @ingroup DataLink
|
||||
@@ -64,14 +64,14 @@ const char *mstptext_frame_type(unsigned index)
|
||||
FRAME_TYPE_PROPRIETARY_MIN, "UNKNOWN", "PROPRIETARY");
|
||||
}
|
||||
|
||||
static INDTEXT_DATA mstp_zero_config_state_text[] = {
|
||||
static INDTEXT_DATA mstp_zero_config_state_text[] = {
|
||||
{ MSTP_ZERO_CONFIG_STATE_INIT, "INIT" },
|
||||
{ MSTP_ZERO_CONFIG_STATE_IDLE, "IDLE" },
|
||||
{ MSTP_ZERO_CONFIG_STATE_LURK, "LURK" },
|
||||
{ MSTP_ZERO_CONFIG_STATE_CLAIM, "CLAIM" },
|
||||
{ MSTP_ZERO_CONFIG_STATE_CONFIRM, "CONFIRM" },
|
||||
{ MSTP_ZERO_CONFIG_STATE_USE, "USE" },
|
||||
{ 0, NULL }
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
const char *mstptext_zero_config_state(unsigned index)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @file
|
||||
* @brief API for the BACnet MS/TP defines to text functions
|
||||
* @brief API for the BACnet MS/TP defines to text functions
|
||||
* @author Steve Karg <skarg@users.sourceforge.net>
|
||||
* @date 2007
|
||||
* @copyright SPDX-License-Identifier: MIT
|
||||
|
||||
Reference in New Issue
Block a user