]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/cupsd.h
Mass change of copyright to CUPS' new owner, Apple Inc.
[thirdparty/cups.git] / scheduler / cupsd.h
CommitLineData
43e2fc22 1/*
c9d3f842 2 * "$Id$"
43e2fc22 3 *
fd8b1cf8 4 * Main header file for the Common UNIX Printing System (CUPS) scheduler.
43e2fc22 5 *
4e8d321f 6 * Copyright 2007 by Apple Inc.
bfd95ed7 7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
43e2fc22 8 *
9 * These coded instructions, statements, and computer programs are the
4e8d321f 10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
43e2fc22 12 * "LICENSE" which should have been included with this file. If this
4e8d321f 13 * file is missing or damaged, see the license at "http://www.cups.org/".
43e2fc22 14 */
15
f3bc1068 16
43e2fc22 17/*
18 * Include necessary headers.
19 */
20
0a0621ae 21#include <cups/http-private.h>
22#include <cups/string.h>
fd8b1cf8 23#include <stdlib.h>
fd8b1cf8 24#include <limits.h>
fd8b1cf8 25#include <errno.h>
26#include <time.h>
27#include <signal.h>
fd8b1cf8 28#include <fcntl.h>
7ed5d5f2 29#include <math.h>
fd8b1cf8 30#include <sys/types.h>
31#include <sys/time.h>
32#include <sys/stat.h>
33#include <sys/wait.h>
34
c3026ddc 35#ifdef WIN32
a74b005d 36# include <direct.h>
fd8b1cf8 37#else
a74b005d 38# include <unistd.h>
c3026ddc 39#endif /* WIN32 */
a74b005d 40
90231631 41#include <cups/array.h>
a74b005d 42#include <cups/cups.h>
f41ba047 43#include "mime.h"
707152b4 44#include <cups/http.h>
bcf61448 45#include <cups/ipp.h>
a501ad17 46#include <cups/i18n.h>
6abc7437 47#include <cups/debug.h>
fd8b1cf8 48
dcfcaeac 49#if defined(HAVE_CDSASSL)
50# include <CoreFoundation/CoreFoundation.h>
51#endif /* HAVE_CDSASSL */
52
fd8b1cf8 53
dfb69f7a 54/*
55 * Some OS's don't have hstrerror(), most notably Solaris...
56 */
57
58#ifndef HAVE_HSTRERROR
95c68078 59# ifdef hstrerror
60# undef hstrerror
61# endif /* hstrerror */
dfb69f7a 62# define hstrerror cups_hstrerror
63
64extern const char *cups_hstrerror(int);
65#endif /* !HAVE_HSTRERROR */
66
67
fd8b1cf8 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
6fd85a6b 82#define MAX_ENV 100 /* Maximum number of environment strings */
83e740a5 83#define MAX_USERPASS 33 /* Maximum size of username/password */
6abc7437 84#define MAX_FILTERS 20 /* Maximum number of filters */
753453e4 85#define MAX_SYSTEM_GROUPS 32 /* Maximum number of system groups */
fd8b1cf8 86
bd84e0d1 87
fd8b1cf8 88/*
89 * Defaults...
90 */
91
bd84e0d1 92#define DEFAULT_HISTORY 1 /* Preserve job history? */
93#define DEFAULT_FILES 0 /* Preserve job files? */
fd8b1cf8 94#define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
bd176c9c 95#define DEFAULT_KEEPALIVE 60 /* Timeout between requests */
fd8b1cf8 96#define DEFAULT_INTERVAL 30 /* Interval between browse updates */
753453e4 97#define DEFAULT_CHARSET "utf-8" /* Default charset */
472ce1dc 98
17b95e13 99
fd8b1cf8 100/*
101 * Global variable macros...
102 */
103
104#ifdef _MAIN_C_
105# define VAR
106# define VALUE(x) =x
0a968cfb 107# define VALUE2(x,y) ={x,y}
fd8b1cf8 108#else
109# define VAR extern
110# define VALUE(x)
0a968cfb 111# define VALUE2(x,y)
fd8b1cf8 112#endif /* _MAIN_C */
113
114
115/*
116 * Other stuff for the scheduler...
117 */
118
6de33945 119#include "sysman.h"
294f4cee 120#include "statbuf.h"
d2122fde 121#include "cert.h"
fd8b1cf8 122#include "auth.h"
99baf768 123#include "client.h"
f27bd5ab 124#include "policy.h"
fd8b1cf8 125#include "printers.h"
a9de544f 126#include "classes.h"
127#include "job.h"
c7fa9d06 128#include "conf.h"
d21a7597 129#include "banners.h"
753453e4 130#include "dirsvc.h"
20264b99 131#include "network.h"
bf6409d1 132#include "subscriptions.h"
d21a7597 133
134
53510eae 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
9d4830a3 144/*
145 * Select callback function type...
146 */
147
148typedef void (*cupsd_selfunc_t)(void *data);
149
150
fd8b1cf8 151/*
152 * Globals...
153 */
154
9d4830a3 155VAR int MaxFDs; /* Maximum number of files */
fd8b1cf8 156
a782f61f 157VAR time_t ReloadTime VALUE(0);
158 /* Time of reload request... */
fc9894d1 159VAR int NeedReload VALUE(RELOAD_ALL);
a74b005d 160 /* Need to load configuration? */
dfeef8b5 161#ifdef HAVE_LAUNCH_H
162VAR int Launchd VALUE(0);
163 /* Running from launchd */
164#endif /* HAVE_LAUNCH_H */
daf8f5f0 165
bb3ff448 166#if defined(__APPLE__) && defined(HAVE_DLFCN_H)
167typedef int (*PSQUpdateQuotaProcPtr)(const char *printer, const char *info,
168 const char *user, int nPages, int options);
169VAR PSQUpdateQuotaProcPtr PSQUpdateQuotaProc
170 VALUE(0);
171 /* Apple PrintService quota function */
172#endif /* __APPLE__ && HAVE_DLFCN_H */
173
174
175
fd8b1cf8 176
177/*
178 * Prototypes...
179 */
43e2fc22 180
589eb420 181extern void cupsdClearString(char **s);
182extern void cupsdHoldSignals(void);
589eb420 183extern void cupsdReleaseSignals(void);
184extern void cupsdSetString(char **s, const char *v);
185extern void cupsdSetStringf(char **s, const char *f, ...)
291355eb 186#ifdef __GNUC__
187__attribute__ ((__format__ (__printf__, 2, 3)))
188#endif /* __GNUC__ */
189;
589eb420 190extern void cupsdStartServer(void);
191extern void cupsdStopServer(void);
8650fcf2 192extern void cupsdClosePipe(int *fds);
193extern int cupsdOpenPipe(int *fds);
89db771d 194
291355eb 195extern void cupsdInitEnv(void);
196extern int cupsdLoadEnv(char *envp[], int envmax);
197extern void cupsdSetEnv(const char *name, const char *value);
198extern void cupsdSetEnvf(const char *name, const char *value, ...)
199#ifdef __GNUC__
200__attribute__ ((__format__ (__printf__, 2, 3)))
201#endif /* __GNUC__ */
202;
203
204extern int cupsdEndProcess(int pid, int force);
960e5ba0 205extern const char *cupsdFinishProcess(int pid, char *name, int namelen);
a665f6fc 206extern int cupsdStartProcess(const char *command, char *argv[],
207 char *envp[], int infd, int outfd,
761a542e 208 int errfd, int backfd, int sidefd,
209 int root, int *pid);
a665f6fc 210
9d4830a3 211extern int cupsdAddSelect(int fd, cupsd_selfunc_t read_cb,
212 cupsd_selfunc_t write_cb, void *data);
213extern int cupsdDoSelect(long timeout);
bfd95ed7 214#ifdef CUPSD_IS_SELECTING
9d4830a3 215extern int cupsdIsSelecting(int fd);
bfd95ed7 216#endif /* CUPSD_IS_SELECTING */
9d4830a3 217extern void cupsdRemoveSelect(int fd);
218extern void cupsdStartSelect(void);
219extern void cupsdStopSelect(void);
220
43e2fc22 221
222/*
c9d3f842 223 * End of "$Id$".
43e2fc22 224 */