]> git.ipfire.org Git - thirdparty/cups.git/blame - scheduler/client.h
Import CUPS v1.7.1
[thirdparty/cups.git] / scheduler / client.h
CommitLineData
ef416fc2 1/*
61515785 2 * "$Id: client.h 11213 2013-08-01 22:23:18Z msweet $"
ef416fc2 3 *
10d09e33 4 * Client definitions for the CUPS scheduler.
ef416fc2 5 *
07ed0e9a 6 * Copyright 2007-2011 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 */
3e7fe0ca
MS
35 char username[HTTP_MAX_VALUE],
36 /* Username from Authorization: line */
37 password[HTTP_MAX_VALUE],
38 /* Password from Authorization: line */
ef416fc2 39 uri[HTTP_MAX_URI],
40 /* Localized URL/URI for GET/PUT */
41 *filename, /* Filename of output file */
42 *command, /* Command to run */
b86bc4cf 43 *options, /* Options for command */
44 *query_string; /* QUERY_STRING environment variable */
ef416fc2 45 int file; /* Input/output file */
46 int file_ready; /* Input ready on file/pipe? */
47 int pipe_pid; /* Pipe process ID (or 0 if not a pipe) */
48 int sent_header, /* Non-zero if sent HTTP header */
49 got_fields, /* Non-zero if all fields seen */
68b10830
MS
50 header_used; /* Number of header bytes used */
51 char header[2048]; /* Header from CGI program */
ef416fc2 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 */
f2534050
MS
57 char clientname[256];/* Client's server name for connection */
58 int clientport; /* Client's server port for connection */
ef416fc2 59 char servername[256];/* Server name for connection */
60 int serverport; /* Server port for connection */
f7deaa1a 61#ifdef HAVE_GSSAPI
97c9a8d7 62 int have_gss; /* Have GSS credentials? */
07ed0e9a 63 uid_t gss_uid; /* User ID for local prints */
f7deaa1a 64#endif /* HAVE_GSSAPI */
65#ifdef HAVE_AUTHORIZATION_H
66 AuthorizationRef authref; /* Authorization ref */
67#endif /* HAVE_AUTHORIZATION_H */
ef416fc2 68};
69
70#define HTTP(con) &((con)->http)
71
72
73/*
74 * HTTP listener structure...
75 */
76
77typedef struct
78{
79 int fd; /* File descriptor for this server */
80 http_addr_t address; /* Bind address of socket */
81 http_encryption_t encryption; /* To encrypt or not to encrypt... */
82} cupsd_listener_t;
83
84
85/*
86 * Globals...
87 */
88
89VAR int ListenBackLog VALUE(SOMAXCONN),
90 /* Max backlog of pending connections */
f11a948a 91 LocalPort VALUE(631),
ef416fc2 92 /* Local port to use */
f11a948a
MS
93 RemotePort VALUE(0);
94 /* Remote port to use */
ef416fc2 95VAR http_encryption_t LocalEncryption VALUE(HTTP_ENCRYPT_IF_REQUESTED);
96 /* Local port encryption to use */
bd7854cb 97VAR cups_array_t *Listeners VALUE(NULL);
ef416fc2 98 /* Listening sockets */
76cd9e37
MS
99VAR time_t ListeningPaused VALUE(0);
100 /* Time when listening was paused */
3dfe78b3 101VAR cups_array_t *Clients VALUE(NULL),
ef416fc2 102 /* HTTP clients */
3dfe78b3
MS
103 *ActiveClients VALUE(NULL);
104 /* Active HTTP clients */
ef416fc2 105VAR char *ServerHeader VALUE(NULL);
106 /* Server header in requests */
107VAR int CGIPipes[2] VALUE2(-1,-1);
108 /* Pipes for CGI error/debug output */
109VAR cupsd_statbuf_t *CGIStatusBuffer VALUE(NULL);
110 /* Status buffer for pipes */
111
112
113/*
114 * Prototypes...
115 */
116
117extern void cupsdAcceptClient(cupsd_listener_t *lis);
118extern void cupsdCloseAllClients(void);
119extern int cupsdCloseClient(cupsd_client_t *con);
bd7854cb 120extern void cupsdDeleteAllListeners(void);
07725fee 121extern int cupsdFlushHeader(cupsd_client_t *con);
ef416fc2 122extern void cupsdPauseListening(void);
123extern int cupsdProcessIPPRequest(cupsd_client_t *con);
f7deaa1a 124extern void cupsdReadClient(cupsd_client_t *con);
ef416fc2 125extern void cupsdResumeListening(void);
126extern int cupsdSendCommand(cupsd_client_t *con, char *command,
127 char *options, int root);
f899b121 128extern int cupsdSendError(cupsd_client_t *con, http_status_t code,
129 int auth_type);
ef416fc2 130extern int cupsdSendHeader(cupsd_client_t *con, http_status_t code,
f899b121 131 char *type, int auth_type);
ef416fc2 132extern void cupsdShutdownClient(cupsd_client_t *con);
133extern void cupsdStartListening(void);
134extern void cupsdStopListening(void);
135extern void cupsdUpdateCGI(void);
f7deaa1a 136extern void cupsdWriteClient(cupsd_client_t *con);
ef416fc2 137
82cc1f9a
MS
138#ifdef HAVE_SSL
139extern int cupsdEndTLS(cupsd_client_t *con);
140extern int cupsdStartTLS(cupsd_client_t *con);
141#endif /* HAVE_SSL */
142
ef416fc2 143
144/*
61515785 145 * End of "$Id: client.h 11213 2013-08-01 22:23:18Z msweet $".
ef416fc2 146 */