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