Mercurial > hg > orthanc
annotate OrthancServer/Sources/OrthancWebDav.h @ 4704:f0038043fb97 openssl-3.x
removed OpenSSL license exception, as OpenSSL 3.0 was relicensed under Apache 2.0
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 22 Jun 2021 07:37:20 +0200 |
parents | d9473bd5ed43 |
children | 2e71a08eea15 |
rev | line source |
---|---|
4240 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
4 * Department, University Hospital of Liege, Belgium | |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4243
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
4240 | 6 * |
7 * This program is free software: you can redistribute it and/or | |
8 * modify it under the terms of the GNU General Public License as | |
9 * published by the Free Software Foundation, either version 3 of the | |
10 * License, or (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
19 **/ | |
20 | |
21 | |
22 #pragma once | |
23 | |
24 #include "../../OrthancFramework/Sources/HttpServer/WebDavStorage.h" | |
25 #include "../../OrthancFramework/Sources/MultiThreading/SharedMessageQueue.h" | |
26 #include "../../OrthancFramework/Sources/Toolbox.h" | |
27 | |
28 | |
29 namespace Orthanc | |
30 { | |
31 class ServerContext; | |
32 | |
33 class OrthancWebDav : public IWebDavBucket | |
34 { | |
35 private: | |
36 typedef std::map<ResourceType, std::string> Templates; | |
37 | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
38 class DicomDeleteVisitor; |
4240 | 39 class DicomFileVisitor; |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
40 class DicomIdentifiersVisitor; |
4240 | 41 class InstancesOfSeries; |
42 class InternalNode; | |
43 class ListOfResources; | |
44 class ListOfStudiesByDate; | |
45 class ListOfStudiesByMonth; | |
46 class ListOfStudiesByYear; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
47 class OrthancJsonVisitor; |
4240 | 48 class ResourcesIndex; |
49 class RootNode; | |
50 class SingleDicomResource; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
51 |
4240 | 52 class INode : public boost::noncopyable |
53 { | |
54 public: | |
55 virtual ~INode() | |
56 { | |
57 } | |
58 | |
59 virtual bool ListCollection(IWebDavBucket::Collection& target, | |
60 const UriComponents& path) = 0; | |
61 | |
62 virtual bool GetFileContent(MimeType& mime, | |
63 std::string& content, | |
64 boost::posix_time::ptime& time, | |
65 const UriComponents& path) = 0; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
66 |
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
67 virtual bool DeleteItem(const UriComponents& path) = 0; |
4240 | 68 }; |
69 | |
70 | |
71 void AddVirtualFile(Collection& collection, | |
72 const UriComponents& path, | |
73 const std::string& filename); | |
74 | |
75 static void UploadWorker(OrthancWebDav* that); | |
76 | |
77 void Upload(const std::string& path); | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
78 |
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
79 INode& GetRootNode(const std::string& rootPath); |
4240 | 80 |
81 ServerContext& context_; | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
82 bool allowDicomDelete_; |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
83 bool allowUpload_; |
4240 | 84 std::unique_ptr<INode> patients_; |
85 std::unique_ptr<INode> studies_; | |
86 std::unique_ptr<INode> dates_; | |
87 Templates patientsTemplates_; | |
88 Templates studiesTemplates_; | |
89 WebDavStorage uploads_; | |
90 SharedMessageQueue uploadQueue_; | |
91 boost::thread uploadThread_; | |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
92 bool uploadRunning_; |
4240 | 93 |
94 public: | |
4242
5cfa6ba75dfc
deleting resources from Orthanc WebDAV
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4240
diff
changeset
|
95 OrthancWebDav(ServerContext& context, |
4243
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
96 bool allowDicomDelete, |
64f57c9d5f79
configuration options for webdav
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4242
diff
changeset
|
97 bool allowUpload); |
4240 | 98 |
99 virtual ~OrthancWebDav() | |
100 { | |
101 Stop(); | |
102 } | |
103 | |
104 virtual bool IsExistingFolder(const UriComponents& path) ORTHANC_OVERRIDE; | |
105 | |
106 virtual bool ListCollection(Collection& collection, | |
107 const UriComponents& path) ORTHANC_OVERRIDE; | |
108 | |
109 virtual bool GetFileContent(MimeType& mime, | |
110 std::string& content, | |
111 boost::posix_time::ptime& modificationTime, | |
112 const UriComponents& path) ORTHANC_OVERRIDE; | |
113 | |
114 virtual bool StoreFile(const std::string& content, | |
115 const UriComponents& path) ORTHANC_OVERRIDE; | |
116 | |
117 virtual bool CreateFolder(const UriComponents& path) ORTHANC_OVERRIDE; | |
118 | |
119 virtual bool DeleteItem(const std::vector<std::string>& path) ORTHANC_OVERRIDE; | |
120 | |
121 virtual void Start() ORTHANC_OVERRIDE; | |
122 | |
123 virtual void Stop() ORTHANC_OVERRIDE; | |
124 }; | |
125 } |