]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/globals.h
Import CUPS 1.4svn-r7464.
[thirdparty/cups.git] / cups / globals.h
1 /*
2 * "$Id: globals.h 6712 2007-07-24 00:13:05Z mike $"
3 *
4 * Global variable definitions for the Common UNIX Printing System (CUPS).
5 *
6 * Copyright 2007-2008 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
8 *
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
14 *
15 * This file is subject to the Apple OS-Developed Software exception.
16 */
17
18 #ifndef _CUPS_GLOBALS_H_
19 # define _CUPS_GLOBALS_H_
20
21 /*
22 * Include necessary headers...
23 */
24
25 # include "string.h"
26 # include "http-private.h"
27 # include "cups.h"
28 # include "i18n.h"
29
30 # ifdef HAVE_PTHREAD_H
31 # include <pthread.h>
32 # endif /* HAVE_PTHREAD_H */
33
34
35 /*
36 * C++ magic...
37 */
38
39 # ifdef __cplusplus
40 extern "C" {
41 # endif /* __cplusplus */
42
43
44 /*
45 * To make libcups thread safe, define thread safe globals (aka thread-
46 * specific data) for the static variables used in the library.
47 */
48
49 typedef struct _cups_globals_s /**** CUPS global state data ****/
50 {
51 /* Multiple places... */
52 const char *cups_datadir, /* CUPS_DATADIR environment var */
53 *cups_serverbin,/* CUPS_SERVERBIN environment var */
54 *cups_serverroot,
55 /* CUPS_SERVERROOT environment var */
56 *cups_statedir, /* CUPS_STATEDIR environment var */
57 *localedir; /* LOCALDIR environment var */
58
59 /* adminutil.c */
60 time_t cupsd_update; /* Last time we got or set cupsd.conf */
61 char cupsd_hostname[HTTP_MAX_HOST];
62 /* Hostname for connection */
63 int cupsd_num_settings;
64 /* Number of server settings */
65 cups_option_t *cupsd_settings;/* Server settings */
66
67 #ifdef DEBUG
68 /* debug.c */
69 int debug_init, /* Did we initialize debugging? */
70 debug_fd; /* Debug log file descriptor */
71 #endif /* DEBUG */
72
73 /* file.c */
74 cups_file_t *stdio_files[3];/* stdin, stdout, stderr */
75
76 /* http.c */
77 char http_date[256]; /* Date+time buffer */
78
79 /* http-addr.c */
80 unsigned ip_addr; /* Packed IPv4 address */
81 char *ip_ptrs[2]; /* Pointer to packed address */
82 struct hostent hostent; /* Host entry for IP address */
83 # ifdef HAVE_GETADDRINFO
84 char hostname[1024]; /* Hostname */
85 # endif /* HAVE_GETADDRINFO */
86
87 /* ipp.c */
88 ipp_uchar_t ipp_date[11]; /* RFC-1903 date/time data */
89
90 /* ipp-support.c */
91 int ipp_port; /* IPP port number */
92 char ipp_unknown[255];
93 /* Unknown error statuses */
94
95 /* language.c */
96 cups_lang_t *lang_default; /* Default language */
97 # ifdef __APPLE__
98 char language[32]; /* Cached language */
99 # endif /* __APPLE__ */
100
101 /* ppd.c */
102 ppd_status_t ppd_status; /* Status of last ppdOpen*() */
103 int ppd_line; /* Current line number */
104 ppd_conform_t ppd_conform; /* Level of conformance required */
105
106 /* snmp.c */
107 char snmp_community[255];
108 /* Default SNMP community name */
109 int snmp_debug; /* Log SNMP IO to stderr? */
110
111 /* tempfile.c */
112 char tempfile[1024]; /* cupsTempFd/File buffer */
113
114 /* usersys.c */
115 http_encryption_t encryption; /* Encryption setting */
116 char user[65], /* User name */
117 server[256], /* Server address */
118 servername[256];/* Server hostname */
119 cups_password_cb_t password_cb; /* Password callback */
120
121 /* util.c */
122 http_t *http; /* Current server connection */
123 ipp_status_t last_error; /* Last IPP error */
124 char *last_status_message;
125 /* Last IPP status-message */
126
127 char def_printer[256];
128 /* Default printer */
129 char ppd_filename[HTTP_MAX_URI];
130 /* PPD filename */
131 } _cups_globals_t;
132
133
134 /*
135 * Prototypes...
136 */
137
138 extern http_t *_cupsConnect(void);
139 extern const char *_cupsGetPassword(const char *prompt);
140 extern _cups_globals_t *_cupsGlobals(void);
141 extern void _cupsSetError(ipp_status_t status, const char *message);
142 extern void _cupsSetHTTPError(http_status_t status);
143
144
145 /*
146 * C++ magic...
147 */
148
149 # ifdef __cplusplus
150 }
151 # endif /* __cplusplus */
152 #endif /* !_CUPS_GLOBALS_H_ */
153
154 /*
155 * End of "$Id: globals.h 6712 2007-07-24 00:13:05Z mike $".
156 */