2011-07-11 20:46:03 -04:00
|
|
|
/**
|
2012-10-08 23:02:04 -04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-11 20:46:03 -04:00
|
|
|
* RDP Licensing
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
2022-10-06 11:32:08 +02:00
|
|
|
* Copyright 2022 Armin Novak <armin.novak@thincast.com>
|
|
|
|
|
* Copyright 2022 Thincast Technologies GmbH
|
2011-07-11 20:46:03 -04:00
|
|
|
*
|
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
|
*
|
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
*
|
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
|
* limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-06-06 14:01:41 +02:00
|
|
|
#ifndef FREERDP_LIB_CORE_LICENSE_H
|
|
|
|
|
#define FREERDP_LIB_CORE_LICENSE_H
|
2011-07-11 20:46:03 -04:00
|
|
|
|
|
|
|
|
#include "rdp.h"
|
2022-11-11 12:26:28 +01:00
|
|
|
#include "state.h"
|
2013-03-21 16:45:25 -04:00
|
|
|
|
2012-02-17 00:58:30 -05:00
|
|
|
#include <freerdp/crypto/crypto.h>
|
2011-07-11 20:46:03 -04:00
|
|
|
|
2014-09-12 14:36:29 +02:00
|
|
|
#include <freerdp/log.h>
|
2018-11-01 11:02:54 +01:00
|
|
|
#include <freerdp/license.h>
|
2013-03-21 16:45:25 -04:00
|
|
|
|
|
|
|
|
#include <winpr/stream.h>
|
2011-07-11 20:46:03 -04:00
|
|
|
|
2022-10-06 11:32:08 +02:00
|
|
|
#define CLIENT_RANDOM_LENGTH 32
|
|
|
|
|
|
2011-07-11 20:46:03 -04:00
|
|
|
typedef struct
|
|
|
|
|
{
|
2012-10-09 03:26:39 -04:00
|
|
|
UINT32 dwVersion;
|
|
|
|
|
UINT32 cbCompanyName;
|
2012-10-09 03:01:37 -04:00
|
|
|
BYTE* pbCompanyName;
|
2012-10-09 03:26:39 -04:00
|
|
|
UINT32 cbProductId;
|
2012-10-09 03:01:37 -04:00
|
|
|
BYTE* pbProductId;
|
2014-02-16 18:02:50 -05:00
|
|
|
} LICENSE_PRODUCT_INFO;
|
2011-07-11 20:46:03 -04:00
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2012-10-09 03:01:37 -04:00
|
|
|
UINT16 type;
|
|
|
|
|
UINT16 length;
|
|
|
|
|
BYTE* data;
|
2011-07-11 20:46:03 -04:00
|
|
|
} LICENSE_BLOB;
|
|
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2012-10-09 03:26:39 -04:00
|
|
|
UINT32 count;
|
2022-10-06 11:32:08 +02:00
|
|
|
LICENSE_BLOB** array;
|
2011-07-11 20:46:03 -04:00
|
|
|
} SCOPE_LIST;
|
|
|
|
|
|
2026-02-24 11:28:38 +01:00
|
|
|
WINPR_ATTR_NODISCARD
|
2022-10-06 11:32:08 +02:00
|
|
|
FREERDP_LOCAL BOOL license_send_valid_client_error_packet(rdpRdp* rdp);
|
2011-07-11 20:46:03 -04:00
|
|
|
|
2026-02-24 11:28:38 +01:00
|
|
|
WINPR_ATTR_NODISCARD
|
2022-11-11 12:26:28 +01:00
|
|
|
FREERDP_LOCAL state_run_t license_recv(rdpLicense* license, wStream* s);
|
2016-08-10 09:12:55 +02:00
|
|
|
|
2022-10-06 11:32:08 +02:00
|
|
|
/* the configuration is applied from settings. Set FreeRDP_ServerLicense* settings */
|
2026-02-24 11:28:38 +01:00
|
|
|
WINPR_ATTR_NODISCARD
|
2022-10-06 11:32:08 +02:00
|
|
|
FREERDP_LOCAL BOOL license_server_configure(rdpLicense* license);
|
2026-02-24 11:28:38 +01:00
|
|
|
|
|
|
|
|
WINPR_ATTR_NODISCARD
|
2022-10-06 11:32:08 +02:00
|
|
|
FREERDP_LOCAL BOOL license_server_send_request(rdpLicense* license);
|
|
|
|
|
|
2016-08-10 09:12:55 +02:00
|
|
|
FREERDP_LOCAL void license_free(rdpLicense* license);
|
2011-07-11 20:46:03 -04:00
|
|
|
|
2024-01-26 13:09:00 +01:00
|
|
|
WINPR_ATTR_MALLOC(license_free, 1)
|
2026-01-26 13:08:35 +01:00
|
|
|
WINPR_ATTR_NODISCARD
|
2024-01-26 13:09:00 +01:00
|
|
|
FREERDP_LOCAL rdpLicense* license_new(rdpRdp* rdp);
|
|
|
|
|
|
2014-09-12 14:36:29 +02:00
|
|
|
#define LICENSE_TAG FREERDP_TAG("core.license")
|
2011-07-12 01:57:09 -04:00
|
|
|
#ifdef WITH_DEBUG_LICENSE
|
2022-10-06 11:32:08 +02:00
|
|
|
#define DEBUG_LICENSE(...) WLog_INFO(LICENSE_TAG, __VA_ARGS__)
|
2011-07-12 01:57:09 -04:00
|
|
|
#else
|
2019-11-06 15:24:51 +01:00
|
|
|
#define DEBUG_LICENSE(...) \
|
|
|
|
|
do \
|
|
|
|
|
{ \
|
|
|
|
|
} while (0)
|
2011-07-12 01:57:09 -04:00
|
|
|
#endif
|
|
|
|
|
|
2017-06-06 14:01:41 +02:00
|
|
|
#endif /* FREERDP_LIB_CORE_LICENSE_H */
|