]>
git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/cupsd.h
4 * Main header file for the CUPS scheduler.
6 * Copyright 2007-2014 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>
22 #include <cups/file-private.h>
29 #include <sys/types.h>
42 #if defined(HAVE_CDSASSL)
43 # include <CoreFoundation/CoreFoundation.h>
44 #endif /* HAVE_CDSASSL */
48 * Some OS's don't have hstrerror(), most notably Solaris...
51 #ifndef HAVE_HSTRERROR
54 # endif /* hstrerror */
55 # define hstrerror cups_hstrerror
57 extern const char *cups_hstrerror(int);
58 #endif /* !HAVE_HSTRERROR */
67 # define TRUE (!FALSE)
72 * Implementation limits...
75 #define MAX_ENV 100 /* Maximum number of environment strings */
76 #define MAX_USERPASS 33 /* Maximum size of username/password */
77 #define MAX_FILTERS 20 /* Maximum number of filters */
78 #define MAX_SYSTEM_GROUPS 32 /* Maximum number of system groups */
85 #define DEFAULT_HISTORY INT_MAX /* Preserve job history? */
86 #define DEFAULT_FILES 86400 /* Preserve job files? */
87 #define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
88 #define DEFAULT_KEEPALIVE 30 /* Timeout between requests */
92 * Global variable macros...
98 # define VALUE2(x,y) ={x,y}
107 * Other stuff for the scheduler...
116 #include "printers.h"
119 #include "colorman.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 VAR
int MaxFDs
VALUE(0);
150 /* Maximum number of files */
152 VAR
time_t ReloadTime
VALUE(0);
153 /* Time of reload request... */
154 VAR
int NeedReload
VALUE(RELOAD_ALL
),
155 /* Need to load configuration? */
156 DoingShutdown
VALUE(0);
157 /* Shutting down the scheduler? */
158 VAR
void *DefaultProfile
VALUE(0);
159 /* Default security profile */
161 #if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD)
162 VAR
int OnDemand
VALUE(0);
163 /* Launched on demand */
164 #endif /* HAVE_LAUNCHD || HAVE_SYSTEMD */
172 extern void cupsdInitEnv(void);
173 extern int cupsdLoadEnv(char *envp
[], int envmax
);
174 extern void cupsdSetEnv(const char *name
, const char *value
);
175 extern void cupsdSetEnvf(const char *name
, const char *value
, ...)
176 __attribute__ ((__format__ (__printf__
, 2, 3)));
177 extern void cupsdUpdateEnv(void);
180 extern void cupsdCleanFiles(const char *path
, const char *pattern
);
181 extern int cupsdCloseCreatedConfFile(cups_file_t
*fp
,
182 const char *filename
);
183 extern void cupsdClosePipe(int *fds
);
184 extern cups_file_t
*cupsdCreateConfFile(const char *filename
, mode_t mode
);
185 extern cups_file_t
*cupsdOpenConfFile(const char *filename
);
186 extern int cupsdOpenPipe(int *fds
);
187 extern int cupsdRemoveFile(const char *filename
);
188 extern int cupsdUnlinkOrRemoveFile(const char *filename
);
191 extern int cupsdAddString(cups_array_t
**a
, const char *s
);
192 extern void cupsdCheckProcess(void);
193 extern void cupsdClearString(char **s
);
194 extern void cupsdFreeStrings(cups_array_t
**a
);
195 extern void cupsdHoldSignals(void);
196 extern char *cupsdMakeUUID(const char *name
, int number
,
197 char *buffer
, size_t bufsize
);
198 extern void cupsdReleaseSignals(void);
199 extern void cupsdSetString(char **s
, const char *v
);
200 extern void cupsdSetStringf(char **s
, const char *f
, ...)
201 __attribute__ ((__format__ (__printf__
, 2, 3)));
204 extern void *cupsdCreateProfile(int job_id
, int allow_networking
);
205 extern void cupsdDestroyProfile(void *profile
);
206 extern int cupsdEndProcess(int pid
, int force
);
207 extern const char *cupsdFinishProcess(int pid
, char *name
, size_t namelen
, int *job_id
);
208 extern int cupsdStartProcess(const char *command
, char *argv
[],
209 char *envp
[], int infd
, int outfd
,
210 int errfd
, int backfd
, int sidefd
,
211 int root
, void *profile
,
212 cupsd_job_t
*job
, int *pid
);
215 extern int cupsdAddSelect(int fd
, cupsd_selfunc_t read_cb
,
216 cupsd_selfunc_t write_cb
, void *data
);
217 extern int cupsdDoSelect(long timeout
);
218 #ifdef CUPSD_IS_SELECTING
219 extern int cupsdIsSelecting(int fd
);
220 #endif /* CUPSD_IS_SELECTING */
221 extern void cupsdRemoveSelect(int fd
);
222 extern void cupsdStartSelect(void);
223 extern void cupsdStopSelect(void);
226 extern void cupsdStartServer(void);
227 extern void cupsdStopServer(void);