]>
Commit | Line | Data |
---|---|---|
f7deaa1a | 1 | /* |
75bd9771 | 2 | * "$Id: sidechannel.h 7616 2008-05-28 00:34:13Z mike $" |
f7deaa1a | 3 | * |
4 | * Side-channel API definitions for the Common UNIX Printing System (CUPS). | |
5 | * | |
5a738aea | 6 | * Copyright 2007-2008 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 | |
33 | extern "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 | 48 | enum 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 | }; |
53 | typedef enum cups_sc_bidi_e cups_sc_bidi_t; | |
54 | /**** Bidirectional capabilities ****/ | |
f7deaa1a | 55 | |
5a738aea | 56 | enum cups_sc_command_e /**** Request command codes ****/ |
f7deaa1a | 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 */ | |
20fbc903 MS |
62 | CUPS_SC_CMD_GET_STATE = 5, /* Return the device state */ |
63 | CUPS_SC_CMD_SNMP_GET = 6, /* Query an SNMP OID @since CUPS 1.4@ */ | |
64 | CUPS_SC_CMD_SNMP_GET_NEXT = 7 /* Query the next SNMP OID @since CUPS 1.4@ */ | |
5a738aea MS |
65 | }; |
66 | typedef enum cups_sc_command_e cups_sc_command_t; | |
67 | /**** Request command codes ****/ | |
f7deaa1a | 68 | |
5a738aea | 69 | enum cups_sc_state_e /**** Printer state bits ****/ |
f7deaa1a | 70 | { |
79e1d494 MS |
71 | CUPS_SC_STATE_OFFLINE = 0, /* Device is offline */ |
72 | CUPS_SC_STATE_ONLINE = 1, /* Device is online */ | |
f7deaa1a | 73 | CUPS_SC_STATE_BUSY = 2, /* Device is busy */ |
74 | CUPS_SC_STATE_ERROR = 4, /* Other error condition */ | |
75 | CUPS_SC_STATE_MEDIA_LOW = 16, /* Paper low condition */ | |
76 | CUPS_SC_STATE_MEDIA_EMPTY = 32, /* Paper out condition */ | |
77 | CUPS_SC_STATE_MARKER_LOW = 64, /* Toner/ink low condition */ | |
78 | CUPS_SC_STATE_MARKER_EMPTY = 128 /* Toner/ink out condition */ | |
5a738aea MS |
79 | }; |
80 | typedef enum cups_sc_state_e cups_sc_state_t; | |
81 | /**** Printer state bits ****/ | |
f7deaa1a | 82 | |
5a738aea | 83 | enum cups_sc_status_e /**** Response status codes ****/ |
f7deaa1a | 84 | { |
85 | CUPS_SC_STATUS_NONE, /* No status */ | |
86 | CUPS_SC_STATUS_OK, /* Operation succeeded */ | |
87 | CUPS_SC_STATUS_IO_ERROR, /* An I/O error occurred */ | |
88 | CUPS_SC_STATUS_TIMEOUT, /* The backend did not respond */ | |
89 | CUPS_SC_STATUS_NO_RESPONSE, /* The device did not respond */ | |
90 | CUPS_SC_STATUS_BAD_MESSAGE, /* The command/response message was invalid */ | |
91 | CUPS_SC_STATUS_TOO_BIG, /* Response too big */ | |
92 | CUPS_SC_STATUS_NOT_IMPLEMENTED /* Command not implemented */ | |
5a738aea MS |
93 | }; |
94 | typedef enum cups_sc_status_e cups_sc_status_t; | |
95 | /**** Response status codes ****/ | |
f7deaa1a | 96 | |
20fbc903 MS |
97 | typedef void (*cups_sc_walk_func_t)(const char *oid, const char *data, |
98 | int datalen, void *context); | |
99 | /**** SNMP walk callback ****/ | |
100 | ||
f7deaa1a | 101 | |
102 | /* | |
103 | * Prototypes... | |
104 | */ | |
105 | ||
106 | extern cups_sc_status_t cupsSideChannelDoRequest(cups_sc_command_t command, | |
107 | char *data, int *datalen, | |
2fb76298 | 108 | double timeout) _CUPS_API_1_3; |
f7deaa1a | 109 | extern int cupsSideChannelRead(cups_sc_command_t *command, |
110 | cups_sc_status_t *status, | |
111 | char *data, int *datalen, | |
2fb76298 | 112 | double timeout) _CUPS_API_1_3; |
f7deaa1a | 113 | extern int cupsSideChannelWrite(cups_sc_command_t command, |
114 | cups_sc_status_t status, | |
115 | const char *data, int datalen, | |
2fb76298 | 116 | double timeout) _CUPS_API_1_3; |
f7deaa1a | 117 | |
20fbc903 MS |
118 | /**** New in CUPS 1.4 ****/ |
119 | extern cups_sc_status_t cupsSideChannelSNMPGet(const char *oid, char *data, | |
120 | int *datalen, double timeout) | |
121 | _CUPS_API_1_4; | |
122 | extern cups_sc_status_t cupsSideChannelSNMPWalk(const char *oid, double timeout, | |
123 | cups_sc_walk_func_t cb, | |
124 | void *context) _CUPS_API_1_4; | |
125 | ||
f7deaa1a | 126 | |
127 | # ifdef __cplusplus | |
128 | } | |
129 | # endif /* __cplusplus */ | |
130 | ||
131 | #endif /* !_CUPS_SIDECHANNEL_H_ */ | |
132 | ||
133 | /* | |
75bd9771 | 134 | * End of "$Id: sidechannel.h 7616 2008-05-28 00:34:13Z mike $". |
f7deaa1a | 135 | */ |