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