annotate Core/DicomNetworking/Internals/CommandDispatcher.cpp @ 3342:63f59ad9381a

Fix issue #136 (C-Find request fails when found DICOM file does not have certain tags)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Apr 2019 13:36:13 +0200
parents bce0e4c9ca45
children 6e42d676401c
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
3060
4e43e67f8ecf preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2786
diff changeset
5 * Copyright (C) 2017-2019 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"
2382
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
93 #include "../../Toolbox.h"
7284093111b0 big reorganization to cleanly separate framework vs. server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2381
diff changeset
94 #include "../../Logging.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
95
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96 #include <dcmtk/dcmnet/dcasccfg.h> /* for class DcmAssociationConfiguration */
101
428784e59dcd trying to use log4cplus
jodogne
parents: 62
diff changeset
97 #include <boost/lexical_cast.hpp>
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
98
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 static OFBool opt_rejectWithoutImplementationUID = OFFalse;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
102
1806
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
103 static DUL_PRESENTATIONCONTEXT *
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
104 findPresentationContextID(LST_HEAD * head,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
105 T_ASC_PresentationContextID presentationContextID)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
106 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
107 DUL_PRESENTATIONCONTEXT *pc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
108 LST_HEAD **l;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
109 OFBool found = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
110
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
111 if (head == NULL)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
112 return NULL;
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 l = &head;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
115 if (*l == NULL)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
116 return NULL;
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 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Head(l));
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
119 (void)LST_Position(l, OFstatic_cast(LST_NODE *, pc));
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 while (pc && !found) {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
122 if (pc->presentationContextID == presentationContextID) {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
123 found = OFTrue;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
124 } else {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
125 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Next(l));
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
126 }
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 return pc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
129 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
130
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
131
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
132 /** accept all presenstation contexts for unknown SOP classes,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
133 * i.e. UIDs appearing in the list of abstract syntaxes
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
134 * where no corresponding name is defined in the UID dictionary.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
135 * @param params pointer to association parameters structure
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
136 * @param transferSyntax transfer syntax to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
137 * @param acceptedRole SCU/SCP role to accept
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 static OFCondition acceptUnknownContextsWithTransferSyntax(
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
140 T_ASC_Parameters * params,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
141 const char* transferSyntax,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
142 T_ASC_SC_ROLE acceptedRole)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
143 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
144 OFCondition cond = EC_Normal;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
145 int n, i, k;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
146 DUL_PRESENTATIONCONTEXT *dpc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
147 T_ASC_PresentationContext pc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
148 OFBool accepted = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
149 OFBool abstractOK = OFFalse;
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 n = ASC_countPresentationContexts(params);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
152 for (i = 0; i < n; i++)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
153 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
154 cond = ASC_getPresentationContext(params, i, &pc);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
155 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
156 abstractOK = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
157 accepted = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
158
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
159 if (dcmFindNameOfUID(pc.abstractSyntax) == NULL)
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 abstractOK = OFTrue;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
162
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
163 /* check the transfer syntax */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
164 for (k = 0; (k < OFstatic_cast(int, pc.transferSyntaxCount)) && !accepted; k++)
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 (strcmp(pc.proposedTransferSyntaxes[k], transferSyntax) == 0)
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 accepted = 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 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
171 }
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 (accepted)
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 cond = ASC_acceptPresentationContext(
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
176 params, pc.presentationContextID,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
177 transferSyntax, acceptedRole);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
178 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
179 } else {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
180 T_ASC_P_ResultReason reason;
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 /* do not refuse if already accepted */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
183 dpc = findPresentationContextID(params->DULparams.acceptedPresentationContext,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
184 pc.presentationContextID);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
185 if ((dpc == NULL) || ((dpc != NULL) && (dpc->result != ASC_P_ACCEPTANCE)))
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
186 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
187
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
188 if (abstractOK) {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
189 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
190 } else {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
191 reason = ASC_P_ABSTRACTSYNTAXNOTSUPPORTED;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
192 }
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 * If previously this presentation context was refused
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
195 * because of bad transfer syntax let it stay that way.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
196 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
197 if ((dpc != NULL) && (dpc->result == ASC_P_TRANSFERSYNTAXESNOTSUPPORTED))
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
198 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED;
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 cond = ASC_refusePresentationContext(params, pc.presentationContextID, reason);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
201 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
202 }
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 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
205 return EC_Normal;
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
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
208
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
209 /** accept all presenstation contexts for unknown SOP classes,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
210 * i.e. UIDs appearing in the list of abstract syntaxes
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
211 * where no corresponding name is defined in the UID dictionary.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
212 * This method is passed a list of "preferred" transfer syntaxes.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
213 * @param params pointer to association parameters structure
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
214 * @param transferSyntax transfer syntax to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
215 * @param acceptedRole SCU/SCP role to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
216 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
217 static OFCondition acceptUnknownContextsWithPreferredTransferSyntaxes(
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
218 T_ASC_Parameters * params,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
219 const char* transferSyntaxes[], int transferSyntaxCount,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
220 T_ASC_SC_ROLE acceptedRole = ASC_SC_ROLE_DEFAULT)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
221 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
222 OFCondition cond = EC_Normal;
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 ** Accept in the order "least wanted" to "most wanted" transfer
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
225 ** syntax. Accepting a transfer syntax will override previously
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
226 ** accepted transfer syntaxes.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
227 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
228 for (int i = transferSyntaxCount - 1; i >= 0; i--)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
229 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
230 cond = acceptUnknownContextsWithTransferSyntax(params, transferSyntaxes[i], acceptedRole);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
231 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
232 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
233 return cond;
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
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
236
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
237
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
238 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 namespace Internals
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 {
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
242 /**
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
243 * EXTRACT OF FILE "dcmdata/libsrc/dcuid.cc" FROM DCMTK 3.6.0
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
244 * (dcmAllStorageSOPClassUIDs).
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
245 *
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
246 * an array of const strings containing all known Storage SOP
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
247 * Classes that fit into the conventional
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
248 * PATIENT-STUDY-SERIES-INSTANCE information model,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
249 * i.e. everything a Storage SCP might want to store in a PACS.
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
250 * Special cases such as hanging protocol storage or the Storage
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
251 * SOP Class are not included in this list.
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
252 *
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
253 * THIS LIST CONTAINS ALL STORAGE SOP CLASSES INCLUDING RETIRED
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
254 * ONES AND IS LARGER THAN 64 ENTRIES.
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
255 */
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
256
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
257 const char* orthancStorageSOPClassUIDs[] =
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
258 {
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
259 UID_AmbulatoryECGWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
260 UID_ArterialPulseWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
261 UID_AutorefractionMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
262 UID_BasicStructuredDisplayStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
263 UID_BasicTextSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
264 UID_BasicVoiceAudioWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
265 UID_BlendingSoftcopyPresentationStateStorage,
3249
bce0e4c9ca45 fix for dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3247
diff changeset
266 #if DCMTK_VERSION_NUMBER >= 361
3247
fcc2b99feaaf Support for DICOM storage SOP classes BreastProjectionXRayImageStorageForProcessing and BreastProjectionXRayImageStorageForPresentation.
jku11 <jpa.kuijer@vumc.nl>
parents: 3118
diff changeset
267 UID_BreastProjectionXRayImageStorageForProcessing,
fcc2b99feaaf Support for DICOM storage SOP classes BreastProjectionXRayImageStorageForProcessing and BreastProjectionXRayImageStorageForPresentation.
jku11 <jpa.kuijer@vumc.nl>
parents: 3118
diff changeset
268 UID_BreastProjectionXRayImageStorageForPresentation,
3249
bce0e4c9ca45 fix for dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3247
diff changeset
269 #endif
bce0e4c9ca45 fix for dcmtk 3.6.0
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 3247
diff changeset
270 UID_BreastTomosynthesisImageStorage,
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
271 UID_CardiacElectrophysiologyWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
272 UID_ChestCADSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
273 UID_ColonCADSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
274 UID_ColorSoftcopyPresentationStateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
275 UID_ComprehensiveSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
276 UID_ComputedRadiographyImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
277 UID_CTImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
278 UID_DeformableSpatialRegistrationStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
279 UID_DigitalIntraOralXRayImageStorageForPresentation,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
280 UID_DigitalIntraOralXRayImageStorageForProcessing,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
281 UID_DigitalMammographyXRayImageStorageForPresentation,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
282 UID_DigitalMammographyXRayImageStorageForProcessing,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
283 UID_DigitalXRayImageStorageForPresentation,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
284 UID_DigitalXRayImageStorageForProcessing,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
285 UID_EncapsulatedCDAStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
286 UID_EncapsulatedPDFStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
287 UID_EnhancedCTImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
288 UID_EnhancedMRColorImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
289 UID_EnhancedMRImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
290 UID_EnhancedPETImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
291 UID_EnhancedSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
292 UID_EnhancedUSVolumeStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
293 UID_EnhancedXAImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
294 UID_EnhancedXRFImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
295 UID_GeneralAudioWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
296 UID_GeneralECGWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
297 UID_GenericImplantTemplateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
298 UID_GrayscaleSoftcopyPresentationStateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
299 UID_HemodynamicWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
300 UID_ImplantAssemblyTemplateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
301 UID_ImplantationPlanSRDocumentStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
302 UID_ImplantTemplateGroupStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
303 UID_IntraocularLensCalculationsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
304 UID_KeratometryMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
305 UID_KeyObjectSelectionDocumentStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
306 UID_LensometryMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
307 UID_MacularGridThicknessAndVolumeReportStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
308 UID_MammographyCADSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
309 UID_MRImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
310 UID_MRSpectroscopyStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
311 UID_MultiframeGrayscaleByteSecondaryCaptureImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
312 UID_MultiframeGrayscaleWordSecondaryCaptureImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
313 UID_MultiframeSingleBitSecondaryCaptureImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
314 UID_MultiframeTrueColorSecondaryCaptureImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
315 UID_NuclearMedicineImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
316 UID_OphthalmicAxialMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
317 UID_OphthalmicPhotography16BitImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
318 UID_OphthalmicPhotography8BitImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
319 UID_OphthalmicTomographyImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
320 UID_OphthalmicVisualFieldStaticPerimetryMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
321 UID_PositronEmissionTomographyImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
322 UID_ProcedureLogStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
323 UID_PseudoColorSoftcopyPresentationStateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
324 UID_RawDataStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
325 UID_RealWorldValueMappingStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
326 UID_RespiratoryWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
327 UID_RTBeamsTreatmentRecordStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
328 UID_RTBrachyTreatmentRecordStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
329 UID_RTDoseStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
330 UID_RTImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
331 UID_RTIonBeamsTreatmentRecordStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
332 UID_RTIonPlanStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
333 UID_RTPlanStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
334 UID_RTStructureSetStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
335 UID_RTTreatmentSummaryRecordStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
336 UID_SecondaryCaptureImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
337 UID_SegmentationStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
338 UID_SpatialFiducialsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
339 UID_SpatialRegistrationStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
340 UID_SpectaclePrescriptionReportStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
341 UID_StereometricRelationshipStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
342 UID_SubjectiveRefractionMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
343 UID_SurfaceSegmentationStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
344 UID_TwelveLeadECGWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
345 UID_UltrasoundImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
346 UID_UltrasoundMultiframeImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
347 UID_VideoEndoscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
348 UID_VideoMicroscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
349 UID_VideoPhotographicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
350 UID_VisualAcuityMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
351 UID_VLEndoscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
352 UID_VLMicroscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
353 UID_VLPhotographicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
354 UID_VLSlideCoordinatesMicroscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
355 UID_VLWholeSlideMicroscopyImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
356 UID_XAXRFGrayscaleSoftcopyPresentationStateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
357 UID_XRay3DAngiographicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
358 UID_XRay3DCraniofacialImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
359 UID_XRayAngiographicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
360 UID_XRayRadiationDoseSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
361 UID_XRayRadiofluoroscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
362 // retired
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
363 UID_RETIRED_HardcopyColorImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
364 UID_RETIRED_HardcopyGrayscaleImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
365 UID_RETIRED_NuclearMedicineImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
366 UID_RETIRED_StandaloneCurveStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
367 UID_RETIRED_StandaloneModalityLUTStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
368 UID_RETIRED_StandaloneOverlayStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
369 UID_RETIRED_StandalonePETCurveStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
370 UID_RETIRED_StandaloneVOILUTStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
371 UID_RETIRED_StoredPrintStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
372 UID_RETIRED_UltrasoundImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
373 UID_RETIRED_UltrasoundMultiframeImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
374 UID_RETIRED_VLImageStorage,
3118
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
375 #if DCMTK_VERSION_NUMBER >= 364
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
376 UID_RETIRED_VLMultiframeImageStorage,
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
377 #else
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
378 UID_RETIRED_VLMultiFrameImageStorage,
3118
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
379 #endif
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
380 UID_RETIRED_XRayAngiographicBiPlaneImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
381 // draft
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
382 UID_DRAFT_SRAudioStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
383 UID_DRAFT_SRComprehensiveStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
384 UID_DRAFT_SRDetailStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
385 UID_DRAFT_SRTextStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
386 UID_DRAFT_WaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
387 UID_DRAFT_RTBeamsDeliveryInstructionStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
388 NULL
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
389 };
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
390
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
391 const int orthancStorageSOPClassUIDsCount = (sizeof(orthancStorageSOPClassUIDs) / sizeof(const char*)) - 1;
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
392
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
393
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
394
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 OFCondition AssociationCleanup(T_ASC_Association *assoc)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 OFCondition cond = ASC_dropSCPAssociation(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
400 LOG(FATAL) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 cond = ASC_destroyAssociation(&assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
407 LOG(FATAL) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
413
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
414
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 CommandDispatcher* AcceptAssociation(const DicomServer& server, T_ASC_Network *net)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 DcmAssociationConfiguration asccfg;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419 char buf[BUFSIZ];
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 T_ASC_Association *assoc;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 OFCondition cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 OFString sprofile;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 OFString temp_str;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 std::vector<const char*> knownAbstractSyntaxes;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
427 // For C-STORE
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
428 if (server.HasStoreRequestHandlerFactory())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
429 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
430 knownAbstractSyntaxes.push_back(UID_VerificationSOPClass);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
431 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 // For C-FIND
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 if (server.HasFindRequestHandlerFactory())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
436 knownAbstractSyntaxes.push_back(UID_FINDPatientRootQueryRetrieveInformationModel);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 knownAbstractSyntaxes.push_back(UID_FINDStudyRootQueryRetrieveInformationModel);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
438 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
439
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
440 if (server.HasWorklistRequestHandlerFactory())
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
441 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
442 knownAbstractSyntaxes.push_back(UID_FINDModalityWorklistInformationModel);
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
443 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
444
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 // For C-MOVE
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 if (server.HasMoveRequestHandlerFactory())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 knownAbstractSyntaxes.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel);
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 661
diff changeset
449 knownAbstractSyntaxes.push_back(UID_MOVEPatientRootQueryRetrieveInformationModel);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
450 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
451
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
452 cond = ASC_receiveAssociation(net, &assoc,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 /*opt_maxPDU*/ ASC_DEFAULTMAXPDU,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 NULL, NULL,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
455 /*opt_secureConnection*/ OFFalse,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 DUL_NOBLOCK, 1);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
457
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 if (cond == DUL_NOASSOCIATIONREQUEST)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
459 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
460 // Timeout
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
461 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
462 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
463 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
464
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
465 // if some kind of error occured, take care of it
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
466 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
467 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
468 LOG(ERROR) << "Receiving Association failed: " << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
469 // 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
470 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
471 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
472 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
473
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
474 // 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
475 std::string remoteAet;
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
476 std::string remoteIp;
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
477 std::string calledAet;
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
478
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
479 {
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
480 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
481 DIC_AE calledAet_C;
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
482 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
483 DIC_AE calledIP_C;
3118
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
484
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
485 if (
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
486 #if DCMTK_VERSION_NUMBER >= 364
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
487 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
488 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
489 #else
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
490 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
491 ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad()
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
492 #endif
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
493 )
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
494 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
495 T_ASC_RejectParameters rej =
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
496 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
497 ASC_RESULT_REJECTEDPERMANENT,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
498 ASC_SOURCE_SERVICEUSER,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
499 ASC_REASON_SU_NOREASON
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
500 };
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
501 ASC_rejectAssociation(assoc, &rej);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
502 AssociationCleanup(assoc);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
503 return NULL;
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
504 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
505
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
506 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
507 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
508 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
509 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
510
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
511 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
512 << " on IP " << remoteIp;
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
513
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
514
661
d233b5090105 accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 620
diff changeset
515 std::vector<const char*> transferSyntaxes;
d233b5090105 accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 620
diff changeset
516
d233b5090105 accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 620
diff changeset
517 // This is the list of the transfer syntaxes that were supported up to Orthanc 0.7.1
d233b5090105 accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 620
diff changeset
518 transferSyntaxes.push_back(UID_LittleEndianExplicitTransferSyntax);
d233b5090105 accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 620
diff changeset
519 transferSyntaxes.push_back(UID_BigEndianExplicitTransferSyntax);
d233b5090105 accept more transfer syntaxes for C-Store SCP, write meta-header when receiving files
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 620
diff changeset
520 transferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax);
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 661
diff changeset
521
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 661
diff changeset
522 // New transfer syntaxes supported since Orthanc 0.7.2
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
523 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
524 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Deflated))
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
525 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
526 transferSyntaxes.push_back(UID_DeflatedExplicitVRLittleEndianTransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
527 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
528
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
529 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
530 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpeg))
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
531 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
532 transferSyntaxes.push_back(UID_JPEGProcess1TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
533 transferSyntaxes.push_back(UID_JPEGProcess2_4TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
534 transferSyntaxes.push_back(UID_JPEGProcess3_5TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
535 transferSyntaxes.push_back(UID_JPEGProcess6_8TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
536 transferSyntaxes.push_back(UID_JPEGProcess7_9TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
537 transferSyntaxes.push_back(UID_JPEGProcess10_12TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
538 transferSyntaxes.push_back(UID_JPEGProcess11_13TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
539 transferSyntaxes.push_back(UID_JPEGProcess14TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
540 transferSyntaxes.push_back(UID_JPEGProcess15TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
541 transferSyntaxes.push_back(UID_JPEGProcess16_18TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
542 transferSyntaxes.push_back(UID_JPEGProcess17_19TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
543 transferSyntaxes.push_back(UID_JPEGProcess20_22TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
544 transferSyntaxes.push_back(UID_JPEGProcess21_23TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
545 transferSyntaxes.push_back(UID_JPEGProcess24_26TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
546 transferSyntaxes.push_back(UID_JPEGProcess25_27TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
547 transferSyntaxes.push_back(UID_JPEGProcess28TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
548 transferSyntaxes.push_back(UID_JPEGProcess29TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
549 transferSyntaxes.push_back(UID_JPEGProcess14SV1TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
550 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
551
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
552 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
553 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpeg2000))
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
554 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
555 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
556 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax);
2786
e7a10626645f Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
557 transferSyntaxes.push_back(UID_JPEG2000LosslessOnlyTransferSyntax);
e7a10626645f Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
558 transferSyntaxes.push_back(UID_JPEG2000TransferSyntax);
e7a10626645f Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
559 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax);
e7a10626645f Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
560 transferSyntaxes.push_back(UID_JPEG2000Part2MulticomponentImageCompressionTransferSyntax);
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
561 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
562
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
563 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
564 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_JpegLossless))
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
565 {
2786
e7a10626645f Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
566 transferSyntaxes.push_back(UID_JPEGLSLosslessTransferSyntax);
e7a10626645f Fix incoming DICOM C-Store filtering for JPEG-LS transfer syntaxes
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2447
diff changeset
567 transferSyntaxes.push_back(UID_JPEGLSLossyTransferSyntax);
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
568 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
569
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
570 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
571 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Jpip))
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
572 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
573 transferSyntaxes.push_back(UID_JPIPReferencedTransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
574 transferSyntaxes.push_back(UID_JPIPReferencedDeflateTransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
575 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
576
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
577 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
578 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Mpeg2))
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
579 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
580 transferSyntaxes.push_back(UID_MPEG2MainProfileAtMainLevelTransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
581 transferSyntaxes.push_back(UID_MPEG2MainProfileAtHighLevelTransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
582 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
583
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
584 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
585 server.GetApplicationEntityFilter().IsAllowedTransferSyntax(remoteIp, remoteAet, calledAet, TransferSyntax_Rle))
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
586 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
587 transferSyntaxes.push_back(UID_RLELosslessTransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
588 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
589
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
590 /* accept the Verification SOP Class if presented */
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
591 cond = ASC_acceptContextsWithPreferredTransferSyntaxes(assoc->params, &knownAbstractSyntaxes[0], knownAbstractSyntaxes.size(), &transferSyntaxes[0], transferSyntaxes.size());
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
592 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
593 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
594 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
595 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
596 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
597 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
598
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
599 /* the array of Storage SOP Class UIDs comes from dcuid.h */
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
600 cond = ASC_acceptContextsWithPreferredTransferSyntaxes(assoc->params, orthancStorageSOPClassUIDs, orthancStorageSOPClassUIDsCount, &transferSyntaxes[0], transferSyntaxes.size());
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
601 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
602 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
603 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
606 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
607
1806
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
608 if (!server.HasApplicationEntityFilter() ||
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
609 server.GetApplicationEntityFilter().IsUnknownSopClassAccepted(remoteIp, remoteAet, calledAet))
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
610 {
1806
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
611 /*
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
612 * Promiscous mode is enabled: Accept everything not known not
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
613 * to be a storage SOP class.
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
614 **/
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
615 cond = acceptUnknownContextsWithPreferredTransferSyntaxes(
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
616 assoc->params, &transferSyntaxes[0], transferSyntaxes.size());
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
617 if (cond.bad())
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
618 {
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
619 LOG(INFO) << cond.text();
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
620 AssociationCleanup(assoc);
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
621 return NULL;
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
622 }
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
623 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
624
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 /* set our app title */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 ASC_setAPTitles(assoc->params, NULL, NULL, server.GetApplicationEntityTitle().c_str());
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
628 /* acknowledge or reject this association */
3118
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
629 #if DCMTK_VERSION_NUMBER >= 364
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
630 cond = ASC_getApplicationContextName(assoc->params, buf, sizeof(buf));
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
631 #else
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
632 cond = ASC_getApplicationContextName(assoc->params, buf);
3118
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
633 #endif
8849677c2cbc compatibility with dcmtk 3.6.4
s.jodogne@gmail.com
parents: 3060
diff changeset
634
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
635 if ((cond.bad()) || strcmp(buf, UID_StandardApplicationContext) != 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
636 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
637 /* reject: the application context name is not supported */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
638 T_ASC_RejectParameters rej =
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
639 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
640 ASC_RESULT_REJECTEDPERMANENT,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641 ASC_SOURCE_SERVICEUSER,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
645 LOG(INFO) << "Association Rejected: Bad Application Context Name: " << buf;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 cond = ASC_rejectAssociation(assoc, &rej);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
647 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
649 LOG(INFO) << cond.text();
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 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
652 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 }
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
654
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 /* check the AETs */
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
656 if (!server.IsMyAETitle(calledAet))
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 {
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
658 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
659 T_ASC_RejectParameters rej =
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
660 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
661 ASC_RESULT_REJECTEDPERMANENT,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
662 ASC_SOURCE_SERVICEUSER,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
663 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
664 };
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
665 ASC_rejectAssociation(assoc, &rej);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
666 AssociationCleanup(assoc);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
667 return NULL;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
669
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
670 if (server.HasApplicationEntityFilter() &&
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
671 !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
672 {
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
673 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
674 T_ASC_RejectParameters rej =
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
675 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
676 ASC_RESULT_REJECTEDPERMANENT,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
677 ASC_SOURCE_SERVICEUSER,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
678 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
679 };
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
680 ASC_rejectAssociation(assoc, &rej);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
681 AssociationCleanup(assoc);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
682 return NULL;
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
683 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
684
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
685 if (opt_rejectWithoutImplementationUID &&
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
686 strlen(assoc->params->theirImplementationClassUID) == 0)
0
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 /* reject: the no implementation Class UID provided */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 T_ASC_RejectParameters rej =
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691 ASC_RESULT_REJECTEDPERMANENT,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692 ASC_SOURCE_SERVICEUSER,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693 ASC_REASON_SU_NOREASON
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 };
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 Rejected: No Implementation Class UID provided";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 cond = ASC_rejectAssociation(assoc, &rej);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
700 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 cond = ASC_acknowledgeAssociation(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
710 LOG(ERROR) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713 }
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
714 LOG(INFO) << "Association Acknowledged (Max Send PDV: " << assoc->sendPDVLength << ")";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0)
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
716 LOG(INFO) << " (but no valid presentation contexts)";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
717 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
718
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
719 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
720 return new CommandDispatcher(server, assoc, remoteIp, remoteAet, calledAet, filter);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722
2134
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(const DicomServer& server,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
725 T_ASC_Association* assoc,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
726 const std::string& remoteIp,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
727 const std::string& remoteAet,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
728 const std::string& calledAet,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
729 IApplicationEntityFilter* filter) :
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
730 server_(server),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
731 assoc_(assoc),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
732 remoteIp_(remoteIp),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
733 remoteAet_(remoteAet),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
734 calledAet_(calledAet),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
735 filter_(filter)
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
736 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
737 associationTimeout_ = server.GetAssociationTimeout();
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
738 elapsedTimeSinceLastCommand_ = 0;
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
739 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
740
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
741
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
742 CommandDispatcher::~CommandDispatcher()
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
743 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
744 try
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
745 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
746 AssociationCleanup(assoc_);
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
747 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
748 catch (...)
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
749 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
750 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
751 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
752 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
753
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
754
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 bool CommandDispatcher::Step()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 /*
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 * This function receives DIMSE commmands over the network connection
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 * and handles these commands correspondingly. Note that in case of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 * 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
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 bool finished = false;
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 // 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
765 DcmDataset *statusDetail = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 T_ASC_PresentationContextID presID = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767 T_DIMSE_Message msg;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 OFCondition cond = DIMSE_receiveCommand(assoc_, DIMSE_NONBLOCKING, 1, &presID, &msg, &statusDetail);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
770 elapsedTimeSinceLastCommand_++;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772 // if the command which was received has extra status
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
773 // detail information, dump this information
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
774 if (statusDetail != NULL)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
775 {
101
428784e59dcd trying to use log4cplus
jodogne
parents: 62
diff changeset
776 //LOG4CPP_WARN(Internals::GetLogger(), "Status Detail:" << OFendl << DcmObject::PrintHelper(*statusDetail));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777 delete statusDetail;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
778 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
779
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
780 if (cond == DIMSE_OUTOFRESOURCES)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
781 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
782 finished = true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
783 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
784 else if (cond == DIMSE_NODATAAVAILABLE)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
785 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
786 // Timeout due to DIMSE_NONBLOCKING
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
787 if (associationTimeout_ != 0 &&
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
788 elapsedTimeSinceLastCommand_ >= associationTimeout_)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
789 {
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
790 // This timeout is actually a association timeout
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
791 finished = true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
792 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
793 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
794 else if (cond == EC_Normal)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
795 {
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
796 // Reset the association timeout counter
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797 elapsedTimeSinceLastCommand_ = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
798
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
799 // 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
800 bool supported = false;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
801 DicomRequestType request;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
802 switch (msg.CommandField)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
803 {
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
804 case DIMSE_C_ECHO_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
805 request = DicomRequestType_Echo;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
806 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
807 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
808
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
809 case DIMSE_C_STORE_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
810 request = DicomRequestType_Store;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
811 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
812 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
813
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
814 case DIMSE_C_MOVE_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
815 request = DicomRequestType_Move;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
816 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
817 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
818
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
819 case DIMSE_C_FIND_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
820 request = DicomRequestType_Find;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
821 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
822 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
823
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
824 default:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
825 // we cannot handle this kind of message
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
826 cond = DIMSE_BADCOMMANDTYPE;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
827 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
828 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
829 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
830
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
831
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
832 // 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
833 if (supported &&
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
834 filter_ != NULL &&
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
835 !filter_->IsAllowedRequest(remoteIp_, remoteAet_, calledAet_, request))
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
836 {
2352
3ab96768d144 Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
837 LOG(WARNING) << "Rejected " << EnumerationToString(request)
3ab96768d144 Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
838 << " 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
839 << remoteAet_ << "\" and hostname \"" << remoteIp_ << "\"";
1085
b161593551db Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1073
diff changeset
840 cond = DIMSE_ILLEGALASSOCIATION;
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
841 supported = false;
1085
b161593551db Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1073
diff changeset
842 finished = true;
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
843 }
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 // 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
846 if (supported)
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 // 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
849 cond = DIMSE_BADCOMMANDTYPE;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
850
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
851 switch (request)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
852 {
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
853 case DicomRequestType_Echo:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
854 cond = EchoScp(assoc_, &msg, presID);
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
855 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
856
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
857 case DicomRequestType_Store:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
858 if (server_.HasStoreRequestHandlerFactory()) // Should always be true
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
859 {
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
860 std::auto_ptr<IStoreRequestHandler> handler
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
861 (server_.GetStoreRequestHandlerFactory().ConstructStoreRequestHandler());
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
862
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
863 if (handler.get() != NULL)
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
864 {
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
865 cond = Internals::storeScp(assoc_, &msg, presID, *handler, remoteIp_);
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
866 }
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
867 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
868 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
869
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
870 case DicomRequestType_Move:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
871 if (server_.HasMoveRequestHandlerFactory()) // Should always be true
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
872 {
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
873 std::auto_ptr<IMoveRequestHandler> handler
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
874 (server_.GetMoveRequestHandlerFactory().ConstructMoveRequestHandler());
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
875
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
876 if (handler.get() != NULL)
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
877 {
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
878 cond = Internals::moveScp(assoc_, &msg, presID, *handler, remoteIp_, remoteAet_, calledAet_);
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
879 }
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
880 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
881 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
882
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
883 case DicomRequestType_Find:
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
884 if (server_.HasFindRequestHandlerFactory() || // Should always be true
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
885 server_.HasWorklistRequestHandlerFactory())
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
886 {
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
887 std::auto_ptr<IFindRequestHandler> findHandler;
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
888 if (server_.HasFindRequestHandlerFactory())
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
889 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
890 findHandler.reset(server_.GetFindRequestHandlerFactory().ConstructFindRequestHandler());
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
891 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
892
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
893 std::auto_ptr<IWorklistRequestHandler> worklistHandler;
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
894 if (server_.HasWorklistRequestHandlerFactory())
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
895 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
896 worklistHandler.reset(server_.GetWorklistRequestHandlerFactory().ConstructWorklistRequestHandler());
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
897 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
898
2381
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2352
diff changeset
899 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
900 findHandler.get(), worklistHandler.get(),
b8969010b534 uncoupling DCMTK primitives from Orthanc::Configuration
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2352
diff changeset
901 remoteIp_, remoteAet_, calledAet_);
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
902 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
903 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
904
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
905 default:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
906 // Should never happen
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
907 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
908 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
909 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
910 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
911 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
912 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
913 // Bad status, which indicates the closing of the connection by
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
914 // the peer or a network error
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
915 finished = true;
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 661
diff changeset
916
667
aa2ab67d913d log error to log info
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 665
diff changeset
917 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
918 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
919
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
920 if (finished)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
921 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
922 if (cond == DUL_PEERREQUESTEDRELEASE)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
923 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
924 LOG(INFO) << "Association Release";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
925 ASC_acknowledgeRelease(assoc_);
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 else if (cond == DUL_PEERABORTEDASSOCIATION)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
928 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
929 LOG(INFO) << "Association Aborted";
0
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 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
932 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
933 OFString temp_str;
2352
3ab96768d144 Fix issue 52 (DICOM level security association problems)
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2244
diff changeset
934 LOG(INFO) << "DIMSE failure (aborting association): " << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
935 /* some kind of error so abort the association */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
936 ASC_abortAssociation(assoc_);
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 }
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 return !finished;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
941 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
942
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
943
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
944 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
945 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
946 OFString temp_str;
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
947 LOG(INFO) << "Received Echo Request";
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
948 //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
949
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
950 /* the echo succeeded !! */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
951 OFCondition cond = DIMSE_sendEchoResponse(assoc, presID, &msg->msg.CEchoRQ, STATUS_Success, NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
952 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
953 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
954 LOG(ERROR) << "Echo SCP Failed: " << cond.text();
0
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 return cond;
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 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
959 }