SeComLib
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Macros
Pages
secure_recommendations
secure_recommendations/main.cpp
Go to the documentation of this file.
1
/*
2
SeComLib
3
Copyright 2012-2013 TU Delft, Information Security & Privacy Lab (http://isplab.tudelft.nl/)
4
5
Contributors:
6
Inald Lagendijk (R.L.Lagendijk@TUDelft.nl)
7
Mihai Todor (todormihai@gmail.com)
8
Thijs Veugen (P.J.M.Veugen@tudelft.nl)
9
Zekeriya Erkin (z.erkin@tudelft.nl)
10
11
Licensed under the Apache License, Version 2.0 (the "License");
12
you may not use this file except in compliance with the License.
13
You may obtain a copy of the License at
14
15
http://www.apache.org/licenses/LICENSE-2.0
16
17
Unless required by applicable law or agreed to in writing, software
18
distributed under the License is distributed on an "AS IS" BASIS,
19
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
See the License for the specific language governing permissions and
21
limitations under the License.
22
*/
30
#include "
main.h
"
31
41
int
main
(
int
argc,
char
*argv[]) {
42
try
{
43
//the first command line parameter always contains the name of the application
44
if
(argc > 1) {
45
//a custom configuration file was specified
46
Utils::Config::SetConfigFile(std::string(argv[1]));
47
}
48
50
std::shared_ptr<Hub> hub = std::make_shared<Hub>();
51
std::shared_ptr<Server> server = std::make_shared<Server>(hub->GetPublicKey());
52
54
hub->SetServer(server);
55
server->SetClient(hub);
56
58
server->Initialize();
59
60
//set the default analysis type to accuracy
61
std::string analysisType = Utils::Config::GetInstance().GetParameter<std::string>(
"SecureRecommendations.analysisType"
,
"accuracy"
);
62
64
if
(analysisType ==
"accuracy"
) {
65
hub->DoAccuracyAnalysis();
66
}
67
else
if
(analysisType ==
"performance"
) {
68
hub->DoPerformanceAnalysis();
69
}
70
else
if
(analysisType ==
"traffic"
) {
71
hub->DoTrafficAnalysis();
72
}
73
else
{
74
throw
std::runtime_error(
"Not implemented yet."
);
75
}
76
}
77
catch
(
const
std::runtime_error &exception) {
78
std::cout << exception.what() << std::endl;
79
}
80
catch
(
const
std::exception &exception) {
81
std::cout << exception.what() << std::endl;
82
}
83
//it won't catch low level exceptions, like division by 0, produced by GMP...
84
catch
(...) {
85
std::cout <<
"Unexpected exception occured."
<< std::endl;
86
}
87
88
return
0;
89
}
main.h
Secure Recommendations main header.
main
int main(int argc, char *argv[])
Definition:
secure_recommendations/main.cpp:41
Generated on Mon Jan 27 2014 01:04:37 for SeComLib by
1.8.6