X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=scheduler%2Fmime.h;h=f536a68e72b6f5d2bb611a63d005cbb40c254f55;hb=4a971b9142727630912c3c8a700979c5e67cc681;hp=7ccaa70e13e795eb9c0f1c17df894de4eb19861d;hpb=bd7854cb4d663bb0e561eaf5b01bbd47baa71d22;p=thirdparty%2Fcups.git diff --git a/scheduler/mime.h b/scheduler/mime.h index 7ccaa70e1..f536a68e7 100644 --- a/scheduler/mime.h +++ b/scheduler/mime.h @@ -1,25 +1,14 @@ /* - * "$Id: mime.h 5061 2006-02-03 16:32:18Z mike $" + * MIME type/conversion database definitions for CUPS. * - * MIME type/conversion database definitions for the Common UNIX Printing System (CUPS). + * Copyright 2007-2013 by Apple Inc. + * Copyright 1997-2007 by Easy Software Products, all rights reserved. * - * Copyright 1997-2006 by Easy Software Products, all rights reserved. - * - * These coded instructions, statements, and computer programs are the - * property of Easy Software Products and are protected by Federal - * copyright law. Distribution and use rights are outlined in the file - * "LICENSE.txt" which should have been included with this file. If this - * file is missing or damaged please contact Easy Software Products - * at: - * - * Attn: CUPS Licensing Information - * Easy Software Products - * 44141 Airport View Drive, Suite 204 - * Hollywood, Maryland 20636 USA - * - * Voice: (301) 373-9600 - * EMail: cups-info@cups.org - * WWW: http://www.cups.org + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". */ #ifndef _CUPS_MIME_H_ @@ -28,15 +17,16 @@ # include # include # include +# include /* * C++ magic... */ -# ifdef _cplusplus +# ifdef __cplusplus extern "C" { -# endif /* _cplusplus */ +# endif /* __cplusplus */ /* @@ -67,7 +57,8 @@ typedef enum MIME_MAGIC_INT, /* Integer/32-bit word matches */ MIME_MAGIC_LOCALE, /* Current locale matches string */ MIME_MAGIC_CONTAINS, /* File contains a string */ - MIME_MAGIC_ISTRING /* Case-insensitive string matches */ + MIME_MAGIC_ISTRING, /* Case-insensitive string matches */ + MIME_MAGIC_REGEX /* Regular expression matches */ } mime_op_t; typedef struct _mime_magic_s /**** MIME Magic Data ****/ @@ -86,15 +77,17 @@ typedef struct _mime_magic_s /**** MIME Magic Data ****/ char matchv[64]; /* Match value */ char localev[64]; /* Locale value */ char stringv[64]; /* String value */ - char charv; /* Byte value */ - short shortv; /* Short value */ - int intv; /* Integer value */ + unsigned char charv; /* Byte value */ + unsigned short shortv; /* Short value */ + unsigned intv; /* Integer value */ + regex_t rev; /* Regular expression value */ } value; } mime_magic_t; typedef struct _mime_type_s /**** MIME Type Data ****/ { mime_magic_t *rules; /* Rules used to detect this type */ + int priority; /* Priority of this type */ char super[MIME_MAX_SUPER], /* Super-type name ("image", "application", etc.) */ type[MIME_MAX_TYPE]; /* Type name ("png", "postscript", etc.) */ } mime_type_t; @@ -105,12 +98,18 @@ typedef struct _mime_filter_s /**** MIME Conversion Filter Data ****/ *dst; /* Destination type */ int cost; /* Relative cost */ char filter[MIME_MAX_FILTER];/* Filter program to use */ + size_t maxsize; /* Maximum file size for this filter */ } mime_filter_t; +typedef void (*mime_error_cb_t)(void *ctx, const char *message); + typedef struct _mime_s /**** MIME Database ****/ { - cups_array_t *types; /* File types */ - cups_array_t *filters; /* Type conversion filters */ + cups_array_t *types; /* File types */ + cups_array_t *filters; /* Type conversion filters */ + cups_array_t *srcs; /* Filters sorted by source type */ + mime_error_cb_t error_cb; /* Error message callback */ + void *error_ctx; /* Pointer for callback */ } mime_t; @@ -119,10 +118,11 @@ typedef struct _mime_s /**** MIME Database ****/ */ extern void mimeDelete(mime_t *mime); +extern mime_t *mimeNew(void) _CUPS_API_1_5; extern mime_t *mimeLoad(const char *pathname, const char *filterpath); -extern mime_t *mimeMerge(mime_t *mime, const char *pathname, - const char *filterpath); -extern mime_t *mimeNew(void); +extern mime_t *mimeLoadFilters(mime_t *mime, const char *pathname, + const char *filterpath); +extern mime_t *mimeLoadTypes(mime_t *mime, const char *pathname); extern mime_type_t *mimeAddType(mime_t *mime, const char *super, const char *type); @@ -142,15 +142,18 @@ extern mime_filter_t *mimeAddFilter(mime_t *mime, mime_type_t *src, extern void mimeDeleteFilter(mime_t *mime, mime_filter_t *filter); extern cups_array_t *mimeFilter(mime_t *mime, mime_type_t *src, mime_type_t *dst, int *cost); +extern cups_array_t *mimeFilter2(mime_t *mime, mime_type_t *src, + size_t srcsize, mime_type_t *dst, + int *cost); +extern mime_filter_t *mimeFilterLookup(mime_t *mime, mime_type_t *src, + mime_type_t *dst); extern mime_filter_t *mimeFirstFilter(mime_t *mime); extern mime_filter_t *mimeNextFilter(mime_t *mime); extern int mimeNumFilters(mime_t *mime); +extern void mimeSetErrorCallback(mime_t *mime, mime_error_cb_t cb, + void *context) _CUPS_API_1_5; -# ifdef _cplusplus +# ifdef __cplusplus } -# endif /* _cplusplus */ +# endif /* __cplusplus */ #endif /* !_CUPS_MIME_H_ */ - -/* - * End of "$Id: mime.h 5061 2006-02-03 16:32:18Z mike $". - */