2 * "$Id: sidechannel.h 6649 2007-07-11 21:46:42Z mike $"
4 * Side-channel API definitions for the Common UNIX Printing System (CUPS).
6 * Copyright 2007-2008 by Apple Inc.
7 * Copyright 2006 by Easy Software Products.
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/".
15 * This file is subject to the Apple OS-Developed Software exception.
18 #ifndef _CUPS_SIDECHANNEL_H_
19 # define _CUPS_SIDECHANNEL_H_
22 * Include necessary headers...
25 # include "versioning.h"
34 # endif /* __cplusplus */
41 #define CUPS_SC_FD 4 /* File descriptor for select/poll */
48 enum cups_sc_bidi_e
/**** Bidirectional capabilities ****/
50 CUPS_SC_BIDI_NOT_SUPPORTED
= 0, /* Bidirectional I/O is not supported */
51 CUPS_SC_BIDI_SUPPORTED
= 1 /* Bidirectional I/O is supported */
53 typedef enum cups_sc_bidi_e cups_sc_bidi_t
;
54 /**** Bidirectional capabilities ****/
56 enum cups_sc_command_e
/**** Request command codes ****/
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 */
64 typedef enum cups_sc_command_e cups_sc_command_t
;
65 /**** Request command codes ****/
67 enum cups_sc_state_e
/**** Printer state bits ****/
69 CUPS_SC_STATE_OFFLINE
= 0, /* Device is off-line */
70 CUPS_SC_STATE_ONLINE
= 1, /* Device is on-line */
71 CUPS_SC_STATE_BUSY
= 2, /* Device is busy */
72 CUPS_SC_STATE_ERROR
= 4, /* Other error condition */
73 CUPS_SC_STATE_MEDIA_LOW
= 16, /* Paper low condition */
74 CUPS_SC_STATE_MEDIA_EMPTY
= 32, /* Paper out condition */
75 CUPS_SC_STATE_MARKER_LOW
= 64, /* Toner/ink low condition */
76 CUPS_SC_STATE_MARKER_EMPTY
= 128 /* Toner/ink out condition */
78 typedef enum cups_sc_state_e cups_sc_state_t
;
79 /**** Printer state bits ****/
81 enum cups_sc_status_e
/**** Response status codes ****/
83 CUPS_SC_STATUS_NONE
, /* No status */
84 CUPS_SC_STATUS_OK
, /* Operation succeeded */
85 CUPS_SC_STATUS_IO_ERROR
, /* An I/O error occurred */
86 CUPS_SC_STATUS_TIMEOUT
, /* The backend did not respond */
87 CUPS_SC_STATUS_NO_RESPONSE
, /* The device did not respond */
88 CUPS_SC_STATUS_BAD_MESSAGE
, /* The command/response message was invalid */
89 CUPS_SC_STATUS_TOO_BIG
, /* Response too big */
90 CUPS_SC_STATUS_NOT_IMPLEMENTED
/* Command not implemented */
92 typedef enum cups_sc_status_e cups_sc_status_t
;
93 /**** Response status codes ****/
100 extern cups_sc_status_t
cupsSideChannelDoRequest(cups_sc_command_t command
,
101 char *data
, int *datalen
,
102 double timeout
) _CUPS_API_1_3
;
103 extern int cupsSideChannelRead(cups_sc_command_t
*command
,
104 cups_sc_status_t
*status
,
105 char *data
, int *datalen
,
106 double timeout
) _CUPS_API_1_3
;
107 extern int cupsSideChannelWrite(cups_sc_command_t command
,
108 cups_sc_status_t status
,
109 const char *data
, int datalen
,
110 double timeout
) _CUPS_API_1_3
;
115 # endif /* __cplusplus */
117 #endif /* !_CUPS_SIDECHANNEL_H_ */
120 * End of "$Id: sidechannel.h 6649 2007-07-11 21:46:42Z mike $".