1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
3 <!-- SECTION: Programming -->
5 <title>Filter and Backend Programming
</title>
6 <meta name=
"keywords" content=
"Programming">
7 <meta name=
"creator" content=
"Mini-XML v2.5">
8 <style type=
"text/css"><!--
10 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
13 H1, H2, H3, H4, H5, H6, P, TD, TH {
14 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
18 font-family: monaco, courier, monospace;
23 font-family: monaco, courier, monospace;
32 border: dotted thin #999999;
37 PRE.command EM, PRE.example EM {
38 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
42 font-family: monaco, courier, monospace;
53 border: solid thin #999999;
59 text-decoration: none;
62 A:link:hover, A:visited:hover, A:active {
63 text-decoration: underline;
71 border: solid thin #999999;
72 border-collapse: collapse;
88 border: solid thin #cccccc;
95 border-bottom: solid thin #999999;
104 caption-side: bottom;
124 border: thin solid #000000;
132 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
138 border-bottom: solid 2pt #000000;
156 font-family: monaco, courier, monospace;
165 border: solid thin #999999;
166 border-collapse: collapse;
171 DIV.summary TABLE TD, DIV.summary TABLE TH {
172 border: solid thin #999999;
178 DIV.summary TABLE THEAD TH {
182 /* API documentation styles... */
189 div.body h3, div.body h4, div.body h5 {
190 margin-bottom: 0.5em;
193 .class, .enumeration, .function, .struct, .typedef, .union {
194 border-bottom: solid thin #999999;
201 code, p.code, pre, ul.code li {
202 font-family: monaco, courier, monospace;
205 ul.code, ul.contents, ul.subcontents {
206 list-style-type: none;
216 ul.contents li ul.code, ul.contents li ul.subcontents {
229 margin-bottom: 0.5em;
232 /* This is just for the HTML files generated with the framedhelp target */
235 border: solid thin black;
244 div.contents ul.contents {
247 div.contents ul.subcontents li {
256 "$Id: api-filter.header 7285 2008-02-01 23:57:39Z mike $"
258 Filter and backend programming header for the Common UNIX Printing System
261 Copyright 2008 by Apple Inc.
263 These coded instructions, statements, and computer programs are the
264 property of Apple Inc. and are protected by Federal copyright
265 law. Distribution and use rights are outlined in the file "LICENSE.txt"
266 which should have been included with this file. If this file is
267 file is missing or damaged, see the license at "http://www.cups.org/".
270 <h1 class=
"title">Filter and Backend Programming
</h1>
272 <div class='summary'
><table summary='General Information'
>
276 <th>cups/backend.h
<br>
277 cups/sidechannel.h
<br>
288 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
289 Programming:
<a href='api-cups.html' target='_top'
>CUPS API
</a><br>
290 Programming:
<a href='api-ppd.html' target='_top'
>PPD API
</a><br>
291 Programming:
<a href='api-raster.html' target='_top'
>Raster API
</a></td>
295 <h2 class=
"title">Contents
</h2>
296 <ul class=
"contents">
298 <li><a href=
"#OVERVIEW">Overview
</a><ul class=
"subcontents">
299 <li><a href=
"#SECURITY">Security Considerations
</a></li>
300 <li><a href=
"#TEMPFILES">Temporary Files
</a></li>
301 <li><a href=
"#COPIES">Copy Generation
</a></li>
302 <li><a href=
"#EXITCODES">Exit Codes
</a></li>
303 <li><a href=
"#ENVIRONMENT">Environment Variables
</a></li>
304 <li><a href=
"#MESSAGES">Communicating with the Scheduler
</a></li>
305 <li><a href=
"#COMMUNICATING">Communicating with the Backend
</a></li>
306 <li><a href=
"#SNMP">Doing SNMP Queries with Network Printers
</a></li>
308 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
309 <li><a href=
"#cupsBackChannelRead" title=
"Read data from the backchannel.">cupsBackChannelRead
</a></li>
310 <li><a href=
"#cupsBackChannelWrite" title=
"Write data to the backchannel.">cupsBackChannelWrite
</a></li>
311 <li><a href=
"#cupsBackendDeviceURI" title=
"Get the device URI for a backend.">cupsBackendDeviceURI
</a></li>
312 <li><a href=
"#cupsSNMPClose" title=
"Close a SNMP socket.">cupsSNMPClose
</a></li>
313 <li><a href=
"#cupsSNMPCopyOID" title=
"Copy an OID.">cupsSNMPCopyOID
</a></li>
314 <li><a href=
"#cupsSNMPDefaultCommunity" title=
"Get the default SNMP community name.">cupsSNMPDefaultCommunity
</a></li>
315 <li><a href=
"#cupsSNMPIsOID" title=
"Test whether a SNMP response contains the specified OID.">cupsSNMPIsOID
</a></li>
316 <li><a href=
"#cupsSNMPIsOIDPrefixed" title=
"Test whether a SNMP response uses the specified
317 OID prefix.">cupsSNMPIsOIDPrefixed
</a></li>
318 <li><a href=
"#cupsSNMPOpen" title=
"Open a SNMP socket.">cupsSNMPOpen
</a></li>
319 <li><a href=
"#cupsSNMPRead" title=
"Read and parse a SNMP response.">cupsSNMPRead
</a></li>
320 <li><a href=
"#cupsSNMPSetDebug" title=
"Enable/disable debug logging to stderr.">cupsSNMPSetDebug
</a></li>
321 <li><a href=
"#cupsSNMPWalk" title=
"Enumerate a group of OIDs.">cupsSNMPWalk
</a></li>
322 <li><a href=
"#cupsSNMPWrite" title=
"Send an SNMP query packet.">cupsSNMPWrite
</a></li>
323 <li><a href=
"#cupsSideChannelDoRequest" title=
"Send a side-channel command to a backend and wait for a response.">cupsSideChannelDoRequest
</a></li>
324 <li><a href=
"#cupsSideChannelRead" title=
"Read a side-channel message.">cupsSideChannelRead
</a></li>
325 <li><a href=
"#cupsSideChannelWrite" title=
"Write a side-channel message.">cupsSideChannelWrite
</a></li>
327 <li><a href=
"#TYPES">Data Types
</a><ul class=
"code">
328 <li><a href=
"#cups_asn1_t" title=
"ASN1 request/object types">cups_asn1_t
</a></li>
329 <li><a href=
"#cups_backend_t" title=
"Backend exit codes">cups_backend_t
</a></li>
330 <li><a href=
"#cups_sc_bidi_t" title=
"Bidirectional capabilities">cups_sc_bidi_t
</a></li>
331 <li><a href=
"#cups_sc_command_t" title=
"Request command codes">cups_sc_command_t
</a></li>
332 <li><a href=
"#cups_sc_state_t" title=
"Printer state bits">cups_sc_state_t
</a></li>
333 <li><a href=
"#cups_sc_status_t" title=
"Response status codes">cups_sc_status_t
</a></li>
334 <li><a href=
"#cups_snmp_cb_t" title=
"Prototypes...">cups_snmp_cb_t
</a></li>
335 <li><a href=
"#cups_snmp_t" title=
"SNMP data packet">cups_snmp_t
</a></li>
337 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
338 <li><a href=
"#cups_snmp_hexstring_s" title=
"Hex-STRING value">cups_snmp_hexstring_s
</a></li>
339 <li><a href=
"#cups_snmp_s" title=
"SNMP data packet">cups_snmp_s
</a></li>
341 <li><a href=
"#UNIONS">Unions
</a><ul class=
"code">
342 <li><a href=
"#cups_snmp_value_u" title=
"Object value">cups_snmp_value_u
</a></li>
344 <li><a href=
"#ENUMERATIONS">Constants
</a><ul class=
"code">
345 <li><a href=
"#cups_asn1_e" title=
"ASN1 request/object types">cups_asn1_e
</a></li>
346 <li><a href=
"#cups_backend_e" title=
"Backend exit codes">cups_backend_e
</a></li>
347 <li><a href=
"#cups_sc_bidi_e" title=
"Bidirectional capabilities">cups_sc_bidi_e
</a></li>
348 <li><a href=
"#cups_sc_command_e" title=
"Request command codes">cups_sc_command_e
</a></li>
349 <li><a href=
"#cups_sc_state_e" title=
"Printer state bits">cups_sc_state_e
</a></li>
350 <li><a href=
"#cups_sc_status_e" title=
"Response status codes">cups_sc_status_e
</a></li>
354 "$Id: api-filter.shtml 7288 2008-02-06 01:39:05Z mike $"
356 Filter and backend programming introduction for the Common UNIX Printing
359 Copyright 2007-2008 by Apple Inc.
360 Copyright 1997-2006 by Easy Software Products, all rights reserved.
362 These coded instructions, statements, and computer programs are the
363 property of Apple Inc. and are protected by Federal copyright
364 law. Distribution and use rights are outlined in the file "LICENSE.txt"
365 which should have been included with this file. If this file is
366 file is missing or damaged, see the license at "http://www.cups.org/".
369 <h2 class='title'
><a name=
"OVERVIEW">Overview
</a></h2>
371 <p>Filters, printer drivers, port monitors, and backends use a common interface
372 for processing print jobs and communicating status information to the scheduler.
373 Each filter is run with a standard set of command-line arguments:
<p>
381 <dd>The user printing the job
</dd>
384 <dd>The job name/title
</dd>
387 <dd>The number of copies to print
</dd>
390 <dd>The options that were provided when the job was submitted
</dd>
393 <dd>The file to print (first filter only)
</dd>
396 <p>The scheduler runs one or more of these programs to print any given job. The
397 first filter reads from the print file and writes to the standard output, while
398 the remaining filters read from the standard input and write to the standard
399 output. The backend is the last filter in the chain and writes to the
402 <h3><a name=
"SECURITY">Security Considerations
</a></h3>
404 <p>It is always important to use security programming practices. Filters and
405 most backends are run as a non-priviledged user, so the major security
406 consideration is resource utilization - filters should not depend on unlimited
407 amounts of CPU, memory, or disk space, and should protect against conditions
408 that could lead to excess usage of any resource like infinite loops and
409 unbounded recursion. In addition, filters must
<em>never
</em> allow the user to
410 specify an arbitrary file path to a separator page, template, or other file
411 used by the filter since that can lead to an unauthorized disclosure of
412 information.
<em>Always
</em> treat input as suspect and validate it!
</p>
414 <p>If you are developing a backend that runs as root, make sure to check for
415 potential buffer overflows, integer under/overflow conditions, and file
416 accesses since these can lead to privilege escalations. When writing files,
417 always validate the file path and
<em>never
</em> allow a user to determine
418 where to store a file.
</p>
420 <blockquote><b>Note:
</b>
422 <p><em>Never
</em> write files to a user's home directory. Aside from the
423 security implications, CUPS is a network print service and as such the network
424 user may not be the same as the local user and/or there may not be a local home
425 directory to write to.
</p>
427 <p>In addition, some operating systems provide additional security mechanisms
428 that further limit file system access, even for backends running as root. On
429 Mac OS X, for example, no backend may write to a user's home directory.
</p>
432 <h3><a name=
"TEMPFILES">Temporary Files
</a></h3>
434 <p>Temporary files should be created in the directory specified by the
435 "TMPDIR" environment variable. The
436 <a href=
"#cupsTempFile2"><code>cupsTempFile2
</code></a> function can be
437 used to safely create temporary files in this directory.
</p>
439 <h3><a name=
"COPIES">Copy Generation
</a></h3>
441 <p>The
<code>argv[
4]
</code> argument specifies the number of copies to produce
442 of the input file. In general, you should only generate copies if the
443 <em>filename
</em> argument is supplied. The only exception to this are
444 filters that produce device-independent PostScript output, since the PostScript
445 filter
<var>pstops
</var> is responsible for generating copies of PostScript
448 <h3><a name=
"EXITCODES">Exit Codes
</a></h3>
450 <p>Filters must exit with status
0 when they successfully generate print data
451 or
1 when they encounter an error. Backends can return any of the
452 <a href=
"#cups_backend_t"><code>cups_backend_t
</code></a> constants.
</p>
454 <h3><a name=
"ENVIRONMENT">Environment Variables
</a></h3>
456 <p>The following environment variables are defined by the printing system:
</p>
460 <dt>APPLE_LANGUAGES
</dt>
461 <dd>The Apple language identifier associated with the job
462 (Mac OS X only).
</dd>
465 <dd>The job character set, typically
"utf-8".
</dd>
468 <dd>When a job is submitted to a printer class, contains the name of
469 the destination printer class. Otherwise this environment
470 variable will not be set.
</dd>
472 <dt>CONTENT_TYPE
</dt>
473 <dd>The MIME type associated with the file (e.g.
474 application/postscript).
</dd>
476 <dt>CUPS_CACHEDIR
</dt>
477 <dd>The directory where cache files can be stored.
</dd>
479 <dt>CUPS_DATADIR
</dt>
480 <dd>The directory where data files can be found.
</dd>
482 <dt>CUPS_SERVERROOT
</dt>
483 <dd>The root directory of the server.
</dd>
486 <dd>The device-uri associated with the printer.
</dd>
488 <dt>FINAL_CONTENT_TYPE
</dt>
489 <dd>The MIME type associated with the printer (e.g.
490 application/vnd.cups-postscript).
</dd>
493 <dd>The language locale associated with the job.
</dd>
496 <dd>The full pathname of the PostScript Printer Description (PPD)
497 file for this printer.
</dd>
500 <dd>The name of the printer.
</dd>
503 <dd>The recommended amount of memory to use for Raster Image
504 Processors (RIPs).
</dd>
508 <h3><a name=
"MESSAGES">Communicating with the Scheduler
</a></h3>
510 <p>Filters and backends communicate wih the scheduler by writing messages
511 to the standard error file. For example, the following code sets the current
512 printer state message to
"Printing page 5":
</p>
514 <pre class=
"example">
517 fprintf(stderr,
"INFO: Printing page %d\n", page);
520 <p>Each message is a single line of text starting with one of the following
525 <dt>ALERT: message
</dt>
526 <dd>Sets the printer-state-message attribute and adds the specified
527 message to the current error log file using the
"alert" log level.
</dd>
529 <dt>ATTR: attribute=value [attribute=value]
</dt>
530 <dd>Sets the named printer or job attribute(s). Typically this is used
531 to set the
<code>marker-colors
</code>,
<code>marker-levels
</code>,
532 <code>marker-names
</code>,
<code>marker-types
</code>,
533 <code>printer-alert
</code>, and
<code>printer-alert-description
</code>
534 printer attributes.
</dd>
536 <dt>CRIT: message
</dt>
537 <dd>Sets the printer-state-message attribute and adds the specified
538 message to the current error log file using the
"critical" log
541 <dt>DEBUG: message
</dt>
542 <dd>Sets the printer-state-message attribute and adds the specified
543 message to the current error log file using the
"debug" log level.
</dd>
545 <dt>DEBUG2: message
</dt>
546 <dd>Sets the printer-state-message attribute and adds the specified
547 message to the current error log file using the
"debug2" log level.
</dd>
549 <dt>EMERG: message
</dt>
550 <dd>Sets the printer-state-message attribute and adds the specified
551 message to the current error log file using the
"emergency" log
554 <dt>ERROR: message
</dt>
555 <dd>Sets the printer-state-message attribute and adds the specified
556 message to the current error log file using the
"error" log level.
</dd>
558 <dt>INFO: message
</dt>
559 <dd>Sets the printer-state-message attribute. If the current log level
560 is set to
"debug2", also adds the specified message to the current error
561 log file using the
"info" log level.
</dd>
563 <dt>NOTICE: message
</dt>
564 <dd>Sets the printer-state-message attribute and adds the specified
565 message to the current error log file using the
"notice" log level.
</dd>
567 <dt>PAGE: page-number #-copies
</dt>
568 <dt>PAGE: total #-pages
</dt>
569 <dd>Adds an entry to the current page log file. The first form adds
570 #-copies to the job-media-sheets-completed attribute. The second
571 form sets the job-media-sheets-completed attribute to #-pages.
</dd>
573 <dt>STATE: printer-state-reason [printer-state-reason ...]
</dt>
574 <dt>STATE: + printer-state-reason [printer-state-reason ...]
</dt>
575 <dt>STATE: - printer-state-reason [printer-state-reason ...]
</dt>
576 <dd>Sets, adds, or removes printer-state-reason keywords to the
577 current queue. Typically this is used to indicate media, ink, and
578 toner conditions on a printer.
</dd>
580 <dt>WARNING: message
</dt>
581 <dd>Sets the printer-state-message attribute and adds the specified
582 message to the current error log file using the
"warning" log
587 <p>Messages without one of these prefixes are treated as if they began with
588 the
"DEBUG:" prefix string.
</p>
590 <h3><a name=
"COMMUNICATING">Communicating with the Backend
</a></h3>
592 <p>Filters can communicate with the backend via the
593 <a href=
"#cupsBackChannelRead"><code>cupsBackChannelRead
</code></a> and
594 <a href=
"#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest
</code></a>
596 <a href=
"#cupsBackChannelRead"><code>cupsBackChannelRead
</code></a> function
597 reads data that has been sent back from the device and is typically used to
598 obtain status and configuration information. For example, the following code
599 polls the backend for back-channel data:
</p>
601 <pre class=
"example">
602 #include
<cups/cups.h
>
607 /* Use a timeout of
0.0 seconds to poll for back-channel data */
608 bytes = cupsBackChannelRead(buffer, sizeof(buffer),
0.0);
612 <a href=
"#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest
</code></a>
613 function allows you to get out-of-band status information and do synchronization
614 with the device. For example, the following code gets the current IEEE-
1284
615 device ID string from the backend:
</p>
617 <pre class=
"example">
618 #include
<cups/sidechannel.h
>
622 <a href=
"#cups_sc_status_t">cups_sc_status_t
</a> status;
624 /* Tell cupsSideChannelDoRequest() how big our buffer is, less
1 byte for nul-termination... */
625 datalen = sizeof(data) -
1;
627 /* Get the IEEE-
1284 device ID, waiting for up to
1 second */
628 status =
<a href=
"#cupsSideChannelDoRequest">cupsSideChannelDoRequest
</a>(CUPS_SC_CMD_GET_DEVICE_ID, data,
&datalen,
1.0);
630 /* Use the returned value if OK was returned and the length is non-zero */
631 if (status == CUPS_SC_STATUS_OK && datalen
> 0)
632 data[datalen] = '\
0';
637 <p>Backends communicate with filters using the reciprocal functions
638 <a href=
"#cupsBackChannelWrite"><code>cupsBackChannelWrite
</code></a>,
639 <a href=
"#cupsSideChannelRead"><code>cupsSideChannelRead
</code></a>, and
640 <a href=
"#cupsSideChannelWrite"><code>cupsSideChannelWrite
</code></a>. We
641 recommend writing back-channel data using a timeout of
1.0 seconds:
</p>
643 <pre class=
"example">
644 #include
<cups/cups.h
>
649 /* Use a timeout of
1.0 seconds to give filters a chance to read */
650 cupsBackChannelWrite(buffer, bytes,
1.0);
653 <p>The
<a href=
"#cupsSideChannelRead"><code>cupsSideChannelRead
</code></a>
654 function reads a side-channel command from a filter, driver, or port monitor.
655 Backends can either poll for commands using a
<code>timeout
</code> of
0.0, wait
656 indefinitely for commands using a
<code>timeout
</code> of -
1.0 (probably in a
657 separate thread for that purpose), or use
<code>select
</code> or
658 <code>poll
</code> on the
<code>CUPS_SC_FD
</code> file descriptor (
4) to handle
659 input and output on several file descriptors at the same time. Backends can pass
660 <code>NULL
</code> for the
<code>data
</code> and
<code>datalen
</code> parameters
661 since none of the commands sent by upstream filters contain any data at this
664 <p>Once a command is processed, the backend uses the
665 <a href=
"#cupsSideChannelWrite"><code>cupsSideChannelWrite
</code></a> function
666 to send its response. For example, the following code shows how to poll for a
667 side-channel command and respond to it:
</p>
669 <pre class=
"example">
670 #include
<cups/sidechannel.h
>
672 <a href=
"#cups_sc_command_t">cups_sc_command_t
</a> command;
673 <a href=
"#cups_sc_status_t">cups_sc_status_t
</a> status;
675 /* Poll for a command... */
676 if (!
<a href=
"#cupsSideChannelRead">cupsSideChannelRead
</a>(
&command,
&status, NULL, NULL,
0.0))
683 /* handle supported commands, file data/datalen/status with values as needed */
686 status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
691 /* Send a response... */
692 <a href=
"#cupsSideChannelWrite">cupsSideChannelWrite
</a>(command, status, data, datalen,
1.0);
696 <h3><a name=
"SNMP">Doing SNMP Queries with Network Printers
</a></h3>
698 <p>The Simple Network Management Protocol (SNMP) allows you to get the current
699 status, page counter, and supply levels from most network printers. Every
700 piece of information is associated with an Object Identifier (OID), and
701 every printer has a
<em>community
</em> name associated with it. OIDs can be
702 queried directly or by
"walking" over a range of OIDs with a common prefix.
</p>
704 <p>The CUPS SNMP functions provide a simple API for querying network printers.
705 Queries are made using a datagram socket that is created using
706 <a href=
"#cupsSNMPOpen"><code>cupsSNMPOpen
</code></a> and destroyed using
707 <a href=
"#cupsSNMPClose"><code>cupsSNMPClose
</code></a>:
</p>
709 <pre class=
"example">
710 #include
<cups/snmp.h
>
712 int snmp =
<a href=
"#cupsSNMPOpen">cupsSNMPOpen
</a>(AF_INET);
714 /* do some queries */
716 <a href=
"#cupsSNMPClose">cupsSNMPClose
</a>(snmp);
719 <p>OIDs are simple C arrays of integers, terminated by a value of -
1. For
720 example, the page counter OID
.1.3.6.1.2.1.43.10.2.1.4.1.1 would be:
</p>
722 <pre class=
"example">
723 int page_counter_oid[] = {
1,
3,
6,
1,
2,
1,
43,
10,
2,
1,
4,
1,
1, -
1 };
726 <p>You send a query using
727 <a href=
"#cupsSNMPWrite"><code>cupsSNMPWrite
</code></a> and read the value back
728 using
<a href=
"#cupsSNMPRead"><code>cupsSNMPRead
</code></a>. The value is read
729 into a structure called
<a href=
"#cups_snmp_t"><code>cups_snmp_t
</code></a>:
</p>
731 <pre class=
"example">
732 #include
<cups/snmp.h
>
734 int page_counter_oid[] = {
1,
3,
6,
1,
2,
1,
43,
10,
2,
1,
4,
1,
1, -
1 };
735 http_addrlist_t *host = httpAddrGetList(
"myprinter", AF_UNSPEC,
"161");
736 int snmp =
<a href=
"#cupsSNMPOpen">cupsSNMPOpen
</a>(host-
>addr.addr.sa_family);
737 <a href=
"#cups_snmp_t">cups_snmp_t
</a> packet;
739 <a href=
"#cupsSNMPWrite">cupsSNMPWrite
</a>(snmp,
&(host-
>addr), CUPS_SNMP_VERSION_1,
740 <a href=
"#cupsSNMPDefaultCommunity">cupsSNMPDefaultCommunity
</a>(), CUPS_ASN1_GET_REQUEST,
1,
742 if (
<a href=
"#cupsSNMPRead">cupsSNMPRead
</a>(snmp,
&packet,
5000))
744 /* Do something with the value */
745 printf(
"Page counter is: %d\n", packet.object_value.integer);
749 <p>The
<a href=
"#cupsSNMPWalk"><code>cupsSNMPWalk
</code></a> function allows you
750 to query a whole group of OIDs, calling a function of your choice for each OID
753 <pre class=
"example">
754 #include
<cups/snmp.h
>
757 my_callback(
<a href=
"#cups_snmp_t">cups_snmp_t
</a> *packet, void *data)
759 /* Do something with the value */
762 int printer_mib_oid[] = {
1,
3,
6,
1,
2,
1,
43, -
1 };
763 http_addrlist_t *host = httpAddrGetList(
"myprinter", AF_UNSPEC,
"161");
764 int snmp =
<a href=
"#cupsSNMPOpen">cupsSNMPOpen
</a>(host-
>addr.addr.sa_family);
767 <a href=
"#cupsSNMPWalk">cupsSNMPWalk
</a>(snmp,
&(host-
>addr), CUPS_SNMP_VERSION_1,
768 <a href=
"#cupsSNMPDefaultCommunity">cupsSNMPDefaultCommunity
</a>(), printer_mib_oid, my_callback, my_data);
770 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
771 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsBackChannelRead">cupsBackChannelRead
</a></h3>
772 <p class=
"description">Read data from the backchannel.
</p>
774 ssize_t cupsBackChannelRead (
<br>
775 char *buffer,
<br>
776 size_t bytes,
<br>
777 double timeout
<br>
779 <h4 class=
"parameters">Parameters
</h4>
782 <dd class=
"description">Buffer to read
</dd>
784 <dd class=
"description">Bytes to read
</dd>
786 <dd class=
"description">Timeout in seconds
</dd>
788 <h4 class=
"returnvalue">Return Value
</h4>
789 <p class=
"description">Bytes read or -
1 on error
</p>
790 <h4 class=
"discussion">Discussion
</h4>
791 <p class=
"discussion">Reads up to
"bytes
" bytes from the backchannel. The
"timeout
"
792 parameter controls how many seconds to wait for the data - use
793 0.0 to return immediately if there is no data, -
1.0 to wait
794 for data indefinitely.
797 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsBackChannelWrite">cupsBackChannelWrite
</a></h3>
798 <p class=
"description">Write data to the backchannel.
</p>
800 ssize_t cupsBackChannelWrite (
<br>
801 const char *buffer,
<br>
802 size_t bytes,
<br>
803 double timeout
<br>
805 <h4 class=
"parameters">Parameters
</h4>
808 <dd class=
"description">Buffer to write
</dd>
810 <dd class=
"description">Bytes to write
</dd>
812 <dd class=
"description">Timeout in seconds
</dd>
814 <h4 class=
"returnvalue">Return Value
</h4>
815 <p class=
"description">Bytes written or -
1 on error
</p>
816 <h4 class=
"discussion">Discussion
</h4>
817 <p class=
"discussion">Writes
"bytes
" bytes to the backchannel. The
"timeout
" parameter
818 controls how many seconds to wait for the data to be written - use
819 0.0 to return immediately if the data cannot be written, -
1.0 to wait
823 <h3 class=
"function"><a name=
"cupsBackendDeviceURI">cupsBackendDeviceURI
</a></h3>
824 <p class=
"description">Get the device URI for a backend.
</p>
826 const char *cupsBackendDeviceURI (
<br>
827 char **argv
<br>
829 <h4 class=
"parameters">Parameters
</h4>
832 <dd class=
"description">Command-line arguments
</dd>
834 <h4 class=
"returnvalue">Return Value
</h4>
835 <p class=
"description">Device URI or
<code>NULL
</code></p>
836 <h4 class=
"discussion">Discussion
</h4>
837 <p class=
"discussion">The
"argv
" argument is the argv argument passed to main(). This
838 function returns the device URI passed in the DEVICE_URI environment
839 variable or the device URI passed in argv[
0], whichever is found
841 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPClose">cupsSNMPClose
</a></h3>
842 <p class=
"description">Close a SNMP socket.
</p>
844 void cupsSNMPClose (
<br>
845 int fd
<br>
847 <h4 class=
"parameters">Parameters
</h4>
850 <dd class=
"description">SNMP socket file descriptor
</dd>
852 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPCopyOID">cupsSNMPCopyOID
</a></h3>
853 <p class=
"description">Copy an OID.
</p>
855 int *cupsSNMPCopyOID (
<br>
856 int *dst,
<br>
857 const int *src,
<br>
858 int dstsize
<br>
860 <h4 class=
"parameters">Parameters
</h4>
863 <dd class=
"description">Destination OID
</dd>
865 <dd class=
"description">Source OID
</dd>
867 <dd class=
"description">Number of integers in dst
</dd>
869 <h4 class=
"returnvalue">Return Value
</h4>
870 <p class=
"description">New OID
</p>
871 <h4 class=
"discussion">Discussion
</h4>
872 <p class=
"discussion">The array pointed to by
"src
" is terminated by the value -
1.
875 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPDefaultCommunity">cupsSNMPDefaultCommunity
</a></h3>
876 <p class=
"description">Get the default SNMP community name.
</p>
878 const char *cupsSNMPDefaultCommunity (void);
</p>
879 <h4 class=
"returnvalue">Return Value
</h4>
880 <p class=
"description">Default community name
</p>
881 <h4 class=
"discussion">Discussion
</h4>
882 <p class=
"discussion">The default community name is the first community name found in the
883 snmp.conf file. If no community name is defined there,
"public
" is used.
886 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPIsOID">cupsSNMPIsOID
</a></h3>
887 <p class=
"description">Test whether a SNMP response contains the specified OID.
</p>
889 int cupsSNMPIsOID (
<br>
890 <a href=
"#cups_snmp_t">cups_snmp_t
</a> *packet,
<br>
891 const int *oid
<br>
893 <h4 class=
"parameters">Parameters
</h4>
896 <dd class=
"description">Response packet
</dd>
898 <dd class=
"description">OID
</dd>
900 <h4 class=
"returnvalue">Return Value
</h4>
901 <p class=
"description">1 if equal,
0 if not equal
</p>
902 <h4 class=
"discussion">Discussion
</h4>
903 <p class=
"discussion">The array pointed to by
"oid
" is terminated by the value -
1.
906 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPIsOIDPrefixed">cupsSNMPIsOIDPrefixed
</a></h3>
907 <p class=
"description">Test whether a SNMP response uses the specified
910 int cupsSNMPIsOIDPrefixed (
<br>
911 <a href=
"#cups_snmp_t">cups_snmp_t
</a> *packet,
<br>
912 const int *prefix
<br>
914 <h4 class=
"parameters">Parameters
</h4>
917 <dd class=
"description">Response packet
</dd>
919 <dd class=
"description">OID prefix
</dd>
921 <h4 class=
"returnvalue">Return Value
</h4>
922 <p class=
"description">1 if prefixed,
0 if not prefixed
</p>
923 <h4 class=
"discussion">Discussion
</h4>
924 <p class=
"discussion">The array pointed to by
"prefix
" is terminated by the value -
1.
927 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPOpen">cupsSNMPOpen
</a></h3>
928 <p class=
"description">Open a SNMP socket.
</p>
930 int cupsSNMPOpen (
<br>
931 int family
<br>
933 <h4 class=
"parameters">Parameters
</h4>
936 <dd class=
"description">Address family -
<code>AF_INET
</code> or
<code>AF_INET6
</code></dd>
938 <h4 class=
"returnvalue">Return Value
</h4>
939 <p class=
"description">SNMP socket file descriptor
</p>
940 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPRead">cupsSNMPRead
</a></h3>
941 <p class=
"description">Read and parse a SNMP response.
</p>
943 <a href=
"#cups_snmp_t">cups_snmp_t
</a> *cupsSNMPRead (
<br>
944 int fd,
<br>
945 <a href=
"#cups_snmp_t">cups_snmp_t
</a> *packet,
<br>
946 double timeout
<br>
948 <h4 class=
"parameters">Parameters
</h4>
951 <dd class=
"description">SNMP socket file descriptor
</dd>
953 <dd class=
"description">SNMP packet buffer
</dd>
955 <dd class=
"description">Timeout in seconds
</dd>
957 <h4 class=
"returnvalue">Return Value
</h4>
958 <p class=
"description">SNMP packet or
<code>NULL
</code> if none
</p>
959 <h4 class=
"discussion">Discussion
</h4>
960 <p class=
"discussion">If
"timeout
" is negative,
<code>cupsSNMPRead
</code> will wait for a response
964 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPSetDebug">cupsSNMPSetDebug
</a></h3>
965 <p class=
"description">Enable/disable debug logging to stderr.
</p>
967 void cupsSNMPSetDebug (
<br>
968 int level
<br>
970 <h4 class=
"parameters">Parameters
</h4>
973 <dd class=
"description">1 to enable debug output,
0 otherwise
</dd>
975 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPWalk">cupsSNMPWalk
</a></h3>
976 <p class=
"description">Enumerate a group of OIDs.
</p>
978 int cupsSNMPWalk (
<br>
979 int fd,
<br>
980 http_addr_t *address,
<br>
981 int version,
<br>
982 const char *community,
<br>
983 const int *prefix,
<br>
984 double timeout,
<br>
985 <a href=
"#cups_snmp_cb_t">cups_snmp_cb_t
</a> cb,
<br>
986 void *data
<br>
988 <h4 class=
"parameters">Parameters
</h4>
991 <dd class=
"description">SNMP socket
</dd>
993 <dd class=
"description">Address to query
</dd>
995 <dd class=
"description">SNMP version
</dd>
997 <dd class=
"description">Community name
</dd>
999 <dd class=
"description">OID prefix
</dd>
1001 <dd class=
"description">Timeout for each response in seconds
</dd>
1003 <dd class=
"description">Function to call for each response
</dd>
1005 <dd class=
"description">User data pointer that is passed to the callback function
</dd>
1007 <h4 class=
"returnvalue">Return Value
</h4>
1008 <p class=
"description">Number of OIDs found or -
1 on error
</p>
1009 <h4 class=
"discussion">Discussion
</h4>
1010 <p class=
"discussion">This function queries all of the OIDs with the specified OID prefix,
1011 calling the
"cb
" function for every response that is received.
<br>
1013 The array pointed to by
"prefix
" is terminated by the value -
1.
<br>
1015 If
"timeout
" is negative,
<code>cupsSNMPWalk
</code> will wait for a response
1019 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPWrite">cupsSNMPWrite
</a></h3>
1020 <p class=
"description">Send an SNMP query packet.
</p>
1022 int cupsSNMPWrite (
<br>
1023 int fd,
<br>
1024 http_addr_t *address,
<br>
1025 int version,
<br>
1026 const char *community,
<br>
1027 <a href=
"#cups_asn1_t">cups_asn1_t
</a> request_type,
<br>
1028 const unsigned request_id,
<br>
1029 const int *oid
<br>
1031 <h4 class=
"parameters">Parameters
</h4>
1034 <dd class=
"description">SNMP socket
</dd>
1036 <dd class=
"description">Address to send to
</dd>
1038 <dd class=
"description">SNMP version
</dd>
1040 <dd class=
"description">Community name
</dd>
1041 <dt>request_type
</dt>
1042 <dd class=
"description">Request type
</dd>
1044 <dd class=
"description">Request ID
</dd>
1046 <dd class=
"description">OID
</dd>
1048 <h4 class=
"returnvalue">Return Value
</h4>
1049 <p class=
"description">1 on success,
0 on error
</p>
1050 <h4 class=
"discussion">Discussion
</h4>
1051 <p class=
"discussion">The array pointed to by
"oid
" is terminated by the value -
1.
1054 <h3 class=
"function"><span class=
"info"> CUPS
1.3 </span><a name=
"cupsSideChannelDoRequest">cupsSideChannelDoRequest
</a></h3>
1055 <p class=
"description">Send a side-channel command to a backend and wait for a response.
</p>
1057 <a href=
"#cups_sc_status_t">cups_sc_status_t
</a> cupsSideChannelDoRequest (
<br>
1058 <a href=
"#cups_sc_command_t">cups_sc_command_t
</a> command,
<br>
1059 char *data,
<br>
1060 int *datalen,
<br>
1061 double timeout
<br>
1063 <h4 class=
"parameters">Parameters
</h4>
1066 <dd class=
"description">Command to send
</dd>
1068 <dd class=
"description">Response data buffer pointer
</dd>
1070 <dd class=
"description">Size of data buffer on entry, number of bytes in buffer on return
</dd>
1072 <dd class=
"description">Timeout in seconds
</dd>
1074 <h4 class=
"returnvalue">Return Value
</h4>
1075 <p class=
"description">Status of command
</p>
1076 <h4 class=
"discussion">Discussion
</h4>
1077 <p class=
"discussion">This function is normally only called by filters, drivers, or port
1078 monitors in order to communicate with the backend used by the current
1079 printer. Programs must be prepared to handle timeout or
"not
1080 implemented
" status codes, which indicate that the backend or device
1081 do not support the specified side-channel command.
<br>
1083 The
"datalen
" parameter must be initialized to the size of the buffer
1084 pointed to by the
"data
" parameter. cupsSideChannelDoRequest() will
1085 update the value to contain the number of data bytes in the buffer.
1088 <h3 class=
"function"><span class=
"info"> CUPS
1.3 </span><a name=
"cupsSideChannelRead">cupsSideChannelRead
</a></h3>
1089 <p class=
"description">Read a side-channel message.
</p>
1091 int cupsSideChannelRead (
<br>
1092 <a href=
"#cups_sc_command_t">cups_sc_command_t
</a> *command,
<br>
1093 <a href=
"#cups_sc_status_t">cups_sc_status_t
</a> *status,
<br>
1094 char *data,
<br>
1095 int *datalen,
<br>
1096 double timeout
<br>
1098 <h4 class=
"parameters">Parameters
</h4>
1101 <dd class=
"description">Command code
</dd>
1103 <dd class=
"description">Status code
</dd>
1105 <dd class=
"description">Data buffer pointer
</dd>
1107 <dd class=
"description">Size of data buffer on entry, number of bytes in buffer on return
</dd>
1109 <dd class=
"description">Timeout in seconds
</dd>
1111 <h4 class=
"returnvalue">Return Value
</h4>
1112 <p class=
"description">0 on success, -
1 on error
</p>
1113 <h4 class=
"discussion">Discussion
</h4>
1114 <p class=
"discussion">This function is normally only called by backend programs to read
1115 commands from a filter, driver, or port monitor program. The
1116 caller must be prepared to handle incomplete or invalid messages
1117 and return the corresponding status codes.
<br>
1119 The
"datalen
" parameter must be initialized to the size of the buffer
1120 pointed to by the
"data
" parameter. cupsSideChannelDoRequest() will
1121 update the value to contain the number of data bytes in the buffer.
1124 <h3 class=
"function"><span class=
"info"> CUPS
1.3 </span><a name=
"cupsSideChannelWrite">cupsSideChannelWrite
</a></h3>
1125 <p class=
"description">Write a side-channel message.
</p>
1127 int cupsSideChannelWrite (
<br>
1128 <a href=
"#cups_sc_command_t">cups_sc_command_t
</a> command,
<br>
1129 <a href=
"#cups_sc_status_t">cups_sc_status_t
</a> status,
<br>
1130 const char *data,
<br>
1131 int datalen,
<br>
1132 double timeout
<br>
1134 <h4 class=
"parameters">Parameters
</h4>
1137 <dd class=
"description">Command code
</dd>
1139 <dd class=
"description">Status code
</dd>
1141 <dd class=
"description">Data buffer pointer
</dd>
1143 <dd class=
"description">Number of bytes of data
</dd>
1145 <dd class=
"description">Timeout in seconds
</dd>
1147 <h4 class=
"returnvalue">Return Value
</h4>
1148 <p class=
"description">0 on success, -
1 on error
</p>
1149 <h4 class=
"discussion">Discussion
</h4>
1150 <p class=
"discussion">This function is normally only called by backend programs to send
1151 responses to a filter, driver, or port monitor program.
1154 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
1155 <h3 class=
"typedef"><a name=
"cups_asn1_t">cups_asn1_t
</a></h3>
1156 <p class=
"description">ASN1 request/object types
</p>
1158 typedef enum
<a href=
"#cups_asn1_e">cups_asn1_e
</a> cups_asn1_t;
1160 <h3 class=
"typedef"><a name=
"cups_backend_t">cups_backend_t
</a></h3>
1161 <p class=
"description">Backend exit codes
</p>
1163 typedef enum
<a href=
"#cups_backend_e">cups_backend_e
</a> cups_backend_t;
1165 <h3 class=
"typedef"><a name=
"cups_sc_bidi_t">cups_sc_bidi_t
</a></h3>
1166 <p class=
"description">Bidirectional capabilities
</p>
1168 typedef enum
<a href=
"#cups_sc_bidi_e">cups_sc_bidi_e
</a> cups_sc_bidi_t;
1170 <h3 class=
"typedef"><a name=
"cups_sc_command_t">cups_sc_command_t
</a></h3>
1171 <p class=
"description">Request command codes
</p>
1173 typedef enum
<a href=
"#cups_sc_command_e">cups_sc_command_e
</a> cups_sc_command_t;
1175 <h3 class=
"typedef"><a name=
"cups_sc_state_t">cups_sc_state_t
</a></h3>
1176 <p class=
"description">Printer state bits
</p>
1178 typedef enum
<a href=
"#cups_sc_state_e">cups_sc_state_e
</a> cups_sc_state_t;
1180 <h3 class=
"typedef"><a name=
"cups_sc_status_t">cups_sc_status_t
</a></h3>
1181 <p class=
"description">Response status codes
</p>
1183 typedef enum
<a href=
"#cups_sc_status_e">cups_sc_status_e
</a> cups_sc_status_t;
1185 <h3 class=
"typedef"><a name=
"cups_snmp_cb_t">cups_snmp_cb_t
</a></h3>
1186 <p class=
"description">Prototypes...
</p>
1188 typedef void (*cups_snmp_cb_t)(
<a href=
"#cups_snmp_t">cups_snmp_t
</a> *packet, void *data);
1190 <h3 class=
"typedef"><a name=
"cups_snmp_t">cups_snmp_t
</a></h3>
1191 <p class=
"description">SNMP data packet
</p>
1193 typedef struct
<a href=
"#cups_snmp_s">cups_snmp_s
</a> cups_snmp_t;
1195 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
1196 <h3 class=
"struct"><a name=
"cups_snmp_hexstring_s">cups_snmp_hexstring_s
</a></h3>
1197 <p class=
"description">Hex-STRING value
</p>
1198 <p class=
"code">struct cups_snmp_hexstring_s {
<br>
1199 unsigned char bytes[CUPS_SNMP_MAX_STRING];
<br>
1200 int num_bytes;
<br>
1202 <h4 class=
"members">Members
</h4>
1204 <dt>bytes[CUPS_SNMP_MAX_STRING]
</dt>
1205 <dd class=
"description">Bytes in string
</dd>
1207 <dd class=
"description">Number of bytes
</dd>
1209 <h3 class=
"struct"><a name=
"cups_snmp_s">cups_snmp_s
</a></h3>
1210 <p class=
"description">SNMP data packet
</p>
1211 <p class=
"code">struct cups_snmp_s {
<br>
1212 http_addr_t address;
<br>
1213 char community[CUPS_SNMP_MAX_STRING];
<br>
1214 const char *error;
<br>
1215 int error_index;
<br>
1216 int error_status;
<br>
1217 int object_name[CUPS_SNMP_MAX_OID];
<br>
1218 <a href=
"#cups_asn1_t">cups_asn1_t
</a> object_type;
<br>
1219 union
<a href=
"#cups_snmp_value_u">cups_snmp_value_u
</a> object_value;
<br>
1220 int request_id;
<br>
1221 <a href=
"#cups_asn1_t">cups_asn1_t
</a> request_type;
<br>
1222 int version;
<br>
1224 <h4 class=
"members">Members
</h4>
1227 <dd class=
"description">Source address
</dd>
1228 <dt>community[CUPS_SNMP_MAX_STRING]
</dt>
1229 <dd class=
"description">Community name
</dd>
1231 <dd class=
"description">Encode/decode error
</dd>
1232 <dt>error_index
</dt>
1233 <dd class=
"description">error-index value
</dd>
1234 <dt>error_status
</dt>
1235 <dd class=
"description">error-status value
</dd>
1236 <dt>object_name[CUPS_SNMP_MAX_OID]
</dt>
1237 <dd class=
"description">object-name value
</dd>
1238 <dt>object_type
</dt>
1239 <dd class=
"description">object-value type
</dd>
1240 <dt>object_value
</dt>
1241 <dd class=
"description">object-value value
</dd>
1242 <dt>request_id
</dt>
1243 <dd class=
"description">request-id value
</dd>
1244 <dt>request_type
</dt>
1245 <dd class=
"description">Request type
</dd>
1247 <dd class=
"description">Version number
</dd>
1249 <h2 class=
"title"><a name=
"UNIONS">Unions
</a></h2>
1250 <h3 class=
"union"><a name=
"cups_snmp_value_u">cups_snmp_value_u
</a></h3>
1251 <p class=
"description">Object value
</p>
1252 <p class=
"code">union cups_snmp_value_u {
<br>
1253 int boolean;
<br>
1254 unsigned counter;
<br>
1255 unsigned gauge;
<br>
1256 struct
<a href=
"#cups_snmp_hexstring_s">cups_snmp_hexstring_s
</a> hex_string;
<br>
1257 int integer;
<br>
1258 int oid[CUPS_SNMP_MAX_OID];
<br>
1259 char string[CUPS_SNMP_MAX_STRING];
<br>
1260 unsigned timeticks;
<br>
1262 <h4 class=
"members">Members
</h4>
1265 <dd class=
"description">Boolean value
</dd>
1267 <dd class=
"description">Counter value
</dd>
1269 <dd class=
"description">Gauge value
</dd>
1270 <dt>hex_string
</dt>
1271 <dd class=
"description">Hex string value
</dd>
1273 <dd class=
"description">Integer value
</dd>
1274 <dt>oid[CUPS_SNMP_MAX_OID]
</dt>
1275 <dd class=
"description">OID value
</dd>
1276 <dt>string[CUPS_SNMP_MAX_STRING]
</dt>
1277 <dd class=
"description">String value
</dd>
1279 <dd class=
"description">Timeticks value
</dd>
1281 <h2 class=
"title"><a name=
"ENUMERATIONS">Constants
</a></h2>
1282 <h3 class=
"enumeration"><a name=
"cups_asn1_e">cups_asn1_e
</a></h3>
1283 <p class=
"description">ASN1 request/object types
</p>
1284 <h4 class=
"constants">Constants
</h4>
1286 <dt>CUPS_ASN1_BIT_STRING
</dt>
1287 <dd class=
"description">BIT STRING
</dd>
1288 <dt>CUPS_ASN1_BOOLEAN
</dt>
1289 <dd class=
"description">BOOLEAN
</dd>
1290 <dt>CUPS_ASN1_COUNTER
</dt>
1291 <dd class=
"description">32-bit unsigned aka Counter32
</dd>
1292 <dt>CUPS_ASN1_END_OF_CONTENTS
</dt>
1293 <dd class=
"description">End-of-contents
</dd>
1294 <dt>CUPS_ASN1_GAUGE
</dt>
1295 <dd class=
"description">32-bit unsigned aka Gauge32
</dd>
1296 <dt>CUPS_ASN1_GET_NEXT_REQUEST
</dt>
1297 <dd class=
"description">GetNextRequest-PDU
</dd>
1298 <dt>CUPS_ASN1_GET_REQUEST
</dt>
1299 <dd class=
"description">GetRequest-PDU
</dd>
1300 <dt>CUPS_ASN1_GET_RESPONSE
</dt>
1301 <dd class=
"description">GetResponse-PDU
</dd>
1302 <dt>CUPS_ASN1_HEX_STRING
</dt>
1303 <dd class=
"description">Binary string aka Hex-STRING
</dd>
1304 <dt>CUPS_ASN1_INTEGER
</dt>
1305 <dd class=
"description">INTEGER or ENUMERATION
</dd>
1306 <dt>CUPS_ASN1_NULL_VALUE
</dt>
1307 <dd class=
"description">NULL VALUE
</dd>
1308 <dt>CUPS_ASN1_OCTET_STRING
</dt>
1309 <dd class=
"description">OCTET STRING
</dd>
1310 <dt>CUPS_ASN1_OID
</dt>
1311 <dd class=
"description">OBJECT IDENTIFIER
</dd>
1312 <dt>CUPS_ASN1_SEQUENCE
</dt>
1313 <dd class=
"description">SEQUENCE
</dd>
1314 <dt>CUPS_ASN1_TIMETICKS
</dt>
1315 <dd class=
"description">32-bit unsigned aka Timeticks32
</dd>
1317 <h3 class=
"enumeration"><a name=
"cups_backend_e">cups_backend_e
</a></h3>
1318 <p class=
"description">Backend exit codes
</p>
1319 <h4 class=
"constants">Constants
</h4>
1321 <dt>CUPS_BACKEND_AUTH_REQUIRED
</dt>
1322 <dd class=
"description">Job failed, authentication required
</dd>
1323 <dt>CUPS_BACKEND_CANCEL
</dt>
1324 <dd class=
"description">Job failed, cancel job
</dd>
1325 <dt>CUPS_BACKEND_FAILED
</dt>
1326 <dd class=
"description">Job failed, use error-policy
</dd>
1327 <dt>CUPS_BACKEND_HOLD
</dt>
1328 <dd class=
"description">Job failed, hold job
</dd>
1329 <dt>CUPS_BACKEND_OK
</dt>
1330 <dd class=
"description">Job completed successfully
</dd>
1331 <dt>CUPS_BACKEND_STOP
</dt>
1332 <dd class=
"description">Job failed, stop queue
</dd>
1334 <h3 class=
"enumeration"><a name=
"cups_sc_bidi_e">cups_sc_bidi_e
</a></h3>
1335 <p class=
"description">Bidirectional capabilities
</p>
1336 <h4 class=
"constants">Constants
</h4>
1338 <dt>CUPS_SC_BIDI_NOT_SUPPORTED
</dt>
1339 <dd class=
"description">Bidirectional I/O is not supported
</dd>
1340 <dt>CUPS_SC_BIDI_SUPPORTED
</dt>
1341 <dd class=
"description">Bidirectional I/O is supported
</dd>
1343 <h3 class=
"enumeration"><a name=
"cups_sc_command_e">cups_sc_command_e
</a></h3>
1344 <p class=
"description">Request command codes
</p>
1345 <h4 class=
"constants">Constants
</h4>
1347 <dt>CUPS_SC_CMD_DRAIN_OUTPUT
</dt>
1348 <dd class=
"description">Drain all pending output
</dd>
1349 <dt>CUPS_SC_CMD_GET_BIDI
</dt>
1350 <dd class=
"description">Return bidirectional capabilities
</dd>
1351 <dt>CUPS_SC_CMD_GET_DEVICE_ID
</dt>
1352 <dd class=
"description">Return the IEEE-
1284 device ID
</dd>
1353 <dt>CUPS_SC_CMD_GET_STATE
</dt>
1354 <dd class=
"description">Return the device state
</dd>
1355 <dt>CUPS_SC_CMD_SOFT_RESET
</dt>
1356 <dd class=
"description">Do a soft reset
</dd>
1358 <h3 class=
"enumeration"><a name=
"cups_sc_state_e">cups_sc_state_e
</a></h3>
1359 <p class=
"description">Printer state bits
</p>
1360 <h4 class=
"constants">Constants
</h4>
1362 <dt>CUPS_SC_STATE_BUSY
</dt>
1363 <dd class=
"description">Device is busy
</dd>
1364 <dt>CUPS_SC_STATE_ERROR
</dt>
1365 <dd class=
"description">Other error condition
</dd>
1366 <dt>CUPS_SC_STATE_MARKER_EMPTY
</dt>
1367 <dd class=
"description">Toner/ink out condition
</dd>
1368 <dt>CUPS_SC_STATE_MARKER_LOW
</dt>
1369 <dd class=
"description">Toner/ink low condition
</dd>
1370 <dt>CUPS_SC_STATE_MEDIA_EMPTY
</dt>
1371 <dd class=
"description">Paper out condition
</dd>
1372 <dt>CUPS_SC_STATE_MEDIA_LOW
</dt>
1373 <dd class=
"description">Paper low condition
</dd>
1374 <dt>CUPS_SC_STATE_OFFLINE
</dt>
1375 <dd class=
"description">Device is off-line
</dd>
1376 <dt>CUPS_SC_STATE_ONLINE
</dt>
1377 <dd class=
"description">Device is on-line
</dd>
1379 <h3 class=
"enumeration"><a name=
"cups_sc_status_e">cups_sc_status_e
</a></h3>
1380 <p class=
"description">Response status codes
</p>
1381 <h4 class=
"constants">Constants
</h4>
1383 <dt>CUPS_SC_STATUS_BAD_MESSAGE
</dt>
1384 <dd class=
"description">The command/response message was invalid
</dd>
1385 <dt>CUPS_SC_STATUS_IO_ERROR
</dt>
1386 <dd class=
"description">An I/O error occurred
</dd>
1387 <dt>CUPS_SC_STATUS_NONE
</dt>
1388 <dd class=
"description">No status
</dd>
1389 <dt>CUPS_SC_STATUS_NOT_IMPLEMENTED
</dt>
1390 <dd class=
"description">Command not implemented
</dd>
1391 <dt>CUPS_SC_STATUS_NO_RESPONSE
</dt>
1392 <dd class=
"description">The device did not respond
</dd>
1393 <dt>CUPS_SC_STATUS_OK
</dt>
1394 <dd class=
"description">Operation succeeded
</dd>
1395 <dt>CUPS_SC_STATUS_TIMEOUT
</dt>
1396 <dd class=
"description">The backend did not respond
</dd>
1397 <dt>CUPS_SC_STATUS_TOO_BIG
</dt>
1398 <dd class=
"description">Response too big
</dd>