PR-657 Initial pass at moving glueable services into separate folders

This commit is contained in:
Garret Fick 2019-11-05 17:17:29 -05:00
parent 45034a1ec7
commit c90b92da72
16 changed files with 47 additions and 37 deletions

View File

@ -227,12 +227,13 @@ if(OPLC_MAIN_PROGRAM)
message("Compile main program enabled")
set(OPLC_USER_DIR ${PROJECT_SOURCE_DIR}/etc/src)
file(GLOB oplc_SRC runtime/core/*.cpp)
file(GLOB oplc_SRC runtime/core/*.cpp runtime/core/dnp3s/*.cpp runtime/vendor/inih-r46/*.c)
include_directories(${OPLC_USER_DIR})
include_directories(runtime/core)
include_directories(runtime/core/lib)
include_directories(runtime/vendor/spdlog-1.3.1)
include_directories(runtime/vendor/inih-r46)
include_directories(./include)
# The makefile based project put their libs here

View File

@ -26,7 +26,10 @@ endif()
include_directories(lib)
# The primary source is everything in this directory
file(GLOB oplc_SRC *.cpp)
file(GLOB oplc_SRC *.cpp dnp3s/*.cpp)
message("In runtime")
message(${oplc_SRC})
# For other part of the build, it is useful to know what are the valid
# files without the hardware layer.

View File

@ -437,7 +437,7 @@ void dnp3StartServer(int port,
/// the DNP3 server is started.
/// @param port The port to run against.
////////////////////////////////////////////////////////////////////////////////
void dnp3StartServer(int port, bool* run, const GlueVariablesBinding& binding) {
void dnp3s_start_server(int port, bool* run, const GlueVariablesBinding& binding) {
unique_ptr<istream, function<void(istream*)>> cfg_stream(new ifstream("./../webserver/dnp3.cfg"), [](istream* s)
{
reinterpret_cast<ifstream*>(s)->close();

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissionsand
// limitations under the License.
#ifndef CORE_DNP3_DNP3_H_
#define CORE_DNP3_DNP3_H_
#ifndef CORE_DNP3S_DNP3_H_
#define CORE_DNP3S_DNP3_H_
#include <cstdint>
#include <istream>
@ -153,8 +153,10 @@ asiodnp3::OutstationStackConfig dnp3_create_config(std::istream& cfg_stream,
/// @param glue_variables The glue variables that may be bound into this
/// server.
void dnp3StartServer(int port,
std::unique_ptr<std::istream, std::function<void(std::istream*)>>& cfg_stream,
bool* run,
const GlueVariablesBinding& glue_variables);
std::unique_ptr<std::istream, std::function<void(std::istream*)>>& cfg_stream,
bool* run,
const GlueVariablesBinding& glue_variables);
#endif // CORE_DNP3_DNP3_H_
#endif // CORE_DNP3S_DNP3_H_
/** @}*/

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissionsand
// limitations under the License.
#ifndef CORE_DNP3_DNP3_PUBLISHER_H_
#define CORE_DNP3_DNP3_PUBLISHER_H_
#ifndef CORE_DNP3S_DNP3_PUBLISHER_H_
#define CORE_DNP3s_DNP3_PUBLISHER_H_
#include <cstdint>
#include <memory>
@ -60,6 +60,6 @@ class Dnp3Publisher {
const Dnp3MappedGroup& measurements;
};
#endif // CORE_DNP3_DNP3_PUBLISHER_H_
#endif // CORE_DNP3S_DNP3_PUBLISHER_H_
/** @}*/

View File

@ -12,8 +12,8 @@
// See the License for the specific language governing permissionsand
// limitations under the License.
#ifndef CORE_DNP3_DNP3_RECEIVER_H_
#define CORE_DNP3_DNP3_RECEIVER_H_
#ifndef CORE_DNP3_DNP3S_RECEIVER_H_
#define CORE_DNP3_DNP3S_RECEIVER_H_
#include <cstdint>
#include <opendnp3/outstation/SimpleCommandHandler.h>
@ -83,6 +83,6 @@ class Dnp3Receiver : public opendnp3::ICommandHandler {
CacheItem<double>* const analog_commands_cache;
};
#endif // CORE_DNP3_DNP3_RECEIVER_H_
#endif // CORE_DNP3S_DNP3_RECEIVER_H_
/** @}*/

View File

@ -28,6 +28,7 @@
#include <spdlog/spdlog.h>
#include "ladder.h"
#include "enip.h"
/** \addtogroup openplc_runtime
* @{

View File

@ -2,26 +2,26 @@
// Copyright 2019 Thiago Alves
// This file is part of the OpenPLC Software Stack.
//
// OpenPLC is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// OpenPLC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with OpenPLC. If not, see <http://www.gnu.org/licenses/>.
//------
// http ://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissionsand
// limitations under the License.
// This file contains the structured used by enip.cpp to process
// EtherNet/IP requests.
// UAH, Sep 2019
//-----------------------------------------------------------------------------
/** \addtogroup openplc_runtime
* @{
*/
struct enip_header
{
@ -123,4 +123,6 @@ struct enip_data_Connected_0x70
unsigned char *request_path;//[4]
unsigned char *requestor_id;//[7]
unsigned char *pcccData;//[?]
};
};
/** @} */

View File

@ -95,4 +95,4 @@ void updateBuffersOut()
**************************************************/
}
/** @} */
/** @} */

View File

@ -21,7 +21,7 @@
#include <pthread.h>
#include <cstdint>
#include <mutex>
#include "enipStruct.h" //This header file contains necessary structs for enip.cpp
//#include "enipStruct.h" //This header file contains necessary structs for enip.cpp
/** \addtogroup openplc_runtime
* @{

View File

@ -27,9 +27,10 @@ if (NOT OPLC_DNP3_OUTSTATION)
endif()
# This is all of our test files
file(GLOB oplctest_SRC *.cpp)
file(GLOB oplctest_SRC *.cpp **/*.cpp)
file(GLOB oplc_dnp3_SRC ../core/dnp3s/*.cpp)
add_executable(oplc_unit_test ${oplctest_SRC} ../core/glue.cpp ../core/dnp3.cpp ../core/dnp3_publisher.cpp ../core/dnp3_receiver.cpp)
add_executable(oplc_unit_test ${oplctest_SRC} ${oplc_dnp3_SRC} ../core/glue.cpp )
target_link_libraries(oplc_unit_test ${OPLC_PTHREAD})
if (OPLC_DNP3_OUTSTATION)

View File

@ -24,7 +24,7 @@
void sleep_until(timespec*, int) {}
#include "glue.h"
#include "dnp3.h"
#include "dnp3s/dnp3.h"
using namespace asiodnp3;
using namespace std;

View File

@ -23,8 +23,8 @@
#include "fakeit.hpp"
#include "glue.h"
#include "dnp3.h"
#include "dnp3_publisher.h"
#include "dnp3s/dnp3.h"
#include "dnp3s/dnp3_publisher.h"
using namespace std;
using namespace fakeit;

View File

@ -16,8 +16,8 @@
#include "catch.hpp"
#include "dnp3_receiver.h"
#include "glue.h"
#include "dnp3s/dnp3_receiver.h"
using namespace std;
using namespace opendnp3;