Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

Fix remaining items for 3.0 release #367

Merged
merged 12 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ IncludeCategories:
Priority: 13
- Regex: '^(<|")testlib/'
Priority: 14
- Regex: '^(<|")catch.hpp/'
Priority: 15
- Regex: '<(.+)\.(h|hpp)' # Other external includes
Priority: 50
- Regex: '<[([:alnum:]|_).]+>' # System include
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
-DDNP3_TLS=ON
-DDNP3_TESTS=ON
-DDNP3_COVERAGE=ON
-DCMAKE_BUILD_TYPE=DEBUG
-DCMAKE_BUILD_TYPE=Debug
..
- name: Build and run tests with code coverage
if: ${{ matrix.coverage }} == "ON"
Expand All @@ -97,7 +97,7 @@ jobs:
- name: Install system dependencies
run: >
if("${{ matrix.architecture }}" -eq "x86") { $flag = "--x86" } else { $flag = "" };
choco install --no-progress "$flag" openssl; mkdir build
choco install --no-progress "$flag" cmake.portable nuget.commandline openssl; mkdir build
- name: Install Java
uses: emgre/setup-java@master
with:
Expand Down Expand Up @@ -127,6 +127,16 @@ jobs:
with:
name: opendnp3-win-${{ matrix.architecture }}-msvc-${{ matrix.build-type }}-${{ github.sha }}
path: build/opendnp3-package
- name: NuGet package
if: ${{ matrix.build-type == 'Release' }}
working-directory: build
run: cpack -G NuGet . -C ${{ matrix.build-type }}
- name: Upload NuGet package
if: ${{ matrix.build-type == 'Release' }}
uses: actions/upload-artifact@v2-preview
with:
name: opendnp3-win-${{ matrix.architecture }}-${{ github.sha }}-nuget
path: build/*.nupkg
- name: Build and test Java bindings
working-directory: java
run: >
Expand Down
19 changes: 5 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,13 @@ endif()
# External dependencies
include(./deps/asio.cmake)
include(./deps/exe4cpp.cmake)
include(./deps/log4cpp.cmake)
include(./deps/ser4cpp.cmake)

if(DNP3_TLS)
find_package(OpenSSL REQUIRED)
endif()

if(DNP3_TESTS)
if(DNP3_TESTS OR DNP3_FUZZING)
include(./deps/catch.cmake)
endif()

Expand Down Expand Up @@ -142,16 +141,7 @@ endif()
if(WIN32 AND DNP3_DOTNET)

message("The .NET framework version is: ${DNP3_DOTNET_FRAMEWORK_VERSION}")

add_subdirectory(./dotnet/CLRInterface)
add_subdirectory(./dotnet/CLRAdapter)

if(DNP3_EXAMPLES)
add_subdirectory(./dotnet/examples/master)
add_subdirectory(./dotnet/examples/master-gprs)
add_subdirectory(./dotnet/examples/master-gprs-tls)
add_subdirectory(./dotnet/examples/outstation)
endif()
add_subdirectory(./dotnet)

endif()

Expand All @@ -164,8 +154,9 @@ endif()
# Packaging
set(CPACK_PACKAGE_NAME opendnp3)
set(CPACK_PACKAGE_VENDOR "Automatak LLC")
set(CPACK_PACKAGE_DESCRIPTION "DNP3 (IEEE-1815) protocol stack")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/dnp3/opendnp3")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "DNP3 (IEEE-1815) protocol stack")
set(CPACK_PACKAGE_DESCRIPTION "OpenDNP3 is the de facto reference implementation of IEEE-1815 (DNP3), a standards-based SCADA protocol.")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://dnp3.github.io/")
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_LIST_DIR}/LICENSE)
set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_LIST_DIR}/README.md)
set(CPACK_PACKAGE_VERSION_MAJOR ${OPENDNP3_MAJOR_VERSION})
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/decoder/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(decoder ./main.cpp)
target_link_libraries (decoder PRIVATE opendnp3)
set_target_properties(decoder PROPERTIES FOLDER cpp/examples)
install(TARGETS decoder)
install(TARGETS decoder RUNTIME DESTINATION bin)
6 changes: 2 additions & 4 deletions cpp/examples/decoder/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
* limitations under the License.
*/

