]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/cupsd.h
More journald/asl logging bug fixes (STR #4661)
[thirdparty/cups.git] / scheduler / cupsd.h
CommitLineData
ef416fc2 1/*
f2d18633 2 * "$Id$"
ef416fc2 3 *
8fe0183a 4 * Main header file for the CUPS scheduler.
ef416fc2 5 *
8fe0183a
MS
6 * Copyright 2007-2014 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 8 *
8fe0183a
MS
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/".
ef416fc2 14 */
15
16
17/*
18 * Include necessary headers.
19 */
20
71e16022 21#include <cups/cups-private.h>
22c9029b 22#include <cups/file-private.h>
71e16022 23
ef416fc2 24#include <limits.h>
ef416fc2 25#include <time.h>
26#include <signal.h>
27#include <fcntl.h>
28#include <math.h>
29#include <sys/types.h>
30#include <sys/time.h>
31#include <sys/stat.h>
32#include <sys/wait.h>
33
34#ifdef WIN32
35# include <direct.h>
36#else
37# include <unistd.h>
38#endif /* WIN32 */
39
ef416fc2 40#include "mime.h"
ef416fc2 41
42#if defined(HAVE_CDSASSL)
43# include <CoreFoundation/CoreFoundation.h>
44#endif /* HAVE_CDSASSL */
45
46
47/*
48 * Some OS's don't have hstrerror(), most notably Solaris...
49 */
50
51#ifndef HAVE_HSTRERROR
b423cd4c 52# ifdef hstrerror
53# undef hstrerror
54# endif /* hstrerror */
ef416fc2 55# define hstrerror cups_hstrerror
56
57extern const char *cups_hstrerror(int);
58#endif /* !HAVE_HSTRERROR */
59
60
61/*
62 * Common constants.
63 */
64
65#ifndef FALSE
66# define FALSE 0
67# define TRUE (!FALSE)
68#endif /* !FALSE */
69
70
71/*
72 * Implementation limits...
73 */
74
e00b005a 75#define MAX_ENV 100 /* Maximum number of environment strings */
ef416fc2 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 */
79
80
81/*
82 * Defaults...
83 */
84
82cc1f9a
MS
85#define DEFAULT_HISTORY INT_MAX /* Preserve job history? */
86#define DEFAULT_FILES 86400 /* Preserve job files? */
ef416fc2 87#define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
49d87452 88#define DEFAULT_KEEPALIVE 30 /* Timeout between requests */
ef416fc2 89
90
91/*
92 * Global variable macros...
93 */
94
95#ifdef _MAIN_C_
96# define VAR
97# define VALUE(x) =x
98# define VALUE2(x,y) ={x,y}
99#else
100# define VAR extern
101# define VALUE(x)
102# define VALUE2(x,y)
103#endif /* _MAIN_C */
104
105
106/*
107 * Other stuff for the scheduler...
108 */
109
09ec0018 110#include "sysman.h"
ef416fc2 111#include "statbuf.h"
112#include "cert.h"
113#include "auth.h"
114#include "client.h"
115#include "policy.h"
116#include "printers.h"
117#include "classes.h"
118#include "job.h"
a29fd7dd 119#include "colorman.h"
ef416fc2 120#include "conf.h"
121#include "banners.h"
122#include "dirsvc.h"
123#include "network.h"
124#include "subscriptions.h"
125
126
127/*
128 * Reload types...
129 */
130
131#define RELOAD_NONE 0 /* No reload needed */
132#define RELOAD_ALL 1 /* Reload everything */
133#define RELOAD_CUPSD 2 /* Reload only cupsd.conf */
134
135
f7deaa1a 136/*
137 * Select callback function type...
138 */
139
140typedef void (*cupsd_selfunc_t)(void *data);
141
142
ef416fc2 143/*
144 * Globals...
145 */
146
8fe0183a 147VAR int TestConfigFile VALUE(0);
2e4ff8af 148 /* Test the cupsd.conf file? */
ac884b6a
MS
149VAR int MaxFDs VALUE(0);
150 /* Maximum number of files */
ef416fc2 151
152VAR time_t ReloadTime VALUE(0);
153 /* Time of reload request... */
7cf5915e 154VAR int NeedReload VALUE(RELOAD_ALL),
ef416fc2 155 /* Need to load configuration? */
7cf5915e
MS
156 DoingShutdown VALUE(0);
157 /* Shutting down the scheduler? */
a4924f6c
MS
158VAR void *DefaultProfile VALUE(0);
159 /* Default security profile */
c24d2134 160
1720786e
MS
161#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD)
162VAR int OnDemand VALUE(0);
163 /* Launched on demand */
164#endif /* HAVE_LAUNCHD || HAVE_SYSTEMD */
ef416fc2 165
166
167/*
168 * Prototypes...
169 */
170
321d8d57
MS
171/* env.c */
172extern void cupsdInitEnv(void);
173extern int cupsdLoadEnv(char *envp[], int envmax);
174extern void cupsdSetEnv(const char *name, const char *value);
175extern void cupsdSetEnvf(const char *name, const char *value, ...)
85dda01c 176 __attribute__ ((__format__ (__printf__, 2, 3)));
321d8d57
MS
177extern void cupsdUpdateEnv(void);
178
179/* file.c */
180extern void cupsdCleanFiles(const char *path, const char *pattern);
181extern int cupsdCloseCreatedConfFile(cups_file_t *fp,
182 const char *filename);
183extern void cupsdClosePipe(int *fds);
184extern cups_file_t *cupsdCreateConfFile(const char *filename, mode_t mode);
185extern cups_file_t *cupsdOpenConfFile(const char *filename);
186extern int cupsdOpenPipe(int *fds);
187extern int cupsdRemoveFile(const char *filename);
cb7f98ee 188extern int cupsdUnlinkOrRemoveFile(const char *filename);
321d8d57
MS
189
190/* main.c */
191extern int cupsdAddString(cups_array_t **a, const char *s);
192extern void cupsdCheckProcess(void);
193extern void cupsdClearString(char **s);
194extern void cupsdFreeStrings(cups_array_t **a);
195extern void cupsdHoldSignals(void);
196extern char *cupsdMakeUUID(const char *name, int number,
197 char *buffer, size_t bufsize);
198extern void cupsdReleaseSignals(void);
199extern void cupsdSetString(char **s, const char *v);
200extern void cupsdSetStringf(char **s, const char *f, ...)
85dda01c 201 __attribute__ ((__format__ (__printf__, 2, 3)));
321d8d57
MS
202
203/* process.c */
8fe0183a 204extern void *cupsdCreateProfile(int job_id, int allow_networking);
321d8d57
MS
205extern void cupsdDestroyProfile(void *profile);
206extern int cupsdEndProcess(int pid, int force);
07623986 207extern const char *cupsdFinishProcess(int pid, char *name, size_t namelen, int *job_id);
321d8d57
MS
208extern 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);
213
214/* select.c */
215extern int cupsdAddSelect(int fd, cupsd_selfunc_t read_cb,
216 cupsd_selfunc_t write_cb, void *data);
217extern int cupsdDoSelect(long timeout);
f899b121 218#ifdef CUPSD_IS_SELECTING
321d8d57 219extern int cupsdIsSelecting(int fd);
f899b121 220#endif /* CUPSD_IS_SELECTING */
321d8d57
MS
221extern void cupsdRemoveSelect(int fd);
222extern void cupsdStartSelect(void);
223extern void cupsdStopSelect(void);
ef416fc2 224
321d8d57
MS
225/* server.c */
226extern void cupsdStartServer(void);
227extern void cupsdStopServer(void);
ef416fc2 228
58dc1933 229
ef416fc2 230/*
f2d18633 231 * End of "$Id$".
ef416fc2 232 */