4848 */
4949#define GUAC_COMMON_RECORDING_MAX_NAME_LENGTH 2048
5050
51+ /**
52+ * The block size to use when sending clipboard data in a recording.
53+ */
54+ #define GUAC_RECORDING_CLIPBOARD_BLOCK_SIZE 4096
55+
5156/**
5257 * An in-progress session recording, attached to a guac_client instance such
5358 * that output Guacamole instructions may be dynamically intercepted and
@@ -61,6 +66,12 @@ typedef struct guac_recording {
6166 */
6267 guac_socket * socket ;
6368
69+ /**
70+ * The stream used for recording clipboard data. This stream is allocated
71+ * once during recording creation and reused for all clipboard events.
72+ */
73+ guac_stream * clipboard_stream ;
74+
6475 /**
6576 * Non-zero if output which is broadcast to each connected client
6677 * (graphics, streams, etc.) should be included in the session recording,
@@ -95,6 +106,15 @@ typedef struct guac_recording {
95106 */
96107 int include_keys ;
97108
109+ /**
110+ * Non-zero if clipboard data should be included in the session
111+ * recording, zero otherwise. Including clipboard data within the recording may
112+ * be necessary in certain auditing contexts, but should only be done with
113+ * caution. Clipboard can easily contain sensitive information, such as
114+ * passwords, credit card numbers, etc.
115+ */
116+ int include_clipboard ;
117+
98118} guac_recording ;
99119
100120/**
@@ -152,6 +172,13 @@ typedef struct guac_recording {
152172 * Non-zero if writing to an existing file should be allowed, or zero
153173 * otherwise.
154174 *
175+ * @param include_clipboard
176+ * Non-zero if clipboard data should be included in the session
177+ * recording, zero otherwise. Including clipboard data within the recording may
178+ * be necessary in certain auditing contexts, but should only be done with
179+ * caution. Clipboard can easily contain sensitive information, such as
180+ * passwords, credit card numbers, etc.
181+ *
155182 * @return
156183 * A new guac_recording structure representing the in-progress
157184 * recording if the recording file has been successfully created and a
@@ -160,7 +187,7 @@ typedef struct guac_recording {
160187guac_recording * guac_recording_create (guac_client * client ,
161188 const char * path , const char * name , int create_path ,
162189 int include_output , int include_mouse , int include_touch ,
163- int include_keys , int allow_write_existing );
190+ int include_keys , int allow_write_existing , int include_clipboard );
164191
165192/**
166193 * Frees the resources associated with the given in-progress recording. Note
@@ -256,5 +283,69 @@ void guac_recording_report_touch(guac_recording* recording,
256283void guac_recording_report_key (guac_recording * recording ,
257284 int keysym , int pressed );
258285
259- #endif
286+ /**
287+ * Reports a clipboard instruction within the recording.
288+ * The full structure consists of clipboard instruction, one or more
289+ * blob instructions and end instruction.
290+ *
291+ * @param recording
292+ * The guac_recording associated with the clipboard instruction.
293+ *
294+ * @param stream
295+ * The guac_stream allocated for the clipboard instruction.
296+ *
297+ * @param mimetype
298+ * The clipboard data mimetype
299+ */
300+ void guac_recording_report_clipboard_begin (guac_recording * recording ,
301+ guac_stream * stream , char * mimetype );
302+
303+ /**
304+ * Report a clipboard blob within the recording.
305+ *
306+ * @param recording
307+ * The guac_recording associated with the clipboard instruction.
308+ *
309+ * @param stream
310+ * The guac_stream associated with the clipboard instruction.
311+ *
312+ * @param data
313+ * The clipboard blob data.
314+ *
315+ * @param length
316+ * Length of the blob data.
317+ */
318+ void guac_recording_report_clipboard_blob (guac_recording * recording ,
319+ guac_stream * stream , void * data , int length );
320+
321+ /**
322+ * Report a clipboard end instruction within the recording.
323+ *
324+ * @param recording
325+ * The guac_recording associated with the clipboard instruction.
326+ *
327+ * @param stream
328+ * The guac_stream associated with the clipboard instruction.
329+ */
330+ void guac_recording_report_clipboard_end (guac_recording * recording ,
331+ guac_stream * stream );
260332
333+ /**
334+ * Reports clipboard data within the recording.
335+ *
336+ * @param recording
337+ * The guac_recording to write clipboard data to.
338+ *
339+ * @param mimetype
340+ * The mimetype of the clipboard data (e.g., "text/plain").
341+ *
342+ * @param data
343+ * The clipboard data buffer.
344+ *
345+ * @param length
346+ * The length of the clipboard data in bytes.
347+ */
348+ void guac_recording_report_clipboard (guac_recording * recording ,
349+ const char * mimetype , const char * data , int length );
350+
351+ #endif
0 commit comments