]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/globals.h
0db1dac2ffa02b916d31d5b29a4f0aa35ccd3996
[thirdparty/cups.git] / cups / globals.h
1 /*
2 * "$Id: globals.h 6253 2007-02-10 18:48:40Z mike $"
3 *
4 * Global variable definitions for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 1997-2007 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 "http-private.h"
36 # include "cups.h"
37 # include "i18n.h"
38
39 # ifdef HAVE_PTHREAD_H
40 # include <pthread.h>
41 # endif /* HAVE_PTHREAD_H */
42
43 # ifdef HAVE_AUTHORIZATION_H
44 # include <Security/Authorization.h>
45 # endif /* HAVE_AUTHORIZATION_H */
46
47
48 /*
49 * C++ magic...
50 */
51
52 # ifdef __cplusplus
53 extern "C" {
54 # endif /* __cplusplus */
55
56
57 /*
58 * To make libcups thread safe, define thread safe globals (aka thread-
59 * specific data) for the static variables used in the library.
60 */
61
62 typedef struct _cups_globals_s /**** CUPS global state data ****/
63 {
64 /* Multiple places... */
65 const char *cups_datadir, /* CUPS_DATADIR environment var */
66 *cups_serverbin,/* CUPS_SERVERBIN environment var */
67 *cups_serverroot,
68 /* CUPS_SERVERROOT environment var */
69 *cups_statedir, /* CUPS_STATEDIR environment var */
70 *localedir; /* LOCALDIR environment var */
71
72 /* adminutil.c */
73 time_t cupsd_update; /* Last time we got or set cupsd.conf */
74 char cupsd_hostname[HTTP_MAX_HOST];
75 /* Hostname for connection */
76 int cupsd_num_settings;
77 /* Number of server settings */
78 cups_option_t *cupsd_settings;/* Server settings */
79
80 /* file.c */
81 cups_file_t *stdio_files[3];/* stdin, stdout, stderr */
82
83 /* http.c */
84 char http_date[256]; /* Date+time buffer */
85
86 /* http-addr.c */
87 unsigned ip_addr; /* Packed IPv4 address */
88 char *ip_ptrs[2]; /* Pointer to packed address */
89 struct hostent hostent; /* Host entry for IP address */
90 # ifdef HAVE_GETADDRINFO
91 char hostname[1024]; /* Hostname */
92 # endif /* HAVE_GETADDRINFO */
93
94 /* ipp.c */
95 ipp_uchar_t ipp_date[11]; /* RFC-1903 date/time data */
96
97 /* ipp-support.c */
98 int ipp_port; /* IPP port number */
99 char ipp_unknown[255];
100 /* Unknown error statuses */
101
102 /* language.c */
103 cups_lang_t *lang_default; /* Default language */
104 # ifdef __APPLE__
105 char language[32]; /* Cached language */
106 # endif /* __APPLE__ */
107
108 /* ppd.c */
109 ppd_status_t ppd_status; /* Status of last ppdOpen*() */
110 int ppd_line; /* Current line number */
111 ppd_conform_t ppd_conform; /* Level of conformance required */
112
113 /* tempfile.c */
114 char tempfile[1024]; /* cupsTempFd/File buffer */
115
116 /* usersys.c */
117 http_encryption_t encryption; /* Encryption setting */
118 char user[65], /* User name */
119 server[256], /* Server address */
120 servername[256];/* Server hostname */
121 cups_password_cb_t password_cb; /* Password callback */
122
123 /* util.c */
124 http_t *http; /* Current server connection */
125 ipp_status_t last_error; /* Last IPP error */
126 char *last_status_message;
127 /* Last IPP status-message */
128
129 char def_printer[256];
130 /* Default printer */
131 char ppd_filename[HTTP_MAX_URI];
132 /* PPD filename */
133
134 #ifdef HAVE_AUTHORIZATION_H
135 /* auth.c */
136 AuthorizationRef auth_ref; /* Authorization ref */
137 #endif /* HAVE_AUTHORIZATION_H */
138 } _cups_globals_t;
139
140
141 /*
142 * Prototypes...
143 */
144
145 extern const char *_cupsGetPassword(const char *prompt);
146 extern _cups_globals_t *_cupsGlobals(void);
147 extern void _cupsSetError(ipp_status_t status, const char *message);
148
149
150 /*
151 * C++ magic...
152 */
153
154 # ifdef __cplusplus
155 }
156 # endif /* __cplusplus */
157 #endif /* !_CUPS_GLOBALS_H_ */
158
159 /*
160 * End of "$Id: globals.h 6253 2007-02-10 18:48:40Z mike $".
161 */