]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/http-private.h
Merge changes from CUPS 1.6svn-r9968.
[thirdparty/cups.git] / cups / http-private.h
index 79ff84d6e605b738798496a913a0c6976b5b0245..ab98b5ab3c5dfde1c9bd0799c920358c859ca249 100644 (file)
 #  endif /* WIN32 */
 
 #  ifdef HAVE_GSSAPI
-#    ifdef HAVE_GSSAPI_GSSAPI_H
+#    ifdef HAVE_GSS_GSSAPI_H
+#      include <GSS/gssapi.h>
+#      ifdef HAVE_GSSAPI_GENERIC_H
+#        include <GSS/gssapi_generic.h>
+#      endif /* HAVE_GSSAPI_GENERIC_H */
+#      ifdef HAVE_GSSAPI_KRB5_H
+#        include <GSS/gssapi_krb5.h>
+#      endif /* HAVE_GSSAPI_KRB5_H */
+#    elif defined(HAVE_GSSAPI_GSSAPI_H)
 #      include <gssapi/gssapi.h>
-#    endif /* HAVE_GSSAPI_GSSAPI_H */
-#    ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
-#      include <gssapi/gssapi_generic.h>
-#    endif /* HAVE_GSSAPI_GSSAPI_GENERIC_H */
-#    ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
-#      include <gssapi/gssapi_krb5.h>
-#    endif /* HAVE_GSSAPI_GSSAPI_KRB5_H */
-#    ifdef HAVE_GSSAPI_H
+#      ifdef HAVE_GSSAPI_GENERIC_H
+#        include <gssapi/gssapi_generic.h>
+#      endif /* HAVE_GSSAPI_GENERIC_H */
+#      ifdef HAVE_GSSAPI_KRB5_H
+#        include <gssapi/gssapi_krb5.h>
+#      endif /* HAVE_GSSAPI_KRB5_H */
+#    elif defined(HAVE_GSSAPI_H)
 #      include <gssapi.h>
-#    endif /* HAVE_GSSAPI_H */
+#    endif /* HAVE_GSS_GSSAPI_H */
 #    ifndef HAVE_GSS_C_NT_HOSTBASED_SERVICE
 #      define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name
 #    endif /* !HAVE_GSS_C_NT_HOSTBASED_SERVICE */
@@ -91,6 +98,9 @@ typedef int socklen_t;
 #    include <CoreFoundation/CoreFoundation.h>
 #    include <Security/Security.h>
 #    include <Security/SecureTransport.h>
+#    ifdef HAVE_SECURETRANSPORTPRIV_H
+#      include <Security/SecureTransportPriv.h>
+#    endif /* HAVE_SECURETRANSPORTPRIV_H */
 #    ifdef HAVE_SECITEM_H
 #      include <Security/SecItem.h>
 #    endif /* HAVE_SECITEM_H */
