annotate OrthancServer/main.cpp @ 125:2d96cb181f45

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Oct 2012 17:44:12 +0200
parents 80ca409f232f
children 2a24f43d9dca
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
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2012 Medical Physics Department, CHU of Liege,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 * Belgium
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.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * 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
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * General Public License for more details.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 *
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 **/
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
21 #include "OrthancRestApi.h"
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 #include <stdio.h>
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 62
diff changeset
24 #include <glog/logging.h>
112
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
25 #include <boost/algorithm/string/predicate.hpp>
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 #include "../Core/HttpServer/FilesystemHttpHandler.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 #include "../Core/HttpServer/MongooseServer.h"
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 #include "DicomProtocol/DicomServer.h"
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
31 #include "OrthancInitialization.h"
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
34 using namespace Orthanc;
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 class MyDicomStore : public IStoreRequestHandler
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 private:
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 ServerIndex& index_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 FileStorage storage_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 public:
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 MyDicomStore(ServerIndex& index,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 const std::string& path) :
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 index_(index),
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 storage_(path)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 virtual void Handle(const std::vector<uint8_t>& dicomFile,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 const DicomMap& dicomSummary,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 const Json::Value& dicomJson,
34
96e57b863dd9 option to disallow remote access
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
54 const std::string& remoteAet)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 std::string instanceUuid;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 if (dicomFile.size() > 0)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 index_.Store(instanceUuid, storage_,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 reinterpret_cast<const char*>(&dicomFile[0]), dicomFile.size(),
34
96e57b863dd9 option to disallow remote access
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
61 dicomSummary, dicomJson, remoteAet);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 };
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 class MyDicomStoreFactory : public IStoreRequestHandlerFactory
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 private:
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 ServerIndex& index_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 std::string path_;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73 public:
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74 MyDicomStoreFactory(ServerIndex& index,
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 const std::string& path) :
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 index_(index),
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 path_(path)
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81 virtual IStoreRequestHandler* ConstructStoreRequestHandler()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 return new MyDicomStore(index_, path_);
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 void Done()
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
87 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88 //index_.db().Execute("DELETE FROM Studies");
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 }
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
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
92
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
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 int main(int argc, char* argv[])
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 {
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 62
diff changeset
98 // Initialize Google's logging library.
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 62
diff changeset
99 FLAGS_logtostderr = true;
112
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
100
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
101 for (int i = 1; i < argc; i++)
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
102 {
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
103 if (boost::starts_with(argv[i], "--logdir="))
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
104 {
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
105 FLAGS_logtostderr = false;
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
106 FLAGS_log_dir = std::string(argv[i]).substr(9);
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
107 }
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
108 }
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
109
102
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 62
diff changeset
110 google::InitGoogleLogging("Orthanc");
7593b57dc1bf switch to google log
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 62
diff changeset
111
112
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
112
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
113 try
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114 {
112
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
115 bool isInitialized = false;
26
6ba765ecf3db compiling openssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 25
diff changeset
116 if (argc >= 2)
6ba765ecf3db compiling openssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 25
diff changeset
117 {
112
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
118 for (int i = 1; i < argc; i++)
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
119 {
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
120 // Use the first argument that does not start with a "-" as
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
121 // the configuration file
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
122 if (argv[i][0] != '-')
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
123 {
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
124 OrthancInitialize(argv[i]);
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
125 isInitialized = true;
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
126 }
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
127 }
26
6ba765ecf3db compiling openssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 25
diff changeset
128 }
112
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
129
80ca409f232f logging
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 108
diff changeset
130 if (!isInitialized)
26
6ba765ecf3db compiling openssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 25
diff changeset
131 {
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
132 OrthancInitialize();
26
6ba765ecf3db compiling openssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 25
diff changeset
133 }
6ba765ecf3db compiling openssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 25
diff changeset
134
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
135 std::string storageDirectory = GetGlobalStringParameter("StorageDirectory", "OrthancStorage");
12
c38716a8a146 static link against MSVC CRT
Administrator@jodogne-w01
parents: 2
diff changeset
136 ServerIndex index(storageDirectory);
c38716a8a146 static link against MSVC CRT
Administrator@jodogne-w01
parents: 2
diff changeset
137 MyDicomStoreFactory storeScp(index, storageDirectory);
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 {
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 // DICOM server
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 DicomServer dicomServer;
55
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 50
diff changeset
142 dicomServer.SetCalledApplicationEntityTitleCheck(GetGlobalBoolParameter("DicomCheckCalledAet", false));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143 dicomServer.SetStoreRequestHandlerFactory(storeScp);
125
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 112
diff changeset
144 dicomServer.SetPort(GetGlobalIntegerParameter("DicomPort", 4242));
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
145 dicomServer.SetApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "ORTHANC"));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 // HTTP server
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 MongooseServer httpServer;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 httpServer.SetPort(GetGlobalIntegerParameter("HttpPort", 8000));
34
96e57b863dd9 option to disallow remote access
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 27
diff changeset
150 httpServer.SetRemoteAccessAllowed(GetGlobalBoolParameter("RemoteAccessAllowed", false));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151
25
dd1489098265 basic http authentication
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 23
diff changeset
152 httpServer.SetAuthenticationEnabled(GetGlobalBoolParameter("AuthenticationEnabled", false));
dd1489098265 basic http authentication
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 23
diff changeset
153 SetupRegisteredUsers(httpServer);
dd1489098265 basic http authentication
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 23
diff changeset
154
23
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
155 if (GetGlobalBoolParameter("SslEnabled", false))
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
156 {
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
157 std::string certificate = GetGlobalStringParameter("SslCertificate", "certificate.pem");
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
158 httpServer.SetSslEnabled(true);
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
159 httpServer.SetSslCertificate(certificate.c_str());
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
160 }
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
161 else
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
162 {
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
163 httpServer.SetSslEnabled(false);
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
164 }
62bd05fe4b7c support for ssl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 19
diff changeset
165
125
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 112
diff changeset
166 LOG(INFO) << "DICOM server listening on port: " << dicomServer.GetPort();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 112
diff changeset
167 LOG(INFO) << "HTTP server listening on port: " << httpServer.GetPort();
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 112
diff changeset
168
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
169 #if ORTHANC_STANDALONE == 1
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
170 httpServer.RegisterHandler(new EmbeddedResourceHttpHandler("/app", EmbeddedResources::ORTHANC_EXPLORER));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 #else
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
172 httpServer.RegisterHandler(new FilesystemHttpHandler("/app", ORTHANC_PATH "/OrthancExplorer"));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 #endif
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
175 httpServer.RegisterHandler(new OrthancRestApi(index, storageDirectory));
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 // GO !!!
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 httpServer.Start();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 dicomServer.Start();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
108
a6e41de88a53 using glog
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
181 LOG(INFO) << "The server has started";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 Toolbox::ServerBarrier();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 // Stop
108
a6e41de88a53 using glog
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
185 LOG(INFO) << "The server is stopping";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 storeScp.Done();
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 }
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
190 catch (OrthancException& e)
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 {
108
a6e41de88a53 using glog
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 102
diff changeset
192 LOG(ERROR) << "EXCEPTION [" << e.What() << "]";
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 }
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194
62
a70bb32802ae renaming Server
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 57
diff changeset
195 OrthancFinalize();
27
cfe212a513c5 openssl with visual studio
Administrator@jodogne-w01
parents: 26
diff changeset
196
0
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 return 0;
3959d33612cc initial commit
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 }