20#include <freerdp/config.h>
24state_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_VRB(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;
58BOOL freerdp_heartbeat_send_heartbeat_pdu(freerdp_peer* peer, BYTE period, BYTE count1, BYTE count2)
60 rdpRdp* rdp = peer->context->rdp;
62 wStream* s = rdp_message_channel_pdu_init(rdp, &sec_flags);
68 Stream_Write_UINT8(s, period);
69 Stream_Write_UINT8(s, count1);
70 Stream_Write_UINT8(s, count2);
72 WLog_DBG(HEARTBEAT_TAG,
73 "sending Heartbeat PDU -> period=%" PRIu8
", count1=%" PRIu8
", count2=%" PRIu8
"",
74 period, count1, count2);
76 if (!rdp_send_message_channel_pdu(rdp, s, sec_flags | SEC_HEARTBEAT))
82rdpHeartbeat* heartbeat_new(
void)
84 rdpHeartbeat* heartbeat = (rdpHeartbeat*)calloc(1,
sizeof(rdpHeartbeat));
93void heartbeat_free(rdpHeartbeat* heartbeat)