@@ -136,6 +146,16 @@ extern "C" {
 #  endif /* __cplusplus */
 
 
+/*
+ * Constants...
+ */
+
+
+#define _HTTP_RESOLVE_DEFAULT  0       /* Just resolve with default options */
+#define _HTTP_RESOLVE_STDERR   1       /* Log resolve progress to stderr */
+#define _HTTP_RESOLVE_FQDN     2       /* Resolve to a FQDN */
+
+
 /*
  * Types and functions for SSL support...
  */
@@ -215,9 +235,6 @@ typedef void *http_tls_t;
 typedef void *http_tls_credentials_t;
 #  endif /* HAVE_LIBSSL */
 
-
-typedef int (*_http_timeout_cb_t)(http_t *http, void *user_data);
-
 struct _http_s                         /**** HTTP connection structure. ****/
 {
   int                  fd;             /* File descriptor for this socket */
@@ -228,14 +245,14 @@ struct _http_s                            /**** HTTP connection structure. ****/
   http_status_t                status;         /* Status of last request */
   http_version_t       version;        /* Protocol version */
   http_keepalive_t     keep_alive;     /* Keep-alive supported? */
-  struct sockaddr_in   _hostaddr;      /* Address of connected host @deprecated@ */
+  struct sockaddr_in   _hostaddr;      /* Address of connected host (deprecated) */
   char                 hostname[HTTP_MAX_HOST],
                                        /* Name of connected host */
                        fields[HTTP_FIELD_MAX][HTTP_MAX_VALUE];
                                        /* Field values */
   char                 *data;          /* Pointer to data buffer */
   http_encoding_t      data_encoding;  /* Chunked or not */
-  int                  _data_remaining;/* Number of bytes left @deprecated@ */
+  int                  _data_remaining;/* Number of bytes left (deprecated) */
   int                  used;           /* Number of bytes used in buffer */
   char                 buffer[HTTP_MAX_BUFFER];
                                        /* Buffer for incoming data */
@@ -247,40 +264,44 @@ struct _http_s                            /**** HTTP connection structure. ****/
   http_tls_t           tls;            /* TLS state information */
   http_encryption_t    encryption;     /* Encryption requirements */
   /**** New in CUPS 1.1.19 ****/
-  fd_set               *input_set;     /* select() set for httpWait() @deprecated@ */
-  http_status_t                expect;         /* Expect: header @since CUPS 1.1.19@ */
-  char                 *cookie;        /* Cookie value(s) @since CUPS 1.1.19@ */
+  fd_set               *input_set;     /* select() set for httpWait() (deprecated) */
+  http_status_t                expect;         /* Expect: header */
+  char                 *cookie;        /* Cookie value(s) */
   /**** New in CUPS 1.1.20 ****/
   char                 _authstring[HTTP_MAX_VALUE],
-                                       /* Current Authentication value. @deprecated@ */
+                                       /* Current Authentication value (deprecated) */
                        userpass[HTTP_MAX_VALUE];
-                                       /* Username:password string @since CUPS 1.1.20@ */
-  int                  digest_tries;   /* Number of tries for digest auth @since CUPS 1.1.20@ */
+                                       /* Username:password string */
+  int                  digest_tries;   /* Number of tries for digest auth */
   /**** New in CUPS 1.2 ****/
-  off_t                        data_remaining; /* Number of bytes left @since CUPS 1.2@ */
-  http_addr_t          *hostaddr;      /* Current host address and port @since CUPS 1.2@ */
-  http_addrlist_t      *addrlist;      /* List of valid addresses @since CUPS 1.2@ */
+  off_t                        data_remaining; /* Number of bytes left */
+  http_addr_t          *hostaddr;      /* Current host address and port */
+  http_addrlist_t      *addrlist;      /* List of valid addresses */
   char                 wbuffer[HTTP_MAX_BUFFER];
                                        /* Buffer for outgoing data */
-  int                  wused;          /* Write buffer bytes used @since CUPS 1.2@ */
+  int                  wused;          /* Write buffer bytes used */
   /**** New in CUPS 1.3 ****/
   char                 *field_authorization;
-                                       /* Authorization field @since CUPS 1.3@ */
-  char                 *authstring;    /* Current authorization field @since CUPS 1.3 */
+                                       /* Authorization field */
+  char                 *authstring;    /* Current authorization field */
 #  ifdef HAVE_GSSAPI
-  gss_OID              gssmech;        /* Authentication mechanism @since CUPS 1.3@ */
-  gss_ctx_id_t         gssctx;         /* Authentication context @since CUPS 1.3@ */
-  gss_name_t           gssname;        /* Authentication server name @since CUPS 1.3@ */
+  gss_OID              gssmech;        /* Authentication mechanism */
+  gss_ctx_id_t         gssctx;         /* Authentication context */
+  gss_name_t           gssname;        /* Authentication server name */
 #  endif /* HAVE_GSSAPI */
 #  ifdef HAVE_AUTHORIZATION_H
-  AuthorizationRef     auth_ref;       /* Authorization ref @since CUPS 1.3@ */
+  AuthorizationRef     auth_ref;       /* Authorization ref */
 #  endif /* HAVE_AUTHORIZATION_H */
   /**** New in CUPS 1.5 ****/
   http_tls_credentials_t tls_credentials;
-                                       /* TLS credentials @since CUPS 1.5@ */
-  _http_timeout_cb_t   timeout_cb;     /* Timeout callback @since CUPS 1.5@ */
-  void                 *timeout_data;  /* User data pointer @since CUPS 1.5@ */
-  struct timeval       timeout_value;  /* Timeout in seconds */
+                                       /* TLS credentials */
+  http_timeout_cb_t    timeout_cb;     /* Timeout callback */
+  void                 *timeout_data;  /* User data pointer */
+  double               timeout_value;  /* Timeout in seconds */
+  int                  wait_value;     /* httpWait value for timeout */
+#  ifdef HAVE_GSSAPI
+  char                 gsshost[256];   /* Hostname for Kerberos */
+#  endif /* HAVE_GSSAPI */
 };
 
 
@@ -345,16 +366,18 @@ extern void       _cups_freeifaddrs(struct ifaddrs *addrs);
  * Prototypes...
  */
 
+#define                        _httpAddrFamily(addrp) (addrp)->addr.sa_family
 extern int             _httpAddrPort(http_addr_t *addr);
+extern void            _httpAddrSetPort(http_addr_t *addr, int port);
 extern char            *_httpAssembleUUID(const char *server, int port,
                                           const char *name, int number,
                                           char *buffer, size_t bufsize);
-extern http_tls_credentials_t
-                       _httpConvertCredentials(cups_array_t *credentials);
 extern http_t          *_httpCreate(const char *host, int port,
                                     http_addrlist_t *addrlist,
                                     http_encryption_t encryption,
                                     int family);
+extern http_tls_credentials_t
+                       _httpCreateCredentials(cups_array_t *credentials);
 extern char            *_httpDecodeURI(char *dst, const char *src,
                                        size_t dstsize);
 extern void            _httpDisconnect(http_t *http);
@@ -363,11 +386,9 @@ extern char                *_httpEncodeURI(char *dst, const char *src,
 extern void            _httpFreeCredentials(http_tls_credentials_t credentials);
 extern ssize_t         _httpPeek(http_t *http, char *buffer, size_t length);
 extern const char      *_httpResolveURI(const char *uri, char *resolved_uri,
-                                        size_t resolved_size, int log,
+                                        size_t resolved_size, int options,
                                         int (*cb)(void *context),
                                         void *context);
-extern void            _httpSetTimeout(http_t *http, double timeout,
-                                       _http_timeout_cb_t cb, void *user_data);
 extern int             _httpUpdate(http_t *http, http_status_t *status);
 extern int             _httpWait(http_t *http, int msec, int usessl);