/vp_plugins/sptsd/cups/sidechannel.h

http://cupsfilter.googlecode.com/ · C Header · 135 lines · 71 code · 24 blank · 40 comment · 0 complexity · c283596f65741dec2fd821e4ecdaa98c MD5 · raw file

  1. /*
  2. * "$Id: sidechannel.h 8627 2009-05-13 21:39:17Z mike $"
  3. *
  4. * Side-channel API definitions for the Common UNIX Printing System (CUPS).
  5. *
  6. * Copyright 2007-2008 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. #ifndef _CUPS_SIDECHANNEL_H_
  18. # define _CUPS_SIDECHANNEL_H_
  19. /*
  20. * Include necessary headers...
  21. */
  22. # include "versioning.h"
  23. /*
  24. * C++ magic...
  25. */
  26. # ifdef __cplusplus
  27. extern "C" {
  28. # endif /* __cplusplus */
  29. /*
  30. * Constants...
  31. */
  32. #define CUPS_SC_FD 4 /* File descriptor for select/poll */
  33. /*
  34. * Enumerations...
  35. */
  36. enum cups_sc_bidi_e /**** Bidirectional capability values ****/
  37. {
  38. CUPS_SC_BIDI_NOT_SUPPORTED = 0, /* Bidirectional I/O is not supported */
  39. CUPS_SC_BIDI_SUPPORTED = 1 /* Bidirectional I/O is supported */
  40. };
  41. typedef enum cups_sc_bidi_e cups_sc_bidi_t;
  42. /**** Bidirectional capabilities ****/
  43. enum cups_sc_command_e /**** Request command codes ****/
  44. {
  45. CUPS_SC_CMD_SOFT_RESET = 1, /* Do a soft reset */
  46. CUPS_SC_CMD_DRAIN_OUTPUT = 2, /* Drain all pending output */
  47. CUPS_SC_CMD_GET_BIDI = 3, /* Return bidirectional capabilities */
  48. CUPS_SC_CMD_GET_DEVICE_ID = 4, /* Return the IEEE-1284 device ID */
  49. CUPS_SC_CMD_GET_STATE = 5, /* Return the device state */
  50. CUPS_SC_CMD_SNMP_GET = 6, /* Query an SNMP OID @since CUPS 1.4/Mac OS X 10.6@ */
  51. CUPS_SC_CMD_SNMP_GET_NEXT = 7 /* Query the next SNMP OID @since CUPS 1.4/Mac OS X 10.6@ */
  52. };
  53. typedef enum cups_sc_command_e cups_sc_command_t;
  54. /**** Request command codes ****/
  55. enum cups_sc_state_e /**** Printer state bits ****/
  56. {
  57. CUPS_SC_STATE_OFFLINE = 0, /* Device is offline */
  58. CUPS_SC_STATE_ONLINE = 1, /* Device is online */
  59. CUPS_SC_STATE_BUSY = 2, /* Device is busy */
  60. CUPS_SC_STATE_ERROR = 4, /* Other error condition */
  61. CUPS_SC_STATE_MEDIA_LOW = 16, /* Paper low condition */
  62. CUPS_SC_STATE_MEDIA_EMPTY = 32, /* Paper out condition */
  63. CUPS_SC_STATE_MARKER_LOW = 64, /* Toner/ink low condition */
  64. CUPS_SC_STATE_MARKER_EMPTY = 128 /* Toner/ink out condition */
  65. };
  66. typedef enum cups_sc_state_e cups_sc_state_t;
  67. /**** Printer state bits ****/
  68. enum cups_sc_status_e /**** 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. };
  79. typedef enum cups_sc_status_e cups_sc_status_t;
  80. /**** Response status codes ****/
  81. typedef void (*cups_sc_walk_func_t)(const char *oid, const char *data,
  82. int datalen, void *context);
  83. /**** SNMP walk callback ****/
  84. /*
  85. * Prototypes...
  86. */
  87. extern cups_sc_status_t cupsSideChannelDoRequest(cups_sc_command_t command,
  88. char *data, int *datalen,
  89. double timeout) _CUPS_API_1_3;
  90. extern int cupsSideChannelRead(cups_sc_command_t *command,
  91. cups_sc_status_t *status,
  92. char *data, int *datalen,
  93. double timeout) _CUPS_API_1_3;
  94. extern int cupsSideChannelWrite(cups_sc_command_t command,
  95. cups_sc_status_t status,
  96. const char *data, int datalen,
  97. double timeout) _CUPS_API_1_3;
  98. /**** New in CUPS 1.4 ****/
  99. extern cups_sc_status_t cupsSideChannelSNMPGet(const char *oid, char *data,
  100. int *datalen, double timeout)
  101. _CUPS_API_1_4;
  102. extern cups_sc_status_t cupsSideChannelSNMPWalk(const char *oid, double timeout,
  103. cups_sc_walk_func_t cb,
  104. void *context) _CUPS_API_1_4;
  105. # ifdef __cplusplus
  106. }
  107. # endif /* __cplusplus */
  108. #endif /* !_CUPS_SIDECHANNEL_H_ */
  109. /*
  110. * End of "$Id: sidechannel.h 8627 2009-05-13 21:39:17Z mike $".
  111. */