#include <log4cpp/Logger.h>

#include <opendnp3/ConsoleLogger.h>
#include <opendnp3/LogLevels.h>
#include <opendnp3/decoder/Decoder.h>
#include <opendnp3/logging/LogLevels.h>

#include <array>

Expand Down Expand Up @@ -53,7 +51,7 @@ Mode GetMode(const std::string& mode)

int main(int argc, char* argv[])
{
log4cpp::Logger logger(ConsoleLogger::Create(), log4cpp::ModuleId(), "decoder", log4cpp::LogLevels::everything());
Logger logger(ConsoleLogger::Create(), ModuleId(), "decoder", LogLevels::everything());
IDecoderCallbacks callback;
Decoder decoder(callback, logger);

Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/master-gprs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(master-gprs-demo ./main.cpp ./ExampleListenCallbacks.h ./ExampleListenCallbacks.cpp)
target_link_libraries (master-gprs-demo PRIVATE opendnp3)
set_target_properties(master-gprs-demo PROPERTIES FOLDER cpp/examples)
install(TARGETS master-gprs-demo)
install(TARGETS master-gprs-demo RUNTIME DESTINATION bin)
11 changes: 2 additions & 9 deletions cpp/examples/master-gprs/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <opendnp3/ConsoleLogger.h>
#include <opendnp3/DNP3Manager.h>
#include <opendnp3/LogLevels.h>
#include <opendnp3/logging/LogLevels.h>
#include <opendnp3/master/PrintingSOEHandler.h>

#include <functional>
Expand Down Expand Up @@ -56,14 +56,7 @@ int main(int argc, char* argv[])
// This is the main point of interaction with the stack
DNP3Manager manager(numThreads, ConsoleLogger::Create());

std::error_code ec;
const auto server1 = manager.CreateListener("server-20000", logFilters, IPEndpoint::AllAdapters(20000), callbacks, ec);

if (ec)
{
std::cout << ec.message() << std::endl;
return ec.value();
}
const auto server1 = manager.CreateListener("server-20000", logFilters, IPEndpoint::AllAdapters(20000), callbacks);

std::cout << "Type 'help' for a list of commands" << std::endl;
do
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/master-udp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(master-udp-demo ./main.cpp)
target_link_libraries (master-udp-demo PRIVATE opendnp3)
set_target_properties(master-udp-demo PROPERTIES FOLDER cpp/examples)
install(TARGETS master-udp-demo)
install(TARGETS master-udp-demo RUNTIME DESTINATION bin)
2 changes: 1 addition & 1 deletion cpp/examples/master-udp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#include <opendnp3/ConsoleLogger.h>
#include <opendnp3/DNP3Manager.h>
#include <opendnp3/LogLevels.h>
#include <opendnp3/channel/PrintingChannelListener.h>
#include <opendnp3/logging/LogLevels.h>
#include <opendnp3/master/DefaultMasterApplication.h>
#include <opendnp3/master/PrintingCommandResultCallback.h>
#include <opendnp3/master/PrintingSOEHandler.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/master/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(master-demo ./main.cpp)
target_link_libraries (master-demo PRIVATE opendnp3)
set_target_properties(master-demo PROPERTIES FOLDER cpp/examples)
install(TARGETS master-demo)
install(TARGETS master-demo RUNTIME DESTINATION bin)
2 changes: 1 addition & 1 deletion cpp/examples/master/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

#include <opendnp3/ConsoleLogger.h>
#include <opendnp3/DNP3Manager.h>
#include <opendnp3/LogLevels.h>
#include <opendnp3/channel/PrintingChannelListener.h>
#include <opendnp3/logging/LogLevels.h>
#include <opendnp3/master/DefaultMasterApplication.h>
#include <opendnp3/master/PrintingCommandResultCallback.h>
#include <opendnp3/master/PrintingSOEHandler.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/outstation-udp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(outstation-udp-demo ./main.cpp)
target_link_libraries (outstation-udp-demo PRIVATE opendnp3)
set_target_properties(outstation-udp-demo PROPERTIES FOLDER cpp/examples)
install(TARGETS outstation-udp-demo)
install(TARGETS outstation-udp-demo RUNTIME DESTINATION bin)
2 changes: 1 addition & 1 deletion cpp/examples/outstation-udp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
#include <opendnp3/ConsoleLogger.h>
#include <opendnp3/DNP3Manager.h>
#include <opendnp3/LogLevels.h>
#include <opendnp3/channel/PrintingChannelListener.h>
#include <opendnp3/logging/LogLevels.h>
#include <opendnp3/outstation/DefaultOutstationApplication.h>
#include <opendnp3/outstation/IUpdateHandler.h>
#include <opendnp3/outstation/SimpleCommandHandler.h>
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/outstation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(outstation-demo ./main.cpp)
target_link_libraries (outstation-demo PRIVATE opendnp3)
set_target_properties(outstation-demo PROPERTIES FOLDER cpp/examples)
install(TARGETS outstation-demo)
install(TARGETS outstation-demo RUNTIME DESTINATION bin)
15 changes: 12 additions & 3 deletions cpp/examples/outstation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
#include <opendnp3/ConsoleLogger.h>
#include <opendnp3/DNP3Manager.h>
#include <opendnp3/LogLevels.h>
#include <opendnp3/channel/PrintingChannelListener.h>
#include <opendnp3/logging/LogLevels.h>
#include <opendnp3/outstation/DefaultOutstationApplication.h>
#include <opendnp3/outstation/IUpdateHandler.h>
#include <opendnp3/outstation/SimpleCommandHandler.h>
Expand Down Expand Up @@ -70,8 +70,17 @@ int main(int argc, char* argv[])
DNP3Manager manager(1, ConsoleLogger::Create());

// Create a TCP server (listener)
auto channel = manager.AddTCPServer("server", logLevels, ServerAcceptMode::CloseExisting, IPEndpoint("0.0.0.0", 20000),
PrintingChannelListener::Create());
auto channel = std::shared_ptr<IChannel>(nullptr);
try
{
channel = manager.AddTCPServer("server", logLevels, ServerAcceptMode::CloseExisting, IPEndpoint("asdf", 20000),
PrintingChannelListener::Create());
}
catch(const std::exception& e)
{
std::cerr << e.what() << '\n';
return -1;
}

// The main object for a outstation. The defaults are useable,
// but understanding the options are important.
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/tls/master-gprs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(master-gprs-tls-demo ./main.cpp)
target_link_libraries (master-gprs-tls-demo PRIVATE opendnp3)
set_target_properties(master-gprs-tls-demo PROPERTIES FOLDER cpp/examples/tls)
install(TARGETS master-gprs-tls-demo)
install(TARGETS master-gprs-tls-demo RUNTIME DESTINATION bin)
11 changes: 2 additions & 9 deletions cpp/examples/tls/master-gprs/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <opendnp3/LogLevels.h>

#include <opendnp3/ConsoleLogger.h>
#include <opendnp3/DNP3Manager.h>
#include <opendnp3/logging/LogLevels.h>
#include <opendnp3/master/DefaultListenCallbacks.h>

#include <iostream>
Expand Down Expand Up @@ -56,15 +56,8 @@ int main(int argc, char* argv[])
// This is the main point of interaction with the stack
DNP3Manager manager(numThread, ConsoleLogger::Create());

std::error_code ec;
auto server1 = manager.CreateListener("server-20001", logLevels, IPEndpoint::AllAdapters(20001),
TLSConfig(caCertificate, certificateChain, privateKey, 2), callbacks, ec);

if (ec)
{
std::cout << ec.message() << std::endl;
return ec.value();
}
TLSConfig(caCertificate, certificateChain, privateKey, 2), callbacks);

