2 * "$Id: cupsd.h 7928 2008-09-10 22:14:22Z mike $"
4 * Main header file for the CUPS scheduler.
6 * Copyright 2007-2010 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/cups-private.h>
28 #include <sys/types.h>
41 #if defined(HAVE_CDSASSL)
42 # include <CoreFoundation/CoreFoundation.h>
43 #endif /* HAVE_CDSASSL */
47 * Some OS's don't have hstrerror(), most notably Solaris...
50 #ifndef HAVE_HSTRERROR
53 # endif /* hstrerror */
54 # define hstrerror cups_hstrerror
56 extern const char *cups_hstrerror(int);
57 #endif /* !HAVE_HSTRERROR */
66 # define TRUE (!FALSE)
71 * Implementation limits...
74 #define MAX_ENV 100 /* Maximum number of environment strings */
75 #define MAX_USERPASS 33 /* Maximum size of username/password */
76 #define MAX_FILTERS 20 /* Maximum number of filters */
77 #define MAX_SYSTEM_GROUPS 32 /* Maximum number of system groups */
84 #define DEFAULT_HISTORY 1 /* Preserve job history? */
85 #define DEFAULT_FILES 0 /* Preserve job files? */
86 #define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
87 #define DEFAULT_KEEPALIVE 30 /* Timeout between requests */
88 #define DEFAULT_INTERVAL 30 /* Interval between browse updates */
89 #define DEFAULT_CHARSET "utf-8" /* Default charset */
93 * Global variable macros...
99 # define VALUE2(x,y) ={x,y}
108 * Other stuff for the scheduler...
117 #include "printers.h"
124 #include "subscriptions.h"
131 #define RELOAD_NONE 0 /* No reload needed */
132 #define RELOAD_ALL 1 /* Reload everything */
133 #define RELOAD_CUPSD 2 /* Reload only cupsd.conf */
137 * Select callback function type...
140 typedef void (*cupsd_selfunc_t
)(void *data
);
147 VAR
int TestConfigFile
VALUE(0),
148 /* Test the cupsd.conf file? */
149 UseProfiles
VALUE(1);
150 /* Use security profiles for child procs? */
151 VAR
int MaxFDs
VALUE(0);
152 /* Maximum number of files */
154 VAR
time_t ReloadTime
VALUE(0);
155 /* Time of reload request... */
156 VAR
int NeedReload
VALUE(RELOAD_ALL
);
157 /* Need to load configuration? */
158 VAR
void *DefaultProfile
VALUE(0);
159 /* Default security profile */
162 VAR
int KerberosInitialized
VALUE(0);
163 /* Has Kerberos been initialized? */
164 VAR krb5_context KerberosContext
VALUE(NULL
);
165 /* Kerberos context for credentials */
166 #endif /* HAVE_GSSAPI */
169 VAR
int Launchd
VALUE(0);
170 /* Running from launchd */
171 #endif /* HAVE_LAUNCH_H */
178 extern void cupsdCheckProcess(void);
179 extern void cupsdClearString(char **s
);
180 extern void cupsdHoldSignals(void);
181 extern void cupsdReleaseSignals(void);
182 extern void cupsdSetString(char **s
, const char *v
);
183 extern void cupsdSetStringf(char **s
, const char *f
, ...)
185 __attribute__ ((__format__ (__printf__
, 2, 3)))
186 #endif /* __GNUC__ */
188 extern void cupsdStartServer(void);
189 extern void cupsdStopServer(void);
190 extern void cupsdClosePipe(int *fds
);
191 extern int cupsdOpenPipe(int *fds
);
193 extern void cupsdInitEnv(void);
194 extern int cupsdLoadEnv(char *envp
[], int envmax
);
195 extern void cupsdSetEnv(const char *name
, const char *value
);
196 extern void cupsdSetEnvf(const char *name
, const char *value
, ...)
198 __attribute__ ((__format__ (__printf__
, 2, 3)))
199 #endif /* __GNUC__ */
202 extern void *cupsdCreateProfile(int job_id
);
203 extern void cupsdDestroyProfile(void *profile
);
204 extern int cupsdEndProcess(int pid
, int force
);
205 extern const char *cupsdFinishProcess(int pid
, char *name
, int namelen
,
207 extern int cupsdStartProcess(const char *command
, char *argv
[],
208 char *envp
[], int infd
, int outfd
,
209 int errfd
, int backfd
, int sidefd
,
210 int root
, void *profile
, cupsd_job_t
*job
,
213 extern int cupsdAddSelect(int fd
, cupsd_selfunc_t read_cb
,
214 cupsd_selfunc_t write_cb
, void *data
);
215 extern int cupsdDoSelect(long timeout
);
216 #ifdef CUPSD_IS_SELECTING
217 extern int cupsdIsSelecting(int fd
);
218 #endif /* CUPSD_IS_SELECTING */
219 extern void cupsdRemoveSelect(int fd
);
220 extern void cupsdStartSelect(void);
221 extern void cupsdStopSelect(void);
223 extern int cupsdRemoveFile(const char *filename
);
227 * End of "$Id: cupsd.h 7928 2008-09-10 22:14:22Z mike $".