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:
Kari Argillander
2024-08-25 22:13:57 +03:00
committed by GitHub
parent 9e0657424e
commit 369da70f2a
455 changed files with 7147 additions and 7249 deletions
+17 -17
View File
@@ -40,8 +40,8 @@ Adding additional services is a matter of adding the encoding and decoding for
the service into/from meaningful data, and I like to add unit testing, a demo
handler and send function, as well as a demo command line example.
For each service that you add to your project or makefile, you will need to
add a handler and possibly a sending function. There are example handlers
For each service that you add to your project or makefile, you will need to
add a handler and possibly a sending function. There are example handlers
and send functions for all the services that the stack supports:
* demo/handler/h_alarm_ack.c - Alarm ACK service handler example
@@ -121,7 +121,7 @@ example object files in the BACnet stack include:
* demo/object/lsp.c - life safety point object demo
* demo/object/mso.c - multi-step output object demo
The BACnet stack includes a number of core files that handle the service
The BACnet stack includes a number of core files that handle the service
packets that come in from the datalink layer. The core files include:
* apdu.c - handles dispatching the services to the proper handlers
@@ -134,11 +134,11 @@ packets that come in from the datalink layer. The core files include:
* demo/handler/h_npdu.c - handles dispatching of the network message
to the apdu dispatcher.
The DataLink Layer controls orderly access to the physical medium.
The stack currently supports one datalink layer at a time, and uses a
macro defined in config.h or your makefile/project to choose the macro
functions defined in datalink.h. The following files are used for the
datalink handling in this BACnet stack, and may have to be developed for
The DataLink Layer controls orderly access to the physical medium.
The stack currently supports one datalink layer at a time, and uses a
macro defined in config.h or your makefile/project to choose the macro
functions defined in datalink.h. The following files are used for the
datalink handling in this BACnet stack, and may have to be developed for
your particular hardware:
* bip.c - BACnet/IP functionality - depends on bip_init.c in port/xx
@@ -149,15 +149,15 @@ your particular hardware:
* arcnet.c - ARCNET datalink layer functionality, in port/xx
* ethernet.c - BACnet Ethernet datalink layer functionality, in port/xx
There are a dozen demonstration applications in the demo directory,
along with many demonstation objects and handlers. All the demos accept
command line options and have been tested under Win32 and Linux.
There is a makefile in the respective demo directory for Linux and
for Borland C++ compilers, and a master makefile at the root level
There are a dozen demonstration applications in the demo directory,
along with many demonstation objects and handlers. All the demos accept
command line options and have been tested under Win32 and Linux.
There is a makefile in the respective demo directory for Linux and
for Borland C++ compilers, and a master makefile at the root level
(Makefile=Linux, makefile.b32=Borland).
The simplest demonstration is to run demo/server/bacserv on one PC (or
virtual PC), and run the other client demonstration applications one
at time on another PC (or virtual PC). Monitor the network communcations
using Wireshark protocol analyzer, or test the BACnet server using
The simplest demonstration is to run demo/server/bacserv on one PC (or
virtual PC), and run the other client demonstration applications one
at time on another PC (or virtual PC). Monitor the network communcations
using Wireshark protocol analyzer, or test the BACnet server using
BACnet Visual Test Shell VTS3.
+14 -14
View File
@@ -1,38 +1,38 @@
To build the Doxygen documentation for the BACnet Stack:
- Install doxygen as described at
- Install doxygen as described at
http://www.stack.nl/~dimitri/doxygen/install.html
- If you want to generate call graphs (recommended - very nice! - but takes
signficantly longer to build the documents), you must also have
- If you want to generate call graphs (recommended - very nice! - but takes
signficantly longer to build the documents), you must also have
graphviz installed.
- To build from the command line, just enter
doxygen BACnet-stack.doxyfile
- Output is built in doc/output/html, and there is a convenient
starting point at doc/output/BAC_stack.html.
- If you use Eclipse,
- If you use Eclipse,
- install the eClox plugin to support doxygen within Eclipse
- Build the documents by right clicking on BACnet-stack.doxyfile,
and selecting "@ Build Documentation"
- Feel free to tweak the doxygen output to your tastes, interests, and
- Feel free to tweak the doxygen output to your tastes, interests, and
choice of output formats.
- The Latex output could be converted into a PDF (see doxygen manual,
and google for your issues).
- I have tried the PDF, man, and RTF outputs and not liked the results
for any of them (500+ pages). I recommend the HTML output, as it is
well organized and has an obvious flow, both of which the others lack.
The doxygen output is not checked into this project because it consists of
over 5,000 little files (for HTML with call graphs), and it is easily
over 5,000 little files (for HTML with call graphs), and it is easily
regenerated.
For speed, the function call graphs are not enabled in the SVN version
of the doxyfile. To enable them, edit BACnet-stack.doxyfile (with a
text editor or with GUI-based editors in Eclipse or using the
doxywizard application) and change
text editor or with GUI-based editors in Eclipse or using the
doxywizard application) and change
HAVE_DOT = YES
CALLER_GRAPH = YES
Following the doxygen website's lead, I found the D-Bus project to be a good
Following the doxygen website's lead, I found the D-Bus project to be a good
example of the sort of documentation we needed to have here.
http://dbus.freedesktop.org/doc/dbus/api/html/index.html
@@ -48,7 +48,7 @@ whitespace, like a function per page, ~600 pages, not usefully organized).
Ditto for RTF and man output.
I could not find a linux-based compiled help compiler, so I resorted to using
Microsoft's. They seem to be pushing some later generation tools, and
Microsoft's. They seem to be pushing some later generation tools, and
maybe someone knows if that's a good thing, but I opted for their now
fairly old HTML Help Workshop, version 4.74.
Doxygen nicely arranges the html input, so pretty much all you have to do
-1
View File
@@ -158,4 +158,3 @@ Q-18: I have downloaded the BACnet stack but can't get Who-Is or EPICS applicati
A-18: Firewalls on modern OS block incoming and outgoing network traffic and require you to 'allow' the port that BACnet/IP uses. To allow the default BACnet/IP UDP port 47808 Linux with UFW:
$ sudo ufw allow 47808/udp
-1
View File
@@ -5,4 +5,3 @@ Q1: Cannot open include file: 'winsock2.h'
A1: Install the Microsoft Platform SDK:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/default.aspx
+1 -1
View File
@@ -1,4 +1,4 @@
SLOC Directory SLOC-by-Language (Sorted)
SLOC Directory SLOC-by-Language (Sorted)
118011 ports ansic=101988,asm=10755,cpp=4651,xml=463,sh=154
78632 src_bacnet ansic=78632
28295 test ansic=27663,cpp=598,xml=34
+1 -1
View File
@@ -29,4 +29,4 @@ X. Change WhoIs demo to list all I-Am's received such that duplicate
IDs with different MAC addresses can be detected.
Y. Add tsm_alloc to allocate memory and invoke ID for sending.
Z. Make alternate TSM that handles segmentation.
AA. Create debug.c module for PC ports which replace printf and fix line end.
AA. Create debug.c module for PC ports which replace printf and fix line end.
+1 -1
View File
@@ -11,4 +11,4 @@ $ sudo apt-get install clang-tools
$ sudo apt-get install clang-format
$ sudo apt-get install sloccount
$ sudo apt-get install liwc
$ sudo apt-get install tofrodos
$ sudo apt-get install tofrodos
+10 -11
View File
@@ -1,6 +1,6 @@
There are a dozen or so demo applications that are built
with the default makefiles. These demo applications are
copied to the bin/ directory. They can be used in
copied to the bin/ directory. They can be used in
scripts and batch files to test BACnet devices or query
information on the BACnet network, as well as simulate
a BACnet device.
@@ -11,14 +11,14 @@ BACNET_IFACE - interface to use for the datalink layer
For Linux, this is something like eth0 or /dev/ttyS0.
For Windows, this is something like 192.168.0.1 or COM4
Defaults to NULL.
BACNET_IP_PORT - BACnet/IP port number.
BACNET_IP_PORT - BACnet/IP port number.
Defaults to 47808.
BACNET_BBMD_PORT - BACnet/IP BBMD port number.
Defaults to 47808.
BACNET_BBMD_TIMETOLIVE - BACnet/IP BBMD time-to-live seconds.
BACNET_BBMD_TIMETOLIVE - BACnet/IP BBMD time-to-live seconds.
Defaults to 0xFFFF.
BACNET_BBMD_ADDRESS - dotted IP address or domain name of BBMD.
@@ -26,17 +26,17 @@ BACNET_BBMD_ADDRESS - dotted IP address or domain name of BBMD.
BACNET_MAX_INFO_FRAMES - BACnet MS/TP max-info-frames parameter.
Defaults to 127.
BACNET_MSTP_BAUD - BACnet MS/TP baud rate.
BACNET_MSTP_BAUD - BACnet MS/TP baud rate.
Defaults to 38400.
BACNET_MSTP_MAC - BACnet MS/TP MAC address.
BACNET_MSTP_MAC - BACnet MS/TP MAC address.
Defaults to 127.
The demo client applications can also perform static
address binding using the file "address_cache" in the
The demo client applications can also perform static
address binding using the file "address_cache" in the
directory where the application is called (defined
in src/address.c file). The format of the address_cache
in src/address.c file). The format of the address_cache
is a line by line of device ids and addresses:
55555 AC:10:56:06:BA:C0 26001 19 50
where:
@@ -45,4 +45,3 @@ AC:10:56:06:BA:C0=MAC address (router address) in hex
26001=DNET network number in decimal
19=DADR MAC address in hex. Use colon to separate multibyte address.
50=Max APDU
+45 -45
View File
@@ -34,10 +34,10 @@ for C++ headers and converts them.
Don't initialize variables in their declaration with non-constant
values. Not all compilers support this. E.g. don't use
uint32_t i = somearray[2];
uint32_t i = somearray[2];
use
uint32_t i;
i = somearray[2];
uint32_t i;
i = somearray[2];
instead.
Don't use zero-length arrays; not all compilers support them. If an
@@ -76,43 +76,43 @@ unsigned integers.
Don't use a label without a statement following it. For example,
something such as
if (...) {
if (...) {
...
...
done:
}
done:
}
will not work with all compilers - you have to do
if (...) {
if (...) {
...
...
done:
;
}
done:
;
}
with some statements, even if it's a null statement, after the label.
Don't use "bzero()", "bcopy()", or "bcmp()"; instead, use the ANSI C
routines
"memset()" (with zero as the second argument, so that it sets
all the bytes to zero);
"memset()" (with zero as the second argument, so that it sets
all the bytes to zero);
"memcpy()" or "memmove()" (note that the first and second
arguments to "memcpy()" are in the reverse order to the
arguments to "bcopy()"; note also that "bcopy()" is typically
guaranteed to work on overlapping memory regions, while
"memcpy()" isn't, so if you may be copying from one region to a
region that overlaps it, use "memmove()", not "memcpy()" - but
"memcpy()" might be faster as a result of not guaranteeing
correct operation on overlapping memory regions);
"memcpy()" or "memmove()" (note that the first and second
arguments to "memcpy()" are in the reverse order to the
arguments to "bcopy()"; note also that "bcopy()" is typically
guaranteed to work on overlapping memory regions, while
"memcpy()" isn't, so if you may be copying from one region to a
region that overlaps it, use "memmove()", not "memcpy()" - but
"memcpy()" might be faster as a result of not guaranteeing
correct operation on overlapping memory regions);
and "memcmp()" (note that "memcmp()" returns 0, 1, or -1, doing
an ordered comparison, rather than just returning 0 for "equal"
and 1 for "not equal", as "bcmp()" does).
and "memcmp()" (note that "memcmp()" returns 0, 1, or -1, doing
an ordered comparison, rather than just returning 0 for "equal"
and 1 for "not equal", as "bcmp()" does).
Not all platforms necessarily have "bzero()"/"bcopy()"/"bcmp()", and
those that do might not declare them in the header file on which they're
@@ -166,25 +166,25 @@ file is to be created if it doesn't exist), and OR in the O_BINARY flag.
That flag is not present on most, if not all, UNIX systems, so you must
also do
#ifndef O_BINARY
#define O_BINARY 0
#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
to properly define it for UNIX (it's not necessary on UNIX).
Don't use forward declarations of static arrays without a specified size
in a fashion such as this:
static const value_string foo_vals[];
static const value_string foo_vals[];
...
...
static const value_string foo_vals[] = {
{ 0, "Red" },
{ 1, "Green" },
{ 2, "Blue" },
{ 0, NULL }
};
static const value_string foo_vals[] = {
{ 0, "Red" },
{ 1, "Green" },
{ 2, "Blue" },
{ 0, NULL }
};
as some compilers will reject the first of those statements. Instead,
initialize the array at the point at which it's first declared, so that
@@ -194,11 +194,11 @@ Don't put declarations in the middle of a block; put them before all
code. Not all compilers support declarations in the middle of code,
such as
int i;
int i;
i = foo();
i = foo();
int j;
int j;
For #define names and enum member names, prefix the names with a tag so
as to avoid collisions with other names - this might be more of an issue
@@ -207,20 +207,20 @@ OPTIONAL.
Don't use "variadic macros", such as
#define DBG(format, args...) fprintf(stderr, format, ## args)
#define DBG(format, args...) fprintf(stderr, format, ## args)
as not all C compilers support them. Use macros that take a fixed
number of arguments, such as
#define DBG0(format) fprintf(stderr, format)
#define DBG1(format, arg1) fprintf(stderr, format, arg1)
#define DBG2(format, arg1, arg2) fprintf(stderr, format, arg1, arg2)
#define DBG0(format) fprintf(stderr, format)
#define DBG1(format, arg1) fprintf(stderr, format, arg1)
#define DBG2(format, arg1, arg2) fprintf(stderr, format, arg1, arg2)
...
...
or something such as
#define DBG(args) printf args
#define DBG(args) printf args
Instead of tmpnam(), use mkstemp(). tmpnam is insecure and should
not be used any more. Note: mkstemp does not accept NULL as a parameter.
+2 -2
View File
@@ -1,8 +1,8 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE>BACnet stack - open source BACnet protocol stack</TITLE>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE>BACnet stack - open source BACnet protocol stack</TITLE>
</HEAD>
<BODY LANG="en-US">
<img src="images/BACnet.png" align=right>
+2 -2
View File
@@ -50,7 +50,7 @@ $ bacrp 123 1 101 85
If you want read the Priority-Array of Analog Output 101
in Device 123, you could send the following command:
$ bacrp 123 1 101 87
If you want read the length of Priority-Array of Analog
If you want read the length of Priority-Array of Analog
Output 101 in Device 123, you could send the following command:
$ bacrp 123 1 101 87 0
@@ -91,7 +91,7 @@ The default Max-Master is 127.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_BAUD
If non-null, a value baud rate of 9600, 19200, 38400, 57600,
and 115200.
and 115200.
The default baud rate is 9600.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_MAC
+3 -3
View File
@@ -13,7 +13,7 @@ bacwi \- send BACnet WhoIs service request to BACnet devices
an I-Am service response from one or more BACnet devices
on the network. I-Am responses include a Device Object-Identifier,
a Vendor-Identifier, a Max-APDU size, and segmentation information.
By its nature, I-Am responses include the source address and
By its nature, I-Am responses include the source address and
any network layer information necessary to communicate with the
device.
@@ -70,7 +70,7 @@ The default Max-Master is 127.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_BAUD
If non-null, a value baud rate of 9600, 19200, 38400, 57600,
and 115200.
and 115200.
The default baud rate is 9600.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_MAC
@@ -100,4 +100,4 @@ Steve Karg <skarg@users.sourceforge.net>
.BR bacucov (1),
.BR bacwh (1),
.BR bacwp (1),
.BR address_cache (5)
.BR address_cache (5)
+12 -12
View File
@@ -10,7 +10,7 @@ bacwp \- send BACnet WriteProperty service request to a BACnet device
.SH DESCRIPTION
.B bacrp uses the BACnet WriteProperty service request to write
a property value to a BACnet device on the network. WhoIs and
a property value to a BACnet device on the network. WhoIs and
I-Am are used for device binding. A simple Ack or error message
is returned to stdio.
@@ -40,21 +40,21 @@ Present Value property, the property is 85.
.IP "priority"
This parameter is used for setting the priority of the
write. If Priority 0 is given, no priority is sent. The BACnet
standard states that the value is written at the lowest
write. If Priority 0 is given, no priority is sent. The BACnet
standard states that the value is written at the lowest
priority (16) if the object property supports priorities
when no priority is sent.
.IP "index"
This integer parameter is the index number of an array.
If the property is a BACnetARRAY and writable, individual
elements can be written. If this parameter value is -1,
If the property is a BACnetARRAY and writable, individual
elements can be written. If this parameter value is -1,
it is omitted when writing to the property.
.IP "tag"
Tag is the integer value of the enumeration BACNET_APPLICATION_TAG
Tag is the integer value of the enumeration BACNET_APPLICATION_TAG
in bacenum.h. It is the data type of the value that you are
writing. For example, if you were writing a REAL value, you would
writing. For example, if you were writing a REAL value, you would
use a tag of 4.
Context tags are created using two tags in a row. The context tag
is preceded by a C. Ctag tag. C2 4 creates a context 2 tagged REAL.
@@ -62,16 +62,16 @@ is preceded by a C. Ctag tag. C2 4 creates a context 2 tagged REAL.
.IP "value"
The value is an ASCII representation of some type of data that you
are writing. It is encoded using the tag information provided. For
example, if you were writing a REAL value of 100.0, you would use
example, if you were writing a REAL value of 100.0, you would use
100.0 as the value. If you were writing an Object-Identifier such
as Device object 1, you would use 8:1 as the value. If you were
writing a Boolean, a value of 0 would indicate false, and a non-zero
value would indicate true.
writing a Boolean, a value of 0 would indicate false, and a non-zero
value would indicate true.
.SH BACnet Tags
Here is a brief overview of BACnet property and tags:
Certain properties are expected to be written with certain
Certain properties are expected to be written with certain
application tags, so you probably need to know which ones to use
with each property of each object. It is almost safe to say that
given a property and an object and a table, the tag could be looked
@@ -127,7 +127,7 @@ The default Max-Master is 127.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_BAUD
If non-null, a value baud rate of 9600, 19200, 38400, 57600,
and 115200.
and 115200.
The default baud rate is 9600.
Used for BACnet MS/TP datalink only.
.IP BACNET_MSTP_MAC