]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/globals.h
15661d587389369b2e42a51088a2d1dfb0aefaf8
[thirdparty/cups.git] / cups / globals.h
1 /*
2 * "$Id: globals.h 5235 2006-03-06 13:02:23Z mike $"
3 *
4 * Global variable definitions for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 1997-2006 by Easy Software Products, all rights reserved.
7 *
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
13 * at:
14 *
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
19 *
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
23 *
24 * This file is subject to the Apple OS-Developed Software exception.
25 */
26
27 #ifndef _CUPS_GLOBALS_H_
28 # define _CUPS_GLOBALS_H_
29
30 /*
31 * Include necessary headers...
32 */
33
34 # include "string.h"
35 # include "cups.h"
36 # include "i18n.h"
37 # include "normalize.h"
38 # include "transcode.h"
39
40 # ifdef HAVE_PTHREAD_H
41 # include <pthread.h>
42 # endif /* HAVE_PTHREAD_H */
43
44
45 /*
46 * C++ magic...
47 */
48
49 # ifdef __cplusplus
50 extern "C" {
51 # endif /* __cplusplus */
52
53
54 /*
55 * To make libcups thread safe, define thread safe globals (aka thread-
56 * specific data) for the static variables used in the library.
57 */
58
59 typedef struct _cups_globals_s /**** CUPS global state data ****/
60 {
61 /* Multiple places... */
62 const char *cups_datadir, /* CUPS_DATADIR environment var */
63 *cups_serverbin,/* CUPS_SERVERBIN environment var */
64 *cups_serverroot,
65 /* CUPS_SERVERROOT environment var */
66 *cups_statedir, /* CUPS_STATEDIR environment var */
67 *localedir; /* LOCALDIR environment var */
68
69 /* adminutil.c */
70 time_t cupsd_update; /* Last time we got or set cupsd.conf */
71 char cupsd_hostname[HTTP_MAX_HOST];
72 /* Hostname for connection */
73 int cupsd_num_settings;
74 /* Number of server settings */
75 cups_option_t *cupsd_settings;/* Server settings */
76
77 /* http.c */
78 char http_date[256]; /* Date+time buffer */
79
80 /* http-addr.c */
81 unsigned ip_addr; /* Packed IPv4 address */
82 char *ip_ptrs[2]; /* Pointer to packed address */
83 struct hostent hostent; /* Host entry for IP address */
84 # ifdef HAVE_GETADDRINFO
85 char hostname[1024]; /* Hostname */
86 # endif /* HAVE_GETADDRINFO */
87
88 /* ipp.c */
89 ipp_uchar_t ipp_date[11]; /* RFC-1903 date/time data */
90
91 /* ipp-support.c */
92 int ipp_port; /* IPP port number */
93 char ipp_unknown[255];
94 /* Unknown error statuses */
95
96 /* normalize.c */
97 _cups_norm_map_t *normmap_cache; /* Normalize Map cache */
98 _cups_fold_map_t *foldmap_cache; /* Case Fold cache */
99 _cups_prop_map_t *propmap_cache; /* Char Prop Map Cache */
100 _cups_comb_map_t *combmap_cache; /* Comb Class Map Cache */
101 _cups_break_map_t *breakmap_cache;/* Line Break Map Cache */
102
103 /* language.c */
104 cups_lang_t *lang_cache; /* Language string cache */
105 cups_lang_t *lang_default; /* Default language */
106 # ifdef __APPLE__
107 # ifdef HAVE_CF_LOCALE_ID
108 char language[32]; /* Cached language */
109 # else
110 const char *language; /* Cached language */
111 # endif /* HAVE_CF_LOCALE_ID */
112 # endif /* __APPLE__ */
113
114 /* ppd.c */
115 ppd_status_t ppd_status; /* Status of last ppdOpen*() */
116 int ppd_line; /* Current line number */
117 ppd_conform_t ppd_conform; /* Level of conformance required */
118
119 /* tempfile.c */
120 char tempfile[1024]; /* cupsTempFd/File buffer */
121
122 /* transcode.c */
123 _cups_cmap_t *cmap_cache; /* SBCS Charmap Cache */
124 _cups_vmap_t *vmap_cache; /* VBCS Charmap Cache */
125
126 /* usersys.c */
127 http_encryption_t encryption; /* Encryption setting */
128 char user[65], /* User name */
129 server[256], /* Server address */
130 servername[256];/* Server hostname */
131 cups_password_cb_t password_cb; /* Password callback */
132
133 /* util.c */
134 http_t *http; /* Current server connection */
135 ipp_status_t last_error; /* Last IPP error */
136 char *last_status_message;
137 /* Last IPP status-message */
138
139 char def_printer[256];
140 /* Default printer */
141 char ppd_filename[HTTP_MAX_URI];
142 /* PPD filename */
143
144 /* string.c */
145 cups_array_t *stringpool; /* String pool */
146 } _cups_globals_t;
147
148
149 /*
150 * Prototypes...
151 */
152
153 extern const char *_cupsGetPassword(const char *prompt);
154 extern _cups_globals_t *_cupsGlobals(void);
155 extern void _cupsLangFlush(_cups_globals_t *cg);
156 extern void _cupsCharmapFlush(_cups_globals_t *cg);
157 extern void _cupsNormalizeMapsFlush(_cups_globals_t *cg);
158 extern void _cupsSetError(ipp_status_t status, const char *message);
159 extern void _cupsStrFlush(_cups_globals_t *cg);
160
161
162 /*
163 * C++ magic...
164 */
165
166 # ifdef __cplusplus
167 }
168 # endif /* __cplusplus */
169 #endif /* !_CUPS_GLOBALS_H_ */
170
171 /*
172 * End of "$Id: globals.h 5235 2006-03-06 13:02:23Z mike $".
173 */