├── .gitignore ├── .travis.yml ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── Dockerfile ├── Makefile.am ├── NEWS ├── README.md ├── StatusCodes.csv ├── astylerc ├── autogen.sh ├── build.sh ├── configure.ac ├── debian.soft ├── debian ├── README.Debian ├── README.source ├── changelog.in ├── compat ├── control ├── copyright ├── docs ├── libopcuaclient-dev.dirs ├── libopcuaclient-dev.install ├── libopcuaclient.dirs ├── libopcuaclient.install ├── libopcuacore-dev.dirs ├── libopcuacore-dev.install ├── libopcuacore.dirs ├── libopcuacore.install ├── libopcuaprotocol-dev.dirs ├── libopcuaprotocol-dev.install ├── libopcuaprotocol.dirs ├── libopcuaprotocol.install ├── libopcuaserver-dev.dirs ├── libopcuaserver-dev.install ├── libopcuaserver.dirs ├── libopcuaserver.install ├── manpage.1.ex ├── rules └── source │ └── format ├── include └── opc │ ├── common │ ├── addons_core │ │ ├── addon.h │ │ ├── addon_manager.h │ │ ├── addon_parameters.h │ │ ├── config_file.h │ │ ├── dynamic_addon.h │ │ ├── dynamic_addon_factory.h │ │ └── errors.h │ ├── class_pointers.h │ ├── errors.h │ ├── exception.h │ ├── interface.h │ ├── logger.h │ ├── modules.h │ ├── thread.h │ └── uri_facade.h │ ├── spdlog │ ├── LICENSE │ ├── README.md │ ├── async_logger.h │ ├── common.h │ ├── details │ │ ├── async_log_helper.h │ │ ├── async_logger_impl.h │ │ ├── file_helper.h │ │ ├── log_msg.h │ │ ├── logger_impl.h │ │ ├── mpmc_bounded_q.h │ │ ├── null_mutex.h │ │ ├── os.h │ │ ├── pattern_formatter_impl.h │ │ ├── registry.h │ │ └── spdlog_impl.h │ ├── fmt │ │ ├── bundled │ │ │ ├── format.cc │ │ │ ├── format.h │ │ │ ├── ostream.cc │ │ │ ├── ostream.h │ │ │ ├── posix.cc │ │ │ ├── posix.h │ │ │ └── time.h │ │ ├── fmt.h │ │ └── ostr.h │ ├── formatter.h │ ├── logger.h │ ├── sinks │ │ ├── android_sink.h │ │ ├── ansicolor_sink.h │ │ ├── base_sink.h │ │ ├── dist_sink.h │ │ ├── file_sinks.h │ │ ├── msvc_sink.h │ │ ├── null_sink.h │ │ ├── ostream_sink.h │ │ ├── sink.h │ │ ├── stdout_sinks.h │ │ ├── syslog_sink.h │ │ └── wincolor_sink.h │ ├── spdlog.h │ └── tweakme.h │ └── ua │ ├── client │ ├── addon.h │ ├── binary_client.h │ ├── client.h │ └── remote_connection.h │ ├── connection_listener.h │ ├── errors.h │ ├── event.h │ ├── global.h │ ├── model.h │ ├── node.h │ ├── protocol │ ├── attribute_ids.h │ ├── binary │ │ ├── common.h │ │ └── stream.h │ ├── channel.h │ ├── data_value.h │ ├── datetime.h │ ├── describe.h │ ├── endpoints.h │ ├── enums.h │ ├── expanded_object_ids.h │ ├── extension_identifiers.h │ ├── guid.h │ ├── input_from_buffer.h │ ├── message_identifiers.h │ ├── monitored_items.h │ ├── node_management.h │ ├── nodeid.h │ ├── object_ids.h │ ├── protocol.h │ ├── protocol_auto.h │ ├── reference_ids.h │ ├── secure_channel.h │ ├── session.h │ ├── status_codes.h │ ├── string_utils.h │ ├── strings.h │ ├── types.h │ ├── types_manual.h │ ├── utils.h │ ├── variable_access_level.h │ ├── variant.h │ ├── variant_visitor.h │ └── view.h │ ├── server │ ├── addons │ │ ├── address_space.h │ │ ├── asio_addon.h │ │ ├── common_addons.h │ │ ├── endpoints_services.h │ │ ├── opc_tcp_async.h │ │ ├── opcua_protocol.h │ │ ├── services_registry.h │ │ ├── standard_address_space.h │ │ ├── subscription_service.h │ │ └── xml_ns.h │ ├── address_space.h │ ├── endpoints_services.h │ ├── opc_tcp_async.h │ ├── server.h │ ├── services_registry.h │ ├── standard_address_space.h │ └── subscription_service.h │ ├── server_operations.h │ ├── services │ ├── attributes.h │ ├── endpoints.h │ ├── method.h │ ├── node_management.h │ ├── services.h │ ├── subscriptions.h │ └── view.h │ ├── socket_channel.h │ └── subscription.h ├── libopcuaclient.pc.in ├── libopcuacore.pc.in ├── libopcuaprotocol.pc.in ├── libopcuaserver.pc.in ├── make_deb.sh ├── python ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── LICENSE ├── MANIFEST.in ├── Makefile.am ├── NEWS ├── README ├── README.md ├── TODO ├── configure.ac ├── examples │ ├── client.py │ ├── event_client.py │ ├── inductive_client.py │ ├── nodeopcuaclient.py │ ├── prosysclient.py │ ├── server.py │ └── user_address_space.xml ├── setup.py ├── src │ ├── py_opcua_enums.cpp │ ├── py_opcua_enums.h │ ├── py_opcua_enums_AttributeId.cpp │ ├── py_opcua_enums_ObjectId.cpp │ ├── py_opcua_enums_StatusCode.cpp │ ├── py_opcua_helpers.h │ ├── py_opcua_module.cpp │ ├── py_opcua_subscriptionclient.cpp │ ├── py_opcua_subscriptionclient.h │ └── py_opcua_variant.h └── tests │ ├── Makefile │ ├── setup.py │ ├── test.py │ ├── test_computer.cpp │ └── test_highlevel.py ├── restyle ├── schemas ├── AttributeIds.csv ├── NodeIds.csv ├── OPCBinarySchema.xsd ├── Opc.Ua.Adi.NodeSet2.xml ├── Opc.Ua.Adi.Types.bsd ├── Opc.Ua.Adi.Types.xsd ├── Opc.Ua.Di.NodeSet2.xml ├── Opc.Ua.Di.Types.bsd ├── Opc.Ua.Di.Types.xsd ├── Opc.Ua.Endpoints.wsdl ├── Opc.Ua.NodeSet2.Part10.xml ├── Opc.Ua.NodeSet2.Part11.xml ├── Opc.Ua.NodeSet2.Part13.xml ├── Opc.Ua.NodeSet2.Part3.xml ├── Opc.Ua.NodeSet2.Part4.xml ├── Opc.Ua.NodeSet2.Part5.xml ├── Opc.Ua.NodeSet2.Part8.xml ├── Opc.Ua.NodeSet2.Part9.xml ├── Opc.Ua.NodeSet2.xml ├── Opc.Ua.Services.wsdl ├── Opc.Ua.Types.bsd ├── Opc.Ua.Types.xsd ├── SecuredApplication.xsd ├── StatusCode.csv ├── UANodeSet.xsd ├── UAVariant.xsd ├── codegen.py ├── download.py ├── generate_address_space.py ├── generate_model.py ├── generate_protocol.py └── regen ├── src ├── client │ ├── binary_client.cpp │ ├── binary_client_addon.cpp │ ├── binary_connection.cpp │ └── client.cpp ├── clientapp │ ├── configs │ │ └── opc_tcp.conf │ ├── opcua_main.cpp │ ├── opcua_options.cpp │ ├── opcua_options.h │ └── opcua_options_attribute_ids.h ├── core │ ├── common │ │ ├── addons_core │ │ │ ├── addon_manager.cpp │ │ │ ├── config_file.cpp │ │ │ ├── dynamic_addon_factory.cpp │ │ │ ├── dynamic_library.h │ │ │ ├── dynamic_library_lin.cpp │ │ │ ├── dynamic_library_win.cpp │ │ │ └── errors_addon_manager.cpp │ │ ├── common_errors.cpp │ │ ├── exception.cpp │ │ ├── thread.cpp │ │ ├── uri_facade_lin.cpp │ │ ├── uri_facade_lin_noregex.cpp │ │ ├── uri_facade_win.cpp │ │ └── value.cpp │ ├── event.cpp │ ├── model_impl.h │ ├── model_node.cpp │ ├── model_object.cpp │ ├── model_object_type.cpp │ ├── model_server.cpp │ ├── model_variable.cpp │ ├── node.cpp │ ├── opcua_errors.cpp │ ├── server_operations.cpp │ ├── socket_channel.cpp │ └── subscription.cpp ├── examples │ ├── example_client.cpp │ └── example_server.cpp ├── protocol │ ├── binary_attribute.cpp │ ├── binary_data_value.cpp │ ├── binary_endpoints.cpp │ ├── binary_messages.cpp │ ├── binary_node_management.cpp │ ├── binary_raw_size.cpp │ ├── binary_serialization.h │ ├── binary_session.cpp │ ├── binary_stream.cpp │ ├── binary_variant.cpp │ ├── binary_view.cpp │ ├── constructors_auto.cpp │ ├── deserialize_auto.cpp │ ├── input_from_buffer.cpp │ ├── monitored_items.cpp │ ├── nodeid.cpp │ ├── protocol.cpp │ ├── rawsize_auto.cpp │ ├── serialize_auto.cpp │ ├── session.cpp │ ├── status_codes.cpp │ ├── string_utils.cpp │ ├── string_utils_attributeid_tostring.cpp │ ├── string_utils_objectid_tostring.cpp │ ├── string_utils_statuscode_tostring.cpp │ └── subscriptions.cpp ├── server │ ├── address_space_addon.cpp │ ├── address_space_addon.h │ ├── address_space_internal.cpp │ ├── address_space_internal.h │ ├── asio_addon.cpp │ ├── common_addons.cpp │ ├── endpoints_parameters.cpp │ ├── endpoints_parameters.h │ ├── endpoints_registry.cpp │ ├── endpoints_services_addon.cpp │ ├── internal_subscription.cpp │ ├── internal_subscription.h │ ├── opc_tcp_async.cpp │ ├── opc_tcp_async_addon.cpp │ ├── opc_tcp_async_parameters.cpp │ ├── opc_tcp_async_parameters.h │ ├── opc_tcp_processor.cpp │ ├── opc_tcp_processor.h │ ├── opcua_protocol.h │ ├── opcua_protocol_addon.cpp │ ├── server.cpp │ ├── server_object.cpp │ ├── server_object.h │ ├── server_object_addon.cpp │ ├── server_object_addon.h │ ├── services_registry_factory.cpp │ ├── services_registry_impl.cpp │ ├── standard_address_space.cpp │ ├── standard_address_space_addon.cpp │ ├── standard_address_space_part10.cpp │ ├── standard_address_space_part11.cpp │ ├── standard_address_space_part13.cpp │ ├── standard_address_space_part3.cpp │ ├── standard_address_space_part4.cpp │ ├── standard_address_space_part5.cpp │ ├── standard_address_space_part8.cpp │ ├── standard_address_space_part9.cpp │ ├── standard_address_space_parts.h │ ├── subscription_service_addon.cpp │ ├── subscription_service_internal.cpp │ ├── subscription_service_internal.h │ ├── tcp_server.cpp │ ├── tcp_server.h │ ├── timer.h │ ├── xml_address_space_addon.cpp │ ├── xml_address_space_loader.cpp │ ├── xml_address_space_loader.h │ └── xml_processor.h └── serverapp │ ├── configs │ ├── opcuaserver │ ├── opcuaserver.conf │ ├── server.conf │ └── standard_address_space.xml │ ├── daemon.cpp │ ├── daemon.h │ ├── daemon_lin.cpp │ ├── daemon_win.cpp │ ├── server_main.cpp │ ├── server_options.cpp │ └── server_options.h └── tests ├── client ├── binary_handshake.cpp ├── common.h ├── computer_attribute.cpp ├── computer_connect.cpp ├── computer_endpoints.cpp ├── computer_session.cpp └── computer_view.cpp ├── core ├── common │ ├── addons_manager_test.cpp │ ├── error_test.cpp │ ├── main.cpp │ └── thread_test.cpp ├── configs │ └── test.conf ├── test_addon_manager.cpp ├── test_config_file.cpp ├── test_dynamic_addon.cpp ├── test_dynamic_addon.h ├── test_dynamic_addon_factory.cpp ├── test_dynamic_addon_id.h └── test_uri.cpp ├── gmock ├── CHANGES ├── CMakeLists.txt ├── CONTRIBUTORS ├── LICENSE ├── Makefile.am ├── README ├── configure.ac ├── fused-src │ ├── gmock-gtest-all.cc │ ├── gmock │ │ └── gmock.h │ ├── gmock_main.cc │ └── gtest │ │ └── gtest.h ├── gtest │ ├── CHANGES │ ├── CMakeLists.txt │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── Makefile.am │ ├── README │ ├── cmake │ │ └── internal_utils.cmake │ ├── codegear │ │ ├── gtest.cbproj │ │ ├── gtest.groupproj │ │ ├── gtest_all.cc │ │ ├── gtest_link.cc │ │ ├── gtest_main.cbproj │ │ └── gtest_unittest.cbproj │ ├── configure.ac │ ├── fused-src │ │ └── gtest │ │ │ ├── gtest.h │ │ │ └── gtest_main.cc │ ├── include │ │ └── gtest │ │ │ ├── gtest-death-test.h │ │ │ ├── gtest-message.h │ │ │ ├── gtest-param-test.h │ │ │ ├── gtest-param-test.h.pump │ │ │ ├── gtest-printers.h │ │ │ ├── gtest-spi.h │ │ │ ├── gtest-test-part.h │ │ │ ├── gtest-typed-test.h │ │ │ ├── gtest.h │ │ │ ├── gtest_pred_impl.h │ │ │ ├── gtest_prod.h │ │ │ └── internal │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-linked_ptr.h │ │ │ ├── gtest-param-util-generated.h │ │ │ ├── gtest-param-util-generated.h.pump │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-tuple.h │ │ │ ├── gtest-tuple.h.pump │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ ├── m4 │ │ ├── acx_pthread.m4 │ │ └── gtest.m4 │ ├── make │ │ └── Makefile │ ├── msvc │ │ ├── gtest-md.sln │ │ ├── gtest-md.vcproj │ │ ├── gtest.sln │ │ ├── gtest.vcproj │ │ ├── gtest_main-md.vcproj │ │ ├── gtest_main.vcproj │ │ ├── gtest_prod_test-md.vcproj │ │ ├── gtest_prod_test.vcproj │ │ ├── gtest_unittest-md.vcproj │ │ └── gtest_unittest.vcproj │ ├── samples │ │ ├── prime_tables.h │ │ ├── sample1.cc │ │ ├── sample1.h │ │ ├── sample10_unittest.cc │ │ ├── sample1_unittest.cc │ │ ├── sample2.cc │ │ ├── sample2.h │ │ ├── sample2_unittest.cc │ │ ├── sample3-inl.h │ │ ├── sample3_unittest.cc │ │ ├── sample4.cc │ │ ├── sample4.h │ │ ├── sample4_unittest.cc │ │ ├── sample5_unittest.cc │ │ ├── sample6_unittest.cc │ │ ├── sample7_unittest.cc │ │ ├── sample8_unittest.cc │ │ └── sample9_unittest.cc │ ├── scripts │ │ ├── fuse_gtest_files.py │ │ ├── fuse_gtest_files.pyc │ │ ├── gen_gtest_pred_impl.py │ │ ├── gtest-config.in │ │ ├── pump.py │ │ └── test │ │ │ └── Makefile │ ├── src │ │ ├── gtest-all.cc │ │ ├── gtest-death-test.cc │ │ ├── gtest-filepath.cc │ │ ├── gtest-internal-inl.h │ │ ├── gtest-port.cc │ │ ├── gtest-printers.cc │ │ ├── gtest-test-part.cc │ │ ├── gtest-typed-test.cc │ │ ├── gtest.cc │ │ └── gtest_main.cc │ ├── test │ │ ├── gtest-death-test_ex_test.cc │ │ ├── gtest-death-test_test.cc │ │ ├── gtest-filepath_test.cc │ │ ├── gtest-linked_ptr_test.cc │ │ ├── gtest-listener_test.cc │ │ ├── gtest-message_test.cc │ │ ├── gtest-options_test.cc │ │ ├── gtest-param-test2_test.cc │ │ ├── gtest-param-test_test.cc │ │ ├── gtest-param-test_test.h │ │ ├── gtest-port_test.cc │ │ ├── gtest-printers_test.cc │ │ ├── gtest-test-part_test.cc │ │ ├── gtest-tuple_test.cc │ │ ├── gtest-typed-test2_test.cc │ │ ├── gtest-typed-test_test.cc │ │ ├── gtest-typed-test_test.h │ │ ├── gtest-unittest-api_test.cc │ │ ├── gtest_all_test.cc │ │ ├── gtest_break_on_failure_unittest.py │ │ ├── gtest_break_on_failure_unittest_.cc │ │ ├── gtest_catch_exceptions_test.py │ │ ├── gtest_catch_exceptions_test_.cc │ │ ├── gtest_color_test.py │ │ ├── gtest_color_test_.cc │ │ ├── gtest_env_var_test.py │ │ ├── gtest_env_var_test_.cc │ │ ├── gtest_environment_test.cc │ │ ├── gtest_filter_unittest.py │ │ ├── gtest_filter_unittest_.cc │ │ ├── gtest_help_test.py │ │ ├── gtest_help_test_.cc │ │ ├── gtest_list_tests_unittest.py │ │ ├── gtest_list_tests_unittest_.cc │ │ ├── gtest_main_unittest.cc │ │ ├── gtest_no_test_unittest.cc │ │ ├── gtest_output_test.py │ │ ├── gtest_output_test_.cc │ │ ├── gtest_output_test_golden_lin.txt │ │ ├── gtest_pred_impl_unittest.cc │ │ ├── gtest_premature_exit_test.cc │ │ ├── gtest_prod_test.cc │ │ ├── gtest_repeat_test.cc │ │ ├── gtest_shuffle_test.py │ │ ├── gtest_shuffle_test_.cc │ │ ├── gtest_sole_header_test.cc │ │ ├── gtest_stress_test.cc │ │ ├── gtest_test_utils.py │ │ ├── gtest_throw_on_failure_ex_test.cc │ │ ├── gtest_throw_on_failure_test.py │ │ ├── gtest_throw_on_failure_test_.cc │ │ ├── gtest_uninitialized_test.py │ │ ├── gtest_uninitialized_test_.cc │ │ ├── gtest_unittest.cc │ │ ├── gtest_xml_outfile1_test_.cc │ │ ├── gtest_xml_outfile2_test_.cc │ │ ├── gtest_xml_outfiles_test.py │ │ ├── gtest_xml_output_unittest.py │ │ ├── gtest_xml_output_unittest_.cc │ │ ├── gtest_xml_test_utils.py │ │ ├── production.cc │ │ └── production.h │ └── xcode │ │ ├── Config │ │ ├── DebugProject.xcconfig │ │ ├── FrameworkTarget.xcconfig │ │ ├── General.xcconfig │ │ ├── ReleaseProject.xcconfig │ │ ├── StaticLibraryTarget.xcconfig │ │ └── TestTarget.xcconfig │ │ ├── Resources │ │ └── Info.plist │ │ ├── Samples │ │ └── FrameworkSample │ │ │ ├── Info.plist │ │ │ ├── WidgetFramework.xcodeproj │ │ │ └── project.pbxproj │ │ │ ├── runtests.sh │ │ │ ├── widget.cc │ │ │ ├── widget.h │ │ │ └── widget_test.cc │ │ ├── Scripts │ │ ├── runtests.sh │ │ └── versiongenerate.py │ │ └── gtest.xcodeproj │ │ └── project.pbxproj ├── include │ └── gmock │ │ ├── gmock-actions.h │ │ ├── gmock-cardinalities.h │ │ ├── gmock-generated-actions.h │ │ ├── gmock-generated-actions.h.pump │ │ ├── gmock-generated-function-mockers.h │ │ ├── gmock-generated-function-mockers.h.pump │ │ ├── gmock-generated-matchers.h │ │ ├── gmock-generated-matchers.h.pump │ │ ├── gmock-generated-nice-strict.h │ │ ├── gmock-generated-nice-strict.h.pump │ │ ├── gmock-matchers.h │ │ ├── gmock-more-actions.h │ │ ├── gmock-more-matchers.h │ │ ├── gmock-spec-builders.h │ │ ├── gmock.h │ │ └── internal │ │ ├── gmock-generated-internal-utils.h │ │ ├── gmock-generated-internal-utils.h.pump │ │ ├── gmock-internal-utils.h │ │ └── gmock-port.h ├── make │ └── Makefile ├── msvc │ ├── 2005 │ │ ├── gmock.sln │ │ ├── gmock.vcproj │ │ ├── gmock_config.vsprops │ │ ├── gmock_main.vcproj │ │ └── gmock_test.vcproj │ └── 2010 │ │ ├── gmock.sln │ │ ├── gmock.vcxproj │ │ ├── gmock_config.props │ │ ├── gmock_main.vcxproj │ │ └── gmock_test.vcxproj ├── scripts │ ├── fuse_gmock_files.py │ ├── generator │ │ ├── LICENSE │ │ ├── README │ │ ├── README.cppclean │ │ ├── cpp │ │ │ ├── __init__.py │ │ │ ├── ast.py │ │ │ ├── gmock_class.py │ │ │ ├── keywords.py │ │ │ ├── tokenize.py │ │ │ └── utils.py │ │ └── gmock_gen.py │ └── gmock-config.in ├── src │ ├── gmock-all.cc │ ├── gmock-cardinalities.cc │ ├── gmock-internal-utils.cc │ ├── gmock-matchers.cc │ ├── gmock-spec-builders.cc │ ├── gmock.cc │ └── gmock_main.cc └── test │ ├── gmock-actions_test.cc │ ├── gmock-cardinalities_test.cc │ ├── gmock-generated-actions_test.cc │ ├── gmock-generated-function-mockers_test.cc │ ├── gmock-generated-internal-utils_test.cc │ ├── gmock-generated-matchers_test.cc │ ├── gmock-internal-utils_test.cc │ ├── gmock-matchers_test.cc │ ├── gmock-more-actions_test.cc │ ├── gmock-nice-strict_test.cc │ ├── gmock-port_test.cc │ ├── gmock-spec-builders_test.cc │ ├── gmock_all_test.cc │ ├── gmock_ex_test.cc │ ├── gmock_leak_test.py │ ├── gmock_leak_test_.cc │ ├── gmock_link2_test.cc │ ├── gmock_link_test.cc │ ├── gmock_link_test.h │ ├── gmock_output_test.py │ ├── gmock_output_test_.cc │ ├── gmock_output_test_golden.txt │ ├── gmock_stress_test.cc │ ├── gmock_test.cc │ └── gmock_test_utils.py ├── gtest ├── CHANGES ├── CMakeLists.txt ├── CONTRIBUTORS ├── LICENSE ├── Makefile.am ├── README ├── cmake │ └── internal_utils.cmake ├── codegear │ ├── gtest.cbproj │ ├── gtest.groupproj │ ├── gtest_all.cc │ ├── gtest_link.cc │ ├── gtest_main.cbproj │ └── gtest_unittest.cbproj ├── configure.ac ├── fused-src │ └── gtest │ │ └── gtest_main.cc ├── include │ └── gtest │ │ ├── gtest-death-test.h │ │ ├── gtest-message.h │ │ ├── gtest-param-test.h │ │ ├── gtest-param-test.h.pump │ │ ├── gtest-printers.h │ │ ├── gtest-spi.h │ │ ├── gtest-test-part.h │ │ ├── gtest-typed-test.h │ │ ├── gtest.h │ │ ├── gtest_pred_impl.h │ │ ├── gtest_prod.h │ │ └── internal │ │ ├── gtest-death-test-internal.h │ │ ├── gtest-filepath.h │ │ ├── gtest-internal.h │ │ ├── gtest-linked_ptr.h │ │ ├── gtest-param-util-generated.h │ │ ├── gtest-param-util-generated.h.pump │ │ ├── gtest-param-util.h │ │ ├── gtest-port.h │ │ ├── gtest-string.h │ │ ├── gtest-tuple.h │ │ ├── gtest-tuple.h.pump │ │ ├── gtest-type-util.h │ │ └── gtest-type-util.h.pump ├── m4 │ ├── acx_pthread.m4 │ └── gtest.m4 ├── make │ └── Makefile ├── msvc │ ├── gtest-md.sln │ ├── gtest-md.vcproj │ ├── gtest.sln │ ├── gtest.vcproj │ ├── gtest_main-md.vcproj │ ├── gtest_main.vcproj │ ├── gtest_prod_test-md.vcproj │ ├── gtest_prod_test.vcproj │ ├── gtest_unittest-md.vcproj │ └── gtest_unittest.vcproj ├── samples │ ├── prime_tables.h │ ├── sample1.cc │ ├── sample1.h │ ├── sample10_unittest.cc │ ├── sample1_unittest.cc │ ├── sample2.cc │ ├── sample2.h │ ├── sample2_unittest.cc │ ├── sample3-inl.h │ ├── sample3_unittest.cc │ ├── sample4.cc │ ├── sample4.h │ ├── sample4_unittest.cc │ ├── sample5_unittest.cc │ ├── sample6_unittest.cc │ ├── sample7_unittest.cc │ ├── sample8_unittest.cc │ └── sample9_unittest.cc ├── scripts │ ├── fuse_gtest_files.py │ ├── gen_gtest_pred_impl.py │ ├── gtest-config.in │ ├── pump.py │ └── test │ │ └── Makefile ├── src │ ├── gtest-all.cc │ ├── gtest-death-test.cc │ ├── gtest-filepath.cc │ ├── gtest-internal-inl.h │ ├── gtest-port.cc │ ├── gtest-printers.cc │ ├── gtest-test-part.cc │ ├── gtest-typed-test.cc │ ├── gtest.cc │ └── gtest_main.cc ├── test │ ├── gtest-death-test_ex_test.cc │ ├── gtest-death-test_test.cc │ ├── gtest-filepath_test.cc │ ├── gtest-linked_ptr_test.cc │ ├── gtest-listener_test.cc │ ├── gtest-message_test.cc │ ├── gtest-options_test.cc │ ├── gtest-param-test2_test.cc │ ├── gtest-param-test_test.cc │ ├── gtest-param-test_test.h │ ├── gtest-port_test.cc │ ├── gtest-printers_test.cc │ ├── gtest-test-part_test.cc │ ├── gtest-tuple_test.cc │ ├── gtest-typed-test2_test.cc │ ├── gtest-typed-test_test.cc │ ├── gtest-typed-test_test.h │ ├── gtest-unittest-api_test.cc │ ├── gtest_all_test.cc │ ├── gtest_break_on_failure_unittest.py │ ├── gtest_break_on_failure_unittest_.cc │ ├── gtest_catch_exceptions_test.py │ ├── gtest_catch_exceptions_test_.cc │ ├── gtest_color_test.py │ ├── gtest_color_test_.cc │ ├── gtest_env_var_test.py │ ├── gtest_env_var_test_.cc │ ├── gtest_environment_test.cc │ ├── gtest_filter_unittest.py │ ├── gtest_filter_unittest_.cc │ ├── gtest_help_test.py │ ├── gtest_help_test_.cc │ ├── gtest_list_tests_unittest.py │ ├── gtest_list_tests_unittest_.cc │ ├── gtest_main_unittest.cc │ ├── gtest_no_test_unittest.cc │ ├── gtest_output_test.py │ ├── gtest_output_test_.cc │ ├── gtest_output_test_golden_lin.txt │ ├── gtest_pred_impl_unittest.cc │ ├── gtest_premature_exit_test.cc │ ├── gtest_prod_test.cc │ ├── gtest_repeat_test.cc │ ├── gtest_shuffle_test.py │ ├── gtest_shuffle_test_.cc │ ├── gtest_sole_header_test.cc │ ├── gtest_stress_test.cc │ ├── gtest_test_utils.py │ ├── gtest_throw_on_failure_ex_test.cc │ ├── gtest_throw_on_failure_test.py │ ├── gtest_throw_on_failure_test_.cc │ ├── gtest_uninitialized_test.py │ ├── gtest_uninitialized_test_.cc │ ├── gtest_unittest.cc │ ├── gtest_xml_outfile1_test_.cc │ ├── gtest_xml_outfile2_test_.cc │ ├── gtest_xml_outfiles_test.py │ ├── gtest_xml_output_unittest.py │ ├── gtest_xml_output_unittest_.cc │ ├── gtest_xml_test_utils.py │ ├── production.cc │ └── production.h └── xcode │ ├── Config │ ├── DebugProject.xcconfig │ ├── FrameworkTarget.xcconfig │ ├── General.xcconfig │ ├── ReleaseProject.xcconfig │ ├── StaticLibraryTarget.xcconfig │ └── TestTarget.xcconfig │ ├── Resources │ └── Info.plist │ ├── Samples │ └── FrameworkSample │ │ ├── Info.plist │ │ ├── WidgetFramework.xcodeproj │ │ └── project.pbxproj │ │ ├── runtests.sh │ │ ├── widget.cc │ │ ├── widget.h │ │ └── widget_test.cc │ ├── Scripts │ ├── runtests.sh │ └── versiongenerate.py │ └── gtest.xcodeproj │ └── project.pbxproj ├── protocol ├── binary_deserialize.cpp ├── binary_node_management.cpp ├── binary_serialize.cpp ├── binary_serialize_attribute.cpp ├── binary_serialize_data_value.cpp ├── binary_serialize_endpoints.cpp ├── binary_serialize_monitored_items.cpp ├── binary_serialize_session.cpp ├── binary_serialize_variant.cpp ├── binary_serialize_view.cpp ├── binary_subscriptions.cpp ├── common.h ├── message_id.cpp ├── node_id.cpp ├── reference_id.cpp ├── test_input_from_buffer.cpp └── utils.cpp └── server ├── address_space_registry_test.h ├── address_space_ut.cpp ├── base_node.xml ├── builtin_server.h ├── builtin_server_addon.h ├── builtin_server_factory.cpp ├── builtin_server_impl.cpp ├── builtin_server_impl.h ├── builtin_server_test.h ├── common.cpp ├── common.h ├── configs └── test_addon.conf ├── empty.xml ├── endpoints_services_test.cpp ├── endpoints_services_test.h ├── invalid_root.xml ├── invalid_version.xml ├── model_object_type_ut.cpp ├── model_object_ut.cpp ├── model_variable_ut.cpp ├── no_version.xml ├── opcua_protocol_addon_test.cpp ├── opcua_protocol_addon_test.h ├── predefined_references.xml ├── services_registry_test.h ├── standard_namespace_test.h ├── standard_namespace_ut.cpp ├── test_server_options.cpp ├── xml_address_space_addon_ut.cpp └── xml_addressspace_ut.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | *.swn 3 | 4 | # C extensions 5 | *.so 6 | *.o 7 | 8 | # Packages 9 | autom4te.cache/ 10 | bin 11 | build 12 | config.log 13 | config.status 14 | develop-eggs 15 | dist 16 | *.egg 17 | *.egg-info 18 | eggs 19 | .DS_Store 20 | .installed.cfg 21 | lib 22 | lib64 23 | .libs/ 24 | Makefile 25 | parts 26 | __pycache__ 27 | sdist 28 | var 29 | *.lo 30 | *.dirstamp 31 | *.deps/ 32 | m4/ 33 | cov-int 34 | config.* 35 | /*.in 36 | aclocal.m4 37 | build-aux 38 | configure 39 | ar-lib 40 | depcomp 41 | missing 42 | 43 | 44 | # Installer logs 45 | pip-log.txt 46 | 47 | # Unit tst / coverage reports 48 | .coverage 49 | .tox 50 | nosetests.xml 51 | 52 | # Translations 53 | *.mo 54 | 55 | # Mr Developer 56 | .mr.developer.cfg 57 | .project 58 | .pydevproject 59 | 60 | # Autogeneration 61 | schemas/ET 62 | schemas/gm 63 | schemas/struct_list.txt 64 | schemas/sys 65 | 66 | Debug/ 67 | Release/ 68 | 69 | compile 70 | install-sh 71 | ltmain.sh 72 | python/INSTALL 73 | python/Makefile.in 74 | python/install-sh 75 | test-driver 76 | tests/gmock/Makefile.in 77 | tests/gmock/gtest/Makefile.in 78 | tests/gtest/Makefile.in 79 | debian/changelog 80 | libopcuaclient.pc 81 | libopcuacore.pc 82 | libopcuaprotocol.pc 83 | libopcuaserver.pc 84 | libtool 85 | stamp-h1 86 | tests/gmock/gtest/libtool 87 | tests/gmock/gtest/scripts/gtest-config 88 | tests/gmock/libtool 89 | tests/gmock/scripts/gmock-config 90 | tests/gtest/libtool 91 | tests/gtest/scripts/gtest-config 92 | .mypy_cache 93 | vscode 94 | 95 | # QtCreator 96 | CMakeLists.txt.user 97 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: xenial 2 | language: cpp 3 | compiler: gcc 4 | env: VERBOSE=1 5 | 6 | install: 7 | - sudo apt-get install libboost-all-dev -qq 8 | - sudo apt-get install libboost-python-dev -qq 9 | - sudo apt-get install libcppunit-dev 10 | 11 | #script: autoreconf -f -i && ./configure --disable-python-bindings && make && make check 12 | script: autoreconf -f -i && ./configure && make && make check 13 | 14 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Rykovanov Alexander (rykovanov.as@gmail.com) 2 | Olivier Roulet-Dubonnet (olivier.roulet@gmail.com) 3 | Matthieu Bec (mdcb808@gmail.com) 4 | 5 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/freeopcua/6eac0975636425d2e122b228ca69fea2d30c9ce6/ChangeLog -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM debian:jessie 2 | MAINTAINER Beau Trepp 3 | ENV DEBIAN_FRONTEND noninteractive 4 | RUN apt-get clean && apt-get update && apt-get install -y \ 5 | gcc \ 6 | g++ \ 7 | make \ 8 | autoconf \ 9 | automake \ 10 | libtool \ 11 | libboost-dev \ 12 | libboost-thread-dev \ 13 | libboost-program-options-dev \ 14 | libboost-system-dev \ 15 | libboost-filesystem-dev \ 16 | libcppunit-dev \ 17 | pkg-config git \ 18 | python-dev \ 19 | libboost-python-dev \ 20 | gsoap \ 21 | libxml2-dev \ 22 | build-essential \ 23 | autotools-dev \ 24 | dh-make \ 25 | debhelper \ 26 | devscripts \ 27 | fakeroot \ 28 | xutils \ 29 | lintian \ 30 | pbuilder \ 31 | reprepro 32 | ADD / /tmp/freeopcua 33 | WORKDIR /tmp/freeopcua 34 | RUN ./build.sh 35 | RUN make check 36 | RUN make install 37 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/freeopcua/6eac0975636425d2e122b228ca69fea2d30c9ce6/NEWS -------------------------------------------------------------------------------- /astylerc: -------------------------------------------------------------------------------- 1 | --break-blocks 2 | --break-blocks=all 3 | --add-brackets 4 | --add-one-line-brackets 5 | --suffix=none 6 | --indent=spaces=2 7 | --convert-tabs 8 | -A7 9 | --align-pointer=middle 10 | --align-reference=middle 11 | --pad-header 12 | --pad-oper 13 | --unpad-paren 14 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | autoreconf -f -i 3 | 4 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./autogen.sh && ./configure && make 3 | 4 | -------------------------------------------------------------------------------- /debian.soft: -------------------------------------------------------------------------------- 1 | apt-get install gcc g++ make autoconf automake libtool \ 2 | libboost-dev libboost-thread-dev libboost-program-options-dev \ 3 | libboost-system-dev libboost-filesystem-dev \ 4 | libcppunit-dev pkg-config git python-dev libboost-python-dev \ 5 | gsoap libxml2-dev build-essential autotools-dev dh-make \ 6 | debhelper devscripts fakeroot xutils lintian pbuilder \ 7 | reprepro libmbedtls-dev 8 | 9 | -------------------------------------------------------------------------------- /debian/README.Debian: -------------------------------------------------------------------------------- 1 | opcuaserver for Debian 2 | ------------------------ 3 | 4 | 5 | 6 | -- Alexander Rykovanov Mon, 30 Dec 2013 21:51:58 +0400 7 | -------------------------------------------------------------------------------- /debian/README.source: -------------------------------------------------------------------------------- 1 | opcuaserver for Debian 2 | ------------------------ 3 | 4 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /debian/changelog.in: -------------------------------------------------------------------------------- 1 | freeopcua (@PACKAGE_VERSION@) unstable; urgency=low 2 | 3 | * Release @PACKAGE_VERSION@ 4 | 5 | -- Alexander Rykovanov @RELEASE_DATE@ 6 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 8 2 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: freeopcua 3 | source: https://github.com/treww/opcua-server/archive/master.zip 4 | 5 | Files: * 6 | Copyright: 2013 Alexander Rykovanov (rykovanov.as@gmail.com) 7 | License: LGPL-3.0+ 8 | This package is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 3 of the License, or (at your option) any later version. 12 | . 13 | This package is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | . 18 | You should have received a copy of the GNU General Public License 19 | along with this program. If not, see . 20 | . 21 | On Debian systems, the complete text of the GNU Lesser General 22 | Public License can be found in "/usr/share/common-licenses/LGPL-3". 23 | 24 | # Please also look if there are files or directories which have a 25 | # different copyright/license attached and list them here. 26 | # Please avoid to pick license terms that are more restrictive than the 27 | # packaged work, as it may make Debian's contributions unacceptable upstream. 28 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- 1 | NEWS 2 | README.md 3 | -------------------------------------------------------------------------------- /debian/libopcuaclient-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/include 2 | -------------------------------------------------------------------------------- /debian/libopcuaclient-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/opc/ua/client/* 2 | usr/lib/*/pkgconfig/libopcuaclient.pc 3 | -------------------------------------------------------------------------------- /debian/libopcuaclient.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | -------------------------------------------------------------------------------- /debian/libopcuaclient.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libopcuaclient.so* 2 | -------------------------------------------------------------------------------- /debian/libopcuacore-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/include 2 | -------------------------------------------------------------------------------- /debian/libopcuacore-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/opc/common/* 2 | usr/include/opc/spdlog/* 3 | usr/include/opc/ua/connection_listener.h 4 | usr/include/opc/ua/errors.h 5 | usr/include/opc/ua/event.h 6 | usr/include/opc/ua/global.h 7 | usr/include/opc/ua/model.h 8 | usr/include/opc/ua/node.h 9 | usr/include/opc/ua/server_operations.h 10 | usr/include/opc/ua/services/* 11 | usr/include/opc/ua/socket_channel.h 12 | usr/include/opc/ua/subscription.h 13 | usr/lib/cmake/FreeOpcUa/* 14 | usr/lib/*/pkgconfig/libopcuacore.pc 15 | -------------------------------------------------------------------------------- /debian/libopcuacore.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | -------------------------------------------------------------------------------- /debian/libopcuacore.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libopcuacore.so* 2 | -------------------------------------------------------------------------------- /debian/libopcuaprotocol-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/include 2 | -------------------------------------------------------------------------------- /debian/libopcuaprotocol-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/opc/ua/protocol/* 2 | usr/lib/*/pkgconfig/libopcuaprotocol.pc 3 | -------------------------------------------------------------------------------- /debian/libopcuaprotocol.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | -------------------------------------------------------------------------------- /debian/libopcuaprotocol.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libopcuaprotocol.so* 2 | -------------------------------------------------------------------------------- /debian/libopcuaserver-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/include 2 | -------------------------------------------------------------------------------- /debian/libopcuaserver-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/opc/ua/server/* 2 | usr/lib/*/pkgconfig/libopcuaserver.pc 3 | -------------------------------------------------------------------------------- /debian/libopcuaserver.dirs: -------------------------------------------------------------------------------- 1 | etc/opcua 2 | usr/bin 3 | usr/lib 4 | var/log/opcua 5 | 6 | -------------------------------------------------------------------------------- /debian/libopcuaserver.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/libopcuaserver.so* 2 | -------------------------------------------------------------------------------- /debian/manpage.1.ex: -------------------------------------------------------------------------------- 1 | .\" Hey, EMACS: -*- nroff -*- 2 | .\" (C) Copyright 2013 Alexander Rykovanov , 3 | .\" 4 | .\" First parameter, NAME, should be all caps 5 | .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection 6 | .\" other parameters are allowed: see man(7), man(1) 7 | .TH OPCUAMAPPINGS SECTION "December 30, 2013" 8 | .\" Please adjust this date whenever revising the manpage. 9 | .\" 10 | .\" Some roff macros, for reference: 11 | .\" .nh disable hyphenation 12 | .\" .hy enable hyphenation 13 | .\" .ad l left justify 14 | .\" .ad b justify to both left and right margins 15 | .\" .nf disable filling 16 | .\" .fi enable filling 17 | .\" .br insert line break 18 | .\" .sp insert n+1 empty lines 19 | .\" for manpage-specific macros, see man(7) 20 | .SH NAME 21 | opcuaserver \- program to do something 22 | .SH SYNOPSIS 23 | .B opcuaserver 24 | .RI [ options ] " files" ... 25 | .br 26 | .B bar 27 | .RI [ options ] " files" ... 28 | .SH DESCRIPTION 29 | This manual page documents briefly the 30 | .B opcuaserver 31 | and 32 | .B bar 33 | commands. 34 | .PP 35 | .\" TeX users may be more comfortable with the \fB\fP and 36 | .\" \fI\fP escape sequences to invode bold face and italics, 37 | .\" respectively. 38 | \fBopcuaserver\fP is a program that... 39 | .SH OPTIONS 40 | These programs follow the usual GNU command line syntax, with long 41 | options starting with two dashes (`-'). 42 | A summary of options is included below. 43 | For a complete description, see the Info files. 44 | .TP 45 | .B \-h, \-\-help 46 | Show summary of options. 47 | .TP 48 | .B \-v, \-\-version 49 | Show version of program. 50 | .SH SEE ALSO 51 | .BR bar (1), 52 | .BR baz (1). 53 | .br 54 | The programs are documented fully by 55 | .IR "The Rise and Fall of a Fooish Bar" , 56 | available via the Info system. 57 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | %: 13 | dh $@ --with autotools-dev 14 | 15 | override_dh_auto_configure: 16 | dh_auto_configure -- $(CONFIGURE_OPTIONS) 17 | 18 | override_dh_shlibdeps: 19 | dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info 20 | 21 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /include/opc/common/addons_core/addon.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Addon interface definition 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __COMMON_ADDON_H__ 12 | #define __COMMON_ADDON_H__ 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace Common 20 | { 21 | 22 | class Addon : private Common::Interface 23 | { 24 | public: 25 | DEFINE_CLASS_POINTERS(Addon) 26 | 27 | public: 28 | /// @brief initialize addon. 29 | /// @note Calls when all addons dependencies resolved. 30 | /// suppose that addon fully ready for work. 31 | virtual void Initialize(AddonsManager & manager, const AddonParameters & parameters) = 0; 32 | 33 | /// @brief Stopping addon work. 34 | /// After calling this method addon should throw exception on any calls. 35 | virtual void Stop() = 0; 36 | }; 37 | 38 | // @brief factory of addon. 39 | class AddonFactory : private Common::Interface 40 | { 41 | public: 42 | DEFINE_CLASS_POINTERS(AddonFactory) 43 | 44 | public: 45 | /// @brief Create instance of addon. 46 | virtual Addon::UniquePtr CreateAddon() = 0; 47 | }; 48 | 49 | } // namespace Common 50 | 51 | #endif // __COMMON_ADDON_H__ 52 | 53 | -------------------------------------------------------------------------------- /include/opc/common/addons_core/addon_parameters.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Addon parameters 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #ifndef OPCCORE_ADDONS_CORE_ADDON_PARAMETERS_H 13 | #define OPCCORE_ADDONS_CORE_ADDON_PARAMETERS_H 14 | 15 | #include 16 | #include 17 | 18 | namespace Common 19 | { 20 | 21 | struct Parameter 22 | { 23 | std::string Name; 24 | std::string Value; 25 | 26 | Parameter() 27 | { 28 | } 29 | 30 | Parameter(const std::string & name, const std::string & value) 31 | : Name(name) 32 | , Value(value) 33 | { 34 | } 35 | }; 36 | 37 | struct ParametersGroup 38 | { 39 | std::string Name; 40 | std::vector Parameters; 41 | std::vector Groups; 42 | 43 | ParametersGroup() 44 | { 45 | } 46 | 47 | ParametersGroup(const std::string & name) 48 | : Name(name) 49 | { 50 | } 51 | }; 52 | 53 | 54 | struct AddonParameters 55 | { 56 | std::vector Groups; 57 | std::vector Parameters; 58 | }; 59 | 60 | } 61 | 62 | #endif // OPCCORE_ADDONS_CORE_ADDON_PARAMETERS_H 63 | 64 | -------------------------------------------------------------------------------- /include/opc/common/addons_core/config_file.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | namespace Common 17 | { 18 | 19 | struct ModuleConfiguration 20 | { 21 | AddonId Id; 22 | std::vector Dependencies; 23 | std::string Path; 24 | AddonParameters Parameters; 25 | }; 26 | 27 | typedef std::vector ModulesConfiguration; 28 | 29 | struct Configuration 30 | { 31 | Common::AddonParameters Parameters; 32 | std::vector Modules; 33 | }; 34 | 35 | Common::AddonInformation GetAddonInfomation(const ModuleConfiguration & config); 36 | 37 | Configuration ParseConfiguration(const std::string & configPath); 38 | void SaveConfiguration(const ModulesConfiguration & configuration, const std::string & configPath); 39 | 40 | Configuration ParseConfigurationFiles(const std::string & directory); 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /include/opc/common/addons_core/dynamic_addon.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Addon interface definition 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef OPC_CORE_DYNAMIC_ADDON_H 12 | #define OPC_CORE_DYNAMIC_ADDON_H 13 | 14 | #include 15 | 16 | extern "C" Common::Addon * CreateAddon(); 17 | 18 | typedef Common::Addon * (*CreateAddonFunc)(); 19 | 20 | #endif // OPC_CORE_DYNAMIC_ADDON_H 21 | 22 | -------------------------------------------------------------------------------- /include/opc/common/addons_core/dynamic_addon_factory.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Addon interface definition 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef OPC_CORE_DYNAMIC_ADDON_FACTORY_H 12 | #define OPC_CORE_DYNAMIC_ADDON_FACTORY_H 13 | 14 | #include 15 | 16 | 17 | namespace Common 18 | { 19 | 20 | AddonFactory::UniquePtr CreateDynamicAddonFactory(const char * modulePath); 21 | 22 | inline AddonFactory::UniquePtr CreateDynamicAddonFactory(const std::string & modulePath) 23 | { 24 | return ::Common::CreateDynamicAddonFactory(modulePath.c_str()); 25 | } 26 | 27 | } 28 | 29 | #endif // OPC_CORE_DYNAMIC_ADDON_FACTORY_H 30 | 31 | -------------------------------------------------------------------------------- /include/opc/common/addons_core/errors.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Errors of Addons Manager 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | extern Common::ErrorData UnableToRegisterAddonWhenStarted; 16 | extern Common::ErrorData AddonsManagerAlreadyStarted; 17 | extern Common::ErrorData AddonsManagerAlreadyStopped; 18 | extern Common::ErrorData AddonNotFound; 19 | extern Common::ErrorData AddonNotInitializedYet; 20 | extern Common::ErrorData AddonNotRegistered; 21 | extern Common::ErrorData AddonRegisteredButShouldnt; 22 | extern Common::ErrorData AddonIsNotStarted; 23 | extern Common::ErrorData UnableToLoadDynamicLibrary; 24 | extern Common::ErrorData UnableToFundSymbolInTheLibrary; 25 | extern Common::ErrorData FailedToStartAddons; 26 | -------------------------------------------------------------------------------- /include/opc/common/class_pointers.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Exception declarations 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __class_pointers_h__74b02386_fb4e_434a_8b54_ef3a676fac54 12 | #define __class_pointers_h__74b02386_fb4e_434a_8b54_ef3a676fac54 13 | 14 | #include 15 | 16 | 17 | #define DEFINE_CLASS_POINTERS(ClassName) \ 18 | typedef std::unique_ptr UniquePtr; \ 19 | typedef std::shared_ptr SharedPtr; \ 20 | typedef std::weak_ptr WeakPtr; 21 | 22 | #endif // __class_pointers_h__74b02386_fb4e_434a_8b54_ef3a676fac54 23 | 24 | -------------------------------------------------------------------------------- /include/opc/common/errors.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Common errors declarations 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | extern Common::ErrorData InvalidValueType; 16 | extern Common::ErrorData UnsupportedFeature; 17 | extern Common::ErrorData NotImplemented; 18 | extern Common::ErrorData StdException; 19 | extern Common::ErrorData OsError; 20 | extern Common::ErrorData CannotParseUri; 21 | extern Common::ErrorData ApplicationAlreayStarted; 22 | extern Common::ErrorData ApplicationNotStarted; 23 | -------------------------------------------------------------------------------- /include/opc/common/interface.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Interface base class. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __OPC_UA_INTERFACE_BASE_H__ 12 | #define __OPC_UA_INTERFACE_BASE_H__ 13 | 14 | namespace Common 15 | { 16 | 17 | class Interface 18 | { 19 | protected: 20 | Interface() {} 21 | 22 | virtual ~Interface() {} 23 | 24 | Interface(const Interface &) = delete; 25 | const Interface & operator=(const Interface &) = delete; 26 | }; 27 | 28 | } 29 | 30 | #endif // __OPC_UA_INTERFACE_BASE_H__ 31 | 32 | -------------------------------------------------------------------------------- /include/opc/common/logger.h: -------------------------------------------------------------------------------- 1 | /// @license GNU LGPL 2 | /// 3 | /// Distributed under the GNU LGPL License 4 | /// (See accompanying file LICENSE or copy at 5 | /// http://www.gnu.org/licenses/lgpl.html) 6 | /// 7 | 8 | #pragma once 9 | 10 | #include 11 | #ifdef HAVE_SYSTEM_SPDLOG 12 | #include 13 | #include 14 | #include 15 | #else 16 | #include 17 | #include 18 | #endif 19 | 20 | namespace Common 21 | { 22 | 23 | namespace Logger { 24 | DEFINE_CLASS_POINTERS(spdlog::logger) 25 | }; 26 | 27 | } 28 | 29 | #define LOG_TRACE(__logger__, ...) { if (__logger__ && __logger__->should_log(spdlog::level::trace)) { __logger__->trace(__VA_ARGS__); }} 30 | #define LOG_DEBUG(__logger__, ...) { if (__logger__ && __logger__->should_log(spdlog::level::debug)) { __logger__->debug(__VA_ARGS__); }} 31 | #define LOG_INFO(__logger__, ...) { if (__logger__ && __logger__->should_log(spdlog::level::info)) { __logger__->info(__VA_ARGS__); }} 32 | #define LOG_WARN(__logger__, ...) { if (__logger__ && __logger__->should_log(spdlog::level::warn)) { __logger__->warn(__VA_ARGS__); }} 33 | #define LOG_ERROR(__logger__, ...) { if (__logger__ && __logger__->should_log(spdlog::level::err)) { __logger__->error(__VA_ARGS__); }} 34 | #define LOG_CRITICAL(__logger__, ...) { if (__logger__ && __logger__->should_log(spdlog::level::critical)) { __logger__->critical(__VA_ARGS__); }} 35 | -------------------------------------------------------------------------------- /include/opc/common/modules.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief modules identifiers. Used for building error codes. 4 | /// Modules are parts of project not addons. 5 | /// @license GNU LGPL 6 | /// 7 | /// Distributed under the GNU LGPL License 8 | /// (See accompanying file LICENSE or copy at 9 | /// http://www.gnu.org/licenses/lgpl.html) 10 | /// 11 | 12 | #ifndef __modules_h__f01eb2ae_a824_4dc3_a0f2_bf586d241024 13 | #define __modules_h__f01eb2ae_a824_4dc3_a0f2_bf586d241024 14 | 15 | namespace Common 16 | { 17 | enum Modules 18 | { 19 | MODULE_OS = 0, 20 | MODULE_COMMON, 21 | MODULE_ADDONS_MANAGER, 22 | MODULE_OPCUA_CORE, 23 | MODULE_OPCUA_Client, 24 | }; 25 | } 26 | 27 | #endif // __modules_h__f01eb2ae_a824_4dc3_a0f2_bf586d241024 28 | 29 | -------------------------------------------------------------------------------- /include/opc/common/thread.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Thread wrapper with coockies. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | namespace Common 21 | { 22 | 23 | class ThreadObserver : private Common::Interface 24 | { 25 | public: 26 | /// @brief thread exited with Success. 27 | virtual void OnSuccess() = 0; 28 | /// @brief Thread exited with error. 29 | virtual void OnError(const std::exception & exc) = 0; 30 | }; 31 | 32 | typedef std::function ThreadProc; 33 | 34 | class Thread 35 | { 36 | public: 37 | DEFINE_CLASS_POINTERS(Thread) 38 | 39 | public: 40 | /// @brief Starts f in a separate thread. 41 | Thread(std::function f, ThreadObserver * observer = 0); 42 | 43 | static Thread::UniquePtr Create(ThreadProc f, ThreadObserver * observer = 0) 44 | { 45 | return Thread::UniquePtr(new Thread(f, observer)); 46 | } 47 | 48 | static Thread::UniquePtr Create(void (*f)(), ThreadObserver * observer = 0) 49 | { 50 | Common::ThreadProc proc(f); 51 | return Thread::UniquePtr(new Common::Thread(proc, observer)); 52 | } 53 | 54 | ~Thread(); 55 | /// @brief Wait until started thread stop. 56 | void Join(); 57 | 58 | public: 59 | /// @brief Calls in the separate thread from ThreadProc. 60 | void Run(); 61 | /// @brief static member required for std::thread 62 | static void ThreadProc(Thread * thread); 63 | 64 | private: 65 | ThreadObserver * Observer; 66 | Common::ThreadProc Func; 67 | std::thread Impl; 68 | }; 69 | 70 | } // namespace Common 71 | 72 | -------------------------------------------------------------------------------- /include/opc/common/uri_facade.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Uri. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | namespace Common 16 | { 17 | 18 | class Uri 19 | { 20 | public: 21 | explicit Uri(const std::string & uriString) 22 | { 23 | Initialize(uriString); 24 | } 25 | 26 | std::string Scheme() const 27 | { 28 | return SchemeStr; 29 | } 30 | 31 | std::string User() const 32 | { 33 | return UserStr; 34 | } 35 | 36 | std::string Password() const 37 | { 38 | return PasswordStr; 39 | } 40 | 41 | std::string Host() const 42 | { 43 | return HostStr; 44 | } 45 | 46 | unsigned Port() const 47 | { 48 | return PortNum; 49 | } 50 | 51 | private: 52 | void Initialize(const std::string & uriString); 53 | 54 | private: 55 | std::string SchemeStr; 56 | std::string UserStr; 57 | std::string PasswordStr; 58 | std::string HostStr; 59 | unsigned PortNum; 60 | }; 61 | 62 | } // namespace Common 63 | 64 | -------------------------------------------------------------------------------- /include/opc/spdlog/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Gabi Melman. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /include/opc/spdlog/details/log_msg.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "opc/spdlog/common.h" 9 | #include "opc/spdlog/details/os.h" 10 | 11 | 12 | #include 13 | #include 14 | 15 | namespace spdlog 16 | { 17 | namespace details 18 | { 19 | struct log_msg 20 | { 21 | log_msg() = default; 22 | log_msg(const std::string *loggers_name, level::level_enum lvl) : 23 | logger_name(loggers_name), 24 | level(lvl), 25 | msg_id(0) 26 | { 27 | #ifndef SPDLOG_NO_DATETIME 28 | time = os::now(); 29 | #endif 30 | 31 | #ifndef SPDLOG_NO_THREAD_ID 32 | thread_id = os::thread_id(); 33 | #endif 34 | } 35 | 36 | log_msg(const log_msg& other) = delete; 37 | log_msg& operator=(log_msg&& other) = delete; 38 | log_msg(log_msg&& other) = delete; 39 | 40 | 41 | const std::string *logger_name; 42 | level::level_enum level; 43 | log_clock::time_point time; 44 | size_t thread_id; 45 | fmt::MemoryWriter raw; 46 | fmt::MemoryWriter formatted; 47 | size_t msg_id; 48 | }; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /include/opc/spdlog/details/null_mutex.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | // null, no cost dummy "mutex" and dummy "atomic" int 10 | 11 | namespace spdlog 12 | { 13 | namespace details 14 | { 15 | struct null_mutex 16 | { 17 | void lock() {} 18 | void unlock() {} 19 | bool try_lock() 20 | { 21 | return true; 22 | } 23 | }; 24 | 25 | struct null_atomic_int 26 | { 27 | int value; 28 | null_atomic_int() = default; 29 | 30 | null_atomic_int(int val):value(val) 31 | {} 32 | 33 | int load(std::memory_order) const 34 | { 35 | return value; 36 | } 37 | 38 | void store(int val) 39 | { 40 | value = val; 41 | } 42 | }; 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /include/opc/spdlog/fmt/bundled/ostream.cc: -------------------------------------------------------------------------------- 1 | /* 2 | Formatting library for C++ - std::ostream support 3 | 4 | Copyright (c) 2012 - 2016, Victor Zverovich 5 | All rights reserved. 6 | 7 | For the license information refer to format.h. 8 | */ 9 | 10 | #include "ostream.h" 11 | 12 | namespace fmt { 13 | 14 | namespace { 15 | // Write the content of w to os. 16 | void write(std::ostream &os, Writer &w) { 17 | const char *data = w.data(); 18 | typedef internal::MakeUnsigned::Type UnsignedStreamSize; 19 | UnsignedStreamSize size = w.size(); 20 | UnsignedStreamSize max_size = 21 | internal::to_unsigned((std::numeric_limits::max)()); 22 | do { 23 | UnsignedStreamSize n = size <= max_size ? size : max_size; 24 | os.write(data, static_cast(n)); 25 | data += n; 26 | size -= n; 27 | } while (size != 0); 28 | } 29 | } 30 | 31 | FMT_FUNC void print(std::ostream &os, CStringRef format_str, ArgList args) { 32 | MemoryWriter w; 33 | w.write(format_str, args); 34 | write(os, w); 35 | } 36 | 37 | FMT_FUNC int fprintf(std::ostream &os, CStringRef format, ArgList args) { 38 | MemoryWriter w; 39 | printf(w, format, args); 40 | write(os, w); 41 | return static_cast(w.size()); 42 | } 43 | } // namespace fmt 44 | -------------------------------------------------------------------------------- /include/opc/spdlog/fmt/fmt.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // 9 | // Include a bundled header-only copy of fmtlib or an external one. 10 | // By default spdlog include its own copy. 11 | // 12 | 13 | #if !defined(SPDLOG_FMT_EXTERNAL) 14 | 15 | #ifndef FMT_HEADER_ONLY 16 | #define FMT_HEADER_ONLY 17 | #endif 18 | #ifndef FMT_USE_WINDOWS_H 19 | #define FMT_USE_WINDOWS_H 0 20 | #endif 21 | #include "opc/spdlog/fmt/bundled/format.h" 22 | 23 | #else //external fmtlib 24 | 25 | #include 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /include/opc/spdlog/fmt/ostr.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // include external or bundled copy of fmtlib's ostream support 9 | // 10 | #if !defined(SPDLOG_FMT_EXTERNAL) 11 | #include "opc/spdlog/fmt/fmt.h" 12 | #include "opc/spdlog/fmt/bundled/ostream.h" 13 | #else 14 | #include 15 | #endif 16 | 17 | 18 | -------------------------------------------------------------------------------- /include/opc/spdlog/formatter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "opc/spdlog/details/log_msg.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace spdlog 15 | { 16 | namespace details 17 | { 18 | class flag_formatter; 19 | } 20 | 21 | class formatter 22 | { 23 | public: 24 | virtual ~formatter() {} 25 | virtual void format(details::log_msg& msg) = 0; 26 | }; 27 | 28 | class pattern_formatter SPDLOG_FINAL : public formatter 29 | { 30 | 31 | public: 32 | explicit pattern_formatter(const std::string& pattern, pattern_time_type pattern_time = pattern_time_type::local); 33 | pattern_formatter(const pattern_formatter&) = delete; 34 | pattern_formatter& operator=(const pattern_formatter&) = delete; 35 | void format(details::log_msg& msg) override; 36 | private: 37 | const std::string _pattern; 38 | const pattern_time_type _pattern_time; 39 | std::vector> _formatters; 40 | std::tm get_time(details::log_msg& msg); 41 | void handle_flag(char flag); 42 | void compile_pattern(const std::string& pattern); 43 | }; 44 | } 45 | 46 | #include "opc/spdlog/details/pattern_formatter_impl.h" 47 | 48 | -------------------------------------------------------------------------------- /include/opc/spdlog/sinks/base_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // base sink templated over a mutex (either dummy or real) 9 | // concrete implementation should only override the _sink_it method. 10 | // all locking is taken care of here so no locking needed by the implementers.. 11 | // 12 | 13 | #include "opc/spdlog/sinks/sink.h" 14 | #include "opc/spdlog/formatter.h" 15 | #include "opc/spdlog/common.h" 16 | #include "opc/spdlog/details/log_msg.h" 17 | 18 | #include 19 | 20 | namespace spdlog 21 | { 22 | namespace sinks 23 | { 24 | template 25 | class base_sink:public sink 26 | { 27 | public: 28 | base_sink():_mutex() {} 29 | virtual ~base_sink() = default; 30 | 31 | base_sink(const base_sink&) = delete; 32 | base_sink& operator=(const base_sink&) = delete; 33 | 34 | void log(const details::log_msg& msg) SPDLOG_FINAL override 35 | { 36 | std::lock_guard lock(_mutex); 37 | _sink_it(msg); 38 | } 39 | void flush() SPDLOG_FINAL override 40 | { 41 | _flush(); 42 | } 43 | 44 | protected: 45 | virtual void _sink_it(const details::log_msg& msg) = 0; 46 | virtual void _flush() = 0; 47 | Mutex _mutex; 48 | }; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /include/opc/spdlog/sinks/msvc_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2016 Alexander Dalshov. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #if defined(_MSC_VER) 9 | 10 | #include "opc/spdlog/sinks/base_sink.h" 11 | #include "opc/spdlog/details/null_mutex.h" 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | namespace spdlog 19 | { 20 | namespace sinks 21 | { 22 | /* 23 | * MSVC sink (logging using OutputDebugStringA) 24 | */ 25 | template 26 | class msvc_sink : public base_sink < Mutex > 27 | { 28 | public: 29 | explicit msvc_sink() 30 | { 31 | } 32 | 33 | 34 | 35 | protected: 36 | void _sink_it(const details::log_msg& msg) override 37 | { 38 | OutputDebugStringA(msg.formatted.c_str()); 39 | } 40 | 41 | void _flush() override 42 | {} 43 | }; 44 | 45 | typedef msvc_sink msvc_sink_mt; 46 | typedef msvc_sink msvc_sink_st; 47 | 48 | } 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/opc/spdlog/sinks/null_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "opc/spdlog/sinks/base_sink.h" 9 | #include "opc/spdlog/details/null_mutex.h" 10 | 11 | #include 12 | 13 | namespace spdlog 14 | { 15 | namespace sinks 16 | { 17 | 18 | template 19 | class null_sink : public base_sink < Mutex > 20 | { 21 | protected: 22 | void _sink_it(const details::log_msg&) override 23 | {} 24 | 25 | void _flush() override 26 | {} 27 | 28 | }; 29 | typedef null_sink null_sink_st; 30 | typedef null_sink null_sink_mt; 31 | 32 | } 33 | } 34 | 35 | -------------------------------------------------------------------------------- /include/opc/spdlog/sinks/ostream_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "opc/spdlog/details/null_mutex.h" 9 | #include "opc/spdlog/sinks/base_sink.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace spdlog 15 | { 16 | namespace sinks 17 | { 18 | template 19 | class ostream_sink: public base_sink 20 | { 21 | public: 22 | explicit ostream_sink(std::ostream& os, bool force_flush=false) :_ostream(os), _force_flush(force_flush) {} 23 | ostream_sink(const ostream_sink&) = delete; 24 | ostream_sink& operator=(const ostream_sink&) = delete; 25 | virtual ~ostream_sink() = default; 26 | 27 | protected: 28 | void _sink_it(const details::log_msg& msg) override 29 | { 30 | _ostream.write(msg.formatted.data(), msg.formatted.size()); 31 | if (_force_flush) 32 | _ostream.flush(); 33 | } 34 | 35 | void _flush() override 36 | { 37 | _ostream.flush(); 38 | } 39 | 40 | std::ostream& _ostream; 41 | bool _force_flush; 42 | }; 43 | 44 | typedef ostream_sink ostream_sink_mt; 45 | typedef ostream_sink ostream_sink_st; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /include/opc/spdlog/sinks/sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | 7 | #pragma once 8 | 9 | #include "opc/spdlog/details/log_msg.h" 10 | 11 | namespace spdlog 12 | { 13 | namespace sinks 14 | { 15 | class sink 16 | { 17 | public: 18 | sink() 19 | { 20 | _level = level::trace; 21 | } 22 | 23 | virtual ~sink() {} 24 | virtual void log(const details::log_msg& msg) = 0; 25 | virtual void flush() = 0; 26 | 27 | bool should_log(level::level_enum msg_level) const; 28 | void set_level(level::level_enum log_level); 29 | level::level_enum level() const; 30 | 31 | private: 32 | level_t _level; 33 | 34 | }; 35 | 36 | inline bool sink::should_log(level::level_enum msg_level) const 37 | { 38 | return msg_level >= _level.load(std::memory_order_relaxed); 39 | } 40 | 41 | inline void sink::set_level(level::level_enum log_level) 42 | { 43 | _level.store(log_level); 44 | } 45 | 46 | inline level::level_enum sink::level() const 47 | { 48 | return static_cast(_level.load(std::memory_order_relaxed)); 49 | } 50 | 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /include/opc/ua/client/addon.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | #include 17 | 18 | namespace OpcUa 19 | { 20 | namespace Client 21 | { 22 | class Addon : public Common::Addon 23 | { 24 | public: 25 | DEFINE_CLASS_POINTERS(Addon) 26 | 27 | public: 28 | virtual std::string GetProtocol() const = 0; 29 | virtual OpcUa::Services::SharedPtr Connect(const std::string & url) = 0; 30 | }; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /include/opc/ua/client/binary_client.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc Ua server interface. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | 18 | #include 19 | 20 | namespace OpcUa 21 | { 22 | 23 | struct SecureConnectionParams 24 | { 25 | std::string EndpointUrl; 26 | std::string SecurePolicy; 27 | std::vector SenderCertificate; 28 | std::vector ReceiverCertificateThumbPrint; 29 | uint32_t SecureChannelId; 30 | 31 | SecureConnectionParams() 32 | : SecureChannelId(0) 33 | { 34 | } 35 | }; 36 | 37 | /// @brief Create server based on opc ua binary protocol. 38 | /// @param channel channel wich will be used for sending requests data. 39 | Services::SharedPtr CreateBinaryClient(IOChannel::SharedPtr channel, const SecureConnectionParams & params, const Common::Logger::SharedPtr & logger = nullptr); 40 | Services::SharedPtr CreateBinaryClient(const std::string & endpointUrl, const Common::Logger::SharedPtr & logger = nullptr); 41 | 42 | } // namespace OpcUa 43 | -------------------------------------------------------------------------------- /include/opc/ua/client/remote_connection.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc binary cnnection channel. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __OPC_UA_BINARY_CHANNEL 12 | #define __OPC_UA_BINARY_CHANNEL 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | namespace OpcUa 21 | { 22 | 23 | class RemoteConnection : public IOChannel 24 | { 25 | public: 26 | virtual std::size_t Receive(char * data, std::size_t size) = 0; 27 | virtual void Send(const char * message, std::size_t size) = 0; 28 | 29 | virtual std::string GetHost() const = 0; 30 | virtual unsigned GetPort() const = 0; 31 | }; 32 | 33 | 34 | std::unique_ptr Connect(const std::string & host, unsigned port, const Common::Logger::SharedPtr & logger); 35 | 36 | } // namespace OpcUa 37 | 38 | #endif // __OPC_UA_BINARY_CHANNEL 39 | 40 | -------------------------------------------------------------------------------- /include/opc/ua/connection_listener.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc binary cnnection channel. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | namespace OpcUa 19 | { 20 | namespace Server 21 | { 22 | 23 | class IncomingConnectionProcessor : private Common::Interface 24 | { 25 | public: 26 | virtual void Process(IOChannel::SharedPtr clientChannel) = 0; 27 | virtual void StopProcessing(IOChannel::SharedPtr clientChannel) = 0; 28 | }; 29 | 30 | class ConnectionListener : private Common::Interface 31 | { 32 | public: 33 | virtual void Start(std::shared_ptr connectionProcssor) = 0; 34 | virtual void Stop() = 0; 35 | }; 36 | 37 | } // namespace UaServer 38 | } // namespace OpcUA 39 | -------------------------------------------------------------------------------- /include/opc/ua/errors.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Common errors declarations 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #define DEFINE_COMMON_ERROR(name) extern Common::ErrorData name; 16 | 17 | DEFINE_COMMON_ERROR(CannotCreateChannelOnInvalidSocket) 18 | 19 | -------------------------------------------------------------------------------- /include/opc/ua/global.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (C) 2014-2014 Olivier Roulet-Dubonnet * 3 | * olivier.roulet@gmail.com * 4 | * * 5 | * This library is free software; you can redistribute it and/or modify * 6 | * it under the terms of the GNU Lesser General Public License as * 7 | * published by the Free Software Foundation; version 3 of the License. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public License * 15 | * along with this library; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 | ******************************************************************************/ 19 | 20 | #pragma once 21 | 22 | # define OPCUA_UNUSED(x) (void)x 23 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/attribute_ids.h: -------------------------------------------------------------------------------- 1 | // 2 | // DO NOT EDIT THIS FILE! 3 | // It is automatically generated from opcfoundation.org schemas. 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | namespace OpcUa 11 | { 12 | enum class AttributeId : uint32_t 13 | { 14 | NodeId = 1, 15 | NodeClass = 2, 16 | BrowseName = 3, 17 | DisplayName = 4, 18 | Description = 5, 19 | WriteMask = 6, 20 | UserWriteMask = 7, 21 | IsAbstract = 8, 22 | Symmetric = 9, 23 | InverseName = 10, 24 | ContainsNoLoops = 11, 25 | EventNotifier = 12, 26 | Value = 13, 27 | DataType = 14, 28 | ValueRank = 15, 29 | ArrayDimensions = 16, 30 | AccessLevel = 17, 31 | UserAccessLevel = 18, 32 | MinimumSamplingInterval = 19, 33 | Historizing = 20, 34 | Executable = 21, 35 | UserExecutable = 22, 36 | Unknown = ~uint32_t(), 37 | }; 38 | } // namespace OpcUa 39 | 40 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/datetime.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc Ua Binary DateTime type. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __OPC_UA_BINARY_DATE_TIME__H__ 12 | #define __OPC_UA_BINARY_DATE_TIME__H__ 13 | 14 | #include 15 | #include 16 | 17 | namespace OpcUa 18 | { 19 | 20 | struct DateTime 21 | { 22 | DateTime() 23 | : Value(0) 24 | { 25 | } 26 | 27 | explicit DateTime(int64_t value) 28 | : Value(value) 29 | { 30 | } 31 | 32 | static DateTime Current(); 33 | static DateTime FromTimeT(time_t t, unsigned usec = 0); 34 | static time_t ToTimeT(DateTime dateTime); 35 | 36 | DateTime(const DateTime &) = default; 37 | DateTime & operator=(const DateTime &) = default; 38 | DateTime & operator+=(const DateTime & val) 39 | { 40 | Value += val.Value; 41 | return *this; 42 | } 43 | 44 | operator int64_t() const 45 | { 46 | return Value; 47 | } 48 | 49 | int64_t Value; 50 | }; 51 | 52 | 53 | typedef double Duration; // Time duration in miliseconds. 54 | 55 | } // OpcUa 56 | 57 | 58 | #endif // __OPC_UA_BINARY_DATE_TIME__H__ 59 | 60 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/describe.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Descriptions of OPC UA structures. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __OPCUA_DESCRIPTIONS_H 12 | #define __OPCUA_DESCRIPTIONS_H 13 | 14 | #include 15 | #include 16 | 17 | namespace OpcUa 18 | { 19 | 20 | struct Tabs 21 | { 22 | explicit Tabs(unsigned num = 0) 23 | : Num(num) 24 | { 25 | } 26 | 27 | unsigned Num; 28 | }; 29 | 30 | std::ostream & operator <<(std::ostream & os, const Tabs & tabs) 31 | { 32 | for (unsigned i = 0; i < tabs.Num; ++i) 33 | { 34 | os << " "; 35 | } 36 | 37 | return os; 38 | } 39 | 40 | template 41 | std::string Describe(const T & object, const Tabs & tabs); 42 | 43 | } 44 | 45 | #endif // __OPCUA_DESCRIPTIONS_H 46 | 47 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/endpoints.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc Ua Binary. Secure channel service. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __OPC_UA_MESSAGES_DISCOVERY_SERVICE_H__ 12 | #define __OPC_UA_MESSAGES_DISCOVERY_SERVICE_H__ 13 | 14 | #include 15 | #include 16 | 17 | namespace OpcUa 18 | { 19 | 20 | //////////////////////////////////////////////////////// 21 | // FindServersRequest 22 | //////////////////////////////////////////////////////// 23 | struct FindServersParameters 24 | { 25 | std::string EndpointUrl; 26 | std::vector Locales; 27 | std::vector ServersToReturn; 28 | }; 29 | 30 | struct FindServersRequest 31 | { 32 | NodeId TypeId; 33 | RequestHeader Header; 34 | FindServersParameters Parameters; 35 | 36 | FindServersRequest(); 37 | }; 38 | 39 | struct FindServersData 40 | { 41 | std::vector Descriptions; 42 | }; 43 | 44 | struct FindServersResponse 45 | { 46 | NodeId TypeId; 47 | ResponseHeader Header; 48 | FindServersData Data; 49 | 50 | FindServersResponse(); 51 | }; 52 | 53 | } // namespace OpcUa 54 | 55 | #endif // __OPC_UA_MESSAGES_DISCOVERY_SERVICE_H__ 56 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/expanded_object_ids.h: -------------------------------------------------------------------------------- 1 | /// @author Olivier Roulet-Dubonnet 2013 2 | /// @brief Well known attributes identifiers. 3 | /// @license GNU LGPL 4 | /// 5 | /// Distributed under the GNU LGPL License 6 | /// (See accompanying file LICENSE or copy at 7 | /// http://www.gnu.org/licenses/lgpl.html) 8 | /// 9 | 10 | #ifndef __OPC_UA_EXPANDED_OBJECTS_IdS 11 | #define __OPC_UA_EXPANDED_OBJECTS_IdS 12 | 13 | #include 14 | 15 | namespace OpcUa 16 | { 17 | enum class ExpandedObjectId : uint32_t 18 | { 19 | Null = 0, 20 | ObjectAttribute = 354, 21 | VariableAttribute = 357, 22 | MethodAttribute = 360, 23 | ObjectTypeAttribute = 363, 24 | VariableTypeAttribute = 366 , 25 | ReferenceTypeAttribute = 369, 26 | DataTypeAttribute = 372, 27 | ViewAttribute = 375, 28 | 29 | DataChangeNotification = 811, 30 | EventNotificationList = 916, //812, 31 | StatusChangeNotification = 820, 32 | 33 | DataChangeFilter = 724, 34 | EventFilter = 727, 35 | AggregateFilter = 730, 36 | 37 | ElementOperand = 594, 38 | LiteralOperand = 597, 39 | AttributeOperand = 600, 40 | SimpleAttributeOperand = 603 41 | 42 | 43 | }; 44 | } 45 | 46 | #endif // __OPC_UA_BINARY_IdENTIFIERS 47 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/extension_identifiers.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc binary cnnection channel. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __OPC_UA_BINARY_EXTENSION_IdENTIFIERS 12 | #define __OPC_UA_BINARY_EXTENSION_IdENTIFIERS 13 | 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | enum ExtensionObjectId : uint16_t 19 | { 20 | USER_IdENTIFY_TOKEN_ANONYMOUS = 0x141, // 321 21 | USER_IdENTIFY_TOKEN_USERNAME = 0x144, // 324 22 | }; 23 | } 24 | 25 | #endif // __OPC_UA_BINARY_EXTENSION_IdENTIFIERS 26 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/monitored_items.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Monitored items services. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef OPC_UA_MAPPINGS_MONITORED_ITEMS_H_ 12 | #define OPC_UA_MAPPINGS_MONITORED_ITEMS_H_ 13 | 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | 19 | } 20 | 21 | #endif // OPC_UA_MAPPINGS_MONITORED_ITEMS_H_ 22 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/protocol.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace OpcUa 6 | { 7 | ReadValueId inline ToReadValueId(NodeId id, AttributeId attr) 8 | { 9 | ReadValueId rv; 10 | rv.NodeId = id; 11 | rv.AttributeId = attr; 12 | return rv; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/reference_ids.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Well known referencies identifiers. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef opc_ua_referencie_ids_h 12 | #define opc_ua_referencie_ids_h 13 | 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | 19 | enum class ReferenceId : uint32_t 20 | { 21 | References = 31, 22 | NonHierarchicalReferences = 32, 23 | HierarchicalReferences = 33, 24 | HasChild = 34, 25 | Organizes = 35, 26 | HasEventSource = 36, 27 | HasModellingRule = 37, 28 | HasEncoding = 38, 29 | HasDescription = 39, 30 | HasTypeDefinition = 40, 31 | GeneratesEvent = 41, 32 | Aggregates = 44, 33 | HasSubtype = 45, 34 | HasProperty = 46, 35 | HasComponent = 47, 36 | HasNotifier = 48, 37 | HasOrderedComponent = 49, 38 | HasModelParent = 50, 39 | FromState = 51, 40 | ToState = 52, 41 | HasCause = 53, 42 | HasEffect = 54, 43 | HasHistoricalConfiguration = 56, 44 | HasHistoricalEventConfiguration = 57, 45 | HasSubStateMachine = 117, 46 | HasEventHistory = 118, 47 | AlwaysGeneratesEvent = 3065, 48 | HasTrueSubState = 9004, 49 | HasFalseSubState = 9005, 50 | HasCondition = 9006, 51 | 52 | Unknown = ~uint32_t() 53 | }; 54 | 55 | } // namespace OpcUa 56 | #endif // opc_ua_referencie_ids_h 57 | 58 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/session.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc Ua Binary. Secure channel service. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __OPC_UA_BINARY_SESSIONS_H__ 12 | #define __OPC_UA_BINARY_SESSIONS_H__ 13 | 14 | #include 15 | #include 16 | 17 | namespace OpcUa 18 | { 19 | //------------------------------------------------- 20 | // CloseSessionRequest 21 | //------------------------------------------------- 22 | 23 | struct CloseSessionRequest 24 | { 25 | NodeId TypeId; 26 | RequestHeader Header; 27 | 28 | bool DeleteSubscriptions; 29 | 30 | CloseSessionRequest(); 31 | }; 32 | 33 | struct CloseSessionResponse 34 | { 35 | NodeId TypeId; 36 | ResponseHeader Header; 37 | 38 | CloseSessionResponse(); 39 | }; 40 | 41 | ExpandedNodeId GenerateSessionId(); 42 | 43 | struct ServiceFaultResponse 44 | { 45 | NodeId TypeId; 46 | ResponseHeader Header; 47 | 48 | ServiceFaultResponse(); 49 | }; 50 | 51 | 52 | } // namespace OpcUa 53 | 54 | #endif // __OPC_UA_BINARY_SESSIONS_H__ 55 | -------------------------------------------------------------------------------- /include/opc/ua/protocol/variable_access_level.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Well known attributes identifiers. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef OPC_UA_VARIABLE_ACCESS_LEVEL_H_ 12 | #define OPC_UA_VARIABLE_ACCESS_LEVEL_H_ 13 | 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | enum class VariableAccessLevel : uint8_t 19 | { 20 | CurrentRead = 1, 21 | CurrentWrite = 2, 22 | HistoryRead = 4, 23 | HistoryWrite = 8, 24 | SemanticChange = 16, 25 | }; 26 | inline VariableAccessLevel operator|(VariableAccessLevel a, VariableAccessLevel b) { return static_cast(static_cast(a) | static_cast(b)); } 27 | inline VariableAccessLevel operator&(VariableAccessLevel a, VariableAccessLevel b) { return static_cast(static_cast(a) | static_cast(b)); } 28 | } 29 | 30 | #endif /* OPC_UA_VARIABLE_ACCESS_LEVEL_H_ */ 31 | -------------------------------------------------------------------------------- /include/opc/ua/server/addons/address_space.h: -------------------------------------------------------------------------------- 1 | /// @author Olivier Roulet-Dubonnet 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | namespace Server 19 | { 20 | 21 | const char AddressSpaceRegistryAddonId[] = "address_space_registry"; 22 | 23 | class AddressSpaceAddonFactory : public Common::AddonFactory 24 | { 25 | public: 26 | DEFINE_CLASS_POINTERS(AddressSpaceAddonFactory) 27 | 28 | public: 29 | virtual Common::Addon::UniquePtr CreateAddon(); 30 | }; 31 | 32 | } // namespace UaServer 33 | } // namespace OpcUa 34 | -------------------------------------------------------------------------------- /include/opc/ua/server/addons/endpoints_services.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Endpoints addon. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace OpcUa 18 | { 19 | namespace Server 20 | { 21 | 22 | const char EndpointsRegistryAddonId[] = "endpoints_services"; 23 | 24 | 25 | class EndpointsRegistryAddonFactory : public Common::AddonFactory 26 | { 27 | public: 28 | DEFINE_CLASS_POINTERS(EndpointsRegistryAddonFactory) 29 | 30 | public: 31 | virtual Common::Addon::UniquePtr CreateAddon() override; 32 | }; 33 | 34 | } // namespace UaServer 35 | } // nmespace OpcUa 36 | 37 | -------------------------------------------------------------------------------- /include/opc/ua/server/addons/opcua_protocol.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Endpoints addon. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | 18 | namespace OpcUa 19 | { 20 | namespace Server 21 | { 22 | 23 | const char OpcUaProtocolAddonId[] = "opcua_protocol"; 24 | 25 | class OpcUaProtocolAddonFactory : public Common::AddonFactory 26 | { 27 | public: 28 | DEFINE_CLASS_POINTERS(OpcUaProtocolAddonFactory) 29 | 30 | public: 31 | virtual Common::Addon::UniquePtr CreateAddon() override; 32 | }; 33 | 34 | } // namespace UaServer 35 | } // nmespace OpcUa 36 | -------------------------------------------------------------------------------- /include/opc/ua/server/addons/services_registry.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Internal Server wich is used by addons. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | namespace Server 19 | { 20 | 21 | const char ServicesRegistryAddonId[] = "services_registry"; 22 | 23 | class ServicesRegistryFactory : public Common::AddonFactory 24 | { 25 | public: 26 | DEFINE_CLASS_POINTERS(ServicesRegistryFactory) 27 | 28 | public: 29 | virtual Common::Addon::UniquePtr CreateAddon(); 30 | }; 31 | 32 | } // namespace UaServer 33 | } // namespace OpcUa 34 | -------------------------------------------------------------------------------- /include/opc/ua/server/addons/standard_address_space.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Function which fill standard opcua address space. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | namespace Server 19 | { 20 | 21 | class StandardNamespaceAddonFactory : public Common::AddonFactory 22 | { 23 | public: 24 | virtual Common::Addon::UniquePtr CreateAddon(); 25 | }; 26 | 27 | const char StandardNamespaceAddonId[] = "standard_namespace"; 28 | 29 | } // namespace UaServer 30 | } // namespace OpcUa 31 | 32 | -------------------------------------------------------------------------------- /include/opc/ua/server/addons/subscription_service.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2014 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Subscription service addon. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | namespace OpcUa 16 | { 17 | namespace Server 18 | { 19 | 20 | const char SubscriptionServiceAddonId[] = "subscriptions"; 21 | 22 | class SubscriptionServiceAddonFactory : public Common::AddonFactory 23 | { 24 | public: 25 | virtual Common::Addon::UniquePtr CreateAddon(); 26 | }; 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /include/opc/ua/server/addons/xml_ns.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | namespace Server 19 | { 20 | 21 | const char XmlAddressSpaceAddonId[] = "xml_address_space"; 22 | 23 | class XmlAddressSpace : public Common::Addon 24 | { 25 | public: 26 | virtual void Load(const char * path) = 0; 27 | }; 28 | 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /include/opc/ua/server/address_space.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief View services addon. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | 21 | namespace OpcUa 22 | { 23 | namespace Server 24 | { 25 | 26 | typedef void DataChangeCallback(const NodeId & node, AttributeId attribute, DataValue); 27 | 28 | class AddressSpace 29 | : public ViewServices 30 | , public AttributeServices 31 | , public NodeManagementServices 32 | , public MethodServices 33 | { 34 | public: 35 | DEFINE_CLASS_POINTERS(AddressSpace) 36 | 37 | //Server side methods 38 | virtual uint32_t AddDataChangeCallback(const NodeId & node, AttributeId attribute, std::function callback) = 0; 39 | virtual void DeleteDataChangeCallback(uint32_t clienthandle) = 0; 40 | virtual StatusCode SetValueCallback(const NodeId & node, AttributeId attribute, std::function callback) = 0; 41 | virtual void SetMethod(const NodeId & node, std::function (NodeId context, std::vector arguments)> callback) = 0; 42 | //FIXME : SHould we also expose SetValue and GetValue on server side? then we need to lock them ... 43 | }; 44 | 45 | AddressSpace::UniquePtr CreateAddressSpace(const Common::Logger::SharedPtr & logger); 46 | 47 | } // namespace UaServer 48 | } // nmespace OpcUa 49 | -------------------------------------------------------------------------------- /include/opc/ua/server/endpoints_services.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Endpoints addon. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | namespace Server 19 | { 20 | 21 | struct ApplicationData 22 | { 23 | ApplicationDescription Application; 24 | std::vector Endpoints; 25 | }; 26 | 27 | class EndpointsRegistry : public OpcUa::EndpointServices 28 | { 29 | public: 30 | DEFINE_CLASS_POINTERS(EndpointsRegistry) 31 | 32 | public: 33 | virtual void AddEndpoints(const std::vector & endpoints) = 0; 34 | virtual void AddApplications(const std::vector & application) = 0; 35 | }; 36 | 37 | EndpointsRegistry::UniquePtr CreateEndpointsRegistry(); 38 | 39 | } // namespace UaServer 40 | } // namespace OpcUa 41 | -------------------------------------------------------------------------------- /include/opc/ua/server/services_registry.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Internal Server wich is used by addons. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | namespace OpcUa 16 | { 17 | namespace Server 18 | { 19 | 20 | class ServicesRegistry : private Common::Interface 21 | { 22 | public: 23 | DEFINE_CLASS_POINTERS(ServicesRegistry) 24 | 25 | public: 26 | virtual std::shared_ptr GetServer() const = 0; 27 | 28 | virtual void RegisterEndpointsServices(OpcUa::EndpointServices::SharedPtr endpoints) = 0; 29 | virtual void UnregisterEndpointsServices() = 0; 30 | 31 | virtual void RegisterViewServices(OpcUa::ViewServices::SharedPtr views) = 0; 32 | virtual void UnregisterViewServices() = 0; 33 | 34 | virtual void RegisterAttributeServices(OpcUa::AttributeServices::SharedPtr attributes) = 0; 35 | virtual void UnregisterAttributeServices() = 0; 36 | 37 | virtual void RegisterMethodServices(MethodServices::SharedPtr method) = 0; 38 | virtual void UnregisterMethodServices() = 0; 39 | 40 | virtual void RegisterNodeManagementServices(OpcUa::NodeManagementServices::SharedPtr attributes) = 0; 41 | virtual void UnregisterNodeManagementServices() = 0; 42 | 43 | virtual void RegisterSubscriptionServices(OpcUa::SubscriptionServices::SharedPtr attributes) = 0; 44 | virtual void UnregisterSubscriptionServices() = 0; 45 | }; 46 | 47 | ServicesRegistry::UniquePtr CreateServicesRegistry(); 48 | 49 | } 50 | } // namespace OpcUa 51 | 52 | -------------------------------------------------------------------------------- /include/opc/ua/server/standard_address_space.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Function which fill standard opcua address space. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | namespace OpcUa 16 | { 17 | namespace Server 18 | { 19 | 20 | void FillStandardNamespace(OpcUa::NodeManagementServices & registry, const Common::Logger::SharedPtr & logger); 21 | 22 | } // namespace UaServer 23 | } // namespace OpcUa 24 | 25 | -------------------------------------------------------------------------------- /include/opc/ua/server/subscription_service.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief View services addon. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | namespace OpcUa 18 | { 19 | namespace Server 20 | { 21 | 22 | class SubscriptionService : public SubscriptionServices 23 | { 24 | public: 25 | DEFINE_CLASS_POINTERS(SubscriptionService) 26 | 27 | virtual void TriggerEvent(NodeId node, Event event) = 0; 28 | }; 29 | 30 | SubscriptionService::UniquePtr CreateSubscriptionService(std::shared_ptr addressspace, boost::asio::io_service & io, const Common::Logger::SharedPtr & logger); 31 | 32 | } // namespace UaServer 33 | } // nmespace OpcUa 34 | -------------------------------------------------------------------------------- /include/opc/ua/server_operations.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "opc/ua/services/services.h" 4 | #include "opc/ua/node.h" 5 | 6 | #include 7 | 8 | namespace OpcUa 9 | { 10 | class UaClient; 11 | class UaServer; 12 | 13 | class ServerOperations 14 | { 15 | friend UaClient; 16 | friend UaServer; 17 | 18 | Services::SharedPtr Server; 19 | protected: 20 | ServerOperations(Services::SharedPtr Server); 21 | 22 | public: 23 | void WriteAttributes(std::vector &); 24 | std::vector ReadAttributes(std::vector & attributes); 25 | std::vector ReadAttributes(std::vector & nodes, AttributeId attr); 26 | std::vector RegisterNodes(std::vector &); 27 | //NB This makes the given nodes invalid 28 | void UnregisterNodes(std::vector &); 29 | }; 30 | } -------------------------------------------------------------------------------- /include/opc/ua/services/attributes.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief View services interface. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef OPC_UA_Client_ATTRIBUTES_H 12 | #define OPC_UA_Client_ATTRIBUTES_H 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | namespace OpcUa 23 | { 24 | 25 | class AttributeServices : private Common::Interface 26 | { 27 | public: 28 | DEFINE_CLASS_POINTERS(AttributeServices) 29 | 30 | public: 31 | virtual std::vector Read(const OpcUa::ReadParameters & filter) const = 0; 32 | virtual std::vector Write(const std::vector & filter) = 0; 33 | }; 34 | 35 | } // namespace OpcUa 36 | 37 | #endif // OPC_UA_Client_ATTRIBUTES_H 38 | -------------------------------------------------------------------------------- /include/opc/ua/services/endpoints.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc endpoints interface. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef OPC_UA_Client_ENDPOINTS_H 12 | #define OPC_UA_Client_ENDPOINTS_H 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace OpcUa 21 | { 22 | 23 | struct ApplicationFilter 24 | { 25 | }; 26 | struct ServerParameters 27 | { 28 | }; 29 | 30 | class EndpointServices : private Common::Interface 31 | { 32 | public: 33 | DEFINE_CLASS_POINTERS(EndpointServices) 34 | 35 | public: 36 | virtual std::vector FindServers(const FindServersParameters & params) const = 0; 37 | // TODO Here all structuresmust be in one namespace. 38 | virtual std::vector GetEndpoints(const GetEndpointsParameters & filter) const = 0; 39 | virtual void RegisterServer(const ServerParameters & parameters) = 0; 40 | }; 41 | 42 | } // namespace OpcUa 43 | 44 | #endif // OPC_UA_Client_ENDPOINTS_H 45 | 46 | -------------------------------------------------------------------------------- /include/opc/ua/services/method.h: -------------------------------------------------------------------------------- 1 | /// @author Denis Štogl 2015 2 | /// @email denis.stogl@mailbox.org 3 | /// @brief Method services interface. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef OPC_UA_Client_METHOD_H 12 | #define OPC_UA_Client_METHOD_H 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | namespace OpcUa 22 | { 23 | 24 | class MethodServices : private Common::Interface 25 | { 26 | public: 27 | DEFINE_CLASS_POINTERS(MethodServices) 28 | 29 | public: 30 | virtual std::vector Call(const std::vector & methodsToCall) = 0; 31 | virtual void SetMethod(const NodeId & node, std::function (NodeId context, std::vector arguments)> callback) = 0; 32 | }; 33 | 34 | } // namespace OpcUa 35 | 36 | #endif // OPC_UA_Client_METHOD_H 37 | 38 | -------------------------------------------------------------------------------- /include/opc/ua/services/node_management.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief View services interface. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef OPC_UA_Client_ADDRESSSPACE_H 12 | #define OPC_UA_Client_ADDRESSSPACE_H 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | namespace OpcUa 23 | { 24 | 25 | class NodeManagementServices : private Common::Interface 26 | { 27 | public: 28 | DEFINE_CLASS_POINTERS(NodeManagementServices) 29 | 30 | public: 31 | virtual std::vector AddNodes(const std::vector & items) = 0; 32 | virtual std::vector AddReferences(const std::vector & items) = 0; 33 | }; 34 | 35 | } // namespace OpcUa 36 | 37 | #endif // OPC_UA_Client_ADDRESSSPACE_H 38 | 39 | -------------------------------------------------------------------------------- /include/opc/ua/services/subscriptions.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Subscription services interface. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __OPC_UA_Client_SUBSCRIPTIONS_H 12 | #define __OPC_UA_Client_SUBSCRIPTIONS_H 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | namespace OpcUa 21 | { 22 | 23 | class SubscriptionServices : private Common::Interface 24 | { 25 | public: 26 | DEFINE_CLASS_POINTERS(SubscriptionServices) 27 | 28 | public: 29 | virtual SubscriptionData CreateSubscription(const CreateSubscriptionRequest &, std::function callbackPublish) = 0; 30 | virtual ModifySubscriptionResponse ModifySubscription(const ModifySubscriptionParameters & parameters) = 0; 31 | virtual std::vector DeleteSubscriptions(const std::vector & subscriptions) = 0; 32 | virtual void Publish(const PublishRequest & request) = 0; 33 | virtual RepublishResponse Republish(const RepublishParameters & params) = 0; 34 | 35 | //FIXME: Spec says MonitoredItems methods should be in their own service 36 | virtual std::vector CreateMonitoredItems(const MonitoredItemsParameters & parameters) = 0; 37 | virtual std::vector DeleteMonitoredItems(const DeleteMonitoredItemsParameters & params) = 0; 38 | }; 39 | 40 | } 41 | 42 | #endif // __OPC_UA_Client_SUBSCRIPTIONS_H 43 | -------------------------------------------------------------------------------- /include/opc/ua/services/view.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief View services interface. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef OPC_UA_Client_VIEW_H 12 | #define OPC_UA_Client_VIEW_H 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | namespace OpcUa 22 | { 23 | 24 | class ViewServices : private Common::Interface 25 | { 26 | public: 27 | DEFINE_CLASS_POINTERS(ViewServices) 28 | 29 | public: 30 | virtual std::vector Browse(const OpcUa::NodesQuery & query) const = 0; 31 | virtual std::vector BrowseNext() const = 0; 32 | virtual std::vector TranslateBrowsePathsToNodeIds(const TranslateBrowsePathsParameters & params) const = 0; 33 | virtual std::vector RegisterNodes(const std::vector & params) const = 0; 34 | virtual void UnregisterNodes(const std::vector & params) const = 0; 35 | }; 36 | 37 | } // namespace OpcUa 38 | 39 | #endif // OPC_UA_Client_VIEW_H 40 | 41 | -------------------------------------------------------------------------------- /include/opc/ua/socket_channel.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc binary cnnection channel. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef OPC_UA_Client_SOCKET_CHANNEL_H 12 | #define OPC_UA_Client_SOCKET_CHANNEL_H 13 | 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | 19 | class SocketChannel : public OpcUa::IOChannel 20 | { 21 | public: 22 | SocketChannel(int sock); 23 | virtual ~SocketChannel(); 24 | 25 | virtual std::size_t Receive(char * data, std::size_t size); 26 | virtual void Send(const char * message, std::size_t size); 27 | 28 | virtual void Stop(); 29 | 30 | private: 31 | int Socket; 32 | }; 33 | 34 | } 35 | 36 | #endif // OPC_UA_Client_SOCKET_CHANNEL_H 37 | 38 | -------------------------------------------------------------------------------- /libopcuaclient.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | extra_cflags=@interface_cflags@ 6 | 7 | Name: libopcuacore 8 | Description: Opcua core infrastructure. 9 | Version: @PACKAGE_VERSION@ 10 | Cflags: -I${includedir} ${extra_cflags} 11 | Libs: -L${libdir} -lopcuaclient 12 | 13 | -------------------------------------------------------------------------------- /libopcuacore.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | extra_cflags=@interface_cflags@ 6 | 7 | Name: libopcuacore 8 | Description: Opcua core infrastructure. 9 | Version: @PACKAGE_VERSION@ 10 | Cflags: -I${includedir} ${extra_cflags} 11 | Libs: -L${libdir} -lopcuacore 12 | 13 | -------------------------------------------------------------------------------- /libopcuaprotocol.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | extra_cflags=@interface_cflags@ 6 | 7 | Name: libopcuaprotocol 8 | Description: Opcua protocol library. 9 | Version: @PACKAGE_VERSION@ 10 | Cflags: -I${includedir} ${extra_cflags} 11 | Libs: -L${libdir} -lopcuaprotocol 12 | 13 | -------------------------------------------------------------------------------- /libopcuaserver.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | extra_cflags=@interface_cflags@ 6 | 7 | Name: libopcuaserver 8 | Description: Opcua server library. 9 | Version: @PACKAGE_VERSION@ 10 | Cflags: -I${includedir} ${extra_cflags} 11 | Libs: -L${libdir} -lopcuaserver 12 | 13 | -------------------------------------------------------------------------------- /make_deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | tar -xvf opcuaserver-${VERSION}.tar.gz 3 | cd opcuaserver-${VERSION} 4 | dh_make -y -l -c lgpl3 -e rykovanov.as@gmail.com -f ../opcuaserver-${VERSION}.tar.gz 5 | dpkg-buildpackage -rfakeroot -nc -F ${DPKG_BUILDPACKAGE_OPTS} 6 | 7 | -------------------------------------------------------------------------------- /python/AUTHORS: -------------------------------------------------------------------------------- 1 | Alexander Rykovanov (rykovanov.as@gmail.com) 2 | Olivier Roulet-Dubonnet (olivier.roulet@gmail.com) 3 | Matthieu Bec (mdcb808@gmail.com) 4 | 5 | -------------------------------------------------------------------------------- /python/ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/freeopcua/6eac0975636425d2e122b228ca69fea2d30c9ce6/python/ChangeLog -------------------------------------------------------------------------------- /python/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include ChangeLog MANIFEST.in README setup.py 2 | recursive-include src * 3 | 4 | -------------------------------------------------------------------------------- /python/NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/freeopcua/6eac0975636425d2e122b228ca69fea2d30c9ce6/python/NEWS -------------------------------------------------------------------------------- /python/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/freeopcua/6eac0975636425d2e122b228ca69fea2d30c9ce6/python/README -------------------------------------------------------------------------------- /python/README.md: -------------------------------------------------------------------------------- 1 | opcua-python 2 | ============ 3 | 4 | OPC-UA Python bindings 5 | 6 | Writting an OPC-UA server is as simple as: 7 | 8 | s = opcua.Server() 9 | s.set_endpoint("opc.tcp://192.168.56.1:4841") 10 | s.start() 11 | try: 12 | objects = s.get_objects_node() 13 | 14 | m = objects.add_folder("2:MyFolder") 15 | v = m.add_variable("2:MyVariable", 3) 16 | 17 | count = 0 18 | while True; 19 | count += 1 20 | v.set_value(count) 21 | time.sleep(1); 22 | 23 | finally: 24 | s.stop() 25 | -------------------------------------------------------------------------------- /python/TODO: -------------------------------------------------------------------------------- 1 | - unittest using Condition.wait: check timeout in a portable way. 2 | 3 | 4 | -------------------------------------------------------------------------------- /python/configure.ac: -------------------------------------------------------------------------------- 1 | # Author: Alexander Rykovanov 2009 2 | # 3 | # Distributed under the GNU GPL License 4 | # (See accompanying file LICENSE or copy at 5 | # http://www.gnu.org/copyleft/gpl.html) 6 | # 7 | # $Id: $ 8 | # $Date: $ 9 | # $Revision: $ 10 | 11 | AC_INIT([opcuaserver], [0.1.2], [rykovanov.as@gmail.com]) 12 | AC_CONFIG_AUX_DIR([.]) 13 | AC_CONFIG_SRCDIR([Makefile.am]) 14 | AC_CONFIG_MACRO_DIR([m4]) 15 | AM_INIT_AUTOMAKE 16 | 17 | AC_ARG_WITH([opcuaserver], 18 | [AS_HELP_STRING([--with-opcuaserver=DIR], [defines path to the root directory of installed opcua-server.])], 19 | [ 20 | AS_IF([test "x$with_opcuaserver" == "xyes"], 21 | [ 22 | AC_SUBST([OPCUA_SERVER_PATH], ["$srcdir/.."]) 23 | AC_MSG_NOTICE([opcuaserver path: $srcdir/..]) 24 | ] 25 | ) 26 | 27 | AS_IF([test "x$with_opcuaserver" != "xyes"], 28 | [ 29 | AC_SUBST([OPCUA_SERVER_PATH], ["$with_opcuaserver"]) 30 | AC_MSG_NOTICE([opcuaserver path: $with_opcuaserver]) 31 | ] 32 | ) 33 | ], 34 | [ 35 | AC_SUBST([OPCUA_SERVER_PATH], ["$prefix"]) 36 | AC_MSG_NOTICE([opcuaserver path: $prefix]) 37 | ]) 38 | 39 | 40 | ################################################################# 41 | AC_CONFIG_FILES([Makefile]) 42 | 43 | AC_OUTPUT 44 | 45 | -------------------------------------------------------------------------------- /python/examples/inductive_client.py: -------------------------------------------------------------------------------- 1 | 2 | import sys 3 | import time 4 | sys.path.append(".") 5 | 6 | from IPython import embed 7 | import opcua 8 | 9 | class SubHandler(opcua.SubscriptionHandler): 10 | def __init__(self, *args): 11 | opcua.SubscriptionHandler.__init__(self, *args) 12 | self.val = MessageSecurityMode::None 13 | 14 | def data_change(self, handle, node, val, attr): 15 | print("Python: New data change event", handle, node, val, attr) 16 | self.val = val 17 | 18 | def event(self, handle, event): 19 | print("Python: New event", handle, event) 20 | self.ev = event 21 | 22 | 23 | if __name__ == "__main__": 24 | client = opcua.Client(True) 25 | #client.connect("opc.tcp://localhost:4841") 26 | client.connect("opc.tcp://utgaard:12685/ctt-server") 27 | #s.connect("opc.tcp://192.168.56.101:48030") 28 | #edps = client.get_server_endpoints() 29 | try: 30 | root = client.get_root_node() 31 | print("I got root: ", root) 32 | print("Childs are: ", root.get_children()) 33 | print("Objects is: ", client.get_objects_node()) 34 | o = client.get_objects_node() 35 | print("Children of objects are: ", o.get_children()) 36 | myvar = root.get_child(["0:Objects", "2:NewObject", "2:MyVariable"]) 37 | print("yvar is: ", myvar) 38 | 39 | sclt = SubHandler() 40 | sub = client.create_subscription(100, sclt) 41 | handle = sub.subscribe_data_change(myvar) 42 | print("Subscribe handle is: ", handle) 43 | evhandle = sub.subscribe_events() 44 | print("Subscribe handle is: ", evhandle) 45 | 46 | 47 | embed() 48 | finally: 49 | client.disconnect() 50 | -------------------------------------------------------------------------------- /python/examples/nodeopcuaclient.py: -------------------------------------------------------------------------------- 1 | 2 | import sys 3 | import time 4 | sys.path.append(".") 5 | 6 | from IPython import embed 7 | import opcua 8 | 9 | class SubClient(opcua.SubscriptionHandler): 10 | def __init_(self, *args): 11 | self.val = MessageSecurityMode.None 12 | #self.c = Condition() 13 | def data_change(self, handle, node, val, attr): 14 | print("Python: New data change event", handle, node, val, attr) 15 | self.val = val 16 | 17 | 18 | if __name__ == "__main__": 19 | client = opcua.Client(True) 20 | client.connect("opc.tcp://utgaard:4841") 21 | #s.connect("opc.tcp://192.168.56.101:48030") 22 | try: 23 | root = client.get_root_node() 24 | print("I got root: ", root) 25 | print("Childs are: ", root.get_children()) 26 | 27 | #getting node by id since nodejs seems not to support browsepath 28 | myvar = client.get_node(opcua.NodeId("ns=1;i=1001")) 29 | #myvar = root.get_child(["0:MyDevice"]) 30 | #print("yvar is: ", myvar,get_children()) 31 | #myvar = root.get_child(["0:MyDevice", "0:MyVariable1"]) 32 | print("myvar is: ", myvar) 33 | 34 | sclt = SubClient() 35 | sub = client.create_subscription(100, sclt) 36 | handle = sub.subscribe_data_change(myvar) 37 | print("Subscribe handle is: ", handle) 38 | 39 | 40 | embed() 41 | finally: 42 | client.disconnect() 43 | -------------------------------------------------------------------------------- /python/examples/prosysclient.py: -------------------------------------------------------------------------------- 1 | 2 | import sys 3 | import time 4 | sys.path.append(".") 5 | 6 | from IPython import embed 7 | import opcua 8 | 9 | class SubHandler(opcua.SubscriptionHandler): 10 | def __init__(self, *args): 11 | opcua.SubscriptionHandler.__init__(self, *args) 12 | self.val = MessageSecurityMode::None 13 | 14 | def data_change(self, handle, node, val, attr): 15 | print("Python: New data change event", handle, node, val, attr) 16 | self.val = val 17 | 18 | def event(self, handle, event): 19 | print("Python: New event", handle, event) 20 | self.ev = event 21 | 22 | 23 | if __name__ == "__main__": 24 | client = opcua.Client(False) 25 | client.connect("opc.tcp://localhost:53530/OPCUA/SimulationServer/") 26 | try: 27 | root = client.get_root_node() 28 | print("I got root: ", root) 29 | print("Childs are: ", root.get_children()) 30 | print("Objects is: ", client.get_objects_node()) 31 | o = client.get_objects_node() 32 | print("Children of objects are: ", o.get_children()) 33 | 34 | myvar = root.get_child(["0:Objects", "5:Simulation", "5:Random1"]) 35 | print("yvar is: ", myvar) 36 | myfloat = client.get_node("ns=4;s=Float") 37 | mydouble = client.get_node("ns=4;s=Double") 38 | myint64 = client.get_node("ns=4;s=Int64") 39 | myuint64 = client.get_node("ns=4;s=UInt64") 40 | myint32 = client.get_node("ns=4;s=Int32") 41 | myuint32 = client.get_node("ns=4;s=UInt32") 42 | 43 | sclt = SubHandler() 44 | sub = client.create_subscription(100, sclt) 45 | handle = sub.subscribe_data_change(myvar) 46 | print("Subscribe handle is: ", handle) 47 | 48 | 49 | embed() 50 | finally: 51 | client.disconnect() 52 | -------------------------------------------------------------------------------- /python/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from distutils.core import setup, Extension 4 | import sys 5 | import os 6 | import platform 7 | 8 | opcua_server_path = os.environ.get('OPCUA_Server_PATH','..') 9 | 10 | extra_compile_args = [ 11 | '-std=c++11', 12 | '-pthread', 13 | '-Wall', 14 | '--param=max-vartrack-size=0', 15 | ] 16 | 17 | extra_link_args = [ 18 | '-pthread', 19 | ] 20 | 21 | include_dirs = [ 22 | os.path.join(opcua_server_path,'include'), 23 | ] 24 | 25 | library_dirs = [ 26 | os.path.join(opcua_server_path,'.libs'), 27 | os.path.join(opcua_server_path,'lib'), 28 | ] 29 | 30 | boost_library='boost_python3' if sys.version_info[0] == 3 and platform.dist()[0] == 'fedora' else 'boost_python' 31 | 32 | libraries = [ 33 | boost_library, 34 | 'opcuaclient', 35 | 'opcuaserver', 36 | ] 37 | 38 | if sys.version_info[0] == 2: name='python-freeopcua' 39 | else: name='python{}-freeopcua'.format(sys.version_info.major) 40 | 41 | setup(name=name, 42 | version='0.2', 43 | description='Python bindings to freeopcua.', 44 | author='Matthieu Bec', 45 | author_email='mdcb808@gmail.com', 46 | url='https://github.com/treww/opcua-python', 47 | license = 'LGPL', 48 | ext_modules = [ 49 | Extension( 50 | name='opcua', 51 | sources=[ 52 | 'src/py_opcua_module.cpp', 53 | 'src/py_opcua_enums.cpp', 54 | 'src/py_opcua_enums_ObjectId.cpp', 55 | 'src/py_opcua_enums_StatusCode.cpp', 56 | 'src/py_opcua_enums_AttributeId.cpp', 57 | 'src/py_opcua_subscriptionclient.cpp', 58 | ], 59 | include_dirs = include_dirs, 60 | extra_compile_args = extra_compile_args, 61 | extra_link_args = extra_link_args, 62 | library_dirs = library_dirs, 63 | libraries = libraries, 64 | ), 65 | ] 66 | ) 67 | 68 | -------------------------------------------------------------------------------- /python/src/py_opcua_enums.h: -------------------------------------------------------------------------------- 1 | /// @author Matthieu Bec 2014 2 | /// @email mbec@gmto.org 3 | /// @brief Python bindings for freeopcua. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | void py_opcua_enums(); 14 | 15 | -------------------------------------------------------------------------------- /python/src/py_opcua_enums_AttributeId.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // DO NOT EDIT THIS FILE! 3 | // It is automatically generated from opcfoundation.org schemas. 4 | // 5 | 6 | #include 7 | 8 | #include "opc/ua/protocol/attribute_ids.h" 9 | 10 | using namespace boost::python; 11 | using namespace OpcUa; 12 | 13 | void py_opcua_enums_AttributeId() 14 | { 15 | enum_("AttributeId") 16 | #define _value(X) value(#X, AttributeId:: X) 17 | ._value(NodeId) 18 | ._value(NodeClass) 19 | ._value(BrowseName) 20 | ._value(DisplayName) 21 | ._value(Description) 22 | ._value(WriteMask) 23 | ._value(UserWriteMask) 24 | ._value(IsAbstract) 25 | ._value(Symmetric) 26 | ._value(InverseName) 27 | ._value(ContainsNoLoops) 28 | ._value(EventNotifier) 29 | ._value(Value) 30 | ._value(DataType) 31 | ._value(ValueRank) 32 | ._value(ArrayDimensions) 33 | ._value(AccessLevel) 34 | ._value(UserAccessLevel) 35 | ._value(MinimumSamplingInterval) 36 | ._value(Historizing) 37 | ._value(Executable) 38 | ._value(UserExecutable) 39 | #undef _value 40 | ; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /python/src/py_opcua_subscriptionclient.h: -------------------------------------------------------------------------------- 1 | /// @author Matthieu Bec 2014 2 | /// @email mbec@gmto.org 3 | /// @brief Python bindings for freeopcua. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | #include "opc/ua/node.h" 16 | #include "opc/ua/event.h" 17 | #include "opc/ua/subscription.h" 18 | 19 | using namespace boost::python; 20 | using namespace OpcUa; 21 | 22 | class PySubscriptionHandler: public SubscriptionHandler 23 | { 24 | public: 25 | 26 | PySubscriptionHandler(PyObject * p); 27 | void DataChange(uint32_t handle, const Node & node, const Variant & val, AttributeId attribute) override; 28 | void Event(uint32_t handle, const OpcUa::Event & event) override; 29 | void StatusChange(StatusCode status) override; 30 | static void DefaultDataChange(const SubscriptionHandler & self_, uint32_t handle, const Node & node, const object & val, uint32_t attribute); 31 | static void DefaultEvent(const SubscriptionHandler & self_, uint32_t handle, const OpcUa::Event & event); 32 | static void DefaultStatusChange(const SubscriptionHandler & self_, StatusCode status); 33 | 34 | private: 35 | PyObject * self; 36 | 37 | }; 38 | 39 | -------------------------------------------------------------------------------- /python/tests/Makefile: -------------------------------------------------------------------------------- 1 | opcua_paths = OPCUA_SERVER_PATH=$(OPCUA_SERVER_PATH) 2 | libraries_path =$(OPCUA_SERVER_PATH)/lib:$(OPCUA_SERVER_PATH)/.libs 3 | 4 | all: 5 | $(opcua_paths) python setup.py bdist 6 | 7 | TEST_VARS = $(opcua_paths) LD_LIBRARY_PATH=$(libraries_path) PYTHONPATH=$(shell find . -name \*.so -exec dirname {} + ) 8 | 9 | check: all 10 | $(TEST_VARS) python test.py 11 | 12 | clean: 13 | rm -rvf build dist 14 | 15 | dist: 16 | 17 | distclean: clean 18 | 19 | -------------------------------------------------------------------------------- /python/tests/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | from distutils.core import setup 4 | from distutils.extension import Extension 5 | import os 6 | 7 | opcua_server_path = os.environ['OPCUA_Server_PATH'] 8 | 9 | sources = [ 10 | '../src/py_opcua_module.cpp', 11 | '../src/py_opcua_enums.cpp', 12 | '../src/py_opcua_subscriptionclient.cpp', 13 | 'test_computer.cpp', 14 | ] 15 | 16 | 17 | includes = [ 18 | opcua_server_path + '/include', 19 | ] 20 | 21 | cpp_flags = [ 22 | '-std=c++11', 23 | '-DMODULE_NAME=test_opcua', 24 | '-Wl,--no-undefined', 25 | ] 26 | 27 | libs = [ 28 | 'opcuaclient', 29 | 'opcuaserver', 30 | 'stdc++', 31 | 'pthread', 32 | 'boost_python', 33 | ] 34 | 35 | ldirs = [ 36 | opcua_server_path + '/lib', 37 | opcua_server_path + '/.libs', 38 | ] 39 | 40 | opcua_client = Extension( 41 | 'test_opcua', 42 | sources, 43 | include_dirs = includes, 44 | extra_compile_args = cpp_flags, 45 | library_dirs = ldirs, 46 | libraries = libs, 47 | language = 'c++') 48 | 49 | modules = [opcua_client] 50 | 51 | setup(name='test_opcua', 52 | version='0.1.2', 53 | description='Client interface for OPC UA servers.', 54 | author='Alexander Rykovanov', 55 | author_email='rykovanov.as@gmail.com', 56 | url='https://github.com/treww/opcua-python', 57 | license = 'LGPL', 58 | ext_modules = modules 59 | ) 60 | 61 | -------------------------------------------------------------------------------- /restyle: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | astyle --options=astylerc `find . -regextype posix-extended -regex ".*\.(c|cpp|h|hpp)"` 4 | 5 | -------------------------------------------------------------------------------- /schemas/AttributeIds.csv: -------------------------------------------------------------------------------- 1 | NodeId,1 2 | NodeClass,2 3 | BrowseName,3 4 | DisplayName,4 5 | Description,5 6 | WriteMask,6 7 | UserWriteMask,7 8 | IsAbstract,8 9 | Symmetric,9 10 | InverseName,10 11 | ContainsNoLoops,11 12 | EventNotifier,12 13 | Value,13 14 | DataType,14 15 | ValueRank,15 16 | ArrayDimensions,16 17 | AccessLevel,17 18 | UserAccessLevel,18 19 | MinimumSamplingInterval,19 20 | Historizing,20 21 | Executable,21 22 | UserExecutable,22 23 | -------------------------------------------------------------------------------- /schemas/Opc.Ua.Di.Types.bsd: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /schemas/Opc.Ua.Di.Types.xsd: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /schemas/UAVariant.xsd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/freeopcua/6eac0975636425d2e122b228ca69fea2d30c9ce6/schemas/UAVariant.xsd -------------------------------------------------------------------------------- /schemas/regen: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | PYTHON=python3 4 | 5 | ${PYTHON} download.py 6 | ${PYTHON} codegen.py cxx object_ids > ../include/opc/ua/protocol/object_ids.h 7 | ${PYTHON} codegen.py cxx object_ids_tostring > ../src/protocol/string_utils_objectid_tostring.cpp 8 | ${PYTHON} codegen.py cxx status_codes > ../include/opc/ua/protocol/status_codes.h 9 | ${PYTHON} codegen.py cxx status_codes_tostring > ../src/protocol/string_utils_statuscode_tostring.cpp 10 | ${PYTHON} codegen.py cxx attribute_ids > ../include/opc/ua/protocol/attribute_ids.h 11 | ${PYTHON} codegen.py cxx attribute_ids_getoptionvalue > ../src/clientapp/opcua_options_attribute_ids.h 12 | ${PYTHON} codegen.py cxx attribute_ids_tostring > ../src/protocol/string_utils_attributeid_tostring.cpp 13 | for part in 3 4 5 8 9 10 11 13; do 14 | ${PYTHON} generate_address_space.py Opc.Ua.NodeSet2.Part${part}.xml ../src/server/standard_address_space_part${part}.cpp 15 | done 16 | 17 | -------------------------------------------------------------------------------- /src/client/binary_client_addon.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | 21 | 22 | namespace 23 | { 24 | class BinaryClientAddon : public OpcUa::Client::Addon 25 | { 26 | public: 27 | virtual void Initialize(Common::AddonsManager & manager, const Common::AddonParameters & parameters) 28 | { 29 | /* 30 | for (auto param = parameters.Parameters.begin(); param != parameters.Parameters.begin(); ++param) 31 | { 32 | if (param->Name == "debug" && param->Value != "false" && param->Value != "0") 33 | { 34 | Logger = manager.GetLogger(); 35 | } 36 | } 37 | */ 38 | Logger = manager.GetLogger(); 39 | } 40 | 41 | virtual void Stop() 42 | { 43 | } 44 | 45 | public: 46 | virtual std::string GetProtocol() const 47 | { 48 | return "opc.tcp"; 49 | } 50 | 51 | virtual OpcUa::Services::SharedPtr Connect(const std::string & url) 52 | { 53 | return OpcUa::CreateBinaryClient(url, Logger); 54 | } 55 | 56 | private: 57 | Common::Logger::SharedPtr Logger; 58 | }; 59 | } 60 | 61 | extern "C" Common::Addon * CreateAddon() 62 | { 63 | return new BinaryClientAddon(); 64 | } 65 | -------------------------------------------------------------------------------- /src/clientapp/configs/opc_tcp.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | opc.tcp 7 | libopcuaclient.so 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/core/common/addons_core/dynamic_addon_factory.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Dynamic addon factory. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "dynamic_library.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | 19 | namespace 20 | { 21 | using namespace Common; 22 | 23 | class DynamicAddonFactory : public AddonFactory 24 | { 25 | public: 26 | DEFINE_CLASS_POINTERS(DynamicAddonFactory) 27 | 28 | public: 29 | DynamicAddonFactory(const std::string & modulePath); 30 | 31 | virtual Addon::UniquePtr CreateAddon(); 32 | 33 | private: 34 | DynamicLibrary Library; 35 | }; 36 | 37 | DynamicAddonFactory::DynamicAddonFactory(const std::string & modulePath) 38 | : Library(modulePath) 39 | { 40 | } 41 | 42 | Addon::UniquePtr DynamicAddonFactory::CreateAddon() 43 | { 44 | return Addon::UniquePtr(Library.Find("CreateAddon")()); 45 | } 46 | } 47 | 48 | Common::AddonFactory::UniquePtr Common::CreateDynamicAddonFactory(const char * modulePath) 49 | { 50 | return Common::AddonFactory::UniquePtr(new DynamicAddonFactory(modulePath)); 51 | } 52 | -------------------------------------------------------------------------------- /src/core/common/addons_core/dynamic_library.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Dynamic library class. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #ifndef __opc_common_dynamic_library_h 13 | #define __opc_common_dynamic_library_h 14 | 15 | #include 16 | 17 | namespace Common 18 | { 19 | 20 | class DynamicLibrary 21 | { 22 | public: 23 | DynamicLibrary(const std::string & libraryPath); 24 | ~DynamicLibrary(); 25 | 26 | template 27 | FuncType Find(const std::string & funcName) 28 | { 29 | return reinterpret_cast(FindSymbol(funcName)); 30 | } 31 | 32 | private: 33 | void * FindSymbol(const std::string & funcName); 34 | 35 | private: 36 | const std::string Path; 37 | void * Library; 38 | }; 39 | 40 | } 41 | 42 | #endif // __opc_common_dynamic_library_h 43 | 44 | -------------------------------------------------------------------------------- /src/core/common/addons_core/dynamic_library_lin.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Dynamic library class. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "dynamic_library.h" 12 | 13 | #include 14 | 15 | #include 16 | 17 | namespace 18 | { 19 | 20 | void * LoadLibrary(const char * path) 21 | { 22 | void * library = dlopen(path, RTLD_LAZY); 23 | 24 | if (!library) 25 | { 26 | std::string msg; 27 | 28 | if (const char * err = dlerror()) 29 | { 30 | msg = err; 31 | } 32 | 33 | THROW_ERROR2(UnableToLoadDynamicLibrary, path, msg); 34 | } 35 | 36 | return library; 37 | } 38 | 39 | } 40 | 41 | namespace Common 42 | { 43 | 44 | DynamicLibrary::DynamicLibrary(const std::string & libraryPath) 45 | : Path(libraryPath) 46 | , Library(0) 47 | { 48 | } 49 | 50 | DynamicLibrary::~DynamicLibrary() 51 | { 52 | if (Library) 53 | { 54 | //dlclose(Library); 55 | } 56 | } 57 | 58 | void * DynamicLibrary::FindSymbol(const std::string & funcName) 59 | { 60 | if (!Library) 61 | { 62 | Library = LoadLibrary(Path.c_str()); 63 | } 64 | 65 | void * func = dlsym(Library, funcName.c_str()); 66 | 67 | if (!func) 68 | { 69 | std::string msg; 70 | 71 | if (const char * err = dlerror()) 72 | { 73 | msg = err; 74 | } 75 | 76 | THROW_ERROR3(UnableToFundSymbolInTheLibrary, funcName, Path, msg); 77 | } 78 | 79 | return func; 80 | } 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/core/common/addons_core/dynamic_library_win.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Dynamic library class. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "dynamic_library.h" 12 | 13 | #include 14 | 15 | #include 16 | 17 | namespace 18 | { 19 | 20 | void * LoadDll(const char * path) 21 | { 22 | // TODO Use SetDllDirctory to search inside installation path. 23 | void * library = LoadLibrary(path); 24 | 25 | if (!library) 26 | { 27 | std::string msg; 28 | // TODO Get windows error string. 29 | THROW_ERROR2(UnableToLoadDynamicLibrary, path, msg); 30 | } 31 | 32 | return library; 33 | } 34 | 35 | } 36 | 37 | namespace Common 38 | { 39 | 40 | DynamicLibrary::DynamicLibrary(const std::string & libraryPath) 41 | : Path(libraryPath) 42 | , Library(0) 43 | { 44 | } 45 | 46 | DynamicLibrary::~DynamicLibrary() 47 | { 48 | if (Library) 49 | { 50 | FreeLibrary((HMODULE)Library); 51 | } 52 | } 53 | 54 | void * DynamicLibrary::FindSymbol(const std::string & funcName) 55 | { 56 | if (!Library) 57 | { 58 | Library = LoadDll(Path.c_str()); 59 | } 60 | 61 | void * func = (void *)GetProcAddress((HMODULE)Library, funcName.c_str()); 62 | 63 | if (!func) 64 | { 65 | std::string msg; 66 | // TODO GetWindows error string. 67 | THROW_ERROR3(UnableToFundSymbolInTheLibrary, funcName, Path, msg); 68 | } 69 | 70 | return func; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/core/common/addons_core/errors_addon_manager.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Common errors 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | #include 13 | 14 | #define ADDONS_MANAGER_ERROR(name, code, message) Common::ErrorData name(ERROR_CODE(Common::MODULE_ADDONS_MANAGER, code), message) 15 | 16 | ADDONS_MANAGER_ERROR(UnableToRegisterAddonWhenStarted, 1, "Unable to register addon '%1%' with dependencies when addons manager started."); 17 | ADDONS_MANAGER_ERROR(AddonsManagerAlreadyStarted, 2, "Addons manager already started."); 18 | ADDONS_MANAGER_ERROR(AddonsManagerAlreadyStopped, 3, "Addons Manager already stopped."); 19 | ADDONS_MANAGER_ERROR(AddonNotFound, 4, "Addon with id '%1%' not found."); 20 | ADDONS_MANAGER_ERROR(AddonNotInitializedYet, 5, "Addon with id '%1%' is not initialized yet"); 21 | ADDONS_MANAGER_ERROR(AddonNotRegistered, 6, "Addon with id '%1%' is not registered, but should."); 22 | ADDONS_MANAGER_ERROR(AddonRegisteredButShouldnt, 7, "Addon with id '%1%' registered, but shouldn't."); 23 | ADDONS_MANAGER_ERROR(AddonIsNotStarted, 8, "Addons with id '%1%' is not started."); 24 | ADDONS_MANAGER_ERROR(UnableToLoadDynamicLibrary, 9, "Unable to load library '%1%'. %2%"); 25 | ADDONS_MANAGER_ERROR(UnableToFundSymbolInTheLibrary, 10, "Unable to find symbol '%1%' in the library '%2%'. %3%"); 26 | ADDONS_MANAGER_ERROR(ApplicationAlreayStarted, 11, "Cannot start application. It is already started."); 27 | ADDONS_MANAGER_ERROR(ApplicationNotStarted, 12, "Application not started."); 28 | -------------------------------------------------------------------------------- /src/core/common/common_errors.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Common errors definitions 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | #include 13 | 14 | #define COMMON_ERROR(name, code, message) Common::ErrorData name(ERROR_CODE(Common::MODULE_COMMON, code), message) 15 | 16 | COMMON_ERROR(InvalidValueType, 1, "Invalid value type '%1%'."); 17 | COMMON_ERROR(UnsupportedFeature, 2, "Unsupported."); 18 | COMMON_ERROR(NotImplemented, 3, "Not implemented."); 19 | COMMON_ERROR(StdException, 4, "Standard exception '%1%'."); 20 | COMMON_ERROR(CannotParseUri, 5, "Cannot parse uri '%1%'."); 21 | COMMON_ERROR(FailedToStartAddons, 6, "Cannot start addons."); 22 | 23 | -------------------------------------------------------------------------------- /src/core/common/exception.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Exception class realization 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | 13 | Common::Error::Error() 14 | : LineNum(0) 15 | , FileName() 16 | , Code(0) 17 | , Message() 18 | { 19 | } 20 | 21 | Common::Error::Error(unsigned lineNum, const char * fileName, unsigned errorCode, const char * msg) 22 | : LineNum(lineNum) 23 | , FileName(fileName) 24 | , Code(errorCode) 25 | , Message(msg) 26 | { 27 | } 28 | 29 | Common::Error::~Error() throw() 30 | { 31 | } 32 | 33 | unsigned Common::Error::GetLineNum() const 34 | { 35 | return LineNum; 36 | } 37 | 38 | std::string Common::Error::GetFileName() const 39 | { 40 | return FileName; 41 | } 42 | 43 | unsigned Common::Error::GetCode() const 44 | { 45 | return Code; 46 | } 47 | 48 | std::string Common::Error::GetMessage() const 49 | { 50 | return Message; 51 | } 52 | 53 | Common::Error & Common::Error::AddError(const Error & subError) 54 | { 55 | SubErrors.push_back(subError); 56 | return *this; 57 | } 58 | 59 | std::string Common::Error::GetFullMessage() const 60 | { 61 | std::string msg = FileName; 62 | msg += "(" + std::to_string(LineNum) + "):\n"; 63 | msg += Message; 64 | std::vector::const_iterator it = SubErrors.begin(); 65 | 66 | for (; it != SubErrors.end(); ++ it) 67 | { 68 | msg += "\n"; 69 | msg += it->GetMessage(); 70 | } 71 | 72 | return msg; 73 | } 74 | 75 | const char * Common::Error::what() const throw() 76 | { 77 | return Message.c_str(); 78 | } 79 | -------------------------------------------------------------------------------- /src/core/common/thread.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Thread wrapper with coockies. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | 13 | #include 14 | 15 | namespace Common 16 | { 17 | 18 | Thread::Thread(std::function f, ThreadObserver * observer) 19 | : Observer(observer) 20 | , Func(f) 21 | , Impl(Thread::ThreadProc, this) 22 | { 23 | } 24 | 25 | Thread::~Thread() 26 | { 27 | try 28 | { 29 | Join(); 30 | } 31 | 32 | catch (std::exception &) 33 | { 34 | } 35 | } 36 | 37 | void Thread::Join() 38 | { 39 | Impl.join(); 40 | } 41 | 42 | void Thread::Run() 43 | { 44 | try 45 | { 46 | Func(); 47 | 48 | if (Observer) 49 | { 50 | Observer->OnSuccess(); 51 | } 52 | } 53 | 54 | catch (const std::exception & exc) 55 | { 56 | if (Observer) 57 | { 58 | Observer->OnError(exc); 59 | } 60 | } 61 | } 62 | 63 | void Thread::ThreadProc(Thread * thread) 64 | { 65 | thread->Run(); 66 | } 67 | 68 | } // namespace Common 69 | 70 | -------------------------------------------------------------------------------- /src/core/common/uri_facade_lin_noregex.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Uri. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | 13 | #include 14 | 15 | #include 16 | 17 | namespace Common 18 | { 19 | 20 | void Uri::Initialize(const std::string& uriString) 21 | { 22 | xmlURIPtr uri = xmlParseURI(uriString.c_str()); 23 | if (!uri) 24 | { 25 | THROW_ERROR1(CannotParseUri, uriString); 26 | } 27 | 28 | if (uri->scheme) 29 | { 30 | SchemeStr = uri->scheme; 31 | } 32 | 33 | if (uri->user) 34 | { 35 | UserStr = uri->user; 36 | int ix = UserStr.find(':'); 37 | 38 | if (ix > 0) 39 | { 40 | PasswordStr = UserStr.substr(ix + 1); 41 | UserStr = UserStr.substr(0, ix); 42 | } 43 | } 44 | 45 | if (uri->server) 46 | { 47 | HostStr = uri->server; 48 | } 49 | 50 | PortNum = uri->port; 51 | xmlFreeURI(uri); 52 | 53 | if (SchemeStr.empty() || HostStr.empty()) 54 | { 55 | THROW_ERROR1(CannotParseUri, uriString); 56 | } 57 | } 58 | 59 | } // namespace Common 60 | -------------------------------------------------------------------------------- /src/core/common/uri_facade_win.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Uri. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | namespace Common 20 | { 21 | 22 | void Uri::Initialize(const std::string &uriString) 23 | { 24 | URL_COMPONENTS url = {0}; 25 | url.dwStructSize = sizeof(url); 26 | url.dwSchemeLength = 1; 27 | url.dwUserNameLength = 1; 28 | url.dwPasswordLength = 1; 29 | url.dwHostNameLength = 1; 30 | DWORD options = 0; 31 | 32 | // TODO msdn says do not use this function in services and in server patforms. :( 33 | // TODO http://msdn.microsoft.com/en-us/library/windows/desktop/aa384376(v=vs.85).aspx 34 | if (!InternetCrackUrl(uriString.c_str(), uriString.size(), options, &url)) 35 | { 36 | THROW_ERROR1(CannotParseUri, uriString); 37 | } 38 | 39 | 40 | SchemeStr = std::string(url.lpszScheme, url.lpszScheme + url.dwSchemeLength); 41 | UserStr = std::string(url.lpszUserName, url.lpszUserName + url.dwUserNameLength); 42 | PasswordStr = std::string(url.lpszPassword, url.lpszPassword + url.dwPasswordLength); 43 | HostStr = std::string(url.lpszHostName, url.lpszHostName + url.dwHostNameLength); 44 | PortNum = url.nPort; 45 | 46 | if (SchemeStr.empty() || HostStr.empty()) 47 | { 48 | THROW_ERROR1(CannotParseUri, uriString); 49 | } 50 | } 51 | 52 | } // namespace Common 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/core/common/value.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Common::Value realization 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | /* 12 | #include 13 | #include 14 | 15 | Common::ValueType Common::GetValueType(const Common::VariantType& value) 16 | { 17 | switch(value.which()) 18 | { 19 | case 0: return CHAR_TYPE; 20 | case 1: return INT_TYPE; 21 | case 2: return UNSIGNED_INT_TYPE; 22 | case 3: return FLOAT_TYPE; 23 | case 4: return DOUBLE_TYPE; 24 | case 5: return STRING_TYPE; 25 | case 6: return WSTRING_TYPE; 26 | } 27 | THROW_ERROR1(InvalidValueType, value.which()); 28 | } 29 | 30 | */ 31 | -------------------------------------------------------------------------------- /src/core/opcua_errors.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Common errors definitions 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | #include 13 | 14 | #define OPCUA_CORE_MODULE_ERROR_CODE(code) ERROR_CODE(Common::MODULE_OPCUA_CORE, code) 15 | #define OPCUA_CORE_ERROR(name, code, message) Common::ErrorData name(OPCUA_CORE_MODULE_ERROR_CODE(code), message) 16 | 17 | OPCUA_CORE_ERROR(CannotCreateChannelOnInvalidSocket, 1, "Cannot create socket on invalid socket."); 18 | 19 | -------------------------------------------------------------------------------- /src/core/server_operations.cpp: -------------------------------------------------------------------------------- 1 | #include "opc/ua/server_operations.h" 2 | 3 | namespace OpcUa 4 | { 5 | ServerOperations::ServerOperations(Services::SharedPtr Server) : Server(Server) 6 | { 7 | } 8 | 9 | void ServerOperations::WriteAttributes(std::vector & updates) 10 | { 11 | std::vector codes = Server->Attributes()->Write(updates); 12 | CheckStatusCode(codes.front()); 13 | } 14 | 15 | std::vector ServerOperations::ReadAttributes(std::vector & attributes) 16 | { 17 | ReadParameters params; 18 | params.AttributesToRead = attributes; 19 | auto vec = Server->Attributes()->Read(params); 20 | return vec; 21 | } 22 | 23 | std::vector ServerOperations::ReadAttributes(std::vector & nodes, AttributeId attr) 24 | { 25 | std::vector request; 26 | 27 | for (auto & n : nodes) 28 | { 29 | ReadValueId r; 30 | r.NodeId = n.GetId(); 31 | r.AttributeId = attr; 32 | request.push_back(r); 33 | } 34 | 35 | return ReadAttributes(request); 36 | } 37 | 38 | std::vector ServerOperations::RegisterNodes(std::vector & nodes) 39 | { 40 | std::vector ids; 41 | 42 | for (auto & node : nodes) 43 | { 44 | ids.push_back(node.GetId()); 45 | } 46 | 47 | auto result = Server->Views()->RegisterNodes(ids); 48 | auto rit = result.begin(); 49 | std::vector out; 50 | 51 | for (auto nit = nodes.begin(); nit != nodes.end() && rit != result.end(); ++nit, ++rit) 52 | { 53 | out.push_back(Node(nit->GetServices(), *rit)); 54 | } 55 | 56 | return out; 57 | } 58 | 59 | void ServerOperations::UnregisterNodes(std::vector & nodes) 60 | { 61 | std::vector ids; 62 | 63 | for (auto & node : nodes) 64 | { 65 | ids.push_back(node.GetId()); 66 | } 67 | 68 | Server->Views()->UnregisterNodes(ids); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/protocol/binary_attribute.cpp: -------------------------------------------------------------------------------- 1 | // @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc Ua binary session services. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "binary_serialization.h" 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | 23 | namespace OpcUa 24 | { 25 | 26 | namespace Binary 27 | { 28 | 29 | template<> 30 | std::size_t RawSize(const AttributeId &) 31 | { 32 | return 4; 33 | } 34 | 35 | template<> 36 | void DataSerializer::Serialize(const AttributeId & attr) 37 | { 38 | *this << static_cast(attr); 39 | } 40 | 41 | template<> 42 | void DataDeserializer::Deserialize(AttributeId & t) 43 | { 44 | uint32_t tmp = 0; 45 | *this >> tmp; 46 | t = static_cast(tmp); 47 | } 48 | 49 | 50 | 51 | } // namespace Binary 52 | } // namespace OpcUa 53 | 54 | -------------------------------------------------------------------------------- /src/protocol/binary_serialization.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Opc binary cnnection channel. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __OPC_UA_BINARY_SERIALIZATION_TOOLS_H__ 12 | #define __OPC_UA_BINARY_SERIALIZATION_TOOLS_H__ 13 | 14 | #include 15 | #include 16 | 17 | 18 | namespace OpcUa 19 | { 20 | template 21 | inline void SerializeContainer(Stream & out, const Container & c, uint32_t emptySizeValue = ~uint32_t()) 22 | { 23 | if (c.empty()) 24 | { 25 | out.Serialize(emptySizeValue); 26 | } 27 | 28 | else 29 | { 30 | out.Serialize(static_cast(c.size())); 31 | std::for_each(c.begin(), c.end(), [&](typename Container::value_type const & v) { out.Serialize(v); }); 32 | } 33 | } 34 | 35 | template 36 | inline void DeserializeContainer(Stream & in, Container & c) 37 | { 38 | uint32_t size = 0; 39 | in.Deserialize(size); 40 | 41 | c.clear(); 42 | 43 | if (!size || size == ~uint32_t()) 44 | { 45 | return; 46 | } 47 | 48 | for (uint32_t i = 0; i < size; ++i) 49 | { 50 | typename Container::value_type val; 51 | in.Deserialize(val); 52 | c.push_back(val); 53 | } 54 | } 55 | } 56 | 57 | #endif // __OPC_UA_BINARY_SERIALIZATION_TOOLS_H__ 58 | 59 | -------------------------------------------------------------------------------- /src/protocol/protocol.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | namespace OpcUa 5 | { 6 | 7 | ReadParameters::ReadParameters() 8 | : MaxAge(0) 9 | , TimestampsToReturn(OpcUa::TimestampsToReturn::Neither) 10 | { 11 | 12 | } 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/protocol/session.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace OpcUa 4 | { 5 | ExpandedNodeId GenerateSessionId() 6 | { 7 | static uint32_t sessionId; 8 | return ExpandedNodeId(NumericNodeId(++sessionId + 5, 0)); 9 | } 10 | } 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/protocol/status_codes.cpp: -------------------------------------------------------------------------------- 1 | /// @brief OpcUa Error codes. 2 | /// @license GNU LGPL 3 | /// 4 | /// Distributed under the GNU LGPL License 5 | /// (See accompanying file LICENSE or copy at 6 | /// http://www.gnu.org/licenses/lgpl.html) 7 | /// 8 | 9 | 10 | #include 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | void OpcUa::CheckStatusCode(StatusCode code) 18 | { 19 | if (code == StatusCode::Good) 20 | { return; } 21 | 22 | throw std::runtime_error(OpcUa::ToString(code)); 23 | } 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/server/endpoints_parameters.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | 18 | namespace OpcUa 19 | { 20 | 21 | std::vector ParseEndpointsParameters(const std::vector & rootGroup, const Common::Logger::SharedPtr & logger); 22 | std::vector CreateCommonParameters(const std::vector & endpoints, const Common::Logger::SharedPtr & logger); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/server/opc_tcp_async_parameters.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (C) 2013-2014 by Alexander Rykovanov * 3 | * rykovanov.as@gmail.com * 4 | * * 5 | * This library is free software; you can redistribute it and/or modify * 6 | * it under the terms of the GNU Lesser General Public License as * 7 | * published by the Free Software Foundation; version 3 of the License. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public License * 15 | * along with this library; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 | ******************************************************************************/ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | 25 | namespace OpcUa 26 | { 27 | namespace Server 28 | { 29 | 30 | AsyncOpcTcp::Parameters GetOpcTcpParameters(const Common::AddonParameters & addonParams); 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/server/opcua_protocol.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Endpoints addon. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #pragma once 13 | 14 | #include "opcua_protocol.h" 15 | #include "tcp_server.h" 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | 22 | namespace OpcUa 23 | { 24 | namespace Server 25 | { 26 | 27 | class OpcUaProtocol : public Common::Interface 28 | { 29 | public: 30 | DEFINE_CLASS_POINTERS(OpcUaProtocol) 31 | 32 | virtual void StartEndpoints(const std::vector & Endpoints, Services::SharedPtr server) = 0; 33 | virtual void StopEndpoints() = 0; 34 | }; 35 | 36 | OpcUaProtocol::UniquePtr CreateOpcUaProtocol(TcpServer & tcpServer, const Common::Logger::SharedPtr & logger); 37 | 38 | } // namespace UaServer 39 | } // nmespace OpcUa 40 | -------------------------------------------------------------------------------- /src/server/server_object_addon.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (C) 2013-2014 by Alexander Rykovanov * 3 | * rykovanov.as@gmail.com * 4 | * * 5 | * This library is free software; you can redistribute it and/or modify * 6 | * it under the terms of the GNU Lesser General Public License as * 7 | * published by the Free Software Foundation; version 3 of the License. * 8 | * * 9 | * This library is distributed in the hope that it will be useful, * 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 12 | * GNU Lesser General Public License for more details. * 13 | * * 14 | * You should have received a copy of the GNU Lesser General Public License * 15 | * along with this library; if not, write to the * 16 | * Free Software Foundation, Inc., * 17 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 18 | ******************************************************************************/ 19 | 20 | #pragma once 21 | 22 | #include 23 | 24 | namespace OpcUa 25 | { 26 | namespace Server 27 | { 28 | 29 | const char ServerObjectAddonId[] = "server_object"; 30 | 31 | class ServerObjectFactory : public Common::AddonFactory 32 | { 33 | public: 34 | /// @brief Create instance of addon. 35 | Common::Addon::UniquePtr CreateAddon() override; 36 | }; 37 | 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/server/standard_address_space.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "standard_address_space_parts.h" 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | 10 | namespace OpcUa 11 | { 12 | namespace Server 13 | { 14 | 15 | void FillStandardNamespace(OpcUa::NodeManagementServices & registry, const Common::Logger::SharedPtr & /*logger*/) 16 | { 17 | OpcUa::CreateAddressSpacePart3(registry); 18 | OpcUa::CreateAddressSpacePart4(registry); 19 | OpcUa::CreateAddressSpacePart5(registry); 20 | OpcUa::CreateAddressSpacePart8(registry); 21 | OpcUa::CreateAddressSpacePart9(registry); 22 | OpcUa::CreateAddressSpacePart10(registry); 23 | OpcUa::CreateAddressSpacePart11(registry); 24 | OpcUa::CreateAddressSpacePart13(registry); 25 | } 26 | 27 | } // namespace UaServer 28 | } // namespace OpcUa 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/server/standard_address_space_addon.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | 19 | namespace 20 | { 21 | 22 | class StandardNamespaceAddon : public Common::Addon 23 | { 24 | public: 25 | DEFINE_CLASS_POINTERS(StandardNamespaceAddon) 26 | 27 | void Initialize(Common::AddonsManager & addons, const Common::AddonParameters & params) 28 | { 29 | OpcUa::NodeManagementServices::SharedPtr registry = addons.GetAddon(OpcUa::Server::AddressSpaceRegistryAddonId); 30 | OpcUa::Server::FillStandardNamespace(*registry, addons.GetLogger()); 31 | } 32 | 33 | void Stop() 34 | { 35 | } 36 | }; 37 | 38 | } // namespace 39 | 40 | namespace OpcUa 41 | { 42 | namespace Server 43 | { 44 | 45 | Common::Addon::UniquePtr StandardNamespaceAddonFactory::CreateAddon() 46 | { 47 | return Common::Addon::UniquePtr(new StandardNamespaceAddon()); 48 | } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/server/standard_address_space_parts.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #include 5 | 6 | namespace OpcUa 7 | { 8 | void CreateAddressSpacePart3(OpcUa::NodeManagementServices & registry); 9 | void CreateAddressSpacePart4(OpcUa::NodeManagementServices & registry); 10 | void CreateAddressSpacePart5(OpcUa::NodeManagementServices & registry); 11 | void CreateAddressSpacePart8(OpcUa::NodeManagementServices & registry); 12 | void CreateAddressSpacePart9(OpcUa::NodeManagementServices & registry); 13 | void CreateAddressSpacePart10(OpcUa::NodeManagementServices & registry); 14 | void CreateAddressSpacePart11(OpcUa::NodeManagementServices & registry); 15 | void CreateAddressSpacePart13(OpcUa::NodeManagementServices & registry); 16 | } 17 | -------------------------------------------------------------------------------- /src/server/tcp_server.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Tcp server factory. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | namespace OpcUa 21 | { 22 | namespace Server 23 | { 24 | struct TcpParameters 25 | { 26 | unsigned short Port; 27 | 28 | TcpParameters() 29 | : Port(0) 30 | { 31 | } 32 | }; 33 | 34 | class TcpServer : public Common::Interface 35 | { 36 | public: 37 | DEFINE_CLASS_POINTERS(TcpServer) 38 | 39 | TcpServer(const Common::Logger::SharedPtr & logger) 40 | : Logger(logger) 41 | {} 42 | 43 | virtual void Listen(const OpcUa::Server::TcpParameters & params, std::shared_ptr processor) = 0; 44 | virtual void StopListen(const OpcUa::Server::TcpParameters & params) = 0; 45 | 46 | protected: 47 | Common::Logger::SharedPtr Logger; 48 | }; 49 | 50 | TcpServer::UniquePtr CreateTcpServer(const Common::Logger::SharedPtr & logger); 51 | 52 | } // namespace UaServer 53 | } // namespace OpcUa 54 | 55 | -------------------------------------------------------------------------------- /src/server/xml_processor.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #ifndef XML_ADDRESS_SPACE_PROCESSOR_H_ 13 | #define XML_ADDRESS_SPACE_PROCESSOR_H_ 14 | 15 | #include 16 | #include 17 | 18 | namespace OpcUa 19 | { 20 | namespace Internal 21 | { 22 | 23 | class XmlProcessor : private Common::Interface 24 | { 25 | public: 26 | virtual void Process(xmlNode & node) = 0; 27 | }; 28 | 29 | } // namespace Internal 30 | 31 | } // namespace OpcUa 32 | 33 | #endif /* XML_ADDRESS_SPACE_PROCESSOR_H_ */ 34 | -------------------------------------------------------------------------------- /src/serverapp/configs/opcuaserver.conf: -------------------------------------------------------------------------------- 1 | # opcuaserver - Upstart configuration file for Opc UA server daemon. 2 | # 3 | 4 | author "Alexander Rykovanov " 5 | description "Opc UA server (https://github.com/treww/opc_layer)" 6 | 7 | start on runlevel [2345] 8 | stop on runlevel [!2345] 9 | 10 | expect fork 11 | respawn 12 | 13 | exec opcuaserver 14 | 15 | -------------------------------------------------------------------------------- /src/serverapp/daemon.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Daemon class. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "daemon.h" 12 | 13 | 14 | namespace OpcUa 15 | { 16 | 17 | Daemon::Daemon() 18 | { 19 | SetTerminateHandlers(); 20 | } 21 | 22 | Daemon::~Daemon() 23 | { 24 | } 25 | 26 | void Daemon::WaitForTerminate() 27 | { 28 | std::unique_lock lock(Mutex); 29 | ExitEvent.wait(lock, [this]() { return Terminating; }); 30 | } 31 | 32 | void Daemon::Terminate() 33 | { 34 | Terminating = true; 35 | ExitEvent.notify_all(); 36 | } 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/serverapp/daemon.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Daemon class. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace OpcUa 16 | { 17 | 18 | class Daemon 19 | { 20 | public: 21 | DEFINE_CLASS_POINTERS(Daemon) 22 | 23 | public: 24 | Daemon(); 25 | ~Daemon(); 26 | 27 | void Daemonize(const std::string & str); 28 | void WaitForTerminate(); 29 | 30 | void Terminate(); 31 | 32 | private: 33 | void SetTerminateHandlers(); 34 | 35 | private: 36 | std::mutex Mutex; 37 | std::condition_variable ExitEvent; 38 | volatile bool Terminating = false; 39 | }; 40 | 41 | } // namespace OpcUa 42 | 43 | -------------------------------------------------------------------------------- /src/serverapp/daemon_win.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Daemon class. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | 13 | #include "daemon.h" 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace 20 | { 21 | 22 | OpcUa::Daemon * DaemonInstance = 0; 23 | 24 | BOOL CtrlHandler(DWORD fdwCtrlType) 25 | { 26 | switch (fdwCtrlType) 27 | { 28 | // Handle the CTRL-C signal. 29 | case CTRL_C_EVENT: 30 | case CTRL_CLOSE_EVENT: 31 | case CTRL_BREAK_EVENT: 32 | case CTRL_LOGOFF_EVENT: 33 | case CTRL_SHUTDOWN_EVENT: 34 | 35 | if (DaemonInstance) 36 | { 37 | std::cout << "terminating.." << std::endl; 38 | DaemonInstance->Terminate(); 39 | DaemonInstance = nullptr; 40 | } 41 | 42 | return TRUE; 43 | 44 | default: 45 | return FALSE; 46 | } 47 | } 48 | 49 | } 50 | 51 | namespace OpcUa 52 | { 53 | 54 | void Daemon::Daemonize(const std::string & logFile) 55 | { 56 | // TODO Implement windows srvice behavior. 57 | } 58 | 59 | void Daemon::SetTerminateHandlers() 60 | { 61 | if (!SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE)) 62 | { 63 | std::cerr << "Cannot set terminate handler. Application may not response on exit event." << std::endl; 64 | } 65 | 66 | DaemonInstance = this; 67 | } 68 | 69 | } 70 | 71 | -------------------------------------------------------------------------------- /src/serverapp/server_main.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Server main. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifdef _WIN32 12 | #include 13 | #endif 14 | 15 | #include 16 | #include "daemon.h" 17 | #include "server_options.h" 18 | 19 | #include 20 | #include 21 | 22 | /* 23 | #ifdef _WIN32 24 | 25 | int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow) 26 | { 27 | int argc = __argc; 28 | char** argv = __argv; 29 | 30 | #else 31 | */ 32 | int main(int argc, char ** argv) 33 | { 34 | //#endif 35 | auto logger = spdlog::stderr_color_mt("server"); 36 | logger->set_level(spdlog::level::info); 37 | 38 | try 39 | { 40 | const char ** arv = (const char **)argv; 41 | OpcUa::Server::CommandLine options(argc, arv); 42 | 43 | if (!options.NeedStartServer()) 44 | { 45 | return 0; 46 | } 47 | 48 | OpcUa::Daemon daemon; 49 | 50 | if (options.IsDaemonMode()) 51 | { 52 | daemon.Daemonize(options.GetLogFile()); 53 | } 54 | 55 | Common::AddonsManager::UniquePtr manager = Common::CreateAddonsManager(logger); 56 | OpcUa::Server::LoadConfiguration(options.GetConfigDir(), *manager); 57 | 58 | manager->Start(); 59 | daemon.WaitForTerminate(); 60 | manager->Stop(); 61 | 62 | return 0; 63 | } 64 | 65 | catch (const std::exception & exc) 66 | { 67 | std::cout << exc.what() << std::endl; 68 | } 69 | 70 | catch (...) 71 | { 72 | std::cout << "Unknown error." << std::endl; 73 | } 74 | 75 | return -1; 76 | } 77 | 78 | -------------------------------------------------------------------------------- /src/serverapp/server_options.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Server main. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef _OPC_UA_Server_OPTIONS_H_ 12 | #define _OPC_UA_Server_OPTIONS_H_ 13 | 14 | 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | 22 | namespace OpcUa 23 | { 24 | namespace Server 25 | { 26 | 27 | class CommandLine 28 | { 29 | public: 30 | CommandLine(int argc, const char ** argv); 31 | 32 | bool NeedStartServer() const 33 | { 34 | return StartPossible; 35 | } 36 | 37 | bool IsDaemonMode() const 38 | { 39 | return IsDaemon; 40 | } 41 | 42 | std::string GetConfigDir() const 43 | { 44 | return ConfigDir; 45 | } 46 | 47 | std::string GetLogFile() const 48 | { 49 | return LogFile; 50 | } 51 | 52 | private: 53 | bool StartPossible; 54 | bool IsDaemon; 55 | std::string ConfigDir; 56 | std::string LogFile; 57 | }; 58 | 59 | } 60 | } 61 | 62 | #endif // _OPC_UA_Server_OPTIONS_H_ 63 | 64 | -------------------------------------------------------------------------------- /tests/client/common.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Test of opc ua binary handshake. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef __OPC_UA_TESTS_COMMON_H__ 12 | #define __OPC_UA_TESTS_COMMON_H__ 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | #include 20 | 21 | 22 | inline std::string GetHost() 23 | { 24 | if (const char * uri = getenv("TEST_Server_URI")) 25 | { 26 | return OpcUa::Internal::Uri(uri).Host(); 27 | } 28 | 29 | return "localhost"; 30 | } 31 | 32 | inline int GetPort() 33 | { 34 | if (const char * uri = getenv("TEST_Server_URI")) 35 | { 36 | return OpcUa::Internal::Uri(uri).Port(); 37 | } 38 | 39 | return 4841; 40 | } 41 | 42 | inline std::string GetEndpoint() 43 | { 44 | if (char * endpoint = getenv("TEST_Server_URI")) 45 | { 46 | return endpoint; 47 | } 48 | 49 | return "opc.tcp://localhost:4841"; 50 | } 51 | 52 | 53 | #endif // __OPC_UA_TESTS_COMMON_H__ 54 | 55 | -------------------------------------------------------------------------------- /tests/client/computer_connect.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Test Remote computer connection. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "common.h" 12 | 13 | #include 14 | 15 | #include 16 | 17 | TEST(Server, EstablishValidConnection) 18 | { 19 | const std::string endpoint = GetEndpoint(); 20 | std::unique_ptr computer; 21 | ASSERT_NO_THROW(computer = OpcUa::Connect(endpoint)); 22 | ASSERT_TRUE(computer.get()); 23 | } 24 | 25 | TEST(Server, ErrorIfInvalidUri) 26 | { 27 | const std::string endpoint = "invalid uri"; 28 | ASSERT_THROW(OpcUa::Connect(endpoint), std::logic_error); 29 | } 30 | 31 | TEST(Server, ErrorIdUnknownHost) 32 | { 33 | const std::string endpoint = "opc.tcp://host.at.tne.mars:4840"; 34 | ASSERT_THROW(OpcUa::Connect(endpoint), std::logic_error); 35 | } 36 | 37 | -------------------------------------------------------------------------------- /tests/client/computer_endpoints.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Test Remote computer connection. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "common.h" 12 | 13 | #include 14 | 15 | #include 16 | 17 | using namespace OpcUa; 18 | 19 | class Endpoints : public ::testing::Test 20 | { 21 | protected: 22 | virtual void SetUp() 23 | { 24 | std::unique_ptr computer = OpcUa::Connect(GetEndpoint()); 25 | Server = computer->Endpoints(); 26 | } 27 | 28 | virtual void TearDown() 29 | { 30 | Server = std::unique_ptr(); 31 | } 32 | 33 | protected: 34 | std::shared_ptr Server; 35 | }; 36 | 37 | 38 | TEST_F(Endpoints, GetEndpoints) 39 | { 40 | EndpointsFilter filter; 41 | const std::vector endpoints = Server->GetEndpoints(filter); 42 | ASSERT_FALSE(endpoints.empty()); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /tests/client/computer_session.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Test Remote computer connection. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "common.h" 12 | 13 | #include 14 | 15 | #include 16 | 17 | TEST(Session, Works) 18 | { 19 | std::unique_ptr computer = OpcUa::Connect(GetEndpoint()); 20 | 21 | OpcUa::RemoteSessionParameters session; 22 | session.ClientDescription.Name.Text = "opcua client"; 23 | session.SessionName = "test"; 24 | session.EndpointUrl = GetEndpoint(); 25 | session.Timeout = 1000; 26 | 27 | computer->CreateSession(session); 28 | computer->ActivateSession(); 29 | computer->CloseSession(); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /tests/core/common/error_test.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Tests of Common::Error 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | class ErrorTestCase : public CPPUNIT_NS::TestFixture 18 | { 19 | CPPUNIT_TEST_SUITE(ErrorTestCase); 20 | CPPUNIT_TEST(Test); 21 | CPPUNIT_TEST_SUITE_END(); 22 | 23 | protected: 24 | void Test(); 25 | }; 26 | 27 | CPPUNIT_TEST_SUITE_REGISTRATION(ErrorTestCase); 28 | 29 | void ErrorTestCase::Test() 30 | { 31 | Common::Error(1, "test_file", 2, "test_message"); 32 | } 33 | -------------------------------------------------------------------------------- /tests/core/common/main.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2011 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Test main function 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | int main(int argc, char ** argv) 21 | { 22 | try 23 | { 24 | CPPUNIT_NS::TestResult controller; 25 | CPPUNIT_NS::TestResultCollector result; 26 | controller.addListener(&result); 27 | CPPUNIT_NS::BriefTestProgressListener progress; 28 | controller.addListener(&progress); 29 | CPPUNIT_NS::TestRunner runner; 30 | runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest()); 31 | runner.run(controller); 32 | CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut()); 33 | outputter.write(); 34 | return result.wasSuccessful() ? 0 : -1; 35 | } 36 | 37 | catch (const std::exception & exc) 38 | { 39 | std::cout << exc.what() << std::endl; 40 | } 41 | 42 | catch (...) 43 | { 44 | std::cout << "Unknown exception." << std::endl; 45 | } 46 | 47 | return -1; 48 | } 49 | -------------------------------------------------------------------------------- /tests/core/common/thread_test.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Test of OpcUa::Thread. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | 13 | #include 14 | #include 15 | 16 | using namespace testing; 17 | 18 | namespace 19 | { 20 | 21 | class TestThreadObserver : public Common::ThreadObserver 22 | { 23 | public: 24 | TestThreadObserver() 25 | : OnSuccessCallCount(0) 26 | , OnErrorCallCount(0) 27 | { 28 | } 29 | 30 | virtual void OnSuccess() override 31 | { 32 | ++OnSuccessCallCount; 33 | } 34 | 35 | virtual void OnError(const std::exception & exc) override 36 | { 37 | ++OnErrorCallCount; 38 | } 39 | 40 | public: 41 | volatile unsigned OnSuccessCallCount; 42 | volatile unsigned OnErrorCallCount; 43 | }; 44 | 45 | void DoNothing() 46 | { 47 | } 48 | 49 | void ThrowsException() 50 | { 51 | throw std::logic_error("oppps!"); 52 | } 53 | 54 | } 55 | 56 | TEST(Thread, CallsOnSuccess) 57 | { 58 | TestThreadObserver observer; 59 | 60 | Common::Thread thread(std::function(DoNothing), &observer); 61 | thread.Join(); 62 | EXPECT_EQ(observer.OnSuccessCallCount, 1); 63 | EXPECT_EQ(observer.OnErrorCallCount, 0); 64 | } 65 | 66 | TEST(Thread, CallsOnError) 67 | { 68 | TestThreadObserver observer; 69 | 70 | Common::Thread thread(std::function(ThrowsException), &observer); 71 | thread.Join(); 72 | EXPECT_EQ(observer.OnSuccessCallCount, 0); 73 | EXPECT_EQ(observer.OnErrorCallCount, 1); 74 | } 75 | 76 | -------------------------------------------------------------------------------- /tests/core/configs/test.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | value1 4 | value2 5 | 6 | value1 7 | value2 8 | 9 | 10 | value1 11 | value2 12 | 13 | 14 | 15 | child_module 16 | child_module.so 17 | 18 | parent_module1 19 | parent_module2 20 | 21 | 22 | 23 | Test OPC UA Server 24 | opcua.treww.org 25 | server 26 | none 27 | http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary 28 | 29 | anonymous 30 | anonymous 31 | http://opcfoundation.org/UA/SecurityPolicy#None 32 | 33 | 34 | 35 | opc.tcp://localhost:4841 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /tests/core/test_dynamic_addon.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Dynamic addon for tests. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "test_dynamic_addon.h" 12 | 13 | namespace 14 | { 15 | class TestDynamicAddonImpl : public OpcCoreTests::TestDynamicAddon 16 | { 17 | public: 18 | virtual void Initialize(Common::AddonsManager &, const Common::AddonParameters & params) 19 | { 20 | Params = params; 21 | } 22 | 23 | virtual void Stop() 24 | { 25 | } 26 | 27 | virtual const char * GetStringWithHello() const 28 | { 29 | return "hello"; 30 | } 31 | 32 | virtual Common::AddonParameters GetParameters() const 33 | { 34 | return Params; 35 | } 36 | private: 37 | Common::AddonParameters Params; 38 | }; 39 | } 40 | 41 | extern "C" 42 | #ifdef _WIN32 43 | __declspec(dllexport) 44 | #endif // _WIN32 45 | Common::Addon * CreateAddon(const char * configuration) 46 | { 47 | return new TestDynamicAddonImpl(); 48 | } 49 | 50 | -------------------------------------------------------------------------------- /tests/core/test_dynamic_addon.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Dynamic addon for tests. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef TEST_DYNAMIC_ADDON_H 12 | #define TEST_DYNAMIC_ADDON_H 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | namespace OpcCoreTests 20 | { 21 | class TestDynamicAddon : public Common::Addon 22 | { 23 | public: 24 | DEFINE_CLASS_POINTERS(TestDynamicAddon); 25 | public: 26 | virtual const char * GetStringWithHello() const = 0; 27 | virtual Common::AddonParameters GetParameters() const = 0; 28 | }; 29 | 30 | } 31 | 32 | #endif // TEST_DYNAMIC_ADDON_H 33 | -------------------------------------------------------------------------------- /tests/core/test_dynamic_addon_factory.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Dynamic addon for tests. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "test_dynamic_addon.h" 12 | 13 | #include 14 | 15 | #include 16 | 17 | 18 | #ifndef DYNAMIC_ADDON_PATH 19 | #define DYNAMIC_ADDON_PATH "./libtest_dynamic_addon.so" 20 | #endif 21 | 22 | const char * modulePath = DYNAMIC_ADDON_PATH; 23 | 24 | TEST(DynamicAddonFactory, CanCreateAddons) 25 | { 26 | Common::AddonFactory::UniquePtr dynamicFactory = Common::CreateDynamicAddonFactory(modulePath); 27 | ASSERT_TRUE(static_cast(dynamicFactory->CreateAddon())); 28 | } 29 | 30 | TEST(DynamicAddonFactory, AddonInterfaceCastsToManagerInterface) 31 | { 32 | Common::AddonFactory::UniquePtr dynamicFactory = Common::CreateDynamicAddonFactory(modulePath); 33 | std::shared_ptr addon(dynamicFactory->CreateAddon()); 34 | std::shared_ptr testAddon = std::dynamic_pointer_cast(addon); 35 | ASSERT_TRUE(static_cast(testAddon)); 36 | } 37 | 38 | TEST(DynamicAddonFactory, CanCallMethodsOfAddon) 39 | { 40 | Common::AddonFactory::UniquePtr dynamicFactory = Common::CreateDynamicAddonFactory(modulePath); 41 | std::shared_ptr addon(dynamicFactory->CreateAddon()); 42 | std::shared_ptr testAddon = std::dynamic_pointer_cast(addon); 43 | ASSERT_EQ(testAddon->GetStringWithHello(), std::string("hello")); 44 | } 45 | 46 | -------------------------------------------------------------------------------- /tests/core/test_dynamic_addon_id.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Dynamic addon for tests. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #ifndef TEST_DYNAMIC_ADDON_Id_H 12 | #define TEST_DYNAMIC_ADDON_Id_H 13 | 14 | #include 15 | 16 | #include 17 | 18 | namespace OpcCoreTests 19 | { 20 | 21 | const char TestDynamicAddonId[] = "test_dynamic_addon"; 22 | 23 | } 24 | 25 | #endif // TEST_DYNAMIC_ADDON_Id_H 26 | -------------------------------------------------------------------------------- /tests/core/test_uri.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Dynamic addon for tests. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include 12 | 13 | #include 14 | 15 | TEST(Uri, CanParseFullURI) 16 | { 17 | Common::Uri uri("http://host:8080"); 18 | ASSERT_EQ(uri.Scheme(), "http"); 19 | ASSERT_EQ(uri.Host(), "host"); 20 | ASSERT_EQ(uri.Port(), 8080u); 21 | } 22 | 23 | TEST(Uri, CanParseFullURIWithUserAndPassword) 24 | { 25 | Common::Uri uri("http://user:password@host:8080"); 26 | ASSERT_EQ(uri.Scheme(), "http"); 27 | ASSERT_EQ(uri.User(), "user"); 28 | ASSERT_EQ(uri.Password(), "password"); 29 | ASSERT_EQ(uri.Host(), "host"); 30 | ASSERT_EQ(uri.Port(), 8080u); 31 | } 32 | 33 | TEST(Uri, CanParseFullWithoutPort) 34 | { 35 | Common::Uri uri("http://host"); 36 | ASSERT_EQ(uri.Scheme(), "http"); 37 | ASSERT_EQ(uri.Host(), "host"); 38 | } 39 | 40 | TEST(Uri, ThrowsIfSchemeEmpty) 41 | { 42 | ASSERT_THROW(Common::Uri("://host"), std::exception); 43 | } 44 | 45 | TEST(Uri, ThrowsIfHostEmpty) 46 | { 47 | ASSERT_THROW(Common::Uri("htp://"), std::exception); 48 | ASSERT_THROW(Common::Uri("htp://:8080"), std::exception); 49 | } 50 | 51 | TEST(Uri, ThrowsIfInvalid) 52 | { 53 | ASSERT_THROW(Common::Uri("httphost8080"), std::exception); 54 | } 55 | 56 | -------------------------------------------------------------------------------- /tests/gmock/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Mocking Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Benoit Sigoure 7 | Bogdan Piloca 8 | Chandler Carruth 9 | Dave MacLachlan 10 | David Anderson 11 | Dean Sturtevant 12 | Gene Volovich 13 | Hal Burch 14 | Jeffrey Yasskin 15 | Jim Keller 16 | Joe Walnes 17 | Jon Wray 18 | Keir Mierle 19 | Keith Ray 20 | Kostya Serebryany 21 | Lev Makhlis 22 | Manuel Klimek 23 | Mario Tanev 24 | Mark Paskin 25 | Markus Heule 26 | Matthew Simmons 27 | Mike Bland 28 | Neal Norwitz 29 | Nermin Ozkiranartli 30 | Owen Carlsen 31 | Paneendra Ba 32 | Paul Menage 33 | Piotr Kaminski 34 | Russ Rufer 35 | Sverre Sundsdal 36 | Takeshi Yoshino 37 | Vadim Berman 38 | Vlad Losev 39 | Wolfgang Klier 40 | Zhanyong Wan 41 | -------------------------------------------------------------------------------- /tests/gmock/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /tests/gmock/gtest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /tests/gmock/gtest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /tests/gmock/gtest/scripts/fuse_gtest_files.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/freeopcua/6eac0975636425d2e122b228ca69fea2d30c9ce6/tests/gmock/gtest/scripts/fuse_gtest_files.pyc -------------------------------------------------------------------------------- /tests/gmock/gtest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "production.h" 35 | 36 | PrivateCode::PrivateCode() : x_(0) {} 37 | -------------------------------------------------------------------------------- /tests/gmock/gtest/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /tests/gmock/gtest/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /tests/gmock/gtest/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Build for PPC and Intel, 32- and 64-bit 11 | ARCHS = i386 x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /tests/gmock/gtest/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /tests/gmock/gtest/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /tests/gmock/gtest/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /tests/gmock/gtest/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/gmock/gtest/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/gmock/msvc/2005/gmock.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 9.00 3 | # Visual Studio 2005 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock", "gmock.vcproj", "{34681F0D-CE45-415D-B5F2-5C662DFE3BD5}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_test", "gmock_test.vcproj", "{F10D22F8-AC7B-4213-8720-608E7D878CD2}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_main", "gmock_main.vcproj", "{E4EF614B-30DF-4954-8C53-580A0BF6B589}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.Build.0 = Debug|Win32 18 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.ActiveCfg = Release|Win32 19 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.Build.0 = Release|Win32 20 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.Build.0 = Debug|Win32 22 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.ActiveCfg = Release|Win32 23 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.Build.0 = Release|Win32 24 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.Build.0 = Debug|Win32 26 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.ActiveCfg = Release|Win32 27 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.Build.0 = Release|Win32 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /tests/gmock/msvc/2005/gmock_config.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /tests/gmock/msvc/2010/gmock.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C++ Express 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock", "gmock.vcxproj", "{34681F0D-CE45-415D-B5F2-5C662DFE3BD5}" 5 | EndProject 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_test", "gmock_test.vcxproj", "{F10D22F8-AC7B-4213-8720-608E7D878CD2}" 7 | EndProject 8 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gmock_main", "gmock_main.vcxproj", "{E4EF614B-30DF-4954-8C53-580A0BF6B589}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Win32 = Debug|Win32 13 | Release|Win32 = Release|Win32 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Debug|Win32.Build.0 = Debug|Win32 18 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.ActiveCfg = Release|Win32 19 | {34681F0D-CE45-415D-B5F2-5C662DFE3BD5}.Release|Win32.Build.0 = Release|Win32 20 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.ActiveCfg = Debug|Win32 21 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Debug|Win32.Build.0 = Debug|Win32 22 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.ActiveCfg = Release|Win32 23 | {F10D22F8-AC7B-4213-8720-608E7D878CD2}.Release|Win32.Build.0 = Release|Win32 24 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.ActiveCfg = Debug|Win32 25 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Debug|Win32.Build.0 = Debug|Win32 26 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.ActiveCfg = Release|Win32 27 | {E4EF614B-30DF-4954-8C53-580A0BF6B589}.Release|Win32.Build.0 = Release|Win32 28 | EndGlobalSection 29 | GlobalSection(SolutionProperties) = preSolution 30 | HideSolutionNode = FALSE 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /tests/gmock/msvc/2010/gmock_config.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ../../gtest 5 | 6 | 7 | <_ProjectFileVersion>10.0.30319.1 8 | 9 | 10 | 11 | $(GTestDir)/include;%(AdditionalIncludeDirectories) 12 | 13 | 14 | 15 | 16 | $(GTestDir) 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tests/gmock/scripts/generator/README: -------------------------------------------------------------------------------- 1 | 2 | The Google Mock class generator is an application that is part of cppclean. 3 | For more information about cppclean, see the README.cppclean file or 4 | visit http://code.google.com/p/cppclean/ 5 | 6 | cppclean requires Python 2.3.5 or later. If you don't have Python installed 7 | on your system, you will also need to install it. You can download Python 8 | from: http://www.python.org/download/releases/ 9 | 10 | To use the Google Mock class generator, you need to call it 11 | on the command line passing the header file and class for which you want 12 | to generate a Google Mock class. 13 | 14 | Make sure to install the scripts somewhere in your path. Then you can 15 | run the program. 16 | 17 | gmock_gen.py header-file.h [ClassName]... 18 | 19 | If no ClassNames are specified, all classes in the file are emitted. 20 | 21 | To change the indentation from the default of 2, set INDENT in 22 | the environment. For example to use an indent of 4 spaces: 23 | 24 | INDENT=4 gmock_gen.py header-file.h ClassName 25 | 26 | This version was made from SVN revision 281 in the cppclean repository. 27 | 28 | Known Limitations 29 | ----------------- 30 | Not all code will be generated properly. For example, when mocking templated 31 | classes, the template information is lost. You will need to add the template 32 | information manually. 33 | 34 | Not all permutations of using multiple pointers/references will be rendered 35 | properly. These will also have to be fixed manually. 36 | -------------------------------------------------------------------------------- /tests/gmock/scripts/generator/cpp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FreeOpcUa/freeopcua/6eac0975636425d2e122b228ca69fea2d30c9ce6/tests/gmock/scripts/generator/cpp/__init__.py -------------------------------------------------------------------------------- /tests/gmock/scripts/generator/cpp/utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Neal Norwitz 4 | # Portions Copyright 2007 Google Inc. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """Generic utilities for C++ parsing.""" 19 | 20 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 21 | 22 | 23 | import sys 24 | 25 | 26 | # Set to True to see the start/end token indices. 27 | DEBUG = True 28 | 29 | 30 | def ReadFile(filename, print_error=True): 31 | """Returns the contents of a file.""" 32 | try: 33 | fp = open(filename) 34 | try: 35 | return fp.read() 36 | finally: 37 | fp.close() 38 | except IOError: 39 | if print_error: 40 | print(('Error reading %s: %s' % (filename, sys.exc_info()[1]))) 41 | return None 42 | -------------------------------------------------------------------------------- /tests/gmock/scripts/generator/gmock_gen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2008 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | """Driver for starting up Google Mock class generator.""" 18 | 19 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 20 | 21 | import os 22 | import sys 23 | 24 | if __name__ == '__main__': 25 | # Add the directory of this script to the path so we can import gmock_class. 26 | sys.path.append(os.path.dirname(__file__)) 27 | 28 | from cpp import gmock_class 29 | # Fix the docstring in case they require the usage. 30 | gmock_class.__doc__ = gmock_class.__doc__.replace('gmock_class.py', __file__) 31 | gmock_class.main() 32 | -------------------------------------------------------------------------------- /tests/gtest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /tests/gtest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /tests/gtest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | 32 | #include "gtest/gtest.h" 33 | 34 | GTEST_API_ int main(int argc, char **argv) { 35 | printf("Running main() from gtest_main.cc\n"); 36 | testing::InitGoogleTest(&argc, argv); 37 | return RUN_ALL_TESTS(); 38 | } 39 | -------------------------------------------------------------------------------- /tests/gtest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: wan@google.com (Zhanyong Wan) 31 | // 32 | // This is part of the unit test for include/gtest/gtest_prod.h. 33 | 34 | #include "production.h" 35 | 36 | PrivateCode::PrivateCode() : x_(0) {} 37 | -------------------------------------------------------------------------------- /tests/gtest/xcode/Config/DebugProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // DebugProject.xcconfig 3 | // 4 | // These are Debug Configuration project settings for the gtest framework and 5 | // examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // No optimization 14 | GCC_OPTIMIZATION_LEVEL = 0 15 | 16 | // Deployment postprocessing is what triggers Xcode to strip, turn it off 17 | DEPLOYMENT_POSTPROCESSING = NO 18 | 19 | // Dead code stripping off 20 | DEAD_CODE_STRIPPING = NO 21 | 22 | // Debug symbols should be on obviously 23 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES 24 | 25 | // Define the DEBUG macro in all debug builds 26 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DDEBUG=1 27 | 28 | // These are turned off to avoid STL incompatibilities with client code 29 | // // Turns on special C++ STL checks to "encourage" good STL use 30 | // GCC_PREPROCESSOR_DEFINITIONS = $(GCC_PREPROCESSOR_DEFINITIONS) _GLIBCXX_DEBUG_PEDANTIC _GLIBCXX_DEBUG _GLIBCPP_CONCEPT_CHECKS 31 | -------------------------------------------------------------------------------- /tests/gtest/xcode/Config/FrameworkTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // FrameworkTarget.xcconfig 3 | // 4 | // These are Framework target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Dynamic libs need to be position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Dynamic libs should not have their external symbols stripped. 14 | STRIP_STYLE = non-global 15 | 16 | // Let the user install by specifying the $DSTROOT with xcodebuild 17 | SKIP_INSTALL = NO 18 | -------------------------------------------------------------------------------- /tests/gtest/xcode/Config/General.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // General.xcconfig 3 | // 4 | // These are General configuration settings for the gtest framework and 5 | // examples. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Build for PPC and Intel, 32- and 64-bit 11 | ARCHS = i386 x86_64 ppc ppc64 12 | 13 | // Zerolink prevents link warnings so turn it off 14 | ZERO_LINK = NO 15 | 16 | // Prebinding considered unhelpful in 10.3 and later 17 | PREBINDING = NO 18 | 19 | // Strictest warning policy 20 | WARNING_CFLAGS = -Wall -Werror -Wendif-labels -Wnewline-eof -Wno-sign-compare -Wshadow 21 | 22 | // Work around Xcode bugs by using external strip. See: 23 | // http://lists.apple.com/archives/Xcode-users/2006/Feb/msg00050.html 24 | SEPARATE_STRIP = YES 25 | 26 | // Force C99 dialect 27 | GCC_C_LANGUAGE_STANDARD = c99 28 | 29 | // not sure why apple defaults this on, but it's pretty risky 30 | ALWAYS_SEARCH_USER_PATHS = NO 31 | 32 | // Turn on position dependent code for most cases (overridden where appropriate) 33 | GCC_DYNAMIC_NO_PIC = YES 34 | 35 | // Default SDK and minimum OS version is 10.4 36 | SDKROOT = $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk 37 | MACOSX_DEPLOYMENT_TARGET = 10.4 38 | GCC_VERSION = 4.0 39 | 40 | // VERSIONING BUILD SETTINGS (used in Info.plist) 41 | GTEST_VERSIONINFO_ABOUT = © 2008 Google Inc. 42 | -------------------------------------------------------------------------------- /tests/gtest/xcode/Config/ReleaseProject.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // ReleaseProject.xcconfig 3 | // 4 | // These are Release Configuration project settings for the gtest framework 5 | // and examples. It is set in the "Based On:" dropdown in the "Project" info 6 | // dialog. 7 | // This file is based on the Xcode Configuration files in: 8 | // http://code.google.com/p/google-toolbox-for-mac/ 9 | // 10 | 11 | #include "General.xcconfig" 12 | 13 | // subconfig/Release.xcconfig 14 | 15 | // Optimize for space and size (Apple recommendation) 16 | GCC_OPTIMIZATION_LEVEL = s 17 | 18 | // Deploment postprocessing is what triggers Xcode to strip 19 | DEPLOYMENT_POSTPROCESSING = YES 20 | 21 | // No symbols 22 | GCC_GENERATE_DEBUGGING_SYMBOLS = NO 23 | 24 | // Dead code strip does not affect ObjC code but can help for C 25 | DEAD_CODE_STRIPPING = YES 26 | 27 | // NDEBUG is used by things like assert.h, so define it for general compat. 28 | // ASSERT going away in release tends to create unused vars. 29 | OTHER_CFLAGS = $(OTHER_CFLAGS) -DNDEBUG=1 -Wno-unused-variable 30 | 31 | // When we strip we want to strip all symbols in release, but save externals. 32 | STRIP_STYLE = all 33 | -------------------------------------------------------------------------------- /tests/gtest/xcode/Config/StaticLibraryTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // StaticLibraryTarget.xcconfig 3 | // 4 | // These are static library target settings for libgtest.a. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | // This file is based on the Xcode Configuration files in: 7 | // http://code.google.com/p/google-toolbox-for-mac/ 8 | // 9 | 10 | // Static libs can be included in bundles so make them position independent 11 | GCC_DYNAMIC_NO_PIC = NO 12 | 13 | // Static libs should not have their internal globals or external symbols 14 | // stripped. 15 | STRIP_STYLE = debugging 16 | 17 | // Let the user install by specifying the $DSTROOT with xcodebuild 18 | SKIP_INSTALL = NO 19 | -------------------------------------------------------------------------------- /tests/gtest/xcode/Config/TestTarget.xcconfig: -------------------------------------------------------------------------------- 1 | // 2 | // TestTarget.xcconfig 3 | // 4 | // These are Test target settings for the gtest framework and examples. It 5 | // is set in the "Based On:" dropdown in the "Target" info dialog. 6 | 7 | PRODUCT_NAME = $(TARGET_NAME) 8 | HEADER_SEARCH_PATHS = ../include 9 | -------------------------------------------------------------------------------- /tests/gtest/xcode/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.${PRODUCT_NAME} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | GTEST_VERSIONINFO_LONG 21 | CFBundleShortVersionString 22 | GTEST_VERSIONINFO_SHORT 23 | CFBundleGetInfoString 24 | ${PRODUCT_NAME} GTEST_VERSIONINFO_LONG, ${GTEST_VERSIONINFO_ABOUT} 25 | NSHumanReadableCopyright 26 | ${GTEST_VERSIONINFO_ABOUT} 27 | CSResourcesFileMapped 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tests/gtest/xcode/Samples/FrameworkSample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.google.gtest.${PRODUCT_NAME:identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | CSResourcesFileMapped 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/protocol/message_id.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Test of opc ua binary handshake. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "common.h" 12 | 13 | using namespace testing; 14 | using namespace OpcUa; 15 | 16 | TEST(MessageIdFromNodeId, CanBeConvertedFromValidNodeId) 17 | { 18 | NodeId id(OPEN_SECURE_CHANNEL_REQUEST); 19 | ASSERT_EQ(GetMessageId(id), OPEN_SECURE_CHANNEL_REQUEST); 20 | } 21 | 22 | 23 | -------------------------------------------------------------------------------- /tests/protocol/reference_id.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2012 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Test of opc ua binary handshake. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "common.h" 12 | 13 | using namespace testing; 14 | using namespace OpcUa; 15 | 16 | TEST(ReferenceIdFromNodeId, CanBeConvertedFromValidNodeId) 17 | { 18 | NodeId id(ReferenceId::HasChild); 19 | ASSERT_EQ(id.Encoding, EV_NUMERIC); 20 | ASSERT_EQ(id.NumericData.NamespaceIndex, 0); 21 | ASSERT_EQ(static_cast(id.NumericData.Identifier), ReferenceId::HasChild); 22 | } 23 | 24 | -------------------------------------------------------------------------------- /tests/server/address_space_registry_test.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace OpcUa 20 | { 21 | namespace Test 22 | { 23 | 24 | inline void RegisterAddressSpace(Common::AddonsManager & addons) 25 | { 26 | Common::AddonInformation config = Server::CreateAddressSpaceAddon(); 27 | addons.Register(config); 28 | } 29 | 30 | } 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/server/base_node.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 84 11 | object 12 | Root 13 | Root 14 | Root 15 | 10 16 | 0 17 | false 18 | false 19 | inverse_name 20 | false 21 | notifier 22 | 23 | uint32 24 | 25 | 55 26 | 0 27 | 0 28 | 0 29 | 0 30 | 100 31 | true 32 | false 33 | false 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tests/server/builtin_server.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Addon for accessing opcua server inside process. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | 15 | namespace OpcUa 16 | { 17 | namespace Server 18 | { 19 | 20 | class BuiltinServer : public Common::Interface 21 | { 22 | public: 23 | DEFINE_CLASS_POINTERS(BuiltingServerFactory); 24 | 25 | public: 26 | virtual OpcUa::Services::SharedPtr GetServices() const = 0; 27 | }; 28 | 29 | 30 | } // namespace UaServer 31 | } // namespace OpcUa 32 | -------------------------------------------------------------------------------- /tests/server/builtin_server_addon.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Addon for accessing opcua server inside process. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #pragma once 12 | 13 | #include 14 | #include 15 | 16 | namespace OpcUa 17 | { 18 | namespace Server 19 | { 20 | 21 | const char BuiltinServerAddonId[] = "builtin_server_addon"; 22 | 23 | class BuiltingServerFactory : public Common::AddonFactory 24 | { 25 | public: 26 | DEFINE_CLASS_POINTERS(BuiltingServerFactory); 27 | 28 | public: 29 | virtual Common::Addon::UniquePtr CreateAddon(); 30 | }; 31 | 32 | 33 | } // namespace UaServer 34 | } // namespace OpcUa 35 | -------------------------------------------------------------------------------- /tests/server/builtin_server_factory.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Test addon wich emulate tcp server addon. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | #include "builtin_server_addon.h" 12 | #include "builtin_server_impl.h" 13 | 14 | Common::Addon::UniquePtr OpcUa::Server::BuiltingServerFactory::CreateAddon() 15 | { 16 | return Common::Addon::UniquePtr(new OpcUa::Impl::BuiltinServerAddon); 17 | } 18 | -------------------------------------------------------------------------------- /tests/server/common.cpp: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief Common test utls. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #include "common.h" 13 | 14 | #include 15 | #include 16 | #include 17 | /* 18 | std::unique_ptr OpcUa::Tests::LoadAddons(const std::string& configPath) 19 | { 20 | std::string config = "--config="; 21 | config += configPath; 22 | 23 | const char* argv[2]; 24 | argv[0] = "test.exe"; 25 | argv[1] = const_cast(config.c_str()); 26 | OpcUa::Server::CommandLine cmdline(2, argv); 27 | Common::ModulesConfiguration modules = cmdline.GetModules(); 28 | Common::AddonsManager::UniquePtr addons = Common::CreateAddonsManager(); 29 | for (auto module : modules) 30 | { 31 | Common::AddonInformation config; 32 | config.Id = module.Id; 33 | config.Factory = Common::CreateDynamicAddonFactory(module.Path.c_str()); 34 | config.Dependencies = module.DependsOn; 35 | config.Parameters = module.Parameters; 36 | addons->Register(config); 37 | } 38 | addons->Start(); 39 | return addons; 40 | } 41 | 42 | */ 43 | -------------------------------------------------------------------------------- /tests/server/configs/test_addon.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | TestAddonID 7 | test_addon.so 8 | 9 | world 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/server/empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tests/server/endpoints_services_test.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | namespace OpcUa 19 | { 20 | namespace Test 21 | { 22 | 23 | inline void RegisterEndpointsServicesAddon(Common::AddonsManager & addons) 24 | { 25 | Common::AddonInformation endpoints = Server::CreateEndpointsRegistryAddon(); 26 | addons.Register(endpoints); 27 | } 28 | 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /tests/server/invalid_root.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tests/server/invalid_version.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/server/no_version.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /tests/server/services_registry_test.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | 18 | namespace OpcUa 19 | { 20 | namespace Test 21 | { 22 | 23 | inline void RegisterServicesRegistry(Common::AddonsManager & addons) 24 | { 25 | Common::AddonInformation services = Server::CreateServicesRegistryAddon(); 26 | addons.Register(services); 27 | } 28 | 29 | } 30 | } 31 | 32 | 33 | -------------------------------------------------------------------------------- /tests/server/standard_namespace_test.h: -------------------------------------------------------------------------------- 1 | /// @author Alexander Rykovanov 2013 2 | /// @email rykovanov.as@gmail.com 3 | /// @brief OPC UA Address space part. 4 | /// @license GNU LGPL 5 | /// 6 | /// Distributed under the GNU LGPL License 7 | /// (See accompanying file LICENSE or copy at 8 | /// http://www.gnu.org/licenses/lgpl.html) 9 | /// 10 | 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | namespace OpcUa 18 | { 19 | namespace Test 20 | { 21 | 22 | inline void RegisterStandardNamespace(Common::AddonsManager & addons) 23 | { 24 | Common::AddonInformation config = Server::CreateStandardNamespaceAddon(); 25 | addons.Register(config); 26 | } 27 | 28 | } 29 | } 30 | --------------------------------------------------------------------------------