]>
Commit | Line | Data |
---|---|---|
a74b005d | 1 | /* |
41d6188e | 2 | * "$Id: client.h,v 1.17.2.13 2004/06/17 14:45:12 mike Exp $" |
a74b005d | 3 | * |
4 | * Client definitions for the Common UNIX Printing System (CUPS) scheduler. | |
5 | * | |
1d9595ab | 6 | * Copyright 1997-2003 by Easy Software Products, all rights reserved. |
a74b005d | 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 | |
8784b6a6 | 17 | * 44141 Airport View Drive, Suite 204 |
a74b005d | 18 | * Hollywood, Maryland 20636-3111 USA |
19 | * | |
20 | * Voice: (301) 373-9603 | |
21 | * EMail: cups-info@cups.org | |
22 | * WWW: http://www.cups.org | |
23 | */ | |
24 | ||
25 | /* | |
26 | * HTTP client structure... | |
27 | */ | |
28 | ||
29 | typedef struct | |
30 | { | |
31 | http_t http; /* HTTP client connection */ | |
32 | ipp_t *request, /* IPP request information */ | |
33 | *response; /* IPP response information */ | |
6a0c519d | 34 | time_t start; /* Request start time */ |
35 | http_state_t operation; /* Request operation */ | |
36 | int bytes; /* Bytes transferred for this request */ | |
83e740a5 | 37 | char username[33], /* Username from Authorization: line */ |
38 | password[33], /* Password from Authorization: line */ | |
a74b005d | 39 | uri[HTTP_MAX_URI], /* Localized URL/URI for GET/PUT */ |
fc757c63 | 40 | *filename, /* Filename of output file */ |
41 | *command, /* Command to run */ | |
f63a2256 | 42 | *options; /* Options for command */ |
a74b005d | 43 | int file; /* Input/output file */ |
6a2cceab | 44 | int file_ready; /* Input ready on file/pipe? */ |
a74b005d | 45 | int pipe_pid; /* Pipe process ID (or 0 if not a pipe) */ |
13486cb7 | 46 | int got_fields, /* Non-zero if all fields seen */ |
47 | field_col; /* Column within line */ | |
a74b005d | 48 | cups_lang_t *language; /* Language to use */ |
49 | } client_t; | |
50 | ||
51 | #define HTTP(con) &((con)->http) | |
52 | ||
53 | ||
54 | /* | |
55 | * HTTP listener structure... | |
56 | */ | |
57 | ||
58 | typedef struct | |
59 | { | |
17b95e13 | 60 | int fd; /* File descriptor for this server */ |
99de6da0 | 61 | http_addr_t address; /* Bind address of socket */ |
46490d9d | 62 | http_encryption_t encryption; /* To encrypt or not to encrypt... */ |
a74b005d | 63 | } listener_t; |
64 | ||
65 | ||
66 | /* | |
67 | * Globals... | |
68 | */ | |
69 | ||
0f71c41e | 70 | VAR int ListenBackLog VALUE(SOMAXCONN), |
71 | /* Max backlog of pending connections */ | |
72 | LocalPort VALUE(631); | |
73 | /* Local port to use */ | |
41d6188e | 74 | VAR http_encryption_t LocalEncryption VALUE(HTTP_ENCRYPT_IF_REQUESTED); |
75 | /* Local port encryption to use */ | |
a74b005d | 76 | VAR int NumListeners VALUE(0); |
77 | /* Number of listening sockets */ | |
5073e3f8 | 78 | VAR listener_t *Listeners VALUE(NULL); |
a74b005d | 79 | /* Listening sockets */ |
80 | VAR int NumClients VALUE(0); | |
81 | /* Number of HTTP clients */ | |
997edb40 | 82 | VAR client_t *Clients VALUE(NULL); |
a74b005d | 83 | /* HTTP clients */ |
99de6da0 | 84 | VAR http_addr_t ServerAddr; /* Server address */ |
0a968cfb | 85 | VAR int CGIPipes[2] VALUE2(-1,-1); |
86 | /* Pipes for CGI error/debug output */ | |
a74b005d | 87 | |
88 | ||
a74b005d | 89 | /* |
90 | * Prototypes... | |
91 | */ | |
92 | ||
93 | extern void AcceptClient(listener_t *lis); | |
94 | extern void CloseAllClients(void); | |
819347a7 | 95 | extern int CloseClient(client_t *con); |
a75c006a | 96 | extern int EncryptClient(client_t *con); |
e6221033 | 97 | extern int IsCGI(client_t *con, const char *filename, |
98 | struct stat *filestats, mime_type_t *type); | |
d236cb49 | 99 | extern void PauseListening(void); |
6e3d4276 | 100 | extern int ProcessIPPRequest(client_t *con); |
a74b005d | 101 | extern int ReadClient(client_t *con); |
d236cb49 | 102 | extern void ResumeListening(void); |
b14d90ba | 103 | extern int SendCommand(client_t *con, char *command, char *options); |
a74b005d | 104 | extern int SendError(client_t *con, http_status_t code); |
105 | extern int SendFile(client_t *con, http_status_t code, char *filename, | |
106 | char *type, struct stat *filestats); | |
107 | extern int SendHeader(client_t *con, http_status_t code, char *type); | |
c3c5af5e | 108 | extern void ShutdownClient(client_t *con); |
a74b005d | 109 | extern void StartListening(void); |
110 | extern void StopListening(void); | |
0a968cfb | 111 | extern void UpdateCGI(void); |
a74b005d | 112 | extern int WriteClient(client_t *con); |
113 | ||
99de6da0 | 114 | |
a74b005d | 115 | /* |
41d6188e | 116 | * End of "$Id: client.h,v 1.17.2.13 2004/06/17 14:45:12 mike Exp $". |
a74b005d | 117 | */ |