]> git.ipfire.org Git - thirdparty/cups.git/blob - doc/help/api-cups.html
Merge changes from CUPS 1.4svn-r7874.
[thirdparty/cups.git] / doc / help / api-cups.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2 <html>
3 <!-- SECTION: Programming -->
4 <head>
5 <title>CUPS API</title>
6 <meta name="keywords" content="Programming">
7 <meta name="creator" content="Mini-XML v2.5">
8 <style type="text/css"><!--
9 BODY {
10 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
11 }
12
13 H1, H2, H3, H4, H5, H6, P, TD, TH {
14 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
15 }
16
17 KBD {
18 font-family: monaco, courier, monospace;
19 font-weight: bold;
20 }
21
22 PRE {
23 font-family: monaco, courier, monospace;
24 }
25
26 PRE.command {
27 margin-left: 36pt;
28 }
29
30 PRE.example {
31 background: #eeeeee;
32 border: dotted thin #999999;
33 margin-left: 36pt;
34 padding: 10px;
35 }
36
37 PRE.command EM, PRE.example EM {
38 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
39 }
40
41 P.command {
42 font-family: monaco, courier, monospace;
43 margin-left: 36pt;
44 }
45
46 P.formula {
47 font-style: italic;
48 margin-left: 36pt;
49 }
50
51 BLOCKQUOTE {
52 background: #cccccc;
53 border: solid thin #999999;
54 padding: 10pt;
55 }
56
57 A:link, A:visited {
58 font-weight: normal;
59 text-decoration: none;
60 }
61
62 A:link:hover, A:visited:hover, A:active {
63 text-decoration: underline;
64 }
65
66 SUB, SUP {
67 font-size: 50%;
68 }
69
70 DIV.table TABLE {
71 border: solid thin #999999;
72 border-collapse: collapse;
73 border-spacing: 0;
74 margin-left: auto;
75 margin-right: auto;
76 }
77
78 DIV.table CAPTION {
79 caption-side: top;
80 font-size: 120%;
81 font-style: italic;
82 font-weight: bold;
83 margin-left: auto;
84 margin-right: auto;
85 }
86
87 DIV.table TABLE TD {
88 border: solid thin #cccccc;
89 padding-top: 5pt;
90 }
91
92 DIV.table TABLE TH {
93 background: #cccccc;
94 border: none;
95 border-bottom: solid thin #999999;
96 }
97
98 DIV.figure TABLE {
99 margin-left: auto;
100 margin-right: auto;
101 }
102
103 DIV.figure CAPTION {
104 caption-side: bottom;
105 font-size: 120%;
106 font-style: italic;
107 font-weight: bold;
108 margin-left: auto;
109 margin-right: auto;
110 }
111
112 TH.label {
113 padding-top: 5pt;
114 text-align: right;
115 vertical-align: top;
116 }
117
118 HR {
119 border: solid thin;
120 }
121
122 SPAN.info {
123 background: #000000;
124 border: thin solid #000000;
125 color: #ffffff;
126 font-size: 80%;
127 font-style: italic;
128 font-weight: bold;
129 white-space: nowrap;
130 }
131
132 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
133 float: right;
134 font-size: 100%;
135 }
136
137 H2.title, H3.title {
138 border-bottom: solid 2pt #000000;
139 }
140
141 DT {
142 margin-left: 36pt;
143 margin-top: 12pt;
144 }
145
146 DD {
147 margin-left: 54pt;
148 }
149
150 DL.category DT {
151 font-weight: bold;
152 }
153
154 P.summary {
155 margin-left: 36pt;
156 font-family: monaco, courier, monospace;
157 }
158
159 SPAN.message {
160 font-style: italic;
161 font-size: smaller;
162 }
163
164 DIV.summary TABLE {
165 border: solid thin #999999;
166 border-collapse: collapse;
167 border-spacing: 0;
168 margin: 10px;
169 }
170
171 DIV.summary TABLE TD, DIV.summary TABLE TH {
172 border: solid thin #999999;
173 padding: 5px;
174 text-align: left;
175 vertical-align: top;
176 }
177
178 DIV.summary TABLE THEAD TH {
179 background: #eeeeee;
180 }
181
182 /* API documentation styles... */
183 div.body h1 {
184 margin: 0;
185 }
186 div.body h2 {
187 margin-top: 1.5em;
188 }
189 div.body h3, div.body h4, div.body h5 {
190 margin-bottom: 0.5em;
191 margin-top: 1.5em;
192 }
193 .class, .enumeration, .function, .struct, .typedef, .union {
194 border-bottom: solid thin #999999;
195 margin-bottom: 0;
196 margin-top: 2em;
197 }
198 .description {
199 margin-top: 0.5em;
200 }
201 code, p.code, pre, ul.code li {
202 font-family: monaco, courier, monospace;
203 font-size: 90%;
204 }
205 ul.code, ul.contents, ul.subcontents {
206 list-style-type: none;
207 margin: 0;
208 padding-left: 0;
209 }
210 ul.code li {
211 margin: 0;
212 }
213 ul.contents > li {
214 margin-top: 1em;
215 }
216 ul.contents li ul.code, ul.contents li ul.subcontents {
217 padding-left: 2em;
218 }
219 div.body dl {
220 margin-left: 0;
221 margin-top: 0;
222 }
223 div.body dt {
224 font-style: italic;
225 margin-left: 0;
226 margin-top: 0;
227 }
228 div.body dd {
229 margin-bottom: 0.5em;
230 }
231
232 /* This is just for the HTML files generated with the framedhelp target */
233 div.contents {
234 background: #e8e8e8;
235 border: solid thin black;
236 padding: 10px;
237 }
238 div.contents h1 {
239 font-size: 110%;
240 }
241 div.contents h2 {
242 font-size: 100%;
243 }
244 div.contents ul.contents {
245 font-size: 80%;
246 }
247 div.contents ul.subcontents li {
248 margin-left: 1em;
249 text-indent: -1em;
250 }
251 --></style>
252 </head>
253 <body>
254 <div class='body'>
255 <!--
256 "$Id: api-cups.header 7279 2008-01-31 01:50:44Z mike $"
257
258 CUPS API header for the Common UNIX Printing System (CUPS).
259
260 Copyright 2008 by Apple Inc.
261
262 These coded instructions, statements, and computer programs are the
263 property of Apple Inc. and are protected by Federal copyright
264 law. Distribution and use rights are outlined in the file "LICENSE.txt"
265 which should have been included with this file. If this file is
266 file is missing or damaged, see the license at "http://www.cups.org/".
267 -->
268
269 <h1 class="title">CUPS API</h1>
270
271 <div class='summary'><table summary='General Information'>
272 <thead>
273 <tr>
274 <th>Header</th>
275 <th>cups/cups.h</th>
276 </tr>
277 </thead>
278 <tbody>
279 <tr>
280 <th>Library</th>
281 <td>-lcups</td>
282 </tr>
283 <tr>
284 <th>See Also</th>
285 <td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
286 Programming: <a href='api-array.html' target='_top'>Array API</a><br>
287 Programming: <a href='api-filedir.html' target='_top'>File and Directory APIs</a><br>
288 Programming: <a href='api-filter.html' target='_top'>Filter and Backend Programming</a><br>
289 Programming: <a href='api-httpipp.html' target='_top'>HTTP and IPP APIs</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>
292 </tr>
293 </tbody>
294 </table></div>
295 <h2 class="title">Contents</h2>
296 <ul class="contents">
297 </li>
298 <li><a href="#OVERVIEW">Overview</a><ul class="subcontents">
299 <li><a href="#CLIENTS_AND_SERVERS">Clients and Servers</a></li>
300 <li><a href="#PRINTERS_AND_CLASSES">Printers and Classes</a></li>
301 <li><a href="#OPTIONS">Options</a></li>
302 <li><a href="#PRINT_JOBS">Print Jobs</a></li>
303 <li><a href="#ERROR_HANDLING">Error Handling</a></li>
304 <li><a href="#PASSWORDS_AND_AUTHENTICATION">Passwords and Authentication</a></li>
305 </ul></li>
306 <li><a href="#FUNCTIONS">Functions</a><ul class="code">
307 <li><a href="#cupsAddDest" title="Add a destination to the list of destinations.">cupsAddDest</a></li>
308 <li><a href="#cupsAddOption" title="Add an option to an option array.">cupsAddOption</a></li>
309 <li><a href="#cupsCancelJob" title="Cancel a print job on the default server.">cupsCancelJob</a></li>
310 <li><a href="#cupsCancelJob2" title="Cancel or purge a print job.">cupsCancelJob2</a></li>
311 <li><a href="#cupsCreateJob" title="Create an empty job for streaming.">cupsCreateJob</a></li>
312 <li><a href="#cupsEncryption" title="Get the default encryption settings.">cupsEncryption</a></li>
313 <li><a href="#cupsFinishDocument" title="Finish sending a document.">cupsFinishDocument</a></li>
314 <li><a href="#cupsFreeDests" title="Free the memory used by the list of destinations.">cupsFreeDests</a></li>
315 <li><a href="#cupsFreeJobs" title="Free memory used by job data.">cupsFreeJobs</a></li>
316 <li><a href="#cupsFreeOptions" title="Free all memory used by options.">cupsFreeOptions</a></li>
317 <li><a href="#cupsGetClasses" title="Get a list of printer classes from the default server.">cupsGetClasses</a></li>
318 <li><a href="#cupsGetDefault" title="Get the default printer or class for the default server.">cupsGetDefault</a></li>
319 <li><a href="#cupsGetDefault2" title="Get the default printer or class for the specified server.">cupsGetDefault2</a></li>
320 <li><a href="#cupsGetDest" title="Get the named destination from the list.">cupsGetDest</a></li>
321 <li><a href="#cupsGetDests" title="Get the list of destinations from the default server.">cupsGetDests</a></li>
322 <li><a href="#cupsGetDests2" title="Get the list of destinations from the specified server.">cupsGetDests2</a></li>
323 <li><a href="#cupsGetJobs" title="Get the jobs from the default server.">cupsGetJobs</a></li>
324 <li><a href="#cupsGetJobs2" title="Get the jobs from the specified server.">cupsGetJobs2</a></li>
325 <li><a href="#cupsGetNamedDest" title="Get options for the named destination.">cupsGetNamedDest</a></li>
326 <li><a href="#cupsGetOption" title="Get an option value.">cupsGetOption</a></li>
327 <li><a href="#cupsGetPPD" title="Get the PPD file for a printer on the default server.">cupsGetPPD</a></li>
328 <li><a href="#cupsGetPPD2" title="Get the PPD file for a printer from the specified server.">cupsGetPPD2</a></li>
329 <li><a href="#cupsGetPPD3" title="Get the PPD file for a printer on the specified
330 server if it has changed.">cupsGetPPD3</a></li>
331 <li><a href="#cupsGetPassword" title="Get a password from the user.">cupsGetPassword</a></li>
332 <li><a href="#cupsGetPrinters" title="Get a list of printers from the default server.">cupsGetPrinters</a></li>
333 <li><a href="#cupsGetServerPPD" title="Get an available PPD file from the server.">cupsGetServerPPD</a></li>
334 <li><a href="#cupsLangDefault" title="Return the default language.">cupsLangDefault</a></li>
335 <li><a href="#cupsLangEncoding" title="Return the character encoding (us-ascii, etc.)
336 for the given language.">cupsLangEncoding</a></li>
337 <li><a href="#cupsLangFlush" title="Flush all language data out of the cache.">cupsLangFlush</a></li>
338 <li><a href="#cupsLangFree" title="Free language data.">cupsLangFree</a></li>
339 <li><a href="#cupsLangGet" title="Get a language.">cupsLangGet</a></li>
340 <li><a href="#cupsLastError" title="Return the last IPP status code.">cupsLastError</a></li>
341 <li><a href="#cupsLastErrorString" title="Return the last IPP status-message.">cupsLastErrorString</a></li>
342 <li><a href="#cupsNotifySubject" title="Return the subject for the given notification message.">cupsNotifySubject</a></li>
343 <li><a href="#cupsNotifyText" title="Return the text for the given notification message.">cupsNotifyText</a></li>
344 <li><a href="#cupsParseOptions" title="Parse options from a command-line argument.">cupsParseOptions</a></li>
345 <li><a href="#cupsPrintFile" title="Print a file to a printer or class on the default server.">cupsPrintFile</a></li>
346 <li><a href="#cupsPrintFile2" title="Print a file to a printer or class on the specified
347 server.">cupsPrintFile2</a></li>
348 <li><a href="#cupsPrintFiles" title="Print one or more files to a printer or class on the
349 default server.">cupsPrintFiles</a></li>
350 <li><a href="#cupsPrintFiles2" title="Print one or more files to a printer or class on the
351 specified server.">cupsPrintFiles2</a></li>
352 <li><a href="#cupsRemoveDest" title="Remove a destination from the destination list.">cupsRemoveDest</a></li>
353 <li><a href="#cupsRemoveOption" title="Remove an option from an option array.">cupsRemoveOption</a></li>
354 <li><a href="#cupsServer" title="Return the hostname/address of the default server.">cupsServer</a></li>
355 <li><a href="#cupsSetDefaultDest" title="Set the default destination.">cupsSetDefaultDest</a></li>
356 <li><a href="#cupsSetDests" title="Save the list of destinations for the default server.">cupsSetDests</a></li>
357 <li><a href="#cupsSetDests2" title="Save the list of destinations for the specified server.">cupsSetDests2</a></li>
358 <li><a href="#cupsSetEncryption" title="Set the encryption preference.">cupsSetEncryption</a></li>
359 <li><a href="#cupsSetPasswordCB" title="Set the password callback for CUPS.">cupsSetPasswordCB</a></li>
360 <li><a href="#cupsSetServer" title="Set the default server name.">cupsSetServer</a></li>
361 <li><a href="#cupsSetUser" title="Set the default user name.">cupsSetUser</a></li>
362 <li><a href="#cupsStartDocument" title="Add a document to a job created with cupsCreateJob().">cupsStartDocument</a></li>
363 <li><a href="#cupsTempFd" title="Creates a temporary file.">cupsTempFd</a></li>
364 <li><a href="#cupsTempFile" title="Generates a temporary filename.">cupsTempFile</a></li>
365 <li><a href="#cupsTempFile2" title="Creates a temporary CUPS file.">cupsTempFile2</a></li>
366 <li><a href="#cupsUser" title="Return the current user's name.">cupsUser</a></li>
367 </ul>
368 <li><a href="#TYPES">Data Types</a><ul class="code">
369 <li><a href="#cups_dest_t" title="Destination">cups_dest_t</a></li>
370 <li><a href="#cups_device_cb_t" title="Device callback ">cups_device_cb_t</a></li>
371 <li><a href="#cups_job_t" title="Job">cups_job_t</a></li>
372 <li><a href="#cups_option_t" title="Printer Options">cups_option_t</a></li>
373 <li><a href="#cups_password_cb_t" title="Password callback">cups_password_cb_t</a></li>
374 <li><a href="#cups_ptype_t" title="Printer type/capability bits">cups_ptype_t</a></li>
375 </ul></li>
376 <li><a href="#STRUCTURES">Structures</a><ul class="code">
377 <li><a href="#cups_dest_s" title="Destination">cups_dest_s</a></li>
378 <li><a href="#cups_job_s" title="Job">cups_job_s</a></li>
379 <li><a href="#cups_option_s" title="Printer Options">cups_option_s</a></li>
380 </ul></li>
381 <li><a href="#ENUMERATIONS">Constants</a><ul class="code">
382 <li><a href="#cups_ptype_e" title="Printer type/capability bit constants">cups_ptype_e</a></li>
383 </ul></li>
384 </ul>
385 <!--
386 "$Id: api-cups.shtml 7337 2008-02-22 04:44:04Z mike $"
387
388 CUPS API introduction for the Common UNIX Printing System (CUPS).
389
390 Copyright 2007-2008 by Apple Inc.
391 Copyright 1997-2006 by Easy Software Products, all rights reserved.
392
393 These coded instructions, statements, and computer programs are the
394 property of Apple Inc. and are protected by Federal copyright
395 law. Distribution and use rights are outlined in the file "LICENSE.txt"
396 which should have been included with this file. If this file is
397 file is missing or damaged, see the license at "http://www.cups.org/".
398 -->
399
400 <h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
401
402 <p>The CUPS API provides the convenience functions needed to support
403 applications, filters, printer drivers, and backends that need to interface
404 with the CUPS scheduler.</p>
405
406 <h3><a name='CLIENTS_AND_SERVERS'>Clients and Servers</a></h3>
407
408 <p>CUPS is based on the Internet Printing Protocol ("IPP"), which allows
409 clients (applications) to communicate with a server (the scheduler) to get a
410 list of printers, send print jobs, and so forth. You identify which server
411 you want to communicate with using a pointer to the opaque structure
412 <code>http_t</code>. All of the examples in this document use the
413 <code>CUPS_HTTP_DEFAULT</code> constant, referring to the default connection
414 to the scheduler. The <a href='api-httpipp.html' target='_top'>HTTP and IPP
415 APIs</a> document provides more information on server connections.</p>
416
417 <h3><a name='PRINTERS_AND_CLASSES'>Printers and Classes</a></h3>
418
419 <p>Printers and classes (collections of printers) are accessed through
420 the <a href="#cups_dest_t"><code>cups_dest_t</code></a> structure which
421 includes the name (<code>name</code>), instance (<code>instance</code> -
422 a way of selecting certain saved options/settings), and the options and
423 attributes associated with that destination (<code>num_options</code> and
424 <code>options</code>). Destinations are created using the
425 <a href="#cupsGetDests"><code>cupsGetDests</code></a> function and freed
426 using the <a href='#cupsFreeDests'><code>cupsFreeDests</code></a> function.
427 The <a href='#cupsGetDest'><code>cupsGetDest</code></a> function finds a
428 specific destination for printing:</p>
429
430 <pre class='example'>
431 #include &lt;cups/cups.h&gt;
432
433 <a href='#cups_dest_t'>cups_dest_t</a> *dests;
434 int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&amp;dests);
435 <a href='#cups_dest_t'>cups_dest_t</a> *dest = <a href='#cupsGetDest'>cupsGetDest</a>("name", NULL, num_dests, dests);
436
437 /* do something wiith dest */
438
439 <a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
440 </pre>
441
442 <p>Passing <code>NULL</code> to
443 <a href='#cupsGetDest'><code>cupsGetDest</code></a> for the destination name
444 will return the default destination. Similarly, passing a <code>NULL</code>
445 instance will return the default instance for that destination.</p>
446
447 <div class='table'><table summary='Table 1: Printer Attributes' width='80%'>
448 <caption>Table 1: <a name='TABLE1'>Printer Attributes</a></caption>
449 <thead>
450 <tr>
451 <th>Attribute Name</th>
452 <th>Description</th>
453 </tr>
454 </thead>
455 <tbody>
456 <tr>
457 <td>"auth-info-required"</td>
458 <td>The type of authentication required for printing to this
459 destination: "none", "username,password", "domain,username,password",
460 or "negotiate" (Kerberos)</td>
461 </tr>
462 <tr>
463 <td>"printer-info"</td>
464 <td>The human-readable description of the destination such as "My
465 Laser Printer".</td>
466 </tr>
467 <tr>
468 <td>"printer-is-accepting-jobs"</td>
469 <td>"1" if the destination is accepting new jobs, "0" if not.</td>
470 </tr>
471 <tr>
472 <td>"printer-is-shared"</td>
473 <td>"1" if the destination is being shared with other computers, "0" if
474 not.</td>
475 </tr>
476 <tr>
477 <td>"printer-location"</td>
478 <td>The human-readable location of the destination such as "Lab 4".</td>
479 </tr>
480 <tr>
481 <td>"printer-make-and-model"</td>
482 <td>The human-readable make and model of the destination such as "HP
483 LaserJet 4000 Series".</td>
484 </tr>
485 <tr>
486 <td>"printer-state"</td>
487 <td>"3" if the destination is idle, "4" if the destination is printing
488 a job, and "5" if the destination is stopped.</td>
489 </tr>
490 <tr>
491 <td>"printer-state-change-time"</td>
492 <td>The UNIX time when the destination entered the current state.</td>
493 </tr>
494 <tr>
495 <td>"printer-state-reasons"</td>
496 <td>Additional comma-delimited state keywords for the destination
497 such as "media-tray-empty-error" and "toner-low-warning".</td>
498 </tr>
499 <tr>
500 <td>"printer-type"</td>
501 <td>The <a href='#cups_printer_t'><code>cups_printer_t</code></a>
502 value associated with the destination.</td>
503 </tr>
504 </tbody>
505 </table></div>
506
507 <h3><a name='OPTIONS'>Options</a></h3>
508
509 <p>Options are stored in arrays of
510 <a href='#cups_option_t'><code>cups_option_t</code></a> structures. Each
511 option has a name (<code>name</code>) and value (<code>value</code>)
512 associated with it. The <a href='#cups_dest_t'><code>cups_dest_t</code></a>
513 <code>num_options</code> and <code>options</code> members contain the
514 default options for a particular destination, along with several informational
515 attributes about the destination as shown in <a href='#TABLE1'>Table 1</a>.
516 The <a href='#cupsGetOption'><code>cupsGetOption</code></a> function gets
517 the value for the named option. For example, the following code lists the
518 available destinations and their human-readable descriptions:</p>
519
520 <pre class='example'>
521 #include &lt;cups/cups.h&gt;
522
523 <a href='#cups_dest_t'>cups_dest_t</a> *dests;
524 int num_dests = <a href='#cupsGetDests'>cupsGetDests</a>(&amp;dests);
525 <a href='#cups_dest_t'>cups_dest_t</a> *dest;
526 int i;
527 const char *value;
528
529 for (i = num_dests, dest = dests; i > 0; i --, dest ++)
530 if (dest->instance == NULL)
531 {
532 value = <a href='#cupsGetOption'>cupsGetOption</a>("printer-info", dest->num_options, dest->options);
533 printf("%s (%s)\n", dest->name, value ? value : "no description");
534 }
535
536 <a href='#cupsFreeDests'>cupsFreeDests</a>(num_dests, dests);
537 </pre>
538
539 <p>You can create your own option arrays using the
540 <a href='#cupsAddOption'><code>cupsAddOption</code></a> function, which
541 adds a single named option to an array:</p>
542
543 <pre class='example'>
544 #include &lt;cups/cups.h&gt;
545
546 int num_options = 0;
547 <a href='#cups_option_t'>cups_option_t</a> *options = NULL;
548
549 /* The returned num_options value is updated as needed */
550 num_options = <a href='#cupsAddOption'>cupsAddOption</a>("first", "value", num_options, &amp;options);
551
552 /* This adds a second option value */
553 num_options = <a href='#cupsAddOption'>cupsAddOption</a>("second", "value", num_options, &amp;options);
554
555 /* This replaces the first option we added */
556 num_options = <a href='#cupsAddOption'>cupsAddOption</a>("first", "new value", num_options, &amp;options);
557 </pre>
558
559 <p>Use a <code>for</code> loop to copy the options from a destination:</p>
560
561 <pre class='example'>
562 #include &lt;cups/cups.h&gt;
563
564 int i;
565 int num_options = 0;
566 <a href='#cups_option_t'>cups_option_t</a> *options = NULL;
567 <a href='#cups_dest_t'>cups_dest_t</a> *dest;
568
569 for (i = 0; i < dest->num_options; i ++)
570 num_options = <a href='#cupsAddOption'>cupsAddOption</a>(dest->options[i].name, dest->options[i].value,
571 num_options, &amp;options);
572 </pre>
573
574 <p>Use the <a href='#cupsFreeOptions'><code>cupsFreeOptions</code></a>
575 function to free the options array when you are done using it:</p>
576
577 <pre class='example'>
578 <a href='#cupsFreeOptions'>cupsFreeOptions</a>(num_options, options);
579 </pre>
580
581 <h3><a name='PRINT_JOBS'>Print Jobs</a></h3>
582
583 <p>Print jobs are identified by a locally-unique job ID number from 1 to
584 2<sup>31</sup>-1 and have options and one or more files for printing to a
585 single destination. The <a href='#cupsPrintFile'><code>cupsPrintFile</code></a>
586 function creates a new job with one file. The following code prints the CUPS
587 test page file:</p>
588
589 <pre class='example'>
590 #include &lt;cups/cups.h&gt;
591
592 <a href='#cups_dest_t'>cups_dest_t</a> *dest;
593 int num_options;
594 <a href='#cups_option_t'>cups_option_t</a> *options;
595 int job_id;
596
597 /* Print a single file */
598 job_id = <a href='#cupsPrintFile'>cupsPrintFile</a>(dest->name, "/usr/share/cups/data/testprint.ps",
599 "Test Print", num_options, options);
600 </pre>
601
602 <p>The <a href='#cupsPrintFiles'><code>cupsPrintFiles</code></a> function
603 creates a job with multiple files. The files are provided in a
604 <code>char *</code> array:</p>
605
606 <pre class='example'>
607 #include &lt;cups/cups.h&gt;
608
609 <a href='#cups_dest_t'>cups_dest_t</a> *dest;
610 int num_options;
611 <a href='#cups_option_t'>cups_option_t</a> *options;
612 int job_id;
613 char *files[3] = { "file1.pdf", "file2.pdf", "file3.pdf" };
614
615 /* Print three files */
616 job_id = <a href='#cupsPrintFiles'>cupsPrintFiles</a>(dest->name, 3, files, "Test Print", num_options, options);
617 </pre>
618
619 <p>Finally, the <a href='#cupsCreateJob'><code>cupsCreateJob</code></a>
620 function creates a new job with no files in it. Files are added using the
621 <a href='#cupsStartDocument'><code>cupsStartDocument</code></a>,
622 <a href='api-httpipp.html#cupsWriteRequestData'><code>cupsWriteRequestData</code></a>,
623 and <a href='#cupsFinishDocument'><code>cupsFinishDocument</code></a> functions.
624 The following example creates a job with 10 text files for printing:</p>
625
626 <pre class='example'>
627 #include &lt;cups/cups.h&gt;
628
629 <a href='#cups_dest_t'>cups_dest_t</a> *dest;
630 int num_options;
631 <a href='#cups_option_t'>cups_option_t</a> *options;
632 int job_id;
633 int i;
634 char buffer[1024];
635
636 /* Create the job */
637 job_id = <a href='#cupsCreateJob'>cupsCreateJob</a>(CUPS_HTTP_DEFAULT, dest->name, "10 Text Files",
638 num_options, options);
639
640 /* If the job is created, add 10 files */
641 if (job_id > 0)
642 {
643 for (i = 1; i &lt;= 10; i ++)
644 {
645 snprintf(buffer, sizeof(buffer), "file%d.txt", i);
646
647 <a href='#cupsStartDocument'>cupsStartDocument</a>(CUPS_HTTP_DEFAULT, dest->name, job_id, buffer,
648 CUPS_FORMAT_TEXT, i == 10);
649
650 snprintf(buffer, sizeof(buffer),
651 "File %d\n"
652 "\n"
653 "One fish,\n"
654 "Two fish,\n
655 "Red fish,\n
656 "Blue fish\n", i);
657
658 /* cupsWriteRequestData can be called as many times as needed */
659 <a href='#cupsWriteRequestData'>cupsWriteRequestData</a>(CUPS_HTTP_DEFAULT, buffer, strlen(buffer));
660
661 <a href='#cupsFinishDocument'>cupsFinishDocument</a>(CUPS_HTTP_DEFAULT, dest->name);
662 }
663 }
664 </pre>
665
666 <p>Once you have created a job, you can monitor its status using the
667 <a href='#cupsGetJobs'><code>cupsGetJobs</code></a> function, which returns
668 an array of <a href='#cups_job_t'><code>cups_job_t</code></a> structures.
669 Each contains the job ID (<code>id</code>), destination name
670 (<code>dest</code>), title (<code>title</code>), and other information
671 associated with the job. The job array is freed using the
672 <a href='#cupsFreeJobs'><code>cupsFreeJobs</code></a> function. The following
673 example monitors a specific job ID, showing the current job state once every
674 5 seconds until the job is completed:</p>
675
676 <pre class='example'>
677 #include &lt;cups/cups.h&gt;
678
679 <a href='#cups_dest_t'>cups_dest_t</a> *dest;
680 int job_id;
681 int num_jobs;
682 <a href='#cups_job_t'>cups_job_t</a> *jobs;
683 int i;
684 ipp_jstate_t job_state = IPP_JOB_PENDING;
685
686 while (job_state &lt; IPP_JOB_STOPPED)
687 {
688 /* Get my jobs (1) with any state (-1) */
689 num_jobs = <a href='#cupsGetJobs'>cupsGetJobs</a>(&amp;jobs, dest->name, 1, -1);
690
691 /* Loop to find my job */
692 job_state = IPP_JOB_COMPLETED;
693
694 for (i = 0; i &lt; num_jobs; i ++)
695 if (jobs[i].id == job_id)
696 {
697 job_state = jobs[i].state;
698 break;
699 }
700
701 /* Free the job array */
702 <a href='#cupsFreeJobs'>cupsFreeJobs</a>(num_jobs, jobs);
703
704 /* Show the current state */
705 switch (job_state)
706 {
707 case IPP_JOB_PENDING :
708 printf("Job %d is pending.\n", job_id);
709 break;
710 case IPP_JOB_HELD :
711 printf("Job %d is held.\n", job_id);
712 break;
713 case IPP_JOB_PROCESSING :
714 printf("Job %d is processing.\n", job_id);
715 break;
716 case IPP_JOB_STOPPED :
717 printf("Job %d is stopped.\n", job_id);
718 break;
719 case IPP_JOB_CANCELED :
720 printf("Job %d is canceled.\n", job_id);
721 break;
722 case IPP_JOB_ABORTED :
723 printf("Job %d is aborted.\n", job_id);
724 break;
725 case IPP_JOB_COMPLETED :
726 printf("Job %d is completed.\n", job_id);
727 break;
728 }
729
730 /* Sleep if the job is not finished */
731 if (job_state &lt; IPP_JOB_STOPPED)
732 sleep(5);
733 }
734 </pre>
735
736 <p>To cancel a job, use the
737 <a href='#cupsCancelJob'><code>cupsCancelJob</code></a> function with the
738 job ID:</p>
739
740 <pre class='example'>
741 #include &lt;cups/cups.h&gt;
742
743 <a href='#cups_dest_t'>cups_dest_t</a> *dest;
744 int job_id;
745
746 <a href='#cupsCancelJob'>cupsCancelJob</a>(dest->name, job_id);
747 </pre>
748
749 <h3><a name='ERROR_HANDLING'>Error Handling</a></h3>
750
751 <p>If any of the CUPS API printing functions returns an error, the reason for
752 that error can be found by calling the
753 <a href='#cupsLastError'><code>cupsLastError</code></a> and
754 <a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> functions.
755 <a href='#cupsLastError'><code>cupsLastError</code></a> returns the last IPP
756 error code
757 (<a href='api-httpipp.html#ipp_status_t'><code>ipp_status_t</code></a>)
758 that was encountered, while
759 <a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> returns
760 a (localized) human-readable string that can be shown to the user. For example,
761 if any of the job creation functions returns a job ID of 0, you can use
762 <a href='#cupsLastErrorString'><code>cupsLastErrorString</code></a> to show
763 the reason why the job could not be created:</p>
764
765 <pre class='example'>
766 #include &lt;cups/cups.h&gt;
767
768 int job_id;
769
770 if (job_id == 0)
771 puts(cupsLastErrorString());
772 </pre>
773
774 <h3><a name='PASSWORDS_AND_AUTHENTICATION'>Passwords and Authentication</a></h3>
775
776 <p>CUPS supports authentication of any request, including submission of print
777 jobs. The default mechanism for getting the username and password is to use the
778 login user and a password from the console.</p>
779
780 <p>To support other types of applications, in particular Graphical User
781 Interfaces ("GUIs"), the CUPS API provides functions to set the default
782 username and to register a callback function that returns a password string.</p>
783
784 <p>The <a href="#cupsSetPasswordCB"><code>cupsSetPasswordCB</code></a>
785 function is used to set a password callback in your program. Only one
786 function can be used at any time.</p>
787
788 <p>The <a href="#cupsSetUser"><code>cupsSetUser</code></a> function sets the
789 current username for authentication. This function can be called by your
790 password callback function to change the current username as needed.</p>
791
792 <p>The following example shows a simple password callback that gets a
793 username and password from the user:</p>
794
795 <pre class='example'>
796 #include &lt;cups/cups.h&gt;
797
798 const char *
799 my_password_cb(const char *prompt)
800 {
801 char user[65];
802
803
804 puts(prompt);
805
806 /* Get a username from the user */
807 printf("Username: ");
808 if (fgets(user, sizeof(user), stdin) == NULL)
809 return (NULL);
810
811 /* Strip the newline from the string and set the user */
812 user[strlen(user) - 1] = '\0';
813
814 <a href='#cupsSetUser'>cupsSetUser</a>(user);
815
816 /* Use getpass() to ask for the password... */
817 return (getpass("Password: "));
818 }
819
820 <a href='#cupsSetPasswordCB'>cupsSetPasswordCB</a>(my_password_cb);
821 </pre>
822
823 <p>Similarly, a GUI could display the prompt string in a window with input
824 fields for the username and password. The username should default to the
825 string returned by the <a href="#cupsUser"><code>cupsUser</code></a>
826 function.</p>
827 <h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
828 <h3 class="function"><a name="cupsAddDest">cupsAddDest</a></h3>
829 <p class="description">Add a destination to the list of destinations.</p>
830 <p class="code">
831 int cupsAddDest (<br>
832 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
833 &nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
834 &nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
835 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
836 );</p>
837 <h4 class="parameters">Parameters</h4>
838 <dl>
839 <dt>name</dt>
840 <dd class="description">Destination name</dd>
841 <dt>instance</dt>
842 <dd class="description">Instance name or <code>NULL</code> for none/primary</dd>
843 <dt>num_dests</dt>
844 <dd class="description">Number of destinations</dd>
845 <dt>dests</dt>
846 <dd class="description">Destinations</dd>
847 </dl>
848 <h4 class="returnvalue">Return Value</h4>
849 <p class="description">New number of destinations</p>
850 <h4 class="discussion">Discussion</h4>
851 <p class="discussion">This function cannot be used to add a new class or printer queue,
852 it only adds a new container of saved options for the named
853 destination or instance.<br>
854 <br>
855 If the named destination already exists, the destination list is
856 returned unchanged. Adding a new instance of a destination creates
857 a copy of that destination's options.<br>
858 <br>
859 Use the <a href="#cupsSaveDests"><code>cupsSaveDests</code></a> function to save the updated list of
860 destinations to the user's lpoptions file.</p>
861 <h3 class="function"><a name="cupsAddOption">cupsAddOption</a></h3>
862 <p class="description">Add an option to an option array.</p>
863 <p class="code">
864 int cupsAddOption (<br>
865 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
866 &nbsp;&nbsp;&nbsp;&nbsp;const char *value,<br>
867 &nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
868 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **options<br>
869 );</p>
870 <h4 class="parameters">Parameters</h4>
871 <dl>
872 <dt>name</dt>
873 <dd class="description">Name of option</dd>
874 <dt>value</dt>
875 <dd class="description">Value of option</dd>
876 <dt>num_options</dt>
877 <dd class="description">Number of options</dd>
878 <dt>options</dt>
879 <dd class="description">Pointer to options</dd>
880 </dl>
881 <h4 class="returnvalue">Return Value</h4>
882 <p class="description">Number of options</p>
883 <h4 class="discussion">Discussion</h4>
884 <p class="discussion">New option arrays can be initialized simply by passing 0 for the
885 &quot;num_options&quot; parameter.</p>
886 <h3 class="function"><a name="cupsCancelJob">cupsCancelJob</a></h3>
887 <p class="description">Cancel a print job on the default server.</p>
888 <p class="code">
889 int cupsCancelJob (<br>
890 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
891 &nbsp;&nbsp;&nbsp;&nbsp;int job_id<br>
892 );</p>
893 <h4 class="parameters">Parameters</h4>
894 <dl>
895 <dt>name</dt>
896 <dd class="description">Name of printer or class</dd>
897 <dt>job_id</dt>
898 <dd class="description">Job ID, <code>CUPS_JOBID_CURRENT</code> for the current job, or <code>CUPS_JOBID_ALL</code> for all jobs</dd>
899 </dl>
900 <h4 class="returnvalue">Return Value</h4>
901 <p class="description">1 on success, 0 on failure</p>
902 <h4 class="discussion">Discussion</h4>
903 <p class="discussion">Pass <code>CUPS_JOBID_ALL</code> to cancel all jobs or <code>CUPS_JOBID_CURRENT</code>
904 to cancel the current job on the named destination.<br>
905 <br>
906 Use the <a href="#cupsLastError"><code>cupsLastError</code></a> and <a href="#cupsLastErrorString"><code>cupsLastErrorString</code></a> functions to get
907 the cause of any failure.</p>
908 <h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsCancelJob2">cupsCancelJob2</a></h3>
909 <p class="description">Cancel or purge a print job.</p>
910 <p class="code">
911 ipp_status_t cupsCancelJob2 (<br>
912 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
913 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
914 &nbsp;&nbsp;&nbsp;&nbsp;int job_id,<br>
915 &nbsp;&nbsp;&nbsp;&nbsp;int purge<br>
916 );</p>
917 <h4 class="parameters">Parameters</h4>
918 <dl>
919 <dt>http</dt>
920 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
921 <dt>name</dt>
922 <dd class="description">Name of printer or class</dd>
923 <dt>job_id</dt>
924 <dd class="description">Job ID, <code>CUPS_JOBID_CURRENT</code> for the current job, or <code>CUPS_JOBID_ALL</code> for all jobs</dd>
925 <dt>purge</dt>
926 <dd class="description">1 to purge, 0 to cancel</dd>
927 </dl>
928 <h4 class="returnvalue">Return Value</h4>
929 <p class="description">IPP status</p>
930 <h4 class="discussion">Discussion</h4>
931 <p class="discussion">Canceled jobs remain in the job history while purged jobs are removed
932 from the job history.<br>
933 <br>
934 Pass <code>CUPS_JOBID_ALL</code> to cancel all jobs or <code>CUPS_JOBID_CURRENT</code>
935 to cancel the current job on the named destination.<br>
936 <br>
937 Use the <a href="#cupsLastError"><code>cupsLastError</code></a> and <a href="#cupsLastErrorString"><code>cupsLastErrorString</code></a> functions to get
938 the cause of any failure.
939
940 </p>
941 <h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsCreateJob">cupsCreateJob</a></h3>
942 <p class="description">Create an empty job for streaming.</p>
943 <p class="code">
944 int cupsCreateJob (<br>
945 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
946 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
947 &nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
948 &nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
949 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
950 );</p>
951 <h4 class="parameters">Parameters</h4>
952 <dl>
953 <dt>http</dt>
954 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
955 <dt>name</dt>
956 <dd class="description">Destination name</dd>
957 <dt>title</dt>
958 <dd class="description">Title of job</dd>
959 <dt>num_options</dt>
960 <dd class="description">Number of options</dd>
961 <dt>options</dt>
962 <dd class="description">Options</dd>
963 </dl>
964 <h4 class="returnvalue">Return Value</h4>
965 <p class="description">Job ID or 0 on error</p>
966 <h4 class="discussion">Discussion</h4>
967 <p class="discussion">Use this function when you want to stream print data using the
968 <a href="#cupsStartDocument"><code>cupsStartDocument</code></a>, <a href="#cupsWriteRequestData"><code>cupsWriteRequestData</code></a>, and
969 <a href="#cupsFinishDocument"><code>cupsFinishDocument</code></a> functions. If you have one or more files to
970 print, use the <a href="#cupsPrintFile2"><code>cupsPrintFile2</code></a> or <a href="#cupsPrintFiles2"><code>cupsPrintFiles2</code></a> function
971 instead.
972
973 </p>
974 <h3 class="function"><a name="cupsEncryption">cupsEncryption</a></h3>
975 <p class="description">Get the default encryption settings.</p>
976 <p class="code">
977 http_encryption_t cupsEncryption (void);</p>
978 <h4 class="returnvalue">Return Value</h4>
979 <p class="description">Encryption settings</p>
980 <h4 class="discussion">Discussion</h4>
981 <p class="discussion">The default encryption setting comes from the CUPS_ENCRYPTION
982 environment variable, then the ~/.cups/client.conf file, and finally the
983 /etc/cups/client.conf file. If not set, the default is
984 <code>HTTP_ENCRYPT_IF_REQUESTED</code>.</p>
985 <h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsFinishDocument">cupsFinishDocument</a></h3>
986 <p class="description">Finish sending a document.</p>
987 <p class="code">
988 ipp_status_t cupsFinishDocument (<br>
989 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
990 &nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
991 );</p>
992 <h4 class="parameters">Parameters</h4>
993 <dl>
994 <dt>http</dt>
995 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
996 <dt>name</dt>
997 <dd class="description">Destination name</dd>
998 </dl>
999 <h4 class="returnvalue">Return Value</h4>
1000 <p class="description">Status of document submission</p>
1001 <h4 class="discussion">Discussion</h4>
1002 <p class="discussion">The document must have been started using <a href="#cupsStartDocument"><code>cupsStartDocument</code></a>.
1003
1004 </p>
1005 <h3 class="function"><a name="cupsFreeDests">cupsFreeDests</a></h3>
1006 <p class="description">Free the memory used by the list of destinations.</p>
1007 <p class="code">
1008 void cupsFreeDests (<br>
1009 &nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1010 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
1011 );</p>
1012 <h4 class="parameters">Parameters</h4>
1013 <dl>
1014 <dt>num_dests</dt>
1015 <dd class="description">Number of destinations</dd>
1016 <dt>dests</dt>
1017 <dd class="description">Destinations</dd>
1018 </dl>
1019 <h3 class="function"><a name="cupsFreeJobs">cupsFreeJobs</a></h3>
1020 <p class="description">Free memory used by job data.</p>
1021 <p class="code">
1022 void cupsFreeJobs (<br>
1023 &nbsp;&nbsp;&nbsp;&nbsp;int num_jobs,<br>
1024 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_job_t">cups_job_t</a> *jobs<br>
1025 );</p>
1026 <h4 class="parameters">Parameters</h4>
1027 <dl>
1028 <dt>num_jobs</dt>
1029 <dd class="description">Number of jobs</dd>
1030 <dt>jobs</dt>
1031 <dd class="description">Jobs</dd>
1032 </dl>
1033 <h3 class="function"><a name="cupsFreeOptions">cupsFreeOptions</a></h3>
1034 <p class="description">Free all memory used by options.</p>
1035 <p class="code">
1036 void cupsFreeOptions (<br>
1037 &nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1038 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1039 );</p>
1040 <h4 class="parameters">Parameters</h4>
1041 <dl>
1042 <dt>num_options</dt>
1043 <dd class="description">Number of options</dd>
1044 <dt>options</dt>
1045 <dd class="description">Pointer to options</dd>
1046 </dl>
1047 <h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsGetClasses">cupsGetClasses</a></h3>
1048 <p class="description">Get a list of printer classes from the default server.</p>
1049 <p class="code">
1050 int cupsGetClasses (<br>
1051 &nbsp;&nbsp;&nbsp;&nbsp;char ***classes<br>
1052 );</p>
1053 <h4 class="parameters">Parameters</h4>
1054 <dl>
1055 <dt>classes</dt>
1056 <dd class="description">Classes</dd>
1057 </dl>
1058 <h4 class="returnvalue">Return Value</h4>
1059 <p class="description">Number of classes</p>
1060 <h4 class="discussion">Discussion</h4>
1061 <p class="discussion">This function is deprecated - use <a href="#cupsGetDests"><code>cupsGetDests</code></a> instead.
1062
1063 </p>
1064 <h3 class="function"><a name="cupsGetDefault">cupsGetDefault</a></h3>
1065 <p class="description">Get the default printer or class for the default server.</p>
1066 <p class="code">
1067 const char *cupsGetDefault (void);</p>
1068 <h4 class="returnvalue">Return Value</h4>
1069 <p class="description">Default printer or <code>NULL</code></p>
1070 <h4 class="discussion">Discussion</h4>
1071 <p class="discussion">This function returns the default printer or class as defined by
1072 the LPDEST or PRINTER environment variables. If these environment
1073 variables are not set, the server default destination is returned.
1074 Applications should use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> and <a href="#cupsGetDest"><code>cupsGetDest</code></a>
1075 functions to get the user-defined default printer, as this function does
1076 not support the lpoptions-defined default printer.</p>
1077 <h3 class="function"><span class="info">&nbsp;CUPS 1.1.21&nbsp;</span><a name="cupsGetDefault2">cupsGetDefault2</a></h3>
1078 <p class="description">Get the default printer or class for the specified server.</p>
1079 <p class="code">
1080 const char *cupsGetDefault2 (<br>
1081 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http<br>
1082 );</p>
1083 <h4 class="parameters">Parameters</h4>
1084 <dl>
1085 <dt>http</dt>
1086 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1087 </dl>
1088 <h4 class="returnvalue">Return Value</h4>
1089 <p class="description">Default printer or <code>NULL</code></p>
1090 <h4 class="discussion">Discussion</h4>
1091 <p class="discussion">This function returns the default printer or class as defined by
1092 the LPDEST or PRINTER environment variables. If these environment
1093 variables are not set, the server default destination is returned.
1094 Applications should use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> and <a href="#cupsGetDest"><code>cupsGetDest</code></a>
1095 functions to get the user-defined default printer, as this function does
1096 not support the lpoptions-defined default printer.
1097
1098 </p>
1099 <h3 class="function"><a name="cupsGetDest">cupsGetDest</a></h3>
1100 <p class="description">Get the named destination from the list.</p>
1101 <p class="code">
1102 <a href="#cups_dest_t">cups_dest_t</a> *cupsGetDest (<br>
1103 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1104 &nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
1105 &nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1106 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
1107 );</p>
1108 <h4 class="parameters">Parameters</h4>
1109 <dl>
1110 <dt>name</dt>
1111 <dd class="description">Destination name or <code>NULL</code> for the default destination</dd>
1112 <dt>instance</dt>
1113 <dd class="description">Instance name or <code>NULL</code></dd>
1114 <dt>num_dests</dt>
1115 <dd class="description">Number of destinations</dd>
1116 <dt>dests</dt>
1117 <dd class="description">Destinations</dd>
1118 </dl>
1119 <h4 class="returnvalue">Return Value</h4>
1120 <p class="description">Destination pointer or <code>NULL</code></p>
1121 <h4 class="discussion">Discussion</h4>
1122 <p class="discussion">Use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> or <a href="#cupsGetDests2"><code>cupsGetDests2</code></a> functions to get a
1123 list of supported destinations for the current user.</p>
1124 <h3 class="function"><a name="cupsGetDests">cupsGetDests</a></h3>
1125 <p class="description">Get the list of destinations from the default server.</p>
1126 <p class="code">
1127 int cupsGetDests (<br>
1128 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
1129 );</p>
1130 <h4 class="parameters">Parameters</h4>
1131 <dl>
1132 <dt>dests</dt>
1133 <dd class="description">Destinations</dd>
1134 </dl>
1135 <h4 class="returnvalue">Return Value</h4>
1136 <p class="description">Number of destinations</p>
1137 <h4 class="discussion">Discussion</h4>
1138 <p class="discussion">Starting with CUPS 1.2, the returned list of destinations include the
1139 printer-info, printer-is-accepting-jobs, printer-is-shared,
1140 printer-make-and-model, printer-state, printer-state-change-time,
1141 printer-state-reasons, and printer-type attributes as options.<br>
1142 <br>
1143 Use the <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> function to free the destination list and
1144 the <a href="#cupsGetDest"><code>cupsGetDest</code></a> function to find a particular destination.</p>
1145 <h3 class="function"><span class="info">&nbsp;CUPS 1.1.21&nbsp;</span><a name="cupsGetDests2">cupsGetDests2</a></h3>
1146 <p class="description">Get the list of destinations from the specified server.</p>
1147 <p class="code">
1148 int cupsGetDests2 (<br>
1149 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1150 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
1151 );</p>
1152 <h4 class="parameters">Parameters</h4>
1153 <dl>
1154 <dt>http</dt>
1155 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1156 <dt>dests</dt>
1157 <dd class="description">Destinations</dd>
1158 </dl>
1159 <h4 class="returnvalue">Return Value</h4>
1160 <p class="description">Number of destinations</p>
1161 <h4 class="discussion">Discussion</h4>
1162 <p class="discussion">Starting with CUPS 1.2, the returned list of destinations include the
1163 printer-info, printer-is-accepting-jobs, printer-is-shared,
1164 printer-make-and-model, printer-state, printer-state-change-time,
1165 printer-state-reasons, and printer-type attributes as options.<br>
1166 <br>
1167 Use the <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> function to free the destination list and
1168 the <a href="#cupsGetDest"><code>cupsGetDest</code></a> function to find a particular destination.
1169
1170 </p>
1171 <h3 class="function"><a name="cupsGetJobs">cupsGetJobs</a></h3>
1172 <p class="description">Get the jobs from the default server.</p>
1173 <p class="code">
1174 int cupsGetJobs (<br>
1175 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_job_t">cups_job_t</a> **jobs,<br>
1176 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1177 &nbsp;&nbsp;&nbsp;&nbsp;int myjobs,<br>
1178 &nbsp;&nbsp;&nbsp;&nbsp;int whichjobs<br>
1179 );</p>
1180 <h4 class="parameters">Parameters</h4>
1181 <dl>
1182 <dt>jobs</dt>
1183 <dd class="description">Job data</dd>
1184 <dt>name</dt>
1185 <dd class="description"><code>NULL</code> = all destinations, otherwise show jobs for named destination</dd>
1186 <dt>myjobs</dt>
1187 <dd class="description">0 = all users, 1 = mine</dd>
1188 <dt>whichjobs</dt>
1189 <dd class="description"><code>CUPS_WHICHJOBS_ALL</code>, <code>CUPS_WHICHJOBS_ACTIVE</code>, or <code>CUPS_WHICHJOBS_COMPLETED</code></dd>
1190 </dl>
1191 <h4 class="returnvalue">Return Value</h4>
1192 <p class="description">Number of jobs</p>
1193 <h4 class="discussion">Discussion</h4>
1194 <p class="discussion">A &quot;whichjobs&quot; value of <code>CUPS_WHICHJOBS_ALL</code> returns all jobs regardless
1195 of state, while <code>CUPS_WHICHJOBS_ACTIVE</code> returns jobs that are
1196 pending, processing, or held and <code>CUPS_WHICHJOBS_COMPLETED</code> returns
1197 jobs that are stopped, canceled, aborted, or completed.</p>
1198 <h3 class="function"><span class="info">&nbsp;CUPS 1.1.21&nbsp;</span><a name="cupsGetJobs2">cupsGetJobs2</a></h3>
1199 <p class="description">Get the jobs from the specified server.</p>
1200 <p class="code">
1201 int cupsGetJobs2 (<br>
1202 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1203 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_job_t">cups_job_t</a> **jobs,<br>
1204 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1205 &nbsp;&nbsp;&nbsp;&nbsp;int myjobs,<br>
1206 &nbsp;&nbsp;&nbsp;&nbsp;int whichjobs<br>
1207 );</p>
1208 <h4 class="parameters">Parameters</h4>
1209 <dl>
1210 <dt>http</dt>
1211 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1212 <dt>jobs</dt>
1213 <dd class="description">Job data</dd>
1214 <dt>name</dt>
1215 <dd class="description"><code>NULL</code> = all destinations, otherwise show jobs for named destination</dd>
1216 <dt>myjobs</dt>
1217 <dd class="description">0 = all users, 1 = mine</dd>
1218 <dt>whichjobs</dt>
1219 <dd class="description"><code>CUPS_WHICHJOBS_ALL</code>, <code>CUPS_WHICHJOBS_ACTIVE</code>, or <code>CUPS_WHICHJOBS_COMPLETED</code></dd>
1220 </dl>
1221 <h4 class="returnvalue">Return Value</h4>
1222 <p class="description">Number of jobs</p>
1223 <h4 class="discussion">Discussion</h4>
1224 <p class="discussion">A &quot;whichjobs&quot; value of <code>CUPS_WHICHJOBS_ALL</code> returns all jobs regardless
1225 of state, while <code>CUPS_WHICHJOBS_ACTIVE</code> returns jobs that are
1226 pending, processing, or held and <code>CUPS_WHICHJOBS_COMPLETED</code> returns
1227 jobs that are stopped, canceled, aborted, or completed.
1228
1229 </p>
1230 <h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsGetNamedDest">cupsGetNamedDest</a></h3>
1231 <p class="description">Get options for the named destination.</p>
1232 <p class="code">
1233 <a href="#cups_dest_t">cups_dest_t</a> *cupsGetNamedDest (<br>
1234 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1235 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1236 &nbsp;&nbsp;&nbsp;&nbsp;const char *instance<br>
1237 );</p>
1238 <h4 class="parameters">Parameters</h4>
1239 <dl>
1240 <dt>http</dt>
1241 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1242 <dt>name</dt>
1243 <dd class="description">Destination name or <code>NULL</code> for the default destination</dd>
1244 <dt>instance</dt>
1245 <dd class="description">Instance name or <code>NULL</code></dd>
1246 </dl>
1247 <h4 class="returnvalue">Return Value</h4>
1248 <p class="description">Destination or <code>NULL</code></p>
1249 <h4 class="discussion">Discussion</h4>
1250 <p class="discussion">This function is optimized for retrieving a single destination and should
1251 be used instead of <a href="#cupsGetDests"><code>cupsGetDests</code></a> and <a href="#cupsGetDest"><code>cupsGetDest</code></a> when you either
1252 know the name of the destination or want to print to the default destination.
1253 If <code>NULL</code> is returned, the destination does not exist or there is no
1254 default destination.<br>
1255 <br>
1256 If &quot;http&quot; is <code>CUPS_HTTP_DEFAULT</code>, the connection to the default print
1257 server will be used.<br>
1258 <br>
1259 If &quot;name&quot; is <code>NULL</code>, the default printer for the current user will be
1260 returned.<br>
1261 <br>
1262 The returned destination must be freed using <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> with a
1263 &quot;num_dests&quot; value of 1.
1264
1265 </p>
1266 <h3 class="function"><a name="cupsGetOption">cupsGetOption</a></h3>
1267 <p class="description">Get an option value.</p>
1268 <p class="code">
1269 const char *cupsGetOption (<br>
1270 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1271 &nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1272 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1273 );</p>
1274 <h4 class="parameters">Parameters</h4>
1275 <dl>
1276 <dt>name</dt>
1277 <dd class="description">Name of option</dd>
1278 <dt>num_options</dt>
1279 <dd class="description">Number of options</dd>
1280 <dt>options</dt>
1281 <dd class="description">Options</dd>
1282 </dl>
1283 <h4 class="returnvalue">Return Value</h4>
1284 <p class="description">Option value or <code>NULL</code></p>
1285 <h3 class="function"><a name="cupsGetPPD">cupsGetPPD</a></h3>
1286 <p class="description">Get the PPD file for a printer on the default server.</p>
1287 <p class="code">
1288 const char *cupsGetPPD (<br>
1289 &nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
1290 );</p>
1291 <h4 class="parameters">Parameters</h4>
1292 <dl>
1293 <dt>name</dt>
1294 <dd class="description">Destination name</dd>
1295 </dl>
1296 <h4 class="returnvalue">Return Value</h4>
1297 <p class="description">Filename for PPD file</p>
1298 <h4 class="discussion">Discussion</h4>
1299 <p class="discussion">For classes, <code>cupsGetPPD</code> returns the PPD file for the first printer
1300 in the class.<br>
1301 <br>
1302 The returned filename is stored in a static buffer and is overwritten with
1303 each call to <code>cupsGetPPD</code> or <a href="#cupsGetPPD2"><code>cupsGetPPD2</code></a>.</p>
1304 <h3 class="function"><span class="info">&nbsp;CUPS 1.1.21&nbsp;</span><a name="cupsGetPPD2">cupsGetPPD2</a></h3>
1305 <p class="description">Get the PPD file for a printer from the specified server.</p>
1306 <p class="code">
1307 const char *cupsGetPPD2 (<br>
1308 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1309 &nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
1310 );</p>
1311 <h4 class="parameters">Parameters</h4>
1312 <dl>
1313 <dt>http</dt>
1314 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1315 <dt>name</dt>
1316 <dd class="description">Destination name</dd>
1317 </dl>
1318 <h4 class="returnvalue">Return Value</h4>
1319 <p class="description">Filename for PPD file</p>
1320 <h4 class="discussion">Discussion</h4>
1321 <p class="discussion">For classes, <code>cupsGetPPD2</code> returns the PPD file for the first printer
1322 in the class.<br>
1323 <br>
1324 The returned filename is stored in a static buffer and is overwritten with
1325 each call to <a href="#cupsGetPPD"><code>cupsGetPPD</code></a> or <code>cupsGetPPD2</code>.
1326
1327 </p>
1328 <h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsGetPPD3">cupsGetPPD3</a></h3>
1329 <p class="description">Get the PPD file for a printer on the specified
1330 server if it has changed.</p>
1331 <p class="code">
1332 http_status_t cupsGetPPD3 (<br>
1333 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1334 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1335 &nbsp;&nbsp;&nbsp;&nbsp;time_t *modtime,<br>
1336 &nbsp;&nbsp;&nbsp;&nbsp;char *buffer,<br>
1337 &nbsp;&nbsp;&nbsp;&nbsp;size_t bufsize<br>
1338 );</p>
1339 <h4 class="parameters">Parameters</h4>
1340 <dl>
1341 <dt>http</dt>
1342 <dd class="description">HTTP connection or <code>CUPS_HTTP_DEFAULT</code></dd>
1343 <dt>name</dt>
1344 <dd class="description">Destination name</dd>
1345 <dt>modtime</dt>
1346 <dd class="description">Modification time</dd>
1347 <dt>buffer</dt>
1348 <dd class="description">Filename buffer</dd>
1349 <dt>bufsize</dt>
1350 <dd class="description">Size of filename buffer</dd>
1351 </dl>
1352 <h4 class="returnvalue">Return Value</h4>
1353 <p class="description">HTTP status</p>
1354 <h4 class="discussion">Discussion</h4>
1355 <p class="discussion">The &quot;modtime&quot; parameter contains the modification time of any
1356 locally-cached content and is updated with the time from the PPD file on
1357 the server.<br>
1358 <br>
1359 The &quot;buffer&quot; parameter contains the local PPD filename. If it contains
1360 the empty string, a new temporary file is created, otherwise the existing
1361 file will be overwritten as needed.<br>
1362 <br>
1363 On success, <code>HTTP_OK</code> is returned for a new PPD file and
1364 <code>HTTP_NOT_MODIFIED</code> if the existing PPD file is up-to-date. Any other
1365 status is an error.<br>
1366 <br>
1367 For classes, <code>cupsGetPPD3</code> returns the PPD file for the first printer
1368 in the class.
1369
1370 </p>
1371 <h3 class="function"><a name="cupsGetPassword">cupsGetPassword</a></h3>
1372 <p class="description">Get a password from the user.</p>
1373 <p class="code">
1374 const char *cupsGetPassword (<br>
1375 &nbsp;&nbsp;&nbsp;&nbsp;const char *prompt<br>
1376 );</p>
1377 <h4 class="parameters">Parameters</h4>
1378 <dl>
1379 <dt>prompt</dt>
1380 <dd class="description">Prompt string</dd>
1381 </dl>
1382 <h4 class="returnvalue">Return Value</h4>
1383 <p class="description">Password</p>
1384 <h4 class="discussion">Discussion</h4>
1385 <p class="discussion">Uses the current password callback function. Returns <code>NULL</code> if the
1386 user does not provide a password.</p>
1387 <h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsGetPrinters">cupsGetPrinters</a></h3>
1388 <p class="description">Get a list of printers from the default server.</p>
1389 <p class="code">
1390 int cupsGetPrinters (<br>
1391 &nbsp;&nbsp;&nbsp;&nbsp;char ***printers<br>
1392 );</p>
1393 <h4 class="parameters">Parameters</h4>
1394 <dl>
1395 <dt>printers</dt>
1396 <dd class="description">Printers</dd>
1397 </dl>
1398 <h4 class="returnvalue">Return Value</h4>
1399 <p class="description">Number of printers</p>
1400 <h4 class="discussion">Discussion</h4>
1401 <p class="discussion">This function is deprecated - use <a href="#cupsGetDests"><code>cupsGetDests</code></a> instead.
1402
1403 </p>
1404 <h3 class="function"><span class="info">&nbsp;CUPS 1.3&nbsp;</span><a name="cupsGetServerPPD">cupsGetServerPPD</a></h3>
1405 <p class="description">Get an available PPD file from the server.</p>
1406 <p class="code">
1407 char *cupsGetServerPPD (<br>
1408 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1409 &nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
1410 );</p>
1411 <h4 class="parameters">Parameters</h4>
1412 <dl>
1413 <dt>http</dt>
1414 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1415 <dt>name</dt>
1416 <dd class="description">Name of PPD file (&quot;ppd-name&quot;)</dd>
1417 </dl>
1418 <h4 class="returnvalue">Return Value</h4>
1419 <p class="description">Name of PPD file or <code>NULL</code> on error</p>
1420 <h4 class="discussion">Discussion</h4>
1421 <p class="discussion">This function returns the named PPD file from the server. The
1422 list of available PPDs is provided by the IPP <code>CUPS_GET_PPDS</code>
1423 operation.<br>
1424 <br>
1425 You must remove (unlink) the PPD file when you are finished with
1426 it. The PPD filename is stored in a static location that will be
1427 overwritten on the next call to <a href="#cupsGetPPD"><code>cupsGetPPD</code></a>, <a href="#cupsGetPPD2"><code>cupsGetPPD2</code></a>,
1428 or <a href="#cupsGetServerPPD"><code>cupsGetServerPPD</code></a>.
1429
1430 </p>
1431 <h3 class="function"><a name="cupsLangDefault">cupsLangDefault</a></h3>
1432 <p class="description">Return the default language.</p>
1433 <p class="code">
1434 cups_lang_t *cupsLangDefault (void);</p>
1435 <h4 class="returnvalue">Return Value</h4>
1436 <p class="description">Language data</p>
1437 <h3 class="function"><a name="cupsLangEncoding">cupsLangEncoding</a></h3>
1438 <p class="description">Return the character encoding (us-ascii, etc.)
1439 for the given language.</p>
1440 <p class="code">
1441 const char *cupsLangEncoding (<br>
1442 &nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang<br>
1443 );</p>
1444 <h4 class="parameters">Parameters</h4>
1445 <dl>
1446 <dt>lang</dt>
1447 <dd class="description">Language data</dd>
1448 </dl>
1449 <h4 class="returnvalue">Return Value</h4>
1450 <p class="description">Character encoding</p>
1451 <h3 class="function"><a name="cupsLangFlush">cupsLangFlush</a></h3>
1452 <p class="description">Flush all language data out of the cache.</p>
1453 <p class="code">
1454 void cupsLangFlush (void);</p>
1455 <h3 class="function"><a name="cupsLangFree">cupsLangFree</a></h3>
1456 <p class="description">Free language data.</p>
1457 <p class="code">
1458 void cupsLangFree (<br>
1459 &nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang<br>
1460 );</p>
1461 <h4 class="parameters">Parameters</h4>
1462 <dl>
1463 <dt>lang</dt>
1464 <dd class="description">Language to free</dd>
1465 </dl>
1466 <h4 class="discussion">Discussion</h4>
1467 <p class="discussion">This does not actually free anything; use <a href="#cupsLangFlush"><code>cupsLangFlush</code></a> for that.</p>
1468 <h3 class="function"><a name="cupsLangGet">cupsLangGet</a></h3>
1469 <p class="description">Get a language.</p>
1470 <p class="code">
1471 cups_lang_t *cupsLangGet (<br>
1472 &nbsp;&nbsp;&nbsp;&nbsp;const char *language<br>
1473 );</p>
1474 <h4 class="parameters">Parameters</h4>
1475 <dl>
1476 <dt>language</dt>
1477 <dd class="description">Language or locale</dd>
1478 </dl>
1479 <h4 class="returnvalue">Return Value</h4>
1480 <p class="description">Language data</p>
1481 <h3 class="function"><a name="cupsLastError">cupsLastError</a></h3>
1482 <p class="description">Return the last IPP status code.</p>
1483 <p class="code">
1484 ipp_status_t cupsLastError (void);</p>
1485 <h4 class="returnvalue">Return Value</h4>
1486 <p class="description">IPP status code from last request</p>
1487 <h3 class="function"><span class="info">&nbsp;CUPS 1.2&nbsp;</span><a name="cupsLastErrorString">cupsLastErrorString</a></h3>
1488 <p class="description">Return the last IPP status-message.</p>
1489 <p class="code">
1490 const char *cupsLastErrorString (void);</p>
1491 <h4 class="returnvalue">Return Value</h4>
1492 <p class="description">status-message text from last request</p>
1493 <h3 class="function"><span class="info">&nbsp;CUPS 1.2&nbsp;</span><a name="cupsNotifySubject">cupsNotifySubject</a></h3>
1494 <p class="description">Return the subject for the given notification message.</p>
1495 <p class="code">
1496 char *cupsNotifySubject (<br>
1497 &nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang,<br>
1498 &nbsp;&nbsp;&nbsp;&nbsp;ipp_t *event<br>
1499 );</p>
1500 <h4 class="parameters">Parameters</h4>
1501 <dl>
1502 <dt>lang</dt>
1503 <dd class="description">Language data</dd>
1504 <dt>event</dt>
1505 <dd class="description">Event data</dd>
1506 </dl>
1507 <h4 class="returnvalue">Return Value</h4>
1508 <p class="description">Subject string or <code>NULL</code></p>
1509 <h4 class="discussion">Discussion</h4>
1510 <p class="discussion">The returned string must be freed by the caller using <code>free</code>.
1511
1512 </p>
1513 <h3 class="function"><span class="info">&nbsp;CUPS 1.2&nbsp;</span><a name="cupsNotifyText">cupsNotifyText</a></h3>
1514 <p class="description">Return the text for the given notification message.</p>
1515 <p class="code">
1516 char *cupsNotifyText (<br>
1517 &nbsp;&nbsp;&nbsp;&nbsp;cups_lang_t *lang,<br>
1518 &nbsp;&nbsp;&nbsp;&nbsp;ipp_t *event<br>
1519 );</p>
1520 <h4 class="parameters">Parameters</h4>
1521 <dl>
1522 <dt>lang</dt>
1523 <dd class="description">Language data</dd>
1524 <dt>event</dt>
1525 <dd class="description">Event data</dd>
1526 </dl>
1527 <h4 class="returnvalue">Return Value</h4>
1528 <p class="description">Message text or <code>NULL</code></p>
1529 <h4 class="discussion">Discussion</h4>
1530 <p class="discussion">The returned string must be freed by the caller using <code>free</code>.
1531
1532 </p>
1533 <h3 class="function"><a name="cupsParseOptions">cupsParseOptions</a></h3>
1534 <p class="description">Parse options from a command-line argument.</p>
1535 <p class="code">
1536 int cupsParseOptions (<br>
1537 &nbsp;&nbsp;&nbsp;&nbsp;const char *arg,<br>
1538 &nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1539 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **options<br>
1540 );</p>
1541 <h4 class="parameters">Parameters</h4>
1542 <dl>
1543 <dt>arg</dt>
1544 <dd class="description">Argument to parse</dd>
1545 <dt>num_options</dt>
1546 <dd class="description">Number of options</dd>
1547 <dt>options</dt>
1548 <dd class="description">Options found</dd>
1549 </dl>
1550 <h4 class="returnvalue">Return Value</h4>
1551 <p class="description">Number of options found</p>
1552 <h4 class="discussion">Discussion</h4>
1553 <p class="discussion">This function converts space-delimited name/value pairs according
1554 to the PAPI text option ABNF specification. Collection values
1555 (&quot;name={a=... b=... c=...}&quot;) are stored with the curley brackets
1556 intact - use <code>cupsParseOptions</code> on the value to extract the
1557 collection attributes.</p>
1558 <h3 class="function"><a name="cupsPrintFile">cupsPrintFile</a></h3>
1559 <p class="description">Print a file to a printer or class on the default server.</p>
1560 <p class="code">
1561 int cupsPrintFile (<br>
1562 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1563 &nbsp;&nbsp;&nbsp;&nbsp;const char *filename,<br>
1564 &nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1565 &nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1566 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1567 );</p>
1568 <h4 class="parameters">Parameters</h4>
1569 <dl>
1570 <dt>name</dt>
1571 <dd class="description">Destination name</dd>
1572 <dt>filename</dt>
1573 <dd class="description">File to print</dd>
1574 <dt>title</dt>
1575 <dd class="description">Title of job</dd>
1576 <dt>num_options</dt>
1577 <dd class="description">Number of options</dd>
1578 <dt>options</dt>
1579 <dd class="description">Options</dd>
1580 </dl>
1581 <h4 class="returnvalue">Return Value</h4>
1582 <p class="description">Job ID or 0 on error</p>
1583 <h3 class="function"><span class="info">&nbsp;CUPS 1.1.21&nbsp;</span><a name="cupsPrintFile2">cupsPrintFile2</a></h3>
1584 <p class="description">Print a file to a printer or class on the specified
1585 server.</p>
1586 <p class="code">
1587 int cupsPrintFile2 (<br>
1588 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1589 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1590 &nbsp;&nbsp;&nbsp;&nbsp;const char *filename,<br>
1591 &nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1592 &nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1593 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1594 );</p>
1595 <h4 class="parameters">Parameters</h4>
1596 <dl>
1597 <dt>http</dt>
1598 <dd class="description">Connection to server</dd>
1599 <dt>name</dt>
1600 <dd class="description">Destination name</dd>
1601 <dt>filename</dt>
1602 <dd class="description">File to print</dd>
1603 <dt>title</dt>
1604 <dd class="description">Title of job</dd>
1605 <dt>num_options</dt>
1606 <dd class="description">Number of options</dd>
1607 <dt>options</dt>
1608 <dd class="description">Options</dd>
1609 </dl>
1610 <h4 class="returnvalue">Return Value</h4>
1611 <p class="description">Job ID or 0 on error</p>
1612 <h3 class="function"><a name="cupsPrintFiles">cupsPrintFiles</a></h3>
1613 <p class="description">Print one or more files to a printer or class on the
1614 default server.</p>
1615 <p class="code">
1616 int cupsPrintFiles (<br>
1617 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1618 &nbsp;&nbsp;&nbsp;&nbsp;int num_files,<br>
1619 &nbsp;&nbsp;&nbsp;&nbsp;const char **files,<br>
1620 &nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1621 &nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1622 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1623 );</p>
1624 <h4 class="parameters">Parameters</h4>
1625 <dl>
1626 <dt>name</dt>
1627 <dd class="description">Destination name</dd>
1628 <dt>num_files</dt>
1629 <dd class="description">Number of files</dd>
1630 <dt>files</dt>
1631 <dd class="description">File(s) to print</dd>
1632 <dt>title</dt>
1633 <dd class="description">Title of job</dd>
1634 <dt>num_options</dt>
1635 <dd class="description">Number of options</dd>
1636 <dt>options</dt>
1637 <dd class="description">Options</dd>
1638 </dl>
1639 <h4 class="returnvalue">Return Value</h4>
1640 <p class="description">Job ID or 0 on error</p>
1641 <h3 class="function"><span class="info">&nbsp;CUPS 1.1.21&nbsp;</span><a name="cupsPrintFiles2">cupsPrintFiles2</a></h3>
1642 <p class="description">Print one or more files to a printer or class on the
1643 specified server.</p>
1644 <p class="code">
1645 int cupsPrintFiles2 (<br>
1646 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1647 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1648 &nbsp;&nbsp;&nbsp;&nbsp;int num_files,<br>
1649 &nbsp;&nbsp;&nbsp;&nbsp;const char **files,<br>
1650 &nbsp;&nbsp;&nbsp;&nbsp;const char *title,<br>
1651 &nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1652 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options<br>
1653 );</p>
1654 <h4 class="parameters">Parameters</h4>
1655 <dl>
1656 <dt>http</dt>
1657 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1658 <dt>name</dt>
1659 <dd class="description">Destination name</dd>
1660 <dt>num_files</dt>
1661 <dd class="description">Number of files</dd>
1662 <dt>files</dt>
1663 <dd class="description">File(s) to print</dd>
1664 <dt>title</dt>
1665 <dd class="description">Title of job</dd>
1666 <dt>num_options</dt>
1667 <dd class="description">Number of options</dd>
1668 <dt>options</dt>
1669 <dd class="description">Options</dd>
1670 </dl>
1671 <h4 class="returnvalue">Return Value</h4>
1672 <p class="description">Job ID or 0 on error</p>
1673 <h3 class="function"><span class="info">&nbsp;CUPS 1.3&nbsp;</span><a name="cupsRemoveDest">cupsRemoveDest</a></h3>
1674 <p class="description">Remove a destination from the destination list.</p>
1675 <p class="code">
1676 int cupsRemoveDest (<br>
1677 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1678 &nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
1679 &nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1680 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> **dests<br>
1681 );</p>
1682 <h4 class="parameters">Parameters</h4>
1683 <dl>
1684 <dt>name</dt>
1685 <dd class="description">Destination name</dd>
1686 <dt>instance</dt>
1687 <dd class="description">Instance name or <code>NULL</code></dd>
1688 <dt>num_dests</dt>
1689 <dd class="description">Number of destinations</dd>
1690 <dt>dests</dt>
1691 <dd class="description">Destinations</dd>
1692 </dl>
1693 <h4 class="returnvalue">Return Value</h4>
1694 <p class="description">New number of destinations</p>
1695 <h4 class="discussion">Discussion</h4>
1696 <p class="discussion">Removing a destination/instance does not delete the class or printer
1697 queue, merely the lpoptions for that destination/instance. Use the
1698 <a href="#cupsSetDests"><code>cupsSetDests</code></a> or <a href="#cupsSetDests2"><code>cupsSetDests2</code></a> functions to save the new
1699 options for the user.
1700
1701 </p>
1702 <h3 class="function"><span class="info">&nbsp;CUPS 1.2&nbsp;</span><a name="cupsRemoveOption">cupsRemoveOption</a></h3>
1703 <p class="description">Remove an option from an option array.</p>
1704 <p class="code">
1705 int cupsRemoveOption (<br>
1706 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1707 &nbsp;&nbsp;&nbsp;&nbsp;int num_options,<br>
1708 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> **options<br>
1709 );</p>
1710 <h4 class="parameters">Parameters</h4>
1711 <dl>
1712 <dt>name</dt>
1713 <dd class="description">Option name</dd>
1714 <dt>num_options</dt>
1715 <dd class="description">Current number of options</dd>
1716 <dt>options</dt>
1717 <dd class="description">Options</dd>
1718 </dl>
1719 <h4 class="returnvalue">Return Value</h4>
1720 <p class="description">New number of options</p>
1721 <h3 class="function"><a name="cupsServer">cupsServer</a></h3>
1722 <p class="description">Return the hostname/address of the default server.</p>
1723 <p class="code">
1724 const char *cupsServer (void);</p>
1725 <h4 class="returnvalue">Return Value</h4>
1726 <p class="description">Server name</p>
1727 <h4 class="discussion">Discussion</h4>
1728 <p class="discussion">The returned value can be a fully-qualified hostname, a numeric
1729 IPv4 or IPv6 address, or a domain socket pathname.</p>
1730 <h3 class="function"><span class="info">&nbsp;CUPS 1.3&nbsp;</span><a name="cupsSetDefaultDest">cupsSetDefaultDest</a></h3>
1731 <p class="description">Set the default destination.</p>
1732 <p class="code">
1733 void cupsSetDefaultDest (<br>
1734 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1735 &nbsp;&nbsp;&nbsp;&nbsp;const char *instance,<br>
1736 &nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1737 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
1738 );</p>
1739 <h4 class="parameters">Parameters</h4>
1740 <dl>
1741 <dt>name</dt>
1742 <dd class="description">Destination name</dd>
1743 <dt>instance</dt>
1744 <dd class="description">Instance name or <code>NULL</code></dd>
1745 <dt>num_dests</dt>
1746 <dd class="description">Number of destinations</dd>
1747 <dt>dests</dt>
1748 <dd class="description">Destinations</dd>
1749 </dl>
1750 <h3 class="function"><a name="cupsSetDests">cupsSetDests</a></h3>
1751 <p class="description">Save the list of destinations for the default server.</p>
1752 <p class="code">
1753 void cupsSetDests (<br>
1754 &nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1755 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
1756 );</p>
1757 <h4 class="parameters">Parameters</h4>
1758 <dl>
1759 <dt>num_dests</dt>
1760 <dd class="description">Number of destinations</dd>
1761 <dt>dests</dt>
1762 <dd class="description">Destinations</dd>
1763 </dl>
1764 <h4 class="discussion">Discussion</h4>
1765 <p class="discussion">This function saves the destinations to /etc/cups/lpoptions when run
1766 as root and ~/.cups/lpoptions when run as a normal user.</p>
1767 <h3 class="function"><span class="info">&nbsp;CUPS 1.1.21&nbsp;</span><a name="cupsSetDests2">cupsSetDests2</a></h3>
1768 <p class="description">Save the list of destinations for the specified server.</p>
1769 <p class="code">
1770 int cupsSetDests2 (<br>
1771 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1772 &nbsp;&nbsp;&nbsp;&nbsp;int num_dests,<br>
1773 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_dest_t">cups_dest_t</a> *dests<br>
1774 );</p>
1775 <h4 class="parameters">Parameters</h4>
1776 <dl>
1777 <dt>http</dt>
1778 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1779 <dt>num_dests</dt>
1780 <dd class="description">Number of destinations</dd>
1781 <dt>dests</dt>
1782 <dd class="description">Destinations</dd>
1783 </dl>
1784 <h4 class="returnvalue">Return Value</h4>
1785 <p class="description">0 on success, -1 on error</p>
1786 <h4 class="discussion">Discussion</h4>
1787 <p class="discussion">This function saves the destinations to /etc/cups/lpoptions when run
1788 as root and ~/.cups/lpoptions when run as a normal user.
1789
1790 </p>
1791 <h3 class="function"><a name="cupsSetEncryption">cupsSetEncryption</a></h3>
1792 <p class="description">Set the encryption preference.</p>
1793 <p class="code">
1794 void cupsSetEncryption (<br>
1795 &nbsp;&nbsp;&nbsp;&nbsp;http_encryption_t e<br>
1796 );</p>
1797 <h4 class="parameters">Parameters</h4>
1798 <dl>
1799 <dt>e</dt>
1800 <dd class="description">New encryption preference</dd>
1801 </dl>
1802 <h3 class="function"><a name="cupsSetPasswordCB">cupsSetPasswordCB</a></h3>
1803 <p class="description">Set the password callback for CUPS.</p>
1804 <p class="code">
1805 void cupsSetPasswordCB (<br>
1806 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_password_cb_t">cups_password_cb_t</a> cb<br>
1807 );</p>
1808 <h4 class="parameters">Parameters</h4>
1809 <dl>
1810 <dt>cb</dt>
1811 <dd class="description">Callback function</dd>
1812 </dl>
1813 <h4 class="discussion">Discussion</h4>
1814 <p class="discussion">Pass <code>NULL</code> to restore the default (console) password callback.</p>
1815 <h3 class="function"><a name="cupsSetServer">cupsSetServer</a></h3>
1816 <p class="description">Set the default server name.</p>
1817 <p class="code">
1818 void cupsSetServer (<br>
1819 &nbsp;&nbsp;&nbsp;&nbsp;const char *server<br>
1820 );</p>
1821 <h4 class="parameters">Parameters</h4>
1822 <dl>
1823 <dt>server</dt>
1824 <dd class="description">Server name</dd>
1825 </dl>
1826 <h4 class="discussion">Discussion</h4>
1827 <p class="discussion">The &quot;server&quot; string can be a fully-qualified hostname, a numeric
1828 IPv4 or IPv6 address, or a domain socket pathname. Pass <code>NULL</code> to
1829 restore the default server name.</p>
1830 <h3 class="function"><a name="cupsSetUser">cupsSetUser</a></h3>
1831 <p class="description">Set the default user name.</p>
1832 <p class="code">
1833 void cupsSetUser (<br>
1834 &nbsp;&nbsp;&nbsp;&nbsp;const char *user<br>
1835 );</p>
1836 <h4 class="parameters">Parameters</h4>
1837 <dl>
1838 <dt>user</dt>
1839 <dd class="description">User name</dd>
1840 </dl>
1841 <h4 class="discussion">Discussion</h4>
1842 <p class="discussion">Pass <code>NULL</code> to restore the default user name.</p>
1843 <h3 class="function"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cupsStartDocument">cupsStartDocument</a></h3>
1844 <p class="description">Add a document to a job created with cupsCreateJob().</p>
1845 <p class="code">
1846 http_status_t cupsStartDocument (<br>
1847 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
1848 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
1849 &nbsp;&nbsp;&nbsp;&nbsp;int job_id,<br>
1850 &nbsp;&nbsp;&nbsp;&nbsp;const char *docname,<br>
1851 &nbsp;&nbsp;&nbsp;&nbsp;const char *format,<br>
1852 &nbsp;&nbsp;&nbsp;&nbsp;int last_document<br>
1853 );</p>
1854 <h4 class="parameters">Parameters</h4>
1855 <dl>
1856 <dt>http</dt>
1857 <dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
1858 <dt>name</dt>
1859 <dd class="description">Destination name</dd>
1860 <dt>job_id</dt>
1861 <dd class="description">Job ID from <a href="#cupsCreateJob"><code>cupsCreateJob</code></a></dd>
1862 <dt>docname</dt>
1863 <dd class="description">Name of document</dd>
1864 <dt>format</dt>
1865 <dd class="description">MIME type or <code>CUPS_FORMAT_foo</code></dd>
1866 <dt>last_document</dt>
1867 <dd class="description">1 for last document in job, 0 otherwise</dd>
1868 </dl>
1869 <h4 class="returnvalue">Return Value</h4>
1870 <p class="description">HTTP status of request</p>
1871 <h4 class="discussion">Discussion</h4>
1872 <p class="discussion">Use <a href="#cupsWriteRequestData"><code>cupsWriteRequestData</code></a> to write data for the document and
1873 <a href="#cupsFinishDocument"><code>cupsFinishDocument</code></a> to finish the document and get the submission status.<br>
1874 <br>
1875 The MIME type constants <code>CUPS_FORMAT_AUTO</code>, <code>CUPS_FORMAT_PDF</code>,
1876 <code>CUPS_FORMAT_POSTSCRIPT</code>, <code>CUPS_FORMAT_RAW</code>, and
1877 <code>CUPS_FORMAT_TEXT</code> are provided for the &quot;format&quot; argument, although
1878 any supported MIME type string can be supplied.
1879
1880 </p>
1881 <h3 class="function"><a name="cupsTempFd">cupsTempFd</a></h3>
1882 <p class="description">Creates a temporary file.</p>
1883 <p class="code">
1884 int cupsTempFd (<br>
1885 &nbsp;&nbsp;&nbsp;&nbsp;char *filename,<br>
1886 &nbsp;&nbsp;&nbsp;&nbsp;int len<br>
1887 );</p>
1888 <h4 class="parameters">Parameters</h4>
1889 <dl>
1890 <dt>filename</dt>
1891 <dd class="description">Pointer to buffer</dd>
1892 <dt>len</dt>
1893 <dd class="description">Size of buffer</dd>
1894 </dl>
1895 <h4 class="returnvalue">Return Value</h4>
1896 <p class="description">New file descriptor or -1 on error</p>
1897 <h4 class="discussion">Discussion</h4>
1898 <p class="discussion">The temporary filename is returned in the filename buffer.
1899 The temporary file is opened for reading and writing.</p>
1900 <h3 class="function"><span class="info">&nbsp;DEPRECATED&nbsp;</span><a name="cupsTempFile">cupsTempFile</a></h3>
1901 <p class="description">Generates a temporary filename.</p>
1902 <p class="code">
1903 char *cupsTempFile (<br>
1904 &nbsp;&nbsp;&nbsp;&nbsp;char *filename,<br>
1905 &nbsp;&nbsp;&nbsp;&nbsp;int len<br>
1906 );</p>
1907 <h4 class="parameters">Parameters</h4>
1908 <dl>
1909 <dt>filename</dt>
1910 <dd class="description">Pointer to buffer</dd>
1911 <dt>len</dt>
1912 <dd class="description">Size of buffer</dd>
1913 </dl>
1914 <h4 class="returnvalue">Return Value</h4>
1915 <p class="description">Filename or <code>NULL</code> on error</p>
1916 <h4 class="discussion">Discussion</h4>
1917 <p class="discussion">The temporary filename is returned in the filename buffer.
1918 This function is deprecated - use <a href="#cupsTempFd"><code>cupsTempFd</code></a> or
1919 <a href="#cupsTempFile2"><code>cupsTempFile2</code></a> instead.
1920
1921 </p>
1922 <h3 class="function"><span class="info">&nbsp;CUPS 1.2&nbsp;</span><a name="cupsTempFile2">cupsTempFile2</a></h3>
1923 <p class="description">Creates a temporary CUPS file.</p>
1924 <p class="code">
1925 cups_file_t *cupsTempFile2 (<br>
1926 &nbsp;&nbsp;&nbsp;&nbsp;char *filename,<br>
1927 &nbsp;&nbsp;&nbsp;&nbsp;int len<br>
1928 );</p>
1929 <h4 class="parameters">Parameters</h4>
1930 <dl>
1931 <dt>filename</dt>
1932 <dd class="description">Pointer to buffer</dd>
1933 <dt>len</dt>
1934 <dd class="description">Size of buffer</dd>
1935 </dl>
1936 <h4 class="returnvalue">Return Value</h4>
1937 <p class="description">CUPS file or <code>NULL</code> on error</p>
1938 <h4 class="discussion">Discussion</h4>
1939 <p class="discussion">The temporary filename is returned in the filename buffer.
1940 The temporary file is opened for writing.
1941
1942 </p>
1943 <h3 class="function"><a name="cupsUser">cupsUser</a></h3>
1944 <p class="description">Return the current user's name.</p>
1945 <p class="code">
1946 const char *cupsUser (void);</p>
1947 <h4 class="returnvalue">Return Value</h4>
1948 <p class="description">User name</p>
1949 <h2 class="title"><a name="TYPES">Data Types</a></h2>
1950 <h3 class="typedef"><a name="cups_dest_t">cups_dest_t</a></h3>
1951 <p class="description">Destination</p>
1952 <p class="code">
1953 typedef struct <a href="#cups_dest_s">cups_dest_s</a> cups_dest_t;
1954 </p>
1955 <h3 class="typedef"><span class="info">&nbsp;CUPS 1.4&nbsp;</span><a name="cups_device_cb_t">cups_device_cb_t</a></h3>
1956 <p class="description">Device callback </p>
1957 <p class="code">
1958 typedef void (*cups_device_cb_t)(const char *device_class, const char *device_id, const char *device_info, const char *device_make_and_model, const char *device_uri, const char *device_location, void *user_data);
1959 </p>
1960 <h3 class="typedef"><a name="cups_job_t">cups_job_t</a></h3>
1961 <p class="description">Job</p>
1962 <p class="code">
1963 typedef struct <a href="#cups_job_s">cups_job_s</a> cups_job_t;
1964 </p>
1965 <h3 class="typedef"><a name="cups_option_t">cups_option_t</a></h3>
1966 <p class="description">Printer Options</p>
1967 <p class="code">
1968 typedef struct <a href="#cups_option_s">cups_option_s</a> cups_option_t;
1969 </p>
1970 <h3 class="typedef"><a name="cups_password_cb_t">cups_password_cb_t</a></h3>
1971 <p class="description">Password callback</p>
1972 <p class="code">
1973 typedef const char *(*cups_password_cb_t)(const char *prompt);
1974 </p>
1975 <h3 class="typedef"><a name="cups_ptype_t">cups_ptype_t</a></h3>
1976 <p class="description">Printer type/capability bits</p>
1977 <p class="code">
1978 typedef unsigned cups_ptype_t;
1979 </p>
1980 <h2 class="title"><a name="STRUCTURES">Structures</a></h2>
1981 <h3 class="struct"><a name="cups_dest_s">cups_dest_s</a></h3>
1982 <p class="description">Destination</p>
1983 <p class="code">struct cups_dest_s {<br>
1984 &nbsp;&nbsp;&nbsp;&nbsp;char *name, *instance;<br>
1985 &nbsp;&nbsp;&nbsp;&nbsp;int is_default;<br>
1986 &nbsp;&nbsp;&nbsp;&nbsp;int num_options;<br>
1987 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#cups_option_t">cups_option_t</a> *options;<br>
1988 };</p>
1989 <h4 class="members">Members</h4>
1990 <dl>
1991 <dt>instance </dt>
1992 <dd class="description">Local instance name or NULL</dd>
1993 <dt>is_default </dt>
1994 <dd class="description">Is this printer the default?</dd>
1995 <dt>num_options </dt>
1996 <dd class="description">Number of options</dd>
1997 <dt>options </dt>
1998 <dd class="description">Options</dd>
1999 </dl>
2000 <h3 class="struct"><a name="cups_job_s">cups_job_s</a></h3>
2001 <p class="description">Job</p>
2002 <p class="code">struct cups_job_s {<br>
2003 &nbsp;&nbsp;&nbsp;&nbsp;time_t completed_time;<br>
2004 &nbsp;&nbsp;&nbsp;&nbsp;time_t creation_time;<br>
2005 &nbsp;&nbsp;&nbsp;&nbsp;char *dest;<br>
2006 &nbsp;&nbsp;&nbsp;&nbsp;char *format;<br>
2007 &nbsp;&nbsp;&nbsp;&nbsp;int id;<br>
2008 &nbsp;&nbsp;&nbsp;&nbsp;int priority;<br>
2009 &nbsp;&nbsp;&nbsp;&nbsp;time_t processing_time;<br>
2010 &nbsp;&nbsp;&nbsp;&nbsp;int size;<br>
2011 &nbsp;&nbsp;&nbsp;&nbsp;ipp_jstate_t state;<br>
2012 &nbsp;&nbsp;&nbsp;&nbsp;char *title;<br>
2013 &nbsp;&nbsp;&nbsp;&nbsp;char *user;<br>
2014 };</p>
2015 <h4 class="members">Members</h4>
2016 <dl>
2017 <dt>completed_time </dt>
2018 <dd class="description">Time the job was completed</dd>
2019 <dt>creation_time </dt>
2020 <dd class="description">Time the job was created</dd>
2021 <dt>dest </dt>
2022 <dd class="description">Printer or class name</dd>
2023 <dt>format </dt>
2024 <dd class="description">Document format</dd>
2025 <dt>id </dt>
2026 <dd class="description">The job ID</dd>
2027 <dt>priority </dt>
2028 <dd class="description">Priority (1-100)</dd>
2029 <dt>processing_time </dt>
2030 <dd class="description">Time the job was processed</dd>
2031 <dt>size </dt>
2032 <dd class="description">Size in kilobytes</dd>
2033 <dt>state </dt>
2034 <dd class="description">Job state</dd>
2035 <dt>title </dt>
2036 <dd class="description">Title/job name</dd>
2037 <dt>user </dt>
2038 <dd class="description">User the submitted the job</dd>
2039 </dl>
2040 <h3 class="struct"><a name="cups_option_s">cups_option_s</a></h3>
2041 <p class="description">Printer Options</p>
2042 <p class="code">struct cups_option_s {<br>
2043 &nbsp;&nbsp;&nbsp;&nbsp;char *name;<br>
2044 &nbsp;&nbsp;&nbsp;&nbsp;char *value;<br>
2045 };</p>
2046 <h4 class="members">Members</h4>
2047 <dl>
2048 <dt>name </dt>
2049 <dd class="description">Name of option</dd>
2050 <dt>value </dt>
2051 <dd class="description">Value of option</dd>
2052 </dl>
2053 <h2 class="title"><a name="ENUMERATIONS">Constants</a></h2>
2054 <h3 class="enumeration"><a name="cups_ptype_e">cups_ptype_e</a></h3>
2055 <p class="description">Printer type/capability bit constants</p>
2056 <h4 class="constants">Constants</h4>
2057 <dl>
2058 <dt>CUPS_PRINTER_AUTHENTICATED <span class="info">&nbsp;CUPS 1.2&nbsp;</span></dt>
2059 <dd class="description">Printer requires authentication </dd>
2060 <dt>CUPS_PRINTER_BIND </dt>
2061 <dd class="description">Can bind output</dd>
2062 <dt>CUPS_PRINTER_BW </dt>
2063 <dd class="description">Can do B&amp;W printing</dd>
2064 <dt>CUPS_PRINTER_CLASS </dt>
2065 <dd class="description">Printer class</dd>
2066 <dt>CUPS_PRINTER_COLLATE </dt>
2067 <dd class="description">Can collage copies</dd>
2068 <dt>CUPS_PRINTER_COLOR </dt>
2069 <dd class="description">Can do color printing</dd>
2070 <dt>CUPS_PRINTER_COMMANDS <span class="info">&nbsp;CUPS 1.2&nbsp;</span></dt>
2071 <dd class="description">Printer supports maintenance commands </dd>
2072 <dt>CUPS_PRINTER_COPIES </dt>
2073 <dd class="description">Can do copies</dd>
2074 <dt>CUPS_PRINTER_COVER </dt>
2075 <dd class="description">Can cover output</dd>
2076 <dt>CUPS_PRINTER_DEFAULT </dt>
2077 <dd class="description">Default printer on network</dd>
2078 <dt>CUPS_PRINTER_DELETE <span class="info">&nbsp;CUPS 1.2&nbsp;</span></dt>
2079 <dd class="description">Delete printer </dd>
2080 <dt>CUPS_PRINTER_DISCOVERED <span class="info">&nbsp;CUPS 1.3&nbsp;</span></dt>
2081 <dd class="description">Printer was automatically discovered and added </dd>
2082 <dt>CUPS_PRINTER_DUPLEX </dt>
2083 <dd class="description">Can do duplexing</dd>
2084 <dt>CUPS_PRINTER_FAX </dt>
2085 <dd class="description">Fax queue</dd>
2086 <dt>CUPS_PRINTER_IMPLICIT </dt>
2087 <dd class="description">Implicit class</dd>
2088 <dt>CUPS_PRINTER_LARGE </dt>
2089 <dd class="description">Can do D/E/A1/A0</dd>
2090 <dt>CUPS_PRINTER_LOCAL </dt>
2091 <dd class="description">Local printer or class</dd>
2092 <dt>CUPS_PRINTER_MEDIUM </dt>
2093 <dd class="description">Can do Tabloid/B/C/A3/A2</dd>
2094 <dt>CUPS_PRINTER_NOT_SHARED <span class="info">&nbsp;CUPS 1.2&nbsp;</span></dt>
2095 <dd class="description">Printer is not shared </dd>
2096 <dt>CUPS_PRINTER_PUNCH </dt>
2097 <dd class="description">Can punch output</dd>
2098 <dt>CUPS_PRINTER_REJECTING </dt>
2099 <dd class="description">Printer is rejecting jobs</dd>
2100 <dt>CUPS_PRINTER_REMOTE </dt>
2101 <dd class="description">Remote printer or class</dd>
2102 <dt>CUPS_PRINTER_SMALL </dt>
2103 <dd class="description">Can do Letter/Legal/A4</dd>
2104 <dt>CUPS_PRINTER_SORT </dt>
2105 <dd class="description">Can sort output</dd>
2106 <dt>CUPS_PRINTER_STAPLE </dt>
2107 <dd class="description">Can staple output</dd>
2108 <dt>CUPS_PRINTER_VARIABLE </dt>
2109 <dd class="description">Can do variable sizes</dd>
2110 </dl>
2111 </div>
2112 </body>
2113 </html>