]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
8ca02f3c | 2 | * "$Id: http.h 5716 2006-07-11 17:56:57Z mike $" |
ef416fc2 | 3 | * |
4 | * Hyper-Text Transport Protocol definitions for the Common UNIX Printing | |
5 | * System (CUPS). | |
6 | * | |
7 | * Copyright 1997-2006 by Easy Software Products, all rights reserved. | |
8 | * | |
9 | * These coded instructions, statements, and computer programs are the | |
10 | * property of Easy Software Products and are protected by Federal | |
11 | * copyright law. Distribution and use rights are outlined in the file | |
12 | * "LICENSE.txt" which should have been included with this file. If this | |
13 | * file is missing or damaged please contact Easy Software Products | |
14 | * at: | |
15 | * | |
16 | * Attn: CUPS Licensing Information | |
17 | * Easy Software Products | |
18 | * 44141 Airport View Drive, Suite 204 | |
19 | * Hollywood, Maryland 20636 USA | |
20 | * | |
21 | * Voice: (301) 373-9600 | |
22 | * EMail: cups-info@cups.org | |
23 | * WWW: http://www.cups.org | |
24 | * | |
25 | * This file is subject to the Apple OS-Developed Software exception. | |
26 | */ | |
27 | ||
28 | #ifndef _CUPS_HTTP_H_ | |
29 | # define _CUPS_HTTP_H_ | |
30 | ||
31 | /* | |
32 | * Include necessary headers... | |
33 | */ | |
34 | ||
35 | # include <string.h> | |
36 | # include <time.h> | |
37 | # include <sys/types.h> | |
38 | # ifdef WIN32 | |
39 | # include <winsock2.h> | |
40 | # include <ws2tcpip.h> | |
41 | # else | |
e1d6a774 | 42 | # ifdef __sgi /* IRIX needs this for IPv6 support!?! */ |
43 | # define INET6 | |
44 | # endif /* __sgi */ | |
ef416fc2 | 45 | # include <unistd.h> |
46 | # include <sys/time.h> | |
47 | # include <sys/socket.h> | |
48 | # include <netdb.h> | |
49 | # include <netinet/in.h> | |
50 | # include <arpa/inet.h> | |
51 | # include <netinet/in_systm.h> | |
52 | # include <netinet/ip.h> | |
53 | # if !defined(__APPLE__) || !defined(TCP_NODELAY) | |
54 | # include <netinet/tcp.h> | |
55 | # endif /* !__APPLE__ || !TCP_NODELAY */ | |
56 | # ifdef AF_LOCAL | |
57 | # include <sys/un.h> | |
58 | # endif /* AF_LOCAL */ | |
59 | # endif /* WIN32 */ | |
60 | ||
61 | # include "md5.h" | |
62 | ||
63 | /* | |
64 | * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get | |
fa73b229 | 65 | * a warning at compile-time. |
ef416fc2 | 66 | */ |
67 | ||
68 | # if defined(__GNUC__) && __GNUC__ > 2 | |
69 | # define _HTTP_DEPRECATED __attribute__ ((__deprecated__)) | |
70 | # else | |
71 | # define _HTTP_DEPRECATED | |
72 | # endif /* __GNUC__ && __GNUC__ > 2 */ | |
73 | ||
74 | ||
75 | /* | |
76 | * C++ magic... | |
77 | */ | |
78 | ||
79 | # ifdef __cplusplus | |
80 | extern "C" { | |
81 | # endif /* __cplusplus */ | |
82 | ||
83 | ||
84 | /* | |
85 | * Oh, the wonderful world of IPv6 compatibility. Apparently some | |
86 | * implementations expose the (more logical) 32-bit address parts | |
87 | * to everyone, while others only expose it to kernel code... To | |
88 | * make supporting IPv6 even easier, each vendor chose different | |
89 | * core structure and union names, so the same defines or code | |
90 | * can't be used on all platforms. | |
91 | * | |
92 | * The following will likely need tweaking on new platforms that | |
93 | * support IPv6 - the "s6_addr32" define maps to the 32-bit integer | |
94 | * array in the in6_addr union, which is named differently on various | |
95 | * platforms. | |
96 | */ | |
97 | ||
98 | #if defined(AF_INET6) && !defined(s6_addr32) | |
99 | # if defined(__sun) | |
100 | # define s6_addr32 _S6_un._S6_u32 | |
8ca02f3c | 101 | # elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) |
ef416fc2 | 102 | # define s6_addr32 __u6_addr.__u6_addr32 |
e1d6a774 | 103 | # elif defined(__osf__) |
104 | # define s6_addr32 s6_un.sa6_laddr | |
ef416fc2 | 105 | # elif defined(WIN32) |
106 | /* | |
107 | * Windows only defines byte and 16-bit word members of the union and | |
108 | * requires special casing of all raw address code... | |
109 | */ | |
110 | # define s6_addr32 error_need_win32_specific_code | |
111 | # endif /* __sun */ | |
112 | #endif /* AF_INET6 && !s6_addr32 */ | |
113 | ||
114 | ||
115 | /* | |
116 | * Limits... | |
117 | */ | |
118 | ||
119 | # define HTTP_MAX_URI 1024 /* Max length of URI string */ | |
120 | # define HTTP_MAX_HOST 256 /* Max length of hostname string */ | |
fa73b229 | 121 | # define HTTP_MAX_BUFFER 2048 /* Max length of data buffer */ |
ef416fc2 | 122 | # define HTTP_MAX_VALUE 256 /* Max header field value length */ |
123 | ||
124 | ||
125 | /* | |
126 | * Types and structures... | |
127 | */ | |
128 | ||
129 | typedef enum http_auth_e /**** HTTP authentication types ****/ | |
130 | { | |
131 | HTTP_AUTH_NONE, /* No authentication in use */ | |
132 | HTTP_AUTH_BASIC, /* Basic authentication in use */ | |
133 | HTTP_AUTH_MD5, /* Digest authentication in use */ | |
134 | HTTP_AUTH_MD5_SESS, /* MD5-session authentication in use */ | |
135 | HTTP_AUTH_MD5_INT, /* Digest authentication in use for body */ | |
136 | HTTP_AUTH_MD5_SESS_INT /* MD5-session authentication in use for body */ | |
137 | } http_auth_t; | |
138 | ||
139 | typedef enum http_encoding_e /**** HTTP transfer encoding values ****/ | |
140 | { | |
141 | HTTP_ENCODE_LENGTH, /* Data is sent with Content-Length */ | |
142 | HTTP_ENCODE_CHUNKED /* Data is chunked */ | |
143 | } http_encoding_t; | |
144 | ||
145 | typedef enum http_encryption_e /**** HTTP encryption values ****/ | |
146 | { | |
147 | HTTP_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */ | |
148 | HTTP_ENCRYPT_NEVER, /* Never encrypt */ | |
149 | HTTP_ENCRYPT_REQUIRED, /* Encryption is required (TLS upgrade) */ | |
150 | HTTP_ENCRYPT_ALWAYS /* Always encrypt (SSL) */ | |
151 | } http_encryption_t; | |
152 | ||
153 | typedef enum http_field_e /**** HTTP field names ****/ | |
154 | { | |
155 | HTTP_FIELD_UNKNOWN = -1, /* Unknown field */ | |
156 | HTTP_FIELD_ACCEPT_LANGUAGE, /* Accept-Language field */ | |
157 | HTTP_FIELD_ACCEPT_RANGES, /* Accept-Ranges field */ | |
158 | HTTP_FIELD_AUTHORIZATION, /* Authorization field */ | |
159 | HTTP_FIELD_CONNECTION, /* Connection field */ | |
160 | HTTP_FIELD_CONTENT_ENCODING, /* Content-Encoding field */ | |
161 | HTTP_FIELD_CONTENT_LANGUAGE, /* Content-Language field */ | |
162 | HTTP_FIELD_CONTENT_LENGTH, /* Content-Length field */ | |
163 | HTTP_FIELD_CONTENT_LOCATION, /* Content-Location field */ | |
164 | HTTP_FIELD_CONTENT_MD5, /* Content-MD5 field */ | |
165 | HTTP_FIELD_CONTENT_RANGE, /* Content-Range field */ | |
166 | HTTP_FIELD_CONTENT_TYPE, /* Content-Type field */ | |
167 | HTTP_FIELD_CONTENT_VERSION, /* Content-Version field */ | |
168 | HTTP_FIELD_DATE, /* Date field */ | |
169 | HTTP_FIELD_HOST, /* Host field */ | |
170 | HTTP_FIELD_IF_MODIFIED_SINCE, /* If-Modified-Since field */ | |
171 | HTTP_FIELD_IF_UNMODIFIED_SINCE, /* If-Unmodified-Since field */ | |
172 | HTTP_FIELD_KEEP_ALIVE, /* Keep-Alive field */ | |
173 | HTTP_FIELD_LAST_MODIFIED, /* Last-Modified field */ | |
174 | HTTP_FIELD_LINK, /* Link field */ | |
175 | HTTP_FIELD_LOCATION, /* Location field */ | |
176 | HTTP_FIELD_RANGE, /* Range field */ | |
177 | HTTP_FIELD_REFERER, /* Referer field */ | |
178 | HTTP_FIELD_RETRY_AFTER, /* Retry-After field */ | |
179 | HTTP_FIELD_TRANSFER_ENCODING, /* Transfer-Encoding field */ | |
180 | HTTP_FIELD_UPGRADE, /* Upgrade field */ | |
181 | HTTP_FIELD_USER_AGENT, /* User-Agent field */ | |
182 | HTTP_FIELD_WWW_AUTHENTICATE, /* WWW-Authenticate field */ | |
183 | HTTP_FIELD_MAX /* Maximum field index */ | |
184 | } http_field_t; | |
185 | ||
186 | typedef enum http_keepalive_e /**** HTTP keep-alive values ****/ | |
187 | { | |
188 | HTTP_KEEPALIVE_OFF = 0, /* No keep alive support */ | |
189 | HTTP_KEEPALIVE_ON /* Use keep alive */ | |
190 | } http_keepalive_t; | |
191 | ||
192 | typedef enum http_state_e /**** HTTP state values; states | |
193 | **** are server-oriented... | |
194 | ****/ | |
195 | { | |
196 | HTTP_WAITING, /* Waiting for command */ | |
197 | HTTP_OPTIONS, /* OPTIONS command, waiting for blank line */ | |
198 | HTTP_GET, /* GET command, waiting for blank line */ | |
199 | HTTP_GET_SEND, /* GET command, sending data */ | |
200 | HTTP_HEAD, /* HEAD command, waiting for blank line */ | |
201 | HTTP_POST, /* POST command, waiting for blank line */ | |
202 | HTTP_POST_RECV, /* POST command, receiving data */ | |
203 | HTTP_POST_SEND, /* POST command, sending data */ | |
204 | HTTP_PUT, /* PUT command, waiting for blank line */ | |
205 | HTTP_PUT_RECV, /* PUT command, receiving data */ | |
206 | HTTP_DELETE, /* DELETE command, waiting for blank line */ | |
207 | HTTP_TRACE, /* TRACE command, waiting for blank line */ | |
208 | HTTP_CLOSE, /* CLOSE command, waiting for blank line */ | |
209 | HTTP_STATUS /* Command complete, sending status */ | |
210 | } http_state_t; | |
211 | ||
212 | typedef enum http_status_e /**** HTTP status codes ****/ | |
213 | { | |
214 | HTTP_ERROR = -1, /* An error response from httpXxxx() */ | |
215 | ||
216 | HTTP_CONTINUE = 100, /* Everything OK, keep going... */ | |
217 | HTTP_SWITCHING_PROTOCOLS, /* HTTP upgrade to TLS/SSL */ | |
218 | ||
219 | HTTP_OK = 200, /* OPTIONS/GET/HEAD/POST/TRACE command was successful */ | |
220 | HTTP_CREATED, /* PUT command was successful */ | |
221 | HTTP_ACCEPTED, /* DELETE command was successful */ | |
222 | HTTP_NOT_AUTHORITATIVE, /* Information isn't authoritative */ | |
223 | HTTP_NO_CONTENT, /* Successful command, no new data */ | |
224 | HTTP_RESET_CONTENT, /* Content was reset/recreated */ | |
225 | HTTP_PARTIAL_CONTENT, /* Only a partial file was recieved/sent */ | |
226 | ||
227 | HTTP_MULTIPLE_CHOICES = 300, /* Multiple files match request */ | |
228 | HTTP_MOVED_PERMANENTLY, /* Document has moved permanently */ | |
229 | HTTP_MOVED_TEMPORARILY, /* Document has moved temporarily */ | |
230 | HTTP_SEE_OTHER, /* See this other link... */ | |
231 | HTTP_NOT_MODIFIED, /* File not modified */ | |
232 | HTTP_USE_PROXY, /* Must use a proxy to access this URI */ | |
233 | ||
234 | HTTP_BAD_REQUEST = 400, /* Bad request */ | |
235 | HTTP_UNAUTHORIZED, /* Unauthorized to access host */ | |
236 | HTTP_PAYMENT_REQUIRED, /* Payment required */ | |
237 | HTTP_FORBIDDEN, /* Forbidden to access this URI */ | |
238 | HTTP_NOT_FOUND, /* URI was not found */ | |
239 | HTTP_METHOD_NOT_ALLOWED, /* Method is not allowed */ | |
240 | HTTP_NOT_ACCEPTABLE, /* Not Acceptable */ | |
241 | HTTP_PROXY_AUTHENTICATION, /* Proxy Authentication is Required */ | |
242 | HTTP_REQUEST_TIMEOUT, /* Request timed out */ | |
243 | HTTP_CONFLICT, /* Request is self-conflicting */ | |
244 | HTTP_GONE, /* Server has gone away */ | |
245 | HTTP_LENGTH_REQUIRED, /* A content length or encoding is required */ | |
246 | HTTP_PRECONDITION, /* Precondition failed */ | |
247 | HTTP_REQUEST_TOO_LARGE, /* Request entity too large */ | |
248 | HTTP_URI_TOO_LONG, /* URI too long */ | |
249 | HTTP_UNSUPPORTED_MEDIATYPE, /* The requested media type is unsupported */ | |
b423cd4c | 250 | HTTP_REQUESTED_RANGE, /* The requested range is not satisfiable */ |
251 | HTTP_EXPECTATION_FAILED, /* The expectation given in an Expect header field was not met */ | |
ef416fc2 | 252 | HTTP_UPGRADE_REQUIRED = 426, /* Upgrade to SSL/TLS required */ |
253 | ||
254 | HTTP_SERVER_ERROR = 500, /* Internal server error */ | |
255 | HTTP_NOT_IMPLEMENTED, /* Feature not implemented */ | |
256 | HTTP_BAD_GATEWAY, /* Bad gateway */ | |
257 | HTTP_SERVICE_UNAVAILABLE, /* Service is unavailable */ | |
258 | HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */ | |
259 | HTTP_NOT_SUPPORTED /* HTTP version not supported */ | |
260 | } http_status_t; | |
261 | ||
262 | typedef enum http_uri_status_e /**** URI separation status @since CUPS1.2@ ****/ | |
263 | { | |
264 | HTTP_URI_OVERFLOW = -8, /* URI buffer for httpAssembleURI is too small */ | |
265 | HTTP_URI_BAD_ARGUMENTS = -7, /* Bad arguments to function (error) */ | |
266 | HTTP_URI_BAD_RESOURCE = -6, /* Bad resource in URI (error) */ | |
267 | HTTP_URI_BAD_PORT = -5, /* Bad port number in URI (error) */ | |
268 | HTTP_URI_BAD_HOSTNAME = -4, /* Bad hostname in URI (error) */ | |
269 | HTTP_URI_BAD_USERNAME = -3, /* Bad username in URI (error) */ | |
270 | HTTP_URI_BAD_SCHEME = -2, /* Bad scheme in URI (error) */ | |
271 | HTTP_URI_BAD_URI = -1, /* Bad/empty URI (error) */ | |
272 | HTTP_URI_OK = 0, /* URI decoded OK */ | |
273 | HTTP_URI_MISSING_SCHEME, /* Missing scheme in URI (warning) */ | |
274 | HTTP_URI_UNKNOWN_SCHEME, /* Unknown scheme in URI (warning) */ | |
275 | HTTP_URI_MISSING_RESOURCE /* Missing resource in URI (warning) */ | |
276 | } http_uri_status_t; | |
277 | ||
a4d04587 | 278 | typedef enum http_uri_coding_e /**** URI en/decode flags ****/ |
279 | { | |
280 | HTTP_URI_CODING_NONE = 0, /* Don't en/decode anything */ | |
281 | HTTP_URI_CODING_USERNAME = 1, /* En/decode the username portion */ | |
282 | HTTP_URI_CODING_HOSTNAME = 2, /* En/decode the hostname portion */ | |
283 | HTTP_URI_CODING_RESOURCE = 4, /* En/decode the resource portion */ | |
284 | HTTP_URI_CODING_MOST = 7, /* En/decode all but the query */ | |
285 | HTTP_URI_CODING_QUERY = 8, /* En/decode the query portion */ | |
286 | HTTP_URI_CODING_ALL = 15 /* En/decode everything */ | |
287 | } http_uri_coding_t; | |
288 | ||
ef416fc2 | 289 | typedef enum http_version_e /**** HTTP version numbers ****/ |
290 | { | |
291 | HTTP_0_9 = 9, /* HTTP/0.9 */ | |
292 | HTTP_1_0 = 100, /* HTTP/1.0 */ | |
293 | HTTP_1_1 = 101 /* HTTP/1.1 */ | |
294 | } http_version_t; | |
295 | ||
ecdc0628 | 296 | typedef union _http_addr_u /**** Socket address union, which |
ef416fc2 | 297 | **** makes using IPv6 and other |
298 | **** address types easier and | |
299 | **** more portable. @since CUPS 1.2@ | |
300 | ****/ | |
301 | { | |
302 | struct sockaddr addr; /* Base structure for family value */ | |
303 | struct sockaddr_in ipv4; /* IPv4 address */ | |
304 | #ifdef AF_INET6 | |
305 | struct sockaddr_in6 ipv6; /* IPv6 address */ | |
306 | #endif /* AF_INET6 */ | |
307 | #ifdef AF_LOCAL | |
308 | struct sockaddr_un un; /* Domain socket file */ | |
309 | #endif /* AF_LOCAL */ | |
310 | char pad[256]; /* Padding to ensure binary compatibility */ | |
311 | } http_addr_t; | |
312 | ||
313 | typedef struct http_addrlist_s /**** Socket address list, which is | |
314 | **** used to enumerate all of the | |
315 | **** addresses that are associated | |
316 | **** with a hostname. @since CUPS 1.2@ | |
317 | ****/ | |
318 | { | |
319 | struct http_addrlist_s *next; /* Pointer to next address in list */ | |
320 | http_addr_t addr; /* Address */ | |
321 | } http_addrlist_t; | |
322 | ||
f7faf1f5 | 323 | typedef struct _http_s /**** HTTP connection structure. ****/ |
324 | { | |
325 | /* | |
326 | * DO NOT ACCESS MEMBERS OF THIS STRUCTURE DIRECTLY; INSTEAD, USE THE | |
327 | * PROVIDED APIS FOR ACCESSING THE VALUES INSTEAD. | |
328 | * | |
329 | * This structure definition will be removed from the public headers in | |
330 | * CUPS 1.3. | |
331 | */ | |
332 | ||
333 | int fd; /* File descriptor for this socket */ | |
334 | int blocking; /* To block or not to block */ | |
335 | int error; /* Last error on read */ | |
336 | time_t activity; /* Time since last read/write */ | |
337 | http_state_t state; /* State of client */ | |
338 | http_status_t status; /* Status of last request */ | |
339 | http_version_t version; /* Protocol version */ | |
340 | http_keepalive_t keep_alive; /* Keep-alive supported? */ | |
341 | struct sockaddr_in _hostaddr; /* Address of connected host @deprecated@ */ | |
342 | char hostname[HTTP_MAX_HOST], | |
343 | /* Name of connected host */ | |
344 | fields[HTTP_FIELD_MAX][HTTP_MAX_VALUE]; | |
345 | /* Field values */ | |
346 | char *data; /* Pointer to data buffer */ | |
347 | http_encoding_t data_encoding; /* Chunked or not */ | |
348 | int _data_remaining;/* Number of bytes left @deprecated@ */ | |
349 | int used; /* Number of bytes used in buffer */ | |
350 | char buffer[HTTP_MAX_BUFFER]; | |
351 | /* Buffer for incoming data */ | |
352 | int auth_type; /* Authentication in use */ | |
353 | _cups_md5_state_t md5_state; /* MD5 state */ | |
354 | char nonce[HTTP_MAX_VALUE]; | |
355 | /* Nonce value */ | |
356 | int nonce_count; /* Nonce count */ | |
357 | void *tls; /* TLS state information */ | |
358 | http_encryption_t encryption; /* Encryption requirements */ | |
359 | /**** New in CUPS 1.1.19 ****/ | |
360 | fd_set *input_set; /* select() set for httpWait() @since CUPS 1.1.19@ */ | |
361 | http_status_t expect; /* Expect: header @since CUPS 1.1.19@ */ | |
362 | char *cookie; /* Cookie value(s) @since CUPS 1.1.19@ */ | |
363 | /**** New in CUPS 1.1.20 ****/ | |
364 | char authstring[HTTP_MAX_VALUE], | |
365 | /* Current Authentication value @since CUPS 1.1.20@ */ | |
366 | userpass[HTTP_MAX_VALUE]; | |
367 | /* Username:password string @since CUPS 1.1.20@ */ | |
368 | int digest_tries; /* Number of tries for digest auth @since CUPS 1.1.20@ */ | |
369 | /**** New in CUPS 1.2 ****/ | |
370 | off_t data_remaining; /* Number of bytes left @since CUPS 1.2@ */ | |
371 | http_addr_t *hostaddr; /* Current host address and port @since CUPS 1.2@ */ | |
372 | http_addrlist_t *addrlist; /* List of valid addresses @since CUPS 1.2@ */ | |
373 | char wbuffer[HTTP_MAX_BUFFER]; | |
374 | /* Buffer for outgoing data */ | |
375 | int wused; /* Write buffer bytes used @since CUPS 1.2@ */ | |
376 | } http_t; | |
ef416fc2 | 377 | |
378 | ||
379 | /* | |
380 | * Prototypes... | |
381 | */ | |
382 | ||
ecdc0628 | 383 | extern void httpBlocking(http_t *http, int b); |
ef416fc2 | 384 | extern int httpCheck(http_t *http); |
ecdc0628 | 385 | extern void httpClearFields(http_t *http); |
ef416fc2 | 386 | extern void httpClose(http_t *http); |
387 | extern http_t *httpConnect(const char *host, int port); | |
388 | extern http_t *httpConnectEncrypt(const char *host, int port, | |
389 | http_encryption_t encryption); | |
390 | extern int httpDelete(http_t *http, const char *uri); | |
391 | extern int httpEncryption(http_t *http, http_encryption_t e); | |
ecdc0628 | 392 | extern int httpError(http_t *http); |
ef416fc2 | 393 | extern void httpFlush(http_t *http); |
394 | extern int httpGet(http_t *http, const char *uri); | |
395 | extern char *httpGets(char *line, int length, http_t *http); | |
396 | extern const char *httpGetDateString(time_t t); | |
397 | extern time_t httpGetDateTime(const char *s); | |
ecdc0628 | 398 | extern const char *httpGetField(http_t *http, http_field_t field); |
ef416fc2 | 399 | extern struct hostent *httpGetHostByName(const char *name); |
400 | extern char *httpGetSubField(http_t *http, http_field_t field, | |
401 | const char *name, char *value); | |
402 | extern int httpHead(http_t *http, const char *uri); | |
403 | extern void httpInitialize(void); | |
404 | extern int httpOptions(http_t *http, const char *uri); | |
405 | extern int httpPost(http_t *http, const char *uri); | |
406 | extern int httpPrintf(http_t *http, const char *format, ...) | |
407 | # ifdef __GNUC__ | |
408 | __attribute__ ((__format__ (__printf__, 2, 3))) | |
409 | # endif /* __GNUC__ */ | |
410 | ; | |
411 | extern int httpPut(http_t *http, const char *uri); | |
a4d04587 | 412 | extern int httpRead(http_t *http, char *buffer, int length) _HTTP_DEPRECATED; |
ef416fc2 | 413 | extern int httpReconnect(http_t *http); |
414 | extern void httpSeparate(const char *uri, char *method, | |
415 | char *username, char *host, int *port, | |
416 | char *resource) _HTTP_DEPRECATED; | |
417 | extern void httpSetField(http_t *http, http_field_t field, | |
418 | const char *value); | |
419 | extern const char *httpStatus(http_status_t status); | |
420 | extern int httpTrace(http_t *http, const char *uri); | |
421 | extern http_status_t httpUpdate(http_t *http); | |
a4d04587 | 422 | extern int httpWrite(http_t *http, const char *buffer, int length) _HTTP_DEPRECATED; |
ef416fc2 | 423 | extern char *httpEncode64(char *out, const char *in) _HTTP_DEPRECATED; |
424 | extern char *httpDecode64(char *out, const char *in) _HTTP_DEPRECATED; | |
425 | extern int httpGetLength(http_t *http) _HTTP_DEPRECATED; | |
426 | extern char *httpMD5(const char *, const char *, const char *, | |
427 | char [33]); | |
428 | extern char *httpMD5Final(const char *, const char *, const char *, | |
429 | char [33]); | |
430 | extern char *httpMD5String(const unsigned char *, char [33]); | |
431 | ||
432 | /**** New in CUPS 1.1.19 ****/ | |
433 | extern void httpClearCookie(http_t *http); | |
ecdc0628 | 434 | extern const char *httpGetCookie(http_t *http); |
ef416fc2 | 435 | extern void httpSetCookie(http_t *http, const char *cookie); |
436 | extern int httpWait(http_t *http, int msec); | |
437 | ||
438 | /**** New in CUPS 1.1.21 ****/ | |
439 | extern char *httpDecode64_2(char *out, int *outlen, const char *in); | |
440 | extern char *httpEncode64_2(char *out, int outlen, const char *in, | |
441 | int inlen); | |
442 | extern void httpSeparate2(const char *uri, | |
443 | char *method, int methodlen, | |
444 | char *username, int usernamelen, | |
445 | char *host, int hostlen, int *port, | |
446 | char *resource, int resourcelen) _HTTP_DEPRECATED; | |
447 | ||
448 | /**** New in CUPS 1.2 ****/ | |
449 | extern int httpAddrAny(const http_addr_t *addr); | |
450 | extern http_addrlist_t *httpAddrConnect(http_addrlist_t *addrlist, int *sock); | |
451 | extern int httpAddrEqual(const http_addr_t *addr1, | |
452 | const http_addr_t *addr2); | |
453 | extern void httpAddrFreeList(http_addrlist_t *addrlist); | |
454 | extern http_addrlist_t *httpAddrGetList(const char *hostname, int family, | |
455 | const char *service); | |
456 | extern int httpAddrLength(const http_addr_t *addr); | |
457 | extern int httpAddrLocalhost(const http_addr_t *addr); | |
458 | extern char *httpAddrLookup(const http_addr_t *addr, | |
459 | char *name, int namelen); | |
460 | extern char *httpAddrString(const http_addr_t *addr, | |
461 | char *s, int slen); | |
a4d04587 | 462 | extern http_uri_status_t httpAssembleURI(http_uri_coding_t encoding, |
463 | char *uri, int urilen, | |
ef416fc2 | 464 | const char *scheme, |
465 | const char *username, | |
466 | const char *host, int port, | |
467 | const char *resource); | |
a4d04587 | 468 | extern http_uri_status_t httpAssembleURIf(http_uri_coding_t encoding, |
469 | char *uri, int urilen, | |
ef416fc2 | 470 | const char *scheme, |
471 | const char *username, | |
472 | const char *host, int port, | |
473 | const char *resourcef, ...); | |
474 | extern int httpFlushWrite(http_t *http); | |
ecdc0628 | 475 | extern int httpGetBlocking(http_t *http); |
ef416fc2 | 476 | extern const char *httpGetDateString2(time_t t, char *s, int slen); |
ecdc0628 | 477 | extern int httpGetFd(http_t *http); |
757d2cad | 478 | extern const char *httpGetHostname(http_t *http, char *s, int slen); |
ef416fc2 | 479 | extern off_t httpGetLength2(http_t *http); |
ecdc0628 | 480 | extern http_status_t httpGetStatus(http_t *http); |
ef416fc2 | 481 | extern char *httpGetSubField2(http_t *http, http_field_t field, |
482 | const char *name, char *value, | |
483 | int valuelen); | |
a4d04587 | 484 | extern ssize_t httpRead2(http_t *http, char *buffer, size_t length); |
485 | extern http_uri_status_t httpSeparateURI(http_uri_coding_t decoding, | |
486 | const char *uri, | |
ef416fc2 | 487 | char *scheme, int schemelen, |
488 | char *username, int usernamelen, | |
489 | char *host, int hostlen, int *port, | |
490 | char *resource, int resourcelen); | |
b423cd4c | 491 | extern void httpSetExpect(http_t *http, http_status_t expect); |
ef416fc2 | 492 | extern void httpSetLength(http_t *http, size_t length); |
a4d04587 | 493 | extern ssize_t httpWrite2(http_t *http, const char *buffer, |
494 | size_t length); | |
ef416fc2 | 495 | |
496 | ||
497 | /* | |
498 | * C++ magic... | |
499 | */ | |
500 | ||
501 | # ifdef __cplusplus | |
502 | } | |
503 | # endif /* __cplusplus */ | |
504 | #endif /* !_CUPS_HTTP_H_ */ | |
505 | ||
506 | /* | |
8ca02f3c | 507 | * End of "$Id: http.h 5716 2006-07-11 17:56:57Z mike $". |
ef416fc2 | 508 | */ |