annotate OrthancServer/Internals/CommandDispatcher.cpp @ 2172:84d1d392a9ab

GenerateUuid() not available in sandboxed environments
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 23 Nov 2016 12:06:00 +0100
parents ddc75c6c712d
children a3a65de1840f
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
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * This program is free software: you can redistribute it and/or
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * published by the Free Software Foundation, either version 3 of the
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * License, or (at your option) any later version.
136
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
10 *
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
11 * In addition, as a special exception, the copyright holders of this
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
12 * 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
13 * OpenSSL project's "OpenSSL" library (or with modified versions of it
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
14 * that use the same license as the "OpenSSL" library), and distribute
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
15 * the linked executables. You must obey the GNU General Public License
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
16 * 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
17 * 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
18 * 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
19 * 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
20 * version. If you delete this exception statement from all source files
fe180eae201d openssl exception
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
21 * in the program, then also delete it here.
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 * 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
24 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 * General Public License for more details.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 * You should have received a copy of the GNU General Public License
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 **/
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
766
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
33
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 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
38
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
39 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
40 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
41
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
42 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
43 All rights reserved.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
44
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
45 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
46
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
47 OFFIS e.V.
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
48 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
49 Escherweg 2
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
50 26121 Oldenburg, Germany
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
51
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
52 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
53 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
54 are met:
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
55
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
56 - 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
57 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
58
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
59 - 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
60 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
61 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
62
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
63 - 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
64 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
65 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
66
0a2f8c707c78 Fix missing licensing terms about reuse of some DCMTK code
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 690
diff changeset
67 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
68 "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
69 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
70 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
71 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
72 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
73 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
74 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
75 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
76 (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
77 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
78
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
831
84513f2ee1f3 pch for unit tests and server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 824
diff changeset
82 #include "../PrecompiledHeadersServer.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 #include "CommandDispatcher.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 #include "FindScp.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 #include "StoreScp.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 #include "MoveScp.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 #include "../../Core/Toolbox.h"
1486
f967bdf8534e refactoring to Logging.h
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1288
diff changeset
89 #include "../../Core/Logging.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
90
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 #include <dcmtk/dcmnet/dcasccfg.h> /* for class DcmAssociationConfiguration */
101
428784e59dcd trying to use log4cplus
jodogne
parents: 62
diff changeset
92 #include <boost/lexical_cast.hpp>
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
93
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
94 static OFBool opt_rejectWithoutImplementationUID = OFFalse;
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
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
97
1806
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
98 static DUL_PRESENTATIONCONTEXT *
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
99 findPresentationContextID(LST_HEAD * head,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
100 T_ASC_PresentationContextID presentationContextID)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
101 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
102 DUL_PRESENTATIONCONTEXT *pc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
103 LST_HEAD **l;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
104 OFBool found = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
105
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
106 if (head == NULL)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
107 return NULL;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
108
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
109 l = &head;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
110 if (*l == NULL)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
111 return NULL;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
112
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
113 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Head(l));
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
114 (void)LST_Position(l, OFstatic_cast(LST_NODE *, pc));
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
115
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
116 while (pc && !found) {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
117 if (pc->presentationContextID == presentationContextID) {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
118 found = OFTrue;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
119 } else {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
120 pc = OFstatic_cast(DUL_PRESENTATIONCONTEXT *, LST_Next(l));
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
121 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
122 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
123 return pc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
124 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
125
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 /** accept all presenstation contexts for unknown SOP classes,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
128 * i.e. UIDs appearing in the list of abstract syntaxes
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
129 * where no corresponding name is defined in the UID dictionary.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
130 * @param params pointer to association parameters structure
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
131 * @param transferSyntax transfer syntax to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
132 * @param acceptedRole SCU/SCP role to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
133 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
134 static OFCondition acceptUnknownContextsWithTransferSyntax(
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
135 T_ASC_Parameters * params,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
136 const char* transferSyntax,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
137 T_ASC_SC_ROLE acceptedRole)
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 OFCondition cond = EC_Normal;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
140 int n, i, k;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
141 DUL_PRESENTATIONCONTEXT *dpc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
142 T_ASC_PresentationContext pc;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
143 OFBool accepted = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
144 OFBool abstractOK = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
145
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
146 n = ASC_countPresentationContexts(params);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
147 for (i = 0; i < n; i++)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
148 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
149 cond = ASC_getPresentationContext(params, i, &pc);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
150 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
151 abstractOK = OFFalse;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
152 accepted = OFFalse;
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 if (dcmFindNameOfUID(pc.abstractSyntax) == NULL)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
155 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
156 abstractOK = OFTrue;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
157
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
158 /* check the transfer syntax */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
159 for (k = 0; (k < OFstatic_cast(int, pc.transferSyntaxCount)) && !accepted; k++)
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 if (strcmp(pc.proposedTransferSyntaxes[k], transferSyntax) == 0)
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 accepted = OFTrue;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
164 }
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 }
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 if (accepted)
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 cond = ASC_acceptPresentationContext(
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
171 params, pc.presentationContextID,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
172 transferSyntax, acceptedRole);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
173 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
174 } else {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
175 T_ASC_P_ResultReason reason;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
176
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
177 /* do not refuse if already accepted */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
178 dpc = findPresentationContextID(params->DULparams.acceptedPresentationContext,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
179 pc.presentationContextID);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
180 if ((dpc == NULL) || ((dpc != NULL) && (dpc->result != ASC_P_ACCEPTANCE)))
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
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
183 if (abstractOK) {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
184 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
185 } else {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
186 reason = ASC_P_ABSTRACTSYNTAXNOTSUPPORTED;
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 /*
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
189 * If previously this presentation context was refused
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
190 * because of bad transfer syntax let it stay that way.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
191 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
192 if ((dpc != NULL) && (dpc->result == ASC_P_TRANSFERSYNTAXESNOTSUPPORTED))
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
193 reason = ASC_P_TRANSFERSYNTAXESNOTSUPPORTED;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
194
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
195 cond = ASC_refusePresentationContext(params, pc.presentationContextID, reason);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
196 if (cond.bad()) return cond;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
197 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
198 }
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 return EC_Normal;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
201 }
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 /** accept all presenstation contexts for unknown SOP classes,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
205 * i.e. UIDs appearing in the list of abstract syntaxes
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
206 * where no corresponding name is defined in the UID dictionary.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
207 * This method is passed a list of "preferred" transfer syntaxes.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
208 * @param params pointer to association parameters structure
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
209 * @param transferSyntax transfer syntax to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
210 * @param acceptedRole SCU/SCP role to accept
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
211 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
212 static OFCondition acceptUnknownContextsWithPreferredTransferSyntaxes(
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
213 T_ASC_Parameters * params,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
214 const char* transferSyntaxes[], int transferSyntaxCount,
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
215 T_ASC_SC_ROLE acceptedRole = ASC_SC_ROLE_DEFAULT)
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 OFCondition cond = EC_Normal;
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
218 /*
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
219 ** Accept in the order "least wanted" to "most wanted" transfer
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
220 ** syntax. Accepting a transfer syntax will override previously
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
221 ** accepted transfer syntaxes.
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
222 */
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
223 for (int i = transferSyntaxCount - 1; i >= 0; i--)
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
224 {
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
225 cond = acceptUnknownContextsWithTransferSyntax(params, transferSyntaxes[i], acceptedRole);
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
226 if (cond.bad()) return cond;
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 return cond;
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
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
231
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
232
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
233 namespace Orthanc
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 namespace Internals
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236 {
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
237 /**
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
238 * 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
239 * (dcmAllStorageSOPClassUIDs).
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
240 *
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
241 * an array of const strings containing all known Storage SOP
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
242 * Classes that fit into the conventional
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
243 * PATIENT-STUDY-SERIES-INSTANCE information model,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
244 * 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
245 * Special cases such as hanging protocol storage or the Storage
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
246 * SOP Class are not included in this list.
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
247 *
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
248 * THIS LIST CONTAINS ALL STORAGE SOP CLASSES INCLUDING RETIRED
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
249 * ONES AND IS LARGER THAN 64 ENTRIES.
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
250 */
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
251
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
252 const char* orthancStorageSOPClassUIDs[] =
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
253 {
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
254 UID_AmbulatoryECGWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
255 UID_ArterialPulseWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
256 UID_AutorefractionMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
257 UID_BasicStructuredDisplayStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
258 UID_BasicTextSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
259 UID_BasicVoiceAudioWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
260 UID_BlendingSoftcopyPresentationStateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
261 UID_BreastTomosynthesisImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
262 UID_CardiacElectrophysiologyWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
263 UID_ChestCADSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
264 UID_ColonCADSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
265 UID_ColorSoftcopyPresentationStateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
266 UID_ComprehensiveSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
267 UID_ComputedRadiographyImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
268 UID_CTImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
269 UID_DeformableSpatialRegistrationStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
270 UID_DigitalIntraOralXRayImageStorageForPresentation,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
271 UID_DigitalIntraOralXRayImageStorageForProcessing,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
272 UID_DigitalMammographyXRayImageStorageForPresentation,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
273 UID_DigitalMammographyXRayImageStorageForProcessing,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
274 UID_DigitalXRayImageStorageForPresentation,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
275 UID_DigitalXRayImageStorageForProcessing,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
276 UID_EncapsulatedCDAStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
277 UID_EncapsulatedPDFStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
278 UID_EnhancedCTImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
279 UID_EnhancedMRColorImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
280 UID_EnhancedMRImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
281 UID_EnhancedPETImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
282 UID_EnhancedSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
283 UID_EnhancedUSVolumeStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
284 UID_EnhancedXAImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
285 UID_EnhancedXRFImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
286 UID_GeneralAudioWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
287 UID_GeneralECGWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
288 UID_GenericImplantTemplateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
289 UID_GrayscaleSoftcopyPresentationStateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
290 UID_HemodynamicWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
291 UID_ImplantAssemblyTemplateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
292 UID_ImplantationPlanSRDocumentStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
293 UID_ImplantTemplateGroupStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
294 UID_IntraocularLensCalculationsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
295 UID_KeratometryMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
296 UID_KeyObjectSelectionDocumentStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
297 UID_LensometryMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
298 UID_MacularGridThicknessAndVolumeReportStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
299 UID_MammographyCADSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
300 UID_MRImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
301 UID_MRSpectroscopyStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
302 UID_MultiframeGrayscaleByteSecondaryCaptureImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
303 UID_MultiframeGrayscaleWordSecondaryCaptureImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
304 UID_MultiframeSingleBitSecondaryCaptureImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
305 UID_MultiframeTrueColorSecondaryCaptureImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
306 UID_NuclearMedicineImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
307 UID_OphthalmicAxialMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
308 UID_OphthalmicPhotography16BitImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
309 UID_OphthalmicPhotography8BitImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
310 UID_OphthalmicTomographyImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
311 UID_OphthalmicVisualFieldStaticPerimetryMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
312 UID_PositronEmissionTomographyImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
313 UID_ProcedureLogStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
314 UID_PseudoColorSoftcopyPresentationStateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
315 UID_RawDataStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
316 UID_RealWorldValueMappingStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
317 UID_RespiratoryWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
318 UID_RTBeamsTreatmentRecordStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
319 UID_RTBrachyTreatmentRecordStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
320 UID_RTDoseStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
321 UID_RTImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
322 UID_RTIonBeamsTreatmentRecordStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
323 UID_RTIonPlanStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
324 UID_RTPlanStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
325 UID_RTStructureSetStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
326 UID_RTTreatmentSummaryRecordStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
327 UID_SecondaryCaptureImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
328 UID_SegmentationStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
329 UID_SpatialFiducialsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
330 UID_SpatialRegistrationStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
331 UID_SpectaclePrescriptionReportStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
332 UID_StereometricRelationshipStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
333 UID_SubjectiveRefractionMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
334 UID_SurfaceSegmentationStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
335 UID_TwelveLeadECGWaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
336 UID_UltrasoundImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
337 UID_UltrasoundMultiframeImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
338 UID_VideoEndoscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
339 UID_VideoMicroscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
340 UID_VideoPhotographicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
341 UID_VisualAcuityMeasurementsStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
342 UID_VLEndoscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
343 UID_VLMicroscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
344 UID_VLPhotographicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
345 UID_VLSlideCoordinatesMicroscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
346 UID_VLWholeSlideMicroscopyImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
347 UID_XAXRFGrayscaleSoftcopyPresentationStateStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
348 UID_XRay3DAngiographicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
349 UID_XRay3DCraniofacialImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
350 UID_XRayAngiographicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
351 UID_XRayRadiationDoseSRStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
352 UID_XRayRadiofluoroscopicImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
353 // retired
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
354 UID_RETIRED_HardcopyColorImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
355 UID_RETIRED_HardcopyGrayscaleImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
356 UID_RETIRED_NuclearMedicineImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
357 UID_RETIRED_StandaloneCurveStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
358 UID_RETIRED_StandaloneModalityLUTStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
359 UID_RETIRED_StandaloneOverlayStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
360 UID_RETIRED_StandalonePETCurveStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
361 UID_RETIRED_StandaloneVOILUTStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
362 UID_RETIRED_StoredPrintStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
363 UID_RETIRED_UltrasoundImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
364 UID_RETIRED_UltrasoundMultiframeImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
365 UID_RETIRED_VLImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
366 UID_RETIRED_VLMultiFrameImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
367 UID_RETIRED_XRayAngiographicBiPlaneImageStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
368 // draft
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
369 UID_DRAFT_SRAudioStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
370 UID_DRAFT_SRComprehensiveStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
371 UID_DRAFT_SRDetailStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
372 UID_DRAFT_SRTextStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
373 UID_DRAFT_WaveformStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
374 UID_DRAFT_RTBeamsDeliveryInstructionStorage,
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
375 NULL
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
376 };
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
377
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
378 const int orthancStorageSOPClassUIDsCount = (sizeof(orthancStorageSOPClassUIDs) / sizeof(const char*)) - 1;
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
379
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
380
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
381
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 OFCondition AssociationCleanup(T_ASC_Association *assoc)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384 OFCondition cond = ASC_dropSCPAssociation(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
387 LOG(FATAL) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 cond = ASC_destroyAssociation(&assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
394 LOG(FATAL) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 return cond;
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401
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 CommandDispatcher* AcceptAssociation(const DicomServer& server, T_ASC_Network *net)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 DcmAssociationConfiguration asccfg;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 char buf[BUFSIZ];
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407 T_ASC_Association *assoc;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
408 OFCondition cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
409 OFString sprofile;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
410 OFString temp_str;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
411
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
412 std::vector<const char*> knownAbstractSyntaxes;
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 // For C-STORE
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
415 if (server.HasStoreRequestHandlerFactory())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
416 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
417 knownAbstractSyntaxes.push_back(UID_VerificationSOPClass);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
418 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
419
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
420 // For C-FIND
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
421 if (server.HasFindRequestHandlerFactory())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
422 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
423 knownAbstractSyntaxes.push_back(UID_FINDPatientRootQueryRetrieveInformationModel);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
424 knownAbstractSyntaxes.push_back(UID_FINDStudyRootQueryRetrieveInformationModel);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
425 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
426
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
427 if (server.HasWorklistRequestHandlerFactory())
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
428 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
429 knownAbstractSyntaxes.push_back(UID_FINDModalityWorklistInformationModel);
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
430 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
431
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
432 // For C-MOVE
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
433 if (server.HasMoveRequestHandlerFactory())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
434 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
435 knownAbstractSyntaxes.push_back(UID_MOVEStudyRootQueryRetrieveInformationModel);
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 661
diff changeset
436 knownAbstractSyntaxes.push_back(UID_MOVEPatientRootQueryRetrieveInformationModel);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
437 }
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 cond = ASC_receiveAssociation(net, &assoc,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
440 /*opt_maxPDU*/ ASC_DEFAULTMAXPDU,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
441 NULL, NULL,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
442 /*opt_secureConnection*/ OFFalse,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
443 DUL_NOBLOCK, 1);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
444
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
445 if (cond == DUL_NOASSOCIATIONREQUEST)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
446 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
447 // Timeout
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
448 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
449 return NULL;
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 // if some kind of error occured, take care of it
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
453 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
454 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
455 LOG(ERROR) << "Receiving Association failed: " << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
456 // 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
457 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
458 return NULL;
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
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
461 // 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
462 std::string remoteAet;
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
463 std::string remoteIp;
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
464 std::string calledAet;
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
465
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
466 {
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
467 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
468 DIC_AE calledAet_C;
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
469 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
470 DIC_AE calledIP_C;
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
471 if (ASC_getAPTitles(assoc->params, remoteAet_C, calledAet_C, NULL).bad() ||
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
472 ASC_getPresentationAddresses(assoc->params, remoteIp_C, calledIP_C).bad())
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
473 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
474 T_ASC_RejectParameters rej =
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
475 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
476 ASC_RESULT_REJECTEDPERMANENT,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
477 ASC_SOURCE_SERVICEUSER,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
478 ASC_REASON_SU_NOREASON
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
479 };
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
480 ASC_rejectAssociation(assoc, &rej);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
481 AssociationCleanup(assoc);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
482 return NULL;
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
483 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
484
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
485 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
486 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
487 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
488 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
489
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
490 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
491 << " on IP " << remoteIp;
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
492
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
493
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
494 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
495
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
496 // 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
497 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
498 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
499 transferSyntaxes.push_back(UID_LittleEndianImplicitTransferSyntax);
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 661
diff changeset
500
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 661
diff changeset
501 // 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
502 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
503 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
504 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
505 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
506 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
507
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
508 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
509 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
510 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
511 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
512 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
513 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
514 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
515 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
516 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
517 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
518 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
519 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
520 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
521 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
522 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
523 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
524 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
525 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
526 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
527 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
528 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
529 transferSyntaxes.push_back(UID_JPEGLSLosslessTransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
530 transferSyntaxes.push_back(UID_JPEGLSLossyTransferSyntax);
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
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
533 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
534 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
535 {
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_JPEG2000LosslessOnlyTransferSyntax);
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_JPEG2000TransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
538 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
539
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
540 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
541 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
542 {
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_JPEG2000LosslessOnlyTransferSyntax);
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_JPEG2000TransferSyntax);
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_JPEG2000Part2MulticomponentImageCompressionLosslessOnlyTransferSyntax);
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_JPEG2000Part2MulticomponentImageCompressionTransferSyntax);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
547 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
548
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
549 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
550 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
551 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
552 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
553 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
554 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
555
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
556 if (!server.HasApplicationEntityFilter() ||
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
557 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
558 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
559 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
560 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
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_Rle))
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
565 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
566 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
567 }
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
568
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
569 /* accept the Verification SOP Class if presented */
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
570 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
571 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
572 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
573 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
574 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
575 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
576 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
577
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
578 /* 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
579 cond = ASC_acceptContextsWithPreferredTransferSyntaxes(assoc->params, orthancStorageSOPClassUIDs, orthancStorageSOPClassUIDsCount, &transferSyntaxes[0], transferSyntaxes.size());
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
580 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
581 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
582 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
583 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
584 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
585 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
586
1806
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
587 if (!server.HasApplicationEntityFilter() ||
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
588 server.GetApplicationEntityFilter().IsUnknownSopClassAccepted(remoteIp, remoteAet, calledAet))
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
589 {
1806
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
590 /*
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
591 * Promiscous mode is enabled: Accept everything not known not
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
592 * to be a storage SOP class.
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
593 **/
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
594 cond = acceptUnknownContextsWithPreferredTransferSyntaxes(
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
595 assoc->params, &transferSyntaxes[0], transferSyntaxes.size());
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
596 if (cond.bad())
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
597 {
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
598 LOG(INFO) << cond.text();
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
599 AssociationCleanup(assoc);
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
600 return NULL;
cd213ebcaefd UnknownSopClassAccepted option
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1800
diff changeset
601 }
503
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
602 }
273e7ad98ea9 promiscuous mode
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 399
diff changeset
603
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
604 /* set our app title */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
605 ASC_setAPTitles(assoc->params, NULL, NULL, server.GetApplicationEntityTitle().c_str());
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 /* acknowledge or reject this association */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
608 cond = ASC_getApplicationContextName(assoc->params, buf);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
609 if ((cond.bad()) || strcmp(buf, UID_StandardApplicationContext) != 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
610 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
611 /* reject: the application context name is not supported */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
612 T_ASC_RejectParameters rej =
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
613 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
614 ASC_RESULT_REJECTEDPERMANENT,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
615 ASC_SOURCE_SERVICEUSER,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
616 ASC_REASON_SU_APPCONTEXTNAMENOTSUPPORTED
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
617 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
618
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
619 LOG(INFO) << "Association Rejected: Bad Application Context Name: " << buf;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
620 cond = ASC_rejectAssociation(assoc, &rej);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
621 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
622 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
623 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
624 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
625 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
626 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
627 }
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
628
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
629 /* check the AETs */
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
630 if (!server.IsMyAETitle(calledAet))
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
631 {
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
632 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
633 T_ASC_RejectParameters rej =
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
634 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
635 ASC_RESULT_REJECTEDPERMANENT,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
636 ASC_SOURCE_SERVICEUSER,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
637 ASC_REASON_SU_CALLEDAETITLENOTRECOGNIZED
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
638 };
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
639 ASC_rejectAssociation(assoc, &rej);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
640 AssociationCleanup(assoc);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
641 return NULL;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
643
1163
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
644 if (server.HasApplicationEntityFilter() &&
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
645 !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
646 {
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
647 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
648 T_ASC_RejectParameters rej =
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
649 {
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
650 ASC_RESULT_REJECTEDPERMANENT,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
651 ASC_SOURCE_SERVICEUSER,
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
652 ASC_REASON_SU_CALLINGAETITLENOTRECOGNIZED
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
653 };
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
654 ASC_rejectAssociation(assoc, &rej);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
655 AssociationCleanup(assoc);
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
656 return NULL;
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
657 }
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
658
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
659 if (opt_rejectWithoutImplementationUID &&
3db41779d8f9 abstraction to allow/prevent transfer syntaxes on AET basis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1085
diff changeset
660 strlen(assoc->params->theirImplementationClassUID) == 0)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
662 /* reject: the no implementation Class UID provided */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 T_ASC_RejectParameters rej =
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
664 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665 ASC_RESULT_REJECTEDPERMANENT,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
666 ASC_SOURCE_SERVICEUSER,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 ASC_REASON_SU_NOREASON
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
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
670 LOG(INFO) << "Association Rejected: No Implementation Class UID provided";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 cond = ASC_rejectAssociation(assoc, &rej);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
672 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
674 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
678 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 cond = ASC_acknowledgeAssociation(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
684 LOG(ERROR) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 AssociationCleanup(assoc);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 return NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 }
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
688 LOG(INFO) << "Association Acknowledged (Max Send PDV: " << assoc->sendPDVLength << ")";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 if (ASC_countAcceptedPresentationContexts(assoc->params) == 0)
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
690 LOG(INFO) << " (but no valid presentation contexts)";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
693 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
694 return new CommandDispatcher(server, assoc, remoteIp, remoteAet, calledAet, filter);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696
2134
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
697
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
698 CommandDispatcher::CommandDispatcher(const DicomServer& server,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
699 T_ASC_Association* assoc,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
700 const std::string& remoteIp,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
701 const std::string& remoteAet,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
702 const std::string& calledAet,
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
703 IApplicationEntityFilter* filter) :
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
704 server_(server),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
705 assoc_(assoc),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
706 remoteIp_(remoteIp),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
707 remoteAet_(remoteAet),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
708 calledAet_(calledAet),
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
709 filter_(filter)
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
710 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
711 associationTimeout_ = server.GetAssociationTimeout();
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
712 elapsedTimeSinceLastCommand_ = 0;
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
713 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
714
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
715
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
716 CommandDispatcher::~CommandDispatcher()
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
717 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
718 try
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
719 {
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
720 AssociationCleanup(assoc_);
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
721 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
722 catch (...)
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 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
725 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
726 }
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
727
ddc75c6c712d Avoid hard crash if not enough memory
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 2068
diff changeset
728
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
729 bool CommandDispatcher::Step()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
730 /*
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
731 * This function receives DIMSE commmands over the network connection
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
732 * and handles these commands correspondingly. Note that in case of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
733 * 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
734 */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
735 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
736 bool finished = false;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
737
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
738 // 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
739 DcmDataset *statusDetail = NULL;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
740 T_ASC_PresentationContextID presID = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
741 T_DIMSE_Message msg;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
742
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
743 OFCondition cond = DIMSE_receiveCommand(assoc_, DIMSE_NONBLOCKING, 1, &presID, &msg, &statusDetail);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
744 elapsedTimeSinceLastCommand_++;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
745
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
746 // if the command which was received has extra status
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
747 // detail information, dump this information
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
748 if (statusDetail != NULL)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
749 {
101
428784e59dcd trying to use log4cplus
jodogne
parents: 62
diff changeset
750 //LOG4CPP_WARN(Internals::GetLogger(), "Status Detail:" << OFendl << DcmObject::PrintHelper(*statusDetail));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
751 delete statusDetail;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
752 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
753
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754 if (cond == DIMSE_OUTOFRESOURCES)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 finished = true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 else if (cond == DIMSE_NODATAAVAILABLE)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
759 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
760 // Timeout due to DIMSE_NONBLOCKING
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
761 if (associationTimeout_ != 0 &&
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
762 elapsedTimeSinceLastCommand_ >= associationTimeout_)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
763 {
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
764 // This timeout is actually a association timeout
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 finished = true;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
766 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
767 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
768 else if (cond == EC_Normal)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
769 {
2068
879f3be759ef renames to make code clearer
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1900
diff changeset
770 // Reset the association timeout counter
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
771 elapsedTimeSinceLastCommand_ = 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
772
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
773 // 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
774 bool supported = false;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
775 DicomRequestType request;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
776 switch (msg.CommandField)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
777 {
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
778 case DIMSE_C_ECHO_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
779 request = DicomRequestType_Echo;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
780 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
781 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
782
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
783 case DIMSE_C_STORE_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
784 request = DicomRequestType_Store;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
785 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
786 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
787
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
788 case DIMSE_C_MOVE_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
789 request = DicomRequestType_Move;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
790 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
791 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
792
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
793 case DIMSE_C_FIND_RQ:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
794 request = DicomRequestType_Find;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
795 supported = true;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
796 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
797
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
798 default:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
799 // we cannot handle this kind of message
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
800 cond = DIMSE_BADCOMMANDTYPE;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
801 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
802 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
803 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
804
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
805
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
806 // 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
807 if (supported &&
1085
b161593551db Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1073
diff changeset
808 request != DicomRequestType_Echo && // Always allow incoming ECHO requests
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
809 filter_ != NULL &&
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
810 !filter_->IsAllowedRequest(remoteIp_, remoteAet_, calledAet_, request))
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
811 {
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
812 LOG(ERROR) << EnumerationToString(request)
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
813 << " requests are disallowed for the AET \""
1573
3309878b3e16 more information about the origin of requests submitted to the DICOM handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1486
diff changeset
814 << remoteAet_ << "\"";
1085
b161593551db Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1073
diff changeset
815 cond = DIMSE_ILLEGALASSOCIATION;
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
816 supported = false;
1085
b161593551db Always allow incoming ECHO requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1073
diff changeset
817 finished = true;
620
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
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
820 // 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
821 if (supported)
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
822 {
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
823 // 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
824 cond = DIMSE_BADCOMMANDTYPE;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
825
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
826 switch (request)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
827 {
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
828 case DicomRequestType_Echo:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
829 cond = EchoScp(assoc_, &msg, presID);
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
830 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
831
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
832 case DicomRequestType_Store:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
833 if (server_.HasStoreRequestHandlerFactory()) // Should always be true
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
834 {
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
835 std::auto_ptr<IStoreRequestHandler> handler
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
836 (server_.GetStoreRequestHandlerFactory().ConstructStoreRequestHandler());
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
837
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
838 if (handler.get() != NULL)
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
839 {
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
840 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
841 }
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
842 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
843 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
844
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
845 case DicomRequestType_Move:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
846 if (server_.HasMoveRequestHandlerFactory()) // Should always be true
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 std::auto_ptr<IMoveRequestHandler> handler
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
849 (server_.GetMoveRequestHandlerFactory().ConstructMoveRequestHandler());
1800
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
850
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
851 if (handler.get() != NULL)
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
852 {
30e97a1f4093 callback for handling worklists with plugins
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1799
diff changeset
853 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
854 }
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
855 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
856 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
857
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
858 case DicomRequestType_Find:
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
859 if (server_.HasFindRequestHandlerFactory() || // Should always be true
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
860 server_.HasWorklistRequestHandlerFactory())
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
861 {
1786
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
862 std::auto_ptr<IFindRequestHandler> findHandler;
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
863 if (server_.HasFindRequestHandlerFactory())
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
864 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
865 findHandler.reset(server_.GetFindRequestHandlerFactory().ConstructFindRequestHandler());
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
866 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
867
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
868 std::auto_ptr<IWorklistRequestHandler> worklistHandler;
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
869 if (server_.HasWorklistRequestHandlerFactory())
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
870 {
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
871 worklistHandler.reset(server_.GetWorklistRequestHandlerFactory().ConstructWorklistRequestHandler());
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
872 }
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
873
164d78911382 primitives to handle dicom worklists
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1573
diff changeset
874 cond = Internals::findScp(assoc_, &msg, presID, findHandler.get(),
1799
4f01c9d73f02 calledAet made available to all the handlers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1786
diff changeset
875 worklistHandler.get(), remoteIp_, remoteAet_, calledAet_);
620
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
876 }
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
877 break;
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
878
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
879 default:
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
880 // Should never happen
4aa6f0d79947 security filter for dicom requests
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 503
diff changeset
881 break;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
882 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
883 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
884 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
885 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
886 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
887 // Bad status, which indicates the closing of the connection by
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
888 // the peer or a network error
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
889 finished = true;
665
41b3e5ccb291 fix for medInria
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 661
diff changeset
890
667
aa2ab67d913d log error to log info
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 665
diff changeset
891 LOG(INFO) << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
892 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
893
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
894 if (finished)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
895 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
896 if (cond == DUL_PEERREQUESTEDRELEASE)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
897 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
898 LOG(INFO) << "Association Release";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
899 ASC_acknowledgeRelease(assoc_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
900 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
901 else if (cond == DUL_PEERABORTEDASSOCIATION)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
902 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
903 LOG(INFO) << "Association Aborted";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
904 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
905 else
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
906 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
907 OFString temp_str;
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
908 LOG(ERROR) << "DIMSE failure (aborting association): " << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
909 /* some kind of error so abort the association */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
910 ASC_abortAssociation(assoc_);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
911 }
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
914 return !finished;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
915 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
916
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
917
1073
01414536c930 complete DICOM conformance
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 831
diff changeset
918 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
919 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
920 OFString temp_str;
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
921 LOG(INFO) << "Received Echo Request";
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
922 //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
923
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
924 /* the echo succeeded !! */
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
925 OFCondition cond = DIMSE_sendEchoResponse(assoc, presID, &msg->msg.CEchoRQ, STATUS_Success, NULL);
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
926 if (cond.bad())
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
927 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
928 LOG(ERROR) << "Echo SCP Failed: " << cond.text();
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
929 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
930 return cond;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
931 }
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 }