]> git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/cupsd.h
Mirror 1.1.x changes.
[thirdparty/cups.git] / scheduler / cupsd.h
1 /*
2 * "$Id: cupsd.h,v 1.28.2.19 2003/04/10 20:15:52 mike Exp $"
3 *
4 * Main header file for the Common UNIX Printing System (CUPS) scheduler.
5 *
6 * Copyright 1997-2003 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" 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-3111 USA
19 *
20 * Voice: (301) 373-9603
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
23 */
24
25 #ifdef __sun
26 /*
27 * Define FD_SETSIZE to 2048 on Solaris to get the correct version of
28 * select() for large numbers of file descriptors.
29 */
30
31 # define FD_SETSIZE 2048
32 #endif /* __sun */
33
34
35 /*
36 * Include necessary headers.
37 */
38
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <limits.h>
42 #include <errno.h>
43 #include <time.h>
44 #include <signal.h>
45 #include <fcntl.h>
46 #include <math.h>
47 #include <sys/types.h>
48 #include <sys/time.h>
49 #include <sys/stat.h>
50 #include <sys/wait.h>
51
52 #ifdef WIN32
53 # include <direct.h>
54 #else
55 # include <unistd.h>
56 #endif /* WIN32 */
57
58 #include <cups/cups.h>
59 #include <cups/string.h>
60 #include "mime.h"
61 #include <cups/http.h>
62 #include <cups/ipp.h>
63 #include <cups/language.h>
64 #include <cups/debug.h>
65
66 #if defined(HAVE_CDSASSL)
67 # include <CoreFoundation/CoreFoundation.h>
68 #endif /* HAVE_CDSASSL */
69
70
71 /*
72 * Some OS's don't have hstrerror(), most notably Solaris...
73 */
74
75 #ifndef HAVE_HSTRERROR
76 # define hstrerror cups_hstrerror
77
78 extern const char *cups_hstrerror(int);
79 #endif /* !HAVE_HSTRERROR */
80
81
82 /*
83 * Common constants.
84 */
85
86 #ifndef FALSE
87 # define FALSE 0
88 # define TRUE (!FALSE)
89 #endif /* !FALSE */
90
91
92 /*
93 * Implementation limits...
94 */
95
96 #define MAX_USERPASS 33 /* Maximum size of username/password */
97 #define MAX_FILTERS 20 /* Maximum number of filters */
98 #define MAX_SYSTEM_GROUPS 32 /* Maximum number of system groups */
99
100
101 /*
102 * Defaults...
103 */
104
105 #define DEFAULT_HISTORY 1 /* Preserve job history? */
106 #define DEFAULT_FILES 0 /* Preserve job files? */
107 #define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
108 #define DEFAULT_KEEPALIVE 60 /* Timeout between requests */
109 #define DEFAULT_INTERVAL 30 /* Interval between browse updates */
110 #define DEFAULT_LANGUAGE setlocale(LC_ALL,"")
111 /* Default language encoding */
112 #define DEFAULT_CHARSET "utf-8" /* Default charset */
113
114
115 /*
116 * Global variable macros...
117 */
118
119 #ifdef _MAIN_C_
120 # define VAR
121 # define VALUE(x) =x
122 # define VALUE2(x,y) ={x,y}
123 #else
124 # define VAR extern
125 # define VALUE(x)
126 # define VALUE2(x,y)
127 #endif /* _MAIN_C */
128
129
130 /*
131 * Other stuff for the scheduler...
132 */
133
134 #include "cert.h"
135 #include "client.h"
136 #include "auth.h"
137 #include "policy.h"
138 #include "printers.h"
139 #include "classes.h"
140 #include "job.h"
141 #include "conf.h"
142 #include "banners.h"
143 #include "dirsvc.h"
144 #include "network.h"
145
146
147 /*
148 * Directory handling functions...
149 */
150
151 #if HAVE_DIRENT_H
152 # include <dirent.h>
153 typedef struct dirent DIRENT;
154 # define NAMLEN(dirent) strlen((dirent)->d_name)
155 #else
156 # if HAVE_SYS_NDIR_H
157 # include <sys/ndir.h>
158 # endif
159 # if HAVE_SYS_DIR_H
160 # include <sys/dir.h>
161 # endif
162 # if HAVE_NDIR_H
163 # include <ndir.h>
164 # endif
165 typedef struct direct DIRENT;
166 # define NAMLEN(dirent) (dirent)->d_namlen
167 #endif
168
169
170 /*
171 * Reload types...
172 */
173
174 #define RELOAD_NONE 0 /* No reload needed */
175 #define RELOAD_ALL 1 /* Reload everything */
176 #define RELOAD_CUPSD 2 /* Reload only cupsd.conf */
177
178
179 /*
180 * Globals...
181 */
182
183 VAR int MaxFDs, /* Maximum number of files */
184 SetSize; /* The size of the input/output sets */
185 VAR fd_set *InputSet, /* Input files for select() */
186 *OutputSet; /* Output files for select() */
187
188 VAR int NeedReload VALUE(RELOAD_ALL);
189 /* Need to load configuration? */
190 VAR char *TZ VALUE(NULL);
191 /* Timezone configuration */
192
193 VAR ipp_t *Devices VALUE(NULL),
194 /* Available devices */
195 *PPDs VALUE(NULL);
196 /* Available PPDs */
197
198
199 /*
200 * Prototypes...
201 */
202
203 extern void CatchChildSignals(void);
204 extern void ClearString(char **s);
205 extern void HoldSignals(void);
206 extern void IgnoreChildSignals(void);
207 extern void LoadDevices(const char *d);
208 extern void LoadPPDs(const char *d);
209 extern void ReleaseSignals(void);
210 extern void SetString(char **s, const char *v);
211 extern void SetStringf(char **s, const char *f, ...);
212 extern void StartServer(void);
213 extern void StopServer(void);
214
215
216 /*
217 * End of "$Id: cupsd.h,v 1.28.2.19 2003/04/10 20:15:52 mike Exp $".
218 */