2 * "$Id: client.h 4757 2005-10-08 10:10:46Z mike $"
4 * Client definitions for the Common UNIX Printing System (CUPS) scheduler.
6 * Copyright 1997-2005 by Easy Software Products, all rights reserved.
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.txt" which should have been included with this file. If this
12 * file is missing or damaged please contact Easy Software Products
15 * Attn: CUPS Licensing Information
16 * Easy Software Products
17 * 44141 Airport View Drive, Suite 204
18 * Hollywood, Maryland 20636 USA
20 * Voice: (301) 373-9600
21 * EMail: cups-info@cups.org
22 * WWW: http://www.cups.org
26 * HTTP client structure...
31 http_t http
; /* HTTP client connection */
32 ipp_t
*request
, /* IPP request information */
33 *response
; /* IPP response information */
34 cupsd_location_t
*best
; /* Best match for AAA */
35 time_t start
; /* Request start time */
36 http_state_t operation
; /* Request operation */
37 off_t bytes
; /* Bytes transferred for this request */
38 char username
[33], /* Username from Authorization: line */
39 password
[33], /* Password from Authorization: line */
41 /* Localized URL/URI for GET/PUT */
42 *filename
, /* Filename of output file */
43 *command
, /* Command to run */
44 *options
; /* Options for command */
45 int file
; /* Input/output file */
46 int file_ready
; /* Input ready on file/pipe? */
47 int pipe_pid
; /* Pipe process ID (or 0 if not a pipe) */
48 int sent_header
, /* Non-zero if sent HTTP header */
49 got_fields
, /* Non-zero if all fields seen */
50 field_col
; /* Column within line */
51 cups_lang_t
*language
; /* Language to use */
53 int auto_ssl
; /* Automatic test for SSL/TLS */
55 http_addr_t clientaddr
; /* Client address */
56 char servername
[256];/* Server name for connection */
57 int serverport
; /* Server port for connection */
60 #define HTTP(con) &((con)->http)
64 * HTTP listener structure...
69 int fd
; /* File descriptor for this server */
70 http_addr_t address
; /* Bind address of socket */
71 http_encryption_t encryption
; /* To encrypt or not to encrypt... */
79 VAR
int ListenBackLog
VALUE(SOMAXCONN
),
80 /* Max backlog of pending connections */
82 /* Local port to use */
83 VAR http_encryption_t LocalEncryption
VALUE(HTTP_ENCRYPT_IF_REQUESTED
);
84 /* Local port encryption to use */
85 VAR
int NumListeners
VALUE(0);
86 /* Number of listening sockets */
87 VAR cupsd_listener_t
*Listeners
VALUE(NULL
);
88 /* Listening sockets */
89 VAR
int NumClients
VALUE(0);
90 /* Number of HTTP clients */
91 VAR cupsd_client_t
*Clients
VALUE(NULL
);
93 VAR http_addrlist_t
*ServerAddrs
VALUE(NULL
);
94 /* Server address(es) */
95 VAR
char *ServerHeader
VALUE(NULL
);
96 /* Server header in requests */
97 VAR
int CGIPipes
[2] VALUE2(-1,-1);
98 /* Pipes for CGI error/debug output */
99 VAR cupsd_statbuf_t
*CGIStatusBuffer
VALUE(NULL
);
100 /* Status buffer for pipes */
107 extern void cupsdAcceptClient(cupsd_listener_t
*lis
);
108 extern void cupsdCloseAllClients(void);
109 extern int cupsdCloseClient(cupsd_client_t
*con
);
110 extern int cupsdEncryptClient(cupsd_client_t
*con
);
111 extern int cupsdIsCGI(cupsd_client_t
*con
, const char *filename
,
112 struct stat
*filestats
, mime_type_t
*type
);
113 extern void cupsdPauseListening(void);
114 extern int cupsdProcessIPPRequest(cupsd_client_t
*con
);
115 extern int cupsdReadClient(cupsd_client_t
*con
);
116 extern void cupsdResumeListening(void);
117 extern int cupsdSendCommand(cupsd_client_t
*con
, char *command
,
118 char *options
, int root
);
119 extern int cupsdSendError(cupsd_client_t
*con
, http_status_t code
);
120 extern int cupsdSendFile(cupsd_client_t
*con
, http_status_t code
,
121 char *filename
, char *type
,
122 struct stat
*filestats
);
123 extern int cupsdSendHeader(cupsd_client_t
*con
, http_status_t code
,
125 extern void cupsdShutdownClient(cupsd_client_t
*con
);
126 extern void cupsdStartListening(void);
127 extern void cupsdStopListening(void);
128 extern void cupsdUpdateCGI(void);
129 extern int cupsdWriteClient(cupsd_client_t
*con
);
133 * End of "$Id: client.h 4757 2005-10-08 10:10:46Z mike $".