|
PACS System 0.1.0
PACS DICOM system library
|
Sends ATNA audit messages via Syslog protocol. More...
#include <atna_syslog_transport.h>

Classes | |
| struct | tls_context |
Public Member Functions | |
| atna_syslog_transport (const syslog_transport_config &config) | |
| Construct transport with configuration. | |
| ~atna_syslog_transport () | |
| atna_syslog_transport (const atna_syslog_transport &)=delete | |
| atna_syslog_transport & | operator= (const atna_syslog_transport &)=delete |
| atna_syslog_transport (atna_syslog_transport &&other) noexcept | |
| atna_syslog_transport & | operator= (atna_syslog_transport &&other) noexcept |
| kcenon::pacs::VoidResult | send (const std::string &xml_message) |
| Send an RFC 3881 XML audit message via Syslog. | |
| std::string | format_syslog_message (const std::string &xml_message) const |
| Format an XML audit message as an RFC 5424 Syslog message. | |
| bool | is_connected () const noexcept |
| Check if the transport is connected (TLS only) | |
| void | close () |
| Close the transport connection. | |
| size_t | messages_sent () const noexcept |
| size_t | send_errors () const noexcept |
| void | reset_statistics () noexcept |
| const syslog_transport_config & | config () const noexcept |
Private Types | |
| using | socket_type = int |
Private Member Functions | |
| kcenon::pacs::VoidResult | send_udp (const std::string &syslog_message) |
| kcenon::pacs::VoidResult | send_tls (const std::string &syslog_message) |
| kcenon::pacs::VoidResult | ensure_tls_connected () |
Static Private Member Functions | |
| static std::string | get_local_hostname () |
| static std::string | get_timestamp () |
| static uint8_t | compute_priority (syslog_facility facility, syslog_severity severity) |
Private Attributes | |
| syslog_transport_config | config_ |
| socket_type | socket_ {invalid_socket} |
| tls_context * | tls_ {nullptr} |
| std::atomic< size_t > | messages_sent_ {0} |
| std::atomic< size_t > | send_errors_ {0} |
Static Private Attributes | |
| static constexpr socket_type | invalid_socket = -1 |
Sends ATNA audit messages via Syslog protocol.
Formats RFC 3881 XML audit messages into RFC 5424 Syslog messages and sends them to an Audit Record Repository via UDP or TLS.
Definition at line 164 of file atna_syslog_transport.h.
|
private |
Definition at line 274 of file atna_syslog_transport.h.
|
explicit |
Construct transport with configuration.
| config | Transport configuration |
Definition at line 91 of file atna_syslog_transport.cpp.
References config_, and kcenon::pacs::security::syslog_transport_config::hostname.
| kcenon::pacs::security::atna_syslog_transport::~atna_syslog_transport | ( | ) |
Definition at line 99 of file atna_syslog_transport.cpp.
References close().

|
delete |
|
noexcept |
Definition at line 103 of file atna_syslog_transport.cpp.
References kcenon::pacs::security::other.
| void kcenon::pacs::security::atna_syslog_transport::close | ( | ) |
Close the transport connection.
For TLS, performs graceful shutdown. For UDP, closes the socket.
Definition at line 195 of file atna_syslog_transport.cpp.
References invalid_socket, socket_, and tls_.
Referenced by ensure_tls_connected(), send_tls(), and ~atna_syslog_transport().

|
staticnodiscardprivate |
Definition at line 487 of file atna_syslog_transport.cpp.
Referenced by format_syslog_message().

|
nodiscardnoexcept |
Definition at line 222 of file atna_syslog_transport.cpp.
References config_.
|
nodiscardprivate |
Definition at line 320 of file atna_syslog_transport.cpp.
References kcenon::pacs::security::syslog_transport_config::ca_cert_path, kcenon::pacs::security::syslog_transport_config::client_cert_path, kcenon::pacs::security::syslog_transport_config::client_key_path, close(), config_, kcenon::pacs::error_codes::connection_failed, kcenon::pacs::security::syslog_transport_config::host, invalid_socket, kcenon::pacs::pacs_void_error(), kcenon::pacs::security::syslog_transport_config::port, socket_, tls_, and kcenon::pacs::security::syslog_transport_config::verify_server.
Referenced by send_tls().


