├── .gitignore ├── CMakeLists.txt ├── LICENSE.txt ├── README.md ├── TODO.md ├── cmake ├── CMakeLists.txt ├── CppProcessConfig.cmake ├── EventDispatcherConfig.cmake ├── EventDispatcherQtConfig.cmake ├── ReporterConfig.cmake ├── SnapLoggerNetworkConfig.cmake └── VerifyMessageDefinitionsConfig.cmake ├── conf ├── README.md ├── ed-signal.conf ├── logger │ └── snaploggerd.conf ├── rprtr.vim ├── snaplog.conf └── snaploggerd.conf ├── cppprocess ├── CMakeLists.txt ├── README.md ├── cppprocess │ ├── CMakeLists.txt │ ├── buffer.h │ ├── exception.cpp │ ├── exception.h │ ├── io.cpp │ ├── io.h │ ├── io_capture_pipe.cpp │ ├── io_capture_pipe.h │ ├── io_data_pipe.cpp │ ├── io_data_pipe.h │ ├── io_error_file.cpp │ ├── io_error_file.h │ ├── io_file.cpp │ ├── io_file.h │ ├── io_input_file.cpp │ ├── io_input_file.h │ ├── io_output_file.cpp │ ├── io_output_file.h │ ├── io_pipe.cpp │ ├── io_pipe.h │ ├── process.cpp │ ├── process.h │ ├── process_info.cpp │ ├── process_info.h │ ├── process_list.cpp │ ├── process_list.h │ ├── version.cpp │ └── version.h.in └── doc │ ├── CMakeLists.txt │ ├── cppprocess.doxy.in │ ├── cppprocess.png │ ├── eventdispatcher.svg │ └── footer.html ├── debian ├── changelog ├── compat ├── control ├── copyright ├── cppprocess-dev.install ├── cppprocess-doc.install ├── cppprocess.docs ├── cppprocess.install ├── eventdispatcher-dev.install ├── eventdispatcher-doc.install ├── eventdispatcher-qt-dev.install ├── eventdispatcher-qt.docs ├── eventdispatcher-qt.install ├── eventdispatcher.docs ├── eventdispatcher.install ├── reporter.install ├── rules ├── snaplogger-network-dev.install ├── snaplogger-network-doc.install ├── snaplogger-network.docs ├── snaplogger-network.install ├── snaplogger-utils.docs ├── snaplogger-utils.install ├── snaploggerd.docs ├── snaploggerd.install ├── snaploggerd.service └── source │ └── options ├── doc ├── CMakeLists.txt ├── ed-stop.1 ├── eventdispatcher.doxy.in ├── eventdispatcher.png ├── eventdispatcher.svg └── footer.html ├── eventdispatcher ├── CMakeLists.txt ├── broadcast_message.h ├── certificate.cpp ├── certificate.h ├── communicator.cpp ├── communicator.h ├── connection.cpp ├── connection.h ├── connection_t.cpp ├── connection_t.h ├── connection_with_send_message.cpp ├── connection_with_send_message.h ├── cui_connection.cpp ├── cui_connection.h ├── dispatcher.cpp ├── dispatcher.h ├── dispatcher_match.cpp ├── dispatcher_match.h ├── dispatcher_support.cpp ├── dispatcher_support.h ├── exception.h ├── fd_buffer_connection.cpp ├── fd_buffer_connection.h ├── fd_connection.cpp ├── fd_connection.h ├── file_changed.cpp ├── file_changed.h ├── inter_thread_message_connection.cpp ├── inter_thread_message_connection.h ├── local_dgram_base.cpp ├── local_dgram_base.h ├── local_dgram_client.cpp ├── local_dgram_client.h ├── local_dgram_server.cpp ├── local_dgram_server.h ├── local_dgram_server_connection.cpp ├── local_dgram_server_connection.h ├── local_dgram_server_message_connection.cpp ├── local_dgram_server_message_connection.h ├── local_stream_blocking_client_message_connection.cpp ├── local_stream_blocking_client_message_connection.h ├── local_stream_client_buffer_connection.cpp ├── local_stream_client_buffer_connection.h ├── local_stream_client_connection.cpp ├── local_stream_client_connection.h ├── local_stream_client_message_connection.cpp ├── local_stream_client_message_connection.h ├── local_stream_client_permanent_message_connection.cpp ├── local_stream_client_permanent_message_connection.h ├── local_stream_server_client_buffer_connection.cpp ├── local_stream_server_client_buffer_connection.h ├── local_stream_server_client_connection.cpp ├── local_stream_server_client_connection.h ├── local_stream_server_client_message_connection.cpp ├── local_stream_server_client_message_connection.h ├── local_stream_server_connection.cpp ├── local_stream_server_connection.h ├── logrotate_udp_messenger.cpp ├── logrotate_udp_messenger.h ├── message-definitions │ ├── ABSOLUTELY.conf │ ├── ALIVE.conf │ ├── CMakeLists.txt │ ├── COMMANDS.conf │ ├── HELP.conf │ ├── INVALID.conf │ ├── LEAK.conf │ ├── LOG_ROTATE.conf │ ├── QUITTING.conf │ ├── READY.conf │ ├── RESTART.conf │ ├── SERVICE_UNAVAILABLE.conf │ ├── STOP.conf │ └── UNKNOWN.conf ├── message.cpp ├── message.h ├── message_definition.cpp ├── message_definition.h ├── names.an ├── pipe_buffer_connection.cpp ├── pipe_buffer_connection.h ├── pipe_connection.cpp ├── pipe_connection.h ├── pipe_message_connection.cpp ├── pipe_message_connection.h ├── process_changed.cpp ├── process_changed.h ├── reporter │ ├── CMakeLists.txt │ ├── README.md │ ├── basic_instructions.cpp │ ├── direct_tcp_server.cpp │ ├── direct_tcp_server.h │ ├── direct_tcp_server_client.cpp │ ├── direct_tcp_server_client.h │ ├── executor.cpp │ ├── executor.h │ ├── expression.cpp │ ├── expression.h │ ├── instruction.cpp │ ├── instruction.h │ ├── instruction_factory.cpp │ ├── instruction_factory.h │ ├── lexer.cpp │ ├── lexer.h │ ├── messenger_tcp_server.cpp │ ├── messenger_tcp_server.h │ ├── messenger_tcp_server_client.cpp │ ├── messenger_tcp_server_client.h │ ├── parser.cpp │ ├── parser.h │ ├── state.cpp │ ├── state.h │ ├── statement.cpp │ ├── statement.h │ ├── token.cpp │ ├── token.h │ ├── variable.cpp │ ├── variable.h │ ├── variable_address.cpp │ ├── variable_address.h │ ├── variable_array.cpp │ ├── variable_array.h │ ├── variable_floating_point.cpp │ ├── variable_floating_point.h │ ├── variable_integer.cpp │ ├── variable_integer.h │ ├── variable_list.cpp │ ├── variable_list.h │ ├── variable_regex.cpp │ ├── variable_regex.h │ ├── variable_string.cpp │ ├── variable_string.h │ ├── variable_timestamp.cpp │ ├── variable_timestamp.h │ ├── variable_void.cpp │ └── variable_void.h ├── signal.cpp ├── signal.h ├── signal_child.cpp ├── signal_child.h ├── signal_handler.cpp ├── signal_handler.h ├── signal_profiler.cpp ├── signal_profiler.h ├── socket_events.cpp ├── socket_events.h ├── tcp_base.cpp ├── tcp_base.h ├── tcp_bio_client.cpp ├── tcp_bio_client.h ├── tcp_bio_options.cpp ├── tcp_bio_options.h ├── tcp_bio_server.cpp ├── tcp_bio_server.h ├── tcp_blocking_client_message_connection.cpp ├── tcp_blocking_client_message_connection.h ├── tcp_client.cpp ├── tcp_client.h ├── tcp_client_buffer_connection.cpp ├── tcp_client_buffer_connection.h ├── tcp_client_connection.cpp ├── tcp_client_connection.h ├── tcp_client_message_connection.cpp ├── tcp_client_message_connection.h ├── tcp_client_permanent_message_connection.cpp ├── tcp_client_permanent_message_connection.h ├── tcp_private.cpp ├── tcp_private.h ├── tcp_server.cpp ├── tcp_server.h ├── tcp_server_client_buffer_connection.cpp ├── tcp_server_client_buffer_connection.h ├── tcp_server_client_connection.cpp ├── tcp_server_client_connection.h ├── tcp_server_client_message_connection.cpp ├── tcp_server_client_message_connection.h ├── tcp_server_connection.cpp ├── tcp_server_connection.h ├── thread_done_signal.cpp ├── thread_done_signal.h ├── timer.cpp ├── timer.h ├── udp_base.cpp ├── udp_base.h ├── udp_client.cpp ├── udp_client.h ├── udp_server.cpp ├── udp_server.h ├── udp_server_connection.cpp ├── udp_server_connection.h ├── udp_server_message_connection.cpp ├── udp_server_message_connection.h ├── utils.cpp ├── utils.h ├── version.cpp └── version.h.in ├── eventdispatcher_qt ├── CMakeLists.txt ├── qt_connection.cpp └── qt_connection.h ├── examples ├── CMakeLists.txt ├── README.md ├── client.cpp └── server.cpp ├── mk ├── scripts ├── CMakeLists.txt └── manage-tls-keys ├── snaplogger ├── CMakeLists.txt ├── README.md ├── daemon │ ├── CMakeLists.txt │ ├── controller_connection.cpp │ ├── controller_connection.h │ ├── main.cpp │ ├── network_component.cpp │ ├── network_component.h │ ├── snaploggerd.cpp │ ├── snaploggerd.h │ ├── tcp_logger_connection.cpp │ ├── tcp_logger_connection.h │ ├── tcp_logger_server.cpp │ ├── tcp_logger_server.h │ ├── udp_logger_server.cpp │ ├── udp_logger_server.h │ ├── utils.cpp │ ├── utils.h │ ├── version.cpp │ └── version.h.in ├── doc │ ├── CMakeLists.txt │ ├── footer.html │ ├── snaplogger-network.doxy.in │ ├── snaplogger-network.png │ └── snaplogger-network.svg ├── network │ ├── CMakeLists.txt │ ├── alert_appender.cpp │ ├── alert_appender.h │ ├── base_network_appender.cpp │ ├── base_network_appender.h │ ├── message-definitions │ │ ├── CMakeLists.txt │ │ └── LOG.conf │ ├── snaplogger_network.cpp │ ├── snaplogger_network.h │ ├── tcp_appender.cpp │ ├── tcp_appender.h │ ├── udp_appender.cpp │ ├── udp_appender.h │ ├── version.cpp │ └── version.h.in └── tools │ ├── CMakeLists.txt │ └── snaplog.cpp ├── tests ├── CMakeLists.txt ├── catch_certificate.cpp ├── catch_dispatcher.cpp ├── catch_file_changed.cpp ├── catch_main.cpp ├── catch_main.h ├── catch_message.cpp ├── catch_process.cpp ├── catch_process_info.cpp ├── catch_reporter_executor.cpp ├── catch_reporter_expression.cpp ├── catch_reporter_instruction.cpp ├── catch_reporter_lexer.cpp ├── catch_reporter_parser.cpp ├── catch_reporter_statement.cpp ├── catch_reporter_token.cpp ├── catch_signal_handler.cpp ├── catch_timer.cpp ├── catch_unix_dgram.cpp ├── catch_unix_stream.cpp ├── catch_version.cpp ├── certificate │ ├── snakeoil.csr │ ├── snakeoil.key │ └── snakeoil.pem ├── check_dispatcher_without_command.cpp ├── check_signal_and_eint.cpp ├── message-definitions │ ├── DOWN.conf │ ├── HELLO.conf │ └── HI.conf ├── process_listener.cpp ├── rprtr │ ├── send_and_receive_complete_messages.rprtr │ └── test_load_with_create_lexer.rprtr ├── sanitizer-options.sh └── suppress-leaks.txt └── tools ├── CMakeLists.txt ├── ed_signal.cpp ├── ed_stop.cpp └── verify_message_definitions.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | tmp 2 | *.sw? 3 | seed.txt 4 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | cmake_minimum_required(VERSION 3.10.2) 20 | 21 | project(eventdispatcher_project) 22 | 23 | find_package(AdvGetOpt REQUIRED) 24 | find_package(AtomicNames REQUIRED) 25 | find_package(CppThread REQUIRED) 26 | find_package(LibAddr REQUIRED) 27 | find_package(LibExcept REQUIRED) 28 | find_package(LibUtf8 REQUIRED) 29 | find_package(OpenSSL REQUIRED) 30 | find_package(ServerPlugins REQUIRED) 31 | find_package(SnapCMakeModules REQUIRED) 32 | find_package(SnapDev REQUIRED) 33 | find_package(SnapLogger REQUIRED) 34 | 35 | SnapGetVersion(EVENTDISPATCHER ${CMAKE_CURRENT_SOURCE_DIR}) 36 | 37 | include_directories( 38 | ${PROJECT_SOURCE_DIR} 39 | ${CMAKE_CURRENT_BINARY_DIR} 40 | ) 41 | 42 | add_subdirectory(eventdispatcher ) 43 | add_subdirectory(eventdispatcher_qt) 44 | add_subdirectory(doc ) 45 | add_subdirectory(cmake ) 46 | add_subdirectory(scripts ) 47 | add_subdirectory(tools ) 48 | add_subdirectory(examples ) 49 | add_subdirectory(snaplogger ) # Extension to support a snaplogger server (remote logs) 50 | add_subdirectory(cppprocess ) # Extension to support a cppprocess implementation 51 | 52 | add_subdirectory(tests ) 53 | 54 | # vim: ts=4 sw=4 et 55 | -------------------------------------------------------------------------------- /cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | project(eventdispatcher_cmake) 20 | 21 | install( 22 | FILES 23 | EventDispatcherConfig.cmake 24 | 25 | DESTINATION 26 | share/cmake/EventDispatcher 27 | ) 28 | 29 | install( 30 | FILES 31 | EventDispatcherQtConfig.cmake 32 | 33 | DESTINATION 34 | share/cmake/EventDispatcherQt 35 | ) 36 | 37 | install( 38 | FILES 39 | ReporterConfig.cmake 40 | 41 | DESTINATION 42 | share/cmake/Reporter 43 | ) 44 | 45 | install( 46 | FILES 47 | CppProcessConfig.cmake 48 | 49 | DESTINATION 50 | share/cmake/CppProcess 51 | ) 52 | 53 | install( 54 | FILES 55 | SnapLoggerNetworkConfig.cmake 56 | 57 | DESTINATION 58 | share/cmake/SnapLoggerNetwork 59 | ) 60 | 61 | install( 62 | FILES 63 | VerifyMessageDefinitionsConfig.cmake 64 | 65 | DESTINATION 66 | share/cmake/VerifyMessageDefinitions 67 | ) 68 | 69 | # vim: ts=4 sw=4 et nocindent 70 | -------------------------------------------------------------------------------- /cmake/CppProcessConfig.cmake: -------------------------------------------------------------------------------- 1 | # - Find C++ Process 2 | # 3 | # CPPPROCESS_FOUND - System has cppprocess 4 | # CPPPROCESS_INCLUDE_DIRS - The cppprocess include directories 5 | # CPPPROCESS_LIBRARIES - The libraries needed to use cppprocess 6 | # CPPPROCESS_DEFINITIONS - Compiler switches required for using cppprocess 7 | # 8 | # License: 9 | # 10 | # Copyright (c) 2011-2025 Made to Order Software Corp. All Rights Reserved 11 | # 12 | # https://snapwebsites.org/project/eventdispatcher 13 | # contact@m2osw.com 14 | # 15 | # This program is free software: you can redistribute it and/or modify 16 | # it under the terms of the GNU General Public License as published by 17 | # the Free Software Foundation, either version 3 of the License, or 18 | # (at your option) any later version. 19 | # 20 | # This program is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # You should have received a copy of the GNU General Public License 26 | # along with this program. If not, see . 27 | 28 | find_path( 29 | CPPPROCESS_INCLUDE_DIR 30 | cppprocess/version.h 31 | 32 | PATHS 33 | ENV CPPPROCESS_INCLUDE_DIR 34 | ) 35 | 36 | find_library( 37 | CPPPROCESS_LIBRARY 38 | cppprocess 39 | 40 | PATHS 41 | ${CPPPROCESS_LIBRARY_DIR} 42 | ENV CPPPROCESS_LIBRARY 43 | ) 44 | 45 | mark_as_advanced( 46 | CPPPROCESS_INCLUDE_DIR 47 | CPPPROCESS_LIBRARY 48 | ) 49 | 50 | set(CPPPROCESS_INCLUDE_DIRS ${CPPPROCESS_INCLUDE_DIR}) 51 | set(CPPPROCESS_LIBRARIES ${CPPPROCESS_LIBRARY}) 52 | 53 | include(FindPackageHandleStandardArgs) 54 | find_package_handle_standard_args( 55 | CppProcess 56 | REQUIRED_VARS 57 | CPPPROCESS_INCLUDE_DIR 58 | CPPPROCESS_LIBRARY 59 | ) 60 | 61 | # vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /cmake/EventDispatcherConfig.cmake: -------------------------------------------------------------------------------- 1 | # - Find EventDispatcher 2 | # 3 | # EVENTDISPATCHER_FOUND - System has EventDispatcher 4 | # EVENTDISPATCHER_INCLUDE_DIRS - The EventDispatcher include directories 5 | # EVENTDISPATCHER_LIBRARIES - The libraries needed to use EventDispatcher 6 | # EVENTDISPATCHER_DEFINITIONS - Compiler switches required for using EventDispatcher 7 | # 8 | # License: 9 | # 10 | # Copyright (c) 2011-2025 Made to Order Software Corp. All Rights Reserved 11 | # 12 | # https://snapwebsites.org/project/eventdispatcher 13 | # contact@m2osw.com 14 | # 15 | # This program is free software: you can redistribute it and/or modify 16 | # it under the terms of the GNU General Public License as published by 17 | # the Free Software Foundation, either version 3 of the License, or 18 | # (at your option) any later version. 19 | # 20 | # This program is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # You should have received a copy of the GNU General Public License 26 | # along with this program. If not, see . 27 | 28 | find_path( 29 | EVENTDISPATCHER_INCLUDE_DIR 30 | eventdispatcher/version.h 31 | 32 | PATHS 33 | ENV EVENTDISPATCHER_INCLUDE_DIR 34 | ) 35 | 36 | find_library( 37 | EVENTDISPATCHER_LIBRARY 38 | eventdispatcher 39 | 40 | PATHS 41 | ${EVENTDISPATCHER_LIBRARY_DIR} 42 | ENV EVENTDISPATCHER_LIBRARY 43 | ) 44 | 45 | mark_as_advanced( 46 | EVENTDISPATCHER_INCLUDE_DIR 47 | EVENTDISPATCHER_LIBRARY 48 | ) 49 | 50 | set(EVENTDISPATCHER_INCLUDE_DIRS ${EVENTDISPATCHER_INCLUDE_DIR}) 51 | set(EVENTDISPATCHER_LIBRARIES ${EVENTDISPATCHER_LIBRARY}) 52 | 53 | include(FindPackageHandleStandardArgs) 54 | find_package_handle_standard_args( 55 | EventDispatcher 56 | REQUIRED_VARS 57 | EVENTDISPATCHER_INCLUDE_DIR 58 | EVENTDISPATCHER_LIBRARY 59 | ) 60 | 61 | set(EVENTDISPATCHER_SHARE_MESSAGE_DEFINITIONS_CONF_DIR share/eventdispatcher/messages) 62 | 63 | # vim: ts=4 sw=4 et 64 | -------------------------------------------------------------------------------- /cmake/EventDispatcherQtConfig.cmake: -------------------------------------------------------------------------------- 1 | # - Find EventDispatcherQt 2 | # 3 | # EVENTDISPATCHER_QT_FOUND - System has EventDispatcherQt 4 | # EVENTDISPATCHER_QT_INCLUDE_DIRS - The EventDispatcherQt include directories 5 | # EVENTDISPATCHER_QT_LIBRARIES - The libraries needed to use EventDispatcherQt 6 | # EVENTDISPATCHER_QT_DEFINITIONS - Compiler switches required for using EventDispatcherQt 7 | # 8 | # License: 9 | # 10 | # Copyright (c) 2011-2025 Made to Order Software Corp. All Rights Reserved 11 | # 12 | # https://snapwebsites.org/project/eventdispatcher 13 | # contact@m2osw.com 14 | # 15 | # This program is free software: you can redistribute it and/or modify 16 | # it under the terms of the GNU General Public License as published by 17 | # the Free Software Foundation, either version 3 of the License, or 18 | # (at your option) any later version. 19 | # 20 | # This program is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # You should have received a copy of the GNU General Public License 26 | # along with this program. If not, see . 27 | 28 | find_path( 29 | EVENTDISPATCHER_QT_INCLUDE_DIR 30 | eventdispatcher/qt_connection.h 31 | 32 | PATHS 33 | ENV EVENTDISPATCHER_QT_INCLUDE_DIR 34 | ENV EVENTDISPATCHER_INCLUDE_DIR 35 | ) 36 | 37 | find_library( 38 | EVENTDISPATCHER_QT_LIBRARY 39 | eventdispatcher_qt 40 | 41 | PATHS 42 | ${EVENTDISPATCHER_QT_LIBRARY_DIR} 43 | ${EVENTDISPATCHER_LIBRARY_DIR} 44 | ENV EVENTDISPATCHER_QT_LIBRARY 45 | ENV EVENTDISPATCHER_LIBRARY 46 | ) 47 | 48 | mark_as_advanced( 49 | EVENTDISPATCHER_QT_INCLUDE_DIR 50 | EVENTDISPATCHER_QT_LIBRARY 51 | ) 52 | 53 | set(EVENTDISPATCHER_QT_INCLUDE_DIRS ${EVENTDISPATCHER_QT_INCLUDE_DIR}) 54 | set(EVENTDISPATCHER_QT_LIBRARIES ${EVENTDISPATCHER_QT_LIBRARY}) 55 | 56 | include(FindPackageHandleStandardArgs) 57 | find_package_handle_standard_args( 58 | EventDispatcherQt 59 | REQUIRED_VARS 60 | EVENTDISPATCHER_QT_INCLUDE_DIR 61 | EVENTDISPATCHER_QT_LIBRARY 62 | ) 63 | 64 | # vim: ts=4 sw=4 et 65 | -------------------------------------------------------------------------------- /cmake/ReporterConfig.cmake: -------------------------------------------------------------------------------- 1 | # - Find Reporter 2 | # 3 | # REPORTER_FOUND - System has Reporter Catch2 extension library 4 | # REPORTER_INCLUDE_DIRS - The Reporter include directories 5 | # REPORTER_LIBRARIES - The libraries needed to use Reporter 6 | # REPORTER_DEFINITIONS - Compiler switches required for using Reporter 7 | # 8 | # License: 9 | # 10 | # Copyright (c) 2011-2025 Made to Order Software Corp. All Rights Reserved 11 | # 12 | # https://snapwebsites.org/project/eventdispatcher 13 | # contact@m2osw.com 14 | # 15 | # This program is free software: you can redistribute it and/or modify 16 | # it under the terms of the GNU General Public License as published by 17 | # the Free Software Foundation, either version 3 of the License, or 18 | # (at your option) any later version. 19 | # 20 | # This program is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # You should have received a copy of the GNU General Public License 26 | # along with this program. If not, see . 27 | 28 | find_path( 29 | REPORTER_INCLUDE_DIR 30 | eventdispatcher/reporter/executor.h 31 | 32 | PATHS 33 | ENV REPORTER_INCLUDE_DIR 34 | ) 35 | 36 | find_library( 37 | REPORTER_LIBRARY 38 | reporter 39 | 40 | PATHS 41 | ${REPORTER_LIBRARY_DIR} 42 | ENV REPORTER_LIBRARY 43 | ) 44 | 45 | mark_as_advanced( 46 | REPORTER_INCLUDE_DIR 47 | REPORTER_LIBRARY 48 | ) 49 | 50 | set(REPORTER_INCLUDE_DIRS ${REPORTER_INCLUDE_DIR}) 51 | set(REPORTER_LIBRARIES ${REPORTER_LIBRARY}) 52 | 53 | include(FindPackageHandleStandardArgs) 54 | find_package_handle_standard_args( 55 | Reporter 56 | REQUIRED_VARS 57 | REPORTER_INCLUDE_DIR 58 | REPORTER_LIBRARY 59 | ) 60 | 61 | # vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /cmake/SnapLoggerNetworkConfig.cmake: -------------------------------------------------------------------------------- 1 | # - Find Snap! Logger Network extension 2 | # 3 | # SNAPLOGGER_NETWORK_FOUND - System has the Snap! Logger Network extension 4 | # SNAPLOGGER_NETWORK_INCLUDE_DIRS - The Snap! Logger Network include directories 5 | # SNAPLOGGER_NETWORK_LIBRARIES - The libraries needed to use Snap! Logger Network 6 | # SNAPLOGGER_NETWORK_DEFINITIONS - Compiler switches required for using Snap! Logger Network 7 | # 8 | # License: 9 | # 10 | # Copyright (c) 2011-2025 Made to Order Software Corp. All Rights Reserved 11 | # 12 | # https://snapwebsites.org/project/eventdispatcher 13 | # contact@m2osw.com 14 | # 15 | # This program is free software: you can redistribute it and/or modify 16 | # it under the terms of the GNU General Public License as published by 17 | # the Free Software Foundation, either version 3 of the License, or 18 | # (at your option) any later version. 19 | # 20 | # This program is distributed in the hope that it will be useful, 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 | # GNU General Public License for more details. 24 | # 25 | # You should have received a copy of the GNU General Public License 26 | # along with this program. If not, see . 27 | 28 | find_path( 29 | SNAPLOGGER_NETWORK_INCLUDE_DIR 30 | snaplogger/network/version.h 31 | 32 | PATHS 33 | ENV SNAPLOGGER_NETWORK_INCLUDE_DIR 34 | ) 35 | 36 | find_library( 37 | SNAPLOGGER_NETWORK_LIBRARY 38 | snaplogger-network 39 | 40 | PATHS 41 | ${SNAPLOGGER_NETWORK_LIBRARY_DIR} 42 | ENV SNAPLOGGER_NETWORK_LIBRARY 43 | ) 44 | 45 | mark_as_advanced( 46 | SNAPLOGGER_NETWORK_INCLUDE_DIR 47 | SNAPLOGGER_NETWORK_LIBRARY 48 | ) 49 | 50 | set(SNAPLOGGER_NETWORK_INCLUDE_DIRS ${SNAPLOGGER_NETWORK_INCLUDE_DIR}) 51 | set(SNAPLOGGER_NETWORK_LIBRARIES ${SNAPLOGGER_NETWORK_LIBRARY}) 52 | 53 | include(FindPackageHandleStandardArgs) 54 | find_package_handle_standard_args( 55 | EventDispatcher 56 | REQUIRED_VARS 57 | SNAPLOGGER_NETWORK_INCLUDE_DIR 58 | SNAPLOGGER_NETWORK_LIBRARY 59 | ) 60 | 61 | # vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /conf/README.md: -------------------------------------------------------------------------------- 1 | 2 | To make modifications, it is preferable to add the changes to files under 3 | this folder. The name must be a two digit number (00 to 99) followed by 4 | a dash and the name of the configuration file. For example, the 5 | `ed-signal.conf` would be found here as: 6 | 7 | /etc/eventdispatcher/eventdispatcher.d/50-ed-signal.conf 8 | 9 | This allows for changes to the default .conf file to happen under the hood 10 | and your changes to remain in place at all time. 11 | 12 | **Note:** it is prefered that you use 50-... because other tools and 13 | libraries may add their own configuration files that they want applied 14 | before (<50) or after (>50) your own configuration. 15 | 16 | -------------------------------------------------------------------------------- /conf/logger/snaploggerd.conf: -------------------------------------------------------------------------------- 1 | # Snap! Logger Daemon 2 | # 3 | # Setup the Snap! Logger Daemon (the service, not the appenders) 4 | 5 | # acknowledge=none|severity|all 6 | # 7 | # Whether UDP message should be acknowledged or not. 8 | # 9 | # none -- never acknowledge 10 | # severity -- only acknowledge messages with that severity or higher 11 | # all -- always acknowledge 12 | # 13 | # For the `severity` option, see also the `acknowledge_severity` setting. 14 | # 15 | # Default: severity 16 | acknowledge=severity 17 | 18 | 19 | # acknowledge_severity= 20 | # 21 | # Severity level to acknowledge in your logs. 22 | # 23 | # By default we assume you're interested to always receive errors. The 24 | # messages with lower priority can be lost in the transfer process. On 25 | # high loads, it is not unlikely that you will miss messages. On regular 26 | # loads, you should receive all the messages without any issue. 27 | # 28 | # Default: error 29 | acknowledge_severity=error 30 | 31 | 32 | # TBD: 33 | # compression= 34 | # 35 | # Use compression before sending messages. 36 | # 37 | # none -- no compression 38 | # per-message -- compress messages directly (Probably not useful) 39 | # groups -- compress N messages and send that in one block 40 | # 41 | # Compression means latency since we'll buffer N messages and then 42 | # send them to the server. The client will save those messages on 43 | # disk locally so if it restarts or such, it can still send the 44 | # messages once it restarts. 45 | # 46 | # Default: none 47 | #compression=none 48 | 49 | -------------------------------------------------------------------------------- /cppprocess/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program; if not, write to the Free Software Foundation, Inc., 18 | # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | ## 21 | ## snaplogger daemon project 22 | ## 23 | project(cppprocess_project) 24 | 25 | include_directories( 26 | ${PROJECT_SOURCE_DIR} 27 | ${CMAKE_CURRENT_BINARY_DIR} 28 | ) 29 | 30 | add_subdirectory(cppprocess) 31 | add_subdirectory(doc) 32 | 33 | 34 | # vim: ts=4 sw=4 et 35 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/buffer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | // C++ 22 | // 23 | #include 24 | 25 | 26 | namespace cppprocess 27 | { 28 | 29 | 30 | typedef std::vector buffer_t; 31 | 32 | 33 | } // namespace cppprocess 34 | // vim: ts=4 sw=4 et 35 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/exception.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Exceptions for the process environment. 23 | * 24 | * This file includes the definitions of exceptions used by the C++ process 25 | * environment. 26 | */ 27 | 28 | // libexcept 29 | // 30 | #include 31 | 32 | 33 | namespace cppprocess 34 | { 35 | 36 | 37 | 38 | DECLARE_LOGIC_ERROR(cppprocess_logic_error); 39 | 40 | DECLARE_OUT_OF_RANGE(cppprocess_out_of_range); 41 | 42 | DECLARE_MAIN_EXCEPTION(cppprocess_exception); 43 | 44 | DECLARE_EXCEPTION(cppprocess_exception, cppprocess_incorrect_pipe_type); 45 | DECLARE_EXCEPTION(cppprocess_exception, cppprocess_recursive_call); 46 | DECLARE_EXCEPTION(cppprocess_exception, cppprocess_initialization_failed); 47 | DECLARE_EXCEPTION(cppprocess_exception, cppprocess_in_use); 48 | DECLARE_EXCEPTION(cppprocess_exception, cppprocess_invalid_parameters); 49 | DECLARE_EXCEPTION(cppprocess_exception, cppprocess_not_started); 50 | DECLARE_EXCEPTION(cppprocess_exception, cppprocess_directory_not_found); 51 | 52 | 53 | 54 | } // namespace cppprocess 55 | // vim: ts=4 sw=4 et 56 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/io_capture_pipe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | // self 22 | // 23 | #include 24 | #include 25 | 26 | 27 | 28 | namespace cppprocess 29 | { 30 | 31 | 32 | 33 | // pre-defined output pipe 34 | class io_capture_pipe 35 | : public io_pipe 36 | { 37 | public: 38 | typedef std::shared_ptr 39 | pointer_t; 40 | 41 | io_capture_pipe(); 42 | 43 | // pipe_connection implementation 44 | // 45 | virtual void process_read() override; 46 | 47 | std::string get_output(bool reset = false) const; 48 | std::string get_trimmed_output(bool inside = false, bool reset = false) const; 49 | buffer_t get_binary_output(bool reset = false) const; 50 | 51 | private: 52 | buffer_t f_output = buffer_t(); 53 | }; 54 | 55 | 56 | 57 | } // namespace cppprocess 58 | // vim: ts=4 sw=4 et 59 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/io_data_pipe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | // self 22 | // 23 | #include 24 | #include 25 | 26 | 27 | 28 | namespace cppprocess 29 | { 30 | 31 | 32 | 33 | class io_data_pipe 34 | : public io_pipe 35 | { 36 | public: 37 | typedef std::shared_ptr 38 | pointer_t; 39 | 40 | io_data_pipe(); 41 | 42 | void add_input(std::string const & input); 43 | void add_input(buffer_t const & input); 44 | std::string get_input(bool reset = false) const; 45 | buffer_t get_binary_input(bool reset = false) const; 46 | 47 | // pipe_connection implementation 48 | // 49 | virtual bool is_writer() const override; 50 | virtual void process_write() override; 51 | 52 | private: 53 | buffer_t f_input = buffer_t(); 54 | std::size_t f_pos = 0; 55 | }; 56 | 57 | 58 | 59 | } // namespace cppprocess 60 | // vim: ts=4 sw=4 et 61 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/io_error_file.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | namespace cppprocess 27 | { 28 | 29 | 30 | 31 | io_error_file::io_error_file(std::string const & filename) 32 | : io_output_file(filename) 33 | { 34 | } 35 | 36 | 37 | 38 | } // namespace cppprocess 39 | // vim: ts=4 sw=4 et 40 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/io_error_file.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | namespace cppprocess 27 | { 28 | 29 | 30 | 31 | class io_error_file 32 | : public io_output_file 33 | { 34 | public: 35 | typedef std::shared_ptr pointer_t; 36 | 37 | io_error_file(std::string const & filename); 38 | 39 | private: 40 | }; 41 | 42 | 43 | 44 | } // namespace cppprocess 45 | // vim: ts=4 sw=4 et 46 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/io_input_file.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | // last include 26 | // 27 | #include 28 | 29 | 30 | 31 | namespace cppprocess 32 | { 33 | 34 | 35 | 36 | io_input_file::io_input_file(std::string const & filename) 37 | : io_file(IO_FLAG_INPUT) 38 | { 39 | set_filename(filename); 40 | } 41 | 42 | 43 | 44 | } // namespace cppprocess 45 | // vim: ts=4 sw=4 et 46 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/io_input_file.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | // self 22 | // 23 | #include 24 | 25 | 26 | 27 | namespace cppprocess 28 | { 29 | 30 | 31 | 32 | class io_input_file 33 | : public io_file 34 | { 35 | public: 36 | typedef std::shared_ptr 37 | pointer_t; 38 | 39 | io_input_file(std::string const & filename); 40 | 41 | private: 42 | }; 43 | 44 | 45 | 46 | } // namespace cppprocess 47 | // vim: ts=4 sw=4 et 48 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/io_output_file.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | // last include 26 | // 27 | #include 28 | 29 | 30 | 31 | namespace cppprocess 32 | { 33 | 34 | 35 | 36 | io_output_file::io_output_file(std::string const & filename) 37 | : io_file(IO_FLAG_OUTPUT) 38 | { 39 | set_filename(filename); 40 | } 41 | 42 | 43 | 44 | } // namespace cppprocess 45 | // vim: ts=4 sw=4 et 46 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/io_output_file.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | // self 22 | // 23 | #include 24 | 25 | 26 | namespace cppprocess 27 | { 28 | 29 | 30 | 31 | class io_output_file 32 | : public io_file 33 | { 34 | public: 35 | typedef std::shared_ptr 36 | pointer_t; 37 | 38 | io_output_file(std::string const & filename); 39 | 40 | private: 41 | }; 42 | 43 | 44 | 45 | } // namespace cppprocess 46 | // vim: ts=4 sw=4 et 47 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/io_pipe.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | // self 22 | // 23 | #include 24 | 25 | 26 | // eventdispatcher 27 | // 28 | #include 29 | 30 | 31 | 32 | namespace cppprocess 33 | { 34 | 35 | 36 | 37 | // base pipe 38 | class io_pipe 39 | : public io 40 | , public ed::pipe_connection 41 | { 42 | public: 43 | io_pipe(io_flags_t flags); 44 | 45 | // pipe_connection implementation 46 | // 47 | virtual void process_error() override; 48 | virtual void process_invalid() override; 49 | virtual void process_hup() override; 50 | 51 | // io implementation 52 | // 53 | virtual int get_fd() override; 54 | virtual int get_other_fd() override; 55 | virtual void close_both() override; 56 | virtual void close_other() override; 57 | virtual void process_starting() override; 58 | virtual bool process_done(done_reason_t reason) override; 59 | 60 | static ed::pipe_t flags_to_pipe_mode(io_flags_t flags); 61 | 62 | private: 63 | }; 64 | 65 | 66 | 67 | } // namespace cppprocess 68 | // vim: ts=4 sw=4 et 69 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/process_list.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | // self 22 | // 23 | #include 24 | 25 | 26 | // C++ 27 | // 28 | #include 29 | 30 | 31 | 32 | namespace cppprocess 33 | { 34 | 35 | 36 | 37 | class process_list 38 | : public std::map 39 | { 40 | public: 41 | typedef std::shared_ptr pointer_t; 42 | 43 | process_list(); 44 | 45 | void refresh(); 46 | process_info::pointer_t find(pid_t pid); 47 | process_info::pointer_t find(std::string const & basename); 48 | }; 49 | 50 | 51 | bool is_running(pid_t pid, int sig = 0, unsigned int timeout = 0); 52 | 53 | 54 | } // namespace cppprocess 55 | // vim: ts=4 sw=4 et 56 | -------------------------------------------------------------------------------- /cppprocess/cppprocess/version.h.in: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/cppprocess 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Definitions of the cppprocess version. 23 | * 24 | * This header includes the cppprocess library version and functions you 25 | * can use to check the current version of the library. 26 | */ 27 | 28 | 29 | #define CPPPROCESS_VERSION_MAJOR @EVENTDISPATCHER_VERSION_MAJOR@ 30 | #define CPPPROCESS_VERSION_MINOR @EVENTDISPATCHER_VERSION_MINOR@ 31 | #define CPPPROCESS_VERSION_PATCH @EVENTDISPATCHER_VERSION_PATCH@ 32 | #define CPPPROCESS_VERSION_STRING "@EVENTDISPATCHER_VERSION_MAJOR@.@EVENTDISPATCHER_VERSION_MINOR@.@EVENTDISPATCHER_VERSION_PATCH@" 33 | 34 | namespace cppprocess 35 | { 36 | 37 | 38 | int get_major_version(); 39 | int get_release_version(); 40 | int get_patch_version(); 41 | char const * get_version_string(); 42 | 43 | 44 | 45 | } // namespace cppprocess 46 | // vim: ts=4 sw=4 et 47 | -------------------------------------------------------------------------------- /cppprocess/doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | 21 | ## 22 | ## Documentation 23 | ## 24 | find_package(SnapDoxygen) 25 | AddDoxygenTarget(cppprocess 26 | ${EVENTDISPATCHER_VERSION_MAJOR} 27 | ${EVENTDISPATCHER_VERSION_MINOR} 28 | ${EVENTDISPATCHER_VERSION_PATCH} 29 | ) 30 | 31 | # vim: ts=4 sw=4 et 32 | -------------------------------------------------------------------------------- /cppprocess/doc/cppprocess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m2osw/eventdispatcher/6e4e850646e3c171af5685799d8d6e2bf40ce4a4/cppprocess/doc/cppprocess.png -------------------------------------------------------------------------------- /cppprocess/doc/footer.html: -------------------------------------------------------------------------------- 1 |
2 |

