comparison OrthancServer/Sources/OrthancConfiguration.cpp @ 4604:2c702cfae274 db-changes

New option "DatabaseServerIdentifier" to identify the server among a pool of Orthanc servers
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 30 Mar 2021 10:39:59 +0200
parents 8f9090b137f1
children f75c63aa9de0
comparison
equal deleted inserted replaced
4603:c125bfd31023 4604:2c702cfae274
1012 GetAcceptOption(target, *this, "RleTransferSyntaxAccepted", TransferSyntaxGroup_Rle); 1012 GetAcceptOption(target, *this, "RleTransferSyntaxAccepted", TransferSyntaxGroup_Rle);
1013 GetAcceptOption(target, *this, "H265TransferSyntaxAccepted", TransferSyntaxGroup_H265); 1013 GetAcceptOption(target, *this, "H265TransferSyntaxAccepted", TransferSyntaxGroup_H265);
1014 } 1014 }
1015 1015
1016 1016
1017 std::string OrthancConfiguration::GetDatabaseServerIdentifier() const
1018 {
1019 std::string id;
1020
1021 if (LookupStringParameter(id, "DatabaseServerIdentifier"))
1022 {
1023 return id;
1024 }
1025 else
1026 {
1027 std::set<std::string> items;
1028
1029 {
1030 std::set<std::string> mac;
1031 SystemToolbox::GetMacAddresses(mac);
1032
1033 for (std::set<std::string>::const_iterator it = mac.begin(); it != mac.end(); ++it)
1034 {
1035 items.insert("mac=" + *it);
1036 }
1037 }
1038
1039 items.insert("aet=" + GetStringParameter("DicomAet", "ORTHANC"));
1040 items.insert("dicom-port=" + boost::lexical_cast<std::string>(GetUnsignedIntegerParameter("DicomPort", 4242)));
1041 items.insert("http-port=" + boost::lexical_cast<std::string>(GetUnsignedIntegerParameter("HttpPort", 8042)));
1042
1043 for (std::set<std::string>::const_iterator it = items.begin(); it != items.end(); ++it)
1044 {
1045 if (id.empty())
1046 {
1047 id = *it;
1048 }
1049 else
1050 {
1051 id += ("|" + *it);
1052 }
1053 }
1054
1055 std::string hash;
1056 Toolbox::ComputeSHA1(hash, id);
1057 return hash;
1058 }
1059 }
1060
1061
1017 void OrthancConfiguration::DefaultExtractDicomSummary(DicomMap& target, 1062 void OrthancConfiguration::DefaultExtractDicomSummary(DicomMap& target,
1018 const ParsedDicomFile& dicom) 1063 const ParsedDicomFile& dicom)
1019 { 1064 {
1020 std::set<DicomTag> ignoreTagLength; 1065 std::set<DicomTag> ignoreTagLength;
1021 dicom.ExtractDicomSummary(target, ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength); 1066 dicom.ExtractDicomSummary(target, ORTHANC_MAXIMUM_TAG_LENGTH, ignoreTagLength);