diff options
Diffstat (limited to 'include/commonsetup.h')
-rw-r--r-- | include/commonsetup.h | 92 |
1 files changed, 84 insertions, 8 deletions
diff --git a/include/commonsetup.h b/include/commonsetup.h index f523216..a3cf72e 100644 --- a/include/commonsetup.h +++ b/include/commonsetup.h @@ -2,10 +2,10 @@ * * SPDX-License-Identifier: GPL-3.0-only WITH Qt-GPL-exception-1.0 */ - #pragma once #include <map> +#include <string> #include "version.h" #define DAEMON_ADDR "localhost" @@ -16,17 +16,24 @@ #define DEFAULT_USER_SETTINGS_TAG "[default]" #define SERVER_VERSION_CMD "serverversion" -#define DAEMON_VERSION_CMD "version" -#define RESERVATION_QUERY_CMD "reservation" +#define DAEMON_VERSION_CMD "daemon_version" +#define RESERVATION_QUERY_CMD "reservation_query" #define LICENSE_REQUEST_CMD "license" #define LONGTERM_REQUEST_CMD "longterm" -#define LONGTERM_ADD_OP "add" -#define LONGTERM_REMOVE_OP "remove" +#define OP_ADD_RESERVATION "add" +#define OP_REMOVE_RESERVATION "remove" +#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 QTLICENSETOOL_APP_NAME "Qt License Tool" +#define LICENSE_FILE_PREFIX "lic_" +#define LICENSE_FILE_EXTENSION ".json" #if __APPLE__ || __MACH__ #define WORKING_DIR "/opt/licd" @@ -36,7 +43,76 @@ #define WORKING_DIR "C:/Program Files/licd/" #endif #define DAEMON_SETTINGS_FILE WORKING_DIR "/licd.ini" -#define LICENSE_FILE_BASE WORKING_DIR "/lic_" #define SHA256_HASH_SIZE 32 #define SECS_IN_HOUR 3600 -#define SECS_IN_DAY (SECS_IN_HOUR * 24) +#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; // _| + uint16_t leeway_hours = 0; + std::string message; + bool status = false; + std::string expiry_date; + std::string operation; + std::string license_key; + std::string license_id; + std::string reservation_id; + std::string parent_reservation_id; // TODO Coming with qa tools: Check with server end! + std::string user_id; +}; + +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_bad_connection = 5 +}; + +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 type = 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; // 'tester' | 'exe', used by QA-Tools only + std::string parentReservationId; // used by QA-Tools only +}; + |