*
* IPP backend for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
}
/* For OS X 10.8 and earlier */
-extern int _httpAddrPort(http_addr_t *addr);
int _httpAddrPort(http_addr_t *addr) { return (httpAddrPort(addr)); }
*
* Private HTTP definitions for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
*/
#define _httpAddrFamily(addrp) (addrp)->addr.sa_family
+extern int _httpAddrPort(http_addr_t *addr)
+ _CUPS_INTERNAL_MSG("Use httpAddrPort instead.");
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);
+ char *buffer, size_t bufsize)
+ _CUPS_INTERNAL_MSG("Use httpAssembleUUID instead.");
extern http_t *_httpCreate(const char *host, int port,
http_addrlist_t *addrlist, int family,
http_encryption_t encryption,
- int blocking, _http_mode_t mode);
+ int blocking, _http_mode_t mode)
+ _CUPS_INTERNAL_MSG("Use httpConnect2 or httpAccept instead.");
extern http_tls_credentials_t
_httpCreateCredentials(cups_array_t *credentials);
extern char *_httpDecodeURI(char *dst, const char *src,
extern char *_httpEncodeURI(char *dst, const char *src,
size_t dstsize);
extern void _httpFreeCredentials(http_tls_credentials_t credentials);
+extern ssize_t _httpPeek(http_t *http, char *buffer, size_t length)
+ _CUPS_INTERNAL_MSG("Use httpPeek instead.");
extern const char *_httpResolveURI(const char *uri, char *resolved_uri,
size_t resolved_size, int options,
int (*cb)(void *context),
*
* HTTP support routines for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* components.
* httpAssembleURIf() - Assemble a uniform resource identifier from its
* components with a formatted resource.
- * _httpAssembleUUID() - Make a UUID URI conforming to RFC 4122.
+ * httpAssembleUUID() - Assemble a name-based UUID URN conforming to RFC
+ * 4122.
* httpDecode64() - Base64-decode a string.
* httpDecode64_2() - Base64-decode a string.
* httpEncode64() - Base64-encode a string.
/*
- * '_httpAssembleUUID()' - Make a UUID URI conforming to RFC 4122.
+ * 'httpAssembleUUID()' - Assemble a name-based UUID URN conforming to RFC 4122.
+ *
+ * This function creates a unique 128-bit identifying number using the server
+ * name, port number, random data, and optionally an object name and/or object
+ * number. The result is formatted as a UUID URN as defined in RFC 4122.
*
* The buffer needs to be at least 46 bytes in size.
*/
char * /* I - UUID string */
-_httpAssembleUUID(const char *server, /* I - Server name */
- int port, /* I - Port number */
- const char *name, /* I - Object name or NULL */
- int number, /* I - Object number or 0 */
- char *buffer, /* I - String buffer */
- size_t bufsize) /* I - Size of buffer */
+httpAssembleUUID(const char *server, /* I - Server name */
+ int port, /* I - Port number */
+ const char *name, /* I - Object name or NULL */
+ int number, /* I - Object number or 0 */
+ char *buffer, /* I - String buffer */
+ size_t bufsize) /* I - Size of buffer */
{
char data[1024]; /* Source string for MD5 */
_cups_md5_state_t md5state; /* MD5 state */
return (buffer);
}
+/* For OS X 10.8 and earlier */
+char *_httpAssembleUUID(const char *server, int port, const char *name,
+ int number, char *buffer, size_t bufsize)
+{
+ return (httpAssembleUUID(server, port, name, number, buffer, bufsize));
+}
+
/*
* 'httpDecode64()' - Base64-decode a string.
}
/* For OS X 10.8 and earlier */
-extern ssize_t _httpPeek(http_t *http, char *buffer, size_t length);
ssize_t _httpPeek(http_t *http, char *buffer, size_t length)
{ return (httpPeek(http, buffer, length)); }
extern int httpAddrListen(http_addr_t *addr, int port)
_CUPS_API_1_7;
extern int httpAddrPort(http_addr_t *addr) _CUPS_API_1_7;
+extern char *httpAssembleUUID(const char *server, int port,
+ const char *name, int number,
+ char *buffer, size_t bufsize)
+ _CUPS_API_1_7;
extern http_t *httpConnect2(const char *host, int port,
http_addrlist_t *addrlist,
int family, http_encryption_t encryption,
*
* API versioning definitions for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
/*
* This header defines several constants - _CUPS_DEPRECATED,
- * _CUPS_API_1_1, _CUPS_API_1_1_19, _CUPS_API_1_1_20, _CUPS_API_1_1_21,
- * _CUPS_API_1_2, _CUPS_API_1_3, _CUPS_API_1_4, _CUPS_API_1_5, _CUPS_API_1_6,
- * and _CUPS_API_1_7 - which add compiler-specific attributes that flag
- * functions that are deprecated or added in particular releases.
+ * _CUPS_DEPRECATED_MSG, _CUPS_INTERNAL_MSG, _CUPS_API_1_1, _CUPS_API_1_1_19,
+ * _CUPS_API_1_1_20, _CUPS_API_1_1_21, _CUPS_API_1_2, _CUPS_API_1_3,
+ * _CUPS_API_1_4, _CUPS_API_1_5, _CUPS_API_1_6, and _CUPS_API_1_7 - which add
+ * compiler-specific attributes that flag functions that are deprecated, added
+ * in particular releases, or internal to CUPS.
*
* On OS X, the _CUPS_API_* constants are defined based on the values of
* the MAC_OS_X_VERSION_MIN_ALLOWED and MAC_OS_X_VERSION_MAX_ALLOWED constants
# endif /* __APPLE__ && !_CUPS_SOURCE */
/*
- * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get
- * a warning at compile-time.
+ * With GCC and Clang we can mark old APIs as "deprecated" or "unavailable" with
+ * messages so you get warnings/errors are compile-time...
*/
-# if defined(__GNUC__) && __GNUC__ > 2
-# ifndef __has_extension
-# define __has_extension(x) 0
-# endif /* !__has_extension */
-# if __has_extension(attribute_unavailable_with_message) && defined(_CUPS_NO_DEPRECATED)
-# define _CUPS_DEPRECATED __attribute__ ((unavailable))
-# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((unavailable(m)))
-# elif !defined(_CUPS_SOURCE) || defined(_CUPS_NO_DEPRECATED)
-# define _CUPS_DEPRECATED __attribute__ ((deprecated))
-# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated(m)))
-# else
-# define _CUPS_DEPRECATED
-# define _CUPS_DEPRECATED_MSG(m)
-# endif /* !_CUPS_SOURCE || _CUPS_NO_DEPRECATED */
-# else
+# ifdef __has_extension /* Clang */
+# define _CUPS_HAS_DEPRECATED
+# if __has_extension(attribute_deprecated_with_message)
+# define _CUPS_HAS_DEPRECATED_WITH_MESSAGE
+# endif
+# if __has_extension(attribute_unavailable_with_message)
+# define _CUPS_HAS_UNAVAILABLE_WITH_MESSAGE
+# endif
+# elif defined(__GNUC__) /* GCC and compatible */
+# if __GNUC__ >= 3 /* GCC 3.0 or higher */
+# define _CUPS_HAS_DEPRECATED
+# endif /* __GNUC__ >= 3 */
+# if __GNUC__ >= 5 /* GCC 5.x */
+# define _CUPS_HAS_DEPRECATED_WITH_MESSAGE
+# elif __GNUC__ == 4 && __GNUC_MINOR__ >= 5
+ /* GCC 4.5 or higher */
+# define _CUPS_HAS_DEPRECATED_WITH_MESSAGE
+# endif /* __GNUC__ >= 5 */
+# endif /* __has_extension */
+
+# if !defined(_CUPS_HAS_DEPRECATED) || (defined(_CUPS_SOURCE) && !defined(_CUPS_NO_DEPRECATED))
+ /*
+ * Don't mark functions deprecated if the compiler doesn't support it
+ * or we are building CUPS source that doesn't care.
+ */
# define _CUPS_DEPRECATED
# define _CUPS_DEPRECATED_MSG(m)
-# endif /* __GNUC__ && __GNUC__ > 2 */
+# define _CUPS_INTERNAL_MSG(m)
+# elif defined(_CUPS_HAS_UNAVAILABLE_WITH_MESSAGE) && defined(_CUPS_NO_DEPRECATED)
+ /*
+ * Compiler supports the unsupported attribute, so use it when the code
+ * wants to exclude the use of deprecated API.
+ */
+# define _CUPS_DEPRECATED __attribute__ ((unavailable))
+# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((unavailable(m)))
+# define _CUPS_INTERNAL_MSG(m) __attribute__ ((unavailable(m)))
+# else
+ /*
+ * Compiler supports the deprecated attribute, so use it.
+ */
+# define _CUPS_DEPRECATED __attribute__ ((deprecated))
+# ifdef _CUPS_HAS_DEPRECATED_WITH_MESSAGE
+# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated(m)))
+# else
+# define _CUPS_DEPRECATED_MSG(m) __attribute__ ((deprecated))
+# endif /* _CUPS_HAS_DEPRECATED_WITH_MESSAGE */
+# ifdef _CUPS_SOURCE
+# define _CUPS_INTERNAL_MSG(m)
+# elif defined(_CUPS_HAS_UNAVAILABLE_WITH_MESSAGE)
+# define _CUPS_INTERNAL_MSG(m) __attribute__ ((unavailable(m)))
+# elif defined(_CUPS_HAS_DEPRECATED_WITH_MESSAGE)
+# define _CUPS_INTERNAL_MSG(m) __attribute__ ((deprecated(m)))
+# else
+# define _CUPS_INTERNAL_MSG(m) __attribute__ ((deprecated))
+# endif /* _CUPS_SOURCE */
+# endif /* !_CUPS_HAS_DEPRECATED || (_CUPS_SOURCE && !_CUPS_NO_DEPRECATED) */
# ifndef __GNUC__
# define __attribute__(x)