]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/cupsd.h
Merge trademark/logo changes from CUPS 1.4svn-r8418.
[thirdparty/cups.git] / scheduler / cupsd.h
CommitLineData
ef416fc2 1/*
b19ccc9e 2 * "$Id: cupsd.h 7928 2008-09-10 22:14:22Z mike $"
ef416fc2 3 *
4 * Main header file for the Common UNIX Printing System (CUPS) scheduler.
5 *
b9faaae1 6 * Copyright 2007-2009 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
21#include <cups/http-private.h>
22#include <cups/string.h>
23#include <stdlib.h>
24#include <limits.h>
25#include <errno.h>
26#include <time.h>
27#include <signal.h>
28#include <fcntl.h>
29#include <math.h>
30#include <sys/types.h>
31#include <sys/time.h>
32#include <sys/stat.h>
33#include <sys/wait.h>
34
35#ifdef WIN32
36# include <direct.h>
37#else
38# include <unistd.h>
39#endif /* WIN32 */
40
41#include <cups/array.h>
42#include <cups/cups.h>
43#include "mime.h"
44#include <cups/http.h>
45#include <cups/ipp.h>
46#include <cups/i18n.h>
47#include <cups/debug.h>
48
49#if defined(HAVE_CDSASSL)
50# include <CoreFoundation/CoreFoundation.h>
51#endif /* HAVE_CDSASSL */
52
53
54/*
55 * Some OS's don't have hstrerror(), most notably Solaris...
56 */
57
58#ifndef HAVE_HSTRERROR
b423cd4c 59# ifdef hstrerror
60# undef hstrerror
61# endif /* hstrerror */
ef416fc2 62# define hstrerror cups_hstrerror
63
64extern const char *cups_hstrerror(int);
65#endif /* !HAVE_HSTRERROR */
66
67
68/*
69 * Common constants.
70 */
71
72#ifndef FALSE
73# define FALSE 0
74# define TRUE (!FALSE)
75#endif /* !FALSE */
76
77
78/*
79 * Implementation limits...
80 */
81
e00b005a 82#define MAX_ENV 100 /* Maximum number of environment strings */
ef416fc2 83#define MAX_USERPASS 33 /* Maximum size of username/password */
84#define MAX_FILTERS 20 /* Maximum number of filters */
85#define MAX_SYSTEM_GROUPS 32 /* Maximum number of system groups */
86
87
88/*
89 * Defaults...
90 */
91
92#define DEFAULT_HISTORY 1 /* Preserve job history? */
93#define DEFAULT_FILES 0 /* Preserve job files? */
94#define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
49d87452 95#define DEFAULT_KEEPALIVE 30 /* Timeout between requests */
ef416fc2 96#define DEFAULT_INTERVAL 30 /* Interval between browse updates */
97#define DEFAULT_CHARSET "utf-8" /* Default charset */
98
99
100/*
101 * Global variable macros...
102 */
103
104#ifdef _MAIN_C_
105# define VAR
106# define VALUE(x) =x
107# define VALUE2(x,y) ={x,y}
108#else
109# define VAR extern
110# define VALUE(x)
111# define VALUE2(x,y)
112#endif /* _MAIN_C */
113
114
115/*
116 * Other stuff for the scheduler...
117 */
118
09ec0018 119#include "sysman.h"
ef416fc2 120#include "statbuf.h"
121#include "cert.h"
122#include "auth.h"
123#include "client.h"
124#include "policy.h"
125#include "printers.h"
126#include "classes.h"
127#include "job.h"
128#include "conf.h"
129#include "banners.h"
130#include "dirsvc.h"
131#include "network.h"
132#include "subscriptions.h"
133
134
135/*
136 * Reload types...
137 */
138
139#define RELOAD_NONE 0 /* No reload needed */
140#define RELOAD_ALL 1 /* Reload everything */
141#define RELOAD_CUPSD 2 /* Reload only cupsd.conf */
142
143
f7deaa1a 144/*
145 * Select callback function type...
146 */
147
148typedef void (*cupsd_selfunc_t)(void *data);
149
150
ef416fc2 151/*
152 * Globals...
153 */
154
1340db2d 155VAR int TestConfigFile VALUE(0),
2e4ff8af 156 /* Test the cupsd.conf file? */
1340db2d
MS
157 UseProfiles VALUE(1);
158 /* Use security profiles for child procs? */
ac884b6a
MS
159VAR int MaxFDs VALUE(0);
160 /* Maximum number of files */
ef416fc2 161
162VAR time_t ReloadTime VALUE(0);
163 /* Time of reload request... */
164VAR int NeedReload VALUE(RELOAD_ALL);
165 /* Need to load configuration? */
a4924f6c
MS
166VAR void *DefaultProfile VALUE(0);
167 /* Default security profile */
c24d2134
MS
168
169#ifdef HAVE_GSSAPI
0af14961
MS
170VAR int KerberosInitialized VALUE(0);
171 /* Has Kerberos been initialized? */
ac884b6a
MS
172VAR krb5_context KerberosContext VALUE(NULL);
173 /* Kerberos context for credentials */
c24d2134
MS
174#endif /* HAVE_GSSAPI */
175
4400e98d 176#ifdef HAVE_LAUNCH_H
177VAR int Launchd VALUE(0);
178 /* Running from launchd */
179#endif /* HAVE_LAUNCH_H */
ef416fc2 180
7594b224 181#if defined(__APPLE__) && defined(HAVE_DLFCN_H)
182typedef int (*PSQUpdateQuotaProcPtr)(const char *printer, const char *info,
183 const char *user, int nPages, int options);
184VAR PSQUpdateQuotaProcPtr PSQUpdateQuotaProc
185 VALUE(0);
186 /* Apple PrintService quota function */
187#endif /* __APPLE__ && HAVE_DLFCN_H */
188
189
190
ef416fc2 191
192/*
193 * Prototypes...
194 */
195
d7871c8c 196extern void cupsdCheckProcess(void);
ef416fc2 197extern void cupsdClearString(char **s);
198extern void cupsdHoldSignals(void);
ef416fc2 199extern void cupsdReleaseSignals(void);
200extern void cupsdSetString(char **s, const char *v);
201extern void cupsdSetStringf(char **s, const char *f, ...)
202#ifdef __GNUC__
203__attribute__ ((__format__ (__printf__, 2, 3)))
204#endif /* __GNUC__ */
205;
206extern void cupsdStartServer(void);
207extern void cupsdStopServer(void);
208extern void cupsdClosePipe(int *fds);
209extern int cupsdOpenPipe(int *fds);
210
ef416fc2 211extern void cupsdInitEnv(void);
212extern int cupsdLoadEnv(char *envp[], int envmax);
213extern void cupsdSetEnv(const char *name, const char *value);
214extern void cupsdSetEnvf(const char *name, const char *value, ...)
215#ifdef __GNUC__
216__attribute__ ((__format__ (__printf__, 2, 3)))
217#endif /* __GNUC__ */
218;
219
a4924f6c
MS
220extern void *cupsdCreateProfile(int job_id);
221extern void cupsdDestroyProfile(void *profile);
ef416fc2 222extern int cupsdEndProcess(int pid, int force);
b9faaae1
MS
223extern const char *cupsdFinishProcess(int pid, char *name, int namelen,
224 int *job_id);
ef416fc2 225extern int cupsdStartProcess(const char *command, char *argv[],
226 char *envp[], int infd, int outfd,
f7deaa1a 227 int errfd, int backfd, int sidefd,
b9faaae1
MS
228 int root, void *profile, int job_id,
229 int *pid);
f7deaa1a 230
231extern int cupsdAddSelect(int fd, cupsd_selfunc_t read_cb,
232 cupsd_selfunc_t write_cb, void *data);
233extern int cupsdDoSelect(long timeout);
f899b121 234#ifdef CUPSD_IS_SELECTING
f7deaa1a 235extern int cupsdIsSelecting(int fd);
f899b121 236#endif /* CUPSD_IS_SELECTING */
f7deaa1a 237extern void cupsdRemoveSelect(int fd);
238extern void cupsdStartSelect(void);
239extern void cupsdStopSelect(void);
ef416fc2 240
cc0d019f 241extern int cupsdRemoveFile(const char *filename);
ef416fc2 242
58dc1933 243
ef416fc2 244/*
b19ccc9e 245 * End of "$Id: cupsd.h 7928 2008-09-10 22:14:22Z mike $".
ef416fc2 246 */