]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/ppd-private.h
More tweaks for IPP Everywhere support in web interface.
[thirdparty/cups.git] / cups / ppd-private.h
CommitLineData
a603edef 1/*
7e86f2f6 2 * Private PPD definitions for CUPS.
a603edef 3 *
87f34051 4 * Copyright 2007-2017 by Apple Inc.
7e86f2f6 5 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
a603edef 6 *
7e86f2f6
MS
7 * These coded instructions, statements, and computer programs are the
8 * property of Apple Inc. and are protected by Federal copyright
9 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 * which should have been included with this file. If this file is
57b7b66b 11 * missing or damaged, see the license at "http://www.cups.org/".
a603edef 12 *
7e86f2f6 13 * PostScript is a trademark of Adobe Systems, Inc.
a603edef 14 *
7e86f2f6
MS
15 * This code and any derivative of it may be used and distributed
16 * freely under the terms of the GNU General Public License when
17 * used with GNU Ghostscript or its derivatives. Use of the code
18 * (or any derivative of it) with software other than GNU
19 * GhostScript (or its derivatives) is governed by the CUPS license
20 * agreement.
a603edef 21 *
7e86f2f6 22 * This file is subject to the Apple OS-Developed Software exception.
a603edef
MS
23 */
24
25#ifndef _CUPS_PPD_PRIVATE_H_
26# define _CUPS_PPD_PRIVATE_H_
27
28/*
29 * Include necessary headers...
30 */
31
c7017ecc 32# include <cups/cups.h>
aaf19ab0
MS
33# include <cups/ppd.h>
34# include "pwg-private.h"
a603edef
MS
35
36
37/*
38 * C++ magic...
39 */
40
41# ifdef __cplusplus
42extern "C" {
43# endif /* __cplusplus */
44
45
f14324a7
MS
46/*
47 * Constants...
48 */
49
87f34051 50# define _PPD_CACHE_VERSION 8 /* Version number in cache file */
f14324a7
MS
51
52
66ab9486 53/*
c7017ecc 54 * Types and structures...
66ab9486
MS
55 */
56
f787e1e3
MS
57typedef struct _ppd_globals_s /**** CUPS PPD global state data ****/
58{
59 /* ppd.c */
60 ppd_status_t ppd_status; /* Status of last ppdOpen*() */
61 int ppd_line; /* Current line number */
62 ppd_conform_t ppd_conform; /* Level of conformance required */
63
64 /* ppd-util.c */
65 char ppd_filename[HTTP_MAX_URI];
66 /* PPD filename */
67} _ppd_globals_t;
68
9c80ffa2
MS
69typedef enum _ppd_localization_e /**** Selector for _ppdOpen ****/
70{
71 _PPD_LOCALIZATION_DEFAULT, /* Load only the default localization */
72 _PPD_LOCALIZATION_ICC_PROFILES, /* Load only the color profile localization */
73 _PPD_LOCALIZATION_NONE, /* Load no localizations */
74 _PPD_LOCALIZATION_ALL /* Load all localizations */
75} _ppd_localization_t;
76
c7017ecc
MS
77typedef enum _ppd_parse_e /**** Selector for _ppdParseOptions ****/
78{
79 _PPD_PARSE_OPTIONS, /* Parse only the options */
80 _PPD_PARSE_PROPERTIES, /* Parse only the properties */
81 _PPD_PARSE_ALL /* Parse everything */
82} _ppd_parse_t;
83
66ab9486
MS
84typedef struct _ppd_cups_uiconst_s /**** Constraint from cupsUIConstraints ****/
85{
86 ppd_option_t *option; /* Constrained option */
87 ppd_choice_t *choice; /* Constrained choice or @code NULL@ */
88 int installable; /* Installable option? */
89} _ppd_cups_uiconst_t;
90
91typedef struct _ppd_cups_uiconsts_s /**** cupsUIConstraints ****/
92{
93 char resolver[PPD_MAX_NAME]; /* Resolver name */
94 int installable, /* Constrained against any installable options? */
95 num_constraints; /* Number of constraints */
96 _ppd_cups_uiconst_t *constraints; /* Constraints */
97} _ppd_cups_uiconsts_t;
98
f14324a7 99typedef enum _pwg_print_color_mode_e /**** PWG print-color-mode indices ****/
c7017ecc 100{
f14324a7
MS
101 _PWG_PRINT_COLOR_MODE_MONOCHROME = 0, /* print-color-mode=monochrome */
102 _PWG_PRINT_COLOR_MODE_COLOR, /* print-color-mode=color */
87f34051 103 /* Other values are not supported by CUPS yet. */
f14324a7
MS
104 _PWG_PRINT_COLOR_MODE_MAX
105} _pwg_print_color_mode_t;
c7017ecc 106
dcb445bc 107typedef enum _pwg_print_quality_e /**** PWG print-quality values ****/
c7017ecc
MS
108{
109 _PWG_PRINT_QUALITY_DRAFT = 0, /* print-quality=3 */
110 _PWG_PRINT_QUALITY_NORMAL, /* print-quality=4 */
111 _PWG_PRINT_QUALITY_HIGH, /* print-quality=5 */
112 _PWG_PRINT_QUALITY_MAX
113} _pwg_print_quality_t;
114
dcb445bc
MS
115typedef struct _pwg_finishings_s /**** PWG finishings mapping data ****/
116{
cb7f98ee
MS
117 ipp_finishings_t value; /* finishings value */
118 int num_options; /* Number of options to apply */
119 cups_option_t *options; /* Options to apply */
dcb445bc
MS
120} _pwg_finishings_t;
121
f14324a7 122struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
c7017ecc
MS
123{
124 int num_bins; /* Number of output bins */
6961465f 125 pwg_map_t *bins; /* Output bins */
c7017ecc 126 int num_sizes; /* Number of media sizes */
6961465f 127 pwg_size_t *sizes; /* Media sizes */
c7017ecc
MS
128 int custom_max_width, /* Maximum custom width in 2540ths */
129 custom_max_length, /* Maximum custom length in 2540ths */
130 custom_min_width, /* Minimum custom width in 2540ths */
131 custom_min_length; /* Minimum custom length in 2540ths */
132 char *custom_max_keyword, /* Maximum custom size PWG keyword */
133 *custom_min_keyword, /* Minimum custom size PWG keyword */
134 custom_ppd_size[41]; /* Custom PPD size name */
6961465f 135 pwg_size_t custom_size; /* Custom size record */
4220952d 136 char *source_option; /* PPD option for media source */
c7017ecc 137 int num_sources; /* Number of media sources */
6961465f 138 pwg_map_t *sources; /* Media sources */
c7017ecc 139 int num_types; /* Number of media types */
6961465f 140 pwg_map_t *types; /* Media types */
f14324a7
MS
141 int num_presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
142 /* Number of print-color-mode/print-quality options */
143 cups_option_t *presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
144 /* print-color-mode/print-quality options */
c7017ecc
MS
145 char *sides_option, /* PPD option for sides */
146 *sides_1sided, /* Choice for one-sided */
147 *sides_2sided_long, /* Choice for two-sided-long-edge */
148 *sides_2sided_short; /* Choice for two-sided-short-edge */
f14324a7
MS
149 char *product; /* Product value */
150 cups_array_t *filters, /* cupsFilter/cupsFilter2 values */
151 *prefilters; /* cupsPreFilter values */
82f97232 152 int single_file; /* cupsSingleFile value */
dcb445bc 153 cups_array_t *finishings; /* cupsIPPFinishings values */
5a9febac
MS
154 int max_copies, /* cupsMaxCopies value */
155 account_id, /* cupsJobAccountId value */
156 accounting_user_id; /* cupsJobAccountingUserId value */
157 char *password; /* cupsJobPassword value */
158 cups_array_t *mandatory; /* cupsMandatory value */
a469f8a5 159 char *charge_info_uri; /* cupsChargeInfoURI value */
c1420c87 160 cups_array_t *support_files; /* Support files - ICC profiles, etc. */
f14324a7 161};
c7017ecc 162
66ab9486
MS
163
164/*
165 * Prototypes...
166 */
167
f099325e 168extern int _cupsConvertOptions(ipp_t *request, ppd_file_t *ppd, _ppd_cache_t *pc, ipp_attribute_t *media_col_sup, ipp_attribute_t *doc_handling_sup, ipp_attribute_t *print_color_mode_sup, const char *user, const char *format, int copies, int num_options, cups_option_t *options);
f14324a7
MS
169extern _ppd_cache_t *_ppdCacheCreateWithFile(const char *filename,
170 ipp_t **attrs);
171extern _ppd_cache_t *_ppdCacheCreateWithPPD(ppd_file_t *ppd);
172extern void _ppdCacheDestroy(_ppd_cache_t *pc);
173extern const char *_ppdCacheGetBin(_ppd_cache_t *pc,
174 const char *output_bin);
cb7f98ee
MS
175extern int _ppdCacheGetFinishingOptions(_ppd_cache_t *pc,
176 ipp_t *job,
177 ipp_finishings_t value,
178 int num_options,
dcb445bc 179 cups_option_t **options);
cb7f98ee
MS
180extern int _ppdCacheGetFinishingValues(_ppd_cache_t *pc,
181 int num_options,
dcb445bc 182 cups_option_t *options,
cb7f98ee
MS
183 int max_values,
184 int *values);
f14324a7
MS
185extern const char *_ppdCacheGetInputSlot(_ppd_cache_t *pc, ipp_t *job,
186 const char *keyword);
187extern const char *_ppdCacheGetMediaType(_ppd_cache_t *pc, ipp_t *job,
188 const char *keyword);
189extern const char *_ppdCacheGetOutputBin(_ppd_cache_t *pc,
190 const char *keyword);
191extern const char *_ppdCacheGetPageSize(_ppd_cache_t *pc, ipp_t *job,
192 const char *keyword, int *exact);
6961465f 193extern pwg_size_t *_ppdCacheGetSize(_ppd_cache_t *pc,
f14324a7
MS
194 const char *page_size);
195extern const char *_ppdCacheGetSource(_ppd_cache_t *pc,
196 const char *input_slot);
197extern const char *_ppdCacheGetType(_ppd_cache_t *pc,
198 const char *media_type);
199extern int _ppdCacheWriteFile(_ppd_cache_t *pc,
200 const char *filename, ipp_t *attrs);
d9fc71e4 201extern char *_ppdCreateFromIPP(char *buffer, size_t bufsize, ipp_t *response);
a603edef 202extern void _ppdFreeLanguages(cups_array_t *languages);
5eb9da71 203extern cups_encoding_t _ppdGetEncoding(const char *name);
a603edef 204extern cups_array_t *_ppdGetLanguages(ppd_file_t *ppd);
f787e1e3 205extern _ppd_globals_t *_ppdGlobals(void);
a603edef
MS
206extern unsigned _ppdHashName(const char *name);
207extern ppd_attr_t *_ppdLocalizedAttr(ppd_file_t *ppd, const char *keyword,
208 const char *spec, const char *ll_CC);
5eb9da71
MS
209extern char *_ppdNormalizeMakeAndModel(const char *make_and_model,
210 char *buffer,
211 size_t bufsize);
9c80ffa2
MS
212extern ppd_file_t *_ppdOpen(cups_file_t *fp,
213 _ppd_localization_t localization);
214extern ppd_file_t *_ppdOpenFile(const char *filename,
215 _ppd_localization_t localization);
66ab9486 216extern int _ppdParseOptions(const char *s, int num_options,
c7017ecc
MS
217 cups_option_t **options,
218 _ppd_parse_t which);
aaf19ab0
MS
219extern const char *_pwgInputSlotForSource(const char *media_source,
220 char *name, size_t namesize);
cc754834 221extern const char *_pwgMediaTypeForType(const char *media_type,
f14324a7 222 char *name, size_t namesize);
6961465f 223extern const char *_pwgPageSizeForMedia(pwg_media_t *media,
aaf19ab0 224 char *name, size_t namesize);
a603edef
MS
225
226
227/*
228 * C++ magic...
229 */
230
231# ifdef __cplusplus
232}
233# endif /* __cplusplus */
234#endif /* !_CUPS_PPD_PRIVATE_H_ */