1 /**
2  * FreeRDP: A Remote Desktop Protocol Implementation
3  * Print Virtual Channel
4  *
5  * Copyright 2010-2011 Vic Lee
6  * Copyright 2015 Thincast Technologies GmbH
7  * Copyright 2015 DI (FH) Martin Haimberger <martin.haimberger@thincast.com>
8  * Copyright 2016 Armin Novak <armin.novak@gmail.com>
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  *     http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #ifndef FREERDP_CHANNEL_PRINTER_CLIENT_PRINTER_H
24 #define FREERDP_CHANNEL_PRINTER_CLIENT_PRINTER_H
25 
26 #include <freerdp/channels/rdpdr.h>
27 
28 typedef struct rdp_printer_driver rdpPrinterDriver;
29 typedef struct rdp_printer rdpPrinter;
30 typedef struct rdp_print_job rdpPrintJob;
31 
32 typedef void (*pcReferencePrinterDriver)(rdpPrinterDriver* driver);
33 typedef rdpPrinter** (*pcEnumPrinters)(rdpPrinterDriver* driver);
34 typedef void (*pcReleaseEnumPrinters)(rdpPrinter** printers);
35 
36 typedef rdpPrinter* (*pcGetPrinter)(rdpPrinterDriver* driver, const char* name,
37                                     const char* driverName);
38 typedef void (*pcReferencePrinter)(rdpPrinter* printer);
39 
40 struct rdp_printer_driver
41 {
42 	pcEnumPrinters EnumPrinters;
43 	pcReleaseEnumPrinters ReleaseEnumPrinters;
44 	pcGetPrinter GetPrinter;
45 
46 	pcReferencePrinterDriver AddRef;
47 	pcReferencePrinterDriver ReleaseRef;
48 };
49 
50 typedef rdpPrintJob* (*pcCreatePrintJob)(rdpPrinter* printer, UINT32 id);
51 typedef rdpPrintJob* (*pcFindPrintJob)(rdpPrinter* printer, UINT32 id);
52 
53 struct rdp_printer
54 {
55 	size_t id;
56 	char* name;
57 	char* driver;
58 	BOOL is_default;
59 
60 	size_t references;
61 	rdpPrinterDriver* backend;
62 	pcCreatePrintJob CreatePrintJob;
63 	pcFindPrintJob FindPrintJob;
64 	pcReferencePrinter AddRef;
65 	pcReferencePrinter ReleaseRef;
66 };
67 
68 typedef UINT (*pcWritePrintJob)(rdpPrintJob* printjob, const BYTE* data, size_t size);
69 typedef void (*pcClosePrintJob)(rdpPrintJob* printjob);
70 
71 struct rdp_print_job
72 {
73 	UINT32 id;
74 	rdpPrinter* printer;
75 
76 	pcWritePrintJob Write;
77 	pcClosePrintJob Close;
78 };
79 
80 #endif /* FREERDP_CHANNEL_PRINTER_CLIENT_PRINTER_H */
81