annotate Core/DicomNetworking/Internals/CommandDispatcher.cpp @ 3961:11aae2efff36 c-get

closing c-get
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 20 May 2020 18:38:09 +0200
parents 76a24be12912
children 821715370890
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: 1806
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1288
6e7e5ed91c2d upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1164
diff changeset
4 * Department, University Hospital of Liege, Belgium
3640
94f4a18a79cc upgrade to year 2020
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU General Public License as
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * published by the Free Software Foundation, either version 3 of the
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * License, or (at your option) any later version.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
11 *
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
12 * In addition, as a special exception, the copyright holders of this
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
13 * program give permission to link the code of its release with the
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
14 * OpenSSL project's "OpenSSL" library (or with modified versions of it
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
15 * that use the same license as the "OpenSSL" library), and distribute
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
16 * the linked executables. You must obey the GNU General Public License
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
17 * in all respects for all of the code used other than "OpenSSL". If you
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
18 * modify file(s) with this exception, you may extend this exception to
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
19 * your version of the file(s), but you are not obligated to do so. If
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
20 * you do not wish to do so, delete this exception statement from your
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
21 * version. If you delete this exception statement from all source files
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
22 * in the program, then also delete it here.
0
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 * 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
25 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 * General Public License for more details.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * You should have received a copy of the GNU General Public License
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
766
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
34
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
35
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
36 /*=========================================================================
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
37
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
38 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: 690
diff changeset
39
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
40 Program: DCMTK 3.6.0
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
41 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: 690
diff changeset
42
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
43 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: 690
diff changeset
44 All rights reserved.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
45
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
46 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: 690
diff changeset
47
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
48 OFFIS e.V.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
49 R&D Division Health
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
50 Escherweg 2
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
51 26121 Oldenburg, Germany
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
52
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
53 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: 690
diff changeset
54 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: 690
diff changeset
55 are met:
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
56
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
57 - 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: 690
diff changeset
58 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: 690
diff changeset
59
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
60 - 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: 690
diff changeset
61 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: 690
diff changeset
62 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: 690
diff changeset
63
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
64 - 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: 690
diff changeset
65 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: 690
diff changeset
66 without specific prior written permission.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
67
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
68 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: 690
diff changeset
69 "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: 690
diff changeset
70 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: 690
diff changeset
71 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: 690
diff changeset
72 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: 690
diff changeset
73 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: 690
diff changeset
74 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: 690
diff changeset
75 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: 690
diff changeset
76 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: 690
diff changeset
77 (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: 690
diff changeset
78 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: 690
diff changeset
79
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
80 =========================================================================*/
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
81
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
82
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
83 #include "../../PrecompiledHeaders.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 #include "CommandDispatcher.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
3118
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
86 #if !defined(DCMTK_VERSION_NUMBER)
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
87 # error The macro DCMTK_VERSION_NUMBER must be defined
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
88 #endif
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
89
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90 #include "FindScp.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 #include "StoreScp.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92 #include "MoveScp.h"
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
93 #include "GetScp.h"
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3704
diff changeset
94 #include "../../Compatibility.h"
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
95 #include "../../Toolbox.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
96 #include "../../Logging.h"
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
97 #include "../../OrthancException.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
99 #include <dcmtk/dcmdata/dcdeftag.h> /* for storage commitment */
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
100 #include <dcmtk/dcmdata/dcsequen.h> /* for class DcmSequenceOfItems */
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
101 #include <dcmtk/dcmdata/dcuid.h> /* for variable dcmAllStorageSOPClassUIDs */
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 #include <dcmtk/dcmnet/dcasccfg.h> /* for class DcmAssociationConfiguration */
3343
6e42d676401c Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3249
diff changeset
103
101
428784e59dcd trying to use log4cplus
jodogne
parents: 62
diff changeset
104 #include <boost/lexical_cast.hpp>
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 static OFBool opt_rejectWithoutImplementationUID = OFFalse;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
109
1806
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
110 static DUL_PRESENTATIONCONTEXT *
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
111 findPresentationContextID(LST_HEAD * head,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
112 T_ASC_PresentationContextID presentationContextID)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
113 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
114 DUL_PRESENTATIONCONTEXT *pc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
115 LST_HEAD **l;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
116 OFBool found = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
117
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
118 if (head == NULL)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
119 return NULL;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
120
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
121 l = &head;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
122 if (*l == NULL)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
123 return NULL;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
124
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
125 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Head(l));
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
126 (void)LST_Position(l, OFstatic_cast(LST_NODE *, pc));
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
127
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
128 while (pc && !found) {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
129 if (pc->presentationContextID == presentationContextID) {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
130 found = OFTrue;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
131 } else {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
132 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Next(l));
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
133 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
134 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
135 return pc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
136 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
137
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
138
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
139 /** accept all presenstation contexts for unknown SOP classes,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
140 * i.e. UIDs appearing in the list of abstract syntaxes
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
141 * where no corresponding name is defined in the UID dictionary.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
142 * @param params pointer to association parameters structure
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
143 * @param transferSyntax transfer syntax to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
144 * @param acceptedRole SCU/SCP role to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
145 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
146 static OFCondition acceptUnknownContextsWithTransferSyntax(
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
147 T_ASC_Parameters * params,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
148 const char* transferSyntax,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
149 T_ASC_SC_ROLE acceptedRole)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
150 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
151 OFCondition cond = EC_Normal;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
152 int n, i, k;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
153 DUL_PRESENTATIONCONTEXT *dpc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
154 T_ASC_PresentationContext pc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
155 OFBool accepted = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
156 OFBool abstractOK = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
157
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
158 n = ASC_countPresentationContexts(params);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
159 for (i = 0; i < n; i++)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
160 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
161 cond = ASC_getPresentationContext(params, i, &pc);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
162 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
163 abstractOK = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
164 accepted = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
165
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
166 if (dcmFindNameOfUID(pc.abstractSyntax) == NULL)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
167 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
168 abstractOK = OFTrue;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
169
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
170 /* check the transfer syntax */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
171 for (k = 0; (k < OFstatic_cast(int, pc.transferSyntaxCount)) && !accepted; k++)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
172 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
173 if (strcmp(pc.proposedTransferSyntaxes[k], transferSyntax) == 0)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
174 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
175 accepted = OFTrue;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
176 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
177 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
178 }
3343
6e42d676401c Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3249
diff changeset
179
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
180 if (accepted)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
181 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
182 cond = ASC_acceptPresentationContext(
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
183 params, pc.presentationContextID,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
184 transferSyntax, acceptedRole);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
185 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
186 } else {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
187 T_ASC_P_ResultReason reason;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
188
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
189 /* do not refuse if already accepted */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
190 dpc = findPresentationContextID(params->DULparams.acceptedPresentationContext,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
191 pc.presentationContextID);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
192 if ((dpc == NULL) || ((dpc != NULL) && (dpc->result != ASC_P_ACCEPTANCE)))
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
193 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
194
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
195 if (abstractOK) {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
196 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
197 } else {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
198 reason = ASC_P_ABSTRACTSYNTAXNOTSUPPORTED;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
199 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
200 /*
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
201 * If previously this presentation context was refused
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
202 * because of bad transfer syntax let it stay that way.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
203 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
204 if ((dpc != NULL) && (dpc->result == ASC_P_TRANSFERSYNTAXESNOTSUPPORTED))
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
205 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
206
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
207 cond = ASC_refusePresentationContext(params, pc.presentationContextID, reason);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
208 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
209 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
210 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
211 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
212 return EC_Normal;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
213 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
214
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
215
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
216 /** accept all presenstation contexts for unknown SOP classes,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
217 * i.e. UIDs appearing in the list of abstract syntaxes
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
218 * where no corresponding name is defined in the UID dictionary.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
219 * This method is passed a list of "preferred" transfer syntaxes.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
220 * @param params pointer to association parameters structure
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
221 * @param transferSyntax transfer syntax to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
222 * @param acceptedRole SCU/SCP role to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
223 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
224 static OFCondition acceptUnknownContextsWithPreferredTransferSyntaxes(
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
225 T_ASC_Parameters * params,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
226 const char* transferSyntaxes[], int transferSyntaxCount,
3343
6e42d676401c Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3249
diff changeset
227 T_ASC_SC_ROLE acceptedRole)
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
228 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
229 OFCondition cond = EC_Normal;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
230 /*
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
231 ** Accept in the order "least wanted" to "most wanted" transfer
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
232 ** syntax. Accepting a transfer syntax will override previously
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
233 ** accepted transfer syntaxes.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
234 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
235 for (int i = transferSyntaxCount - 1; i >= 0; i--)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
236 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
237 cond = acceptUnknownContextsWithTransferSyntax(params, transferSyntaxes[i], acceptedRole);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
238 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
239 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
240 return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
241 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
242
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
243
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
244
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
245 namespace Orthanc
0
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 namespace Internals
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 OFCondition AssociationCleanup(T_ASC_Association *assoc)
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 OFCondition cond = ASC_dropSCPAssociation(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
254 LOG(FATAL) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 }
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 cond = ASC_destroyAssociation(&assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
261 LOG(FATAL) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 CommandDispatcher* AcceptAssociation(const DicomServer& server, T_ASC_Network *net)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272 DcmAssociationConfiguration asccfg;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273 char buf[BUFSIZ];
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 T_ASC_Association *assoc;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 OFCondition cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 OFString sprofile;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277 OFString temp_str;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
279
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
280
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 cond = ASC_receiveAssociation(net, &assoc,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 /*opt_maxPDU*/ ASC_DEFAULTMAXPDU,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 NULL, NULL,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 /*opt_secureConnection*/ OFFalse,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 DUL_NOBLOCK, 1);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 if (cond == DUL_NOASSOCIATIONREQUEST)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 // Timeout
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 return NULL;
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 // if some kind of error occured, take care of it
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
297 LOG(ERROR) << "Receiving Association failed: " << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 // no matter what kind of error occurred, we need to do a cleanup
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
303 // Retrieve the AET and the IP address of the remote modality
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
304 std::string remoteAet;
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
305 std::string remoteIp;
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
306 std::string calledAet;
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
307
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
308 {
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
309 DIC_AE remoteAet_C;
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
310 DIC_AE calledAet_C;
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
311 DIC_AE remoteIp_C;
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
312 DIC_AE calledIP_C;
3118
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
313
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
314 if (
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
315 #if DCMTK_VERSION_NUMBER >= 364
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
316 ASC_getAPTitles(assoc->params, remoteAet_C, sizeof(remoteAet_C), calledAet_C, sizeof(calledAet_C), NULL, 0).bad() ||
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
317 ASC_getPresentationAddresses(assoc->params, remoteIp_C, sizeof(remoteIp_C), calledIP_C, sizeof(calledIP_C)).bad()
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
318 #else
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
319 ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() ||
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
320 ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad()
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
321 #endif
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
322 )
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
323 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
324 T_ASC_RejectParameters rej =
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
325 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
326 ASC_RESULT_REJECTEDPERMANENT,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
327 ASC_SOURCE_SERVICEUSER,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
328 ASC_REASON_SU_NOREASON
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
329 };
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
330 ASC_rejectAssociation(assoc, &rej);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
331 AssociationCleanup(assoc);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
332 return NULL;
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
333 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
334
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
335 remoteIp = std::string(/*OFSTRING_GUARD*/(remoteIp_C));
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
336 remoteAet = std::string(/*OFSTRING_GUARD*/(remoteAet_C));
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
337 calledAet = (/*OFSTRING_GUARD*/(calledAet_C));
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
338 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
339
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
340 LOG(INFO) << "Association Received from AET " << remoteAet
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
341 << " on IP " << remoteIp;
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
342
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
344 {
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
345 /* accept the abstract syntaxes for C-ECHO, C-FIND, C-MOVE,
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
346 and storage commitment, if presented */
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
347
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
348 std::vector<const char*> genericTransferSyntaxes;
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
349 genericTransferSyntaxes.push_back(UID_LittleEndianExplicitTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
350 genericTransferSyntaxes.push_back(UID_BigEndianExplicitTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
351 genericTransferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax);
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
352
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
353 std::vector<const char*> knownAbstractSyntaxes;
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
354
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
355 // For C-ECHO (always enabled since Orthanc 1.6.0; in earlier
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
356 // versions, only enabled if C-STORE was also enabled)
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
357 knownAbstractSyntaxes.push_back(UID_VerificationSOPClass);
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
358
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
359 // For C-FIND
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
360 if (server.HasFindRequestHandlerFactory())
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
361 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
362 knownAbstractSyntaxes.push_back(UID_FINDPatientRootQueryRetrieveInformationModel);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
363 knownAbstractSyntaxes.push_back(UID_FINDStudyRootQueryRetrieveInformationModel);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
364 }
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
365
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
366 if (server.HasWorklistRequestHandlerFactory())
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
367 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
368 knownAbstractSyntaxes.push_back(UID_FINDModalityWorklistInformationModel);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
369 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
371 // For C-MOVE
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
372 if (server.HasMoveRequestHandlerFactory())
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
373 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
374 knownAbstractSyntaxes.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
375 knownAbstractSyntaxes.push_back(UID_MOVEPatientRootQueryRetrieveInformationModel);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
376 }
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
377
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
378 // For C-GET
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
379 if (server.HasGetRequestHandlerFactory())
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
380 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
381 knownAbstractSyntaxes.push_back(UID_GETStudyRootQueryRetrieveInformationModel);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
382 knownAbstractSyntaxes.push_back(UID_GETPatientRootQueryRetrieveInformationModel);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
383 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
384
3343
6e42d676401c Fix issue #137 (C-STORE fails for unknown SOP Class although server is configured to accept any)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3249
diff changeset
385
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
386 cond = ASC_acceptContextsWithPreferredTransferSyntaxes(
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
387 assoc->params,
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
388 &knownAbstractSyntaxes[0], knownAbstractSyntaxes.size(),
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
389 &genericTransferSyntaxes[0], genericTransferSyntaxes.size());
1806
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
390 if (cond.bad())
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
391 {
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
392 LOG(INFO) << cond.text();
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
393 AssociationCleanup(assoc);
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
394 return NULL;
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
395 }
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
396
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
397
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
398 /* storage commitment support, new in Orthanc 1.6.0 */
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
399 if (server.HasStorageCommitmentRequestHandlerFactory())
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
400 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
401 /**
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
402 * "ASC_SC_ROLE_SCUSCP": The "SCU" role is needed to accept
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
403 * remote storage commitment requests, and the "SCP" role is
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
404 * needed to receive storage commitments answers.
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
405 **/
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
406 const char* as[1] = { UID_StorageCommitmentPushModelSOPClass };
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
407 cond = ASC_acceptContextsWithPreferredTransferSyntaxes(
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
408 assoc->params, as, 1,
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
409 &genericTransferSyntaxes[0], genericTransferSyntaxes.size(), ASC_SC_ROLE_SCUSCP);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
410 if (cond.bad())
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
411 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
412 LOG(INFO) << cond.text();
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
413 AssociationCleanup(assoc);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
414 return NULL;
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
415 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
416 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
417 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
418
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
419
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
420 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
421 /* accept the abstract syntaxes for C-STORE, if presented */
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
422
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
423 std::vector<const char*> storageTransferSyntaxes;
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
424
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
425 // This is the list of the transfer syntaxes that were supported up to Orthanc 0.7.1
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
426 storageTransferSyntaxes.push_back(UID_LittleEndianExplicitTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
427 storageTransferSyntaxes.push_back(UID_BigEndianExplicitTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
428 storageTransferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
429
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
430 // New transfer syntaxes supported since Orthanc 0.7.2
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
431 if (!server.HasApplicationEntityFilter() ||
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
432 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Deflated))
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
433 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
434 storageTransferSyntaxes.push_back(UID_DeflatedExplicitVRLittleEndianTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
435 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
436
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
437 if (!server.HasApplicationEntityFilter() ||
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
438 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpeg))
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
439 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
440 storageTransferSyntaxes.push_back(UID_JPEGProcess1TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
441 storageTransferSyntaxes.push_back(UID_JPEGProcess2_4TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
442 storageTransferSyntaxes.push_back(UID_JPEGProcess3_5TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
443 storageTransferSyntaxes.push_back(UID_JPEGProcess6_8TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
444 storageTransferSyntaxes.push_back(UID_JPEGProcess7_9TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
445 storageTransferSyntaxes.push_back(UID_JPEGProcess10_12TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
446 storageTransferSyntaxes.push_back(UID_JPEGProcess11_13TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
447 storageTransferSyntaxes.push_back(UID_JPEGProcess14TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
448 storageTransferSyntaxes.push_back(UID_JPEGProcess15TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
449 storageTransferSyntaxes.push_back(UID_JPEGProcess16_18TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
450 storageTransferSyntaxes.push_back(UID_JPEGProcess17_19TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
451 storageTransferSyntaxes.push_back(UID_JPEGProcess20_22TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
452 storageTransferSyntaxes.push_back(UID_JPEGProcess21_23TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
453 storageTransferSyntaxes.push_back(UID_JPEGProcess24_26TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
454 storageTransferSyntaxes.push_back(UID_JPEGProcess25_27TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
455 storageTransferSyntaxes.push_back(UID_JPEGProcess28TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
456 storageTransferSyntaxes.push_back(UID_JPEGProcess29TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
457 storageTransferSyntaxes.push_back(UID_JPEGProcess14SV1TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
458 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
459
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
460 if (!server.HasApplicationEntityFilter() ||
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
461 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpeg2000))
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
462 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
463 storageTransferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
464 storageTransferSyntaxes.push_back(UID_JPEG2000TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
465 storageTransferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
466 storageTransferSyntaxes.push_back(UID_JPEG2000TransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
467 storageTransferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
468 storageTransferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
469 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
470
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
471 if (!server.HasApplicationEntityFilter() ||
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
472 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_JpegLossless))
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
473 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
474 storageTransferSyntaxes.push_back(UID_JPEGLSLosslessTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
475 storageTransferSyntaxes.push_back(UID_JPEGLSLossyTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
476 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
477
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
478 if (!server.HasApplicationEntityFilter() ||
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
479 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpip))
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
480 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
481 storageTransferSyntaxes.push_back(UID_JPIPReferencedTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
482 storageTransferSyntaxes.push_back(UID_JPIPReferencedDeflateTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
483 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
484
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
485 if (!server.HasApplicationEntityFilter() ||
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
486 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Mpeg2))
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
487 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
488 storageTransferSyntaxes.push_back(UID_MPEG2MainProfileAtMainLevelTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
489 storageTransferSyntaxes.push_back(UID_MPEG2MainProfileAtHighLevelTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
490 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
491
3769
eb044cc49d51 compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3767
diff changeset
492 #if DCMTK_VERSION_NUMBER >= 361
3646
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
493 // New in Orthanc 1.6.0
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
494 if (!server.HasApplicationEntityFilter() ||
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
495 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Mpeg4))
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
496 {
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
497 storageTransferSyntaxes.push_back(UID_MPEG4BDcompatibleHighProfileLevel4_1TransferSyntax);
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
498 storageTransferSyntaxes.push_back(UID_MPEG4HighProfileLevel4_1TransferSyntax);
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
499 storageTransferSyntaxes.push_back(UID_MPEG4HighProfileLevel4_2_For2DVideoTransferSyntax);
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
500 storageTransferSyntaxes.push_back(UID_MPEG4HighProfileLevel4_2_For3DVideoTransferSyntax);
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
501 storageTransferSyntaxes.push_back(UID_MPEG4StereoHighProfileLevel4_2TransferSyntax);
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
502 }
3769
eb044cc49d51 compatibility with DCMTK 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3767
diff changeset
503 #endif
3646
5faf76511931 integration mainline->storage-commitment
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3641 3645
diff changeset
504
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
505 if (!server.HasApplicationEntityFilter() ||
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
506 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Rle))
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
507 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
508 storageTransferSyntaxes.push_back(UID_RLELosslessTransferSyntax);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
509 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
510
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
511 /* the array of Storage SOP Class UIDs that is defined within "dcmdata/libsrc/dcuid.cc" */
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
512 size_t count = 0;
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
513 while (dcmAllStorageSOPClassUIDs[count] != NULL)
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
514 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
515 count++;
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
516 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
517
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
518 #if DCMTK_VERSION_NUMBER >= 362
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
519 // The global variable "numberOfDcmAllStorageSOPClassUIDs" is
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
520 // only published if DCMTK >= 3.6.2:
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
521 // https://bitbucket.org/sjodogne/orthanc/issues/137
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
522 assert(static_cast<int>(count) == numberOfDcmAllStorageSOPClassUIDs);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
523 #endif
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
524
3920
82e88ff003d7 merge default -> c-get
Alain Mazy <alain@mazy.be>
parents: 3818
diff changeset
525 // now that C-GET SCP is always enabled, the first branch of this if is useless
3959
76a24be12912 c-get: support of transcoding
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3953
diff changeset
526 // TO BE ANALYZED by SJ
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
527 if (!server.HasGetRequestHandlerFactory()) // dcmqrsrv.cc line 828
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
528 {
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
529 cond = ASC_acceptContextsWithPreferredTransferSyntaxes(
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
530 assoc->params,
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
531 dcmAllStorageSOPClassUIDs, count,
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
532 &storageTransferSyntaxes[0], storageTransferSyntaxes.size());
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
533 if (cond.bad())
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
534 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
535 LOG(INFO) << cond.text();
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
536 AssociationCleanup(assoc);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
537 return NULL;
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
538 }
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
539 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
540 else // see dcmqrsrv.cc lines 839 - 876
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
541 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
542 /* accept storage syntaxes with proposed role */
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
543 T_ASC_PresentationContext pc;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
544 T_ASC_SC_ROLE role;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
545 int npc = ASC_countPresentationContexts(assoc->params);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
546 for (int i = 0; i < npc; i++)
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
547 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
548 ASC_getPresentationContext(assoc->params, i, &pc);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
549 if (dcmIsaStorageSOPClassUID(pc.abstractSyntax))
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
550 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
551 /*
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
552 ** We are prepared to accept whatever role the caller proposes.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
553 ** Normally we can be the SCP of the Storage Service Class.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
554 ** When processing the C-GET operation we can be the SCU of the Storage Service Class.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
555 */
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
556 role = pc.proposedRole;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
557
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
558 /*
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
559 ** Accept in the order "least wanted" to "most wanted" transfer
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
560 ** syntax. Accepting a transfer syntax will override previously
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
561 ** accepted transfer syntaxes.
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
562 */
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
563 for (int k = (int) storageTransferSyntaxes.size() - 1; k >= 0; k--)
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
564 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
565 for (int j = 0; j < (int)pc.transferSyntaxCount; j++)
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
566 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
567 /* if the transfer syntax was proposed then we can accept it
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
568 * appears in our supported list of transfer syntaxes
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
569 */
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
570 if (strcmp(pc.proposedTransferSyntaxes[j], storageTransferSyntaxes[k]) == 0)
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
571 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
572 cond = ASC_acceptPresentationContext(
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
573 assoc->params, pc.presentationContextID, storageTransferSyntaxes[k], role);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
574 if (cond.bad())
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
575 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
576 LOG(INFO) << cond.text();
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
577 AssociationCleanup(assoc);
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
578 return NULL;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
579 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
580 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
581 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
582 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
583 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
584 } /* for */
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
585
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
586 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
587
3612
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
588
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
589 if (!server.HasApplicationEntityFilter() ||
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
590 server.GetApplicationEntityFilter().IsUnknownSopClassAccepted(remoteIp, remoteAet, calledAet))
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
591 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
592 /*
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
593 * Promiscous mode is enabled: Accept everything not known not
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
594 * to be a storage SOP class.
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
595 **/
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
596 cond = acceptUnknownContextsWithPreferredTransferSyntaxes(
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
597 assoc->params, &storageTransferSyntaxes[0], storageTransferSyntaxes.size(), ASC_SC_ROLE_DEFAULT);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
598 if (cond.bad())
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
599 {
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
600 LOG(INFO) << cond.text();
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
601 AssociationCleanup(assoc);
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
602 return NULL;
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
603 }
22eef03feed7 DANGEROUS changeset: Removing unnecessary transfer syntaxes for C-ECHO, C-FIND and C-MOVE
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3604
diff changeset
604 }
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
605 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
606
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607 /* set our app title */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608 ASC_setAPTitles(assoc->params, NULL, NULL, server.GetApplicationEntityTitle().c_str());
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 /* acknowledge or reject this association */
3118
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
611 #if DCMTK_VERSION_NUMBER >= 364
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
612 cond = ASC_getApplicationContextName(assoc->params, buf, sizeof(buf));
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
613 #else
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 cond = ASC_getApplicationContextName(assoc->params, buf);
3118
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
615 #endif
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
616
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617 if ((cond.bad()) || strcmp(buf, UID_StandardApplicationContext) != 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
619 /* reject: the application context name is not supported */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 T_ASC_RejectParameters rej =
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622 ASC_RESULT_REJECTEDPERMANENT,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
623 ASC_SOURCE_SERVICEUSER,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
627 LOG(INFO) << "Association Rejected: Bad Application Context Name: " << buf;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628 cond = ASC_rejectAssociation(assoc, &rej);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
630 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
631 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
633 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
634 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635 }
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
636
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637 /* check the AETs */
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
638 if (!server.IsMyAETitle(calledAet))
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639 {
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
640 LOG(WARNING) << "Rejected association, because of a bad called AET in the request (" << calledAet << ")";
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
641 T_ASC_RejectParameters rej =
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
642 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
643 ASC_RESULT_REJECTEDPERMANENT,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
644 ASC_SOURCE_SERVICEUSER,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
645 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
646 };
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
647 ASC_rejectAssociation(assoc, &rej);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
648 AssociationCleanup(assoc);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
649 return NULL;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
650 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
652 if (server.HasApplicationEntityFilter() &&
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
653 !server.GetApplicationEntityFilter().IsAllowedConnection(remoteIp, remoteAet, calledAet))
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
654 {
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
655 LOG(WARNING) << "Rejected association for remote AET " << remoteAet << " on IP " << remoteIp;
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
656 T_ASC_RejectParameters rej =
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
657 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
658 ASC_RESULT_REJECTEDPERMANENT,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
659 ASC_SOURCE_SERVICEUSER,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
660 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
661 };
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
662 ASC_rejectAssociation(assoc, &rej);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
663 AssociationCleanup(assoc);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
664 return NULL;
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
665 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
666
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
667 if (opt_rejectWithoutImplementationUID &&
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
668 strlen(assoc->params->theirImplementationClassUID) == 0)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 /* reject: the no implementation Class UID provided */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 T_ASC_RejectParameters rej =
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 ASC_RESULT_REJECTEDPERMANENT,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674 ASC_SOURCE_SERVICEUSER,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 ASC_REASON_SU_NOREASON
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
678 LOG(INFO) << "Association Rejected: No Implementation Class UID provided";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 cond = ASC_rejectAssociation(assoc, &rej);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
682 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 cond = ASC_acknowledgeAssociation(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
692 LOG(ERROR) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695 }
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
696 LOG(INFO) << "Association Acknowledged (Max Send PDV: " << assoc->sendPDVLength << ")";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0)
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
698 LOG(INFO) << " (but no valid presentation contexts)";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
701 IApplicationEntityFilter* filter = server.HasApplicationEntityFilter() ? &server.GetApplicationEntityFilter() : NULL;
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
702 return new CommandDispatcher(server, assoc, remoteIp, remoteAet, calledAet, filter);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704
2134
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
705
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
706 CommandDispatcher::CommandDispatcher(const DicomServer& server,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
707 T_ASC_Association* assoc,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
708 const std::string& remoteIp,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
709 const std::string& remoteAet,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
710 const std::string& calledAet,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
711 IApplicationEntityFilter* filter) :
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
712 server_(server),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
713 assoc_(assoc),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
714 remoteIp_(remoteIp),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
715 remoteAet_(remoteAet),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
716 calledAet_(calledAet),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
717 filter_(filter)
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
718 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
719 associationTimeout_ = server.GetAssociationTimeout();
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
720 elapsedTimeSinceLastCommand_ = 0;
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
721 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
722
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
723
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
724 CommandDispatcher::~CommandDispatcher()
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
725 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
726 try
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
727 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
728 AssociationCleanup(assoc_);
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
729 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
730 catch (...)
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
731 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
732 LOG(ERROR) << "Some association was not cleanly aborted";
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
733 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
734 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
735
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
736
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737 bool CommandDispatcher::Step()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738 /*
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
739 * This function receives DIMSE commmands over the network connection
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740 * and handles these commands correspondingly. Note that in case of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 * storscp only C-ECHO-RQ and C-STORE-RQ commands can be processed.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742 */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744 bool finished = false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746 // receive a DIMSE command over the network, with a timeout of 1 second
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 DcmDataset *statusDetail = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748 T_ASC_PresentationContextID presID = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749 T_DIMSE_Message msg;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
750
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751 OFCondition cond = DIMSE_receiveCommand(assoc_, DIMSE_NONBLOCKING, 1, &presID, &msg, &statusDetail);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
752 elapsedTimeSinceLastCommand_++;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754 // if the command which was received has extra status
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 // detail information, dump this information
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 if (statusDetail != NULL)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 {
101
428784e59dcd trying to use log4cplus
jodogne
parents: 62
diff changeset
758 //LOG4CPP_WARN(Internals::GetLogger(), "Status Detail:" << OFendl << DcmObject::PrintHelper(*statusDetail));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 delete statusDetail;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
761
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
762 if (cond == DIMSE_OUTOFRESOURCES)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
764 finished = true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 else if (cond == DIMSE_NODATAAVAILABLE)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768 // Timeout due to DIMSE_NONBLOCKING
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
769 if (associationTimeout_ != 0 &&
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
770 elapsedTimeSinceLastCommand_ >= associationTimeout_)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 {
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
772 // This timeout is actually a association timeout
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 finished = true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776 else if (cond == EC_Normal)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777 {
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
778 // Reset the association timeout counter
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779 elapsedTimeSinceLastCommand_ = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
781 // Convert the type of request to Orthanc's internal type
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
782 bool supported = false;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
783 DicomRequestType request;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784 switch (msg.CommandField)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785 {
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
786 case DIMSE_C_ECHO_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
787 request = DicomRequestType_Echo;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
788 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
789 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
790
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
791 case DIMSE_C_STORE_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
792 request = DicomRequestType_Store;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
793 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
794 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
795
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
796 case DIMSE_C_MOVE_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
797 request = DicomRequestType_Move;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
798 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
799 break;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
800
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
801 case DIMSE_C_GET_RQ:
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
802 request = DicomRequestType_Get;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
803 supported = true;
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
804 break;
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
805
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
806 case DIMSE_C_FIND_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
807 request = DicomRequestType_Find;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
808 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
809 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
810
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
811 case DIMSE_N_ACTION_RQ:
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
812 request = DicomRequestType_NAction;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
813 supported = true;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
814 break;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
815
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
816 case DIMSE_N_EVENT_REPORT_RQ:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
817 request = DicomRequestType_NEventReport;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
818 supported = true;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
819 break;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
820
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
821 default:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
822 // we cannot handle this kind of message
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
823 cond = DIMSE_BADCOMMANDTYPE;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
824 LOG(ERROR) << "cannot handle command: 0x" << std::hex << msg.CommandField;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
825 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
826 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
827
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
828
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
829 // Check whether this request is allowed by the security filter
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
830 if (supported &&
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
831 filter_ != NULL &&
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
832 !filter_->IsAllowedRequest(remoteIp_, remoteAet_, calledAet_, request))
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
833 {
2352
3ab96768d144 Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
834 LOG(WARNING) << "Rejected " << EnumerationToString(request)
3ab96768d144 Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
835 << " request from remote DICOM modality with AET \""
3ab96768d144 Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
836 << remoteAet_ << "\" and hostname \"" << remoteIp_ << "\"";
1085
b161593551db Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1073
diff changeset
837 cond = DIMSE_ILLEGALASSOCIATION;
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
838 supported = false;
1085
b161593551db Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1073
diff changeset
839 finished = true;
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
840 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
841
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
842 // in case we received a supported message, process this command
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
843 if (supported)
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
844 {
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
845 // If anything goes wrong, there will be a "BADCOMMANDTYPE" answer
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
846 cond = DIMSE_BADCOMMANDTYPE;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
847
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
848 switch (request)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
849 {
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
850 case DicomRequestType_Echo:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
851 cond = EchoScp(assoc_, &msg, presID);
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
852 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
853
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
854 case DicomRequestType_Store:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
855 if (server_.HasStoreRequestHandlerFactory()) // Should always be true
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
856 {
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3704
diff changeset
857 std::unique_ptr<IStoreRequestHandler> handler
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
858 (server_.GetStoreRequestHandlerFactory().ConstructStoreRequestHandler());
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
859
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
860 if (handler.get() != NULL)
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
861 {
3704
58f92b1c8061 Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3691
diff changeset
862 cond = Internals::storeScp(assoc_, &msg, presID, *handler, remoteIp_, associationTimeout_);
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
863 }
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
864 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
865 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
866
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
867 case DicomRequestType_Move:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
868 if (server_.HasMoveRequestHandlerFactory()) // Should always be true
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
869 {
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3704
diff changeset
870 std::unique_ptr<IMoveRequestHandler> handler
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
871 (server_.GetMoveRequestHandlerFactory().ConstructMoveRequestHandler());
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
872
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
873 if (handler.get() != NULL)
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
874 {
3704
58f92b1c8061 Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3691
diff changeset
875 cond = Internals::moveScp(assoc_, &msg, presID, *handler, remoteIp_, remoteAet_, calledAet_, associationTimeout_);
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
876 }
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
877 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
878 break;
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
879
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
880 case DicomRequestType_Get:
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
881 if (server_.HasGetRequestHandlerFactory()) // Should always be true
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
882 {
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
883 std::auto_ptr<IGetRequestHandler> handler
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
884 (server_.GetGetRequestHandlerFactory().ConstructGetRequestHandler());
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
885
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
886 if (handler.get() != NULL)
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
887 {
3953
620e87e9e816 c-get: fixing memory with failedUIDs_
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3920
diff changeset
888 cond = Internals::getScp(assoc_, &msg, presID, *handler, remoteIp_, remoteAet_, calledAet_, associationTimeout_);
3818
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
889 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
890 }
4f78da5613a1 Add C-GET SCP support
Stacy Loesch <stacy.loesch@varian.com>
parents: 3769
diff changeset
891 break;
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
892
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
893 case DicomRequestType_Find:
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
894 if (server_.HasFindRequestHandlerFactory() || // Should always be true
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
895 server_.HasWorklistRequestHandlerFactory())
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
896 {
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3704
diff changeset
897 std::unique_ptr<IFindRequestHandler> findHandler;
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
898 if (server_.HasFindRequestHandlerFactory())
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
899 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
900 findHandler.reset(server_.GetFindRequestHandlerFactory().ConstructFindRequestHandler());
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
901 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
902
3712
2a170a8f1faf replacing std::auto_ptr by std::unique_ptr
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3704
diff changeset
903 std::unique_ptr<IWorklistRequestHandler> worklistHandler;
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
904 if (server_.HasWorklistRequestHandlerFactory())
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
905 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
906 worklistHandler.reset(server_.GetWorklistRequestHandlerFactory().ConstructWorklistRequestHandler());
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
907 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
908
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2352
diff changeset
909 cond = Internals::findScp(assoc_, &msg, presID, server_.GetRemoteModalities(),
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2352
diff changeset
910 findHandler.get(), worklistHandler.get(),
3704
58f92b1c8061 Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3691
diff changeset
911 remoteIp_, remoteAet_, calledAet_, associationTimeout_);
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
912 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
913 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
914
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
915 case DicomRequestType_NAction:
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
916 cond = NActionScp(&msg, presID);
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
917 break;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
918
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
919 case DicomRequestType_NEventReport:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
920 cond = NEventReportScp(&msg, presID);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
921 break;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
922
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
923 default:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
924 // Should never happen
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
925 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
926 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
927 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
928 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
929 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
930 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
931 // Bad status, which indicates the closing of the connection by
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
932 // the peer or a network error
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
933 finished = true;
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 661
diff changeset
934
667
aa2ab67d913d log error to log info
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 665
diff changeset
935 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
936 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
937
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
938 if (finished)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
939 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
940 if (cond == DUL_PEERREQUESTEDRELEASE)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
941 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
942 LOG(INFO) << "Association Release";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
943 ASC_acknowledgeRelease(assoc_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
944 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
945 else if (cond == DUL_PEERABORTEDASSOCIATION)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
946 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
947 LOG(INFO) << "Association Aborted";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
948 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
949 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
950 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
951 OFString temp_str;
2352
3ab96768d144 Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
952 LOG(INFO) << "DIMSE failure (aborting association): " << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
953 /* some kind of error so abort the association */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
954 ASC_abortAssociation(assoc_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
955 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
956 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
957
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
958 return !finished;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
959 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
960
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
961
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
962 OFCondition EchoScp(T_ASC_Association * assoc, T_DIMSE_Message * msg, T_ASC_PresentationContextID presID)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
963 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
964 OFString temp_str;
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
965 LOG(INFO) << "Received Echo Request";
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
966 //LOG(DEBUG) << DIMSE_dumpMessage(temp_str, msg->msg.CEchoRQ, DIMSE_INCOMING, NULL, presID));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
967
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
968 /* the echo succeeded !! */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
969 OFCondition cond = DIMSE_sendEchoResponse(assoc, presID, &msg->msg.CEchoRQ, STATUS_Success, NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
970 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
971 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
972 LOG(ERROR) << "Echo SCP Failed: " << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
973 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
974 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
975 }
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
976
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
977
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
978 static DcmDataset* ReadDataset(T_ASC_Association* assoc,
3706
bd34b6ac5c08 timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3705
diff changeset
979 const char* errorMessage,
bd34b6ac5c08 timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3705
diff changeset
980 int timeout)
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
981 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
982 DcmDataset *tmp = NULL;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
983 T_ASC_PresentationContextID presIdData;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
984
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
985 OFCondition cond = DIMSE_receiveDataSetInMemory(
3706
bd34b6ac5c08 timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3705
diff changeset
986 assoc, (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), timeout,
bd34b6ac5c08 timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3705
diff changeset
987 &presIdData, &tmp, NULL, NULL);
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
988 if (!cond.good() ||
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
989 tmp == NULL)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
990 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
991 throw OrthancException(ErrorCode_NetworkProtocol, errorMessage);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
992 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
993
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
994 return tmp;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
995 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
996
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
997
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
998 static std::string ReadString(DcmDataset& dataset,
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
999 const DcmTagKey& tag)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1000 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1001 const char* s = NULL;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1002 if (!dataset.findAndGetString(tag, s).good() ||
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1003 s == NULL)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1004 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1005 char buf[64];
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1006 sprintf(buf, "Missing mandatory tag in dataset: (%04X,%04X)",
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1007 tag.getGroup(), tag.getElement());
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1008 throw OrthancException(ErrorCode_NetworkProtocol, buf);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1009 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1010
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1011 return std::string(s);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1012 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1013
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1014
3736
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1015 static void ReadSopSequence(
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1016 std::vector<std::string>& sopClassUids,
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1017 std::vector<std::string>& sopInstanceUids,
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1018 std::vector<StorageCommitmentFailureReason>* failureReasons, // Can be NULL
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1019 DcmDataset& dataset,
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1020 const DcmTagKey& tag,
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1021 bool mandatory)
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1022 {
3614
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1023 sopClassUids.clear();
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1024 sopInstanceUids.clear();
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1025
3736
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1026 if (failureReasons)
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1027 {
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1028 failureReasons->clear();
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1029 }
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1030
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1031 DcmSequenceOfItems* sequence = NULL;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1032 if (!dataset.findAndGetSequence(tag, sequence).good() ||
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1033 sequence == NULL)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1034 {
3614
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1035 if (mandatory)
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1036 {
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1037 char buf[64];
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1038 sprintf(buf, "Missing mandatory sequence in dataset: (%04X,%04X)",
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1039 tag.getGroup(), tag.getElement());
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1040 throw OrthancException(ErrorCode_NetworkProtocol, buf);
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1041 }
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1042 else
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1043 {
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1044 return;
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1045 }
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1046 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1047
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1048 sopClassUids.reserve(sequence->card());
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1049 sopInstanceUids.reserve(sequence->card());
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1050
3736
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1051 if (failureReasons)
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1052 {
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1053 failureReasons->reserve(sequence->card());
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1054 }
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1055
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1056 for (unsigned long i = 0; i < sequence->card(); i++)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1057 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1058 const char* a = NULL;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1059 const char* b = NULL;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1060 if (!sequence->getItem(i)->findAndGetString(DCM_ReferencedSOPClassUID, a).good() ||
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1061 !sequence->getItem(i)->findAndGetString(DCM_ReferencedSOPInstanceUID, b).good() ||
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1062 a == NULL ||
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1063 b == NULL)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1064 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1065 throw OrthancException(ErrorCode_NetworkProtocol,
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1066 "Missing Referenced SOP Class/Instance UID "
3736
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1067 "in storage commitment dataset");
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1068 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1069
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1070 sopClassUids.push_back(a);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1071 sopInstanceUids.push_back(b);
3736
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1072
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1073 if (failureReasons != NULL)
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1074 {
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1075 Uint16 reason;
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1076 if (!sequence->getItem(i)->findAndGetUint16(DCM_FailureReason, reason).good())
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1077 {
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1078 throw OrthancException(ErrorCode_NetworkProtocol,
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1079 "Missing Failure Reason (0008,1197) "
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1080 "in storage commitment dataset");
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1081 }
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1082
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1083 failureReasons->push_back(static_cast<StorageCommitmentFailureReason>(reason));
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1084 }
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1085 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1086 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1087
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1088
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1089 OFCondition CommandDispatcher::NActionScp(T_DIMSE_Message* msg,
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1090 T_ASC_PresentationContextID presID)
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1091 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1092 /**
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1093 * Starting with Orthanc 1.6.0, only storage commitment is
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1094 * supported with DICOM N-ACTION. This corresponds to the case
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1095 * where "Action Type ID" equals "1".
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1096 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.2.html
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1097 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#table_10.1-4
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1098 **/
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1099
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1100 if (msg->CommandField != DIMSE_N_ACTION_RQ /* value == 304 == 0x0130 */ ||
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1101 !server_.HasStorageCommitmentRequestHandlerFactory())
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1102 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1103 throw OrthancException(ErrorCode_InternalError);
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1104 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1105
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1106
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1107 /**
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1108 * Check that the storage commitment request is correctly formatted.
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1109 **/
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1110
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1111 const T_DIMSE_N_ActionRQ& request = msg->msg.NActionRQ;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1112
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1113 if (request.ActionTypeID != 1)
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1114 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1115 throw OrthancException(ErrorCode_NotImplemented,
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1116 "Only storage commitment is implemented for DICOM N-ACTION SCP");
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1117 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1118
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1119 if (std::string(request.RequestedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass ||
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1120 std::string(request.RequestedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance)
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1121 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1122 throw OrthancException(ErrorCode_NetworkProtocol,
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1123 "Unexpected incoming SOP class or instance UID for storage commitment");
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1124 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1125
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1126 if (request.DataSetType != DIMSE_DATASET_PRESENT)
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1127 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1128 throw OrthancException(ErrorCode_NetworkProtocol,
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1129 "Incoming storage commitment request without a dataset");
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1130 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1131
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1132
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1133 /**
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1134 * Extract the DICOM dataset that is associated with the DIMSE
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1135 * message. The content of this dataset is documented in "Table
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1136 * J.3-1. Storage Commitment Request - Action Information":
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1137 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.2.html#table_J.3-1
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1138 **/
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1139
3767
c6658187e4b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3736
diff changeset
1140 std::unique_ptr<DcmDataset> dataset(
3706
bd34b6ac5c08 timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3705
diff changeset
1141 ReadDataset(assoc_, "Cannot read the dataset in N-ACTION SCP", associationTimeout_));
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1142
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1143 std::string transactionUid = ReadString(*dataset, DCM_TransactionUID);
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1144
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1145 std::vector<std::string> sopClassUid, sopInstanceUid;
3736
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1146 ReadSopSequence(sopClassUid, sopInstanceUid, NULL,
3614
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1147 *dataset, DCM_ReferencedSOPSequence, true /* mandatory */);
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1148
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1149 LOG(INFO) << "Incoming storage commitment request, with transaction UID: " << transactionUid;
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1150
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1151 for (size_t i = 0; i < sopClassUid.size(); i++)
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1152 {
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1153 LOG(INFO) << " (" << (i + 1) << "/" << sopClassUid.size()
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1154 << ") queried SOP Class/Instance UID: "
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1155 << sopClassUid[i] << " / " << sopInstanceUid[i];
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1156 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1157
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1158
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1159 /**
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1160 * Call the Orthanc handler. The list of available DIMSE status
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1161 * codes can be found at:
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1162 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#sect_10.1.4.1.10
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1163 **/
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1164
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1165 DIC_US dimseStatus;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1166
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1167 try
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1168 {
3767
c6658187e4b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3736
diff changeset
1169 std::unique_ptr<IStorageCommitmentRequestHandler> handler
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1170 (server_.GetStorageCommitmentRequestHandlerFactory().
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1171 ConstructStorageCommitmentRequestHandler());
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1172
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1173 handler->HandleRequest(transactionUid, sopClassUid, sopInstanceUid,
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1174 remoteIp_, remoteAet_, calledAet_);
3604
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1175
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1176 dimseStatus = 0; // Success
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1177 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1178 catch (OrthancException& e)
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1179 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1180 LOG(ERROR) << "Error while processing an incoming storage commitment request: " << e.What();
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1181
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1182 // Code 0x0110 - "General failure in processing the operation was encountered"
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1183 dimseStatus = STATUS_N_ProcessingFailure;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1184 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1185
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1186
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1187 /**
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1188 * Send the DIMSE status back to the SCU.
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1189 **/
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1190
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1191 {
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1192 T_DIMSE_Message response;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1193 memset(&response, 0, sizeof(response));
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1194 response.CommandField = DIMSE_N_ACTION_RSP;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1195
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1196 T_DIMSE_N_ActionRSP& content = response.msg.NActionRSP;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1197 content.MessageIDBeingRespondedTo = request.MessageID;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1198 strncpy(content.AffectedSOPClassUID, UID_StorageCommitmentPushModelSOPClass, DIC_UI_LEN);
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1199 content.DimseStatus = dimseStatus;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1200 strncpy(content.AffectedSOPInstanceUID, UID_StorageCommitmentPushModelSOPInstance, DIC_UI_LEN);
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1201 content.ActionTypeID = 0; // Not present, as "O_NACTION_ACTIONTYPEID" not set in "opts"
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1202 content.DataSetType = DIMSE_DATASET_NULL; // Dataset is absent in storage commitment response
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1203 content.opts = O_NACTION_AFFECTEDSOPCLASSUID | O_NACTION_AFFECTEDSOPINSTANCEUID;
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1204
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1205 return DIMSE_sendMessageUsingMemoryData(
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1206 assoc_, presID, &response, NULL /* no dataset */, NULL /* dataObject */,
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1207 NULL /* callback */, NULL /* callback context */, NULL /* commandSet */);
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1208 }
e327b44780bb abstraction: storage commitment handler
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3451
diff changeset
1209 }
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1210
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1211
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1212 OFCondition CommandDispatcher::NEventReportScp(T_DIMSE_Message* msg,
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1213 T_ASC_PresentationContextID presID)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1214 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1215 /**
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1216 * Starting with Orthanc 1.6.0, handling N-EVENT-REPORT for
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1217 * storage commitment.
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1218 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.3.html
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1219 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#table_10.1-1
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1220 **/
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1221
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1222 if (msg->CommandField != DIMSE_N_EVENT_REPORT_RQ /* value == 256 == 0x0100 */ ||
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1223 !server_.HasStorageCommitmentRequestHandlerFactory())
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1224 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1225 throw OrthancException(ErrorCode_InternalError);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1226 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1227
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1228
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1229 /**
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1230 * Check that the storage commitment report is correctly formatted.
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1231 **/
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1232
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1233 const T_DIMSE_N_EventReportRQ& report = msg->msg.NEventReportRQ;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1234
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1235 if (report.EventTypeID != 1 /* successful */ &&
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1236 report.EventTypeID != 2 /* failures exist */)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1237 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1238 throw OrthancException(ErrorCode_NotImplemented,
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1239 "Unknown event for DICOM N-EVENT-REPORT SCP");
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1240 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1241
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1242 if (std::string(report.AffectedSOPClassUID) != UID_StorageCommitmentPushModelSOPClass ||
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1243 std::string(report.AffectedSOPInstanceUID) != UID_StorageCommitmentPushModelSOPInstance)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1244 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1245 throw OrthancException(ErrorCode_NetworkProtocol,
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1246 "Unexpected incoming SOP class or instance UID for storage commitment");
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1247 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1248
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1249 if (report.DataSetType != DIMSE_DATASET_PRESENT)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1250 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1251 throw OrthancException(ErrorCode_NetworkProtocol,
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1252 "Incoming storage commitment report without a dataset");
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1253 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1254
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1255
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1256 /**
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1257 * Extract the DICOM dataset that is associated with the DIMSE
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1258 * message. The content of this dataset is documented in "Table
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1259 * J.3-2. Storage Commitment Result - Event Information":
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1260 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part04/sect_J.3.3.html#table_J.3-2
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1261 **/
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1262
3767
c6658187e4b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3736
diff changeset
1263 std::unique_ptr<DcmDataset> dataset(
3706
bd34b6ac5c08 timeouts in storage commitment SCU and SCP
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3705
diff changeset
1264 ReadDataset(assoc_, "Cannot read the dataset in N-EVENT-REPORT SCP", associationTimeout_));
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1265
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1266 std::string transactionUid = ReadString(*dataset, DCM_TransactionUID);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1267
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1268 std::vector<std::string> successSopClassUid, successSopInstanceUid;
3736
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1269 ReadSopSequence(successSopClassUid, successSopInstanceUid, NULL,
3614
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1270 *dataset, DCM_ReferencedSOPSequence,
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1271 (report.EventTypeID == 1) /* mandatory in the case of success */);
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1272
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1273 std::vector<std::string> failedSopClassUid, failedSopInstanceUid;
3736
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1274 std::vector<StorageCommitmentFailureReason> failureReasons;
3614
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1275
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1276 if (report.EventTypeID == 2 /* failures exist */)
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1277 {
3736
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1278 ReadSopSequence(failedSopClassUid, failedSopInstanceUid, &failureReasons,
3614
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1279 *dataset, DCM_FailedSOPSequence, true);
4543ffad256d storage commitment requests/responses to/from self are working
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3613
diff changeset
1280 }
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1281
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1282 LOG(INFO) << "Incoming storage commitment report, with transaction UID: " << transactionUid;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1283
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1284 for (size_t i = 0; i < successSopClassUid.size(); i++)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1285 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1286 LOG(INFO) << " (success " << (i + 1) << "/" << successSopClassUid.size()
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1287 << ") SOP Class/Instance UID: "
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1288 << successSopClassUid[i] << " / " << successSopInstanceUid[i];
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1289 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1290
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1291 for (size_t i = 0; i < failedSopClassUid.size(); i++)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1292 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1293 LOG(INFO) << " (failure " << (i + 1) << "/" << failedSopClassUid.size()
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1294 << ") SOP Class/Instance UID: "
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1295 << failedSopClassUid[i] << " / " << failedSopInstanceUid[i];
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1296 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1297
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1298 /**
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1299 * Call the Orthanc handler. The list of available DIMSE status
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1300 * codes can be found at:
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1301 * http://dicom.nema.org/medical/dicom/2019a/output/chtml/part07/chapter_10.html#sect_10.1.4.1.10
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1302 **/
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1303
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1304 DIC_US dimseStatus;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1305
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1306 try
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1307 {
3767
c6658187e4b1 cppcheck
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3736
diff changeset
1308 std::unique_ptr<IStorageCommitmentRequestHandler> handler
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1309 (server_.GetStorageCommitmentRequestHandlerFactory().
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1310 ConstructStorageCommitmentRequestHandler());
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1311
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1312 handler->HandleReport(transactionUid, successSopClassUid, successSopInstanceUid,
3736
0540b54324f1 StorageCommitmentReports
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3713
diff changeset
1313 failedSopClassUid, failedSopInstanceUid, failureReasons,
3613
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1314 remoteIp_, remoteAet_, calledAet_);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1315
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1316 dimseStatus = 0; // Success
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1317 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1318 catch (OrthancException& e)
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1319 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1320 LOG(ERROR) << "Error while processing an incoming storage commitment report: " << e.What();
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1321
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1322 // Code 0x0110 - "General failure in processing the operation was encountered"
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1323 dimseStatus = STATUS_N_ProcessingFailure;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1324 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1325
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1326
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1327 /**
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1328 * Send the DIMSE status back to the SCU.
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1329 **/
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1330
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1331 {
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1332 T_DIMSE_Message response;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1333 memset(&response, 0, sizeof(response));
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1334 response.CommandField = DIMSE_N_EVENT_REPORT_RSP;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1335
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1336 T_DIMSE_N_EventReportRSP& content = response.msg.NEventReportRSP;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1337 content.MessageIDBeingRespondedTo = report.MessageID;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1338 strncpy(content.AffectedSOPClassUID, UID_StorageCommitmentPushModelSOPClass, DIC_UI_LEN);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1339 content.DimseStatus = dimseStatus;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1340 strncpy(content.AffectedSOPInstanceUID, UID_StorageCommitmentPushModelSOPInstance, DIC_UI_LEN);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1341 content.EventTypeID = 0; // Not present, as "O_NEVENTREPORT_EVENTTYPEID" not set in "opts"
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1342 content.DataSetType = DIMSE_DATASET_NULL; // Dataset is absent in storage commitment response
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1343 content.opts = O_NEVENTREPORT_AFFECTEDSOPCLASSUID | O_NEVENTREPORT_AFFECTEDSOPINSTANCEUID;
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1344
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1345 return DIMSE_sendMessageUsingMemoryData(
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1346 assoc_, presID, &response, NULL /* no dataset */, NULL /* dataObject */,
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1347 NULL /* callback */, NULL /* callback context */, NULL /* commandSet */);
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1348 }
c1e2b91c2ab4 all the abstractions for storage commitment are available
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3612
diff changeset
1349 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1350 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1351 }