Mercurial > hg > orthanc
comparison OrthancServer/DicomProtocol/DicomServer.cpp @ 62:a70bb32802ae orthanc-renaming
renaming Server
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Sun, 16 Sep 2012 09:33:19 +0200 |
parents | 4bc019d2f969 |
children | 428784e59dcd |
comparison
equal
deleted
inserted
replaced
61:d1c511efd6b1 | 62:a70bb32802ae |
---|---|
1 /** | 1 /** |
2 * Palanthir - A Lightweight, RESTful DICOM Store | 2 * Orthanc - A Lightweight, RESTful DICOM Store |
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege, | 3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege, |
4 * Belgium | 4 * Belgium |
5 * | 5 * |
6 * This program is free software: you can redistribute it and/or | 6 * This program is free software: you can redistribute it and/or |
7 * modify it under the terms of the GNU General Public License as | 7 * modify it under the terms of the GNU General Public License as |
18 **/ | 18 **/ |
19 | 19 |
20 | 20 |
21 #include "DicomServer.h" | 21 #include "DicomServer.h" |
22 | 22 |
23 #include "../../Core/PalanthirException.h" | 23 #include "../../Core/OrthancException.h" |
24 #include "../../Core/Toolbox.h" | 24 #include "../../Core/Toolbox.h" |
25 #include "../Internals/CommandDispatcher.h" | 25 #include "../Internals/CommandDispatcher.h" |
26 | 26 |
27 #include <boost/thread.hpp> | 27 #include <boost/thread.hpp> |
28 #include <dcmtk/dcmdata/dcdict.h> | 28 #include <dcmtk/dcmdata/dcdict.h> |
29 | 29 |
30 | 30 |
31 namespace Palanthir | 31 namespace Orthanc |
32 { | 32 { |
33 struct DicomServer::PImpl | 33 struct DicomServer::PImpl |
34 { | 34 { |
35 boost::thread thread_; | 35 boost::thread thread_; |
36 | 36 |
62 (NET_ACCEPTOR, OFstatic_cast(int, server->port_), /*opt_acse_timeout*/ 30, &net); | 62 (NET_ACCEPTOR, OFstatic_cast(int, server->port_), /*opt_acse_timeout*/ 30, &net); |
63 if (cond.bad()) | 63 if (cond.bad()) |
64 { | 64 { |
65 OFString temp_str; | 65 OFString temp_str; |
66 OFLOG_ERROR(Internals::Logger, "cannot create network: " << DimseCondition::dump(temp_str, cond)); | 66 OFLOG_ERROR(Internals::Logger, "cannot create network: " << DimseCondition::dump(temp_str, cond)); |
67 throw PalanthirException("Cannot create network"); | 67 throw OrthancException("Cannot create network"); |
68 } | 68 } |
69 | 69 |
70 OFLOG_WARN(Internals::Logger, "DICOM server started"); | 70 OFLOG_WARN(Internals::Logger, "DICOM server started"); |
71 | 71 |
72 server->started_ = true; | 72 server->started_ = true; |
168 | 168 |
169 void DicomServer::SetApplicationEntityTitle(const std::string& aet) | 169 void DicomServer::SetApplicationEntityTitle(const std::string& aet) |
170 { | 170 { |
171 if (aet.size() == 0) | 171 if (aet.size() == 0) |
172 { | 172 { |
173 throw PalanthirException("Too short AET"); | 173 throw OrthancException("Too short AET"); |
174 } | 174 } |
175 | 175 |
176 for (size_t i = 0; i < aet.size(); i++) | 176 for (size_t i = 0; i < aet.size(); i++) |
177 { | 177 { |
178 if (!isalnum(aet[i]) && aet[i] != '-') | 178 if (!isalnum(aet[i]) && aet[i] != '-') |
179 { | 179 { |
180 throw PalanthirException("Only alphanumeric characters are allowed in AET"); | 180 throw OrthancException("Only alphanumeric characters are allowed in AET"); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 Stop(); | 184 Stop(); |
185 aet_ = aet; | 185 aet_ = aet; |
207 { | 207 { |
208 return *findRequestHandlerFactory_; | 208 return *findRequestHandlerFactory_; |
209 } | 209 } |
210 else | 210 else |
211 { | 211 { |
212 throw PalanthirException("No C-FIND request handler factory"); | 212 throw OrthancException("No C-FIND request handler factory"); |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 void DicomServer::SetMoveRequestHandlerFactory(IMoveRequestHandlerFactory& factory) | 216 void DicomServer::SetMoveRequestHandlerFactory(IMoveRequestHandlerFactory& factory) |
217 { | 217 { |
230 { | 230 { |
231 return *moveRequestHandlerFactory_; | 231 return *moveRequestHandlerFactory_; |
232 } | 232 } |
233 else | 233 else |
234 { | 234 { |
235 throw PalanthirException("No C-MOVE request handler factory"); | 235 throw OrthancException("No C-MOVE request handler factory"); |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 void DicomServer::SetStoreRequestHandlerFactory(IStoreRequestHandlerFactory& factory) | 239 void DicomServer::SetStoreRequestHandlerFactory(IStoreRequestHandlerFactory& factory) |
240 { | 240 { |
253 { | 253 { |
254 return *storeRequestHandlerFactory_; | 254 return *storeRequestHandlerFactory_; |
255 } | 255 } |
256 else | 256 else |
257 { | 257 { |
258 throw PalanthirException("No C-STORE request handler factory"); | 258 throw OrthancException("No C-STORE request handler factory"); |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
262 void DicomServer::SetApplicationEntityFilter(IApplicationEntityFilter& factory) | 262 void DicomServer::SetApplicationEntityFilter(IApplicationEntityFilter& factory) |
263 { | 263 { |
276 { | 276 { |
277 return *applicationEntityFilter_; | 277 return *applicationEntityFilter_; |
278 } | 278 } |
279 else | 279 else |
280 { | 280 { |
281 throw PalanthirException("No application entity filter"); | 281 throw OrthancException("No application entity filter"); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 void DicomServer::Start() | 285 void DicomServer::Start() |
286 { | 286 { |