]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/client.h
Changelog.
[thirdparty/cups.git] / scheduler / client.h
CommitLineData
ef416fc2 1/*
f2d18633 2 * "$Id$"
ef416fc2 3 *
5ec1fd3d 4 * Client definitions for the CUPS scheduler.
ef416fc2 5 *
5ec1fd3d
MS
6 * Copyright 2007-2013 by Apple Inc.
7 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
ef416fc2 8 *
5ec1fd3d
MS
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/".
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{
996acce8
MS
27 int number; /* Connection number */
28 http_t *http; /* HTTP client connection */
ef416fc2 29 ipp_t *request, /* IPP request information */
30 *response; /* IPP response information */
31 cupsd_location_t *best; /* Best match for AAA */
dfd5680b 32 struct timeval start; /* Request start time */
ef416fc2 33 http_state_t operation; /* Request operation */
34 off_t bytes; /* Bytes transferred for this request */
2fb76298 35 int type; /* AuthType for username */
3e7fe0ca
MS
36 char username[HTTP_MAX_VALUE],
37 /* Username from Authorization: line */
38 password[HTTP_MAX_VALUE],
39 /* Password from Authorization: line */
ef416fc2 40 uri[HTTP_MAX_URI],
41 /* Localized URL/URI for GET/PUT */
42 *filename, /* Filename of output file */
43 *command, /* Command to run */
b86bc4cf 44 *options, /* Options for command */
45 *query_string; /* QUERY_STRING environment variable */
ef416fc2 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) */
e200616a 49 http_status_t pipe_status; /* HTTP status from pipe process */
ef416fc2 50 int sent_header, /* Non-zero if sent HTTP header */
51 got_fields, /* Non-zero if all fields seen */
68b10830
MS
52 header_used; /* Number of header bytes used */
53 char header[2048]; /* Header from CGI program */
ef416fc2 54 cups_lang_t *language; /* Language to use */
55#ifdef HAVE_SSL
56 int auto_ssl; /* Automatic test for SSL/TLS */
57#endif /* HAVE_SSL */
996acce8 58 http_addr_t clientaddr; /* Client's server address */
f2534050
MS
59 char clientname[256];/* Client's server name for connection */
60 int clientport; /* Client's server port for connection */
ef416fc2 61 char servername[256];/* Server name for connection */
62 int serverport; /* Server port for connection */
f7deaa1a 63#ifdef HAVE_GSSAPI
97c9a8d7 64 int have_gss; /* Have GSS credentials? */
07ed0e9a 65 uid_t gss_uid; /* User ID for local prints */
f7deaa1a 66#endif /* HAVE_GSSAPI */
67#ifdef HAVE_AUTHORIZATION_H
68 AuthorizationRef authref; /* Authorization ref */
69#endif /* HAVE_AUTHORIZATION_H */
ef416fc2 70};
71
996acce8 72#define HTTP(con) ((con)->http)
ef416fc2 73
74
75/*
76 * HTTP listener structure...
77 */
78
79typedef struct
80{
81 int fd; /* File descriptor for this server */
82 http_addr_t address; /* Bind address of socket */
83 http_encryption_t encryption; /* To encrypt or not to encrypt... */
84} cupsd_listener_t;
85
86
87/*
88 * Globals...
89 */
90
996acce8
MS
91VAR int LastClientNumber VALUE(0),
92 /* Last client connection number */
93 ListenBackLog VALUE(SOMAXCONN),
ef416fc2 94 /* Max backlog of pending connections */
f11a948a 95 LocalPort VALUE(631),
ef416fc2 96 /* Local port to use */
f11a948a
MS
97 RemotePort VALUE(0);
98 /* Remote port to use */
ef416fc2 99VAR http_encryption_t LocalEncryption VALUE(HTTP_ENCRYPT_IF_REQUESTED);
100 /* Local port encryption to use */
bd7854cb 101VAR cups_array_t *Listeners VALUE(NULL);
ef416fc2 102 /* Listening sockets */
76cd9e37
MS
103VAR time_t ListeningPaused VALUE(0);
104 /* Time when listening was paused */
3dfe78b3 105VAR cups_array_t *Clients VALUE(NULL),
ef416fc2 106 /* HTTP clients */
3dfe78b3
MS
107 *ActiveClients VALUE(NULL);
108 /* Active HTTP clients */
ef416fc2 109VAR char *ServerHeader VALUE(NULL);
110 /* Server header in requests */
111VAR int CGIPipes[2] VALUE2(-1,-1);
112 /* Pipes for CGI error/debug output */
113VAR cupsd_statbuf_t *CGIStatusBuffer VALUE(NULL);
114 /* Status buffer for pipes */
115
116
117/*
118 * Prototypes...
119 */
120
121extern void cupsdAcceptClient(cupsd_listener_t *lis);
122extern void cupsdCloseAllClients(void);
123extern int cupsdCloseClient(cupsd_client_t *con);
bd7854cb 124extern void cupsdDeleteAllListeners(void);
ef416fc2 125extern void cupsdPauseListening(void);
126extern int cupsdProcessIPPRequest(cupsd_client_t *con);
f7deaa1a 127extern void cupsdReadClient(cupsd_client_t *con);
ef416fc2 128extern void cupsdResumeListening(void);
129extern int cupsdSendCommand(cupsd_client_t *con, char *command,
130 char *options, int root);
f899b121 131extern int cupsdSendError(cupsd_client_t *con, http_status_t code,
132 int auth_type);
ef416fc2 133extern int cupsdSendHeader(cupsd_client_t *con, http_status_t code,
f899b121 134 char *type, int auth_type);
ef416fc2 135extern void cupsdShutdownClient(cupsd_client_t *con);
136extern void cupsdStartListening(void);
137extern void cupsdStopListening(void);
138extern void cupsdUpdateCGI(void);
f7deaa1a 139extern void cupsdWriteClient(cupsd_client_t *con);
ef416fc2 140
82cc1f9a
MS
141#ifdef HAVE_SSL
142extern int cupsdEndTLS(cupsd_client_t *con);
143extern int cupsdStartTLS(cupsd_client_t *con);
144#endif /* HAVE_SSL */
145
ef416fc2 146
147/*
f2d18633 148 * End of "$Id$".
ef416fc2 149 */