]> git.ipfire.org Git - thirdparty/cups.git/blob - doc/help/api-cgi.html
Merge changes from CUPS 1.4svn-r8606.
[thirdparty/cups.git] / doc / help / api-cgi.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <html>
3 <!-- SECTION: Programming -->
4 <head>
5 <title>CGI API</title>
6 <meta name="keywords" content="Programming">
7 <meta name="creator" content="Mini-XML v2.6">
8 <style type="text/css"><!--
9 BODY {
10 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
11 }
12
13 H1, H2, H3, H4, H5, H6, P, TD, TH {
14 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
15 }
16
17 KBD {
18 font-family: monaco, courier, monospace;
19 font-weight: bold;
20 }
21
22 PRE {
23 font-family: monaco, courier, monospace;
24 }
25
26 PRE.command {
27 margin-left: 36pt;
28 }
29
30 P.compact {
31 margin: 0;
32 }
33
34 P.example {
35 font-style: italic;
36 margin-left: 36pt;
37 }
38
39 PRE.example {
40 background: #eeeeee;
41 border: dotted thin #999999;
42 margin-left: 36pt;
43 padding: 10px;
44 }
45
46 PRE.command EM, PRE.example EM {
47 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
48 }
49
50 P.command {
51 font-family: monaco, courier, monospace;
52 margin-left: 36pt;
53 }
54
55 P.formula {
56 font-style: italic;
57 margin-left: 36pt;
58 }
59
60 BLOCKQUOTE {
61 background: #cccccc;
62 border: solid thin #999999;
63 padding: 10pt;
64 }
65
66 A IMG {
67 border: none;
68 }
69
70 A:link:hover IMG {
71 background: #f0f0f0;
72 border-radius: 10px;
73 -moz-border-radius: 10px;
74 }
75
76 A:link, A:visited {
77 font-weight: normal;
78 text-decoration: none;
79 }
80
81 A:link:hover, A:visited:hover, A:active {
82 text-decoration: underline;
83 }
84
85 SUB, SUP {
86 font-size: 50%;
87 }
88
89 TR.data, TD.data, TR.data TD {
90 margin-top: 10pt;
91 padding: 5pt;
92 border-bottom: solid 1pt #999999;
93 }
94
95 TR.data TH {
96 border-bottom: solid 1pt #999999;
97 padding-top: 10pt;
98 padding-left: 5pt;
99 text-align: left;
100 }
101
102 DIV.table TABLE {
103 border: solid thin #999999;
104 border-collapse: collapse;
105 border-spacing: 0;
106 margin-left: auto;
107 margin-right: auto;
108 }
109
110 DIV.table CAPTION {
111 caption-side: top;
112 font-size: 120%;
113 font-style: italic;
114 font-weight: bold;
115 margin-left: auto;
116 margin-right: auto;
117 }
118
119 DIV.table TABLE TD {
120 border: solid thin #cccccc;
121 padding-top: 5pt;
122 }
123
124 DIV.table TABLE TH {
125 background: #cccccc;
126 border: none;
127 border-bottom: solid thin #999999;
128 }
129
130 DIV.figure TABLE {
131 margin-left: auto;
132 margin-right: auto;
133 }
134
135 DIV.figure CAPTION {
136 caption-side: bottom;
137 font-size: 120%;
138 font-style: italic;
139 font-weight: bold;
140 margin-left: auto;
141 margin-right: auto;
142 }
143
144 TH.label {
145 text-align: right;
146 vertical-align: top;
147 }
148
149 TH.sublabel {
150 text-align: right;
151 font-weight: normal;
152 }
153
154 HR {
155 border: solid thin;
156 }
157
158 SPAN.info {
159 background: black;
160 border: thin solid black;
161 color: white;
162 font-size: 80%;
163 font-style: italic;
164 font-weight: bold;
165 white-space: nowrap;
166 }
167
168 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
169 float: right;
170 font-size: 100%;
171 }
172
173 H2.title, H3.title {
174 border-bottom: solid 2pt #000000;
175 }
176
177 DIV.indent, TABLE.indent {
178 margin-top: 2em;
179 margin-left: auto;
180 margin-right: auto;
181 width: 90%;
182 }
183
184 TABLE.indent {
185 border-collapse: collapse;
186 }
187
188 TABLE.indent TD, TABLE.indent TH {
189 padding: 0;
190 }
191
192 TABLE.list {
193 border-collapse: collapse;
194 margin-left: auto;
195 margin-right: auto;
196 width: 90%;
197 }
198
199 TABLE.list TH {
200 background: white;
201 border-bottom: solid thin #cccccc;
202 color: #444444;
203 padding-top: 10pt;
204 padding-left: 5pt;
205 text-align: left;
206 vertical-align: bottom;
207 white-space: nowrap;
208 }
209
210 TABLE.list TH A {
211 color: #4444cc;
212 }
213
214 TABLE.list TD {
215 border-bottom: solid thin #eeeeee;
216 padding-top: 5pt;
217 padding-left: 5pt;
218 }
219
220 TABLE.list TR:nth-child(even) {
221 background: #f8f8f8;
222 }
223
224 TABLE.list TR:nth-child(odd) {
225 background: #f4f4f4;
226 }
227
228 DT {
229 margin-left: 36pt;
230 margin-top: 12pt;
231 }
232
233 DD {
234 margin-left: 54pt;
235 }
236
237 DL.category DT {
238 font-weight: bold;
239 }
240
241 P.summary {
242 margin-left: 36pt;
243 font-family: monaco, courier, monospace;
244 }
245
246 DIV.summary TABLE {
247 border: solid thin #999999;
248 border-collapse: collapse;
249 border-spacing: 0;
250 margin: 10px;
251 }
252
253 DIV.summary TABLE TD, DIV.summary TABLE TH {
254 border: solid thin #999999;
255 padding: 5px;
256 text-align: left;
257 vertical-align: top;
258 }
259
260 DIV.summary TABLE THEAD TH {
261 background: #eeeeee;
262 }
263
264 /* API documentation styles... */
265 div.body h1 {
266 margin: 0;
267 }
268 div.body h2 {
269 margin-top: 1.5em;
270 }
271 div.body h3, div.body h4, div.body h5 {
272 margin-bottom: 0.5em;
273 margin-top: 1.5em;
274 }
275 .class, .enumeration, .function, .struct, .typedef, .union {
276 border-bottom: solid thin #999999;
277 margin-bottom: 0;
278 margin-top: 2em;
279 }
280 .description {
281 margin-top: 0.5em;
282 }
283 code, p.code, pre, ul.code li {
284 font-family: monaco, courier, monospace;
285 font-size: 90%;
286 }
287 ul.code, ul.contents, ul.subcontents {
288 list-style-type: none;
289 margin: 0;
290 padding-left: 0;
291 }
292 ul.code li {
293 margin: 0;
294 }
295 ul.contents > li {
296 margin-top: 1em;
297 }
298 ul.contents li ul.code, ul.contents li ul.subcontents {
299 padding-left: 2em;
300 }
301 div.body dl {
302 margin-left: 0;
303 margin-top: 0;
304 }
305 div.body dt {
306 font-style: italic;
307 margin-left: 0;
308 margin-top: 0;
309 }
310 div.body dd {
311 margin-bottom: 0.5em;
312 }
313
314 /* This is just for the HTML files generated with the framedhelp target */
315 div.contents {
316 background: #e8e8e8;
317 border: solid thin black;
318 padding: 10px;
319 }
320 div.contents h1 {
321 font-size: 110%;
322 }
323 div.contents h2 {
324 font-size: 100%;
325 }
326 div.contents ul.contents {
327 font-size: 80%;
328 }
329 div.contents ul.subcontents li {
330 margin-left: 1em;
331 text-indent: -1em;
332 }
333 --></style>
334 </head>
335 <body>
336 <div class='body'>
337 <h2 class="title">Contents</h2>
338 <ul class="contents">
339 <li><a href="#FUNCTIONS">Functions</a><ul class="code">
340 <li><a href="#cgiCheckVariables" title="Check for the presence of &quot;required&quot; variables.">cgiCheckVariables</a></li>
341 <li><a href="#cgiCompileSearch" title="Compile a search string.">cgiCompileSearch</a></li>
342 <li><a href="#cgiCopyTemplateFile" title="Copy a template file and replace all the
343 '{variable}' strings with the variable value.">cgiCopyTemplateFile</a></li>
344 <li><a href="#cgiCopyTemplateLang" title="Copy a template file using a language...">cgiCopyTemplateLang</a></li>
345 <li><a href="#cgiDoSearch" title="Do a search of some text.">cgiDoSearch</a></li>
346 <li><a href="#cgiEndHTML" title="End a HTML page.">cgiEndHTML</a></li>
347 <li><a href="#cgiEndMultipart" title="End the delivery of a multipart web page.">cgiEndMultipart</a></li>
348 <li><a href="#cgiFormEncode" title="Encode a string as a form variable.">cgiFormEncode</a></li>
349 <li><a href="#cgiFreeSearch" title="Free a compiled search context.">cgiFreeSearch</a></li>
350 <li><a href="#cgiGetArray" title="Get an element from a form array...">cgiGetArray</a></li>
351 <li><a href="#cgiGetAttributes" title="Get the list of attributes that are needed
352 by the template file.">cgiGetAttributes</a></li>
353 <li><a href="#cgiGetFile" title="Get the file (if any) that was submitted in the form.">cgiGetFile</a></li>
354 <li><a href="#cgiGetIPPObjects" title="Get the objects in an IPP response.">cgiGetIPPObjects</a></li>
355 <li><a href="#cgiGetSize" title="Get the size of a form array value.">cgiGetSize</a></li>
356 <li><a href="#cgiGetTemplateDir" title="Get the templates directory...">cgiGetTemplateDir</a></li>
357 <li><a href="#cgiGetVariable" title="Get a CGI variable from the database...">cgiGetVariable</a></li>
358 <li><a href="#cgiInitialize" title="Initialize the CGI variable &quot;database&quot;...">cgiInitialize</a></li>
359 <li><a href="#cgiIsPOST" title="Determine whether this page was POSTed.">cgiIsPOST</a></li>
360 <li><a href="#cgiMoveJobs" title="Move one or more jobs.">cgiMoveJobs</a></li>
361 <li><a href="#cgiPrintCommand" title="Print a CUPS command job.">cgiPrintCommand</a></li>
362 <li><a href="#cgiPrintTestPage" title="Print a test page.">cgiPrintTestPage</a></li>
363 <li><a href="#cgiRewriteURL" title="Rewrite a printer URI into a web browser URL...">cgiRewriteURL</a></li>
364 <li><a href="#cgiSetArray" title="Set array element N to the specified string.">cgiSetArray</a></li>
365 <li><a href="#cgiSetIPPObjectVars" title="Set CGI variables from an IPP object.">cgiSetIPPObjectVars</a></li>
366 <li><a href="#cgiSetIPPVars" title="Set CGI variables from an IPP response.">cgiSetIPPVars</a></li>
367 <li><a href="#cgiSetServerVersion" title="Set the server name and CUPS version...">cgiSetServerVersion</a></li>
368 <li><a href="#cgiSetSize" title="Set the array size.">cgiSetSize</a></li>
369 <li><a href="#cgiSetVariable" title="Set a CGI variable in the database...">cgiSetVariable</a></li>
370 <li><a href="#cgiShowIPPError" title="Show the last IPP error message.">cgiShowIPPError</a></li>
371 <li><a href="#cgiShowJobs" title="Show print jobs.">cgiShowJobs</a></li>
372 <li><a href="#cgiStartHTML" title="Start a HTML page.">cgiStartHTML</a></li>
373 <li><a href="#cgiStartMultipart" title="Start a multipart delivery of a web page.">cgiStartMultipart</a></li>
374 <li><a href="#cgiSupportsMultipart" title="Does the browser support multi-part documents?">cgiSupportsMultipart</a></li>
375 <li><a href="#cgiText" title="Return localized text.">cgiText</a></li>
376 <li><a href="#helpDeleteIndex" title="Delete an index, freeing all memory used.">helpDeleteIndex</a></li>
377 <li><a href="#helpFindNode" title="Find a node in an index.">helpFindNode</a></li>
378 <li><a href="#helpLoadIndex" title="Load a help index from disk.">helpLoadIndex</a></li>
379 <li><a href="#helpSaveIndex" title="Save a help index to disk.">helpSaveIndex</a></li>
380 <li><a href="#helpSearchIndex" title="Search an index.">helpSearchIndex</a></li>
381 </ul></li>
382 <li><a href="#TYPES">Data Types</a><ul class="code">
383 <li><a href="#cgi_file_t" title="Uploaded file data">cgi_file_t</a></li>
384 <li><a href="#help_index_t" title="Help index structure">help_index_t</a></li>
385 <li><a href="#help_node_t" title="Help node structure...">help_node_t</a></li>
386 <li><a href="#help_word_t" title="Help word structure...">help_word_t</a></li>
387 </ul></li>
388 <li><a href="#STRUCTURES">Structures</a><ul class="code">
389 <li><a href="#cgi_file_s" title="Uploaded file data">cgi_file_s</a></li>
390 <li><a href="#help_index_s" title="Help index structure">help_index_s</a></li>
391 <li><a href="#help_node_s" title="Help node structure...">help_node_s</a></li>
392 <li><a href="#help_word_s" title="Help word structure...">help_word_s</a></li>
393 </ul></li>
394 <h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
395 <h3 class="function"><a name="cgiCheckVariables">cgiCheckVariables</a></h3>
396 <p class="description">Check for the presence of &quot;required&quot; variables.</p>
397 <p class="code">
398 int cgiCheckVariables (<br>
399 &nbsp;&nbsp;&nbsp;&nbsp;const char *names<br>
400 );</p>
401 <h4 class="parameters">Parameters</h4>
402 <dl>
403 <dt>names</dt>
404 <dd class="description">Variables to look for</dd>
405 </dl>
406 <h4 class="returnvalue">Return Value</h4>
407 <p class="description">1 if all variables present, 0 otherwise</p>
408 <h4 class="discussion">Discussion</h4>
409 <p class="discussion">Names may be separated by spaces and/or commas.</p>
410 <h3 class="function"><a name="cgiCompileSearch">cgiCompileSearch</a></h3>
411 <p class="description">Compile a search string.</p>
412 <p class="code">
413 void *cgiCompileSearch (<br>
414 &nbsp;&nbsp;&nbsp;&nbsp;const char *query<br>
415 );</p>
416 <h4 class="parameters">Parameters</h4>
417 <dl>
418 <dt>query</dt>
419 <dd class="description">Query string</dd>
420 </dl>
421 <h4 class="returnvalue">Return Value</h4>
422 <p class="description">Search context</p>
423 <h3 class="function"><a name="cgiCopyTemplateFile">cgiCopyTemplateFile</a></h3>
424 <p class="description">Copy a template file and replace all the
425 '{variable}' strings with the variable value.</p>
426 <p class="code">
427 void cgiCopyTemplateFile (<br>
428 &nbsp;&nbsp;&nbsp;&nbsp;FILE *out,<br>
429 &nbsp;&nbsp;&nbsp;&nbsp;const char *tmpl<br>
430 );</p>
431 <h4 class="parameters">Parameters</h4>
432 <dl>
433 <dt>out</dt>
434 <dd class="description">Output file</dd>
435 <dt>tmpl</dt>
436 <dd class="description">Template file to read</dd>
437 </dl>
438 <h3 class="function"><a name="cgiCopyTemplateLang">cgiCopyTemplateLang</a></h3>
439 <p class="description">Copy a template file using a language...</p>
440 <p class="code">
441 void cgiCopyTemplateLang (<br>
442 &nbsp;&nbsp;&nbsp;&nbsp;const char *tmpl<br>
443 );</p>
444 <h4 class="parameters">Parameters</h4>
445 <dl>
446 <dt>tmpl</dt>
447 <dd class="description">Base filename</dd>
448 </dl>
449 <h3 class="function"><a name="cgiDoSearch">cgiDoSearch</a></h3>
450 <p class="description">Do a search of some text.</p>
451 <p class="code">
452 int cgiDoSearch (<br>
453 &nbsp;&nbsp;&nbsp;&nbsp;void *search,<br>
454 &nbsp;&nbsp;&nbsp;&nbsp;const char *text<br>
455 );</p>
456 <h4 class="parameters">Parameters</h4>
457 <dl>
458 <dt>search</dt>
459 <dd class="description">Search context</dd>
460 <dt>text</dt>
461 <dd class="description">Text to search</dd>
462 </dl>
463 <h4 class="returnvalue">Return Value</h4>
464 <p class="description">Number of matches</p>
465 <h3 class="function"><a name="cgiEndHTML">cgiEndHTML</a></h3>
466 <p class="description">End a HTML page.</p>
467 <p class="code">
468 void cgiEndHTML (void);</p>
469 <h3 class="function"><a name="cgiEndMultipart">cgiEndMultipart</a></h3>
470 <p class="description">End the delivery of a multipart web page.</p>
471 <p class="code">
472 void cgiEndMultipart (void);</p>
473 <h3 class="function"><a name="cgiFormEncode">cgiFormEncode</a></h3>
474 <p class="description">Encode a string as a form variable.</p>
475 <p class="code">
476 char *cgiFormEncode (<br>
477 &nbsp;&nbsp;&nbsp;&nbsp;char *dst,<br>
478 &nbsp;&nbsp;&nbsp;&nbsp;const char *src,<br>
479 &nbsp;&nbsp;&nbsp;&nbsp;size_t dstsize<br>
480 );</p>
481 <h4 class="parameters">Parameters</h4>
482 <dl>
483 <dt>dst</dt>
484 <dd class="description">Destination string</dd>
485 <dt>src</dt>
486 <dd class="description">Source string</dd>
487 <dt>dstsize</dt>
488 <dd class="description">Size of destination string</dd>
489 </dl>
490 <h4 class="returnvalue">Return Value</h4>
491 <p class="description">Destination string</p>
492 <h3 class="function"><a name="cgiFreeSearch">cgiFreeSearch</a></h3>
493 <p class="description">Free a compiled search context.</p>
494 <p class="code">
495 void cgiFreeSearch (<br>
496 &nbsp;&nbsp;&nbsp;&nbsp;void *search<br>
497 );</p>
498 <h4 class="parameters">Parameters</h4>
499 <dl>
500 <dt>search</dt>
501 <dd class="description">Search context</dd>
502 </dl>
503 <h3 class="function"><a name="cgiGetArray">cgiGetArray</a></h3>
504 <p class="description">Get an element from a form array...</p>
505 <p class="code">
506 const char *cgiGetArray (<br>
507 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
508 &nbsp;&nbsp;&nbsp;&nbsp;int element<br>
509 );</p>
510 <h4 class="parameters">Parameters</h4>
511 <dl>
512 <dt>name</dt>
513 <dd class="description">Name of array variable</dd>
514 <dt>element</dt>
515 <dd class="description">Element number (0 to N)</dd>
516 </dl>
517 <h4 class="returnvalue">Return Value</h4>
518 <p class="description">Element value or NULL</p>
519 <h3 class="function"><a name="cgiGetAttributes">cgiGetAttributes</a></h3>
520 <p class="description">Get the list of attributes that are needed
521 by the template file.</p>
522 <p class="code">
523 void cgiGetAttributes (<br>
524 &nbsp;&nbsp;&nbsp;&nbsp;ipp_t *request,<br>
525 &nbsp;&nbsp;&nbsp;&nbsp;const char *tmpl<br>
526 );</p>
527 <h4 class="parameters">Parameters</h4>
528 <dl>
529 <dt>request</dt>
530 <dd class="description">IPP request</dd>
531 <dt>tmpl</dt>
532 <dd class="description">Base filename</dd>
533 </dl>
534 <h3 class="function"><a name="cgiGetFile">cgiGetFile</a></h3>
535 <p class="description">Get the file (if any) that was submitted in the form.</p>
536 <p class="code">
537 const <a href="#cgi_file_t">cgi_file_t</a> *cgiGetFile (void);</p>
538 <h4 class="returnvalue">Return Value</h4>
539 <p class="description">Attached file or NULL</p>
540 <h3 class="function"><a name="cgiGetIPPObjects">cgiGetIPPObjects</a></h3>
541 <p class="description">Get the objects in an IPP response.</p>
542 <p class="code">
543 cups_array_t *cgiGetIPPObjects (<br>
544 &nbsp;&nbsp;&nbsp;&nbsp;ipp_t *response,<br>
545 &nbsp;&nbsp;&nbsp;&nbsp;void *search<br>
546 );</p>
547 <h4 class="parameters">Parameters</h4>
548 <dl>
549 <dt>response</dt>
550 <dd class="description">IPP response</dd>
551 <dt>search</dt>
552 <dd class="description">Search filter</dd>
553 </dl>
554 <h4 class="returnvalue">Return Value</h4>
555 <p class="description">Array of objects</p>
556 <h3 class="function"><a name="cgiGetSize">cgiGetSize</a></h3>
557 <p class="description">Get the size of a form array value.</p>
558 <p class="code">
559 int cgiGetSize (<br>
560 &nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
561 );</p>
562 <h4 class="parameters">Parameters</h4>
563 <dl>
564 <dt>name</dt>
565 <dd class="description">Name of variable</dd>
566 </dl>
567 <h4 class="returnvalue">Return Value</h4>
568 <p class="description">Number of elements</p>
569 <h3 class="function"><a name="cgiGetTemplateDir">cgiGetTemplateDir</a></h3>
570 <p class="description">Get the templates directory...</p>
571 <p class="code">
572 char *cgiGetTemplateDir (void);</p>
573 <h4 class="returnvalue">Return Value</h4>
574 <p class="description">Template directory</p>
575 <h3 class="function"><a name="cgiGetVariable">cgiGetVariable</a></h3>
576 <p class="description">Get a CGI variable from the database...</p>
577 <p class="code">
578 const char *cgiGetVariable (<br>
579 &nbsp;&nbsp;&nbsp;&nbsp;const char *name<br>
580 );</p>
581 <h4 class="parameters">Parameters</h4>
582 <dl>
583 <dt>name</dt>
584 <dd class="description">Name of variable</dd>
585 </dl>
586 <h4 class="returnvalue">Return Value</h4>
587 <p class="description">Value of variable</p>
588 <h4 class="discussion">Discussion</h4>
589 <p class="discussion">Returns NULL if the variable doesn't exist. If the variable is an
590 array of values, returns the last element...</p>
591 <h3 class="function"><a name="cgiInitialize">cgiInitialize</a></h3>
592 <p class="description">Initialize the CGI variable &quot;database&quot;...</p>
593 <p class="code">
594 int cgiInitialize (void);</p>
595 <h4 class="returnvalue">Return Value</h4>
596 <p class="description">Non-zero if there was form data</p>
597 <h3 class="function"><a name="cgiIsPOST">cgiIsPOST</a></h3>
598 <p class="description">Determine whether this page was POSTed.</p>
599 <p class="code">
600 int cgiIsPOST (void);</p>
601 <h4 class="returnvalue">Return Value</h4>
602 <p class="description">1 if POST, 0 if GET</p>
603 <h3 class="function"><a name="cgiMoveJobs">cgiMoveJobs</a></h3>
604 <p class="description">Move one or more jobs.</p>
605 <p class="code">
606 void cgiMoveJobs (<br>
607 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
608 &nbsp;&nbsp;&nbsp;&nbsp;const char *dest,<br>
609 &nbsp;&nbsp;&nbsp;&nbsp;int job_id<br>
610 );</p>
611 <h4 class="parameters">Parameters</h4>
612 <dl>
613 <dt>http</dt>
614 <dd class="description">Connection to server</dd>
615 <dt>dest</dt>
616 <dd class="description">Destination or NULL</dd>
617 <dt>job_id</dt>
618 <dd class="description">Job ID or 0 for all</dd>
619 </dl>
620 <h4 class="discussion">Discussion</h4>
621 <p class="discussion">At least one of dest or job_id must be non-zero/NULL.</p>
622 <h3 class="function"><a name="cgiPrintCommand">cgiPrintCommand</a></h3>
623 <p class="description">Print a CUPS command job.</p>
624 <p class="code">
625 void cgiPrintCommand (<br>
626 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
627 &nbsp;&nbsp;&nbsp;&nbsp;const char *dest,<br>
628 &nbsp;&nbsp;&nbsp;&nbsp;const char *command,<br>
629 &nbsp;&nbsp;&nbsp;&nbsp;const char *title<br>
630 );</p>
631 <h4 class="parameters">Parameters</h4>
632 <dl>
633 <dt>http</dt>
634 <dd class="description">Connection to server</dd>
635 <dt>dest</dt>
636 <dd class="description">Destination printer</dd>
637 <dt>command</dt>
638 <dd class="description">Command to send</dd>
639 <dt>title</dt>
640 <dd class="description">Page/job title</dd>
641 </dl>
642 <h3 class="function"><a name="cgiPrintTestPage">cgiPrintTestPage</a></h3>
643 <p class="description">Print a test page.</p>
644 <p class="code">
645 void cgiPrintTestPage (<br>
646 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
647 &nbsp;&nbsp;&nbsp;&nbsp;const char *dest<br>
648 );</p>
649 <h4 class="parameters">Parameters</h4>
650 <dl>
651 <dt>http</dt>
652 <dd class="description">Connection to server</dd>
653 <dt>dest</dt>
654 <dd class="description">Destination printer/class</dd>
655 </dl>
656 <h3 class="function"><a name="cgiRewriteURL">cgiRewriteURL</a></h3>
657 <p class="description">Rewrite a printer URI into a web browser URL...</p>
658 <p class="code">
659 char *cgiRewriteURL (<br>
660 &nbsp;&nbsp;&nbsp;&nbsp;const char *uri,<br>
661 &nbsp;&nbsp;&nbsp;&nbsp;char *url,<br>
662 &nbsp;&nbsp;&nbsp;&nbsp;int urlsize,<br>
663 &nbsp;&nbsp;&nbsp;&nbsp;const char *newresource<br>
664 );</p>
665 <h4 class="parameters">Parameters</h4>
666 <dl>
667 <dt>uri</dt>
668 <dd class="description">Current URI</dd>
669 <dt>url</dt>
670 <dd class="description">New URL</dd>
671 <dt>urlsize</dt>
672 <dd class="description">Size of URL buffer</dd>
673 <dt>newresource</dt>
674 <dd class="description">Replacement resource</dd>
675 </dl>
676 <h4 class="returnvalue">Return Value</h4>
677 <p class="description">New URL</p>
678 <h3 class="function"><a name="cgiSetArray">cgiSetArray</a></h3>
679 <p class="description">Set array element N to the specified string.</p>
680 <p class="code">
681 void cgiSetArray (<br>
682 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
683 &nbsp;&nbsp;&nbsp;&nbsp;int element,<br>
684 &nbsp;&nbsp;&nbsp;&nbsp;const char *value<br>
685 );</p>
686 <h4 class="parameters">Parameters</h4>
687 <dl>
688 <dt>name</dt>
689 <dd class="description">Name of variable</dd>
690 <dt>element</dt>
691 <dd class="description">Element number (0 to N)</dd>
692 <dt>value</dt>
693 <dd class="description">Value of variable</dd>
694 </dl>
695 <h4 class="discussion">Discussion</h4>
696 <p class="discussion">If the variable array is smaller than (element + 1), the intervening
697 elements are set to NULL.</p>
698 <h3 class="function"><a name="cgiSetIPPObjectVars">cgiSetIPPObjectVars</a></h3>
699 <p class="description">Set CGI variables from an IPP object.</p>
700 <p class="code">
701 ipp_attribute_t *cgiSetIPPObjectVars (<br>
702 &nbsp;&nbsp;&nbsp;&nbsp;ipp_attribute_t *obj,<br>
703 &nbsp;&nbsp;&nbsp;&nbsp;const char *prefix,<br>
704 &nbsp;&nbsp;&nbsp;&nbsp;int element<br>
705 );</p>
706 <h4 class="parameters">Parameters</h4>
707 <dl>
708 <dt>obj</dt>
709 <dd class="description">Response data to be copied...</dd>
710 <dt>prefix</dt>
711 <dd class="description">Prefix for name or NULL</dd>
712 <dt>element</dt>
713 <dd class="description">Parent element number</dd>
714 </dl>
715 <h4 class="returnvalue">Return Value</h4>
716 <p class="description">Next object</p>
717 <h3 class="function"><a name="cgiSetIPPVars">cgiSetIPPVars</a></h3>
718 <p class="description">Set CGI variables from an IPP response.</p>
719 <p class="code">
720 int cgiSetIPPVars (<br>
721 &nbsp;&nbsp;&nbsp;&nbsp;ipp_t *response,<br>
722 &nbsp;&nbsp;&nbsp;&nbsp;const char *filter_name,<br>
723 &nbsp;&nbsp;&nbsp;&nbsp;const char *filter_value,<br>
724 &nbsp;&nbsp;&nbsp;&nbsp;const char *prefix,<br>
725 &nbsp;&nbsp;&nbsp;&nbsp;int parent_el<br>
726 );</p>
727 <h4 class="parameters">Parameters</h4>
728 <dl>
729 <dt>response</dt>
730 <dd class="description">Response data to be copied...</dd>
731 <dt>filter_name</dt>
732 <dd class="description">Filter name</dd>
733 <dt>filter_value</dt>
734 <dd class="description">Filter value</dd>
735 <dt>prefix</dt>
736 <dd class="description">Prefix for name or NULL</dd>
737 <dt>parent_el</dt>
738 <dd class="description">Parent element number</dd>
739 </dl>
740 <h4 class="returnvalue">Return Value</h4>
741 <p class="description">Maximum number of elements</p>
742 <h3 class="function"><a name="cgiSetServerVersion">cgiSetServerVersion</a></h3>
743 <p class="description">Set the server name and CUPS version...</p>
744 <p class="code">
745 void cgiSetServerVersion (void);</p>
746 <h3 class="function"><a name="cgiSetSize">cgiSetSize</a></h3>
747 <p class="description">Set the array size.</p>
748 <p class="code">
749 void cgiSetSize (<br>
750 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
751 &nbsp;&nbsp;&nbsp;&nbsp;int size<br>
752 );</p>
753 <h4 class="parameters">Parameters</h4>
754 <dl>
755 <dt>name</dt>
756 <dd class="description">Name of variable</dd>
757 <dt>size</dt>
758 <dd class="description">Number of elements (0 to N)</dd>
759 </dl>
760 <h3 class="function"><a name="cgiSetVariable">cgiSetVariable</a></h3>
761 <p class="description">Set a CGI variable in the database...</p>
762 <p class="code">
763 void cgiSetVariable (<br>
764 &nbsp;&nbsp;&nbsp;&nbsp;const char *name,<br>
765 &nbsp;&nbsp;&nbsp;&nbsp;const char *value<br>
766 );</p>
767 <h4 class="parameters">Parameters</h4>
768 <dl>
769 <dt>name</dt>
770 <dd class="description">Name of variable</dd>
771 <dt>value</dt>
772 <dd class="description">Value of variable</dd>
773 </dl>
774 <h4 class="discussion">Discussion</h4>
775 <p class="discussion">If the variable is an array, this truncates the array to a single element.</p>
776 <h3 class="function"><a name="cgiShowIPPError">cgiShowIPPError</a></h3>
777 <p class="description">Show the last IPP error message.</p>
778 <p class="code">
779 void cgiShowIPPError (<br>
780 &nbsp;&nbsp;&nbsp;&nbsp;const char *message<br>
781 );</p>
782 <h4 class="parameters">Parameters</h4>
783 <dl>
784 <dt>message</dt>
785 <dd class="description">Contextual message</dd>
786 </dl>
787 <h4 class="discussion">Discussion</h4>
788 <p class="discussion">The caller must still call cgiStartHTML() and cgiEndHTML().</p>
789 <h3 class="function"><a name="cgiShowJobs">cgiShowJobs</a></h3>
790 <p class="description">Show print jobs.</p>
791 <p class="code">
792 void cgiShowJobs (<br>
793 &nbsp;&nbsp;&nbsp;&nbsp;http_t *http,<br>
794 &nbsp;&nbsp;&nbsp;&nbsp;const char *dest<br>
795 );</p>
796 <h4 class="parameters">Parameters</h4>
797 <dl>
798 <dt>http</dt>
799 <dd class="description">Connection to server</dd>
800 <dt>dest</dt>
801 <dd class="description">Destination name or NULL</dd>
802 </dl>
803 <h3 class="function"><a name="cgiStartHTML">cgiStartHTML</a></h3>
804 <p class="description">Start a HTML page.</p>
805 <p class="code">
806 void cgiStartHTML (<br>
807 &nbsp;&nbsp;&nbsp;&nbsp;const char *title<br>
808 );</p>
809 <h4 class="parameters">Parameters</h4>
810 <dl>
811 <dt>title</dt>
812 <dd class="description">Title of page</dd>
813 </dl>
814 <h3 class="function"><a name="cgiStartMultipart">cgiStartMultipart</a></h3>
815 <p class="description">Start a multipart delivery of a web page.</p>
816 <p class="code">
817 void cgiStartMultipart (void);</p>
818 <h3 class="function"><a name="cgiSupportsMultipart">cgiSupportsMultipart</a></h3>
819 <p class="description">Does the browser support multi-part documents?</p>
820 <p class="code">
821 int cgiSupportsMultipart (void);</p>
822 <h4 class="returnvalue">Return Value</h4>
823 <p class="description">1 if multi-part supported, 0 otherwise</p>
824 <h3 class="function"><a name="cgiText">cgiText</a></h3>
825 <p class="description">Return localized text.</p>
826 <p class="code">
827 const char *cgiText (<br>
828 &nbsp;&nbsp;&nbsp;&nbsp;const char *message<br>
829 );</p>
830 <h4 class="parameters">Parameters</h4>
831 <dl>
832 <dt>message</dt>
833 <dd class="description">Message</dd>
834 </dl>
835 <h4 class="returnvalue">Return Value</h4>
836 <p class="description">Localized message</p>
837 <h3 class="function"><a name="helpDeleteIndex">helpDeleteIndex</a></h3>
838 <p class="description">Delete an index, freeing all memory used.</p>
839 <p class="code">
840 void helpDeleteIndex (<br>
841 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#help_index_t">help_index_t</a> *hi<br>
842 );</p>
843 <h4 class="parameters">Parameters</h4>
844 <dl>
845 <dt>hi</dt>
846 <dd class="description">Help index</dd>
847 </dl>
848 <h3 class="function"><a name="helpFindNode">helpFindNode</a></h3>
849 <p class="description">Find a node in an index.</p>
850 <p class="code">
851 <a href="#help_node_t">help_node_t</a> *helpFindNode (<br>
852 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#help_index_t">help_index_t</a> *hi,<br>
853 &nbsp;&nbsp;&nbsp;&nbsp;const char *filename,<br>
854 &nbsp;&nbsp;&nbsp;&nbsp;const char *anchor<br>
855 );</p>
856 <h4 class="parameters">Parameters</h4>
857 <dl>
858 <dt>hi</dt>
859 <dd class="description">Index</dd>
860 <dt>filename</dt>
861 <dd class="description">Filename</dd>
862 <dt>anchor</dt>
863 <dd class="description">Anchor</dd>
864 </dl>
865 <h4 class="returnvalue">Return Value</h4>
866 <p class="description">Node pointer or NULL</p>
867 <h3 class="function"><a name="helpLoadIndex">helpLoadIndex</a></h3>
868 <p class="description">Load a help index from disk.</p>
869 <p class="code">
870 <a href="#help_index_t">help_index_t</a> *helpLoadIndex (<br>
871 &nbsp;&nbsp;&nbsp;&nbsp;const char *hifile,<br>
872 &nbsp;&nbsp;&nbsp;&nbsp;const char *directory<br>
873 );</p>
874 <h4 class="parameters">Parameters</h4>
875 <dl>
876 <dt>hifile</dt>
877 <dd class="description">Index filename</dd>
878 <dt>directory</dt>
879 <dd class="description">Directory that is indexed</dd>
880 </dl>
881 <h4 class="returnvalue">Return Value</h4>
882 <p class="description">Index pointer or NULL</p>
883 <h3 class="function"><a name="helpSaveIndex">helpSaveIndex</a></h3>
884 <p class="description">Save a help index to disk.</p>
885 <p class="code">
886 int helpSaveIndex (<br>
887 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#help_index_t">help_index_t</a> *hi,<br>
888 &nbsp;&nbsp;&nbsp;&nbsp;const char *hifile<br>
889 );</p>
890 <h4 class="parameters">Parameters</h4>
891 <dl>
892 <dt>hi</dt>
893 <dd class="description">Index</dd>
894 <dt>hifile</dt>
895 <dd class="description">Index filename</dd>
896 </dl>
897 <h4 class="returnvalue">Return Value</h4>
898 <p class="description">0 on success, -1 on error</p>
899 <h3 class="function"><a name="helpSearchIndex">helpSearchIndex</a></h3>
900 <p class="description">Search an index.</p>
901 <p class="code">
902 <a href="#help_index_t">help_index_t</a> *helpSearchIndex (<br>
903 &nbsp;&nbsp;&nbsp;&nbsp;<a href="#help_index_t">help_index_t</a> *hi,<br>
904 &nbsp;&nbsp;&nbsp;&nbsp;const char *query,<br>
905 &nbsp;&nbsp;&nbsp;&nbsp;const char *section,<br>
906 &nbsp;&nbsp;&nbsp;&nbsp;const char *filename<br>
907 );</p>
908 <h4 class="parameters">Parameters</h4>
909 <dl>
910 <dt>hi</dt>
911 <dd class="description">Index</dd>
912 <dt>query</dt>
913 <dd class="description">Query string</dd>
914 <dt>section</dt>
915 <dd class="description">Limit search to this section</dd>
916 <dt>filename</dt>
917 <dd class="description">Limit search to this file</dd>
918 </dl>
919 <h4 class="returnvalue">Return Value</h4>
920 <p class="description">Search index</p>
921 <h2 class="title"><a name="TYPES">Data Types</a></h2>
922 <h3 class="typedef"><a name="cgi_file_t">cgi_file_t</a></h3>
923 <p class="description">Uploaded file data</p>
924 <p class="code">
925 typedef struct <a href="#cgi_file_s">cgi_file_s</a> cgi_file_t;
926 </p>
927 <h3 class="typedef"><a name="help_index_t">help_index_t</a></h3>
928 <p class="description">Help index structure</p>
929 <p class="code">
930 typedef struct <a href="#help_index_s">help_index_s</a> help_index_t;
931 </p>
932 <h3 class="typedef"><a name="help_node_t">help_node_t</a></h3>
933 <p class="description">Help node structure...</p>
934 <p class="code">
935 typedef struct <a href="#help_node_s">help_node_s</a> help_node_t;
936 </p>
937 <h3 class="typedef"><a name="help_word_t">help_word_t</a></h3>
938 <p class="description">Help word structure...</p>
939 <p class="code">
940 typedef struct <a href="#help_word_s">help_word_s</a> help_word_t;
941 </p>
942 <h2 class="title"><a name="STRUCTURES">Structures</a></h2>
943 <h3 class="struct"><a name="cgi_file_s">cgi_file_s</a></h3>
944 <p class="description">Uploaded file data</p>
945 <p class="code">struct cgi_file_s {<br>
946 &nbsp;&nbsp;&nbsp;&nbsp;size_t filesize;<br>
947 &nbsp;&nbsp;&nbsp;&nbsp;char tempfile[1024], *name, *filename, *mimetype;<br>
948 };</p>
949 <h4 class="members">Members</h4>
950 <dl>
951 <dt>filesize </dt>
952 <dd class="description">Size of uploaded file</dd>
953 <dt>mimetype </dt>
954 <dd class="description">MIME media type</dd>
955 </dl>
956 <h3 class="struct"><a name="help_index_s">help_index_s</a></h3>
957 <p class="description">Help index structure</p>
958 <p class="code">struct help_index_s {<br>
959 &nbsp;&nbsp;&nbsp;&nbsp;cups_array_t *nodes;<br>
960 &nbsp;&nbsp;&nbsp;&nbsp;int search;<br>
961 &nbsp;&nbsp;&nbsp;&nbsp;cups_array_t *sorted;<br>
962 };</p>
963 <h4 class="members">Members</h4>
964 <dl>
965 <dt>nodes </dt>
966 <dd class="description">Nodes sorted by filename</dd>
967 <dt>search </dt>
968 <dd class="description">1 = search index, 0 = normal</dd>
969 <dt>sorted </dt>
970 <dd class="description">Nodes sorted by score + text</dd>
971 </dl>
972 <h3 class="struct"><a name="help_node_s">help_node_s</a></h3>
973 <p class="description">Help node structure...</p>
974 <p class="code">struct help_node_s {<br>
975 &nbsp;&nbsp;&nbsp;&nbsp;char *anchor;<br>
976 &nbsp;&nbsp;&nbsp;&nbsp;char *filename;<br>
977 &nbsp;&nbsp;&nbsp;&nbsp;size_t length;<br>
978 &nbsp;&nbsp;&nbsp;&nbsp;time_t mtime;<br>
979 &nbsp;&nbsp;&nbsp;&nbsp;off_t offset;<br>
980 &nbsp;&nbsp;&nbsp;&nbsp;int score;<br>
981 &nbsp;&nbsp;&nbsp;&nbsp;char *section;<br>
982 &nbsp;&nbsp;&nbsp;&nbsp;char *text;<br>
983 &nbsp;&nbsp;&nbsp;&nbsp;cups_array_t *words;<br>
984 };</p>
985 <h4 class="members">Members</h4>
986 <dl>
987 <dt>anchor </dt>
988 <dd class="description">Anchor name (NULL if none)</dd>
989 <dt>filename </dt>
990 <dd class="description">Filename, relative to help dir</dd>
991 <dt>length </dt>
992 <dd class="description">Length in bytes</dd>
993 <dt>mtime </dt>
994 <dd class="description">Last modification time</dd>
995 <dt>offset </dt>
996 <dd class="description">Offset in file</dd>
997 <dt>score </dt>
998 <dd class="description">Search score</dd>
999 <dt>section </dt>
1000 <dd class="description">Section name (NULL if none)</dd>
1001 <dt>text </dt>
1002 <dd class="description">Text in anchor</dd>
1003 <dt>words </dt>
1004 <dd class="description">Words after this node</dd>
1005 </dl>
1006 <h3 class="struct"><a name="help_word_s">help_word_s</a></h3>
1007 <p class="description">Help word structure...</p>
1008 <p class="code">struct help_word_s {<br>
1009 &nbsp;&nbsp;&nbsp;&nbsp;int count;<br>
1010 &nbsp;&nbsp;&nbsp;&nbsp;char *text;<br>
1011 };</p>
1012 <h4 class="members">Members</h4>
1013 <dl>
1014 <dt>count </dt>
1015 <dd class="description">Number of occurrences</dd>
1016 <dt>text </dt>
1017 <dd class="description">Word text</dd>
1018 </dl>
1019 </div>
1020 </body>
1021 </html>