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