PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
rest_server.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
19#pragma once
20
21#include "rest_config.h"
22
23#include <cstdint>
24#include <memory>
25
26// Forward declarations for PACS monitoring
28class health_checker;
29class pacs_metrics;
30} // namespace kcenon::pacs::monitoring
31
32namespace kcenon::pacs::security {
33class access_control_manager;
34} // namespace kcenon::pacs::security
35
37struct oauth2_config;
38class oauth2_middleware;
39class jwks_provider;
40} // namespace kcenon::pacs::web::auth
41
42namespace kcenon::pacs::storage {
43class index_database;
44class file_storage;
45} // namespace kcenon::pacs::storage
46
47namespace kcenon::pacs::network {
48class dicom_server;
49} // namespace kcenon::pacs::network
50
51namespace kcenon::pacs::client {
52class remote_node_manager;
53class job_manager;
54class routing_manager;
55} // namespace kcenon::pacs::client
56
57namespace kcenon::pacs::web {
58
86public:
91
96 explicit rest_server(const rest_server_config &config);
97
101 ~rest_server();
102
104 rest_server(const rest_server &) = delete;
106
108 rest_server(rest_server &&other) noexcept;
110
111 // =========================================================================
112 // Configuration
113 // =========================================================================
114
119 [[nodiscard]] const rest_server_config &config() const noexcept;
120
126
127 // =========================================================================
128 // Integration
129 // =========================================================================
130
135 void set_health_checker(std::shared_ptr<monitoring::health_checker> checker);
136
145 void set_metrics_provider(std::shared_ptr<monitoring::pacs_metrics> metrics);
146
152 std::shared_ptr<security::access_control_manager> manager);
153
158 void set_database(std::shared_ptr<storage::index_database> database);
159
164 void set_file_storage(std::shared_ptr<storage::file_storage> storage);
165
170 void set_node_manager(std::shared_ptr<client::remote_node_manager> manager);
171
176 void set_job_manager(std::shared_ptr<client::job_manager> manager);
177
182 void set_routing_manager(std::shared_ptr<client::routing_manager> manager);
183
188 void set_dicom_server(std::shared_ptr<network::dicom_server> server);
189
195 std::shared_ptr<auth::oauth2_middleware> middleware);
196
197 // =========================================================================
198 // Lifecycle
199 // =========================================================================
200
206 void start();
207
213 void start_async();
214
220 void stop();
221
226 [[nodiscard]] bool is_running() const noexcept;
227
234 void wait();
235
240 [[nodiscard]] std::uint16_t port() const noexcept;
241
242private:
243 struct impl;
244 std::unique_ptr<impl> impl_;
245};
246
247} // namespace kcenon::pacs::web
REST API server for PACS administration and monitoring.
Definition rest_server.h:85
rest_server & operator=(rest_server &&other) noexcept
void start_async()
Start the server (non-blocking)
void set_routing_manager(std::shared_ptr< client::routing_manager > manager)
Set routing manager for auto-forwarding rules.
void set_oauth2_middleware(std::shared_ptr< auth::oauth2_middleware > middleware)
Set OAuth 2.0 middleware for DICOMweb endpoint authorization.
void set_node_manager(std::shared_ptr< client::remote_node_manager > manager)
Set remote node manager for remote PACS node management.
rest_server()
Construct REST server with default configuration.
void set_health_checker(std::shared_ptr< monitoring::health_checker > checker)
Set health checker for /api/v1/system/status endpoint.
bool is_running() const noexcept
Check if server is currently running.
void set_access_control_manager(std::shared_ptr< security::access_control_manager > manager)
Set access control manager for security.
void set_dicom_server(std::shared_ptr< network::dicom_server > server)
Set DICOM server for live association management.
void set_job_manager(std::shared_ptr< client::job_manager > manager)
Set job manager for async DICOM operations.
const rest_server_config & config() const noexcept
Get current configuration.
rest_server(rest_server &&other) noexcept
Movable.
void wait()
Wait for server to stop.
rest_server & operator=(const rest_server &)=delete
void stop()
Stop the server.
void set_config(const rest_server_config &config)
Update configuration (requires restart to apply)
rest_server(const rest_server &)=delete
Non-copyable.
void start()
Start the server (blocking)
void set_file_storage(std::shared_ptr< storage::file_storage > storage)
Set file storage for DICOM instance persistence (STOW-RS)
void set_database(std::shared_ptr< storage::index_database > database)
Set index database for patient/study/series endpoints.
~rest_server()
Destructor - stops server if running.
void set_metrics_provider(std::shared_ptr< monitoring::pacs_metrics > metrics)
Set metrics provider for /api/v1/system/metrics endpoint.
std::uint16_t port() const noexcept
Get the actual port the server is listening on.
std::unique_ptr< impl > impl_
Configuration for REST API server.
Implementation details for rest_server.
Configuration options for the REST server.
Definition rest_config.h:29