Mercurial > hg > orthanc
annotate OrthancFramework/Sources/WebServiceParameters.h @ 4844:55e8fb8e8028
tagging a pre-release of the Orthanc framework for WSI 1.1
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 07 Dec 2021 14:01:17 +0100 |
parents | 7053502fbf97 |
children | 43e613a7756b |
rev | line source |
---|---|
808 | 1 /** |
2 * Orthanc - A Lightweight, RESTful DICOM Store | |
1900 | 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
1288
6e7e5ed91c2d
upgrade to year 2015
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
812
diff
changeset
|
4 * Department, University Hospital of Liege, Belgium |
4437
d9473bd5ed43
upgrade to year 2021
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4392
diff
changeset
|
5 * Copyright (C) 2017-2021 Osimis S.A., Belgium |
4831
7053502fbf97
added copyright UCLouvain
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4523
diff
changeset
|
6 * Copyright (C) 2021-2021 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
808 | 7 * |
8 * This program is free software: you can redistribute it and/or | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public License |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
10 * as published by the Free Software Foundation, either version 3 of |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
11 * the License, or (at your option) any later version. |
808 | 12 * |
13 * This program is distributed in the hope that it will be useful, but | |
14 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
16 * Lesser General Public License for more details. |
808 | 17 * |
4119
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
19 * License along with this program. If not, see |
bf7b9edf6b81
re-licensing the OrthancFramework to LGPL, in order to license Stone of Orthanc under LGPL
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4044
diff
changeset
|
20 * <http://www.gnu.org/licenses/>. |
808 | 21 **/ |
22 | |
23 | |
24 #pragma once | |
25 | |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
26 #include "OrthancFramework.h" |
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
27 |
2145 | 28 #if !defined(ORTHANC_SANDBOXED) |
29 # error The macro ORTHANC_SANDBOXED must be defined | |
30 #endif | |
31 | |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
32 #include <map> |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
33 #include <set> |
4523 | 34 #include <stdint.h> |
808 | 35 #include <string> |
4392
3af1d763763a
confining Json::Reader and Json::*Writer into Toolbox
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4300
diff
changeset
|
36 #include <json/value.h> |
808 | 37 |
38 namespace Orthanc | |
39 { | |
3992
f9863630ec7f
working on the shared library for Orthanc framework
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3640
diff
changeset
|
40 class ORTHANC_PUBLIC WebServiceParameters |
808 | 41 { |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
42 public: |
2823
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
43 typedef std::map<std::string, std::string> Dictionary; |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
44 |
808 | 45 private: |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
46 std::string url_; |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
47 std::string username_; |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
48 std::string password_; |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
49 std::string certificateFile_; |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
50 std::string certificateKeyFile_; |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
51 std::string certificateKeyPassword_; |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
52 bool pkcs11Enabled_; |
2823
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
53 Dictionary headers_; |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
54 Dictionary userProperties_; |
4522
017ab543e6ef
added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
55 unsigned int timeout_; |
2019
9c9332e486ca
HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
56 |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
57 void FromSimpleFormat(const Json::Value& peer); |
2019
9c9332e486ca
HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
58 |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
59 void FromAdvancedFormat(const Json::Value& peer); |
808 | 60 |
61 public: | |
2020 | 62 WebServiceParameters(); |
808 | 63 |
4300 | 64 explicit WebServiceParameters(const Json::Value& serialized); |
2655 | 65 |
4300 | 66 const std::string& GetUrl() const; |
808 | 67 |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
68 void SetUrl(const std::string& url); |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
69 |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
70 void ClearCredentials(); |
808 | 71 |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
72 void SetCredentials(const std::string& username, |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
73 const std::string& password); |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
74 |
4300 | 75 const std::string& GetUsername() const; |
808 | 76 |
4300 | 77 const std::string& GetPassword() const; |
808 | 78 |
2022
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2020
diff
changeset
|
79 void ClearClientCertificate(); |
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2020
diff
changeset
|
80 |
2019
9c9332e486ca
HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
81 void SetClientCertificate(const std::string& certificateFile, |
9c9332e486ca
HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
82 const std::string& certificateKeyFile, |
9c9332e486ca
HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
83 const std::string& certificateKeyPassword); |
9c9332e486ca
HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
84 |
4300 | 85 const std::string& GetCertificateFile() const; |
2019
9c9332e486ca
HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
86 |
4300 | 87 const std::string& GetCertificateKeyFile() const; |
2019
9c9332e486ca
HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
88 |
4300 | 89 const std::string& GetCertificateKeyPassword() const; |
2019
9c9332e486ca
HTTPS client certificates can be associated with Orthanc peers to enhance security over Internet
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1900
diff
changeset
|
90 |
4300 | 91 void SetPkcs11Enabled(bool enabled); |
2022
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2020
diff
changeset
|
92 |
4300 | 93 bool IsPkcs11Enabled() const; |
2022
fefbe71c2272
Possibility to use PKCS#11 authentication for hardware security modules with Orthanc peers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2020
diff
changeset
|
94 |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
95 void AddHttpHeader(const std::string& key, |
4300 | 96 const std::string& value); |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
97 |
4300 | 98 void ClearHttpHeaders(); |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
99 |
4300 | 100 const Dictionary& GetHttpHeaders() const; |
808 | 101 |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
102 void ListHttpHeaders(std::set<std::string>& target) const; |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
103 |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
104 bool LookupHttpHeader(std::string& value, |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
105 const std::string& key) const; |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
106 |
2823
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
107 void AddUserProperty(const std::string& key, |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
108 const std::string& value); |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
109 |
4300 | 110 void ClearUserProperties(); |
2823
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
111 |
4300 | 112 const Dictionary& GetUserProperties() const; |
2823
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
113 |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
114 void ListUserProperties(std::set<std::string>& target) const; |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
115 |
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
116 bool LookupUserProperty(std::string& value, |
3444
6fe42a335a80
WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3192
diff
changeset
|
117 const std::string& key) const; |
6fe42a335a80
WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3192
diff
changeset
|
118 |
6fe42a335a80
WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3192
diff
changeset
|
119 bool GetBooleanUserProperty(const std::string& key, |
6fe42a335a80
WebServiceParameters::GetBooleanUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3192
diff
changeset
|
120 bool defaultValue) const; |
2823
807169f85ba9
OrthancPluginGetPeerUserProperty()
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2800
diff
changeset
|
121 |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
122 bool IsAdvancedFormatNeeded() const; |
2655 | 123 |
2800
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
124 void Unserialize(const Json::Value& peer); |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
125 |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
126 void Serialize(Json::Value& value, |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
127 bool forceAdvancedFormat, |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
128 bool includePasswords) const; |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
129 |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
130 #if ORTHANC_SANDBOXED == 0 |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
131 void CheckClientCertificate() const; |
dc7330089736
"OrthancPeers" configuration option now allows to specify HTTP headers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
2779
diff
changeset
|
132 #endif |
3192
595bfee4391a
URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
133 |
595bfee4391a
URI "/peers?expand" provides more information
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
3060
diff
changeset
|
134 void FormatPublic(Json::Value& target) const; |
4522
017ab543e6ef
added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
135 |
017ab543e6ef
added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
136 // Setting it to "0" will use "HttpClient::SetDefaultTimeout()" |
017ab543e6ef
added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
137 void SetTimeout(uint32_t seconds); |
017ab543e6ef
added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
138 |
017ab543e6ef
added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
139 uint32_t GetTimeout() const; |
017ab543e6ef
added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
140 |
017ab543e6ef
added field "Timeout" in "OrthancPeers" configuration option
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
4437
diff
changeset
|
141 bool HasTimeout() const; |
808 | 142 }; |
143 } |