#include <cups/http-private.h>
#include <cups/string.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <time.h>
#include <signal.h>
#include <fcntl.h>
#include <math.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
#ifdef HAVE_LIBGEN_H
# include <libgen.h>
#endif
#ifdef WIN32
# include <direct.h>
#else
# include <unistd.h>
#endif
#include <cups/cups.h>
#include "mime.h"
#include <cups/http.h>
#include <cups/ipp.h>
#include <cups/language.h>
#include <cups/debug.h>
#if defined(HAVE_CDSASSL)
# include <Security/Security.h>
# include <CoreFoundation/CoreFoundation.h>
#endif
#ifndef HAVE_HSTRERROR
# define hstrerror cups_hstrerror
extern const char *cups_hstrerror(int);
#endif
#ifndef FALSE
# define FALSE 0
# define TRUE (!FALSE)
#endif
#define MAX_USERPASS 33
#define MAX_FILTERS 20
#define MAX_SYSTEM_GROUPS 32
#define DEFAULT_HISTORY 1
#define DEFAULT_FILES 0
#define DEFAULT_TIMEOUT 300
#define DEFAULT_KEEPALIVE 60
#define DEFAULT_INTERVAL 30
#define DEFAULT_LANGUAGE setlocale(LC_ALL,"")
#define DEFAULT_CHARSET "utf-8"
#ifdef _MAIN_C_
# define VAR
# define VALUE(x) =x
# define VALUE2(x,y) ={x,y}
#else
# define VAR extern
# define VALUE(x)
# define VALUE2(x,y)
#endif
#include "cert.h"
#include "client.h"
#include "auth.h"
#include "printers.h"
#include "classes.h"
#include "job.h"
#include "conf.h"
#include "banners.h"
#include "dirsvc.h"
#include "network.h"
#if HAVE_DIRENT_H
# include <dirent.h>
typedef struct dirent DIRENT;
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# endif
typedef struct direct DIRENT;
# define NAMLEN(dirent) (dirent)->d_namlen
#endif
#define RELOAD_NONE 0
#define RELOAD_ALL 1
#define RELOAD_CUPSD 2
VAR int MaxFDs,
SetSize;
VAR fd_set *InputFds,
*InputSet,
*OutputFds,
*OutputSet;
VAR time_t ReloadTime VALUE(0);
VAR int NeedReload VALUE(RELOAD_ALL),
SignalCount VALUE(0);
VAR char *TZ VALUE(NULL);
VAR ipp_t *Devices VALUE(NULL),
*PPDs VALUE(NULL);
#ifdef __APPLE__
VAR int BackendsExeced VALUE(0);
VAR int Sleeping VALUE(0);
VAR int SysEventPipes[2] VALUE2(-1,-1);
#endif
extern void CatchChildSignals(void);
extern void ClearString(char **s);
extern void HoldSignals(void);
extern void IgnoreChildSignals(void);
extern void LoadDevices(const char *d, int exec_backends);
extern void LoadPPDs(const char *d);
extern void ReleaseSignals(void);
extern void SetString(char **s, const char *v);
extern void SetStringf(char **s, const char *f, ...);
extern void StartServer(void);
extern void StopServer(void);
extern void cupsdClosePipe(int *fds);
extern int cupsdOpenPipe(int *fds);
#ifdef __APPLE__
extern void StartSysEventMonitor(void);
extern void StopSysEventMonitor(void);
extern void UpdateSysEventMonitor(void);
#endif