]>
Commit | Line | Data |
---|---|---|
43e2fc22 | 1 | /* |
c9d3f842 | 2 | * "$Id$" |
43e2fc22 | 3 | * |
fd8b1cf8 | 4 | * Main header file for the Common UNIX Printing System (CUPS) scheduler. |
43e2fc22 | 5 | * |
c9d3f842 | 6 | * Copyright 1997-2005 by Easy Software Products, all rights reserved. |
43e2fc22 | 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 | |
8784b6a6 | 17 | * 44141 Airport View Drive, Suite 204 |
bcd9e019 | 18 | * Hollywood, Maryland 20636 USA |
43e2fc22 | 19 | * |
9639c4de | 20 | * Voice: (301) 373-9600 |
43e2fc22 | 21 | * EMail: cups-info@cups.org |
22 | * WWW: http://www.cups.org | |
43e2fc22 | 23 | */ |
24 | ||
f3bc1068 | 25 | |
43e2fc22 | 26 | /* |
27 | * Include necessary headers. | |
28 | */ | |
29 | ||
0a0621ae | 30 | #include <cups/http-private.h> |
31 | #include <cups/string.h> | |
fd8b1cf8 | 32 | #include <stdlib.h> |
fd8b1cf8 | 33 | #include <limits.h> |
fd8b1cf8 | 34 | #include <errno.h> |
35 | #include <time.h> | |
36 | #include <signal.h> | |
fd8b1cf8 | 37 | #include <fcntl.h> |
7ed5d5f2 | 38 | #include <math.h> |
fd8b1cf8 | 39 | #include <sys/types.h> |
40 | #include <sys/time.h> | |
41 | #include <sys/stat.h> | |
42 | #include <sys/wait.h> | |
43 | ||
c3026ddc | 44 | #ifdef WIN32 |
a74b005d | 45 | # include <direct.h> |
fd8b1cf8 | 46 | #else |
a74b005d | 47 | # include <unistd.h> |
c3026ddc | 48 | #endif /* WIN32 */ |
a74b005d | 49 | |
90231631 | 50 | #include <cups/array.h> |
a74b005d | 51 | #include <cups/cups.h> |
f41ba047 | 52 | #include "mime.h" |
707152b4 | 53 | #include <cups/http.h> |
bcf61448 | 54 | #include <cups/ipp.h> |
a74b005d | 55 | #include <cups/language.h> |
6abc7437 | 56 | #include <cups/debug.h> |
fd8b1cf8 | 57 | |
dcfcaeac | 58 | #if defined(HAVE_CDSASSL) |
59 | # include <CoreFoundation/CoreFoundation.h> | |
60 | #endif /* HAVE_CDSASSL */ | |
61 | ||
fd8b1cf8 | 62 | |
dfb69f7a | 63 | /* |
64 | * Some OS's don't have hstrerror(), most notably Solaris... | |
65 | */ | |
66 | ||
67 | #ifndef HAVE_HSTRERROR | |
68 | # define hstrerror cups_hstrerror | |
69 | ||
70 | extern const char *cups_hstrerror(int); | |
71 | #endif /* !HAVE_HSTRERROR */ | |
72 | ||
73 | ||
fd8b1cf8 | 74 | /* |
75 | * Common constants. | |
76 | */ | |
77 | ||
78 | #ifndef FALSE | |
79 | # define FALSE 0 | |
80 | # define TRUE (!FALSE) | |
81 | #endif /* !FALSE */ | |
82 | ||
83 | ||
84 | /* | |
85 | * Implementation limits... | |
86 | */ | |
87 | ||
83e740a5 | 88 | #define MAX_USERPASS 33 /* Maximum size of username/password */ |
6abc7437 | 89 | #define MAX_FILTERS 20 /* Maximum number of filters */ |
753453e4 | 90 | #define MAX_SYSTEM_GROUPS 32 /* Maximum number of system groups */ |
fd8b1cf8 | 91 | |
bd84e0d1 | 92 | |
fd8b1cf8 | 93 | /* |
94 | * Defaults... | |
95 | */ | |
96 | ||
bd84e0d1 | 97 | #define DEFAULT_HISTORY 1 /* Preserve job history? */ |
98 | #define DEFAULT_FILES 0 /* Preserve job files? */ | |
fd8b1cf8 | 99 | #define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */ |
bd176c9c | 100 | #define DEFAULT_KEEPALIVE 60 /* Timeout between requests */ |
fd8b1cf8 | 101 | #define DEFAULT_INTERVAL 30 /* Interval between browse updates */ |
753453e4 | 102 | #define DEFAULT_CHARSET "utf-8" /* Default charset */ |
472ce1dc | 103 | |
17b95e13 | 104 | |
fd8b1cf8 | 105 | /* |
106 | * Global variable macros... | |
107 | */ | |
108 | ||
109 | #ifdef _MAIN_C_ | |
110 | # define VAR | |
111 | # define VALUE(x) =x | |
0a968cfb | 112 | # define VALUE2(x,y) ={x,y} |
fd8b1cf8 | 113 | #else |
114 | # define VAR extern | |
115 | # define VALUE(x) | |
0a968cfb | 116 | # define VALUE2(x,y) |
fd8b1cf8 | 117 | #endif /* _MAIN_C */ |
118 | ||
119 | ||
120 | /* | |
121 | * Other stuff for the scheduler... | |
122 | */ | |
123 | ||
294f4cee | 124 | #include "statbuf.h" |
d2122fde | 125 | #include "cert.h" |
fd8b1cf8 | 126 | #include "auth.h" |
99baf768 | 127 | #include "client.h" |
f27bd5ab | 128 | #include "policy.h" |
fd8b1cf8 | 129 | #include "printers.h" |
a9de544f | 130 | #include "classes.h" |
131 | #include "job.h" | |
c7fa9d06 | 132 | #include "conf.h" |
d21a7597 | 133 | #include "banners.h" |
753453e4 | 134 | #include "dirsvc.h" |
20264b99 | 135 | #include "network.h" |
bf6409d1 | 136 | #include "subscriptions.h" |
d21a7597 | 137 | |
138 | ||
53510eae | 139 | /* |
140 | * Reload types... | |
141 | */ | |
142 | ||
143 | #define RELOAD_NONE 0 /* No reload needed */ | |
144 | #define RELOAD_ALL 1 /* Reload everything */ | |
145 | #define RELOAD_CUPSD 2 /* Reload only cupsd.conf */ | |
146 | ||
147 | ||
fd8b1cf8 | 148 | /* |
149 | * Globals... | |
150 | */ | |
151 | ||
f3bc1068 | 152 | VAR int MaxFDs, /* Maximum number of files */ |
153 | SetSize; /* The size of the input/output sets */ | |
154 | VAR fd_set *InputSet, /* Input files for select() */ | |
155 | *OutputSet; /* Output files for select() */ | |
fd8b1cf8 | 156 | |
a782f61f | 157 | VAR time_t ReloadTime VALUE(0); |
158 | /* Time of reload request... */ | |
fc9894d1 | 159 | VAR int NeedReload VALUE(RELOAD_ALL); |
a74b005d | 160 | /* Need to load configuration? */ |
daf8f5f0 | 161 | |
fd8b1cf8 | 162 | |
163 | /* | |
164 | * Prototypes... | |
165 | */ | |
43e2fc22 | 166 | |
589eb420 | 167 | extern void cupsdCatchChildSignals(void); |
168 | extern void cupsdClearString(char **s); | |
169 | extern void cupsdHoldSignals(void); | |
170 | extern void cupsdIgnoreChildSignals(void); | |
171 | extern void cupsdReleaseSignals(void); | |
172 | extern void cupsdSetString(char **s, const char *v); | |
173 | extern void cupsdSetStringf(char **s, const char *f, ...) | |
291355eb | 174 | #ifdef __GNUC__ |
175 | __attribute__ ((__format__ (__printf__, 2, 3))) | |
176 | #endif /* __GNUC__ */ | |
177 | ; | |
589eb420 | 178 | extern void cupsdStartServer(void); |
179 | extern void cupsdStopServer(void); | |
8650fcf2 | 180 | extern void cupsdClosePipe(int *fds); |
181 | extern int cupsdOpenPipe(int *fds); | |
89db771d | 182 | |
291355eb | 183 | extern void cupsdClearEnv(void); |
184 | extern void cupsdInitEnv(void); | |
185 | extern int cupsdLoadEnv(char *envp[], int envmax); | |
186 | extern void cupsdSetEnv(const char *name, const char *value); | |
187 | extern void cupsdSetEnvf(const char *name, const char *value, ...) | |
188 | #ifdef __GNUC__ | |
189 | __attribute__ ((__format__ (__printf__, 2, 3))) | |
190 | #endif /* __GNUC__ */ | |
191 | ; | |
192 | ||
193 | extern int cupsdEndProcess(int pid, int force); | |
a665f6fc | 194 | extern int cupsdStartProcess(const char *command, char *argv[], |
195 | char *envp[], int infd, int outfd, | |
196 | int errfd, int backfd, int root, int *pid); | |
a665f6fc | 197 | |
43e2fc22 | 198 | |
199 | /* | |
c9d3f842 | 200 | * End of "$Id$". |
43e2fc22 | 201 | */ |