/*
- * "$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).
# 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>
# 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
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 */
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@
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 */
* 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);
/**** 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);
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);
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);
#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 $".
*/