FreeRDP
wf_interface.h
1 
21 #ifndef FREERDP_SERVER_WIN_INTERFACE_H
22 #define FREERDP_SERVER_WIN_INTERFACE_H
23 
24 #include <winpr/windows.h>
25 
26 #include <freerdp/api.h>
27 #include <freerdp/freerdp.h>
28 #include <freerdp/listener.h>
29 
30 #include <freerdp/freerdp.h>
31 #include <freerdp/codec/rfx.h>
32 
33 #include <freerdp/server/rdpsnd.h>
34 
35 #if _WIN32_WINNT >= 0x0602
36 #define WITH_DXGI_1_2 1
37 #endif
38 
39 #define FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_CONNECT 1
40 #define FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_DISCONNECT 2
41 #define FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_ACTIVATE 4
42 #define FREERDP_SERVER_WIN_SRV_CALLBACK_EVENT_AUTH 8
43 
44 typedef struct wf_info wfInfo;
45 typedef struct wf_peer_context wfPeerContext;
46 
47 struct wf_info
48 {
49  wStream* s;
50 
51  // screen and monitor info
52  int screenID;
53  int virtscreen_width;
54  int virtscreen_height;
55  int servscreen_width;
56  int servscreen_height;
57  int servscreen_xoffset;
58  int servscreen_yoffset;
59 
60  int frame_idx;
61  int bitsPerPixel;
62  HDC driverDC;
63  int peerCount;
64  int activePeerCount;
65  void* changeBuffer;
66  int framesPerSecond;
67  LPTSTR deviceKey;
68  TCHAR deviceName[32];
69  freerdp_peer** peers;
70  BOOL mirrorDriverActive;
71  UINT framesWaiting;
72 
73  HANDLE snd_mutex;
74  BOOL snd_stop;
75  AUDIO_FORMAT* agreed_format;
76 
77  RECT invalid;
78  HANDLE mutex;
79  BOOL updatePending;
80  HANDLE updateEvent;
81  HANDLE updateThread;
82  HANDLE updateSemaphore;
83  RFX_CONTEXT* rfx_context;
84  unsigned long lastUpdate;
85  unsigned long nextUpdate;
87 
88  BOOL input_disabled;
89  BOOL force_all_disconnect;
90 };
91 
93 {
94  rdpContext _p;
95 
96  wfInfo* info;
97  int frame_idx;
98  HANDLE updateEvent;
99  BOOL socketClose;
100  HANDLE socketEvent;
101  HANDLE socketThread;
102  HANDLE socketSemaphore;
103 
104  HANDLE vcm;
105  RdpsndServerContext* rdpsnd;
106 };
107 
108 struct wf_server
109 {
110  DWORD port;
111  HANDLE thread;
112  freerdp_listener* instance;
113 };
114 typedef struct wf_server wfServer;
115 
116 typedef void(__stdcall* cbCallback)(int, UINT32);
117 
118 FREERDP_API int get_screen_info(int id, _TCHAR* name, size_t length, int* w, int* h, int* b);
119 FREERDP_API void set_screen_id(int id);
120 
121 FREERDP_API BOOL wfreerdp_server_start(wfServer* server);
122 FREERDP_API BOOL wfreerdp_server_stop(wfServer* server);
123 
124 FREERDP_API wfServer* wfreerdp_server_new(void);
125 FREERDP_API void wfreerdp_server_free(wfServer* server);
126 
127 FREERDP_API BOOL wfreerdp_server_is_running(wfServer* server);
128 
129 FREERDP_API UINT32 wfreerdp_server_num_peers(void);
130 FREERDP_API UINT32 wfreerdp_server_get_peer_hostname(int pId, wchar_t* dstStr);
131 FREERDP_API BOOL wfreerdp_server_peer_is_local(int pId);
132 FREERDP_API BOOL wfreerdp_server_peer_is_connected(int pId);
133 FREERDP_API BOOL wfreerdp_server_peer_is_activated(int pId);
134 FREERDP_API BOOL wfreerdp_server_peer_is_authenticated(int pId);
135 
136 FREERDP_API void wfreerdp_server_register_callback_event(cbCallback cb);
137 
138 void wfreerdp_server_peer_callback_event(int pId, UINT32 eType);
139 
140 #endif /* FREERDP_SERVER_WIN_INTERFACE_H */