1355b4669Sjacobs /* 2355b4669Sjacobs * "$Id: http.h 148 2006-04-25 16:54:17Z njacobs $" 3355b4669Sjacobs * 4355b4669Sjacobs * Hyper-Text Transport Protocol definitions for the Common UNIX Printing 5355b4669Sjacobs * System (CUPS). 6355b4669Sjacobs * 7355b4669Sjacobs * Copyright 1997-2005 by Easy Software Products, all rights reserved. 8355b4669Sjacobs * 9355b4669Sjacobs * These coded instructions, statements, and computer programs are the 10355b4669Sjacobs * property of Easy Software Products and are protected by Federal 11355b4669Sjacobs * copyright law. Distribution and use rights are outlined in the file 12355b4669Sjacobs * "LICENSE.txt" which should have been included with this file. If this 13355b4669Sjacobs * file is missing or damaged please contact Easy Software Products 14355b4669Sjacobs * at: 15355b4669Sjacobs * 16355b4669Sjacobs * Attn: CUPS Licensing Information 17355b4669Sjacobs * Easy Software Products 18355b4669Sjacobs * 44141 Airport View Drive, Suite 204 19355b4669Sjacobs * Hollywood, Maryland 20636 USA 20355b4669Sjacobs * 21355b4669Sjacobs * Voice: (301) 373-9600 22355b4669Sjacobs * EMail: cups-info@cups.org 23355b4669Sjacobs * WWW: http://www.cups.org 24355b4669Sjacobs * 25355b4669Sjacobs * This file is subject to the Apple OS-Developed Software exception. 26355b4669Sjacobs */ 27355b4669Sjacobs 28355b4669Sjacobs #ifndef _CUPS_HTTP_H_ 29355b4669Sjacobs #define _CUPS_HTTP_H_ 30355b4669Sjacobs 31355b4669Sjacobs /* 32355b4669Sjacobs * Include necessary headers... 33355b4669Sjacobs */ 34355b4669Sjacobs 35355b4669Sjacobs # include <string.h> 36355b4669Sjacobs # include <time.h> 37355b4669Sjacobs # ifdef WIN32 38355b4669Sjacobs # include <winsock.h> 39355b4669Sjacobs # else 40355b4669Sjacobs # include <unistd.h> 41355b4669Sjacobs # include <sys/time.h> 42355b4669Sjacobs # include <sys/types.h> 43355b4669Sjacobs # include <sys/socket.h> 44355b4669Sjacobs # include <netdb.h> 45355b4669Sjacobs # include <netinet/in.h> 46355b4669Sjacobs # include <arpa/inet.h> 47355b4669Sjacobs # include <netinet/in_systm.h> 48355b4669Sjacobs # include <netinet/ip.h> 49355b4669Sjacobs # if !defined(__APPLE__) || !defined(TCP_NODELAY) 50355b4669Sjacobs # include <netinet/tcp.h> 51355b4669Sjacobs # endif /* !__APPLE__ || !TCP_NODELAY */ 52355b4669Sjacobs # ifdef AF_LOCAL 53355b4669Sjacobs # include <sys/un.h> 54355b4669Sjacobs # endif /* AF_LOCAL */ 55355b4669Sjacobs # endif /* WIN32 */ 56355b4669Sjacobs 57355b4669Sjacobs 58355b4669Sjacobs /* 59355b4669Sjacobs * C++ magic... 60355b4669Sjacobs */ 61355b4669Sjacobs 62355b4669Sjacobs #ifdef __cplusplus 63355b4669Sjacobs extern "C" { 64355b4669Sjacobs #endif 65355b4669Sjacobs 66355b4669Sjacobs 67355b4669Sjacobs /* 68355b4669Sjacobs * Oh, the wonderful world of IPv6 compatibility. Apparently some 69355b4669Sjacobs * implementations expose the (more logical) 32-bit address parts 70355b4669Sjacobs * to everyone, while others only expose it to kernel code... To 71355b4669Sjacobs * make supporting IPv6 even easier, each vendor chose different 72355b4669Sjacobs * core structure and union names, so the same defines or code 73355b4669Sjacobs * can't be used on all platforms. 74355b4669Sjacobs * 75355b4669Sjacobs * The following will likely need tweeking on new platforms that 76355b4669Sjacobs * support IPv6 - the "s6_addr32" define maps to the 32-bit integer 77355b4669Sjacobs * array in the in6_addr union, which is named differently on various 78355b4669Sjacobs * platforms. 79355b4669Sjacobs */ 80355b4669Sjacobs 81355b4669Sjacobs #if defined(AF_INET6) && !defined(s6_addr32) 82355b4669Sjacobs # if defined(__sun) 83355b4669Sjacobs # define s6_addr32 _S6_un._S6_u32 84355b4669Sjacobs # elif defined(__FreeBSD__) || defined(__APPLE__) 85355b4669Sjacobs # define s6_addr32 __u6_addr.__u6_addr32 86355b4669Sjacobs # endif /* __sun */ 87355b4669Sjacobs #endif /* AF_INET6 && !s6_addr32 */ 88355b4669Sjacobs 89355b4669Sjacobs 90355b4669Sjacobs /* 91355b4669Sjacobs * Limits... 92355b4669Sjacobs */ 93355b4669Sjacobs 94355b4669Sjacobs # define HTTP_MAX_URI 1024 /* Max length of URI string */ 95355b4669Sjacobs # define HTTP_MAX_HOST 256 /* Max length of hostname string */ 96355b4669Sjacobs # define HTTP_MAX_BUFFER 2048 /* Max length of data buffer */ 97355b4669Sjacobs # define HTTP_MAX_VALUE 256 /* Max header field value length */ 98355b4669Sjacobs 99355b4669Sjacobs 100355b4669Sjacobs /* 101355b4669Sjacobs * HTTP state values... 102355b4669Sjacobs */ 103355b4669Sjacobs 104355b4669Sjacobs typedef enum /* States are server-oriented */ 105355b4669Sjacobs { 106355b4669Sjacobs HTTP_WAITING, /* Waiting for command */ 107355b4669Sjacobs HTTP_OPTIONS, /* OPTIONS command, waiting for blank line */ 108355b4669Sjacobs HTTP_GET, /* GET command, waiting for blank line */ 109355b4669Sjacobs HTTP_GET_SEND, /* GET command, sending data */ 110355b4669Sjacobs HTTP_HEAD, /* HEAD command, waiting for blank line */ 111355b4669Sjacobs HTTP_POST, /* POST command, waiting for blank line */ 112355b4669Sjacobs HTTP_POST_RECV, /* POST command, receiving data */ 113355b4669Sjacobs HTTP_POST_SEND, /* POST command, sending data */ 114355b4669Sjacobs HTTP_PUT, /* PUT command, waiting for blank line */ 115355b4669Sjacobs HTTP_PUT_RECV, /* PUT command, receiving data */ 116355b4669Sjacobs HTTP_DELETE, /* DELETE command, waiting for blank line */ 117355b4669Sjacobs HTTP_TRACE, /* TRACE command, waiting for blank line */ 118355b4669Sjacobs HTTP_CLOSE, /* CLOSE command, waiting for blank line */ 119355b4669Sjacobs HTTP_STATUS /* Command complete, sending status */ 120355b4669Sjacobs } http_state_t; 121355b4669Sjacobs 122355b4669Sjacobs 123355b4669Sjacobs /* 124355b4669Sjacobs * HTTP version numbers... 125355b4669Sjacobs */ 126355b4669Sjacobs 127355b4669Sjacobs typedef enum 128355b4669Sjacobs { 129355b4669Sjacobs HTTP_0_9 = 9, /* HTTP/0.9 */ 130355b4669Sjacobs HTTP_1_0 = 100, /* HTTP/1.0 */ 131355b4669Sjacobs HTTP_1_1 = 101 /* HTTP/1.1 */ 132355b4669Sjacobs } http_version_t; 133355b4669Sjacobs 134355b4669Sjacobs 135355b4669Sjacobs /* 136355b4669Sjacobs * HTTP keep-alive values... 137355b4669Sjacobs */ 138355b4669Sjacobs 139355b4669Sjacobs typedef enum 140355b4669Sjacobs { 141355b4669Sjacobs HTTP_KEEPALIVE_OFF = 0, 142355b4669Sjacobs HTTP_KEEPALIVE_ON 143355b4669Sjacobs } http_keepalive_t; 144355b4669Sjacobs 145355b4669Sjacobs 146355b4669Sjacobs /* 147355b4669Sjacobs * HTTP transfer encoding values... 148355b4669Sjacobs */ 149355b4669Sjacobs 150355b4669Sjacobs typedef enum 151355b4669Sjacobs { 152355b4669Sjacobs HTTP_ENCODE_LENGTH, /* Data is sent with Content-Length */ 153355b4669Sjacobs HTTP_ENCODE_CHUNKED /* Data is chunked */ 154355b4669Sjacobs } http_encoding_t; 155355b4669Sjacobs 156355b4669Sjacobs 157355b4669Sjacobs /* 158355b4669Sjacobs * HTTP encryption values... 159355b4669Sjacobs */ 160355b4669Sjacobs 161355b4669Sjacobs typedef enum 162355b4669Sjacobs { 163355b4669Sjacobs HTTP_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */ 164355b4669Sjacobs HTTP_ENCRYPT_NEVER, /* Never encrypt */ 165355b4669Sjacobs HTTP_ENCRYPT_REQUIRED, /* Encryption is required (TLS upgrade) */ 166355b4669Sjacobs HTTP_ENCRYPT_ALWAYS /* Always encrypt (SSL) */ 167355b4669Sjacobs } http_encryption_t; 168355b4669Sjacobs 169355b4669Sjacobs 170355b4669Sjacobs /* 171355b4669Sjacobs * HTTP authentication types... 172355b4669Sjacobs */ 173355b4669Sjacobs 174355b4669Sjacobs typedef enum 175355b4669Sjacobs { 176355b4669Sjacobs HTTP_AUTH_NONE, /* No authentication in use */ 177355b4669Sjacobs HTTP_AUTH_BASIC, /* Basic authentication in use */ 178355b4669Sjacobs HTTP_AUTH_MD5, /* Digest authentication in use */ 179355b4669Sjacobs HTTP_AUTH_MD5_SESS, /* MD5-session authentication in use */ 180355b4669Sjacobs HTTP_AUTH_MD5_INT, /* Digest authentication in use for body */ 181355b4669Sjacobs HTTP_AUTH_MD5_SESS_INT /* MD5-session authentication in use for body */ 182355b4669Sjacobs } http_auth_t; 183355b4669Sjacobs 184355b4669Sjacobs 185355b4669Sjacobs /* 186355b4669Sjacobs * HTTP status codes... 187355b4669Sjacobs */ 188355b4669Sjacobs 189355b4669Sjacobs typedef enum 190355b4669Sjacobs { 191355b4669Sjacobs HTTP_ERROR = -1, /* An error response from httpXxxx() */ 192355b4669Sjacobs 193355b4669Sjacobs HTTP_CONTINUE = 100, /* Everything OK, keep going... */ 194355b4669Sjacobs HTTP_SWITCHING_PROTOCOLS, /* HTTP upgrade to TLS/SSL */ 195355b4669Sjacobs 196355b4669Sjacobs HTTP_OK = 200, /* OPTIONS/GET/HEAD/POST/TRACE command was successful */ 197355b4669Sjacobs HTTP_CREATED, /* PUT command was successful */ 198355b4669Sjacobs HTTP_ACCEPTED, /* DELETE command was successful */ 199355b4669Sjacobs HTTP_NOT_AUTHORITATIVE, /* Information isn't authoritative */ 200355b4669Sjacobs HTTP_NO_CONTENT, /* Successful command, no new data */ 201355b4669Sjacobs HTTP_RESET_CONTENT, /* Content was reset/recreated */ 202355b4669Sjacobs HTTP_PARTIAL_CONTENT, /* Only a partial file was recieved/sent */ 203355b4669Sjacobs 204355b4669Sjacobs HTTP_MULTIPLE_CHOICES = 300, /* Multiple files match request */ 205355b4669Sjacobs HTTP_MOVED_PERMANENTLY, /* Document has moved permanently */ 206355b4669Sjacobs HTTP_MOVED_TEMPORARILY, /* Document has moved temporarily */ 207355b4669Sjacobs HTTP_SEE_OTHER, /* See this other link... */ 208355b4669Sjacobs HTTP_NOT_MODIFIED, /* File not modified */ 209355b4669Sjacobs HTTP_USE_PROXY, /* Must use a proxy to access this URI */ 210355b4669Sjacobs 211355b4669Sjacobs HTTP_BAD_REQUEST = 400, /* Bad request */ 212355b4669Sjacobs HTTP_UNAUTHORIZED, /* Unauthorized to access host */ 213355b4669Sjacobs HTTP_PAYMENT_REQUIRED, /* Payment required */ 214355b4669Sjacobs HTTP_FORBIDDEN, /* Forbidden to access this URI */ 215355b4669Sjacobs HTTP_NOT_FOUND, /* URI was not found */ 216355b4669Sjacobs HTTP_METHOD_NOT_ALLOWED, /* Method is not allowed */ 217355b4669Sjacobs HTTP_NOT_ACCEPTABLE, /* Not Acceptable */ 218355b4669Sjacobs HTTP_PROXY_AUTHENTICATION, /* Proxy Authentication is Required */ 219355b4669Sjacobs HTTP_REQUEST_TIMEOUT, /* Request timed out */ 220355b4669Sjacobs HTTP_CONFLICT, /* Request is self-conflicting */ 221355b4669Sjacobs HTTP_GONE, /* Server has gone away */ 222355b4669Sjacobs HTTP_LENGTH_REQUIRED, /* A content length or encoding is required */ 223355b4669Sjacobs HTTP_PRECONDITION, /* Precondition failed */ 224355b4669Sjacobs HTTP_REQUEST_TOO_LARGE, /* Request entity too large */ 225355b4669Sjacobs HTTP_URI_TOO_LONG, /* URI too long */ 226355b4669Sjacobs HTTP_UNSUPPORTED_MEDIATYPE, /* The requested media type is unsupported */ 227355b4669Sjacobs HTTP_UPGRADE_REQUIRED = 426, /* Upgrade to SSL/TLS required */ 228355b4669Sjacobs 229355b4669Sjacobs HTTP_SERVER_ERROR = 500, /* Internal server error */ 230355b4669Sjacobs HTTP_NOT_IMPLEMENTED, /* Feature not implemented */ 231355b4669Sjacobs HTTP_BAD_GATEWAY, /* Bad gateway */ 232355b4669Sjacobs HTTP_SERVICE_UNAVAILABLE, /* Service is unavailable */ 233355b4669Sjacobs HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */ 234355b4669Sjacobs HTTP_NOT_SUPPORTED /* HTTP version not supported */ 235355b4669Sjacobs } http_status_t; 236355b4669Sjacobs 237355b4669Sjacobs 238355b4669Sjacobs /* 239355b4669Sjacobs * HTTP field names... 240355b4669Sjacobs */ 241355b4669Sjacobs 242355b4669Sjacobs typedef enum 243355b4669Sjacobs { 244355b4669Sjacobs HTTP_FIELD_UNKNOWN = -1, 245355b4669Sjacobs HTTP_FIELD_ACCEPT_LANGUAGE, 246355b4669Sjacobs HTTP_FIELD_ACCEPT_RANGES, 247355b4669Sjacobs HTTP_FIELD_AUTHORIZATION, 248355b4669Sjacobs HTTP_FIELD_CONNECTION, 249355b4669Sjacobs HTTP_FIELD_CONTENT_ENCODING, 250355b4669Sjacobs HTTP_FIELD_CONTENT_LANGUAGE, 251355b4669Sjacobs HTTP_FIELD_CONTENT_LENGTH, 252355b4669Sjacobs HTTP_FIELD_CONTENT_LOCATION, 253355b4669Sjacobs HTTP_FIELD_CONTENT_MD5, 254355b4669Sjacobs HTTP_FIELD_CONTENT_RANGE, 255355b4669Sjacobs HTTP_FIELD_CONTENT_TYPE, 256355b4669Sjacobs HTTP_FIELD_CONTENT_VERSION, 257355b4669Sjacobs HTTP_FIELD_DATE, 258355b4669Sjacobs HTTP_FIELD_HOST, 259355b4669Sjacobs HTTP_FIELD_IF_MODIFIED_SINCE, 260355b4669Sjacobs HTTP_FIELD_IF_UNMODIFIED_SINCE, 261355b4669Sjacobs HTTP_FIELD_KEEP_ALIVE, 262355b4669Sjacobs HTTP_FIELD_LAST_MODIFIED, 263355b4669Sjacobs HTTP_FIELD_LINK, 264355b4669Sjacobs HTTP_FIELD_LOCATION, 265355b4669Sjacobs HTTP_FIELD_RANGE, 266355b4669Sjacobs HTTP_FIELD_REFERER, 267355b4669Sjacobs HTTP_FIELD_RETRY_AFTER, 268355b4669Sjacobs HTTP_FIELD_TRANSFER_ENCODING, 269355b4669Sjacobs HTTP_FIELD_UPGRADE, 270355b4669Sjacobs HTTP_FIELD_USER_AGENT, 271355b4669Sjacobs HTTP_FIELD_WWW_AUTHENTICATE, 272355b4669Sjacobs HTTP_FIELD_MAX 273355b4669Sjacobs } http_field_t; 274355b4669Sjacobs 275355b4669Sjacobs 276355b4669Sjacobs /* 277355b4669Sjacobs * HTTP address structure (makes using IPv6 a little easier and more portable.) 278355b4669Sjacobs */ 279355b4669Sjacobs 280355b4669Sjacobs typedef union 281355b4669Sjacobs { 282355b4669Sjacobs struct sockaddr addr; /* Base structure for family value */ 283355b4669Sjacobs struct sockaddr_in ipv4; /* IPv4 address */ 284355b4669Sjacobs #ifdef AF_INET6 285355b4669Sjacobs struct sockaddr_in6 ipv6; /* IPv6 address */ 286355b4669Sjacobs #endif /* AF_INET6 */ 287355b4669Sjacobs #ifdef AF_LOCAL 288355b4669Sjacobs struct sockaddr_un un; /* Domain socket file */ 289355b4669Sjacobs #endif /* AF_LOCAL */ 290355b4669Sjacobs char pad[128]; /* Pad to ensure binary compatibility */ 291355b4669Sjacobs } http_addr_t; 292355b4669Sjacobs 293355b4669Sjacobs /* 294355b4669Sjacobs * HTTP connection structure... 295355b4669Sjacobs */ 296355b4669Sjacobs 297355b4669Sjacobs typedef struct 298355b4669Sjacobs { 299355b4669Sjacobs int fd; /* File descriptor for this socket */ 300355b4669Sjacobs int blocking; /* To block or not to block */ 301355b4669Sjacobs int error; /* Last error on read */ 302355b4669Sjacobs time_t activity; /* Time since last read/write */ 303355b4669Sjacobs http_state_t state; /* State of client */ 304355b4669Sjacobs http_status_t status; /* Status of last request */ 305355b4669Sjacobs http_version_t version; /* Protocol version */ 306355b4669Sjacobs http_keepalive_t keep_alive; /* Keep-alive supported? */ 307355b4669Sjacobs struct sockaddr_in oldaddr; /* Address of connected host */ 308355b4669Sjacobs char hostname[HTTP_MAX_HOST], 309355b4669Sjacobs /* Name of connected host */ 310355b4669Sjacobs fields[HTTP_FIELD_MAX][HTTP_MAX_VALUE]; 311355b4669Sjacobs /* Field values */ 312355b4669Sjacobs char *data; /* Pointer to data buffer */ 313355b4669Sjacobs http_encoding_t data_encoding; /* Chunked or not */ 314355b4669Sjacobs int data_remaining; /* Number of bytes left */ 315355b4669Sjacobs int used; /* Number of bytes used in buffer */ 316355b4669Sjacobs char buffer[HTTP_MAX_BUFFER]; 317355b4669Sjacobs /* Buffer for messages */ 318355b4669Sjacobs int auth_type; /* Authentication in use */ 319355b4669Sjacobs char nonce[HTTP_MAX_VALUE]; 320355b4669Sjacobs /* Nonce value */ 321355b4669Sjacobs int nonce_count; /* Nonce count */ 322355b4669Sjacobs void *tls; /* TLS state information */ 323355b4669Sjacobs http_encryption_t encryption; /* Encryption requirements */ 324355b4669Sjacobs /**** New in CUPS 1.1.19 ****/ 325355b4669Sjacobs fd_set *input_set; /* select() set for httpWait() */ 326355b4669Sjacobs http_status_t expect; /* Expect: header */ 327355b4669Sjacobs char *cookie; /* Cookie value(s) */ 328355b4669Sjacobs /**** New in CUPS 1.1.20 ****/ 329355b4669Sjacobs char authstring[HTTP_MAX_VALUE], 330355b4669Sjacobs /* Current Authentication value */ 331355b4669Sjacobs userpass[HTTP_MAX_VALUE]; 332355b4669Sjacobs /* Username:password string */ 333355b4669Sjacobs int digest_tries; /* Number of tries for digest auth */ 334355b4669Sjacobs /**** New in CUPS 1.2 ****/ 335355b4669Sjacobs http_addr_t hostaddr; /* Host address and port */ 336355b4669Sjacobs } http_t; 337355b4669Sjacobs 338355b4669Sjacobs 339355b4669Sjacobs /* 340355b4669Sjacobs * Prototypes... 341355b4669Sjacobs */ 342355b4669Sjacobs 343355b4669Sjacobs # define httpBlocking(http,b) (http)->blocking = (b) 344355b4669Sjacobs extern int httpCheck(http_t *http); 345355b4669Sjacobs # define httpClearFields(http) memset((http)->fields, 0, sizeof((http)->fields)),\ 346355b4669Sjacobs httpSetField((http), HTTP_FIELD_HOST, (http)->hostname) 347355b4669Sjacobs extern void httpClose(http_t *http); 348355b4669Sjacobs extern http_t *httpConnect(const char *host, int port); 349355b4669Sjacobs extern http_t *httpConnectEncrypt(const char *host, int port, 350355b4669Sjacobs http_encryption_t encrypt); 351355b4669Sjacobs extern int httpDelete(http_t *http, const char *uri); 352355b4669Sjacobs extern int httpEncryption(http_t *http, http_encryption_t e); 353355b4669Sjacobs # define httpError(http) ((http)->error) 354355b4669Sjacobs extern void httpFlush(http_t *http); 355355b4669Sjacobs extern int httpGet(http_t *http, const char *uri); 356355b4669Sjacobs extern char *httpGets(char *line, int length, http_t *http); 357355b4669Sjacobs extern const char *httpGetDateString(time_t t); 358355b4669Sjacobs extern time_t httpGetDateTime(const char *s); 359355b4669Sjacobs # define httpGetField(http,field) (http)->fields[field] 360355b4669Sjacobs extern struct hostent *httpGetHostByName(const char *name); 361355b4669Sjacobs extern char *httpGetSubField(http_t *http, http_field_t field, 362355b4669Sjacobs const char *name, char *value); 363355b4669Sjacobs extern int httpHead(http_t *http, const char *uri); 364355b4669Sjacobs extern void httpInitialize(void); 365355b4669Sjacobs extern int httpOptions(http_t *http, const char *uri); 366355b4669Sjacobs extern int httpPost(http_t *http, const char *uri); 367355b4669Sjacobs extern int httpPrintf(http_t *http, const char *format, ...) 368355b4669Sjacobs # ifdef __GNUC__ 369355b4669Sjacobs __attribute__ ((__format__ (__printf__, 2, 3))) 370355b4669Sjacobs # endif /* __GNUC__ */ 371355b4669Sjacobs ; 372355b4669Sjacobs extern int httpPut(http_t *http, const char *uri); 373355b4669Sjacobs extern int httpRead(http_t *http, char *buffer, int length); 374355b4669Sjacobs extern int httpReconnect(http_t *http); 375355b4669Sjacobs extern void httpSeparate(const char *uri, char *method, 376355b4669Sjacobs char *username, char *host, int *port, 377355b4669Sjacobs char *resource); 378355b4669Sjacobs extern void httpSetField(http_t *http, http_field_t field, 379355b4669Sjacobs const char *value); 380355b4669Sjacobs extern const char *httpStatus(http_status_t status); 381355b4669Sjacobs extern int httpTrace(http_t *http, const char *uri); 382355b4669Sjacobs extern http_status_t httpUpdate(http_t *http); 383355b4669Sjacobs extern int httpWrite(http_t *http, const char *buffer, int length); 384355b4669Sjacobs extern char *httpEncode64(char *out, const char *in); 385355b4669Sjacobs extern char *httpDecode64(char *out, const char *in); 386355b4669Sjacobs extern int httpGetLength(http_t *http); 387355b4669Sjacobs extern char *httpMD5(const char *, const char *, const char *, 388355b4669Sjacobs char [33]); 389355b4669Sjacobs extern char *httpMD5Final(const char *, const char *, const char *, 390355b4669Sjacobs char [33]); 391355b4669Sjacobs extern char *httpMD5String(const unsigned char *, char [33]); 392355b4669Sjacobs 393355b4669Sjacobs /**** New in CUPS 1.1.19 ****/ 394355b4669Sjacobs extern void httpClearCookie(http_t *http); 395355b4669Sjacobs #define httpGetCookie(http) ((http)->cookie) 396355b4669Sjacobs extern void httpSetCookie(http_t *http, const char *cookie); 397355b4669Sjacobs extern int httpWait(http_t *http, int msec); 398355b4669Sjacobs 399355b4669Sjacobs /**** New in CUPS 1.1.21 ****/ 400355b4669Sjacobs extern char *httpDecode64_2(char *out, int *outlen, const char *in); 401355b4669Sjacobs extern char *httpEncode64_2(char *out, int outlen, const char *in, 402355b4669Sjacobs int inlen); 403355b4669Sjacobs extern void httpSeparate2(const char *uri, 404355b4669Sjacobs char *method, int methodlen, 405355b4669Sjacobs char *username, int usernamelen, 406355b4669Sjacobs char *host, int hostlen, int *port, 407355b4669Sjacobs char *resource, int resourcelen); 408355b4669Sjacobs 409355b4669Sjacobs /**** New in CUPS 1.2 ****/ 410355b4669Sjacobs extern int httpAddrAny(const http_addr_t *addr); 411355b4669Sjacobs extern int httpAddrEqual(const http_addr_t *addr1, 412355b4669Sjacobs const http_addr_t *addr2); 413355b4669Sjacobs extern void httpAddrLoad(const struct hostent *host, int port, 414355b4669Sjacobs int n, http_addr_t *addr); 415355b4669Sjacobs extern int httpAddrLocalhost(const http_addr_t *addr); 416355b4669Sjacobs extern char *httpAddrLookup(const http_addr_t *addr, 417355b4669Sjacobs char *name, int namelen); 418355b4669Sjacobs extern char *httpAddrString(const http_addr_t *addr, 419355b4669Sjacobs char *s, int slen); 420355b4669Sjacobs 421*0a44ef6dSjacobs #include <stdio.h> 422*0a44ef6dSjacobs extern void httpDumpData(FILE *, const char *, const char *, int); 423*0a44ef6dSjacobs 424355b4669Sjacobs 425355b4669Sjacobs /* 426355b4669Sjacobs * C++ magic... 427355b4669Sjacobs */ 428355b4669Sjacobs 429355b4669Sjacobs #ifdef __cplusplus 430355b4669Sjacobs } 431355b4669Sjacobs #endif 432355b4669Sjacobs 433355b4669Sjacobs #endif /* !_CUPS_HTTP_H_ */ 434355b4669Sjacobs 435355b4669Sjacobs /* 436355b4669Sjacobs * End of "$Id: http.h 148 2006-04-25 16:54:17Z njacobs $" 437355b4669Sjacobs */ 438