]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
bc44d920 | 2 | * "$Id: http.h 6649 2007-07-11 21:46:42Z mike $" |
ef416fc2 | 3 | * |
4 | * Hyper-Text Transport Protocol definitions for the Common UNIX Printing | |
5 | * System (CUPS). | |
6 | * | |
bc44d920 | 7 | * Copyright 2007 by Apple Inc. |
b86bc4cf | 8 | * Copyright 1997-2007 by Easy Software Products, all rights reserved. |
ef416fc2 | 9 | * |
10 | * These coded instructions, statements, and computer programs are the | |
bc44d920 | 11 | * property of Apple Inc. and are protected by Federal copyright |
12 | * law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
13 | * which should have been included with this file. If this file is | |
14 | * file is missing or damaged, see the license at "http://www.cups.org/". | |
ef416fc2 | 15 | * |
16 | * This file is subject to the Apple OS-Developed Software exception. | |
17 | */ | |
18 | ||
19 | #ifndef _CUPS_HTTP_H_ | |
20 | # define _CUPS_HTTP_H_ | |
21 | ||
22 | /* | |
23 | * Include necessary headers... | |
24 | */ | |
25 | ||
26 | # include <string.h> | |
27 | # include <time.h> | |
28 | # include <sys/types.h> | |
29 | # ifdef WIN32 | |
b86bc4cf | 30 | # ifndef __CUPS_SSIZE_T_DEFINED |
31 | # define __CUPS_SSIZE_T_DEFINED | |
32 | /* Windows does not support the ssize_t type, so map it to off_t... */ | |
33 | typedef off_t ssize_t; /* @private@ */ | |
34 | # endif /* !__CUPS_SSIZE_T_DEFINED */ | |
ef416fc2 | 35 | # include <winsock2.h> |
36 | # include <ws2tcpip.h> | |
37 | # else | |
d09495fa | 38 | # ifdef __sgi |
39 | # define INET6 /* IRIX IPv6 support... */ | |
e1d6a774 | 40 | # endif /* __sgi */ |
ef416fc2 | 41 | # include <unistd.h> |
42 | # include <sys/time.h> | |
43 | # include <sys/socket.h> | |
44 | # include <netdb.h> | |
45 | # include <netinet/in.h> | |
46 | # include <arpa/inet.h> | |
47 | # include <netinet/in_systm.h> | |
48 | # include <netinet/ip.h> | |
49 | # if !defined(__APPLE__) || !defined(TCP_NODELAY) | |
50 | # include <netinet/tcp.h> | |
51 | # endif /* !__APPLE__ || !TCP_NODELAY */ | |
d09495fa | 52 | # if defined(AF_UNIX) && !defined(AF_LOCAL) |
53 | # define AF_LOCAL AF_UNIX /* Older UNIX's have old names... */ | |
54 | # endif /* AF_UNIX && !AF_LOCAL */ | |
ef416fc2 | 55 | # ifdef AF_LOCAL |
56 | # include <sys/un.h> | |
57 | # endif /* AF_LOCAL */ | |
bc44d920 | 58 | # if defined(LOCAL_PEERCRED) && !defined(SO_PEERCRED) |
59 | # define SO_PEERCRED LOCAL_PEERCRED | |
60 | # endif /* LOCAL_PEERCRED && !SO_PEERCRED */ | |
ef416fc2 | 61 | # endif /* WIN32 */ |
62 | ||
ef416fc2 | 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 */ | |
f7deaa1a | 136 | HTTP_AUTH_MD5_SESS_INT, /* MD5-session authentication in use for body */ |
137 | HTTP_AUTH_NEGOTIATE /* GSSAPI authentication in use @since CUPS 1.3@ */ | |
ef416fc2 | 138 | } http_auth_t; |
139 | ||
140 | typedef enum http_encoding_e /**** HTTP transfer encoding values ****/ | |
141 | { | |
142 | HTTP_ENCODE_LENGTH, /* Data is sent with Content-Length */ | |
d09495fa | 143 | HTTP_ENCODE_CHUNKED, /* Data is chunked */ |
144 | HTTP_ENCODE_FIELDS /* Sending HTTP fields */ | |
ef416fc2 | 145 | } http_encoding_t; |
146 | ||
147 | typedef enum http_encryption_e /**** HTTP encryption values ****/ | |
148 | { | |
149 | HTTP_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */ | |
150 | HTTP_ENCRYPT_NEVER, /* Never encrypt */ | |
151 | HTTP_ENCRYPT_REQUIRED, /* Encryption is required (TLS upgrade) */ | |
152 | HTTP_ENCRYPT_ALWAYS /* Always encrypt (SSL) */ | |
153 | } http_encryption_t; | |
154 | ||
155 | typedef enum http_field_e /**** HTTP field names ****/ | |
156 | { | |
157 | HTTP_FIELD_UNKNOWN = -1, /* Unknown field */ | |
158 | HTTP_FIELD_ACCEPT_LANGUAGE, /* Accept-Language field */ | |
159 | HTTP_FIELD_ACCEPT_RANGES, /* Accept-Ranges field */ | |
160 | HTTP_FIELD_AUTHORIZATION, /* Authorization field */ | |
161 | HTTP_FIELD_CONNECTION, /* Connection field */ | |
162 | HTTP_FIELD_CONTENT_ENCODING, /* Content-Encoding field */ | |
163 | HTTP_FIELD_CONTENT_LANGUAGE, /* Content-Language field */ | |
164 | HTTP_FIELD_CONTENT_LENGTH, /* Content-Length field */ | |
165 | HTTP_FIELD_CONTENT_LOCATION, /* Content-Location field */ | |
166 | HTTP_FIELD_CONTENT_MD5, /* Content-MD5 field */ | |
167 | HTTP_FIELD_CONTENT_RANGE, /* Content-Range field */ | |
168 | HTTP_FIELD_CONTENT_TYPE, /* Content-Type field */ | |
169 | HTTP_FIELD_CONTENT_VERSION, /* Content-Version field */ | |
170 | HTTP_FIELD_DATE, /* Date field */ | |
171 | HTTP_FIELD_HOST, /* Host field */ | |
172 | HTTP_FIELD_IF_MODIFIED_SINCE, /* If-Modified-Since field */ | |
173 | HTTP_FIELD_IF_UNMODIFIED_SINCE, /* If-Unmodified-Since field */ | |
174 | HTTP_FIELD_KEEP_ALIVE, /* Keep-Alive field */ | |
175 | HTTP_FIELD_LAST_MODIFIED, /* Last-Modified field */ | |
176 | HTTP_FIELD_LINK, /* Link field */ | |
177 | HTTP_FIELD_LOCATION, /* Location field */ | |
178 | HTTP_FIELD_RANGE, /* Range field */ | |
179 | HTTP_FIELD_REFERER, /* Referer field */ | |
180 | HTTP_FIELD_RETRY_AFTER, /* Retry-After field */ | |
181 | HTTP_FIELD_TRANSFER_ENCODING, /* Transfer-Encoding field */ | |
182 | HTTP_FIELD_UPGRADE, /* Upgrade field */ | |
183 | HTTP_FIELD_USER_AGENT, /* User-Agent field */ | |
184 | HTTP_FIELD_WWW_AUTHENTICATE, /* WWW-Authenticate field */ | |
185 | HTTP_FIELD_MAX /* Maximum field index */ | |
186 | } http_field_t; | |
187 | ||
188 | typedef enum http_keepalive_e /**** HTTP keep-alive values ****/ | |
189 | { | |
190 | HTTP_KEEPALIVE_OFF = 0, /* No keep alive support */ | |
191 | HTTP_KEEPALIVE_ON /* Use keep alive */ | |
192 | } http_keepalive_t; | |
193 | ||
194 | typedef enum http_state_e /**** HTTP state values; states | |
195 | **** are server-oriented... | |
196 | ****/ | |
197 | { | |
198 | HTTP_WAITING, /* Waiting for command */ | |
199 | HTTP_OPTIONS, /* OPTIONS command, waiting for blank line */ | |
200 | HTTP_GET, /* GET command, waiting for blank line */ | |
201 | HTTP_GET_SEND, /* GET command, sending data */ | |
202 | HTTP_HEAD, /* HEAD command, waiting for blank line */ | |
203 | HTTP_POST, /* POST command, waiting for blank line */ | |
204 | HTTP_POST_RECV, /* POST command, receiving data */ | |
205 | HTTP_POST_SEND, /* POST command, sending data */ | |
206 | HTTP_PUT, /* PUT command, waiting for blank line */ | |
207 | HTTP_PUT_RECV, /* PUT command, receiving data */ | |
208 | HTTP_DELETE, /* DELETE command, waiting for blank line */ | |
209 | HTTP_TRACE, /* TRACE command, waiting for blank line */ | |
210 | HTTP_CLOSE, /* CLOSE command, waiting for blank line */ | |
211 | HTTP_STATUS /* Command complete, sending status */ | |
212 | } http_state_t; | |
213 | ||
214 | typedef enum http_status_e /**** HTTP status codes ****/ | |
215 | { | |
216 | HTTP_ERROR = -1, /* An error response from httpXxxx() */ | |
217 | ||
218 | HTTP_CONTINUE = 100, /* Everything OK, keep going... */ | |
219 | HTTP_SWITCHING_PROTOCOLS, /* HTTP upgrade to TLS/SSL */ | |
220 | ||
221 | HTTP_OK = 200, /* OPTIONS/GET/HEAD/POST/TRACE command was successful */ | |
222 | HTTP_CREATED, /* PUT command was successful */ | |
223 | HTTP_ACCEPTED, /* DELETE command was successful */ | |
224 | HTTP_NOT_AUTHORITATIVE, /* Information isn't authoritative */ | |
225 | HTTP_NO_CONTENT, /* Successful command, no new data */ | |
226 | HTTP_RESET_CONTENT, /* Content was reset/recreated */ | |
227 | HTTP_PARTIAL_CONTENT, /* Only a partial file was recieved/sent */ | |
228 | ||
229 | HTTP_MULTIPLE_CHOICES = 300, /* Multiple files match request */ | |
230 | HTTP_MOVED_PERMANENTLY, /* Document has moved permanently */ | |
231 | HTTP_MOVED_TEMPORARILY, /* Document has moved temporarily */ | |
232 | HTTP_SEE_OTHER, /* See this other link... */ | |
233 | HTTP_NOT_MODIFIED, /* File not modified */ | |
234 | HTTP_USE_PROXY, /* Must use a proxy to access this URI */ | |
235 | ||
236 | HTTP_BAD_REQUEST = 400, /* Bad request */ | |
237 | HTTP_UNAUTHORIZED, /* Unauthorized to access host */ | |
238 | HTTP_PAYMENT_REQUIRED, /* Payment required */ | |
239 | HTTP_FORBIDDEN, /* Forbidden to access this URI */ | |
240 | HTTP_NOT_FOUND, /* URI was not found */ | |
241 | HTTP_METHOD_NOT_ALLOWED, /* Method is not allowed */ | |
242 | HTTP_NOT_ACCEPTABLE, /* Not Acceptable */ | |
243 | HTTP_PROXY_AUTHENTICATION, /* Proxy Authentication is Required */ | |
244 | HTTP_REQUEST_TIMEOUT, /* Request timed out */ | |
245 | HTTP_CONFLICT, /* Request is self-conflicting */ | |
246 | HTTP_GONE, /* Server has gone away */ | |
247 | HTTP_LENGTH_REQUIRED, /* A content length or encoding is required */ | |
248 | HTTP_PRECONDITION, /* Precondition failed */ | |
249 | HTTP_REQUEST_TOO_LARGE, /* Request entity too large */ | |
250 | HTTP_URI_TOO_LONG, /* URI too long */ | |
251 | HTTP_UNSUPPORTED_MEDIATYPE, /* The requested media type is unsupported */ | |
b423cd4c | 252 | HTTP_REQUESTED_RANGE, /* The requested range is not satisfiable */ |
253 | HTTP_EXPECTATION_FAILED, /* The expectation given in an Expect header field was not met */ | |
ef416fc2 | 254 | HTTP_UPGRADE_REQUIRED = 426, /* Upgrade to SSL/TLS required */ |
255 | ||
256 | HTTP_SERVER_ERROR = 500, /* Internal server error */ | |
257 | HTTP_NOT_IMPLEMENTED, /* Feature not implemented */ | |
258 | HTTP_BAD_GATEWAY, /* Bad gateway */ | |
259 | HTTP_SERVICE_UNAVAILABLE, /* Service is unavailable */ | |
260 | HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */ | |
261 | HTTP_NOT_SUPPORTED /* HTTP version not supported */ | |
262 | } http_status_t; | |
263 | ||
264 | typedef enum http_uri_status_e /**** URI separation status @since CUPS1.2@ ****/ | |
265 | { | |
266 | HTTP_URI_OVERFLOW = -8, /* URI buffer for httpAssembleURI is too small */ | |
267 | HTTP_URI_BAD_ARGUMENTS = -7, /* Bad arguments to function (error) */ | |
268 | HTTP_URI_BAD_RESOURCE = -6, /* Bad resource in URI (error) */ | |
269 | HTTP_URI_BAD_PORT = -5, /* Bad port number in URI (error) */ | |
270 | HTTP_URI_BAD_HOSTNAME = -4, /* Bad hostname in URI (error) */ | |
271 | HTTP_URI_BAD_USERNAME = -3, /* Bad username in URI (error) */ | |
272 | HTTP_URI_BAD_SCHEME = -2, /* Bad scheme in URI (error) */ | |
273 | HTTP_URI_BAD_URI = -1, /* Bad/empty URI (error) */ | |
274 | HTTP_URI_OK = 0, /* URI decoded OK */ | |
275 | HTTP_URI_MISSING_SCHEME, /* Missing scheme in URI (warning) */ | |
276 | HTTP_URI_UNKNOWN_SCHEME, /* Unknown scheme in URI (warning) */ | |
277 | HTTP_URI_MISSING_RESOURCE /* Missing resource in URI (warning) */ | |
278 | } http_uri_status_t; | |
279 | ||
a4d04587 | 280 | typedef enum http_uri_coding_e /**** URI en/decode flags ****/ |
281 | { | |
282 | HTTP_URI_CODING_NONE = 0, /* Don't en/decode anything */ | |
283 | HTTP_URI_CODING_USERNAME = 1, /* En/decode the username portion */ | |
284 | HTTP_URI_CODING_HOSTNAME = 2, /* En/decode the hostname portion */ | |
285 | HTTP_URI_CODING_RESOURCE = 4, /* En/decode the resource portion */ | |
286 | HTTP_URI_CODING_MOST = 7, /* En/decode all but the query */ | |
287 | HTTP_URI_CODING_QUERY = 8, /* En/decode the query portion */ | |
288 | HTTP_URI_CODING_ALL = 15 /* En/decode everything */ | |
289 | } http_uri_coding_t; | |
290 | ||
ef416fc2 | 291 | typedef enum http_version_e /**** HTTP version numbers ****/ |
292 | { | |
293 | HTTP_0_9 = 9, /* HTTP/0.9 */ | |
294 | HTTP_1_0 = 100, /* HTTP/1.0 */ | |
295 | HTTP_1_1 = 101 /* HTTP/1.1 */ | |
296 | } http_version_t; | |
297 | ||
ecdc0628 | 298 | typedef union _http_addr_u /**** Socket address union, which |
ef416fc2 | 299 | **** makes using IPv6 and other |
300 | **** address types easier and | |
301 | **** more portable. @since CUPS 1.2@ | |
302 | ****/ | |
303 | { | |
304 | struct sockaddr addr; /* Base structure for family value */ | |
305 | struct sockaddr_in ipv4; /* IPv4 address */ | |
306 | #ifdef AF_INET6 | |
307 | struct sockaddr_in6 ipv6; /* IPv6 address */ | |
308 | #endif /* AF_INET6 */ | |
309 | #ifdef AF_LOCAL | |
310 | struct sockaddr_un un; /* Domain socket file */ | |
311 | #endif /* AF_LOCAL */ | |
312 | char pad[256]; /* Padding to ensure binary compatibility */ | |
313 | } http_addr_t; | |
314 | ||
315 | typedef struct http_addrlist_s /**** Socket address list, which is | |
316 | **** used to enumerate all of the | |
317 | **** addresses that are associated | |
318 | **** with a hostname. @since CUPS 1.2@ | |
319 | ****/ | |
320 | { | |
321 | struct http_addrlist_s *next; /* Pointer to next address in list */ | |
322 | http_addr_t addr; /* Address */ | |
323 | } http_addrlist_t; | |
324 | ||
f7deaa1a | 325 | typedef struct _http_s http_t; /**** HTTP connection type ****/ |
ef416fc2 | 326 | |
327 | ||
328 | /* | |
329 | * Prototypes... | |
330 | */ | |
331 | ||
ecdc0628 | 332 | extern void httpBlocking(http_t *http, int b); |
ef416fc2 | 333 | extern int httpCheck(http_t *http); |
ecdc0628 | 334 | extern void httpClearFields(http_t *http); |
ef416fc2 | 335 | extern void httpClose(http_t *http); |
336 | extern http_t *httpConnect(const char *host, int port); | |
337 | extern http_t *httpConnectEncrypt(const char *host, int port, | |
338 | http_encryption_t encryption); | |
339 | extern int httpDelete(http_t *http, const char *uri); | |
340 | extern int httpEncryption(http_t *http, http_encryption_t e); | |
ecdc0628 | 341 | extern int httpError(http_t *http); |
ef416fc2 | 342 | extern void httpFlush(http_t *http); |
343 | extern int httpGet(http_t *http, const char *uri); | |
344 | extern char *httpGets(char *line, int length, http_t *http); | |
345 | extern const char *httpGetDateString(time_t t); | |
346 | extern time_t httpGetDateTime(const char *s); | |
ecdc0628 | 347 | extern const char *httpGetField(http_t *http, http_field_t field); |
ef416fc2 | 348 | extern struct hostent *httpGetHostByName(const char *name); |
349 | extern char *httpGetSubField(http_t *http, http_field_t field, | |
350 | const char *name, char *value); | |
351 | extern int httpHead(http_t *http, const char *uri); | |
352 | extern void httpInitialize(void); | |
353 | extern int httpOptions(http_t *http, const char *uri); | |
354 | extern int httpPost(http_t *http, const char *uri); | |
355 | extern int httpPrintf(http_t *http, const char *format, ...) | |
356 | # ifdef __GNUC__ | |
357 | __attribute__ ((__format__ (__printf__, 2, 3))) | |
358 | # endif /* __GNUC__ */ | |
359 | ; | |
360 | extern int httpPut(http_t *http, const char *uri); | |
a4d04587 | 361 | extern int httpRead(http_t *http, char *buffer, int length) _HTTP_DEPRECATED; |
ef416fc2 | 362 | extern int httpReconnect(http_t *http); |
363 | extern void httpSeparate(const char *uri, char *method, | |
364 | char *username, char *host, int *port, | |
365 | char *resource) _HTTP_DEPRECATED; | |
366 | extern void httpSetField(http_t *http, http_field_t field, | |
367 | const char *value); | |
368 | extern const char *httpStatus(http_status_t status); | |
369 | extern int httpTrace(http_t *http, const char *uri); | |
370 | extern http_status_t httpUpdate(http_t *http); | |
a4d04587 | 371 | extern int httpWrite(http_t *http, const char *buffer, int length) _HTTP_DEPRECATED; |
ef416fc2 | 372 | extern char *httpEncode64(char *out, const char *in) _HTTP_DEPRECATED; |
373 | extern char *httpDecode64(char *out, const char *in) _HTTP_DEPRECATED; | |
374 | extern int httpGetLength(http_t *http) _HTTP_DEPRECATED; | |
375 | extern char *httpMD5(const char *, const char *, const char *, | |
376 | char [33]); | |
377 | extern char *httpMD5Final(const char *, const char *, const char *, | |
378 | char [33]); | |
379 | extern char *httpMD5String(const unsigned char *, char [33]); | |
380 | ||
381 | /**** New in CUPS 1.1.19 ****/ | |
382 | extern void httpClearCookie(http_t *http); | |
ecdc0628 | 383 | extern const char *httpGetCookie(http_t *http); |
ef416fc2 | 384 | extern void httpSetCookie(http_t *http, const char *cookie); |
385 | extern int httpWait(http_t *http, int msec); | |
386 | ||
387 | /**** New in CUPS 1.1.21 ****/ | |
388 | extern char *httpDecode64_2(char *out, int *outlen, const char *in); | |
389 | extern char *httpEncode64_2(char *out, int outlen, const char *in, | |
390 | int inlen); | |
391 | extern void httpSeparate2(const char *uri, | |
392 | char *method, int methodlen, | |
393 | char *username, int usernamelen, | |
394 | char *host, int hostlen, int *port, | |
395 | char *resource, int resourcelen) _HTTP_DEPRECATED; | |
396 | ||
397 | /**** New in CUPS 1.2 ****/ | |
398 | extern int httpAddrAny(const http_addr_t *addr); | |
399 | extern http_addrlist_t *httpAddrConnect(http_addrlist_t *addrlist, int *sock); | |
400 | extern int httpAddrEqual(const http_addr_t *addr1, | |
401 | const http_addr_t *addr2); | |
402 | extern void httpAddrFreeList(http_addrlist_t *addrlist); | |
403 | extern http_addrlist_t *httpAddrGetList(const char *hostname, int family, | |
404 | const char *service); | |
405 | extern int httpAddrLength(const http_addr_t *addr); | |
406 | extern int httpAddrLocalhost(const http_addr_t *addr); | |
407 | extern char *httpAddrLookup(const http_addr_t *addr, | |
408 | char *name, int namelen); | |
409 | extern char *httpAddrString(const http_addr_t *addr, | |
410 | char *s, int slen); | |
a4d04587 | 411 | extern http_uri_status_t httpAssembleURI(http_uri_coding_t encoding, |
412 | char *uri, int urilen, | |
ef416fc2 | 413 | const char *scheme, |
414 | const char *username, | |
415 | const char *host, int port, | |
416 | const char *resource); | |
a4d04587 | 417 | extern http_uri_status_t httpAssembleURIf(http_uri_coding_t encoding, |
418 | char *uri, int urilen, | |
ef416fc2 | 419 | const char *scheme, |
420 | const char *username, | |
421 | const char *host, int port, | |
422 | const char *resourcef, ...); | |
423 | extern int httpFlushWrite(http_t *http); | |
ecdc0628 | 424 | extern int httpGetBlocking(http_t *http); |
ef416fc2 | 425 | extern const char *httpGetDateString2(time_t t, char *s, int slen); |
ecdc0628 | 426 | extern int httpGetFd(http_t *http); |
757d2cad | 427 | extern const char *httpGetHostname(http_t *http, char *s, int slen); |
ef416fc2 | 428 | extern off_t httpGetLength2(http_t *http); |
ecdc0628 | 429 | extern http_status_t httpGetStatus(http_t *http); |
ef416fc2 | 430 | extern char *httpGetSubField2(http_t *http, http_field_t field, |
431 | const char *name, char *value, | |
432 | int valuelen); | |
a4d04587 | 433 | extern ssize_t httpRead2(http_t *http, char *buffer, size_t length); |
434 | extern http_uri_status_t httpSeparateURI(http_uri_coding_t decoding, | |
435 | const char *uri, | |
ef416fc2 | 436 | char *scheme, int schemelen, |
437 | char *username, int usernamelen, | |
438 | char *host, int hostlen, int *port, | |
439 | char *resource, int resourcelen); | |
b423cd4c | 440 | extern void httpSetExpect(http_t *http, http_status_t expect); |
ef416fc2 | 441 | extern void httpSetLength(http_t *http, size_t length); |
a4d04587 | 442 | extern ssize_t httpWrite2(http_t *http, const char *buffer, |
443 | size_t length); | |
ef416fc2 | 444 | |
445 | ||
446 | /* | |
447 | * C++ magic... | |
448 | */ | |
449 | ||
450 | # ifdef __cplusplus | |
451 | } | |
452 | # endif /* __cplusplus */ | |
453 | #endif /* !_CUPS_HTTP_H_ */ | |
454 | ||
455 | /* | |
bc44d920 | 456 | * End of "$Id: http.h 6649 2007-07-11 21:46:42Z mike $". |
ef416fc2 | 457 | */ |