From d87d351c0049c30ddad5b81d07866d646d770b95 Mon Sep 17 00:00:00 2001 From: Martin Fleisz Date: Tue, 4 Aug 2020 09:11:41 +0200 Subject: [PATCH] Add GatewayMessageType to public API --- client/Windows/wf_client.c | 2 +- client/common/client.c | 2 +- include/freerdp/freerdp.h | 5 +++++ libfreerdp/core/gateway/rdg.c | 4 ++-- libfreerdp/core/gateway/tsg.c | 4 ++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/client/Windows/wf_client.c b/client/Windows/wf_client.c index 9ebad7aad..d8646f8a1 100644 --- a/client/Windows/wf_client.c +++ b/client/Windows/wf_client.c @@ -645,7 +645,7 @@ static BOOL wf_present_gateway_message(freerdp* instance, UINT32 type, BOOL isDi return TRUE; /* special handling for consent messages (show modal dialog) */ - if (type == 1 && isConsentMandatory) + if (type == GATEWAY_MESSAGE_CONSENT && isConsentMandatory) { int mbRes; WCHAR* msg; diff --git a/client/common/client.c b/client/common/client.c index 8a9c4bd31..cccc97401 100644 --- a/client/common/client.c +++ b/client/common/client.c @@ -668,7 +668,7 @@ BOOL client_cli_present_gateway_message(freerdp* instance, UINT32 type, BOOL isD const WCHAR* message) { char answer; - const char* msgType = (type == 1) ? "Consent message" : "Service message"; + const char* msgType = (type == GATEWAY_MESSAGE_CONSENT) ? "Consent message" : "Service message"; if (!isDisplayMandatory && !isConsentMandatory) return TRUE; diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index 230234189..ac0678ad6 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -70,6 +70,10 @@ extern "C" #define VERIFY_CERT_FLAG_MISMATCH 0x80 #define VERIFY_CERT_FLAG_MATCH_LEGACY_SHA1 0x100 +/* Message types used by gateway messaging callback */ +#define GATEWAY_MESSAGE_CONSENT 1 +#define GATEWAY_MESSAGE_SERVICE 2 + typedef BOOL (*pContextNew)(freerdp* instance, rdpContext* context); typedef void (*pContextFree)(freerdp* instance, rdpContext* context); @@ -183,6 +187,7 @@ extern "C" typedef BOOL (*pReceiveChannelData)(freerdp* instance, UINT16 channelId, const BYTE* data, size_t size, UINT32 flags, size_t totalSize); + /* type can be one of the GATEWAY_MESSAGE_ type defines */ typedef BOOL (*pPresentGatewayMessage)(freerdp* instance, UINT32 type, BOOL isDisplayMandatory, BOOL isConsentMandatory, size_t length, const WCHAR* message); diff --git a/libfreerdp/core/gateway/rdg.c b/libfreerdp/core/gateway/rdg.c index e65eddf83..0c3fa6beb 100644 --- a/libfreerdp/core/gateway/rdg.c +++ b/libfreerdp/core/gateway/rdg.c @@ -775,7 +775,7 @@ static BOOL rdg_process_tunnel_response_optional(rdpRdg* rdg, wStream* s, UINT16 } return IFCALLRESULT(TRUE, context->instance->PresentGatewayMessage, context->instance, - TSG_ASYNC_MESSAGE_CONSENT_MESSAGE, TRUE, TRUE, msgLenBytes, msg); + GATEWAY_MESSAGE_CONSENT, TRUE, TRUE, msgLenBytes, msg); } return TRUE; @@ -1441,7 +1441,7 @@ static BOOL rdg_process_service_message(rdpRdg* rdg, wStream* s) } return IFCALLRESULT(TRUE, context->instance->PresentGatewayMessage, context->instance, - TSG_ASYNC_MESSAGE_SERVICE_MESSAGE, TRUE, FALSE, msgLenBytes, msg); + GATEWAY_MESSAGE_SERVICE, TRUE, FALSE, msgLenBytes, msg); } static BOOL rdg_process_unknown_packet(rdpRdg* rdg, int type) diff --git a/libfreerdp/core/gateway/tsg.c b/libfreerdp/core/gateway/tsg.c index 1626b91c1..26c4ba223 100644 --- a/libfreerdp/core/gateway/tsg.c +++ b/libfreerdp/core/gateway/tsg.c @@ -1335,7 +1335,7 @@ static BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu) if (tsg->rpc && tsg->rpc->context && tsg->rpc->context->instance) { rc = IFCALLRESULT(TRUE, tsg->rpc->context->instance->PresentGatewayMessage, - tsg->rpc->context->instance, SwitchValue, + tsg->rpc->context->instance, GATEWAY_MESSAGE_CONSENT, packetStringMessage.isDisplayMandatory != 0, packetStringMessage.isConsentMandatory != 0, packetStringMessage.msgBytes, packetStringMessage.msgBuffer); @@ -1356,7 +1356,7 @@ static BOOL TsProxyMakeTunnelCallReadResponse(rdpTsg* tsg, RPC_PDU* pdu) if (tsg->rpc && tsg->rpc->context && tsg->rpc->context->instance) { rc = IFCALLRESULT(TRUE, tsg->rpc->context->instance->PresentGatewayMessage, - tsg->rpc->context->instance, SwitchValue, + tsg->rpc->context->instance, GATEWAY_MESSAGE_SERVICE, packetStringMessage.isDisplayMandatory != 0, packetStringMessage.isConsentMandatory != 0, packetStringMessage.msgBytes, packetStringMessage.msgBuffer);