FreeRDP
wf_channels.c
1 
19 #include <freerdp/config.h>
20 
21 #include <winpr/assert.h>
22 
23 #include "wf_channels.h"
24 
25 #include "wf_rail.h"
26 #include "wf_cliprdr.h"
27 
28 #include <freerdp/gdi/gfx.h>
29 #include <freerdp/gdi/video.h>
30 
31 #include <freerdp/log.h>
32 #define TAG CLIENT_TAG("windows")
33 
34 void wf_OnChannelConnectedEventHandler(void* context, const ChannelConnectedEventArgs* e)
35 {
36  wfContext* wfc = (wfContext*)context;
37  rdpSettings* settings;
38 
39  WINPR_ASSERT(wfc);
40  WINPR_ASSERT(e);
41 
42  settings = wfc->common.context.settings;
43  WINPR_ASSERT(settings);
44 
45  if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
46  {
47  wf_rail_init(wfc, (RailClientContext*)e->pInterface);
48  }
49  else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
50  {
51  wf_cliprdr_init(wfc, (CliprdrClientContext*)e->pInterface);
52  }
53  else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
54  {
55  wfc->disp = (DispClientContext*)e->pInterface;
56  }
57  else
58  freerdp_client_OnChannelConnectedEventHandler(context, e);
59 }
60 
61 void wf_OnChannelDisconnectedEventHandler(void* context, const ChannelDisconnectedEventArgs* e)
62 {
63  wfContext* wfc = (wfContext*)context;
64  rdpSettings* settings;
65 
66  WINPR_ASSERT(wfc);
67  WINPR_ASSERT(e);
68 
69  settings = wfc->common.context.settings;
70  WINPR_ASSERT(settings);
71 
72  if (strcmp(e->name, RAIL_SVC_CHANNEL_NAME) == 0)
73  {
74  wf_rail_uninit(wfc, (RailClientContext*)e->pInterface);
75  }
76  else if (strcmp(e->name, CLIPRDR_SVC_CHANNEL_NAME) == 0)
77  {
78  wf_cliprdr_uninit(wfc, (CliprdrClientContext*)e->pInterface);
79  }
80  else if (strcmp(e->name, DISP_DVC_CHANNEL_NAME) == 0)
81  {
82  wfc->disp = NULL;
83  }
84  else
85  freerdp_client_OnChannelDisconnectedEventHandler(context, e);
86 }