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