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>MIME API	</title>
6	<meta name="keywords" content="Programming">
7	<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
8	<meta name="creator" content="Mini-XML v2.7">
9<style type="text/css"><!--
10BODY {
11  font-family: lucida grande, geneva, helvetica, arial, sans-serif;
12}
13
14H1, H2, H3, H4, H5, H6, P, TD, TH {
15  font-family: lucida grande, geneva, helvetica, arial, sans-serif;
16}
17
18KBD {
19  font-family: monaco, courier, monospace;
20  font-weight: bold;
21}
22
23PRE {
24  font-family: monaco, courier, monospace;
25}
26
27PRE.command {
28  border: dotted thin #7f7f7f;
29  margin-left: 36pt;
30  padding: 10px;
31}
32
33P.compact {
34  margin: 0;
35}
36
37P.example {
38  font-style: italic;
39  margin-left: 36pt;
40}
41
42DL.man DD {
43  margin-left: 5em;
44}
45
46DL.man DT {
47  margin-left: 0;
48}
49
50PRE.man {
51  margin: 0;
52}
53
54PRE.example {
55  background: #eeeeee;
56  border: dotted thin #999999;
57  margin-left: 36pt;
58  padding: 10pt;
59}
60
61PRE.command EM, PRE.example EM {
62  font-family: lucida grande, geneva, helvetica, arial, sans-serif;
63}
64
65P.command {
66  font-family: monaco, courier, monospace;
67  margin-left: 36pt;
68}
69
70P.formula {
71  font-style: italic;
72  margin-left: 36pt;
73}
74
75BLOCKQUOTE {
76  background: #eeeeee;
77  border: solid thin #999999;
78  padding: 10pt;
79}
80
81A IMG {
82  border: none;
83}
84
85A:link:hover IMG {
86  background: #f0f0f0;
87  border-radius: 10px;
88  -moz-border-radius: 10px;
89}
90
91A:link, A:visited {
92  font-weight: inherit;
93  text-decoration: none;
94}
95
96A:link:hover, A:visited:hover, A:active {
97  text-decoration: underline;
98}
99
100SUB, SUP {
101  font-size: 50%;
102}
103
104TR.data, TD.data, TR.data TD {
105  margin-top: 10pt;
106  padding: 5pt;
107  border-bottom: solid 1pt #999999;
108}
109
110TR.data TH {
111  border-bottom: solid 1pt #999999;
112  padding-top: 10pt;
113  padding-left: 5pt;
114  text-align: left;
115}
116
117DIV.table TABLE {
118  border: solid thin #999999;
119  border-collapse: collapse;
120  border-spacing: 0;
121  margin-left: auto;
122  margin-right: auto;
123}
124
125DIV.table CAPTION {
126  caption-side: top;
127  font-size: 120%;
128  font-style: italic;
129  font-weight: bold;
130  margin-left: auto;
131  margin-right: auto;
132}
133
134DIV.table TABLE TD {
135  border: solid thin #cccccc;
136  padding-top: 5pt;
137}
138
139DIV.table TABLE TH {
140  background: #cccccc;
141  border: none;
142  border-bottom: solid thin #999999;
143}
144
145DIV.figure TABLE {
146  margin-left: auto;
147  margin-right: auto;
148}
149
150DIV.figure CAPTION {
151  caption-side: bottom;
152  font-size: 120%;
153  font-style: italic;
154  font-weight: bold;
155  margin-left: auto;
156  margin-right: auto;
157}
158
159TH.label {
160  text-align: right;
161  vertical-align: top;
162}
163
164TH.sublabel {
165  text-align: right;
166  font-weight: normal;
167}
168
169HR {
170  border: solid thin;
171}
172
173SPAN.info {
174  background: black;
175  border: thin solid black;
176  color: white;
177  font-size: 80%;
178  font-style: italic;
179  font-weight: bold;
180  white-space: nowrap;
181}
182
183H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
184  float: right;
185  font-size: 100%;
186}
187
188H1.title {
189}
190
191H2.title, H3.title {
192  border-bottom: solid 2pt #000000;
193}
194
195DIV.indent, TABLE.indent {
196  margin-top: 2em;
197  margin-left: auto;
198  margin-right: auto;
199  width: 90%;
200}
201
202TABLE.indent {
203  border-collapse: collapse;
204}
205
206TABLE.indent TD, TABLE.indent TH {
207  padding: 0;
208}
209
210TABLE.list {
211  border-collapse: collapse;
212  margin-left: auto;
213  margin-right: auto;
214  width: 90%;
215}
216
217TABLE.list TH {
218  background: white;
219  border-bottom: solid thin #cccccc;
220  color: #444444;
221  padding-top: 10pt;
222  padding-left: 5pt;
223  text-align: left;
224  vertical-align: bottom;
225  white-space: nowrap;
226}
227
228TABLE.list TH A {
229  color: #4444cc;
230}
231
232TABLE.list TD {
233  border-bottom: solid thin #eeeeee;
234  padding-top: 5pt;
235  padding-left: 5pt;
236}
237
238TABLE.list TR:nth-child(even) {
239  background: #f8f8f8;
240}
241
242TABLE.list TR:nth-child(odd) {
243  background: #f4f4f4;
244}
245
246DT {
247  margin-left: 36pt;
248  margin-top: 12pt;
249}
250
251DD {
252  margin-left: 54pt;
253}
254
255DL.category DT {
256  font-weight: bold;
257}
258
259P.summary {
260  margin-left: 36pt;
261  font-family: monaco, courier, monospace;
262}
263
264DIV.summary TABLE {
265  border: solid thin #999999;
266  border-collapse: collapse;
267  border-spacing: 0;
268  margin: 10px;
269}
270
271DIV.summary TABLE TD, DIV.summary TABLE TH {
272  border: solid thin #999999;
273  padding: 5px;
274  text-align: left;
275  vertical-align: top;
276}
277
278DIV.summary TABLE THEAD TH {
279  background: #eeeeee;
280}
281
282/* API documentation styles... */
283div.body h1 {
284  margin: 0;
285}
286div.body h2 {
287  margin-top: 1.5em;
288}
289div.body h3, div.body h4, div.body h5 {
290  margin-bottom: 0.5em;
291  margin-top: 1.5em;
292}
293.class, .enumeration, .function, .struct, .typedef, .union {
294  border-bottom: solid thin #999999;
295  margin-bottom: 0;
296  margin-top: 2em;
297}
298.description {
299  margin-top: 0.5em;
300}
301code, p.code, pre, ul.code li {
302  font-family: monaco, courier, monospace;
303  font-size: 90%;
304}
305ul.code, ul.contents, ul.subcontents {
306  list-style-type: none;
307  margin: 0;
308  padding-left: 0;
309}
310ul.code li {
311  margin: 0;
312}
313ul.contents > li {
314  margin-top: 1em;
315}
316ul.contents li ul.code, ul.contents li ul.subcontents {
317  padding-left: 2em;
318}
319div.body dl {
320  margin-left: 0;
321  margin-top: 0;
322}
323div.body dt {
324  font-style: italic;
325  margin-left: 0;
326  margin-top: 0;
327}
328div.body dd {
329  margin-bottom: 0.5em;
330}
331
332/* This is just for the HTML files generated with the framedhelp target */
333div.contents {
334  background: #e8e8e8;
335  border: solid thin black;
336  padding: 10px;
337}
338div.contents h1 {
339  font-size: 110%;
340}
341div.contents h2 {
342  font-size: 100%;
343}
344div.contents ul.contents {
345  font-size: 80%;
346}
347div.contents ul.subcontents li {
348  margin-left: 1em;
349  text-indent: -1em;
350}
351--></style>
352</head>
353<body>
354<div class='body'>
355<!--
356  "$Id: api-array.header 8087 2008-10-27 21:37:05Z mike $"
357
358  MIME API header for CUPS.
359
360  Copyright 2009 by Apple Inc.
361
362  These coded instructions, statements, and computer programs are the
363  property of Apple Inc. and are protected by Federal copyright
364  law.  Distribution and use rights are outlined in the file "LICENSE.txt"
365  which should have been included with this file.  If this file is
366  file is missing or damaged, see the license at "http://www.cups.org/".
367-->
368
369<h1 class='title'>MIME API</h1>
370
371<div class='summary'><table summary='General Information'>
372<thead>
373<tr>
374	<th>Header</th>
375	<th>cups/mime.h</th>
376</tr>
377</thead>
378<tbody>
379<tr>
380	<th>Library</th>
381	<td>-lcupsmime</td>
382</tr>
383<tr>
384	<th>See Also</th>
385	<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a></td>
386</tr>
387</tbody>
388</table></div>
389<h2 class="title">Contents</h2>
390<ul class="contents">
391<li><a href="#OVERVIEW">Overview</a></li>
392<li><a href="#FUNCTIONS">Functions</a><ul class="code">
393	<li><a href="#mimeAddFilter" title="Add a filter to the current MIME database.">mimeAddFilter</a></li>
394	<li><a href="#mimeAddType" title="Add a MIME type to a database.">mimeAddType</a></li>
395	<li><a href="#mimeAddTypeRule" title="Add a detection rule for a file type.">mimeAddTypeRule</a></li>
396	<li><a href="#mimeDelete" title="Delete (free) a MIME database.">mimeDelete</a></li>
397	<li><a href="#mimeDeleteFilter" title="Delete a filter from the MIME database.">mimeDeleteFilter</a></li>
398	<li><a href="#mimeDeleteType" title="Delete a type from the MIME database.">mimeDeleteType</a></li>
399	<li><a href="#mimeFileType" title="Determine the type of a file.">mimeFileType</a></li>
400	<li><a href="#mimeFilter" title="Find the fastest way to convert from one type to another.">mimeFilter</a></li>
401	<li><a href="#mimeFilter2" title="Find the fastest way to convert from one type to another,
402including file size.">mimeFilter2</a></li>
403	<li><a href="#mimeFilterLookup" title="Lookup a filter.">mimeFilterLookup</a></li>
404	<li><a href="#mimeFirstFilter" title="Get the first filter in the MIME database.">mimeFirstFilter</a></li>
405	<li><a href="#mimeFirstType" title="Get the first type in the MIME database.">mimeFirstType</a></li>
406	<li><a href="#mimeLoad" title="Create a new MIME database from disk.">mimeLoad</a></li>
407	<li><a href="#mimeLoadFilters" title="Load filter definitions from disk.">mimeLoadFilters</a></li>
408	<li><a href="#mimeLoadTypes" title="Load type definitions from disk.">mimeLoadTypes</a></li>
409	<li><a href="#mimeNew" title="Create a new, empty MIME database.">mimeNew</a></li>
410	<li><a href="#mimeNextFilter" title="Get the next filter in the MIME database.">mimeNextFilter</a></li>
411	<li><a href="#mimeNextType" title="Get the next type in the MIME database.">mimeNextType</a></li>
412	<li><a href="#mimeNumFilters" title="Next type">mimeNumFilters</a></li>
413	<li><a href="#mimeNumTypes" title="MIME database">mimeNumTypes</a></li>
414	<li><a href="#mimeSetErrorCallback" title="Set the callback for error messages.">mimeSetErrorCallback</a></li>
415	<li><a href="#mimeType" title="Lookup a file type.">mimeType</a></li>
416</ul></li>
417<li><a href="#TYPES">Data Types</a><ul class="code">
418	<li><a href="#const" title="MIME Database">const</a></li>
419	<li><a href="#mime_filter_t" title="MIME Conversion Filter Data">mime_filter_t</a></li>
420	<li><a href="#mime_magic_t" title="MIME Magic Data">mime_magic_t</a></li>
421	<li><a href="#mime_op_t" title="Types/structures...">mime_op_t</a></li>
422	<li><a href="#mime_t" title="MIME Database">mime_t</a></li>
423	<li><a href="#mime_type_t" title="MIME Type Data">mime_type_t</a></li>
424</ul></li>
425</ul>
426<!--
427  "$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $"
428
429  MIME API introduction for CUPS.
430
431  Copyright 2009 by Apple Inc.
432
433  These coded instructions, statements, and computer programs are the
434  property of Apple Inc. and are protected by Federal copyright
435  law.  Distribution and use rights are outlined in the file "LICENSE.txt"
436  which should have been included with this file.  If this file is
437  file is missing or damaged, see the license at "http://www.cups.org/".
438-->
439
440<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
441
442<p>The MIME API provides file typing and conversion services for CUPS.</p>
443<h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
444<h3 class="function"><a name="mimeAddFilter">mimeAddFilter</a></h3>
445<p class="description">Add a filter to the current MIME database.</p>
446<p class="code">
447<a href="#mime_filter_t">mime_filter_t</a> *mimeAddFilter (<br>
448&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
449&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *src,<br>
450&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *dst,<br>
451&nbsp;&nbsp;&nbsp;&nbsp;int cost,<br>
452&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *filter<br>
453);</p>
454<h4 class="parameters">Parameters</h4>
455<dl>
456<dt>mime</dt>
457<dd class="description">MIME database</dd>
458<dt>src</dt>
459<dd class="description">Source type</dd>
460<dt>dst</dt>
461<dd class="description">Destination type</dd>
462<dt>cost</dt>
463<dd class="description">Relative time/resource cost</dd>
464<dt>filter</dt>
465<dd class="description">Filter program to run</dd>
466</dl>
467<h4 class="returnvalue">Return Value</h4>
468<p class="description">New filter</p>
469<h3 class="function"><a name="mimeAddType">mimeAddType</a></h3>
470<p class="description">Add a MIME type to a database.</p>
471<p class="code">
472<a href="#mime_type_t">mime_type_t</a> *mimeAddType (<br>
473&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
474&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *super,<br>
475&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *type<br>
476);</p>
477<h4 class="parameters">Parameters</h4>
478<dl>
479<dt>mime</dt>
480<dd class="description">MIME database</dd>
481<dt>super</dt>
482<dd class="description">Super-type name</dd>
483<dt>type</dt>
484<dd class="description">Type name</dd>
485</dl>
486<h4 class="returnvalue">Return Value</h4>
487<p class="description">New (or existing) MIME type</p>
488<h3 class="function"><a name="mimeAddTypeRule">mimeAddTypeRule</a></h3>
489<p class="description">Add a detection rule for a file type.</p>
490<p class="code">
491int mimeAddTypeRule (<br>
492&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *mt,<br>
493&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *rule<br>
494);</p>
495<h4 class="parameters">Parameters</h4>
496<dl>
497<dt>mt</dt>
498<dd class="description">Type to add to</dd>
499<dt>rule</dt>
500<dd class="description">Rule to add</dd>
501</dl>
502<h4 class="returnvalue">Return Value</h4>
503<p class="description">0 on success, -1 on failure</p>
504<h3 class="function"><a name="mimeDelete">mimeDelete</a></h3>
505<p class="description">Delete (free) a MIME database.</p>
506<p class="code">
507void mimeDelete (<br>
508&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
509);</p>
510<h4 class="parameters">Parameters</h4>
511<dl>
512<dt>mime</dt>
513<dd class="description">MIME database</dd>
514</dl>
515<h3 class="function"><a name="mimeDeleteFilter">mimeDeleteFilter</a></h3>
516<p class="description">Delete a filter from the MIME database.</p>
517<p class="code">
518void mimeDeleteFilter (<br>
519&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
520&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_filter_t">mime_filter_t</a> *filter<br>
521);</p>
522<h4 class="parameters">Parameters</h4>
523<dl>
524<dt>mime</dt>
525<dd class="description">MIME database</dd>
526<dt>filter</dt>
527<dd class="description">Filter</dd>
528</dl>
529<h3 class="function"><a name="mimeDeleteType">mimeDeleteType</a></h3>
530<p class="description">Delete a type from the MIME database.</p>
531<p class="code">
532void mimeDeleteType (<br>
533&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
534&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *mt<br>
535);</p>
536<h4 class="parameters">Parameters</h4>
537<dl>
538<dt>mime</dt>
539<dd class="description">MIME database</dd>
540<dt>mt</dt>
541<dd class="description">Type</dd>
542</dl>
543<h3 class="function"><a name="mimeFileType">mimeFileType</a></h3>
544<p class="description">Determine the type of a file.</p>
545<p class="code">
546<a href="#mime_type_t">mime_type_t</a> *mimeFileType (<br>
547&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
548&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *pathname,<br>
549&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *filename,<br>
550&nbsp;&nbsp;&nbsp;&nbsp;int *compression<br>
551);</p>
552<h4 class="parameters">Parameters</h4>
553<dl>
554<dt>mime</dt>
555<dd class="description">MIME database</dd>
556<dt>pathname</dt>
557<dd class="description">Name of file to check on disk</dd>
558<dt>filename</dt>
559<dd class="description">Original filename or NULL</dd>
560<dt>compression</dt>
561<dd class="description">Is the file compressed?</dd>
562</dl>
563<h4 class="returnvalue">Return Value</h4>
564<p class="description">Type of file</p>
565<h3 class="function"><a name="mimeFilter">mimeFilter</a></h3>
566<p class="description">Find the fastest way to convert from one type to another.</p>
567<p class="code">
568cups_array_t *mimeFilter (<br>
569&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
570&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *src,<br>
571&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *dst,<br>
572&nbsp;&nbsp;&nbsp;&nbsp;int *cost<br>
573);</p>
574<h4 class="parameters">Parameters</h4>
575<dl>
576<dt>mime</dt>
577<dd class="description">MIME database</dd>
578<dt>src</dt>
579<dd class="description">Source file type</dd>
580<dt>dst</dt>
581<dd class="description">Destination file type</dd>
582<dt>cost</dt>
583<dd class="description">Cost of filters</dd>
584</dl>
585<h4 class="returnvalue">Return Value</h4>
586<p class="description">Array of filters to run</p>
587<h3 class="function"><a name="mimeFilter2">mimeFilter2</a></h3>
588<p class="description">Find the fastest way to convert from one type to another,
589including file size.</p>
590<p class="code">
591cups_array_t *mimeFilter2 (<br>
592&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
593&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *src,<br>
594&nbsp;&nbsp;&nbsp;&nbsp;size_t srcsize,<br>
595&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *dst,<br>
596&nbsp;&nbsp;&nbsp;&nbsp;int *cost<br>
597);</p>
598<h4 class="parameters">Parameters</h4>
599<dl>
600<dt>mime</dt>
601<dd class="description">MIME database</dd>
602<dt>src</dt>
603<dd class="description">Source file type</dd>
604<dt>srcsize</dt>
605<dd class="description">Size of source file</dd>
606<dt>dst</dt>
607<dd class="description">Destination file type</dd>
608<dt>cost</dt>
609<dd class="description">Cost of filters</dd>
610</dl>
611<h4 class="returnvalue">Return Value</h4>
612<p class="description">Array of filters to run</p>
613<h3 class="function"><a name="mimeFilterLookup">mimeFilterLookup</a></h3>
614<p class="description">Lookup a filter.</p>
615<p class="code">
616<a href="#mime_filter_t">mime_filter_t</a> *mimeFilterLookup (<br>
617&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
618&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *src,<br>
619&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_type_t">mime_type_t</a> *dst<br>
620);</p>
621<h4 class="parameters">Parameters</h4>
622<dl>
623<dt>mime</dt>
624<dd class="description">MIME database</dd>
625<dt>src</dt>
626<dd class="description">Source type</dd>
627<dt>dst</dt>
628<dd class="description">Destination type</dd>
629</dl>
630<h4 class="returnvalue">Return Value</h4>
631<p class="description">Filter for src-&gt;dst</p>
632<h3 class="function"><a name="mimeFirstFilter">mimeFirstFilter</a></h3>
633<p class="description">Get the first filter in the MIME database.</p>
634<p class="code">
635<a href="#mime_filter_t">mime_filter_t</a> *mimeFirstFilter (<br>
636&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
637);</p>
638<h4 class="parameters">Parameters</h4>
639<dl>
640<dt>mime</dt>
641<dd class="description">MIME database</dd>
642</dl>
643<h4 class="returnvalue">Return Value</h4>
644<p class="description">Filter or NULL</p>
645<h3 class="function"><a name="mimeFirstType">mimeFirstType</a></h3>
646<p class="description">Get the first type in the MIME database.</p>
647<p class="code">
648<a href="#mime_type_t">mime_type_t</a> *mimeFirstType (<br>
649&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
650);</p>
651<h4 class="parameters">Parameters</h4>
652<dl>
653<dt>mime</dt>
654<dd class="description">MIME database</dd>
655</dl>
656<h4 class="returnvalue">Return Value</h4>
657<p class="description">Type or NULL</p>
658<h3 class="function"><a name="mimeLoad">mimeLoad</a></h3>
659<p class="description">Create a new MIME database from disk.</p>
660<p class="code">
661<a href="#mime_t">mime_t</a> *mimeLoad (<br>
662&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *pathname,<br>
663&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *filterpath<br>
664);</p>
665<h4 class="parameters">Parameters</h4>
666<dl>
667<dt>pathname</dt>
668<dd class="description">Directory to load</dd>
669<dt>filterpath</dt>
670<dd class="description">Directory to load</dd>
671</dl>
672<h4 class="returnvalue">Return Value</h4>
673<p class="description">New MIME database</p>
674<h4 class="discussion">Discussion</h4>
675<p class="discussion">This function uses <a href="#mimeLoadFilters"><code>mimeLoadFilters</code></a> and <a href="#mimeLoadTypes"><code>mimeLoadTypes</code></a> to
676create a MIME database from a single directory.</p>
677<h3 class="function"><a name="mimeLoadFilters">mimeLoadFilters</a></h3>
678<p class="description">Load filter definitions from disk.</p>
679<p class="code">
680<a href="#mime_t">mime_t</a> *mimeLoadFilters (<br>
681&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
682&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *pathname,<br>
683&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *filterpath<br>
684);</p>
685<h4 class="parameters">Parameters</h4>
686<dl>
687<dt>mime</dt>
688<dd class="description">MIME database</dd>
689<dt>pathname</dt>
690<dd class="description">Directory to load from</dd>
691<dt>filterpath</dt>
692<dd class="description">Default filter program directory</dd>
693</dl>
694<h4 class="returnvalue">Return Value</h4>
695<p class="description">MIME database</p>
696<h4 class="discussion">Discussion</h4>
697<p class="discussion">This function loads all of the .convs files from the specified directory.
698Use <a href="#mimeLoadTypes"><code>mimeLoadTypes</code></a> to load all types before you load the filters.</p>
699<h3 class="function"><a name="mimeLoadTypes">mimeLoadTypes</a></h3>
700<p class="description">Load type definitions from disk.</p>
701<p class="code">
702<a href="#mime_t">mime_t</a> *mimeLoadTypes (<br>
703&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
704&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *pathname<br>
705);</p>
706<h4 class="parameters">Parameters</h4>
707<dl>
708<dt>mime</dt>
709<dd class="description">MIME database or <code>NULL</code> to create a new one</dd>
710<dt>pathname</dt>
711<dd class="description">Directory to load from</dd>
712</dl>
713<h4 class="returnvalue">Return Value</h4>
714<p class="description">MIME database</p>
715<h4 class="discussion">Discussion</h4>
716<p class="discussion">This function loads all of the .types files from the specified directory.
717Use <a href="#mimeLoadFilters"><code>mimeLoadFilters</code></a> to load all filters after you load the types.</p>
718<h3 class="function"><a name="mimeNew">mimeNew</a></h3>
719<p class="description">Create a new, empty MIME database.</p>
720<p class="code">
721<a href="#mime_t">mime_t</a> *mimeNew (void);</p>
722<h4 class="returnvalue">Return Value</h4>
723<p class="description">MIME database</p>
724<h3 class="function"><a name="mimeNextFilter">mimeNextFilter</a></h3>
725<p class="description">Get the next filter in the MIME database.</p>
726<p class="code">
727<a href="#mime_filter_t">mime_filter_t</a> *mimeNextFilter (<br>
728&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
729);</p>
730<h4 class="parameters">Parameters</h4>
731<dl>
732<dt>mime</dt>
733<dd class="description">MIME database</dd>
734</dl>
735<h4 class="returnvalue">Return Value</h4>
736<p class="description">Filter or NULL</p>
737<h3 class="function"><a name="mimeNextType">mimeNextType</a></h3>
738<p class="description">Get the next type in the MIME database.</p>
739<p class="code">
740<a href="#mime_type_t">mime_type_t</a> *mimeNextType (<br>
741&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
742);</p>
743<h4 class="parameters">Parameters</h4>
744<dl>
745<dt>mime</dt>
746<dd class="description">MIME database</dd>
747</dl>
748<h4 class="returnvalue">Return Value</h4>
749<p class="description">Type or NULL</p>
750<h3 class="function"><a name="mimeNumFilters">mimeNumFilters</a></h3>
751<p class="description">Next type</p>
752<p class="code">
753int mimeNumFilters (<br>
754&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
755);</p>
756<h4 class="parameters">Parameters</h4>
757<dl>
758<dt>mime</dt>
759<dd class="description">MIME database</dd>
760</dl>
761<h4 class="returnvalue">Return Value</h4>
762<p class="description">Get the number of filters in a MIME database.</p>
763<h3 class="function"><a name="mimeNumTypes">mimeNumTypes</a></h3>
764<p class="description">MIME database</p>
765<p class="code">
766int mimeNumTypes (<br>
767&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime<br>
768);</p>
769<h4 class="parameters">Parameters</h4>
770<dl>
771<dt>mime</dt>
772<dd class="description">MIME database</dd>
773</dl>
774<h4 class="returnvalue">Return Value</h4>
775<p class="description">Get the number of types in a MIME database.</p>
776<h3 class="function"><a name="mimeSetErrorCallback">mimeSetErrorCallback</a></h3>
777<p class="description">Set the callback for error messages.</p>
778<p class="code">
779void mimeSetErrorCallback (<br>
780&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
781&nbsp;&nbsp;&nbsp;&nbsp;mime_error_cb_t cb,<br>
782&nbsp;&nbsp;&nbsp;&nbsp;void *ctx<br>
783);</p>
784<h4 class="parameters">Parameters</h4>
785<dl>
786<dt>mime</dt>
787<dd class="description">MIME database</dd>
788<dt>cb</dt>
789<dd class="description">Callback function</dd>
790<dt>ctx</dt>
791<dd class="description">Context pointer for callback</dd>
792</dl>
793<h3 class="function"><a name="mimeType">mimeType</a></h3>
794<p class="description">Lookup a file type.</p>
795<p class="code">
796<a href="#mime_type_t">mime_type_t</a> *mimeType (<br>
797&nbsp;&nbsp;&nbsp;&nbsp;<a href="#mime_t">mime_t</a> *mime,<br>
798&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *super,<br>
799&nbsp;&nbsp;&nbsp;&nbsp;<a href="#const">const</a> char *type<br>
800);</p>
801<h4 class="parameters">Parameters</h4>
802<dl>
803<dt>mime</dt>
804<dd class="description">MIME database</dd>
805<dt>super</dt>
806<dd class="description">Super-type name</dd>
807<dt>type</dt>
808<dd class="description">Type name</dd>
809</dl>
810<h4 class="returnvalue">Return Value</h4>
811<p class="description">Matching file type definition</p>
812<h2 class="title"><a name="TYPES">Data Types</a></h2>
813<h3 class="typedef"><a name="const">const</a></h3>
814<p class="description">MIME Database</p>
815<p class="code">
816typedef void (*constmime_error_cb_t)(void *;
817</p>
818<h3 class="typedef"><a name="mime_filter_t">mime_filter_t</a></h3>
819<p class="description">MIME Conversion Filter Data</p>
820<p class="code">
821typedef struct _mime_filter_s mime_filter_t;
822</p>
823<h3 class="typedef"><a name="mime_magic_t">mime_magic_t</a></h3>
824<p class="description">MIME Magic Data</p>
825<p class="code">
826typedef struct _mime_magic_s mime_magic_t;
827</p>
828<h3 class="typedef"><a name="mime_op_t">mime_op_t</a></h3>
829<p class="description">Types/structures...</p>
830<p class="code">
831typedef enum mime_op_t;
832</p>
833<h3 class="typedef"><a name="mime_t">mime_t</a></h3>
834<p class="description">MIME Database</p>
835<p class="code">
836typedef struct _mime_s mime_t;
837</p>
838<h3 class="typedef"><a name="mime_type_t">mime_type_t</a></h3>
839<p class="description">MIME Type Data</p>
840<p class="code">
841typedef struct _mime_type_s mime_type_t;
842</p>
843</div>
844</body>
845</html>
846