]> git.ipfire.org Git - thirdparty/cups.git/blob - scheduler/client.h
Merge changes from CUPS 1.4svn-r7874.
[thirdparty/cups.git] / scheduler / client.h
1 /*
2 * "$Id: client.h 7470 2008-04-18 23:24:24Z mike $"
3 *
4 * Client definitions for the Common UNIX Printing System (CUPS) scheduler.
5 *
6 * Copyright 2007 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
8 *
9 * These coded instructions, statements, and computer programs are the
10 * property of Apple Inc. and are protected by Federal copyright
11 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
12 * which should have been included with this file. If this file is
13 * file is missing or damaged, see the license at "http://www.cups.org/".
14 */
15
16 #ifdef HAVE_AUTHORIZATION_H
17 # include <Security/Authorization.h>
18 #endif /* HAVE_AUTHORIZATION_H */
19
20 /*
21 * HTTP client structure...
22 */
23
24 struct cupsd_client_s
25 {
26 http_t http; /* HTTP client connection */
27 ipp_t *request, /* IPP request information */
28 *response; /* IPP response information */
29 cupsd_location_t *best; /* Best match for AAA */
30 time_t start; /* Request start time */
31 http_state_t operation; /* Request operation */
32 off_t bytes; /* Bytes transferred for this request */
33 int type; /* AuthType for username */
34 char username[256], /* Username from Authorization: line */
35 password[33], /* Password from Authorization: line */
36 uri[HTTP_MAX_URI],
37 /* Localized URL/URI for GET/PUT */
38 *filename, /* Filename of output file */
39 *command, /* Command to run */
40 *options, /* Options for command */
41 *query_string; /* QUERY_STRING environment variable */
42 int file; /* Input/output file */
43 int file_ready; /* Input ready on file/pipe? */
44 int pipe_pid; /* Pipe process ID (or 0 if not a pipe) */
45 int sent_header, /* Non-zero if sent HTTP header */
46 got_fields, /* Non-zero if all fields seen */
47 field_col; /* Column within line */
48 cups_lang_t *language; /* Language to use */
49 #ifdef HAVE_SSL
50 int auto_ssl; /* Automatic test for SSL/TLS */
51 #endif /* HAVE_SSL */
52 http_addr_t clientaddr; /* Client address */
53 char servername[256];/* Server name for connection */
54 int serverport; /* Server port for connection */
55 #ifdef HAVE_GSSAPI
56 int gss_have_creds; /* Have authenticated credentials */
57 gss_buffer_desc gss_output_token;
58 /* Output token for Negotiate header */
59 gss_cred_id_t gss_delegated_cred;
60 /* Credentials from client header */
61 #endif /* HAVE_GSSAPI */
62 #ifdef HAVE_AUTHORIZATION_H
63 AuthorizationRef authref; /* Authorization ref */
64 #endif /* HAVE_AUTHORIZATION_H */
65 };
66
67 #define HTTP(con) &((con)->http)
68
69
70 /*
71 * HTTP listener structure...
72 */
73
74 typedef struct
75 {
76 int fd; /* File descriptor for this server */
77 http_addr_t address; /* Bind address of socket */
78 http_encryption_t encryption; /* To encrypt or not to encrypt... */
79 } cupsd_listener_t;
80
81
82 /*
83 * Globals...
84 */
85
86 VAR int ListenBackLog VALUE(SOMAXCONN),
87 /* Max backlog of pending connections */
88 LocalPort VALUE(631);
89 /* Local port to use */
90 VAR http_encryption_t LocalEncryption VALUE(HTTP_ENCRYPT_IF_REQUESTED);
91 /* Local port encryption to use */
92 VAR cups_array_t *Listeners VALUE(NULL);
93 /* Listening sockets */
94 VAR time_t ListeningPaused VALUE(0);
95 /* Time when listening was paused */
96 VAR cups_array_t *Clients VALUE(NULL),
97 /* HTTP clients */
98 *ActiveClients VALUE(NULL);
99 /* Active HTTP clients */
100 VAR http_addrlist_t *ServerAddrs VALUE(NULL);
101 /* Server address(es) */
102 VAR char *ServerHeader VALUE(NULL);
103 /* Server header in requests */
104 VAR int CGIPipes[2] VALUE2(-1,-1);
105 /* Pipes for CGI error/debug output */
106 VAR cupsd_statbuf_t *CGIStatusBuffer VALUE(NULL);
107 /* Status buffer for pipes */
108
109
110 /*
111 * Prototypes...
112 */
113
114 extern void cupsdAcceptClient(cupsd_listener_t *lis);
115 extern void cupsdCloseAllClients(void);
116 extern int cupsdCloseClient(cupsd_client_t *con);
117 extern void cupsdDeleteAllListeners(void);
118 extern int cupsdFlushHeader(cupsd_client_t *con);
119 extern void cupsdPauseListening(void);
120 extern int cupsdProcessIPPRequest(cupsd_client_t *con);
121 extern void cupsdReadClient(cupsd_client_t *con);
122 extern void cupsdResumeListening(void);
123 extern int cupsdSendCommand(cupsd_client_t *con, char *command,
124 char *options, int root);
125 extern int cupsdSendError(cupsd_client_t *con, http_status_t code,
126 int auth_type);
127 extern int cupsdSendHeader(cupsd_client_t *con, http_status_t code,
128 char *type, int auth_type);
129 extern void cupsdShutdownClient(cupsd_client_t *con);
130 extern void cupsdStartListening(void);
131 extern void cupsdStopListening(void);
132 extern void cupsdUpdateCGI(void);
133 extern void cupsdWriteClient(cupsd_client_t *con);
134
135
136 /*
137 * End of "$Id: client.h 7470 2008-04-18 23:24:24Z mike $".
138 */