aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qlicenseservice/commonsetup.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/qlicenseservice/commonsetup.h')
-rw-r--r--src/libs/qlicenseservice/commonsetup.h118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/libs/qlicenseservice/commonsetup.h b/src/libs/qlicenseservice/commonsetup.h
new file mode 100644
index 0000000..d0f403b
--- /dev/null
+++ b/src/libs/qlicenseservice/commonsetup.h
@@ -0,0 +1,118 @@
+/* Copyright (C) 2022 The Qt Company Ltd.
+ *
+ * SPDX-License-Identifier: GPL-3.0-only WITH Qt-GPL-exception-1.0
+*/
+#pragma once
+
+#include <map>
+#include <string>
+
+#define DAEMON_ADDR "localhost"
+#define DAEMON_PORT 60000
+#define BLOCK_IF_NO_LICENSE true
+
+#define USER_SETTINGS_FILE "qtlicenseservice.ini"
+#define DEFAULT_USER_SETTINGS_TAG "[default]"
+
+#define SERVER_VERSION_CMD "serverversion"
+#define DAEMON_VERSION_CMD "daemon_version"
+#define RESERVATION_QUERY_CMD "reservation_query"
+#define LICENSE_REQUEST_CMD "license"
+#define PERMANENT_REQUEST_CMD "permanent"
+#define OP_ADD_RESERVATION "add"
+#define OP_REMOVE_RESERVATION "remove"
+#define OP_QA_RELEASE_RESERVATION "release"
+
+#define QTLICENSETOOL_APP_NAME "clitool"
+#define SQUISH_IDE_APP_NAME "squish-ide"
+#define SQUISH_APP_NAME "squish"
+#define COCO_APP_NAME "coco"
+#define MOCWRAPPER_APP_NAME "moc"
+#define CREATOR_APPNAME "qtcreator"
+#define DESIGN_STUDIO_APP_NAME "qtdesignstudio"
+#define ORIGINAL_MOC_PREFIX "orig_"
+
+#define LICENSE_FILE_PREFIX "lic_"
+#define LICENSE_FILE_EXTENSION ".json"
+
+#if __APPLE__ || __MACH__
+ #define WORKING_DIR "/opt/qtlicd"
+#elif __linux__
+ #define WORKING_DIR "/opt/qtlicd"
+#else
+ #define WORKING_DIR "C:/Program Files/licd/"
+#endif
+#define DAEMON_SETTINGS_FILE WORKING_DIR "/qtlicd.ini"
+#define SHA256_HASH_SIZE 32
+#define SECS_IN_HOUR 3600
+#define SECS_IN_DAY 86400
+
+struct License {
+ uint64_t last_timestamp = 0; // |
+ uint64_t current_timestamp = 0; // | For internal use only, not in server resp JSON
+ uint64_t expiry_epoch = 0; // |
+ bool status = false;
+ std::string message;
+ std::string user_id;
+ std::string license_key;
+ std::string license_id;
+ std::string expiry_date;
+ std::string reservation_id;
+ std::string parentReservation;
+ uint16_t leeway_hours = 0;
+};
+
+enum RequestReply {
+ e_bad_request = -1,
+ e_got_response = 0,
+ e_license_granted = 1,
+ e_license_rejected = 2,
+ e_no_conn_leeway = 3,
+ e_license_pool_full = 4,
+ e_no_permanent_to_release = 5,
+ e_bad_connection = 6
+};
+
+enum class RequestType {
+ no_request = 0,
+ license_request = 1,
+ keepalive_report = 2,
+ license_release = 3,
+ long_term_request = 4,
+ server_version = 5,
+ daemon_version = 6,
+ reservation_query = 7,
+};
+
+enum class ClientType {
+ client_undefined = -1,
+ client_moc = 1,
+ client_plugin,
+ client_CLI,
+ client_squish,
+ client_squish_ide,
+ client_coco
+};
+
+// Struct to store request info
+struct RequestInfo {
+ uint16_t socketId;
+ RequestType reqType = RequestType::no_request;
+ ClientType client;
+ uint16_t updateIntervalSecs;
+ std::string licenseFile;
+ std::string reservationID;
+ std::string operation;
+ std::string appName;
+ std::string appVersion;
+ std::string userId;
+ std::string licenseId;
+ std::string email;
+ std::string payload;
+ std::string serverAddr;
+ uint64_t startTimestamp; // used by QA-Tools only
+ uint64_t stopTimestamp = 0; // used by QA-Tools only
+ std::string runnerType; // "qa_tester" || "qa_exe", used by QA-Tools only
+ std::string parentReservationId; // used by QA-Tools only
+};
+