Send printed document via blobs.
This commit is contained in:
parent
9e88ae4f60
commit
8920bc0c76
@ -2,14 +2,24 @@
|
|||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
#include <freerdp/utils/svc_plugin.h>
|
||||||
|
|
||||||
|
#include <guacamole/protocol.h>
|
||||||
|
|
||||||
#include "rdpdr_messages.h"
|
#include "rdpdr_messages.h"
|
||||||
|
#include "rdpdr_printer.h"
|
||||||
#include "rdpdr_service.h"
|
#include "rdpdr_service.h"
|
||||||
|
#include "client.h"
|
||||||
|
|
||||||
void guac_rdpdr_process_print_job_create(guac_rdpdrPlugin* rdpdr, STREAM* input_stream, int completion_id) {
|
void guac_rdpdr_process_print_job_create(guac_rdpdrPlugin* rdpdr, STREAM* input_stream, int completion_id) {
|
||||||
|
|
||||||
|
rdp_guac_client_data* client_data = (rdp_guac_client_data*) rdpdr->client->data;
|
||||||
STREAM* output_stream = stream_new(24);
|
STREAM* output_stream = stream_new(24);
|
||||||
|
|
||||||
|
/* Open file */
|
||||||
guac_client_log_info(rdpdr->client, "Print job created");
|
guac_client_log_info(rdpdr->client, "Print job created");
|
||||||
|
pthread_mutex_lock(&(client_data->update_lock));
|
||||||
|
guac_protocol_send_file(rdpdr->client->socket,
|
||||||
|
GUAC_RDPDR_PRINTER_BLOB, "print.ps", "application/postscript");
|
||||||
|
pthread_mutex_unlock(&(client_data->update_lock));
|
||||||
|
|
||||||
/* Write header */
|
/* Write header */
|
||||||
stream_write_uint16(output_stream, RDPDR_CTYP_CORE);
|
stream_write_uint16(output_stream, RDPDR_CTYP_CORE);
|
||||||
@ -28,15 +38,21 @@ void guac_rdpdr_process_print_job_create(guac_rdpdrPlugin* rdpdr, STREAM* input_
|
|||||||
void guac_rdpdr_process_print_job_write(guac_rdpdrPlugin* rdpdr, STREAM* input_stream, int completion_id) {
|
void guac_rdpdr_process_print_job_write(guac_rdpdrPlugin* rdpdr, STREAM* input_stream, int completion_id) {
|
||||||
|
|
||||||
int length;
|
int length;
|
||||||
|
unsigned char* buffer;
|
||||||
|
|
||||||
|
rdp_guac_client_data* client_data = (rdp_guac_client_data*) rdpdr->client->data;
|
||||||
STREAM* output_stream = stream_new(24);
|
STREAM* output_stream = stream_new(24);
|
||||||
|
|
||||||
stream_read_uint32(input_stream, length);
|
stream_read_uint32(input_stream, length);
|
||||||
stream_seek(input_stream, 8); /* Offset */
|
stream_seek(input_stream, 8); /* Offset */
|
||||||
stream_seek(input_stream, 20); /* Padding */
|
stream_seek(input_stream, 20); /* Padding */
|
||||||
|
buffer = stream_get_tail(input_stream);
|
||||||
|
|
||||||
/* TODO: Here, read data */
|
/* Send data */
|
||||||
guac_client_log_info(rdpdr->client, "Data received: %i bytes", length);
|
pthread_mutex_lock(&(client_data->update_lock));
|
||||||
|
guac_protocol_send_blob(rdpdr->client->socket,
|
||||||
|
GUAC_RDPDR_PRINTER_BLOB, buffer, length);
|
||||||
|
pthread_mutex_unlock(&(client_data->update_lock));
|
||||||
|
|
||||||
/* Write header */
|
/* Write header */
|
||||||
stream_write_uint16(output_stream, RDPDR_CTYP_CORE);
|
stream_write_uint16(output_stream, RDPDR_CTYP_CORE);
|
||||||
@ -55,9 +71,14 @@ void guac_rdpdr_process_print_job_write(guac_rdpdrPlugin* rdpdr, STREAM* input_s
|
|||||||
|
|
||||||
void guac_rdpdr_process_print_job_close(guac_rdpdrPlugin* rdpdr, STREAM* input_stream, int completion_id) {
|
void guac_rdpdr_process_print_job_close(guac_rdpdrPlugin* rdpdr, STREAM* input_stream, int completion_id) {
|
||||||
|
|
||||||
|
rdp_guac_client_data* client_data = (rdp_guac_client_data*) rdpdr->client->data;
|
||||||
STREAM* output_stream = stream_new(24);
|
STREAM* output_stream = stream_new(24);
|
||||||
|
|
||||||
|
/* Close file */
|
||||||
guac_client_log_info(rdpdr->client, "Print job closed");
|
guac_client_log_info(rdpdr->client, "Print job closed");
|
||||||
|
pthread_mutex_lock(&(client_data->update_lock));
|
||||||
|
guac_protocol_send_end(rdpdr->client->socket, GUAC_RDPDR_PRINTER_BLOB);
|
||||||
|
pthread_mutex_unlock(&(client_data->update_lock));
|
||||||
|
|
||||||
/* Write header */
|
/* Write header */
|
||||||
stream_write_uint16(output_stream, RDPDR_CTYP_CORE);
|
stream_write_uint16(output_stream, RDPDR_CTYP_CORE);
|
||||||
|
@ -41,6 +41,11 @@
|
|||||||
#include <freerdp/utils/stream.h>
|
#include <freerdp/utils/stream.h>
|
||||||
#include <freerdp/utils/svc_plugin.h>
|
#include <freerdp/utils/svc_plugin.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The index of the blob to use when sending printed files.
|
||||||
|
*/
|
||||||
|
#define GUAC_RDPDR_PRINTER_BLOB 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Message handlers.
|
* Message handlers.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user