]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/cupsd.h
Load cups into easysw/current.
[thirdparty/cups.git] / scheduler / cupsd.h
CommitLineData
ef416fc2 1/*
f899b121 2 * "$Id: cupsd.h 6376 2007-03-21 06:39:10Z mike $"
ef416fc2 3 *
4 * Main header file for the Common UNIX Printing System (CUPS) scheduler.
5 *
f899b121 6 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 7 *
8 * These coded instructions, statements, and computer programs are the
9 * property of Easy Software Products and are protected by Federal
10 * copyright law. Distribution and use rights are outlined in the file
11 * "LICENSE" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
13 * at:
14 *
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
19 *
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
23 */
24
25
26/*
27 * Include necessary headers.
28 */
29
30#include <cups/http-private.h>
31#include <cups/string.h>
32#include <stdlib.h>
33#include <limits.h>
34#include <errno.h>
35#include <time.h>
36#include <signal.h>
37#include <fcntl.h>
38#include <math.h>
39#include <sys/types.h>
40#include <sys/time.h>
41#include <sys/stat.h>
42#include <sys/wait.h>
43
44#ifdef WIN32
45# include <direct.h>
46#else
47# include <unistd.h>
48#endif /* WIN32 */
49
50#include <cups/array.h>
51#include <cups/cups.h>
52#include "mime.h"
53#include <cups/http.h>
54#include <cups/ipp.h>
55#include <cups/i18n.h>
56#include <cups/debug.h>
57
58#if defined(HAVE_CDSASSL)
59# include <CoreFoundation/CoreFoundation.h>
60#endif /* HAVE_CDSASSL */
61
62
63/*
64 * Some OS's don't have hstrerror(), most notably Solaris...
65 */
66
67#ifndef HAVE_HSTRERROR
b423cd4c 68# ifdef hstrerror
69# undef hstrerror
70# endif /* hstrerror */
ef416fc2 71# define hstrerror cups_hstrerror
72
73extern const char *cups_hstrerror(int);
74#endif /* !HAVE_HSTRERROR */
75
76
77/*
78 * Common constants.
79 */
80
81#ifndef FALSE
82# define FALSE 0
83# define TRUE (!FALSE)
84#endif /* !FALSE */
85
86
87/*
88 * Implementation limits...
89 */
90
e00b005a 91#define MAX_ENV 100 /* Maximum number of environment strings */
ef416fc2 92#define MAX_USERPASS 33 /* Maximum size of username/password */
93#define MAX_FILTERS 20 /* Maximum number of filters */
94#define MAX_SYSTEM_GROUPS 32 /* Maximum number of system groups */
95
96
97/*
98 * Defaults...
99 */
100
101#define DEFAULT_HISTORY 1 /* Preserve job history? */
102#define DEFAULT_FILES 0 /* Preserve job files? */
103#define DEFAULT_TIMEOUT 300 /* Timeout during requests/updates */
104#define DEFAULT_KEEPALIVE 60 /* Timeout between requests */
105#define DEFAULT_INTERVAL 30 /* Interval between browse updates */
106#define DEFAULT_CHARSET "utf-8" /* Default charset */
107
108
109/*
110 * Global variable macros...
111 */
112
113#ifdef _MAIN_C_
114# define VAR
115# define VALUE(x) =x
116# define VALUE2(x,y) ={x,y}
117#else
118# define VAR extern
119# define VALUE(x)
120# define VALUE2(x,y)
121#endif /* _MAIN_C */
122
123
124/*
125 * Other stuff for the scheduler...
126 */
127
09ec0018 128#include "sysman.h"
ef416fc2 129#include "statbuf.h"
130#include "cert.h"
131#include "auth.h"
132#include "client.h"
133#include "policy.h"
134#include "printers.h"
135#include "classes.h"
136#include "job.h"
137#include "conf.h"
138#include "banners.h"
139#include "dirsvc.h"
140#include "network.h"
141#include "subscriptions.h"
142
143
144/*
145 * Reload types...
146 */
147
148#define RELOAD_NONE 0 /* No reload needed */
149#define RELOAD_ALL 1 /* Reload everything */
150#define RELOAD_CUPSD 2 /* Reload only cupsd.conf */
151
152
f7deaa1a 153/*
154 * Select callback function type...
155 */
156
157typedef void (*cupsd_selfunc_t)(void *data);
158
159
ef416fc2 160/*
161 * Globals...
162 */
163
f7deaa1a 164VAR int MaxFDs; /* Maximum number of files */
ef416fc2 165
166VAR time_t ReloadTime VALUE(0);
167 /* Time of reload request... */
168VAR int NeedReload VALUE(RELOAD_ALL);
169 /* Need to load configuration? */
4400e98d 170#ifdef HAVE_LAUNCH_H
171VAR int Launchd VALUE(0);
172 /* Running from launchd */
173#endif /* HAVE_LAUNCH_H */
ef416fc2 174
7594b224 175#if defined(__APPLE__) && defined(HAVE_DLFCN_H)
176typedef int (*PSQUpdateQuotaProcPtr)(const char *printer, const char *info,
177 const char *user, int nPages, int options);
178VAR PSQUpdateQuotaProcPtr PSQUpdateQuotaProc
179 VALUE(0);
180 /* Apple PrintService quota function */
181#endif /* __APPLE__ && HAVE_DLFCN_H */
182
183
184
ef416fc2 185
186/*
187 * Prototypes...
188 */
189
ef416fc2 190extern void cupsdClearString(char **s);
191extern void cupsdHoldSignals(void);
ef416fc2 192extern void cupsdReleaseSignals(void);
193extern void cupsdSetString(char **s, const char *v);
194extern void cupsdSetStringf(char **s, const char *f, ...)
195#ifdef __GNUC__
196__attribute__ ((__format__ (__printf__, 2, 3)))
197#endif /* __GNUC__ */
198;
199extern void cupsdStartServer(void);
200extern void cupsdStopServer(void);
201extern void cupsdClosePipe(int *fds);
202extern int cupsdOpenPipe(int *fds);
203
ef416fc2 204extern void cupsdInitEnv(void);
205extern int cupsdLoadEnv(char *envp[], int envmax);
206extern void cupsdSetEnv(const char *name, const char *value);
207extern void cupsdSetEnvf(const char *name, const char *value, ...)
208#ifdef __GNUC__
209__attribute__ ((__format__ (__printf__, 2, 3)))
210#endif /* __GNUC__ */
211;
212
213extern int cupsdEndProcess(int pid, int force);
e00b005a 214extern const char *cupsdFinishProcess(int pid, char *name, int namelen);
ef416fc2 215extern int cupsdStartProcess(const char *command, char *argv[],
216 char *envp[], int infd, int outfd,
f7deaa1a 217 int errfd, int backfd, int sidefd,
218 int root, int *pid);
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
230
231/*
f899b121 232 * End of "$Id: cupsd.h 6376 2007-03-21 06:39:10Z mike $".
ef416fc2 233 */