]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http.h
Load cups into easysw/current.
[thirdparty/cups.git] / cups / http.h
index 9c346eebfca2be8194374a8640c667fb178cc5c1..937b94fa07b26211a27c51f7d66d2920624d1106 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: http.h 5023 2006-01-29 14:39:44Z mike $"
+ * "$Id: http.h 5632 2006-06-06 14:46:10Z mike $"
  *
  *   Hyper-Text Transport Protocol definitions for the Common UNIX Printing
  *   System (CUPS).
@@ -39,6 +39,9 @@
 #    include <winsock2.h>
 #    include <ws2tcpip.h>
 #  else
+#    ifdef __sgi /* IRIX needs this for IPv6 support!?! */
+#      define INET6
+#    endif /* __sgi */
 #    include <unistd.h>
 #    include <sys/time.h>
 #    include <sys/socket.h>
@@ -97,6 +100,8 @@ extern "C" {
 #    define s6_addr32  _S6_un._S6_u32
 #  elif defined(__FreeBSD__) || defined(__APPLE__)
 #    define s6_addr32  __u6_addr.__u6_addr32
+#  elif defined(__osf__)
+#    define s6_addr32  s6_un.sa6_laddr
 #  elif defined(WIN32)
 /*
  * Windows only defines byte and 16-bit word members of the union and
@@ -242,6 +247,8 @@ typedef enum http_status_e          /**** HTTP status codes ****/
   HTTP_REQUEST_TOO_LARGE,              /* Request entity too large */
   HTTP_URI_TOO_LONG,                   /* URI too long */
   HTTP_UNSUPPORTED_MEDIATYPE,          /* The requested media type is unsupported */
+  HTTP_REQUESTED_RANGE,                        /* The requested range is not satisfiable */
+  HTTP_EXPECTATION_FAILED,             /* The expectation given in an Expect header field was not met */
   HTTP_UPGRADE_REQUIRED = 426,         /* Upgrade to SSL/TLS required */
 
   HTTP_SERVER_ERROR = 500,             /* Internal server error */
@@ -286,7 +293,7 @@ typedef enum http_version_e         /**** HTTP version numbers ****/
   HTTP_1_1 = 101                       /* HTTP/1.1 */
 } http_version_t;
 
-typedef union http_addr_u              /**** Socket address union, which
+typedef union _http_addr_u             /**** Socket address union, which
                                         **** makes using IPv6 and other
                                         **** address types easier and
                                         **** more portable. @since CUPS 1.2@
@@ -313,8 +320,16 @@ typedef struct http_addrlist_s             /**** Socket address list, which is
   http_addr_t          addr;           /* Address */
 } http_addrlist_t;
 
-typedef struct http_s                  /**** HTTP connection structure. ****/
+typedef struct _http_s                 /**** HTTP connection structure. ****/
 {
+ /*
+  * DO NOT ACCESS MEMBERS OF THIS STRUCTURE DIRECTLY; INSTEAD, USE THE
+  * PROVIDED APIS FOR ACCESSING THE VALUES INSTEAD.
+  *
+  * This structure definition will be removed from the public headers in
+  * CUPS 1.3.
+  */
+
   int                  fd;             /* File descriptor for this socket */
   int                  blocking;       /* To block or not to block */
   int                  error;          /* Last error on read */
@@ -365,23 +380,22 @@ typedef struct http_s                     /**** HTTP connection structure. ****/
  * Prototypes...
  */
 
-#  define              httpBlocking(http,b)    (http)->blocking = (b)
+extern void            httpBlocking(http_t *http, int b);
 extern int             httpCheck(http_t *http);
-#  define              httpClearFields(http)   memset((http)->fields, 0, sizeof((http)->fields)),\
-                                               httpSetField((http), HTTP_FIELD_HOST, (http)->hostname)
+extern void            httpClearFields(http_t *http);
 extern void            httpClose(http_t *http);
 extern http_t          *httpConnect(const char *host, int port);
 extern http_t          *httpConnectEncrypt(const char *host, int port,
                                            http_encryption_t encryption);
 extern int             httpDelete(http_t *http, const char *uri);
 extern int             httpEncryption(http_t *http, http_encryption_t e);
-#  define              httpError(http) ((http)->error)
+extern int             httpError(http_t *http);
 extern void            httpFlush(http_t *http);
 extern int             httpGet(http_t *http, const char *uri);
 extern char            *httpGets(char *line, int length, http_t *http);
 extern const char      *httpGetDateString(time_t t);
 extern time_t          httpGetDateTime(const char *s);
-#  define              httpGetField(http,field)        (http)->fields[field]
+extern const char      *httpGetField(http_t *http, http_field_t field);
 extern struct hostent  *httpGetHostByName(const char *name);
 extern char            *httpGetSubField(http_t *http, http_field_t field,
                                         const char *name, char *value);
@@ -417,7 +431,7 @@ extern char         *httpMD5String(const unsigned char *, char [33]);
 
 /**** New in CUPS 1.1.19 ****/
 extern void            httpClearCookie(http_t *http);
-#define httpGetCookie(http) ((http)->cookie)
+extern const char      *httpGetCookie(http_t *http);
 extern void            httpSetCookie(http_t *http, const char *cookie);
 extern int             httpWait(http_t *http, int msec);
 
@@ -458,9 +472,12 @@ extern http_uri_status_t httpAssembleURIf(http_uri_coding_t encoding,
                                          const char *host, int port,
                                          const char *resourcef, ...);
 extern int             httpFlushWrite(http_t *http);
+extern int             httpGetBlocking(http_t *http);
 extern const char      *httpGetDateString2(time_t t, char *s, int slen);
-extern const char      *httpGetHostname(char *s, int slen);
+extern int             httpGetFd(http_t *http);
+extern const char      *httpGetHostname(http_t *http, char *s, int slen);
 extern off_t           httpGetLength2(http_t *http);
+extern http_status_t   httpGetStatus(http_t *http);
 extern char            *httpGetSubField2(http_t *http, http_field_t field,
                                          const char *name, char *value,
                                          int valuelen);
@@ -471,6 +488,7 @@ extern http_uri_status_t httpSeparateURI(http_uri_coding_t decoding,
                                         char *username, int usernamelen,
                                         char *host, int hostlen, int *port,
                                         char *resource, int resourcelen);
+extern void            httpSetExpect(http_t *http, http_status_t expect);
 extern void            httpSetLength(http_t *http, size_t length);
 extern ssize_t         httpWrite2(http_t *http, const char *buffer,
                                   size_t length);
@@ -486,5 +504,5 @@ extern ssize_t              httpWrite2(http_t *http, const char *buffer,
 #endif /* !_CUPS_HTTP_H_ */
 
 /*
- * End of "$Id: http.h 5023 2006-01-29 14:39:44Z mike $".
+ * End of "$Id: http.h 5632 2006-06-06 14:46:10Z mike $".
  */