source: trunk/zoo-project/zoo-kernel/mimetypes.h @ 908

Last change on this file since 908 was 601, checked in by knut, 10 years ago

Implemented default result file extensions for many MIME types, based on Apache's mime.types list. Added file mimetypes.h. Made function printIOType more general with respect to media content. Rewrote the XML parsing of the <ResponseDocument?> block in Execute requests to fix problem caused by one output variable inheriting properties from another. Minor memory allocation modification in zoo_loader.c.

File size: 32.9 KB
Line 
1#include "service.h"
2 
3typedef enum MimeTypes {
4         M_Type,
5         M_Extension
6} mimetype;
7
8#define NUM_MIME_TYPES 767
9
10/*
11 * This array has been constructed based on the
12 * Apache web server's mime.types file
13 */
14const char* const MIME[NUM_MIME_TYPES][2] = {
15        { "application/andrew-inset", "ez" },
16        { "application/applixware", "aw" },
17        { "application/atom+xml", "atom" },
18        { "application/atomcat+xml", "atomcat" },
19        { "application/atomsvc+xml", "atomsvc" },
20        { "application/ccxml+xml", "ccxml" },
21        { "application/cdmi-capability", "cdmia" },
22        { "application/cdmi-container", "cdmic" },
23        { "application/cdmi-domain", "cdmid" },
24        { "application/cdmi-object", "cdmio" },
25        { "application/cdmi-queue", "cdmiq" },
26        { "application/cu-seeme", "cu" },
27        { "application/davmount+xml", "davmount" },
28        { "application/docbook+xml", "dbk" },
29        { "application/dssc+der", "dssc" },
30        { "application/dssc+xml", "xdssc" },
31        { "application/ecmascript", "ecma" },
32        { "application/emma+xml", "emma" },
33        { "application/epub+zip", "epub" },
34        { "application/exi", "exi" },
35        { "application/font-tdpfr", "pfr" },
36        { "application/gml+xml", "gml" },
37        { "application/gpx+xml", "gpx" },
38        { "application/gxf", "gxf" },
39        { "application/hyperstudio", "stk" },
40        { "application/inkml+xml", "ink" },
41        { "application/ipfix", "ipfix" },
42        { "application/java-archive", "jar" },
43        { "application/java-serialized-object", "ser" },
44        { "application/java-vm", "class" },
45        { "application/javascript", "js" },
46        { "application/json", "json" },
47        { "application/jsonml+json", "jsonml" },
48        { "application/lost+xml", "lostxml" },
49        { "application/mac-binhex40", "hqx" },
50        { "application/mac-compactpro", "cpt" },
51        { "application/mads+xml", "mads" },
52        { "application/marc", "mrc" },
53        { "application/marcxml+xml", "mrcx" },
54        { "application/mathematica", "ma" },
55        { "application/mathml+xml", "mathml" },
56        { "application/mbox", "mbox" },
57        { "application/mediaservercontrol+xml", "mscml" },
58        { "application/metalink+xml", "metalink" },
59        { "application/metalink4+xml", "meta4" },
60        { "application/mets+xml", "mets" },
61        { "application/mods+xml", "mods" },
62        { "application/mp21", "m21" },
63        { "application/mp4", "mp4s" },
64        { "application/msword", "doc" },
65        { "application/mxf", "mxf" },
66        { "application/octet-stream", "bin" },
67        { "application/oda", "oda" },
68        { "application/oebps-package+xml", "opf" },
69        { "application/ogg", "ogx" },
70        { "application/omdoc+xml", "omdoc" },
71        { "application/onenote", "onetoc" },
72        { "application/oxps", "oxps" },
73        { "application/patch-ops-error+xml", "xer" },
74        { "application/pdf", "pdf" },
75        { "application/pgp-encrypted", "pgp" },
76        { "application/pgp-signature", "asc" },
77        { "application/pics-rules", "prf" },
78        { "application/pkcs10", "p10" },
79        { "application/pkcs7-mime", "p7m" },
80        { "application/pkcs7-signature", "p7s" },
81        { "application/pkcs8", "p8" },
82        { "application/pkix-attr-cert", "ac" },
83        { "application/pkix-cert", "cer" },
84        { "application/pkix-crl", "crl" },
85        { "application/pkix-pkipath", "pkipath" },
86        { "application/pkixcmp", "pki" },
87        { "application/pls+xml", "pls" },
88        { "application/postscript", "ps" },
89        { "application/prs.cww", "cww" },
90        { "application/pskc+xml", "pskcxml" },
91        { "application/rdf+xml", "rdf" },
92        { "application/reginfo+xml", "rif" },
93        { "application/relax-ng-compact-syntax", "rnc" },
94        { "application/resource-lists+xml", "rl" },
95        { "application/resource-lists-diff+xml", "rld" },
96        { "application/rls-services+xml", "rs" },
97        { "application/rpki-ghostbusters", "gbr" },
98        { "application/rpki-manifest", "mft" },
99        { "application/rpki-roa", "roa" },
100        { "application/rsd+xml", "rsd" },
101        { "application/rss+xml", "rss" },
102        { "application/rtf", "rtf" },
103        { "application/sbml+xml", "sbml" },
104        { "application/scvp-cv-request", "scq" },
105        { "application/scvp-cv-response", "scs" },
106        { "application/scvp-vp-request", "spq" },
107        { "application/scvp-vp-response", "spp" },
108        { "application/sdp", "sdp" },
109        { "application/set-payment-initiation", "setpay" },
110        { "application/set-registration-initiation", "setreg" },
111        { "application/shf+xml", "shf" },
112        { "application/smil+xml", "smi" },
113        { "application/sparql-query", "rq" },
114        { "application/sparql-results+xml", "srx" },
115        { "application/srgs", "gram" },
116        { "application/srgs+xml", "grxml" },
117        { "application/sru+xml", "sru" },
118        { "application/ssdl+xml", "ssdl" },
119        { "application/ssml+xml", "ssml" },
120        { "application/tei+xml", "tei" },
121        { "application/thraud+xml", "tfi" },
122        { "application/timestamped-data", "tsd" },
123        { "application/vnd.3gpp.pic-bw-large", "plb" },
124        { "application/vnd.3gpp.pic-bw-small", "psb" },
125        { "application/vnd.3gpp.pic-bw-var", "pvb" },
126        { "application/vnd.3gpp2.tcap", "tcap" },
127        { "application/vnd.3m.post-it-notes", "pwn" },
128        { "application/vnd.accpac.simply.aso", "aso" },
129        { "application/vnd.accpac.simply.imp", "imp" },
130        { "application/vnd.acucobol", "acu" },
131        { "application/vnd.acucorp", "atc" },
132        { "application/vnd.adobe.air-application-installer-package+zip", "air" },
133        { "application/vnd.adobe.formscentral.fcdt", "fcdt" },
134        { "application/vnd.adobe.fxp", "fxp" },
135        { "application/vnd.adobe.xdp+xml", "xdp" },
136        { "application/vnd.adobe.xfdf", "xfdf" },
137        { "application/vnd.ahead.space", "ahead" },
138        { "application/vnd.airzip.filesecure.azf", "azf" },
139        { "application/vnd.airzip.filesecure.azs", "azs" },
140        { "application/vnd.amazon.ebook", "azw" },
141        { "application/vnd.americandynamics.acc", "acc" },
142        { "application/vnd.amiga.ami", "ami" },
143        { "application/vnd.android.package-archive", "apk" },
144        { "application/vnd.anser-web-certificate-issue-initiation", "cii" },
145        { "application/vnd.anser-web-funds-transfer-initiation", "fti" },
146        { "application/vnd.antix.game-component", "atx" },
147        { "application/vnd.apple.installer+xml", "mpkg" },
148        { "application/vnd.apple.mpegurl", "m3u8" },
149        { "application/vnd.aristanetworks.swi", "swi" },
150        { "application/vnd.astraea-software.iota", "iota" },
151        { "application/vnd.audiograph", "aep" },
152        { "application/vnd.blueice.multipass", "mpm" },
153        { "application/vnd.bmi", "bmi" },
154        { "application/vnd.businessobjects", "rep" },
155        { "application/vnd.chemdraw+xml", "cdxml" },
156        { "application/vnd.chipnuts.karaoke-mmd", "mmd" },
157        { "application/vnd.cinderella", "cdy" },
158        { "application/vnd.claymore", "cla" },
159        { "application/vnd.cloanto.rp9", "rp9" },
160        { "application/vnd.clonk.c4group", "c4g" },
161        { "application/vnd.cluetrust.cartomobile-config", "c11amc" },
162        { "application/vnd.cluetrust.cartomobile-config-pkg", "c11amz" },
163        { "application/vnd.commonspace", "csp" },
164        { "application/vnd.contact.cmsg", "cdbcmsg" },
165        { "application/vnd.cosmocaller", "cmc" },
166        { "application/vnd.crick.clicker", "clkx" },
167        { "application/vnd.crick.clicker.keyboard", "clkk" },
168        { "application/vnd.crick.clicker.palette", "clkp" },
169        { "application/vnd.crick.clicker.template", "clkt" },
170        { "application/vnd.crick.clicker.wordbank", "clkw" },
171        { "application/vnd.criticaltools.wbs+xml", "wbs" },
172        { "application/vnd.ctc-posml", "pml" },
173        { "application/vnd.cups-ppd", "ppd" },
174        { "application/vnd.curl.car", "car" },
175        { "application/vnd.curl.pcurl", "pcurl" },
176        { "application/vnd.dart", "dart" },
177        { "application/vnd.data-vision.rdz", "rdz" },
178        { "application/vnd.dece.data", "uvf" },
179        { "application/vnd.dece.ttml+xml", "uvt" },
180        { "application/vnd.dece.unspecified", "uvx" },
181        { "application/vnd.dece.zip", "uvz" },
182        { "application/vnd.denovo.fcselayout-link", "fe_launch" },
183        { "application/vnd.dna", "dna" },
184        { "application/vnd.dolby.mlp", "mlp" },
185        { "application/vnd.dpgraph", "dpg" },
186        { "application/vnd.dreamfactory", "dfac" },
187        { "application/vnd.ds-keypoint", "kpxx" },
188        { "application/vnd.dvb.ait", "ait" },
189        { "application/vnd.dvb.service", "svc" },
190        { "application/vnd.dynageo", "geo" },
191        { "application/vnd.ecowin.chart", "mag" },
192        { "application/vnd.enliven", "nml" },
193        { "application/vnd.epson.esf", "esf" },
194        { "application/vnd.epson.msf", "msf" },
195        { "application/vnd.epson.quickanime", "qam" },
196        { "application/vnd.epson.salt", "slt" },
197        { "application/vnd.epson.ssf", "ssf" },
198        { "application/vnd.eszigno3+xml", "es3" },
199        { "application/vnd.ezpix-album", "ez2" },
200        { "application/vnd.ezpix-package", "ez3" },
201        { "application/vnd.fdf", "fdf" },
202        { "application/vnd.fdsn.mseed", "mseed" },
203        { "application/vnd.fdsn.seed", "seed" },
204        { "application/vnd.flographit", "gph" },
205        { "application/vnd.fluxtime.clip", "ftc" },
206        { "application/vnd.framemaker", "fm" },
207        { "application/vnd.frogans.fnc", "fnc" },
208        { "application/vnd.frogans.ltf", "ltf" },
209        { "application/vnd.fsc.weblaunch", "fsc" },
210        { "application/vnd.fujitsu.oasys", "oas" },
211        { "application/vnd.fujitsu.oasys2", "oa2" },
212        { "application/vnd.fujitsu.oasys3", "oa3" },
213        { "application/vnd.fujitsu.oasysgp", "fg5" },
214        { "application/vnd.fujitsu.oasysprs", "bh2" },
215        { "application/vnd.fujixerox.ddd", "ddd" },
216        { "application/vnd.fujixerox.docuworks", "xdw" },
217        { "application/vnd.fujixerox.docuworks.binder", "xbd" },
218        { "application/vnd.fuzzysheet", "fzs" },
219        { "application/vnd.genomatix.tuxedo", "txd" },
220        { "application/vnd.geogebra.file", "ggb" },
221        { "application/vnd.geogebra.tool", "ggt" },
222        { "application/vnd.geometry-explorer", "gex" },
223        { "application/vnd.geonext", "gxt" },
224        { "application/vnd.geoplan", "g2w" },
225        { "application/vnd.geospace", "g3w" },
226        { "application/vnd.gmx", "gmx" },
227        { "application/vnd.google-earth.kml+xml", "kml" },
228        { "application/vnd.google-earth.kmz", "kmz" },
229        { "application/vnd.grafeq", "gqf" },
230        { "application/vnd.groove-account", "gac" },
231        { "application/vnd.groove-help", "ghf" },
232        { "application/vnd.groove-identity-message", "gim" },
233        { "application/vnd.groove-injector", "grv" },
234        { "application/vnd.groove-tool-message", "gtm" },
235        { "application/vnd.groove-tool-template", "tpl" },
236        { "application/vnd.groove-vcard", "vcg" },
237        { "application/vnd.hal+xml", "hal" },
238        { "application/vnd.handheld-entertainment+xml", "zmm" },
239        { "application/vnd.hbci", "hbci" },
240        { "application/vnd.hhe.lesson-player", "les" },
241        { "application/vnd.hp-hpgl", "hpgl" },
242        { "application/vnd.hp-hpid", "hpid" },
243        { "application/vnd.hp-hps", "hps" },
244        { "application/vnd.hp-jlyt", "jlt" },
245        { "application/vnd.hp-pcl", "pcl" },
246        { "application/vnd.hp-pclxl", "pclxl" },
247        { "application/vnd.hydrostatix.sof-data", "sfd-hdstx" },
248        { "application/vnd.ibm.minipay", "mpy" },
249        { "application/vnd.ibm.modcap", "afp" },
250        { "application/vnd.ibm.rights-management", "irm" },
251        { "application/vnd.ibm.secure-container", "sc" },
252        { "application/vnd.iccprofile", "icc" },
253        { "application/vnd.igloader", "igl" },
254        { "application/vnd.immervision-ivp", "ivp" },
255        { "application/vnd.immervision-ivu", "ivu" },
256        { "application/vnd.insors.igm", "igm" },
257        { "application/vnd.intercon.formnet", "xpw" },
258        { "application/vnd.intergeo", "i2g" },
259        { "application/vnd.intu.qbo", "qbo" },
260        { "application/vnd.intu.qfx", "qfx" },
261        { "application/vnd.ipunplugged.rcprofile", "rcprofile" },
262        { "application/vnd.irepository.package+xml", "irp" },
263        { "application/vnd.is-xpr", "xpr" },
264        { "application/vnd.isac.fcs", "fcs" },
265        { "application/vnd.jam", "jam" },
266        { "application/vnd.jcp.javame.midlet-rms", "rms" },
267        { "application/vnd.jisp", "jisp" },
268        { "application/vnd.joost.joda-archive", "joda" },
269        { "application/vnd.kahootz", "ktz" },
270        { "application/vnd.kde.karbon", "karbon" },
271        { "application/vnd.kde.kchart", "chrt" },
272        { "application/vnd.kde.kformula", "kfo" },
273        { "application/vnd.kde.kivio", "flw" },
274        { "application/vnd.kde.kontour", "kon" },
275        { "application/vnd.kde.kpresenter", "kpr" },
276        { "application/vnd.kde.kspread", "ksp" },
277        { "application/vnd.kde.kword", "kwd" },
278        { "application/vnd.kenameaapp", "htke" },
279        { "application/vnd.kidspiration", "kia" },
280        { "application/vnd.kinar", "kne" },
281        { "application/vnd.koan", "skp" },
282        { "application/vnd.kodak-descriptor", "sse" },
283        { "application/vnd.las.las+xml", "lasxml" },
284        { "application/vnd.llamagraphics.life-balance.desktop", "lbd" },
285        { "application/vnd.llamagraphics.life-balance.exchange+xml", "lbe" },
286        { "application/vnd.lotus-1-2-3", "123" },
287        { "application/vnd.lotus-approach", "apr" },
288        { "application/vnd.lotus-freelance", "pre" },
289        { "application/vnd.lotus-notes", "nsf" },
290        { "application/vnd.lotus-organizer", "org" },
291        { "application/vnd.lotus-screencam", "scm" },
292        { "application/vnd.lotus-wordpro", "lwp" },
293        { "application/vnd.macports.portpkg", "portpkg" },
294        { "application/vnd.mcd", "mcd" },
295        { "application/vnd.medcalcdata", "mc1" },
296        { "application/vnd.mediastation.cdkey", "cdkey" },
297        { "application/vnd.mfer", "mwf" },
298        { "application/vnd.mfmp", "mfm" },
299        { "application/vnd.micrografx.flo", "flo" },
300        { "application/vnd.micrografx.igx", "igx" },
301        { "application/vnd.mif", "mif" },
302        { "application/vnd.mobius.daf", "daf" },
303        { "application/vnd.mobius.dis", "dis" },
304        { "application/vnd.mobius.mbk", "mbk" },
305        { "application/vnd.mobius.mqy", "mqy" },
306        { "application/vnd.mobius.msl", "msl" },
307        { "application/vnd.mobius.plc", "plc" },
308        { "application/vnd.mobius.txf", "txf" },
309        { "application/vnd.mophun.application", "mpn" },
310        { "application/vnd.mophun.certificate", "mpc" },
311        { "application/vnd.mozilla.xul+xml", "xul" },
312        { "application/vnd.ms-artgalry", "cil" },
313        { "application/vnd.ms-cab-compressed", "cab" },
314        { "application/vnd.ms-excel", "xls" },
315        { "application/vnd.ms-excel.addin.macroenabled.12", "xlam" },
316        { "application/vnd.ms-excel.sheet.binary.macroenabled.12", "xlsb" },
317        { "application/vnd.ms-excel.sheet.macroenabled.12", "xlsm" },
318        { "application/vnd.ms-excel.template.macroenabled.12", "xltm" },
319        { "application/vnd.ms-fontobject", "eot" },
320        { "application/vnd.ms-htmlhelp", "chm" },
321        { "application/vnd.ms-ims", "ims" },
322        { "application/vnd.ms-lrm", "lrm" },
323        { "application/vnd.ms-officetheme", "thmx" },
324        { "application/vnd.ms-pki.seccat", "cat" },
325        { "application/vnd.ms-pki.stl", "stl" },
326        { "application/vnd.ms-powerpoint", "ppt" },
327        { "application/vnd.ms-powerpoint.addin.macroenabled.12", "ppam" },
328        { "application/vnd.ms-powerpoint.presentation.macroenabled.12", "pptm" },
329        { "application/vnd.ms-powerpoint.slide.macroenabled.12", "sldm" },
330        { "application/vnd.ms-powerpoint.slideshow.macroenabled.12", "ppsm" },
331        { "application/vnd.ms-powerpoint.template.macroenabled.12", "potm" },
332        { "application/vnd.ms-project", "mpp" },
333        { "application/vnd.ms-word.document.macroenabled.12", "docm" },
334        { "application/vnd.ms-word.template.macroenabled.12", "dotm" },
335        { "application/vnd.ms-works", "wps" },
336        { "application/vnd.ms-wpl", "wpl" },
337        { "application/vnd.ms-xpsdocument", "xps" },
338        { "application/vnd.mseq", "mseq" },
339        { "application/vnd.musician", "mus" },
340        { "application/vnd.muvee.style", "msty" },
341        { "application/vnd.mynfc", "taglet" },
342        { "application/vnd.neurolanguage.nlu", "nlu" },
343        { "application/vnd.nitf", "ntf" },
344        { "application/vnd.noblenet-directory", "nnd" },
345        { "application/vnd.noblenet-sealer", "nns" },
346        { "application/vnd.noblenet-web", "nnw" },
347        { "application/vnd.nokia.n-gage.data", "ngdat" },
348        { "application/vnd.nokia.n-gage.symbian.install", "n-gage" },
349        { "application/vnd.nokia.radio-preset", "rpst" },
350        { "application/vnd.nokia.radio-presets", "rpss" },
351        { "application/vnd.novadigm.edm", "edm" },
352        { "application/vnd.novadigm.edx", "edx" },
353        { "application/vnd.novadigm.ext", "ext" },
354        { "application/vnd.oasis.opendocument.chart", "odc" },
355        { "application/vnd.oasis.opendocument.chart-template", "otc" },
356        { "application/vnd.oasis.opendocument.database", "odb" },
357        { "application/vnd.oasis.opendocument.formula", "odf" },
358        { "application/vnd.oasis.opendocument.formula-template", "odft" },
359        { "application/vnd.oasis.opendocument.graphics", "odg" },
360        { "application/vnd.oasis.opendocument.graphics-template", "otg" },
361        { "application/vnd.oasis.opendocument.image", "odi" },
362        { "application/vnd.oasis.opendocument.image-template", "oti" },
363        { "application/vnd.oasis.opendocument.presentation", "odp" },
364        { "application/vnd.oasis.opendocument.presentation-template", "otp" },
365        { "application/vnd.oasis.opendocument.spreadsheet", "ods" },
366        { "application/vnd.oasis.opendocument.spreadsheet-template", "ots" },
367        { "application/vnd.oasis.opendocument.text", "odt" },
368        { "application/vnd.oasis.opendocument.text-master", "odm" },
369        { "application/vnd.oasis.opendocument.text-template", "ott" },
370        { "application/vnd.oasis.opendocument.text-web", "oth" },
371        { "application/vnd.olpc-sugar", "xo" },
372        { "application/vnd.oma.dd2+xml", "dd2" },
373        { "application/vnd.openofficeorg.extension", "oxt" },
374        { "application/vnd.openxmlformats-officedocument.presentationml.presentation", "pptx" },
375        { "application/vnd.openxmlformats-officedocument.presentationml.slide", "sldx" },
376        { "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "ppsx" },
377        { "application/vnd.openxmlformats-officedocument.presentationml.template", "potx" },
378        { "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xlsx" },
379        { "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "xltx" },
380        { "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "docx" },
381        { "application/vnd.openxmlformats-officedocument.wordprocessingml.template", "dotx" },
382        { "application/vnd.osgeo.mapguide.package", "mgp" },
383        { "application/vnd.osgi.dp", "dp" },
384        { "application/vnd.osgi.subsystem", "esa" },
385        { "application/vnd.palm", "pdb" },
386        { "application/vnd.pawaafile", "paw" },
387        { "application/vnd.pg.format", "str" },
388        { "application/vnd.pg.osasli", "ei6" },
389        { "application/vnd.picsel", "efif" },
390        { "application/vnd.pmi.widget", "wg" },
391        { "application/vnd.pocketlearn", "plf" },
392        { "application/vnd.powerbuilder6", "pbd" },
393        { "application/vnd.previewsystems.box", "box" },
394        { "application/vnd.proteus.magazine", "mgz" },
395        { "application/vnd.publishare-delta-tree", "qps" },
396        { "application/vnd.pvi.ptid1", "ptid" },
397        { "application/vnd.quark.quarkxpress", "qxd" },
398        { "application/vnd.realvnc.bed", "bed" },
399        { "application/vnd.recordare.musicxml", "mxl" },
400        { "application/vnd.recordare.musicxml+xml", "musicxml" },
401        { "application/vnd.rig.cryptonote", "cryptonote" },
402        { "application/vnd.rim.cod", "cod" },
403        { "application/vnd.rn-realmedia", "rm" },
404        { "application/vnd.rn-realmedia-vbr", "rmvb" },
405        { "application/vnd.route66.link66+xml", "link66" },
406        { "application/vnd.sailingtracker.track", "st" },
407        { "application/vnd.seemail", "see" },
408        { "application/vnd.sema", "sema" },
409        { "application/vnd.semd", "semd" },
410        { "application/vnd.semf", "semf" },
411        { "application/vnd.shana.informed.formdata", "ifm" },
412        { "application/vnd.shana.informed.formtemplate", "itp" },
413        { "application/vnd.shana.informed.interchange", "iif" },
414        { "application/vnd.shana.informed.package", "ipk" },
415        { "application/vnd.simtech-mindmapper", "twd" },
416        { "application/vnd.smaf", "mmf" },
417        { "application/vnd.smart.teacher", "teacher" },
418        { "application/vnd.solent.sdkm+xml", "sdkm" },
419        { "application/vnd.spotfire.dxp", "dxp" },
420        { "application/vnd.spotfire.sfs", "sfs" },
421        { "application/vnd.stardivision.calc", "sdc" },
422        { "application/vnd.stardivision.draw", "sda" },
423        { "application/vnd.stardivision.impress", "sdd" },
424        { "application/vnd.stardivision.math", "smf" },
425        { "application/vnd.stardivision.writer", "sdw" },
426        { "application/vnd.stardivision.writer-global", "sgl" },
427        { "application/vnd.stepmania.package", "smzip" },
428        { "application/vnd.stepmania.stepchart", "sm" },
429        { "application/vnd.sun.xml.calc", "sxc" },
430        { "application/vnd.sun.xml.calc.template", "stc" },
431        { "application/vnd.sun.xml.draw", "sxd" },
432        { "application/vnd.sun.xml.draw.template", "std" },
433        { "application/vnd.sun.xml.impress", "sxi" },
434        { "application/vnd.sun.xml.impress.template", "sti" },
435        { "application/vnd.sun.xml.math", "sxm" },
436        { "application/vnd.sun.xml.writer", "sxw" },
437        { "application/vnd.sun.xml.writer.global", "sxg" },
438        { "application/vnd.sun.xml.writer.template", "stw" },
439        { "application/vnd.sus-calendar", "sus" },
440        { "application/vnd.svd", "svd" },
441        { "application/vnd.symbian.install", "sis" },
442        { "application/vnd.syncml+xml", "xsm" },
443        { "application/vnd.syncml.dm+wbxml", "bdm" },
444        { "application/vnd.syncml.dm+xml", "xdm" },
445        { "application/vnd.tao.intent-module-archive", "tao" },
446        { "application/vnd.tcpdump.pcap", "pcap" },
447        { "application/vnd.tmobile-livetv", "tmo" },
448        { "application/vnd.trid.tpt", "tpt" },
449        { "application/vnd.triscape.mxs", "mxs" },
450        { "application/vnd.trueapp", "tra" },
451        { "application/vnd.ufdl", "ufd" },
452        { "application/vnd.uiq.theme", "utz" },
453        { "application/vnd.umajin", "umj" },
454        { "application/vnd.unity", "unityweb" },
455        { "application/vnd.uoml+xml", "uoml" },
456        { "application/vnd.vcx", "vcx" },
457        { "application/vnd.visio", "vsd" },
458        { "application/vnd.visionary", "vis" },
459        { "application/vnd.vsf", "vsf" },
460        { "application/vnd.wap.wbxml", "wbxml" },
461        { "application/vnd.wap.wmlc", "wmlc" },
462        { "application/vnd.wap.wmlscriptc", "wmlsc" },
463        { "application/vnd.webturbo", "wtb" },
464        { "application/vnd.wolfram.player", "nbp" },
465        { "application/vnd.wordperfect", "wpd" },
466        { "application/vnd.wqd", "wqd" },
467        { "application/vnd.wt.stf", "stf" },
468        { "application/vnd.xara", "xar" },
469        { "application/vnd.xfdl", "xfdl" },
470        { "application/vnd.yamaha.hv-dic", "hvd" },
471        { "application/vnd.yamaha.hv-script", "hvs" },
472        { "application/vnd.yamaha.hv-voice", "hvp" },
473        { "application/vnd.yamaha.openscoreformat", "osf" },
474        { "application/vnd.yamaha.openscoreformat.osfpvg+xml", "osfpvg" },
475        { "application/vnd.yamaha.smaf-audio", "saf" },
476        { "application/vnd.yamaha.smaf-phrase", "spf" },
477        { "application/vnd.yellowriver-custom-menu", "cmp" },
478        { "application/vnd.zul", "zir" },
479        { "application/vnd.zzazz.deck+xml", "zaz" },
480        { "application/voicexml+xml", "vxml" },
481        { "application/widget", "wgt" },
482        { "application/winhlp", "hlp" },
483        { "application/wsdl+xml", "wsdl" },
484        { "application/wspolicy+xml", "wspolicy" },
485        { "application/x-7z-compressed", "7z" },
486        { "application/x-abiword", "abw" },
487        { "application/x-ace-compressed", "ace" },
488        { "application/x-apple-diskimage", "dmg" },
489        { "application/x-authorware-bin", "aab" },
490        { "application/x-authorware-map", "aam" },
491        { "application/x-authorware-seg", "aas" },
492        { "application/x-bcpio", "bcpio" },
493        { "application/x-bittorrent", "torrent" },
494        { "application/x-blorb", "blb" },
495        { "application/x-bzip", "bz" },
496        { "application/x-bzip2", "bz2" },
497        { "application/x-cbr", "cbr" },
498        { "application/x-cdlink", "vcd" },
499        { "application/x-cfs-compressed", "cfs" },
500        { "application/x-chat", "chat" },
501        { "application/x-chess-pgn", "pgn" },
502        { "application/x-conference", "nsc" },
503        { "application/x-cpio", "cpio" },
504        { "application/x-csh", "csh" },
505        { "application/x-debian-package", "deb" },
506        { "application/x-dgc-compressed", "dgc" },
507        { "application/x-director", "dir" },
508        { "application/x-doom", "wad" },
509        { "application/x-dtbncx+xml", "ncx" },
510        { "application/x-dtbook+xml", "dtb" },
511        { "application/x-dtbresource+xml", "res" },
512        { "application/x-dvi", "dvi" },
513        { "application/x-envoy", "evy" },
514        { "application/x-eva", "eva" },
515        { "application/x-font-bdf", "bdf" },
516        { "application/x-font-ghostscript", "gsf" },
517        { "application/x-font-linux-psf", "psf" },
518        { "application/x-font-otf", "otf" },
519        { "application/x-font-pcf", "pcf" },
520        { "application/x-font-snf", "snf" },
521        { "application/x-font-ttf", "ttf" },
522        { "application/x-font-type1", "pfa" },
523        { "application/font-woff", "woff" },
524        { "application/x-freearc", "arc" },
525        { "application/x-futuresplash", "spl" },
526        { "application/x-gca-compressed", "gca" },
527        { "application/x-glulx", "ulx" },
528        { "application/x-gnumeric", "gnumeric" },
529        { "application/x-gramps-xml", "gramps" },
530        { "application/x-gtar", "gtar" },
531        { "application/x-hdf", "hdf" },
532        { "application/x-install-instructions", "install" },
533        { "application/x-iso9660-image", "iso" },
534        { "application/x-java-jnlp-file", "jnlp" },
535        { "application/x-latex", "latex" },
536        { "application/x-lzh-compressed", "lzh" },
537        { "application/x-mie", "mie" },
538        { "application/x-mobipocket-ebook", "prc" },
539        { "application/x-ms-application", "application" },
540        { "application/x-ms-shortcut", "lnk" },
541        { "application/x-ms-wmd", "wmd" },
542        { "application/x-ms-wmz", "wmz" },
543        { "application/x-ms-xbap", "xbap" },
544        { "application/x-msaccess", "mdb" },
545        { "application/x-msbinder", "obd" },
546        { "application/x-mscardfile", "crd" },
547        { "application/x-msclip", "clp" },
548        { "application/x-msdownload", "exe" },
549        { "application/x-msmediaview", "mvb" },
550        { "application/x-msmetafile", "wmf" },
551        { "application/x-msmoney", "mny" },
552        { "application/x-mspublisher", "pub" },
553        { "application/x-msschedule", "scd" },
554        { "application/x-msterminal", "trm" },
555        { "application/x-mswrite", "wri" },
556        { "application/x-netcdf", "nc" },
557        { "application/x-nzb", "nzb" },
558        { "application/x-pkcs12", "p12" },
559        { "application/x-pkcs7-certificates", "p7b" },
560        { "application/x-pkcs7-certreqresp", "p7r" },
561        { "application/x-rar-compressed", "rar" },
562        { "application/x-research-info-systems", "ris" },
563        { "application/x-sh", "sh" },
564        { "application/x-shar", "shar" },
565        { "application/x-shockwave-flash", "swf" },
566        { "application/x-silverlight-app", "xap" },
567        { "application/x-sql", "sql" },
568        { "application/x-stuffit", "sit" },
569        { "application/x-stuffitx", "sitx" },
570        { "application/x-subrip", "srt" },
571        { "application/x-sv4cpio", "sv4cpio" },
572        { "application/x-sv4crc", "sv4crc" },
573        { "application/x-t3vm-image", "t3" },
574        { "application/x-tads", "gam" },
575        { "application/x-tar", "tar" },
576        { "application/x-tcl", "tcl" },
577        { "application/x-tex", "tex" },
578        { "application/x-tex-tfm", "tfm" },
579        { "application/x-texinfo", "texinfo" },
580        { "application/x-tgif", "obj" },
581        { "application/x-ustar", "ustar" },
582        { "application/x-wais-source", "src" },
583        { "application/x-x509-ca-cert", "der" },
584        { "application/x-xfig", "fig" },
585        { "application/x-xliff+xml", "xlf" },
586        { "application/x-xpinstall", "xpi" },
587        { "application/x-xz", "xz" },
588        { "application/x-zmachine", "z1" },
589        { "application/xaml+xml", "xaml" },
590        { "application/xcap-diff+xml", "xdf" },
591        { "application/xenc+xml", "xenc" },
592        { "application/xhtml+xml", "xhtml" },
593        { "application/xml", "xml" },
594        { "application/xml-dtd", "dtd" },
595        { "application/xop+xml", "xop" },
596        { "application/xproc+xml", "xpl" },
597        { "application/xslt+xml", "xslt" },
598        { "application/xspf+xml", "xspf" },
599        { "application/xv+xml", "mxml" },
600        { "application/yang", "yang" },
601        { "application/yin+xml", "yin" },
602        { "application/zip", "zip" },
603        { "audio/adpcm", "adp" },
604        { "audio/basic", "au" },
605        { "audio/midi", "mid" },
606        { "audio/mp4", "mp4a" },
607        { "audio/mpeg", "mpga" },
608        { "audio/ogg", "oga" },
609        { "audio/s3m", "s3m" },
610        { "audio/silk", "sil" },
611        { "audio/vnd.dece.audio", "uva" },
612        { "audio/vnd.digital-winds", "eol" },
613        { "audio/vnd.dra", "dra" },
614        { "audio/vnd.dts", "dts" },
615        { "audio/vnd.dts.hd", "dtshd" },
616        { "audio/vnd.lucent.voice", "lvp" },
617        { "audio/vnd.ms-playready.media.pya", "pya" },
618        { "audio/vnd.nuera.ecelp4800", "ecelp4800" },
619        { "audio/vnd.nuera.ecelp7470", "ecelp7470" },
620        { "audio/vnd.nuera.ecelp9600", "ecelp9600" },
621        { "audio/vnd.rip", "rip" },
622        { "audio/webm", "weba" },
623        { "audio/x-aac", "aac" },
624        { "audio/x-aiff", "aif" },
625        { "audio/x-caf", "caf" },
626        { "audio/x-flac", "flac" },
627        { "audio/x-matroska", "mka" },
628        { "audio/x-mpegurl", "m3u" },
629        { "audio/x-ms-wax", "wax" },
630        { "audio/x-ms-wma", "wma" },
631        { "audio/x-pn-realaudio", "ram" },
632        { "audio/x-pn-realaudio-plugin", "rmp" },
633        { "audio/x-wav", "wav" },
634        { "audio/xm", "xm" },
635        { "chemical/x-cdx", "cdx" },
636        { "chemical/x-cif", "cif" },
637        { "chemical/x-cmdf", "cmdf" },
638        { "chemical/x-cml", "cml" },
639        { "chemical/x-csml", "csml" },
640        { "chemical/x-xyz", "xyz" },
641        { "image/bmp", "bmp" },
642        { "image/cgm", "cgm" },
643        { "image/g3fax", "g3" },
644        { "image/gif", "gif" },
645        { "image/ief", "ief" },
646        { "image/jpg", "jpg" },
647        { "image/jpeg", "jpeg" },
648        { "image/ktx", "ktx" },
649        { "image/png", "png" },
650        { "image/prs.btif", "btif" },
651        { "image/sgi", "sgi" },
652        { "image/svg+xml", "svg" },
653        { "image/tiff", "tiff" },
654        { "image/vnd.adobe.photoshop", "psd" },
655        { "image/vnd.dece.graphic", "uvi" },
656        { "image/vnd.dvb.subtitle", "sub" },
657        { "image/vnd.djvu", "djvu" },
658        { "image/vnd.dwg", "dwg" },
659        { "image/vnd.dxf", "dxf" },
660        { "image/vnd.fastbidsheet", "fbs" },
661        { "image/vnd.fpx", "fpx" },
662        { "image/vnd.fst", "fst" },
663        { "image/vnd.fujixerox.edmics-mmr", "mmr" },
664        { "image/vnd.fujixerox.edmics-rlc", "rlc" },
665        { "image/vnd.ms-modi", "mdi" },
666        { "image/vnd.ms-photo", "wdp" },
667        { "image/vnd.net-fpx", "npx" },
668        { "image/vnd.wap.wbmp", "wbmp" },
669        { "image/vnd.xiff", "xif" },
670        { "image/webp", "webp" },
671        { "image/x-3ds", "3ds" },
672        { "image/x-cmu-raster", "ras" },
673        { "image/x-cmx", "cmx" },
674        { "image/x-freehand", "fh" },
675        { "image/x-icon", "ico" },
676        { "image/x-mrsid-image", "sid" },
677        { "image/x-pcx", "pcx" },
678        { "image/x-pict", "pic" },
679        { "image/x-portable-anymap", "pnm" },
680        { "image/x-portable-bitmap", "pbm" },
681        { "image/x-portable-graymap", "pgm" },
682        { "image/x-portable-pixmap", "ppm" },
683        { "image/x-rgb", "rgb" },
684        { "image/x-tga", "tga" },
685        { "image/x-xbitmap", "xbm" },
686        { "image/x-xpixmap", "xpm" },
687        { "image/x-xwindowdump", "xwd" },
688        { "message/rfc822", "eml" },
689        { "model/iges", "igs" },
690        { "model/mesh", "msh" },
691        { "model/vnd.collada+xml", "dae" },
692        { "model/vnd.dwf", "dwf" },
693        { "model/vnd.gdl", "gdl" },
694        { "model/vnd.gtw", "gtw" },
695        { "model/vnd.mts", "mts" },
696        { "model/vnd.vtu", "vtu" },
697        { "model/vrml", "wrl" },
698        { "model/x3d+binary", "x3db" },
699        { "model/x3d+vrml", "x3dv" },
700        { "model/x3d+xml", "x3d" },
701        { "text/cache-manifest", "appcache" },
702        { "text/calendar", "ics" },
703        { "text/css", "css" },
704        { "text/csv", "csv" },
705        { "text/html", "html" },
706        { "text/n3", "n3" },
707        { "text/plain", "txt" },
708        { "text/prs.lines.tag", "dsc" },
709        { "text/richtext", "rtx" },
710        { "text/sgml", "sgml" },
711        { "text/tab-separated-values", "tsv" },
712        { "text/troff", "t" },
713        { "text/turtle", "ttl" },
714        { "text/uri-list", "uri" },
715        { "text/vcard", "vcard" },
716        { "text/vnd.curl", "curl" },
717        { "text/vnd.curl.dcurl", "dcurl" },
718        { "text/vnd.curl.scurl", "scurl" },
719        { "text/vnd.curl.mcurl", "mcurl" },
720        { "text/vnd.dvb.subtitle", "sub" },
721        { "text/vnd.fly", "fly" },
722        { "text/vnd.fmi.flexstor", "flx" },
723        { "text/vnd.graphviz", "gv" },
724        { "text/vnd.in3d.3dml", "3dml" },
725        { "text/vnd.in3d.spot", "spot" },
726        { "text/vnd.sun.j2me.app-descriptor", "jad" },
727        { "text/vnd.wap.wml", "wml" },
728        { "text/vnd.wap.wmlscript", "wmls" },
729        { "text/x-asm", "s" },
730        { "text/x-c", "c" },
731        { "text/x-fortran", "f" },
732        { "text/x-java-source", "java" },
733        { "text/x-opml", "opml" },
734        { "text/x-pascal", "p" },
735        { "text/x-nfo", "nfo" },
736        { "text/x-setext", "etx" },
737        { "text/x-sfv", "sfv" },
738        { "text/x-uuencode", "uu" },
739        { "text/x-vcalendar", "vcs" },
740        { "text/x-vcard", "vcf" },
741        { "text/xml", "xml" },
742        { "video/3gpp", "3gp" },
743        { "video/3gpp2", "3g2" },
744        { "video/h261", "h261" },
745        { "video/h263", "h263" },
746        { "video/h264", "h264" },
747        { "video/jpeg", "jpgv" },
748        { "video/jpm", "jpm" },
749        { "video/mj2", "mj2" },
750        { "video/mp4", "mp4" },
751        { "video/mpeg", "mpeg" },
752        { "video/ogg", "ogv" },
753        { "video/quicktime", "qt" },
754        { "video/vnd.dece.hd", "uvh" },
755        { "video/vnd.dece.mobile", "uvm" },
756        { "video/vnd.dece.pd", "uvp" },
757        { "video/vnd.dece.sd", "uvs" },
758        { "video/vnd.dece.video", "uvv" },
759        { "video/vnd.dvb.file", "dvb" },
760        { "video/vnd.fvt", "fvt" },
761        { "video/vnd.mpegurl", "mxu" },
762        { "video/vnd.ms-playready.media.pyv", "pyv" },
763        { "video/vnd.uvvu.mp4", "uvu" },
764        { "video/vnd.vivo", "viv" },
765        { "video/webm", "webm" },
766        { "video/x-f4v", "f4v" },
767        { "video/x-fli", "fli" },
768        { "video/x-flv", "flv" },
769        { "video/x-m4v", "m4v" },
770        { "video/x-matroska", "mkv" },
771        { "video/x-mng", "mng" },
772        { "video/x-ms-asf", "asf" },
773        { "video/x-ms-vob", "vob" },
774        { "video/x-ms-wm", "wm" },
775        { "video/x-ms-wmv", "wmv" },
776        { "video/x-ms-wmx", "wmx" },
777        { "video/x-ms-wvx", "wvx" },
778        { "video/x-msvideo", "avi" },
779        { "video/x-sgi-movie", "movie" },
780        { "video/x-smv", "smv" },
781        { "x-conference/x-cooltalk", "ice" }
782};
783
784/**
785* Obtain default file extension for a give MIME type
786*
787* @param mimeType a MIME type (lowercase string), e.g. "image/png"
788* @param extension a buffer in which to store the file extension; the default value is "txt" if no extension is found
789* @param length the size of the buffer extension
790* @return true if a file extension is found for the given MIME type, otherwise false
791*/
792static bool getFileExtension(const char* mimeType, char* extension, size_t length) {
793
794        bool hasExt = false;
795        strncpy(extension, "txt", length);
796       
797        if (mimeType != NULL) {         
798                for (int i = 0; i < NUM_MIME_TYPES; i++) {                                     
799                        if      (strncmp(mimeType, MIME[i][M_Type], strlen(MIME[i][M_Type])) == 0) {
800                                strncpy(extension, MIME[i][M_Extension], length);
801                                hasExt = true;
802                                break;                         
803                        }               
804                }
805                if (hasExt == false && strncmp(mimeType, "image/", 6) == 0) {
806                        strncpy(extension, strstr(mimeType, "/") + 1, length);
807                }       
808        }       
809        return hasExt;
810}
811
812/**
813* Obtain default file extension for a give MIME type
814*
815* @param mimeType a MIME type (lowercase string), e.g. "image/png"
816* @param hasExt the value of this pointer is set to true if a default file extension is found, otherwise false
817* @return a map with name "extension" and value set to file extension, e.g. "png"; if not found the default value is "txt"
818*/
819static map* getFileExtensionMap(const char* mimeType, bool* hasExt) {
820
821        map* ext = createMap("extension", "txt");
822        *hasExt = false;
823       
824        if (mimeType != NULL) {         
825                for (int i = 0; i < NUM_MIME_TYPES; i++) {                     
826                        if      (strncmp(mimeType, MIME[i][M_Type], strlen(MIME[i][M_Type])) == 0) {
827                                ext->value = zStrdup(MIME[i][M_Extension]);
828                                *hasExt = true;
829                                break;                         
830                        }               
831                }
832                if (*hasExt == false && strncmp(mimeType, "image/", 6) == 0) {
833                        ext->value = zStrdup(strstr(mimeType, "/") + 1);
834                }                       
835        }       
836        return ext;
837}
Note: See TracBrowser for help on using the repository browser.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png