This document is part of the Snap! Websites Project.

3 |

Copyright by Made to Order Software Corp.

4 |
5 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 15 2 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Upstream-Name: eventdispatcher 3 | Source: https://github.com/m2osw/eventdispatcher 4 | 5 | Files: * 6 | Copyright: 2012-2025 Made to Order Software Corp. 7 | 2012-2025 Alexis Wilke 8 | 2012-2025 R. Douglas Barbieri 9 | License: GPL-2+ 10 | This package is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation; either version 2 of the License, or 13 | (at your option) any later version. 14 | . 15 | This package is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | . 20 | You should have received a copy of the GNU General Public License 21 | along with this program. If not, see 22 | . 23 | On Debian systems, the complete text of the GNU General 24 | Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". 25 | 26 | # Please also look if there are files or directories which have a 27 | # different copyright/license attached and list them here. 28 | # Please avoid picking license terms that are more restrictive than the 29 | # packaged work, as it may make Debian's contributions unacceptable upstream. 30 | -------------------------------------------------------------------------------- /debian/cppprocess-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/cppprocess/*.h 2 | usr/lib/libcppprocess.so 3 | usr/share/cmake/CppProcess/* 4 | -------------------------------------------------------------------------------- /debian/cppprocess-doc.install: -------------------------------------------------------------------------------- 1 | usr/share/doc/cppprocess/html/* usr/share/doc/cppprocess-doc/html/ 2 | -------------------------------------------------------------------------------- /debian/cppprocess.docs: -------------------------------------------------------------------------------- 1 | LICENSE.txt 2 | cppprocess/README.md 3 | TODO.md 4 | -------------------------------------------------------------------------------- /debian/cppprocess.install: -------------------------------------------------------------------------------- 1 | usr/lib/libcppprocess.so.* 2 | 3 | # uses the cppprocess library so it has to be here 4 | usr/bin/ed-stop 5 | -------------------------------------------------------------------------------- /debian/eventdispatcher-doc.install: -------------------------------------------------------------------------------- 1 | usr/share/doc/eventdispatcher/html/* usr/share/doc/eventdispatcher-doc/html/ 2 | -------------------------------------------------------------------------------- /debian/eventdispatcher-qt-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/eventdispatcher/qt_connection.h 2 | usr/lib/libeventdispatcher_qt.so 3 | usr/share/cmake/EventDispatcherQt/* 4 | -------------------------------------------------------------------------------- /debian/eventdispatcher-qt.docs: -------------------------------------------------------------------------------- 1 | LICENSE.txt 2 | README.md 3 | TODO.md 4 | -------------------------------------------------------------------------------- /debian/eventdispatcher-qt.install: -------------------------------------------------------------------------------- 1 | usr/lib/libeventdispatcher_qt.so.* 2 | -------------------------------------------------------------------------------- /debian/eventdispatcher.docs: -------------------------------------------------------------------------------- 1 | LICENSE.txt 2 | README.md 3 | TODO.md 4 | -------------------------------------------------------------------------------- /debian/eventdispatcher.install: -------------------------------------------------------------------------------- 1 | usr/lib/libeventdispatcher.so.* 2 | usr/lib/eventdispatcher/inst/manage-tls-keys 3 | usr/bin/ed-signal 4 | usr/share/eventdispatcher/messages 5 | conf/ed-signal.conf etc/eventdispatcher/ 6 | conf/README.md etc/eventdispatcher/eventdispatcher.d/ 7 | -------------------------------------------------------------------------------- /debian/reporter.install: -------------------------------------------------------------------------------- 1 | usr/include/eventdispatcher/reporter/* 2 | usr/lib/libreporter.so* 3 | usr/share/cmake/Reporter/* 4 | -------------------------------------------------------------------------------- /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 $@ --parallel 14 | 15 | override_dh_auto_configure: 16 | dh_auto_configure -- -DCMAKE_BUILD_TYPE=Release 17 | 18 | -------------------------------------------------------------------------------- /debian/snaplogger-network-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/snaplogger usr/include 2 | usr/share/cmake/SnapLoggerNetwork/* usr/share/cmake/SnapLoggerNetwork 3 | -------------------------------------------------------------------------------- /debian/snaplogger-network-doc.install: -------------------------------------------------------------------------------- 1 | usr/share/doc/snaplogger-network/html/* usr/share/doc/snaplogger-network/html/ 2 | -------------------------------------------------------------------------------- /debian/snaplogger-network.docs: -------------------------------------------------------------------------------- 1 | LICENSE.txt 2 | snaplogger/README.md 3 | TODO.md 4 | -------------------------------------------------------------------------------- /debian/snaplogger-network.install: -------------------------------------------------------------------------------- 1 | usr/lib/snaplogger/plugins/libsnaplogger_network.so 2 | -------------------------------------------------------------------------------- /debian/snaplogger-utils.docs: -------------------------------------------------------------------------------- 1 | LICENSE.txt 2 | snaplogger/README.md 3 | TODO.md 4 | -------------------------------------------------------------------------------- /debian/snaplogger-utils.install: -------------------------------------------------------------------------------- 1 | usr/bin/snaplog usr/bin 2 | conf/snaplog.conf etc/snaplogger/ 3 | -------------------------------------------------------------------------------- /debian/snaploggerd.docs: -------------------------------------------------------------------------------- 1 | LICENSE.txt 2 | snaplogger/README.md 3 | TODO.md 4 | -------------------------------------------------------------------------------- /debian/snaploggerd.install: -------------------------------------------------------------------------------- 1 | usr/sbin/snaploggerd usr/sbin 2 | conf/snaploggerd.conf etc/snaplogger/ 3 | conf/logger/snaploggerd.conf etc/snaplogger/logger 4 | -------------------------------------------------------------------------------- /debian/snaploggerd.service: -------------------------------------------------------------------------------- 1 | # Documentation available at: 2 | # https://www.freedesktop.org/software/systemd/man/systemd.service.html 3 | 4 | [Unit] 5 | Description=Snap! Logger daemon 6 | Documentation=https://snapwebsites.org/project/snaplogger file:/usr/share/doc/snaplogger-doc/html/ 7 | 8 | [Service] 9 | Type=simple 10 | WorkingDirectory=~ 11 | ProtectHome=true 12 | NoNewPrivileges=true 13 | ExecStart=/usr/sbin/snaploggerd 14 | ExecStop=/usr/bin/ed-signal snaploggerd/STOP 15 | Restart=on-failure 16 | RestartSec=10 17 | User=snaplogger 18 | Group=snaplogger 19 | LimitNPROC=1000 20 | # For developers and administrators to get console output 21 | #StandardOutput=tty 22 | #StandardError=tty 23 | #TTYPath=/dev/console 24 | # Enter a size to get a core dump in case of a crash 25 | #LimitCORE=10G 26 | 27 | [Install] 28 | WantedBy=multi-user.target 29 | 30 | # vim: syntax=dosini 31 | -------------------------------------------------------------------------------- /debian/source/options: -------------------------------------------------------------------------------- 1 | tar-ignore = "tmp" 2 | tar-ignore = ".git" 3 | -------------------------------------------------------------------------------- /doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | 21 | ## 22 | ## Documentation 23 | ## 24 | find_package(SnapDoxygen) 25 | AddDoxygenTarget(eventdispatcher 26 | ${EVENTDISPATCHER_VERSION_MAJOR} 27 | ${EVENTDISPATCHER_VERSION_MINOR} 28 | ${EVENTDISPATCHER_VERSION_PATCH} 29 | ) 30 | 31 | # vim: ts=4 sw=4 et 32 | -------------------------------------------------------------------------------- /doc/eventdispatcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m2osw/eventdispatcher/6e4e850646e3c171af5685799d8d6e2bf40ce4a4/doc/eventdispatcher.png -------------------------------------------------------------------------------- /doc/footer.html: -------------------------------------------------------------------------------- 1 |
2 |

