Initial commit - from Precise source
[freerdp-ubuntu-pcb-backport.git] / channels / rdpdr / printer / printer_main.h
1 /**
2  * FreeRDP: A Remote Desktop Protocol client.
3  * Print Virtual Channel
4  *
5  * Copyright 2010-2011 Vic Lee
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #ifndef __PRINTER_MAIN_H
21 #define __PRINTER_MAIN_H
22
23 #include "rdpdr_types.h"
24
25 /* SERVER_PRINTER_CACHE_EVENT.cachedata */
26 #define RDPDR_ADD_PRINTER_EVENT             0x00000001
27 #define RDPDR_UPDATE_PRINTER_EVENT          0x00000002
28 #define RDPDR_DELETE_PRINTER_EVENT          0x00000003
29 #define RDPDR_RENAME_PRINTER_EVENT          0x00000004
30
31 /* DR_PRN_DEVICE_ANNOUNCE.Flags */
32 #define RDPDR_PRINTER_ANNOUNCE_FLAG_ASCII           0x00000001
33 #define RDPDR_PRINTER_ANNOUNCE_FLAG_DEFAULTPRINTER  0x00000002
34 #define RDPDR_PRINTER_ANNOUNCE_FLAG_NETWORKPRINTER  0x00000004
35 #define RDPDR_PRINTER_ANNOUNCE_FLAG_TSPRINTER       0x00000008
36 #define RDPDR_PRINTER_ANNOUNCE_FLAG_XPSFORMAT       0x00000010
37
38 typedef struct rdp_printer_driver rdpPrinterDriver;
39 typedef struct rdp_printer rdpPrinter;
40 typedef struct rdp_print_job rdpPrintJob;
41
42 typedef rdpPrinter** (*pcEnumPrinters) (rdpPrinterDriver* driver);
43 typedef rdpPrinter* (*pcGetPrinter) (rdpPrinterDriver* driver, const char* name);
44
45 struct rdp_printer_driver
46 {
47         pcEnumPrinters EnumPrinters;
48         pcGetPrinter GetPrinter;
49 };
50
51 typedef rdpPrintJob* (*pcCreatePrintJob) (rdpPrinter* printer, uint32 id);
52 typedef rdpPrintJob* (*pcFindPrintJob) (rdpPrinter* printer, uint32 id);
53 typedef void (*pcFreePrinter) (rdpPrinter* printer);
54
55 struct rdp_printer
56 {
57         int id;
58         char* name;
59         char* driver;
60         boolean is_default;
61
62         pcCreatePrintJob CreatePrintJob;
63         pcFindPrintJob FindPrintJob;
64         pcFreePrinter Free;
65 };
66
67 typedef void (*pcWritePrintJob) (rdpPrintJob* printjob, uint8* data, int size);
68 typedef void (*pcClosePrintJob) (rdpPrintJob* printjob);
69
70 struct rdp_print_job
71 {
72         uint32 id;
73         rdpPrinter* printer;
74
75         pcWritePrintJob Write;
76         pcClosePrintJob Close;
77 };
78
79 #endif