|
nodiscard |
Format an XML audit message as an RFC 5424 Syslog message.
Produces the complete Syslog message without sending it. Useful for testing and logging.
| xml_message | The audit XML payload |
Definition at line 159 of file atna_syslog_transport.cpp.
References kcenon::pacs::security::syslog_transport_config::app_name, compute_priority(), config_, kcenon::pacs::security::syslog_transport_config::facility, get_timestamp(), kcenon::pacs::security::syslog_transport_config::hostname, and kcenon::pacs::security::syslog_transport_config::severity.
Referenced by send().


|
staticnodiscardprivate |
Definition at line 456 of file atna_syslog_transport.cpp.
|
staticnodiscardprivate |
Definition at line 465 of file atna_syslog_transport.cpp.
Referenced by format_syslog_message().

|
nodiscardnoexcept |
Check if the transport is connected (TLS only)
For UDP, always returns true since UDP is connectionless.
Definition at line 188 of file atna_syslog_transport.cpp.
References config_, invalid_socket, kcenon::pacs::security::syslog_transport_config::protocol, socket_, tls_, and kcenon::pacs::security::udp.
|
nodiscardnoexcept |
Definition at line 209 of file atna_syslog_transport.cpp.
References messages_sent_.
|
noexcept |
Definition at line 114 of file atna_syslog_transport.cpp.
References kcenon::pacs::security::other.
|
delete |
|
noexcept |
Definition at line 217 of file atna_syslog_transport.cpp.
References messages_sent_, and send_errors_.
|
nodiscard |
Send an RFC 3881 XML audit message via Syslog.
Wraps the XML payload in an RFC 5424 Syslog message and sends it to the configured Audit Record Repository.
| xml_message | RFC 3881 XML audit message string |
Definition at line 137 of file atna_syslog_transport.cpp.
References config_, format_syslog_message(), messages_sent_, kcenon::pacs::security::syslog_transport_config::protocol, send_errors_, send_tls(), send_udp(), and kcenon::pacs::security::tls.
Referenced by kcenon::pacs::security::atna_service_auditor::send_audit().


|
nodiscardnoexcept |
Definition at line 213 of file atna_syslog_transport.cpp.
References send_errors_.
|
nodiscardprivate |
Definition at line 285 of file atna_syslog_transport.cpp.
References close(), kcenon::pacs::error_codes::connection_failed, ensure_tls_connected(), kcenon::pacs::pacs_void_error(), kcenon::pacs::error_codes::send_failed, and tls_.
Referenced by send().


|
nodiscardprivate |
Definition at line 230 of file atna_syslog_transport.cpp.
References config_, kcenon::pacs::error_codes::connection_failed, kcenon::pacs::security::syslog_transport_config::host, invalid_socket, kcenon::pacs::pacs_void_error(), kcenon::pacs::security::syslog_transport_config::port, and kcenon::pacs::error_codes::send_failed.
Referenced by send().


|
private |
Definition at line 267 of file atna_syslog_transport.h.
Referenced by atna_syslog_transport(), config(), ensure_tls_connected(), format_syslog_message(), is_connected(), send(), and send_udp().
|
staticconstexprprivate |
Definition at line 275 of file atna_syslog_transport.h.
Referenced by close(), ensure_tls_connected(), is_connected(), and send_udp().
|
private |
Definition at line 283 of file atna_syslog_transport.h.
Referenced by messages_sent(), reset_statistics(), and send().
|
private |
Definition at line 284 of file atna_syslog_transport.h.
Referenced by reset_statistics(), send(), and send_errors().
|
private |
Definition at line 277 of file atna_syslog_transport.h.
Referenced by close(), ensure_tls_connected(), and is_connected().
|
private |
Definition at line 281 of file atna_syslog_transport.h.
Referenced by close(), ensure_tls_connected(), is_connected(), and send_tls().