This document is part of the Snap! Websites Project.

3 |

Copyright by Made to Order Software Corp.

4 |
5 | -------------------------------------------------------------------------------- /eventdispatcher/connection_t.cpp: -------------------------------------------------------------------------------- 1 | 2 | // The following compiles properly, I would have to reimplement all 3 | // the handlers properly and verify them to make the move to the version 4 | // which would not require us to re-write subclasses each time 5 | 6 | #include "connection_t.h" 7 | #include "timer.h" 8 | 9 | class handler_a 10 | { 11 | public: 12 | void process_hup() 13 | { 14 | } 15 | }; 16 | class handler_b 17 | { 18 | public: 19 | void timeout_event() 20 | { 21 | } 22 | }; 23 | handler_a g_handler_a; 24 | ed::connection_template g_test_a(&g_handler_a); 25 | handler_b g_handler_b; 26 | ed::connection_template g_test_b(&g_handler_b); 27 | -------------------------------------------------------------------------------- /eventdispatcher/dispatcher_support.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch support class. 23 | * 24 | * This class is used on connections that support the dispatcher. This means 25 | * those classes support messaging as defined by the eventdispatcher library. 26 | */ 27 | 28 | 29 | // self 30 | // 31 | #include 32 | 33 | 34 | 35 | namespace ed 36 | { 37 | 38 | 39 | class dispatcher; 40 | typedef std::shared_ptr dispatcher_pointer_t; 41 | typedef std::weak_ptr dispatcher_weak_t; 42 | 43 | 44 | class dispatcher_support 45 | { 46 | public: 47 | typedef std::shared_ptr pointer_t; 48 | 49 | virtual ~dispatcher_support(); 50 | 51 | void set_dispatcher(dispatcher_pointer_t d); 52 | dispatcher_pointer_t get_dispatcher() const; 53 | 54 | // new callbacks 55 | // 56 | virtual bool dispatch_message(message & msg); 57 | virtual void process_message(message & msg); 58 | 59 | private: 60 | dispatcher_weak_t f_dispatcher = dispatcher_weak_t(); 61 | }; 62 | 63 | 64 | 65 | } // namespace ed 66 | // vim: ts=4 sw=4 et 67 | -------------------------------------------------------------------------------- /eventdispatcher/fd_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | 31 | 32 | // C 33 | // 34 | #include 35 | 36 | 37 | 38 | namespace ed 39 | { 40 | 41 | 42 | 43 | class fd_connection 44 | : public connection 45 | { 46 | public: 47 | typedef std::shared_ptr pointer_t; 48 | 49 | enum class mode_t 50 | { 51 | FD_MODE_READ, 52 | FD_MODE_WRITE, 53 | FD_MODE_RW 54 | }; 55 | 56 | fd_connection(int fd, mode_t mode); 57 | 58 | void close(); 59 | void mark_closed(); 60 | 61 | // connection implementation 62 | virtual bool is_reader() const override; 63 | virtual bool is_writer() const override; 64 | virtual int get_socket() const override; 65 | 66 | // new callbacks 67 | virtual ssize_t read(void * buf, size_t count); 68 | virtual ssize_t write(void const * buf, size_t count); 69 | 70 | private: 71 | int f_fd = -1; 72 | mode_t f_mode = mode_t::FD_MODE_RW; 73 | }; 74 | 75 | 76 | 77 | } // namespace ed 78 | // vim: ts=4 sw=4 et 79 | -------------------------------------------------------------------------------- /eventdispatcher/local_dgram_client.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | 31 | 32 | 33 | namespace ed 34 | { 35 | 36 | 37 | 38 | class local_dgram_client 39 | : public local_dgram_base 40 | { 41 | public: 42 | typedef std::shared_ptr pointer_t; 43 | 44 | local_dgram_client( 45 | addr::addr_unix const & address 46 | , bool sequential = false 47 | , bool close_on_exec = true); 48 | 49 | int send(char const * msg, size_t size); 50 | 51 | private: 52 | }; 53 | 54 | 55 | 56 | } // namespace ed 57 | // vim: ts=4 sw=4 et 58 | -------------------------------------------------------------------------------- /eventdispatcher/local_dgram_server.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | 28 | // self 29 | // 30 | #include 31 | 32 | 33 | 34 | namespace ed 35 | { 36 | 37 | 38 | 39 | class local_dgram_server 40 | : public local_dgram_base 41 | { 42 | public: 43 | typedef std::shared_ptr pointer_t; 44 | 45 | local_dgram_server( 46 | addr::addr_unix const & address 47 | , bool sequential 48 | , bool close_on_exec 49 | , bool force_reuse_addr); 50 | 51 | int recv(char * msg, size_t max_size); 52 | int timed_recv(char * msg, size_t const max_size, int const max_wait_ms); 53 | std::string timed_recv(int const bufsize, int const max_wait_ms); 54 | 55 | private: 56 | }; 57 | 58 | 59 | 60 | } // namespace ed 61 | // vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /eventdispatcher/local_dgram_server_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | #include 31 | 32 | 33 | 34 | namespace ed 35 | { 36 | 37 | 38 | 39 | class local_dgram_server_connection 40 | : public connection 41 | , public local_dgram_server 42 | { 43 | public: 44 | typedef std::shared_ptr pointer_t; 45 | 46 | local_dgram_server_connection( 47 | addr::addr_unix const & address 48 | , bool sequential 49 | , bool close_on_exec 50 | , bool force_reuse_addr); 51 | 52 | // connection implementation 53 | virtual bool is_reader() const override; 54 | virtual int get_socket() const override; 55 | 56 | void set_secret_code(std::string const & secret_code); 57 | std::string const & get_secret_code() const; 58 | 59 | private: 60 | std::string f_secret_code = std::string(); 61 | }; 62 | 63 | 64 | 65 | } // namespace ed 66 | // vim: ts=4 sw=4 et 67 | -------------------------------------------------------------------------------- /eventdispatcher/local_stream_blocking_client_message_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | 31 | 32 | 33 | namespace ed 34 | { 35 | 36 | 37 | 38 | class local_stream_blocking_client_message_connection 39 | : public local_stream_client_message_connection 40 | { 41 | public: 42 | local_stream_blocking_client_message_connection( 43 | addr::addr_unix const & address 44 | , bool const blocking = false 45 | , bool const close_on_exec = true); 46 | 47 | void run(); 48 | void peek(); 49 | 50 | // connection_with_send_message implementation 51 | // 52 | virtual bool send_message(message & msg, bool cache = false) override; 53 | 54 | private: 55 | std::string f_line = std::string(); 56 | }; 57 | 58 | 59 | 60 | } // namespace ed 61 | // vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /eventdispatcher/local_stream_server_client_message_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Class used to manage message on a client connect on the server side. 23 | * 24 | * This class is used to create objects representing clients connecting 25 | * to a service. 26 | */ 27 | 28 | // self 29 | // 30 | #include 31 | #include 32 | #include 33 | 34 | 35 | 36 | namespace ed 37 | { 38 | 39 | 40 | 41 | class local_stream_server_client_message_connection 42 | : public local_stream_server_client_buffer_connection 43 | , public dispatcher_support 44 | , public connection_with_send_message 45 | { 46 | public: 47 | typedef std::shared_ptr pointer_t; 48 | 49 | local_stream_server_client_message_connection(snapdev::raii_fd_t client); 50 | 51 | // connection_with_send_message implementation 52 | // 53 | virtual bool send_message(message & msg, bool cache = false) override; 54 | 55 | // local_stream_server_client_buffer_connection implementation 56 | // 57 | virtual void process_line(std::string const & line) override; 58 | }; 59 | 60 | 61 | 62 | } // namespace ed 63 | // vim: ts=4 sw=4 et 64 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/ABSOLUTELY.conf: -------------------------------------------------------------------------------- 1 | # ALIVE parameters 2 | 3 | [serial] 4 | flags = optional 5 | 6 | [timestamp] 7 | type = timespec 8 | flags = optional 9 | 10 | [reply_timestamp] 11 | type = timespec 12 | flags = required 13 | 14 | # vim: syntax=dosini 15 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/ALIVE.conf: -------------------------------------------------------------------------------- 1 | # ALIVE parameters 2 | 3 | [serial] 4 | flags = optional 5 | 6 | [timestamp] 7 | type = timespec 8 | flags = optional 9 | 10 | # vim: syntax=dosini 11 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | project(eventdispatcher_message_definitions) 20 | 21 | install( 22 | DIRECTORY 23 | ${CMAKE_CURRENT_SOURCE_DIR}/ 24 | 25 | DESTINATION 26 | # The variable is our own so it's not available here 27 | #${EVENTDISPATCHER_SHARE_MESSAGE_DEFINITIONS_CONF_DIR} 28 | share/eventdispatcher/messages 29 | 30 | FILES_MATCHING PATTERN 31 | "*.conf" 32 | ) 33 | 34 | # vim: ts=4 sw=4 et 35 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/COMMANDS.conf: -------------------------------------------------------------------------------- 1 | # COMMANDS parameters 2 | 3 | [list] 4 | description = list of commands this daemon supports 5 | flags = required 6 | 7 | # vim: syntax=dosini 8 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/HELP.conf: -------------------------------------------------------------------------------- 1 | # HELP parameters 2 | 3 | # no parameter to the HELP command 4 | 5 | # vim: syntax=dosini 6 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/INVALID.conf: -------------------------------------------------------------------------------- 1 | # INVALID parameters 2 | 3 | [command] 4 | description = the command is supported but was not used properly (bad parameters) 5 | flags = optional 6 | 7 | [message] 8 | descro[topm = an optional message about the error 9 | flags = optional 10 | 11 | # vim: syntax=dosini 12 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/LEAK.conf: -------------------------------------------------------------------------------- 1 | # LEAK parameters 2 | 3 | # no parameter to the LEAK command 4 | 5 | # vim: syntax=dosini 6 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/LOG_ROTATE.conf: -------------------------------------------------------------------------------- 1 | # LOG_ROTATE parameters 2 | 3 | # no parameter to the LOG_ROTATE command 4 | 5 | # vim: syntax=dosini 6 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/QUITTING.conf: -------------------------------------------------------------------------------- 1 | # QUITTING parameters 2 | 3 | # no parameter to the QUITTING command 4 | 5 | # vim: syntax=dosini 6 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/READY.conf: -------------------------------------------------------------------------------- 1 | # READY parameters 2 | 3 | [my_address] 4 | description = the IP address of the sender 5 | type = address 6 | flags = optional 7 | 8 | # vim: syntax=dosini 9 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/RESTART.conf: -------------------------------------------------------------------------------- 1 | # RESTART parameters 2 | 3 | # no parameter defined to the RESTART command in eventdispatcher 4 | # 5 | # you may still add some parameters and handle them in your own restart() 6 | # function as you see fit 7 | 8 | # vim: syntax=dosini 9 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/SERVICE_UNAVAILABLE.conf: -------------------------------------------------------------------------------- 1 | # SERVICE_UNAVAILABLE parameters 2 | 3 | [destination_service] 4 | description = the service the message was intended for 5 | 6 | [unsent_command] 7 | description = command that did not make it to the destination_service 8 | 9 | # vim: syntax=dosini 10 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/STOP.conf: -------------------------------------------------------------------------------- 1 | # STOP parameters 2 | 3 | # no parameter to the STOP command 4 | 5 | # vim: syntax=dosini 6 | -------------------------------------------------------------------------------- /eventdispatcher/message-definitions/UNKNOWN.conf: -------------------------------------------------------------------------------- 1 | # UNKNOWN parameters 2 | 3 | [command] 4 | description = the command that was not understood 5 | flags = optional 6 | 7 | [message] 8 | descro[topm = an optional message about the error 9 | flags = optional 10 | 11 | # vim: syntax=dosini 12 | -------------------------------------------------------------------------------- /eventdispatcher/names.an: -------------------------------------------------------------------------------- 1 | # Global names for the Event Dispatcher Environment 2 | 3 | introducer=name 4 | project=ed 5 | 6 | [public] 7 | cmd_absolutely=ABSOLUTELY 8 | cmd_alive=ALIVE 9 | cmd_commands=COMMANDS 10 | cmd_help=HELP 11 | cmd_invalid=INVALID 12 | cmd_leak=LEAK 13 | cmd_log_rotate=LOG_ROTATE 14 | cmd_quit=QUIT 15 | cmd_quitting=QUITTING 16 | cmd_ready=READY 17 | cmd_register=REGISTER 18 | cmd_restart=RESTART 19 | cmd_service_unavailable=SERVICE_UNAVAILABLE 20 | cmd_stop=STOP 21 | cmd_unknown=UNKNOWN 22 | cmd_unregister=UNREGISTER 23 | 24 | param_command=command 25 | param_list=list 26 | param_message=message 27 | param_my_address=my_address 28 | param_reply_timestamp=reply_timestamp 29 | param_serial=serial 30 | param_service=service 31 | param_timestamp=timestamp 32 | 33 | # vim: syntax=dosini 34 | -------------------------------------------------------------------------------- /eventdispatcher/pipe_buffer_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | 31 | 32 | 33 | namespace ed 34 | { 35 | 36 | 37 | 38 | class pipe_buffer_connection 39 | : public pipe_connection 40 | { 41 | public: 42 | typedef std::shared_ptr pointer_t; 43 | 44 | pipe_buffer_connection(); 45 | 46 | // connection 47 | virtual bool is_writer() const override; 48 | 49 | // pipe_connection implementation 50 | virtual ssize_t write(void const * data, size_t length) override; 51 | virtual void process_read() override; 52 | virtual void process_write() override; 53 | virtual void process_hup() override; 54 | 55 | // new callback 56 | virtual void process_line(std::string const & line) = 0; 57 | 58 | private: 59 | std::string f_line = std::string(); // do NOT use QString because UTF-8 would break often... (since we may only receive part of messages) 60 | std::vector f_output = std::vector(); 61 | size_t f_position = 0; 62 | }; 63 | 64 | 65 | 66 | } // namespace ed 67 | // vim: ts=4 sw=4 et 68 | -------------------------------------------------------------------------------- /eventdispatcher/pipe_message_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | 35 | namespace ed 36 | { 37 | 38 | 39 | 40 | class pipe_message_connection 41 | : public pipe_buffer_connection 42 | , public dispatcher_support 43 | , public connection_with_send_message 44 | { 45 | public: 46 | typedef std::shared_ptr pointer_t; 47 | 48 | // connection_with_send_message 49 | virtual bool send_message(message & msg, bool cache = false) override; 50 | 51 | // tcp_server_client_buffer_connection implementation 52 | virtual void process_line(std::string const & line) override; 53 | }; 54 | 55 | 56 | 57 | } // namespace ed 58 | // vim: ts=4 sw=4 et 59 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/direct_tcp_server.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "direct_tcp_server.h" 22 | 23 | #include "direct_tcp_server_client.h" 24 | #include "state.h" 25 | 26 | 27 | // last include 28 | // 29 | #include 30 | 31 | 32 | 33 | namespace SNAP_CATCH2_NAMESPACE 34 | { 35 | namespace reporter 36 | { 37 | 38 | 39 | 40 | direct_tcp_server::direct_tcp_server( 41 | state * s 42 | , addr::addr const & a) 43 | : tcp_server_connection(a, std::string(), std::string()) 44 | , f_state(s) 45 | { 46 | set_name("drct_tcp_server"); 47 | keep_alive(); 48 | } 49 | 50 | 51 | void direct_tcp_server::process_accept() 52 | { 53 | // make sure lower level has a chance to capture the event 54 | // 55 | tcp_server_connection::process_accept(); 56 | 57 | ed::tcp_bio_client::pointer_t client(accept()); 58 | if(client == nullptr) 59 | { 60 | throw std::runtime_error("accept() failed to return a pointer."); // LCOV_EXCL_LINE 61 | } 62 | 63 | direct_tcp_server_client::pointer_t service(std::make_shared(f_state, client)); 64 | f_state->add_connection(service); 65 | } 66 | 67 | 68 | 69 | } // namespace reporter 70 | } // namespace SNAP_CATCH2_NAMESPACE 71 | // vim: ts=4 sw=4 et 72 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/direct_tcp_server.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // eventdispatcher 21 | // 22 | #include 23 | 24 | 25 | // snapcatch2 26 | // 27 | #include 28 | 29 | 30 | 31 | // view these as an extension of the snapcatch2 library 32 | namespace SNAP_CATCH2_NAMESPACE 33 | { 34 | namespace reporter 35 | { 36 | 37 | 38 | 39 | class state; 40 | 41 | 42 | class direct_tcp_server 43 | : public ed::tcp_server_connection 44 | { 45 | public: 46 | typedef std::shared_ptr pointer_t; 47 | 48 | direct_tcp_server( 49 | state * s 50 | , addr::addr const & a); 51 | direct_tcp_server(direct_tcp_server const &) = delete; 52 | direct_tcp_server & operator = (direct_tcp_server const &) = delete; 53 | 54 | // ed::connection implementation 55 | virtual void process_accept() override; 56 | 57 | private: 58 | state * f_state = nullptr; 59 | }; 60 | 61 | 62 | 63 | } // namespace reporter 64 | } // namespace SNAP_CATCH2_NAMESPACE 65 | // vim: ts=4 sw=4 et 66 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/direct_tcp_server_client.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // eventdispatcher 21 | // 22 | #include 23 | 24 | 25 | // snapcatch2 26 | // 27 | #include 28 | 29 | 30 | 31 | // view these as an extension of the snapcatch2 library 32 | namespace SNAP_CATCH2_NAMESPACE 33 | { 34 | namespace reporter 35 | { 36 | 37 | 38 | 39 | class state; 40 | 41 | 42 | class direct_tcp_server_client 43 | : public ed::tcp_server_client_connection 44 | { 45 | public: 46 | typedef std::shared_ptr pointer_t; 47 | 48 | direct_tcp_server_client( 49 | state * s 50 | , ed::tcp_bio_client::pointer_t client); 51 | direct_tcp_server_client(direct_tcp_server_client const &) = delete; 52 | 53 | direct_tcp_server_client & 54 | operator = (direct_tcp_server_client const &) = delete; 55 | 56 | // tcp_server_client_connection implementation 57 | virtual void process_read() override; 58 | 59 | private: 60 | state * f_state = nullptr; 61 | }; 62 | 63 | 64 | 65 | } // namespace reporter 66 | } // namespace SNAP_CATCH2_NAMESPACE 67 | // vim: ts=4 sw=4 et 68 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/executor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | // eventdispatcher 26 | // 27 | #include 28 | 29 | 30 | // cppthread 31 | // 32 | #include 33 | #include 34 | 35 | 36 | 37 | // view these as an extension of the snapcatch2 library 38 | namespace SNAP_CATCH2_NAMESPACE 39 | { 40 | namespace reporter 41 | { 42 | 43 | 44 | 45 | class executor 46 | { 47 | public: 48 | typedef std::shared_ptr pointer_t; 49 | typedef std::function thread_done_callback_t; 50 | 51 | executor(state::pointer_t s); 52 | ~executor(); 53 | 54 | void start(); 55 | bool run(); 56 | void stop(); 57 | 58 | void set_thread_done_callback(thread_done_callback_t callback); 59 | 60 | private: 61 | ed::thread_done_signal::pointer_t 62 | f_done_signal = ed::thread_done_signal::pointer_t(); 63 | cppthread::runner::pointer_t f_runner = cppthread::runner::pointer_t(); 64 | cppthread::thread::pointer_t f_thread = cppthread::thread::pointer_t(); 65 | }; 66 | 67 | 68 | 69 | } // namespace reporter 70 | } // namespace SNAP_CATCH2_NAMESPACE 71 | // vim: ts=4 sw=4 et 72 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/expression.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "expression.h" 22 | 23 | 24 | 25 | // last include 26 | // 27 | #include 28 | 29 | 30 | 31 | namespace SNAP_CATCH2_NAMESPACE 32 | { 33 | namespace reporter 34 | { 35 | 36 | 37 | 38 | operator_t expression::get_operator() const 39 | { 40 | return f_operator; 41 | } 42 | 43 | 44 | void expression::set_operator(operator_t op) 45 | { 46 | f_operator = op; 47 | } 48 | 49 | 50 | std::size_t expression::get_expression_size() const 51 | { 52 | return f_expressions.size(); 53 | } 54 | 55 | 56 | expression::pointer_t expression::get_expression(int idx) const 57 | { 58 | if(static_cast(idx) >= f_expressions.size()) 59 | { 60 | throw std::overflow_error( 61 | "index too large (" 62 | + std::to_string(idx) 63 | + ") to get sub-expression (max: " 64 | + std::to_string(f_expressions.size()) 65 | + ")."); 66 | } 67 | return f_expressions[idx]; 68 | } 69 | 70 | 71 | void expression::add_expression(pointer_t expr) 72 | { 73 | f_expressions.push_back(expr); 74 | } 75 | 76 | 77 | token const & expression::get_token() const 78 | { 79 | return f_token; 80 | } 81 | 82 | 83 | void expression::set_token(token const & t) 84 | { 85 | f_token = t; 86 | } 87 | 88 | 89 | 90 | } // namespace reporter 91 | } // namespace SNAP_CATCH2_NAMESPACE 92 | // vim: ts=4 sw=4 et 93 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/instruction.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "instruction.h" 22 | 23 | 24 | 25 | // last include 26 | // 27 | #include 28 | 29 | 30 | 31 | namespace SNAP_CATCH2_NAMESPACE 32 | { 33 | namespace reporter 34 | { 35 | 36 | 37 | 38 | namespace 39 | { 40 | 41 | 42 | 43 | constexpr parameter_declaration const g_no_params[] = {{}}; 44 | 45 | 46 | 47 | } // no name namespace 48 | 49 | 50 | 51 | instruction::instruction(std::string const & name) 52 | : f_name(name) 53 | { 54 | } 55 | 56 | 57 | instruction::~instruction() 58 | { 59 | } 60 | 61 | 62 | std::string const & instruction::get_name() const 63 | { 64 | return f_name; 65 | } 66 | 67 | 68 | parameter_declaration const * instruction::parameter_declarations() const 69 | { 70 | return g_no_params; 71 | } 72 | 73 | 74 | 75 | } // namespace reporter 76 | } // namespace SNAP_CATCH2_NAMESPACE 77 | // vim: ts=4 sw=4 et 78 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/instruction.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // catch2 21 | // 22 | #include 23 | 24 | 25 | // C++ 26 | // 27 | #include 28 | #include 29 | #include 30 | 31 | 32 | 33 | // view these as an extension of the snapcatch2 library 34 | namespace SNAP_CATCH2_NAMESPACE 35 | { 36 | namespace reporter 37 | { 38 | 39 | 40 | 41 | class state; 42 | 43 | 44 | struct parameter_declaration 45 | { 46 | char const * f_name = nullptr; 47 | char const * f_type = nullptr; 48 | bool f_required = true; 49 | }; 50 | 51 | 52 | class instruction 53 | { 54 | public: 55 | typedef std::shared_ptr pointer_t; 56 | typedef std::map map_t; 57 | 58 | instruction(std::string const & name); 59 | virtual ~instruction(); 60 | 61 | std::string const & get_name() const; 62 | 63 | virtual void func(state & s) = 0; 64 | virtual parameter_declaration const * 65 | parameter_declarations() const; 66 | 67 | private: 68 | std::string f_name = std::string(); 69 | }; 70 | 71 | 72 | 73 | } // namespace reporter 74 | } // namespace SNAP_CATCH2_NAMESPACE 75 | // vim: ts=4 sw=4 et 76 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/instruction_factory.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | // view these as an extension of the snapcatch2 library 27 | namespace SNAP_CATCH2_NAMESPACE 28 | { 29 | namespace reporter 30 | { 31 | 32 | 33 | 34 | class instruction_factory 35 | { 36 | public: 37 | instruction_factory(instruction::pointer_t inst); 38 | virtual ~instruction_factory(); 39 | 40 | std::string const & get_name() const; 41 | 42 | private: 43 | instruction::pointer_t f_instruction = instruction::pointer_t(); 44 | }; 45 | 46 | 47 | instruction::pointer_t get_instruction(std::string const & name); 48 | 49 | 50 | #define INSTRUCTION(name) instruction_factory g_instruction_factory_##name(std::make_shared()) 51 | 52 | 53 | 54 | } // namespace reporter 55 | } // namespace SNAP_CATCH2_NAMESPACE 56 | // vim: ts=4 sw=4 et 57 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/messenger_tcp_server.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "messenger_tcp_server.h" 22 | 23 | #include "messenger_tcp_server_client.h" 24 | #include "state.h" 25 | 26 | 27 | // last include 28 | // 29 | #include 30 | 31 | 32 | 33 | namespace SNAP_CATCH2_NAMESPACE 34 | { 35 | namespace reporter 36 | { 37 | 38 | 39 | 40 | messenger_tcp_server::messenger_tcp_server( 41 | state * s 42 | , addr::addr const & a) 43 | : tcp_server_connection(a, std::string(), std::string()) 44 | , f_state(s) 45 | { 46 | set_name("tcp_server"); 47 | keep_alive(); 48 | } 49 | 50 | 51 | void messenger_tcp_server::process_accept() 52 | { 53 | // make sure lower level has a chance to capture the event 54 | // 55 | tcp_server_connection::process_accept(); 56 | 57 | ed::tcp_bio_client::pointer_t client(accept()); 58 | if(client == nullptr) 59 | { 60 | throw std::runtime_error("accept() failed to return a pointer."); // LCOV_EXCL_LINE 61 | } 62 | 63 | messenger_tcp_server_client::pointer_t service(std::make_shared(f_state, client)); 64 | f_state->add_connection(service); 65 | } 66 | 67 | 68 | 69 | } // namespace reporter 70 | } // namespace SNAP_CATCH2_NAMESPACE 71 | // vim: ts=4 sw=4 et 72 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/messenger_tcp_server.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // eventdispatcher 21 | // 22 | #include 23 | 24 | 25 | // snapcatch2 26 | // 27 | #include 28 | 29 | 30 | 31 | // view these as an extension of the snapcatch2 library 32 | namespace SNAP_CATCH2_NAMESPACE 33 | { 34 | namespace reporter 35 | { 36 | 37 | 38 | 39 | class state; 40 | 41 | 42 | class messenger_tcp_server 43 | : public ed::tcp_server_connection 44 | { 45 | public: 46 | typedef std::shared_ptr pointer_t; 47 | 48 | messenger_tcp_server( 49 | state * s 50 | , addr::addr const & a); 51 | messenger_tcp_server(messenger_tcp_server const &) = delete; 52 | messenger_tcp_server & operator = (messenger_tcp_server const &) = delete; 53 | 54 | // ed::connection implementation 55 | virtual void process_accept() override; 56 | 57 | private: 58 | state * f_state = nullptr; 59 | }; 60 | 61 | 62 | 63 | } // namespace reporter 64 | } // namespace SNAP_CATCH2_NAMESPACE 65 | // vim: ts=4 sw=4 et 66 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/messenger_tcp_server_client.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "messenger_tcp_server_client.h" 22 | 23 | #include "state.h" 24 | 25 | 26 | // last include 27 | // 28 | #include 29 | 30 | 31 | 32 | namespace SNAP_CATCH2_NAMESPACE 33 | { 34 | namespace reporter 35 | { 36 | 37 | 38 | 39 | messenger_tcp_server_client::messenger_tcp_server_client( 40 | state * s 41 | , ed::tcp_bio_client::pointer_t client) 42 | : tcp_server_client_message_connection(client) 43 | , f_state(s) 44 | { 45 | set_name("msg_tcp_client"); 46 | } 47 | 48 | 49 | void messenger_tcp_server_client::process_message(ed::message & msg) 50 | { 51 | f_state->add_message(msg); 52 | } 53 | 54 | 55 | 56 | } // namespace reporter 57 | } // namespace SNAP_CATCH2_NAMESPACE 58 | // vim: ts=4 sw=4 et 59 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/messenger_tcp_server_client.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // eventdispatcher 21 | // 22 | #include 23 | 24 | 25 | // snapcatch2 26 | // 27 | #include 28 | 29 | 30 | 31 | // view these as an extension of the snapcatch2 library 32 | namespace SNAP_CATCH2_NAMESPACE 33 | { 34 | namespace reporter 35 | { 36 | 37 | 38 | 39 | class state; 40 | 41 | 42 | class messenger_tcp_server_client 43 | : public ed::tcp_server_client_message_connection 44 | { 45 | public: 46 | typedef std::shared_ptr pointer_t; 47 | 48 | messenger_tcp_server_client( 49 | state * s 50 | , ed::tcp_bio_client::pointer_t client); 51 | messenger_tcp_server_client(messenger_tcp_server_client const &) = delete; 52 | 53 | messenger_tcp_server_client & 54 | operator = (messenger_tcp_server_client const &) = delete; 55 | 56 | // ed::connection implementation 57 | virtual void process_message(ed::message & msg) override; 58 | 59 | private: 60 | state * f_state = nullptr; 61 | }; 62 | 63 | 64 | 65 | } // namespace reporter 66 | } // namespace SNAP_CATCH2_NAMESPACE 67 | // vim: ts=4 sw=4 et 68 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/parser.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | #include 24 | 25 | 26 | 27 | namespace SNAP_CATCH2_NAMESPACE 28 | { 29 | namespace reporter 30 | { 31 | 32 | 33 | 34 | class parser 35 | { 36 | public: 37 | typedef std::shared_ptr pointer_t; 38 | 39 | parser(lexer::pointer_t l, state::pointer_t s); 40 | 41 | void parse_program(); 42 | 43 | private: 44 | bool next_token(); 45 | void one_statement(); 46 | void parameters(); 47 | void one_parameter(); 48 | expression::pointer_t expression_list(); 49 | expression::pointer_t expression_array(); 50 | expression::pointer_t list_item(); 51 | expression::pointer_t comparative(); 52 | expression::pointer_t additive(); 53 | expression::pointer_t multiplicative(); 54 | expression::pointer_t primary(); 55 | 56 | lexer::pointer_t f_lexer = lexer::pointer_t(); 57 | state::pointer_t f_state = state::pointer_t(); 58 | token f_token = token(); 59 | statement::pointer_t f_statement = statement::pointer_t(); 60 | variable::pointer_t f_parameter = variable::pointer_t(); 61 | }; 62 | 63 | 64 | 65 | } // namespace reporter 66 | } // namespace SNAP_CATCH2_NAMESPACE 67 | // vim: ts=4 sw=4 et 68 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "variable.h" 22 | 23 | 24 | 25 | // last include 26 | // 27 | #include 28 | 29 | 30 | 31 | namespace SNAP_CATCH2_NAMESPACE 32 | { 33 | namespace reporter 34 | { 35 | 36 | 37 | 38 | variable::variable( 39 | std::string const & name 40 | , std::string const & type) 41 | : f_name(name) 42 | , f_type(type) 43 | { 44 | } 45 | 46 | 47 | variable::~variable() 48 | { 49 | } 50 | 51 | 52 | std::string const & variable::get_name() const 53 | { 54 | return f_name; 55 | } 56 | 57 | 58 | std::string const & variable::get_type() const 59 | { 60 | return f_type; 61 | } 62 | 63 | 64 | 65 | } // namespace reporter 66 | } // namespace SNAP_CATCH2_NAMESPACE 67 | // vim: ts=4 sw=4 et 68 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_address.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "variable_address.h" 22 | 23 | 24 | 25 | namespace SNAP_CATCH2_NAMESPACE 26 | { 27 | namespace reporter 28 | { 29 | 30 | 31 | 32 | variable_address::variable_address(std::string const & name) 33 | : variable(name, "address") 34 | { 35 | } 36 | 37 | 38 | addr::addr variable_address::get_address() const 39 | { 40 | return f_address; 41 | } 42 | 43 | 44 | void variable_address::set_address(addr::addr const & a) 45 | { 46 | f_address = a; 47 | } 48 | 49 | 50 | variable::pointer_t variable_address::clone(std::string const & name) const 51 | { 52 | pointer_t clone(std::make_shared(name)); 53 | clone->f_address = f_address; 54 | return clone; 55 | } 56 | 57 | 58 | 59 | } // namespace reporter 60 | } // namespace SNAP_CATCH2_NAMESPACE 61 | // vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_address.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | // libaddr 27 | // 28 | #include 29 | 30 | 31 | // C++ 32 | // 33 | #include 34 | #include 35 | #include 36 | 37 | 38 | 39 | // view these as an extension of the snapcatch2 library 40 | namespace SNAP_CATCH2_NAMESPACE 41 | { 42 | namespace reporter 43 | { 44 | 45 | 46 | 47 | class variable_address 48 | : public variable 49 | { 50 | public: 51 | typedef std::shared_ptr pointer_t; 52 | 53 | variable_address(std::string const & name); 54 | 55 | addr::addr get_address() const; 56 | void set_address(addr::addr const & a); 57 | 58 | // variable implementation 59 | // 60 | virtual variable::pointer_t 61 | clone(std::string const & name) const override; 62 | 63 | private: 64 | addr::addr f_address = addr::addr(); 65 | }; 66 | 67 | 68 | 69 | } // namespace reporter 70 | } // namespace SNAP_CATCH2_NAMESPACE 71 | // vim: ts=4 sw=4 et 72 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_array.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "variable_array.h" 22 | 23 | 24 | 25 | // eventdispatcher 26 | // 27 | #include 28 | 29 | 30 | 31 | namespace SNAP_CATCH2_NAMESPACE 32 | { 33 | namespace reporter 34 | { 35 | 36 | 37 | 38 | variable_array::variable_array(std::string const & name) 39 | : variable(name, "array") 40 | { 41 | } 42 | 43 | 44 | std::size_t variable_array::get_item_size() const 45 | { 46 | return f_items.size(); 47 | } 48 | 49 | 50 | variable::pointer_t variable_array::get_item(int idx) const 51 | { 52 | if(static_cast(idx) >= f_items.size()) 53 | { 54 | return variable::pointer_t(); 55 | } 56 | 57 | return f_items[idx]; 58 | } 59 | 60 | 61 | void variable_array::add_item(variable::pointer_t v) 62 | { 63 | f_items.push_back(v); 64 | } 65 | 66 | 67 | variable::pointer_t variable_array::clone(std::string const & name) const 68 | { 69 | pointer_t clone(std::make_shared(name)); 70 | for(auto const & item : f_items) 71 | { 72 | clone->add_item(item->clone(item->get_name())); 73 | } 74 | return clone; 75 | } 76 | 77 | 78 | 79 | } // namespace reporter 80 | } // namespace SNAP_CATCH2_NAMESPACE 81 | // vim: ts=4 sw=4 et 82 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_array.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | // view these as an extension of the snapcatch2 library 27 | namespace SNAP_CATCH2_NAMESPACE 28 | { 29 | namespace reporter 30 | { 31 | 32 | 33 | 34 | class variable_array 35 | : public variable 36 | { 37 | public: 38 | typedef std::shared_ptr pointer_t; 39 | 40 | variable_array(std::string const & name); 41 | 42 | std::size_t get_item_size() const; 43 | variable::pointer_t get_item(int idx) const; 44 | void add_item(variable::pointer_t v); 45 | 46 | // variable implementation 47 | // 48 | virtual variable::pointer_t 49 | clone(std::string const & name) const override; 50 | 51 | private: 52 | variable::vector_t f_items = variable::vector_t(); 53 | }; 54 | 55 | 56 | 57 | } // namespace reporter 58 | } // namespace SNAP_CATCH2_NAMESPACE 59 | // vim: ts=4 sw=4 et 60 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_floating_point.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "variable_floating_point.h" 22 | 23 | 24 | namespace SNAP_CATCH2_NAMESPACE 25 | { 26 | namespace reporter 27 | { 28 | 29 | 30 | 31 | variable_floating_point::variable_floating_point(std::string const & name) 32 | : variable(name, "floating_point") 33 | { 34 | } 35 | 36 | 37 | double variable_floating_point::get_floating_point() const 38 | { 39 | return f_floating_point; 40 | } 41 | 42 | 43 | void variable_floating_point::set_floating_point(double d) 44 | { 45 | f_floating_point = d; 46 | } 47 | 48 | 49 | variable::pointer_t variable_floating_point::clone(std::string const & name) const 50 | { 51 | pointer_t clone(std::make_shared(name)); 52 | clone->f_floating_point = f_floating_point; 53 | return clone; 54 | } 55 | 56 | 57 | 58 | } // namespace reporter 59 | } // namespace SNAP_CATCH2_NAMESPACE 60 | // vim: ts=4 sw=4 et 61 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_floating_point.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | // view these as an extension of the snapcatch2 library 27 | namespace SNAP_CATCH2_NAMESPACE 28 | { 29 | namespace reporter 30 | { 31 | 32 | 33 | 34 | class variable_floating_point 35 | : public variable 36 | { 37 | public: 38 | typedef std::shared_ptr pointer_t; 39 | 40 | variable_floating_point(std::string const & name); 41 | 42 | double get_floating_point() const; 43 | void set_floating_point(double i); 44 | 45 | // variable implementation 46 | // 47 | virtual variable::pointer_t 48 | clone(std::string const & name) const override; 49 | 50 | private: 51 | double f_floating_point = 0.0; 52 | }; 53 | 54 | 55 | 56 | } // namespace reporter 57 | } // namespace SNAP_CATCH2_NAMESPACE 58 | // vim: ts=4 sw=4 et 59 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_integer.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "variable_integer.h" 22 | 23 | 24 | 25 | namespace SNAP_CATCH2_NAMESPACE 26 | { 27 | namespace reporter 28 | { 29 | 30 | 31 | 32 | variable_integer::variable_integer(std::string const & name) 33 | : variable(name, "integer") 34 | { 35 | } 36 | 37 | 38 | std::int64_t variable_integer::get_integer() const 39 | { 40 | return f_integer; 41 | } 42 | 43 | 44 | void variable_integer::set_integer(std::int64_t i) 45 | { 46 | f_integer = i; 47 | } 48 | 49 | 50 | variable::pointer_t variable_integer::clone(std::string const & name) const 51 | { 52 | pointer_t clone(std::make_shared(name)); 53 | clone->f_integer = f_integer; 54 | return clone; 55 | } 56 | 57 | 58 | 59 | } // namespace reporter 60 | } // namespace SNAP_CATCH2_NAMESPACE 61 | // vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_integer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | // view these as an extension of the snapcatch2 library 27 | namespace SNAP_CATCH2_NAMESPACE 28 | { 29 | namespace reporter 30 | { 31 | 32 | 33 | 34 | class variable_integer 35 | : public variable 36 | { 37 | public: 38 | typedef std::shared_ptr pointer_t; 39 | 40 | variable_integer(std::string const & name); 41 | 42 | std::int64_t get_integer() const; 43 | void set_integer(std::int64_t i); 44 | 45 | // variable implementation 46 | // 47 | virtual variable::pointer_t 48 | clone(std::string const & name) const override; 49 | 50 | private: 51 | std::int64_t f_integer = 0; 52 | }; 53 | 54 | 55 | 56 | } // namespace reporter 57 | } // namespace SNAP_CATCH2_NAMESPACE 58 | // vim: ts=4 sw=4 et 59 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_list.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | // view these as an extension of the snapcatch2 library 27 | namespace SNAP_CATCH2_NAMESPACE 28 | { 29 | namespace reporter 30 | { 31 | 32 | 33 | 34 | class variable_list 35 | : public variable 36 | { 37 | public: 38 | typedef std::shared_ptr pointer_t; 39 | 40 | variable_list(std::string const & name); 41 | 42 | std::size_t get_item_size() const; 43 | variable::pointer_t get_item(int idx) const; 44 | variable::pointer_t get_item(std::string const & name) const; 45 | void add_item(variable::pointer_t v); 46 | 47 | // variable implementation 48 | // 49 | virtual variable::pointer_t 50 | clone(std::string const & name) const override; 51 | 52 | private: 53 | variable::map_t f_items = variable::map_t(); 54 | }; 55 | 56 | 57 | 58 | } // namespace reporter 59 | } // namespace SNAP_CATCH2_NAMESPACE 60 | // vim: ts=4 sw=4 et 61 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_regex.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "variable_regex.h" 22 | 23 | 24 | 25 | namespace SNAP_CATCH2_NAMESPACE 26 | { 27 | namespace reporter 28 | { 29 | 30 | 31 | 32 | variable_regex::variable_regex(std::string const & name) 33 | : variable(name, "regex") 34 | { 35 | } 36 | 37 | 38 | std::string const & variable_regex::get_regex() const 39 | { 40 | return f_regex; 41 | } 42 | 43 | 44 | void variable_regex::set_regex(std::string const & regex) 45 | { 46 | f_regex = regex; 47 | } 48 | 49 | 50 | variable::pointer_t variable_regex::clone(std::string const & name) const 51 | { 52 | pointer_t clone(std::make_shared(name)); 53 | clone->f_regex = f_regex; 54 | return clone; 55 | } 56 | 57 | 58 | 59 | } // namespace reporter 60 | } // namespace SNAP_CATCH2_NAMESPACE 61 | // vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_regex.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | // view these as an extension of the snapcatch2 library 27 | namespace SNAP_CATCH2_NAMESPACE 28 | { 29 | namespace reporter 30 | { 31 | 32 | 33 | 34 | class variable_regex 35 | : public variable 36 | { 37 | public: 38 | typedef std::shared_ptr pointer_t; 39 | 40 | variable_regex(std::string const & name); 41 | 42 | std::string const & get_regex() const; 43 | void set_regex(std::string const & s); 44 | 45 | // variable implementation 46 | // 47 | virtual variable::pointer_t 48 | clone(std::string const & name) const override; 49 | 50 | private: 51 | std::string f_regex = std::string(); 52 | }; 53 | 54 | 55 | 56 | } // namespace reporter 57 | } // namespace SNAP_CATCH2_NAMESPACE 58 | // vim: ts=4 sw=4 et 59 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_string.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "variable_string.h" 22 | 23 | 24 | 25 | namespace SNAP_CATCH2_NAMESPACE 26 | { 27 | namespace reporter 28 | { 29 | 30 | 31 | 32 | variable_string::variable_string(std::string const & name, std::string const & type) 33 | : variable(name, type) 34 | { 35 | } 36 | 37 | 38 | std::string const & variable_string::get_string() const 39 | { 40 | return f_string; 41 | } 42 | 43 | 44 | void variable_string::set_string(std::string const & s) 45 | { 46 | f_string = s; 47 | } 48 | 49 | 50 | variable::pointer_t variable_string::clone(std::string const & name) const 51 | { 52 | pointer_t clone(std::make_shared(name, get_type())); 53 | clone->f_string = f_string; 54 | return clone; 55 | } 56 | 57 | 58 | 59 | } // namespace reporter 60 | } // namespace SNAP_CATCH2_NAMESPACE 61 | // vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_string.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | // view these as an extension of the snapcatch2 library 27 | namespace SNAP_CATCH2_NAMESPACE 28 | { 29 | namespace reporter 30 | { 31 | 32 | 33 | 34 | class variable_string 35 | : public variable 36 | { 37 | public: 38 | typedef std::shared_ptr pointer_t; 39 | 40 | variable_string(std::string const & name, std::string const & type = "string"); 41 | 42 | std::string const & get_string() const; 43 | void set_string(std::string const & s); 44 | 45 | // variable implementation 46 | // 47 | virtual variable::pointer_t 48 | clone(std::string const & name) const override; 49 | 50 | private: 51 | std::string f_string = std::string(); 52 | }; 53 | 54 | 55 | 56 | } // namespace reporter 57 | } // namespace SNAP_CATCH2_NAMESPACE 58 | // vim: ts=4 sw=4 et 59 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_timestamp.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "variable_timestamp.h" 22 | 23 | 24 | 25 | namespace SNAP_CATCH2_NAMESPACE 26 | { 27 | namespace reporter 28 | { 29 | 30 | 31 | 32 | variable_timestamp::variable_timestamp(std::string const & name) 33 | : variable(name, "timestamp") 34 | { 35 | } 36 | 37 | 38 | snapdev::timespec_ex variable_timestamp::get_timestamp() const 39 | { 40 | return f_timestamp; 41 | } 42 | 43 | 44 | void variable_timestamp::set_timestamp(snapdev::timespec_ex timestamp) 45 | { 46 | f_timestamp = timestamp; 47 | } 48 | 49 | 50 | variable::pointer_t variable_timestamp::clone(std::string const & name) const 51 | { 52 | pointer_t clone(std::make_shared(name)); 53 | clone->f_timestamp = f_timestamp; 54 | return clone; 55 | } 56 | 57 | 58 | 59 | } // namespace reporter 60 | } // namespace SNAP_CATCH2_NAMESPACE 61 | // vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_timestamp.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | // snapdev 26 | // 27 | #include 28 | 29 | 30 | 31 | // view these as an extension of the snapcatch2 library 32 | namespace SNAP_CATCH2_NAMESPACE 33 | { 34 | namespace reporter 35 | { 36 | 37 | 38 | 39 | class variable_timestamp 40 | : public variable 41 | { 42 | public: 43 | typedef std::shared_ptr pointer_t; 44 | 45 | variable_timestamp(std::string const & name); 46 | 47 | snapdev::timespec_ex get_timestamp() const; 48 | void set_timestamp(snapdev::timespec_ex i); 49 | 50 | // variable implementation 51 | // 52 | virtual variable::pointer_t 53 | clone(std::string const & name) const override; 54 | 55 | private: 56 | snapdev::timespec_ex f_timestamp = snapdev::timespec_ex(); 57 | }; 58 | 59 | 60 | 61 | } // namespace reporter 62 | } // namespace SNAP_CATCH2_NAMESPACE 63 | // vim: ts=4 sw=4 et 64 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_void.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | 19 | // self 20 | // 21 | #include "variable_void.h" 22 | 23 | 24 | 25 | namespace SNAP_CATCH2_NAMESPACE 26 | { 27 | namespace reporter 28 | { 29 | 30 | 31 | 32 | variable_void::variable_void(std::string const & name) 33 | : variable(name, "void") 34 | { 35 | } 36 | 37 | 38 | variable::pointer_t variable_void::clone(std::string const & name) const 39 | { 40 | return std::make_shared(name); 41 | } 42 | 43 | 44 | 45 | } // namespace reporter 46 | } // namespace SNAP_CATCH2_NAMESPACE 47 | // vim: ts=4 sw=4 et 48 | -------------------------------------------------------------------------------- /eventdispatcher/reporter/variable_void.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation, either version 3 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program. If not, see . 18 | #pragma once 19 | 20 | // self 21 | // 22 | #include 23 | 24 | 25 | 26 | // view these as an extension of the snapcatch2 library 27 | namespace SNAP_CATCH2_NAMESPACE 28 | { 29 | namespace reporter 30 | { 31 | 32 | 33 | 34 | class variable_void 35 | : public variable 36 | { 37 | public: 38 | typedef std::shared_ptr pointer_t; 39 | 40 | variable_void(std::string const & name); 41 | 42 | // variable implementation 43 | // 44 | virtual variable::pointer_t 45 | clone(std::string const & name) const override; 46 | 47 | private: 48 | }; 49 | 50 | 51 | 52 | } // namespace reporter 53 | } // namespace SNAP_CATCH2_NAMESPACE 54 | // vim: ts=4 sw=4 et 55 | -------------------------------------------------------------------------------- /eventdispatcher/signal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | 31 | 32 | // C 33 | // 34 | #include 35 | 36 | 37 | 38 | namespace ed 39 | { 40 | 41 | 42 | 43 | class signal 44 | : public connection 45 | { 46 | public: 47 | typedef std::shared_ptr pointer_t; 48 | 49 | signal(int posix_signal); 50 | virtual ~signal() override; 51 | 52 | void close(); 53 | void unblock_signal_on_destruction(); 54 | 55 | // connection implementation 56 | virtual bool is_signal() const override; 57 | virtual int get_socket() const override; 58 | 59 | pid_t get_child_pid() const; 60 | signalfd_siginfo const * get_signal_info() const; 61 | 62 | void process(); 63 | 64 | private: 65 | int f_signal = 0; // i.e. SIGHUP, SIGTERM... 66 | int f_socket = -1; // output of signalfd() 67 | signalfd_siginfo f_signal_info = signalfd_siginfo(); 68 | bool f_unblock = false; 69 | }; 70 | 71 | 72 | 73 | } // namespace ed 74 | // vim: ts=4 sw=4 et 75 | -------------------------------------------------------------------------------- /eventdispatcher/signal_profiler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class handling SIGPROF signals. 23 | * 24 | * A class used to simplify the handling of SIGPROF in an application. 25 | */ 26 | 27 | 28 | // self 29 | // 30 | #include 31 | 32 | 33 | // C 34 | // 35 | #include 36 | 37 | 38 | 39 | namespace ed 40 | { 41 | 42 | 43 | class signal_profiler 44 | : public ed::signal 45 | { 46 | public: 47 | typedef struct sigaction sigaction_t; 48 | typedef void (*sa_sigaction_t)(int, siginfo_t *, void *); 49 | 50 | signal_profiler(); 51 | 52 | // implementation of ed::connection 53 | virtual void process_signal() override; 54 | 55 | private: 56 | sigaction_t f_action = sigaction_t(); 57 | }; 58 | 59 | 60 | } // namespace ed 61 | // vim: ts=4 sw=4 et 62 | -------------------------------------------------------------------------------- /eventdispatcher/socket_events.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Send signal when a socket is opened in LISTEN mode. 23 | * 24 | * This class can be used to wait for a TCP socket to be opened and listening 25 | * for clients to connect. Later versions may offer more types of sockets 26 | * and more types of events. 27 | */ 28 | 29 | // self 30 | // 31 | #include 32 | 33 | 34 | // libaddr 35 | // 36 | #include 37 | 38 | 39 | 40 | namespace ed 41 | { 42 | 43 | 44 | 45 | class socket_events 46 | : public connection 47 | { 48 | public: 49 | typedef std::shared_ptr pointer_t; 50 | 51 | static std::int64_t const DEFAULT_PAUSE_BETWEEN_POLLS = 10LL; // 10 seconds 52 | 53 | socket_events(addr::addr const & address); 54 | virtual ~socket_events() override; 55 | 56 | // connection implementation 57 | virtual int get_socket() const override; 58 | 59 | // new callbacks 60 | virtual void process_listening() = 0; 61 | 62 | addr::addr const & get_addr() const; 63 | void lost_connection(); 64 | 65 | private: 66 | addr::addr f_addr = addr::addr(); 67 | }; 68 | 69 | 70 | 71 | } // namespace ed 72 | // vim: ts=4 sw=4 et 73 | -------------------------------------------------------------------------------- /eventdispatcher/tcp_base.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | 31 | 32 | 33 | namespace ed 34 | { 35 | 36 | 37 | 38 | void cleanup(); 39 | void cleanup_on_thread_exit(); 40 | 41 | 42 | 43 | } // namespace ed 44 | // vim: ts=4 sw=4 et 45 | -------------------------------------------------------------------------------- /eventdispatcher/tcp_blocking_client_message_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | 31 | 32 | 33 | namespace ed 34 | { 35 | 36 | 37 | 38 | class tcp_blocking_client_message_connection 39 | : public tcp_client_message_connection 40 | { 41 | public: 42 | tcp_blocking_client_message_connection( 43 | addr::addr const & address 44 | , mode_t mode = mode_t::MODE_PLAIN); 45 | 46 | void run(); 47 | void peek(); 48 | 49 | // connection_with_send_message 50 | virtual bool send_message(message & msg, bool cache = false) override; 51 | 52 | // connection callback 53 | virtual void process_error() override; 54 | 55 | private: 56 | std::string f_line = std::string(); 57 | }; 58 | 59 | 60 | 61 | } // namespace ed 62 | // vim: ts=4 sw=4 et 63 | -------------------------------------------------------------------------------- /eventdispatcher/tcp_client_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief A TCP connection, client side. 23 | * 24 | * This class implements a connection using TCP. This is the client side. 25 | * This connection connects to the server listening on a TCP port. 26 | */ 27 | 28 | // self 29 | // 30 | #include 31 | #include 32 | 33 | 34 | 35 | namespace ed 36 | { 37 | 38 | 39 | 40 | class tcp_client_connection 41 | : public connection 42 | , public tcp_bio_client 43 | { 44 | public: 45 | typedef std::shared_ptr pointer_t; 46 | 47 | tcp_client_connection( 48 | addr::addr const & address 49 | , mode_t mode = mode_t::MODE_PLAIN); 50 | 51 | addr::addr const & get_remote_address() const; 52 | 53 | // connection implementation 54 | virtual bool is_reader() const override; 55 | virtual int get_socket() const override; 56 | 57 | // new callbacks 58 | virtual ssize_t read(void * buf, std::size_t count); 59 | virtual ssize_t write(void const * buf, std::size_t count); 60 | 61 | private: 62 | addr::addr const f_remote_address = addr::addr(); 63 | }; 64 | 65 | 66 | 67 | } // namespace ed 68 | // vim: ts=4 sw=4 et 69 | -------------------------------------------------------------------------------- /eventdispatcher/tcp_client_message_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | 35 | namespace ed 36 | { 37 | 38 | 39 | 40 | class tcp_client_message_connection 41 | : public tcp_client_buffer_connection 42 | , public dispatcher_support 43 | , public connection_with_send_message 44 | { 45 | public: 46 | typedef std::shared_ptr pointer_t; 47 | 48 | tcp_client_message_connection( 49 | addr::addr const & address 50 | , mode_t const mode = mode_t::MODE_PLAIN 51 | , bool const blocking = false); 52 | 53 | // connection_with_send_message 54 | virtual bool send_message(message & msg, bool cache = false) override; 55 | 56 | // tcp_client_buffer_connection implementation 57 | virtual void process_line(std::string const & line) override; 58 | }; 59 | 60 | 61 | 62 | } // namespace ed 63 | // vim: ts=4 sw=4 et 64 | -------------------------------------------------------------------------------- /eventdispatcher/tcp_private.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief TCP BIO client implementation. 23 | * 24 | * Class used to manage a BIO client. 25 | */ 26 | 27 | // make sure we use OpenSSL with multi-thread support 28 | // (TODO: move to .cpp once we have the impl!) 29 | #define OPENSSL_THREAD_DEFINES 30 | 31 | // C++ 32 | // 33 | #include 34 | 35 | 36 | // OpenSSL 37 | // 38 | #include 39 | #include 40 | 41 | 42 | 43 | namespace ed 44 | { 45 | namespace detail 46 | { 47 | 48 | 49 | // shared with the tcp_bio_server 50 | class tcp_bio_client_impl 51 | { 52 | public: 53 | std::shared_ptr f_ssl_ctx = std::shared_ptr(); 54 | std::shared_ptr f_bio = std::shared_ptr(); 55 | }; 56 | 57 | 58 | void bio_cleanup(); 59 | void bio_deleter(BIO * bio); 60 | void bio_initialize(); 61 | int bio_log_errors(); 62 | void general_names_deleter(GENERAL_NAMES * general_names); 63 | void per_thread_cleanup(); 64 | void ssl_ctx_deleter(SSL_CTX * ssl_ctx); 65 | void thread_cleanup(); 66 | 67 | 68 | 69 | } // namespace detail 70 | } // namespace ed 71 | // vim: ts=4 sw=4 et 72 | -------------------------------------------------------------------------------- /eventdispatcher/tcp_server_client_message_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | 35 | namespace ed 36 | { 37 | 38 | 39 | 40 | class tcp_server_client_message_connection 41 | : public tcp_server_client_buffer_connection 42 | , public dispatcher_support 43 | , public connection_with_send_message 44 | { 45 | public: 46 | typedef std::shared_ptr pointer_t; 47 | 48 | tcp_server_client_message_connection(tcp_bio_client::pointer_t client); 49 | 50 | // connection_with_send_message implementation 51 | virtual bool send_message(message & msg, bool cache = false) override; 52 | 53 | // tcp_server_client_buffer_connection implementation 54 | virtual void process_line(std::string const & line) override; 55 | 56 | private: 57 | }; 58 | 59 | 60 | 61 | } // namespace ed 62 | // vim: ts=4 sw=4 et 63 | -------------------------------------------------------------------------------- /eventdispatcher/tcp_server_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief TCP Server connection class. 23 | * 24 | * Class used to handle a TCP connection. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | #include 31 | 32 | 33 | 34 | namespace ed 35 | { 36 | 37 | 38 | 39 | class tcp_server_connection 40 | : public connection 41 | , public tcp_bio_server 42 | { 43 | public: 44 | typedef std::shared_ptr pointer_t; 45 | 46 | tcp_server_connection( 47 | addr::addr const & address 48 | , std::string const & certificate 49 | , std::string const & private_key 50 | , mode_t mode = mode_t::MODE_PLAIN 51 | , int max_connections = -1 52 | , bool reuse_addr = false); 53 | 54 | // connection implementation 55 | // 56 | virtual bool is_listener() const override; 57 | virtual int get_socket() const override; 58 | }; 59 | 60 | 61 | 62 | } // namespace ed 63 | // vim: ts=4 sw=4 et 64 | -------------------------------------------------------------------------------- /eventdispatcher/thread_done_signal.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Handle the "thread done" signal. 23 | * 24 | * This class is used to send a signal through a pipe when a thread is 25 | * done for the main thread (usually the main thread is the one listening 26 | * for event from the communicator). 27 | */ 28 | 29 | // self 30 | // 31 | #include 32 | 33 | 34 | 35 | namespace ed 36 | { 37 | 38 | 39 | 40 | class thread_done_signal 41 | : public connection 42 | { 43 | public: 44 | typedef std::shared_ptr pointer_t; 45 | 46 | thread_done_signal(); 47 | virtual ~thread_done_signal() override; 48 | 49 | // connection implementation 50 | // 51 | virtual bool is_reader() const override; 52 | virtual int get_socket() const override; 53 | virtual void process_read() override; 54 | 55 | void thread_done(); 56 | 57 | private: 58 | int f_pipe[2] = { -1, -1 }; // pipes 59 | }; 60 | 61 | 62 | 63 | } // namespace ed 64 | // vim: ts=4 sw=4 et 65 | -------------------------------------------------------------------------------- /eventdispatcher/udp_base.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | 28 | // self 29 | // 30 | #include 31 | 32 | 33 | // libaddr 34 | // 35 | #include 36 | 37 | 38 | 39 | namespace ed 40 | { 41 | 42 | 43 | 44 | 45 | class udp_base 46 | { 47 | public: 48 | virtual ~udp_base(); 49 | 50 | int get_socket() const; 51 | void set_broadcast(bool state); 52 | 53 | int get_mtu_size() const; 54 | int get_mss_size() const; 55 | addr::addr get_address() const; 56 | 57 | protected: 58 | udp_base(addr::addr const & address); 59 | 60 | snapdev::raii_fd_t f_socket = snapdev::raii_fd_t(); 61 | mutable int f_mtu_size = 0; 62 | addr::addr f_address = addr::addr(); 63 | }; 64 | 65 | 66 | 67 | } // namespace ed 68 | // vim: ts=4 sw=4 et 69 | -------------------------------------------------------------------------------- /eventdispatcher/udp_client.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | 31 | 32 | 33 | namespace ed 34 | { 35 | 36 | 37 | 38 | class udp_client 39 | : public udp_base 40 | { 41 | public: 42 | typedef std::shared_ptr pointer_t; 43 | 44 | udp_client(addr::addr const & address); 45 | ~udp_client(); 46 | 47 | int send(char const * msg, size_t size); 48 | 49 | private: 50 | }; 51 | 52 | 53 | 54 | } // namespace ed 55 | // vim: ts=4 sw=4 et 56 | -------------------------------------------------------------------------------- /eventdispatcher/udp_server.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | 28 | // self 29 | // 30 | #include 31 | 32 | 33 | 34 | namespace ed 35 | { 36 | 37 | 38 | 39 | class udp_server 40 | : public udp_base 41 | { 42 | public: 43 | typedef std::shared_ptr pointer_t; 44 | 45 | udp_server(addr::addr const & addr 46 | , addr::addr const & multicast_addr = addr::addr()); 47 | virtual ~udp_server() override; 48 | 49 | int recv(char * msg, size_t max_size); 50 | int timed_recv(char * msg, size_t const max_size, int const max_wait_ms); 51 | std::string timed_recv(int const bufsize, int const max_wait_ms); 52 | 53 | private: 54 | }; 55 | 56 | 57 | 58 | } // namespace ed 59 | // vim: ts=4 sw=4 et 60 | -------------------------------------------------------------------------------- /eventdispatcher/udp_server_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Event dispatch class. 23 | * 24 | * Class used to handle events. 25 | */ 26 | 27 | // self 28 | // 29 | #include 30 | #include 31 | 32 | 33 | 34 | namespace ed 35 | { 36 | 37 | 38 | 39 | class udp_server_connection 40 | : public connection 41 | , public udp_server 42 | { 43 | public: 44 | typedef std::shared_ptr pointer_t; 45 | 46 | udp_server_connection( 47 | addr::addr const & addr 48 | , addr::addr const & multicast_address = addr::addr()); 49 | 50 | // connection implementation 51 | virtual bool is_reader() const override; 52 | virtual int get_socket() const override; 53 | 54 | void set_secret_code(std::string const & secret_code); 55 | std::string const & get_secret_code() const; 56 | 57 | private: 58 | std::string f_secret_code = std::string(); 59 | }; 60 | 61 | 62 | 63 | } // namespace ed 64 | // vim: ts=4 sw=4 et 65 | -------------------------------------------------------------------------------- /eventdispatcher/utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Various useful functions and declarations. 23 | * 24 | * Some functions/declarations that are used throughout the library. 25 | */ 26 | 27 | 28 | // snapdev 29 | // 30 | #include 31 | 32 | 33 | // C++ 34 | // 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | 41 | // C 42 | // 43 | #include 44 | 45 | 46 | 47 | namespace ed 48 | { 49 | 50 | 51 | 52 | enum class mode_t 53 | { 54 | MODE_PLAIN, // avoid SSL/TLS 55 | MODE_SECURE, // WARNING: may return a non-verified connection 56 | MODE_ALWAYS_SECURE // fails if cannot be 100% secure 57 | }; 58 | 59 | 60 | typedef std::map string_map_t; 61 | 62 | 63 | constexpr int const MAX_CONNECTIONS = 50; 64 | 65 | 66 | std::int64_t get_current_date(); 67 | std::int64_t get_current_date_ns(); 68 | 69 | 70 | 71 | 72 | } // namespace ed 73 | // vim: ts=4 sw=4 et 74 | -------------------------------------------------------------------------------- /eventdispatcher/version.h.in: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Definitions of the event dispatcher version. 23 | * 24 | * This header includes the event dispatcher library version and functions 25 | * you can use to check the current version of the library. 26 | */ 27 | 28 | 29 | #define EVENTDISPATCHER_VERSION_MAJOR @EVENTDISPATCHER_VERSION_MAJOR@ 30 | #define EVENTDISPATCHER_VERSION_MINOR @EVENTDISPATCHER_VERSION_MINOR@ 31 | #define EVENTDISPATCHER_VERSION_PATCH @EVENTDISPATCHER_VERSION_PATCH@ 32 | #define EVENTDISPATCHER_VERSION_STRING "@EVENTDISPATCHER_VERSION_MAJOR@.@EVENTDISPATCHER_VERSION_MINOR@.@EVENTDISPATCHER_VERSION_PATCH@" 33 | 34 | namespace ed 35 | { 36 | 37 | 38 | 39 | int get_major_version(); 40 | int get_release_version(); 41 | int get_patch_version(); 42 | char const * get_version_string(); 43 | 44 | 45 | 46 | } // namespace ed 47 | // vim: ts=4 sw=4 et 48 | -------------------------------------------------------------------------------- /eventdispatcher_qt/qt_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | // eventdispatcher 22 | // 23 | #include 24 | 25 | 26 | 27 | namespace ed 28 | { 29 | 30 | 31 | class qt_connection 32 | : public connection 33 | { 34 | public: 35 | typedef std::shared_ptr pointer_t; 36 | 37 | qt_connection(); 38 | virtual ~qt_connection() override; 39 | 40 | // implements connection 41 | virtual int get_socket() const override; 42 | virtual bool is_reader() const override; 43 | virtual void process_timeout() override; 44 | virtual void process_read() override; 45 | 46 | private: 47 | int f_fd = -1; 48 | }; 49 | 50 | 51 | } // namespace ed 52 | // vim: ts=4 sw=4 et 53 | -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program; if not, write to the Free Software Foundation, Inc., 18 | # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | ## 21 | ## server example 22 | ## 23 | project(server) 24 | 25 | add_executable(${PROJECT_NAME} 26 | server.cpp 27 | ) 28 | 29 | target_link_libraries(${PROJECT_NAME} 30 | eventdispatcher 31 | ) 32 | 33 | target_include_directories(${PROJECT_NAME} 34 | PUBLIC 35 | ${ADVGETOPT_INCLUDE_DIRS} 36 | ) 37 | 38 | #install( 39 | # TARGETS 40 | # ${PROJECT_NAME} 41 | # 42 | # RUNTIME DESTINATION 43 | # bin 44 | #) 45 | 46 | 47 | ## 48 | ## client example 49 | ## 50 | project(client) 51 | 52 | add_executable(${PROJECT_NAME} 53 | client.cpp 54 | ) 55 | 56 | target_link_libraries(${PROJECT_NAME} 57 | eventdispatcher 58 | ) 59 | 60 | target_include_directories(${PROJECT_NAME} 61 | PUBLIC 62 | ${ADVGETOPT_INCLUDE_DIRS} 63 | ) 64 | 65 | #install( 66 | # TARGETS 67 | # ${PROJECT_NAME} 68 | # 69 | # RUNTIME DESTINATION 70 | # bin 71 | #) 72 | 73 | 74 | # vim: ts=4 sw=4 et 75 | -------------------------------------------------------------------------------- /mk: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # See the snapcmakemodules project for details about this script 4 | # https://github.com/m2osw/snapcmakemodules 5 | 6 | if test -x ../../cmake/scripts/mk 7 | then 8 | ../../cmake/scripts/mk $* 9 | else 10 | echo "error: could not locate the cmake mk script" 11 | exit 1 12 | fi 13 | 14 | -------------------------------------------------------------------------------- /scripts/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2023-2025 Made to Order Software Corp. All Rights Reserved. 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | ## 20 | ## install the eventdispatcher scripts 21 | ## 22 | project(eventdispatcherscripts) 23 | 24 | install( 25 | PROGRAMS 26 | manage-tls-keys 27 | 28 | DESTINATION 29 | lib/eventdispatcher/inst/ 30 | ) 31 | 32 | # vim: ts=4 sw=4 et 33 | -------------------------------------------------------------------------------- /scripts/manage-tls-keys: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # 3 | 4 | # Create a public and private key pair for TLS encryption. 5 | # 6 | # This is used to communicate with the various Snap! tools with an unsigned 7 | # key. 8 | # 9 | # Note: the environment name is often the same as the package name. 10 | # 11 | # param[in] $1 environment name 12 | # param[in] $2 package name 13 | # param[in] $3 user name 14 | # param[in] $4 group name 15 | # 16 | create_tls_keys() { 17 | ENVIRONMENT_NAME=$1 18 | PACKAGE_NAME=$2 19 | USER_NAME=$3 20 | GROUP_NAME=$4 21 | 22 | SSL_DIR=/etc/${ENVIRONMENT_NAME}/ssl 23 | mkdir -p ${SSL_DIR} 24 | chown ${USER_NAME}:${GROUP_NAME} ${SSL_DIR} 25 | chmod 710 ${SSL_DIR} 26 | if test ! -f ${SSL_DIR}/${PACKAGE_NAME}.key \ 27 | -o ! -f ${SSL_DIR}/${PACKAGE_NAME}.crt 28 | then 29 | openssl req -newkey rsa:2048 \ 30 | -nodes -keyout ${SSL_DIR}/${PACKAGE_NAME}.key \ 31 | -x509 -days 3650 -out ${SSL_DIR}/${PACKAGE_NAME}.crt \ 32 | -subj "/C=US/ST=California/L=Sacramento/O=Snap/OU=Website/CN=snap.website" 33 | fi 34 | } 35 | 36 | # Delete the public and private keys created by the create_tls_keys() function 37 | # 38 | # This function deletes the keys that the package would have created using 39 | # the create_tls_keys() function. The directory is also removed if empty 40 | # once the certificate and key were deleted. 41 | # 42 | # param[in] $1 environment name 43 | # param[in] $2 package name 44 | # 45 | delete_tls_keys() { 46 | ENVIRONMENT_NAME=$1 47 | PACKAGE_NAME=$2 48 | 49 | SSL_DIR=/etc/${ENVIRONMENT_NAME}/ssl 50 | rm -f ${SSL_DIR}/${PACKAGE_NAME}.key 51 | rm -f ${SSL_DIR}/${PACKAGE_NAME}.crt 52 | 53 | if test -d ${SSL_DIR} 54 | then 55 | rmdir --ignore-fail-on-non-empty ${SSL_DIR} 56 | fi 57 | } 58 | 59 | 60 | # vim: ts=4 sw=4 et 61 | -------------------------------------------------------------------------------- /snaplogger/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program; if not, write to the Free Software Foundation, Inc., 18 | # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | ## 21 | ## snaplogger daemon project 22 | ## 23 | project(snaploggerd_project) 24 | 25 | add_subdirectory(network) 26 | add_subdirectory(daemon) 27 | add_subdirectory(tools) 28 | add_subdirectory(doc) 29 | 30 | 31 | # vim: ts=4 sw=4 et 32 | -------------------------------------------------------------------------------- /snaplogger/daemon/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program; if not, write to the Free Software Foundation, Inc., 18 | # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | ## 21 | ## snaplogger daemon 22 | ## 23 | project(snaploggerd) 24 | 25 | configure_file( 26 | ${CMAKE_CURRENT_SOURCE_DIR}/version.h.in 27 | ${CMAKE_CURRENT_BINARY_DIR}/version.h 28 | ) 29 | 30 | add_executable(${PROJECT_NAME} 31 | main.cpp 32 | network_component.cpp 33 | snaploggerd.cpp 34 | tcp_logger_connection.cpp 35 | tcp_logger_server.cpp 36 | udp_logger_server.cpp 37 | utils.cpp 38 | version.cpp 39 | ) 40 | 41 | target_include_directories(${PROJECT_NAME} 42 | PUBLIC 43 | ${ADVGETOPT_INCLUDE_DIRS} 44 | ${LIBADDR_INCLUDE_DIRS} 45 | ${LIBEXCEPT_INCLUDE_DIRS} 46 | ${SNAPLOGGER_INCLUDE_DIRS} 47 | ) 48 | 49 | target_link_libraries(${PROJECT_NAME} 50 | eventdispatcher 51 | ${ADVGETOPT_LIBRARIES} 52 | ${LIBADDR_LIBRARIES} 53 | ${LIBEXCEPT_LIBRARIES} 54 | ${SNAPLOGGER_LIBRARIES} 55 | ) 56 | 57 | install( 58 | TARGETS 59 | ${PROJECT_NAME} 60 | 61 | RUNTIME DESTINATION 62 | sbin 63 | ) 64 | 65 | 66 | 67 | # vim: ts=4 sw=4 et 68 | -------------------------------------------------------------------------------- /snaplogger/daemon/controller_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Appenders are used to append data to somewhere. 23 | * 24 | * This file declares the base appender class. 25 | */ 26 | 27 | // eventdispatcher 28 | // 29 | #include 30 | #include 31 | 32 | 33 | 34 | namespace snaplogger_daemon 35 | { 36 | 37 | 38 | class controller_connection 39 | : public ed::tcp_client_permanent_message_connection 40 | { 41 | public: 42 | typedef std::shared_ptr 43 | pointer_t; 44 | 45 | controller_connection(ed::tcp_bio_client::pointer_t client); 46 | virtual ~controller_connection() override; 47 | 48 | private: 49 | ed::dispatcher::pointer_t 50 | f_dispatcher = ed::dispatcher::pointer_t(); 51 | }; 52 | 53 | 54 | } // snaplogger_daemon namespace 55 | // vim: ts=4 sw=4 et 56 | -------------------------------------------------------------------------------- /snaplogger/daemon/network_component.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | 20 | /** \file 21 | * \brief Appenders are used to append data to somewhere. 22 | * 23 | * This file declares the base appender class. 24 | */ 25 | 26 | // self 27 | // 28 | #include "snaplogger/daemon/network_component.h" 29 | 30 | 31 | 32 | // last include 33 | // 34 | #include 35 | 36 | 37 | 38 | namespace snaplogger_daemon 39 | { 40 | 41 | 42 | snaplogger::component::pointer_t g_network_component(snaplogger::get_component(COMPONENT_NETWORK)); 43 | snaplogger::component::pointer_t g_daemon_component(snaplogger::get_component(COMPONENT_DAEMON)); 44 | snaplogger::component::pointer_t g_remote_component(snaplogger::get_component(COMPONENT_REMOTE, { g_daemon_component })); 45 | snaplogger::component::pointer_t g_local_component(snaplogger::get_component(COMPONENT_LOCAL, { g_daemon_component, g_remote_component })); 46 | snaplogger::component::pointer_t g_tcp_component(snaplogger::get_component(COMPONENT_TCP)); 47 | snaplogger::component::pointer_t g_udp_component(snaplogger::get_component(COMPONENT_UDP, { g_tcp_component })); 48 | 49 | 50 | } // snaplogger_daemon namespace 51 | // vim: ts=4 sw=4 et 52 | -------------------------------------------------------------------------------- /snaplogger/daemon/tcp_logger_connection.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Appenders are used to append data to somewhere. 23 | * 24 | * This file declares the base appender class. 25 | */ 26 | 27 | // eventdispatcher 28 | // 29 | #include 30 | #include 31 | 32 | 33 | 34 | namespace snaplogger_daemon 35 | { 36 | 37 | 38 | class tcp_logger_connection 39 | : public ed::tcp_server_client_message_connection 40 | { 41 | public: 42 | typedef std::shared_ptr 43 | pointer_t; 44 | 45 | tcp_logger_connection(ed::tcp_bio_client::pointer_t client); 46 | virtual ~tcp_logger_connection() override; 47 | 48 | void msg_logger_message(ed::message & m); 49 | 50 | private: 51 | ed::dispatcher::pointer_t f_dispatcher = ed::dispatcher::pointer_t(); 52 | }; 53 | 54 | 55 | } // snaplogger_daemon namespace 56 | // vim: ts=4 sw=4 et 57 | -------------------------------------------------------------------------------- /snaplogger/daemon/tcp_logger_server.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | /** \file 22 | * \brief The declaration of the TCP logger server. 23 | * 24 | * This file declares the TCP logger server which listens for clients 25 | * to connect and send us LOG_MESSAGE messages. 26 | */ 27 | 28 | // eventdispatcher 29 | // 30 | #include 31 | #include 32 | 33 | 34 | 35 | namespace snaplogger_daemon 36 | { 37 | 38 | 39 | class tcp_logger_server 40 | : public ed::tcp_server_connection 41 | { 42 | public: 43 | typedef std::shared_ptr 44 | pointer_t; 45 | 46 | tcp_logger_server(addr::addr const & listen); 47 | virtual ~tcp_logger_server() override; 48 | 49 | // tcp_server_connection implementation 50 | // 51 | void process_accept(); 52 | 53 | private: 54 | ed::communicator::pointer_t f_communicator; 55 | }; 56 | 57 | 58 | } // snaplogger_daemon namespace 59 | // vim: ts=4 sw=4 et 60 | -------------------------------------------------------------------------------- /snaplogger/daemon/udp_logger_server.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Appenders are used to append data to somewhere. 23 | * 24 | * This file declares the base appender class. 25 | */ 26 | 27 | // libaddr 28 | // 29 | #include 30 | 31 | 32 | // eventdispatcher 33 | // 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | 40 | 41 | namespace snaplogger_daemon 42 | { 43 | 44 | 45 | class udp_logger_server 46 | : public ed::udp_server_message_connection 47 | { 48 | public: 49 | typedef std::shared_ptr 50 | pointer_t; 51 | 52 | udp_logger_server( 53 | addr::addr const & listen 54 | , std::string const & secret_code); 55 | virtual ~udp_logger_server() override; 56 | 57 | void msg_logger_message(ed::message & m); 58 | 59 | private: 60 | ed::dispatcher::pointer_t f_dispatcher = ed::dispatcher::pointer_t(); 61 | }; 62 | 63 | 64 | } // snaplogger_daemon namespace 65 | // vim: ts=4 sw=4 et 66 | -------------------------------------------------------------------------------- /snaplogger/daemon/utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | /** \file 22 | * \brief A few useful functions and structures. 23 | * 24 | * A few complementary functions and structures. 25 | */ 26 | 27 | // snaplogger 28 | // 29 | #include 30 | 31 | 32 | // eventdispatcher 33 | // 34 | #include 35 | 36 | 37 | 38 | namespace snaplogger_daemon 39 | { 40 | 41 | 42 | snaplogger::message::pointer_t ed_message_to_log_message(ed::message const & message); 43 | 44 | 45 | } // snaplogger_daemon namespace 46 | // vim: ts=4 sw=4 et 47 | -------------------------------------------------------------------------------- /snaplogger/daemon/version.h.in: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Definitions of the snaplogger network extension version. 23 | * 24 | * This header includes the snaplogger library version and functions you 25 | * can use to check the current version of the library. 26 | */ 27 | 28 | 29 | #define SNAPLOGGERD_VERSION_MAJOR @EVENTDISPATCHER_VERSION_MAJOR@ 30 | #define SNAPLOGGERD_VERSION_MINOR @EVENTDISPATCHER_VERSION_MINOR@ 31 | #define SNAPLOGGERD_VERSION_PATCH @EVENTDISPATCHER_VERSION_PATCH@ 32 | #define SNAPLOGGERD_VERSION_STRING "@EVENTDISPATCHER_VERSION_MAJOR@.@EVENTDISPATCHER_VERSION_MINOR@.@EVENTDISPATCHER_VERSION_PATCH@" 33 | 34 | namespace snaplogger_daemon 35 | { 36 | 37 | 38 | int get_major_version(); 39 | int get_release_version(); 40 | int get_patch_version(); 41 | char const * get_version_string(); 42 | 43 | 44 | 45 | } // snaplogger_daemon namespace 46 | // vim: ts=4 sw=4 et 47 | -------------------------------------------------------------------------------- /snaplogger/doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License along 17 | # with this program; if not, write to the Free Software Foundation, Inc., 18 | # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | 21 | ## 22 | ## Documentation 23 | ## 24 | find_package(SnapDoxygen) 25 | AddDoxygenTarget(snaplogger-network 26 | ${EVENTDISPATCHER_VERSION_MAJOR} 27 | ${EVENTDISPATCHER_VERSION_MINOR} 28 | ${EVENTDISPATCHER_VERSION_PATCH} 29 | ) 30 | 31 | # vim: ts=4 sw=4 et 32 | -------------------------------------------------------------------------------- /snaplogger/doc/footer.html: -------------------------------------------------------------------------------- 1 |
2 |