do
{
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/tls/master/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(master-tls-demo ./main.cpp)
target_link_libraries (master-tls-demo PRIVATE opendnp3)
set_target_properties(master-tls-demo PROPERTIES FOLDER cpp/examples/tls)
install(TARGETS master-tls-demo)
install(TARGETS master-tls-demo RUNTIME DESTINATION bin)
12 changes: 2 additions & 10 deletions cpp/examples/tls/master/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <opendnp3/LogLevels.h>

#include <opendnp3/ConsoleLogger.h>
#include <opendnp3/DNP3Manager.h>
#include <opendnp3/channel/PrintingChannelListener.h>
#include <opendnp3/logging/LogLevels.h>
#include <opendnp3/master/DefaultMasterApplication.h>
#include <opendnp3/master/PrintingCommandResultCallback.h>
#include <opendnp3/master/PrintingSOEHandler.h>
Expand Down Expand Up @@ -51,18 +51,10 @@ int main(int argc, char* argv[])
// send log messages to the console
DNP3Manager manager(1, ConsoleLogger::Create());

std::error_code ec;

// Connect via a TCPClient socket to a outstation
auto channel = manager.AddTLSClient(
"tls-client", logLevels, ChannelRetry::Default(), {IPEndpoint("127.0.0.1", 20001)}, "0.0.0.0",
TLSConfig(peerCertificate, privateKey, privateKey), PrintingChannelListener::Create(), ec);

if (ec)
{
std::cout << "Unable to create tls client: " << ec.message() << std::endl;
return ec.value();
}
TLSConfig(peerCertificate, privateKey, privateKey), PrintingChannelListener::Create());

