]> git.ipfire.org Git - thirdparty/cups.git/blob - doc/spm.html
Load cups into easysw/current.
[thirdparty/cups.git] / doc / spm.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
2 <HTML>
3 <HEAD>
4 <TITLE>CUPS Software Programmers Manual</TITLE>
5 <META NAME="author" CONTENT="Easy Software Products">
6 <META NAME="copyright" CONTENT="Copyright 1997-2003, All Rights Reserved">
7 <META NAME="docnumber" CONTENT="CUPS-SPM-1.2.0">
8 <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=iso-8859-1">
9 <STYLE TYPE="text/css"><!--
10 BODY { font-family: serif }
11 H1 { font-family: sans-serif }
12 H2 { font-family: sans-serif }
13 H3 { font-family: sans-serif }
14 H4 { font-family: sans-serif }
15 H5 { font-family: sans-serif }
16 H6 { font-family: sans-serif }
17 SUB { font-size: smaller }
18 SUP { font-size: smaller }
19 PRE { font-family: monospace }
20 --></STYLE>
21 </HEAD>
22 <BODY BGCOLOR="#ffffff">
23 <CENTER><A HREF="#CONTENTS"><IMG SRC="images/cups-large.gif" BORDER="0" WIDTH="431" HEIGHT="511"><BR>
24 <H1>CUPS Software Programmers Manual</H1></A><BR>
25 CUPS-SPM-1.2.0<BR>
26 Easy Software Products<BR>
27 Copyright 1997-2003, All Rights Reserved<BR>
28 </CENTER>
29 <HR>
30 <H1 ALIGN="CENTER"><A NAME="CONTENTS">Table of Contents</A></H1>
31 <BR>
32 <BR><B><A HREF="#1">Preface</A></B>
33 <UL>
34 <LI><A HREF="#1_1">System Overview</A></LI>
35 <LI><A HREF="#1_2">Document Overview</A></LI>
36 <LI><A HREF="#1_3">Notation Conventions</A></LI>
37 <LI><A HREF="#1_4">Abbreviations</A></LI>
38 <LI><A HREF="#1_5">Other References</A></LI>
39 </UL>
40 <B><A HREF="#OVERVIEW">1 - Printing System Overview</A></B>
41 <UL>
42 <LI><A HREF="#2_1">The Printing Problem</A></LI>
43 <LI><A HREF="#2_2">The Technology</A></LI>
44 <LI><A HREF="#2_3">Jobs</A></LI>
45 <LI><A HREF="#2_4">Classes</A></LI>
46 <LI><A HREF="#2_5">Filters</A></LI>
47 <LI><A HREF="#2_6">Backends</A></LI>
48 <LI><A HREF="#2_7">Printer Drivers</A></LI>
49 <LI><A HREF="#2_8">Networking</A></LI>
50 </UL>
51 <B><A HREF="#CUPS_API">2 - The CUPS API</A></B>
52 <UL>
53 <LI><A HREF="#3_1">The CUPS API Library</A></LI>
54 <UL>
55 <LI><A HREF="#3_1_1">Detecting the CUPS API Library in GNU Autoconf</A></LI>
56 </UL>
57 <LI><A HREF="#3_2">Printing Services</A></LI>
58 <UL>
59 <LI><A HREF="#3_2_1">Include Files</A></LI>
60 <LI><A HREF="#3_2_2">Printing a File</A></LI>
61 <LI><A HREF="#3_2_3">Printing Multiple Files</A></LI>
62 <LI><A HREF="#3_2_4">Cancelling Jobs</A></LI>
63 <LI><A HREF="#3_2_5">Getting the Available Printers and Classes</A></LI>
64 <LI><A HREF="#3_2_6">Printing with Options</A></LI>
65 <LI><A HREF="#3_2_7">Setting Printer Options</A></LI>
66 <LI><A HREF="#3_2_8">Getting Errors</A></LI>
67 <LI><A HREF="#3_2_9">Passwords and Authentication</A></LI>
68 </UL>
69 <LI><A HREF="#3_3">PPD Services</A></LI>
70 <UL>
71 <LI><A HREF="#3_3_1">Include Files</A></LI>
72 <LI><A HREF="#3_3_2">Getting a PPD File for a Printer</A></LI>
73 <LI><A HREF="#3_3_3">Loading a PPD File</A></LI>
74 <LI><A HREF="#3_3_4">Freeing PPD File Information</A></LI>
75 <LI><A HREF="#3_3_5">The PPD File Structure</A></LI>
76 <LI><A HREF="#3_3_6">Marking Options</A></LI>
77 <LI><A HREF="#3_3_7">Checking for Conflicts</A></LI>
78 </UL>
79 </UL>
80 <B><A HREF="#WRITING_FILTERS">3 - Writing Filters</A></B>
81 <UL>
82 <LI><A HREF="#4_1">Overview</A></LI>
83 <UL>
84 <LI><A HREF="#4_1_1">Security Considerations</A></LI>
85 <LI><A HREF="#4_1_2">Users and Groups</A></LI>
86 <LI><A HREF="#4_1_3">Temporary Files</A></LI>
87 <LI><A HREF="#4_1_4">Sending Messages to the User</A></LI>
88 <LI><A HREF="#4_1_5">Page Accounting</A></LI>
89 <LI><A HREF="#4_1_6">Command-Line Arguments</A></LI>
90 <LI><A HREF="#4_1_7">Copy Generation</A></LI>
91 <LI><A HREF="#4_1_8">Environment Variables</A></LI>
92 </UL>
93 <LI><A HREF="#4_2">Dissecting the HP-GL/2 Filter</A></LI>
94 <UL>
95 <LI><A HREF="#4_2_1">Initializing the Filter</A></LI>
96 </UL>
97 <LI><A HREF="#4_3">PostScript Output</A></LI>
98 </UL>
99 <B><A HREF="#WRITING_DRIVERS">4 - Writing Printer Drivers</A></B>
100 <UL>
101 <LI><A HREF="#5_1">Overview</A></LI>
102 <UL>
103 <LI><A HREF="#5_1_1">CUPS Raster Data</A></LI>
104 <LI><A HREF="#5_1_2">Page Accounting</A></LI>
105 <LI><A HREF="#5_1_3">Color Management</A></LI>
106 <LI><A HREF="#5_1_4">Device and Bitmap Variables</A></LI>
107 </UL>
108 <LI><A HREF="#5_2">Dissecting the HP-PCL Driver</A></LI>
109 <UL>
110 <LI><A HREF="#5_2_1">PPD Files</A></LI>
111 <LI><A HREF="#5_2_2">Reading Raster Data</A></LI>
112 </UL>
113 </UL>
114 <B><A HREF="#WRITING_BACKENDS">5 - Writing Backends</A></B>
115 <UL>
116 <LI><A HREF="#6_1">Overview</A></LI>
117 <UL>
118 <LI><A HREF="#6_1_1">Security Considerations</A></LI>
119 <LI><A HREF="#6_1_2">Command-Line Arguments</A></LI>
120 <LI><A HREF="#6_1_3">Copy Generation</A></LI>
121 <LI><A HREF="#6_1_4">Page Accounting</A></LI>
122 <LI><A HREF="#6_1_5">Exclusive Access</A></LI>
123 <LI><A HREF="#6_1_6">Retries</A></LI>
124 </UL>
125 <LI><A HREF="#6_2">Dissecting the Serial Port Backend</A></LI>
126 <UL>
127 <LI><A HREF="#6_2_1">Supporting Device Discovery</A></LI>
128 <LI><A HREF="#6_2_2">Opening the Serial Port</A></LI>
129 <LI><A HREF="#6_2_3">Writing Data to the Port</A></LI>
130 <LI><A HREF="#6_2_4">Finishing Up</A></LI>
131 </UL>
132 </UL>
133 <B><A HREF="#LICENSE">A - Software License Agreement</A></B>
134 <UL>
135 <LI><A HREF="#7_1">Common UNIX Printing System License Agreement</A></LI>
136 <UL>
137 <LI><A HREF="#7_1_1">Introduction</A></LI>
138 <LI><A HREF="#7_1_2">License Exceptions</A></LI>
139 <LI><A HREF="#7_1_3">Trademarks</A></LI>
140 <LI><A HREF="#7_1_4">Binary Distribution Rights</A></LI>
141 <LI><A HREF="#7_1_5">Support</A></LI>
142 </UL>
143 <LI><A HREF="#7_2">GNU GENERAL PUBLIC LICENSE</A></LI>
144 <LI><A HREF="#7_3">GNU LIBRARY GENERAL PUBLIC LICENSE</A></LI>
145 </UL>
146 <B><A HREF="#CONSTANTS">B - Constants</A></B>
147 <UL>
148 <LI><A HREF="#8_1">CUPS Constants</A></LI>
149 <UL>
150 <LI><A HREF="#8_1_1">Version Number</A></LI>
151 <LI><A HREF="#8_1_2">Printer Capabilities</A></LI>
152 <LI><A HREF="#8_1_3">Encodings</A></LI>
153 </UL>
154 <LI><A HREF="#8_2">HTTP Constants</A></LI>
155 <UL>
156 <LI><A HREF="#8_2_1">Limits</A></LI>
157 <LI><A HREF="#8_2_2">Status Codes</A></LI>
158 <LI><A HREF="#8_2_3">Fields</A></LI>
159 </UL>
160 <LI><A HREF="#8_3">IPP Constants</A></LI>
161 <UL>
162 <LI><A HREF="#8_3_1">Limits</A></LI>
163 <LI><A HREF="#8_3_2">Tags</A></LI>
164 <LI><A HREF="#8_3_3">Resolution Units</A></LI>
165 <LI><A HREF="#8_3_4">Finishings</A></LI>
166 <LI><A HREF="#8_3_5">Orientations</A></LI>
167 <LI><A HREF="#8_3_6">Qualities</A></LI>
168 <LI><A HREF="#8_3_7">Job States</A></LI>
169 <LI><A HREF="#8_3_8">Printer States</A></LI>
170 <LI><A HREF="#8_3_9">Operations</A></LI>
171 <LI><A HREF="#8_3_10">Status Codes</A></LI>
172 </UL>
173 <LI><A HREF="#8_4">PPD Constants</A></LI>
174 <UL>
175 <LI><A HREF="#8_4_1">PPD Format Version</A></LI>
176 <LI><A HREF="#8_4_2">PPD User-Interface Types</A></LI>
177 <LI><A HREF="#8_4_3">PPD Sections</A></LI>
178 <LI><A HREF="#8_4_4">PPD Colorspaces</A></LI>
179 </UL>
180 <LI><A HREF="#8_5">Raster Constants</A></LI>
181 <UL>
182 <LI><A HREF="#8_5_1">Raster Sync Words</A></LI>
183 <LI><A HREF="#8_5_2">Raster Stream Modes</A></LI>
184 <LI><A HREF="#8_5_3">Raster Boolean Constants</A></LI>
185 <LI><A HREF="#8_5_4">Raster Jog Values</A></LI>
186 <LI><A HREF="#8_5_5">Raster Orientation Values</A></LI>
187 <LI><A HREF="#8_5_6">Raster CutMedia Values</A></LI>
188 <LI><A HREF="#8_5_7">Raster AdvanceMedia Values</A></LI>
189 <LI><A HREF="#8_5_8">Raster LeadingEdge Values</A></LI>
190 <LI><A HREF="#8_5_9">Raster Color Order Values</A></LI>
191 <LI><A HREF="#8_5_10">Raster Colorspace Values</A></LI>
192 </UL>
193 </UL>
194 <B><A HREF="#STRUCTURES">C - Structures</A></B>
195 <UL>
196 <LI><A HREF="#9_1">CUPS Structures</A></LI>
197 <UL>
198 <LI><A HREF="#cups_dest_t">CUPS Destinations</A></LI>
199 <LI><A HREF="#cups_job_t">CUPS Jobs</A></LI>
200 <LI><A HREF="#cups_lang_t">CUPS Messages</A></LI>
201 <LI><A HREF="#cups_option_t">CUPS Options</A></LI>
202 </UL>
203 <LI><A HREF="#9_2">Networking Structures</A></LI>
204 <UL>
205 <LI><A HREF="#http_t">HTTP State</A></LI>
206 <LI><A HREF="#ipp_t">IPP State</A></LI>
207 </UL>
208 <LI><A HREF="#9_3">Raster Structures</A></LI>
209 <UL>
210 <LI><A HREF="#cups_raster_header_t">Raster Page Header</A></LI>
211 </UL>
212 </UL>
213 <B><A HREF="#FUNCTIONS">D - Functions</A></B>
214 <UL>
215 <LI><A HREF="#cupsAddDest">cupsAddDest()</A></LI>
216 <UL>
217 <LI><A HREF="#10_1_1">Usage</A></LI>
218 <LI><A HREF="#10_1_2">Arguments</A></LI>
219 <LI><A HREF="#10_1_3">Returns</A></LI>
220 <LI><A HREF="#10_1_4">Description</A></LI>
221 <LI><A HREF="#10_1_5">Example</A></LI>
222 <LI><A HREF="#10_1_6">See Also</A></LI>
223 </UL>
224 <LI><A HREF="#cupsAddOption">cupsAddOption()</A></LI>
225 <UL>
226 <LI><A HREF="#10_2_1">Usage</A></LI>
227 <LI><A HREF="#10_2_2">Arguments</A></LI>
228 <LI><A HREF="#10_2_3">Returns</A></LI>
229 <LI><A HREF="#10_2_4">Description</A></LI>
230 <LI><A HREF="#10_2_5">Example</A></LI>
231 <LI><A HREF="#10_2_6">See Also</A></LI>
232 </UL>
233 <LI><A HREF="#cupsCancelJob">cupsCancelJob()</A></LI>
234 <UL>
235 <LI><A HREF="#10_3_1">Usage</A></LI>
236 <LI><A HREF="#10_3_2">Arguments</A></LI>
237 <LI><A HREF="#10_3_3">Returns</A></LI>
238 <LI><A HREF="#10_3_4">Description</A></LI>
239 <LI><A HREF="#10_3_5">Example</A></LI>
240 <LI><A HREF="#10_3_6">See Also</A></LI>
241 </UL>
242 <LI><A HREF="#cupsDoFileRequest">cupsDoFileRequest()</A></LI>
243 <UL>
244 <LI><A HREF="#10_4_1">Usage</A></LI>
245 <LI><A HREF="#10_4_2">Arguments</A></LI>
246 <LI><A HREF="#10_4_3">Returns</A></LI>
247 <LI><A HREF="#10_4_4">Description</A></LI>
248 <LI><A HREF="#10_4_5">Example</A></LI>
249 <LI><A HREF="#10_4_6">See Also</A></LI>
250 </UL>
251 <LI><A HREF="#cupsDoRequest">cupsDoRequest()</A></LI>
252 <UL>
253 <LI><A HREF="#10_5_1">Usage</A></LI>
254 <LI><A HREF="#10_5_2">Arguments</A></LI>
255 <LI><A HREF="#10_5_3">Returns</A></LI>
256 <LI><A HREF="#10_5_4">Description</A></LI>
257 <LI><A HREF="#10_5_5">Example</A></LI>
258 <LI><A HREF="#10_5_6">See Also</A></LI>
259 </UL>
260 <LI><A HREF="#cupsEncodeOptions">cupsEncodeOptions()</A></LI>
261 <UL>
262 <LI><A HREF="#10_6_1">Usage</A></LI>
263 <LI><A HREF="#10_6_2">Arguments</A></LI>
264 <LI><A HREF="#10_6_3">Description</A></LI>
265 <LI><A HREF="#10_6_4">Example</A></LI>
266 <LI><A HREF="#10_6_5">See Also</A></LI>
267 </UL>
268 <LI><A HREF="#cupsEncryption">cupsEncryption()</A></LI>
269 <UL>
270 <LI><A HREF="#10_7_1">Usage</A></LI>
271 <LI><A HREF="#10_7_2">Returns</A></LI>
272 <LI><A HREF="#10_7_3">Description</A></LI>
273 <LI><A HREF="#10_7_4">Example</A></LI>
274 <LI><A HREF="#10_7_5">See Also</A></LI>
275 </UL>
276 <LI><A HREF="#cupsFreeDests">cupsFreeDests()</A></LI>
277 <UL>
278 <LI><A HREF="#10_8_1">Usage</A></LI>
279 <LI><A HREF="#10_8_2">Arguments</A></LI>
280 <LI><A HREF="#10_8_3">Description</A></LI>
281 <LI><A HREF="#10_8_4">Example</A></LI>
282 <LI><A HREF="#10_8_5">See Also</A></LI>
283 </UL>
284 <LI><A HREF="#cupsFreeJobs">cupsFreeJobs()</A></LI>
285 <UL>
286 <LI><A HREF="#10_9_1">Usage</A></LI>
287 <LI><A HREF="#10_9_2">Arguments</A></LI>
288 <LI><A HREF="#10_9_3">Description</A></LI>
289 <LI><A HREF="#10_9_4">Example</A></LI>
290 <LI><A HREF="#10_9_5">See Also</A></LI>
291 </UL>
292 <LI><A HREF="#cupsFreeOptions">cupsFreeOptions()</A></LI>
293 <UL>
294 <LI><A HREF="#10_10_1">Usage</A></LI>
295 <LI><A HREF="#10_10_2">Arguments</A></LI>
296 <LI><A HREF="#10_10_3">Description</A></LI>
297 <LI><A HREF="#10_10_4">Example</A></LI>
298 <LI><A HREF="#10_10_5">See Also</A></LI>
299 </UL>
300 <LI><A HREF="#cupsGetClasses">cupsGetClasses()</A></LI>
301 <UL>
302 <LI><A HREF="#10_11_1">Usage</A></LI>
303 <LI><A HREF="#10_11_2">Arguments</A></LI>
304 <LI><A HREF="#10_11_3">Returns</A></LI>
305 <LI><A HREF="#10_11_4">Description</A></LI>
306 <LI><A HREF="#10_11_5">Example</A></LI>
307 <LI><A HREF="#10_11_6">See Also</A></LI>
308 </UL>
309 <LI><A HREF="#cupsGetDefault">cupsGetDefault()</A></LI>
310 <UL>
311 <LI><A HREF="#10_12_1">Usage</A></LI>
312 <LI><A HREF="#10_12_2">Returns</A></LI>
313 <LI><A HREF="#10_12_3">Description</A></LI>
314 <LI><A HREF="#10_12_4">Example</A></LI>
315 <LI><A HREF="#10_12_5">See Also</A></LI>
316 </UL>
317 <LI><A HREF="#cupsGetDest">cupsGetDest()</A></LI>
318 <UL>
319 <LI><A HREF="#10_13_1">Usage</A></LI>
320 <LI><A HREF="#10_13_2">Arguments</A></LI>
321 <LI><A HREF="#10_13_3">Returns</A></LI>
322 <LI><A HREF="#10_13_4">Description</A></LI>
323 <LI><A HREF="#10_13_5">Example</A></LI>
324 <LI><A HREF="#10_13_6">See Also</A></LI>
325 </UL>
326 <LI><A HREF="#cupsGetDests">cupsGetDests()</A></LI>
327 <UL>
328 <LI><A HREF="#10_14_1">Usage</A></LI>
329 <LI><A HREF="#10_14_2">Arguments</A></LI>
330 <LI><A HREF="#10_14_3">Returns</A></LI>
331 <LI><A HREF="#10_14_4">Description</A></LI>
332 <LI><A HREF="#10_14_5">Example</A></LI>
333 <LI><A HREF="#10_14_6">See Also</A></LI>
334 </UL>
335 <LI><A HREF="#cupsGetJobs">cupsGetJobs()</A></LI>
336 <UL>
337 <LI><A HREF="#10_15_1">Usage</A></LI>
338 <LI><A HREF="#10_15_2">Arguments</A></LI>
339 <LI><A HREF="#10_15_3">Returns</A></LI>
340 <LI><A HREF="#10_15_4">Description</A></LI>
341 <LI><A HREF="#10_15_5">Example</A></LI>
342 <LI><A HREF="#10_15_6">See Also</A></LI>
343 </UL>
344 <LI><A HREF="#cupsGetOption">cupsGetOption()</A></LI>
345 <UL>
346 <LI><A HREF="#10_16_1">Usage</A></LI>
347 <LI><A HREF="#10_16_2">Arguments</A></LI>
348 <LI><A HREF="#10_16_3">Returns</A></LI>
349 <LI><A HREF="#10_16_4">Description</A></LI>
350 <LI><A HREF="#10_16_5">See Also</A></LI>
351 </UL>
352 <LI><A HREF="#cupsGetPassword">cupsGetPassword()</A></LI>
353 <UL>
354 <LI><A HREF="#10_17_1">Usage</A></LI>
355 <LI><A HREF="#10_17_2">Arguments</A></LI>
356 <LI><A HREF="#10_17_3">Returns</A></LI>
357 <LI><A HREF="#10_17_4">Description</A></LI>
358 <LI><A HREF="#10_17_5">Example</A></LI>
359 <LI><A HREF="#10_17_6">See Also</A></LI>
360 </UL>
361 <LI><A HREF="#cupsGetPPD">cupsGetPPD()</A></LI>
362 <UL>
363 <LI><A HREF="#10_18_1">Usage</A></LI>
364 <LI><A HREF="#10_18_2">Arguments</A></LI>
365 <LI><A HREF="#10_18_3">Returns</A></LI>
366 <LI><A HREF="#10_18_4">Description</A></LI>
367 <LI><A HREF="#10_18_5">Example</A></LI>
368 </UL>
369 <LI><A HREF="#cupsGetPrinters">cupsGetPrinters()</A></LI>
370 <UL>
371 <LI><A HREF="#10_19_1">Usage</A></LI>
372 <LI><A HREF="#10_19_2">Arguments</A></LI>
373 <LI><A HREF="#10_19_3">Returns</A></LI>
374 <LI><A HREF="#10_19_4">Description</A></LI>
375 <LI><A HREF="#10_19_5">Example</A></LI>
376 <LI><A HREF="#10_19_6">See Also</A></LI>
377 </UL>
378 <LI><A HREF="#cupsLangDefault">cupsLangDefault()</A></LI>
379 <UL>
380 <LI><A HREF="#10_20_1">Usage</A></LI>
381 <LI><A HREF="#10_20_2">Returns</A></LI>
382 <LI><A HREF="#10_20_3">Description</A></LI>
383 <LI><A HREF="#10_20_4">Example</A></LI>
384 <LI><A HREF="#10_20_5">See Also</A></LI>
385 </UL>
386 <LI><A HREF="#cupsLangEncoding">cupsLangEncoding()</A></LI>
387 <UL>
388 <LI><A HREF="#10_21_1">Usage</A></LI>
389 <LI><A HREF="#10_21_2">Arguments</A></LI>
390 <LI><A HREF="#10_21_3">Returns</A></LI>
391 <LI><A HREF="#10_21_4">Description</A></LI>
392 <LI><A HREF="#10_21_5">Example</A></LI>
393 <LI><A HREF="#10_21_6">See Also</A></LI>
394 </UL>
395 <LI><A HREF="#cupsLangFlush">cupsLangFlush()</A></LI>
396 <UL>
397 <LI><A HREF="#10_22_1">Usage</A></LI>
398 <LI><A HREF="#10_22_2">Description</A></LI>
399 <LI><A HREF="#10_22_3">Example</A></LI>
400 <LI><A HREF="#10_22_4">See Also</A></LI>
401 </UL>
402 <LI><A HREF="#cupsLangFree">cupsLangFree()</A></LI>
403 <UL>
404 <LI><A HREF="#10_23_1">Usage</A></LI>
405 <LI><A HREF="#10_23_2">Arguments</A></LI>
406 <LI><A HREF="#10_23_3">Description</A></LI>
407 <LI><A HREF="#10_23_4">Example</A></LI>
408 <LI><A HREF="#10_23_5">See Also</A></LI>
409 </UL>
410 <LI><A HREF="#cupsLangGet">cupsLangGet()</A></LI>
411 <UL>
412 <LI><A HREF="#10_24_1">Usage</A></LI>
413 <LI><A HREF="#10_24_2">Arguments</A></LI>
414 <LI><A HREF="#10_24_3">Returns</A></LI>
415 <LI><A HREF="#10_24_4">Description</A></LI>
416 <LI><A HREF="#10_24_5">Example</A></LI>
417 <LI><A HREF="#10_24_6">See Also</A></LI>
418 </UL>
419 <LI><A HREF="#cupsLangString">cupsLangString()</A></LI>
420 <UL>
421 <LI><A HREF="#10_25_1">Usage</A></LI>
422 <LI><A HREF="#10_25_2">Arguments</A></LI>
423 <LI><A HREF="#10_25_3">Returns</A></LI>
424 <LI><A HREF="#10_25_4">Description</A></LI>
425 <LI><A HREF="#10_25_5">Example</A></LI>
426 <LI><A HREF="#10_25_6">See Also</A></LI>
427 </UL>
428 <LI><A HREF="#cupsLastError">cupsLastError()</A></LI>
429 <UL>
430 <LI><A HREF="#10_26_1">Usage</A></LI>
431 <LI><A HREF="#10_26_2">Returns</A></LI>
432 <LI><A HREF="#10_26_3">Description</A></LI>
433 <LI><A HREF="#10_26_4">Example</A></LI>
434 <LI><A HREF="#10_26_5">See Also</A></LI>
435 </UL>
436 <LI><A HREF="#cupsMarkOptions">cupsMarkOptions()</A></LI>
437 <UL>
438 <LI><A HREF="#10_27_1">Usage</A></LI>
439 <LI><A HREF="#10_27_2">Arguments</A></LI>
440 <LI><A HREF="#10_27_3">Returns</A></LI>
441 <LI><A HREF="#10_27_4">Description</A></LI>
442 <LI><A HREF="#10_27_5">Example</A></LI>
443 <LI><A HREF="#10_27_6">See Also</A></LI>
444 </UL>
445 <LI><A HREF="#cupsParseOptions">cupsParseOptions()</A></LI>
446 <UL>
447 <LI><A HREF="#10_28_1">Usage</A></LI>
448 <LI><A HREF="#10_28_2">Arguments</A></LI>
449 <LI><A HREF="#10_28_3">Returns</A></LI>
450 <LI><A HREF="#10_28_4">Description</A></LI>
451 <LI><A HREF="#10_28_5">Example</A></LI>
452 <LI><A HREF="#10_28_6">See Also</A></LI>
453 </UL>
454 <LI><A HREF="#cupsPrintFile">cupsPrintFile()</A></LI>
455 <UL>
456 <LI><A HREF="#10_29_1">Usage</A></LI>
457 <LI><A HREF="#10_29_2">Arguments</A></LI>
458 <LI><A HREF="#10_29_3">Returns</A></LI>
459 <LI><A HREF="#10_29_4">Description</A></LI>
460 <LI><A HREF="#10_29_5">Example</A></LI>
461 <LI><A HREF="#10_29_6">See Also</A></LI>
462 </UL>
463 <LI><A HREF="#cupsPrintFiles">cupsPrintFiles()</A></LI>
464 <UL>
465 <LI><A HREF="#10_30_1">Usage</A></LI>
466 <LI><A HREF="#10_30_2">Arguments</A></LI>
467 <LI><A HREF="#10_30_3">Returns</A></LI>
468 <LI><A HREF="#10_30_4">Description</A></LI>
469 <LI><A HREF="#10_30_5">Example</A></LI>
470 <LI><A HREF="#10_30_6">See Also</A></LI>
471 </UL>
472 <LI><A HREF="#cupsRasterClose">cupsRasterClose()</A></LI>
473 <UL>
474 <LI><A HREF="#10_31_1">Usage</A></LI>
475 <LI><A HREF="#10_31_2">Arguments</A></LI>
476 <LI><A HREF="#10_31_3">Description</A></LI>
477 <LI><A HREF="#10_31_4">Example</A></LI>
478 <LI><A HREF="#10_31_5">See Also</A></LI>
479 </UL>
480 <LI><A HREF="#cupsRasterOpen">cupsRasterOpen()</A></LI>
481 <UL>
482 <LI><A HREF="#10_32_1">Usage</A></LI>
483 <LI><A HREF="#10_32_2">Arguments</A></LI>
484 <LI><A HREF="#10_32_3">Returns</A></LI>
485 <LI><A HREF="#10_32_4">Description</A></LI>
486 <LI><A HREF="#10_32_5">Example</A></LI>
487 <LI><A HREF="#10_32_6">See Also</A></LI>
488 </UL>
489 <LI><A HREF="#cupsRasterReadHeader">cupsRasterReadHeader()</A></LI>
490 <UL>
491 <LI><A HREF="#10_33_1">Usage</A></LI>
492 <LI><A HREF="#10_33_2">Arguments</A></LI>
493 <LI><A HREF="#10_33_3">Returns</A></LI>
494 <LI><A HREF="#10_33_4">Description</A></LI>
495 <LI><A HREF="#10_33_5">Example</A></LI>
496 <LI><A HREF="#10_33_6">See Also</A></LI>
497 </UL>
498 <LI><A HREF="#cupsRasterReadPixels">cupsRasterReadPixels()</A></LI>
499 <UL>
500 <LI><A HREF="#10_34_1">Usage</A></LI>
501 <LI><A HREF="#10_34_2">Arguments</A></LI>
502 <LI><A HREF="#10_34_3">Returns</A></LI>
503 <LI><A HREF="#10_34_4">Description</A></LI>
504 <LI><A HREF="#10_34_5">Example</A></LI>
505 <LI><A HREF="#10_34_6">See Also</A></LI>
506 </UL>
507 <LI><A HREF="#cupsRasterWriteHeader">cupsRasterWriteHeader()</A></LI>
508 <UL>
509 <LI><A HREF="#10_35_1">Usage</A></LI>
510 <LI><A HREF="#10_35_2">Arguments</A></LI>
511 <LI><A HREF="#10_35_3">Returns</A></LI>
512 <LI><A HREF="#10_35_4">Description</A></LI>
513 <LI><A HREF="#10_35_5">Example</A></LI>
514 <LI><A HREF="#10_35_6">See Also</A></LI>
515 </UL>
516 <LI><A HREF="#cupsRasterWritePixels">cupsRasterWritePixels()</A></LI>
517 <UL>
518 <LI><A HREF="#10_36_1">Usage</A></LI>
519 <LI><A HREF="#10_36_2">Arguments</A></LI>
520 <LI><A HREF="#10_36_3">Returns</A></LI>
521 <LI><A HREF="#10_36_4">Description</A></LI>
522 <LI><A HREF="#10_36_5">Example</A></LI>
523 <LI><A HREF="#10_36_6">See Also</A></LI>
524 </UL>
525 <LI><A HREF="#cupsServer">cupsServer()</A></LI>
526 <UL>
527 <LI><A HREF="#10_37_1">Usage</A></LI>
528 <LI><A HREF="#10_37_2">Returns</A></LI>
529 <LI><A HREF="#10_37_3">Description</A></LI>
530 <LI><A HREF="#10_37_4">Example</A></LI>
531 <LI><A HREF="#10_37_5">See Also</A></LI>
532 </UL>
533 <LI><A HREF="#cupsSetDests">cupsSetDests()</A></LI>
534 <UL>
535 <LI><A HREF="#10_38_1">Usage</A></LI>
536 <LI><A HREF="#10_38_2">Arguments</A></LI>
537 <LI><A HREF="#10_38_3">Description</A></LI>
538 <LI><A HREF="#10_38_4">Example</A></LI>
539 <LI><A HREF="#10_38_5">See Also</A></LI>
540 </UL>
541 <LI><A HREF="#cupsSetEncryption">cupsSetEncryption()</A></LI>
542 <UL>
543 <LI><A HREF="#10_39_1">Usage</A></LI>
544 <LI><A HREF="#10_39_2">Arguments</A></LI>
545 <LI><A HREF="#10_39_3">Description</A></LI>
546 <LI><A HREF="#10_39_4">Example</A></LI>
547 <LI><A HREF="#10_39_5">See Also</A></LI>
548 </UL>
549 <LI><A HREF="#cupsSetPasswordCB">cupsSetPasswordCB()</A></LI>
550 <UL>
551 <LI><A HREF="#10_40_1">Usage</A></LI>
552 <LI><A HREF="#10_40_2">Arguments</A></LI>
553 <LI><A HREF="#10_40_3">Description</A></LI>
554 <LI><A HREF="#10_40_4">Example</A></LI>
555 <LI><A HREF="#10_40_5">See Also</A></LI>
556 </UL>
557 <LI><A HREF="#cupsSetServer">cupsSetServer()</A></LI>
558 <UL>
559 <LI><A HREF="#10_41_1">Usage</A></LI>
560 <LI><A HREF="#10_41_2">Arguments</A></LI>
561 <LI><A HREF="#10_41_3">Description</A></LI>
562 <LI><A HREF="#10_41_4">Example</A></LI>
563 <LI><A HREF="#10_41_5">See Also</A></LI>
564 </UL>
565 <LI><A HREF="#cupsSetUser">cupsSetUser()</A></LI>
566 <UL>
567 <LI><A HREF="#10_42_1">Usage</A></LI>
568 <LI><A HREF="#10_42_2">Arguments</A></LI>
569 <LI><A HREF="#10_42_3">Description</A></LI>
570 <LI><A HREF="#10_42_4">Example</A></LI>
571 <LI><A HREF="#10_42_5">See Also</A></LI>
572 </UL>
573 <LI><A HREF="#cupsTempFd">cupsTempFd()</A></LI>
574 <UL>
575 <LI><A HREF="#10_43_1">Usage</A></LI>
576 <LI><A HREF="#10_43_2">Arguments</A></LI>
577 <LI><A HREF="#10_43_3">Returns</A></LI>
578 <LI><A HREF="#10_43_4">Description</A></LI>
579 <LI><A HREF="#10_43_5">Example</A></LI>
580 <LI><A HREF="#10_43_6">See Also</A></LI>
581 </UL>
582 <LI><A HREF="#cupsTempFile">cupsTempFile()</A></LI>
583 <UL>
584 <LI><A HREF="#10_44_1">Usage</A></LI>
585 <LI><A HREF="#10_44_2">Arguments</A></LI>
586 <LI><A HREF="#10_44_3">Returns</A></LI>
587 <LI><A HREF="#10_44_4">Description</A></LI>
588 <LI><A HREF="#10_44_5">Example</A></LI>
589 <LI><A HREF="#10_44_6">See Also</A></LI>
590 </UL>
591 <LI><A HREF="#cupsUser">cupsUser()</A></LI>
592 <UL>
593 <LI><A HREF="#10_45_1">Usage</A></LI>
594 <LI><A HREF="#10_45_2">Returns</A></LI>
595 <LI><A HREF="#10_45_3">Description</A></LI>
596 <LI><A HREF="#10_45_4">Example</A></LI>
597 <LI><A HREF="#10_45_5">See Also</A></LI>
598 </UL>
599 <LI><A HREF="#httpBlocking">httpBlocking()</A></LI>
600 <UL>
601 <LI><A HREF="#10_46_1">Usage</A></LI>
602 <LI><A HREF="#10_46_2">Arguments</A></LI>
603 <LI><A HREF="#10_46_3">Description</A></LI>
604 <LI><A HREF="#10_46_4">Example</A></LI>
605 <LI><A HREF="#10_46_5">See Also</A></LI>
606 </UL>
607 <LI><A HREF="#httpCheck">httpCheck()</A></LI>
608 <UL>
609 <LI><A HREF="#10_47_1">Usage</A></LI>
610 <LI><A HREF="#10_47_2">Arguments</A></LI>
611 <LI><A HREF="#10_47_3">Returns</A></LI>
612 <LI><A HREF="#10_47_4">Description</A></LI>
613 <LI><A HREF="#10_47_5">Example</A></LI>
614 <LI><A HREF="#10_47_6">See Also</A></LI>
615 </UL>
616 <LI><A HREF="#httpClearFields">httpClearFields()</A></LI>
617 <UL>
618 <LI><A HREF="#10_48_1">Usage</A></LI>
619 <LI><A HREF="#10_48_2">Arguments</A></LI>
620 <LI><A HREF="#10_48_3">Description</A></LI>
621 <LI><A HREF="#10_48_4">Example</A></LI>
622 <LI><A HREF="#10_48_5">See Also</A></LI>
623 </UL>
624 <LI><A HREF="#httpClose">httpClose()</A></LI>
625 <UL>
626 <LI><A HREF="#10_49_1">Usage</A></LI>
627 <LI><A HREF="#10_49_2">Arguments</A></LI>
628 <LI><A HREF="#10_49_3">Description</A></LI>
629 <LI><A HREF="#10_49_4">Example</A></LI>
630 <LI><A HREF="#10_49_5">See Also</A></LI>
631 </UL>
632 <LI><A HREF="#httpConnect">httpConnect()</A></LI>
633 <UL>
634 <LI><A HREF="#10_50_1">Usage</A></LI>
635 <LI><A HREF="#10_50_2">Arguments</A></LI>
636 <LI><A HREF="#10_50_3">Returns</A></LI>
637 <LI><A HREF="#10_50_4">Description</A></LI>
638 <LI><A HREF="#10_50_5">Example</A></LI>
639 <LI><A HREF="#10_50_6">See Also</A></LI>
640 </UL>
641 <LI><A HREF="#httpConnectEncrypt">httpConnectEncrypt()</A></LI>
642 <UL>
643 <LI><A HREF="#10_51_1">Usage</A></LI>
644 <LI><A HREF="#10_51_2">Arguments</A></LI>
645 <LI><A HREF="#10_51_3">Returns</A></LI>
646 <LI><A HREF="#10_51_4">Description</A></LI>
647 <LI><A HREF="#10_51_5">Example</A></LI>
648 <LI><A HREF="#10_51_6">See Also</A></LI>
649 </UL>
650 <LI><A HREF="#httpDecode64">httpDecode64()</A></LI>
651 <UL>
652 <LI><A HREF="#10_52_1">Usage</A></LI>
653 <LI><A HREF="#10_52_2">Arguments</A></LI>
654 <LI><A HREF="#10_52_3">Returns</A></LI>
655 <LI><A HREF="#10_52_4">Description</A></LI>
656 <LI><A HREF="#10_52_5">Example</A></LI>
657 <LI><A HREF="#10_52_6">See Also</A></LI>
658 </UL>
659 <LI><A HREF="#httpDelete">httpDelete()</A></LI>
660 <UL>
661 <LI><A HREF="#10_53_1">Usage</A></LI>
662 <LI><A HREF="#10_53_2">Arguments</A></LI>
663 <LI><A HREF="#10_53_3">Returns</A></LI>
664 <LI><A HREF="#10_53_4">Description</A></LI>
665 <LI><A HREF="#10_53_5">Example</A></LI>
666 <LI><A HREF="#10_53_6">See Also</A></LI>
667 </UL>
668 <LI><A HREF="#httpEncode64">httpEncode64()</A></LI>
669 <UL>
670 <LI><A HREF="#10_54_1">Usage</A></LI>
671 <LI><A HREF="#10_54_2">Arguments</A></LI>
672 <LI><A HREF="#10_54_3">Returns</A></LI>
673 <LI><A HREF="#10_54_4">Description</A></LI>
674 <LI><A HREF="#10_54_5">Example</A></LI>
675 <LI><A HREF="#10_54_6">See Also</A></LI>
676 </UL>
677 <LI><A HREF="#httpEncryption">httpEncryption()</A></LI>
678 <UL>
679 <LI><A HREF="#10_55_1">Usage</A></LI>
680 <LI><A HREF="#10_55_2">Arguments</A></LI>
681 <LI><A HREF="#10_55_3">Returns</A></LI>
682 <LI><A HREF="#10_55_4">Description</A></LI>
683 <LI><A HREF="#10_55_5">Example</A></LI>
684 <LI><A HREF="#10_55_6">See Also</A></LI>
685 </UL>
686 <LI><A HREF="#httpError">httpError()</A></LI>
687 <UL>
688 <LI><A HREF="#10_56_1">Usage</A></LI>
689 <LI><A HREF="#10_56_2">Arguments</A></LI>
690 <LI><A HREF="#10_56_3">Returns</A></LI>
691 <LI><A HREF="#10_56_4">Description</A></LI>
692 <LI><A HREF="#10_56_5">Example</A></LI>
693 <LI><A HREF="#10_56_6">See Also</A></LI>
694 </UL>
695 <LI><A HREF="#httpFlush">httpFlush()</A></LI>
696 <UL>
697 <LI><A HREF="#10_57_1">Usage</A></LI>
698 <LI><A HREF="#10_57_2">Arguments</A></LI>
699 <LI><A HREF="#10_57_3">Description</A></LI>
700 <LI><A HREF="#10_57_4">Example</A></LI>
701 <LI><A HREF="#10_57_5">See Also</A></LI>
702 </UL>
703 <LI><A HREF="#httpGet">httpGet()</A></LI>
704 <UL>
705 <LI><A HREF="#10_58_1">Usage</A></LI>
706 <LI><A HREF="#10_58_2">Arguments</A></LI>
707 <LI><A HREF="#10_58_3">Returns</A></LI>
708 <LI><A HREF="#10_58_4">Description</A></LI>
709 <LI><A HREF="#10_58_5">Example</A></LI>
710 <LI><A HREF="#10_58_6">See Also</A></LI>
711 </UL>
712 <LI><A HREF="#httpGets">httpGets()</A></LI>
713 <UL>
714 <LI><A HREF="#10_59_1">Usage</A></LI>
715 <LI><A HREF="#10_59_2">Arguments</A></LI>
716 <LI><A HREF="#10_59_3">Returns</A></LI>
717 <LI><A HREF="#10_59_4">Description</A></LI>
718 <LI><A HREF="#10_59_5">Example</A></LI>
719 <LI><A HREF="#10_59_6">See Also</A></LI>
720 </UL>
721 <LI><A HREF="#httpGetDateString">httpGetDateString()</A></LI>
722 <UL>
723 <LI><A HREF="#10_60_1">Usage</A></LI>
724 <LI><A HREF="#10_60_2">Arguments</A></LI>
725 <LI><A HREF="#10_60_3">Returns</A></LI>
726 <LI><A HREF="#10_60_4">Description</A></LI>
727 <LI><A HREF="#10_60_5">Example</A></LI>
728 <LI><A HREF="#10_60_6">See Also</A></LI>
729 </UL>
730 <LI><A HREF="#httpGetDateTime">httpGetDateTime()</A></LI>
731 <UL>
732 <LI><A HREF="#10_61_1">Usage</A></LI>
733 <LI><A HREF="#10_61_2">Arguments</A></LI>
734 <LI><A HREF="#10_61_3">Returns</A></LI>
735 <LI><A HREF="#10_61_4">Description</A></LI>
736 <LI><A HREF="#10_61_5">Example</A></LI>
737 <LI><A HREF="#10_61_6">See Also</A></LI>
738 </UL>
739 <LI><A HREF="#httpGetField">httpGetField()</A></LI>
740 <UL>
741 <LI><A HREF="#10_62_1">Usage</A></LI>
742 <LI><A HREF="#10_62_2">Arguments</A></LI>
743 <LI><A HREF="#10_62_3">Returns</A></LI>
744 <LI><A HREF="#10_62_4">Description</A></LI>
745 <LI><A HREF="#10_62_5">Example</A></LI>
746 <LI><A HREF="#10_62_6">See Also</A></LI>
747 </UL>
748 <LI><A HREF="#httpGetHostByName">httpGetHostByName()</A></LI>
749 <UL>
750 <LI><A HREF="#10_63_1">Usage</A></LI>
751 <LI><A HREF="#10_63_2">Arguments</A></LI>
752 <LI><A HREF="#10_63_3">Returns</A></LI>
753 <LI><A HREF="#10_63_4">Description</A></LI>
754 <LI><A HREF="#10_63_5">Example</A></LI>
755 </UL>
756 <LI><A HREF="#httpGetLength">httpGetLength()</A></LI>
757 <UL>
758 <LI><A HREF="#10_64_1">Usage</A></LI>
759 <LI><A HREF="#10_64_2">Arguments</A></LI>
760 <LI><A HREF="#10_64_3">Returns</A></LI>
761 <LI><A HREF="#10_64_4">Description</A></LI>
762 <LI><A HREF="#10_64_5">Example</A></LI>
763 <LI><A HREF="#10_64_6">See Also</A></LI>
764 </UL>
765 <LI><A HREF="#httpGetSubField">httpGetSubField()</A></LI>
766 <UL>
767 <LI><A HREF="#10_65_1">Usage</A></LI>
768 <LI><A HREF="#10_65_2">Arguments</A></LI>
769 <LI><A HREF="#10_65_3">Returns</A></LI>
770 <LI><A HREF="#10_65_4">Description</A></LI>
771 <LI><A HREF="#10_65_5">Example</A></LI>
772 <LI><A HREF="#10_65_6">See Also</A></LI>
773 </UL>
774 <LI><A HREF="#httpHead">httpHead()</A></LI>
775 <UL>
776 <LI><A HREF="#10_66_1">Usage</A></LI>
777 <LI><A HREF="#10_66_2">Arguments</A></LI>
778 <LI><A HREF="#10_66_3">Returns</A></LI>
779 <LI><A HREF="#10_66_4">Description</A></LI>
780 <LI><A HREF="#10_66_5">Example</A></LI>
781 <LI><A HREF="#10_66_6">See Also</A></LI>
782 </UL>
783 <LI><A HREF="#httpInitialize">httpInitialize()</A></LI>
784 <UL>
785 <LI><A HREF="#10_67_1">Usage</A></LI>
786 <LI><A HREF="#10_67_2">Description</A></LI>
787 <LI><A HREF="#10_67_3">Example</A></LI>
788 <LI><A HREF="#10_67_4">See Also</A></LI>
789 </UL>
790 <LI><A HREF="#httpMD5">httpMD5()</A></LI>
791 <UL>
792 <LI><A HREF="#10_68_1">Usage</A></LI>
793 <LI><A HREF="#10_68_2">Arguments</A></LI>
794 <LI><A HREF="#10_68_3">Returns</A></LI>
795 <LI><A HREF="#10_68_4">Description</A></LI>
796 <LI><A HREF="#10_68_5">Example</A></LI>
797 <LI><A HREF="#10_68_6">See Also</A></LI>
798 </UL>
799 <LI><A HREF="#httpMD5Final">httpMD5Final()</A></LI>
800 <UL>
801 <LI><A HREF="#10_69_1">Usage</A></LI>
802 <LI><A HREF="#10_69_2">Arguments</A></LI>
803 <LI><A HREF="#10_69_3">Returns</A></LI>
804 <LI><A HREF="#10_69_4">Description</A></LI>
805 <LI><A HREF="#10_69_5">Example</A></LI>
806 <LI><A HREF="#10_69_6">See Also</A></LI>
807 </UL>
808 <LI><A HREF="#httpMD5String">httpMD5String()</A></LI>
809 <UL>
810 <LI><A HREF="#10_70_1">Usage</A></LI>
811 <LI><A HREF="#10_70_2">Arguments</A></LI>
812 <LI><A HREF="#10_70_3">Returns</A></LI>
813 <LI><A HREF="#10_70_4">Description</A></LI>
814 <LI><A HREF="#10_70_5">Example</A></LI>
815 <LI><A HREF="#10_70_6">See Also</A></LI>
816 </UL>
817 <LI><A HREF="#httpOptions">httpOptions()</A></LI>
818 <UL>
819 <LI><A HREF="#10_71_1">Usage</A></LI>
820 <LI><A HREF="#10_71_2">Arguments</A></LI>
821 <LI><A HREF="#10_71_3">Returns</A></LI>
822 <LI><A HREF="#10_71_4">Description</A></LI>
823 <LI><A HREF="#10_71_5">Example</A></LI>
824 <LI><A HREF="#10_71_6">See Also</A></LI>
825 </UL>
826 <LI><A HREF="#httpPost">httpPost()</A></LI>
827 <UL>
828 <LI><A HREF="#10_72_1">Usage</A></LI>
829 <LI><A HREF="#10_72_2">Arguments</A></LI>
830 <LI><A HREF="#10_72_3">Returns</A></LI>
831 <LI><A HREF="#10_72_4">Description</A></LI>
832 <LI><A HREF="#10_72_5">Example</A></LI>
833 <LI><A HREF="#10_72_6">See Also</A></LI>
834 </UL>
835 <LI><A HREF="#httpPrintf">httpPrintf()</A></LI>
836 <UL>
837 <LI><A HREF="#10_73_1">Usage</A></LI>
838 <LI><A HREF="#10_73_2">Arguments</A></LI>
839 <LI><A HREF="#10_73_3">Returns</A></LI>
840 <LI><A HREF="#10_73_4">Description</A></LI>
841 <LI><A HREF="#10_73_5">Example</A></LI>
842 <LI><A HREF="#10_73_6">See Also</A></LI>
843 </UL>
844 <LI><A HREF="#httpPut">httpPut()</A></LI>
845 <UL>
846 <LI><A HREF="#10_74_1">Usage</A></LI>
847 <LI><A HREF="#10_74_2">Arguments</A></LI>
848 <LI><A HREF="#10_74_3">Returns</A></LI>
849 <LI><A HREF="#10_74_4">Description</A></LI>
850 <LI><A HREF="#10_74_5">Example</A></LI>
851 <LI><A HREF="#10_74_6">See Also</A></LI>
852 </UL>
853 <LI><A HREF="#httpRead">httpRead()</A></LI>
854 <UL>
855 <LI><A HREF="#10_75_1">Usage</A></LI>
856 <LI><A HREF="#10_75_2">Arguments</A></LI>
857 <LI><A HREF="#10_75_3">Returns</A></LI>
858 <LI><A HREF="#10_75_4">Description</A></LI>
859 <LI><A HREF="#10_75_5">Example</A></LI>
860 <LI><A HREF="#10_75_6">See Also</A></LI>
861 </UL>
862 <LI><A HREF="#httpReconnect">httpReconnect()</A></LI>
863 <UL>
864 <LI><A HREF="#10_76_1">Usage</A></LI>
865 <LI><A HREF="#10_76_2">Arguments</A></LI>
866 <LI><A HREF="#10_76_3">Returns</A></LI>
867 <LI><A HREF="#10_76_4">Description</A></LI>
868 <LI><A HREF="#10_76_5">Example</A></LI>
869 <LI><A HREF="#10_76_6">See Also</A></LI>
870 </UL>
871 <LI><A HREF="#httpSeparate">httpSeparate()</A></LI>
872 <UL>
873 <LI><A HREF="#10_77_1">Usage</A></LI>
874 <LI><A HREF="#10_77_2">Arguments</A></LI>
875 <LI><A HREF="#10_77_3">Description</A></LI>
876 <LI><A HREF="#10_77_4">Example</A></LI>
877 <LI><A HREF="#10_77_5">See Also</A></LI>
878 </UL>
879 <LI><A HREF="#httpSetField">httpSetField()</A></LI>
880 <UL>
881 <LI><A HREF="#10_78_1">Usage</A></LI>
882 <LI><A HREF="#10_78_2">Arguments</A></LI>
883 <LI><A HREF="#10_78_3">Description</A></LI>
884 <LI><A HREF="#10_78_4">Example</A></LI>
885 <LI><A HREF="#10_78_5">See Also</A></LI>
886 </UL>
887 <LI><A HREF="#httpStatus">httpStatus()</A></LI>
888 <UL>
889 <LI><A HREF="#10_79_1">Usage</A></LI>
890 <LI><A HREF="#10_79_2">Arguments</A></LI>
891 <LI><A HREF="#10_79_3">Returns</A></LI>
892 <LI><A HREF="#10_79_4">Description</A></LI>
893 <LI><A HREF="#10_79_5">Example</A></LI>
894 </UL>
895 <LI><A HREF="#httpTrace">httpTrace()</A></LI>
896 <UL>
897 <LI><A HREF="#10_80_1">Usage</A></LI>
898 <LI><A HREF="#10_80_2">Arguments</A></LI>
899 <LI><A HREF="#10_80_3">Returns</A></LI>
900 <LI><A HREF="#10_80_4">Description</A></LI>
901 <LI><A HREF="#10_80_5">Example</A></LI>
902 <LI><A HREF="#10_80_6">See Also</A></LI>
903 </UL>
904 <LI><A HREF="#httpUpdate">httpUpdate()</A></LI>
905 <UL>
906 <LI><A HREF="#10_81_1">Usage</A></LI>
907 <LI><A HREF="#10_81_2">Arguments</A></LI>
908 <LI><A HREF="#10_81_3">Returns</A></LI>
909 <LI><A HREF="#10_81_4">Description</A></LI>
910 <LI><A HREF="#10_81_5">Example</A></LI>
911 <LI><A HREF="#10_81_6">See Also</A></LI>
912 </UL>
913 <LI><A HREF="#httpWrite">httpWrite()</A></LI>
914 <UL>
915 <LI><A HREF="#10_82_1">Usage</A></LI>
916 <LI><A HREF="#10_82_2">Arguments</A></LI>
917 <LI><A HREF="#10_82_3">Returns</A></LI>
918 <LI><A HREF="#10_82_4">Description</A></LI>
919 <LI><A HREF="#10_82_5">Example</A></LI>
920 <LI><A HREF="#10_82_6">See Also</A></LI>
921 </UL>
922 <LI><A HREF="#ippAddBoolean">ippAddBoolean()</A></LI>
923 <UL>
924 <LI><A HREF="#10_83_1">Usage</A></LI>
925 <LI><A HREF="#10_83_2">Arguments</A></LI>
926 <LI><A HREF="#10_83_3">Returns</A></LI>
927 <LI><A HREF="#10_83_4">Description</A></LI>
928 <LI><A HREF="#10_83_5">Example</A></LI>
929 <LI><A HREF="#10_83_6">See Also</A></LI>
930 </UL>
931 <LI><A HREF="#ippAddBooleans">ippAddBooleans()</A></LI>
932 <UL>
933 <LI><A HREF="#10_84_1">Usage</A></LI>
934 <LI><A HREF="#10_84_2">Arguments</A></LI>
935 <LI><A HREF="#10_84_3">Returns</A></LI>
936 <LI><A HREF="#10_84_4">Description</A></LI>
937 <LI><A HREF="#10_84_5">Example</A></LI>
938 <LI><A HREF="#10_84_6">See Also</A></LI>
939 </UL>
940 <LI><A HREF="#ippAddDate">ippAddDate()</A></LI>
941 <UL>
942 <LI><A HREF="#10_85_1">Usage</A></LI>
943 <LI><A HREF="#10_85_2">Arguments</A></LI>
944 <LI><A HREF="#10_85_3">Returns</A></LI>
945 <LI><A HREF="#10_85_4">Description</A></LI>
946 <LI><A HREF="#10_85_5">Example</A></LI>
947 <LI><A HREF="#10_85_6">See Also</A></LI>
948 </UL>
949 <LI><A HREF="#ippAddInteger">ippAddInteger()</A></LI>
950 <UL>
951 <LI><A HREF="#10_86_1">Usage</A></LI>
952 <LI><A HREF="#10_86_2">Arguments</A></LI>
953 <LI><A HREF="#10_86_3">Returns</A></LI>
954 <LI><A HREF="#10_86_4">Description</A></LI>
955 <LI><A HREF="#10_86_5">Example</A></LI>
956 <LI><A HREF="#10_86_6">See Also</A></LI>
957 </UL>
958 <LI><A HREF="#ippAddIntegers">ippAddIntegers()</A></LI>
959 <UL>
960 <LI><A HREF="#10_87_1">Usage</A></LI>
961 <LI><A HREF="#10_87_2">Arguments</A></LI>
962 <LI><A HREF="#10_87_3">Returns</A></LI>
963 <LI><A HREF="#10_87_4">Description</A></LI>
964 <LI><A HREF="#10_87_5">Example</A></LI>
965 <LI><A HREF="#10_87_6">See Also</A></LI>
966 </UL>
967 <LI><A HREF="#ippAddRange">ippAddRange()</A></LI>
968 <UL>
969 <LI><A HREF="#10_88_1">Usage</A></LI>
970 <LI><A HREF="#10_88_2">Arguments</A></LI>
971 <LI><A HREF="#10_88_3">Returns</A></LI>
972 <LI><A HREF="#10_88_4">Description</A></LI>
973 <LI><A HREF="#10_88_5">Example</A></LI>
974 <LI><A HREF="#10_88_6">See Also</A></LI>
975 </UL>
976 <LI><A HREF="#ippAddRanges">ippAddRanges()</A></LI>
977 <UL>
978 <LI><A HREF="#10_89_1">Usage</A></LI>
979 <LI><A HREF="#10_89_2">Arguments</A></LI>
980 <LI><A HREF="#10_89_3">Returns</A></LI>
981 <LI><A HREF="#10_89_4">Description</A></LI>
982 <LI><A HREF="#10_89_5">Example</A></LI>
983 <LI><A HREF="#10_89_6">See Also</A></LI>
984 </UL>
985 <LI><A HREF="#ippAddResolution">ippAddResolution()</A></LI>
986 <UL>
987 <LI><A HREF="#10_90_1">Usage</A></LI>
988 <LI><A HREF="#10_90_2">Arguments</A></LI>
989 <LI><A HREF="#10_90_3">Returns</A></LI>
990 <LI><A HREF="#10_90_4">Description</A></LI>
991 <LI><A HREF="#10_90_5">Example</A></LI>
992 <LI><A HREF="#10_90_6">See Also</A></LI>
993 </UL>
994 <LI><A HREF="#ippAddResolutions">ippAddResolutions()</A></LI>
995 <UL>
996 <LI><A HREF="#10_91_1">Usage</A></LI>
997 <LI><A HREF="#10_91_2">Arguments</A></LI>
998 <LI><A HREF="#10_91_3">Returns</A></LI>
999 <LI><A HREF="#10_91_4">Description</A></LI>
1000 <LI><A HREF="#10_91_5">Example</A></LI>
1001 <LI><A HREF="#10_91_6">See Also</A></LI>
1002 </UL>
1003 <LI><A HREF="#ippAddSeparator">ippAddSeparator()</A></LI>
1004 <UL>
1005 <LI><A HREF="#10_92_1">Usage</A></LI>
1006 <LI><A HREF="#10_92_2">Arguments</A></LI>
1007 <LI><A HREF="#10_92_3">Returns</A></LI>
1008 <LI><A HREF="#10_92_4">Description</A></LI>
1009 <LI><A HREF="#10_92_5">Example</A></LI>
1010 <LI><A HREF="#10_92_6">See Also</A></LI>
1011 </UL>
1012 <LI><A HREF="#ippAddString">ippAddString()</A></LI>
1013 <UL>
1014 <LI><A HREF="#10_93_1">Usage</A></LI>
1015 <LI><A HREF="#10_93_2">Arguments</A></LI>
1016 <LI><A HREF="#10_93_3">Returns</A></LI>
1017 <LI><A HREF="#10_93_4">Description</A></LI>
1018 <LI><A HREF="#10_93_5">Example</A></LI>
1019 <LI><A HREF="#10_93_6">See Also</A></LI>
1020 </UL>
1021 <LI><A HREF="#ippAddStrings">ippAddStrings()</A></LI>
1022 <UL>
1023 <LI><A HREF="#10_94_1">Usage</A></LI>
1024 <LI><A HREF="#10_94_2">Arguments</A></LI>
1025 <LI><A HREF="#10_94_3">Returns</A></LI>
1026 <LI><A HREF="#10_94_4">Description</A></LI>
1027 <LI><A HREF="#10_94_5">Example</A></LI>
1028 <LI><A HREF="#10_94_6">See Also</A></LI>
1029 </UL>
1030 <LI><A HREF="#ippDateToTime">ippDateToTime()</A></LI>
1031 <UL>
1032 <LI><A HREF="#10_95_1">Usage</A></LI>
1033 <LI><A HREF="#10_95_2">Arguments</A></LI>
1034 <LI><A HREF="#10_95_3">Returns</A></LI>
1035 <LI><A HREF="#10_95_4">Description</A></LI>
1036 <LI><A HREF="#10_95_5">Example</A></LI>
1037 <LI><A HREF="#10_95_6">See Also</A></LI>
1038 </UL>
1039 <LI><A HREF="#ippDelete">ippDelete()</A></LI>
1040 <UL>
1041 <LI><A HREF="#10_96_1">Usage</A></LI>
1042 <LI><A HREF="#10_96_2">Arguments</A></LI>
1043 <LI><A HREF="#10_96_3">Description</A></LI>
1044 <LI><A HREF="#10_96_4">Example</A></LI>
1045 <LI><A HREF="#10_96_5">See Also</A></LI>
1046 </UL>
1047 <LI><A HREF="#ippErrorString">ippErrorString()</A></LI>
1048 <UL>
1049 <LI><A HREF="#10_97_1">Usage</A></LI>
1050 <LI><A HREF="#10_97_2">Arguments</A></LI>
1051 <LI><A HREF="#10_97_3">Returns</A></LI>
1052 <LI><A HREF="#10_97_4">Description</A></LI>
1053 <LI><A HREF="#10_97_5">Example</A></LI>
1054 <LI><A HREF="#10_97_6">See Also</A></LI>
1055 </UL>
1056 <LI><A HREF="#ippFindAttribute">ippFindAttribute()</A></LI>
1057 <UL>
1058 <LI><A HREF="#10_98_1">Usage</A></LI>
1059 <LI><A HREF="#10_98_2">Arguments</A></LI>
1060 <LI><A HREF="#10_98_3">Returns</A></LI>
1061 <LI><A HREF="#10_98_4">Description</A></LI>
1062 <LI><A HREF="#10_98_5">Example</A></LI>
1063 <LI><A HREF="#10_98_6">See Also</A></LI>
1064 </UL>
1065 <LI><A HREF="#ippFindNextAttribute">ippFindNextAttribute()</A></LI>
1066 <UL>
1067 <LI><A HREF="#10_99_1">Usage</A></LI>
1068 <LI><A HREF="#10_99_2">Arguments</A></LI>
1069 <LI><A HREF="#10_99_3">Returns</A></LI>
1070 <LI><A HREF="#10_99_4">Description</A></LI>
1071 <LI><A HREF="#10_99_5">Example</A></LI>
1072 <LI><A HREF="#10_99_6">See Also</A></LI>
1073 </UL>
1074 <LI><A HREF="#ippLength">ippLength()</A></LI>
1075 <UL>
1076 <LI><A HREF="#10_100_1">Usage</A></LI>
1077 <LI><A HREF="#10_100_2">Arguments</A></LI>
1078 <LI><A HREF="#10_100_3">Returns</A></LI>
1079 <LI><A HREF="#10_100_4">Description</A></LI>
1080 <LI><A HREF="#10_100_5">Example</A></LI>
1081 <LI><A HREF="#10_100_6">See Also</A></LI>
1082 </UL>
1083 <LI><A HREF="#ippNew">ippNew()</A></LI>
1084 <UL>
1085 <LI><A HREF="#10_101_1">Usage</A></LI>
1086 <LI><A HREF="#10_101_2">Returns</A></LI>
1087 <LI><A HREF="#10_101_3">Description</A></LI>
1088 <LI><A HREF="#10_101_4">Example</A></LI>
1089 <LI><A HREF="#10_101_5">See Also</A></LI>
1090 </UL>
1091 <LI><A HREF="#ippPort">ippPort()</A></LI>
1092 <UL>
1093 <LI><A HREF="#10_102_1">Usage</A></LI>
1094 <LI><A HREF="#10_102_2">Returns</A></LI>
1095 <LI><A HREF="#10_102_3">Description</A></LI>
1096 <LI><A HREF="#10_102_4">Example</A></LI>
1097 <LI><A HREF="#10_102_5">See Also</A></LI>
1098 </UL>
1099 <LI><A HREF="#ippRead">ippRead()</A></LI>
1100 <UL>
1101 <LI><A HREF="#10_103_1">Usage</A></LI>
1102 <LI><A HREF="#10_103_2">Arguments</A></LI>
1103 <LI><A HREF="#10_103_3">Returns</A></LI>
1104 <LI><A HREF="#10_103_4">Description</A></LI>
1105 <LI><A HREF="#10_103_5">Example</A></LI>
1106 <LI><A HREF="#10_103_6">See Also</A></LI>
1107 </UL>
1108 <LI><A HREF="#ippSetPort">ippSetPort()</A></LI>
1109 <UL>
1110 <LI><A HREF="#10_104_1">Usage</A></LI>
1111 <LI><A HREF="#10_104_2">Arguments</A></LI>
1112 <LI><A HREF="#10_104_3">Description</A></LI>
1113 <LI><A HREF="#10_104_4">Example</A></LI>
1114 <LI><A HREF="#10_104_5">See Also</A></LI>
1115 </UL>
1116 <LI><A HREF="#ippTimeToDate">ippTimeToDate()</A></LI>
1117 <UL>
1118 <LI><A HREF="#10_105_1">Usage</A></LI>
1119 <LI><A HREF="#10_105_2">Arguments</A></LI>
1120 <LI><A HREF="#10_105_3">Returns</A></LI>
1121 <LI><A HREF="#10_105_4">Description</A></LI>
1122 <LI><A HREF="#10_105_5">Example</A></LI>
1123 <LI><A HREF="#10_105_6">See Also</A></LI>
1124 </UL>
1125 <LI><A HREF="#ippWrite">ippWrite()</A></LI>
1126 <UL>
1127 <LI><A HREF="#10_106_1">Usage</A></LI>
1128 <LI><A HREF="#10_106_2">Arguments</A></LI>
1129 <LI><A HREF="#10_106_3">Returns</A></LI>
1130 <LI><A HREF="#10_106_4">Description</A></LI>
1131 <LI><A HREF="#10_106_5">Example</A></LI>
1132 <LI><A HREF="#10_106_6">See Also</A></LI>
1133 </UL>
1134 <LI><A HREF="#ppdClose">ppdClose()</A></LI>
1135 <UL>
1136 <LI><A HREF="#10_107_1">Usage</A></LI>
1137 <LI><A HREF="#10_107_2">Arguments</A></LI>
1138 <LI><A HREF="#10_107_3">Description</A></LI>
1139 <LI><A HREF="#10_107_4">Example</A></LI>
1140 <LI><A HREF="#10_107_5">See Also</A></LI>
1141 </UL>
1142 <LI><A HREF="#ppdCollect">ppdCollect()</A></LI>
1143 <UL>
1144 <LI><A HREF="#10_108_1">Usage</A></LI>
1145 <LI><A HREF="#10_108_2">Arguments</A></LI>
1146 <LI><A HREF="#10_108_3">Returns</A></LI>
1147 <LI><A HREF="#10_108_4">Description</A></LI>
1148 <LI><A HREF="#10_108_5">Example</A></LI>
1149 <LI><A HREF="#10_108_6">See Also</A></LI>
1150 </UL>
1151 <LI><A HREF="#ppdConflicts">ppdConflicts()</A></LI>
1152 <UL>
1153 <LI><A HREF="#10_109_1">Usage</A></LI>
1154 <LI><A HREF="#10_109_2">Arguments</A></LI>
1155 <LI><A HREF="#10_109_3">Returns</A></LI>
1156 <LI><A HREF="#10_109_4">Description</A></LI>
1157 <LI><A HREF="#10_109_5">Example</A></LI>
1158 <LI><A HREF="#10_109_6">See Also</A></LI>
1159 </UL>
1160 <LI><A HREF="#ppdEmit">ppdEmit()</A></LI>
1161 <UL>
1162 <LI><A HREF="#10_110_1">Usage</A></LI>
1163 <LI><A HREF="#10_110_2">Arguments</A></LI>
1164 <LI><A HREF="#10_110_3">Returns</A></LI>
1165 <LI><A HREF="#10_110_4">Description</A></LI>
1166 <LI><A HREF="#10_110_5">Example</A></LI>
1167 <LI><A HREF="#10_110_6">See Also</A></LI>
1168 </UL>
1169 <LI><A HREF="#ppdEmitFd">ppdEmitFd()</A></LI>
1170 <UL>
1171 <LI><A HREF="#10_111_1">Usage</A></LI>
1172 <LI><A HREF="#10_111_2">Arguments</A></LI>
1173 <LI><A HREF="#10_111_3">Returns</A></LI>
1174 <LI><A HREF="#10_111_4">Description</A></LI>
1175 <LI><A HREF="#10_111_5">Example</A></LI>
1176 <LI><A HREF="#10_111_6">See Also</A></LI>
1177 </UL>
1178 <LI><A HREF="#ppdFindChoice">ppdFindChoice()</A></LI>
1179 <UL>
1180 <LI><A HREF="#10_112_1">Usage</A></LI>
1181 <LI><A HREF="#10_112_2">Arguments</A></LI>
1182 <LI><A HREF="#10_112_3">Returns</A></LI>
1183 <LI><A HREF="#10_112_4">Description</A></LI>
1184 <LI><A HREF="#10_112_5">Example</A></LI>
1185 <LI><A HREF="#10_112_6">See Also</A></LI>
1186 </UL>
1187 <LI><A HREF="#ppdFindMarkedChoice">ppdFindMarkedChoice()</A></LI>
1188 <UL>
1189 <LI><A HREF="#10_113_1">Usage</A></LI>
1190 <LI><A HREF="#10_113_2">Arguments</A></LI>
1191 <LI><A HREF="#10_113_3">Returns</A></LI>
1192 <LI><A HREF="#10_113_4">Description</A></LI>
1193 <LI><A HREF="#10_113_5">Example</A></LI>
1194 <LI><A HREF="#10_113_6">See Also</A></LI>
1195 </UL>
1196 <LI><A HREF="#ppdFindOption">ppdFindOption()</A></LI>
1197 <UL>
1198 <LI><A HREF="#10_114_1">Usage</A></LI>
1199 <LI><A HREF="#10_114_2">Arguments</A></LI>
1200 <LI><A HREF="#10_114_3">Returns</A></LI>
1201 <LI><A HREF="#10_114_4">Description</A></LI>
1202 <LI><A HREF="#10_114_5">Example</A></LI>
1203 <LI><A HREF="#10_114_6">See Also</A></LI>
1204 </UL>
1205 <LI><A HREF="#ppdIsMarked">ppdIsMarked()</A></LI>
1206 <UL>
1207 <LI><A HREF="#10_115_1">Usage</A></LI>
1208 <LI><A HREF="#10_115_2">Arguments</A></LI>
1209 <LI><A HREF="#10_115_3">Returns</A></LI>
1210 <LI><A HREF="#10_115_4">Description</A></LI>
1211 <LI><A HREF="#10_115_5">Example</A></LI>
1212 <LI><A HREF="#10_115_6">See Also</A></LI>
1213 </UL>
1214 <LI><A HREF="#ppdMarkDefaults">ppdMarkDefaults()</A></LI>
1215 <UL>
1216 <LI><A HREF="#10_116_1">Usage</A></LI>
1217 <LI><A HREF="#10_116_2">Arguments</A></LI>
1218 <LI><A HREF="#10_116_3">Description</A></LI>
1219 <LI><A HREF="#10_116_4">Example</A></LI>
1220 <LI><A HREF="#10_116_5">See Also</A></LI>
1221 </UL>
1222 <LI><A HREF="#ppdMarkOption">ppdMarkOption()</A></LI>
1223 <UL>
1224 <LI><A HREF="#10_117_1">Usage</A></LI>
1225 <LI><A HREF="#10_117_2">Arguments</A></LI>
1226 <LI><A HREF="#10_117_3">Returns</A></LI>
1227 <LI><A HREF="#10_117_4">Description</A></LI>
1228 <LI><A HREF="#10_117_5">Example</A></LI>
1229 <LI><A HREF="#10_117_6">See Also</A></LI>
1230 </UL>
1231 <LI><A HREF="#ppdOpen">ppdOpen()</A></LI>
1232 <UL>
1233 <LI><A HREF="#10_118_1">Usage</A></LI>
1234 <LI><A HREF="#10_118_2">Arguments</A></LI>
1235 <LI><A HREF="#10_118_3">Returns</A></LI>
1236 <LI><A HREF="#10_118_4">Description</A></LI>
1237 <LI><A HREF="#10_118_5">Example</A></LI>
1238 <LI><A HREF="#10_118_6">See Also</A></LI>
1239 </UL>
1240 <LI><A HREF="#ppdOpenFd">ppdOpenFd()</A></LI>
1241 <UL>
1242 <LI><A HREF="#10_119_1">Usage</A></LI>
1243 <LI><A HREF="#10_119_2">Arguments</A></LI>
1244 <LI><A HREF="#10_119_3">Returns</A></LI>
1245 <LI><A HREF="#10_119_4">Description</A></LI>
1246 <LI><A HREF="#10_119_5">Example</A></LI>
1247 <LI><A HREF="#10_119_6">See Also</A></LI>
1248 </UL>
1249 <LI><A HREF="#ppdOpenFile">ppdOpenFile()</A></LI>
1250 <UL>
1251 <LI><A HREF="#10_120_1">Usage</A></LI>
1252 <LI><A HREF="#10_120_2">Arguments</A></LI>
1253 <LI><A HREF="#10_120_3">Returns</A></LI>
1254 <LI><A HREF="#10_120_4">Description</A></LI>
1255 <LI><A HREF="#10_120_5">Example</A></LI>
1256 <LI><A HREF="#10_120_6">See Also</A></LI>
1257 </UL>
1258 <LI><A HREF="#ppdPageLength">ppdPageLength()</A></LI>
1259 <UL>
1260 <LI><A HREF="#10_121_1">Usage</A></LI>
1261 <LI><A HREF="#10_121_2">Arguments</A></LI>
1262 <LI><A HREF="#10_121_3">Returns</A></LI>
1263 <LI><A HREF="#10_121_4">Description</A></LI>
1264 <LI><A HREF="#10_121_5">Example</A></LI>
1265 <LI><A HREF="#10_121_6">See Also</A></LI>
1266 </UL>
1267 <LI><A HREF="#ppdPageSize">ppdPageSize()</A></LI>
1268 <UL>
1269 <LI><A HREF="#10_122_1">Usage</A></LI>
1270 <LI><A HREF="#10_122_2">Arguments</A></LI>
1271 <LI><A HREF="#10_122_3">Returns</A></LI>
1272 <LI><A HREF="#10_122_4">Description</A></LI>
1273 <LI><A HREF="#10_122_5">Example</A></LI>
1274 <LI><A HREF="#10_122_6">See Also</A></LI>
1275 </UL>
1276 <LI><A HREF="#ppdPageWidth">ppdPageWidth()</A></LI>
1277 <UL>
1278 <LI><A HREF="#10_123_1">Usage</A></LI>
1279 <LI><A HREF="#10_123_2">Arguments</A></LI>
1280 <LI><A HREF="#10_123_3">Returns</A></LI>
1281 <LI><A HREF="#10_123_4">Description</A></LI>
1282 <LI><A HREF="#10_123_5">Example</A></LI>
1283 <LI><A HREF="#10_123_6">See Also</A></LI>
1284 </UL>
1285 </UL>
1286 <HR>
1287 <H1 ALIGN="RIGHT"><A NAME="1">Preface</A></H1>
1288 <P>This software programmers manual provides software programming
1289 information for the Common UNIX Printing System (&quot;CUPS&quot;) Version 1.2.0.</P>
1290 <H2><A NAME="1_1">System Overview</A></H2>
1291 <P>CUPS provides a portable printing layer for UNIX&reg;-based operating
1292 systems. It has been developed by<A HREF="http://www.easysw.com"> Easy
1293 Software Products</A> to promote a standard printing solution for all
1294 UNIX vendors and users. CUPS provides the System V and Berkeley
1295 command-line interfaces.</P>
1296 <P>CUPS uses the Internet Printing Protocol (&quot;IPP&quot;) as the basis for
1297 managing print jobs and queues. The Line Printer Daemon (&quot;LPD&quot;) Server
1298 Message Block (&quot;SMB&quot;), and AppSocket (a.k.a. JetDirect) protocols are
1299 also supported with reduced functionality. CUPS adds network printer
1300 browsing and PostScript Printer Description (&quot;PPD&quot;) based printing
1301 options to support real-world printing under UNIX.</P>
1302 <P>CUPS also includes a customized version of GNU Ghostscript (currently
1303 based off GNU Ghostscript 5.50) and an image file RIP that are used to
1304 support non-PostScript printers. Sample drivers for HP and EPSON
1305 printers are included that use these filters.</P>
1306
1307 <!-- NEED 2in -->
1308 <H2><A NAME="1_2">Document Overview</A></H2>
1309 <P>This software programmers manual is organized into the following
1310 sections:</P>
1311 <UL>
1312 <LI><A HREF="#OVERVIEW">1 - Printing System Overview</A></LI>
1313 <LI><A HREF="#CUPS_API">2 - The CUPS API</A></LI>
1314 <LI><A HREF="#WRITING_FILTERS">3 - Writing Filters</A></LI>
1315 <LI><A HREF="#WRITING_DRIVERS">4 - Writing Printer Drivers</A></LI>
1316 <LI><A HREF="#WRITING_BACKENDS">5 - Writing Backends</A></LI>
1317 <LI><A HREF="#LICENSE">A - Software License Agreement</A></LI>
1318 <LI><A HREF="#CONSTANTS">B - Constants</A></LI>
1319 <LI><A HREF="#STRUCTURES">C - Structures</A></LI>
1320 <LI><A HREF="#FUNCTIONS">D - Functions</A></LI>
1321 </UL>
1322 <H2><A NAME="1_3">Notation Conventions</A></H2>
1323 <P>Various font and syntax conventions are used in this guide. Examples
1324 and their meanings and uses are explained below:
1325 <CENTER>
1326 <TABLE WIDTH="80%">
1327 <TR><TH>Example</TH><TD>&nbsp;&nbsp;&nbsp;</TD><TH>Description</TH></TR>
1328 <TR><TD>&nbsp;</TD></TR>
1329 <TR VALIGN="TOP"><TD><CODE>lpstat</CODE>
1330 <BR> <CODE>lpstat(1)</CODE></TD><TD>&nbsp;&nbsp;&nbsp;</TD><TD>The names of commands;
1331 the first mention of a command or function in a chapter is followed by
1332 a manual page section number.</TD></TR>
1333 <TR><TD>&nbsp;</TD></TR>
1334 <TR VALIGN="TOP"><TD><VAR>/var</VAR>
1335 <BR><VAR> /usr/share/cups/data/testprint.ps</VAR></TD><TD>&nbsp;&nbsp;&nbsp;</TD><TD>
1336 File and directory names.</TD></TR>
1337 <TR><TD>&nbsp;</TD></TR>
1338 <TR VALIGN="TOP"><TD NOWRAP><TT>Request ID is Printer-123</TT></TD><TD>
1339 &nbsp;&nbsp;&nbsp;</TD><TD>Screen output.</TD></TR>
1340 <TR><TD>&nbsp;</TD></TR>
1341 <TR VALIGN="TOP"><TD NOWRAP><KBD>lp -d printer filename ENTER</KBD></TD><TD>
1342 &nbsp;&nbsp;&nbsp;</TD><TD>Literal user input; special keys like <KBD>ENTER</KBD> are
1343 in ALL CAPS.</TD></TR>
1344 <TR><TD>&nbsp;</TD></TR>
1345 <TR VALIGN="TOP"><TD>12.3</TD><TD>&nbsp;&nbsp;&nbsp;</TD><TD>Numbers in the text are
1346 written using the period (.) to indicate the decimal point.</TD></TR>
1347 </TABLE>
1348 </CENTER>
1349
1350 <!-- NEED 3in -->
1351 </P>
1352 <H2><A NAME="1_4">Abbreviations</A></H2>
1353 The following abbreviations are used throughout this manual:
1354 <UL>
1355 <DL>
1356 <DT>kb</DT>
1357 <DD>Kilobytes, or 1024 bytes
1358 <BR>&nbsp;</DD>
1359 <DT>Mb</DT>
1360 <DD>Megabytes, or 1048576 bytes
1361 <BR>&nbsp;</DD>
1362 <DT>Gb</DT>
1363 <DD>Gigabytes, or 1073741824 bytes
1364 <BR>&nbsp;</DD>
1365 </DL>
1366 </UL>
1367 <H2><A NAME="1_5">Other References</A></H2>
1368 <UL>
1369 <DL>
1370 <DT>CUPS Software Administrators Manual</DT>
1371 <DD>An administration guide for the CUPS software.
1372 <BR>&nbsp;</DD>
1373 <DT>CUPS Software Users Manual</DT>
1374 <DD>An end-user guide for using the CUPS software.
1375 <BR>&nbsp;</DD>
1376 </DL>
1377 </UL>
1378 <H1 ALIGN="RIGHT"><A NAME="OVERVIEW">1 - Printing System Overview</A></H1>
1379 <P>This chapter provides an overview of how the Common UNIX Printing
1380 System works.</P>
1381 <H2><A NAME="2_1">The Printing Problem</A></H2>
1382 <P>For years<I> the printing problem</I> has plagued UNIX. Unlike
1383 Microsoft&reg; Windows&reg; or Mac OS, UNIX has no standard interface or system
1384 in place for supporting printers. Among the solutions currently
1385 available, the Berkeley and System V printing systems are the most
1386 prevalent.</P>
1387 <P>These printing systems support line printers (text only) or
1388 PostScript printers (text and graphics), and with some coaxing they can
1389 be made to support a full range of printers and file formats. However,
1390 because each varient of the UNIX operating system uses a different
1391 printing system than the next developing printer drivers for a wide
1392 range of printers and operating systems is extremely difficult. That
1393 combined with the limited volume of customers for each UNIX varient has
1394 forced most printer vendors to give up supporting UNIX entirely.</P>
1395 <P>CUPS is designed to eliminate<I> the printing problem</I>. One common
1396 printing system can be used by all UNIX varients to support the
1397 printing needs of users. Printer vendors can use its modular filter
1398 interface to develop a single driver program that supports a wide range
1399 of file formats with little or no effort. Since CUPS provides both the
1400 System V and Berkeley printing commands, users (and applications) can
1401 reap the benefits of this new technology with no changes.</P>
1402 <H2><A NAME="2_2">The Technology</A></H2>
1403 <P>CUPS is based upon an emerging Internet standard called the Internet
1404 Printing Protocol. IPP has been embraced by dozens of printer and
1405 printer server manufacturers and is supported by Microsoft Windows
1406 2000.</P>
1407 <P>IPP defines a standard protocol for printing as well as managing
1408 print jobs and printer options like media size, resolution, and so
1409 forth. Like all IP-based protocols, IPP can be used locally or over the
1410 Internet to printers hundreds or thousands of miles away. Unlike other
1411 protocols, however, IPP also supports access control, authentication,
1412 and encryption, making it a much more capable and secure printing
1413 solution than older ones.</P>
1414 <P>IPP is layered on top of the Hyper-Text Transport Protocol (&quot;HTTP&quot;)
1415 which is the basis of web servers on the Internet. This allows users to
1416 view documentation, check status information on a printer or server,
1417 and manage their printers, classes, and jobs using their web browser.</P>
1418 <P>CUPS provides a complete IPP/1.1 based printing system that provides
1419 Basic, Digest, and local certificate authentication and user, domain,
1420 or IP-based access control. TLS encryption will be available in future
1421 versions of CUPS.</P>
1422 <H2><A NAME="2_3">Jobs</A></H2>
1423 <P>Each file or set of files that is submitted for printing is called a<I>
1424 job</I>. Jobs are identified by a unique number starting at 1 and are
1425 assigned to a particular destination, usually a printer. Jobs can also
1426 have options associated with them such as media size, number of copies,
1427 and priority.</P>
1428 <H2><A NAME="2_4">Classes</A></H2>
1429 <P>CUPS supports collections of printers known as<I> classes</I>. Jobs
1430 sent to a class are forwarded to the first available printer in the
1431 class.</P>
1432 <H2><A NAME="2_5">Filters</A></H2>
1433 <P>Filters allow a user or application to print many types of files
1434 without extra effort. Print jobs sent to a CUPS server are filtered
1435 before sending them to a printer. Some filters convert job files to
1436 different formats that the printer can understand. Others perform page
1437 selection and ordering tasks.</P>
1438 <P>CUPS provides filters for printing many types of image files, HP-GL/2
1439 files, PDF files, and text files. CUPS also supplies PostScript and
1440 image file Raster Image Processor (&quot;RIP&quot;) filters that convert
1441 PostScript or image files into bitmaps that can be sent to a raster
1442 printer.</P>
1443 <H2><A NAME="2_6">Backends</A></H2>
1444 <P>Backends perform the most important task of all - they send the
1445 filtered print data to the printer.</P>
1446 <P>CUPS provides backends for printing over parallel, serial, and USB
1447 ports, and over the network via the IPP, JetDirect (AppSocket), and
1448 Line Printer Daemon (&quot;LPD&quot;) protocols. Additional backends are
1449 available in network service packages such as the SMB backend included
1450 with the popular SAMBA software.</P>
1451 <P>Backends are also used to determine the available devices. On startup
1452 each backend is asked for a list of devices it supports, and any
1453 information that is available. This allows the parallel backend to tell
1454 CUPS that an EPSON Stylus Color 600 printer is attached to parallel
1455 port 1, for example.</P>
1456 <H2><A NAME="2_7">Printer Drivers</A></H2>
1457 <P>Printer drivers in CUPS consist of one of more filters specific to a
1458 printer. CUPS includes sample printer drivers for Hewlett-Packard
1459 LaserJet and DeskJet printers and EPSON 9-pin, 24-pin, Stylus Color,
1460 and Stylus Photo printers. While these drivers do not generate optimal
1461 output for the different printer models, they do provide basic printing
1462 and demonstrate how you can write your own printer drivers and
1463 incorporate them into CUPS.</P>
1464 <H2><A NAME="2_8">Networking</A></H2>
1465 <P>Printers and classes on the local system are automatically shared
1466 with other systems on the network. This allows you to setup one system
1467 to print to a printer and use this system as a printer server or spool
1468 host for all of the others. Users may then select a local printer by
1469 name or a remote printer using &quot;name@server&quot;.</P>
1470 <P>CUPS also provides<I> implicit classes</I>, which are collections of
1471 printers and/or classes with the same name. This allows you to setup
1472 multiple servers pointing to the same physical network printer, for
1473 example, so that you aren't relying on a single system for printing.
1474 Because this also works with printer classes, you can setup multiple
1475 servers and printers and never worry about a single point of failure
1476 unless all of the printers and servers go down!</P>
1477 <H1 ALIGN="RIGHT"><A NAME="CUPS_API">2 - The CUPS API</A></H1>
1478 <P>This chapter describes the CUPS Application Programmers Interface
1479 (&quot;API&quot;).</P>
1480 <H2><A NAME="3_1">The CUPS API Library</A></H2>
1481 <P>The CUPS library provides a whole collection of interfaces needed to
1482 support the internal needs of the CUPS software as well as the needs of
1483 applications, filters, printer drivers, and backends.</P>
1484 <P>Unlike the rest of CUPS, the CUPS API library is provided under the
1485 GNU Library General Public License. This means that you can use the
1486 CUPS API library in both proprietary and open-source programs.</P>
1487 <P>Programs that use the CUPS API library typically will include the <CODE>
1488 &lt;cups/cups.h&gt;</CODE> header file:</P>
1489 <UL>
1490 <PRE>
1491 #include &lt;cups/cups.h&gt;
1492
1493 ...
1494
1495 jobid = cupsPrintFile(&quot;myprinter&quot;, &quot;filename.ps&quot;, &quot;title&quot;,
1496 num_options, options);
1497 </PRE>
1498 </UL>
1499 <P>Use the <CODE>-lcups</CODE> compiler option when linking to the CUPS
1500 API library:</P>
1501 <UL>
1502 <PRE>
1503 <B>cc -o program program.c -lcups ENTER</B>
1504 </PRE>
1505 </UL>
1506 <P>Additional options and libraries may be required depending on the
1507 operating system and the location of the CUPS API library.</P>
1508 <H3><A NAME="3_1_1">Detecting the CUPS API Library in GNU Autoconf</A></H3>
1509 <P>GNU autoconf is a popular configuration tool used by many programs.
1510 Add the following lines to your<VAR> configure.in</VAR> file to check
1511 for the CUPS API library in your configuration script:</P>
1512 <UL>
1513 <PRE>
1514 AC_CHECK_LIB(socket,socket,
1515 if test &quot;$uname&quot; != &quot;IRIX&quot;; then
1516 LIBS=&quot;-lsocket $LIBS&quot;
1517 else
1518 echo &quot;Not using -lsocket since you are running IRIX.&quot;
1519 fi)
1520 AC_CHECK_LIB(nsl,gethostbyaddr,
1521 if test &quot;$uname&quot; != &quot;IRIX&quot;; then
1522 LIBS=&quot;-lnsl $LIBS&quot;
1523 else
1524 echo &quot;Not using -lnsl since you are running IRIX.&quot;
1525 fi)
1526
1527 AC_CHECK_LIB(cups,httpConnect)
1528 </PRE>
1529 </UL>
1530 <H2><A NAME="3_2">Printing Services</A></H2>
1531 <P>The CUPS API library provides some basic printing services for
1532 applications that need to print files.</P>
1533 <H3><A NAME="3_2_1">Include Files</A></H3>
1534 <P>The include file used by all of these functions is <CODE>
1535 &lt;cups/cups.h&gt;</CODE>:</P>
1536 <UL>
1537 <PRE>
1538 #include &lt;cups/cups.h&gt;
1539 </PRE>
1540 </UL>
1541 <H3><A NAME="3_2_2">Printing a File</A></H3>
1542 <P>The CUPS API provides two functions for printing files. The first is <CODE>
1543 cupsPrintFile</CODE> which prints a single named file:</P>
1544 <UL>
1545 <PRE>
1546 #include &lt;cups/cups.h&gt;
1547
1548 ...
1549
1550 int jobid;
1551
1552 ...
1553
1554 jobid = cupsPrintFile(&quot;<I>name</I>&quot;, &quot;<I>filename</I>&quot;, &quot;<I>title</I>&quot;, 0, NULL);
1555 </PRE>
1556 </UL>
1557 <P>The <CODE>name</CODE> string is the name of the printer or class to
1558 print to. The <CODE>filename</CODE> string is the name of the file to
1559 print. The <CODE>title</CODE> string is the name of the print job, e.g.
1560 &quot;Acme Word Document&quot;.</P>
1561 <P>The return value is a unique ID number for the print job or 0 if
1562 there was an error.</P>
1563 <H3><A NAME="3_2_3">Printing Multiple Files</A></H3>
1564 <P>The second printing function is <CODE>cupsPrintFiles</CODE>:</P>
1565 <UL>
1566 <PRE>
1567 #include &lt;cups/cups.h&gt;
1568
1569 ...
1570
1571 int jobid;
1572 int num_files;
1573 const char *files[100];
1574 ...
1575
1576 jobid = cupsPrintFiles(&quot;name&quot;, <I>num_files</I>, <I>files</I>, &quot;title&quot;, 0, NULL);
1577 </PRE>
1578 </UL>
1579 <P>Instead of passing a filename string as with <CODE>cupsPrintFile()</CODE>
1580 you pass a file count (<CODE>num_files</CODE>) and filename pointer
1581 array (<CODE>files</CODE>) for each file that you want to print.</P>
1582 <P>As with <CODE>cupsPrintFile()</CODE> the return value is a unique ID
1583 for the print job.</P>
1584 <H3><A NAME="3_2_4">Cancelling Jobs</A></H3>
1585 <P>The <CODE>cupsCancelJob()</CODE> function cancels a queued print job:</P>
1586 <UL>
1587 <PRE>
1588 #include &lt;cups/cups.h&gt;
1589
1590 ...
1591
1592 int jobid;
1593 int status;
1594 ...
1595
1596 status = cupsCancelJob(&quot;<I>name</I>&quot;, <I>jobid</I>);
1597 </PRE>
1598 </UL>
1599 <P>The <CODE>name</CODE> string specifies the destination and is used to
1600 determine the server to send the request to. The <CODE>jobid</CODE>
1601 value is the integer returned from a previous <CODE>cupsPrintFile()</CODE>
1602 or <CODE>cupsPrintFiles()</CODE> call.</P>
1603 <P><CODE>cupsCancelJob()</CODE> returns <CODE>1</CODE> if the job was
1604 successfully cancelled and <CODE>0</CODE> if there was an error.</P>
1605 <H3><A NAME="3_2_5">Getting the Available Printers and Classes</A></H3>
1606 <P>The <CODE>cupsGetDests()</CODE> function can be used to get a list of
1607 the available printers, classes, and instances that a user has defined:</P>
1608 <UL>
1609 <PRE>
1610 #include &lt;cups/cups.h&gt;
1611
1612 ...
1613
1614 int num_dests;
1615 cups_dest_t *dests;
1616
1617 ...
1618
1619 num_dests = cupsGetDests(&amp;dests);
1620 </PRE>
1621 </UL>
1622 <P>Each destination is stored in a <CODE>cups_dest_t</CODE> structure
1623 which defines the printer or class name, the instance name (if any), if
1624 it is the default destination, and the default options the user has
1625 defined for the destination:</P>
1626 <UL>
1627 <PRE>
1628 typedef struct /**** Destination ****/
1629 {
1630 char *name, /* Printer or class name */
1631 *instance; /* Local instance name or NULL */
1632 int is_default; /* Is this printer the default? */
1633 int num_options; /* Number of options */
1634 cups_option_t *options; /* Options */
1635 } cups_dest_t;
1636 </PRE>
1637 </UL>
1638 <P>The destinations are sorted by name and instance for your
1639 convenience. Once you have the list of available destinations, you can
1640 lookup a specific destination using the <CODE>cupsGetDest()</CODE>
1641 function:</P>
1642 <UL>
1643 <PRE>
1644 #include &lt;cups/cups.h&gt;
1645
1646 ...
1647
1648 int num_dests;
1649 cups_dest_t *dests;
1650 cups_dest_t *mydest;
1651
1652 ...
1653
1654 mydest = cupsGetDest(&quot;<I>name</I>&quot;, &quot;<I>instance</I>&quot;, num_dests, dests);
1655 </PRE>
1656 </UL>
1657 <P>The <CODE>name</CODE> string is the printer or class name. You can
1658 pass a value of <CODE>NULL</CODE> to get the default destination.</P>
1659 <P>The <CODE>instance</CODE> string is the user-defined instance name.
1660 Pass <CODE>NULL</CODE> to select the default instance, e.g. &quot;name&quot;
1661 instead of &quot;name/instance&quot;.</P>
1662 <H3><A NAME="3_2_6">Printing with Options</A></H3>
1663 <P>All of the previous printing examples have passed <CODE>0</CODE> and <CODE>
1664 NULL</CODE> for the last two arguments to the <CODE>cupsPrintFile()</CODE>
1665 and <CODE>cupsPrintFiles()</CODE> functions. These last two arguments
1666 are the number of options and a pointer to the option array:</P>
1667 <UL>
1668 <PRE>
1669 int cupsPrintFile(const char *name, const char *filename, const char *title,
1670 int num_options, cups_option_t *options);
1671 int cupsPrintFiles(const char *name, int num_files, const char **files,
1672 const char *title, int num_options,
1673 cups_option_t *options);
1674 </PRE>
1675 </UL>
1676 <P>The <CODE>cups_option_t</CODE> structure holds each option and its
1677 value. These are converted as needed and passed to the CUPS server when
1678 printing a file.</P>
1679 <P>The simplest way of handling options is to use the <CODE>num_options</CODE>
1680 and <CODE>options</CODE> members of the <CODE>cups_dest_t</CODE>
1681 structure described earlier:</P>
1682 <UL>
1683 <PRE>
1684 #include &lt;cups/cups.h&gt;
1685
1686 ...
1687
1688 int jobid;
1689 int num_dests;
1690 cups_dest_t *dests;
1691 cups_dest_t *mydest;
1692
1693 ...
1694
1695 mydest = cupsGetDest(&quot;<I>name</I>&quot;, &quot;<I>instance</I>&quot;, num_dests, dests);
1696
1697 jobid = cupsPrintFile(mydest-&gt;name, &quot;filename&quot;, &quot;title&quot;,
1698 mydest-&gt;num_options, mydest-&gt;options);
1699 </PRE>
1700 </UL>
1701 <P>This effectively uses the options a user has previous selected
1702 without a lot of code.</P>
1703 <H3><A NAME="3_2_7">Setting Printer Options</A></H3>
1704 <P>Options can also be set by your program using the <CODE>
1705 cupsAddOption()</CODE> function:</P>
1706 <UL>
1707 <PRE>
1708 #include &lt;cups/cups.h&gt;
1709
1710 ...
1711
1712 int num_options;
1713 cups_option_t *options;
1714
1715 ...
1716
1717 num_options = 0;
1718 options = NULL;
1719
1720 ...
1721
1722 num_options = cupsAddOption(&quot;<I>name</I>&quot;, &quot;<I>value</I>&quot;, num_options, &amp;options);
1723 num_options = cupsAddOption(&quot;<I>name</I>&quot;, &quot;<I>value</I>&quot;, num_options, &amp;options);
1724 num_options = cupsAddOption(&quot;<I>name</I>&quot;, &quot;<I>value</I>&quot;, num_options, &amp;options);
1725 num_options = cupsAddOption(&quot;<I>name</I>&quot;, &quot;<I>value</I>&quot;, num_options, &amp;options);
1726 </PRE>
1727 </UL>
1728 <P>The <CODE>name</CODE> string is the name of the option, and the <CODE>
1729 value</CODE> string is the value for that option.</P>
1730 <P>Each call to <CODE>cupsAddOption()</CODE> returns the new number of
1731 options. Since adding two options with the same name overwrites the
1732 first value with the second, do not assume that calling <CODE>
1733 cupsAddOptions()</CODE> 20 times will result in 20 options.</P>
1734 <P>Call <CODE>cupsFreeOptions</CODE> once you are done using the
1735 options:</P>
1736 <UL>
1737 <PRE>
1738 #include &lt;cups/cups.h&gt;
1739
1740 ...
1741
1742 int num_options;
1743 cups_option_t *options;
1744
1745 ...
1746
1747 cupsFreeOptions(num_options, options);
1748 </PRE>
1749 </UL>
1750 <H3><A NAME="3_2_8">Getting Errors</A></H3>
1751 <P>If any of the CUPS API printing functions returns an error, the
1752 reason for that error can be found by calling <CODE>cupsLastError()</CODE>
1753 and <CODE>cupsErrorString()</CODE>. <CODE>cupsLastError()</CODE>
1754 returns the last IPP error code that was encountered. <CODE>
1755 cupsErrorString()</CODE> converts the error code to a localized message
1756 string suitable for presentation to the user:</P>
1757 <UL>
1758 <PRE>
1759 #include &lt;cups/cups.h&gt;
1760
1761 ...
1762
1763 int jobid;
1764
1765 ...
1766
1767 if (jobid == 0)
1768 puts(cupsErrorString(cupsLastError()));
1769 </PRE>
1770 </UL>
1771 <H3><A NAME="3_2_9">Passwords and Authentication</A></H3>
1772 <P>CUPS supports authentication of any request, including submission of
1773 print jobs. The default mechanism for getting the username and password
1774 is to use the login user and a password from the console.</P>
1775 <P>To support other types of applications, in particular Graphical User
1776 Interfaces (&quot;GUIs&quot;), the CUPS API provides functions to set the default
1777 username and to register a callback function that returns a password
1778 string.</P>
1779 <P>The<A HREF="#cupsSetPasswordCB"> <CODE>cupsSetPasswordCB()</CODE></A>
1780 function is used to set a password callback in your program. Only one
1781 function can be used at any time.</P>
1782 <P>The<A HREF="#cupsSetUser"> <CODE>cupsSetUser()</CODE></A> function
1783 sets the current username for authentication. This function can be
1784 called by your password callback function to change the current
1785 username as needed.</P>
1786 <P>The following example shows a simple password callback that gets a
1787 username and password from the user:</P>
1788 <UL>
1789 <PRE>
1790 #include &lt;cups/cups.h&gt;
1791
1792 const char *
1793 my_password_cb(const char *prompt)
1794 {
1795 char user[65];
1796
1797
1798 puts(prompt);
1799
1800 /* Get a username from the user */
1801 printf(&quot;Username: &quot;);
1802 if (fgets(user, sizeof(user), stdin) == NULL)
1803 return (NULL);
1804
1805 /* Strip the newline from the string and set the user */
1806 user[strlen(user) - 1] = '\0';
1807
1808 cupsSetUser(user);
1809
1810 /* Use getpass() to ask for the password... */
1811 return (getpass(&quot;Password: &quot;));
1812 }
1813
1814 ...
1815
1816 cupsSetPasswordCB(my_password_cb);
1817 </PRE>
1818 </UL>
1819 <P>Similarly, a GUI interface could display the prompt string in a
1820 window with input fields for the username and password. The username
1821 should probably default to the value of<A HREF="#cupsUser"> <CODE>
1822 cupsUser()</CODE></A> to make things easier on the user.</P>
1823 <H2><A NAME="3_3">PPD Services</A></H2>
1824 <P>CUPS includes functions to access and manipulate PostScript Printer
1825 Description (&quot;PPD&quot;) files that are used with the printer drivers in
1826 CUPS.</P>
1827 <P>Each PPD file enumerates the available features provided by a
1828 printer, including conflict information for specific options (e.g.
1829 can't duplex output on envelopes.)</P>
1830 <H3><A NAME="3_3_1">Include Files</A></H3>
1831 <P>Include the <CODE>&lt;cups/ppd.h&gt;</CODE> header file to use the PPD
1832 functions:</P>
1833 <UL>
1834 <PRE>
1835 #include &lt;cups/ppd.h&gt;
1836 </PRE>
1837 </UL>
1838 <P>This header file is also included by the <CODE>&lt;cups/cups.h&gt;</CODE>
1839 header file.</P>
1840 <H3><A NAME="3_3_2">Getting a PPD File for a Printer</A></H3>
1841 <P>The <CODE>cupsGetPPD()</CODE> function retrieves the PPD file for the
1842 named printer or class:</P>
1843 <UL>
1844 <PRE>
1845 #include &lt;cups/cups.h&gt;
1846
1847 ...
1848
1849 const char *filename;
1850
1851 filename = cupsGetPPD(&quot;<I>name</I>&quot;);
1852 </PRE>
1853 </UL>
1854 <P>The <CODE>name</CODE> string is the name of the printer or class,
1855 including the remote server name as appropriate (e.g.
1856 &quot;printer@server&quot;.)</P>
1857 <P>The return value is a pointer to a filename in static storage; this
1858 value is overwritten with each call to <CODE>cupsGetPPD()</CODE>. If
1859 the printer or class does not exist, a <CODE>NULL</CODE> pointer will
1860 be returned.</P>
1861 <H3><A NAME="3_3_3">Loading a PPD File</A></H3>
1862 <P>The <CODE>ppdOpenFile()</CODE> function &quot;opens&quot; a PPD file and loads
1863 it into memory:</P>
1864 <UL>
1865 <PRE>
1866 #include &lt;cups/ppd.h&gt;
1867
1868 ...
1869
1870 ppd_file_t *ppd;
1871
1872 ppd = ppdOpenFile(&quot;<I>filename</I>&quot;);
1873 </PRE>
1874 </UL>
1875 <P>The <CODE>filename</CODE> string is the name of the file to load,
1876 such as the value returned by the <CODE>cupsGetPPD()</CODE> function.</P>
1877 <P>The return value is a pointer to a structure describing the contents
1878 of the PPD file or NULL if the PPD file could not be read.</P>
1879 <H3><A NAME="3_3_4">Freeing PPD File Information</A></H3>
1880 <P>Once you are done using a PPD file, call the <CODE>ppdClose()</CODE>
1881 function to free all memory that has been used:</P>
1882 <UL>
1883 <PRE>
1884 #include &lt;cups/ppd.h&gt;
1885
1886 ...
1887
1888 ppd_file_t *ppd;
1889
1890 ...
1891
1892 ppdClose(ppd);
1893 </PRE>
1894 </UL>
1895 <H3><A NAME="3_3_5">The PPD File Structure</A></H3>
1896 <P>Each PPD file contains a number of capability attributes, printer
1897 options, and conflict definitions. The page size options also include
1898 the physical margins for the printer and the minimum and maximum sizes
1899 for the printer. All of this information is stored in the <CODE>
1900 ppd_file_t</CODE> structure.</P>
1901 <H4>Capabilities</H4>
1902 <P>Each PPD file contains a number of informational attributes that
1903 describe the capabilities of the printer. These are provided in the <CODE>
1904 ppd_file_t</CODE> structure in the following members:
1905 <CENTER>
1906 <TABLE BORDER="1" WIDTH="80%">
1907 <TR><TH>Member</TH><TH>Type</TH><TH>Description</TH></TR>
1908 <TR><TD><CODE>accurate_screens</CODE></TD><TD><CODE>int</CODE></TD><TD>1
1909 = supports accurate screens</TD></TR>
1910 <TR><TD><CODE>color_device</CODE></TD><TD><CODE>int</CODE></TD><TD>1 =
1911 color device</TD></TR>
1912 <TR><TD><CODE>colorspace</CODE></TD><TD><CODE>ppd_cs_t</CODE></TD><TD>
1913 Default colorspace: PPD_CS_CMYK, PPD_CS_CMY, PPD_CS_GRAY, PPD_CS_RGB,
1914 PPD_CS_RGBK, PPD_CS_N</TD></TR>
1915 <TR><TD><CODE>contone_only</CODE></TD><TD><CODE>int</CODE></TD><TD>1 =
1916 printer is continuous tone only</TD></TR>
1917 <TR><TD><CODE>num_emulations
1918 <BR> emulations</CODE></TD><TD><CODE>int
1919 <BR> ppd_emul_t *</CODE></TD><TD>Emulations supported by the printer</TD>
1920 </TR>
1921 <TR><TD><CODE>flip_duplex</CODE></TD><TD><CODE>int</CODE></TD><TD>1 =
1922 need to flip odd pages when duplexing</TD></TR>
1923 <TR><TD><CODE>num_fonts
1924 <BR> fonts</CODE></TD><TD><CODE>int
1925 <BR> char **</CODE></TD><TD>The fonts available on the printer.</TD></TR>
1926 <TR><TD><CODE>jcl_begin
1927 <BR> jcl_ps
1928 <BR> jcl_end</CODE></TD><TD><CODE>char *</CODE></TD><TD>Job Control
1929 Language commands for PostScript output</TD></TR>
1930 <TR><TD><CODE>landscape</CODE></TD><TD><CODE>int</CODE></TD><TD>
1931 Landscape orientation, -90 or 90 degrees</TD></TR>
1932 <TR><TD><CODE>lang_encoding</CODE></TD><TD><CODE>char *</CODE></TD><TD>
1933 The character used for the option strings</TD></TR>
1934 <TR><TD><CODE>lang_version</CODE></TD><TD><CODE>char *</CODE></TD><TD>
1935 The language used for the options strings (English, French, etc.)</TD></TR>
1936 <TR><TD><CODE>language_level</CODE></TD><TD><CODE>int</CODE></TD><TD>
1937 PostScript language level, 1 to 3</TD></TR>
1938 <TR><TD><CODE>manual_copies</CODE></TD><TD><CODE>int</CODE></TD><TD>1 =
1939 Copies are done manually</TD></TR>
1940 <TR><TD><CODE>model_number</CODE></TD><TD><CODE>int</CODE></TD><TD>
1941 Driver-specific model number.</TD></TR>
1942 <TR><TD><CODE>patches</CODE></TD><TD><CODE>char *</CODE></TD><TD>Patch
1943 commands to send to the printer</TD></TR>
1944 <TR><TD><CODE>manufacturer</CODE></TD><TD><CODE>char *</CODE></TD><TD>
1945 The Manufacturer attribute from the PPD file, if any</TD></TR>
1946 <TR><TD><CODE>modelname</CODE></TD><TD><CODE>char *</CODE></TD><TD>The
1947 ModelName attribute from the PPD file</TD></TR>
1948 <TR><TD><CODE>nickname</CODE></TD><TD><CODE>char *</CODE></TD><TD>The
1949 NickName attribute from the PPD file, if any</TD></TR>
1950 <TR><TD><CODE>product</CODE></TD><TD><CODE>char *</CODE></TD><TD>The
1951 Product attribute from the PPD file, if any</TD></TR>
1952 <TR><TD><CODE>shortnickname</CODE></TD><TD><CODE>char *</CODE></TD><TD>
1953 The ShortNickName attribute from the PPD file, if any</TD></TR>
1954 <TR><TD><CODE>throughput</CODE></TD><TD><CODE>int</CODE></TD><TD>Number
1955 of pages per minute</TD></TR>
1956 <TR><TD><CODE>ttrasterizer</CODE></TD><TD><CODE>char *</CODE></TD><TD>
1957 The TruType font rasterizer (Type42)</TD></TR>
1958 <TR><TD><CODE>variable_sizes</CODE></TD><TD><CODE>int</CODE></TD><TD>1 =
1959 supports variable sizes</TD></TR>
1960 </TABLE>
1961 </CENTER>
1962 </P>
1963 <H4>Options and Groups</H4>
1964 <P>PPD files support multiple options, which are stored in <CODE>
1965 ppd_option_t</CODE> and <CODE>ppd_choice_t</CODE> structures by the PPD
1966 functions.</P>
1967 <P>Each option in turn is associated with a group stored in the <CODE>
1968 ppd_group_t</CODE> structure. Groups can be specified in the PPD file;
1969 if an option is not associated with a group then it is put in a
1970 &quot;General&quot; or &quot;Extra&quot; group depending on the option.</P>
1971 <P>Groups can also have sub-groups; CUPS currently limits the depth of
1972 sub-groups to 1 level to reduce programming complexity.</P>
1973 <H4>Conflicts</H4>
1974 <P>PPD files support specification of conflict conditions between
1975 different options. Conflicts are stored in <CODE>ppd_conflict_t</CODE>
1976 structures which specify the options that conflict with each other.</P>
1977 <H4>Page Sizes</H4>
1978 <P>PPD files specify all of the available pages sizes and the physical
1979 margins associated with them. These sizes are stored in <CODE>
1980 ppd_size_t</CODE> structures and are available in the <CODE>num_sizes</CODE>
1981 and <CODE>sizes</CODE> members of the <CODE>ppd_file_t</CODE>
1982 structure. You can lookup a particular page size with the <CODE>
1983 ppdPageWidth()</CODE>, <CODE>ppdPageLength()</CODE>, and <CODE>
1984 ppdPageSize()</CODE> functions:</P>
1985 <UL>
1986 <PRE>
1987 #include &lt;cups/ppd.h&gt;
1988
1989 ...
1990
1991 ppd_file_t *ppd;
1992 ppd_size_t *size;
1993 float width;
1994 float length;
1995
1996 ...
1997
1998 size = ppdPageSize(ppd, &quot;<I>size</I>&quot;);
1999 width = ppdPageWidth(ppd, &quot;<I>size</I>&quot;);
2000 length = ppdPageLength(ppd, &quot;<I>size</I>&quot;);
2001 </PRE>
2002 </UL>
2003 <P>The <CODE>size</CODE> string is the named page size option. The width
2004 and length are in points; there are 72 points per inch. The <CODE>
2005 ppd_size_t</CODE> structure contains the width, length, and margin
2006 information:</P>
2007 <UL>
2008 <PRE>
2009 typedef struct /**** Page Sizes ****/
2010 {
2011 int marked; /* Page size selected? */
2012 char name[41]; /* Media size option */
2013 float width, /* Width of media in points */
2014 length, /* Length of media in points */
2015 left, /* Left printable margin in points */
2016 bottom, /* Bottom printable margin in points */
2017 right, /* Right printable margin in points */
2018 top; /* Top printable margin in points */
2019 } ppd_size_t;
2020 </PRE>
2021 </UL>
2022 <H4>Custom Page Sizes</H4>
2023 <P>Besides the standard page sizes listed in a PPD file, some printers
2024 support variable or custom page sizes. If <CODE>variables_sizes</CODE>
2025 is non-zero, the <CODE>custom_min</CODE>, <CODE>custom_max</CODE>, and <CODE>
2026 custom_margins</CODE> members of the <CODE>ppd_file_t</CODE> structure
2027 define the limits of the variable sizes.</P>
2028 <P>To get the resulting media size, use a page size string of <CODE>
2029 Custom.<I>width</I>x<I>length</I></CODE>, where <CODE>width</CODE> and <CODE>
2030 length</CODE> are integer values in points:</P>
2031 <UL>
2032 <PRE>
2033 Custom.612x792 [8.5 inches wide, 11 inches long]
2034 Custom.1224x792 [17 inches wide, 11 inches long]
2035 </PRE>
2036 </UL>
2037 <H3><A NAME="3_3_6">Marking Options</A></H3>
2038 <P>Before marking any user-defined options, call the <CODE>
2039 ppdMarkDefaults()</CODE> function to mark the default options from the
2040 PPD file:</P>
2041 <UL>
2042 <PRE>
2043 #include &lt;cups/ppd.h&gt;
2044
2045 ...
2046
2047 ppd_file_t *ppd;
2048
2049 ...
2050
2051 ppdMarkDefaults(ppd);
2052 </PRE>
2053 </UL>
2054 <P>Then call the <CODE>ppdMarkOption()</CODE> function to mark
2055 individual options:</P>
2056 <UL>
2057 <PRE>
2058 #include &lt;cups/ppd.h&gt;
2059
2060 ...
2061
2062 ppd_file_t *ppd;
2063 int conflicts;
2064
2065 ...
2066
2067 conflicts = ppdMarkOption(ppd, &quot;<I>name</I>&quot;, &quot;<I>value</I>&quot;);
2068 </PRE>
2069 </UL>
2070 <P>The <CODE>name</CODE> and <CODE>value</CODE> strings choose a
2071 particular option and choice, respectively. The return value is 0 if
2072 there are not conflicts created by the selection.</P>
2073 <P>CUPS also provides a convenience function for marking all options in
2074 the <CODE>cups_option_t</CODE> structure:</P>
2075 <UL>
2076 <PRE>
2077 #include &lt;cups/cups.h&gt;
2078
2079 ...
2080
2081 ppd_file_t *ppd;
2082 int num_options;
2083 cups_option_t *options;
2084 int conflicts;
2085
2086 ...
2087
2088 conflicts = cupsMarkOptions(ppd, num_options, options);
2089 </PRE>
2090 </UL>
2091 <P>The <CODE>cupsMarkOptions()</CODE> function also handles mapping the
2092 IPP job template attributes to PPD options. The return value is the
2093 number of conflicts present.</P>
2094 <H3><A NAME="3_3_7">Checking for Conflicts</A></H3>
2095 <P>The <CODE>ppdMarkOption()</CODE> and <CODE>cupsMarkOptions()</CODE>
2096 functions return the number of conflicts with the currently marked
2097 options.</P>
2098 <P>Call the <CODE>ppdConflicts()</CODE> function to get the number of
2099 conflicts after you have marked all of the options:</P>
2100 <UL>
2101 <PRE>
2102 #include &lt;cups/cups.h&gt;
2103
2104 ...
2105
2106 ppd_file_t *ppd;
2107 int conflicts;
2108
2109 ...
2110
2111 conflicts = ppdConflicts(ppd);
2112 </PRE>
2113 </UL>
2114 <P>The return value is the number of conflicting options, or 0 if there
2115 are no conflicts.</P>
2116 <H1 ALIGN="RIGHT"><A NAME="WRITING_FILTERS">3 - Writing Filters</A></H1>
2117 <P>This chapter describes how to write a file filter for CUPS.</P>
2118 <H2><A NAME="4_1">Overview</A></H2>
2119 <P>File filters are programs that convert from one or more MIME types to
2120 another type. Filters use a common command-line and environment
2121 interface that allows them to be joined as needed to print files to any
2122 type of printer.</P>
2123 <H3><A NAME="4_1_1">Security Considerations</A></H3>
2124 <P>Filters are normally run as a non-priviledged user, so the major
2125 security consideration is resource utilization - filters should not
2126 depend on unlimited amounts of memory and disk space.</P>
2127 <H3><A NAME="4_1_2">Users and Groups</A></H3>
2128 <P>The default CUPS configuration runs filters as user &quot;lp&quot; and group
2129 &quot;other&quot;.</P>
2130 <H3><A NAME="4_1_3">Temporary Files</A></H3>
2131 <P>Temporary files should be created in the directory specified by the
2132 &quot;TMPDIR&quot; environment variable. The<A HREF="#cupsTempFile"> <CODE>
2133 cupsTempFile()</CODE></A> function can be used to safely choose
2134 temporary files in this directory.</P>
2135 <H3><A NAME="4_1_4">Sending Messages to the User</A></H3>
2136 <P>The CUPS scheduler collects messages sent to the standard error file
2137 by the filter. These messages are relayed to the user based upon the
2138 scheduler <CODE>LogLevel</CODE> directive.</P>
2139 <P>The type of message is determined by an initial prefix sent on each
2140 line:</P>
2141 <UL>
2142 <LI><CODE>DEBUG:</CODE> - a debug message</LI>
2143 <LI><CODE>INFO:</CODE> - an informational message</LI>
2144 <LI><CODE>WARNING:</CODE> - a warning message</LI>
2145 <LI><CODE>ERROR:</CODE> - an error message</LI>
2146 <LI><CODE>PAGE:</CODE> - a page accounting message</LI>
2147 </UL>
2148 <P>If the line of text does not begin with any of the above prefixes, it
2149 is treated as a debug message. Text following the prefix is copied to
2150 the <CODE>printer-state-message</CODE> attribute for the printer, and
2151 also added to the<VAR> error_log</VAR> unless it is an informational or
2152 page accounting message.</P>
2153 <H3><A NAME="4_1_5">Page Accounting</A></H3>
2154 <P>Page accounting messages are used to inform the server when one or
2155 more pages are printed. Each line has the form:</P>
2156 <UL>
2157 <PRE>
2158 PAGE: page-number copy-count
2159 </PRE>
2160 </UL>
2161 <P>The<I> page-number</I> field is the current page number, starting at
2162 1. The<I> copy-count</I> field specifies the number of copies of that
2163 page that was produced.</P>
2164 <P>Page account messages are added to the<VAR> page_log</VAR> file and
2165 cause the <CODE>job-sheets-completed</CODE> attribute to be updated for
2166 the job.</P>
2167 <H3><A NAME="4_1_6">Command-Line Arguments</A></H3>
2168 <P>Every filter accepts exactly 6 or 7 command-line arguments:</P>
2169 <UL>
2170 <PRE>
2171 printer job user title copies options [filename]
2172 </PRE>
2173 <LI><CODE>printer</CODE> - The name of the printer queue (normally this
2174 is the name of the program being run)</LI>
2175 <LI><CODE>job</CODE> - The numeric job ID for the job being printed</LI>
2176 <LI><CODE>user</CODE> - The string from the <CODE>originating-user-name</CODE>
2177 attribute</LI>
2178 <LI><CODE>title</CODE> - The string from the <CODE>job-name</CODE>
2179 attribute</LI>
2180 <LI><CODE>copies</CODE> - The numeric value from the <CODE>number-copies</CODE>
2181 attribute</LI>
2182 <LI><CODE>options</CODE> - String representations of the job template
2183 attributes, separated by spaces. Boolean attributes are provided as
2184 &quot;name&quot; for true values and &quot;noname&quot; for false values. All other
2185 attributes are provided as &quot;name=value&quot; for single-valued attributes
2186 and &quot;name=value1,value2,...,valueN&quot; for set attributes</LI>
2187 <LI><CODE>filename</CODE> - The request file</LI>
2188 </UL>
2189 <P>The<I> filename</I> argument is only provided to the first filter in
2190 the chain; all filters<B> must</B> be prepared to read the print file
2191 from the standard input if the<I> filename</I> argument is omitted.</P>
2192 <H3><A NAME="4_1_7">Copy Generation</A></H3>
2193 <P>The<I> copies</I> argument specifies the number of copies to produce
2194 of the input file. In general, you should only generate copies if the<I>
2195 filename</I> argument is supplied. The only exception to this are
2196 filters that produce device-independent PostScript output (without any
2197 printer commands from the printer's PPD file), since the PostScript
2198 filter <CODE>pstops</CODE> is responsible for copy generation.</P>
2199 <H3><A NAME="4_1_8">Environment Variables</A></H3>
2200 <P>Every filter receives a fixed set of environment variables that can
2201 be used by the filter:</P>
2202 <UL>
2203 <LI><CODE>CHARSET</CODE> - The character set used by the client for this
2204 print file</LI>
2205 <LI><CODE>CONTENT_TYPE</CODE> - The original document type, such as
2206 &quot;application/postscript&quot;</LI>
2207 <LI><CODE>CUPS_DATADIR</CODE> - The location of CUPS data files</LI>
2208 <LI><CODE>CUPS_SERVERROOT</CODE> - The location of CUPS configuration
2209 files</LI>
2210 <LI><CODE>DEVICE_URI</CODE> - The output device URI</LI>
2211 <LI><CODE>LANG</CODE> - The language used by the client for this print
2212 file</LI>
2213 <LI><CODE>PATH</CODE> - The execution path exported to the filter</LI>
2214 <LI><CODE>PPD</CODE> - The full filename of the printer's PPD file</LI>
2215 <LI><CODE>PRINTER</CODE> - The name of the printer queue</LI>
2216 <LI><CODE>RIP_CACHE</CODE> - The maximum amount of memory each filter
2217 should use</LI>
2218 <LI><CODE>SOFTWARE</CODE> - The name of the CUPS software, typically
2219 &quot;CUPS/1.1&quot;</LI>
2220 <LI><CODE>TZ</CODE> - The local timezone</LI>
2221 <LI><CODE>USER</CODE> - The name of the current user</LI>
2222 </UL>
2223 <H2><A NAME="4_2">Dissecting the HP-GL/2 Filter</A></H2>
2224 <P>The HP-GL/2 filter (<CODE>hpgltops</CODE>) provided with CUPS is a
2225 complex program that converts HP-GL/2 files into device-independent
2226 PostScript output. Since it produces device-independent PostScript
2227 output, it does not need to handle copy generation or writing printer
2228 options from the printer's PPD file.</P>
2229 <H3><A NAME="4_2_1">Initializing the Filter</A></H3>
2230 <P>The first task of any filter is to ensure that the correct number of
2231 command-line arguments are present:</P>
2232 <UL>
2233 <PRE>
2234 if (argc &lt; 6 || argc &gt; 7)
2235 {
2236 fputs(&quot;ERROR: hpgltops job-id user title copies options [file]\n&quot;, stderr);
2237 return (1);
2238 }
2239 </PRE>
2240 </UL>
2241 <P>After this you open the print file or read from the standard input as
2242 needed:</P>
2243 <UL>
2244 <PRE>
2245 FILE *fp;
2246
2247 /*
2248 * If we have 7 arguments, print the file named on the command-line.
2249 * Otherwise, send stdin instead...
2250 */
2251
2252 if (argc == 6)
2253 fp = stdin;
2254 else
2255 {
2256 /*
2257 * Try to open the print file...
2258 */
2259
2260 if ((fp = fopen(argv[6], &quot;rb&quot;)) == NULL)
2261 {
2262 perror(&quot;ERROR: unable to open print file - &quot;);
2263 return (1);
2264 }
2265 }
2266 </PRE>
2267 </UL>
2268 <P>Once the print file has been opened, options can be processed using
2269 the<A HREF="#cupsParseOptions"> <CODE>cupsParseOptions()</CODE></A> and<A
2270 HREF="#cupsGetOption"> <CODE>cupsGetOption()</CODE></A> functions:</P>
2271 <UL>
2272 <PRE>
2273 int num_options;
2274 cups_option_t *options;
2275 const char *val;
2276
2277 /*
2278 * Process command-line options and write the prolog...
2279 */
2280
2281 options = NULL;
2282 num_options = cupsParseOptions(argv[5], 0,
2283
2284 if ((val = cupsGetOption(&quot;blackplot&quot;, num_options, options)) != NULL)
2285 shading = 0;
2286
2287 if ((val = cupsGetOption(&quot;fitplot&quot;, num_options, options)) != NULL)
2288 FitPlot = 1;
2289
2290 if ((val = cupsGetOption(&quot;penwidth&quot;, num_options, options)) != NULL)
2291 PenWidth = (float)atoi(val) * 0.001f;
2292 </PRE>
2293 </UL>
2294 <P>After the options have been processed, the filter writes PostScript
2295 code to the standard output based on the print file, closes the print
2296 file (as needed), and returns 0 to the scheduler.</P>
2297 <H2><A NAME="4_3">PostScript Output</A></H2>
2298 <P>Filters that produce PostScript output must generate output
2299 conforming to the Adobe Document Structuring Conventions, 3.0. In
2300 general this means the beginning of each file must begin with:</P>
2301 <UL>
2302 <PRE>
2303 %!PS-Adobe-3.0
2304 %%BoundingBox: left bottom right top
2305 %%Pages: (atend)
2306 %%EndComments
2307 </PRE>
2308 </UL>
2309 <P>The<I> left</I>,<I> bottom</I>,<I> right</I>, and<I> top</I> values
2310 are integers in points from the lower-lefthand corner of the page.</P>
2311 <P>Pages must be surrounded by:</P>
2312 <UL>
2313 <PRE>
2314 %%Page: number number
2315 gsave
2316 ...
2317 grestore
2318 showpage
2319 </PRE>
2320 </UL>
2321 <P>And the end of each file must contain:</P>
2322 <UL>
2323 <PRE>
2324 %%Trailer
2325 %%Pages: number-pages
2326 %%EOF
2327 </PRE>
2328 </UL>
2329 <P>These comments allow the PostScript filter to correctly perform page
2330 accounting, copy generation, N-up printing, and so forth.</P>
2331 <H1 ALIGN="RIGHT"><A NAME="WRITING_DRIVERS">4 - Writing Printer Drivers</A>
2332 </H1>
2333 <P>This chapter discusses how to write a printer driver, which is a
2334 special filter program that converts CUPS raster data into the
2335 appropriate commands and data required for a printer.</P>
2336 <H2><A NAME="5_1">Overview</A></H2>
2337 <P>Raster printers utilitize PPD files that specify one or more
2338 device-specific filters that handle converting print files for the
2339 printer. The simplest raster printer drivers provide a single filter
2340 that converts CUPS raster data to the printer's native format.</P>
2341 <H3><A NAME="5_1_1">CUPS Raster Data</A></H3>
2342 <P>CUPS raster data (<CODE>application/vnd.cups-raster</CODE>) consists
2343 of a stream of raster page descriptions produced by one of the RIP
2344 filters, such as <CODE>pstoraster</CODE> or <CODE>imagetoraster</CODE>.</P>
2345 <P>Each page of data begins with a page dictionary structure called<A HREF="#cups_raster_header_t">
2346 <CODE>cups_raster_header_t</CODE></A>. This structure contains the
2347 colorspace, bits per color, media size, media type, hardware
2348 resolution, and so forth.</P>
2349 <P>After the page dictionary comes the page data which is a
2350 full-resolution, uncompressed bitmap representing the page in the
2351 printer's output colorspace.</P>
2352 <H3><A NAME="5_1_2">Page Accounting</A></H3>
2353 <P>Printer drivers must handle all page accounting. This means they must
2354 send &quot;PAGE:&quot; messages to the standard error file for each page (and in
2355 many cases, copy) sent to the printer.</P>
2356 <H3><A NAME="5_1_3">Color Management</A></H3>
2357 <P>Printer drivers can implement their color management via the <CODE>
2358 cupsColorProfile</CODE> attributes in the PPD file or internally in the
2359 driver from a device-independent colorspace. In general, color
2360 management performed by the RIP filters is more efficient than that
2361 performed inside printer drivers.</P>
2362 <P>For example, the <CODE>pstoraster</CODE> filter often only has to
2363 perform a color conversion once each time the color is used for
2364 multiple output pixels, while the raster filter must convert every
2365 pixel on the page.</P>
2366 <H3><A NAME="5_1_4">Device and Bitmap Variables</A></H3>
2367 <P>Besides the standard PostScript page device dictionary variables
2368 defined in the Adobe PostScript Level 3 reference manual, the CUPS
2369 filters support additional variables that are passed in the page device
2370 dictionary header for the page and in some cases control the type of
2371 raster data that is generated:
2372 <CENTER>
2373 <TABLE BORDER="1" WIDTH="90%">
2374 <TR><TH>Variable</TH><TH>Type</TH><TH>Description</TH></TR>
2375 <TR><TD>cupsWidth</TD><TD>read-only integer</TD><TD>Width of bitmap in
2376 pixels</TD></TR>
2377 <TR><TD>cupsHeight</TD><TD>read-only integer</TD><TD>Height of bitmap in
2378 pixels</TD></TR>
2379 <TR><TD>cupsMediaType</TD><TD>read-write integer</TD><TD>Device-specific
2380 media type code</TD></TR>
2381 <TR><TD>cupsBitsPerColor</TD><TD>read-write integer</TD><TD>Number of
2382 bits per color; 1, 2, 4, and 8 are currently supported</TD></TR>
2383 <TR><TD>cupsBitsPerPixel</TD><TD>read-only integer</TD><TD>Number of
2384 bits per pixel; 1 to 32</TD></TR>
2385 <TR><TD>cupsBytesPerLine</TD><TD>read-only integer</TD><TD>Number of
2386 bytes per line of raster graphics</TD></TR>
2387 <TR><TD>cupsColorOrder</TD><TD>read-write enum</TD><TD>The order of
2388 color values in the bitmap:
2389 <UL>
2390 <LI><CODE>CUPS_ORDER_CHUNKED</CODE> - CMYK&nbsp;CMYK&nbsp;CMYK</LI>
2391 <LI><CODE>CUPS_ORDER_BANDED</CODE> - CCC&nbsp;MMM&nbsp;YYY&nbsp;KKK</LI>
2392 <LI><CODE>CUPS_ORDER_PLANAR</CODE> - CCC&nbsp;...&nbsp;MMM&nbsp;...&nbsp;YYY&nbsp;...&nbsp;KKK&nbsp;...</LI>
2393 </UL>
2394 </TD></TR>
2395 <TR><TD>cupsColorSpace</TD><TD>read-write enum</TD><TD>The colorspace of
2396 the bitmap:
2397 <UL>
2398 <LI><CODE>CUPS_CSPACE_W</CODE> - White (luminance)</LI>
2399 <LI><CODE>CUPS_CSPACE_RGB</CODE> - Red, green, blue</LI>
2400 <LI><CODE>CUPS_CSPACE_RGBA</CODE> - Red, green, blue, alpha</LI>
2401 <LI><CODE>CUPS_CSPACE_K</CODE> - Black</LI>
2402 <LI><CODE>CUPS_CSPACE_CMY</CODE> - Cyan, magenta, yellow</LI>
2403 <LI><CODE>CUPS_CSPACE_YMC</CODE> - Yellow, magenta, cyan</LI>
2404 <LI><CODE>CUPS_CSPACE_CMYK</CODE> - Cyan, magenta, yellow, black</LI>
2405 <LI><CODE>CUPS_CSPACE_YMCK</CODE> - Yellow, magenta, cyan, black</LI>
2406 <LI><CODE>CUPS_CSPACE_KCMY</CODE> - Black, cyan, magenta, yellow</LI>
2407 <LI><CODE>CUPS_CSPACE_KCMYcm</CODE> - Black, cyan, magenta, yellow,
2408 light cyan, light magenta</LI>
2409 <LI><CODE>CUPS_CSPACE_GMCK</CODE> - Metallic yellow (gold), metallic
2410 magenta, metallic cyan, black</LI>
2411 <LI><CODE>CUPS_CSPACE_GMCS</CODE> - Metallic yellow (gold), metallic
2412 magenta, metallic cyan, metallic grey (silver)</LI>
2413 <LI><CODE>CUPS_CSPACE_WHITE</CODE> - White pigment (black as white
2414 pigment)</LI>
2415 <LI><CODE>CUPS_CSPACE_GOLD</CODE> - Gold foil (black as gold foil)</LI>
2416 <LI><CODE>CUPS_CSPACE_SILVER</CODE> - Silver foil (black as silver foil)</LI>
2417 </UL>
2418 </TD></TR>
2419 <TR><TD>cupsCompression</TD><TD>read-write integer</TD><TD>
2420 Device-specific compression type code</TD></TR>
2421 <TR><TD>cupsRowCount</TD><TD>read-write integer</TD><TD>Device-specific
2422 row count value</TD></TR>
2423 <TR><TD>cupsRowFeed</TD><TD>read-write integer</TD><TD>Device-specific
2424 row feed value</TD></TR>
2425 <TR><TD>cupsRowStep</TD><TD>read-write integer</TD><TD>Device-specific
2426 row step value</TD></TR>
2427 </TABLE>
2428 </CENTER>
2429 </P>
2430 <P>Bitmaps with a colorspace of CUPS_CSPACE_KCMYcm and more than 1 bit
2431 per color are transmitted to the raster driver in KCMY colorspace; the
2432 driver is responsible for producing the correct separation of normal
2433 and light cyan and magenta inks.</P>
2434 <H2><A NAME="5_2">Dissecting the HP-PCL Driver</A></H2>
2435 <P>The HP-PCL driver provided with CUPS (<CODE>rastertohp</CODE>)
2436 converts bitmap data from the raster filters into HP-PCL commands for
2437 most PCL-compatible printers. The actual format of the raster data is
2438 controlled by the PPD file being used -<VAR> deskjet.ppd</VAR> or<VAR>
2439 laserjet.ppd</VAR>.</P>
2440 <H3><A NAME="5_2_1">PPD Files</A></H3>
2441 <P>PPD files play an important part of all raster printer drivers.
2442 Options defined in the PPD file contain PostScript commands that
2443 control the raster data that is sent to the printer driver.</P>
2444 <P>A typical CUPS printer driver will include <CODE>ColorModel</CODE>, <CODE>
2445 InputSlot</CODE>, <CODE>PageSize</CODE>, <CODE>PageRegion</CODE>, and <CODE>
2446 Resolution</CODE> options. Each option is shown using the standard PPD
2447 format:</P>
2448 <UL>
2449 <PRE>
2450 *OpenUI *PageSize/Media Size: PickOne
2451 *OrderDependency: 10 AnySetup *PageSize
2452 *DefaultPageSize: Letter
2453 *PageSize Letter/US Letter: &quot;&lt;&lt;
2454 /PageSize [612 792]
2455 /ImagingBBox null
2456 &gt;&gt; setpagedevice&quot;
2457 *End
2458 *PageSize Legal/US Legal: &quot;&lt;&lt;
2459 /PageSize [612 1008]
2460 /ImagingBBox null
2461 &gt;&gt; setpagedevice&quot;
2462 *End
2463 *PageSize A4/A4: &quot;&lt;&lt;
2464 /PageSize [595 842]
2465 /ImagingBBox null
2466 &gt;&gt; setpagedevice&quot;
2467 *End
2468 *CloseUI: *PageSize
2469 </PRE>
2470 </UL>
2471 <P>The <CODE>OpenUI</CODE> keyword specifies the new option. The first
2472 name is the option with an asterisk (*) in front of it. The first name
2473 is usually followed by a slash (/) and a human-readable version of the
2474 option name.</P>
2475 <P>Every option<B> must</B> have a default value, specified using the <CODE>
2476 Default<I>Option</I></CODE> keyword.</P>
2477 <P>Each option begins with the option name followed by the computer and
2478 human-readable values. The PostScript commands follow these inside
2479 double quotes. PostScript commands can be provided on a single line:</P>
2480 <UL>
2481 <PRE>
2482 *PageSize A4/A4: &quot;&lt;&lt;/PageSize[595 842]/ImagingBBox null&gt;&gt; setpagedevice&quot;
2483 </PRE>
2484 </UL>
2485 <P>or broken down on separate lines using the <CODE>End</CODE> keyword
2486 to terminate them:</P>
2487 <UL>
2488 <PRE>
2489 *PageSize A4/A4: &quot;&lt;&lt;
2490 /PageSize [595 842]
2491 /ImagingBBox null
2492 &gt;&gt; setpagedevice&quot;
2493 *End
2494 </PRE>
2495 </UL>
2496 <P>The choice of the two formats is usually esthetic. However, each line
2497 in a PPD file must not exceed 255 characters, so if your PostScript
2498 commands are long you may need to break them up on separate lines.</P>
2499 <H3><A NAME="5_2_2">Reading Raster Data</A></H3>
2500 <P>As with any filter, your printer driver should handle raster data
2501 from a filename specified on the command-line or from the standard
2502 input. The<A HREF="#cupsRasterOpen"> <CODE>cupsRasterOpen()</CODE></A>
2503 function opens a raster stream for printing:</P>
2504 <UL>
2505 <PRE>
2506 int fd; /* File descriptor */
2507 cups_raster_t *ras; /* Raster stream for printing */
2508
2509
2510 /*
2511 * Check for valid arguments...
2512 */
2513
2514 if (argc &lt; 6 || argc &gt; 7)
2515 {
2516 /*
2517 * We don't have the correct number of arguments; write an error message
2518 * and return.
2519 */
2520
2521 fputs(&quot;ERROR: rastertopcl job-id user title copies options [file]\n&quot;, stderr);
2522 return (1);
2523 }
2524
2525 /*
2526 * Open the page stream...
2527 */
2528
2529 if (argc == 7)
2530 {
2531 if ((fd = open(argv[6], O_RDONLY)) == -1)
2532 {
2533 perror(&quot;ERROR: Unable to open raster file - &quot;);
2534 sleep(1);
2535 return (1);
2536 }
2537 }
2538 else
2539 fd = 0;
2540
2541 ras = cupsRasterOpen(fd, CUPS_RASTER_READ);
2542 </PRE>
2543 </UL>
2544 <P>Once you have opened the raster stream you just need to read each
2545 page and print it:</P>
2546 <UL>
2547 <PRE>
2548 cups_raster_header_t header;
2549 int y;
2550 unsigned char data[8192];
2551
2552 while (cupsRasterReadHeader(ras, &amp;header))
2553 {
2554 ... initialize the printer ...
2555 for (y = header.cupsHeight; y &gt; 0; y ++)
2556 {
2557 cupsRasterReadPixels(ras, data, header.cupsBytesPerLine);
2558 ... send raster line to printer ...
2559 }
2560 }
2561 </PRE>
2562 </UL>
2563 <P>After you have processed all pages, close the raster stream and
2564 return:</P>
2565 <UL>
2566 <PRE>
2567 cupsRasterClose(ras);
2568
2569 return (0);
2570 </PRE>
2571 </UL>
2572 <H1 ALIGN="RIGHT"><A NAME="WRITING_BACKENDS">5 - Writing Backends</A></H1>
2573 <P>This chapter describes how to write a backend for CUPS. Backends
2574 communicate directly with printers and allow printer drivers and
2575 filters to send data using any type of connection transparently.</P>
2576 <H2><A NAME="6_1">Overview</A></H2>
2577 <P>Backends are special filters that communicate with printers directly.
2578 They are treated slightly differently than filters, however, and have
2579 some unique requirements.</P>
2580 <H3><A NAME="6_1_1">Security Considerations</A></H3>
2581 <P>Backends are run as the root user, so special care must be taken to
2582 avoid potential security violations. In particular, remember that a
2583 backend will be able to manipulate disk files, devices, and other
2584 resources that potentially could damage a system or printer.</P>
2585 <H3><A NAME="6_1_2">Command-Line Arguments</A></H3>
2586 <P>Besides the standard filter arguments, backends are also run with no
2587 arguments to get a list of available devices. This discovery process is
2588 described later in this chapter.</P>
2589 <H3><A NAME="6_1_3">Copy Generation</A></H3>
2590 <P>Like filters, backends should send multiple copies of the print file
2591 only if a filename is supplied on the command-line. Otherwise the
2592 backend should assume that the upstream filter has already added the
2593 necessary commands or data to produce the multiple copies.</P>
2594 <H3><A NAME="6_1_4">Page Accounting</A></H3>
2595 <P>Backend filters generally do not do page accounting, however they
2596 should at a minimum produce a single page message for each copy that is
2597 produced when a filename is present on the command-line. This is
2598 because the user selected &quot;raw&quot; printing and no other accounting
2599 information is possible.</P>
2600 <H3><A NAME="6_1_5">Exclusive Access</A></H3>
2601 <P>Backends that talk to local character or block devices should open
2602 the device file in exclusive mode (<CODE>O_EXCL</CODE>) to cooperate
2603 with other printers defined for the same device.</P>
2604 <H3><A NAME="6_1_6">Retries</A></H3>
2605 <P>All backends<B> must</B> retry connections to the device. This
2606 includes backends that talk to local character or block devices, as the
2607 user may define more than one printer queue pointing at the same
2608 physical device.</P>
2609 <P>To prevent excess CPU utilitization, the backend should go to sleep
2610 for an amount of time between retries; the CUPS-supplied backends retry
2611 once every 30 seconds.</P>
2612 <H2><A NAME="6_2">Dissecting the Serial Port Backend</A></H2>
2613 <P>The serial port backend provides support for serial printers. Since
2614 it does everything a good backend needs to do, it provides an excellent
2615 example of what to do.</P>
2616 <H3><A NAME="6_2_1">Supporting Device Discovery</A></H3>
2617 <P>As previously noted, backends are special filter programs that talk
2618 to printer devices. Another task a backend must perform is to list the
2619 available devices it supports. The backend lists the available devices
2620 when no additioanl arguments are supplied on the command-line (i.e.
2621 just the command name...)</P>
2622 <P>The serial backend lists devices by looking at serial port files in
2623 the<VAR> /dev</VAR> directory, by consulting a hardware inventory
2624 (IRIX), and in some cases by trying to open the ports to see if they
2625 actually exist.</P>
2626 <P>Once it finds a serial port it writes a single line for each port to
2627 the standard error file. Each line looks like this:</P>
2628 <UL>
2629 <PRE>
2630 serial serial:/dev/ttyS0?baud=115200 &quot;Unknown&quot; &quot;Serial Port 1&quot;
2631 </PRE>
2632 </UL>
2633 <P>The first word &quot;serial&quot; is the<I> device class</I>; this identifies
2634 the class of device which can be used to categorize it in user
2635 interfaces. CUPS currently recognizes the following classes:</P>
2636 <UL>
2637 <LI>&quot;file&quot; - a disk file.</LI>
2638 <LI>&quot;direct&quot; - a parallel or fixed-rate serial data port, currently used
2639 for Centronics, IEEE-1284, and USB printer ports.</LI>
2640 <LI>&quot;serial&quot; - a variable-rate serial port.</LI>
2641 <LI>&quot;network&quot; - a network connection, typically via AppSocket, HTTP,
2642 IPP, LPD, or SMB/CIFS protocols.</LI>
2643 </UL>
2644 <P>After the device class is the<I> device URI</I>, in this case
2645 &quot;serial:/dev/ttyS0?baud=115200&quot;. This is the URI that should be used by
2646 the user to select this port. For serial ports, the &quot;baud=115200&quot;
2647 specifies the maximum baud rate supported by the port - the actual
2648 value will vary based on the speed the user selects for the printer.</P>
2649 <P>The last two strings are the model and description for the port. The
2650 &quot;Unknown&quot; string means that the printer model is unknown - some devices
2651 are able to provide a make and model such as &quot;HP DeskJet&quot; that allows
2652 users and software to choose an appropriate printer driver more easily.
2653 Both the model and description must be enclosed inside double quotes.</P>
2654 <H3><A NAME="6_2_2">Opening the Serial Port</A></H3>
2655 <P>As noted previously, all backends should open device files in
2656 exclusive mode, and retry as needed until the port is available. The
2657 serial port does this using a <CODE>do-while</CODE> loop:</P>
2658 <UL>
2659 <PRE>
2660 do
2661 {
2662 if ((fd = open(resource, O_WRONLY | O_NOCTTY | O_EXCL)) == -1)
2663 {
2664 if (errno == EBUSY)
2665 {
2666 fputs(&quot;INFO: Serial port busy; will retry in 30 seconds...\n&quot;, stderr);
2667 sleep(30);
2668 }
2669 else
2670 {
2671 perror(&quot;ERROR: Unable to open serial port device file&quot;);
2672 return (1);
2673 }
2674 }
2675 }
2676 while (fd &lt; 0);
2677 </PRE>
2678 </UL>
2679 <P>If the port is busy or in use by another process, the backend will go
2680 to sleep for 30 seconds and try again. If another error is detected a
2681 message is sent to the user and the backend aborts the print job until
2682 the problem can be corrected.</P>
2683 <H3><A NAME="6_2_3">Writing Data to the Port</A></H3>
2684 <P>Network and character devices pose an interesting problem when
2685 writing data to the port - they may not be able to write all of the
2686 bytes in your buffer before returning. To work around this problem you
2687 must loop until all bytes have been written:</P>
2688 <UL>
2689 <PRE>
2690 while (nbytes &gt; 0)
2691 {
2692 if ((wbytes = write(fd, bufptr, nbytes)) &lt; 0)
2693 if (errno == ENOTTY)
2694 wbytes = write(fd, bufptr, nbytes);
2695
2696 if (wbytes &lt; 0)
2697 {
2698 perror(&quot;ERROR: Unable to send print file to printer&quot;);
2699 break;
2700 }
2701
2702 nbytes -= wbytes;
2703 bufptr += wbytes;
2704 }
2705 </PRE>
2706 </UL>
2707 <P>The check for the <CODE>ENOTTY</CODE> error is needed on some
2708 platforms to clear an error from a previous <CODE>ioctl()</CODE> call.</P>
2709 <H3><A NAME="6_2_4">Finishing Up</A></H3>
2710 <P>Once you have sent the print file, return 0 if the file printed
2711 successfully or 1 if it did not. This will allow the scheduler to stop
2712 the print job if there is a device error, preserving the print job for
2713 later printing once the problem has been corrected.</P>
2714 <H1 ALIGN="RIGHT"><A NAME="LICENSE">A - Software License Agreement</A></H1>
2715 <H2 ALIGN="CENTER"><A NAME="7_1">Common UNIX Printing System License
2716 Agreement</A></H2>
2717 <P ALIGN="CENTER">Copyright 1997-2003 by Easy Software Products
2718 <BR> 44141 AIRPORT VIEW DR STE 204
2719 <BR> HOLLYWOOD, MARYLAND 20636-3111 USA
2720 <BR>
2721 <BR> Voice: +1.301.373.9600
2722 <BR> Email:<A HREF="mailto:cups-info@cups.org"> cups-info@cups.org</A>
2723 <BR> WWW:<A HREF="http://www.cups.org"> http://www.cups.org</A></P>
2724 <H3><A NAME="7_1_1">Introduction</A></H3>
2725 <P>The Common UNIX Printing System<SUP>TM</SUP>, (&quot;CUPS<SUP>TM</SUP>&quot;),
2726 is provided under the GNU General Public License (&quot;GPL&quot;) and GNU
2727 Library General Public License (&quot;LGPL&quot;), Version 2, with exceptions for
2728 Apple operating systems and the OpenSSL toolkit. A copy of the
2729 exceptions and licenses follow this introduction.</P>
2730 <P>The GNU LGPL applies to the CUPS API library, located in the &quot;cups&quot;
2731 subdirectory of the CUPS source distribution and in the &quot;cups&quot; include
2732 directory and library files in the binary distributions. The GNU GPL
2733 applies to the remainder of the CUPS distribution, including the
2734 &quot;pdftops&quot; filter which is based upon Xpdf and the CUPS imaging library.</P>
2735 <P>For those not familiar with the GNU GPL, the license basically allows
2736 you to:</P>
2737 <UL>
2738 <LI>Use the CUPS software at no charge.</LI>
2739 <LI>Distribute verbatim copies of the software in source or binary form.</LI>
2740 <LI>Sell verbatim copies of the software for a media fee, or sell
2741 support for the software.</LI>
2742 <LI>Distribute or sell printer drivers and filters that use CUPS so long
2743 as source code is made available under the GPL.</LI>
2744 </UL>
2745 <P>What this license<B> does not</B> allow you to do is make changes or
2746 add features to CUPS and then sell a binary distribution without source
2747 code. You must provide source for any new drivers, changes, or
2748 additions to the software, and all code must be provided under the GPL
2749 or LGPL as appropriate. The only exceptions to this are the portions of
2750 the CUPS software covered by the Apple operating system license
2751 exceptions outlined later in this license agreement.</P>
2752 <P>The GNU LGPL relaxes the &quot;link-to&quot; restriction, allowing you to
2753 develop applications that use the CUPS API library under other licenses
2754 and/or conditions as appropriate for your application.</P>
2755 <H3><A NAME="7_1_2">License Exceptions</A></H3>
2756 <P>In addition, as the copyright holder of CUPS, Easy Software Products
2757 grants the following special exceptions:</P>
2758 <OL>
2759 <LI><B>Apple Operating System Development License Exception</B>;
2760 <OL TYPE="a">
2761 <LI>Software that is developed by any person or entity for an Apple
2762 Operating System (&quot;Apple OS-Developed Software&quot;), including but not
2763 limited to Apple and third party printer drivers, filters, and backends
2764 for an Apple Operating System, that is linked to the CUPS imaging
2765 library or based on any sample filters or backends provided with CUPS
2766 shall not be considered to be a derivative work or collective work
2767 based on the CUPS program and is exempt from the mandatory source code
2768 release clauses of the GNU GPL. You may therefore distribute linked
2769 combinations of the CUPS imaging library with Apple OS-Developed
2770 Software without releasing the source code of the Apple OS-Developed
2771 Software. You may also use sample filters and backends provided with
2772 CUPS to develop Apple OS-Developed Software without releasing the
2773 source code of the Apple OS-Developed Software.</LI>
2774 <LI>An Apple Operating System means any operating system software
2775 developed and/or marketed by Apple Computer, Inc., including but not
2776 limited to all existing releases and versions of Apple's Darwin, Mac OS
2777 X, and Mac OS X Server products and all follow-on releases and future
2778 versions thereof.</LI>
2779 <LI>This exception is only available for Apple OS-Developed Software and
2780 does not apply to software that is distributed for use on other
2781 operating systems.</LI>
2782 <LI>All CUPS software that falls under this license exception have the
2783 following text at the top of each source file:<BLOCKQUOTE>This file is
2784 subject to the Apple OS-Developed Software exception.</BLOCKQUOTE></LI>
2785 </OL>
2786 </LI>
2787 <LI><B>OpenSSL Toolkit License Exception</B>;
2788 <OL TYPE="a">
2789 <LI>Easy Software Products explicitly allows the compilation and
2790 distribution of the CUPS software with the OpenSSL Toolkit.</LI>
2791 </OL>
2792 </LI>
2793 </OL>
2794 <P>No developer is required to provide these exceptions in a derived
2795 work.</P>
2796 <H3><A NAME="7_1_3">Trademarks</A></H3>
2797 <P>Easy Software Products has trademarked the Common UNIX Printing
2798 System, CUPS, and CUPS logo. These names and logos may be used freely
2799 in any direct port or binary distribution of CUPS. Please contract Easy
2800 Software Products for written permission to use them in derivative
2801 products. Our intention is to protect the value of these trademarks and
2802 ensure that any derivative product meets the same high-quality
2803 standards as the original.</P>
2804 <H3><A NAME="7_1_4">Binary Distribution Rights</A></H3>
2805 <P>Easy Software Products also sells rights to the CUPS source code
2806 under a binary distribution license for vendors that are unable to
2807 release source code for their drivers, additions, and modifications to
2808 CUPS under the GNU GPL and LGPL. For information please contact us at
2809 the address shown above.</P>
2810 <P>The Common UNIX Printing System provides a &quot;pdftops&quot; filter that is
2811 based on the Xpdf software. For binary distribution licensing of this
2812 software, please contact:<BLOCKQUOTE> Derek B. Noonburg
2813 <BR> Email:<A HREF="mailto:derekn@foolabs.com"> derekn@foolabs.com</A>
2814 <BR> WWW:<A HREF="http://www.foolabs.com/xpdf/">
2815 http://www.foolabs.com/xpdf/</A></BLOCKQUOTE></P>
2816 <H3><A NAME="7_1_5">Support</A></H3>
2817 <P>Easy Software Products sells software support for CUPS as well as a
2818 commercial printing product based on CUPS called ESP Print Pro. You can
2819 find out more at our web site:</P>
2820 <UL>
2821 <PRE>
2822 <A HREF="http://www.easysw.com/">http://www.easysw.com/</A>
2823 </PRE>
2824 </UL>
2825
2826 <!-- NEW PAGE -->
2827 <H2><A NAME="7_2">GNU GENERAL PUBLIC LICENSE</A></H2>
2828 <P>Version 2, June 1991</P>
2829 <PRE>
2830 Copyright 1989, 1991 Free Software Foundation, Inc.
2831 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2832
2833 Everyone is permitted to copy and distribute verbatim
2834 copies of this license document, but changing it is not allowed.
2835 </PRE>
2836 <H4>Preamble</H4>
2837 <P>The licenses for most software are designed to take away your freedom
2838 to share and change it. By contrast, the GNU General Public License is
2839 intended to guarantee your freedom to share and change free
2840 software--to make sure the software is free for all its users. This
2841 General Public License applies to most of the Free Software
2842 Foundation's software and to any other program whose authors commit to
2843 using it. (Some other Free Software Foundation software is covered by
2844 the GNU Library General Public License instead.) You can apply it to
2845 your programs, too.</P>
2846 <P>When we speak of free software, we are referring to freedom, not
2847 price. Our General Public Licenses are designed to make sure that you
2848 have the freedom to distribute copies of free software (and charge for
2849 this service if you wish), that you receive source code or can get it
2850 if you want it, that you can change the software or use pieces of it in
2851 new free programs; and that you know you can do these things.</P>
2852 <P>To protect your rights, we need to make restrictions that forbid
2853 anyone to deny you these rights or to ask you to surrender the rights.
2854 These restrictions translate to certain responsibilities for you if you
2855 distribute copies of the software, or if you modify it.</P>
2856 <P>For example, if you distribute copies of such a program, whether
2857 gratis or for a fee, you must give the recipients all the rights that
2858 you have. You must make sure that they, too, receive or can get the
2859 source code. And you must show them these terms so they know their
2860 rights.</P>
2861 <P>We protect your rights with two steps: (1) copyright the software,
2862 and (2) offer you this license which gives you legal permission to
2863 copy, distribute and/or modify the software.</P>
2864 <P>Also, for each author's protection and ours, we want to make certain
2865 that everyone understands that there is no warranty for this free
2866 software. If the software is modified by someone else and passed on, we
2867 want its recipients to know that what they have is not the original, so
2868 that any problems introduced by others will not reflect on the original
2869 authors' reputations.</P>
2870 <P>Finally, any free program is threatened constantly by software
2871 patents. We wish to avoid the danger that redistributors of a free
2872 program will individually obtain patent licenses, in effect making the
2873 program proprietary. To prevent this, we have made it clear that any
2874 patent must be licensed for everyone's free use or not licensed at all.</P>
2875 <P>The precise terms and conditions for copying, distribution and
2876 modification follow.</P>
2877 <H4>GNU GENERAL PUBLIC LICENSE
2878 <BR> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H4>
2879 <OL START="0">
2880 <LI>This License applies to any program or other work which contains a
2881 notice placed by the copyright holder saying it may be distributed
2882 under the terms of this General Public License. The &quot;Program&quot;, below,
2883 refers to any such program or work, and a &quot;work based on the Program&quot;
2884 means either the Program or any derivative work under copyright law:
2885 that is to say, a work containing the Program or a portion of it,
2886 either verbatim or with modifications and/or translated into another
2887 language. (Hereinafter, translation is included without limitation in
2888 the term &quot;modification&quot;.) Each licensee is addressed as &quot;you&quot;.
2889 <P>Activities other than copying, distribution and modification are not
2890 covered by this License; they are outside its scope. The act of running
2891 the Program is not restricted, and the output from the Program is
2892 covered only if its contents constitute a work based on the Program
2893 (independent of having been made by running the Program). Whether that
2894 is true depends on what the Program does.</P>
2895 <LI>You may copy and distribute verbatim copies of the Program's source
2896 code as you receive it, in any medium, provided that you conspicuously
2897 and appropriately publish on each copy an appropriate copyright notice
2898 and disclaimer of warranty; keep intact all the notices that refer to
2899 this License and to the absence of any warranty; and give any other
2900 recipients of the Program a copy of this License along with the
2901 Program.
2902 <P>You may charge a fee for the physical act of transferring a copy, and
2903 you may at your option offer warranty protection in exchange for a fee.</P>
2904 <LI>You may modify your copy or copies of the Program or any portion of
2905 it, thus forming a work based on the Program, and copy and distribute
2906 such modifications or work under the terms of Section 1 above, provided
2907 that you also meet all of these conditions:
2908 <OL TYPE="a">
2909 <LI>You must cause the modified files to carry prominent notices stating
2910 that you changed the files and the date of any change.</LI>
2911 <LI>You must cause any work that you distribute or publish, that in
2912 whole or in part contains or is derived from the Program or any part
2913 thereof, to be licensed as a whole at no charge to all third parties
2914 under the terms of this License.</LI>
2915 <LI>if the modified program normally reads commands interactively when
2916 run, you must cause it, when started running for such interactive use
2917 in the most ordinary way, to print or display an announcement including
2918 an appropriate copyright notice and a notice that there is no warranty
2919 (or else, saying that you provide a warranty) and that users may
2920 redistribute the program under these conditions, and telling the user
2921 how to view a copy of this License. (Exception: if the Program itself
2922 is interactive but does not normally print such an announcement, your
2923 work based on the Program is not required to print an announcement.)</LI>
2924 </OL>
2925 <P>These requirements apply to the modified work as a whole. If
2926 identifiable sections of that work are not derived from the Program,
2927 and can be reasonably considered independent and separate works in
2928 themselves, then this License, and its terms, do not apply to those
2929 sections when you distribute them as separate works. But when you
2930 distribute the same sections as part of a whole which is a work based
2931 on the Program, the distribution of the whole must be on the terms of
2932 this License, whose permissions for other licensees extend to the
2933 entire whole, and thus to each and every part regardless of who wrote
2934 it.</P>
2935 <P>Thus, it is not the intent of this section to claim rights or contest
2936 your rights to work written entirely by you; rather, the intent is to
2937 exercise the right to control the distribution of derivative or
2938 collective works based on the Program.</P>
2939 <P>In addition, mere aggregation of another work not based on the
2940 Program with the Program (or with a work based on the Program) on a
2941 volume of a storage or distribution medium does not bring the other
2942 work under the scope of this License.</P>
2943 <LI>You may copy and distribute the Program (or a work based on it,
2944 under Section 2) in object code or executable form under the terms of
2945 Sections 1 and 2 above provided that you also do one of the following:
2946 <OL TYPE="a">
2947 <LI>Accompany it with the complete corresponding machine-readable source
2948 code, which must be distributed under the terms of Sections 1 and 2
2949 above on a medium customarily used for software interchange; or,</LI>
2950 <LI>Accompany it with a written offer, valid for at least three years,
2951 to give any third party, for a charge no more than your cost of
2952 physically performing source distribution, a complete machine-readable
2953 copy of the corresponding source code, to be distributed under the
2954 terms of Sections 1 and 2 above on a medium customarily used for
2955 software interchange; or,</LI>
2956 <LI>Accompany it with the information you received as to the offer to
2957 distribute corresponding source code. (This alternative is allowed only
2958 for noncommercial distribution and only if you received the program in
2959 object code or executable form with such an offer, in accord with
2960 Subsection b above.)</LI>
2961 </OL>
2962 <P>The source code for a work means the preferred form of the work for
2963 making modifications to it. For an executable work, complete source
2964 code means all the source code for all modules it contains, plus any
2965 associated interface definition files, plus the scripts used to control
2966 compilation and installation of the executable. However, as a special
2967 exception, the source code distributed need not include anything that
2968 is normally distributed (in either source or binary form) with the
2969 major components (compiler, kernel, and so on) of the operating system
2970 on which the executable runs, unless that component itself accompanies
2971 the executable.</P>
2972 <P>If distribution of executable or object code is made by offering
2973 access to copy from a designated place, then offering equivalent access
2974 to copy the source code from the same place counts as distribution of
2975 the source code, even though third parties are not compelled to copy
2976 the source along with the object code.</P>
2977 <LI>You may not copy, modify, sublicense, or distribute the Program
2978 except as expressly provided under this License. Any attempt otherwise
2979 to copy, modify, sublicense or distribute the Program is void, and will
2980 automatically terminate your rights under this License. However,
2981 parties who have received copies, or rights, from you under this
2982 License will not have their licenses terminated so long as such parties
2983 remain in full compliance.</LI>
2984 <LI>You are not required to accept this License, since you have not
2985 signed it. However, nothing else grants you permission to modify or
2986 distribute the Program or its derivative works. These actions are
2987 prohibited by law if you do not accept this License. Therefore, by
2988 modifying or distributing the Program (or any work based on the
2989 Program), you indicate your acceptance of this License to do so, and
2990 all its terms and conditions for copying, distributing or modifying the
2991 Program or works based on it.</LI>
2992 <LI>Each time you redistribute the Program (or any work based on the
2993 Program), the recipient automatically receives a license from the
2994 original licensor to copy, distribute or modify the Program subject to
2995 these terms and conditions. You may not impose any further restrictions
2996 on the recipients' exercise of the rights granted herein. You are not
2997 responsible for enforcing compliance by third parties to this License.</LI>
2998 <LI>If, as a consequence of a court judgment or allegation of patent
2999 infringement or for any other reason (not limited to patent issues),
3000 conditions are imposed on you (whether by court order, agreement or
3001 otherwise) that contradict the conditions of this License, they do not
3002 excuse you from the conditions of this License. If you cannot
3003 distribute so as to satisfy simultaneously your obligations under this
3004 License and any other pertinent obligations, then as a consequence you
3005 may not distribute the Program at all. For example, if a patent license
3006 would not permit royalty-free redistribution of the Program by all
3007 those who receive copies directly or indirectly through you, then the
3008 only way you could satisfy both it and this License would be to refrain
3009 entirely from distribution of the Program.
3010 <P>If any portion of this section is held invalid or unenforceable under
3011 any particular circumstance, the balance of the section is intended to
3012 apply and the section as a whole is intended to apply in other
3013 circumstances.</P>
3014 <P>It is not the purpose of this section to induce you to infringe any
3015 patents or other property right claims or to contest validity of any
3016 such claims; this section has the sole purpose of protecting the
3017 integrity of the free software distribution system, which is
3018 implemented by public license practices. Many people have made generous
3019 contributions to the wide range of software distributed through that
3020 system in reliance on consistent application of that system; it is up
3021 to the author/donor to decide if he or she is willing to distribute
3022 software through any other system and a licensee cannot impose that
3023 choice.</P>
3024 <P>This section is intended to make thoroughly clear what is believed to
3025 be a consequence of the rest of this License.</P>
3026 <LI>If the distribution and/or use of the Program is restricted in
3027 certain countries either by patents or by copyrighted interfaces, the
3028 original copyright holder who places the Program under this License may
3029 add an explicit geographical distribution limitation excluding those
3030 countries, so that distribution is permitted only in or among countries
3031 not thus excluded. In such case, this License incorporates the
3032 limitation as if written in the body of this License.</LI>
3033 <LI>The Free Software Foundation may publish revised and/or new versions
3034 of the General Public License from time to time. Such new versions will
3035 be similar in spirit to the present version, but may differ in detail
3036 to address new problems or concerns.
3037 <P>Each version is given a distinguishing version number. If the Program
3038 specifies a version number of this License which applies to it and &quot;any
3039 later version&quot;, you have the option of following the terms and
3040 conditions either of that version or of any later version published by
3041 the Free Software Foundation. If the Program does not specify a version
3042 number of this License, you may choose any version ever published by
3043 the Free Software Foundation.</P>
3044 <LI>If you wish to incorporate parts of the Program into other free
3045 programs whose distribution conditions are different, write to the
3046 author to ask for permission. For software which is copyrighted by the
3047 Free Software Foundation, write to the Free Software Foundation; we
3048 sometimes make exceptions for this. Our decision will be guided by the
3049 two goals of preserving the free status of all derivatives of our free
3050 software and of promoting the sharing and reuse of software generally.</LI>
3051 </LI>
3052 </LI>
3053 </LI>
3054 </LI>
3055 </LI>
3056 </LI>
3057 </OL>
3058 <H4>NO WARRANTY</H4>
3059 <OL START="11">
3060 <LI>BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
3061 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
3062 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
3063 PROVIDE THE PROGRAM &quot;AS IS&quot; WITHOUT WARRANTY OF ANY KIND, EITHER
3064 EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
3065 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
3066 ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH
3067 YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
3068 NECESSARY SERVICING, REPAIR OR CORRECTION.</LI>
3069 <LI>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
3070 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
3071 AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
3072 FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
3073 CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
3074 PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
3075 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
3076 FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF
3077 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
3078 DAMAGES.</LI>
3079 </OL>
3080 <H4>END OF TERMS AND CONDITIONS</H4>
3081
3082 <!-- NEW PAGE -->
3083 <H2><A NAME="7_3">GNU LIBRARY GENERAL PUBLIC LICENSE</A></H2>
3084 <P>Version 2, June 1991</P>
3085 <PRE>
3086 Copyright (C) 1991 Free Software Foundation, Inc.
3087 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
3088 Everyone is permitted to copy and distribute verbatim copies
3089 of this license document, but changing it is not allowed.
3090
3091 [This is the first released version of the library GPL. It is
3092 numbered 2 because it goes with version 2 of the ordinary GPL.]
3093 </PRE>
3094 <H4>Preamble</H4>
3095 <P>The licenses for most software are designed to take away your freedom
3096 to share and change it. By contrast, the GNU General Public Licenses
3097 are intended to guarantee your freedom to share and change free
3098 software--to make sure the software is free for all its users.</P>
3099 <P>This license, the Library General Public License, applies to some
3100 specially designated Free Software Foundation software, and to any
3101 other libraries whose authors decide to use it. You can use it for your
3102 libraries, too.</P>
3103 <P>When we speak of free software, we are referring to freedom, not
3104 price. Our General Public Licenses are designed to make sure that you
3105 have the freedom to distribute copies of free software (and charge for
3106 this service if you wish), that you receive source code or can get it
3107 if you want it, that you can change the software or use pieces of it in
3108 new free programs; and that you know you can do these things.</P>
3109 <P>To protect your rights, we need to make restrictions that forbid
3110 anyone to deny you these rights or to ask you to surrender the rights.
3111 These restrictions translate to certain responsibilities for you if you
3112 distribute copies of the library, or if you modify it.</P>
3113 <P>For example, if you distribute copies of the library, whether gratis
3114 or for a fee, you must give the recipients all the rights that we gave
3115 you. You must make sure that they, too, receive or can get the source
3116 code. If you link a program with the library, you must provide complete
3117 object files to the recipients so that they can relink them with the
3118 library, after making changes to the library and recompiling it. And
3119 you must show them these terms so they know their rights.</P>
3120 <P>Our method of protecting your rights has two steps: (1) copyright the
3121 library, and (2) offer you this license which gives you legal
3122 permission to copy, distribute and/or modify the library.</P>
3123 <P>Also, for each distributor's protection, we want to make certain that
3124 everyone understands that there is no warranty for this free library.
3125 If the library is modified by someone else and passed on, we want its
3126 recipients to know that what they have is not the original version, so
3127 that any problems introduced by others will not reflect on the original
3128 authors' reputations.</P>
3129 <P>Finally, any free program is threatened constantly by software
3130 patents. We wish to avoid the danger that companies distributing free
3131 software will individually obtain patent licenses, thus in effect
3132 transforming the program into proprietary software. To prevent this, we
3133 have made it clear that any patent must be licensed for everyone's free
3134 use or not licensed at all.</P>
3135 <P>Most GNU software, including some libraries, is covered by the
3136 ordinary GNU General Public License, which was designed for utility
3137 programs. This license, the GNU Library General Public License, applies
3138 to certain designated libraries. This license is quite different from
3139 the ordinary one; be sure to read it in full, and don't assume that
3140 anything in it is the same as in the ordinary license.</P>
3141 <P>The reason we have a separate public license for some libraries is
3142 that they blur the distinction we usually make between modifying or
3143 adding to a program and simply using it. Linking a program with a
3144 library, without changing the library, is in some sense simply using
3145 the library, and is analogous to running a utility program or
3146 application program. However, in a textual and legal sense, the linked
3147 executable is a combined work, a derivative of the original library,
3148 and the ordinary General Public License treats it as such.</P>
3149 <P>Because of this blurred distinction, using the ordinary General
3150 Public License for libraries did not effectively promote software
3151 sharing, because most developers did not use the libraries. We
3152 concluded that weaker conditions might promote sharing better.</P>
3153 <P>However, unrestricted linking of non-free programs would deprive the
3154 users of those programs of all benefit from the free status of the
3155 libraries themselves. This Library General Public License is intended
3156 to permit developers of non-free programs to use free libraries, while
3157 preserving your freedom as a user of such programs to change the free
3158 libraries that are incorporated in them. (We have not seen how to
3159 achieve this as regards changes in header files, but we have achieved
3160 it as regards changes in the actual functions of the Library.) The hope
3161 is that this will lead to faster development of free libraries.</P>
3162 <P>The precise terms and conditions for copying, distribution and
3163 modification follow. Pay close attention to the difference between a
3164 &quot;work based on the library&quot; and a &quot;work that uses the library&quot;. The
3165 former contains code derived from the library, while the latter only
3166 works together with the library.</P>
3167 <P>Note that it is possible for a library to be covered by the ordinary
3168 General Public License rather than by this special one.</P>
3169 <H4>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</H4>
3170 <P><STRONG>0.</STRONG> This License Agreement applies to any software
3171 library which contains a notice placed by the copyright holder or other
3172 authorized party saying it may be distributed under the terms of this
3173 Library General Public License (also called &quot;this License&quot;). Each
3174 licensee is addressed as &quot;you&quot;.</P>
3175 <P>A &quot;library&quot; means a collection of software functions and/or data
3176 prepared so as to be conveniently linked with application programs
3177 (which use some of those functions and data) to form executables.</P>
3178 <P>The &quot;Library&quot;, below, refers to any such software library or work
3179 which has been distributed under these terms. A &quot;work based on the
3180 Library&quot; means either the Library or any derivative work under
3181 copyright law: that is to say, a work containing the Library or a
3182 portion of it, either verbatim or with modifications and/or translated
3183 straightforwardly into another language. (Hereinafter, translation is
3184 included without limitation in the term &quot;modification&quot;.)</P>
3185 <P>&quot;Source code&quot; for a work means the preferred form of the work for
3186 making modifications to it. For a library, complete source code means
3187 all the source code for all modules it contains, plus any associated
3188 interface definition files, plus the scripts used to control
3189 compilation and installation of the library.</P>
3190 <P>Activities other than copying, distribution and modification are not
3191 covered by this License; they are outside its scope. The act of running
3192 a program using the Library is not restricted, and output from such a
3193 program is covered only if its contents constitute a work based on the
3194 Library (independent of the use of the Library in a tool for writing
3195 it). Whether that is true depends on what the Library does and what the
3196 program that uses the Library does.</P>
3197 <P><STRONG>1.</STRONG> You may copy and distribute verbatim copies of
3198 the Library's complete source code as you receive it, in any medium,
3199 provided that you conspicuously and appropriately publish on each copy
3200 an appropriate copyright notice and disclaimer of warranty; keep intact
3201 all the notices that refer to this License and to the absence of any
3202 warranty; and distribute a copy of this License along with the Library.</P>
3203 <P>You may charge a fee for the physical act of transferring a copy, and
3204 you may at your option offer warranty protection in exchange for a fee.</P>
3205 <P><STRONG>2.</STRONG> You may modify your copy or copies of the Library
3206 or any portion of it, thus forming a work based on the Library, and
3207 copy and distribute such modifications or work under the terms of
3208 Section 1 above, provided that you also meet all of these conditions:</P>
3209 <OL TYPE="a">
3210 <LI>The modified work must itself be a software library.
3211 <P></P>
3212 <LI>You must cause the files modified to carry prominent notices stating
3213 that you changed the files and the date of any change.
3214 <P></P>
3215 <LI>You must cause the whole of the work to be licensed at no charge to
3216 all third parties under the terms of this License.
3217 <P></P>
3218 <LI>If a facility in the modified Library refers to a function or a
3219 table of data to be supplied by an application program that uses the
3220 facility, other than as an argument passed when the facility is
3221 invoked, then you must make a good faith effort to ensure that, in the
3222 event an application does not supply such function or table, the
3223 facility still operates, and performs whatever part of its purpose
3224 remains meaningful.
3225 <P>(For example, a function in a library to compute square roots has a
3226 purpose that is entirely well-defined independent of the application.
3227 Therefore, Subsection 2d requires that any application-supplied
3228 function or table used by this function must be optional: if the
3229 application does not supply it, the square root function must still
3230 compute square roots.)</P>
3231 </LI>
3232 </LI>
3233 </LI>
3234 </LI>
3235 </OL>
3236 <P>These requirements apply to the modified work as a whole. If
3237 identifiable sections of that work are not derived from the Library,
3238 and can be reasonably considered independent and separate works in
3239 themselves, then this License, and its terms, do not apply to those
3240 sections when you distribute them as separate works. But when you
3241 distribute the same sections as part of a whole which is a work based
3242 on the Library, the distribution of the whole must be on the terms of
3243 this License, whose permissions for other licensees extend to the
3244 entire whole, and thus to each and every part regardless of who wrote
3245 it.</P>
3246 <P>Thus, it is not the intent of this section to claim rights or contest
3247 your rights to work written entirely by you; rather, the intent is to
3248 exercise the right to control the distribution of derivative or
3249 collective works based on the Library.</P>
3250 <P>In addition, mere aggregation of another work not based on the
3251 Library with the Library (or with a work based on the Library) on a
3252 volume of a storage or distribution medium does not bring the other
3253 work under the scope of this License.</P>
3254 <P><STRONG>3.</STRONG> You may opt to apply the terms of the ordinary
3255 GNU General Public License instead of this License to a given copy of
3256 the Library. To do this, you must alter all the notices that refer to
3257 this License, so that they refer to the ordinary GNU General Public
3258 License, version 2, instead of to this License. (If a newer version
3259 than version 2 of the ordinary GNU General Public License has appeared,
3260 then you can specify that version instead if you wish.) Do not make any
3261 other change in these notices.</P>
3262 <P>Once this change is made in a given copy, it is irreversible for that
3263 copy, so the ordinary GNU General Public License applies to all
3264 subsequent copies and derivative works made from that copy.</P>
3265 <P>This option is useful when you wish to copy part of the code of the
3266 Library into a program that is not a library.</P>
3267 <P><STRONG>4.</STRONG> You may copy and distribute the Library (or a
3268 portion or derivative of it, under Section 2) in object code or
3269 executable form under the terms of Sections 1 and 2 above provided that
3270 you accompany it with the complete corresponding machine-readable
3271 source code, which must be distributed under the terms of Sections 1
3272 and 2 above on a medium customarily used for software interchange.</P>
3273 <P>If distribution of object code is made by offering access to copy
3274 from a designated place, then offering equivalent access to copy the
3275 source code from the same place satisfies the requirement to distribute
3276 the source code, even though third parties are not compelled to copy
3277 the source along with the object code.</P>
3278 <P><STRONG>5.</STRONG> A program that contains no derivative of any
3279 portion of the Library, but is designed to work with the Library by
3280 being compiled or linked with it, is called a &quot;work that uses the
3281 Library&quot;. Such a work, in isolation, is not a derivative work of the
3282 Library, and therefore falls outside the scope of this License.</P>
3283 <P>However, linking a &quot;work that uses the Library&quot; with the Library
3284 creates an executable that is a derivative of the Library (because it
3285 contains portions of the Library), rather than a &quot;work that uses the
3286 library&quot;. The executable is therefore covered by this License. Section
3287 6 states terms for distribution of such executables.</P>
3288 <P>When a &quot;work that uses the Library&quot; uses material from a header file
3289 that is part of the Library, the object code for the work may be a
3290 derivative work of the Library even though the source code is not.
3291 Whether this is true is especially significant if the work can be
3292 linked without the Library, or if the work is itself a library. The
3293 threshold for this to be true is not precisely defined by law.</P>
3294 <P>If such an object file uses only numerical parameters, data structure
3295 layouts and accessors, and small macros and small inline functions (ten
3296 lines or less in length), then the use of the object file is
3297 unrestricted, regardless of whether it is legally a derivative work.
3298 (Executables containing this object code plus portions of the Library
3299 will still fall under Section 6.)</P>
3300 <P>Otherwise, if the work is a derivative of the Library, you may
3301 distribute the object code for the work under the terms of Section 6.
3302 Any executables containing that work also fall under Section 6, whether
3303 or not they are linked directly with the Library itself.</P>
3304 <P><STRONG>6.</STRONG> As an exception to the Sections above, you may
3305 also compile or link a &quot;work that uses the Library&quot; with the Library to
3306 produce a work containing portions of the Library, and distribute that
3307 work under terms of your choice, provided that the terms permit
3308 modification of the work for the customer's own use and reverse
3309 engineering for debugging such modifications.</P>
3310 <P>You must give prominent notice with each copy of the work that the
3311 Library is used in it and that the Library and its use are covered by
3312 this License. You must supply a copy of this License. If the work
3313 during execution displays copyright notices, you must include the
3314 copyright notice for the Library among them, as well as a reference
3315 directing the user to the copy of this License. Also, you must do one
3316 of these things:</P>
3317 <OL TYPE="a">
3318 <LI>Accompany the work with the complete corresponding machine-readable
3319 source code for the Library including whatever changes were used in the
3320 work (which must be distributed under Sections 1 and 2 above); and, if
3321 the work is an executable linked with the Library, with the complete
3322 machine-readable &quot;work that uses the Library&quot;, as object code and/or
3323 source code, so that the user can modify the Library and then relink to
3324 produce a modified executable containing the modified Library. (It is
3325 understood that the user who changes the contents of definitions files
3326 in the Library will not necessarily be able to recompile the
3327 application to use the modified definitions.)
3328 <P></P>
3329 <LI>Accompany the work with a written offer, valid for at least three
3330 years, to give the same user the materials specified in Subsection 6a,
3331 above, for a charge no more than the cost of performing this
3332 distribution.
3333 <P></P>
3334 <LI>If distribution of the work is made by offering access to copy from
3335 a designated place, offer equivalent access to copy the above specified
3336 materials from the same place.
3337 <P></P>
3338 <LI>Verify that the user has already received a copy of these materials
3339 or that you have already sent this user a copy.</LI>
3340 </LI>
3341 </LI>
3342 </LI>
3343 </OL>
3344 <P>For an executable, the required form of the &quot;work that uses the
3345 Library&quot; must include any data and utility programs needed for
3346 reproducing the executable from it. However, as a special exception,
3347 the source code distributed need not include anything that is normally
3348 distributed (in either source or binary form) with the major components
3349 (compiler, kernel, and so on) of the operating system on which the
3350 executable runs, unless that component itself accompanies the
3351 executable.</P>
3352 <P>It may happen that this requirement contradicts the license
3353 restrictions of other proprietary libraries that do not normally
3354 accompany the operating system. Such a contradiction means you cannot
3355 use both them and the Library together in an executable that you
3356 distribute.</P>
3357 <P><STRONG>7.</STRONG> You may place library facilities that are a work
3358 based on the Library side-by-side in a single library together with
3359 other library facilities not covered by this License, and distribute
3360 such a combined library, provided that the separate distribution of the
3361 work based on the Library and of the other library facilities is
3362 otherwise permitted, and provided that you do these two things:</P>
3363 <OL TYPE="a">
3364 <LI>Accompany the combined library with a copy of the same work based on
3365 the Library, uncombined with any other library facilities. This must be
3366 distributed under the terms of the Sections above.
3367 <P></P>
3368 <LI>Give prominent notice with the combined library of the fact that
3369 part of it is a work based on the Library, and explaining where to find
3370 the accompanying uncombined form of the same work.</LI>
3371 </LI>
3372 </OL>
3373 <P><STRONG>8.</STRONG> You may not copy, modify, sublicense, link with,
3374 or distribute the Library except as expressly provided under this
3375 License. Any attempt otherwise to copy, modify, sublicense, link with,
3376 or distribute the Library is void, and will automatically terminate
3377 your rights under this License. However, parties who have received
3378 copies, or rights, from you under this License will not have their
3379 licenses terminated so long as such parties remain in full compliance.</P>
3380 <P><STRONG>9.</STRONG> You are not required to accept this License,
3381 since you have not signed it. However, nothing else grants you
3382 permission to modify or distribute the Library or its derivative works.
3383 These actions are prohibited by law if you do not accept this License.
3384 Therefore, by modifying or distributing the Library (or any work based
3385 on the Library), you indicate your acceptance of this License to do so,
3386 and all its terms and conditions for copying, distributing or modifying
3387 the Library or works based on it.</P>
3388 <P><STRONG>10.</STRONG> Each time you redistribute the Library (or any
3389 work based on the Library), the recipient automatically receives a
3390 license from the original licensor to copy, distribute, link with or
3391 modify the Library subject to these terms and conditions. You may not
3392 impose any further restrictions on the recipients' exercise of the
3393 rights granted herein. You are not responsible for enforcing compliance
3394 by third parties to this License.</P>
3395 <P><STRONG>11.</STRONG> If, as a consequence of a court judgment or
3396 allegation of patent infringement or for any other reason (not limited
3397 to patent issues), conditions are imposed on you (whether by court
3398 order, agreement or otherwise) that contradict the conditions of this
3399 License, they do not excuse you from the conditions of this License. If
3400 you cannot distribute so as to satisfy simultaneously your obligations
3401 under this License and any other pertinent obligations, then as a
3402 consequence you may not distribute the Library at all. For example, if
3403 a patent license would not permit royalty-free redistribution of the
3404 Library by all those who receive copies directly or indirectly through
3405 you, then the only way you could satisfy both it and this License would
3406 be to refrain entirely from distribution of the Library.</P>
3407 <P>If any portion of this section is held invalid or unenforceable under
3408 any particular circumstance, the balance of the section is intended to
3409 apply, and the section as a whole is intended to apply in other
3410 circumstances.</P>
3411 <P>It is not the purpose of this section to induce you to infringe any
3412 patents or other property right claims or to contest validity of any
3413 such claims; this section has the sole purpose of protecting the
3414 integrity of the free software distribution system which is implemented
3415 by public license practices. Many people have made generous
3416 contributions to the wide range of software distributed through that
3417 system in reliance on consistent application of that system; it is up
3418 to the author/donor to decide if he or she is willing to distribute
3419 software through any other system and a licensee cannot impose that
3420 choice.</P>
3421 <P>This section is intended to make thoroughly clear what is believed to
3422 be a consequence of the rest of this License.</P>
3423 <P><STRONG>12.</STRONG> If the distribution and/or use of the Library is
3424 restricted in certain countries either by patents or by copyrighted
3425 interfaces, the original copyright holder who places the Library under
3426 this License may add an explicit geographical distribution limitation
3427 excluding those countries, so that distribution is permitted only in or
3428 among countries not thus excluded. In such case, this License
3429 incorporates the limitation as if written in the body of this License.</P>
3430 <P><STRONG>13.</STRONG> The Free Software Foundation may publish revised
3431 and/or new versions of the Library General Public License from time to
3432 time. Such new versions will be similar in spirit to the present
3433 version, but may differ in detail to address new problems or concerns.</P>
3434 <P>Each version is given a distinguishing version number. If the Library
3435 specifies a version number of this License which applies to it and &quot;any
3436 later version&quot;, you have the option of following the terms and
3437 conditions either of that version or of any later version published by
3438 the Free Software Foundation. If the Library does not specify a license
3439 version number, you may choose any version ever published by the Free
3440 Software Foundation.</P>
3441 <P><STRONG>14.</STRONG> If you wish to incorporate parts of the Library
3442 into other free programs whose distribution conditions are incompatible
3443 with these, write to the author to ask for permission. For software
3444 which is copyrighted by the Free Software Foundation, write to the Free
3445 Software Foundation; we sometimes make exceptions for this. Our
3446 decision will be guided by the two goals of preserving the free status
3447 of all derivatives of our free software and of promoting the sharing
3448 and reuse of software generally.</P>
3449 <P><STRONG>NO WARRANTY</STRONG></P>
3450 <P><STRONG>15.</STRONG> BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE,
3451 THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY
3452 APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
3453 HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY &quot;AS IS&quot; WITHOUT
3454 WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
3455 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
3456 PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
3457 OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU
3458 ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</P>
3459 <P><STRONG>16.</STRONG> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR
3460 AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO
3461 MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE
3462 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL
3463 OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
3464 LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
3465 RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
3466 FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
3467 SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
3468 DAMAGES.</P>
3469 <H4>END OF TERMS AND CONDITIONS</H4>
3470 <H1 ALIGN="RIGHT"><A NAME="CONSTANTS">B - Constants</A></H1>
3471 <P>This appendix lists all of the constants that are defined by the CUPS
3472 API.</P>
3473 <H2><A NAME="8_1">CUPS Constants</A></H2>
3474 <H3><A NAME="8_1_1">Version Number</A></H3>
3475 <P>The <CODE>CUPS_VERSION</CODE> constant is a floating-point number
3476 representing the API version number. The current version number is
3477 1.0100 which represents CUPS version 1.1.0.</P>
3478 <H3><A NAME="8_1_2">Printer Capabilities</A></H3>
3479 <P>The <CODE>CUPS_PRINTER</CODE> constants represent capability bits for
3480 printers and classes:</P>
3481 <UL>
3482 <LI><CODE>CUPS_PRINTER_LOCAL</CODE> - Is a local printer or class.</LI>
3483 <LI><CODE>CUPS_PRINTER_REMOTE</CODE> - Is a remote printer or class.</LI>
3484 <LI><CODE>CUPS_PRINTER_CLASS</CODE> - Is a class.</LI>
3485 <LI><CODE>CUPS_PRINTER_BW</CODE> - Printer prints in black and white.</LI>
3486 <LI><CODE>CUPS_PRINTER_COLOR</CODE> - Printer prints in color.</LI>
3487 <LI><CODE>CUPS_PRINTER_DUPLEX</CODE> - Printer can print double-sided.</LI>
3488 <LI><CODE>CUPS_PRINTER_STAPLE</CODE> - Printer can staple output.</LI>
3489 <LI><CODE>CUPS_PRINTER_COPIES</CODE> - Printer can produce multiple
3490 copies on its own.</LI>
3491 <LI><CODE>CUPS_PRINTER_COLLATE</CODE> - Printer can collate copies.</LI>
3492 <LI><CODE>CUPS_PRINTER_PUNCH</CODE> - Printer can punch holes in output.</LI>
3493 <LI><CODE>CUPS_PRINTER_COVER</CODE> - Printer can put covers on output.</LI>
3494 <LI><CODE>CUPS_PRINTER_BIND</CODE> - Printer can bind output.</LI>
3495 <LI><CODE>CUPS_PRINTER_SORT</CODE> - Printer can sort output.</LI>
3496 <LI><CODE>CUPS_PRINTER_SMALL</CODE> - Printer can print on media up to
3497 9x14 inches.</LI>
3498 <LI><CODE>CUPS_PRINTER_MEDIUM</CODE> - Printer can print on media from
3499 9x14 to 18x24 inches.</LI>
3500 <LI><CODE>CUPS_PRINTER_LARGE</CODE> - Printer can print on media larger
3501 than 18x24 inches.</LI>
3502 <LI><CODE>CUPS_PRINTER_VARIABLE</CODE> - Printer can print on variable
3503 or custom media sizes.</LI>
3504 <LI><CODE>CUPS_PRINTER_IMPLICIT</CODE> - Is an implicit class.</LI>
3505 <LI><CODE>CUPS_PRINTER_OPTIONS</CODE> - All of the printer capability
3506 and option bits.</LI>
3507 </UL>
3508 <H3><A NAME="8_1_3">Encodings</A></H3>
3509 <P>CUPS defines the following character set encoding constants:</P>
3510 <UL>
3511 <LI><CODE>CUPS_US_ASCII</CODE> - US ASCII character set.</LI>
3512 <LI><CODE>CUPS_UTF_8</CODE> - UTF-8 encoding of Unicode.</LI>
3513 <LI><CODE>CUPS_ISO8859_1</CODE> - ISO-8859-1 character set.</LI>
3514 <LI><CODE>CUPS_ISO8859_2</CODE> - ISO-8859-2 character set.</LI>
3515 <LI><CODE>CUPS_ISO8859_3</CODE> - ISO-8859-3 character set.</LI>
3516 <LI><CODE>CUPS_ISO8859_4</CODE> - ISO-8859-4 character set.</LI>
3517 <LI><CODE>CUPS_ISO8859_5</CODE> - ISO-8859-5 character set.</LI>
3518 <LI><CODE>CUPS_ISO8859_6</CODE> - ISO-8859-6 character set.</LI>
3519 <LI><CODE>CUPS_ISO8859_7</CODE> - ISO-8859-7 character set.</LI>
3520 <LI><CODE>CUPS_ISO8859_8</CODE> - ISO-8859-8 character set.</LI>
3521 <LI><CODE>CUPS_ISO8859_9</CODE> - ISO-8859-9 character set.</LI>
3522 <LI><CODE>CUPS_ISO8859_10</CODE> - ISO-8859-10 character set.</LI>
3523 <LI><CODE>CUPS_ISO8859_13</CODE> - ISO-8859-13 character set.</LI>
3524 <LI><CODE>CUPS_ISO8859_14</CODE> - ISO-8859-14 character set.</LI>
3525 <LI><CODE>CUPS_ISO8859_15</CODE> - ISO-8859-15 character set.</LI>
3526 <LI><CODE>CUPS_WINDOWS_874</CODE> - Windows code page 874.</LI>
3527 <LI><CODE>CUPS_WINDOWS_1250</CODE> - Windows code page 1250.</LI>
3528 <LI><CODE>CUPS_WINDOWS_1251</CODE> - Windows code page 1251.</LI>
3529 <LI><CODE>CUPS_WINDOWS_1252</CODE> - Windows code page 1252.</LI>
3530 <LI><CODE>CUPS_WINDOWS_1253</CODE> - Windows code page 1253.</LI>
3531 <LI><CODE>CUPS_WINDOWS_1254</CODE> - Windows code page 1254.</LI>
3532 <LI><CODE>CUPS_WINDOWS_1255</CODE> - Windows code page 1255.</LI>
3533 <LI><CODE>CUPS_WINDOWS_1256</CODE> - Windows code page 1256.</LI>
3534 <LI><CODE>CUPS_WINDOWS_1257</CODE> - Windows code page 1257.</LI>
3535 <LI><CODE>CUPS_WINDOWS_1258</CODE> - Windows code page 1258.</LI>
3536 <LI><CODE>CUPS_KOI8_R</CODE> - Russian code page koi8-r.</LI>
3537 <LI><CODE>CUPS_KOI8_U</CODE> - Ukrainian code page koi8-r.</LI>
3538 </UL>
3539 <H2><A NAME="8_2">HTTP Constants</A></H2>
3540 <H3><A NAME="8_2_1">Limits</A></H3>
3541 <P>The following constants define the limits for strings:</P>
3542 <UL>
3543 <LI><CODE>HTTP_MAX_BUFFER</CODE> - Size of socket buffer.</LI>
3544 <LI><CODE>HTTP_MAX_HOST</CODE> - Maximum length of hostname.</LI>
3545 <LI><CODE>HTTP_MAX_URI</CODE> - Maximum length of URI.</LI>
3546 <LI><CODE>HTTP_MAX_VALUE</CODE> - Maximum length of field values.</LI>
3547 </UL>
3548 <H3><A NAME="8_2_2">Status Codes</A></H3>
3549 <P>The following status codes can be returned by <CODE>httpUpdate()</CODE>
3550 :</P>
3551 <UL>
3552 <LI><CODE>HTTP_ERROR</CODE> - A network error occurred</LI>
3553 <LI><CODE>HTTP_CONTINUE</CODE> - Continue response from HTTP proxy</LI>
3554 <LI><CODE>HTTP_OK</CODE> - OPTIONS/GET/HEAD/POST/TRACE command was
3555 successful</LI>
3556 <LI><CODE>HTTP_CREATED</CODE> - PUT command was successful</LI>
3557 <LI><CODE>HTTP_ACCEPTED</CODE> - DELETE command was successful</LI>
3558 <LI><CODE>HTTP_NOT_AUTHORITATIVE</CODE> - Information isn't
3559 authoritative</LI>
3560 <LI><CODE>HTTP_NO_CONTENT</CODE> - Successful command</LI>
3561 <LI><CODE>HTTP_RESET_CONTENT</CODE> - Content was reset/recreated</LI>
3562 <LI><CODE>HTTP_PARTIAL_CONTENT</CODE> - Only a partial file was
3563 recieved/sent</LI>
3564 <LI><CODE>HTTP_MULTIPLE_CHOICES</CODE> - Multiple files match request</LI>
3565 <LI><CODE>HTTP_MOVED_PERMANENTLY</CODE> - Document has moved permanently</LI>
3566 <LI><CODE>HTTP_MOVED_TEMPORARILY</CODE> - Document has moved temporarily</LI>
3567 <LI><CODE>HTTP_SEE_OTHER</CODE> - See this other link...</LI>
3568 <LI><CODE>HTTP_NOT_MODIFIED</CODE> - File not modified</LI>
3569 <LI><CODE>HTTP_USE_PROXY</CODE> - Must use a proxy to access this URI</LI>
3570 <LI><CODE>HTTP_BAD_REQUEST</CODE> - Bad request</LI>
3571 <LI><CODE>HTTP_UNAUTHORIZED</CODE> - Unauthorized to access host</LI>
3572 <LI><CODE>HTTP_PAYMENT_REQUIRED</CODE> - Payment required</LI>
3573 <LI><CODE>HTTP_FORBIDDEN</CODE> - Forbidden to access this URI</LI>
3574 <LI><CODE>HTTP_NOT_FOUND</CODE> - URI was not found</LI>
3575 <LI><CODE>HTTP_METHOD_NOT_ALLOWED</CODE> - Method is not allowed</LI>
3576 <LI><CODE>HTTP_NOT_ACCEPTABLE</CODE> - Not Acceptable</LI>
3577 <LI><CODE>HTTP_PROXY_AUTHENTICATION</CODE> - Proxy Authentication is
3578 Required</LI>
3579 <LI><CODE>HTTP_REQUEST_TIMEOUT</CODE> - Request timed out</LI>
3580 <LI><CODE>HTTP_CONFLICT</CODE> - Request is self-conflicting</LI>
3581 <LI><CODE>HTTP_GONE</CODE> - Server has gone away</LI>
3582 <LI><CODE>HTTP_LENGTH_REQUIRED</CODE> - A content length or encoding is
3583 required</LI>
3584 <LI><CODE>HTTP_PRECONDITION</CODE> - Precondition failed</LI>
3585 <LI><CODE>HTTP_REQUEST_TOO_LARGE</CODE> - Request entity too large</LI>
3586 <LI><CODE>HTTP_URI_TOO_LONG</CODE> - URI too long</LI>
3587 <LI><CODE>HTTP_UNSUPPORTED_MEDIATYPE</CODE> - The requested media type
3588 is unsupported</LI>
3589 <LI><CODE>HTTP_SERVER_ERROR</CODE> - Internal server error</LI>
3590 <LI><CODE>HTTP_NOT_IMPLEMENTED</CODE> - Feature not implemented</LI>
3591 <LI><CODE>HTTP_BAD_GATEWAY</CODE> - Bad gateway</LI>
3592 <LI><CODE>HTTP_SERVICE_UNAVAILABLE</CODE> - Service is unavailable</LI>
3593 <LI><CODE>HTTP_GATEWAY_TIMEOUT</CODE> - Gateway connection timed out</LI>
3594 <LI><CODE>HTTP_NOT_SUPPORTED</CODE> - HTTP version not supported</LI>
3595 </UL>
3596 <H3><A NAME="8_2_3">Fields</A></H3>
3597 <P>The following fields are indices for each of the standard HTTP fields
3598 in HTTP 1/1:</P>
3599 <UL>
3600 <LI><CODE>HTTP_FIELD_ACCEPT_LANGUAGE</CODE> - Accept-Language</LI>
3601 <LI><CODE>HTTP_FIELD_ACCEPT_RANGES</CODE> - Accept-Ranges</LI>
3602 <LI><CODE>HTTP_FIELD_AUTHORIZATION</CODE> - Authorization</LI>
3603 <LI><CODE>HTTP_FIELD_CONNECTION</CODE> - Connection</LI>
3604 <LI><CODE>HTTP_FIELD_CONTENT_ENCODING</CODE> - Content-Encoding</LI>
3605 <LI><CODE>HTTP_FIELD_CONTENT_LANGUAGE</CODE> - Content-Language</LI>
3606 <LI><CODE>HTTP_FIELD_CONTENT_LENGTH</CODE> - Content-Length</LI>
3607 <LI><CODE>HTTP_FIELD_CONTENT_LOCATION</CODE> - Content-Location</LI>
3608 <LI><CODE>HTTP_FIELD_CONTENT_MD5</CODE> - Content-MD5</LI>
3609 <LI><CODE>HTTP_FIELD_CONTENT_RANGE</CODE> - Content-Range</LI>
3610 <LI><CODE>HTTP_FIELD_CONTENT_TYPE</CODE> - Content-Type</LI>
3611 <LI><CODE>HTTP_FIELD_CONTENT_VERSION</CODE> - Content-Version</LI>
3612 <LI><CODE>HTTP_FIELD_DATE</CODE> - Date</LI>
3613 <LI><CODE>HTTP_FIELD_HOST</CODE> - Host</LI>
3614 <LI><CODE>HTTP_FIELD_IF_MODIFIED_SINCE</CODE> - If-Modified-Since</LI>
3615 <LI><CODE>HTTP_FIELD_IF_UNMODIFIED_SINCE</CODE> - If-Unmodified-Since</LI>
3616 <LI><CODE>HTTP_FIELD_KEEP_ALIVE</CODE> - Keep-Alive</LI>
3617 <LI><CODE>HTTP_FIELD_LAST_MODIFIED</CODE> - Last-Modified</LI>
3618 <LI><CODE>HTTP_FIELD_LINK</CODE> - Link</LI>
3619 <LI><CODE>HTTP_FIELD_LOCATION</CODE> - Location</LI>
3620 <LI><CODE>HTTP_FIELD_RANGE</CODE> - Range</LI>
3621 <LI><CODE>HTTP_FIELD_REFERER</CODE> - Referer</LI>
3622 <LI><CODE>HTTP_FIELD_RETRY_AFTER</CODE> - Retry-After</LI>
3623 <LI><CODE>HTTP_FIELD_TRANSFER_ENCODING</CODE> - Transfer-Encoding</LI>
3624 <LI><CODE>HTTP_FIELD_UPGRADE</CODE> - Upgrade</LI>
3625 <LI><CODE>HTTP_FIELD_USER_AGENT</CODE> - User-Agent</LI>
3626 <LI><CODE>HTTP_FIELD_WWW_AUTHENTICATE</CODE> - WWW-Authenticate</LI>
3627 </UL>
3628 <H2><A NAME="8_3">IPP Constants</A></H2>
3629 <H3><A NAME="8_3_1">Limits</A></H3>
3630 <P>The following constants define array limits for IPP data:</P>
3631 <UL>
3632 <LI><CODE>IPP_MAX_NAME</CODE> - Maximum length of an attribute name</LI>
3633 <LI><CODE>IPP_MAX_VALUES</CODE> - Maximum number of set-of values that
3634 can be read in a request.</LI>
3635 </UL>
3636 <H3><A NAME="8_3_2">Tags</A></H3>
3637 <UL>
3638 <LI><CODE>IPP_TAG_ZERO</CODE> - Wildcard tag value for searches; also
3639 used to separate groups of attributes</LI>
3640 <LI><CODE>IPP_TAG_OPERATION</CODE> - Tag for values of type operation</LI>
3641 <LI><CODE>IPP_TAG_JOB</CODE> - Tag for values of type job</LI>
3642 <LI><CODE>IPP_TAG_END</CODE> - Tag for values of type end</LI>
3643 <LI><CODE>IPP_TAG_PRINTER</CODE> - Tag for values of type printer</LI>
3644 <LI><CODE>IPP_TAG_UNSUPPORTED_GROUP</CODE> - Tag for values of type
3645 unsupported_group</LI>
3646 <LI><CODE>IPP_TAG_UNSUPPORTED_VALUE</CODE> - Tag for values of type
3647 unsupported_value</LI>
3648 <LI><CODE>IPP_TAG_DEFAULT</CODE> - Tag for values of type default</LI>
3649 <LI><CODE>IPP_TAG_UNKNOWN</CODE> - Tag for values of type unknown</LI>
3650 <LI><CODE>IPP_TAG_NOVALUE</CODE> - Tag for values of type novalue</LI>
3651 <LI><CODE>IPP_TAG_NOTSETTABLE</CODE> - Tag for values of type
3652 notsettable</LI>
3653 <LI><CODE>IPP_TAG_DELETEATTR</CODE> - Tag for values of type deleteattr</LI>
3654 <LI><CODE>IPP_TAG_ANYVALUE</CODE> - Tag for values of type anyvalue</LI>
3655 <LI><CODE>IPP_TAG_INTEGER</CODE> - Tag for values of type integer</LI>
3656 <LI><CODE>IPP_TAG_BOOLEAN</CODE> - Tag for values of type boolean</LI>
3657 <LI><CODE>IPP_TAG_ENUM</CODE> - Tag for values of type enum</LI>
3658 <LI><CODE>IPP_TAG_STRING</CODE> - Tag for values of type string</LI>
3659 <LI><CODE>IPP_TAG_DATE</CODE> - Tag for values of type date</LI>
3660 <LI><CODE>IPP_TAG_RESOLUTION</CODE> - Tag for values of type resolution</LI>
3661 <LI><CODE>IPP_TAG_RANGE</CODE> - Tag for values of type range</LI>
3662 <LI><CODE>IPP_TAG_COLLECTION</CODE> - Tag for values of type collection</LI>
3663 <LI><CODE>IPP_TAG_TEXTLANG</CODE> - Tag for values of type textlang</LI>
3664 <LI><CODE>IPP_TAG_NAMELANG</CODE> - Tag for values of type namelang</LI>
3665 <LI><CODE>IPP_TAG_TEXT</CODE> - Tag for values of type text</LI>
3666 <LI><CODE>IPP_TAG_NAME</CODE> - Tag for values of type name</LI>
3667 <LI><CODE>IPP_TAG_KEYWORD</CODE> - Tag for values of type keyword</LI>
3668 <LI><CODE>IPP_TAG_URI</CODE> - Tag for values of type uri</LI>
3669 <LI><CODE>IPP_TAG_URISCHEME</CODE> - Tag for values of type urischeme</LI>
3670 <LI><CODE>IPP_TAG_CHARSET</CODE> - Tag for values of type charset</LI>
3671 <LI><CODE>IPP_TAG_LANGUAGE</CODE> - Tag for values of type language</LI>
3672 <LI><CODE>IPP_TAG_MIMETYPE</CODE> - Tag for values of type mimetype</LI>
3673 </UL>
3674 <H3><A NAME="8_3_3">Resolution Units</A></H3>
3675 <P>The <CODE>IPP_RES_PER_INCH</CODE> and <CODE>IPP_RES_PER_CM</CODE>
3676 constants specify dots per inch and dots per centimeter, respectively.</P>
3677 <H3><A NAME="8_3_4">Finishings</A></H3>
3678 <P>The finishing values specify special finishing operations to be
3679 performed on the job.</P>
3680 <UL>
3681 <LI><CODE>IPP_FINISH_NONE</CODE> - Do no finishing</LI>
3682 <LI><CODE>IPP_FINISH_STAPLE</CODE> - Staple the job</LI>
3683 <LI><CODE>IPP_FINISH_PUNCH</CODE> - Punch the job</LI>
3684 <LI><CODE>IPP_FINISH_COVER</CODE> - Cover the job</LI>
3685 <LI><CODE>IPP_FINISH_BIND</CODE> - Bind the job</LI>
3686 </UL>
3687 <H3><A NAME="8_3_5">Orientations</A></H3>
3688 <P>The orientation values specify the orientation of the job.</P>
3689 <UL>
3690 <LI><CODE>IPP_PORTRAIT</CODE> - No rotation</LI>
3691 <LI><CODE>IPP_LANDSCAPE</CODE> - 90 degrees counter-clockwise</LI>
3692 <LI><CODE>IPP_REVERSE_LANDSCAPE</CODE> - 90 degrees clockwise</LI>
3693 <LI><CODE>IPP_REVERSE_PORTRAIT</CODE> - 180 degrees</LI>
3694 </UL>
3695 <H3><A NAME="8_3_6">Qualities</A></H3>
3696 <P>The quality values specify the desired quality of the print.</P>
3697 <UL>
3698 <LI><CODE>IPP_QUALITY_DRAFT</CODE> - Draft quality</LI>
3699 <LI><CODE>IPP_QUALITY_NORMAL</CODE> - Normal quality</LI>
3700 <LI><CODE>IPP_QUALITY_HIGH</CODE> - High quality</LI>
3701 </UL>
3702 <H3><A NAME="8_3_7">Job States</A></H3>
3703 <P>The job state values are used to represent the current job state.</P>
3704 <UL>
3705 <LI><CODE>IPP_JOB_PENDING</CODE> - Job is pending</LI>
3706 <LI><CODE>IPP_JOB_HELD</CODE> - Job is held</LI>
3707 <LI><CODE>IPP_JOB_PROCESSING</CODE> - Job is processing</LI>
3708 <LI><CODE>IPP_JOB_STOPPED</CODE> - Job is stopped</LI>
3709 <LI><CODE>IPP_JOB_CANCELLED</CODE> - Job is cancelled</LI>
3710 <LI><CODE>IPP_JOB_ABORTED</CODE> - Job is aborted</LI>
3711 <LI><CODE>IPP_JOB_COMPLETED</CODE> - Job is completed</LI>
3712 </UL>
3713 <H3><A NAME="8_3_8">Printer States</A></H3>
3714 <P>The printer state values are used to represent the current printer
3715 state.</P>
3716 <UL>
3717 <LI><CODE>IPP_PRINTER_IDLE</CODE> - Printer is idle</LI>
3718 <LI><CODE>IPP_PRINTER_PROCESSING</CODE> - Printer is processing</LI>
3719 <LI><CODE>IPP_PRINTER_STOPPED</CODE> - Printer is stopped</LI>
3720 </UL>
3721 <H3><A NAME="8_3_9">Operations</A></H3>
3722 <P>The operation values represent the available IPP operations.</P>
3723 <UL>
3724 <LI><CODE>IPP_PRINT_JOB</CODE> - Print a file</LI>
3725 <LI><CODE>IPP_PRINT_URI</CODE> - Print a URI</LI>
3726 <LI><CODE>IPP_VALIDATE_JOB</CODE> - Validate job attributes</LI>
3727 <LI><CODE>IPP_CREATE_JOB</CODE> - Create a new job</LI>
3728 <LI><CODE>IPP_SEND_DOCUMENT</CODE> - Send a document to a job</LI>
3729 <LI><CODE>IPP_SEND_URI</CODE> - Send a URI to a job</LI>
3730 <LI><CODE>IPP_CANCEL_JOB</CODE> - Cancel a job</LI>
3731 <LI><CODE>IPP_GET_JOB_ATTRIBUTES</CODE> - Get job attributes</LI>
3732 <LI><CODE>IPP_GET_JOBS</CODE> - Get a list of all jobs</LI>
3733 <LI><CODE>IPP_GET_PRINTER_ATTRIBUTES</CODE> - Get printer attributes</LI>
3734 <LI><CODE>IPP_HOLD_JOB</CODE> - Hold a pending job</LI>
3735 <LI><CODE>IPP_RELEASE_JOB</CODE> - Release a held job</LI>
3736 <LI><CODE>IPP_RESTART_JOB</CODE> - Restart a completed job</LI>
3737 <LI><CODE>IPP_PAUSE_PRINTER</CODE> - Pause a printer</LI>
3738 <LI><CODE>IPP_RESUME_PRINTER</CODE> - Restart a paused printer</LI>
3739 <LI><CODE>IPP_PURGE_JOBS</CODE> - Purge jobs from the queue</LI>
3740 <LI><CODE>IPP_SET_PRINTER_ATTRIBUTES</CODE> - Set printer attributes</LI>
3741 <LI><CODE>IPP_SET_JOB_ATTRIBUTES</CODE> - Set job attributes</LI>
3742 <LI><CODE>IPP_GET_PRINTER_SUPPORTED_VALUES</CODE> - Get printer
3743 supported values</LI>
3744 <LI><CODE>CUPS_GET_DEFAULT</CODE> - Get the default destination</LI>
3745 <LI><CODE>CUPS_GET_PRINTERS</CODE> - Get a list of all printers</LI>
3746 <LI><CODE>CUPS_ADD_PRINTER</CODE> - Add or modify a printer</LI>
3747 <LI><CODE>CUPS_DELETE_PRINTER</CODE> - Delete a printer</LI>
3748 <LI><CODE>CUPS_GET_CLASSES</CODE> - Get a list of all classes</LI>
3749 <LI><CODE>CUPS_ADD_CLASS</CODE> - Add or modify a class</LI>
3750 <LI><CODE>CUPS_DELETE_CLASS</CODE> - Delete a class</LI>
3751 <LI><CODE>CUPS_ACCEPT_JOBS</CODE> - Accept jobs on a printer or class</LI>
3752 <LI><CODE>CUPS_REJECT_JOBS</CODE> - Reject jobs on a printer or class</LI>
3753 <LI><CODE>CUPS_SET_DEFAULT</CODE> - Set the default destination</LI>
3754 <LI><CODE>CUPS_GET_DEVICES</CODE> - Get a list of all devices</LI>
3755 <LI><CODE>CUPS_GET_PPDS</CODE> - Get a list of all PPDs</LI>
3756 <LI><CODE>CUPS_MOVE_JOB</CODE> - Move a job to a new destination</LI>
3757 </UL>
3758 <H3><A NAME="8_3_10">Status Codes</A></H3>
3759 <P>Status codes are returned by all IPP requests.</P>
3760 <UL>
3761 <LI><CODE>IPP_OK</CODE> - Request completed with no errors</LI>
3762 <LI><CODE>IPP_OK_SUBST</CODE> - Request completed but some attribute
3763 values were substituted</LI>
3764 <LI><CODE>IPP_OK_CONFLICT</CODE> - Request completed but some attributes
3765 conflicted</LI>
3766 <LI><CODE>IPP_BAD_REQUEST</CODE> - The request was bad</LI>
3767 <LI><CODE>IPP_FORBIDDEN</CODE> - You don't have access to the resource</LI>
3768 <LI><CODE>IPP_NOT_AUTHENTICATED</CODE> - You are not authenticated for
3769 the resource</LI>
3770 <LI><CODE>IPP_NOT_AUTHORIZED</CODE> - You not authorized to access the
3771 resource</LI>
3772 <LI><CODE>IPP_NOT_POSSIBLE</CODE> - The requested operation cannot be
3773 completed</LI>
3774 <LI><CODE>IPP_TIMEOUT</CODE> - A timeout occurred</LI>
3775 <LI><CODE>IPP_NOT_FOUND</CODE> - The resource was not found</LI>
3776 <LI><CODE>IPP_GONE</CODE> - The resource has gone away</LI>
3777 <LI><CODE>IPP_REQUEST_ENTITY</CODE> - The request was too large</LI>
3778 <LI><CODE>IPP_REQUEST_VALUE</CODE> - The request contained a value that
3779 was unknown to the server</LI>
3780 <LI><CODE>IPP_DOCUMENT_FORMAT</CODE> - The document format is not
3781 supported by the server</LI>
3782 <LI><CODE>IPP_ATTRIBUTES</CODE> - Required attributes are missing</LI>
3783 <LI><CODE>IPP_URI_SCHEME</CODE> - The URI scheme is not supported</LI>
3784 <LI><CODE>IPP_CHARSET</CODE> - The charset is not supported</LI>
3785 <LI><CODE>IPP_CONFLICT</CODE> - One or more attributes conflict</LI>
3786 <LI><CODE>IPP_COMPRESSION_NOT_SUPPORTED</CODE> - The specified
3787 compression is not supported</LI>
3788 <LI><CODE>IPP_COMPRESSION_ERROR</CODE> - The compressed data contained
3789 an error</LI>
3790 <LI><CODE>IPP_DOCUMENT_FORMAT_ERROR</CODE> - The document data contained
3791 an error in it</LI>
3792 <LI><CODE>IPP_DOCUMENT_ACCESS_ERROR</CODE> - The remote document could
3793 not be accessed</LI>
3794 <LI><CODE>IPP_INTERNAL_ERROR</CODE> - The server encountered an internal
3795 error</LI>
3796 <LI><CODE>IPP_OPERATION_NOT_SUPPORTED</CODE> - The requested operation
3797 is not supported</LI>
3798 <LI><CODE>IPP_SERVICE_UNAVAILABLE</CODE> - The requested service is
3799 unavailable</LI>
3800 <LI><CODE>IPP_VERSION_NOT_SUPPORTED</CODE> - The IPP request version is
3801 not supported</LI>
3802 <LI><CODE>IPP_DEVICE_ERROR</CODE> - The output device encountered an
3803 error</LI>
3804 <LI><CODE>IPP_TEMPORARY_ERROR</CODE> - A temporary error occurred</LI>
3805 <LI><CODE>IPP_NOT_ACCEPTING</CODE> - The destination is not accepting
3806 jobs</LI>
3807 <LI><CODE>IPP_PRINTER_BUSY</CODE> - The destination is busy</LI>
3808 <LI><CODE>IPP_ERROR_JOB_CANCELLED</CODE> - The requested job has been
3809 cancelled</LI>
3810 <LI><CODE>IPP_MULTIPLE_JOBS_NOT_SUPPORTED</CODE> - The server does not
3811 support multiple jobs</LI>
3812 </UL>
3813 <H2><A NAME="8_4">PPD Constants</A></H2>
3814 <H3><A NAME="8_4_1">PPD Format Version</A></H3>
3815 <P>The <CODE>PPD_VERSION</CODE> constant defines a floating point number
3816 representing the newest format version that is supported by CUPS,
3817 currently 4.3.</P>
3818 <H3><A NAME="8_4_2">PPD User-Interface Types</A></H3>
3819 <P>Each printer option has a type associated with it:</P>
3820 <UL>
3821 <LI><CODE>PPD_UI_BOOLEAN</CODE> - The user can turn this option on or
3822 off</LI>
3823 <LI><CODE>PPD_UI_PICKONE</CODE> - The user can choose one option value
3824 to use.</LI>
3825 <LI><CODE>PPD_UI_PICKMANY</CODE> - The user can choose zero or more
3826 option values.</LI>
3827 </UL>
3828 <H3><A NAME="8_4_3">PPD Sections</A></H3>
3829 <P>Some options must be output before others, or in different sections
3830 of the output document. The <CODE>ppd_section_t</CODE> enumeration
3831 defines which section the option must be output in:</P>
3832 <UL>
3833 <LI><CODE>PPD_ORDER_ANY</CODE> - The option can be output in any of the
3834 document, page, or prolog sections of the document</LI>
3835 <LI><CODE>PPD_ORDER_DOCUMENT</CODE> - The option must be output in the
3836 DocumentSetup section of the document</LI>
3837 <LI><CODE>PPD_ORDER_EXIT</CODE> - The option must be output before the
3838 document</LI>
3839 <LI><CODE>PPD_ORDER_JCL</CODE> - The option must be output in the job
3840 control section of the document</LI>
3841 <LI><CODE>PPD_ORDER_PAGE</CODE> - The option must be output in the
3842 PageSetup section of the document</LI>
3843 <LI><CODE>PPD_ORDER_PROLOG</CODE> - The option must be output in the
3844 Prolog section of the document</LI>
3845 </UL>
3846 <H3><A NAME="8_4_4">PPD Colorspaces</A></H3>
3847 <P>Each printer has a default colorspace:</P>
3848 <UL>
3849 <LI><CODE>PPD_CS_CMYK</CODE> - The printer uses CMYK colors by default</LI>
3850 <LI><CODE>PPD_CS_CMY</CODE> - The printer uses CMY colors by default</LI>
3851 <LI><CODE>PPD_CS_GRAY</CODE> - The printer uses grayscale by default</LI>
3852 <LI><CODE>PPD_CS_RGB</CODE> - The printer uses RGB colors by default</LI>
3853 <LI><CODE>PPD_CS_RGBK</CODE> - The printer uses RGBK colors by default</LI>
3854 <LI><CODE>PPD_CS_N</CODE> - The printer uses a DeviceN colorspace by
3855 default</LI>
3856 </UL>
3857 <H2><A NAME="8_5">Raster Constants</A></H2>
3858 <H3><A NAME="8_5_1">Raster Sync Words</A></H3>
3859 <P>The <CODE>CUPS_RASTER_SYNC</CODE> and <CODE>CUPS_RASTER_REVSYNC</CODE>
3860 constants define the standard sync words at the beginning of each CUPS
3861 raster file.</P>
3862 <H3><A NAME="8_5_2">Raster Stream Modes</A></H3>
3863 <P>The <CODE>CUPS_RASTER_READ</CODE> and <CODE>CUPS_RASTER_WRITE</CODE>
3864 constants are used with the<A HREF="#cupsRasterOpen"> <CODE>
3865 cupsRasterOpen()</CODE></A> function to specify a stream for reading or
3866 writing.</P>
3867 <H3><A NAME="8_5_3">Raster Boolean Constants</A></H3>
3868 <P>The <CODE>CUPS_FALSE</CODE> and <CODE>CUPS_TRUE</CODE> constants
3869 represent boolean values in the page header.</P>
3870 <H3><A NAME="8_5_4">Raster Jog Values</A></H3>
3871 <P>The <CODE>cups_jog_t</CODE> enumeration defines constants for the Jog
3872 page device dictionary variable:</P>
3873 <UL>
3874 <LI><CODE>CUPS_JOG_NONE</CODE> - Do no jogging</LI>
3875 <LI><CODE>CUPS_JOG_FILE</CODE> - Jog pages after each file</LI>
3876 <LI><CODE>CUPS_JOG_JOB</CODE> - Jog pages after each job</LI>
3877 <LI><CODE>CUPS_JOG_SET</CODE> - Jog pages after each set of jobs</LI>
3878 </UL>
3879 <H3><A NAME="8_5_5">Raster Orientation Values</A></H3>
3880 <P>The <CODE>cups_orient_t</CODE> enumeration defines constants for the
3881 Orientation page device dictionary variable:</P>
3882 <UL>
3883 <LI><CODE>CUPS_ORIENT_0</CODE> - Portrait orientation</LI>
3884 <LI><CODE>CUPS_ORIENT_90</CODE> - Landscape orientation</LI>
3885 <LI><CODE>CUPS_ORIENT_180</CODE> - Reverse-portrait orientation</LI>
3886 <LI><CODE>CUPS_ORIENT_270</CODE> - Reverse-landscape orientation</LI>
3887 </UL>
3888 <H3><A NAME="8_5_6">Raster CutMedia Values</A></H3>
3889 <P>The <CODE>cups_cut_t</CODE> enumeration defines constants for the
3890 CutMedia page device dictionary variable:</P>
3891 <UL>
3892 <LI><CODE>CUPS_CUT_NONE</CODE> - Do no jogging</LI>
3893 <LI><CODE>CUPS_CUT_FILE</CODE> - Cut pages after each file</LI>
3894 <LI><CODE>CUPS_CUT_JOB</CODE> - Cut pages after each job</LI>
3895 <LI><CODE>CUPS_CUT_SET</CODE> - Cut pages after each set of jobs</LI>
3896 <LI><CODE>CUPS_CUT_PAGE</CODE> - Cut each page</LI>
3897 </UL>
3898 <H3><A NAME="8_5_7">Raster AdvanceMedia Values</A></H3>
3899 <P>The <CODE>cups_advance_t</CODE> enumeration defines constants for the
3900 AdvanceMedia page device dictionary variable:</P>
3901 <UL>
3902 <LI><CODE>CUPS_ADVANCE_NONE</CODE> - Do no jogging</LI>
3903 <LI><CODE>CUPS_ADVANCE_FILE</CODE> - Advance media after each file</LI>
3904 <LI><CODE>CUPS_ADVANCE_JOB</CODE> - Advance media after each job</LI>
3905 <LI><CODE>CUPS_ADVANCE_SET</CODE> - Advance media after each set of jobs</LI>
3906 <LI><CODE>CUPS_ADVANCE_PAGE</CODE> - Advance media for each page</LI>
3907 </UL>
3908 <H3><A NAME="8_5_8">Raster LeadingEdge Values</A></H3>
3909 <P>The <CODE>cups_edge_t</CODE> enumeration defines constants for the
3910 LeadingEdge page device dictionary variable:</P>
3911 <UL>
3912 <LI><CODE>CUPS_EDGE_TOP</CODE> - The top of the media is the leading
3913 edge</LI>
3914 <LI><CODE>CUPS_EDGE_RIGHT</CODE> - The right of the media is the leading
3915 edge</LI>
3916 <LI><CODE>CUPS_EDGE_BOTTOM</CODE> - The bottom of the media is the
3917 leading edge</LI>
3918 <LI><CODE>CUPS_EDGE_LEFT</CODE> - The left of the media is the leading
3919 edge</LI>
3920 </UL>
3921 <H3><A NAME="8_5_9">Raster Color Order Values</A></H3>
3922 <P>The <CODE>cups_order_t</CODE> enumeration defines the possible color
3923 value orderings:</P>
3924 <UL>
3925 <LI><CODE>CUPS_ORDER_CHUNKED</CODE> - CMYK&nbsp;CMYK&nbsp;CMYK</LI>
3926 <LI><CODE>CUPS_ORDER_BANDED</CODE> - CCC&nbsp;MMM&nbsp;YYY&nbsp;KKK</LI>
3927 <LI><CODE>CUPS_ORDER_PLANAR</CODE> - CCC&nbsp;...&nbsp;MMM&nbsp;...&nbsp;YYY&nbsp;...&nbsp;KKK&nbsp;...</LI>
3928 </UL>
3929 <H3><A NAME="8_5_10">Raster Colorspace Values</A></H3>
3930 <P>The <CODE>cups_cspace_t</CODE> enumeration defines the possible
3931 colorspaces:</P>
3932 <UL>
3933 <LI><CODE>CUPS_CSPACE_W</CODE> - White (luminance)</LI>
3934 <LI><CODE>CUPS_CSPACE_RGB</CODE> - Red, green, blue</LI>
3935 <LI><CODE>CUPS_CSPACE_RGBA</CODE> - Red, green, blue, alpha</LI>
3936 <LI><CODE>CUPS_CSPACE_K</CODE> - Black</LI>
3937 <LI><CODE>CUPS_CSPACE_CMY</CODE> - Cyan, magenta, yellow</LI>
3938 <LI><CODE>CUPS_CSPACE_YMC</CODE> - Yellow, magenta, cyan</LI>
3939 <LI><CODE>CUPS_CSPACE_CMYK</CODE> - Cyan, magenta, yellow, black</LI>
3940 <LI><CODE>CUPS_CSPACE_YMCK</CODE> - Yellow, magenta, cyan, black</LI>
3941 <LI><CODE>CUPS_CSPACE_KCMY</CODE> - Black, cyan, magenta, yellow</LI>
3942 <LI><CODE>CUPS_CSPACE_KCMYcm</CODE> - Black, cyan, magenta, yellow,
3943 light cyan, light magenta</LI>
3944 <LI><CODE>CUPS_CSPACE_GMCK</CODE> - Metallic yellow (gold), metallic
3945 magenta, metallic cyan, black</LI>
3946 <LI><CODE>CUPS_CSPACE_GMCS</CODE> - Metallic yellow (gold), metallic
3947 magenta, metallic cyan, metallic grey (silver)</LI>
3948 <LI><CODE>CUPS_CSPACE_WHITE</CODE> - White pigment (black as white
3949 pigment)</LI>
3950 <LI><CODE>CUPS_CSPACE_GOLD</CODE> - Gold foil (black as gold foil)</LI>
3951 <LI><CODE>CUPS_CSPACE_SILVER</CODE> - Silver foil (black as silver foil)</LI>
3952 </UL>
3953 <H1 ALIGN="RIGHT"><A NAME="STRUCTURES">C - Structures</A></H1>
3954 <P>This appendix describes all of the structures that are defined by the
3955 CUPS API.</P>
3956 <H2><A NAME="9_1">CUPS Structures</A></H2>
3957 <H3><A NAME="cups_dest_t">CUPS Destinations</A></H3>
3958 <P>The CUPS destination structure (<CODE>cups_dest_t</CODE>) contains
3959 information on a specific destination or instance:
3960 <CENTER>
3961 <TABLE BORDER="1" WIDTH="90%">
3962 <TR><TH>Member</TH><TH>Type</TH><TH>Description</TH></TR>
3963 <TR><TD>name</TD><TD>char *</TD><TD>The name of the printer or class.</TD>
3964 </TR>
3965 <TR><TD>instance</TD><TD>char *</TD><TD>The instance of the printer or
3966 class; NULL for the primary instance.</TD></TR>
3967 <TR><TD>is_default</TD><TD>int</TD><TD>1 if the destination is set as
3968 the default, 0 otherwise.</TD></TR>
3969 <TR><TD>num_options</TD><TD>int</TD><TD>The number of options associated
3970 with this destination.</TD></TR>
3971 <TR><TD>options</TD><TD><A HREF="#cups_option_t">cups_option_t *</A></TD><TD>
3972 The options associated with this destination.</TD></TR>
3973 </TABLE>
3974 </CENTER>
3975 </P>
3976 <H3><A NAME="cups_job_t">CUPS Jobs</A></H3>
3977 <P>The CUPS job structure (<CODE>cups_job_t</CODE>) contains information
3978 on a specific job:
3979 <CENTER>
3980 <TABLE BORDER="1" WIDTH="90%">
3981 <TR><TH>Member</TH><TH>Type</TH><TH>Description</TH></TR>
3982 <TR><TD>id</TD><TD>int</TD><TD>The job ID for this job.</TD></TR>
3983 <TR><TD>dest</TD><TD>char *</TD><TD>The destination for this job
3984 (printer or class name).</TD></TR>
3985 <TR><TD>title</TD><TD>char *</TD><TD>The job-name for this job (title).</TD>
3986 </TR>
3987 <TR><TD>user</TD><TD>char *</TD><TD>The job-originating-user-name for
3988 this job (username).</TD></TR>
3989 <TR><TD>format</TD><TD>char *</TD><TD>The document-format for this job
3990 (MIME type string).</TD></TR>
3991 <TR><TD>state</TD><TD>ipp_jstate</TD><TD>The current state of the job.</TD>
3992 </TR>
3993 <TR><TD>size</TD><TD>int</TD><TD>The size of this job in kilobytes.</TD></TR>
3994 <TR><TD>priority</TD><TD>int</TD><TD>The priority of this job from 1 to
3995 100 (50 is normal).</TD></TR>
3996 <TR><TD>completed_time</TD><TD>time_t</TD><TD>The time the job was
3997 completed, or 0 if not yet completed.</TD></TR>
3998 <TR><TD>creation_time</TD><TD>time_t</TD><TD>The time the job was
3999 queued.</TD></TR>
4000 <TR><TD>processing_time</TD><TD>time_t</TD><TD>The time the job started
4001 printing.</TD></TR>
4002 </TABLE>
4003 </CENTER>
4004 </P>
4005 <H3><A NAME="cups_lang_t">CUPS Messages</A></H3>
4006 <P>The CUPS messages structure (<CODE>cups_lang_t</CODE>) contains the
4007 character set, locale name, and messages array:
4008 <CENTER>
4009 <TABLE BORDER="1" WIDTH="90%">
4010 <TR><TH>Member</TH><TH>Type</TH><TH>Description</TH></TR>
4011 <TR><TD>next</TD><TD>cups_lang_t *</TD><TD>Pointer to the next messages
4012 structure in memory.</TD></TR>
4013 <TR><TD>used</TD><TD>int</TD><TD>The number of active users of this
4014 messages structure.</TD></TR>
4015 <TR><TD>encoding</TD><TD>cups_encoding_t</TD><TD>The character encoding
4016 of the message strings.</TD></TR>
4017 <TR><TD>language</TD><TD>char [16]</TD><TD>The language/locale name.</TD>
4018 </TR>
4019 <TR><TD>messages</TD><TD>char *[]</TD><TD>The array of message strings.</TD>
4020 </TR>
4021 </TABLE>
4022 </CENTER>
4023 </P>
4024 <H3><A NAME="cups_option_t">CUPS Options</A></H3>
4025 <P>The CUPS option structure (<CODE>cups_option_t</CODE>) contains the
4026 option name and string value:
4027 <CENTER>
4028 <TABLE BORDER="1" WIDTH="90%">
4029 <TR><TH>Member</TH><TH>Type</TH><TH>Description</TH></TR>
4030 <TR><TD>name</TD><TD>char *</TD><TD>The name of the option.</TD></TR>
4031 <TR><TD>value</TD><TD>char *</TD><TD>The string value of the option.</TD>
4032 </TR>
4033 </TABLE>
4034 </CENTER>
4035 </P>
4036 <H2><A NAME="9_2">Networking Structures</A></H2>
4037 <H3><A NAME="http_t">HTTP State</A></H3>
4038 <P>The HTTP state structure (<CODE>http_t</CODE>) contains the current
4039 state of a HTTP request or response:
4040 <CENTER>
4041 <TABLE BORDER="1" WIDTH="90%">
4042 <TR><TH>Member</TH><TH>Type</TH><TH>Description</TH></TR>
4043 <TR><TD>fd</TD><TD>int</TD><TD>The socket for the HTTP connection.</TD></TR>
4044 <TR><TD>blocking</TD><TD>int</TD><TD>1 if the HTTP functions should
4045 block, 0 if not.</TD></TR>
4046 <TR><TD>error</TD><TD>int</TD><TD>The last OS error that occurred on the
4047 socket.</TD></TR>
4048 <TR><TD>activity</TD><TD>time_t</TD><TD>The last time the HTTP
4049 connection was used.</TD></TR>
4050 <TR><TD>state</TD><TD>http_state_t</TD><TD>The current HTTP
4051 request/response state.</TD></TR>
4052 <TR><TD>status</TD><TD>int</TD><TD>The last HTTP status seen.</TD></TR>
4053 <TR><TD>version</TD><TD>http_version_t</TD><TD>The HTTP protocol version
4054 in use.</TD></TR>
4055 <TR><TD>keep_alive</TD><TD>http_keep_alive_t</TD><TD>Whether or not to
4056 use Keep-Alive</TD></TR>
4057 <TR><TD>hostaddr</TD><TD>struct sockaddr_in</TD><TD>The IPv4 address of
4058 the HTTP server.</TD></TR>
4059 <TR><TD>hostname</TD><TD>char []</TD><TD>The hostname of the HTTP
4060 server.</TD></TR>
4061 <TR><TD>fields</TD><TD>char [][]</TD><TD>The string values of all HTTP
4062 request/response fields.</TD></TR>
4063 <TR><TD>data</TD><TD>char *</TD><TD>Current byte in data buffer.</TD></TR>
4064 <TR><TD>data_encoding</TD><TD>http_encoding_t</TD><TD>The transfer
4065 encoding for the request/response.</TD></TR>
4066 <TR><TD>data_remaining</TD><TD>int</TD><TD>The number of bytes remaining
4067 in the current request, response, or chunk.</TD></TR>
4068 <TR><TD>used</TD><TD>int</TD><TD>The number of bytes that are used in
4069 the buffer.</TD></TR>
4070 <TR><TD>buffer</TD><TD>char []</TD><TD>The read/write buffer.</TD></TR>
4071 <TR><TD>auth_type</TD><TD>int</TD><TD>The type of authentication in use.</TD>
4072 </TR>
4073 <TR><TD>md5_state</TD><TD>md5_state_t</TD><TD>The current MD5 digest
4074 state.</TD></TR>
4075 <TR><TD>nonce</TD><TD>char []</TD><TD>The nonce value for Digest
4076 authentication.</TD></TR>
4077 <TR><TD>nonce_count</TD><TD>int</TD><TD>The nonce count value.</TD></TR>
4078 <TR><TD>tls</TD><TD>void *</TD><TD>A pointer to private encryption data.</TD>
4079 </TR>
4080 <TR><TD>encryption</TD><TD>http_encryption_t</TD><TD>The current
4081 encryption mode.</TD></TR>
4082 </TABLE>
4083 </CENTER>
4084 </P>
4085 <H3><A NAME="ipp_t">IPP State</A></H3>
4086 <P>The IPP state structure (<CODE>ipp_t</CODE>) contains the current
4087 state of a IPP request or response:
4088 <CENTER>
4089 <TABLE BORDER="1" WIDTH="90%">
4090 <TR><TH>Member</TH><TH>Type</TH><TH>Description</TH></TR>
4091 <TR><TD></TD><TD></TD><TD></TD></TR>
4092 </TABLE>
4093 </CENTER>
4094 </P>
4095 <H2><A NAME="9_3">Raster Structures</A></H2>
4096 <H3><A NAME="cups_raster_header_t">Raster Page Header</A></H3>
4097 <P>The raster page header (<CODE>cups_raster_header_t</CODE>) consists
4098 of the PostScript page device dictionary for the page:
4099 <CENTER>
4100 <TABLE BORDER="1" WIDTH="90%">
4101 <TR><TH>Member</TH><TH>Type</TH><TH>Description</TH></TR>
4102 <TR><TD>MediaClass</TD><TD>char[64]</TD><TD>The media class name</TD></TR>
4103 <TR><TD>MediaColor</TD><TD>char[64]</TD><TD>The media color name</TD></TR>
4104 <TR><TD>MediaType</TD><TD>char[64]</TD><TD>The media type name</TD></TR>
4105 <TR><TD>OutputType</TD><TD>char[64]</TD><TD>The output type name</TD></TR>
4106 <TR><TD>AdvanceDistance</TD><TD>unsigned</TD><TD>The distance to advance
4107 the media in points</TD></TR>
4108 <TR><TD>AdvanceMedia</TD><TD>cups_adv_t</TD><TD>When to advance the
4109 media</TD></TR>
4110 <TR><TD>Collate</TD><TD>cups_bool_t</TD><TD>Whether or not to produce
4111 collated copies</TD></TR>
4112 <TR><TD>CutMedia</TD><TD>cups_cut_t</TD><TD>When to cut the media</TD></TR>
4113 <TR><TD>Duplex</TD><TD>cups_bool_t</TD><TD>Whether or not to print on
4114 both sides of the paper</TD></TR>
4115 <TR><TD>HWResolution</TD><TD>unsigned[2]</TD><TD>The resolution of the
4116 page image in pixels per inch; the HWResolution[0] represents the
4117 horizontal resolution and HWResolution[1] represents the vertical
4118 resolution</TD></TR>
4119 <TR><TD>ImagingBoundingBox</TD><TD>unsigned[4]</TD><TD>The bounding box
4120 for the page in points; the elements represent the left, bottom, right,
4121 and top coordinates of the imaged area (if 0 then the whole page is
4122 imaged)</TD></TR>
4123 <TR><TD>InsertSheet</TD><TD>cups_bool_t</TD><TD>Whether or not to insert
4124 a sheet before this page</TD></TR>
4125 <TR><TD>Jog</TD><TD>cups_jog_t</TD><TD>When to jog copies of the page</TD>
4126 </TR>
4127 <TR><TD>LeadingEdge</TD><TD>cups_edge_t</TD><TD>The leading edge of the
4128 page</TD></TR>
4129 <TR><TD>Margins</TD><TD>unsigned[2]</TD><TD>The lower-lefthand margin of
4130 the page in points</TD></TR>
4131 <TR><TD>ManualFeed</TD><TD>cups_bool_t</TD><TD>Whether or not to
4132 manually feed the page</TD></TR>
4133 <TR><TD>MediaPosition</TD><TD>unsigned</TD><TD>The input slot number to
4134 use</TD></TR>
4135 <TR><TD>MediaWeight</TD><TD>unsigned</TD><TD>The weight of the output
4136 media in grams/m<SUP>2</SUP></TD></TR>
4137 <TR><TD>MirrorPrint</TD><TD>cups_bool_t</TD><TD>Whether or not to mirror
4138 the print</TD></TR>
4139 <TR><TD>NegativePrint</TD><TD>cups_bool_t</TD><TD>Whether or not to
4140 invert the print</TD></TR>
4141 <TR><TD>NumCopies</TD><TD>unsigned</TD><TD>The number of copies to
4142 produce</TD></TR>
4143 <TR><TD>Orientation</TD><TD>cups_orient_t</TD><TD>The orientation of the
4144 page image</TD></TR>
4145 <TR><TD>OutputFaceUp</TD><TD>cups_bool_t</TD><TD>Whether or not to
4146 output the page face up</TD></TR>
4147 <TR><TD>PageSize</TD><TD>unsigned[2]</TD><TD>The width and height of the
4148 page in points</TD></TR>
4149 <TR><TD>Separations</TD><TD>cups_bool_t</TD><TD>Whether or not to output
4150 separations</TD></TR>
4151 <TR><TD>TraySwitch</TD><TD>cups_bool_t</TD><TD>Whether or not to
4152 automatically switch trays for the requested media size/type</TD></TR>
4153 <TR><TD>Tumble</TD><TD>cups_bool_t</TD><TD>Whether or not to rotate the
4154 back side of the page</TD></TR>
4155 <TR><TD>cupsWidth</TD><TD>unsigned</TD><TD>The width of the page image
4156 in pixels</TD></TR>
4157 <TR><TD>cupsHeight</TD><TD>unsigned</TD><TD>The height of the page image
4158 in pixels</TD></TR>
4159 <TR><TD>cupsMediaType</TD><TD>unsigned</TD><TD>The device-specific media
4160 type code</TD></TR>
4161 <TR><TD>cupsBitsPerColor</TD><TD>unsigned</TD><TD>The number of bits per
4162 color</TD></TR>
4163 <TR><TD>cupsBitsPerPixel</TD><TD>unsigned</TD><TD>The number of bits per
4164 pixel</TD></TR>
4165 <TR><TD>cupsBytesPerLine</TD><TD>unsigned</TD><TD>The number of bytes
4166 per line of image data</TD></TR>
4167 <TR><TD>cupsColorOrder</TD><TD>cups_order_t</TD><TD>The order of color
4168 values</TD></TR>
4169 <TR><TD>cupsColorSpace</TD><TD>cups_cspace_t</TD><TD>The type of color
4170 values</TD></TR>
4171 <TR><TD>cupsCompression</TD><TD>unsigned</TD><TD>The device-specific
4172 compression code</TD></TR>
4173 <TR><TD>cupsRowCount</TD><TD>unsigned</TD><TD>The device-specific row
4174 count</TD></TR>
4175 <TR><TD>cupsRowFeed</TD><TD>unsigned</TD><TD>The device-specific row
4176 feed</TD></TR>
4177 <TR><TD>cupsRowStep</TD><TD>unsigned</TD><TD>The device-specific row
4178 step</TD></TR>
4179 </TABLE>
4180 </CENTER>
4181 </P>
4182 <H1 ALIGN="RIGHT"><A NAME="FUNCTIONS">D - Functions</A></H1>
4183 <P>This appendix provides a reference for all of the CUPS API functions.
4184 <!-- NEW PAGE -->
4185 </P>
4186 <H2><A NAME="cupsAddDest">cupsAddDest()</A></H2>
4187 <H3><A NAME="10_1_1">Usage</A></H3>
4188 <PRE>
4189 int
4190 cupsAddDest(const char *name,
4191 const char *instance,
4192 int num_dests,
4193 cups_dest_t **dests);
4194 </PRE>
4195 <H3><A NAME="10_1_2">Arguments</A></H3>
4196 <CENTER>
4197 <TABLE BORDER WIDTH="80%">
4198 <TR><TH>Argument</TH><TH>Description</TH></TR>
4199 <TR><TD>name</TD><TD>The name of the destination.</TD></TR>
4200 <TR><TD>instance</TD><TD>The instance of the destination, or NULL for
4201 the primary instance.</TD></TR>
4202 <TR><TD>num_dests</TD><TD>The number of destinations in the array.</TD></TR>
4203 <TR><TD>dest</TD><TD>A pointer to the destination array pointer.</TD></TR>
4204 </TABLE>
4205 </CENTER>
4206 <H3><A NAME="10_1_3">Returns</A></H3>
4207 <P>The new number of destinations in the array.</P>
4208 <H3><A NAME="10_1_4">Description</A></H3>
4209 <P><CODE>cupsAddDest()</CODE> adds the named destination to the
4210 destination array if it does not already exist.</P>
4211 <H3><A NAME="10_1_5">Example</A></H3>
4212 <PRE>
4213 #include &lt;cups/cups.h&gt;
4214
4215 int num_dests;
4216 <A HREF="#cups_dest_t">cups_dest_t</A> *dests;
4217
4218
4219 num_dests = cupsAddDests(&quot;foo&quot;, &quot;bar&quot;, num_dests, &amp;dests);
4220 </PRE>
4221 <H3><A NAME="10_1_6">See Also</A></H3>
4222 <P><A HREF="#cupsFreeDests"> <CODE>cupsFreeDests()</CODE></A>,<A HREF="#cupsGetDest">
4223 <CODE>cupsGetDest()</CODE></A>,<A HREF="#cupsGetDests"> <CODE>
4224 cupsGetDests()</CODE></A>
4225 <!-- NEW PAGE -->
4226 </P>
4227 <H2><A NAME="cupsAddOption">cupsAddOption()</A></H2>
4228 <H3><A NAME="10_2_1">Usage</A></H3>
4229 <PRE>
4230 int
4231 cupsAddOption(const char *name,
4232 const char *value,
4233 int num_options,
4234 cups_option_t **options);
4235 </PRE>
4236 <H3><A NAME="10_2_2">Arguments</A></H3>
4237 <CENTER>
4238 <TABLE BORDER WIDTH="80%">
4239 <TR><TH>Argument</TH><TH>Description</TH></TR>
4240 <TR><TD>name</TD><TD>The name of the option.</TD></TR>
4241 <TR><TD>value</TD><TD>The value of the option.</TD></TR>
4242 <TR><TD>num_options</TD><TD>Number of options currently in the array.</TD>
4243 </TR>
4244 <TR><TD>options</TD><TD>Pointer to the options array.</TD></TR>
4245 </TABLE>
4246 </CENTER>
4247 <H3><A NAME="10_2_3">Returns</A></H3>
4248 <P>The new number of options.</P>
4249 <H3><A NAME="10_2_4">Description</A></H3>
4250 <P><CODE>cupsAddOption()</CODE> adds an option to the specified array.</P>
4251 <H3><A NAME="10_2_5">Example</A></H3>
4252 <PRE>
4253 #include &lt;cups.h&gt;
4254
4255 ...
4256
4257 /* Declare the options array */
4258 int num_options;
4259 <A HREF="#cups_option_t">cups_option_t</A> *options;
4260
4261 /* Initialize the options array */
4262 num_options = 0;
4263 options = (cups_option_t *)0;
4264
4265 /* Add options using cupsAddOption() */
4266 num_options = cupsAddOption(&quot;media&quot;, &quot;letter&quot;, num_options, &amp;options);
4267 num_options = cupsAddOption(&quot;resolution&quot;, &quot;300dpi&quot;, num_options, &amp;options);
4268 </PRE>
4269 <H3><A NAME="10_2_6">See Also</A></H3>
4270 <A HREF="#cupsEncodeOptions"> <CODE>cupsEncodeOptions()</CODE></A>,<A HREF="#cupsFreeOptions">
4271 <CODE>cupsFreeOptions()</CODE></A>,<A HREF="#cupsGetOption"> <CODE>
4272 cupsGetOption()</CODE></A>,<A HREF="#cupsParseOptions"> <CODE>
4273 cupsParseOptions()</CODE></A>
4274 <!-- NEW PAGE -->
4275
4276 <H2><A NAME="cupsCancelJob">cupsCancelJob()</A></H2>
4277 <H3><A NAME="10_3_1">Usage</A></H3>
4278 <PRE>
4279 int
4280 cupsCancelJob(const char *dest,
4281 int job);
4282 </PRE>
4283 <H3><A NAME="10_3_2">Arguments</A></H3>
4284 <CENTER>
4285 <TABLE BORDER WIDTH="80%">
4286 <TR><TH>Argument</TH><TH>Description</TH></TR>
4287 <TR><TD>dest</TD><TD>Printer or class name</TD></TR>
4288 <TR><TD>job</TD><TD>Job ID</TD></TR>
4289 </TABLE>
4290 </CENTER>
4291 <H3><A NAME="10_3_3">Returns</A></H3>
4292 <P>1 on success, 0 on failure. On failure the error can be found by
4293 calling<A HREF="#cupsLastError"> <CODE>cupsLastError()</CODE></A>.</P>
4294 <H3><A NAME="10_3_4">Description</A></H3>
4295 <P><CODE>cupsCancelJob()</CODE> cancels the specifies job.</P>
4296 <H3><A NAME="10_3_5">Example</A></H3>
4297 <PRE>
4298 #include &lt;cups.h&gt;
4299
4300 cupsCancelJob(&quot;LaserJet&quot;, 1);
4301 </PRE>
4302 <H3><A NAME="10_3_6">See Also</A></H3>
4303 <P><A HREF="#cupsLastError"> <CODE>cupsLastError()</CODE></A>,<A HREF="#cupsPrintFile">
4304 <CODE>cupsPrintFile()</CODE></A>,<A HREF="#cupsPrintFiles"> <CODE>
4305 cupsPrintFiles()</CODE></A>
4306 <!-- NEW PAGE -->
4307 </P>
4308 <H2><A NAME="cupsDoFileRequest">cupsDoFileRequest()</A></H2>
4309 <H3><A NAME="10_4_1">Usage</A></H3>
4310 <PRE>
4311 ipp_t *
4312 cupsDoFileRequest(http_t *http,
4313 ipp_t *request,
4314 const char *resource,
4315 const char *filename);
4316 </PRE>
4317 <H3><A NAME="10_4_2">Arguments</A></H3>
4318 <CENTER>
4319 <TABLE BORDER WIDTH="80%">
4320 <TR><TH>Argument</TH><TH>Description</TH></TR>
4321 <TR><TD>http</TD><TD>HTTP connection to server.</TD></TR>
4322 <TR><TD>request</TD><TD>IPP request data.</TD></TR>
4323 <TR><TD>resource</TD><TD>HTTP resource name for POST.</TD></TR>
4324 <TR><TD>filename</TD><TD>File to send with POST request (<CODE>NULL</CODE>
4325 pointer if none.)</TD></TR>
4326 </TABLE>
4327 </CENTER>
4328 <H3><A NAME="10_4_3">Returns</A></H3>
4329 <P>IPP response data or <CODE>NULL</CODE> if the request fails. On
4330 failure the error can be found by calling<A HREF="#cupsLastError"> <CODE>
4331 cupsLastError()</CODE></A>.</P>
4332 <H3><A NAME="10_4_4">Description</A></H3>
4333 <P><CODE>cupsDoFileRequest()</CODE> does a HTTP POST request and
4334 provides the IPP request and optionally the contents of a file to the
4335 IPP server. It also handles resubmitting the request and performing
4336 password authentication as needed.</P>
4337 <H3><A NAME="10_4_5">Example</A></H3>
4338 <PRE>
4339 #include &lt;cups.h&gt;
4340
4341 <A HREF="#http_t">http_t</A> *http;
4342 <A HREF="#cups_lang_t">cups_lang_t</A> *language;
4343 <A HREF="#ipp_t">ipp_t</A> *request;
4344 ipp_t *response;
4345
4346 ...
4347
4348 /* Get the default language */
4349 language = <A HREF="#cupsLangDefault">cupsLangDefault()</A>;
4350
4351 /* Create a new IPP request */
4352 request = <A HREF="#ippNew">ippNew()</A>;
4353
4354 request-&gt;request.op.operation_id = IPP_PRINT_FILE;
4355 request-&gt;request.op.request_id = 1;
4356
4357 /* Add required attributes */
4358 <A HREF="#ippAddString">ippAddString</A>(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
4359 &quot;attributes-charset&quot;, NULL, <A HREF="#cupsLangEncoding">cupsLangEncoding</A>(language));
4360
4361 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
4362 &quot;attributes-natural-language&quot;, NULL,
4363 language != NULL ? language-&gt;language : &quot;C&quot;);
4364
4365 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, &quot;printer-uri&quot;,
4366 NULL, &quot;ipp://hostname/resource&quot;);
4367
4368 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, &quot;requesting-user-name&quot;,
4369 NULL, <A HREF="#cupsUser">cupsUser()</A>);
4370
4371 /* Do the request... */
4372 response = cupsDoFileRequest(http, request, &quot;/resource&quot;, &quot;filename.txt&quot;);
4373 </PRE>
4374 <H3><A NAME="10_4_6">See Also</A></H3>
4375 <P><A HREF="#cupsLangDefault"> <CODE>cupsLangDefault()</CODE></A>,<A HREF="#cupsLangEncoding">
4376 <CODE>cupsLangEncoding()</CODE></A>,<A HREF="#cupsUser"> <CODE>
4377 cupsUser()</CODE></A>,<A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>
4378 ,<A HREF="#ippAddString"> <CODE>ippAddString()</CODE></A>,<A HREF="#ippNew">
4379 <CODE>ippNew()</CODE></A>
4380 <!-- NEW PAGE -->
4381 </P>
4382 <H2><A NAME="cupsDoRequest">cupsDoRequest()</A></H2>
4383 <H3><A NAME="10_5_1">Usage</A></H3>
4384 <PRE>
4385 ipp_t *
4386 cupsDoRequest(http_t *http,
4387 ipp_t *request,
4388 const char *resource);
4389 </PRE>
4390 <H3><A NAME="10_5_2">Arguments</A></H3>
4391 <CENTER>
4392 <TABLE BORDER WIDTH="80%">
4393 <TR><TH>Argument</TH><TH>Description</TH></TR>
4394 <TR><TD>http</TD><TD>HTTP connection to server.</TD></TR>
4395 <TR><TD>request</TD><TD>IPP request data.</TD></TR>
4396 <TR><TD>resource</TD><TD>HTTP resource name for POST.</TD></TR>
4397 </TABLE>
4398 </CENTER>
4399 <H3><A NAME="10_5_3">Returns</A></H3>
4400 <P>IPP response data or <CODE>NULL</CODE> if the request fails. On
4401 failure the error can be found by calling<A HREF="#cupsLastError"> <CODE>
4402 cupsLastError()</CODE></A>.</P>
4403 <H3><A NAME="10_5_4">Description</A></H3>
4404 <P><CODE>cupsDoRequest()</CODE> does a HTTP POST request and provides
4405 the IPP request to the IPP server. It also handles resubmitting the
4406 request and performing password authentication as needed.</P>
4407 <H3><A NAME="10_5_5">Example</A></H3>
4408 <PRE>
4409 #include &lt;cups.h&gt;
4410
4411 <A HREF="#http_t">http_t</A> *http;
4412 <A HREF="#cups_lang_t">cups_lang_t</A> *language;
4413 <A HREF="#ipp_t">ipp_t</A> *request;
4414 ipp_t *response;
4415
4416 ...
4417
4418 /* Get the default language */
4419 language = <A HREF="#cupsLangDefault">cupsLangDefault()</A>;
4420
4421 /* Create a new IPP request */
4422 request = <A HREF="#ippNew">ippNew()</A>;
4423
4424 request-&gt;request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
4425 request-&gt;request.op.request_id = 1;
4426
4427 /* Add required attributes */
4428 <A HREF="#ippAddString">ippAddString</A>(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
4429 &quot;attributes-charset&quot;, NULL, <A HREF="#cupsLangEncoding">cupsLangEncoding</A>(language));
4430
4431 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
4432 &quot;attributes-natural-language&quot;, NULL,
4433 language != NULL ? language-&gt;language : &quot;C&quot;);
4434
4435 ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, &quot;printer-uri&quot;,
4436 NULL, &quot;ipp://hostname/resource&quot;);
4437
4438 /* Do the request... */
4439 response = cupsDoRequest(http, request, &quot;/resource&quot;);
4440 </PRE>
4441 <H3><A NAME="10_5_6">See Also</A></H3>
4442 <P><A HREF="#cupsLangDefault"> <CODE>cupsLangDefault()</CODE></A>,<A HREF="#cupsLangEncoding">
4443 <CODE>cupsLangEncoding()</CODE></A>,<A HREF="#cupsUser"> <CODE>
4444 cupsUser()</CODE></A>,<A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>
4445 ,<A HREF="#ippAddString"> <CODE>ippAddString()</CODE></A>,<A HREF="#ippNew">
4446 <CODE>ippNew()</CODE></A>
4447 <!-- NEW PAGE -->
4448 </P>
4449 <H2><A NAME="cupsEncodeOptions">cupsEncodeOptions()</A></H2>
4450 <H3><A NAME="10_6_1">Usage</A></H3>
4451 <PRE>
4452 void
4453 cupsEncodeOptions(ipp_t *ipp,
4454 int num_options,
4455 cups_option_t *options);
4456 </PRE>
4457 <H3><A NAME="10_6_2">Arguments</A></H3>
4458 <CENTER>
4459 <TABLE BORDER WIDTH="80%">
4460 <TR><TH>Argument</TH><TH>Description</TH></TR>
4461 <TR><TD>ipp</TD><TD>The IPP request.</TD></TR>
4462 <TR><TD>num_options</TD><TD>The number of options.</TD></TR>
4463 <TR><TD>options</TD><TD>The options.</TD></TR>
4464 </TABLE>
4465 </CENTER>
4466 <H3><A NAME="10_6_3">Description</A></H3>
4467 <P><CODE>cupsEncodeOptions()</CODE> encodes all of the options in the
4468 specified array as IPP attributes and adds them to the IPP request.</P>
4469 <H3><A NAME="10_6_4">Example</A></H3>
4470 <PRE>
4471 #include &lt;cups/cups.h&gt;
4472
4473 <A HREF="#ipp_t">ipp_t</A> *ipp;
4474 int num_options;
4475 <A HREF="#cups_option_t">cups_option_t</A> *options;
4476
4477
4478 cupsEncodeOptions(ipp, num_options, options);
4479 </PRE>
4480 <H3><A NAME="10_6_5">See Also</A></H3>
4481 <P><A HREF="#cupsAddOption"> <CODE>cupsAddOption()</CODE></A>,<A HREF="#cupsParseOptions">
4482 <CODE>cupsParseOptions()</CODE></A>,<A HREF="#ippNew"> <CODE>ippNew()</CODE>
4483 </A>
4484 <!-- NEW PAGE -->
4485 </P>
4486 <H2><A NAME="cupsEncryption">cupsEncryption()</A></H2>
4487 <H3><A NAME="10_7_1">Usage</A></H3>
4488 <PRE>
4489 http_encryption_t
4490 cupsEncryption(void);
4491 </PRE>
4492 <H3><A NAME="10_7_2">Returns</A></H3>
4493 <P>The current encryption setting.</P>
4494 <H3><A NAME="10_7_3">Description</A></H3>
4495 <P><CODE>cupsEncryption()</CODE> returns the current encryption setting
4496 for IPP requests such as printing.</P>
4497 <H3><A NAME="10_7_4">Example</A></H3>
4498 <PRE>
4499 #include &lt;cups/cups.h&gt;
4500
4501 <A HREF="#http_t">http_t</A> *http;
4502
4503 printf(&quot;The current encryption setting is %d.\n&quot;, cupsEncryption());
4504
4505 http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
4506 </PRE>
4507 <H3><A NAME="10_7_5">See Also</A></H3>
4508 <P><A HREF="#cupsServer"> <CODE>cupsServer()</CODE></A>,<A HREF="#httpConnectEncrypt">
4509 <CODE>httpConnectEncrypt()</CODE></A>,<A HREF="#ippPort"> <CODE>
4510 ippPort()</CODE></A>
4511 <!-- NEW PAGE -->
4512 </P>
4513 <H2><A NAME="cupsFreeDests">cupsFreeDests()</A></H2>
4514 <H3><A NAME="10_8_1">Usage</A></H3>
4515 <PRE>
4516 void
4517 cupsFreeDests(int num_dests,
4518 cups_dest_t *dests);
4519 </PRE>
4520 <H3><A NAME="10_8_2">Arguments</A></H3>
4521 <CENTER>
4522 <TABLE BORDER WIDTH="80%">
4523 <TR><TH>Argument</TH><TH>Description</TH></TR>
4524 <TR><TD>num_dests</TD><TD>The number of destinations in the array.</TD></TR>
4525 <TR><TD>dests</TD><TD>The destination array.</TD></TR>
4526 </TABLE>
4527 </CENTER>
4528 <H3><A NAME="10_8_3">Description</A></H3>
4529 <P><CODE>cupsFreeDests()</CODE> frees a destination array that was
4530 created using <CODE>cupsGetDests()</CODE>.</P>
4531 <H3><A NAME="10_8_4">Example</A></H3>
4532 <PRE>
4533 #include &lt;cups/cups.h&gt;
4534
4535 int num_dests;
4536 <A HREF="#cups_dest_t">cups_dest_t</A> *dests;
4537 cups_dest_t *dest;
4538
4539 num_dests = cupsGetDests(&amp;dests);
4540 dest = cupsGetDest(NULL, NULL, num_dests, dests);
4541
4542 if (dest)
4543 printf(&quot;The default destination is %s\n&quot;, dest-&gt;name);
4544 else
4545 puts(&quot;No default destination.&quot;);
4546
4547 cupsFreeDests(num_dests, dests);
4548 </PRE>
4549 <H3><A NAME="10_8_5">See Also</A></H3>
4550 <P><A HREF="#cupsGetDest"> <CODE>cupsGetDest()</CODE></A>,<A HREF="#cupsGetDests">
4551 <CODE>cupsGetDests()</CODE></A>
4552 <!-- NEW PAGE -->
4553 </P>
4554 <H2><A NAME="cupsFreeJobs">cupsFreeJobs()</A></H2>
4555 <H3><A NAME="10_9_1">Usage</A></H3>
4556 <PRE>
4557 void
4558 cupsFreeJobs(int num_jobs,
4559 cups_job_t *jobs);
4560 </PRE>
4561 <H3><A NAME="10_9_2">Arguments</A></H3>
4562 <CENTER>
4563 <TABLE BORDER WIDTH="80%">
4564 <TR><TH>Argument</TH><TH>Description</TH></TR>
4565 <TR><TD>num_jobs</TD><TD>The number of jobs.</TD></TR>
4566 <TR><TD>jobs</TD><TD>The job array.</TD></TR>
4567 </TABLE>
4568 </CENTER>
4569 <H3><A NAME="10_9_3">Description</A></H3>
4570 <P><CODE>cupsFreeJobs()</CODE> frees an array of print jobs created by
4571 the <CODE>cupsGetJobs()</CODE> function.</P>
4572 <H3><A NAME="10_9_4">Example</A></H3>
4573 <PRE>
4574 #include &lt;cups/cups.h&gt;
4575
4576 int i;
4577 int num_jobs;
4578 <A HREF="#cups_job_t">cups_job_t</A> *jobs;
4579
4580
4581 num_jobs = cupsGetJobs(&amp;jobs, NULL, 0, 0);
4582
4583 printf(&quot;%d active job(s):\n&quot;, num_jobs);
4584 for (i = 0; i &lt; num_jobs; i ++)
4585 printf(&quot;%-16.16s %-6d %-12.12s %s (%s)\n&quot;, jobs[i].dest, jobs[i].id,
4586 jobs[i].user, jobs[i].title,
4587 jobs[i].state != IPP_JOB_PENDING ? &quot;printing&quot; : &quot;pending&quot;);
4588
4589 cupsFreeJobs(num_jobs, jobs);
4590 </PRE>
4591 <H3><A NAME="10_9_5">See Also</A></H3>
4592 <P><A HREF="#cupsGetJobs"> <CODE>cupsGetJobs()</CODE></A>,<A HREF="#cupsGetDests">
4593 <CODE>cupsGetDests()</CODE></A>
4594 <!-- NEW PAGE -->
4595 </P>
4596 <H2><A NAME="cupsFreeOptions">cupsFreeOptions()</A></H2>
4597 <H3><A NAME="10_10_1">Usage</A></H3>
4598 <PRE>
4599 void
4600 cupsFreeOptions(int num_options,
4601 cups_option_t *options);
4602 </PRE>
4603 <H3><A NAME="10_10_2">Arguments</A></H3>
4604 <CENTER>
4605 <TABLE BORDER WIDTH="80%">
4606 <TR><TH>Argument</TH><TH>Description</TH></TR>
4607 <TR><TD>num_options</TD><TD>Number of options in array.</TD></TR>
4608 <TR><TD>options</TD><TD>Pointer to options array.</TD></TR>
4609 </TABLE>
4610 </CENTER>
4611 <H3><A NAME="10_10_3">Description</A></H3>
4612 <P><CODE>cupsFreeOptions()</CODE> frees all memory associated with the
4613 option array specified.</P>
4614 <H3><A NAME="10_10_4">Example</A></H3>
4615 <PRE>
4616 #include &lt;cups/cups.h&gt;
4617
4618 int num_options;
4619 <A HREF="#cups_option_t">cups_option_t</A> *options;
4620
4621 ...
4622
4623 cupsFreeOptions(num_options, options);
4624 </PRE>
4625 <H3><A NAME="10_10_5">See Also</A></H3>
4626 <P><A HREF="#cupsAddOption"> <CODE>cupsAddOption()</CODE></A>,<A HREF="#cupsEncodeOptions">
4627 <CODE>cupsEncodeOptions()</CODE></A>,<A HREF="#cupsGetOption"> <CODE>
4628 cupsGetOption()</CODE></A>,<A HREF="#cupsMarkOptions"> <CODE>
4629 cupsMarkOptions()</CODE></A>,<A HREF="#cupsParseOptions"> <CODE>
4630 cupsParseOptions()</CODE></A>
4631 <!-- NEW PAGE -->
4632 </P>
4633 <H2><A NAME="cupsGetClasses">cupsGetClasses()</A></H2>
4634 <H3><A NAME="10_11_1">Usage</A></H3>
4635 <PRE>
4636 int
4637 cupsGetClasses(char ***classes);
4638 </PRE>
4639 <H3><A NAME="10_11_2">Arguments</A></H3>
4640 <CENTER>
4641 <TABLE BORDER WIDTH="80%">
4642 <TR><TH>Argument</TH><TH>Description</TH></TR>
4643 <TR><TD>classes</TD><TD>Pointer to character pointer array.</TD></TR>
4644 </TABLE>
4645 </CENTER>
4646 <H3><A NAME="10_11_3">Returns</A></H3>
4647 <P>The number of printer classes available.</P>
4648 <H3><A NAME="10_11_4">Description</A></H3>
4649 <P><CODE>cupsGetClasses()</CODE> gets a list of the available printer
4650 classes. The returned array should be freed using the <CODE>free()</CODE>
4651 when it is no longer needed.</P>
4652 <H3><A NAME="10_11_5">Example</A></H3>
4653 <PRE>
4654 #include &lt;cups/cups.h&gt;
4655
4656 int i;
4657 int num_classes;
4658 char **classes;
4659
4660 ...
4661
4662 num_classes = cupsGetClasses(
4663
4664 ...
4665
4666 if (num_classes &gt; 0)
4667 {
4668 for (i = 0; i &lt; num_classes; i ++)
4669 free(classes[i]);
4670
4671 free(classes);
4672 }
4673 </PRE>
4674 <H3><A NAME="10_11_6">See Also</A></H3>
4675 <P><A HREF="#cupsGetDefault"> <CODE>cupsGetDefault()</CODE></A>,<A HREF="#cupsGetPrinters">
4676 <CODE>cupsGetPrinters()</CODE></A>
4677 <!-- NEW PAGE -->
4678 </P>
4679 <H2><A NAME="cupsGetDefault">cupsGetDefault()</A></H2>
4680 <H3><A NAME="10_12_1">Usage</A></H3>
4681 <PRE>
4682 const char *
4683 cupsGetDefault(void);
4684 </PRE>
4685 <H3><A NAME="10_12_2">Returns</A></H3>
4686 <P>A pointer to the default destination.</P>
4687 <H3><A NAME="10_12_3">Description</A></H3>
4688 <P><CODE>cupsGetDefault()</CODE> gets the default destination printer or
4689 class. The default destination is stored in a static string and will be
4690 overwritten (usually with the same value) after each call.</P>
4691 <H3><A NAME="10_12_4">Example</A></H3>
4692 <PRE>
4693 #include &lt;cups/cups.h&gt;
4694
4695 printf(&quot;The default destination is %s\n&quot;, cupsGetDefault());
4696 </PRE>
4697 <H3><A NAME="10_12_5">See Also</A></H3>
4698 <P><A HREF="#cupsGetClasses"> <CODE>cupsGetClasses()</CODE></A>,<A HREF="#cupsGetPrinters">
4699 <CODE>cupsGetPrinters()</CODE></A>
4700 <!-- NEW PAGE -->
4701 </P>
4702 <H2><A NAME="cupsGetDest">cupsGetDest()</A></H2>
4703 <H3><A NAME="10_13_1">Usage</A></H3>
4704 <PRE>
4705 cups_dest_t *
4706 cupsGetDest(const char *name,
4707 const char *instance,
4708 int num_dests,
4709 cups_dest_t *dests);
4710 </PRE>
4711 <H3><A NAME="10_13_2">Arguments</A></H3>
4712 <CENTER>
4713 <TABLE BORDER WIDTH="80%">
4714 <TR><TH>Argument</TH><TH>Description</TH></TR>
4715 <TR><TD>name</TD><TD>The name of the destination, or NULL for the
4716 default destination.</TD></TR>
4717 <TR><TD>instance</TD><TD>The instance of the destination, or NULL for
4718 the primary instance.</TD></TR>
4719 <TR><TD>num_dests</TD><TD>The number of destinations.</TD></TR>
4720 <TR><TD>dests</TD><TD>The destination array.</TD></TR>
4721 </TABLE>
4722 </CENTER>
4723 <H3><A NAME="10_13_3">Returns</A></H3>
4724 <P>A pointer to the specified destination, or NULL if none exists.</P>
4725 <H3><A NAME="10_13_4">Description</A></H3>
4726 <P><CODE>cupsGetDest()</CODE> finds the specified destination in the
4727 array of destinations created by the <CODE>cupsGetDests()</CODE>
4728 function.</P>
4729 <H3><A NAME="10_13_5">Example</A></H3>
4730 <PRE>
4731 #include &lt;cups/cups.h&gt;
4732
4733 int num_dests;
4734 <A HREF="#cups_dest_t">cups_dest_t</A> *dests;
4735 cups_dest_t *dest;
4736
4737 num_dests = cupsGetDests(&amp;dests);
4738 dest = cupsGetDest(NULL, NULL, num_dests, dests);
4739
4740 if (dest)
4741 printf(&quot;The default destination is %s\n&quot;, dest-&gt;name);
4742 else
4743 puts(&quot;No default destination.&quot;);
4744
4745 cupsFreeDests(num_dests, dests);
4746 </PRE>
4747 <H3><A NAME="10_13_6">See Also</A></H3>
4748 <P><A HREF="#cupsGetDests"> <CODE>cupsGetDests()</CODE></A>,<A HREF="#cupsGetJobs">
4749 <CODE>cupsGetJobs()</CODE></A>
4750 <!-- NEW PAGE -->
4751 </P>
4752 <H2><A NAME="cupsGetDests">cupsGetDests()</A></H2>
4753 <H3><A NAME="10_14_1">Usage</A></H3>
4754 <PRE>
4755 int
4756 cupsGetDests(cups_dest_t **dests);
4757 </PRE>
4758 <H3><A NAME="10_14_2">Arguments</A></H3>
4759 <CENTER>
4760 <TABLE BORDER WIDTH="80%">
4761 <TR><TH>Argument</TH><TH>Description</TH></TR>
4762 <TR><TD>dests</TD><TD>A pointer to a destination array pointer.</TD></TR>
4763 </TABLE>
4764 </CENTER>
4765 <H3><A NAME="10_14_3">Returns</A></H3>
4766 <P>The number of available destinations.</P>
4767 <H3><A NAME="10_14_4">Description</A></H3>
4768 <P><CODE>cupsGetDests()</CODE> creates an array of available
4769 destinations that the user can print to. The array should be freed
4770 using the <CODE>cupsFreeDests()</CODE> function.</P>
4771 <H3><A NAME="10_14_5">Example</A></H3>
4772 <PRE>
4773 #include &lt;cups/cups.h&gt;
4774
4775 int num_dests;
4776 <A HREF="#cups_dest_t">cups_dest_t</A> *dests;
4777 cups_dest_t *dest;
4778
4779 num_dests = cupsGetDests(&amp;dests);
4780 dest = cupsGetDest(NULL, NULL, num_dests, dests);
4781
4782 if (dest)
4783 printf(&quot;The default destination is %s\n&quot;, dest-&gt;name);
4784 else
4785 puts(&quot;No default destination.&quot;);
4786
4787 cupsFreeDests(num_dests, dests);
4788 </PRE>
4789 <H3><A NAME="10_14_6">See Also</A></H3>
4790 <P><A HREF="#cupsFreeDests"> <CODE>cupsFreeDests()</CODE></A>,<A HREF="#cupsGetDest">
4791 <CODE>cupsGetDest()</CODE></A>,<A HREF="#cupsGetJobs"> <CODE>
4792 cupsGetJobs()</CODE></A>
4793 <!-- NEW PAGE -->
4794 </P>
4795 <H2><A NAME="cupsGetJobs">cupsGetJobs()</A></H2>
4796 <H3><A NAME="10_15_1">Usage</A></H3>
4797 <PRE>
4798 int
4799 cupsGetJobs(cups_job_t **jobs,
4800 const char *dest,
4801 int myjobs,
4802 int completed);
4803 </PRE>
4804 <H3><A NAME="10_15_2">Arguments</A></H3>
4805 <CENTER>
4806 <TABLE BORDER WIDTH="80%">
4807 <TR><TH>Argument</TH><TH>Description</TH></TR>
4808 <TR><TD>jobs</TD><TD>A pointer to the job array pointer.</TD></TR>
4809 <TR><TD>dest</TD><TD>The destination name, or NULL if jobs for all
4810 destinations are requested.</TD></TR>
4811 <TR><TD>myjobs</TD><TD>1 if only those jobs submitted by the current <CODE>
4812 cupsUser()</CODE> should be returned, 0 for jobs submitted by all users.</TD>
4813 </TR>
4814 <TR><TD>completed</TD><TD>1 if only completed jobs should be returned, 0
4815 if only pending/processing jobs should be returned.</TD></TR>
4816 </TABLE>
4817 </CENTER>
4818 <H3><A NAME="10_15_3">Returns</A></H3>
4819 <P>The number of jobs.</P>
4820 <H3><A NAME="10_15_4">Description</A></H3>
4821 <P><CODE>cupsGetJobs()</CODE> creates an array of print jobs based on
4822 the arguments supplied in the function call. The returned array should
4823 be freed using the <CODE>cupsFreeJobs()</CODE> function.</P>
4824 <H3><A NAME="10_15_5">Example</A></H3>
4825 <PRE>
4826 #include &lt;cups/cups.h&gt;
4827
4828 int i;
4829 int num_jobs;
4830 <A HREF="#cups_job_t">cups_job_t</A> *jobs;
4831
4832
4833 num_jobs = cupsGetJobs(&amp;jobs, NULL, 0, 0);
4834
4835 printf(&quot;%d active job(s):\n&quot;, num_jobs);
4836 for (i = 0; i &lt; num_jobs; i ++)
4837 printf(&quot;%-16.16s %-6d %-12.12s %s (%s)\n&quot;, jobs[i].dest, jobs[i].id,
4838 jobs[i].user, jobs[i].title,
4839 jobs[i].state != IPP_JOB_PENDING ? &quot;printing&quot; : &quot;pending&quot;);
4840
4841 cupsFreeJobs(num_jobs, jobs);
4842 </PRE>
4843 <H3><A NAME="10_15_6">See Also</A></H3>
4844 <P><A HREF="#cupsFreeJobs"> <CODE>cupsFreeJobs()</CODE></A>,<A HREF="#cupsGetDests">
4845 <CODE>cupsGetDests()</CODE></A>
4846 <!-- NEW PAGE -->
4847 </P>
4848 <H2><A NAME="cupsGetOption">cupsGetOption()</A></H2>
4849 <H3><A NAME="10_16_1">Usage</A></H3>
4850 <PRE>
4851 const char *
4852 cupsGetOption(const char *name,
4853 int num_options,
4854 cups_option_t *options);
4855 </PRE>
4856 <H3><A NAME="10_16_2">Arguments</A></H3>
4857 <CENTER>
4858 <TABLE BORDER WIDTH="80%">
4859 <TR><TH>Argument</TH><TH>Description</TH></TR>
4860 <TR><TD>name</TD><TD>The name of the option.</TD></TR>
4861 <TR><TD>num_options</TD><TD>The number of options in the array.</TD></TR>
4862 <TR><TD>options</TD><TD>The options array.</TD></TR>
4863 </TABLE>
4864 </CENTER>
4865 <H3><A NAME="10_16_3">Returns</A></H3>
4866 <P>A pointer to the option values or <CODE>NULL</CODE> if the option is
4867 not defined.</P>
4868 <H3><A NAME="10_16_4">Description</A></H3>
4869 <P><CODE>cupsGetOption()</CODE> returns the first occurrence of the
4870 named option. If the option is not included in the options array then a
4871 <CODE>NULL</CODE> pointer is returned.</P>
4872 <PRE>
4873 #include &lt;cups/cups.h&gt;
4874
4875 int num_options;
4876 cups_option_t *options;
4877 const char *media;
4878
4879 ...
4880
4881 media = cupsGetOption(&quot;media&quot;, num_options, options);
4882 </PRE>
4883 <H3><A NAME="10_16_5">See Also</A></H3>
4884 <P><A HREF="#cupsAddOption"> <CODE>cupsAddOption()</CODE></A>,<A HREF="#cupsEncodeOptions">
4885 <CODE>cupsEncodeOptions()</CODE></A>,<A HREF="#cupsFreeOptions"> <CODE>
4886 cupsFreeOptions()</CODE></A>,<A HREF="#cupsMarkOptions"> <CODE>
4887 cupsMarkOptions()</CODE></A>,<A HREF="#cupsParseOptions"> <CODE>
4888 cupsParseOptions()</CODE></A>
4889 <!-- NEW PAGE -->
4890 </P>
4891 <H2><A NAME="cupsGetPassword">cupsGetPassword()</A></H2>
4892 <H3><A NAME="10_17_1">Usage</A></H3>
4893 <PRE>
4894 const char *
4895 cupsGetPassword(const char *prompt);
4896 </PRE>
4897 <H3><A NAME="10_17_2">Arguments</A></H3>
4898 <CENTER>
4899 <TABLE BORDER WIDTH="80%">
4900 <TR><TH>Argument</TH><TH>Description</TH></TR>
4901 <TR><TD>prompt</TD><TD>The prompt to display to the user.</TD></TR>
4902 </TABLE>
4903 </CENTER>
4904 <H3><A NAME="10_17_3">Returns</A></H3>
4905 <P>A pointer to the password that was entered or <CODE>NULL</CODE> if no
4906 password was entered.</P>
4907 <H3><A NAME="10_17_4">Description</A></H3>
4908 <P><CODE>cupsGetPassword()</CODE> displays the prompt string and asks
4909 the user for a password. The password text is not echoed to the user.</P>
4910 <H3><A NAME="10_17_5">Example</A></H3>
4911 <PRE>
4912 #include &lt;cups/cups.h&gt;
4913
4914 char *password;
4915
4916 ...
4917
4918 password = cupsGetPassword(&quot;Please enter a password:&quot;);
4919 </PRE>
4920 <H3><A NAME="10_17_6">See Also</A></H3>
4921 <P><A HREF="#cupsServer"> <CODE>cupsServer()</CODE></A>,<A HREF="#cupsSetPasswordCB">
4922 <CODE>cupsSetPasswordCB()</CODE></A>,<A HREF="#cupsSetServer"> <CODE>
4923 cupsSetServer()</CODE></A>,<A HREF="#cupsSetUser"> <CODE>cupsSetUser()</CODE>
4924 </A>,<A HREF="#cupsUser"> <CODE>cupsUser()</CODE></A>
4925 <!-- NEW PAGE -->
4926 </P>
4927 <H2><A NAME="cupsGetPPD">cupsGetPPD()</A></H2>
4928 <H3><A NAME="10_18_1">Usage</A></H3>
4929 <PRE>
4930 const char *
4931 cupsGetPPD(const char *printer);
4932 </PRE>
4933 <H3><A NAME="10_18_2">Arguments</A></H3>
4934 <CENTER>
4935 <TABLE BORDER WIDTH="80%">
4936 <TR><TH>Argument</TH><TH>Description</TH></TR>
4937 <TR><TD>printer</TD><TD>The name of the printer.</TD></TR>
4938 </TABLE>
4939 </CENTER>
4940 <H3><A NAME="10_18_3">Returns</A></H3>
4941 <P>The name of a temporary file containing the PPD file or <CODE>NULL</CODE>
4942 if the printer cannot be located or does not have a PPD file.</P>
4943 <H3><A NAME="10_18_4">Description</A></H3>
4944 <P><CODE>cupsGetPPD()</CODE> gets a copy of the PPD file for the named
4945 printer. The printer name can be of the form &quot;printer&quot; or
4946 &quot;printer@hostname&quot;.</P>
4947 <P>You should remove (unlink) the PPD file after you are done using it.
4948 The filename is stored in a static buffer and will be overwritten with
4949 each call to <CODE>cupsGetPPD()</CODE>.</P>
4950 <H3><A NAME="10_18_5">Example</A></H3>
4951 <PRE>
4952 #include &lt;cups/cups.h&gt;
4953
4954 char *ppd;
4955
4956 ...
4957
4958 ppd = cupsGetPPD(&quot;printer@hostname&quot;);
4959
4960 ...
4961
4962 unlink(ppd);
4963 </PRE>
4964
4965 <!-- NEW PAGE -->
4966 <H2><A NAME="cupsGetPrinters">cupsGetPrinters()</A></H2>
4967 <H3><A NAME="10_19_1">Usage</A></H3>
4968 <PRE>
4969 int
4970 cupsGetPrinters(char ***printers);
4971 </PRE>
4972 <H3><A NAME="10_19_2">Arguments</A></H3>
4973 <CENTER>
4974 <TABLE BORDER WIDTH="80%">
4975 <TR><TH>Argument</TH><TH>Description</TH></TR>
4976 <TR><TD>printers</TD><TD>Pointer to character pointer array.</TD></TR>
4977 </TABLE>
4978 </CENTER>
4979 <H3><A NAME="10_19_3">Returns</A></H3>
4980 <P>The number of printer printers available.</P>
4981 <H3><A NAME="10_19_4">Description</A></H3>
4982 <P><CODE>cupsGetPrinters()</CODE> gets a list of the available printers.
4983 The returned array should be freed using the <CODE>free()</CODE> when
4984 it is no longer needed.</P>
4985 <H3><A NAME="10_19_5">Example</A></H3>
4986 <PRE>
4987 #include &lt;cups/cups.h&gt;
4988
4989 int i;
4990 int num_printers;
4991 char **printers;
4992
4993 ...
4994
4995 num_printers = cupsGetPrinters(
4996
4997 ...
4998
4999 if (num_printers &gt; 0)
5000 {
5001 for (i = 0; i &lt; num_printers; i ++)
5002 free(printers[i]);
5003
5004 free(printers);
5005 }
5006 </PRE>
5007 <H3><A NAME="10_19_6">See Also</A></H3>
5008 <P><A HREF="#cupsGetClasses"> <CODE>cupsGetClasses()</CODE></A><A HREF="#cupsGetDefault">
5009 <CODE>cupsGetDefault()</CODE></A>
5010 <!-- NEW PAGE -->
5011 </P>
5012 <H2><A NAME="cupsLangDefault">cupsLangDefault()</A></H2>
5013 <H3><A NAME="10_20_1">Usage</A></H3>
5014 <PRE>
5015 const char *
5016 cupsLangDefault(void);
5017 </PRE>
5018 <H3><A NAME="10_20_2">Returns</A></H3>
5019 <P>A pointer to the default language structure.</P>
5020 <H3><A NAME="10_20_3">Description</A></H3>
5021 <P><CODE>cupsLangDefault()</CODE> returns a language structure for the
5022 default language. The default language is defined by the <CODE>LANG</CODE>
5023 environment variable. If the specified language cannot be located then
5024 the POSIX (English) locale is used.</P>
5025 <P>Call <CODE>cupsLangFree()</CODE> to free any memory associated with
5026 the language structure when you are done.</P>
5027 <H3><A NAME="10_20_4">Example</A></H3>
5028 <PRE>
5029 #include &lt;cups/language.h&gt;
5030
5031 <A HREF="#cups_lang_t">cups_lang_t</A> *language;
5032 ...
5033
5034 language = cupsLangDefault();
5035
5036 ...
5037
5038 cupsLangFree(language);
5039 </PRE>
5040 <H3><A NAME="10_20_5">See Also</A></H3>
5041 <P><A HREF="#cupsLangEncoding"> <CODE>cupsLangEncoding()</CODE></A>,<A HREF="#cupsLangFlush">
5042 <CODE>cupsLangFlush()</CODE></A>,<A HREF="#cupsLangFree"> <CODE>
5043 cupsLangFree()</CODE></A>,<A HREF="#cupsLangGet"> <CODE>cupsLangGet()</CODE>
5044 </A>,<A HREF="#cupsLangString"> <CODE>cupsLangString()</CODE></A>
5045 <!-- NEW PAGE -->
5046 </P>
5047 <H2><A NAME="cupsLangEncoding">cupsLangEncoding()</A></H2>
5048 <H3><A NAME="10_21_1">Usage</A></H3>
5049 <PRE>
5050 char *
5051 cupsLangEncoding(cups_lang_t *language);
5052 </PRE>
5053 <H3><A NAME="10_21_2">Arguments</A></H3>
5054 <CENTER>
5055 <TABLE BORDER WIDTH="80%">
5056 <TR><TH>Argument</TH><TH>Description</TH></TR>
5057 <TR><TD>language</TD><TD>The language structure.</TD></TR>
5058 </TABLE>
5059 </CENTER>
5060 <H3><A NAME="10_21_3">Returns</A></H3>
5061 <P>A pointer to the encoding string.</P>
5062 <H3><A NAME="10_21_4">Description</A></H3>
5063 <P><CODE>cupsLangEncoding()</CODE> returns the language encoding used
5064 for the specified language, e.g. &quot;iso-8859-1&quot;, &quot;utf-8&quot;, etc.</P>
5065 <H3><A NAME="10_21_5">Example</A></H3>
5066 <PRE>
5067 #include &lt;cups/language.h&gt;
5068
5069 <A HREF="#cups_lang_t">cups_lang_t</A> *language;
5070 char *encoding;
5071 ...
5072
5073 language = cupsLangDefault();
5074 encoding = cupsLangEncoding(language);
5075 ...
5076
5077 cupsLangFree(language);
5078 </PRE>
5079 <H3><A NAME="10_21_6">See Also</A></H3>
5080 <P><A HREF="#cupsLangDefault"> <CODE>cupsLangDefault()</CODE></A>,<A HREF="#cupsLangFlush">
5081 <CODE>cupsLangFlush()</CODE></A>,<A HREF="#cupsLangFree"> <CODE>
5082 cupsLangFree()</CODE></A>,<A HREF="#cupsLangGet"> <CODE>cupsLangGet()</CODE>
5083 </A>,<A HREF="#cupsLangString"> <CODE>cupsLangString()</CODE></A>
5084 <!-- NEW PAGE -->
5085 </P>
5086 <H2><A NAME="cupsLangFlush">cupsLangFlush()</A></H2>
5087 <H3><A NAME="10_22_1">Usage</A></H3>
5088 <PRE>
5089 void
5090 cupsLangFlush(void);
5091 </PRE>
5092 <H3><A NAME="10_22_2">Description</A></H3>
5093 <P><CODE>cupsLangFlush()</CODE> frees all language structures that have
5094 been allocated.</P>
5095 <H3><A NAME="10_22_3">Example</A></H3>
5096 <PRE>
5097 #include &lt;cups/language.h&gt;
5098
5099 ...
5100
5101 cupsLangFlush();
5102 </PRE>
5103 <H3><A NAME="10_22_4">See Also</A></H3>
5104 <P><A HREF="#cupsLangDefault"> <CODE>cupsLangDefault()</CODE></A>,<A HREF="#cupsLangEncoding">
5105 <CODE>cupsLangEncoding()</CODE></A>,<A HREF="#cupsLangFree"> <CODE>
5106 cupsLangFree()</CODE></A>,<A HREF="#cupsLangGet"> <CODE>cupsLangGet()</CODE>
5107 </A>,<A HREF="#cupsLangString"> <CODE>cupsLangString()</CODE></A>
5108 <!-- NEW PAGE -->
5109 </P>
5110 <H2><A NAME="cupsLangFree">cupsLangFree()</A></H2>
5111 <H3><A NAME="10_23_1">Usage</A></H3>
5112 <PRE>
5113 void
5114 cupsLangFree(cups_lang_t *language);
5115 </PRE>
5116 <H3><A NAME="10_23_2">Arguments</A></H3>
5117 <CENTER>
5118 <TABLE BORDER WIDTH="80%">
5119 <TR><TH>Argument</TH><TH>Description</TH></TR>
5120 <TR><TD>language</TD><TD>The language structure to free.</TD></TR>
5121 </TABLE>
5122 </CENTER>
5123 <H3><A NAME="10_23_3">Description</A></H3>
5124 <P><CODE>cupsLangFree()</CODE> frees the specified language structure.</P>
5125 <H3><A NAME="10_23_4">Example</A></H3>
5126 <PRE>
5127 #include &lt;cups/language.h&gt;
5128
5129 <A HREF="#cups_lang_t">cups_lang_t</A> *language;
5130 ...
5131
5132 cupsLangFree(language);
5133 </PRE>
5134 <H3><A NAME="10_23_5">See Also</A></H3>
5135 <P><A HREF="#cupsLangDefault"> <CODE>cupsLangDefault()</CODE></A>,<A HREF="#cupsLangEncoding">
5136 <CODE>cupsLangEncoding()</CODE></A>,<A HREF="#cupsLangFlush"> <CODE>
5137 cupsLangFlush()</CODE></A>,<A HREF="#cupsLangGet"> <CODE>cupsLangGet()</CODE>
5138 </A>,<A HREF="#cupsLangString"> <CODE>cupsLangString()</CODE></A>
5139 <!-- NEW PAGE -->
5140 </P>
5141 <H2><A NAME="cupsLangGet">cupsLangGet()</A></H2>
5142 <H3><A NAME="10_24_1">Usage</A></H3>
5143 <PRE>
5144 cups_lang_t *
5145 cupsLangGet(const char *name);
5146 </PRE>
5147 <H3><A NAME="10_24_2">Arguments</A></H3>
5148 <CENTER>
5149 <TABLE BORDER WIDTH="80%">
5150 <TR><TH>Argument</TH><TH>Description</TH></TR>
5151 <TR><TD>name</TD><TD>The name of the locale.</TD></TR>
5152 </TABLE>
5153 </CENTER>
5154 <H3><A NAME="10_24_3">Returns</A></H3>
5155 <P>A pointer to a language structure.</P>
5156 <H3><A NAME="10_24_4">Description</A></H3>
5157 <P><CODE>cupsLangGet()</CODE> returns a language structure for the
5158 specified locale. If the locale is not defined then the POSIX (English)
5159 locale is substituted.</P>
5160 <H3><A NAME="10_24_5">Example</A></H3>
5161 <PRE>
5162 #include &lt;cups/language.h&gt;
5163
5164 <A HREF="#cups_lang_t">cups_lang_t</A> *language;
5165
5166 ...
5167
5168 language = cupsLangGet(&quot;fr&quot;);
5169
5170 ...
5171
5172 cupsLangFree(language);
5173 </PRE>
5174 <H3><A NAME="10_24_6">See Also</A></H3>
5175 <P><A HREF="#cupsLangDefault"> <CODE>cupsLangDefault()</CODE></A>,<A HREF="#cupsLangEncoding">
5176 <CODE>cupsLangEncoding()</CODE></A>,<A HREF="#cupsLangFlush"> <CODE>
5177 cupsLangFlush()</CODE></A>,<A HREF="#cupsLangFree"> <CODE>cupsLangFree()</CODE>
5178 </A>,<A HREF="#cupsLangString"> <CODE>cupsLangString()</CODE></A>
5179 <!-- NEW PAGE -->
5180 </P>
5181 <H2><A NAME="cupsLangString">cupsLangString()</A></H2>
5182 <H3><A NAME="10_25_1">Usage</A></H3>
5183 <PRE>
5184 char *
5185 cupsLangString(cups_lang_t *language,
5186 int message);
5187 </PRE>
5188 <H3><A NAME="10_25_2">Arguments</A></H3>
5189 <CENTER>
5190 <TABLE BORDER WIDTH="80%">
5191 <TR><TH>Argument</TH><TH>Description</TH></TR>
5192 <TR><TD>language</TD><TD>The language to query.</TD></TR>
5193 <TR><TD>message</TD><TD>The message number.</TD></TR>
5194 </TABLE>
5195 </CENTER>
5196 <H3><A NAME="10_25_3">Returns</A></H3>
5197 <P>A pointer to the message string or <CODE>NULL</CODE> if the message
5198 is not defined.</P>
5199 <H3><A NAME="10_25_4">Description</A></H3>
5200 <P><CODE>cupsLangString()</CODE> returns a pointer to the specified
5201 message string in the specified language.</P>
5202 <H3><A NAME="10_25_5">Example</A></H3>
5203 <PRE>
5204 #include &lt;cups/language.h&gt;
5205
5206 <A HREF="#cups_lang_t">cups_lang_t</A> *language;
5207 char *s;
5208 ...
5209
5210 language = cupsLangGet(&quot;fr&quot;);
5211
5212 s = cupsLangString(language, CUPS_MSG_YES);
5213
5214 ...
5215
5216 cupsLangFree(language);
5217 </PRE>
5218 <H3><A NAME="10_25_6">See Also</A></H3>
5219 <P><A HREF="#cupsLangDefault"> <CODE>cupsLangDefault()</CODE></A>,<A HREF="#cupsLangEncoding">
5220 <CODE>cupsLangEncoding()</CODE></A>,<A HREF="#cupsLangFlush"> <CODE>
5221 cupsLangFlush()</CODE></A>,<A HREF="#cupsLangFree"> <CODE>cupsLangFree()</CODE>
5222 </A>,<A HREF="#cupsLangGet"> <CODE>cupsLangGet()</CODE></A>
5223 <!-- NEW PAGE -->
5224 </P>
5225 <H2><A NAME="cupsLastError">cupsLastError()</A></H2>
5226 <H3><A NAME="10_26_1">Usage</A></H3>
5227 <PRE>
5228 ipp_status_t
5229 cupsLastError(void);
5230 </PRE>
5231 <H3><A NAME="10_26_2">Returns</A></H3>
5232 <P>An enumeration containing the last IPP error.</P>
5233 <H3><A NAME="10_26_3">Description</A></H3>
5234 <P><CODE>cupsLastError()</CODE> returns the last IPP error that
5235 occurred. If no error occurred then it will return <CODE>IPP_OK</CODE>
5236 or <CODE>IPP_OK_CONFLICT</CODE>.</P>
5237 <H3><A NAME="10_26_4">Example</A></H3>
5238 <PRE>
5239 #include &lt;cups/cups.h&gt;
5240
5241 ipp_status_t status;
5242
5243 ...
5244
5245 status = cupsLastError();
5246 </PRE>
5247 <H3><A NAME="10_26_5">See Also</A></H3>
5248 <P><A HREF="#cupsCancelJob"> <CODE>cupsCancelJob()</CODE></A>,<A HREF="#cupsPrintFile">
5249 <CODE>cupsPrintFile()</CODE></A>
5250 <!-- NEW PAGE -->
5251 </P>
5252 <H2><A NAME="cupsMarkOptions">cupsMarkOptions()</A></H2>
5253 <H3><A NAME="10_27_1">Usage</A></H3>
5254 <PRE>
5255 int
5256 cupsMarkOptions(ppd_file_t *ppd,
5257 int num_options,
5258 cups_option_t *options);
5259 </PRE>
5260 <H3><A NAME="10_27_2">Arguments</A></H3>
5261 <CENTER>
5262 <TABLE BORDER WIDTH="80%">
5263 <TR><TH>Argument</TH><TH>Description</TH></TR>
5264 <TR><TD>ppd</TD><TD>The PPD file to mark.</TD></TR>
5265 <TR><TD>num_options</TD><TD>The number of options in the options array.</TD>
5266 </TR>
5267 <TR><TD>options</TD><TD>A pointer to the options array.</TD></TR>
5268 </TABLE>
5269 </CENTER>
5270 <H3><A NAME="10_27_3">Returns</A></H3>
5271 <P>The number of conflicts found.</P>
5272 <H3><A NAME="10_27_4">Description</A></H3>
5273 <P><CODE>cupsMarkOptions()</CODE> marks options in the PPD file. It also
5274 handles mapping of IPP option names and values to PPD option names.</P>
5275 <H3><A NAME="10_27_5">Example</A></H3>
5276 <PRE>
5277 #include &lt;cups/cups.h&gt;
5278
5279 int num_options;
5280 <A HREF="#cups_option_t">cups_option_t</A> *options;
5281 <A HREF="#ppd_file_t">ppd_file_t</A> *ppd;
5282
5283 ...
5284
5285 cupsMarkOptions(ppd, num_options, options);
5286 </PRE>
5287 <H3><A NAME="10_27_6">See Also</A></H3>
5288 <P><A HREF="#cupsAddOption"> <CODE>cupsAddOption()</CODE></A>,<A HREF="#cupsFreeOptions">
5289 <CODE>cupsFreeOptions()</CODE></A>,<A HREF="#cupsGetOption"> <CODE>
5290 cupsGetOption()</CODE></A>,<A HREF="#cupsParseOptions"> <CODE>
5291 cupsParseOptions()</CODE></A>
5292 <!-- NEW PAGE -->
5293 </P>
5294 <H2><A NAME="cupsParseOptions">cupsParseOptions()</A></H2>
5295 <H3><A NAME="10_28_1">Usage</A></H3>
5296 <PRE>
5297 int
5298 cupsParseOptions(const char *arg,
5299 int num_options,
5300 cups_option_t **options);
5301 </PRE>
5302 <H3><A NAME="10_28_2">Arguments</A></H3>
5303 <CENTER>
5304 <TABLE BORDER WIDTH="80%">
5305 <TR><TH>Argument</TH><TH>Description</TH></TR>
5306 <TR><TD>arg</TD><TD>The string containing one or more options.</TD></TR>
5307 <TR><TD>num_options</TD><TD>The number of options in the options array.</TD>
5308 </TR>
5309 <TR><TD>options</TD><TD>A pointer to the options array pointer.</TD></TR>
5310 </TABLE>
5311 </CENTER>
5312 <H3><A NAME="10_28_3">Returns</A></H3>
5313 <P>The new number of options in the array.</P>
5314 <H3><A NAME="10_28_4">Description</A></H3>
5315 <P><CODE>cupsParseOptions()</CODE> parses the specifies string for one
5316 or more options of the form &quot;name=value&quot;, &quot;name&quot;, or &quot;noname&quot;. It can
5317 be called multiple times to combine the options from several strings.</P>
5318 <H3><A NAME="10_28_5">Example</A></H3>
5319 <PRE>
5320 #include &lt;cups/cups.h&gt;
5321
5322 int num_options;
5323 <A HREF="#cups_options_t">cups_option_t</A> *options;
5324
5325 ...
5326
5327 num_options = 0;
5328 options = (cups_option_t *)0;
5329 num_options = cupsParseOptions(argv[5], num_options, &amp;options);
5330 </PRE>
5331 <H3><A NAME="10_28_6">See Also</A></H3>
5332 <P><A HREF="#cupsAddOption"> <CODE>cupsAddOption()</CODE></A>,<A HREF="#cupsFreeOptions">
5333 <CODE>cupsFreeOptions()</CODE></A>,<A HREF="#cupsGetOption"> <CODE>
5334 cupsGetOption()</CODE></A>,<A HREF="#cupsMarkOptions"> <CODE>
5335 cupsMarkOptions()</CODE></A>
5336 <!-- NEW PAGE -->
5337 </P>
5338 <H2><A NAME="cupsPrintFile">cupsPrintFile()</A></H2>
5339 <H3><A NAME="10_29_1">Usage</A></H3>
5340 <PRE>
5341 int
5342 cupsPrintFile(const char *printer,
5343 const char *filename,
5344 const char *title,
5345 int num_options,
5346 cups_option_t *options);
5347 </PRE>
5348 <H3><A NAME="10_29_2">Arguments</A></H3>
5349 <CENTER>
5350 <TABLE BORDER WIDTH="80%">
5351 <TR><TH>Argument</TH><TH>Description</TH></TR>
5352 <TR><TD>printer</TD><TD>The printer or class to print to.</TD></TR>
5353 <TR><TD>filename</TD><TD>The file to print.</TD></TR>
5354 <TR><TD>title</TD><TD>The job title.</TD></TR>
5355 <TR><TD>num_options</TD><TD>The number of options in the options array.</TD>
5356 </TR>
5357 <TR><TD>options</TD><TD>A pointer to the options array.</TD></TR>
5358 </TABLE>
5359 </CENTER>
5360 <H3><A NAME="10_29_3">Returns</A></H3>
5361 <P>The new job ID number or 0 on error.</P>
5362 <H3><A NAME="10_29_4">Description</A></H3>
5363 <P><CODE>cupsPrintFile()</CODE> sends a file to the specified printer or
5364 class for printing. If the job cannot be printed the error code can be
5365 found by calling <CODE>cupsLastError()</CODE>.</P>
5366 <H3><A NAME="10_29_5">Example</A></H3>
5367 <PRE>
5368 #include &lt;cups/cups.h&gt;
5369
5370 int num_options;
5371 <A HREF="#cups_option_t">cups_option_t</A> *options;
5372 int jobid;
5373
5374 ...
5375
5376 jobid = cupsPrintFile(&quot;printer@hostname&quot;, &quot;filename.ps&quot;, &quot;Job Title&quot;,
5377 num_options, options);
5378 </PRE>
5379 <H3><A NAME="10_29_6">See Also</A></H3>
5380 <P><A HREF="#cupsCancelJob"> <CODE>cupsCancelJob()</CODE></A>,<A HREF="#cupsLastError">
5381 <CODE>cupsLastError()</CODE></A>,<A HREF="#cupsPrintFiles"> <CODE>
5382 cupsPrintFiles()</CODE></A>
5383 <!-- NEW PAGE -->
5384 </P>
5385 <H2><A NAME="cupsPrintFiles">cupsPrintFiles()</A></H2>
5386 <H3><A NAME="10_30_1">Usage</A></H3>
5387 <PRE>
5388 int
5389 cupsPrintFiles(const char *printer,
5390 int num_files,
5391 const char **files,
5392 const char *title,
5393 int num_options,
5394 cups_option_t *options);
5395 </PRE>
5396 <H3><A NAME="10_30_2">Arguments</A></H3>
5397 <CENTER>
5398 <TABLE BORDER WIDTH="80%">
5399 <TR><TH>Argument</TH><TH>Description</TH></TR>
5400 <TR><TD>printer</TD><TD>The printer or class to print to.</TD></TR>
5401 <TR><TD>num_files</TD><TD>The number of files to print.</TD></TR>
5402 <TR><TD>files</TD><TD>The files to print.</TD></TR>
5403 <TR><TD>title</TD><TD>The job title.</TD></TR>
5404 <TR><TD>num_options</TD><TD>The number of options in the options array.</TD>
5405 </TR>
5406 <TR><TD>options</TD><TD>A pointer to the options array.</TD></TR>
5407 </TABLE>
5408 </CENTER>
5409 <H3><A NAME="10_30_3">Returns</A></H3>
5410 <P>The new job ID number or 0 on error.</P>
5411 <H3><A NAME="10_30_4">Description</A></H3>
5412 <P><CODE>cupsPrintFiles()</CODE> sends multiple files to the specified
5413 printer or class for printing. If the job cannot be printed the error
5414 code can be found by calling <CODE>cupsLastError()</CODE>.</P>
5415 <H3><A NAME="10_30_5">Example</A></H3>
5416 <PRE>
5417 #include &lt;cups/cups.h&gt;
5418
5419 int num_files;
5420 const char *files[100];
5421 int num_options;
5422 <A HREF="#cups_option_t">cups_option_t</A> *options;
5423 int jobid;
5424
5425 ...
5426
5427 jobid = cupsPrintFiles(&quot;printer@hostname&quot;, num_files, files,
5428 &quot;Job Title&quot;, num_options, options);
5429 </PRE>
5430 <H3><A NAME="10_30_6">See Also</A></H3>
5431 <P><A HREF="#cupsCancelJob"> <CODE>cupsCancelJob()</CODE></A>,<A HREF="#cupsLastError">
5432 <CODE>cupsLastError()</CODE></A>,<A HREF="#cupsPrintFile"> <CODE>
5433 cupsPrintFile()</CODE></A>
5434 <!-- NEW PAGE -->
5435 </P>
5436 <H2><A NAME="cupsRasterClose">cupsRasterClose()</A></H2>
5437 <H3><A NAME="10_31_1">Usage</A></H3>
5438 <PRE>
5439 void
5440 cupsRasterClose(cups_raster_t *ras);
5441 </PRE>
5442 <H3><A NAME="10_31_2">Arguments</A></H3>
5443 <CENTER>
5444 <TABLE BORDER WIDTH="80%">
5445 <TR><TH>Argument</TH><TH>Description</TH></TR>
5446 <TR><TD>ras</TD><TD>The raster stream to close.</TD></TR>
5447 </TABLE>
5448 </CENTER>
5449 <H3><A NAME="10_31_3">Description</A></H3>
5450 <P><CODE>cupsRasterClose()</CODE> closes the specified raster stream.</P>
5451 <H3><A NAME="10_31_4">Example</A></H3>
5452 <PRE>
5453 #include &lt;cups/raster.h&gt;
5454
5455 <A HREF="#cups_raster_t">cups_raster_t</A> *ras;
5456
5457 ...
5458
5459 cupsRasterClose(ras);
5460 </PRE>
5461 <H3><A NAME="10_31_5">See Also</A></H3>
5462 <P><A HREF="#cupsRasterOpen"> <CODE>cupsRasterOpen()</CODE></A>,<A HREF="#cupsRasterReadHeader">
5463 <CODE>cupsRasterReadHeader()</CODE></A>,<A HREF="#cupsRasterReadPixels">
5464 <CODE>cupsRasterReadPixels()</CODE></A>,<A HREF="#cupsRasterWriteHeader">
5465 <CODE>cupsRasterWriteHeader()</CODE></A>,<A HREF="#cupsRasterWritePixels">
5466 <CODE>cupsRasterWritePixels()</CODE></A>
5467 <!-- NEW PAGE -->
5468 </P>
5469 <H2><A NAME="cupsRasterOpen">cupsRasterOpen()</A></H2>
5470 <H3><A NAME="10_32_1">Usage</A></H3>
5471 <PRE>
5472 cups_raster_t *
5473 cupsRasterOpen(int fd,
5474 cups_mode_t mode);
5475 </PRE>
5476 <H3><A NAME="10_32_2">Arguments</A></H3>
5477 <CENTER>
5478 <TABLE BORDER WIDTH="80%">
5479 <TR><TH>Argument</TH><TH>Description</TH></TR>
5480 <TR><TD>fd</TD><TD>The file descriptor to use.</TD></TR>
5481 <TR><TD>mode</TD><TD>The mode to use; <CODE>CUPS_RASTER_READ</CODE> or <CODE>
5482 CUPS_RASTER_WRITE</CODE>.</TD></TR>
5483 </TABLE>
5484 </CENTER>
5485 <H3><A NAME="10_32_3">Returns</A></H3>
5486 <P>A pointer to a raster stream or <CODE>NULL</CODE> if there was an
5487 error.</P>
5488 <H3><A NAME="10_32_4">Description</A></H3>
5489 <P><CODE>cupsRasterOpen()</CODE> opens a raster stream for reading or
5490 writing.</P>
5491 <H3><A NAME="10_32_5">Example</A></H3>
5492 <PRE>
5493 #include &lt;cups/raster.h&gt;
5494
5495 <A HREF="#cups_raster_t">cups_raster_t</A> *ras;
5496
5497 ...
5498
5499 ras = cupsRasterOpen(0, CUPS_RASTER_READ);
5500 </PRE>
5501 <H3><A NAME="10_32_6">See Also</A></H3>
5502 <P><A HREF="#cupsRasterClose"> <CODE>cupsRasterClose()</CODE></A>,<A HREF="#cupsRasterReadHeader">
5503 <CODE>cupsRasterReadHeader()</CODE></A>,<A HREF="#cupsRasterReadPixels">
5504 <CODE>cupsRasterReadPixels()</CODE></A>,<A HREF="#cupsRasterWriteHeader">
5505 <CODE>cupsRasterWriteHeader()</CODE></A>,<A HREF="#cupsRasterWritePixels">
5506 <CODE>cupsRasterWritePixels()</CODE></A>
5507 <!-- NEW PAGE -->
5508 </P>
5509 <H2><A NAME="cupsRasterReadHeader">cupsRasterReadHeader()</A></H2>
5510 <H3><A NAME="10_33_1">Usage</A></H3>
5511 <PRE>
5512 unsigned
5513 cupsRasterReadHeader(cups_raster_t *ras,
5514 cups_page_header_t *header);
5515 </PRE>
5516 <H3><A NAME="10_33_2">Arguments</A></H3>
5517 <CENTER>
5518 <TABLE BORDER WIDTH="80%">
5519 <TR><TH>Argument</TH><TH>Description</TH></TR>
5520 <TR><TD>ras</TD><TD>The raster stream to read from.</TD></TR>
5521 <TR><TD>header</TD><TD>A pointer to a page header structure to read
5522 into.</TD></TR>
5523 </TABLE>
5524 </CENTER>
5525 <H3><A NAME="10_33_3">Returns</A></H3>
5526 <P>1 on success, 0 on EOF or error.</P>
5527 <H3><A NAME="10_33_4">Description</A></H3>
5528 <P><CODE>cupsRasterReadHeader()</CODE> reads a page header from the
5529 specified raster stream.</P>
5530 <H3><A NAME="10_33_5">Example</A></H3>
5531 <PRE>
5532 #include &lt;cups/raster.h&gt;
5533
5534 int line;
5535 <A HREF="#cups_raster_t">cups_raster_t</A> *ras;
5536 <A HREF="#cups_raster_header_t">cups_raster_header_t</A> header;
5537 unsigned char pixels[8192];
5538 ...
5539
5540 while (cupsRasterReadHeader(ras, &amp;header))
5541 {
5542 ...
5543
5544 for (line = 0; line &lt; header.cupsHeight; line ++)
5545 {
5546 cupsRasterReadPixels(ras, pixels, header.cupsBytesPerLine);
5547
5548 ...
5549 }
5550 }
5551 </PRE>
5552 <H3><A NAME="10_33_6">See Also</A></H3>
5553 <P><A HREF="#cupsRasterClose"> <CODE>cupsRasterClose()</CODE></A>,<A HREF="#cupsRasterOpen">
5554 <CODE>cupsRasterOpen()</CODE></A>,<A HREF="#cupsRasterReadPixels"> <CODE>
5555 cupsRasterReadPixels()</CODE></A>,<A HREF="#cupsRasterWriteHeader"> <CODE>
5556 cupsRasterWriteHeader()</CODE></A>,<A HREF="#cupsRasterWritePixels"> <CODE>
5557 cupsRasterWritePixels()</CODE></A>
5558 <!-- NEW PAGE -->
5559 </P>
5560 <H2><A NAME="cupsRasterReadPixels">cupsRasterReadPixels()</A></H2>
5561 <H3><A NAME="10_34_1">Usage</A></H3>
5562 <PRE>
5563 unsigned
5564 cupsRasterReadPixels(cups_raster_t *ras,
5565 unsigned char *pixels,
5566 unsigned length);
5567 </PRE>
5568 <H3><A NAME="10_34_2">Arguments</A></H3>
5569 <CENTER>
5570 <TABLE BORDER WIDTH="80%">
5571 <TR><TH>Argument</TH><TH>Description</TH></TR>
5572 <TR><TD>ras</TD><TD>The raster stream to read from.</TD></TR>
5573 <TR><TD>pixels</TD><TD>The pointer to a pixel buffer.</TD></TR>
5574 <TR><TD>length</TD><TD>The number of bytes of pixel data to read.</TD></TR>
5575 </TABLE>
5576 </CENTER>
5577 <H3><A NAME="10_34_3">Returns</A></H3>
5578 <P>The number of bytes read or 0 on EOF or error.</P>
5579 <H3><A NAME="10_34_4">Description</A></H3>
5580 <P><CODE>cupsRasterReadPixels()</CODE> reads pixel data from the
5581 specified raster stream.</P>
5582 <H3><A NAME="10_34_5">Example</A></H3>
5583 <PRE>
5584 #include &lt;cups/raster.h&gt;
5585
5586 int line;
5587 <A HREF="#cups_raster_t">cups_raster_t</A> *ras;
5588 <A HREF="#cups_raster_header_t">cups_raster_header_t</A> header;
5589 unsigned char pixels[8192];
5590 ...
5591
5592 while (cupsRasterReadHeader(ras, &amp;header))
5593 {
5594 ...
5595
5596 for (line = 0; line &lt; header.cupsHeight; line ++)
5597 {
5598 cupsRasterReadPixels(ras, pixels, header.cupsBytesPerLine);
5599
5600 ...
5601 }
5602 }
5603 </PRE>
5604 <H3><A NAME="10_34_6">See Also</A></H3>
5605 <P><A HREF="#cupsRasterClose"> <CODE>cupsRasterClose()</CODE></A>,<A HREF="#cupsRasterOpen">
5606 <CODE>cupsRasterOpen()</CODE></A>,<A HREF="#cupsRasterReadHeader"> <CODE>
5607 cupsRasterReadHeader()</CODE></A>,<A HREF="#cupsRasterWriteHeader"> <CODE>
5608 cupsRasterWriteHeader()</CODE></A>,<A HREF="#cupsRasterWritePixels"> <CODE>
5609 cupsRasterWritePixels()</CODE></A>
5610 <!-- NEW PAGE -->
5611 </P>
5612 <H2><A NAME="cupsRasterWriteHeader">cupsRasterWriteHeader()</A></H2>
5613 <H3><A NAME="10_35_1">Usage</A></H3>
5614 <PRE>
5615 unsigned
5616 cupsRasterWriteHeader(cups_raster_t *ras,
5617 cups_page_header_t *header);
5618 </PRE>
5619 <H3><A NAME="10_35_2">Arguments</A></H3>
5620 <CENTER>
5621 <TABLE BORDER WIDTH="80%">
5622 <TR><TH>Argument</TH><TH>Description</TH></TR>
5623 <TR><TD>ras</TD><TD>The raster stream to write to.</TD></TR>
5624 <TR><TD>header</TD><TD>A pointer to the page header to write.</TD></TR>
5625 </TABLE>
5626 </CENTER>
5627 <H3><A NAME="10_35_3">Returns</A></H3>
5628 <P>1 on success, 0 on error.</P>
5629 <H3><A NAME="10_35_4">Description</A></H3>
5630 <P><CODE>cupsRasterWriteHeader()</CODE> writes the specified page header
5631 to a raster stream.</P>
5632 <H3><A NAME="10_35_5">Example</A></H3>
5633 <PRE>
5634 #include &lt;cups/raster.h&gt;
5635
5636 int line;
5637 <A HREF="#cups_raster_t">cups_raster_t</A> *ras;
5638 <A HREF="#cups_raster_header_t">cups_raster_header_t</A> header;
5639 unsigned char pixels[8192];
5640 ...
5641
5642 cupsRasterWriteHeader(ras, &amp;header);
5643
5644 for (line = 0; line &lt; header.cupsHeight; line ++)
5645 {
5646 ...
5647
5648 cupsRasterWritePixels(ras, pixels, header.cupsBytesPerLine);
5649 }
5650 </PRE>
5651 <H3><A NAME="10_35_6">See Also</A></H3>
5652 <P><A HREF="#cupsRasterClose"> <CODE>cupsRasterClose()</CODE></A>,<A HREF="#cupsRasterOpen">
5653 <CODE>cupsRasterOpen()</CODE></A>,<A HREF="#cupsRasterReadHeader"> <CODE>
5654 cupsRasterReadHeader()</CODE></A>,<A HREF="#cupsRasterReadPixels"> <CODE>
5655 cupsRasterReadPixels()</CODE></A>,<A HREF="#cupsRasterWritePixels"> <CODE>
5656 cupsRasterWritePixels()</CODE></A>
5657 <!-- NEW PAGE -->
5658 </P>
5659 <H2><A NAME="cupsRasterWritePixels">cupsRasterWritePixels()</A></H2>
5660 <H3><A NAME="10_36_1">Usage</A></H3>
5661 <PRE>
5662 unsigned
5663 cupsRasterWritePixels(cups_raster_t *ras,
5664 unsigned char *pixels,
5665 unsigned length);
5666 </PRE>
5667 <H3><A NAME="10_36_2">Arguments</A></H3>
5668 <CENTER>
5669 <TABLE BORDER WIDTH="80%">
5670 <TR><TH>Argument</TH><TH>Description</TH></TR>
5671 <TR><TD>ras</TD><TD>The raster stream to write to.</TD></TR>
5672 <TR><TD>pixels</TD><TD>The pixel data to write.</TD></TR>
5673 <TR><TD>length</TD><TD>The number of bytes to write.</TD></TR>
5674 </TABLE>
5675 </CENTER>
5676 <H3><A NAME="10_36_3">Returns</A></H3>
5677 <P>The number of bytes written.</P>
5678 <H3><A NAME="10_36_4">Description</A></H3>
5679 <P><CODE>cupsRasterWritePixels()</CODE> writes the specified pixel data
5680 to a raster stream.</P>
5681 <H3><A NAME="10_36_5">Example</A></H3>
5682 <PRE>
5683 #include &lt;cups/raster.h&gt;
5684
5685 int line;
5686 <A HREF="#cups_raster_t">cups_raster_t</A> *ras;
5687 <A HREF="#cups_raster_header_t">cups_raster_header_t</A> header;
5688 unsigned char pixels[8192];
5689 ...
5690
5691 cupsRasterWriteHeader(ras, &amp;header);
5692
5693 for (line = 0; line &lt; header.cupsHeight; line ++)
5694 {
5695 ...
5696
5697 cupsRasterWritePixels(ras, pixels, header.cupsBytesPerLine);
5698 }
5699 </PRE>
5700 <H3><A NAME="10_36_6">See Also</A></H3>
5701 <P><A HREF="#cupsRasterClose"> <CODE>cupsRasterClose()</CODE></A>,<A HREF="#cupsRasterOpen">
5702 <CODE>cupsRasterOpen()</CODE></A>,<A HREF="#cupsRasterReadHeader"> <CODE>
5703 cupsRasterReadHeader()</CODE></A>,<A HREF="#cupsRasterReadPixels"> <CODE>
5704 cupsRasterReadPixels()</CODE></A>,<A HREF="#cupsRasterWriteHeader"> <CODE>
5705 cupsRasterWriteHeader()</CODE></A>
5706 <!-- NEW PAGE -->
5707 </P>
5708 <H2><A NAME="cupsServer">cupsServer()</A></H2>
5709 <H3><A NAME="10_37_1">Usage</A></H3>
5710 <PRE>
5711 const char *
5712 cupsServer(void);
5713 </PRE>
5714 <H3><A NAME="10_37_2">Returns</A></H3>
5715 <P>A pointer to the default server name.</P>
5716 <H3><A NAME="10_37_3">Description</A></H3>
5717 <P><CODE>cupsServer()</CODE> returns a pointer to the default server
5718 name. The server name is stored in a static location and will be
5719 overwritten with every call to <CODE>cupsServer()</CODE>.</P>
5720 <P>The default server is determined from the following locations:</P>
5721 <OL>
5722 <LI>The <CODE>CUPS_SERVER</CODE> environment variable,</LI>
5723 <LI>The <CODE>ServerName</CODE> directive in the<VAR> client.conf</VAR>
5724 file,</LI>
5725 <LI>The default host, &quot;localhost&quot;.</LI>
5726 </OL>
5727 <H3><A NAME="10_37_4">Example</A></H3>
5728 <PRE>
5729 #include &lt;cups/cups.h&gt;
5730
5731 const char *server;
5732
5733 server = cupsServer();
5734 </PRE>
5735 <H3><A NAME="10_37_5">See Also</A></H3>
5736 <P><A HREF="#cupsGetPassword"> <CODE>cupsGetPassword()</CODE></A>,<A HREF="#cupsSetPasswordCB">
5737 <CODE>cupsSetPasswordCB()</CODE></A>,<A HREF="#cupsSetServer"> <CODE>
5738 cupsSetServer()</CODE></A>,<A HREF="#cupsSetUser"> <CODE>cupsSetUser()</CODE>
5739 </A>,<A HREF="#cupsUser"> <CODE>cupsUser()</CODE></A>
5740 <!-- NEW PAGE -->
5741 </P>
5742 <H2><A NAME="cupsSetDests">cupsSetDests()</A></H2>
5743 <H3><A NAME="10_38_1">Usage</A></H3>
5744 <PRE>
5745 void
5746 cupsSetDests(int num_dests,
5747 cups_dest_t *dests);
5748 </PRE>
5749 <H3><A NAME="10_38_2">Arguments</A></H3>
5750 <CENTER>
5751 <TABLE BORDER WIDTH="80%">
5752 <TR><TH>Argument</TH><TH>Description</TH></TR>
5753 <TR><TD>num_dests</TD><TD>Number of destinations.</TD></TR>
5754 <TR><TD>dests</TD><TD>Array of destinations.</TD></TR>
5755 </TABLE>
5756 </CENTER>
5757 <H3><A NAME="10_38_3">Description</A></H3>
5758 <P><CODE>cupsSetDests()</CODE> saves the destination array to disk. If
5759 the current UID is 0, the destinations are saved in the<VAR>
5760 /etc/cups/lpoptions</VAR> file, otherwise they are saved in the<VAR>
5761 ~/.lpoptions</VAR> file. This function is typically used to save the
5762 default options and instances that are set by the user.</P>
5763 <H3><A NAME="10_38_4">Example</A></H3>
5764 <PRE>
5765 #include &lt;cups/cups.h&gt;
5766
5767 int num_dests;
5768 <A HREF="#cups_dest_t">cups_dest_t</A> *dests;
5769
5770 ...
5771
5772 cupsSetDests(num_dests, dests);
5773 </PRE>
5774 <H3><A NAME="10_38_5">See Also</A></H3>
5775 <P><A HREF="#cupsGetDests"> <CODE>cupsGetDests()</CODE></A>
5776 <!-- NEW PAGE -->
5777 </P>
5778 <H2><A NAME="cupsSetEncryption">cupsSetEncryption()</A></H2>
5779 <H3><A NAME="10_39_1">Usage</A></H3>
5780 <PRE>
5781 void
5782 cupsSetEncryption(http_encryption_t encryption);
5783 </PRE>
5784 <H3><A NAME="10_39_2">Arguments</A></H3>
5785 <CENTER>
5786 <TABLE BORDER WIDTH="80%">
5787 <TR><TH>Argument</TH><TH>Description</TH></TR>
5788 <TR><TD>encryption</TD><TD>The type of encryption to use.</TD></TR>
5789 </TABLE>
5790 </CENTER>
5791 <H3><A NAME="10_39_3">Description</A></H3>
5792 <P><CODE>cupsSetEncryption()</CODE> sets the default type of encryption
5793 to use when connecting with the print server.</P>
5794 <H3><A NAME="10_39_4">Example</A></H3>
5795 <PRE>
5796 #include &lt;cups/cups.h&gt;
5797
5798 cupsSetEncryption(HTTP_ENCRYPT_REQUIRED);
5799 </PRE>
5800 <H3><A NAME="10_39_5">See Also</A></H3>
5801 <P><A HREF="#cupsEncryption"> <CODE>cupsEncryption()</CODE></A>
5802 <!-- NEW PAGE -->
5803 </P>
5804 <H2><A NAME="cupsSetPasswordCB">cupsSetPasswordCB()</A></H2>
5805 <H3><A NAME="10_40_1">Usage</A></H3>
5806 <PRE>
5807 void
5808 cupsSetPasswordCB(const char *(*cb)(const char *prompt));
5809 </PRE>
5810 <H3><A NAME="10_40_2">Arguments</A></H3>
5811 <CENTER>
5812 <TABLE BORDER WIDTH="80%">
5813 <TR><TH>Argument</TH><TH>Description</TH></TR>
5814 <TR><TD>cb</TD><TD>The password callback function.</TD></TR>
5815 </TABLE>
5816 </CENTER>
5817 <H3><A NAME="10_40_3">Description</A></H3>
5818 <P><CODE>cupsSetPasswordCB()</CODE> sets the callback function to use
5819 when asking the user for a password. The callback function must accept
5820 a single character string pointer (the prompt string) and return <CODE>
5821 NULL</CODE> if the user did not enter a password string or a pointer to
5822 the password string otherwise.</P>
5823 <H3><A NAME="10_40_4">Example</A></H3>
5824 <PRE>
5825 #include &lt;cups/cups.h&gt;
5826
5827 const char *
5828 my_password_cb(const char *prompt)
5829 {
5830 return (getpass(prompt));
5831 }
5832
5833 ...
5834
5835 char *password;
5836
5837 ...
5838
5839 cupsSetPasswordCB(my_password_cb);
5840 password = cupsGetPassword(&quot;Please enter a password:&quot;);
5841 </PRE>
5842 <H3><A NAME="10_40_5">See Also</A></H3>
5843 <P><A HREF="#cupsServer"> <CODE>cupsServer()</CODE></A>,<A HREF="#cupsSetServer">
5844 <CODE>cupsSetServer()</CODE></A>,<A HREF="#cupsSetUser"> <CODE>
5845 cupsSetUser()</CODE></A>,<A HREF="#cupsUser"> <CODE>cupsUser()</CODE></A>
5846 <!-- NEW PAGE -->
5847
5848 </P>
5849 <H2><A NAME="cupsSetServer">cupsSetServer()</A></H2>
5850 <H3><A NAME="10_41_1">Usage</A></H3>
5851 <PRE>
5852 void
5853 cupsSetServer(const char *server);
5854 </PRE>
5855 <H3><A NAME="10_41_2">Arguments</A></H3>
5856 <CENTER>
5857 <TABLE BORDER WIDTH="80%">
5858 <TR><TH>Argument</TH><TH>Description</TH></TR>
5859 <TR><TD>server</TD><TD>The default server to use.</TD></TR>
5860 </TABLE>
5861 </CENTER>
5862 <H3><A NAME="10_41_3">Description</A></H3>
5863 <P><CODE>cupsSetServer()</CODE> sets the default server to use for the
5864 CUPS API. If the <CODE>server</CODE> argument is <CODE>NULL</CODE>, the
5865 default server is used.</P>
5866 <H3><A NAME="10_41_4">Example</A></H3>
5867 <PRE>
5868 #include &lt;cups/cups.h&gt;
5869
5870 cupsSetServer(&quot;foo.bar.com&quot;);
5871 </PRE>
5872 <H3><A NAME="10_41_5">See Also</A></H3>
5873 <P><A HREF="#cupsServer"> <CODE>cupsServer()</CODE></A>,<A HREF="#cupsSetPasswordCB">
5874 <CODE>cupsSetPasswordCB()</CODE></A>,<A HREF="#cupsSetUser"> <CODE>
5875 cupsSetUser()</CODE></A>,<A HREF="#cupsUser"> <CODE>cupsUser()</CODE></A>
5876 <!-- NEW PAGE -->
5877
5878 </P>
5879 <H2><A NAME="cupsSetUser">cupsSetUser()</A></H2>
5880 <H3><A NAME="10_42_1">Usage</A></H3>
5881 <PRE>
5882 void
5883 cupsSetUser(const char *user);
5884 </PRE>
5885 <H3><A NAME="10_42_2">Arguments</A></H3>
5886 <CENTER>
5887 <TABLE BORDER WIDTH="80%">
5888 <TR><TH>Argument</TH><TH>Description</TH></TR>
5889 <TR><TD>user</TD><TD>The user name string to use.</TD></TR>
5890 </TABLE>
5891 </CENTER>
5892 <H3><A NAME="10_42_3">Description</A></H3>
5893 <P><CODE>cupsSetUser()</CODE> sets the default user name for
5894 authentication. If the <CODE>user</CODE> argument is <CODE>NULL</CODE>
5895 then the current login user is used.</P>
5896 <H3><A NAME="10_42_4">Example</A></H3>
5897 <PRE>
5898 #include &lt;cups/cups.h&gt;
5899
5900 ...
5901
5902 cupsSetUser(&quot;root&quot;);
5903 </PRE>
5904 <H3><A NAME="10_42_5">See Also</A></H3>
5905 <P><A HREF="#cupsServer"> <CODE>cupsServer()</CODE></A>,<A HREF="#cupsSetPasswordCB">
5906 <CODE>cupsSetPasswordCB()</CODE></A>,<A HREF="#cupsSetServer"> <CODE>
5907 cupsSetServer()</CODE></A>,<A HREF="#cupsUser"> <CODE>cupsUser()</CODE></A>
5908 <!-- NEW PAGE -->
5909
5910 </P>
5911 <H2><A NAME="cupsTempFd">cupsTempFd()</A></H2>
5912 <H3><A NAME="10_43_1">Usage</A></H3>
5913 <PRE>
5914 int
5915 cupsTempFd(char *filename,
5916 int length);
5917 </PRE>
5918 <H3><A NAME="10_43_2">Arguments</A></H3>
5919 <CENTER>
5920 <TABLE BORDER WIDTH="80%">
5921 <TR><TH>Argument</TH><TH>Description</TH></TR>
5922 <TR><TD>filename</TD><TD>The character string to hold the temporary
5923 filename.</TD></TR>
5924 <TR><TD>length</TD><TD>The size of the filename string in bytes.</TD></TR>
5925 </TABLE>
5926 </CENTER>
5927 <H3><A NAME="10_43_3">Returns</A></H3>
5928 <P>A file descriptor open for reading and writing.</P>
5929 <H3><A NAME="10_43_4">Description</A></H3>
5930 <P><CODE>cupsTempFd()</CODE> create a temporary filename in the<VAR>
5931 /var/tmp</VAR> directory or the directory specified by the <CODE>TMPDIR</CODE>
5932 environment variable.</P>
5933 <H3><A NAME="10_43_5">Example</A></H3>
5934 <PRE>
5935 #include &lt;cups/cups.h&gt;
5936
5937 int fd;
5938 char filename[256];
5939
5940 fd = cupsTempFd(filename, sizeof(filename));
5941 </PRE>
5942 <H3><A NAME="10_43_6">See Also</A></H3>
5943 <P><A HREF="#cupsTempFile"> <CODE>cupsTempFile()</CODE></A>
5944 <!-- NEW PAGE -->
5945 </P>
5946 <H2><A NAME="cupsTempFile">cupsTempFile()</A></H2>
5947 <H3><A NAME="10_44_1">Usage</A></H3>
5948 <PRE>
5949 char *
5950 cupsTempFile(char *filename,
5951 int length);
5952 </PRE>
5953 <H3><A NAME="10_44_2">Arguments</A></H3>
5954 <CENTER>
5955 <TABLE BORDER WIDTH="80%">
5956 <TR><TH>Argument</TH><TH>Description</TH></TR>
5957 <TR><TD>filename</TD><TD>The character string to hold the temporary
5958 filename.</TD></TR>
5959 <TR><TD>length</TD><TD>The size of the filename string in bytes.</TD></TR>
5960 </TABLE>
5961 </CENTER>
5962 <H3><A NAME="10_44_3">Returns</A></H3>
5963 <P>A pointer to <CODE>filename</CODE>.</P>
5964 <H3><A NAME="10_44_4">Description</A></H3>
5965 <P><CODE>cupsTempFile()</CODE> creates a temporary filename in the<VAR>
5966 /var/tmp</VAR> directory or the directory specified by the <CODE>TMPDIR</CODE>
5967 environment variable.</P>
5968 <H3><A NAME="10_44_5">Example</A></H3>
5969 <PRE>
5970 #include &lt;cups/cups.h&gt;
5971
5972 char filename[256];
5973
5974 cupsTempFile(filename, sizeof(filename));
5975 </PRE>
5976 <H3><A NAME="10_44_6">See Also</A></H3>
5977 <P><A HREF="#cupsTempFd"> <CODE>cupsTempFd()</CODE></A>
5978 <!-- NEW PAGE -->
5979 </P>
5980 <H2><A NAME="cupsUser">cupsUser()</A></H2>
5981 <H3><A NAME="10_45_1">Usage</A></H3>
5982 <PRE>
5983 const char *
5984 cupsUser(void);
5985 </PRE>
5986 <H3><A NAME="10_45_2">Returns</A></H3>
5987 <P>A pointer to the current username or <CODE>NULL</CODE> if the user ID
5988 is undefined.</P>
5989 <H3><A NAME="10_45_3">Description</A></H3>
5990 <P><CODE>cupsUser()</CODE> returns the name associated with the current
5991 user ID as reported by the <CODE>getuid()</CODE> system call.</P>
5992 <H3><A NAME="10_45_4">Example</A></H3>
5993 <PRE>
5994 #include &lt;cups/cups.h&gt;
5995
5996 const char *user;
5997
5998 user = cupsUser();
5999 </PRE>
6000 <H3><A NAME="10_45_5">See Also</A></H3>
6001 <P><A HREF="#cupsGetPassword"> <CODE>cupsGetPassword()</CODE></A>,<A HREF="#cupsServer">
6002 <CODE>cupsServer()</CODE></A>
6003 <!-- NEW PAGE -->
6004 </P>
6005 <H2><A NAME="httpBlocking">httpBlocking()</A></H2>
6006 <H3><A NAME="10_46_1">Usage</A></H3>
6007 <PRE>
6008 void
6009 httpBlocking(http_t *http,
6010 int blocking)
6011 </PRE>
6012 <H3><A NAME="10_46_2">Arguments</A></H3>
6013 <CENTER>
6014 <TABLE BORDER WIDTH="80%">
6015 <TR><TH>Argument</TH><TH>Description</TH></TR>
6016 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6017 <TR><TD>blocking</TD><TD>0 if the connection should be non-blocking, 1
6018 if it should be blocking</TD></TR>
6019 </TABLE>
6020 </CENTER>
6021 <H3><A NAME="10_46_3">Description</A></H3>
6022 <P>The <CODE>httpBlocking()</CODE> function sets the blocking mode for
6023 the HTTP connection. By default HTTP connections will block (stop) the
6024 client program until data is available or can be sent to the server.</P>
6025 <H3><A NAME="10_46_4">Example</A></H3>
6026 <PRE>
6027 #include &lt;cups/http.h&gt;
6028
6029 http_t *http;
6030
6031 http = httpConnect(&quot;server&quot;, port);
6032 httpBlocking(http, 0);
6033 </PRE>
6034 <H3><A NAME="10_46_5">See Also</A></H3>
6035 <A HREF="#httpCheck"> <CODE>httpCheck()</CODE></A>,<A HREF="#httpConnect">
6036 <CODE>httpConnect()</CODE></A>
6037 <!-- NEW PAGE -->
6038
6039 <H2><A NAME="httpCheck">httpCheck()</A></H2>
6040 <H3><A NAME="10_47_1">Usage</A></H3>
6041 <PRE>
6042 int
6043 httpCheck(http_t *http);
6044 </PRE>
6045 <H3><A NAME="10_47_2">Arguments</A></H3>
6046 <CENTER>
6047 <TABLE BORDER WIDTH="80%">
6048 <TR><TH>Argument</TH><TH>Description</TH></TR>
6049 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6050 </TABLE>
6051 </CENTER>
6052 <H3><A NAME="10_47_3">Returns</A></H3>
6053 <P>0 if there is no data pending, 1 otherwise.</P>
6054 <H3><A NAME="10_47_4">Description</A></H3>
6055 <P>The <CODE>httpCheck()</CODE> function checks to see if there is any
6056 data pending on an HTTP connection.</P>
6057 <H3><A NAME="10_47_5">Example</A></H3>
6058 <PRE>
6059 #include &lt;cups/http.h&gt;
6060
6061 http_t *http;
6062
6063 if (httpCheck(http))
6064 {
6065 ... do something ...
6066 }
6067 </PRE>
6068 <H3><A NAME="10_47_6">See Also</A></H3>
6069 <A HREF="#httpBlocking"> <CODE>httpBlocking()</CODE></A>,<A HREF="#httpConnect">
6070 <CODE>httpConnect()</CODE></A>,<A HREF="#httpGets"> <CODE>httpGets()</CODE>
6071 </A>,<A HREF="#httpRead"> <CODE>httpRead()</CODE></A>
6072 <!-- NEW PAGE -->
6073
6074 <H2><A NAME="httpClearFields">httpClearFields()</A></H2>
6075 <H3><A NAME="10_48_1">Usage</A></H3>
6076 <PRE>
6077 void
6078 httpClearFields(http_t *http)
6079 </PRE>
6080 <H3><A NAME="10_48_2">Arguments</A></H3>
6081 <CENTER>
6082 <TABLE BORDER WIDTH="80%">
6083 <TR><TH>Argument</TH><TH>Description</TH></TR>
6084 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6085 </TABLE>
6086 </CENTER>
6087 <H3><A NAME="10_48_3">Description</A></H3>
6088 <P>The <CODE>httpClearFields()</CODE> function clears all HTTP request
6089 fields for the HTTP connection.</P>
6090 <H3><A NAME="10_48_4">Example</A></H3>
6091 <PRE>
6092 #include &lt;cups/http.h&gt;
6093
6094 http_t *http;
6095
6096 httpClearFields(http);
6097 </PRE>
6098 <H3><A NAME="10_48_5">See Also</A></H3>
6099 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpGetField">
6100 <CODE>httpGetField()</CODE></A>,<A HREF="#httpSetField"> <CODE>
6101 httpSetField()</CODE></A>
6102 <!-- NEW PAGE -->
6103
6104 <H2><A NAME="httpClose">httpClose()</A></H2>
6105 <H3><A NAME="10_49_1">Usage</A></H3>
6106 <PRE>
6107 void
6108 httpClose(http_t *http);
6109 </PRE>
6110 <H3><A NAME="10_49_2">Arguments</A></H3>
6111 <CENTER>
6112 <TABLE BORDER WIDTH="80%">
6113 <TR><TH>Argument</TH><TH>Description</TH></TR>
6114 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6115 </TABLE>
6116 </CENTER>
6117 <H3><A NAME="10_49_3">Description</A></H3>
6118 <P>The <CODE>httpClose()</CODE> function closes an active HTTP
6119 connection.</P>
6120 <H3><A NAME="10_49_4">Example</A></H3>
6121 <PRE>
6122 #include &lt;cups/http.h&gt;
6123
6124 http_t *http;
6125
6126 httpClose(http);
6127 </PRE>
6128 <H3><A NAME="10_49_5">See Also</A></H3>
6129 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>
6130 <!-- NEW PAGE -->
6131
6132 <H2><A NAME="httpConnect">httpConnect()</A></H2>
6133 <H3><A NAME="10_50_1">Usage</A></H3>
6134 <PRE>
6135 http_t *
6136 httpConnect(const char *hostname,
6137 int port);
6138 </PRE>
6139 <H3><A NAME="10_50_2">Arguments</A></H3>
6140 <CENTER>
6141 <TABLE BORDER WIDTH="80%">
6142 <TR><TH>Argument</TH><TH>Description</TH></TR>
6143 <TR><TD>hostname</TD><TD>The name or IP address of the server to connect
6144 to</TD></TR>
6145 <TR><TD>port</TD><TD>The port number to use</TD></TR>
6146 </TABLE>
6147 </CENTER>
6148 <H3><A NAME="10_50_3">Returns</A></H3>
6149 <P>A pointer to a HTTP connection structure or NULL if the connection
6150 could not be made.</P>
6151 <H3><A NAME="10_50_4">Description</A></H3>
6152 <P>The <CODE>httpConnect()</CODE> function opens a HTTP connection to
6153 the specified server and port.</P>
6154 <H3><A NAME="10_50_5">Example</A></H3>
6155 <PRE>
6156 #include &lt;cups/http.h&gt;
6157
6158 <A HREF="#http_t">http_t</A> *http;
6159
6160 http = httpConnect(cupsServer(), ippPort());
6161 </PRE>
6162 <H3><A NAME="10_50_6">See Also</A></H3>
6163 <A HREF="#httpClose"> <CODE>httpClose()</CODE></A>,<A HREF="#httpConnectEncrypt">
6164 <CODE>httpConnectEncrypt()</CODE></A>,<A HREF="#httpGet"> <CODE>
6165 httpGet()</CODE></A>,<A HREF="#httpGets"> <CODE>httpGets()</CODE></A>,<A HREF="#httpPost">
6166 <CODE>httpPost()</CODE></A>,<A HREF="#httpRead"> <CODE>httpRead()</CODE>
6167 </A>,<A HREF="#httpWrite"> <CODE>httpWrite()</CODE></A>
6168 <!-- NEW PAGE -->
6169
6170 <H2><A NAME="httpConnectEncrypt">httpConnectEncrypt()</A></H2>
6171 <H3><A NAME="10_51_1">Usage</A></H3>
6172 <PRE>
6173 http_t *
6174 httpConnectEncrypt(const char *hostname,
6175 int port,
6176 http_encryption_t encryption);
6177 </PRE>
6178 <H3><A NAME="10_51_2">Arguments</A></H3>
6179 <CENTER>
6180 <TABLE BORDER WIDTH="80%">
6181 <TR><TH>Argument</TH><TH>Description</TH></TR>
6182 <TR><TD>hostname</TD><TD>The name or IP address of the server to connect
6183 to</TD></TR>
6184 <TR><TD>port</TD><TD>The port number to use</TD></TR>
6185 <TR><TD>encryption</TD><TD>The level of encryption to use</TD></TR>
6186 </TABLE>
6187 </CENTER>
6188 <H3><A NAME="10_51_3">Returns</A></H3>
6189 <P>A pointer to a HTTP connection structure or NULL if the connection
6190 could not be made.</P>
6191 <H3><A NAME="10_51_4">Description</A></H3>
6192 <P>The <CODE>httpConnectEncrypt()</CODE> function opens a HTTP
6193 connection to the specified server, port, and encryption.</P>
6194 <H3><A NAME="10_51_5">Example</A></H3>
6195 <PRE>
6196 #include &lt;cups/http.h&gt;
6197
6198 <A HREF="#http_t">http_t</A> *http;
6199
6200 http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
6201 </PRE>
6202 <H3><A NAME="10_51_6">See Also</A></H3>
6203 <A HREF="#httpClose"> <CODE>httpClose()</CODE></A>,<A HREF="#httpConnect">
6204 <CODE>httpConnect()</CODE></A>,<A HREF="#httpGet"> <CODE>httpGet()</CODE>
6205 </A>,<A HREF="#httpGets"> <CODE>httpGets()</CODE></A>,<A HREF="#httpPost">
6206 <CODE>httpPost()</CODE></A>,<A HREF="#httpRead"> <CODE>httpRead()</CODE>
6207 </A>,<A HREF="#httpWrite"> <CODE>httpWrite()</CODE></A>
6208 <!-- NEW PAGE -->
6209
6210 <H2><A NAME="httpDecode64">httpDecode64()</A></H2>
6211 <H3><A NAME="10_52_1">Usage</A></H3>
6212 <PRE>
6213 char *
6214 httpDecode64(char *out,
6215 const char *in);
6216 </PRE>
6217 <H3><A NAME="10_52_2">Arguments</A></H3>
6218 <CENTER>
6219 <TABLE BORDER WIDTH="80%">
6220 <TR><TH>Argument</TH><TH>Description</TH></TR>
6221 <TR><TD>out</TD><TD>The output string</TD></TR>
6222 <TR><TD>in</TD><TD>The input string</TD></TR>
6223 </TABLE>
6224 </CENTER>
6225 <H3><A NAME="10_52_3">Returns</A></H3>
6226 <P>A pointer to the decoded string.</P>
6227 <H3><A NAME="10_52_4">Description</A></H3>
6228 <P>The <CODE>httpDecode64()</CODE> function decodes a base-64 encoded
6229 string to the original string.</P>
6230 <H3><A NAME="10_52_5">Example</A></H3>
6231 <PRE>
6232 #include &lt;cups/http.h&gt;
6233
6234 char encoded_string[255];
6235 char original_string[255];
6236
6237 httpDecode64(original_string, encoded_string);
6238 </PRE>
6239 <H3><A NAME="10_52_6">See Also</A></H3>
6240 <A HREF="#httpEncode64"> <CODE>httpEncode64()</CODE></A>
6241 <!-- NEW PAGE -->
6242
6243 <H2><A NAME="httpDelete">httpDelete()</A></H2>
6244 <H3><A NAME="10_53_1">Usage</A></H3>
6245 <PRE>
6246 int
6247 httpDelete(http_t *http,
6248 const char *uri);
6249 </PRE>
6250 <H3><A NAME="10_53_2">Arguments</A></H3>
6251 <CENTER>
6252 <TABLE BORDER WIDTH="80%">
6253 <TR><TH>Argument</TH><TH>Description</TH></TR>
6254 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6255 <TR><TD>uri</TD><TD>The URI to delete</TD></TR>
6256 </TABLE>
6257 </CENTER>
6258 <H3><A NAME="10_53_3">Returns</A></H3>
6259 <P>0 on success, non-zero on failure.</P>
6260 <H3><A NAME="10_53_4">Description</A></H3>
6261 <P>The <CODE>httpDelete()</CODE> function sends a HTTP DELETE request to
6262 the server.</P>
6263 <H3><A NAME="10_53_5">Example</A></H3>
6264 <PRE>
6265 #include &lt;cups/http.h&gt;
6266
6267 http_t *http;
6268
6269 httpDelete(http, &quot;/some/uri&quot;);
6270 </PRE>
6271 <H3><A NAME="10_53_6">See Also</A></H3>
6272 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpSetField">
6273 <CODE>httpSetField()</CODE></A>,<A HREF="#httpUpdate"> <CODE>
6274 httpUpdate()</CODE></A>
6275 <!-- NEW PAGE -->
6276
6277 <H2><A NAME="httpEncode64">httpEncode64()</A></H2>
6278 <H3><A NAME="10_54_1">Usage</A></H3>
6279 <PRE>
6280 char *
6281 httpEncode64(char *out,
6282 const char *in);
6283 </PRE>
6284 <H3><A NAME="10_54_2">Arguments</A></H3>
6285 <CENTER>
6286 <TABLE BORDER WIDTH="80%">
6287 <TR><TH>Argument</TH><TH>Description</TH></TR>
6288 <TR><TD>out</TD><TD>The output string</TD></TR>
6289 <TR><TD>in</TD><TD>The input string</TD></TR>
6290 </TABLE>
6291 </CENTER>
6292 <H3><A NAME="10_54_3">Returns</A></H3>
6293 <P>A pointer to the encoded string.</P>
6294 <H3><A NAME="10_54_4">Description</A></H3>
6295 <P>The <CODE>httpEncode64()</CODE> function decodes a base-64 encoded
6296 string to the original string.</P>
6297 <H3><A NAME="10_54_5">Example</A></H3>
6298 <PRE>
6299 #include &lt;cups/http.h&gt;
6300
6301 char encoded_string[255];
6302 char original_string[255];
6303
6304 httpEncode64(encoded_string, original_string);
6305 </PRE>
6306 <H3><A NAME="10_54_6">See Also</A></H3>
6307 <A HREF="#httpDecode64"> <CODE>httpDecode64()</CODE></A>
6308 <!-- NEW PAGE -->
6309
6310 <H2><A NAME="httpEncryption">httpEncryption()</A></H2>
6311 <H3><A NAME="10_55_1">Usage</A></H3>
6312 <PRE>
6313 int
6314 httpEncryption(http_t *http,
6315 http_encryption_t encryption);
6316 </PRE>
6317 <H3><A NAME="10_55_2">Arguments</A></H3>
6318 <CENTER>
6319 <TABLE BORDER WIDTH="80%">
6320 <TR><TH>Argument</TH><TH>Description</TH></TR>
6321 <TR><TD>http</TD><TD>The HTTP connection.</TD></TR>
6322 <TR><TD>encryption</TD><TD>The desired level of encryption.</TD></TR>
6323 </TABLE>
6324 </CENTER>
6325 <H3><A NAME="10_55_3">Returns</A></H3>
6326 <P>0 on success, -1 on error.</P>
6327 <H3><A NAME="10_55_4">Description</A></H3>
6328 <P><CODE>httpEncryption()</CODE> sets the encryption level for the HTTP
6329 connection.</P>
6330 <H3><A NAME="10_55_5">Example</A></H3>
6331 <PRE>
6332 #include &lt;cups/http.h&gt;
6333
6334 <A HREF="#http_t">http_t</A> *http;
6335
6336 ...
6337
6338 httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
6339 </PRE>
6340 <H3><A NAME="10_55_6">See Also</A></H3>
6341 <P><A HREF="#httpConnectEncrypt"> <CODE>httpConnectEncrypt()</CODE></A>
6342 <!-- NEW PAGE -->
6343 </P>
6344 <H2><A NAME="httpError">httpError()</A></H2>
6345 <H3><A NAME="10_56_1">Usage</A></H3>
6346 <PRE>
6347 int
6348 httpError(http_t *http);
6349 </PRE>
6350 <H3><A NAME="10_56_2">Arguments</A></H3>
6351 <CENTER>
6352 <TABLE BORDER WIDTH="80%">
6353 <TR><TH>Argument</TH><TH>Description</TH></TR>
6354 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6355 </TABLE>
6356 </CENTER>
6357 <H3><A NAME="10_56_3">Returns</A></H3>
6358 <P>The last error that occurred or 0 if no error has occurred.</P>
6359 <H3><A NAME="10_56_4">Description</A></H3>
6360 <P>The <CODE>httpError()</CODE> function returns the last error that
6361 occurred on the HTTP connection.</P>
6362 <H3><A NAME="10_56_5">Example</A></H3>
6363 <PRE>
6364 #include &lt;cups/http.h&gt;
6365
6366 http_t *http;
6367
6368 if (httpError(http))
6369 {
6370 ... show an error message ...
6371 }
6372 </PRE>
6373 <H3><A NAME="10_56_6">See Also</A></H3>
6374 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>
6375 <!-- NEW PAGE -->
6376
6377 <H2><A NAME="httpFlush">httpFlush()</A></H2>
6378 <H3><A NAME="10_57_1">Usage</A></H3>
6379 <PRE>
6380 void
6381 httpFlush(http_t *http);
6382 </PRE>
6383 <H3><A NAME="10_57_2">Arguments</A></H3>
6384 <CENTER>
6385 <TABLE BORDER WIDTH="80%">
6386 <TR><TH>Argument</TH><TH>Description</TH></TR>
6387 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6388 </TABLE>
6389 </CENTER>
6390 <H3><A NAME="10_57_3">Description</A></H3>
6391 <P>The <CODE>httpFlush()</CODE> function flushes any remaining data left
6392 from a GET or POST operation.</P>
6393 <H3><A NAME="10_57_4">Example</A></H3>
6394 <PRE>
6395 #include &lt;cups/http.h&gt;
6396
6397 http_t *http;
6398
6399 httpFlush(http);
6400 </PRE>
6401 <H3><A NAME="10_57_5">See Also</A></H3>
6402 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,
6403 <!-- NEW PAGE -->
6404
6405 <H2><A NAME="httpGet">httpGet()</A></H2>
6406 <H3><A NAME="10_58_1">Usage</A></H3>
6407 <PRE>
6408 int
6409 httpGet(http_t *http,
6410 const char *uri);
6411 </PRE>
6412 <H3><A NAME="10_58_2">Arguments</A></H3>
6413 <CENTER>
6414 <TABLE BORDER WIDTH="80%">
6415 <TR><TH>Argument</TH><TH>Description</TH></TR>
6416 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6417 <TR><TD>uri</TD><TD>The URI to get</TD></TR>
6418 </TABLE>
6419 </CENTER>
6420 <H3><A NAME="10_58_3">Returns</A></H3>
6421 <P>0 on success, non-zero on failure.</P>
6422 <H3><A NAME="10_58_4">Description</A></H3>
6423 <P>The <CODE>httpGet()</CODE> function sends a HTTP GET request to the
6424 server.</P>
6425 <H3><A NAME="10_58_5">Example</A></H3>
6426 <PRE>
6427 #include &lt;cups/http.h&gt;
6428
6429 <A HREF="#http_t">http_t</A> *http;
6430
6431 httpGet(http, &quot;/some/uri&quot;);
6432 </PRE>
6433 <H3><A NAME="10_58_6">See Also</A></H3>
6434 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpSetField">
6435 <CODE>httpSetField()</CODE></A>,<A HREF="#httpUpdate"> <CODE>
6436 httpUpdate()</CODE></A>
6437 <!-- NEW PAGE -->
6438
6439 <H2><A NAME="httpGets">httpGets()</A></H2>
6440 <H3><A NAME="10_59_1">Usage</A></H3>
6441 <PRE>
6442 char *
6443 httpGets(char *line,
6444 int length,
6445 http_t *http)
6446 </PRE>
6447 <H3><A NAME="10_59_2">Arguments</A></H3>
6448 <CENTER>
6449 <TABLE BORDER WIDTH="80%">
6450 <TR><TH>Argument</TH><TH>Description</TH></TR>
6451 <TR><TD>line</TD><TD>The string to fill with a line from the HTTP
6452 connection</TD></TR>
6453 <TR><TD>length</TD><TD>The maximum length of the string</TD></TR>
6454 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6455 </TABLE>
6456 </CENTER>
6457 <H3><A NAME="10_59_3">Returns</A></H3>
6458 <P>A pointer to the string or NULL if no line could be retrieved.</P>
6459 <H3><A NAME="10_59_4">Description</A></H3>
6460 <P>The <CODE>httpGets()</CODE> function is used to read a request line
6461 from the HTTP connection. It is not normally used by a client program.</P>
6462 <H3><A NAME="10_59_5">Example</A></H3>
6463 <PRE>
6464 #include &lt;cups/http.h&gt;
6465
6466 <A HREF="#http_t">http_t</A> *http;
6467 char line[1024];
6468
6469 if (httpGets(line, sizeof(line), http))
6470 {
6471 ... process the line ...
6472 }
6473 </PRE>
6474 <H3><A NAME="10_59_6">See Also</A></H3>
6475 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpUpdate">
6476 <CODE>httpUpdate()</CODE></A>
6477 <!-- NEW PAGE -->
6478
6479 <H2><A NAME="httpGetDateString">httpGetDateString()</A></H2>
6480 <H3><A NAME="10_60_1">Usage</A></H3>
6481 <PRE>
6482 const char *
6483 httpGetDateString(time_t time)
6484 </PRE>
6485 <H3><A NAME="10_60_2">Arguments</A></H3>
6486 <CENTER>
6487 <TABLE BORDER WIDTH="80%">
6488 <TR><TH>Argument</TH><TH>Description</TH></TR>
6489 <TR><TD>time</TD><TD>The UNIX date/time value</TD></TR>
6490 </TABLE>
6491 </CENTER>
6492 <H3><A NAME="10_60_3">Returns</A></H3>
6493 <P>A pointer to a static string containing the HTTP date/time string for
6494 the specified UNIX time value.</P>
6495 <H3><A NAME="10_60_4">Description</A></H3>
6496 <P>The <CODE>httpGetDateString()</CODE> function generates a date/time
6497 string suitable for HTTP requests from a UNIX time value.</P>
6498 <H3><A NAME="10_60_5">Example</A></H3>
6499 <PRE>
6500 #include &lt;cups/http.h&gt;
6501
6502 puts(httpGetDateString(time(NULL)));
6503 </PRE>
6504 <H3><A NAME="10_60_6">See Also</A></H3>
6505 <A HREF="#httpGetDateTime"> <CODE>httpGetDateTime()</CODE></A>
6506 <!-- NEW PAGE -->
6507
6508 <H2><A NAME="httpGetDateTime">httpGetDateTime()</A></H2>
6509 <H3><A NAME="10_61_1">Usage</A></H3>
6510 <PRE>
6511 time_t
6512 httpGetDateTime(const char *date)
6513 </PRE>
6514 <H3><A NAME="10_61_2">Arguments</A></H3>
6515 <CENTER>
6516 <TABLE BORDER WIDTH="80%">
6517 <TR><TH>Argument</TH><TH>Description</TH></TR>
6518 <TR><TD>date</TD><TD>The HTTP date/time string</TD></TR>
6519 </TABLE>
6520 </CENTER>
6521 <H3><A NAME="10_61_3">Returns</A></H3>
6522 <P>A UNIX time value.</P>
6523 <H3><A NAME="10_61_4">Description</A></H3>
6524 <P>The <CODE>httpGetDateTime()</CODE> function converts a HTTP date/time
6525 string to a UNIX time value.</P>
6526 <H3><A NAME="10_61_5">Example</A></H3>
6527 <PRE>
6528 #include &lt;cups/http.h&gt;
6529
6530 printf(&quot;%d\n&quot;, httpGetDateTime(&quot;Fri, 30 June 2000 12:34:56 GMT&quot;));
6531 </PRE>
6532 <H3><A NAME="10_61_6">See Also</A></H3>
6533 <A HREF="#httpGetDateString"> <CODE>httpGetDateString()</CODE></A>
6534 <!-- NEW PAGE -->
6535
6536 <H2><A NAME="httpGetField">httpGetField()</A></H2>
6537 <H3><A NAME="10_62_1">Usage</A></H3>
6538 <PRE>
6539 const char *
6540 httpGetField(http_t *http,
6541 http_field_t field);
6542 </PRE>
6543 <H3><A NAME="10_62_2">Arguments</A></H3>
6544 <CENTER>
6545 <TABLE BORDER WIDTH="80%">
6546 <TR><TH>Argument</TH><TH>Description</TH></TR>
6547 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6548 <TR><TD>field</TD><TD>The HTTP field</TD></TR>
6549 </TABLE>
6550 </CENTER>
6551 <H3><A NAME="10_62_3">Returns</A></H3>
6552 <P>A pointer to the field value string.</P>
6553 <H3><A NAME="10_62_4">Description</A></H3>
6554 <P>The <CODE>httpGetField()</CODE> function returns the current value
6555 for the specified HTTP field.</P>
6556 <H3><A NAME="10_62_5">Example</A></H3>
6557 <PRE>
6558 #include &lt;cups/http.h&gt;
6559
6560 <A HREF="#http_t">http_t</A> *http;
6561
6562 httpGet(http, &quot;/some/uri&quot;);
6563 while (httpUpdate(http) == HTTP_CONTINUE);
6564
6565 puts(httpGetField(http, HTTP_FIELD_CONTENT_TYPE));
6566 </PRE>
6567 <H3><A NAME="10_62_6">See Also</A></H3>
6568 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpGetSubField">
6569 <CODE>httpGetSubField()</CODE></A>,<A HREF="#httpSetField"> <CODE>
6570 httpSetField()</CODE></A>
6571 <!-- NEW PAGE -->
6572
6573 <H2><A NAME="httpGetHostByName">httpGetHostByName()</A></H2>
6574 <H3><A NAME="10_63_1">Usage</A></H3>
6575 <PRE>
6576 struct hostent *
6577 httpGetHostByName(const char *name);
6578 </PRE>
6579 <H3><A NAME="10_63_2">Arguments</A></H3>
6580 <CENTER>
6581 <TABLE BORDER WIDTH="80%">
6582 <TR><TH>Argument</TH><TH>Description</TH></TR>
6583 <TR><TD>name</TD><TD>Name or IP address to lookup.</TD></TR>
6584 </TABLE>
6585 </CENTER>
6586 <H3><A NAME="10_63_3">Returns</A></H3>
6587 <P>NULL if the host could not be found or a pointer to a host entry
6588 containing one or more addresses.</P>
6589 <H3><A NAME="10_63_4">Description</A></H3>
6590 <P><CODE>httpGetHostByName()</CODE> is a portable wrapper around the <CODE>
6591 gethostbyname()</CODE> function which handles both hostnames and IP
6592 addresses.</P>
6593 <H3><A NAME="10_63_5">Example</A></H3>
6594 <PRE>
6595 #include &lt;cups/http.h&gt;
6596
6597 struct hostent *hostaddr;
6598
6599 hostaddr = httpGetHostByName(&quot;foo.bar.com&quot;);
6600 </PRE>
6601
6602 <!-- NEW PAGE -->
6603 <H2><A NAME="httpGetLength">httpGetLength()</A></H2>
6604 <H3><A NAME="10_64_1">Usage</A></H3>
6605 <PRE>
6606 int
6607 httpGetLength(http_t *http);
6608 </PRE>
6609 <H3><A NAME="10_64_2">Arguments</A></H3>
6610 <CENTER>
6611 <TABLE BORDER WIDTH="80%">
6612 <TR><TH>Argument</TH><TH>Description</TH></TR>
6613 <TR><TD>http</TD><TD>The HTTP connection.</TD></TR>
6614 </TABLE>
6615 </CENTER>
6616 <H3><A NAME="10_64_3">Returns</A></H3>
6617 <P>The content length of the response or MAX_INT if chunking is used.</P>
6618 <H3><A NAME="10_64_4">Description</A></H3>
6619 <P><CODE>httpGetLength()</CODE> returns the content length of a
6620 response.</P>
6621 <H3><A NAME="10_64_5">Example</A></H3>
6622 <PRE>
6623 #include &lt;cups/http.h&gt;
6624
6625 <A HREF="#http_t">http_t</A> *http;
6626
6627 ...
6628
6629 printf(&quot;The length of the response is %d bytes.\n&quot;, httpGetLength(http));
6630 </PRE>
6631 <H3><A NAME="10_64_6">See Also</A></H3>
6632 <P><A HREF="#httpGet"> <CODE>httpGet()</CODE></A>,<A HREF="#httpPost"> <CODE>
6633 httpPost()</CODE></A>
6634 <!-- NEW PAGE -->
6635 </P>
6636 <H2><A NAME="httpGetSubField">httpGetSubField()</A></H2>
6637 <H3><A NAME="10_65_1">Usage</A></H3>
6638 <PRE>
6639 const char *
6640 httpGetSubField(http_t *http,
6641 http_field_t field,
6642 const char *name,
6643 char *value);
6644 </PRE>
6645 <H3><A NAME="10_65_2">Arguments</A></H3>
6646 <CENTER>
6647 <TABLE BORDER WIDTH="80%">
6648 <TR><TH>Argument</TH><TH>Description</TH></TR>
6649 <TR><TD>http</TD><TD>The HTTP connection.</TD></TR>
6650 <TR><TD>field</TD><TD>The HTTP field.</TD></TR>
6651 <TR><TD>name</TD><TD>The name of the subfield.</TD></TR>
6652 <TR><TD>value</TD><TD>The string to hold the subfield value.</TD></TR>
6653 </TABLE>
6654 </CENTER>
6655 <H3><A NAME="10_65_3">Returns</A></H3>
6656 <P>A pointer to the subfield value string or NULL if it does not exist.</P>
6657 <H3><A NAME="10_65_4">Description</A></H3>
6658 <P>The <CODE>httpGetSubField()</CODE> function returns a subfield value
6659 from the specified HTTP field. The destination string buffer must be at
6660 least <CODE>HTTP_MAX_VALUE</CODE> bytes in length.</P>
6661 <H3><A NAME="10_65_5">Example</A></H3>
6662 <PRE>
6663 #include &lt;cups/http.h&gt;
6664
6665 <A HREF="#http_t">http_t</A> *http;
6666 char value[HTTP_MAX_VALUE];
6667
6668 httpGet(http, &quot;/some/uri&quot;);
6669 while (httpUpdate(http) == HTTP_CONTINUE);
6670
6671 puts(httpGetSubField(http, HTTP_FIELD_CONTENT_TYPE, &quot;charset&quot;, value));
6672 </PRE>
6673 <H3><A NAME="10_65_6">See Also</A></H3>
6674 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpGetField">
6675 <CODE>httpGetField()</CODE></A>,<A HREF="#httpSetField"> <CODE>
6676 httpSetField()</CODE></A>
6677 <!-- NEW PAGE -->
6678
6679 <H2><A NAME="httpHead">httpHead()</A></H2>
6680 <H3><A NAME="10_66_1">Usage</A></H3>
6681 <PRE>
6682 int
6683 httpHead(http_t *http,
6684 const char *uri);
6685 </PRE>
6686 <H3><A NAME="10_66_2">Arguments</A></H3>
6687 <CENTER>
6688 <TABLE BORDER WIDTH="80%">
6689 <TR><TH>Argument</TH><TH>Description</TH></TR>
6690 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6691 <TR><TD>uri</TD><TD>The URI to head</TD></TR>
6692 </TABLE>
6693 </CENTER>
6694 <H3><A NAME="10_66_3">Returns</A></H3>
6695 <P>0 on success, non-zero on failure.</P>
6696 <H3><A NAME="10_66_4">Description</A></H3>
6697 <P>The <CODE>httpHead()</CODE> function sends a HTTP HEAD request to the
6698 server.</P>
6699 <H3><A NAME="10_66_5">Example</A></H3>
6700 <PRE>
6701 #include &lt;cups/http.h&gt;
6702
6703 http_t *http;
6704
6705 httpHead(http, &quot;/some/uri&quot;);
6706 </PRE>
6707 <H3><A NAME="10_66_6">See Also</A></H3>
6708 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpSetField">
6709 <CODE>httpSetField()</CODE></A>,<A HREF="#httpUpdate"> <CODE>
6710 httpUpdate()</CODE></A>
6711 <!-- NEW PAGE -->
6712
6713 <H2><A NAME="httpInitialize">httpInitialize()</A></H2>
6714 <H3><A NAME="10_67_1">Usage</A></H3>
6715 <PRE>
6716 void httpInitialize(void);
6717 </PRE>
6718 <H3><A NAME="10_67_2">Description</A></H3>
6719 <P>The <CODE>httpInitialize()</CODE> function initializes the networking
6720 code as needed by the underlying platform. It is called automatically
6721 by the <CODE>httpConnect()</CODE> function.</P>
6722 <H3><A NAME="10_67_3">Example</A></H3>
6723 <PRE>
6724 #include &lt;cups/http.h&gt;
6725
6726 httpInitialize();
6727 </PRE>
6728 <H3><A NAME="10_67_4">See Also</A></H3>
6729 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>
6730 <!-- NEW PAGE -->
6731
6732 <H2><A NAME="httpMD5">httpMD5()</A></H2>
6733 <H3><A NAME="10_68_1">Usage</A></H3>
6734 <PRE>
6735 char *
6736 httpMD5(const char *username,
6737 const char *realm,
6738 const char *passwd,
6739 char md5[33]);
6740 </PRE>
6741 <H3><A NAME="10_68_2">Arguments</A></H3>
6742 <CENTER>
6743 <TABLE BORDER WIDTH="80%">
6744 <TR><TH>Argument</TH><TH>Description</TH></TR>
6745 <TR><TD>username</TD><TD>The authenticating user name.</TD></TR>
6746 <TR><TD>realm</TD><TD>The authenticating realm name.</TD></TR>
6747 <TR><TD>passwd</TD><TD>The authenticating password.</TD></TR>
6748 <TR><TD>md5</TD><TD>The MD5 sum string.</TD></TR>
6749 </TABLE>
6750 </CENTER>
6751 <H3><A NAME="10_68_3">Returns</A></H3>
6752 <P>A pointer to the MD5 sum string.</P>
6753 <H3><A NAME="10_68_4">Description</A></H3>
6754 <P><CODE>httpMD5()</CODE> computes the MD5 hash of the username, realm,
6755 and password as required by the HTTP Digest specification.</P>
6756 <H3><A NAME="10_68_5">Example</A></H3>
6757 <PRE>
6758 #include &lt;cups/http.h&gt;
6759
6760 char md5[33];
6761
6762 ...
6763
6764 httpMD5(&quot;user&quot;, &quot;realm&quot;, &quot;password&quot;, md5);
6765 </PRE>
6766 <H3><A NAME="10_68_6">See Also</A></H3>
6767 <P><A HREF="#httpMD5Final"> <CODE>httpMD5Final()</CODE></A>,<A HREF="#httpMD5String">
6768 <CODE>httpMD5String()</CODE></A>
6769 <!-- NEW PAGE -->
6770 </P>
6771 <H2><A NAME="httpMD5Final">httpMD5Final()</A></H2>
6772 <H3><A NAME="10_69_1">Usage</A></H3>
6773 <PRE>
6774 char *
6775 httpMD5Final(const char *nonce,
6776 const char *method,
6777 const char *resource,
6778 char md5[33]);
6779 </PRE>
6780 <H3><A NAME="10_69_2">Arguments</A></H3>
6781 <CENTER>
6782 <TABLE BORDER WIDTH="80%">
6783 <TR><TH>Argument</TH><TH>Description</TH></TR>
6784 <TR><TD>nonce</TD><TD>The server nonce value.</TD></TR>
6785 <TR><TD>method</TD><TD>The HTTP method (GET, POST, etc.)</TD></TR>
6786 <TR><TD>resource</TD><TD>The resource path.</TD></TR>
6787 <TR><TD>md5</TD><TD>The MD5 sum string.</TD></TR>
6788 </TABLE>
6789 </CENTER>
6790 <H3><A NAME="10_69_3">Returns</A></H3>
6791 <P>The MD5 sum string.</P>
6792 <H3><A NAME="10_69_4">Description</A></H3>
6793 <P><CODE>httpMD5Final()</CODE> appends the nonce, method, and resource
6794 to the specified MD5 sum.</P>
6795 <H3><A NAME="10_69_5">Example</A></H3>
6796 <PRE>
6797 #include &lt;cups/http.h&gt;
6798
6799 char md5[33];
6800
6801 ...
6802
6803 httpMD5Final(&quot;nonce&quot;, &quot;GET&quot;, &quot;/jobs&quot;, md5);
6804 </PRE>
6805 <H3><A NAME="10_69_6">See Also</A></H3>
6806 <P><A HREF="#httpMD5"> <CODE>httpMD5()</CODE></A>,<A HREF="#httpMD5String">
6807 <CODE>httpMD5String()</CODE></A>
6808 <!-- NEW PAGE -->
6809 </P>
6810 <H2><A NAME="httpMD5String">httpMD5String()</A></H2>
6811 <H3><A NAME="10_70_1">Usage</A></H3>
6812 <PRE>
6813 char *
6814 httpMD5String(const md5_byte_t *sum,
6815 char md5[33]);
6816 </PRE>
6817 <H3><A NAME="10_70_2">Arguments</A></H3>
6818 <CENTER>
6819 <TABLE BORDER WIDTH="80%">
6820 <TR><TH>Argument</TH><TH>Description</TH></TR>
6821 <TR><TD>sum</TD><TD>The raw MD5 sum data.</TD></TR>
6822 <TR><TD>md5</TD><TD>The MD5 sum string.</TD></TR>
6823 </TABLE>
6824 </CENTER>
6825 <H3><A NAME="10_70_3">Returns</A></H3>
6826 <P>The MD5 sum string.</P>
6827 <H3><A NAME="10_70_4">Description</A></H3>
6828 <P><CODE>httpMD5String()</CODE> converts the raw MD5 sum value to a
6829 string.</P>
6830 <H3><A NAME="10_70_5">Example</A></H3>
6831 <PRE>
6832 #include &lt;cups/http.h&gt;
6833
6834 md5_byte_t sum[16];
6835 char md5[33];
6836
6837 ...
6838
6839 httpMD5String(sum, md5);
6840 </PRE>
6841 <H3><A NAME="10_70_6">See Also</A></H3>
6842 <P><A HREF="#httpMD5"> <CODE>httpMD5()</CODE></A>,<A HREF="#httpMD5Final">
6843 <CODE>httpMD5Final()</CODE></A>
6844 <!-- NEW PAGE -->
6845 </P>
6846 <H2><A NAME="httpOptions">httpOptions()</A></H2>
6847 <H3><A NAME="10_71_1">Usage</A></H3>
6848 <PRE>
6849 int
6850 httpOptions(http_t *http,
6851 const char *uri);
6852 </PRE>
6853 <H3><A NAME="10_71_2">Arguments</A></H3>
6854 <CENTER>
6855 <TABLE BORDER WIDTH="80%">
6856 <TR><TH>Argument</TH><TH>Description</TH></TR>
6857 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6858 <TR><TD>uri</TD><TD>The URI to check for options</TD></TR>
6859 </TABLE>
6860 </CENTER>
6861 <H3><A NAME="10_71_3">Returns</A></H3>
6862 <P>0 on success, non-zero on failure.</P>
6863 <H3><A NAME="10_71_4">Description</A></H3>
6864 <P>The <CODE>httpOptions()</CODE> function sends a HTTP OPTIONS request
6865 to the server.</P>
6866 <H3><A NAME="10_71_5">Example</A></H3>
6867 <PRE>
6868 #include &lt;cups/http.h&gt;
6869
6870 http_t *http;
6871
6872 httpOptions(http, &quot;/some/uri&quot;);
6873 </PRE>
6874 <H3><A NAME="10_71_6">See Also</A></H3>
6875 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpSetField">
6876 <CODE>httpSetField()</CODE></A>,<A HREF="#httpUpdate"> <CODE>
6877 httpUpdate()</CODE></A>
6878 <!-- NEW PAGE -->
6879
6880 <H2><A NAME="httpPost">httpPost()</A></H2>
6881 <H3><A NAME="10_72_1">Usage</A></H3>
6882 <PRE>
6883 int
6884 httpPost(http_t *http,
6885 const char *uri);
6886 </PRE>
6887 <H3><A NAME="10_72_2">Arguments</A></H3>
6888 <CENTER>
6889 <TABLE BORDER WIDTH="80%">
6890 <TR><TH>Argument</TH><TH>Description</TH></TR>
6891 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6892 <TR><TD>uri</TD><TD>The URI to post to</TD></TR>
6893 </TABLE>
6894 </CENTER>
6895 <H3><A NAME="10_72_3">Returns</A></H3>
6896 <P>0 on success, non-zero on failure.</P>
6897 <H3><A NAME="10_72_4">Description</A></H3>
6898 <P>The <CODE>httpPost()</CODE> function sends a HTTP POST request to the
6899 server.</P>
6900 <H3><A NAME="10_72_5">Example</A></H3>
6901 <PRE>
6902 #include &lt;cups/http.h&gt;
6903
6904 http_t *http;
6905
6906 httpPost(http, &quot;/some/uri&quot;);
6907 </PRE>
6908 <H3><A NAME="10_72_6">See Also</A></H3>
6909 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpSetField">
6910 <CODE>httpSetField()</CODE></A>,<A HREF="#httpUpdate"> <CODE>
6911 httpUpdate()</CODE></A>
6912 <!-- NEW PAGE -->
6913
6914 <H2><A NAME="httpPrintf">httpPrintf()</A></H2>
6915 <H3><A NAME="10_73_1">Usage</A></H3>
6916 <PRE>
6917 int
6918 httpPrintf(http_t *http,
6919 const char *format,
6920 ...);
6921 </PRE>
6922 <H3><A NAME="10_73_2">Arguments</A></H3>
6923 <CENTER>
6924 <TABLE BORDER WIDTH="80%">
6925 <TR><TH>Argument</TH><TH>Description</TH></TR>
6926 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6927 <TR><TD>format</TD><TD>A printf-style format string</TD></TR>
6928 </TABLE>
6929 </CENTER>
6930 <H3><A NAME="10_73_3">Returns</A></H3>
6931 <P>The number of bytes written.</P>
6932 <H3><A NAME="10_73_4">Description</A></H3>
6933 <P>The <CODE>httpPrintf()</CODE> function sends a formatted string to
6934 the HTTP connection. It is normally only used by the CUPS API and
6935 scheduler.</P>
6936 <H3><A NAME="10_73_5">Example</A></H3>
6937 <PRE>
6938 #include &lt;cups/http.h&gt;
6939
6940 http_t *http;
6941
6942 httpPrintf(http, &quot;GET / HTTP/1.1 \r\n&quot;);
6943 </PRE>
6944 <H3><A NAME="10_73_6">See Also</A></H3>
6945 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>
6946 <!-- NEW PAGE -->
6947
6948 <H2><A NAME="httpPut">httpPut()</A></H2>
6949 <H3><A NAME="10_74_1">Usage</A></H3>
6950 <PRE>
6951 int
6952 httpPut(http_t *http,
6953 const char *uri);
6954 </PRE>
6955 <H3><A NAME="10_74_2">Arguments</A></H3>
6956 <CENTER>
6957 <TABLE BORDER WIDTH="80%">
6958 <TR><TH>Argument</TH><TH>Description</TH></TR>
6959 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6960 <TR><TD>uri</TD><TD>The URI to put</TD></TR>
6961 </TABLE>
6962 </CENTER>
6963 <H3><A NAME="10_74_3">Returns</A></H3>
6964 <P>0 on success, non-zero on failure.</P>
6965 <H3><A NAME="10_74_4">Description</A></H3>
6966 <P>The <CODE>httpPut()</CODE> function sends a HTTP PUT request to the
6967 server.</P>
6968 <H3><A NAME="10_74_5">Example</A></H3>
6969 <PRE>
6970 #include &lt;cups/http.h&gt;
6971
6972 http_t *http;
6973
6974 httpDelete(http, &quot;/some/uri&quot;);
6975 </PRE>
6976 <H3><A NAME="10_74_6">See Also</A></H3>
6977 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpSetField">
6978 <CODE>httpSetField()</CODE></A>,<A HREF="#httpUpdate"> <CODE>
6979 httpUpdate()</CODE></A>
6980 <!-- NEW PAGE -->
6981
6982 <H2><A NAME="httpRead">httpRead()</A></H2>
6983 <H3><A NAME="10_75_1">Usage</A></H3>
6984 <PRE>
6985 int
6986 httpRead(http_t *http,
6987 char *buffer,
6988 int length);
6989 </PRE>
6990 <H3><A NAME="10_75_2">Arguments</A></H3>
6991 <CENTER>
6992 <TABLE BORDER WIDTH="80%">
6993 <TR><TH>Argument</TH><TH>Description</TH></TR>
6994 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
6995 <TR><TD>buffer</TD><TD>The buffer to read into</TD></TR>
6996 <TR><TD>length</TD><TD>The number of bytes to read</TD></TR>
6997 </TABLE>
6998 </CENTER>
6999 <H3><A NAME="10_75_3">Returns</A></H3>
7000 <P>The number of bytes read or -1 on error.</P>
7001 <H3><A NAME="10_75_4">Description</A></H3>
7002 <P>The <CODE>httpRead()</CODE> function reads data from the HTTP
7003 connection, possibly the result of a GET or POST request.</P>
7004 <H3><A NAME="10_75_5">Example</A></H3>
7005 <PRE>
7006 #include &lt;cups/http.h&gt;
7007
7008 http_t *http;
7009 char buffer[1024];
7010 int bytes;
7011
7012 httpGet(http, &quot;/&quot;);
7013 while (httpUpdate(http) != HTTP_CONTINUE);
7014 while ((bytes = httpRead(http, buffer, sizeof(buffer) - 1)) &gt; 0)
7015 {
7016 buffer[bytes] = '\0';
7017 fputs(buffer, stdout);
7018 }
7019 </PRE>
7020 <H3><A NAME="10_75_6">See Also</A></H3>
7021 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpWrite">
7022 <CODE>httpWrite()</CODE></A>
7023 <!-- NEW PAGE -->
7024
7025 <H2><A NAME="httpReconnect">httpReconnect()</A></H2>
7026 <H3><A NAME="10_76_1">Usage</A></H3>
7027 <PRE>
7028 int
7029 httpReconnect(http_t *http);
7030 </PRE>
7031 <H3><A NAME="10_76_2">Arguments</A></H3>
7032 <CENTER>
7033 <TABLE BORDER WIDTH="80%">
7034 <TR><TH>Argument</TH><TH>Description</TH></TR>
7035 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
7036 </TABLE>
7037 </CENTER>
7038 <H3><A NAME="10_76_3">Returns</A></H3>
7039 <P>0 on success, non-zero on failure.</P>
7040 <H3><A NAME="10_76_4">Description</A></H3>
7041 <P>The <CODE>httpReconnect()</CODE> function reconnects to the HTTP
7042 server. This is usually done automatically if the HTTP functions detect
7043 that the server connection has terminated.</P>
7044 <H3><A NAME="10_76_5">Example</A></H3>
7045 <PRE>
7046 #include &lt;cups/http.h&gt;
7047
7048 http_t *http;
7049
7050 httpReconnect(http);
7051 </PRE>
7052 <H3><A NAME="10_76_6">See Also</A></H3>
7053 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>
7054 <!-- NEW PAGE -->
7055
7056 <H2><A NAME="httpSeparate">httpSeparate()</A></H2>
7057 <H3><A NAME="10_77_1">Usage</A></H3>
7058 <PRE>
7059 void
7060 httpSeparate(const char *uri,
7061 char *method,
7062 char *username,
7063 char *host,
7064 int *port,
7065 char *resource);
7066 </PRE>
7067 <H3><A NAME="10_77_2">Arguments</A></H3>
7068 <CENTER>
7069 <TABLE BORDER WIDTH="80%">
7070 <TR><TH>Argument</TH><TH>Description</TH></TR>
7071 <TR><TD>uri</TD><TD>The URI to separate</TD></TR>
7072 <TR><TD>method</TD><TD>The method (scheme) of the URI</TD></TR>
7073 <TR><TD>username</TD><TD>The username (and password) portion of the URI,
7074 if any</TD></TR>
7075 <TR><TD>host</TD><TD>The hostname portion of the URI, if any</TD></TR>
7076 <TR><TD>port</TD><TD>The port number for the URI, either as specified or
7077 as default for the method/scheme</TD></TR>
7078 <TR><TD>resource</TD><TD>The resource string, usually a filename on the
7079 server</TD></TR>
7080 </TABLE>
7081 </CENTER>
7082 <H3><A NAME="10_77_3">Description</A></H3>
7083 <P>The <CODE>httpSeparate()</CODE> function separates the specified URI
7084 into its component parts. The method, username, hostname, and resource
7085 strings should be at least <CODE>HTTP_MAX_URI</CODE> characters long to
7086 avoid potential buffer overflow problems.</P>
7087 <H3><A NAME="10_77_4">Example</A></H3>
7088 <PRE>
7089 char uri[HTTP_MAX_URI];
7090 char method[HTTP_MAX_URI];
7091 char username[HTTP_MAX_URI];
7092 char host[HTTP_MAX_URI];
7093 char resource[HTTP_MAX_URI];
7094 int port;
7095
7096 ...
7097
7098 httpSeparate(uri, method, username, host, &amp;port, resource);
7099 </PRE>
7100 <H3><A NAME="10_77_5">See Also</A></H3>
7101 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>
7102 <!-- NEW PAGE -->
7103
7104 <H2><A NAME="httpSetField">httpSetField()</A></H2>
7105 <H3><A NAME="10_78_1">Usage</A></H3>
7106 <PRE>
7107 void
7108 httpSetField(http_t *http,
7109 http_field_t field,
7110 const char *value);
7111 </PRE>
7112 <H3><A NAME="10_78_2">Arguments</A></H3>
7113 <CENTER>
7114 <TABLE BORDER WIDTH="80%">
7115 <TR><TH>Argument</TH><TH>Description</TH></TR>
7116 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
7117 <TR><TD>field</TD><TD>The HTTP field</TD></TR>
7118 <TR><TD>value</TD><TD>The string value for the field</TD></TR>
7119 </TABLE>
7120 </CENTER>
7121 <H3><A NAME="10_78_3">Description</A></H3>
7122 <P>The <CODE>httpSetField()</CODE> function sets the current value for
7123 the specified HTTP field.</P>
7124 <H3><A NAME="10_78_4">Example</A></H3>
7125 <PRE>
7126 #include &lt;cups/http.h&gt;
7127
7128 http_t *http;
7129
7130 httpSetField(http, HTTP_FIELD_AUTHORIZATION, &quot;Basic dfdr34453454325&quot;));
7131 httpGet(http, &quot;/some/uri&quot;);
7132 while (httpUpdate(http) == HTTP_CONTINUE);
7133 </PRE>
7134 <H3><A NAME="10_78_5">See Also</A></H3>
7135 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpGetField">
7136 <CODE>httpGetField()</CODE></A>
7137 <!-- NEW PAGE -->
7138
7139 <H2><A NAME="httpStatus">httpStatus()</A></H2>
7140 <H3><A NAME="10_79_1">Usage</A></H3>
7141 <PRE>
7142 const char *
7143 httpStatus(http_status_t status);
7144 </PRE>
7145 <H3><A NAME="10_79_2">Arguments</A></H3>
7146 <CENTER>
7147 <TABLE BORDER WIDTH="80%">
7148 <TR><TH>Argument</TH><TH>Description</TH></TR>
7149 <TR><TD>status</TD><TD>The HTTP status code from the server.</TD></TR>
7150 </TABLE>
7151 </CENTER>
7152 <H3><A NAME="10_79_3">Returns</A></H3>
7153 <P>The standard HTTP status text associated with the status code.</P>
7154 <H3><A NAME="10_79_4">Description</A></H3>
7155 <P><CODE>httpStatus()</CODE> returns the standard HTTP status text
7156 associated with the status code.</P>
7157 <H3><A NAME="10_79_5">Example</A></H3>
7158 <PRE>
7159 #include &lt;cups/http.h&gt;
7160
7161 <A HREF="#http_t">http_t</A> *http;
7162
7163 ...
7164
7165 puts(httpStatus(http-&gt;status));
7166 </PRE>
7167
7168 <!-- NEW PAGE -->
7169 <H2><A NAME="httpTrace">httpTrace()</A></H2>
7170 <H3><A NAME="10_80_1">Usage</A></H3>
7171 <PRE>
7172 int
7173 httpTrace(http_t *http,
7174 const char *uri);
7175 </PRE>
7176 <H3><A NAME="10_80_2">Arguments</A></H3>
7177 <CENTER>
7178 <TABLE BORDER WIDTH="80%">
7179 <TR><TH>Argument</TH><TH>Description</TH></TR>
7180 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
7181 <TR><TD>uri</TD><TD>The URI to trace</TD></TR>
7182 </TABLE>
7183 </CENTER>
7184 <H3><A NAME="10_80_3">Returns</A></H3>
7185 <P>0 on success, non-zero on failure.</P>
7186 <H3><A NAME="10_80_4">Description</A></H3>
7187 <P>The <CODE>httpTrace()</CODE> function sends a HTTP TRACE request to
7188 the server.</P>
7189 <H3><A NAME="10_80_5">Example</A></H3>
7190 <PRE>
7191 #include &lt;cups/http.h&gt;
7192
7193 http_t *http;
7194
7195 httpTrace(http, &quot;/some/uri&quot;);
7196 </PRE>
7197 <H3><A NAME="10_80_6">See Also</A></H3>
7198 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpSetField">
7199 <CODE>httpSetField()</CODE></A>,<A HREF="#httpUpdate"> <CODE>
7200 httpUpdate()</CODE></A>
7201 <!-- NEW PAGE -->
7202
7203 <H2><A NAME="httpUpdate">httpUpdate()</A></H2>
7204 <H3><A NAME="10_81_1">Usage</A></H3>
7205 <PRE>
7206 http_status_t
7207 httpUpdate(http_t *http);
7208 </PRE>
7209 <H3><A NAME="10_81_2">Arguments</A></H3>
7210 <CENTER>
7211 <TABLE BORDER WIDTH="80%">
7212 <TR><TH>Argument</TH><TH>Description</TH></TR>
7213 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
7214 </TABLE>
7215 </CENTER>
7216 <H3><A NAME="10_81_3">Returns</A></H3>
7217 <P>The HTTP status of the current request.</P>
7218 <H3><A NAME="10_81_4">Description</A></H3>
7219 <P>The <CODE>httpUpdate()</CODE> function updates the current request
7220 status. It is used after any DELETE, GET, HEAD, OPTIONS, POST, PUT, or
7221 TRACE request to finalize the HTTP request and retrieve the request
7222 status.</P>
7223 <P>Since proxies and the current blocking mode can cause the request to
7224 take longer, programs should continue calling <CODE>httpUpdate() <CODE>
7225 until the return status is not the constant value <CODE>HTTP_CONTINUE</CODE>
7226 .</CODE></CODE></P>
7227 <H3><A NAME="10_81_5">Example</A></H3>
7228 <PRE>
7229 #include &lt;cups/http.h&gt;
7230
7231 http_t *http;
7232 http_status_t status;
7233
7234 httpGet(http, &quot;/some/uri&quot;);
7235 while ((status = httpUpdate(http)) == HTTP_CONTINUE);
7236 printf(&quot;Request status is %d\n&quot;, status);
7237 </PRE>
7238 <H3><A NAME="10_81_6">See Also</A></H3>
7239 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpDelete">
7240 <CODE>httpDelete()</CODE></A>,<A HREF="#httpGet"> <CODE>httpGet()</CODE>
7241 </A>,<A HREF="#httpHead"> <CODE>httpHead()</CODE></A>,<A HREF="#httpOptions">
7242 <CODE>httpOptions()</CODE></A>,<A HREF="#httpPost"> <CODE>httpPost()</CODE>
7243 </A>,<A HREF="#httpPut"> <CODE>httpPut()</CODE></A>,<A HREF="#httpTrace">
7244 <CODE>httpTrace()</CODE></A>
7245 <!-- NEW PAGE -->
7246
7247 <H2><A NAME="httpWrite">httpWrite()</A></H2>
7248 <H3><A NAME="10_82_1">Usage</A></H3>
7249 <PRE>
7250 int
7251 httpWrite(http_t *http,
7252 char *buffer,
7253 int length);
7254 </PRE>
7255 <H3><A NAME="10_82_2">Arguments</A></H3>
7256 <CENTER>
7257 <TABLE BORDER WIDTH="80%">
7258 <TR><TH>Argument</TH><TH>Description</TH></TR>
7259 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
7260 <TR><TD>buffer</TD><TD>The buffer to read into</TD></TR>
7261 <TR><TD>length</TD><TD>The number of bytes to read</TD></TR>
7262 </TABLE>
7263 </CENTER>
7264 <H3><A NAME="10_82_3">Returns</A></H3>
7265 <P>The number of bytes read or -1 on error.</P>
7266 <H3><A NAME="10_82_4">Description</A></H3>
7267 <P>The <CODE>httpWrite()</CODE> function reads data from the HTTP
7268 connection, possibly the result of a GET or POST request.</P>
7269 <H3><A NAME="10_82_5">Example</A></H3>
7270 <PRE>
7271 #include &lt;cups/http.h&gt;
7272
7273 http_t *http;
7274 FILE *fp;
7275 char buffer[1024];
7276 int bytes;
7277
7278 httpPost(http, &quot;/&quot;);
7279
7280 while ((bytes = fread(buffer, 1, sizeof(buffer), fp)) &gt; 0)
7281 httpWrite(http, buffer, bytes);
7282
7283 while (httpUpdate(http) != HTTP_CONTINUE);
7284
7285 while ((bytes = httpRead(http, buffer, sizeof(buffer) - 1)) &gt; 0)
7286 {
7287 buffer[bytes] = '\0';
7288 fputs(buffer, stdout);
7289 }
7290 </PRE>
7291 <H3><A NAME="10_82_6">See Also</A></H3>
7292 <A HREF="#httpConnect"> <CODE>httpConnect()</CODE></A>,<A HREF="#httpRead">
7293 <CODE>httpRead()</CODE></A>
7294 <!-- NEW PAGE -->
7295
7296 <H2><A NAME="ippAddBoolean">ippAddBoolean()</A></H2>
7297 <H3><A NAME="10_83_1">Usage</A></H3>
7298 <PRE>
7299 ipp_attribute_t *
7300 ippAddBoolean(ipp_t *ipp,
7301 ipp_tag_t group,
7302 const char *name,
7303 char value);
7304 </PRE>
7305 <H3><A NAME="10_83_2">Arguments</A></H3>
7306 <CENTER>
7307 <TABLE BORDER WIDTH="80%">
7308 <TR><TH>Argument</TH><TH>Description</TH></TR>
7309 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7310 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7311 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7312 <TR><TD>value</TD><TD>The boolean value</TD></TR>
7313 </TABLE>
7314 </CENTER>
7315 <H3><A NAME="10_83_3">Returns</A></H3>
7316 <P>A pointer to the new attribute or NULL if the attribute could not be
7317 created.</P>
7318 <H3><A NAME="10_83_4">Description</A></H3>
7319 <P>The <CODE>ippAddBoolean()</CODE> function adds a single boolean
7320 attribute value to the specified IPP request.</P>
7321 <H3><A NAME="10_83_5">Example</A></H3>
7322 <PRE>
7323 #include &lt;cups/ipp.h&gt;
7324
7325 ipp_t *ipp;
7326
7327 ippAddBoolean(ipp, IPP_TAG_OPERATION, &quot;my-jobs&quot;, 1);
7328 </PRE>
7329 <H3><A NAME="10_83_6">See Also</A></H3>
7330 <A HREF="#ippAddBooleans"> <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddDate">
7331 <CODE>ippAddDate()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>
7332 ippAddInteger()</CODE></A>,<A HREF="#ippAddIntegers"> <CODE>
7333 ippAddIntegers()</CODE></A>,<A HREF="#ippAddRange"> <CODE>ippAddRange()</CODE>
7334 </A>,<A HREF="#ippAddRanges"> <CODE>ippAddRanges()</CODE></A>,<A HREF="#ippAddResolution">
7335 <CODE>ippAddResolution()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7336 ippAddResolutions()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7337 ippAddSeparator()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7338 ippAddString()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7339 ippAddStrings()</CODE></A>
7340 <!-- NEW PAGE -->
7341
7342 <H2><A NAME="ippAddBooleans">ippAddBooleans()</A></H2>
7343 <H3><A NAME="10_84_1">Usage</A></H3>
7344 <PRE>
7345 ipp_attribute_t *
7346 ippAddBooleans(ipp_t *ipp,
7347 ipp_tag_t group,
7348 const char *name,
7349 int num_values,
7350 const char *values);
7351 </PRE>
7352 <H3><A NAME="10_84_2">Arguments</A></H3>
7353 <CENTER>
7354 <TABLE BORDER WIDTH="80%">
7355 <TR><TH>Argument</TH><TH>Description</TH></TR>
7356 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7357 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7358 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7359 <TR><TD>num_values</TD><TD>The number of values</TD></TR>
7360 <TR><TD>values</TD><TD>The boolean values</TD></TR>
7361 </TABLE>
7362 </CENTER>
7363 <H3><A NAME="10_84_3">Returns</A></H3>
7364 <P>A pointer to the new attribute or NULL if the attribute could not be
7365 created.</P>
7366 <H3><A NAME="10_84_4">Description</A></H3>
7367 <P>The <CODE>ippAddBooleans()</CODE> function adds one or more boolean
7368 attribute values to the specified IPP request. If the <CODE>values</CODE>
7369 pointer is <CODE>NULL</CODE> then an array of <CODE>num_values</CODE>
7370 false values is created.</P>
7371 <H3><A NAME="10_84_5">Example</A></H3>
7372 <PRE>
7373 #include &lt;cups/ipp.h&gt;
7374
7375 ipp_t *ipp;
7376 char values[10];
7377
7378 ippAddBooleans(ipp, IPP_TAG_OPERATION, &quot;some-attribute&quot;, 10, values);
7379 </PRE>
7380 <H3><A NAME="10_84_6">See Also</A></H3>
7381 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddDate">
7382 <CODE>ippAddDate()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>
7383 ippAddInteger()</CODE></A>,<A HREF="#ippAddIntegers"> <CODE>
7384 ippAddIntegers()</CODE></A>,<A HREF="#ippAddRange"> <CODE>ippAddRange()</CODE>
7385 </A>,<A HREF="#ippAddRanges"> <CODE>ippAddRanges()</CODE></A>,<A HREF="#ippAddResolution">
7386 <CODE>ippAddResolution()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7387 ippAddResolutions()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7388 ippAddSeparator()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7389 ippAddString()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7390 ippAddStrings()</CODE></A>
7391 <!-- NEW PAGE -->
7392
7393 <H2><A NAME="ippAddDate">ippAddDate()</A></H2>
7394 <H3><A NAME="10_85_1">Usage</A></H3>
7395 <PRE>
7396 ipp_attribute_t *
7397 ippAddDate(ipp_t *ipp,
7398 ipp_tag_t group,
7399 const char *name,
7400 ipp_uchar_t *value);
7401 </PRE>
7402 <H3><A NAME="10_85_2">Arguments</A></H3>
7403 <CENTER>
7404 <TABLE BORDER WIDTH="80%">
7405 <TR><TH>Argument</TH><TH>Description</TH></TR>
7406 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7407 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7408 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7409 <TR><TD>value</TD><TD>The date value</TD></TR>
7410 </TABLE>
7411 </CENTER>
7412 <H3><A NAME="10_85_3">Returns</A></H3>
7413 <P>A pointer to the new attribute or NULL if the attribute could not be
7414 created.</P>
7415 <H3><A NAME="10_85_4">Description</A></H3>
7416 <P>The <CODE>ippAddDate()</CODE> function adds a single date-time
7417 attribute value to the specified IPP request.</P>
7418 <H3><A NAME="10_85_5">Example</A></H3>
7419 <PRE>
7420 #include &lt;cups/ipp.h&gt;
7421
7422 ipp_t *ipp;
7423
7424 ippAddDate(ipp, IPP_TAG_OPERATION, &quot;some-attribute&quot;,
7425 ippTimeToDate(time(NULL));
7426 </PRE>
7427 <H3><A NAME="10_85_6">See Also</A></H3>
7428 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddBooleans">
7429 <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>
7430 ippAddInteger()</CODE></A>,<A HREF="#ippAddIntegers"> <CODE>
7431 ippAddIntegers()</CODE></A>,<A HREF="#ippAddRange"> <CODE>ippAddRange()</CODE>
7432 </A>,<A HREF="#ippAddRanges"> <CODE>ippAddRanges()</CODE></A>,<A HREF="#ippAddResolution">
7433 <CODE>ippAddResolution()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7434 ippAddResolutions()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7435 ippAddSeparator()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7436 ippAddString()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7437 ippAddStrings()</CODE></A>,<A HREF="#ippTimeToDate"> <CODE>
7438 ippTimeToDate()</CODE></A>
7439 <!-- NEW PAGE -->
7440
7441 <H2><A NAME="ippAddInteger">ippAddInteger()</A></H2>
7442 <H3><A NAME="10_86_1">Usage</A></H3>
7443 <PRE>
7444 ipp_attribute_t *
7445 ippAddInteger(ipp_t *ipp,
7446 ipp_tag_t group,
7447 ipp_tag_t tag,
7448 const char *name,
7449 int value);
7450 </PRE>
7451 <H3><A NAME="10_86_2">Arguments</A></H3>
7452 <CENTER>
7453 <TABLE BORDER WIDTH="80%">
7454 <TR><TH>Argument</TH><TH>Description</TH></TR>
7455 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7456 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7457 <TR><TD>tag</TD><TD>The type of integer value (IPP_TAG_INTEGER or
7458 IPP_TAG_ENUM)</TD></TR>
7459 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7460 <TR><TD>value</TD><TD>The integer value</TD></TR>
7461 </TABLE>
7462 </CENTER>
7463 <H3><A NAME="10_86_3">Returns</A></H3>
7464 <P>A pointer to the new attribute or NULL if the attribute could not be
7465 created.</P>
7466 <H3><A NAME="10_86_4">Description</A></H3>
7467 <P>The <CODE>ippAddInteger()</CODE> function adds a single integer
7468 attribute value to the specified IPP request.</P>
7469 <H3><A NAME="10_86_5">Example</A></H3>
7470 <PRE>
7471 #include &lt;cups/ipp.h&gt;
7472
7473 ipp_t *ipp;
7474
7475 ippAddInteger(ipp, IPP_TAG_OPERATION, &quot;limit&quot;, 100);
7476 </PRE>
7477 <H3><A NAME="10_86_6">See Also</A></H3>
7478 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddBooleans">
7479 <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddDate"> <CODE>
7480 ippAddDate()</CODE></A>,<A HREF="#ippAddIntegers"> <CODE>
7481 ippAddIntegers()</CODE></A>,<A HREF="#ippAddRange"> <CODE>ippAddRange()</CODE>
7482 </A>,<A HREF="#ippAddRanges"> <CODE>ippAddRanges()</CODE></A>,<A HREF="#ippAddResolution">
7483 <CODE>ippAddResolution()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7484 ippAddResolutions()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7485 ippAddSeparator()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7486 ippAddString()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7487 ippAddStrings()</CODE></A>
7488 <!-- NEW PAGE -->
7489
7490 <H2><A NAME="ippAddIntegers">ippAddIntegers()</A></H2>
7491 <H3><A NAME="10_87_1">Usage</A></H3>
7492 <PRE>
7493 ipp_attribute_t *
7494 ippAddIntegers(ipp_t *ipp,
7495 ipp_tag_t group,
7496 ipp_tag_t tag,
7497 const char *name,
7498 int num_values,
7499 const int *values);
7500 </PRE>
7501 <H3><A NAME="10_87_2">Arguments</A></H3>
7502 <CENTER>
7503 <TABLE BORDER WIDTH="80%">
7504 <TR><TH>Argument</TH><TH>Description</TH></TR>
7505 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7506 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7507 <TR><TD>tag</TD><TD>The type of integer value (IPP_TAG_INTEGER or
7508 IPP_TAG_ENUM)</TD></TR>
7509 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7510 <TR><TD>num_values</TD><TD>The number of values</TD></TR>
7511 <TR><TD>values</TD><TD>The integer values</TD></TR>
7512 </TABLE>
7513 </CENTER>
7514 <H3><A NAME="10_87_3">Returns</A></H3>
7515 <P>A pointer to the new attribute or NULL if the attribute could not be
7516 created.</P>
7517 <H3><A NAME="10_87_4">Description</A></H3>
7518 <P>The <CODE>ippAddIntegers()</CODE> function adds one or more integer
7519 attribute values to the specified IPP request. If the <CODE>values</CODE>
7520 pointer is <CODE>NULL</CODE> then an array of <CODE>num_values</CODE> 0
7521 values is created.</P>
7522 <H3><A NAME="10_87_5">Example</A></H3>
7523 <PRE>
7524 #include &lt;cups/ipp.h&gt;
7525
7526 ipp_t *ipp;
7527 int values[100];
7528
7529 ippAddIntegers(ipp, IPP_TAG_OPERATION, &quot;some-attribute&quot;, 100, values);
7530 </PRE>
7531 <H3><A NAME="10_87_6">See Also</A></H3>
7532 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddBooleans">
7533 <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddDate"> <CODE>
7534 ippAddDate()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>ippAddInteger()</CODE>
7535 </A>,<A HREF="#ippAddRange"> <CODE>ippAddRange()</CODE></A>,<A HREF="#ippAddRanges">
7536 <CODE>ippAddRanges()</CODE></A>,<A HREF="#ippAddResolution"> <CODE>
7537 ippAddResolution()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7538 ippAddResolutions()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7539 ippAddSeparator()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7540 ippAddString()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7541 ippAddStrings()</CODE></A>
7542 <!-- NEW PAGE -->
7543
7544 <H2><A NAME="ippAddRange">ippAddRange()</A></H2>
7545 <H3><A NAME="10_88_1">Usage</A></H3>
7546 <PRE>
7547 ipp_attribute_t *
7548 ippAddRange(ipp_t *ipp,
7549 ipp_tag_t group,
7550 const char *name,
7551 int low,
7552 int high);
7553 </PRE>
7554 <H3><A NAME="10_88_2">Arguments</A></H3>
7555 <CENTER>
7556 <TABLE BORDER WIDTH="80%">
7557 <TR><TH>Argument</TH><TH>Description</TH></TR>
7558 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7559 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7560 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7561 <TR><TD>low</TD><TD>The lower value</TD></TR>
7562 <TR><TD>high</TD><TD>The higher value</TD></TR>
7563 </TABLE>
7564 </CENTER>
7565 <H3><A NAME="10_88_3">Returns</A></H3>
7566 <P>A pointer to the new attribute or NULL if the attribute could not be
7567 created.</P>
7568 <H3><A NAME="10_88_4">Description</A></H3>
7569 <P>The <CODE>ippAddRange()</CODE> function adds a single range attribute
7570 value to the specified IPP request.</P>
7571 <H3><A NAME="10_88_5">Example</A></H3>
7572 <PRE>
7573 #include &lt;cups/ipp.h&gt;
7574
7575 ipp_t *ipp;
7576
7577 ippAddRange(ipp, IPP_TAG_OPERATION, &quot;page-ranges&quot;, 1, 10);
7578 </PRE>
7579 <H3><A NAME="10_88_6">See Also</A></H3>
7580 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddBooleans">
7581 <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddDate"> <CODE>
7582 ippAddDate()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>ippAddInteger()</CODE>
7583 </A>,<A HREF="#ippAddIntegers"> <CODE>ippAddIntegers()</CODE></A>,<A HREF="#ippAddRanges">
7584 <CODE>ippAddRanges()</CODE></A>,<A HREF="#ippAddResolution"> <CODE>
7585 ippAddResolution()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7586 ippAddResolutions()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7587 ippAddSeparator()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7588 ippAddString()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7589 ippAddStrings()</CODE></A>
7590 <!-- NEW PAGE -->
7591
7592 <H2><A NAME="ippAddRanges">ippAddRanges()</A></H2>
7593 <H3><A NAME="10_89_1">Usage</A></H3>
7594 <PRE>
7595 ipp_attribute_t *
7596 ippAddRanges(ipp_t *ipp,
7597 ipp_tag_t group,
7598 const char *name,
7599 int num_values,
7600 const int *lows,
7601 const int *highs);
7602 </PRE>
7603 <H3><A NAME="10_89_2">Arguments</A></H3>
7604 <CENTER>
7605 <TABLE BORDER WIDTH="80%">
7606 <TR><TH>Argument</TH><TH>Description</TH></TR>
7607 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7608 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7609 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7610 <TR><TD>num_values</TD><TD>The number of range values</TD></TR>
7611 <TR><TD>lows</TD><TD>The lower values</TD></TR>
7612 <TR><TD>highs</TD><TD>The higher values</TD></TR>
7613 </TABLE>
7614 </CENTER>
7615 <H3><A NAME="10_89_3">Returns</A></H3>
7616 <P>A pointer to the new attribute or NULL if the attribute could not be
7617 created.</P>
7618 <H3><A NAME="10_89_4">Description</A></H3>
7619 <P>The <CODE>ippAddRanges()</CODE> function adds one or more range
7620 attribute values to the specified IPP request. If the <CODE>values</CODE>
7621 pointer is <CODE>NULL</CODE> then an array of <CODE>num_values</CODE>
7622 0,0 ranges is created.</P>
7623 <H3><A NAME="10_89_5">Example</A></H3>
7624 <PRE>
7625 #include &lt;cups/ipp.h&gt;
7626
7627 ipp_t *ipp;
7628 int lows[2];
7629 int highs[2];
7630
7631 ippAddRanges(ipp, IPP_TAG_OPERATION, &quot;page-ranges&quot;, 2, lows, highs);
7632 </PRE>
7633 <H3><A NAME="10_89_6">See Also</A></H3>
7634 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddBooleans">
7635 <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddDate"> <CODE>
7636 ippAddDate()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>ippAddInteger()</CODE>
7637 </A>,<A HREF="#ippAddIntegers"> <CODE>ippAddIntegers()</CODE></A>,<A HREF="#ippAddRange">
7638 <CODE>ippAddRange()</CODE></A>,<A HREF="#ippAddResolution"> <CODE>
7639 ippAddResolution()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7640 ippAddResolutions()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7641 ippAddSeparator()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7642 ippAddString()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7643 ippAddStrings()</CODE></A>
7644 <!-- NEW PAGE -->
7645
7646 <H2><A NAME="ippAddResolution">ippAddResolution()</A></H2>
7647 <H3><A NAME="10_90_1">Usage</A></H3>
7648 <PRE>
7649 ipp_attribute_t *
7650 ippAddResolution(ipp_t *ipp,
7651 ipp_tag_t group,
7652 const char *name,
7653 int xres,
7654 int yres,
7655 ipp_res_t units);
7656 </PRE>
7657 <H3><A NAME="10_90_2">Arguments</A></H3>
7658 <CENTER>
7659 <TABLE BORDER WIDTH="80%">
7660 <TR><TH>Argument</TH><TH>Description</TH></TR>
7661 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7662 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7663 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7664 <TR><TD>xres</TD><TD>The horizontal resolution</TD></TR>
7665 <TR><TD>yres</TD><TD>The vertical resolution</TD></TR>
7666 <TR><TD>units</TD><TD>The resolution units</TD></TR>
7667 </TABLE>
7668 </CENTER>
7669 <H3><A NAME="10_90_3">Returns</A></H3>
7670 <P>A pointer to the new attribute or NULL if the attribute could not be
7671 created.</P>
7672 <H3><A NAME="10_90_4">Description</A></H3>
7673 <P>The <CODE>ippAddResolution()</CODE> function adds a single resolution
7674 attribute value to the specified IPP request.</P>
7675 <H3><A NAME="10_90_5">Example</A></H3>
7676 <PRE>
7677 #include &lt;cups/ipp.h&gt;
7678
7679 ipp_t *ipp;
7680
7681 ippAddBoolean(ipp, IPP_TAG_OPERATION, &quot;printer-resolution&quot;,
7682 720, 720, IPP_RES_PER_INCH);
7683 </PRE>
7684 <H3><A NAME="10_90_6">See Also</A></H3>
7685 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddBooleans">
7686 <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddDate"> <CODE>
7687 ippAddDate()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>ippAddInteger()</CODE>
7688 </A>,<A HREF="#ippAddIntegers"> <CODE>ippAddIntegers()</CODE></A>,<A HREF="#ippAddRange">
7689 <CODE>ippAddRange()</CODE></A>,<A HREF="#ippAddRanges"> <CODE>
7690 ippAddRanges()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7691 ippAddResolutions()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7692 ippAddSeparator()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7693 ippAddString()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7694 ippAddStrings()</CODE></A>
7695 <!-- NEW PAGE -->
7696
7697 <H2><A NAME="ippAddResolutions">ippAddResolutions()</A></H2>
7698 <H3><A NAME="10_91_1">Usage</A></H3>
7699 <PRE>
7700 ipp_attribute_t *
7701 ippAddResolutions(ipp_t *ipp,
7702 ipp_tag_t group,
7703 const char *name,
7704 int num_values,
7705 const int *xres,
7706 const int *yres,
7707 const ipp_res_t *units);
7708 </PRE>
7709 <H3><A NAME="10_91_2">Arguments</A></H3>
7710 <CENTER>
7711 <TABLE BORDER WIDTH="80%">
7712 <TR><TH>Argument</TH><TH>Description</TH></TR>
7713 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7714 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7715 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7716 <TR><TD>num_values</TD><TD>The number of resolution values</TD></TR>
7717 <TR><TD>xres</TD><TD>The horizontal resolutions</TD></TR>
7718 <TR><TD>yres</TD><TD>The vertical resolutions</TD></TR>
7719 <TR><TD>units</TD><TD>The resolution units</TD></TR>
7720 </TABLE>
7721 </CENTER>
7722 <H3><A NAME="10_91_3">Returns</A></H3>
7723 <P>A pointer to the new attribute or NULL if the attribute could not be
7724 created.</P>
7725 <H3><A NAME="10_91_4">Description</A></H3>
7726 <P>The <CODE>ippAddResolutions()</CODE> function adds one or more
7727 resolution attribute values to the specified IPP request. If the <CODE>
7728 values</CODE> pointer is <CODE>NULL</CODE> then an array of <CODE>
7729 num_values</CODE> 0,0 resolutions is created.</P>
7730 <H3><A NAME="10_91_5">Example</A></H3>
7731 <PRE>
7732 #include &lt;cups/ipp.h&gt;
7733
7734 ipp_t *ipp;
7735 int xres[5];
7736 int yres[5];
7737 ipp_res_t units[5];
7738
7739 ippAddBoolean(ipp, IPP_TAG_OPERATION, &quot;printer-resolutions-supported&quot;,
7740 5, xres, yres, units);
7741 </PRE>
7742 <H3><A NAME="10_91_6">See Also</A></H3>
7743 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddBooleans">
7744 <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddDate"> <CODE>
7745 ippAddDate()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>ippAddInteger()</CODE>
7746 </A>,<A HREF="#ippAddIntegers"> <CODE>ippAddIntegers()</CODE></A>,<A HREF="#ippAddRange">
7747 <CODE>ippAddRange()</CODE></A>,<A HREF="#ippAddRanges"> <CODE>
7748 ippAddRanges()</CODE></A>,<A HREF="#ippAddResolution"> <CODE>
7749 ippAddResolution()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7750 ippAddSeparator()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7751 ippAddString()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7752 ippAddStrings()</CODE></A>
7753 <!-- NEW PAGE -->
7754
7755 <H2><A NAME="ippAddSeparator">ippAddSeparator()</A></H2>
7756 <H3><A NAME="10_92_1">Usage</A></H3>
7757 <PRE>
7758 ipp_attribute_t *
7759 ippAddSeparator(ipp_t *ipp);
7760 </PRE>
7761 <H3><A NAME="10_92_2">Arguments</A></H3>
7762 <CENTER>
7763 <TABLE BORDER WIDTH="80%">
7764 <TR><TH>Argument</TH><TH>Description</TH></TR>
7765 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7766 </TABLE>
7767 </CENTER>
7768 <H3><A NAME="10_92_3">Returns</A></H3>
7769 <P>A pointer to the new separator or NULL if the separator could not be
7770 created.</P>
7771 <H3><A NAME="10_92_4">Description</A></H3>
7772 <P>The <CODE>ippAddSeparator()</CODE> function adds a group separator to
7773 the specified IPP request.</P>
7774 <H3><A NAME="10_92_5">Example</A></H3>
7775 <PRE>
7776 #include &lt;cups/ipp.h&gt;
7777
7778 ipp_t *ipp;
7779
7780 ippAddSeparator(ipp);
7781 </PRE>
7782 <H3><A NAME="10_92_6">See Also</A></H3>
7783 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddBooleans">
7784 <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddDate"> <CODE>
7785 ippAddDate()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>ippAddInteger()</CODE>
7786 </A>,<A HREF="#ippAddIntegers"> <CODE>ippAddIntegers()</CODE></A>,<A HREF="#ippAddRange">
7787 <CODE>ippAddRange()</CODE></A>,<A HREF="#ippAddRanges"> <CODE>
7788 ippAddRanges()</CODE></A>,<A HREF="#ippAddResolution"> <CODE>
7789 ippAddResolution()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7790 ippAddResolutions()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7791 ippAddString()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7792 ippAddStrings()</CODE></A>
7793 <!-- NEW PAGE -->
7794
7795 <H2><A NAME="ippAddString">ippAddString()</A></H2>
7796 <H3><A NAME="10_93_1">Usage</A></H3>
7797 <PRE>
7798 ipp_attribute_t *
7799 ippAddString(ipp_t *ipp,
7800 ipp_tag_t group,
7801 ipp_tag_t tag,
7802 const char *name,
7803 const char *charset,
7804 const char *value);
7805 </PRE>
7806 <H3><A NAME="10_93_2">Arguments</A></H3>
7807 <CENTER>
7808 <TABLE BORDER WIDTH="80%">
7809 <TR><TH>Argument</TH><TH>Description</TH></TR>
7810 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7811 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7812 <TR><TD>tag</TD><TD>The type of string value</TD></TR>
7813 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7814 <TR><TD>charset</TD><TD>The character set for the string</TD></TR>
7815 <TR><TD>value</TD><TD>The string value</TD></TR>
7816 </TABLE>
7817 </CENTER>
7818 <H3><A NAME="10_93_3">Returns</A></H3>
7819 <P>A pointer to the new attribute or NULL if the attribute could not be
7820 created.</P>
7821 <H3><A NAME="10_93_4">Description</A></H3>
7822 <P>The <CODE>ippAddString()</CODE> function adds a single string
7823 attribute value to the specified IPP request. For <CODE>
7824 IPP_TAG_NAMELANG</CODE> and <CODE>IPP_TAG_TEXTLANG</CODE> strings, the
7825 charset value is provided with the string to identify the string
7826 encoding used. Otherwise the charset value is ignored.</P>
7827 <H3><A NAME="10_93_5">Example</A></H3>
7828 <PRE>
7829 #include &lt;cups/ipp.h&gt;
7830
7831 ipp_t *ipp;
7832
7833 ippAddString(ipp, IPP_TAG_OPERATION, IPP_TAG_NAME, &quot;job-name&quot;,
7834 NULL, &quot;abc123&quot;);
7835 </PRE>
7836 <H3><A NAME="10_93_6">See Also</A></H3>
7837 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddBooleans">
7838 <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddDate"> <CODE>
7839 ippAddDate()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>ippAddInteger()</CODE>
7840 </A>,<A HREF="#ippAddIntegers"> <CODE>ippAddIntegers()</CODE></A>,<A HREF="#ippAddRange">
7841 <CODE>ippAddRange()</CODE></A>,<A HREF="#ippAddRanges"> <CODE>
7842 ippAddRanges()</CODE></A>,<A HREF="#ippAddResolution"> <CODE>
7843 ippAddResolution()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7844 ippAddResolutions()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7845 ippAddSeparator()</CODE></A>,<A HREF="#ippAddStrings"> <CODE>
7846 ippAddStrings()</CODE></A>
7847 <!-- NEW PAGE -->
7848
7849 <H2><A NAME="ippAddStrings">ippAddStrings()</A></H2>
7850 <H3><A NAME="10_94_1">Usage</A></H3>
7851 <PRE>
7852 ipp_attribute_t *
7853 ippAddStrings(ipp_t *ipp,
7854 ipp_tag_t group,
7855 ipp_tag_t tag,
7856 const char *name,
7857 int num_values,
7858 const char *charset,
7859 const char **values);
7860 </PRE>
7861 <H3><A NAME="10_94_2">Arguments</A></H3>
7862 <CENTER>
7863 <TABLE BORDER WIDTH="80%">
7864 <TR><TH>Argument</TH><TH>Description</TH></TR>
7865 <TR><TD>ipp</TD><TD>The IPP request</TD></TR>
7866 <TR><TD>group</TD><TD>The IPP group</TD></TR>
7867 <TR><TD>tag</TD><TD>The type of string value</TD></TR>
7868 <TR><TD>name</TD><TD>The name of attribute</TD></TR>
7869 <TR><TD>num_values</TD><TD>The number of strings</TD></TR>
7870 <TR><TD>charset</TD><TD>The character set for the strings</TD></TR>
7871 <TR><TD>values</TD><TD>The string values</TD></TR>
7872 </TABLE>
7873 </CENTER>
7874 <H3><A NAME="10_94_3">Returns</A></H3>
7875 <P>A pointer to the new attribute or NULL if the attribute could not be
7876 created.</P>
7877 <H3><A NAME="10_94_4">Description</A></H3>
7878 <P>The <CODE>ippAddStrings()</CODE> function adds one or more string
7879 attribute values to the specified IPP request. For <CODE>
7880 IPP_TAG_NAMELANG</CODE> and <CODE>IPP_TAG_TEXTLANG</CODE> strings, the
7881 charset value is provided with the strings to identify the string
7882 encoding used. Otherwise the charset value is ignored. If the <CODE>
7883 values</CODE> pointer is <CODE>NULL</CODE> then an array of <CODE>
7884 num_values</CODE> NULL strings is created.</P>
7885 <H3><A NAME="10_94_5">Example</A></H3>
7886 <PRE>
7887 #include &lt;cups/ipp.h&gt;
7888
7889 ipp_t *ipp;
7890 char *values[2] = { &quot;one&quot;, &quot;two&quot; };
7891
7892 ippAddStrings(ipp, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, &quot;attr-name&quot;,
7893 2, NULL, values);
7894 </PRE>
7895 <H3><A NAME="10_94_6">See Also</A></H3>
7896 <A HREF="#ippAddBoolean"> <CODE>ippAddBoolean()</CODE></A>,<A HREF="#ippAddBooleans">
7897 <CODE>ippAddBooleans()</CODE></A>,<A HREF="#ippAddDate"> <CODE>
7898 ippAddDate()</CODE></A>,<A HREF="#ippAddInteger"> <CODE>ippAddInteger()</CODE>
7899 </A>,<A HREF="#ippAddIntegers"> <CODE>ippAddIntegers()</CODE></A>,<A HREF="#ippAddRange">
7900 <CODE>ippAddRange()</CODE></A>,<A HREF="#ippAddRanges"> <CODE>
7901 ippAddRanges()</CODE></A>,<A HREF="#ippAddResolution"> <CODE>
7902 ippAddResolution()</CODE></A>,<A HREF="#ippAddResolutions"> <CODE>
7903 ippAddResolutions()</CODE></A>,<A HREF="#ippAddSeparator"> <CODE>
7904 ippAddSeparator()</CODE></A>,<A HREF="#ippAddString"> <CODE>
7905 ippAddString()</CODE></A>
7906 <!-- NEW PAGE -->
7907
7908 <H2><A NAME="ippDateToTime">ippDateToTime()</A></H2>
7909 <H3><A NAME="10_95_1">Usage</A></H3>
7910 <PRE>
7911 time_t
7912 ippDateToTime(const ipp_uchar_t date[11]);
7913 </PRE>
7914 <H3><A NAME="10_95_2">Arguments</A></H3>
7915 <CENTER>
7916 <TABLE BORDER WIDTH="80%">
7917 <TR><TH>Argument</TH><TH>Description</TH></TR>
7918 <TR><TD>date</TD><TD>The IPP date-time value</TD></TR>
7919 </TABLE>
7920 </CENTER>
7921 <H3><A NAME="10_95_3">Returns</A></H3>
7922 <P>A UNIX time value.</P>
7923 <H3><A NAME="10_95_4">Description</A></H3>
7924 <P>The <CODE>ippDateToTime()</CODE> function converts an IPP date-time
7925 value to a UNIX time value.</P>
7926 <H3><A NAME="10_95_5">Example</A></H3>
7927 <PRE>
7928 #include &lt;cups/ipp.h&gt;
7929
7930 ipp_uchar_t date[11];
7931
7932 printf(&quot;UNIX time is %d\n&quot;, ippDateToTime(date));
7933 </PRE>
7934 <H3><A NAME="10_95_6">See Also</A></H3>
7935 <A HREF="#ippTimeToDate"> <CODE>ippTimeToDate()</CODE></A>
7936 <!-- NEW PAGE -->
7937
7938 <H2><A NAME="ippDelete">ippDelete()</A></H2>
7939 <H3><A NAME="10_96_1">Usage</A></H3>
7940 <PRE>
7941 void
7942 ippDelete(ipp_t *ipp);
7943 </PRE>
7944 <H3><A NAME="10_96_2">Arguments</A></H3>
7945 <CENTER>
7946 <TABLE BORDER WIDTH="80%">
7947 <TR><TH>Argument</TH><TH>Description</TH></TR>
7948 <TR><TD>ipp</TD><TD>The IPP request or response</TD></TR>
7949 </TABLE>
7950 </CENTER>
7951 <H3><A NAME="10_96_3">Description</A></H3>
7952 <P>The <CODE>ippDelete()</CODE> function deletes all memory used by an
7953 IPP request or response.</P>
7954 <H3><A NAME="10_96_4">Example</A></H3>
7955 <PRE>
7956 #include &lt;cups/ipp.h&gt;
7957
7958 ipp_t *ipp;
7959
7960 ippDelete(ipp);
7961 </PRE>
7962 <H3><A NAME="10_96_5">See Also</A></H3>
7963 <A HREF="#ippNew"> <CODE>ippNew()</CODE></A>
7964 <!-- NEW PAGE -->
7965
7966 <H2><A NAME="ippErrorString">ippErrorString()</A></H2>
7967 <H3><A NAME="10_97_1">Usage</A></H3>
7968 <PRE>
7969 const char *
7970 ippErrorString(ipp_status_t error);
7971 </PRE>
7972 <H3><A NAME="10_97_2">Arguments</A></H3>
7973 <CENTER>
7974 <TABLE BORDER WIDTH="80%">
7975 <TR><TH>Argument</TH><TH>Description</TH></TR>
7976 <TR><TD>error</TD><TD>IPP error code.</TD></TR>
7977 </TABLE>
7978 </CENTER>
7979 <H3><A NAME="10_97_3">Returns</A></H3>
7980 <P>The standard text representation of the IPP error code.</P>
7981 <H3><A NAME="10_97_4">Description</A></H3>
7982 <P><CODE>ippErrorString()</CODE> returns the standard text
7983 representation of the IPP error code.</P>
7984 <H3><A NAME="10_97_5">Example</A></H3>
7985 <PRE>
7986 #include &lt;cups/ipp.h&gt;
7987
7988 puts(ippErrorString(IPP_OK));
7989 </PRE>
7990 <H3><A NAME="10_97_6">See Also</A></H3>
7991 <P><A HREF="#cupsLastError"> <CODE>cupsLastError()</CODE></A>
7992 <!-- NEW PAGE -->
7993 </P>
7994 <H2><A NAME="ippFindAttribute">ippFindAttribute()</A></H2>
7995 <H3><A NAME="10_98_1">Usage</A></H3>
7996 <PRE>
7997 ipp_attribute_t *
7998 ippFindAttribute(ipp_t *ipp,
7999 const char *name,
8000 ipp_tag_t tag);
8001 </PRE>
8002 <H3><A NAME="10_98_2">Arguments</A></H3>
8003 <CENTER>
8004 <TABLE BORDER WIDTH="80%">
8005 <TR><TH>Argument</TH><TH>Description</TH></TR>
8006 <TR><TD>ipp</TD><TD>The IPP request or response</TD></TR>
8007 <TR><TD>name</TD><TD>The name of the attribute</TD></TR>
8008 <TR><TD>tag</TD><TD>The required value tag for the attribute or <CODE>
8009 IPP_TAG_ZERO</CODE> for any type of value.</TD></TR>
8010 </TABLE>
8011 </CENTER>
8012 <H3><A NAME="10_98_3">Returns</A></H3>
8013 <P>A pointer to the first occurrence of the requested attribute, or <CODE>
8014 NULL</CODE> if it was not found.</P>
8015 <H3><A NAME="10_98_4">Description</A></H3>
8016 <P><CODE>ippFindAttribute()</CODE> finds the first occurrence of the
8017 named attribute. The <CODE>tag</CODE> parameter restricts the search to
8018 a specific value type - use <CODE>IPP_TAG_ZERO</CODE> to find any value
8019 with the name.</P>
8020 <P>The value tags <CODE>IPP_TAG_NAME</CODE> and <CODE>IPP_TAG_TEXT</CODE>
8021 match the name/text values with or without the language code.</P>
8022 <H3><A NAME="10_98_5">Example</A></H3>
8023 <PRE>
8024 <A HREF="#ipp_attribute_t">ipp_attribute_t</A> *attr;
8025
8026 attr = ippFindAttribute(response, &quot;printer-state-message&quot;, IPP_TAG_TEXT);
8027 while (attr != NULL)
8028 {
8029 puts(attr-&gt;values[0].string.text);
8030
8031 attr = ippFindNextAttribute(response, &quot;printer-state-message&quot;, IPP_TAG_TEXT);
8032 }
8033 </PRE>
8034 <H3><A NAME="10_98_6">See Also</A></H3>
8035 <A HREF="#cupsDoFileRequest"> <CODE>cupsDoFileRequest()</CODE></A>,<A HREF="#cupsDoRequest">
8036 <CODE>cupsDoRequest()</CODE></A>,<A HREF="#ippDelete"> <CODE>
8037 ippDelete()</CODE></A>,<A HREF="#ippFindNextAttribute"> <CODE>
8038 ippFindNextAttribute()</CODE></A>,<A HREF="#ippNew"> <CODE>ippNew()</CODE>
8039 </A>
8040 <!-- NEW PAGE -->
8041
8042 <H2><A NAME="ippFindNextAttribute">ippFindNextAttribute()</A></H2>
8043 <H3><A NAME="10_99_1">Usage</A></H3>
8044 <PRE>
8045 ipp_attribute_t *
8046 ippFindNextAttribute(ipp_t *ipp,
8047 const char *name,
8048 ipp_tag_t tag);
8049 </PRE>
8050 <H3><A NAME="10_99_2">Arguments</A></H3>
8051 <CENTER>
8052 <TABLE BORDER WIDTH="80%">
8053 <TR><TH>Argument</TH><TH>Description</TH></TR>
8054 <TR><TD>ipp</TD><TD>The IPP request or response</TD></TR>
8055 <TR><TD>name</TD><TD>The name of the attribute</TD></TR>
8056 <TR><TD>tag</TD><TD>The required value tag for the attribute or <CODE>
8057 IPP_TAG_ZERO</CODE> for any type of value.</TD></TR>
8058 </TABLE>
8059 </CENTER>
8060 <H3><A NAME="10_99_3">Returns</A></H3>
8061 <P>A pointer to the next occurrence of the requested attribute, or <CODE>
8062 NULL</CODE> if it was not found.</P>
8063 <H3><A NAME="10_99_4">Description</A></H3>
8064 <P><CODE>ippFindNextAttribute()</CODE> finds the next occurrence of the
8065 named attribute. The <CODE>tag</CODE> parameter restricts the search to
8066 a specific value type - use <CODE>IPP_TAG_ZERO</CODE> to find any value
8067 with the name.</P>
8068 <P>The value tags <CODE>IPP_TAG_NAME</CODE> and <CODE>IPP_TAG_TEXT</CODE>
8069 match the name/text values with or without the language code.</P>
8070 <H3><A NAME="10_99_5">Example</A></H3>
8071 <PRE>
8072 <A HREF="#ipp_attribute_t">ipp_attribute_t</A> *attr;
8073
8074 attr = ippFindAttribute(response, &quot;printer-state-message&quot;, IPP_TAG_TEXT);
8075 while (attr != NULL)
8076 {
8077 puts(attr-&gt;values[0].string.text);
8078
8079 attr = ippFindNextAttribute(response, &quot;printer-state-message&quot;, IPP_TAG_TEXT);
8080 }
8081 </PRE>
8082 <H3><A NAME="10_99_6">See Also</A></H3>
8083 <A HREF="#cupsDoFileRequest"> <CODE>cupsDoFileRequest()</CODE></A>,<A HREF="#cupsDoRequest">
8084 <CODE>cupsDoRequest()</CODE></A>,<A HREF="#ippDelete"> <CODE>
8085 ippDelete()</CODE></A>,<A HREF="#ippFindNextAttribute"> <CODE>
8086 ippFindNextAttribute()</CODE></A>,<A HREF="#ippNew"> <CODE>ippNew()</CODE>
8087 </A>
8088 <!-- NEW PAGE -->
8089
8090 <H2><A NAME="ippLength">ippLength()</A></H2>
8091 <H3><A NAME="10_100_1">Usage</A></H3>
8092 <PRE>
8093 int
8094 ippLength(ipp_t *ipp);
8095 </PRE>
8096 <H3><A NAME="10_100_2">Arguments</A></H3>
8097 <CENTER>
8098 <TABLE BORDER WIDTH="80%">
8099 <TR><TH>Argument</TH><TH>Description</TH></TR>
8100 <TR><TD>ipp</TD><TD>The IPP request or response</TD></TR>
8101 </TABLE>
8102 </CENTER>
8103 <H3><A NAME="10_100_3">Returns</A></H3>
8104 <P>The total encoded length of the IPP request or response in bytes.</P>
8105 <H3><A NAME="10_100_4">Description</A></H3>
8106 <P><CODE>ippLength()</CODE> returns the length of the IPP request or
8107 response in bytes.</P>
8108 <H3><A NAME="10_100_5">Example</A></H3>
8109 <PRE>
8110 printf(&quot;The length of the response is %d bytes.\n&quot;, ippLength(response));
8111 </PRE>
8112 <H3><A NAME="10_100_6">See Also</A></H3>
8113 <A HREF="#ippDelete"> <CODE>ippDelete()</CODE></A>,<A HREF="#ippNew"> <CODE>
8114 ippNew()</CODE></A>
8115 <!-- NEW PAGE -->
8116
8117 <H2><A NAME="ippNew">ippNew()</A></H2>
8118 <H3><A NAME="10_101_1">Usage</A></H3>
8119 <PRE>
8120 ipp_t *
8121 ippNew(void);
8122 </PRE>
8123 <H3><A NAME="10_101_2">Returns</A></H3>
8124 <P>A pointer to a new IPP request or response.</P>
8125 <H3><A NAME="10_101_3">Description</A></H3>
8126 <P>The <CODE>ippNew()</CODE> function creates a new IPP request or
8127 response.</P>
8128 <H3><A NAME="10_101_4">Example</A></H3>
8129 <PRE>
8130 #include &lt;cups/ipp.h&gt;
8131
8132 ipp_t *ipp;
8133
8134 ipp = ippNew();
8135 </PRE>
8136 <H3><A NAME="10_101_5">See Also</A></H3>
8137 <A HREF="#ippDelete"> <CODE>ippDelete()</CODE></A>
8138 <!-- NEW PAGE -->
8139
8140 <H2><A NAME="ippPort">ippPort()</A></H2>
8141 <H3><A NAME="10_102_1">Usage</A></H3>
8142 <PRE>
8143 int
8144 ippPort(void);
8145 </PRE>
8146 <H3><A NAME="10_102_2">Returns</A></H3>
8147 <P>The default TCP/IP port number for IPP requests.</P>
8148 <H3><A NAME="10_102_3">Description</A></H3>
8149 <P>The <CODE>ippPort()</CODE> function returns the default IPP port
8150 number for requests.</P>
8151 <H3><A NAME="10_102_4">Example</A></H3>
8152 <PRE>
8153 #include &lt;cups/http.h&gt;
8154 #include &lt;cups/ipp.h&gt;
8155
8156 http_t *http;
8157
8158 http = httpConnect(cupsServer(), ippPort());
8159 </PRE>
8160 <H3><A NAME="10_102_5">See Also</A></H3>
8161 <A HREF="#cupsServer"> <CODE>cupsServer()</CODE></A>,<A HREF="#ippSetPort">
8162 <CODE>ippSetPort()</CODE></A>
8163 <!-- NEW PAGE -->
8164
8165 <H2><A NAME="ippRead">ippRead()</A></H2>
8166 <H3><A NAME="10_103_1">Usage</A></H3>
8167 <PRE>
8168 ipp_state_t
8169 ippRead(http_t *http,
8170 ipp_t *ipp);
8171 </PRE>
8172 <H3><A NAME="10_103_2">Arguments</A></H3>
8173 <CENTER>
8174 <TABLE BORDER WIDTH="80%">
8175 <TR><TH>Argument</TH><TH>Description</TH></TR>
8176 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
8177 <TR><TD>ipp</TD><TD>The IPP request or response</TD></TR>
8178 </TABLE>
8179 </CENTER>
8180 <H3><A NAME="10_103_3">Returns</A></H3>
8181 <P>The current read state.</P>
8182 <H3><A NAME="10_103_4">Description</A></H3>
8183 <P>The <CODE>ippRead()</CODE> function reads IPP attributes from the
8184 specified HTTP connection. Programs should continue calling <CODE>
8185 ippRead()</CODE> until <CODE>IPP_ERROR</CODE> or <CODE>IPP_DATA</CODE>
8186 is returned.</P>
8187 <H3><A NAME="10_103_5">Example</A></H3>
8188 <PRE>
8189 #include &lt;cups/http.h&gt;
8190 #include &lt;cups/ipp.h&gt;
8191
8192 http_t *http;
8193 ipp_t *ipp;
8194 ipp_state_t status;
8195
8196 ipp = ippNew();
8197
8198 while ((status = ippRead(http, ipp)) != IPP_ERROR)
8199 if (status == IPP_DATA)
8200 break;
8201
8202 if (status == IPP_DATA)
8203 {
8204 ... read additional non-IPP data using httpRead() ...
8205 }
8206 </PRE>
8207 <H3><A NAME="10_103_6">See Also</A></H3>
8208 <A HREF="#ippWrite"> <CODE>ippWrite()</CODE></A>
8209 <!-- NEW PAGE -->
8210
8211 <H2><A NAME="ippSetPort">ippSetPort()</A></H2>
8212 <H3><A NAME="10_104_1">Usage</A></H3>
8213 <PRE>
8214 void
8215 ippSetPort(int port);
8216 </PRE>
8217 <H3><A NAME="10_104_2">Arguments</A></H3>
8218 <CENTER>
8219 <TABLE BORDER WIDTH="80%">
8220 <TR><TH>Argument</TH><TH>Description</TH></TR>
8221 <TR><TD>port</TD><TD>The port number to use</TD></TR>
8222 </TABLE>
8223 </CENTER>
8224 <H3><A NAME="10_104_3">Description</A></H3>
8225 <P>The <CODE>ippSetPort()</CODE> function sets the default IPP port
8226 number for requests.</P>
8227 <H3><A NAME="10_104_4">Example</A></H3>
8228 <PRE>
8229 #include &lt;cups/http.h&gt;
8230 #include &lt;cups/ipp.h&gt;
8231
8232 ...
8233
8234 ippSetPort(8631);
8235 </PRE>
8236 <H3><A NAME="10_104_5">See Also</A></H3>
8237 <A HREF="#ippPort"> <CODE>ippPort()</CODE></A>
8238 <!-- NEW PAGE -->
8239
8240 <H2><A NAME="ippTimeToDate">ippTimeToDate()</A></H2>
8241 <H3><A NAME="10_105_1">Usage</A></H3>
8242 <PRE>
8243 ipp_uchar_t *
8244 ippTimeToDate(time_t time);
8245 </PRE>
8246 <H3><A NAME="10_105_2">Arguments</A></H3>
8247 <CENTER>
8248 <TABLE BORDER WIDTH="80%">
8249 <TR><TH>Argument</TH><TH>Description</TH></TR>
8250 <TR><TD>time</TD><TD>The UNIX time value</TD></TR>
8251 </TABLE>
8252 </CENTER>
8253 <H3><A NAME="10_105_3">Returns</A></H3>
8254 <P>A static pointer to an IPP date-time value.</P>
8255 <H3><A NAME="10_105_4">Description</A></H3>
8256 <P>The <CODE>ippTimeToDate()</CODE> function converts a UNIX time to an
8257 IPP date-time value.</P>
8258 <H3><A NAME="10_105_5">Example</A></H3>
8259 <PRE>
8260 #include &lt;cups/ipp.h&gt;
8261
8262 ipp_uchar_t *date;
8263
8264 date = ippTimeToDate(time(NULL));
8265 </PRE>
8266 <H3><A NAME="10_105_6">See Also</A></H3>
8267 <A HREF="#ippDateToTime"> <CODE>ippDateToTime()</CODE></A>
8268 <!-- NEW PAGE -->
8269
8270 <H2><A NAME="ippWrite">ippWrite()</A></H2>
8271 <H3><A NAME="10_106_1">Usage</A></H3>
8272 <PRE>
8273 ipp_state_t
8274 ippWrite(http_t *http,
8275 ipp_t *ipp);
8276 </PRE>
8277 <H3><A NAME="10_106_2">Arguments</A></H3>
8278 <CENTER>
8279 <TABLE BORDER WIDTH="80%">
8280 <TR><TH>Argument</TH><TH>Description</TH></TR>
8281 <TR><TD>http</TD><TD>The HTTP connection</TD></TR>
8282 <TR><TD>ipp</TD><TD>The IPP request or response</TD></TR>
8283 </TABLE>
8284 </CENTER>
8285 <H3><A NAME="10_106_3">Returns</A></H3>
8286 <P>The current write state.</P>
8287 <H3><A NAME="10_106_4">Description</A></H3>
8288 <P>The <CODE>ippWrite()</CODE> function writes IPP attributes to the
8289 specified HTTP connection. Programs should continue calling <CODE>
8290 ippWrite()</CODE> until <CODE>IPP_ERROR</CODE> or <CODE>IPP_DATA</CODE>
8291 is returned.</P>
8292 <H3><A NAME="10_106_5">Example</A></H3>
8293 <PRE>
8294 #include &lt;cups/http.h&gt;
8295 #include &lt;cups/ipp.h&gt;
8296
8297 http_t *http;
8298 ipp_t *ipp;
8299 ipp_state_t status;
8300
8301 ipp = ippNew();
8302 ... add attributes ...
8303
8304 while ((status = ippWrite(http, ipp)) != IPP_ERROR)
8305 if (status == IPP_DATA)
8306 break;
8307
8308 if (status == IPP_DATA)
8309 {
8310 ... read additional non-IPP data using httpWrite() ...
8311 }
8312 </PRE>
8313 <H3><A NAME="10_106_6">See Also</A></H3>
8314 <A HREF="#ippRead"> <CODE>ippRead()</CODE></A>
8315 <!-- NEW PAGE -->
8316
8317 <H2><A NAME="ppdClose">ppdClose()</A></H2>
8318 <H3><A NAME="10_107_1">Usage</A></H3>
8319 <PRE>
8320 void
8321 ppdClose(ppd_file_t *ppd);
8322 </PRE>
8323 <H3><A NAME="10_107_2">Arguments</A></H3>
8324 <CENTER>
8325 <TABLE BORDER WIDTH="80%">
8326 <TR><TH>Argument</TH><TH>Description</TH></TR>
8327 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8328 </TABLE>
8329 </CENTER>
8330 <H3><A NAME="10_107_3">Description</A></H3>
8331 <P>The <CODE>ppdClose()</CODE> function frees all memory associated with
8332 the PPD file.</P>
8333 <H3><A NAME="10_107_4">Example</A></H3>
8334 <PRE>
8335 #include &lt;cups/ppd.h&gt;
8336
8337 ppd_file_t *ppd;
8338
8339 ppdClose(ppd);
8340 </PRE>
8341 <H3><A NAME="10_107_5">See Also</A></H3>
8342 <A HREF="#ppdOpen"> <CODE>ppdOpen()</CODE></A>,<A HREF="#ppdOpenFd"> <CODE>
8343 ppdOpenFd()</CODE></A>,<A HREF="#ppdOpenFile"> <CODE>ppdOpenFile()</CODE>
8344 </A>
8345 <!-- NEW PAGE -->
8346
8347 <H2><A NAME="ppdCollect">ppdCollect()</A></H2>
8348 <H3><A NAME="10_108_1">Usage</A></H3>
8349 <PRE>
8350 int
8351 ppdCollect(ppd_file_t *ppd,
8352 ppd_section_t section,
8353 ppd_choice_t ***choices);
8354 </PRE>
8355 <H3><A NAME="10_108_2">Arguments</A></H3>
8356 <CENTER>
8357 <TABLE BORDER WIDTH="80%">
8358 <TR><TH>Argument</TH><TH>Description</TH></TR>
8359 <TR><TD>ppd</TD><TD>The PPD file.</TD></TR>
8360 <TR><TD>section</TD><TD>The document section to collect.</TD></TR>
8361 <TR><TD>choices</TD><TD>The array of option choices that are marked.</TD>
8362 </TR>
8363 </TABLE>
8364 </CENTER>
8365 <H3><A NAME="10_108_3">Returns</A></H3>
8366 <P>The number of options collected.</P>
8367 <H3><A NAME="10_108_4">Description</A></H3>
8368 <P><CODE>ppdCollect()</CODE> collects all of the marked options in the
8369 specified section, sorts them by their order dependency values, and
8370 returns an array that can be used to emit option commands in the proper
8371 order. It is normally used by the <CODE>ppdEmit*()</CODE> functions.</P>
8372 <H3><A NAME="10_108_5">Example</A></H3>
8373 <PRE>
8374 #include &lt;cups/ppd.h&gt;
8375
8376 <A HREF="#ppd_file_t">ppd_file_t</A> *ppd;
8377 int num_choices;
8378 <A HREF="#ppd_choice_t">ppd_choice_t</A> **choices;
8379
8380 ...
8381
8382 num_choices = ppdCollect(ppd, PPD_ORDER_JCL, &amp;choices);
8383 </PRE>
8384 <H3><A NAME="10_108_6">See Also</A></H3>
8385 <P><A HREF="#ppdEmit"> <CODE>ppdEmit()</CODE></A>,<A HREF="#ppdEmitFd"> <CODE>
8386 ppdEmitFd()</CODE></A>,<A HREF="#ppdEmitJCL"> <CODE>ppdEmitJCL()</CODE></A>
8387 <!-- NEW PAGE -->
8388
8389 </P>
8390 <H2><A NAME="ppdConflicts">ppdConflicts()</A></H2>
8391 <H3><A NAME="10_109_1">Usage</A></H3>
8392 <PRE>
8393 int
8394 ppdConflicts(ppd_file_t *ppd);
8395 </PRE>
8396 <H3><A NAME="10_109_2">Arguments</A></H3>
8397 <CENTER>
8398 <TABLE BORDER WIDTH="80%">
8399 <TR><TH>Argument</TH><TH>Description</TH></TR>
8400 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8401 </TABLE>
8402 </CENTER>
8403 <H3><A NAME="10_109_3">Returns</A></H3>
8404 <P>The number of option conflicts in the file.</P>
8405 <H3><A NAME="10_109_4">Description</A></H3>
8406 <P>The <CODE>ppdConflicts()</CODE> function returns the number of
8407 conflicts with the currently selected options.</P>
8408 <H3><A NAME="10_109_5">Example</A></H3>
8409 <PRE>
8410 #include &lt;cups/ppd.h&gt;
8411
8412 ppd_file_t *ppd;
8413
8414 printf(&quot;%d conflicts\n&quot;, ppdConflicts(ppd));
8415 </PRE>
8416 <H3><A NAME="10_109_6">See Also</A></H3>
8417 <A HREF="#cupsMarkOptions"> <CODE>cupsMarkOptions()</CODE></A>,<A HREF="#ppdIsMarked">
8418 <CODE>ppdIsMarked()</CODE></A>,<A HREF="#ppdMarkDefaults"> <CODE>
8419 ppdMarkDefaults()</CODE></A>,<A HREF="#ppdMarkOption"> <CODE>
8420 ppdMarkOption()</CODE></A>
8421 <!-- NEW PAGE -->
8422
8423 <H2><A NAME="ppdEmit">ppdEmit()</A></H2>
8424 <H3><A NAME="10_110_1">Usage</A></H3>
8425 <PRE>
8426 int
8427 ppdEmit(ppd_file_t *ppd,
8428 FILE *file,
8429 ppd_section_t section);
8430 </PRE>
8431 <H3><A NAME="10_110_2">Arguments</A></H3>
8432 <CENTER>
8433 <TABLE BORDER WIDTH="80%">
8434 <TR><TH>Argument</TH><TH>Description</TH></TR>
8435 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8436 <TR><TD>file</TD><TD>The file to write to</TD></TR>
8437 <TR><TD>section</TD><TD>The option section to write</TD></TR>
8438 </TABLE>
8439 </CENTER>
8440 <H3><A NAME="10_110_3">Returns</A></H3>
8441 <P>0 on success, -1 on error.</P>
8442 <H3><A NAME="10_110_4">Description</A></H3>
8443 <P>The <CODE>ppdEmit()</CODE> function sends printer-specific option
8444 commands to the specified file.</P>
8445 <H3><A NAME="10_110_5">Example</A></H3>
8446 <PRE>
8447 #include &lt;cups/ppd.h&gt;
8448
8449 ppd_file_t *ppd;
8450
8451 ppdEmit(ppd, stdout, PPD_ORDER_PAGE);
8452 </PRE>
8453 <H3><A NAME="10_110_6">See Also</A></H3>
8454 <A HREF="#ppdEmitFd"> <CODE>ppdEmitFd()</CODE></A>
8455 <!-- NEW PAGE -->
8456
8457 <H2><A NAME="ppdEmitFd">ppdEmitFd()</A></H2>
8458 <H3><A NAME="10_111_1">Usage</A></H3>
8459 <PRE>
8460 int
8461 ppdEmitFd(ppd_file_t *ppd,
8462 int fd,
8463 ppd_section_t section);
8464 </PRE>
8465 <H3><A NAME="10_111_2">Arguments</A></H3>
8466 <CENTER>
8467 <TABLE BORDER WIDTH="80%">
8468 <TR><TH>Argument</TH><TH>Description</TH></TR>
8469 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8470 <TR><TD>fd</TD><TD>The file descriptor to write to</TD></TR>
8471 <TR><TD>section</TD><TD>The option section to write</TD></TR>
8472 </TABLE>
8473 </CENTER>
8474 <H3><A NAME="10_111_3">Returns</A></H3>
8475 <P>0 on success, -1 on error.</P>
8476 <H3><A NAME="10_111_4">Description</A></H3>
8477 <P>The <CODE>ppdEmitFd()</CODE> function sends printer-specific option
8478 commands to the specified file descriptor.</P>
8479 <H3><A NAME="10_111_5">Example</A></H3>
8480 <PRE>
8481 #include &lt;cups/ppd.h&gt;
8482
8483 ppd_file_t *ppd;
8484
8485 ppdEmitFd(ppd, 1, PPD_ORDER_PAGE);
8486 </PRE>
8487 <H3><A NAME="10_111_6">See Also</A></H3>
8488 <A HREF="#ppdEmit"> <CODE>ppdEmit()</CODE></A>
8489 <!-- NEW PAGE -->
8490
8491 <H2><A NAME="ppdFindChoice">ppdFindChoice()</A></H2>
8492 <H3><A NAME="10_112_1">Usage</A></H3>
8493 <PRE>
8494 ppd_choice_t *
8495 ppdFindChoice(ppd_option_t *option,
8496 const char *choice);
8497 </PRE>
8498 <H3><A NAME="10_112_2">Arguments</A></H3>
8499 <CENTER>
8500 <TABLE BORDER WIDTH="80%">
8501 <TR><TH>Argument</TH><TH>Description</TH></TR>
8502 <TR><TD>option</TD><TD>A pointer to the option</TD></TR>
8503 <TR><TD>choice</TD><TD>The name of the choice</TD></TR>
8504 </TABLE>
8505 </CENTER>
8506 <H3><A NAME="10_112_3">Returns</A></H3>
8507 <P>A pointer to the choice data or NULL if the choice does not exist.</P>
8508 <H3><A NAME="10_112_4">Description</A></H3>
8509 <P>The <CODE>ppdFindChoice()</CODE> function returns a pointer to the
8510 choice data for the specified option.</P>
8511 <H3><A NAME="10_112_5">Example</A></H3>
8512 <PRE>
8513 #include &lt;cups/ppd.h&gt;
8514
8515 ppd_file_t *ppd;
8516 ppd_option_t *option;
8517 ppd_choice_t *choice;
8518
8519 option = ppdFindOption(ppd, &quot;PageSize&quot;);
8520 choice = ppdFindChoice(option, &quot;Letter&quot;);
8521 </PRE>
8522 <H3><A NAME="10_112_6">See Also</A></H3>
8523 <A HREF="#ppdFindMarkedChoice"> <CODE>ppdFindMarkedChoice()</CODE></A>,<A
8524 HREF="#ppdFindOption"> <CODE>ppdFindOption()</CODE></A>
8525 <!-- NEW PAGE -->
8526
8527 <H2><A NAME="ppdFindMarkedChoice">ppdFindMarkedChoice()</A></H2>
8528 <H3><A NAME="10_113_1">Usage</A></H3>
8529 <PRE>
8530 ppd_choice_t *
8531 ppdFindMarkedChoice(ppd_file_t *ppd,
8532 const char *keyword);
8533 </PRE>
8534 <H3><A NAME="10_113_2">Arguments</A></H3>
8535 <CENTER>
8536 <TABLE BORDER WIDTH="80%">
8537 <TR><TH>Argument</TH><TH>Description</TH></TR>
8538 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8539 <TR><TD>keyword</TD><TD>The name of the option</TD></TR>
8540 </TABLE>
8541 </CENTER>
8542 <H3><A NAME="10_113_3">Returns</A></H3>
8543 <P>A pointer to the choice data or NULL if the choice does not exist or
8544 is not marked.</P>
8545 <H3><A NAME="10_113_4">Description</A></H3>
8546 <P>The <CODE>ppdFindMarkedChoice()</CODE> function returns a pointer to
8547 the marked choice data for the specified option.</P>
8548 <H3><A NAME="10_113_5">Example</A></H3>
8549 <PRE>
8550 #include &lt;cups/ppd.h&gt;
8551
8552 ppd_file_t *ppd;
8553 ppd_choice_t *choice;
8554
8555 choice = ppdFindMarkedChoice(ppd, &quot;PageSize&quot;);
8556 </PRE>
8557 <H3><A NAME="10_113_6">See Also</A></H3>
8558 <A HREF="#ppdFindChoice"> <CODE>ppdFindChoice()</CODE></A>,<A HREF="#ppdFindOption">
8559 <CODE>ppdFindOption()</CODE></A>
8560 <!-- NEW PAGE -->
8561
8562 <H2><A NAME="ppdFindOption">ppdFindOption()</A></H2>
8563 <H3><A NAME="10_114_1">Usage</A></H3>
8564 <PRE>
8565 ppd_option_t *
8566 ppdFindOption(ppd_file_t *ppd,
8567 const char *keyword);
8568 </PRE>
8569 <H3><A NAME="10_114_2">Arguments</A></H3>
8570 <CENTER>
8571 <TABLE BORDER WIDTH="80%">
8572 <TR><TH>Argument</TH><TH>Description</TH></TR>
8573 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8574 <TR><TD>keyword</TD><TD>The name of the option</TD></TR>
8575 </TABLE>
8576 </CENTER>
8577 <H3><A NAME="10_114_3">Returns</A></H3>
8578 <P>A pointer to the option data or NULL if the option does not exist.</P>
8579 <H3><A NAME="10_114_4">Description</A></H3>
8580 <P>The <CODE>ppdFindOption()</CODE> function returns a pointer to the
8581 option data for the specified option.</P>
8582 <H3><A NAME="10_114_5">Example</A></H3>
8583 <PRE>
8584 #include &lt;cups/ppd.h&gt;
8585
8586 ppd_file_t *ppd;
8587 ppd_option_t *option;
8588
8589 option = ppdFindOption(ppd, &quot;PageSize&quot;);
8590 </PRE>
8591 <H3><A NAME="10_114_6">See Also</A></H3>
8592 <A HREF="#ppdFindChoice"> <CODE>ppdFindChoice()</CODE></A>,<A HREF="#ppdFindMarkedChoice">
8593 <CODE>ppdFindMarkedChoice()</CODE></A>
8594 <!-- NEW PAGE -->
8595
8596 <H2><A NAME="ppdIsMarked">ppdIsMarked()</A></H2>
8597 <H3><A NAME="10_115_1">Usage</A></H3>
8598 <PRE>
8599 int
8600 ppdIsMarked(ppd_file_t *ppd,
8601 const char *keyword,
8602 const char *choice);
8603 </PRE>
8604 <H3><A NAME="10_115_2">Arguments</A></H3>
8605 <CENTER>
8606 <TABLE BORDER WIDTH="80%">
8607 <TR><TH>Argument</TH><TH>Description</TH></TR>
8608 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8609 <TR><TD>keyword</TD><TD>The name of the option</TD></TR>
8610 <TR><TD>choice</TD><TD>The name of the option choice</TD></TR>
8611 </TABLE>
8612 </CENTER>
8613 <H3><A NAME="10_115_3">Returns</A></H3>
8614 <P>1 if the choice is marked, 0 otherwise.</P>
8615 <H3><A NAME="10_115_4">Description</A></H3>
8616 <P>The <CODE>ppdIsMarked()</CODE> function returns whether or not the
8617 specified option choice is marked.</P>
8618 <H3><A NAME="10_115_5">Example</A></H3>
8619 <PRE>
8620 #include &lt;cups/ppd.h&gt;
8621
8622 ppd_file_t *ppd;
8623
8624 printf(&quot;Letter size %s selected.\n&quot;,
8625 ppdIsMarked(ppd, &quot;PageSize&quot;, &quot;Letter&quot;) ? &quot;is&quot; : &quot;is not&quot;);
8626 </PRE>
8627 <H3><A NAME="10_115_6">See Also</A></H3>
8628 <A HREF="#cupsMarkOptions"> <CODE>cupsMarkOptions()</CODE></A>,<A HREF="#ppdConflicts">
8629 <CODE>ppdConflicts()</CODE></A>,<A HREF="#ppdIsMarked"> <CODE>
8630 ppdIsMarked()</CODE></A>,<A HREF="#ppdMarkDefaults"> <CODE>
8631 ppdMarkDefaults()</CODE></A>,<A HREF="#ppdMarkOption"> <CODE>
8632 ppdMarkOption()</CODE></A>
8633 <!-- NEW PAGE -->
8634
8635 <H2><A NAME="ppdMarkDefaults">ppdMarkDefaults()</A></H2>
8636 <H3><A NAME="10_116_1">Usage</A></H3>
8637 <PRE>
8638 void
8639 ppdMarkDefaults(ppd_file_t *ppd);
8640 </PRE>
8641 <H3><A NAME="10_116_2">Arguments</A></H3>
8642 <CENTER>
8643 <TABLE BORDER WIDTH="80%">
8644 <TR><TH>Argument</TH><TH>Description</TH></TR>
8645 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8646 </TABLE>
8647 </CENTER>
8648 <H3><A NAME="10_116_3">Description</A></H3>
8649 <P>The <CODE>ppdMarkDefaults()</CODE> function marks all of the default
8650 choices in the PPD file.</P>
8651 <H3><A NAME="10_116_4">Example</A></H3>
8652 <PRE>
8653 #include &lt;cups/ppd.h&gt;
8654
8655 ppd_file_t *ppd;
8656
8657 ppdMarkDefaults(ppd);
8658 </PRE>
8659 <H3><A NAME="10_116_5">See Also</A></H3>
8660 <A HREF="#cupsMarkOptions"> <CODE>cupsMarkOptions()</CODE></A>,<A HREF="#ppdConflicts">
8661 <CODE>ppdConflicts()</CODE></A>,<A HREF="#ppdIsMarked"> <CODE>
8662 ppdIsMarked()</CODE></A>,<A HREF="#ppdMarkDefaults"> <CODE>
8663 ppdMarkDefaults()</CODE></A>,<A HREF="#ppdMarkOption"> <CODE>
8664 ppdMarkOption()</CODE></A>
8665 <!-- NEW PAGE -->
8666
8667 <H2><A NAME="ppdMarkOption">ppdMarkOption()</A></H2>
8668 <H3><A NAME="10_117_1">Usage</A></H3>
8669 <PRE>
8670 int
8671 ppdMarkOption(ppd_file_t *ppd,
8672 const char *keyword,
8673 const char *choice);
8674 </PRE>
8675 <H3><A NAME="10_117_2">Arguments</A></H3>
8676 <CENTER>
8677 <TABLE BORDER WIDTH="80%">
8678 <TR><TH>Argument</TH><TH>Description</TH></TR>
8679 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8680 <TR><TD>keyword</TD><TD>The name of the option</TD></TR>
8681 <TR><TD>choice</TD><TD>The name of the choice</TD></TR>
8682 </TABLE>
8683 </CENTER>
8684 <H3><A NAME="10_117_3">Returns</A></H3>
8685 <P>The number of conflicts in the PPD file.</P>
8686 <H3><A NAME="10_117_4">Description</A></H3>
8687 <P>The <CODE>ppdMarkOption()</CODE> function marks the specified option
8688 choice.</P>
8689 <H3><A NAME="10_117_5">Example</A></H3>
8690 <PRE>
8691 #include &lt;cups/ppd.h&gt;
8692
8693 ppd_file_t *ppd;
8694
8695 ppdMarkOption(ppd, &quot;PageSize&quot;, &quot;Letter&quot;);
8696 </PRE>
8697 <H3><A NAME="10_117_6">See Also</A></H3>
8698 <A HREF="#cupsMarkOptions"> <CODE>cupsMarkOptions()</CODE></A>,<A HREF="#ppdConflicts">
8699 <CODE>ppdConflicts()</CODE></A>,<A HREF="#ppdIsMarked"> <CODE>
8700 ppdIsMarked()</CODE></A>,<A HREF="#ppdMarkDefaults"> <CODE>
8701 ppdMarkDefaults()</CODE></A>,<A HREF="#ppdMarkOption"> <CODE>
8702 ppdMarkOption()</CODE></A>
8703 <!-- NEW PAGE -->
8704
8705 <H2><A NAME="ppdOpen">ppdOpen()</A></H2>
8706 <H3><A NAME="10_118_1">Usage</A></H3>
8707 <PRE>
8708 ppd_file_t *
8709 ppdOpen(FILE *file);
8710 </PRE>
8711 <H3><A NAME="10_118_2">Arguments</A></H3>
8712 <CENTER>
8713 <TABLE BORDER WIDTH="80%">
8714 <TR><TH>Argument</TH><TH>Description</TH></TR>
8715 <TR><TD>file</TD><TD>The file to read from</TD></TR>
8716 </TABLE>
8717 </CENTER>
8718 <H3><A NAME="10_118_3">Returns</A></H3>
8719 <P>A pointer to a PPD file structure or NULL if the PPD file could not
8720 be read.</P>
8721 <H3><A NAME="10_118_4">Description</A></H3>
8722 <P>The <CODE>ppdOpen()</CODE> function reads a PPD file from the
8723 specified file into memory.</P>
8724 <H3><A NAME="10_118_5">Example</A></H3>
8725 <PRE>
8726 #include &lt;cups/ppd.h&gt;
8727
8728 ppd_file_t *ppd;
8729 FILE *file;
8730
8731 file = fopen(&quot;filename.ppd&quot;, &quot;rb&quot;);
8732 ppd = ppdOpen(file);
8733 fclose(file);
8734 </PRE>
8735 <H3><A NAME="10_118_6">See Also</A></H3>
8736 <A HREF="#ppdClose"> <CODE>ppdClose()</CODE></A>,<A HREF="#ppdOpenFd"> <CODE>
8737 ppdOpenFd()</CODE></A>,<A HREF="#ppdOpenFile"> <CODE>ppdOpenFile()</CODE>
8738 </A>
8739 <!-- NEW PAGE -->
8740
8741 <H2><A NAME="ppdOpenFd">ppdOpenFd()</A></H2>
8742 <H3><A NAME="10_119_1">Usage</A></H3>
8743 <PRE>
8744 ppd_file_t *
8745 ppdOpenFd(int fd);
8746 </PRE>
8747 <H3><A NAME="10_119_2">Arguments</A></H3>
8748 <CENTER>
8749 <TABLE BORDER WIDTH="80%">
8750 <TR><TH>Argument</TH><TH>Description</TH></TR>
8751 <TR><TD>fd</TD><TD>The file descriptor to read from</TD></TR>
8752 </TABLE>
8753 </CENTER>
8754 <H3><A NAME="10_119_3">Returns</A></H3>
8755 <P>A pointer to a PPD file structure or NULL if the PPD file could not
8756 be read.</P>
8757 <H3><A NAME="10_119_4">Description</A></H3>
8758 <P>The <CODE>ppdOpenFd()</CODE> function reads a PPD file from the
8759 specified file descriptor into memory.</P>
8760 <H3><A NAME="10_119_5">Example</A></H3>
8761 <PRE>
8762 #include &lt;cups/ppd.h&gt;
8763
8764 ppd_file_t *ppd;
8765 int fd;
8766
8767 fd = open(&quot;filename.ppd&quot;, O_RDONLY);
8768 ppd = ppdOpenFd(fd);
8769 close(fd);
8770 </PRE>
8771 <H3><A NAME="10_119_6">See Also</A></H3>
8772 <A HREF="#ppdClose"> <CODE>ppdClose()</CODE></A>,<A HREF="#ppdOpen"> <CODE>
8773 ppdOpen()</CODE></A>,<A HREF="#ppdOpenFile"> <CODE>ppdOpenFile()</CODE></A>
8774 <!-- NEW PAGE -->
8775
8776 <H2><A NAME="ppdOpenFile">ppdOpenFile()</A></H2>
8777 <H3><A NAME="10_120_1">Usage</A></H3>
8778 <PRE>
8779 ppd_file_t *
8780 ppdOpenFile(const char *filename);
8781 </PRE>
8782 <H3><A NAME="10_120_2">Arguments</A></H3>
8783 <CENTER>
8784 <TABLE BORDER WIDTH="80%">
8785 <TR><TH>Argument</TH><TH>Description</TH></TR>
8786 <TR><TD>filename</TD><TD>The name of the file to read from</TD></TR>
8787 </TABLE>
8788 </CENTER>
8789 <H3><A NAME="10_120_3">Returns</A></H3>
8790 <P>A pointer to a PPD file structure or NULL if the PPD file could not
8791 be read.</P>
8792 <H3><A NAME="10_120_4">Description</A></H3>
8793 <P>The <CODE>ppdOpenFile()</CODE> function reads a PPD file from the
8794 named file into memory.</P>
8795 <H3><A NAME="10_120_5">Example</A></H3>
8796 <PRE>
8797 #include &lt;cups/ppd.h&gt;
8798
8799 ppd_file_t *ppd;
8800
8801 ppd = ppdOpenFile(&quot;filename.ppd&quot;);
8802 </PRE>
8803 <H3><A NAME="10_120_6">See Also</A></H3>
8804 <A HREF="#ppdClose"> <CODE>ppdClose()</CODE></A>,<A HREF="#ppdOpen"> <CODE>
8805 ppdOpen()</CODE></A>,<A HREF="#ppdOpenFd"> <CODE>ppdOpenFd()</CODE></A>
8806 <!-- NEW PAGE -->
8807
8808 <H2><A NAME="ppdPageLength">ppdPageLength()</A></H2>
8809 <H3><A NAME="10_121_1">Usage</A></H3>
8810 <PRE>
8811 float
8812 ppdPageLength(ppd_file_t *ppd,
8813 const char *name);
8814 </PRE>
8815 <H3><A NAME="10_121_2">Arguments</A></H3>
8816 <CENTER>
8817 <TABLE BORDER WIDTH="80%">
8818 <TR><TH>Argument</TH><TH>Description</TH></TR>
8819 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8820 <TR><TD>name</TD><TD>The name of the page size</TD></TR>
8821 </TABLE>
8822 </CENTER>
8823 <H3><A NAME="10_121_3">Returns</A></H3>
8824 <P>The length of the specified page size in points or 0 if the page size
8825 does not exist.</P>
8826 <H3><A NAME="10_121_4">Description</A></H3>
8827 <P>The <CODE>ppdPageLength()</CODE> function returns the page length of
8828 the specified page size.</P>
8829 <H3><A NAME="10_121_5">Example</A></H3>
8830 <PRE>
8831 #include &lt;cups/ppd.h&gt;
8832
8833 ppd_file_t *ppd;
8834
8835 printf(&quot;Length = %.0f\n&quot;, ppdPageLength(ppd, &quot;Letter&quot;));
8836 </PRE>
8837 <H3><A NAME="10_121_6">See Also</A></H3>
8838 <A HREF="#ppdPageLength"> <CODE>ppdPageLength()</CODE></A>,<A HREF="#ppdPageSize">
8839 <CODE>ppdPageSize()</CODE></A>,<A HREF="#ppdPageWidth"> <CODE>
8840 ppdPageWidth()</CODE></A>
8841 <!-- NEW PAGE -->
8842
8843 <H2><A NAME="ppdPageSize">ppdPageSize()</A></H2>
8844 <H3><A NAME="10_122_1">Usage</A></H3>
8845 <PRE>
8846 ppd_size_t *
8847 ppdPageSize(ppd_file_t *ppd,
8848 const char *name);
8849 </PRE>
8850 <H3><A NAME="10_122_2">Arguments</A></H3>
8851 <CENTER>
8852 <TABLE BORDER WIDTH="80%">
8853 <TR><TH>Argument</TH><TH>Description</TH></TR>
8854 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8855 <TR><TD>name</TD><TD>The name of the page size</TD></TR>
8856 </TABLE>
8857 </CENTER>
8858 <H3><A NAME="10_122_3">Returns</A></H3>
8859 <P>A pointer to the page size record of the specified page size in
8860 points or NULL if the page size does not exist.</P>
8861 <H3><A NAME="10_122_4">Description</A></H3>
8862 <P>The <CODE>ppdPageSize()</CODE> function returns the page size record
8863 for the specified page size.</P>
8864 <H3><A NAME="10_122_5">Example</A></H3>
8865 <PRE>
8866 #include &lt;cups/ppd.h&gt;
8867
8868 ppd_file_t *ppd;
8869 ppd_size_t *size;
8870
8871 size = ppdPageSize(ppd, &quot;Letter&quot;);
8872 if (size != NULL)
8873 {
8874 printf(&quot; Width = %.0f\n&quot;, size-&gt;width);
8875 printf(&quot;Length = %.0f\n&quot;, size-&gt;length);
8876 printf(&quot; Left = %.0f\n&quot;, size-&gt;left);
8877 printf(&quot; Right = %.0f\n&quot;, size-&gt;right);
8878 printf(&quot;Bottom = %.0f\n&quot;, size-&gt;bottom);
8879 printf(&quot; Top = %.0f\n&quot;, size-&gt;top);
8880 }
8881 </PRE>
8882 <H3><A NAME="10_122_6">See Also</A></H3>
8883 <A HREF="#ppdPageLength"> <CODE>ppdPageLength()</CODE></A>,<A HREF="#ppdPageWidth">
8884 <CODE>ppdPageWidth()</CODE></A>
8885 <!-- NEW PAGE -->
8886
8887 <H2><A NAME="ppdPageWidth">ppdPageWidth()</A></H2>
8888 <H3><A NAME="10_123_1">Usage</A></H3>
8889 <PRE>
8890 float
8891 ppdPageWidth(ppd_file_t *ppd,
8892 const char *name);
8893 </PRE>
8894 <H3><A NAME="10_123_2">Arguments</A></H3>
8895 <CENTER>
8896 <TABLE BORDER WIDTH="80%">
8897 <TR><TH>Argument</TH><TH>Description</TH></TR>
8898 <TR><TD>ppd</TD><TD>The PPD file</TD></TR>
8899 <TR><TD>name</TD><TD>The name of the page size</TD></TR>
8900 </TABLE>
8901 </CENTER>
8902 <H3><A NAME="10_123_3">Returns</A></H3>
8903 <P>The width of the specified page size in points or 0 if the page size
8904 does not exist.</P>
8905 <H3><A NAME="10_123_4">Description</A></H3>
8906 <P>The <CODE>ppdPageWidth()</CODE> function returns the page width of
8907 the specified page size.</P>
8908 <H3><A NAME="10_123_5">Example</A></H3>
8909 <PRE>
8910 #include &lt;cups/ppd.h&gt;
8911
8912 ppd_file_t *ppd;
8913
8914 printf(&quot;Width = %.0f\n&quot;, ppdPageWidth(ppd, &quot;Letter&quot;));
8915 </PRE>
8916 <H3><A NAME="10_123_6">See Also</A></H3>
8917 <A HREF="#ppdPageLength"> <CODE>ppdPageLength()</CODE></A>,<A HREF="#ppdPageSize">
8918 <CODE>ppdPageSize()</CODE></A></BODY>
8919 </HTML>