20 #include <freerdp/config.h>
22 #include "heartbeat.h"
24 state_run_t rdp_recv_heartbeat_packet(rdpRdp* rdp,
wStream* s)
32 WINPR_ASSERT(rdp->context);
35 if (!Stream_CheckAndLogRequiredLength(AUTODETECT_TAG, s, 4))
36 return STATE_RUN_FAILED;
39 Stream_Read_UINT8(s, period);
40 Stream_Read_UINT8(s, count1);
41 Stream_Read_UINT8(s, count2);
43 WLog_DBG(HEARTBEAT_TAG,
44 "received Heartbeat PDU -> period=%" PRIu8
", count1=%" PRIu8
", count2=%" PRIu8
"",
45 period, count1, count2);
47 rc = IFCALLRESULT(TRUE, rdp->heartbeat->ServerHeartbeat, rdp->context->instance, period, count1,
51 WLog_ERR(HEARTBEAT_TAG,
"heartbeat->ServerHeartbeat callback failed!");
52 return STATE_RUN_FAILED;
55 return STATE_RUN_SUCCESS;
58 BOOL freerdp_heartbeat_send_heartbeat_pdu(freerdp_peer* peer, BYTE period, BYTE count1, BYTE count2)
60 rdpRdp* rdp = peer->context->rdp;
61 wStream* s = rdp_message_channel_pdu_init(rdp);
67 Stream_Write_UINT8(s, period);
68 Stream_Write_UINT8(s, count1);
69 Stream_Write_UINT8(s, count2);
71 WLog_DBG(HEARTBEAT_TAG,
72 "sending Heartbeat PDU -> period=%" PRIu8
", count1=%" PRIu8
", count2=%" PRIu8
"",
73 period, count1, count2);
75 if (!rdp_send_message_channel_pdu(rdp, s, SEC_HEARTBEAT))
81 rdpHeartbeat* heartbeat_new(
void)
83 rdpHeartbeat* heartbeat = (rdpHeartbeat*)calloc(1,
sizeof(rdpHeartbeat));
92 void heartbeat_free(rdpHeartbeat* heartbeat)