]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/sidechannel.h
Update svn:keyword properties.
[thirdparty/cups.git] / cups / sidechannel.h
CommitLineData
f7deaa1a 1/*
f2d18633 2 * "$Id$"
f7deaa1a 3 *
f14324a7 4 * Side-channel API definitions for CUPS.
f7deaa1a 5 *
f3c17241 6 * Copyright 2007-2012 by Apple Inc.
f7deaa1a 7 * Copyright 2006 by Easy Software Products.
8 *
9 * These coded instructions, statements, and computer programs are the
bc44d920 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/".
f7deaa1a 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
2fb76298
MS
21/*
22 * Include necessary headers...
23 */
24
25# include "versioning.h"
26
27
f7deaa1a 28/*
29 * C++ magic...
30 */
31
32# ifdef __cplusplus
33extern "C" {
34# endif /* __cplusplus */
35
36
37/*
38 * Constants...
39 */
40
41#define CUPS_SC_FD 4 /* File descriptor for select/poll */
42
43
44/*
45 * Enumerations...
46 */
47
79e1d494 48enum cups_sc_bidi_e /**** Bidirectional capability values ****/
f7deaa1a 49{
50 CUPS_SC_BIDI_NOT_SUPPORTED = 0, /* Bidirectional I/O is not supported */
51 CUPS_SC_BIDI_SUPPORTED = 1 /* Bidirectional I/O is supported */
5a738aea
MS
52};
53typedef enum cups_sc_bidi_e cups_sc_bidi_t;
54 /**** Bidirectional capabilities ****/
f7deaa1a 55
5a738aea 56enum cups_sc_command_e /**** Request command codes ****/
f7deaa1a 57{
18ecb428 58 CUPS_SC_CMD_NONE = 0, /* No command @private@ */
f7deaa1a 59 CUPS_SC_CMD_SOFT_RESET = 1, /* Do a soft reset */
60 CUPS_SC_CMD_DRAIN_OUTPUT = 2, /* Drain all pending output */
61 CUPS_SC_CMD_GET_BIDI = 3, /* Return bidirectional capabilities */
62 CUPS_SC_CMD_GET_DEVICE_ID = 4, /* Return the IEEE-1284 device ID */
20fbc903 63 CUPS_SC_CMD_GET_STATE = 5, /* Return the device state */
f3c17241
MS
64 CUPS_SC_CMD_SNMP_GET = 6, /* Query an SNMP OID @since CUPS 1.4/OS X 10.6@ */
65 CUPS_SC_CMD_SNMP_GET_NEXT = 7, /* Query the next SNMP OID @since CUPS 1.4/OS X 10.6@ */
66 CUPS_SC_CMD_GET_CONNECTED = 8, /* Return whether the backend is "connected" to the printer @since CUPS 1.5/OS X 10.7@ */
f14324a7 67 CUPS_SC_CMD_MAX /* End of valid values @private@ */
5a738aea
MS
68};
69typedef enum cups_sc_command_e cups_sc_command_t;
70 /**** Request command codes ****/
f7deaa1a 71
f14324a7
MS
72enum cups_sc_connected_e /**** Connectivity values ****/
73{
74 CUPS_SC_NOT_CONNECTED = 0, /* Backend is not "connected" to printer */
75 CUPS_SC_CONNECTED = 1 /* Backend is "connected" to printer */
76};
77typedef enum cups_sc_connected_e cups_sc_connected_t;
78 /**** Connectivity values ****/
79
80
5a738aea 81enum cups_sc_state_e /**** Printer state bits ****/
f7deaa1a 82{
79e1d494
MS
83 CUPS_SC_STATE_OFFLINE = 0, /* Device is offline */
84 CUPS_SC_STATE_ONLINE = 1, /* Device is online */
f7deaa1a 85 CUPS_SC_STATE_BUSY = 2, /* Device is busy */
86 CUPS_SC_STATE_ERROR = 4, /* Other error condition */
87 CUPS_SC_STATE_MEDIA_LOW = 16, /* Paper low condition */
88 CUPS_SC_STATE_MEDIA_EMPTY = 32, /* Paper out condition */
89 CUPS_SC_STATE_MARKER_LOW = 64, /* Toner/ink low condition */
90 CUPS_SC_STATE_MARKER_EMPTY = 128 /* Toner/ink out condition */
5a738aea
MS
91};
92typedef enum cups_sc_state_e cups_sc_state_t;
93 /**** Printer state bits ****/
f7deaa1a 94
5a738aea 95enum cups_sc_status_e /**** Response status codes ****/
f7deaa1a 96{
97 CUPS_SC_STATUS_NONE, /* No status */
98 CUPS_SC_STATUS_OK, /* Operation succeeded */
99 CUPS_SC_STATUS_IO_ERROR, /* An I/O error occurred */
100 CUPS_SC_STATUS_TIMEOUT, /* The backend did not respond */
101 CUPS_SC_STATUS_NO_RESPONSE, /* The device did not respond */
102 CUPS_SC_STATUS_BAD_MESSAGE, /* The command/response message was invalid */
103 CUPS_SC_STATUS_TOO_BIG, /* Response too big */
104 CUPS_SC_STATUS_NOT_IMPLEMENTED /* Command not implemented */
5a738aea
MS
105};
106typedef enum cups_sc_status_e cups_sc_status_t;
107 /**** Response status codes ****/
f7deaa1a 108
20fbc903
MS
109typedef void (*cups_sc_walk_func_t)(const char *oid, const char *data,
110 int datalen, void *context);
111 /**** SNMP walk callback ****/
112
f7deaa1a 113
114/*
115 * Prototypes...
116 */
117
118extern cups_sc_status_t cupsSideChannelDoRequest(cups_sc_command_t command,
119 char *data, int *datalen,
2fb76298 120 double timeout) _CUPS_API_1_3;
f7deaa1a 121extern int cupsSideChannelRead(cups_sc_command_t *command,
122 cups_sc_status_t *status,
123 char *data, int *datalen,
2fb76298 124 double timeout) _CUPS_API_1_3;
f7deaa1a 125extern int cupsSideChannelWrite(cups_sc_command_t command,
126 cups_sc_status_t status,
127 const char *data, int datalen,
2fb76298 128 double timeout) _CUPS_API_1_3;
f7deaa1a 129
20fbc903
MS
130/**** New in CUPS 1.4 ****/
131extern cups_sc_status_t cupsSideChannelSNMPGet(const char *oid, char *data,
132 int *datalen, double timeout)
133 _CUPS_API_1_4;
134extern cups_sc_status_t cupsSideChannelSNMPWalk(const char *oid, double timeout,
135 cups_sc_walk_func_t cb,
136 void *context) _CUPS_API_1_4;
137
f7deaa1a 138
139# ifdef __cplusplus
140}
141# endif /* __cplusplus */
142
143#endif /* !_CUPS_SIDECHANNEL_H_ */
144
145/*
f2d18633 146 * End of "$Id$".
f7deaa1a 147 */