]>
git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/cupsd.h
2 * Main header file for the CUPS scheduler.
4 * Copyright 2007-2016 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
7 * These coded instructions, statements, and computer programs are the
8 * property of Apple Inc. and are protected by Federal copyright
9 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
10 * "LICENSE" which should have been included with this file. If this
11 * file is missing or damaged, see the license at "http://www.cups.org/".
16 * Include necessary headers.
19 #include <cups/cups-private.h>
20 #include <cups/file-private.h>
21 #include <cups/ppd-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 INT_MAX /* Preserve job history? */
85 #define DEFAULT_FILES 86400 /* Preserve job files? */
86 #define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
87 #define DEFAULT_KEEPALIVE 30 /* Timeout between requests */
91 * Global variable macros...
97 # define VALUE2(x,y) ={x,y}
106 * Other stuff for the scheduler...
115 #include "printers.h"
118 #include "colorman.h"
123 #include "subscriptions.h"
130 #define RELOAD_NONE 0 /* No reload needed */
131 #define RELOAD_ALL 1 /* Reload everything */
132 #define RELOAD_CUPSD 2 /* Reload only cupsd.conf */
136 * Select callback function type...
139 typedef void (*cupsd_selfunc_t
)(void *data
);
146 VAR
int TestConfigFile
VALUE(0);
147 /* Test the cupsd.conf file? */
148 VAR
int MaxFDs
VALUE(0);
149 /* Maximum number of files */
151 VAR
time_t ReloadTime
VALUE(0);
152 /* Time of reload request... */
153 VAR
int NeedReload
VALUE(RELOAD_ALL
),
154 /* Need to load configuration? */
155 DoingShutdown
VALUE(0);
156 /* Shutting down the scheduler? */
157 VAR
void *DefaultProfile
VALUE(0);
158 /* Default security profile */
161 VAR
int OnDemand
VALUE(0);
162 /* Launched on demand */
163 #endif /* HAVE_ONDEMAND */
171 extern void cupsdInitEnv(void);
172 extern int cupsdLoadEnv(char *envp
[], int envmax
);
173 extern void cupsdSetEnv(const char *name
, const char *value
);
174 extern void cupsdSetEnvf(const char *name
, const char *value
, ...)
175 __attribute__ ((__format__ (__printf__
, 2, 3)));
176 extern void cupsdUpdateEnv(void);
179 extern void cupsdCleanFiles(const char *path
, const char *pattern
);
180 extern int cupsdCloseCreatedConfFile(cups_file_t
*fp
,
181 const char *filename
);
182 extern void cupsdClosePipe(int *fds
);
183 extern cups_file_t
*cupsdCreateConfFile(const char *filename
, mode_t mode
);
184 extern cups_file_t
*cupsdOpenConfFile(const char *filename
);
185 extern int cupsdOpenPipe(int *fds
);
186 extern int cupsdRemoveFile(const char *filename
);
187 extern int cupsdUnlinkOrRemoveFile(const char *filename
);
190 extern int cupsdAddString(cups_array_t
**a
, const char *s
);
191 extern void cupsdCheckProcess(void);
192 extern void cupsdClearString(char **s
);
193 extern void cupsdFreeStrings(cups_array_t
**a
);
194 extern void cupsdHoldSignals(void);
195 extern char *cupsdMakeUUID(const char *name
, int number
,
196 char *buffer
, size_t bufsize
);
197 extern void cupsdReleaseSignals(void);
198 extern void cupsdSetString(char **s
, const char *v
);
199 extern void cupsdSetStringf(char **s
, const char *f
, ...)
200 __attribute__ ((__format__ (__printf__
, 2, 3)));
203 extern void *cupsdCreateProfile(int job_id
, int allow_networking
);
204 extern void cupsdDestroyProfile(void *profile
);
205 extern int cupsdEndProcess(int pid
, int force
);
206 extern const char *cupsdFinishProcess(int pid
, char *name
, size_t namelen
, int *job_id
);
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
,
211 cupsd_job_t
*job
, int *pid
);
214 extern int cupsdAddSelect(int fd
, cupsd_selfunc_t read_cb
,
215 cupsd_selfunc_t write_cb
, void *data
);
216 extern int cupsdDoSelect(long timeout
);
217 #ifdef CUPSD_IS_SELECTING
218 extern int cupsdIsSelecting(int fd
);
219 #endif /* CUPSD_IS_SELECTING */
220 extern void cupsdRemoveSelect(int fd
);
221 extern void cupsdStartSelect(void);
222 extern void cupsdStopSelect(void);
225 extern void cupsdStartServer(void);
226 extern void cupsdStopServer(void);