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