]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/cupsd.h
Merge changes from CUPS 1.5svn-r9675.
[thirdparty/cups.git] / scheduler / cupsd.h
CommitLineData
ef416fc2 1/*
b19ccc9e 2 * "$Id: cupsd.h 7928 2008-09-10 22:14:22Z mike $"
ef416fc2 3 *
71e16022 4 * Main header file for the CUPS scheduler.
ef416fc2 5 *
0268488e 6 * Copyright 2007-2011 by Apple Inc.
f899b121 7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 8 *
9 * These coded instructions, statements, and computer programs are the
bc44d920 10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
ef416fc2 12 * "LICENSE" which should have been included with this file. If this
bc44d920 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
MS
21#include <cups/cups-private.h>
22
ef416fc2 23#include <limits.h>
ef416fc2 24#include <time.h>
25#include <signal.h>
26#include <fcntl.h>
27#include <math.h>
28#include <sys/types.h>
29#include <sys/time.h>
30#include <sys/stat.h>
31#include <sys/wait.h>
32
33#ifdef WIN32
34# include <direct.h>
35#else
36# include <unistd.h>
37#endif /* WIN32 */
38
ef416fc2 39#include "mime.h"
ef416fc2 40
41#if defined(HAVE_CDSASSL)
42# include <CoreFoundation/CoreFoundation.h>
43#endif /* HAVE_CDSASSL */
44
45
46/*
47 * Some OS's don't have hstrerror(), most notably Solaris...
48 */
49
50#ifndef HAVE_HSTRERROR
b423cd4c 51# ifdef hstrerror
52# undef hstrerror
53# endif /* hstrerror */
ef416fc2 54# define hstrerror cups_hstrerror
55
56extern const char *cups_hstrerror(int);
57#endif /* !HAVE_HSTRERROR */
58
59
60/*
61 * Common constants.
62 */
63
64#ifndef FALSE
65# define FALSE 0
66# define TRUE (!FALSE)
67#endif /* !FALSE */
68
69
70/*
71 * Implementation limits...
72 */
73
e00b005a 74#define MAX_ENV 100 /* Maximum number of environment strings */
ef416fc2 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 */
78
79
80/*
81 * Defaults...
82 */
83
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 */
49d87452 87#define DEFAULT_KEEPALIVE 30 /* Timeout between requests */
ef416fc2 88#define DEFAULT_INTERVAL 30 /* Interval between browse updates */
89#define DEFAULT_CHARSET "utf-8" /* Default charset */
90
91
92/*
93 * Global variable macros...
94 */
95
96#ifdef _MAIN_C_
97# define VAR
98# define VALUE(x) =x
99# define VALUE2(x,y) ={x,y}
100#else
101# define VAR extern
102# define VALUE(x)
103# define VALUE2(x,y)
104#endif /* _MAIN_C */
105
106
107/*
108 * Other stuff for the scheduler...
109 */
110
09ec0018 111#include "sysman.h"
ef416fc2 112#include "statbuf.h"
113#include "cert.h"
114#include "auth.h"
115#include "client.h"
116#include "policy.h"
117#include "printers.h"
118#include "classes.h"
119#include "job.h"
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
1340db2d 147VAR int TestConfigFile VALUE(0),
2e4ff8af 148 /* Test the cupsd.conf file? */
1340db2d
MS
149 UseProfiles VALUE(1);
150 /* Use security profiles for child procs? */
ac884b6a
MS
151VAR int MaxFDs VALUE(0);
152 /* Maximum number of files */
ef416fc2 153
154VAR time_t ReloadTime VALUE(0);
155 /* Time of reload request... */
7cf5915e 156VAR int NeedReload VALUE(RELOAD_ALL),
ef416fc2 157 /* Need to load configuration? */
7cf5915e
MS
158 DoingShutdown VALUE(0);
159 /* Shutting down the scheduler? */
a4924f6c
MS
160VAR void *DefaultProfile VALUE(0);
161 /* Default security profile */
c24d2134
MS
162
163#ifdef HAVE_GSSAPI
0af14961
MS
164VAR int KerberosInitialized VALUE(0);
165 /* Has Kerberos been initialized? */
ac884b6a
MS
166VAR krb5_context KerberosContext VALUE(NULL);
167 /* Kerberos context for credentials */
c24d2134
MS
168#endif /* HAVE_GSSAPI */
169
4400e98d 170#ifdef HAVE_LAUNCH_H
171VAR int Launchd VALUE(0);
172 /* Running from launchd */
173#endif /* HAVE_LAUNCH_H */
ef416fc2 174
175
176/*
177 * Prototypes...
178 */
179
10d09e33 180extern int cupsdAddString(cups_array_t **a, const char *s);
d7871c8c 181extern void cupsdCheckProcess(void);
ef416fc2 182extern void cupsdClearString(char **s);
10d09e33 183extern void cupsdFreeStrings(cups_array_t **a);
ef416fc2 184extern void cupsdHoldSignals(void);
82f97232
MS
185extern char *cupsdMakeUUID(const char *name, int number,
186 char *buffer, size_t bufsize);
ef416fc2 187extern void cupsdReleaseSignals(void);
188extern void cupsdSetString(char **s, const char *v);
189extern void cupsdSetStringf(char **s, const char *f, ...)
190#ifdef __GNUC__
191__attribute__ ((__format__ (__printf__, 2, 3)))
192#endif /* __GNUC__ */
193;
194extern void cupsdStartServer(void);
195extern void cupsdStopServer(void);
196extern void cupsdClosePipe(int *fds);
197extern int cupsdOpenPipe(int *fds);
198
ef416fc2 199extern void cupsdInitEnv(void);
200extern int cupsdLoadEnv(char *envp[], int envmax);
201extern void cupsdSetEnv(const char *name, const char *value);
202extern void cupsdSetEnvf(const char *name, const char *value, ...)
203#ifdef __GNUC__
204__attribute__ ((__format__ (__printf__, 2, 3)))
205#endif /* __GNUC__ */
206;
0268488e 207extern void cupsdUpdateEnv(void);
ef416fc2 208
a4924f6c
MS
209extern void *cupsdCreateProfile(int job_id);
210extern void cupsdDestroyProfile(void *profile);
ef416fc2 211extern int cupsdEndProcess(int pid, int force);
b9faaae1
MS
212extern const char *cupsdFinishProcess(int pid, char *name, int namelen,
213 int *job_id);
ef416fc2 214extern int cupsdStartProcess(const char *command, char *argv[],
215 char *envp[], int infd, int outfd,
f7deaa1a 216 int errfd, int backfd, int sidefd,
38e73f87 217 int root, void *profile, cupsd_job_t *job,
b9faaae1 218 int *pid);
f7deaa1a 219
220extern int cupsdAddSelect(int fd, cupsd_selfunc_t read_cb,
221 cupsd_selfunc_t write_cb, void *data);
222extern int cupsdDoSelect(long timeout);
f899b121 223#ifdef CUPSD_IS_SELECTING
f7deaa1a 224extern int cupsdIsSelecting(int fd);
f899b121 225#endif /* CUPSD_IS_SELECTING */
f7deaa1a 226extern void cupsdRemoveSelect(int fd);
227extern void cupsdStartSelect(void);
228extern void cupsdStopSelect(void);
ef416fc2 229
cc0d019f 230extern int cupsdRemoveFile(const char *filename);
ef416fc2 231
58dc1933 232
ef416fc2 233/*
b19ccc9e 234 * End of "$Id: cupsd.h 7928 2008-09-10 22:14:22Z mike $".
ef416fc2 235 */