]> git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/client.h
Load cups into easysw/current.
[thirdparty/cups.git] / scheduler / client.h
1 /*
2 * "$Id: client.h 6205 2007-01-22 22:04:43Z mike $"
3 *
4 * Client definitions for the Common UNIX Printing System (CUPS) scheduler.
5 *
6 * Copyright 1997-2006 by Easy Software Products, all rights reserved.
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.txt" 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 * HTTP client structure...
27 */
28
29 struct cupsd_client_s
30 {
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 */
40 uri[HTTP_MAX_URI],
41 /* Localized URL/URI for GET/PUT */
42 *filename, /* Filename of output file */
43 *command, /* Command to run */
44 *options, /* Options for command */
45 *query_string; /* QUERY_STRING environment variable */
46 int file; /* Input/output file */
47 int file_ready; /* Input ready on file/pipe? */
48 int pipe_pid; /* Pipe process ID (or 0 if not a pipe) */
49 int sent_header, /* Non-zero if sent HTTP header */
50 got_fields, /* Non-zero if all fields seen */
51 field_col; /* Column within line */
52 cups_lang_t *language; /* Language to use */
53 #ifdef HAVE_SSL
54 int auto_ssl; /* Automatic test for SSL/TLS */
55 #endif /* HAVE_SSL */
56 http_addr_t clientaddr; /* Client address */
57 char servername[256];/* Server name for connection */
58 int serverport; /* Server port for connection */
59 };
60
61 #define HTTP(con) &((con)->http)
62
63
64 /*
65 * HTTP listener structure...
66 */
67
68 typedef struct
69 {
70 int fd; /* File descriptor for this server */
71 http_addr_t address; /* Bind address of socket */
72 http_encryption_t encryption; /* To encrypt or not to encrypt... */
73 } cupsd_listener_t;
74
75
76 /*
77 * Globals...
78 */
79
80 VAR int ListenBackLog VALUE(SOMAXCONN),
81 /* Max backlog of pending connections */
82 LocalPort VALUE(631);
83 /* Local port to use */
84 VAR http_encryption_t LocalEncryption VALUE(HTTP_ENCRYPT_IF_REQUESTED);
85 /* Local port encryption to use */
86 VAR cups_array_t *Listeners VALUE(NULL);
87 /* Listening sockets */
88 VAR cups_array_t *Clients VALUE(NULL);
89 /* HTTP clients */
90 VAR http_addrlist_t *ServerAddrs VALUE(NULL);
91 /* Server address(es) */
92 VAR char *ServerHeader VALUE(NULL);
93 /* Server header in requests */
94 VAR int CGIPipes[2] VALUE2(-1,-1);
95 /* Pipes for CGI error/debug output */
96 VAR cupsd_statbuf_t *CGIStatusBuffer VALUE(NULL);
97 /* Status buffer for pipes */
98
99
100 /*
101 * Prototypes...
102 */
103
104 extern void cupsdAcceptClient(cupsd_listener_t *lis);
105 extern void cupsdCloseAllClients(void);
106 extern int cupsdCloseClient(cupsd_client_t *con);
107 extern void cupsdDeleteAllListeners(void);
108 extern int cupsdFlushHeader(cupsd_client_t *con);
109 extern void cupsdPauseListening(void);
110 extern int cupsdProcessIPPRequest(cupsd_client_t *con);
111 extern int cupsdReadClient(cupsd_client_t *con);
112 extern void cupsdResumeListening(void);
113 extern int cupsdSendCommand(cupsd_client_t *con, char *command,
114 char *options, int root);
115 extern int cupsdSendError(cupsd_client_t *con, http_status_t code);
116 extern int cupsdSendHeader(cupsd_client_t *con, http_status_t code,
117 char *type);
118 extern void cupsdShutdownClient(cupsd_client_t *con);
119 extern void cupsdStartListening(void);
120 extern void cupsdStopListening(void);
121 extern void cupsdUpdateCGI(void);
122 extern int cupsdWriteClient(cupsd_client_t *con);
123
124
125 /*
126 * End of "$Id: client.h 6205 2007-01-22 22:04:43Z mike $".
127 */