]>
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 | * |
24c1b5ce | 6 | * Copyright 1997-2006 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> |
a501ad17 | 55 | #include <cups/i18n.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 | |
95c68078 | 68 | # ifdef hstrerror |
69 | # undef hstrerror | |
70 | # endif /* hstrerror */ | |
dfb69f7a | 71 | # define hstrerror cups_hstrerror |
72 | ||
73 | extern const char *cups_hstrerror(int); | |
74 | #endif /* !HAVE_HSTRERROR */ | |
75 | ||
76 | ||
fd8b1cf8 | 77 | /* |
78 | * Common constants. | |
79 | */ | |
80 | ||
81 | #ifndef FALSE | |
82 | # define FALSE 0 | |
83 | # define TRUE (!FALSE) | |
84 | #endif /* !FALSE */ | |
85 | ||
86 | ||
87 | /* | |
88 | * Implementation limits... | |
89 | */ | |
90 | ||
6fd85a6b | 91 | #define MAX_ENV 100 /* Maximum number of environment strings */ |
83e740a5 | 92 | #define MAX_USERPASS 33 /* Maximum size of username/password */ |
6abc7437 | 93 | #define MAX_FILTERS 20 /* Maximum number of filters */ |
753453e4 | 94 | #define MAX_SYSTEM_GROUPS 32 /* Maximum number of system groups */ |
fd8b1cf8 | 95 | |
bd84e0d1 | 96 | |
fd8b1cf8 | 97 | /* |
98 | * Defaults... | |
99 | */ | |
100 | ||
bd84e0d1 | 101 | #define DEFAULT_HISTORY 1 /* Preserve job history? */ |
102 | #define DEFAULT_FILES 0 /* Preserve job files? */ | |
fd8b1cf8 | 103 | #define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */ |
bd176c9c | 104 | #define DEFAULT_KEEPALIVE 60 /* Timeout between requests */ |
fd8b1cf8 | 105 | #define DEFAULT_INTERVAL 30 /* Interval between browse updates */ |
753453e4 | 106 | #define DEFAULT_CHARSET "utf-8" /* Default charset */ |
472ce1dc | 107 | |
17b95e13 | 108 | |
fd8b1cf8 | 109 | /* |
110 | * Global variable macros... | |
111 | */ | |
112 | ||
113 | #ifdef _MAIN_C_ | |
114 | # define VAR | |
115 | # define VALUE(x) =x | |
0a968cfb | 116 | # define VALUE2(x,y) ={x,y} |
fd8b1cf8 | 117 | #else |
118 | # define VAR extern | |
119 | # define VALUE(x) | |
0a968cfb | 120 | # define VALUE2(x,y) |
fd8b1cf8 | 121 | #endif /* _MAIN_C */ |
122 | ||
123 | ||
124 | /* | |
125 | * Other stuff for the scheduler... | |
126 | */ | |
127 | ||
6de33945 | 128 | #include "sysman.h" |
294f4cee | 129 | #include "statbuf.h" |
d2122fde | 130 | #include "cert.h" |
fd8b1cf8 | 131 | #include "auth.h" |
99baf768 | 132 | #include "client.h" |
f27bd5ab | 133 | #include "policy.h" |
fd8b1cf8 | 134 | #include "printers.h" |
a9de544f | 135 | #include "classes.h" |
136 | #include "job.h" | |
c7fa9d06 | 137 | #include "conf.h" |
d21a7597 | 138 | #include "banners.h" |
753453e4 | 139 | #include "dirsvc.h" |
20264b99 | 140 | #include "network.h" |
bf6409d1 | 141 | #include "subscriptions.h" |
d21a7597 | 142 | |
143 | ||
53510eae | 144 | /* |
145 | * Reload types... | |
146 | */ | |
147 | ||
148 | #define RELOAD_NONE 0 /* No reload needed */ | |
149 | #define RELOAD_ALL 1 /* Reload everything */ | |
150 | #define RELOAD_CUPSD 2 /* Reload only cupsd.conf */ | |
151 | ||
152 | ||
9d4830a3 | 153 | /* |
154 | * Select callback function type... | |
155 | */ | |
156 | ||
157 | typedef void (*cupsd_selfunc_t)(void *data); | |
158 | ||
159 | ||
fd8b1cf8 | 160 | /* |
161 | * Globals... | |
162 | */ | |
163 | ||
9d4830a3 | 164 | VAR int MaxFDs; /* Maximum number of files */ |
fd8b1cf8 | 165 | |
a782f61f | 166 | VAR time_t ReloadTime VALUE(0); |
167 | /* Time of reload request... */ | |
fc9894d1 | 168 | VAR int NeedReload VALUE(RELOAD_ALL); |
a74b005d | 169 | /* Need to load configuration? */ |
dfeef8b5 | 170 | #ifdef HAVE_LAUNCH_H |
171 | VAR int Launchd VALUE(0); | |
172 | /* Running from launchd */ | |
173 | #endif /* HAVE_LAUNCH_H */ | |
daf8f5f0 | 174 | |
fd8b1cf8 | 175 | |
176 | /* | |
177 | * Prototypes... | |
178 | */ | |
43e2fc22 | 179 | |
589eb420 | 180 | extern void cupsdClearString(char **s); |
181 | extern void cupsdHoldSignals(void); | |
589eb420 | 182 | extern void cupsdReleaseSignals(void); |
183 | extern void cupsdSetString(char **s, const char *v); | |
184 | extern void cupsdSetStringf(char **s, const char *f, ...) | |
291355eb | 185 | #ifdef __GNUC__ |
186 | __attribute__ ((__format__ (__printf__, 2, 3))) | |
187 | #endif /* __GNUC__ */ | |
188 | ; | |
589eb420 | 189 | extern void cupsdStartServer(void); |
190 | extern void cupsdStopServer(void); | |
8650fcf2 | 191 | extern void cupsdClosePipe(int *fds); |
192 | extern int cupsdOpenPipe(int *fds); | |
89db771d | 193 | |
291355eb | 194 | extern void cupsdInitEnv(void); |
195 | extern int cupsdLoadEnv(char *envp[], int envmax); | |
196 | extern void cupsdSetEnv(const char *name, const char *value); | |
197 | extern void cupsdSetEnvf(const char *name, const char *value, ...) | |
198 | #ifdef __GNUC__ | |
199 | __attribute__ ((__format__ (__printf__, 2, 3))) | |
200 | #endif /* __GNUC__ */ | |
201 | ; | |
202 | ||
203 | extern int cupsdEndProcess(int pid, int force); | |
960e5ba0 | 204 | extern const char *cupsdFinishProcess(int pid, char *name, int namelen); |
a665f6fc | 205 | extern int cupsdStartProcess(const char *command, char *argv[], |
206 | char *envp[], int infd, int outfd, | |
207 | int errfd, int backfd, int root, int *pid); | |
a665f6fc | 208 | |
9d4830a3 | 209 | extern int cupsdAddSelect(int fd, cupsd_selfunc_t read_cb, |
210 | cupsd_selfunc_t write_cb, void *data); | |
211 | extern int cupsdDoSelect(long timeout); | |
212 | extern int cupsdIsSelecting(int fd); | |
213 | extern void cupsdRemoveSelect(int fd); | |
214 | extern void cupsdStartSelect(void); | |
215 | extern void cupsdStopSelect(void); | |
216 | ||
43e2fc22 | 217 | |
218 | /* | |
c9d3f842 | 219 | * End of "$Id$". |
43e2fc22 | 220 | */ |