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;
58 text-decoration: none;
62 A:link:hover, A:visited:hover, A:active {
63 text-decoration: underline;
72 border: solid thin #999999;
73 border-collapse: collapse;
89 border: solid thin #cccccc;
96 border-bottom: solid thin #999999;
105 caption-side: bottom;
125 border: thin solid #000000;
133 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
139 border-bottom: solid 2pt #000000;
157 font-family: monaco, courier, monospace;
166 border: solid thin #999999;
167 border-collapse: collapse;
172 DIV.summary TABLE TD, DIV.summary TABLE TH {
173 border: solid thin #999999;
179 DIV.summary TABLE THEAD TH {
183 /* API documentation styles... */
190 div.body h3, div.body h4, div.body h5 {
191 margin-bottom: 0.5em;
194 .class, .enumeration, .function, .struct, .typedef, .union {
195 border-bottom: solid thin #999999;
202 code, p.code, pre, ul.code li {
203 font-family: monaco, courier, monospace;
206 ul.code, ul.contents, ul.subcontents {
207 list-style-type: none;
217 ul.contents li ul.code, ul.contents li ul.subcontents {
230 margin-bottom: 0.5em;
233 /* This is just for the HTML files generated with the framedhelp target */
236 border: solid thin black;
245 div.contents ul.contents {
248 div.contents ul.subcontents li {
257 "$Id: api-filter.header 7285 2008-02-01 23:57:39Z mike $"
259 Filter and backend programming header for the Common UNIX Printing System
262 Copyright 2008 by Apple Inc.
264 These coded instructions, statements, and computer programs are the
265 property of Apple Inc. and are protected by Federal copyright
266 law. Distribution and use rights are outlined in the file "LICENSE.txt"
267 which should have been included with this file. If this file is
268 file is missing or damaged, see the license at "http://www.cups.org/".
271 <h1 class=
"title">Filter and Backend Programming
</h1>
273 <div class='summary'
><table summary='General Information'
>
277 <th>cups/backend.h
<br>
278 cups/sidechannel.h
<br>
289 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
290 Programming:
<a href='api-cups.html' target='_top'
>CUPS API
</a><br>
291 Programming:
<a href='api-ppd.html' target='_top'
>PPD API
</a><br>
292 Programming:
<a href='api-raster.html' target='_top'
>Raster API
</a></td>
296 <h2 class=
"title">Contents
</h2>
297 <ul class=
"contents">
299 <li><a href=
"#OVERVIEW">Overview
</a><ul class=
"subcontents">
300 <li><a href=
"#SECURITY">Security Considerations
</a></li>
301 <li><a href=
"#TEMPFILES">Temporary Files
</a></li>
302 <li><a href=
"#COPIES">Copy Generation
</a></li>
303 <li><a href=
"#EXITCODES">Exit Codes
</a></li>
304 <li><a href=
"#ENVIRONMENT">Environment Variables
</a></li>
305 <li><a href=
"#MESSAGES">Communicating with the Scheduler
</a></li>
306 <li><a href=
"#COMMUNICATING">Communicating with the Backend
</a></li>
307 <li><a href=
"#SNMP">Doing SNMP Queries with Network Printers
</a></li>
309 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
310 <li><a href=
"#cupsBackChannelRead" title=
"Read data from the backchannel.">cupsBackChannelRead
</a></li>
311 <li><a href=
"#cupsBackChannelWrite" title=
"Write data to the backchannel.">cupsBackChannelWrite
</a></li>
312 <li><a href=
"#cupsBackendDeviceURI" title=
"Get the device URI for a backend.">cupsBackendDeviceURI
</a></li>
313 <li><a href=
"#cupsSNMPClose" title=
"Close a SNMP socket.">cupsSNMPClose
</a></li>
314 <li><a href=
"#cupsSNMPCopyOID" title=
"Copy an OID.">cupsSNMPCopyOID
</a></li>
315 <li><a href=
"#cupsSNMPDefaultCommunity" title=
"Get the default SNMP community name.">cupsSNMPDefaultCommunity
</a></li>
316 <li><a href=
"#cupsSNMPIsOID" title=
"Test whether a SNMP response contains the specified OID.">cupsSNMPIsOID
</a></li>
317 <li><a href=
"#cupsSNMPIsOIDPrefixed" title=
"Test whether a SNMP response uses the specified
318 OID prefix.">cupsSNMPIsOIDPrefixed
</a></li>
319 <li><a href=
"#cupsSNMPOpen" title=
"Open a SNMP socket.">cupsSNMPOpen
</a></li>
320 <li><a href=
"#cupsSNMPRead" title=
"Read and parse a SNMP response.">cupsSNMPRead
</a></li>
321 <li><a href=
"#cupsSNMPSetDebug" title=
"Enable/disable debug logging to stderr.">cupsSNMPSetDebug
</a></li>
322 <li><a href=
"#cupsSNMPWalk" title=
"Enumerate a group of OIDs.">cupsSNMPWalk
</a></li>
323 <li><a href=
"#cupsSNMPWrite" title=
"Send an SNMP query packet.">cupsSNMPWrite
</a></li>
324 <li><a href=
"#cupsSideChannelDoRequest" title=
"Send a side-channel command to a backend and wait for a response.">cupsSideChannelDoRequest
</a></li>
325 <li><a href=
"#cupsSideChannelRead" title=
"Read a side-channel message.">cupsSideChannelRead
</a></li>
326 <li><a href=
"#cupsSideChannelWrite" title=
"Write a side-channel message.">cupsSideChannelWrite
</a></li>
328 <li><a href=
"#TYPES">Data Types
</a><ul class=
"code">
329 <li><a href=
"#cups_asn1_t" title=
"ASN1 request/object types">cups_asn1_t
</a></li>
330 <li><a href=
"#cups_backend_t" title=
"Backend exit codes">cups_backend_t
</a></li>
331 <li><a href=
"#cups_sc_bidi_t" title=
"Bidirectional capabilities">cups_sc_bidi_t
</a></li>
332 <li><a href=
"#cups_sc_command_t" title=
"Request command codes">cups_sc_command_t
</a></li>
333 <li><a href=
"#cups_sc_state_t" title=
"Printer state bits">cups_sc_state_t
</a></li>
334 <li><a href=
"#cups_sc_status_t" title=
"Response status codes">cups_sc_status_t
</a></li>
335 <li><a href=
"#cups_snmp_cb_t" title=
"Prototypes...">cups_snmp_cb_t
</a></li>
336 <li><a href=
"#cups_snmp_t" title=
"SNMP data packet">cups_snmp_t
</a></li>
338 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
339 <li><a href=
"#cups_snmp_hexstring_s" title=
"Hex-STRING value">cups_snmp_hexstring_s
</a></li>
340 <li><a href=
"#cups_snmp_s" title=
"SNMP data packet">cups_snmp_s
</a></li>
342 <li><a href=
"#UNIONS">Unions
</a><ul class=
"code">
343 <li><a href=
"#cups_snmp_value_u" title=
"Object value">cups_snmp_value_u
</a></li>
345 <li><a href=
"#ENUMERATIONS">Constants
</a><ul class=
"code">
346 <li><a href=
"#cups_asn1_e" title=
"ASN1 request/object types">cups_asn1_e
</a></li>
347 <li><a href=
"#cups_backend_e" title=
"Backend exit codes">cups_backend_e
</a></li>
348 <li><a href=
"#cups_sc_bidi_e" title=
"Bidirectional capabilities">cups_sc_bidi_e
</a></li>
349 <li><a href=
"#cups_sc_command_e" title=
"Request command codes">cups_sc_command_e
</a></li>
350 <li><a href=
"#cups_sc_state_e" title=
"Printer state bits">cups_sc_state_e
</a></li>
351 <li><a href=
"#cups_sc_status_e" title=
"Response status codes">cups_sc_status_e
</a></li>
355 "$Id: api-filter.shtml 7288 2008-02-06 01:39:05Z mike $"
357 Filter and backend programming introduction for the Common UNIX Printing
360 Copyright 2007-2008 by Apple Inc.
361 Copyright 1997-2006 by Easy Software Products, all rights reserved.
363 These coded instructions, statements, and computer programs are the
364 property of Apple Inc. and are protected by Federal copyright
365 law. Distribution and use rights are outlined in the file "LICENSE.txt"
366 which should have been included with this file. If this file is
367 file is missing or damaged, see the license at "http://www.cups.org/".
370 <h2 class='title'
><a name=
"OVERVIEW">Overview
</a></h2>
372 <p>Filters, printer drivers, port monitors, and backends use a common interface
373 for processing print jobs and communicating status information to the scheduler.
374 Each filter is run with a standard set of command-line arguments:
<p>
382 <dd>The user printing the job
</dd>
385 <dd>The job name/title
</dd>
388 <dd>The number of copies to print
</dd>
391 <dd>The options that were provided when the job was submitted
</dd>
394 <dd>The file to print (first filter only)
</dd>
397 <p>The scheduler runs one or more of these programs to print any given job. The
398 first filter reads from the print file and writes to the standard output, while
399 the remaining filters read from the standard input and write to the standard
400 output. The backend is the last filter in the chain and writes to the
403 <h3><a name=
"SECURITY">Security Considerations
</a></h3>
405 <p>It is always important to use security programming practices. Filters and
406 most backends are run as a non-priviledged user, so the major security
407 consideration is resource utilization - filters should not depend on unlimited
408 amounts of CPU, memory, or disk space, and should protect against conditions
409 that could lead to excess usage of any resource like infinite loops and
410 unbounded recursion. In addition, filters must
<em>never
</em> allow the user to
411 specify an arbitrary file path to a separator page, template, or other file
412 used by the filter since that can lead to an unauthorized disclosure of
413 information.
<em>Always
</em> treat input as suspect and validate it!
</p>
415 <p>If you are developing a backend that runs as root, make sure to check for
416 potential buffer overflows, integer under/overflow conditions, and file
417 accesses since these can lead to privilege escalations. When writing files,
418 always validate the file path and
<em>never
</em> allow a user to determine
419 where to store a file.
</p>
421 <blockquote><b>Note:
</b>
423 <p><em>Never
</em> write files to a user's home directory. Aside from the
424 security implications, CUPS is a network print service and as such the network
425 user may not be the same as the local user and/or there may not be a local home
426 directory to write to.
</p>
428 <p>In addition, some operating systems provide additional security mechanisms
429 that further limit file system access, even for backends running as root. On
430 Mac OS X, for example, no backend may write to a user's home directory.
</p>
433 <h3><a name=
"TEMPFILES">Temporary Files
</a></h3>
435 <p>Temporary files should be created in the directory specified by the
436 "TMPDIR" environment variable. The
437 <a href=
"#cupsTempFile2"><code>cupsTempFile2
</code></a> function can be
438 used to safely create temporary files in this directory.
</p>
440 <h3><a name=
"COPIES">Copy Generation
</a></h3>
442 <p>The
<code>argv[
4]
</code> argument specifies the number of copies to produce
443 of the input file. In general, you should only generate copies if the
444 <em>filename
</em> argument is supplied. The only exception to this are
445 filters that produce device-independent PostScript output, since the PostScript
446 filter
<var>pstops
</var> is responsible for generating copies of PostScript
449 <h3><a name=
"EXITCODES">Exit Codes
</a></h3>
451 <p>Filters must exit with status
0 when they successfully generate print data
452 or
1 when they encounter an error. Backends can return any of the
453 <a href=
"#cups_backend_t"><code>cups_backend_t
</code></a> constants.
</p>
455 <h3><a name=
"ENVIRONMENT">Environment Variables
</a></h3>
457 <p>The following environment variables are defined by the printing system:
</p>
461 <dt>APPLE_LANGUAGES
</dt>
462 <dd>The Apple language identifier associated with the job
463 (Mac OS X only).
</dd>
466 <dd>The job character set, typically
"utf-8".
</dd>
469 <dd>When a job is submitted to a printer class, contains the name of
470 the destination printer class. Otherwise this environment
471 variable will not be set.
</dd>
473 <dt>CONTENT_TYPE
</dt>
474 <dd>The MIME type associated with the file (e.g.
475 application/postscript).
</dd>
477 <dt>CUPS_CACHEDIR
</dt>
478 <dd>The directory where cache files can be stored.
</dd>
480 <dt>CUPS_DATADIR
</dt>
481 <dd>The directory where data files can be found.
</dd>
483 <dt>CUPS_SERVERROOT
</dt>
484 <dd>The root directory of the server.
</dd>
487 <dd>The device-uri associated with the printer.
</dd>
489 <dt>FINAL_CONTENT_TYPE
</dt>
490 <dd>The MIME type associated with the printer (e.g.
491 application/vnd.cups-postscript).
</dd>
494 <dd>The language locale associated with the job.
</dd>
497 <dd>The full pathname of the PostScript Printer Description (PPD)
498 file for this printer.
</dd>
501 <dd>The name of the printer.
</dd>
504 <dd>The recommended amount of memory to use for Raster Image
505 Processors (RIPs).
</dd>
509 <h3><a name=
"MESSAGES">Communicating with the Scheduler
</a></h3>
511 <p>Filters and backends communicate wih the scheduler by writing messages
512 to the standard error file. For example, the following code sets the current
513 printer state message to
"Printing page 5":
</p>
515 <pre class=
"example">
518 fprintf(stderr,
"INFO: Printing page %d\n", page);
521 <p>Each message is a single line of text starting with one of the following
526 <dt>ALERT: message
</dt>
527 <dd>Sets the printer-state-message attribute and adds the specified
528 message to the current error log file using the
"alert" log level.
</dd>
530 <dt>ATTR: attribute=value [attribute=value]
</dt>
531 <dd>Sets the named printer or job attribute(s). Typically this is used
532 to set the
<code>marker-colors
</code>,
<code>marker-levels
</code>,
533 <code>marker-names
</code>,
<code>marker-types
</code>,
534 <code>printer-alert
</code>, and
<code>printer-alert-description
</code>
535 printer attributes.
</dd>
537 <dt>CRIT: message
</dt>
538 <dd>Sets the printer-state-message attribute and adds the specified
539 message to the current error log file using the
"critical" log
542 <dt>DEBUG: message
</dt>
543 <dd>Sets the printer-state-message attribute and adds the specified
544 message to the current error log file using the
"debug" log level.
</dd>
546 <dt>DEBUG2: message
</dt>
547 <dd>Sets the printer-state-message attribute and adds the specified
548 message to the current error log file using the
"debug2" log level.
</dd>
550 <dt>EMERG: message
</dt>
551 <dd>Sets the printer-state-message attribute and adds the specified
552 message to the current error log file using the
"emergency" log
555 <dt>ERROR: message
</dt>
556 <dd>Sets the printer-state-message attribute and adds the specified
557 message to the current error log file using the
"error" log level.
</dd>
559 <dt>INFO: message
</dt>
560 <dd>Sets the printer-state-message attribute. If the current log level
561 is set to
"debug2", also adds the specified message to the current error
562 log file using the
"info" log level.
</dd>
564 <dt>NOTICE: message
</dt>
565 <dd>Sets the printer-state-message attribute and adds the specified
566 message to the current error log file using the
"notice" log level.
</dd>
568 <dt>PAGE: page-number #-copies
</dt>
569 <dt>PAGE: total #-pages
</dt>
570 <dd>Adds an entry to the current page log file. The first form adds
571 #-copies to the job-media-sheets-completed attribute. The second
572 form sets the job-media-sheets-completed attribute to #-pages.
</dd>
574 <dt>STATE: printer-state-reason [printer-state-reason ...]
</dt>
575 <dt>STATE: + printer-state-reason [printer-state-reason ...]
</dt>
576 <dt>STATE: - printer-state-reason [printer-state-reason ...]
</dt>
577 <dd>Sets, adds, or removes printer-state-reason keywords to the
578 current queue. Typically this is used to indicate media, ink, and
579 toner conditions on a printer.
</dd>
581 <dt>WARNING: message
</dt>
582 <dd>Sets the printer-state-message attribute and adds the specified
583 message to the current error log file using the
"warning" log
588 <p>Messages without one of these prefixes are treated as if they began with
589 the
"DEBUG:" prefix string.
</p>
591 <h3><a name=
"COMMUNICATING">Communicating with the Backend
</a></h3>
593 <p>Filters can communicate with the backend via the
594 <a href=
"#cupsBackChannelRead"><code>cupsBackChannelRead
</code></a> and
595 <a href=
"#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest
</code></a>
597 <a href=
"#cupsBackChannelRead"><code>cupsBackChannelRead
</code></a> function
598 reads data that has been sent back from the device and is typically used to
599 obtain status and configuration information. For example, the following code
600 polls the backend for back-channel data:
</p>
602 <pre class=
"example">
603 #include
<cups/cups.h
>
608 /* Use a timeout of
0.0 seconds to poll for back-channel data */
609 bytes = cupsBackChannelRead(buffer, sizeof(buffer),
0.0);
613 <a href=
"#cupsSideChannelDoRequest"><code>cupsSideChannelDoRequest
</code></a>
614 function allows you to get out-of-band status information and do synchronization
615 with the device. For example, the following code gets the current IEEE-
1284
616 device ID string from the backend:
</p>
618 <pre class=
"example">
619 #include
<cups/sidechannel.h
>
623 <a href=
"#cups_sc_status_t">cups_sc_status_t
</a> status;
625 /* Tell cupsSideChannelDoRequest() how big our buffer is, less
1 byte for nul-termination... */
626 datalen = sizeof(data) -
1;
628 /* Get the IEEE-
1284 device ID, waiting for up to
1 second */
629 status =
<a href=
"#cupsSideChannelDoRequest">cupsSideChannelDoRequest
</a>(CUPS_SC_CMD_GET_DEVICE_ID, data,
&datalen,
1.0);
631 /* Use the returned value if OK was returned and the length is non-zero */
632 if (status == CUPS_SC_STATUS_OK && datalen
> 0)
633 data[datalen] = '\
0';
638 <p>Backends communicate with filters using the reciprocal functions
639 <a href=
"#cupsBackChannelWrite"><code>cupsBackChannelWrite
</code></a>,
640 <a href=
"#cupsSideChannelRead"><code>cupsSideChannelRead
</code></a>, and
641 <a href=
"#cupsSideChannelWrite"><code>cupsSideChannelWrite
</code></a>. We
642 recommend writing back-channel data using a timeout of
1.0 seconds:
</p>
644 <pre class=
"example">
645 #include
<cups/cups.h
>
650 /* Use a timeout of
1.0 seconds to give filters a chance to read */
651 cupsBackChannelWrite(buffer, bytes,
1.0);
654 <p>The
<a href=
"#cupsSideChannelRead"><code>cupsSideChannelRead
</code></a>
655 function reads a side-channel command from a filter, driver, or port monitor.
656 Backends can either poll for commands using a
<code>timeout
</code> of
0.0, wait
657 indefinitely for commands using a
<code>timeout
</code> of -
1.0 (probably in a
658 separate thread for that purpose), or use
<code>select
</code> or
659 <code>poll
</code> on the
<code>CUPS_SC_FD
</code> file descriptor (
4) to handle
660 input and output on several file descriptors at the same time. Backends can pass
661 <code>NULL
</code> for the
<code>data
</code> and
<code>datalen
</code> parameters
662 since none of the commands sent by upstream filters contain any data at this
665 <p>Once a command is processed, the backend uses the
666 <a href=
"#cupsSideChannelWrite"><code>cupsSideChannelWrite
</code></a> function
667 to send its response. For example, the following code shows how to poll for a
668 side-channel command and respond to it:
</p>
670 <pre class=
"example">
671 #include
<cups/sidechannel.h
>
673 <a href=
"#cups_sc_command_t">cups_sc_command_t
</a> command;
674 <a href=
"#cups_sc_status_t">cups_sc_status_t
</a> status;
676 /* Poll for a command... */
677 if (!
<a href=
"#cupsSideChannelRead">cupsSideChannelRead
</a>(
&command,
&status, NULL, NULL,
0.0))
684 /* handle supported commands, file data/datalen/status with values as needed */
687 status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
692 /* Send a response... */
693 <a href=
"#cupsSideChannelWrite">cupsSideChannelWrite
</a>(command, status, data, datalen,
1.0);
697 <h3><a name=
"SNMP">Doing SNMP Queries with Network Printers
</a></h3>
699 <p>The Simple Network Management Protocol (SNMP) allows you to get the current
700 status, page counter, and supply levels from most network printers. Every
701 piece of information is associated with an Object Identifier (OID), and
702 every printer has a
<em>community
</em> name associated with it. OIDs can be
703 queried directly or by
"walking" over a range of OIDs with a common prefix.
</p>
705 <p>The CUPS SNMP functions provide a simple API for querying network printers.
706 Queries are made using a datagram socket that is created using
707 <a href=
"#cupsSNMPOpen"><code>cupsSNMPOpen
</code></a> and destroyed using
708 <a href=
"#cupsSNMPClose"><code>cupsSNMPClose
</code></a>:
</p>
710 <pre class=
"example">
711 #include
<cups/snmp.h
>
713 int snmp =
<a href=
"#cupsSNMPOpen">cupsSNMPOpen
</a>(AF_INET);
715 /* do some queries */
717 <a href=
"#cupsSNMPClose">cupsSNMPClose
</a>(snmp);
720 <p>OIDs are simple C arrays of integers, terminated by a value of -
1. For
721 example, the page counter OID
.1.3.6.1.2.1.43.10.2.1.4.1.1 would be:
</p>
723 <pre class=
"example">
724 int page_counter_oid[] = {
1,
3,
6,
1,
2,
1,
43,
10,
2,
1,
4,
1,
1, -
1 };
727 <p>You send a query using
728 <a href=
"#cupsSNMPWrite"><code>cupsSNMPWrite
</code></a> and read the value back
729 using
<a href=
"#cupsSNMPRead"><code>cupsSNMPRead
</code></a>. The value is read
730 into a structure called
<a href=
"#cups_snmp_t"><code>cups_snmp_t
</code></a>:
</p>
732 <pre class=
"example">
733 #include
<cups/snmp.h
>
735 int page_counter_oid[] = {
1,
3,
6,
1,
2,
1,
43,
10,
2,
1,
4,
1,
1, -
1 };
736 http_addrlist_t *host = httpAddrGetList(
"myprinter", AF_UNSPEC,
"161");
737 int snmp =
<a href=
"#cupsSNMPOpen">cupsSNMPOpen
</a>(host-
>addr.addr.sa_family);
738 <a href=
"#cups_snmp_t">cups_snmp_t
</a> packet;
740 <a href=
"#cupsSNMPWrite">cupsSNMPWrite
</a>(snmp,
&(host-
>addr), CUPS_SNMP_VERSION_1,
741 <a href=
"#cupsSNMPDefaultCommunity">cupsSNMPDefaultCommunity
</a>(), CUPS_ASN1_GET_REQUEST,
1,
743 if (
<a href=
"#cupsSNMPRead">cupsSNMPRead
</a>(snmp,
&packet,
5000))
745 /* Do something with the value */
746 printf(
"Page counter is: %d\n", packet.object_value.integer);
750 <p>The
<a href=
"#cupsSNMPWalk"><code>cupsSNMPWalk
</code></a> function allows you
751 to query a whole group of OIDs, calling a function of your choice for each OID
754 <pre class=
"example">
755 #include
<cups/snmp.h
>
758 my_callback(
<a href=
"#cups_snmp_t">cups_snmp_t
</a> *packet, void *data)
760 /* Do something with the value */
763 int printer_mib_oid[] = {
1,
3,
6,
1,
2,
1,
43, -
1 };
764 http_addrlist_t *host = httpAddrGetList(
"myprinter", AF_UNSPEC,
"161");
765 int snmp =
<a href=
"#cupsSNMPOpen">cupsSNMPOpen
</a>(host-
>addr.addr.sa_family);
768 <a href=
"#cupsSNMPWalk">cupsSNMPWalk
</a>(snmp,
&(host-
>addr), CUPS_SNMP_VERSION_1,
769 <a href=
"#cupsSNMPDefaultCommunity">cupsSNMPDefaultCommunity
</a>(), printer_mib_oid, my_callback, my_data);
771 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
772 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsBackChannelRead">cupsBackChannelRead
</a></h3>
773 <p class=
"description">Read data from the backchannel.
</p>
775 ssize_t cupsBackChannelRead (
<br>
776 char *buffer,
<br>
777 size_t bytes,
<br>
778 double timeout
<br>
780 <h4 class=
"parameters">Parameters
</h4>
783 <dd class=
"description">Buffer to read
</dd>
785 <dd class=
"description">Bytes to read
</dd>
787 <dd class=
"description">Timeout in seconds
</dd>
789 <h4 class=
"returnvalue">Return Value
</h4>
790 <p class=
"description">Bytes read or -
1 on error
</p>
791 <h4 class=
"discussion">Discussion
</h4>
792 <p class=
"discussion">Reads up to
"bytes
" bytes from the backchannel. The
"timeout
"
793 parameter controls how many seconds to wait for the data - use
794 0.0 to return immediately if there is no data, -
1.0 to wait
795 for data indefinitely.
798 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsBackChannelWrite">cupsBackChannelWrite
</a></h3>
799 <p class=
"description">Write data to the backchannel.
</p>
801 ssize_t cupsBackChannelWrite (
<br>
802 const char *buffer,
<br>
803 size_t bytes,
<br>
804 double timeout
<br>
806 <h4 class=
"parameters">Parameters
</h4>
809 <dd class=
"description">Buffer to write
</dd>
811 <dd class=
"description">Bytes to write
</dd>
813 <dd class=
"description">Timeout in seconds
</dd>
815 <h4 class=
"returnvalue">Return Value
</h4>
816 <p class=
"description">Bytes written or -
1 on error
</p>
817 <h4 class=
"discussion">Discussion
</h4>
818 <p class=
"discussion">Writes
"bytes
" bytes to the backchannel. The
"timeout
" parameter
819 controls how many seconds to wait for the data to be written - use
820 0.0 to return immediately if the data cannot be written, -
1.0 to wait
824 <h3 class=
"function"><a name=
"cupsBackendDeviceURI">cupsBackendDeviceURI
</a></h3>
825 <p class=
"description">Get the device URI for a backend.
</p>
827 const char *cupsBackendDeviceURI (
<br>
828 char **argv
<br>
830 <h4 class=
"parameters">Parameters
</h4>
833 <dd class=
"description">Command-line arguments
</dd>
835 <h4 class=
"returnvalue">Return Value
</h4>
836 <p class=
"description">Device URI or
<code>NULL
</code></p>
837 <h4 class=
"discussion">Discussion
</h4>
838 <p class=
"discussion">The
"argv
" argument is the argv argument passed to main(). This
839 function returns the device URI passed in the DEVICE_URI environment
840 variable or the device URI passed in argv[
0], whichever is found
842 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPClose">cupsSNMPClose
</a></h3>
843 <p class=
"description">Close a SNMP socket.
</p>
845 void cupsSNMPClose (
<br>
846 int fd
<br>
848 <h4 class=
"parameters">Parameters
</h4>
851 <dd class=
"description">SNMP socket file descriptor
</dd>
853 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPCopyOID">cupsSNMPCopyOID
</a></h3>
854 <p class=
"description">Copy an OID.
</p>
856 int *cupsSNMPCopyOID (
<br>
857 int *dst,
<br>
858 const int *src,
<br>
859 int dstsize
<br>
861 <h4 class=
"parameters">Parameters
</h4>
864 <dd class=
"description">Destination OID
</dd>
866 <dd class=
"description">Source OID
</dd>
868 <dd class=
"description">Number of integers in dst
</dd>
870 <h4 class=
"returnvalue">Return Value
</h4>
871 <p class=
"description">New OID
</p>
872 <h4 class=
"discussion">Discussion
</h4>
873 <p class=
"discussion">The array pointed to by
"src
" is terminated by the value -
1.
876 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPDefaultCommunity">cupsSNMPDefaultCommunity
</a></h3>
877 <p class=
"description">Get the default SNMP community name.
</p>
879 const char *cupsSNMPDefaultCommunity (void);
</p>
880 <h4 class=
"returnvalue">Return Value
</h4>
881 <p class=
"description">Default community name
</p>
882 <h4 class=
"discussion">Discussion
</h4>
883 <p class=
"discussion">The default community name is the first community name found in the
884 snmp.conf file. If no community name is defined there,
"public
" is used.
887 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPIsOID">cupsSNMPIsOID
</a></h3>
888 <p class=
"description">Test whether a SNMP response contains the specified OID.
</p>
890 int cupsSNMPIsOID (
<br>
891 <a href=
"#cups_snmp_t">cups_snmp_t
</a> *packet,
<br>
892 const int *oid
<br>
894 <h4 class=
"parameters">Parameters
</h4>
897 <dd class=
"description">Response packet
</dd>
899 <dd class=
"description">OID
</dd>
901 <h4 class=
"returnvalue">Return Value
</h4>
902 <p class=
"description">1 if equal,
0 if not equal
</p>
903 <h4 class=
"discussion">Discussion
</h4>
904 <p class=
"discussion">The array pointed to by
"oid
" is terminated by the value -
1.
907 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPIsOIDPrefixed">cupsSNMPIsOIDPrefixed
</a></h3>
908 <p class=
"description">Test whether a SNMP response uses the specified
911 int cupsSNMPIsOIDPrefixed (
<br>
912 <a href=
"#cups_snmp_t">cups_snmp_t
</a> *packet,
<br>
913 const int *prefix
<br>
915 <h4 class=
"parameters">Parameters
</h4>
918 <dd class=
"description">Response packet
</dd>
920 <dd class=
"description">OID prefix
</dd>
922 <h4 class=
"returnvalue">Return Value
</h4>
923 <p class=
"description">1 if prefixed,
0 if not prefixed
</p>
924 <h4 class=
"discussion">Discussion
</h4>
925 <p class=
"discussion">The array pointed to by
"prefix
" is terminated by the value -
1.
928 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPOpen">cupsSNMPOpen
</a></h3>
929 <p class=
"description">Open a SNMP socket.
</p>
931 int cupsSNMPOpen (
<br>
932 int family
<br>
934 <h4 class=
"parameters">Parameters
</h4>
937 <dd class=
"description">Address family -
<code>AF_INET
</code> or
<code>AF_INET6
</code></dd>
939 <h4 class=
"returnvalue">Return Value
</h4>
940 <p class=
"description">SNMP socket file descriptor
</p>
941 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPRead">cupsSNMPRead
</a></h3>
942 <p class=
"description">Read and parse a SNMP response.
</p>
944 <a href=
"#cups_snmp_t">cups_snmp_t
</a> *cupsSNMPRead (
<br>
945 int fd,
<br>
946 <a href=
"#cups_snmp_t">cups_snmp_t
</a> *packet,
<br>
947 int msec
<br>
949 <h4 class=
"parameters">Parameters
</h4>
952 <dd class=
"description">SNMP socket file descriptor
</dd>
954 <dd class=
"description">SNMP packet buffer
</dd>
956 <dd class=
"description">Timeout in milliseconds
</dd>
958 <h4 class=
"returnvalue">Return Value
</h4>
959 <p class=
"description">SNMP packet or
<code>NULL
</code> if none
</p>
960 <h4 class=
"discussion">Discussion
</h4>
961 <p class=
"discussion">If
"timeout
" is negative,
<code>cupsSNMPRead
</code> will wait for a response
965 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPSetDebug">cupsSNMPSetDebug
</a></h3>
966 <p class=
"description">Enable/disable debug logging to stderr.
</p>
968 void cupsSNMPSetDebug (
<br>
969 int level
<br>
971 <h4 class=
"parameters">Parameters
</h4>
974 <dd class=
"description">1 to enable debug output,
0 otherwise
</dd>
976 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPWalk">cupsSNMPWalk
</a></h3>
977 <p class=
"description">Enumerate a group of OIDs.
</p>
979 int cupsSNMPWalk (
<br>
980 int fd,
<br>
981 http_addr_t *address,
<br>
982 int version,
<br>
983 const char *community,
<br>
984 const int *prefix,
<br>
985 int msec,
<br>
986 <a href=
"#cups_snmp_cb_t">cups_snmp_cb_t
</a> cb,
<br>
987 void *data
<br>
989 <h4 class=
"parameters">Parameters
</h4>
992 <dd class=
"description">SNMP socket
</dd>
994 <dd class=
"description">Address to query
</dd>
996 <dd class=
"description">SNMP version
</dd>
998 <dd class=
"description">Community name
</dd>
1000 <dd class=
"description">OID prefix
</dd>
1002 <dd class=
"description">Timeout for each response in milliseconds
</dd>
1004 <dd class=
"description">Function to call for each response
</dd>
1006 <dd class=
"description">User data pointer that is passed to the callback function
</dd>
1008 <h4 class=
"returnvalue">Return Value
</h4>
1009 <p class=
"description">Number of OIDs found or -
1 on error
</p>
1010 <h4 class=
"discussion">Discussion
</h4>
1011 <p class=
"discussion">This function queries all of the OIDs with the specified OID prefix,
1012 calling the
"cb
" function for every response that is received.
<br>
1014 The array pointed to by
"prefix
" is terminated by the value -
1.
1017 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsSNMPWrite">cupsSNMPWrite
</a></h3>
1018 <p class=
"description">Send an SNMP query packet.
</p>
1020 int cupsSNMPWrite (
<br>
1021 int fd,
<br>
1022 http_addr_t *address,
<br>
1023 int version,
<br>
1024 const char *community,
<br>
1025 <a href=
"#cups_asn1_t">cups_asn1_t
</a> request_type,
<br>
1026 const unsigned request_id,
<br>
1027 const int *oid
<br>
1029 <h4 class=
"parameters">Parameters
</h4>
1032 <dd class=
"description">SNMP socket
</dd>
1034 <dd class=
"description">Address to send to
</dd>
1036 <dd class=
"description">SNMP version
</dd>
1038 <dd class=
"description">Community name
</dd>
1039 <dt>request_type
</dt>
1040 <dd class=
"description">Request type
</dd>
1042 <dd class=
"description">Request ID
</dd>
1044 <dd class=
"description">OID
</dd>
1046 <h4 class=
"returnvalue">Return Value
</h4>
1047 <p class=
"description">1 on success,
0 on error
</p>
1048 <h4 class=
"discussion">Discussion
</h4>
1049 <p class=
"discussion">The array pointed to by
"oid
" is terminated by the value -
1.
1052 <h3 class=
"function"><span class=
"info"> CUPS
1.3 </span><a name=
"cupsSideChannelDoRequest">cupsSideChannelDoRequest
</a></h3>
1053 <p class=
"description">Send a side-channel command to a backend and wait for a response.
</p>
1055 <a href=
"#cups_sc_status_t">cups_sc_status_t
</a> cupsSideChannelDoRequest (
<br>
1056 <a href=
"#cups_sc_command_t">cups_sc_command_t
</a> command,
<br>
1057 char *data,
<br>
1058 int *datalen,
<br>
1059 double timeout
<br>
1061 <h4 class=
"parameters">Parameters
</h4>
1064 <dd class=
"description">Command to send
</dd>
1066 <dd class=
"description">Response data buffer pointer
</dd>
1068 <dd class=
"description">Size of data buffer on entry, number of bytes in buffer on return
</dd>
1070 <dd class=
"description">Timeout in seconds
</dd>
1072 <h4 class=
"returnvalue">Return Value
</h4>
1073 <p class=
"description">Status of command
</p>
1074 <h4 class=
"discussion">Discussion
</h4>
1075 <p class=
"discussion">This function is normally only called by filters, drivers, or port
1076 monitors in order to communicate with the backend used by the current
1077 printer. Programs must be prepared to handle timeout or
"not
1078 implemented
" status codes, which indicate that the backend or device
1079 do not support the specified side-channel command.
<br>
1081 The
"datalen
" parameter must be initialized to the size of the buffer
1082 pointed to by the
"data
" parameter. cupsSideChannelDoRequest() will
1083 update the value to contain the number of data bytes in the buffer.
1086 <h3 class=
"function"><span class=
"info"> CUPS
1.3 </span><a name=
"cupsSideChannelRead">cupsSideChannelRead
</a></h3>
1087 <p class=
"description">Read a side-channel message.
</p>
1089 int cupsSideChannelRead (
<br>
1090 <a href=
"#cups_sc_command_t">cups_sc_command_t
</a> *command,
<br>
1091 <a href=
"#cups_sc_status_t">cups_sc_status_t
</a> *status,
<br>
1092 char *data,
<br>
1093 int *datalen,
<br>
1094 double timeout
<br>
1096 <h4 class=
"parameters">Parameters
</h4>
1099 <dd class=
"description">Command code
</dd>
1101 <dd class=
"description">Status code
</dd>
1103 <dd class=
"description">Data buffer pointer
</dd>
1105 <dd class=
"description">Size of data buffer on entry, number of bytes in buffer on return
</dd>
1107 <dd class=
"description">Timeout in seconds
</dd>
1109 <h4 class=
"returnvalue">Return Value
</h4>
1110 <p class=
"description">0 on success, -
1 on error
</p>
1111 <h4 class=
"discussion">Discussion
</h4>
1112 <p class=
"discussion">This function is normally only called by backend programs to read
1113 commands from a filter, driver, or port monitor program. The
1114 caller must be prepared to handle incomplete or invalid messages
1115 and return the corresponding status codes.
<br>
1117 The
"datalen
" parameter must be initialized to the size of the buffer
1118 pointed to by the
"data
" parameter. cupsSideChannelDoRequest() will
1119 update the value to contain the number of data bytes in the buffer.
1122 <h3 class=
"function"><span class=
"info"> CUPS
1.3 </span><a name=
"cupsSideChannelWrite">cupsSideChannelWrite
</a></h3>
1123 <p class=
"description">Write a side-channel message.
</p>
1125 int cupsSideChannelWrite (
<br>
1126 <a href=
"#cups_sc_command_t">cups_sc_command_t
</a> command,
<br>
1127 <a href=
"#cups_sc_status_t">cups_sc_status_t
</a> status,
<br>
1128 const char *data,
<br>
1129 int datalen,
<br>
1130 double timeout
<br>
1132 <h4 class=
"parameters">Parameters
</h4>
1135 <dd class=
"description">Command code
</dd>
1137 <dd class=
"description">Status code
</dd>
1139 <dd class=
"description">Data buffer pointer
</dd>
1141 <dd class=
"description">Number of bytes of data
</dd>
1143 <dd class=
"description">Timeout in seconds
</dd>
1145 <h4 class=
"returnvalue">Return Value
</h4>
1146 <p class=
"description">0 on success, -
1 on error
</p>
1147 <h4 class=
"discussion">Discussion
</h4>
1148 <p class=
"discussion">This function is normally only called by backend programs to send
1149 responses to a filter, driver, or port monitor program.
1152 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
1153 <h3 class=
"typedef"><a name=
"cups_asn1_t">cups_asn1_t
</a></h3>
1154 <p class=
"description">ASN1 request/object types
</p>
1156 typedef enum
<a href=
"#cups_asn1_e">cups_asn1_e
</a> cups_asn1_t;
1158 <h3 class=
"typedef"><a name=
"cups_backend_t">cups_backend_t
</a></h3>
1159 <p class=
"description">Backend exit codes
</p>
1161 typedef enum
<a href=
"#cups_backend_e">cups_backend_e
</a> cups_backend_t;
1163 <h3 class=
"typedef"><a name=
"cups_sc_bidi_t">cups_sc_bidi_t
</a></h3>
1164 <p class=
"description">Bidirectional capabilities
</p>
1166 typedef enum
<a href=
"#cups_sc_bidi_e">cups_sc_bidi_e
</a> cups_sc_bidi_t;
1168 <h3 class=
"typedef"><a name=
"cups_sc_command_t">cups_sc_command_t
</a></h3>
1169 <p class=
"description">Request command codes
</p>
1171 typedef enum
<a href=
"#cups_sc_command_e">cups_sc_command_e
</a> cups_sc_command_t;
1173 <h3 class=
"typedef"><a name=
"cups_sc_state_t">cups_sc_state_t
</a></h3>
1174 <p class=
"description">Printer state bits
</p>
1176 typedef enum
<a href=
"#cups_sc_state_e">cups_sc_state_e
</a> cups_sc_state_t;
1178 <h3 class=
"typedef"><a name=
"cups_sc_status_t">cups_sc_status_t
</a></h3>
1179 <p class=
"description">Response status codes
</p>
1181 typedef enum
<a href=
"#cups_sc_status_e">cups_sc_status_e
</a> cups_sc_status_t;
1183 <h3 class=
"typedef"><a name=
"cups_snmp_cb_t">cups_snmp_cb_t
</a></h3>
1184 <p class=
"description">Prototypes...
</p>
1186 typedef void (*cups_snmp_cb_t)(
<a href=
"#cups_snmp_t">cups_snmp_t
</a> *packet, void *data);
1188 <h3 class=
"typedef"><a name=
"cups_snmp_t">cups_snmp_t
</a></h3>
1189 <p class=
"description">SNMP data packet
</p>
1191 typedef struct
<a href=
"#cups_snmp_s">cups_snmp_s
</a> cups_snmp_t;
1193 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
1194 <h3 class=
"struct"><a name=
"cups_snmp_hexstring_s">cups_snmp_hexstring_s
</a></h3>
1195 <p class=
"description">Hex-STRING value
</p>
1196 <p class=
"code">struct cups_snmp_hexstring_s {
<br>
1197 unsigned char bytes[CUPS_SNMP_MAX_STRING];
<br>
1198 int num_bytes;
<br>
1200 <h4 class=
"members">Members
</h4>
1202 <dt>bytes[CUPS_SNMP_MAX_STRING]
</dt>
1203 <dd class=
"description">Bytes in string
</dd>
1205 <dd class=
"description">Number of bytes
</dd>
1207 <h3 class=
"struct"><a name=
"cups_snmp_s">cups_snmp_s
</a></h3>
1208 <p class=
"description">SNMP data packet
</p>
1209 <p class=
"code">struct cups_snmp_s {
<br>
1210 http_addr_t address;
<br>
1211 char community[CUPS_SNMP_MAX_STRING];
<br>
1212 const char *error;
<br>
1213 int error_index;
<br>
1214 int error_status;
<br>
1215 int object_name[CUPS_SNMP_MAX_OID];
<br>
1216 <a href=
"#cups_asn1_t">cups_asn1_t
</a> object_type;
<br>
1217 union
<a href=
"#cups_snmp_value_u">cups_snmp_value_u
</a> object_value;
<br>
1218 int request_id;
<br>
1219 <a href=
"#cups_asn1_t">cups_asn1_t
</a> request_type;
<br>
1220 int version;
<br>
1222 <h4 class=
"members">Members
</h4>
1225 <dd class=
"description">Source address
</dd>
1226 <dt>community[CUPS_SNMP_MAX_STRING]
</dt>
1227 <dd class=
"description">Community name
</dd>
1229 <dd class=
"description">Encode/decode error
</dd>
1230 <dt>error_index
</dt>
1231 <dd class=
"description">error-index value
</dd>
1232 <dt>error_status
</dt>
1233 <dd class=
"description">error-status value
</dd>
1234 <dt>object_name[CUPS_SNMP_MAX_OID]
</dt>
1235 <dd class=
"description">object-name value
</dd>
1236 <dt>object_type
</dt>
1237 <dd class=
"description">object-value type
</dd>
1238 <dt>object_value
</dt>
1239 <dd class=
"description">object-value value
</dd>
1240 <dt>request_id
</dt>
1241 <dd class=
"description">request-id value
</dd>
1242 <dt>request_type
</dt>
1243 <dd class=
"description">Request type
</dd>
1245 <dd class=
"description">Version number
</dd>
1247 <h2 class=
"title"><a name=
"UNIONS">Unions
</a></h2>
1248 <h3 class=
"union"><a name=
"cups_snmp_value_u">cups_snmp_value_u
</a></h3>
1249 <p class=
"description">Object value
</p>
1250 <p class=
"code">union cups_snmp_value_u {
<br>
1251 int boolean;
<br>
1252 unsigned counter;
<br>
1253 unsigned gauge;
<br>
1254 struct
<a href=
"#cups_snmp_hexstring_s">cups_snmp_hexstring_s
</a> hex_string;
<br>
1255 int integer;
<br>
1256 int oid[CUPS_SNMP_MAX_OID];
<br>
1257 char string[CUPS_SNMP_MAX_STRING];
<br>
1258 unsigned timeticks;
<br>
1260 <h4 class=
"members">Members
</h4>
1263 <dd class=
"description">Boolean value
</dd>
1265 <dd class=
"description">Counter value
</dd>
1267 <dd class=
"description">Gauge value
</dd>
1268 <dt>hex_string
</dt>
1269 <dd class=
"description">Hex string value
</dd>
1271 <dd class=
"description">Integer value
</dd>
1272 <dt>oid[CUPS_SNMP_MAX_OID]
</dt>
1273 <dd class=
"description">OID value
</dd>
1274 <dt>string[CUPS_SNMP_MAX_STRING]
</dt>
1275 <dd class=
"description">String value
</dd>
1277 <dd class=
"description">Timeticks value
</dd>
1279 <h2 class=
"title"><a name=
"ENUMERATIONS">Constants
</a></h2>
1280 <h3 class=
"enumeration"><a name=
"cups_asn1_e">cups_asn1_e
</a></h3>
1281 <p class=
"description">ASN1 request/object types
</p>
1282 <h4 class=
"constants">Constants
</h4>
1284 <dt>CUPS_ASN1_BIT_STRING
</dt>
1285 <dd class=
"description">BIT STRING
</dd>
1286 <dt>CUPS_ASN1_BOOLEAN
</dt>
1287 <dd class=
"description">BOOLEAN
</dd>
1288 <dt>CUPS_ASN1_COUNTER
</dt>
1289 <dd class=
"description">32-bit unsigned aka Counter32
</dd>
1290 <dt>CUPS_ASN1_END_OF_CONTENTS
</dt>
1291 <dd class=
"description">End-of-contents
</dd>
1292 <dt>CUPS_ASN1_GAUGE
</dt>
1293 <dd class=
"description">32-bit unsigned aka Gauge32
</dd>
1294 <dt>CUPS_ASN1_GET_NEXT_REQUEST
</dt>
1295 <dd class=
"description">GetNextRequest-PDU
</dd>
1296 <dt>CUPS_ASN1_GET_REQUEST
</dt>
1297 <dd class=
"description">GetRequest-PDU
</dd>
1298 <dt>CUPS_ASN1_GET_RESPONSE
</dt>
1299 <dd class=
"description">GetResponse-PDU
</dd>
1300 <dt>CUPS_ASN1_HEX_STRING
</dt>
1301 <dd class=
"description">Binary string aka Hex-STRING
</dd>
1302 <dt>CUPS_ASN1_INTEGER
</dt>
1303 <dd class=
"description">INTEGER or ENUMERATION
</dd>
1304 <dt>CUPS_ASN1_NULL_VALUE
</dt>
1305 <dd class=
"description">NULL VALUE
</dd>
1306 <dt>CUPS_ASN1_OCTET_STRING
</dt>
1307 <dd class=
"description">OCTET STRING
</dd>
1308 <dt>CUPS_ASN1_OID
</dt>
1309 <dd class=
"description">OBJECT IDENTIFIER
</dd>
1310 <dt>CUPS_ASN1_SEQUENCE
</dt>
1311 <dd class=
"description">SEQUENCE
</dd>
1312 <dt>CUPS_ASN1_TIMETICKS
</dt>
1313 <dd class=
"description">32-bit unsigned aka Timeticks32
</dd>
1315 <h3 class=
"enumeration"><a name=
"cups_backend_e">cups_backend_e
</a></h3>
1316 <p class=
"description">Backend exit codes
</p>
1317 <h4 class=
"constants">Constants
</h4>
1319 <dt>CUPS_BACKEND_AUTH_REQUIRED
</dt>
1320 <dd class=
"description">Job failed, authentication required
</dd>
1321 <dt>CUPS_BACKEND_CANCEL
</dt>
1322 <dd class=
"description">Job failed, cancel job
</dd>
1323 <dt>CUPS_BACKEND_FAILED
</dt>
1324 <dd class=
"description">Job failed, use error-policy
</dd>
1325 <dt>CUPS_BACKEND_HOLD
</dt>
1326 <dd class=
"description">Job failed, hold job
</dd>
1327 <dt>CUPS_BACKEND_OK
</dt>
1328 <dd class=
"description">Job completed successfully
</dd>
1329 <dt>CUPS_BACKEND_STOP
</dt>
1330 <dd class=
"description">Job failed, stop queue
</dd>
1332 <h3 class=
"enumeration"><a name=
"cups_sc_bidi_e">cups_sc_bidi_e
</a></h3>
1333 <p class=
"description">Bidirectional capabilities
</p>
1334 <h4 class=
"constants">Constants
</h4>
1336 <dt>CUPS_SC_BIDI_NOT_SUPPORTED
</dt>
1337 <dd class=
"description">Bidirectional I/O is not supported
</dd>
1338 <dt>CUPS_SC_BIDI_SUPPORTED
</dt>
1339 <dd class=
"description">Bidirectional I/O is supported
</dd>
1341 <h3 class=
"enumeration"><a name=
"cups_sc_command_e">cups_sc_command_e
</a></h3>
1342 <p class=
"description">Request command codes
</p>
1343 <h4 class=
"constants">Constants
</h4>
1345 <dt>CUPS_SC_CMD_DRAIN_OUTPUT
</dt>
1346 <dd class=
"description">Drain all pending output
</dd>
1347 <dt>CUPS_SC_CMD_GET_BIDI
</dt>
1348 <dd class=
"description">Return bidirectional capabilities
</dd>
1349 <dt>CUPS_SC_CMD_GET_DEVICE_ID
</dt>
1350 <dd class=
"description">Return the IEEE-
1284 device ID
</dd>
1351 <dt>CUPS_SC_CMD_GET_STATE
</dt>
1352 <dd class=
"description">Return the device state
</dd>
1353 <dt>CUPS_SC_CMD_SOFT_RESET
</dt>
1354 <dd class=
"description">Do a soft reset
</dd>
1356 <h3 class=
"enumeration"><a name=
"cups_sc_state_e">cups_sc_state_e
</a></h3>
1357 <p class=
"description">Printer state bits
</p>
1358 <h4 class=
"constants">Constants
</h4>
1360 <dt>CUPS_SC_STATE_BUSY
</dt>
1361 <dd class=
"description">Device is busy
</dd>
1362 <dt>CUPS_SC_STATE_ERROR
</dt>
1363 <dd class=
"description">Other error condition
</dd>
1364 <dt>CUPS_SC_STATE_MARKER_EMPTY
</dt>
1365 <dd class=
"description">Toner/ink out condition
</dd>
1366 <dt>CUPS_SC_STATE_MARKER_LOW
</dt>
1367 <dd class=
"description">Toner/ink low condition
</dd>
1368 <dt>CUPS_SC_STATE_MEDIA_EMPTY
</dt>
1369 <dd class=
"description">Paper out condition
</dd>
1370 <dt>CUPS_SC_STATE_MEDIA_LOW
</dt>
1371 <dd class=
"description">Paper low condition
</dd>
1372 <dt>CUPS_SC_STATE_OFFLINE
</dt>
1373 <dd class=
"description">Device is off-line
</dd>
1374 <dt>CUPS_SC_STATE_ONLINE
</dt>
1375 <dd class=
"description">Device is on-line
</dd>
1377 <h3 class=
"enumeration"><a name=
"cups_sc_status_e">cups_sc_status_e
</a></h3>
1378 <p class=
"description">Response status codes
</p>
1379 <h4 class=
"constants">Constants
</h4>
1381 <dt>CUPS_SC_STATUS_BAD_MESSAGE
</dt>
1382 <dd class=
"description">The command/response message was invalid
</dd>
1383 <dt>CUPS_SC_STATUS_IO_ERROR
</dt>
1384 <dd class=
"description">An I/O error occurred
</dd>
1385 <dt>CUPS_SC_STATUS_NONE
</dt>
1386 <dd class=
"description">No status
</dd>
1387 <dt>CUPS_SC_STATUS_NOT_IMPLEMENTED
</dt>
1388 <dd class=
"description">Command not implemented
</dd>
1389 <dt>CUPS_SC_STATUS_NO_RESPONSE
</dt>
1390 <dd class=
"description">The device did not respond
</dd>
1391 <dt>CUPS_SC_STATUS_OK
</dt>
1392 <dd class=
"description">Operation succeeded
</dd>
1393 <dt>CUPS_SC_STATUS_TIMEOUT
</dt>
1394 <dd class=
"description">The backend did not respond
</dd>
1395 <dt>CUPS_SC_STATUS_TOO_BIG
</dt>
1396 <dd class=
"description">Response too big
</dd>