comparison OrthancFramework/Sources/DicomNetworking/DicomServer.h @ 4044:d25f4c0fa160 framework

splitting code into OrthancFramework and OrthancServer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Jun 2020 20:30:34 +0200
parents Core/DicomNetworking/DicomServer.h@4f78da5613a1
children bf7b9edf6b81
comparison
equal deleted inserted replaced
4043:6c6239aec462 4044:d25f4c0fa160
1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
6 *
7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
11 *
12 * In addition, as a special exception, the copyright holders of this
13 * program give permission to link the code of its release with the
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
15 * that use the same license as the "OpenSSL" library), and distribute
16 * the linked executables. You must obey the GNU General Public License
17 * in all respects for all of the code used other than "OpenSSL". If you
18 * modify file(s) with this exception, you may extend this exception to
19 * your version of the file(s), but you are not obligated to do so. If
20 * you do not wish to do so, delete this exception statement from your
21 * version. If you delete this exception statement from all source files
22 * in the program, then also delete it here.
23 *
24 * This program is distributed in the hope that it will be useful, but
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 **/
32
33
34 #pragma once
35
36 #if ORTHANC_ENABLE_DCMTK_NETWORKING != 1
37 # error The macro ORTHANC_ENABLE_DCMTK_NETWORKING must be set to 1
38 #endif
39
40 #include "IFindRequestHandlerFactory.h"
41 #include "IMoveRequestHandlerFactory.h"
42 #include "IGetRequestHandlerFactory.h"
43 #include "IStoreRequestHandlerFactory.h"
44 #include "IWorklistRequestHandlerFactory.h"
45 #include "IStorageCommitmentRequestHandlerFactory.h"
46 #include "IApplicationEntityFilter.h"
47 #include "RemoteModalityParameters.h"
48
49 #include <boost/shared_ptr.hpp>
50 #include <boost/noncopyable.hpp>
51
52
53 namespace Orthanc
54 {
55 class DicomServer : public boost::noncopyable
56 {
57 public:
58 // WARNING: The methods of this class must be thread-safe
59 class IRemoteModalities : public boost::noncopyable
60 {
61 public:
62 virtual ~IRemoteModalities()
63 {
64 }
65
66 virtual bool IsSameAETitle(const std::string& aet1,
67 const std::string& aet2) = 0;
68
69 virtual bool LookupAETitle(RemoteModalityParameters& modality,
70 const std::string& aet) = 0;
71 };
72
73 private:
74 struct PImpl;
75 boost::shared_ptr<PImpl> pimpl_;
76
77 bool checkCalledAet_;
78 std::string aet_;
79 uint16_t port_;
80 bool continue_;
81 uint32_t associationTimeout_;
82 IRemoteModalities* modalities_;
83 IFindRequestHandlerFactory* findRequestHandlerFactory_;
84 IMoveRequestHandlerFactory* moveRequestHandlerFactory_;
85 IGetRequestHandlerFactory* getRequestHandlerFactory_;
86 IStoreRequestHandlerFactory* storeRequestHandlerFactory_;
87 IWorklistRequestHandlerFactory* worklistRequestHandlerFactory_;
88 IStorageCommitmentRequestHandlerFactory* storageCommitmentFactory_;
89 IApplicationEntityFilter* applicationEntityFilter_;
90
91 static void ServerThread(DicomServer* server);
92
93 public:
94 DicomServer();
95
96 ~DicomServer();
97
98 void SetPortNumber(uint16_t port);
99 uint16_t GetPortNumber() const;
100
101 void SetAssociationTimeout(uint32_t seconds);
102 uint32_t GetAssociationTimeout() const;
103
104 void SetCalledApplicationEntityTitleCheck(bool check);
105 bool HasCalledApplicationEntityTitleCheck() const;
106
107 void SetApplicationEntityTitle(const std::string& aet);
108 const std::string& GetApplicationEntityTitle() const;
109
110 void SetRemoteModalities(IRemoteModalities& modalities);
111 IRemoteModalities& GetRemoteModalities() const;
112
113 void SetFindRequestHandlerFactory(IFindRequestHandlerFactory& handler);
114 bool HasFindRequestHandlerFactory() const;
115 IFindRequestHandlerFactory& GetFindRequestHandlerFactory() const;
116
117 void SetMoveRequestHandlerFactory(IMoveRequestHandlerFactory& handler);
118 bool HasMoveRequestHandlerFactory() const;
119 IMoveRequestHandlerFactory& GetMoveRequestHandlerFactory() const;
120
121 void SetGetRequestHandlerFactory(IGetRequestHandlerFactory& handler);
122 bool HasGetRequestHandlerFactory() const;
123 IGetRequestHandlerFactory& GetGetRequestHandlerFactory() const;
124
125 void SetStoreRequestHandlerFactory(IStoreRequestHandlerFactory& handler);
126 bool HasStoreRequestHandlerFactory() const;
127 IStoreRequestHandlerFactory& GetStoreRequestHandlerFactory() const;
128
129 void SetWorklistRequestHandlerFactory(IWorklistRequestHandlerFactory& handler);
130 bool HasWorklistRequestHandlerFactory() const;
131 IWorklistRequestHandlerFactory& GetWorklistRequestHandlerFactory() const;
132
133 void SetStorageCommitmentRequestHandlerFactory(IStorageCommitmentRequestHandlerFactory& handler);
134 bool HasStorageCommitmentRequestHandlerFactory() const;
135 IStorageCommitmentRequestHandlerFactory& GetStorageCommitmentRequestHandlerFactory() const;
136
137 void SetApplicationEntityFilter(IApplicationEntityFilter& handler);
138 bool HasApplicationEntityFilter() const;
139 IApplicationEntityFilter& GetApplicationEntityFilter() const;
140
141 void Start();
142
143 void Stop();
144
145 bool IsMyAETitle(const std::string& aet) const;
146 };
147
148 }