File: sysinfo.hpp

package info (click to toggle)
openvpn3-client 25%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,276 kB
  • sloc: cpp: 190,085; python: 7,218; ansic: 1,866; sh: 1,361; java: 402; lisp: 81; makefile: 17
file content (61 lines) | stat: -rw-r--r-- 1,255 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//  OpenVPN 3 Linux client -- Next generation OpenVPN client
//
//  SPDX-License-Identifier: AGPL-3.0-only
//
//  Copyright (C) 2017-  OpenVPN Inc <sales@openvpn.net>
//  Copyright (C) 2024-  Răzvan Cojocaru <razvan.cojocaru@openvpn.com>
//

#pragma once

#include <string>

namespace DevPosture {

struct SysInfo
{
    SysInfo();

    struct Uname
    {
        std::string sysname;
        std::string machine;
        std::string version;
        std::string release;
    };

    struct OSRelease
    {
        std::string version_id;
        std::string id;
        std::string cpe;
        std::string extra_version;
    };

    operator std::string() const
    {
        return "{\n { " + uname.sysname + ", " + uname.machine + ", " + uname.version
               + ", " + uname.release + " },\n { " + os_release.version_id + ", "
               + os_release.id + ", " + os_release.cpe + ", " + os_release.extra_version
               + " }\n}";
    }

    Uname uname;
    OSRelease os_release;
};

struct DateTime
{
    DateTime();

    operator std::string() const
    {
        return "{ " + date + ", " + time + ", " + timezone + " }";
    }

    std::string date;
    std::string time;
    std::string timezone;
};

} // namespace DevPosture