]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
bd7854cb | 2 | * "$Id: client.h 5069 2006-02-04 05:24:35Z mike $" |
ef416fc2 | 3 | * |
4 | * Client definitions for the Common UNIX Printing System (CUPS) scheduler. | |
5 | * | |
bd7854cb | 6 | * Copyright 1997-2006 by Easy Software Products, all rights reserved. |
ef416fc2 | 7 | * |
8 | * These coded instructions, statements, and computer programs are the | |
9 | * property of Easy Software Products and are protected by Federal | |
10 | * copyright law. Distribution and use rights are outlined in the file | |
11 | * "LICENSE.txt" which should have been included with this file. If this | |
12 | * file is missing or damaged please contact Easy Software Products | |
13 | * at: | |
14 | * | |
15 | * Attn: CUPS Licensing Information | |
16 | * Easy Software Products | |
17 | * 44141 Airport View Drive, Suite 204 | |
18 | * Hollywood, Maryland 20636 USA | |
19 | * | |
20 | * Voice: (301) 373-9600 | |
21 | * EMail: cups-info@cups.org | |
22 | * WWW: http://www.cups.org | |
23 | */ | |
24 | ||
25 | /* | |
26 | * HTTP client structure... | |
27 | */ | |
28 | ||
29 | struct cupsd_client_s | |
30 | { | |
31 | http_t http; /* HTTP client connection */ | |
32 | ipp_t *request, /* IPP request information */ | |
33 | *response; /* IPP response information */ | |
34 | cupsd_location_t *best; /* Best match for AAA */ | |
35 | time_t start; /* Request start time */ | |
36 | http_state_t operation; /* Request operation */ | |
37 | off_t bytes; /* Bytes transferred for this request */ | |
38 | char username[33], /* Username from Authorization: line */ | |
39 | password[33], /* Password from Authorization: line */ | |
40 | uri[HTTP_MAX_URI], | |
41 | /* Localized URL/URI for GET/PUT */ | |
42 | *filename, /* Filename of output file */ | |
43 | *command, /* Command to run */ | |
44 | *options; /* Options for command */ | |
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 */ | |
50 | field_col; /* Column within line */ | |
51 | cups_lang_t *language; /* Language to use */ | |
52 | #ifdef HAVE_SSL | |
53 | int auto_ssl; /* Automatic test for SSL/TLS */ | |
54 | #endif /* HAVE_SSL */ | |
55 | http_addr_t clientaddr; /* Client address */ | |
56 | char servername[256];/* Server name for connection */ | |
57 | int serverport; /* Server port for connection */ | |
58 | }; | |
59 | ||
60 | #define HTTP(con) &((con)->http) | |
61 | ||
62 | ||
63 | /* | |
64 | * HTTP listener structure... | |
65 | */ | |
66 | ||
67 | typedef struct | |
68 | { | |
69 | int fd; /* File descriptor for this server */ | |
70 | http_addr_t address; /* Bind address of socket */ | |
71 | http_encryption_t encryption; /* To encrypt or not to encrypt... */ | |
72 | } cupsd_listener_t; | |
73 | ||
74 | ||
75 | /* | |
76 | * Globals... | |
77 | */ | |
78 | ||
79 | VAR int ListenBackLog VALUE(SOMAXCONN), | |
80 | /* Max backlog of pending connections */ | |
81 | LocalPort VALUE(631); | |
82 | /* Local port to use */ | |
83 | VAR http_encryption_t LocalEncryption VALUE(HTTP_ENCRYPT_IF_REQUESTED); | |
84 | /* Local port encryption to use */ | |
bd7854cb | 85 | VAR cups_array_t *Listeners VALUE(NULL); |
ef416fc2 | 86 | /* Listening sockets */ |
bd7854cb | 87 | VAR cups_array_t *Clients VALUE(NULL); |
ef416fc2 | 88 | /* HTTP clients */ |
89 | VAR http_addrlist_t *ServerAddrs VALUE(NULL); | |
90 | /* Server address(es) */ | |
91 | VAR char *ServerHeader VALUE(NULL); | |
92 | /* Server header in requests */ | |
93 | VAR int CGIPipes[2] VALUE2(-1,-1); | |
94 | /* Pipes for CGI error/debug output */ | |
95 | VAR cupsd_statbuf_t *CGIStatusBuffer VALUE(NULL); | |
96 | /* Status buffer for pipes */ | |
97 | ||
98 | ||
99 | /* | |
100 | * Prototypes... | |
101 | */ | |
102 | ||
103 | extern void cupsdAcceptClient(cupsd_listener_t *lis); | |
104 | extern void cupsdCloseAllClients(void); | |
105 | extern int cupsdCloseClient(cupsd_client_t *con); | |
bd7854cb | 106 | extern void cupsdDeleteAllListeners(void); |
ef416fc2 | 107 | extern int cupsdEncryptClient(cupsd_client_t *con); |
108 | extern int cupsdIsCGI(cupsd_client_t *con, const char *filename, | |
109 | struct stat *filestats, mime_type_t *type); | |
110 | extern void cupsdPauseListening(void); | |
111 | extern int cupsdProcessIPPRequest(cupsd_client_t *con); | |
112 | extern int cupsdReadClient(cupsd_client_t *con); | |
113 | extern void cupsdResumeListening(void); | |
114 | extern int cupsdSendCommand(cupsd_client_t *con, char *command, | |
115 | char *options, int root); | |
116 | extern int cupsdSendError(cupsd_client_t *con, http_status_t code); | |
117 | extern int cupsdSendFile(cupsd_client_t *con, http_status_t code, | |
118 | char *filename, char *type, | |
119 | struct stat *filestats); | |
120 | extern int cupsdSendHeader(cupsd_client_t *con, http_status_t code, | |
121 | char *type); | |
122 | extern void cupsdShutdownClient(cupsd_client_t *con); | |
123 | extern void cupsdStartListening(void); | |
124 | extern void cupsdStopListening(void); | |
125 | extern void cupsdUpdateCGI(void); | |
126 | extern int cupsdWriteClient(cupsd_client_t *con); | |
127 | ||
128 | ||
129 | /* | |
bd7854cb | 130 | * End of "$Id: client.h 5069 2006-02-04 05:24:35Z mike $". |
ef416fc2 | 131 | */ |