1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *   http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied.  See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef GUAC_RDP_CHANNELS_RDPDR_PRINTER_H
21 #define GUAC_RDP_CHANNELS_RDPDR_PRINTER_H
22 
23 #include "channels/common-svc.h"
24 #include "channels/rdpdr/rdpdr.h"
25 
26 #include <winpr/stream.h>
27 
28 /**
29  * Name of the printer driver that should be used on the server.
30  */
31 #define GUAC_PRINTER_DRIVER "M\0S\0 \0P\0u\0b\0l\0i\0s\0h\0e\0r\0 \0I\0m\0a\0g\0e\0s\0e\0t\0t\0e\0r\0\0\0"
32 
33 /**
34  * The size of GUAC_PRINTER_DRIVER in bytes.
35  */
36 #define GUAC_PRINTER_DRIVER_LENGTH 50
37 
38 /**
39  * Registers a new printer device within the RDPDR plugin. This must be done
40  * before RDPDR connection finishes.
41  *
42  * @param svc
43  *     The static virtual channel instance being used for RDPDR.
44  *
45  * @param printer_name
46  *     The name of the printer that will be registered with the RDP
47  *     connection and passed through to the server.
48  */
49 void guac_rdpdr_register_printer(guac_rdp_common_svc* svc, char* printer_name);
50 
51 /**
52  * I/O request handler which processes a print job creation request.
53  */
54 guac_rdpdr_device_iorequest_handler guac_rdpdr_process_print_job_create;
55 
56 /**
57  * I/O request handler which processes a request to write data to an existing
58  * print job.
59  */
60 guac_rdpdr_device_iorequest_handler guac_rdpdr_process_print_job_write;
61 
62 /**
63  * I/O request handler which processes a request to close an existing print
64  * job.
65  */
66 guac_rdpdr_device_iorequest_handler guac_rdpdr_process_print_job_close;
67 
68 /**
69  * Handler for RDPDR Device I/O Requests which processes received messages on
70  * behalf of a printer device, in this case a simulated printer which produces
71  * PDF output.
72  */
73 guac_rdpdr_device_iorequest_handler guac_rdpdr_device_printer_iorequest_handler;
74 
75 /**
76  * Free handler which frees all data specific to the simulated printer device.
77  */
78 guac_rdpdr_device_free_handler guac_rdpdr_device_printer_free_handler;
79 
80 #endif
81 
82