This document is part of the Snap! Websites Project.

3 |

Copyright by Made to Order Software Corp.

4 |
5 | -------------------------------------------------------------------------------- /snaplogger/doc/snaplogger-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/m2osw/eventdispatcher/6e4e850646e3c171af5685799d8d6e2bf40ce4a4/snaplogger/doc/snaplogger-network.png -------------------------------------------------------------------------------- /snaplogger/network/message-definitions/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program. If not, see . 18 | 19 | project(snaploggernetwork_message_definitions) 20 | 21 | install( 22 | DIRECTORY 23 | ${CMAKE_CURRENT_SOURCE_DIR}/ 24 | 25 | DESTINATION 26 | # The variable is our own so it's not available here 27 | #${EVENTDISPATCHER_SHARE_MESSAGE_DEFINITIONS_CONF_DIR} 28 | share/eventdispatcher/messages 29 | 30 | FILES_MATCHING PATTERN 31 | "*.conf" 32 | ) 33 | 34 | # vim: ts=4 sw=4 et 35 | -------------------------------------------------------------------------------- /snaplogger/network/message-definitions/LOG.conf: -------------------------------------------------------------------------------- 1 | # LOG parameters 2 | 3 | [severity] 4 | description = severity of log message (debug, info, error, fatal...) 5 | flags = optional 6 | 7 | [timestamp] 8 | description = the time when the log was generated 9 | type = timespec 10 | flags = required 11 | 12 | [filename] 13 | description = the source file that generated the log entry 14 | flags = optional 15 | 16 | [function] 17 | description = the funcion in which the log was generated 18 | flags = optional 19 | 20 | [line] 21 | description = the line number on which the log was generated 22 | flags = optional 23 | 24 | [column] 25 | description = the column number at which the log was generated 26 | flags = optional 27 | 28 | [recursive] 29 | description = whether the log message is recursive 30 | flags = optional 31 | 32 | [components] 33 | description = a list of components (groups) 34 | flags = optional 35 | 36 | [message] 37 | description = the actual log message 38 | flags = required 39 | 40 | [fields] 41 | description = a list of named values 42 | flags = optional 43 | 44 | # vim: syntax=dosini 45 | -------------------------------------------------------------------------------- /snaplogger/network/snaplogger_network.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2006-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | 20 | // self 21 | // 22 | #include "snaplogger_network.h" 23 | 24 | 25 | // serverplugins 26 | // 27 | #include "serverplugins/factory.h" 28 | 29 | 30 | // last include 31 | // 32 | #include 33 | 34 | 35 | 36 | namespace snaplogger_network 37 | { 38 | 39 | 40 | SERVERPLUGINS_START(snaplogger_network) 41 | , ::serverplugins::description("snaplogger network plugin extension to allow sending log messages to other servers via TCP or UDP.") 42 | , ::serverplugins::help_uri("https://snapwebsites.org/project/eventdispatcher") 43 | , ::serverplugins::categorization_tag("snaplogger") 44 | , ::serverplugins::categorization_tag("network") 45 | SERVERPLUGINS_END(snaplogger_network) 46 | 47 | 48 | 49 | } // optional_namespace namespace 50 | // vim: ts=4 sw=4 et 51 | -------------------------------------------------------------------------------- /snaplogger/network/snaplogger_network.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | // serverplugins 22 | // 23 | #include 24 | 25 | 26 | 27 | namespace snaplogger_network 28 | { 29 | 30 | 31 | 32 | SERVERPLUGINS_VERSION(snaplogger_network, 1, 0) 33 | 34 | 35 | /** \brief The Snap! Logger Network plugin class. 36 | * 37 | * All plugins must have a plugin instance which gets created on load. 38 | * Without this, the plugin loader fails. At this time, there is no other 39 | * use for this class. 40 | */ 41 | class snaplogger_network 42 | : public serverplugins::plugin 43 | { 44 | public: 45 | SERVERPLUGINS_DEFAULTS(snaplogger_network); 46 | 47 | private: 48 | }; 49 | 50 | 51 | 52 | } // namespace snaplogger_network 53 | // vim: ts=4 sw=4 et 54 | -------------------------------------------------------------------------------- /snaplogger/network/udp_appender.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Declaration of a UDP appender to send messages to a server. 23 | * 24 | * This file declares the UDP appender one can use to send messages to 25 | * a snaploggerd server. The UDP protocol is very light and can be used 26 | * without the need to support acknowledgements. 27 | */ 28 | 29 | // self 30 | // 31 | #include "base_network_appender.h" 32 | 33 | 34 | 35 | 36 | 37 | namespace snaplogger_network 38 | { 39 | 40 | 41 | class udp_appender 42 | : public base_network_appender 43 | { 44 | public: 45 | typedef std::shared_ptr pointer_t; 46 | 47 | udp_appender(std::string const & name); 48 | virtual ~udp_appender() override; 49 | 50 | // appender implementation 51 | // 52 | virtual void set_config(advgetopt::getopt const & params) override; 53 | 54 | protected: 55 | virtual void process_message( 56 | snaplogger::message const & msg 57 | , std::string const & formatted_message) override; 58 | 59 | private: 60 | std::string f_secret_code = std::string(); 61 | }; 62 | 63 | 64 | } // snaplogger_network namespace 65 | // vim: ts=4 sw=4 et 66 | -------------------------------------------------------------------------------- /snaplogger/network/version.h.in: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 | #pragma once 20 | 21 | /** \file 22 | * \brief Definitions of the snaplogger network extension version. 23 | * 24 | * This header includes the snaplogger library version and functions you 25 | * can use to check the current version of the library. 26 | */ 27 | 28 | 29 | #define SNAPLOGGER_NETWORK_VERSION_MAJOR @EVENTDISPATCHER_VERSION_MAJOR@ 30 | #define SNAPLOGGER_NETWORK_VERSION_MINOR @EVENTDISPATCHER_VERSION_MINOR@ 31 | #define SNAPLOGGER_NETWORK_VERSION_PATCH @EVENTDISPATCHER_VERSION_PATCH@ 32 | #define SNAPLOGGER_NETWORK_VERSION_STRING "@EVENTDISPATCHER_VERSION_MAJOR@.@EVENTDISPATCHER_VERSION_MINOR@.@EVENTDISPATCHER_VERSION_PATCH@" 33 | 34 | namespace snaplogger_network 35 | { 36 | 37 | 38 | int get_major_version(); 39 | int get_release_version(); 40 | int get_patch_version(); 41 | char const * get_version_string(); 42 | 43 | 44 | 45 | } // snaplogger_network namespace 46 | // vim: ts=4 sw=4 et 47 | -------------------------------------------------------------------------------- /snaplogger/tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | # 3 | # https://snapwebsites.org/project/eventdispatcher 4 | # contact@m2osw.com 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; if not, write to the Free Software 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | ## 21 | ## snaplog command line tool 22 | ## 23 | project(snaplog) 24 | 25 | add_executable(${PROJECT_NAME} 26 | snaplog.cpp 27 | ) 28 | 29 | target_include_directories(${PROJECT_NAME} 30 | PUBLIC 31 | ${ADVGETOPT_INCLUDE_DIRS} 32 | ) 33 | 34 | target_link_libraries(${PROJECT_NAME} 35 | eventdispatcher 36 | ) 37 | 38 | install( 39 | TARGETS 40 | ${PROJECT_NAME} 41 | 42 | RUNTIME DESTINATION 43 | bin 44 | ) 45 | 46 | 47 | # vim: ts=4 sw=4 et 48 | -------------------------------------------------------------------------------- /tests/catch_main.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License 17 | // along with this program; if not, write to the Free Software 18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | #pragma once 20 | 21 | // catch2 22 | // 23 | #include 24 | 25 | 26 | // snapdev 27 | // 28 | #include 29 | 30 | 31 | // C++ 32 | // 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | 39 | 40 | namespace SNAP_CATCH2_NAMESPACE 41 | { 42 | 43 | 44 | 45 | extern char ** g_argv; 46 | 47 | 48 | 49 | inline char32_t rand_char(bool full_range = false) 50 | { 51 | char32_t const max((full_range ? 0x0110000 : 0x0010000) - (0xE000 - 0xD800)); 52 | 53 | char32_t wc; 54 | do 55 | { 56 | wc = ((rand() << 16) ^ rand()) % max; 57 | } 58 | while(wc == 0); 59 | if(wc >= 0xD800) 60 | { 61 | // skip the surrogates 62 | // 63 | wc += 0xE000 - 0xD800; 64 | } 65 | 66 | return wc; 67 | } 68 | 69 | 70 | inline std::string get_tmp_dir(std::string const & subdir) 71 | { 72 | std::string const & tmp_dir(SNAP_CATCH2_NAMESPACE::g_tmp_dir() + "/" + subdir); 73 | 74 | CATCH_REQUIRE(snapdev::mkdir_p(tmp_dir, false, 0700) == 0); 75 | 76 | return tmp_dir; 77 | } 78 | 79 | 80 | 81 | 82 | } 83 | // namespace SNAP_CATCH2_NAMESPACE 84 | // vim: ts=4 sw=4 et 85 | -------------------------------------------------------------------------------- /tests/certificate/snakeoil.csr: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIFBDCCAuwCAQAwgb4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlh 3 | MRQwEgYDVQQHDAtMb3MgQW5nZWxlczErMCkGA1UECgwiTWFkZSB0byBPcmRlciBT 4 | b2Z0d2FyZSBDb3Jwb3JhdGlvbjEdMBsGA1UECwwUU29mdHdhcmUgRGV2ZWxvcG1l 5 | bnQxFDASBgNVBAMMC2V4YW1wbGUubmV0MSIwIAYJKoZIhvcNAQkBFhNjb250YWN0 6 | QGV4YW1wbGUubmV0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsGpl 7 | gPIk8zdsoi8BJPPCQ3ZinI9GUmjtWdgxqIOc8GcXXCr/1R06krzu6hYdsl5W9PMg 8 | DNkg9JnpYZ1JpM9r/ctRYf1zvh0a0Z4LsH8xT+PILpRen1S+rmCS9GiV1KvPXa+/ 9 | sVeVdRxH+JoM4RStWPdOnDRUEPxen0Gdam+B4JgOhguuHCciOWCOdGr4vB4eno1X 10 | FpXM3lSwnOYSPl/YRM8V0kbUKQW6DCIFJUZSSa30vXv7T5O8Jgex9mDL54V3d26F 11 | oMPLCvOHA6wlB6EMw96g49F57zD6Bczbt+bAz1jC6FDXI9iAB6Hr1Ti4l3Q8sxIE 12 | lZP5+ZdzKcooOjn5TFpvthELqXRtCmx3ShqYIFlJG7ly4ihKN3ffT7timxAQRg5Z 13 | 4G2ha//Lhb+QCjxjU+Wm+Cm8k5HPom6uYW8s7ZJYjw1dI9vnbswYBtZIgTv57dPM 14 | PDO3W3OpviDf3wGCMMUzpJSfk66zOfZmC8YuMM3fEP4qBKnZhjJLYkJbF4scWrkS 15 | EmG3NI2z58TeNAzLgUAWsdlMcHldMI64x0vQoSoZ4Xsy6qYyDJm24DNYFEs4NZp4 16 | nROC9KJRG1pjycfm2QxEtGZoH3vzgx/kJu5/bLtJvyY7k8mhU/mMvLtG6xXpivV4 17 | zIhNdHBnad1znIkzEaqzG7zUXBcQacFejIKP+VsCAwEAAaAAMA0GCSqGSIb3DQEB 18 | CwUAA4ICAQCGhH+7Poc06WCTC7gnHvljXo5EajcBXjvgwQY5l+UnqLpu/E8PjS3v 19 | Um2nVzDG+GbR+1t0kxmKCUo2uX3hB9pJaHN/yBRi5sgMqqmDsCpeRkNmrACVUqjc 20 | x7mBQxFvZ6vsE1aEyRYmg7HmPP4zmoJbSVJBKDUMBXkeNGoXvAuimy7MBUjULtPD 21 | 5N5q1Xeoq3EGUoYZihXgAkU72Lh268UeuN1iM8U4/QbzKh2cSqd6fju9lADmJC4C 22 | 9q16qbyNxI45xuJT5L3FZ9xjNS1DdLHB3WZekUoH/ZbVfUWTFGnoId+linpDGxcC 23 | klvq6DV+DvB/uHV1zKW+3Ef/EZ6yq0I+DpLAzXsVbQV+HicVXvbbj5wkwBFpkIOs 24 | 5wCqxDbgzb/C77/S7C5NJeKJ9pYhGxywD6Vre4EzJDqnt0GsZm2M7Qft8puINkgF 25 | hjEnmDVR4HnaxRxsT3Iz0p3zljMg+yWmREQfPrHi7mqrY7jG0fbJI+XVf4yZHlMS 26 | 6hykHPdC9tLdpi10ABETVtpu+nN8o+CZSZll4W4Tee9YntYYI57qjnwpn4tHEpE0 27 | o6+CbXGaWlIEkOU3qHnPHp2fkuTT2m0R8KxyefMnuHLRA5jhYxW2roENPB0llvWb 28 | GnqErFVrMSzNDCl3L/Y/E7gQcrpvQWwPQ1hgsFA6osidWOiu/cs9VQ== 29 | -----END CERTIFICATE REQUEST----- 30 | -------------------------------------------------------------------------------- /tests/certificate/snakeoil.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIGBTCCA+0CFEV6z46F7MPJQ4FjuJeBJdZv2U5QMA0GCSqGSIb3DQEBCwUAMIG+ 3 | MQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEUMBIGA1UEBwwLTG9z 4 | IEFuZ2VsZXMxKzApBgNVBAoMIk1hZGUgdG8gT3JkZXIgU29mdHdhcmUgQ29ycG9y 5 | YXRpb24xHTAbBgNVBAsMFFNvZnR3YXJlIERldmVsb3BtZW50MRQwEgYDVQQDDAtl 6 | eGFtcGxlLm5ldDEiMCAGCSqGSIb3DQEJARYTY29udGFjdEBleGFtcGxlLm5ldDAe 7 | Fw0yNTAyMDEwMTA1MThaFw0yNjAyMDEwMTA1MThaMIG+MQswCQYDVQQGEwJVUzET 8 | MBEGA1UECAwKQ2FsaWZvcm5pYTEUMBIGA1UEBwwLTG9zIEFuZ2VsZXMxKzApBgNV 9 | BAoMIk1hZGUgdG8gT3JkZXIgU29mdHdhcmUgQ29ycG9yYXRpb24xHTAbBgNVBAsM 10 | FFNvZnR3YXJlIERldmVsb3BtZW50MRQwEgYDVQQDDAtleGFtcGxlLm5ldDEiMCAG 11 | CSqGSIb3DQEJARYTY29udGFjdEBleGFtcGxlLm5ldDCCAiIwDQYJKoZIhvcNAQEB 12 | BQADggIPADCCAgoCggIBALBqZYDyJPM3bKIvASTzwkN2YpyPRlJo7VnYMaiDnPBn 13 | F1wq/9UdOpK87uoWHbJeVvTzIAzZIPSZ6WGdSaTPa/3LUWH9c74dGtGeC7B/MU/j 14 | yC6UXp9Uvq5gkvRoldSrz12vv7FXlXUcR/iaDOEUrVj3Tpw0VBD8Xp9BnWpvgeCY 15 | DoYLrhwnIjlgjnRq+LweHp6NVxaVzN5UsJzmEj5f2ETPFdJG1CkFugwiBSVGUkmt 16 | 9L17+0+TvCYHsfZgy+eFd3duhaDDywrzhwOsJQehDMPeoOPRee8w+gXM27fmwM9Y 17 | wuhQ1yPYgAeh69U4uJd0PLMSBJWT+fmXcynKKDo5+Uxab7YRC6l0bQpsd0oamCBZ 18 | SRu5cuIoSjd330+7YpsQEEYOWeBtoWv/y4W/kAo8Y1PlpvgpvJORz6JurmFvLO2S 19 | WI8NXSPb527MGAbWSIE7+e3TzDwzt1tzqb4g398BgjDFM6SUn5Ouszn2ZgvGLjDN 20 | 3xD+KgSp2YYyS2JCWxeLHFq5EhJhtzSNs+fE3jQMy4FAFrHZTHB5XTCOuMdL0KEq 21 | GeF7MuqmMgyZtuAzWBRLODWaeJ0TgvSiURtaY8nH5tkMRLRmaB9784Mf5Cbuf2y7 22 | Sb8mO5PJoVP5jLy7RusV6Yr1eMyITXRwZ2ndc5yJMxGqsxu81FwXEGnBXoyCj/lb 23 | AgMBAAEwDQYJKoZIhvcNAQELBQADggIBAFQiNZ8ZBf+KsuzRTEixuqluP10vAw9z 24 | gdTANaJRHrHiDzLKim6+SREFy0jCTcK5JDY9EjxqpugtgHMBgHuSgyt3ySkiN953 25 | Se/bhx+8FjRsKAi1zFwFv8vaY8o3Ppe1v2CucU79GYKIOlAw5Tdlxn7O6Fqeu1DX 26 | JminGJszl3c54CSKISfYQn3NzlZYVYfVr0dHGK93k6yCgAI6zQnZc0dVUvJt98CQ 27 | W2dpyPzSO1c1QlLItt4bnVb7zrYt9zll2/S7phJbIuHiYIgxthU132TUf4Hat6Ag 28 | I+KefraA45KigJ46ELO5INMdRc+CDbH4vmWWWDavu/X3ebT/a7nYbqVqxNa/z/KW 29 | Cx2bzhK0DqUZLgVcUYEK0BZcodmZ5UOUqzCFrayBLgw47Oa4rvG/tr5PjWlDfGZz 30 | cqafBF923CBeMe+b+uinUYWxFhsq+kUiQxrS5XIFsb6W5dWi1RaW2Vx54vqhDat/ 31 | lWtfdzcygBYRwhunMuqjXiaSs4SeDvg5YqdET6mKtQzj4a/xRiXhL5RWc5L1n9/w 32 | QiC0GImFkSUZXOyymFJj1VfVQVfjftkbn3tyxl6ngPpFGsJ6zugd8C/vvLW2P8sb 33 | OXuZqpVBo93ustAS8NBDHHuSRkZGDChmVBSBNDIFr7DkxBPkwx/F9XxbnSnh/ccC 34 | Koq3ki7yLGeJ 35 | -----END CERTIFICATE----- 36 | -------------------------------------------------------------------------------- /tests/check_dispatcher_without_command.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012-2025 Made to Order Software Corp. All Rights Reserved 2 | // 3 | // https://snapwebsites.org/project/eventdispatcher 4 | // contact@m2osw.com 5 | // 6 | // This program is free software; you can redistribute it and/or modify 7 | // it under the terms of the GNU General Public License as published by 8 | // the Free Software Foundation; either version 2 of the License, or 9 | // (at your option) any later version. 10 | // 11 | // This program is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU General Public License along 17 | // with this program; if not, write to the Free Software Foundation, Inc., 18 | // 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 | 20 | #include 21 | 22 | int main() 23 | { 24 | ::ed::define_match(::ed::Expression("REGISTER")); 25 | return 0; 26 | } 27 | -------------------------------------------------------------------------------- /tests/message-definitions/DOWN.conf: -------------------------------------------------------------------------------- 1 | # DOWN parameters 2 | 3 | description = used in some unit tests to similate messages between client & server 4 | 5 | #[data] 6 | #description = a parameter 7 | #flags = optional 8 | 9 | # vim: syntax=dosini 10 | -------------------------------------------------------------------------------- /tests/message-definitions/HELLO.conf: -------------------------------------------------------------------------------- 1 | # HELLO parameters 2 | 3 | description = used in some unit tests to similate messages between client & server 4 | 5 | [data] 6 | description = a parameter 7 | flags = optional 8 | 9 | # vim: syntax=dosini 10 | -------------------------------------------------------------------------------- /tests/message-definitions/HI.conf: -------------------------------------------------------------------------------- 1 | # HI parameters 2 | 3 | description = used in some unit tests to similate messages between client & server 4 | 5 | #[data] 6 | #description = a parameter 7 | #flags = optional 8 | 9 | # vim: syntax=dosini 10 | -------------------------------------------------------------------------------- /tests/rprtr/test_load_with_create_lexer.rprtr: -------------------------------------------------------------------------------- 1 | // This file gets loaded by a test to verify the create_lexer() function 2 | // 3 | 4 | print(message: "it worked.") 5 | 6 | -------------------------------------------------------------------------------- /tests/sanitizer-options.sh: -------------------------------------------------------------------------------- 1 | # Additional options for the sanitizer 2 | # 3 | #export ASAN_OPTIONS=detect_leaks=1 4 | #export LSAN_OPTIONS=suppressions=${SOURCE}/tests/suppress-leaks.txt 5 | -------------------------------------------------------------------------------- /tests/suppress-leaks.txt: -------------------------------------------------------------------------------- 1 | leak:^CRYPTO_zalloc$ 2 | leak:^BIO_lookup_ex$ 3 | leak:^CRYPTO_strdup$ 4 | leak:^CRYPTO_strndup$ 5 | --------------------------------------------------------------------------------