ctkgridlicense.h 3.75 KB
Newer Older
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
/*
 * nvidia-settings: A tool for configuring the NVIDIA X driver on Unix
 * and Linux systems.
 *
 * Copyright (C) 2017 NVIDIA Corporation.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses>.
 */

#ifndef __CTK_MANAGE_GRID_LICENSE_H__
#define __CTK_MANAGE_GRID_LICENSE_H__

G_BEGIN_DECLS

#define CTK_TYPE_MANAGE_GRID_LICENSE (ctk_manage_grid_license_get_type())

#define CTK_MANAGE_GRID_LICENSE(obj) \
    (G_TYPE_CHECK_INSTANCE_CAST ((obj), CTK_TYPE_MANAGE_GRID_LICENSE, CtkManageGridLicense))

#define CTK_MANAGE_GRID_LICENSE_CLASS(klass) \
    (G_TYPE_CHECK_CLASS_CAST ((klass), CTK_TYPE_MANAGE_GRID_LICENSE, CtkManageGridLicenseClass))

#define CTK_IS_MANAGE_GRID_LICENSE(obj) \
    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CTK_TYPE_MANAGE_GRID_LICENSE))

#define CTK_IS_MANAGE_GRID_LICENSE_CLASS(class) \
    (G_TYPE_CHECK_CLASS_TYPE ((klass), CTK_TYPE_MANAGE_GRID_LICENSE))

#define CTK_MANAGE_GRID_LICENSE_GET_CLASS(obj) \
    (G_TYPE_INSTANCE_GET_CLASS ((obj), CTK_TYPE_MANAGE_GRID_LICENSE, CtkMANAGE_GRID_LICENSEClass))

Liam Middlebrook's avatar
Liam Middlebrook committed
42 43 44 45
#define GRID_LICENSE_INFO_MAX_LENGTH        128
#define GRID_MESSAGE_MAX_BUFFER_SIZE        512
#define GRID_VIRTUAL_APPLICATIONS           "GRID Virtual Applications"

46 47 48 49 50 51 52 53 54 55 56
typedef struct _CtkManageGridLicense       CtkManageGridLicense;
typedef struct _CtkManageGridLicenseClass  CtkManageGridLicenseClass;

typedef struct _DbusData DbusData;

struct _CtkManageGridLicense
{
    GtkVBox parent;

    CtkConfig *ctk_config;

57 58
    GtkWidget* txt_secondary_server_port;
    GtkWidget* txt_secondary_server_address;
59 60 61
    GtkWidget* txt_server_port;
    GtkWidget* txt_server_address;
    GtkWidget* label_license_state;
62
    GtkWidget* btn_apply;
63 64
    GtkWidget* radio_btn_vapp;
    GtkWidget* radio_btn_qdws;
65
    GtkWidget* btn_cancel;
66 67 68
    GtkWidget* box_server_info;

    DbusData *dbusData;
69
    CtrlTarget *target;
70
    gint license_edition_state;
Liam Middlebrook's avatar
Liam Middlebrook committed
71 72 73
    gint feature_type;                              // Feature type from UI/gridd.conf.
    int gridd_feature_type;                         // Feature type fetched from nvidia-gridd.
    char productName[GRID_LICENSE_INFO_MAX_LENGTH]; // GRID product name fetched from nvml.
74 75
};

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
/*
 * Status related to GRID licensing
 */
typedef enum
{
    NV_GRID_UNLICENSED_VGPU = 0,
    NV_GRID_UNLICENSED_VAPP,
    NV_GRID_UNLICENSED_QDWS_SELECTED,
    NV_GRID_LICENSE_ACQUIRED_VGPU,
    NV_GRID_LICENSE_ACQUIRED_QDWS,
    NV_GRID_LICENSE_REQUESTING_VGPU,
    NV_GRID_LICENSE_REQUESTING_QDWS,
    NV_GRID_LICENSE_FAILED_VGPU,
    NV_GRID_LICENSE_FAILED_QDWS,
    NV_GRID_LICENSE_EXPIRED_VGPU,
    NV_GRID_LICENSE_EXPIRED_QDWS,
    NV_GRID_LICENSE_RESTART_REQUIRED,
93
    NV_GRID_LICENSE_RESTART_REQUIRED_VAPP,
94
    NV_GRID_UNLICENSED_REQUEST_DETAILS,     // Default case
95 96
} licenseStatus;

97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
struct _CtkManageGridLicenseClass
{
    GtkVBoxClass parent_class;
};

GType          ctk_manage_grid_license_get_type    (void) G_GNUC_CONST;
GtkWidget*     ctk_manage_grid_license_new         (CtrlTarget *, CtkConfig *);
GtkTextBuffer* ctk_manage_grid_license_create_help (GtkTextTagTable *,
                                               CtkManageGridLicense *);

void           ctk_manage_grid_license_start_timer (GtkWidget *);
void           ctk_manage_grid_license_stop_timer  (GtkWidget *);

G_END_DECLS

#endif /* __CTK_MANAGE_GRID_LICENSE_H__ */