]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/client.h
Merge changes from CUPS 1.3.1.
[thirdparty/cups.git] / scheduler / client.h
CommitLineData
ef416fc2 1/*
db1f069b 2 * "$Id: client.h 6949 2007-09-12 21:33:23Z mike $"
ef416fc2 3 *
4 * Client definitions for the Common UNIX Printing System (CUPS) scheduler.
5 *
bc44d920 6 * Copyright 2007 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
ef416fc2 20/*
21 * HTTP client structure...
22 */
23
24struct 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 */
db1f069b 33 char username[256], /* Username from Authorization: line */
ef416fc2 34 password[33], /* Password from Authorization: line */
35 uri[HTTP_MAX_URI],
36 /* Localized URL/URI for GET/PUT */
37 *filename, /* Filename of output file */
38 *command, /* Command to run */
b86bc4cf 39 *options, /* Options for command */
40 *query_string; /* QUERY_STRING environment variable */
ef416fc2 41 int file; /* Input/output file */
42 int file_ready; /* Input ready on file/pipe? */
43 int pipe_pid; /* Pipe process ID (or 0 if not a pipe) */
44 int sent_header, /* Non-zero if sent HTTP header */
45 got_fields, /* Non-zero if all fields seen */
46 field_col; /* Column within line */
47 cups_lang_t *language; /* Language to use */
48#ifdef HAVE_SSL
49 int auto_ssl; /* Automatic test for SSL/TLS */
50#endif /* HAVE_SSL */
51 http_addr_t clientaddr; /* Client address */
52 char servername[256];/* Server name for connection */
53 int serverport; /* Server port for connection */
f7deaa1a 54#ifdef HAVE_GSSAPI
09a101d6 55 int gss_have_creds; /* Have authenticated credentials */
f7deaa1a 56 gss_buffer_desc gss_output_token;
57 /* Output token for Negotiate header */
58 gss_cred_id_t gss_delegated_cred;
59 /* Credentials from client header */
60#endif /* HAVE_GSSAPI */
61#ifdef HAVE_AUTHORIZATION_H
62 AuthorizationRef authref; /* Authorization ref */
63#endif /* HAVE_AUTHORIZATION_H */
ef416fc2 64};
65
66#define HTTP(con) &((con)->http)
67
68
69/*
70 * HTTP listener structure...
71 */
72
73typedef struct
74{
75 int fd; /* File descriptor for this server */
76 http_addr_t address; /* Bind address of socket */
77 http_encryption_t encryption; /* To encrypt or not to encrypt... */
78} cupsd_listener_t;
79
80
81/*
82 * Globals...
83 */
84
85VAR int ListenBackLog VALUE(SOMAXCONN),
86 /* Max backlog of pending connections */
87 LocalPort VALUE(631);
88 /* Local port to use */
89VAR http_encryption_t LocalEncryption VALUE(HTTP_ENCRYPT_IF_REQUESTED);
90 /* Local port encryption to use */
bd7854cb 91VAR cups_array_t *Listeners VALUE(NULL);
ef416fc2 92 /* Listening sockets */
76cd9e37
MS
93VAR time_t ListeningPaused VALUE(0);
94 /* Time when listening was paused */
bd7854cb 95VAR cups_array_t *Clients VALUE(NULL);
ef416fc2 96 /* HTTP clients */
97VAR http_addrlist_t *ServerAddrs VALUE(NULL);
98 /* Server address(es) */
99VAR char *ServerHeader VALUE(NULL);
100 /* Server header in requests */
101VAR int CGIPipes[2] VALUE2(-1,-1);
102 /* Pipes for CGI error/debug output */
103VAR cupsd_statbuf_t *CGIStatusBuffer VALUE(NULL);
104 /* Status buffer for pipes */
105
106
107/*
108 * Prototypes...
109 */
110
111extern void cupsdAcceptClient(cupsd_listener_t *lis);
112extern void cupsdCloseAllClients(void);
113extern int cupsdCloseClient(cupsd_client_t *con);
bd7854cb 114extern void cupsdDeleteAllListeners(void);
07725fee 115extern int cupsdFlushHeader(cupsd_client_t *con);
ef416fc2 116extern void cupsdPauseListening(void);
117extern int cupsdProcessIPPRequest(cupsd_client_t *con);
f7deaa1a 118extern void cupsdReadClient(cupsd_client_t *con);
ef416fc2 119extern void cupsdResumeListening(void);
120extern int cupsdSendCommand(cupsd_client_t *con, char *command,
121 char *options, int root);
f899b121 122extern int cupsdSendError(cupsd_client_t *con, http_status_t code,
123 int auth_type);
ef416fc2 124extern int cupsdSendHeader(cupsd_client_t *con, http_status_t code,
f899b121 125 char *type, int auth_type);
ef416fc2 126extern void cupsdShutdownClient(cupsd_client_t *con);
127extern void cupsdStartListening(void);
128extern void cupsdStopListening(void);
129extern void cupsdUpdateCGI(void);
f7deaa1a 130extern void cupsdWriteClient(cupsd_client_t *con);
ef416fc2 131
132
133/*
db1f069b 134 * End of "$Id: client.h 6949 2007-09-12 21:33:23Z mike $".
ef416fc2 135 */