]>
git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/mime.h
2 * "$Id: mime.h 5061 2006-02-03 16:32:18Z mike $"
4 * MIME type/conversion database definitions for the Common UNIX Printing System (CUPS).
6 * Copyright 1997-2006 by Easy Software Products, all rights reserved.
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
26 # define _CUPS_MIME_H_
28 # include <cups/array.h>
29 # include <cups/ipp.h>
30 # include <cups/file.h>
39 # endif /* _cplusplus */
46 # define MIME_MAX_SUPER 16 /* Maximum size of supertype name */
47 # define MIME_MAX_TYPE IPP_MAX_NAME /* Maximum size of type name */
48 # define MIME_MAX_FILTER 256 /* Maximum size of filter pathname */
49 # define MIME_MAX_BUFFER 4096 /* Maximum size of file buffer */
58 MIME_MAGIC_NOP
, /* No operation */
59 MIME_MAGIC_AND
, /* Logical AND of all children */
60 MIME_MAGIC_OR
, /* Logical OR of all children */
61 MIME_MAGIC_MATCH
, /* Filename match */
62 MIME_MAGIC_ASCII
, /* ASCII characters in range */
63 MIME_MAGIC_PRINTABLE
, /* Printable characters (32-255) in range */
64 MIME_MAGIC_STRING
, /* String matches */
65 MIME_MAGIC_CHAR
, /* Character/byte matches */
66 MIME_MAGIC_SHORT
, /* Short/16-bit word matches */
67 MIME_MAGIC_INT
, /* Integer/32-bit word matches */
68 MIME_MAGIC_LOCALE
, /* Current locale matches string */
69 MIME_MAGIC_CONTAINS
, /* File contains a string */
70 MIME_MAGIC_ISTRING
/* Case-insensitive string matches */
73 typedef struct _mime_magic_s
/**** MIME Magic Data ****/
75 struct _mime_magic_s
*prev
, /* Previous rule */
76 *next
, /* Next rule */
77 *parent
, /* Parent rules */
78 *child
; /* Child rules */
79 short op
, /* Operation code (see above) */
80 invert
; /* Invert the result */
81 int offset
, /* Offset in file */
82 region
, /* Region length */
83 length
; /* Length of data */
86 char matchv
[64]; /* Match value */
87 char localev
[64]; /* Locale value */
88 char stringv
[64]; /* String value */
89 char charv
; /* Byte value */
90 short shortv
; /* Short value */
91 int intv
; /* Integer value */
95 typedef struct _mime_type_s
/**** MIME Type Data ****/
97 mime_magic_t
*rules
; /* Rules used to detect this type */
98 char super
[MIME_MAX_SUPER
], /* Super-type name ("image", "application", etc.) */
99 type
[MIME_MAX_TYPE
]; /* Type name ("png", "postscript", etc.) */
102 typedef struct _mime_filter_s
/**** MIME Conversion Filter Data ****/
104 mime_type_t
*src
, /* Source type */
105 *dst
; /* Destination type */
106 int cost
; /* Relative cost */
107 char filter
[MIME_MAX_FILTER
];/* Filter program to use */
110 typedef struct _mime_s
/**** MIME Database ****/
112 cups_array_t
*types
; /* File types */
113 cups_array_t
*filters
; /* Type conversion filters */
121 extern void mimeDelete(mime_t
*mime
);
122 extern mime_t
*mimeLoad(const char *pathname
, const char *filterpath
);
123 extern mime_t
*mimeMerge(mime_t
*mime
, const char *pathname
,
124 const char *filterpath
);
125 extern mime_t
*mimeNew(void);
127 extern mime_type_t
*mimeAddType(mime_t
*mime
, const char *super
,
129 extern int mimeAddTypeRule(mime_type_t
*mt
, const char *rule
);
130 extern void mimeDeleteType(mime_t
*mime
, mime_type_t
*mt
);
131 extern mime_type_t
*mimeFileType(mime_t
*mime
, const char *pathname
,
132 const char *filename
, int *compression
);
133 extern mime_type_t
*mimeFirstType(mime_t
*mime
);
134 extern mime_type_t
*mimeNextType(mime_t
*mime
);
135 extern int mimeNumTypes(mime_t
*mime
);
136 extern mime_type_t
*mimeType(mime_t
*mime
, const char *super
,
139 extern mime_filter_t
*mimeAddFilter(mime_t
*mime
, mime_type_t
*src
,
140 mime_type_t
*dst
, int cost
,
142 extern void mimeDeleteFilter(mime_t
*mime
, mime_filter_t
*filter
);
143 extern cups_array_t
*mimeFilter(mime_t
*mime
, mime_type_t
*src
,
144 mime_type_t
*dst
, int *cost
);
145 extern mime_filter_t
*mimeFirstFilter(mime_t
*mime
);
146 extern mime_filter_t
*mimeNextFilter(mime_t
*mime
);
147 extern int mimeNumFilters(mime_t
*mime
);
151 # endif /* _cplusplus */
152 #endif /* !_CUPS_MIME_H_ */
155 * End of "$Id: mime.h 5061 2006-02-03 16:32:18Z mike $".