]>
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>
23 #include <cups/ppd-private.h>
30 #include <sys/types.h>
43 #if defined(HAVE_CDSASSL)
44 # include <CoreFoundation/CoreFoundation.h>
45 #endif /* HAVE_CDSASSL */
49 * Some OS's don't have hstrerror(), most notably Solaris...
52 #ifndef HAVE_HSTRERROR
55 # endif /* hstrerror */
56 # define hstrerror cups_hstrerror
58 extern const char *cups_hstrerror(int);
59 #endif /* !HAVE_HSTRERROR */
68 # define TRUE (!FALSE)
73 * Implementation limits...
76 #define MAX_ENV 100 /* Maximum number of environment strings */
77 #define MAX_USERPASS 33 /* Maximum size of username/password */
78 #define MAX_FILTERS 20 /* Maximum number of filters */
79 #define MAX_SYSTEM_GROUPS 32 /* Maximum number of system groups */
86 #define DEFAULT_HISTORY INT_MAX /* Preserve job history? */
87 #define DEFAULT_FILES 86400 /* Preserve job files? */
88 #define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
89 #define DEFAULT_KEEPALIVE 30 /* Timeout between requests */
93 * Global variable macros...
99 # define VALUE2(x,y) ={x,y}
108 * Other stuff for the scheduler...
117 #include "printers.h"
120 #include "colorman.h"
125 #include "subscriptions.h"
132 #define RELOAD_NONE 0 /* No reload needed */
133 #define RELOAD_ALL 1 /* Reload everything */
134 #define RELOAD_CUPSD 2 /* Reload only cupsd.conf */
138 * Select callback function type...
141 typedef void (*cupsd_selfunc_t
)(void *data
);
148 VAR
int TestConfigFile
VALUE(0);
149 /* Test the cupsd.conf file? */
150 VAR
int MaxFDs
VALUE(0);
151 /* Maximum number of files */
153 VAR
time_t ReloadTime
VALUE(0);
154 /* Time of reload request... */
155 VAR
int NeedReload
VALUE(RELOAD_ALL
),
156 /* Need to load configuration? */
157 DoingShutdown
VALUE(0);
158 /* Shutting down the scheduler? */
159 VAR
void *DefaultProfile
VALUE(0);
160 /* Default security profile */
162 #if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD)
163 VAR
int OnDemand
VALUE(0);
164 /* Launched on demand */
165 #endif /* HAVE_LAUNCHD || HAVE_SYSTEMD */
173 extern void cupsdInitEnv(void);
174 extern int cupsdLoadEnv(char *envp
[], int envmax
);
175 extern void cupsdSetEnv(const char *name
, const char *value
);
176 extern void cupsdSetEnvf(const char *name
, const char *value
, ...)
177 __attribute__ ((__format__ (__printf__
, 2, 3)));
178 extern void cupsdUpdateEnv(void);
181 extern void cupsdCleanFiles(const char *path
, const char *pattern
);
182 extern int cupsdCloseCreatedConfFile(cups_file_t
*fp
,
183 const char *filename
);
184 extern void cupsdClosePipe(int *fds
);
185 extern cups_file_t
*cupsdCreateConfFile(const char *filename
, mode_t mode
);
186 extern cups_file_t
*cupsdOpenConfFile(const char *filename
);
187 extern int cupsdOpenPipe(int *fds
);
188 extern int cupsdRemoveFile(const char *filename
);
189 extern int cupsdUnlinkOrRemoveFile(const char *filename
);
192 extern int cupsdAddString(cups_array_t
**a
, const char *s
);
193 extern void cupsdCheckProcess(void);
194 extern void cupsdClearString(char **s
);
195 extern void cupsdFreeStrings(cups_array_t
**a
);
196 extern void cupsdHoldSignals(void);
197 extern char *cupsdMakeUUID(const char *name
, int number
,
198 char *buffer
, size_t bufsize
);
199 extern void cupsdReleaseSignals(void);
200 extern void cupsdSetString(char **s
, const char *v
);
201 extern void cupsdSetStringf(char **s
, const char *f
, ...)
202 __attribute__ ((__format__ (__printf__
, 2, 3)));
205 extern void *cupsdCreateProfile(int job_id
, int allow_networking
);
206 extern void cupsdDestroyProfile(void *profile
);
207 extern int cupsdEndProcess(int pid
, int force
);
208 extern const char *cupsdFinishProcess(int pid
, char *name
, size_t namelen
, int *job_id
);
209 extern int cupsdStartProcess(const char *command
, char *argv
[],
210 char *envp
[], int infd
, int outfd
,
211 int errfd
, int backfd
, int sidefd
,
212 int root
, void *profile
,
213 cupsd_job_t
*job
, int *pid
);
216 extern int cupsdAddSelect(int fd
, cupsd_selfunc_t read_cb
,
217 cupsd_selfunc_t write_cb
, void *data
);
218 extern int cupsdDoSelect(long timeout
);
219 #ifdef CUPSD_IS_SELECTING
220 extern int cupsdIsSelecting(int fd
);
221 #endif /* CUPSD_IS_SELECTING */
222 extern void cupsdRemoveSelect(int fd
);
223 extern void cupsdStartSelect(void);
224 extern void cupsdStopSelect(void);
227 extern void cupsdStartServer(void);
228 extern void cupsdStopServer(void);