2 * "$Id: cupsd.h 7928 2008-09-10 22:14:22Z mike $"
4 * Main header file for the Common UNIX Printing System (CUPS) scheduler.
6 * Copyright 2007-2008 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
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 * "LICENSE" which should have been included with this file. If this
13 * file is missing or damaged, see the license at "http://www.cups.org/".
18 * Include necessary headers.
21 #include <cups/http-private.h>
22 #include <cups/string.h>
30 #include <sys/types.h>
41 #include <cups/array.h>
42 #include <cups/cups.h>
44 #include <cups/http.h>
46 #include <cups/i18n.h>
47 #include <cups/debug.h>
49 #if defined(HAVE_CDSASSL)
50 # include <CoreFoundation/CoreFoundation.h>
51 #endif /* HAVE_CDSASSL */
55 * Some OS's don't have hstrerror(), most notably Solaris...
58 #ifndef HAVE_HSTRERROR
61 # endif /* hstrerror */
62 # define hstrerror cups_hstrerror
64 extern const char *cups_hstrerror(int);
65 #endif /* !HAVE_HSTRERROR */
74 # define TRUE (!FALSE)
79 * Implementation limits...
82 #define MAX_ENV 100 /* Maximum number of environment strings */
83 #define MAX_USERPASS 33 /* Maximum size of username/password */
84 #define MAX_FILTERS 20 /* Maximum number of filters */
85 #define MAX_SYSTEM_GROUPS 32 /* Maximum number of system groups */
92 #define DEFAULT_HISTORY 1 /* Preserve job history? */
93 #define DEFAULT_FILES 0 /* Preserve job files? */
94 #define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
95 #define DEFAULT_KEEPALIVE 30 /* Timeout between requests */
96 #define DEFAULT_INTERVAL 30 /* Interval between browse updates */
97 #define DEFAULT_CHARSET "utf-8" /* Default charset */
101 * Global variable macros...
107 # define VALUE2(x,y) ={x,y}
116 * Other stuff for the scheduler...
125 #include "printers.h"
132 #include "subscriptions.h"
139 #define RELOAD_NONE 0 /* No reload needed */
140 #define RELOAD_ALL 1 /* Reload everything */
141 #define RELOAD_CUPSD 2 /* Reload only cupsd.conf */
145 * Select callback function type...
148 typedef void (*cupsd_selfunc_t
)(void *data
);
155 VAR
int TestConfigFile
VALUE(0);
156 /* Test the cupsd.conf file? */
157 VAR
int MaxFDs
VALUE(0);
158 /* Maximum number of files */
160 VAR
time_t ReloadTime
VALUE(0);
161 /* Time of reload request... */
162 VAR
int NeedReload
VALUE(RELOAD_ALL
);
163 /* Need to load configuration? */
164 VAR
void *DefaultProfile
VALUE(0);
165 /* Default security profile */
168 VAR
int KerberosInitialized
VALUE(0);
169 /* Has Kerberos been initialized? */
170 VAR krb5_context KerberosContext
VALUE(NULL
);
171 /* Kerberos context for credentials */
172 #endif /* HAVE_GSSAPI */
175 VAR
int Launchd
VALUE(0);
176 /* Running from launchd */
177 #endif /* HAVE_LAUNCH_H */
179 #if defined(__APPLE__) && defined(HAVE_DLFCN_H)
180 typedef int (*PSQUpdateQuotaProcPtr
)(const char *printer
, const char *info
,
181 const char *user
, int nPages
, int options
);
182 VAR PSQUpdateQuotaProcPtr PSQUpdateQuotaProc
184 /* Apple PrintService quota function */
185 #endif /* __APPLE__ && HAVE_DLFCN_H */
194 extern void cupsdClearString(char **s
);
195 extern void cupsdHoldSignals(void);
196 extern void cupsdReleaseSignals(void);
197 extern void cupsdSetString(char **s
, const char *v
);
198 extern void cupsdSetStringf(char **s
, const char *f
, ...)
200 __attribute__ ((__format__ (__printf__
, 2, 3)))
201 #endif /* __GNUC__ */
203 extern void cupsdStartServer(void);
204 extern void cupsdStopServer(void);
205 extern void cupsdClosePipe(int *fds
);
206 extern int cupsdOpenPipe(int *fds
);
208 extern void cupsdInitEnv(void);
209 extern int cupsdLoadEnv(char *envp
[], int envmax
);
210 extern void cupsdSetEnv(const char *name
, const char *value
);
211 extern void cupsdSetEnvf(const char *name
, const char *value
, ...)
213 __attribute__ ((__format__ (__printf__
, 2, 3)))
214 #endif /* __GNUC__ */
217 extern void *cupsdCreateProfile(int job_id
);
218 extern void cupsdDestroyProfile(void *profile
);
219 extern int cupsdEndProcess(int pid
, int force
);
220 extern const char *cupsdFinishProcess(int pid
, char *name
, int namelen
);
221 extern int cupsdStartProcess(const char *command
, char *argv
[],
222 char *envp
[], int infd
, int outfd
,
223 int errfd
, int backfd
, int sidefd
,
224 int root
, void *profile
, int *pid
);
226 extern int cupsdAddSelect(int fd
, cupsd_selfunc_t read_cb
,
227 cupsd_selfunc_t write_cb
, void *data
);
228 extern int cupsdDoSelect(long timeout
);
229 #ifdef CUPSD_IS_SELECTING
230 extern int cupsdIsSelecting(int fd
);
231 #endif /* CUPSD_IS_SELECTING */
232 extern void cupsdRemoveSelect(int fd
);
233 extern void cupsdStartSelect(void);
234 extern void cupsdStopSelect(void);
236 extern int cupsdRemoveFile(const char *filename
);
240 * End of "$Id: cupsd.h 7928 2008-09-10 22:14:22Z mike $".