// The master config object for a master. The default are
// useable, but understanding the options are important.
Expand Down
2 changes: 1 addition & 1 deletion cpp/examples/tls/outstation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_executable(outstation-tls-demo ./main.cpp)
target_link_libraries (outstation-tls-demo PRIVATE opendnp3)
set_target_properties(outstation-tls-demo PROPERTIES FOLDER cpp/examples/tls)
install(TARGETS outstation-tls-demo)
install(TARGETS outstation-tls-demo RUNTIME DESTINATION bin)
12 changes: 2 additions & 10 deletions cpp/examples/tls/outstation/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
#include <opendnp3/ConsoleLogger.h>
#include <opendnp3/DNP3Manager.h>
#include <opendnp3/LogLevels.h>
#include <opendnp3/channel/PrintingChannelListener.h>
#include <opendnp3/logging/LogLevels.h>
#include <opendnp3/outstation/DefaultOutstationApplication.h>
#include <opendnp3/outstation/SimpleCommandHandler.h>
#include <opendnp3/outstation/UpdateBuilder.h>
Expand Down Expand Up @@ -77,18 +77,10 @@ int main(int argc, char* argv[])
// Allocate a single thread to the pool since this is a single outstation
DNP3Manager manager(1, ConsoleLogger::Create());

std::error_code ec;

// Create a TCP server (listener)
auto channel = manager.AddTLSServer("server", logLevels, ServerAcceptMode::CloseExisting, IPEndpoint("0.0.0.0", 20001),
TLSConfig(caCertificate, certificateChain, privateKey, 2),
PrintingChannelListener::Create(), ec);

if (ec)
{
std::cout << "Unable to create tls server: " << ec.message() << std::endl;
return ec.value();
}
PrintingChannelListener::Create());

// The main object for a outstation. The defaults are useable,
// but understanding the options are important.
Expand Down