]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/sidechannel.h
Load cups into easysw/current.
[thirdparty/cups.git] / cups / sidechannel.h
1 /*
2 * "$Id: sidechannel.h 6170 2007-01-02 17:26:41Z mike $"
3 *
4 * Side-channel API definitions for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 2006 by Easy Software Products.
7 *
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
13 * at:
14 *
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
19 *
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
23 *
24 * This file is subject to the Apple OS-Developed Software exception.
25 */
26
27 #ifndef _CUPS_SIDECHANNEL_H_
28 # define _CUPS_SIDECHANNEL_H_
29
30 /*
31 * C++ magic...
32 */
33
34 # ifdef __cplusplus
35 extern "C" {
36 # endif /* __cplusplus */
37
38
39 /*
40 * Constants...
41 */
42
43 #define CUPS_SC_FD 4 /* File descriptor for select/poll */
44
45
46 /*
47 * Enumerations...
48 */
49
50 typedef enum /**** Bidirectional capabilities ****/
51 {
52 CUPS_SC_BIDI_NOT_SUPPORTED = 0, /* Bidirectional I/O is not supported */
53 CUPS_SC_BIDI_SUPPORTED = 1 /* Bidirectional I/O is supported */
54 } cups_sc_bidi_t;
55
56 typedef enum /**** Request command codes ****/
57 {
58 CUPS_SC_CMD_SOFT_RESET = 1, /* Do a soft reset */
59 CUPS_SC_CMD_DRAIN_OUTPUT = 2, /* Drain all pending output */
60 CUPS_SC_CMD_GET_BIDI = 3, /* Return bidirectional capabilities */
61 CUPS_SC_CMD_GET_DEVICE_ID = 4, /* Return the IEEE-1284 device ID */
62 CUPS_SC_CMD_GET_STATE = 5 /* Return the device state */
63 } cups_sc_command_t;
64
65 typedef enum /**** Printer state bits ****/
66 {
67 CUPS_SC_STATE_OFFLINE = 0, /* Device is off-line */
68 CUPS_SC_STATE_ONLINE = 1, /* Device is on-line */
69 CUPS_SC_STATE_BUSY = 2, /* Device is busy */
70 CUPS_SC_STATE_ERROR = 4, /* Other error condition */
71 CUPS_SC_STATE_MEDIA_LOW = 16, /* Paper low condition */
72 CUPS_SC_STATE_MEDIA_EMPTY = 32, /* Paper out condition */
73 CUPS_SC_STATE_MARKER_LOW = 64, /* Toner/ink low condition */
74 CUPS_SC_STATE_MARKER_EMPTY = 128 /* Toner/ink out condition */
75 } cups_sc_state_t;
76
77 typedef enum /**** Response status codes ****/
78 {
79 CUPS_SC_STATUS_NONE, /* No status */
80 CUPS_SC_STATUS_OK, /* Operation succeeded */
81 CUPS_SC_STATUS_IO_ERROR, /* An I/O error occurred */
82 CUPS_SC_STATUS_TIMEOUT, /* The backend did not respond */
83 CUPS_SC_STATUS_NO_RESPONSE, /* The device did not respond */
84 CUPS_SC_STATUS_BAD_MESSAGE, /* The command/response message was invalid */
85 CUPS_SC_STATUS_TOO_BIG, /* Response too big */
86 CUPS_SC_STATUS_NOT_IMPLEMENTED /* Command not implemented */
87 } cups_sc_status_t;
88
89
90 /*
91 * Prototypes...
92 */
93
94 extern cups_sc_status_t cupsSideChannelDoRequest(cups_sc_command_t command,
95 char *data, int *datalen,
96 double timeout);
97 extern int cupsSideChannelRead(cups_sc_command_t *command,
98 cups_sc_status_t *status,
99 char *data, int *datalen,
100 double timeout);
101 extern int cupsSideChannelWrite(cups_sc_command_t command,
102 cups_sc_status_t status,
103 const char *data, int datalen,
104 double timeout);
105
106
107 # ifdef __cplusplus
108 }
109 # endif /* __cplusplus */
110
111 #endif /* !_CUPS_SIDECHANNEL_H_ */
112
113 /*
114 * End of "$Id: sidechannel.h 6170 2007-01-02 17:26:41Z mike $".
115 */