| | |
| | | name: Github_Actions |
| | | name: Github_CI |
| | | on: |
| | | push: |
| | | jobs: |
| | |
| | | [](https://en.wikipedia.org/wiki/C%2B%2B#Standardization) |
| | | [](http://github.com/badges/stability-badges) |
| | | [](https://opensource.org/licenses/BSD-3-Clause) |
| | | [](https://travis-ci.org/open-license-manager/open-license-manager) |
| | |  |
| | | [](https://travis-ci.org/open-license-manager/open-license-manager) |
| | | [](https://github.com/open-license-manager/open-license-manager/actions) |
| | | [](https://www.codacy.com/manual/gcontini/open-license-manager?utm_source=github.com&utm_medium=referral&utm_content=open-license-manager/open-license-manager&utm_campaign=Badge_Grade) |
| | | [](https://codecov.io/gh/open-license-manager/open-license-manager) |
| | | [](http://github.com/open-license-manager/open-license-manager/issues) |
| | |
| | | ============================================ |
| | | |
| | | Included with the library there are three hardware identification strategies: `IP_ADDRESS`, `STRATEGY_ETHERNET` (mac address) and |
| | | `STRATEGY_ETHERNET` (partition serial number). If you want to change the preferred one: |
| | | `STRATEGY_DISK` (partition serial number). If you want to change the preferred one: |
| | | |
| | | - locate the file `licensecc_properties.h`` (usually in ``projects/<$project_name>/include/licensecc/<$project_name>`` |
| | | - you can change the order of the strategies in the following code block (the strategies will be tried in sequence until the first one succeeds): |
| | | |
| | | .. code-block:: c |
| | | |
| | | .. code-block:: c |
| | | #define LCC_BARE_TO_METAL_STRATEGIES { STRATEGY_ETHERNET, STRATEGY_ETHERNET, STRATEGY_NONE } |
| | | #define LCC_VM_STRATEGIES { STRATEGY_ETHERNET, STRATEGY_NONE } |
| | | #define LCC_LXC_STRATEGIES { STRATEGY_ETHERNET, STRATEGY_NONE } |
| | | #define LCC_DOCKER_STRATEGIES { STRATEGY_NONE } |
| | | #define LCC_CLOUD_STRATEGIES { STRATEGY_NONE } |
| | | |
| | | |
| | | |
| | | Custom license locator |
| | |
| | | .. _unstable: http://github.com/badges/stability-badges |
| | | .. |License| image:: https://img.shields.io/badge/License-BSD%203--Clause-blue.svg |
| | | .. _License: ttps://opensource.org/licenses/BSD-3-Clause |
| | | .. |BuildStatus| image:: https://travis-ci.org/open-license-manager/open-license-manager.svg?branch=develop |
| | | .. _BuildStatus: https://travis-ci.org/open-license-manager/open-license-manager |
| | | .. |TravisBuild| image:: https://travis-ci.org/open-license-manager/open-license-manager.svg?branch=develop |
| | | .. _TravisBuild: https://travis-ci.org/open-license-manager/open-license-manager |
| | | .. |GithubCI| image:: https://github.com/open-license-manager/open-license-manager/workflows/Github_CI/badge.svg |
| | | .. _GithubCI: https://github.com/open-license-manager/open-license-manager/actions |
| | | .. |CodacyBadge| image:: https://api.codacy.com/project/badge/Grade/62d6e1bb22d648bd85b6f3bc344a545a |
| | | .. _CodacyBadge: https://www.codacy.com/manual/gcontini/open-license-manager?utm_source=github.com&utm_medium=referral&utm_content=open-license-manager/open-license-manager&utm_campaign=Badge_Grade |
| | | .. |codecov| image:: https://codecov.io/gh/open-license-manager/open-license-manager/branch/develop/graph/badge.svg |
| | |
| | | << static_cast<unsigned int>(osAdapter.ipv4_address[1]) << "-" |
| | | << static_cast<unsigned int>(osAdapter.ipv4_address[0]) << "]" << endl; |
| | | cout << " mac address [" << std::hex; |
| | | for (int i = 0; i < 8; i++) { |
| | | for (int i = 0; i < sizeof(osAdapter.mac_address); i++) { |
| | | if (i != 0) { |
| | | cout << ":"; |
| | | } |
| | |
| | | string base64(const void* binaryData, size_t len, int lineLenght) {
|
| | | const unsigned char* bin = (const unsigned char*)binaryData;
|
| | |
|
| | | int rc = 0; // result counter
|
| | | // int rc = 0; // result counter
|
| | | unsigned int byteNo; // I need this after the loop
|
| | |
|
| | | int modulusLen = len % 3;
|
| | |
| | | tmp_str.erase(std::remove(tmp_str.begin(), tmp_str.end(), '\n'), tmp_str.end());
|
| | | const unsigned char* safeAsciiPtr = (const unsigned char*)tmp_str.c_str();
|
| | | std::vector<uint8_t> bin;
|
| | | int cb = 0;
|
| | | // int cb = 0;
|
| | | unsigned int charNo;
|
| | | int pad = 0;
|
| | | size_t len = tmp_str.size();
|
| | |
| | | unique_ptr<IdentificationStrategy> strategy_ptr = IdentificationStrategy::get_strategy(strategy); |
| | | HwIdentifier pc_id; |
| | | FUNCTION_RETURN result = strategy_ptr->generate_pc_id(pc_id); |
| | | pc_id.set_use_environment_var(use_env_var); |
| | | if (result != FUNC_RET_OK) { |
| | | throw logic_error("strategy " + to_string(strategy_ptr->identification_strategy()) + " failed"); |
| | | } |
| | |
| | | } |
| | | |
| | | FUNCTION_RETURN IdentificationStrategy::generate_pc_id(HwIdentifier& pc_id) const { |
| | | vector<array<uint8_t, HW_IDENTIFIER_PROPRIETARY_DATA>> data; |
| | | const vector<HwIdentifier> available_ids = alternative_ids(); |
| | | FUNCTION_RETURN result = FUNC_RET_NOT_AVAIL; |
| | | if (available_ids.size() > 0) { |
| | |
| | | /* |
| | | * virtualization.cpp |
| | | * execution_environment.cpp |
| | | * |
| | | * Created on: Dec 15, 2019 |
| | | * Author: GC |
| | | */ |
| | | #define __STDC_WANT_LIB_EXT1__1 |
| | | #include <paths.h> |
| | | #include <sys/stat.h> |
| | | #include <unistd.h> |
| | |
| | | char path[MAX_PATH] = {0}; |
| | | char proc_path[MAX_PATH], pidStr[64]; |
| | | pid_t pid = getpid(); |
| | | sprintf(pidStr, "%d", pid); |
| | | strcpy(proc_path, "/proc/"); |
| | | strcat(proc_path, pidStr); |
| | | strcat(proc_path, "/cgroup"); |
| | | snprintf(pidStr, sizeof(pidStr), "%d", pid); |
| | | strncpy(proc_path, "/proc/", sizeof(proc_path)); |
| | | strncat(proc_path, pidStr, sizeof(proc_path)); |
| | | strncpy(proc_path, "/cgroup", sizeof(proc_path)); |
| | | |
| | | FILE *fp; |
| | | char *line = NULL; |
| | |
| | | } |
| | | |
| | | while ((read = getline(&line, &len, fp)) != -1 && result == 0) { |
| | | // line[len]=0; |
| | | // printf("Retrieved line of length %zu:\n", read); |
| | | // printf("%s", line); |
| | | if (strstr(line, "docker") != NULL) { |
| | | result = CONTAINER_TYPE::DOCKER; |
| | | } |
| | |
| | | |
| | | FUNCTION_RETURN parse_blkid(const std::string &blkid_file_content, std::vector<DiskInfo> &diskInfos_out, |
| | | std::unordered_map<std::string, int> &disk_by_uuid) { |
| | | DiskInfo diskInfo; |
| | | DiskInfo diskInfo = {}; |
| | | int diskNum = 0; |
| | | for (std::size_t oldpos = 0, pos = 0; (pos = blkid_file_content.find("</device>", oldpos)) != std::string::npos; |
| | | oldpos = pos + 1) { |
| | |
| | | parseUUID(disk_sn.c_str(), diskInfo.disk_sn, sizeof(diskInfo.disk_sn)); |
| | | std::string disk_type = getAttribute(cur_dev, "TYPE"); |
| | | disk_by_uuid.insert(std::pair<std::string, int>(disk_sn, diskInfo.id)); |
| | | diskInfo.label_initialized = true; |
| | | diskInfo.sn_initialized = true; |
| | | // unlikely that somebody put the swap on a removable disk. |
| | | // this is a first rough guess on what can be a preferred disk for blkid devices |
| | | // just in case /etc/fstab can't be accessed or it is not up to date. |
| | |
| | | } |
| | | |
| | | IP_ADAPTER_INFO* pAdapter = pAdapterInfo; |
| | | FUNCTION_RETURN result = FUNC_RET_OK; |
| | | while (pAdapter) { |
| | | if (pAdapter->Type == MIB_IF_TYPE_ETHERNET) { |
| | | OsAdapterInfo ai = {}; |