annotate OrthancFramework/Sources/DicomNetworking/Internals/MoveScp.cpp @ 5853:4d932683049d get-scu tip

very first implementation of C-Get SCU
author Alain Mazy <am@orthanc.team>
date Tue, 29 Oct 2024 17:25:49 +0100
parents f7adfb22e20e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
2 * Orthanc - A Lightweight, RESTful DICOM Store
1900
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
4 * Department, University Hospital of Liege, Belgium
5640
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
5 * Copyright (C) 2017-2023 Osimis S.A., Belgium
f7adfb22e20e updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5485
diff changeset
6 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
5485
48b8dae6dc77 upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5432
diff changeset
7 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * This program is free software: you can redistribute it and/or
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
10 * modify it under the terms of the GNU Lesser General Public License
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
11 * as published by the Free Software Foundation, either version 3 of
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
12 * the License, or (at your option) any later version.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 122
diff changeset
13 *
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
17 * Lesser General Public License for more details.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 *
4119
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
20 * License along with this program. If not, see
bf7b9edf6b81 re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4044
diff changeset
21 * <http://www.gnu.org/licenses/>.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24
766
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
25
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
26
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
27 /*=========================================================================
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
28
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
29 This file is based on portions of the following project:
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
30
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
31 Program: DCMTK 3.6.0
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
32 Module: http://dicom.offis.de/dcmtk.php.en
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
33
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
34 Copyright (C) 1994-2011, OFFIS e.V.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
35 All rights reserved.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
36
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
37 This software and supporting documentation were developed by
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
38
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
39 OFFIS e.V.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
40 R&D Division Health
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
41 Escherweg 2
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
42 26121 Oldenburg, Germany
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
43
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
44 Redistribution and use in source and binary forms, with or without
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
45 modification, are permitted provided that the following conditions
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
46 are met:
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
47
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
48 - Redistributions of source code must retain the above copyright
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
49 notice, this list of conditions and the following disclaimer.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
50
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
51 - Redistributions in binary form must reproduce the above copyright
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
52 notice, this list of conditions and the following disclaimer in the
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
53 documentation and/or other materials provided with the distribution.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
54
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
55 - Neither the name of OFFIS nor the names of its contributors may be
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
56 used to endorse or promote products derived from this software
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
57 without specific prior written permission.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
58
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
59 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
60 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
61 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
62 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
63 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
64 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
65 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
66 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
67 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
68 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
69 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
70
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
71 =========================================================================*/
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
72
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 722
diff changeset
73
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
74 #include "../../PrecompiledHeaders.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 #include "MoveScp.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 #include <memory>
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
79 #include "../../DicomParsing/FromDcmtkBridge.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
80 #include "../../DicomParsing/ToDcmtkBridge.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
81 #include "../../Logging.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
82 #include "../../OrthancException.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
84 #include <boost/lexical_cast.hpp>
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
85
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
2723
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
87 /**
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
88 * Macro specifying whether to apply the patch suggested in issue 66:
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
89 * "Orthanc responses C-MOVE with zero Move Originator Message ID"
5432
59e3b6f8c5be migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 5185
diff changeset
90 * https://orthanc.uclouvain.be/bugs/show_bug.cgi?id=66
2723
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
91 **/
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
92
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
93 #define APPLY_FIX_ISSUE_66 1
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
94
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
95
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
96 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98 namespace
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 struct MoveScpData
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 std::string target_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 IMoveRequestHandler* handler_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 DcmDataset* lastRequest_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105 unsigned int subOperationCount_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 unsigned int failureCount_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107 unsigned int warningCount_;
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3704
diff changeset
108 std::unique_ptr<IMoveRequestIterator> iterator_;
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
109 const std::string* remoteIp_;
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
110 const std::string* remoteAet_;
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
111 const std::string* calledAet_;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
112 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
2723
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
115 #if APPLY_FIX_ISSUE_66 != 1
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
116 static uint16_t GetMessageId(const DicomMap& message)
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
117 {
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
118 /**
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
119 * Retrieve the Message ID (0000,0110) for this C-MOVE request, if
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
120 * any. If present, this Message ID will be stored in the Move
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
121 * Originator Message ID (0000,1031) field of the C-MOVE response.
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
122 * http://dicom.nema.org/dicom/2013/output/chtml/part07/chapter_E.html
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
123 **/
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
124
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
125 const DicomValue* value = message.TestAndGetValue(DICOM_TAG_MESSAGE_ID);
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
126
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
127 if (value != NULL &&
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
128 !value->IsNull() &&
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
129 !value->IsBinary())
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
130 {
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
131 try
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
132 {
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
133 int tmp = boost::lexical_cast<int>(value->GetContent());
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
134 if (tmp >= 0 && tmp <= 0xffff)
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
135 {
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
136 return static_cast<uint16_t>(tmp);
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
137 }
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
138 }
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
139 catch (boost::bad_lexical_cast&)
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
140 {
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4137
diff changeset
141 CLOG(WARNING, DICOM) << "Cannot convert the Message ID (\"" << value->GetContent()
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4137
diff changeset
142 << "\") of an incoming C-MOVE request to an integer, assuming zero";
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
143 }
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
144 }
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
145
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
146 return 0;
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
147 }
2723
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
148 #endif
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
149
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
150
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 void MoveScpCallback(
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 /* in */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 void *callbackData,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 OFBool cancelled,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 T_DIMSE_C_MoveRQ *request,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 DcmDataset *requestIdentifiers,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157 int responseCount,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 /* out */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 T_DIMSE_C_MoveRSP *response,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 DcmDataset **responseIdentifiers,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 DcmDataset **statusDetail)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 {
4286
526bd8bad850 debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
163 assert(response != NULL);
526bd8bad850 debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
164 assert(requestIdentifiers != NULL);
526bd8bad850 debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
165
5072
b23a4bb18065 replaced bzero() by memset()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4870
diff changeset
166 memset(response, 0, sizeof(T_DIMSE_C_MoveRSP));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 *statusDetail = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 *responseIdentifiers = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169
656
08eca5d86aad fixes to cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 613
diff changeset
170 MoveScpData& data = *reinterpret_cast<MoveScpData*>(callbackData);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 if (data.lastRequest_ == NULL)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 {
4286
526bd8bad850 debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
173 {
4288
5b254bd435d3 fix for VS2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4286
diff changeset
174 std::stringstream s; // DcmObject::PrintHelper cannot be used with VS2008
5b254bd435d3 fix for VS2008
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4286
diff changeset
175 requestIdentifiers->print(s);
4286
526bd8bad850 debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
176 CLOG(TRACE, DICOM) << "Received C-MOVE Request:" << std::endl << s.str();
526bd8bad850 debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
177 }
526bd8bad850 debug logs for C-MOVE and C-GET SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4284
diff changeset
178
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
179 DicomMap input;
4137
6774605d4341 keep only one signature for FromDcmtkBridge::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4136
diff changeset
180 std::set<DicomTag> ignoreTagLength;
6774605d4341 keep only one signature for FromDcmtkBridge::ExtractDicomSummary()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4136
diff changeset
181 FromDcmtkBridge::ExtractDicomSummary(input, *requestIdentifiers, 0 /* don't truncate tags */, ignoreTagLength);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 try
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 {
2723
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
185 #if APPLY_FIX_ISSUE_66 == 1
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
186 uint16_t messageId = request->MessageID;
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
187 #else
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
188 // The line below was the implementation for Orthanc <= 1.3.2
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
189 uint16_t messageId = GetMessageId(input);
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
190 #endif
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
191
2222
21713ce8717b Fix handling of Move Originator AET and ID in C-MOVE SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2131
diff changeset
192 data.iterator_.reset(data.handler_->Handle(data.target_, input, *data.remoteIp_, *data.remoteAet_,
2723
c1e351b6abec fix issue #66
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
193 *data.calledAet_, messageId));
722
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 689
diff changeset
194
613
60d90e48e809 query/retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
195 if (data.iterator_.get() == NULL)
60d90e48e809 query/retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
196 {
60d90e48e809 query/retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
197 // Internal error!
60d90e48e809 query/retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
198 response->DimseStatus = STATUS_MOVE_Failed_UnableToProcess;
60d90e48e809 query/retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
199 return;
60d90e48e809 query/retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
200 }
60d90e48e809 query/retrieve
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
201
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 data.subOperationCount_ = data.iterator_->GetSubOperationCount();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 data.failureCount_ = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 data.warningCount_ = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 }
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
206 catch (OrthancException& e)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 // Internal error!
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4137
diff changeset
209 CLOG(ERROR, DICOM) << "IMoveRequestHandler Failed: " << e.What();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 response->DimseStatus = STATUS_MOVE_Failed_UnableToProcess;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 return;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 data.lastRequest_ = requestIdentifiers;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 else if (data.lastRequest_ != requestIdentifiers)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 // Internal error!
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 response->DimseStatus = STATUS_MOVE_Failed_UnableToProcess;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 return;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 if (data.subOperationCount_ == 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 response->DimseStatus = STATUS_Success;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 IMoveRequestIterator::Status status;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 try
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 status = data.iterator_->DoNext();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 }
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
235 catch (OrthancException& e)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 // Internal error!
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4137
diff changeset
238 CLOG(ERROR, DICOM) << "IMoveRequestHandler Failed: " << e.What();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 response->DimseStatus = STATUS_MOVE_Failed_UnableToProcess;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 return;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 if (status == IMoveRequestIterator::Status_Failure)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 data.failureCount_++;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 else if (status == IMoveRequestIterator::Status_Warning)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 data.warningCount_++;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 if (responseCount < static_cast<int>(data.subOperationCount_))
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 response->DimseStatus = STATUS_Pending;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 response->DimseStatus = STATUS_Success;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 response->NumberOfRemainingSubOperations = data.subOperationCount_ - responseCount;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 response->NumberOfCompletedSubOperations = responseCount;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 response->NumberOfFailedSubOperations = data.failureCount_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 response->NumberOfWarningSubOperations = data.warningCount_;
4692
e68edf92e5cc C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4476
diff changeset
266
e68edf92e5cc C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4476
diff changeset
267 if (data.failureCount_ != 0)
e68edf92e5cc C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4476
diff changeset
268 {
e68edf92e5cc C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4476
diff changeset
269 // Warning "Sub-operations Complete - One or more Failures" (0xB000)
e68edf92e5cc C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4476
diff changeset
270 response->DimseStatus = STATUS_MOVE_Warning_SubOperationsCompleteOneOrMoreFailures;
e68edf92e5cc C-MOVE SCP: added possible DIMSE status "Sub-operations Complete - One or more Failures"
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4476
diff changeset
271 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 OFCondition Internals::moveScp(T_ASC_Association * assoc,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 T_DIMSE_Message * msg,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 T_ASC_PresentationContextID presID,
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
279 IMoveRequestHandler& handler,
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
280 const std::string& remoteIp,
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
281 const std::string& remoteAet,
3704
58f92b1c8061 Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
282 const std::string& calledAet,
58f92b1c8061 Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
283 int timeout)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 MoveScpData data;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286 data.target_ = std::string(msg->msg.CMoveRQ.MoveDestination);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 data.lastRequest_ = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 data.handler_ = &handler;
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
289 data.remoteIp_ = &remoteIp;
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
290 data.remoteAet_ = &remoteAet;
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
291 data.calledAet_ = &calledAet;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 OFCondition cond = DIMSE_moveProvider(assoc, presID, &msg->msg.CMoveRQ,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 MoveScpCallback, &data,
3704
58f92b1c8061 Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
295 /*opt_blockMode*/ (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING),
58f92b1c8061 Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3640
diff changeset
296 /*opt_dimse_timeout*/ timeout);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 // if some error occured, dump corresponding information and remove the outfile if necessary
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 OFString temp_str;
4284
756126cd2219 moving all logs from DicomNetworking folder into the "dicom" category
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 4137
diff changeset
302 CLOG(ERROR, DICOM) << "Move SCP Failed: " << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
305 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307 }