From owner-freebsd-java@FreeBSD.ORG Fri Feb 15 15:40:02 2008 Return-Path: Delivered-To: freebsd-java@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 897FE16A420 for ; Fri, 15 Feb 2008 15:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4BD2913C45B for ; Fri, 15 Feb 2008 15:40:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m1FFe2BD005589 for ; Fri, 15 Feb 2008 15:40:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m1FFe1EC005588; Fri, 15 Feb 2008 15:40:01 GMT (envelope-from gnats) Resent-Date: Fri, 15 Feb 2008 15:40:01 GMT Resent-Message-Id: <200802151540.m1FFe1EC005588@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-java@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dan Nelson Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A34B16A468 for ; Fri, 15 Feb 2008 15:35:56 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.freebsd.org (Postfix) with ESMTP id 1EEA713C455 for ; Fri, 15 Feb 2008 15:35:53 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.2/8.14.2) id m1FFZrn4003975; Fri, 15 Feb 2008 09:35:53 -0600 (CST) (envelope-from dan) Message-Id: <200802151535.m1FFZrn4003975@dan.emsphone.com> Date: Fri, 15 Feb 2008 09:35:53 -0600 (CST) From: Dan Nelson To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: java/120718: [patch] Completely remove jdk16 dependency on cups-base X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Feb 2008 15:40:02 -0000 >Number: 120718 >Category: java >Synopsis: [patch] Completely remove jdk16 dependency on cups-base >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-java >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Feb 15 15:40:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Dan Nelson >Release: FreeBSD 7.0-PRERELEASE i386 >Organization: The Allant Group >Environment: System: FreeBSD dan.emsphone.com 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #532: Mon Jan 28 09:37:54 CST 2008 zsh@dan.emsphone.com:/usr/src-7/sys/i386/compile/DANSMP i386 >Description: The jdk16 port currently requires the cups-base port to be installed to build, which causes havok for any machine not using cups, because cups-base installs incompatible lp/lpq/lpr binaries into /usr/local/bin . Luckily, the java source doesn't really require cups at all; it only wants to #include a few headers. >How-To-Repeat: >Fix: The following patch adds the 7 cups headers used by CUPSfuncs.c to the files/cups/ directory and tells the build system to look there. Hopefully it can be added to the upcoming jdk160u3 port update. Index: Makefile =================================================================== RCS file: /home/ncvs/ports/java/jdk16/Makefile,v retrieving revision 1.154 diff -u -r1.154 Makefile --- Makefile 3 Feb 2008 18:46:25 -0000 1.154 +++ Makefile 14 Feb 2008 23:18:24 -0000 @@ -20,8 +20,7 @@ BUILD_DEPENDS= zip:${PORTSDIR}/archivers/zip \ unzip:${PORTSDIR}/archivers/unzip \ - ${X11BASE}/lib/libXm.so:${PORTSDIR}/x11-toolkits/open-motif \ - ${LOCALBASE}/include/cups/cups.h:${PORTSDIR}/print/cups-base + ${X11BASE}/lib/libXm.so:${PORTSDIR}/x11-toolkits/open-motif RUN_DEPENDS= javavm:${PORTSDIR}/java/javavmwrapper OPTIONS= DEBUG "Enable debugging support" off \ @@ -136,6 +135,7 @@ SKIP_FASTDEBUG_BUILD="true" \ LOCALBASE="${LOCALBASE}" \ X11BASE="${X11BASE}" \ + FILESDIR="${FILESDIR}" \ PTHREAD_LIBS="${PTHREAD_LIBS}" .if defined(WITH_DEBUG) Index: files/patch-j2se-shared-Defs-bsd.gmk =================================================================== RCS file: /home/ncvs/ports/java/jdk16/files/patch-j2se-shared-Defs-bsd.gmk,v retrieving revision 1.1 diff -u -r1.1 patch-j2se-shared-Defs-bsd.gmk --- files/patch-j2se-shared-Defs-bsd.gmk 5 Aug 2007 20:39:49 -0000 1.1 +++ files/patch-j2se-shared-Defs-bsd.gmk 14 Feb 2008 23:09:55 -0000 @@ -16,7 +16,7 @@ # CUPS -_CUPS_HEADERS_PATH=/usr/local/include -+_CUPS_HEADERS_PATH=${LOCALBASE}/include ++_CUPS_HEADERS_PATH=${FILESDIR} # JDK_IMPORT_PATH: location of previously built JDK (this version). ifdef ALT_JDK_IMPORT_PATH Index: files/cups/array.h =================================================================== RCS file: files/cups/array.h diff -N files/cups/array.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/cups/array.h 11 Jul 2007 21:46:42 -0000 @@ -0,0 +1,83 @@ +/* + * "$Id: array.h 6649 2007-07-11 21:46:42Z mike $" + * + * Sorted array definitions for the Common UNIX Printing System (CUPS). + * + * Copyright 2007 by Apple Inc. + * Copyright 1997-2007 by Easy Software Products. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * This file is subject to the Apple OS-Developed Software exception. + */ + +#ifndef _CUPS_ARRAY_H_ +# define _CUPS_ARRAY_H_ + +/* + * Include necessary headers... + */ + +# include + + +/* + * C++ magic... + */ + +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ + + +/* + * Types and structures... + */ + +typedef struct _cups_array_s cups_array_t; + /**** CUPS array type ****/ +typedef int (*cups_array_func_t)(void *first, void *second, void *data); + /**** Array comparison function ****/ +typedef int (*cups_ahash_func_t)(void *element, void *data); + /**** Array hash function ****/ + + +/* + * Functions... + */ + +extern int cupsArrayAdd(cups_array_t *a, void *e); +extern void cupsArrayClear(cups_array_t *a); +extern int cupsArrayCount(cups_array_t *a); +extern void *cupsArrayCurrent(cups_array_t *a); +extern void cupsArrayDelete(cups_array_t *a); +extern cups_array_t *cupsArrayDup(cups_array_t *a); +extern void *cupsArrayFind(cups_array_t *a, void *e); +extern void *cupsArrayFirst(cups_array_t *a); +extern int cupsArrayGetIndex(cups_array_t *a); +extern int cupsArrayGetInsert(cups_array_t *a); +extern void *cupsArrayIndex(cups_array_t *a, int n); +extern int cupsArrayInsert(cups_array_t *a, void *e); +extern void *cupsArrayLast(cups_array_t *a); +extern cups_array_t *cupsArrayNew(cups_array_func_t f, void *d); +extern cups_array_t *cupsArrayNew2(cups_array_func_t f, void *d, + cups_ahash_func_t h, int hsize); +extern void *cupsArrayNext(cups_array_t *a); +extern void *cupsArrayPrev(cups_array_t *a); +extern int cupsArrayRemove(cups_array_t *a, void *e); +extern void *cupsArrayRestore(cups_array_t *a); +extern int cupsArraySave(cups_array_t *a); +extern void *cupsArrayUserData(cups_array_t *a); + +# ifdef __cplusplus +} +# endif /* __cplusplus */ +#endif /* !_CUPS_ARRAY_H_ */ + +/* + * End of "$Id: array.h 6649 2007-07-11 21:46:42Z mike $". + */ Index: files/cups/cups.h =================================================================== RCS file: files/cups/cups.h diff -N files/cups/cups.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/cups/cups.h 19 Sep 2007 21:51:55 -0000 @@ -0,0 +1,260 @@ +/* + * "$Id: cups.h 6981 2007-09-19 21:51:55Z mike $" + * + * API definitions for the Common UNIX Printing System (CUPS). + * + * Copyright 2007 by Apple Inc. + * Copyright 1997-2007 by Easy Software Products. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * This file is subject to the Apple OS-Developed Software exception. + */ + +#ifndef _CUPS_CUPS_H_ +# define _CUPS_CUPS_H_ + +/* + * Include necessary headers... + */ + +# include +# if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED) +# define __CUPS_SSIZE_T_DEFINED +/* Windows does not support the ssize_t type, so map it to off_t... */ +typedef off_t ssize_t; /* @private@ */ +# endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */ + +# include "ipp.h" +# include "ppd.h" +# include "language.h" + + +/* + * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get + * a warning at compile-time. + */ + +# if defined(__GNUC__) && __GNUC__ > 2 +# define _CUPS_DEPRECATED __attribute__ ((__deprecated__)) +# else +# define _CUPS_DEPRECATED +# endif /* __GNUC__ && __GNUC__ > 2 */ + + +/* + * C++ magic... + */ + +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ + + +/* + * Constants... + */ + +# define CUPS_VERSION 1.0303 +# define CUPS_VERSION_MAJOR 1 +# define CUPS_VERSION_MINOR 3 +# define CUPS_VERSION_PATCH 3 +# define CUPS_DATE_ANY -1 + + +/* + * Types and structures... + */ + +typedef unsigned cups_ptype_t; /**** Printer Type/Capability Bits ****/ +enum cups_ptype_e /* Not a typedef'd enum so we can OR */ +{ + CUPS_PRINTER_LOCAL = 0x0000, /* Local printer or class */ + CUPS_PRINTER_CLASS = 0x0001, /* Printer class */ + CUPS_PRINTER_REMOTE = 0x0002, /* Remote printer or class */ + CUPS_PRINTER_BW = 0x0004, /* Can do B&W printing */ + CUPS_PRINTER_COLOR = 0x0008, /* Can do color printing */ + CUPS_PRINTER_DUPLEX = 0x0010, /* Can do duplexing */ + CUPS_PRINTER_STAPLE = 0x0020, /* Can staple output */ + CUPS_PRINTER_COPIES = 0x0040, /* Can do copies */ + CUPS_PRINTER_COLLATE = 0x0080, /* Can collage copies */ + CUPS_PRINTER_PUNCH = 0x0100, /* Can punch output */ + CUPS_PRINTER_COVER = 0x0200, /* Can cover output */ + CUPS_PRINTER_BIND = 0x0400, /* Can bind output */ + CUPS_PRINTER_SORT = 0x0800, /* Can sort output */ + CUPS_PRINTER_SMALL = 0x1000, /* Can do Letter/Legal/A4 */ + CUPS_PRINTER_MEDIUM = 0x2000, /* Can do Tabloid/B/C/A3/A2 */ + CUPS_PRINTER_LARGE = 0x4000, /* Can do D/E/A1/A0 */ + CUPS_PRINTER_VARIABLE = 0x8000, /* Can do variable sizes */ + CUPS_PRINTER_IMPLICIT = 0x10000, /* Implicit class */ + CUPS_PRINTER_DEFAULT = 0x20000, /* Default printer on network */ + CUPS_PRINTER_FAX = 0x40000, /* Fax queue */ + CUPS_PRINTER_REJECTING = 0x80000, /* Printer is rejecting jobs */ + CUPS_PRINTER_DELETE = 0x100000, /* Delete printer @since CUPS 1.2@ */ + CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared @since CUPS 1.2@ */ + CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication @since CUPS 1.2@ */ + CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands @since CUPS 1.2@ */ + CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered and added @since CUPS 1.3@ */ + CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT | DEFAULT | FAX | REJECTING | DELETE | NOT_SHARED | AUTHENTICATED | COMMANDS | DISCOVERED) */ +}; + +typedef const char *(*cups_password_cb_t)(const char *); + /**** Password callback ****/ + +typedef struct cups_option_s /**** Printer Options ****/ +{ + char *name; /* Name of option */ + char *value; /* Value of option */ +} cups_option_t; + +typedef struct cups_dest_s /**** Destination ****/ +{ + char *name, /* Printer or class name */ + *instance; /* Local instance name or NULL */ + int is_default; /* Is this printer the default? */ + int num_options; /* Number of options */ + cups_option_t *options; /* Options */ +} cups_dest_t; + +typedef struct cups_job_s /**** Job ****/ +{ + int id; /* The job ID */ + char *dest; /* Printer or class name */ + char *title; /* Title/job name */ + char *user; /* User the submitted the job */ + char *format; /* Document format */ + ipp_jstate_t state; /* Job state */ + int size; /* Size in kilobytes */ + int priority; /* Priority (1-100) */ + time_t completed_time; /* Time the job was completed */ + time_t creation_time; /* Time the job was created */ + time_t processing_time; /* Time the job was processed */ +} cups_job_t; + + +/* + * Functions... + */ + +extern int cupsCancelJob(const char *printer, int job); +extern ipp_t *cupsDoFileRequest(http_t *http, ipp_t *request, + const char *resource, + const char *filename); +extern ipp_t *cupsDoRequest(http_t *http, ipp_t *request, + const char *resource); +extern http_encryption_t cupsEncryption(void); +extern void cupsFreeJobs(int num_jobs, cups_job_t *jobs); +extern int cupsGetClasses(char ***classes) _CUPS_DEPRECATED; +extern const char *cupsGetDefault(void); +extern int cupsGetJobs(cups_job_t **jobs, const char *dest, + int myjobs, int completed); +extern const char *cupsGetPPD(const char *printer); +extern int cupsGetPrinters(char ***printers) _CUPS_DEPRECATED; +extern ipp_status_t cupsLastError(void); +extern int cupsPrintFile(const char *printer, const char *filename, + const char *title, int num_options, + cups_option_t *options); +extern int cupsPrintFiles(const char *printer, int num_files, + const char **files, const char *title, + int num_options, cups_option_t *options); +extern char *cupsTempFile(char *filename, int len) _CUPS_DEPRECATED; +extern int cupsTempFd(char *filename, int len); + +extern int cupsAddDest(const char *name, const char *instance, + int num_dests, cups_dest_t **dests); +extern void cupsFreeDests(int num_dests, cups_dest_t *dests); +extern cups_dest_t *cupsGetDest(const char *name, const char *instance, + int num_dests, cups_dest_t *dests); +extern int cupsGetDests(cups_dest_t **dests); +extern void cupsSetDests(int num_dests, cups_dest_t *dests); + +extern int cupsAddOption(const char *name, const char *value, + int num_options, cups_option_t **options); +extern void cupsEncodeOptions(ipp_t *ipp, int num_options, + cups_option_t *options); +extern void cupsFreeOptions(int num_options, cups_option_t *options); +extern const char *cupsGetOption(const char *name, int num_options, + cups_option_t *options); +extern int cupsMarkOptions(ppd_file_t *ppd, int num_options, + cups_option_t *options); +extern int cupsParseOptions(const char *arg, int num_options, + cups_option_t **options); + +extern const char *cupsGetPassword(const char *prompt); +extern const char *cupsServer(void); +extern void cupsSetEncryption(http_encryption_t e); +extern void cupsSetPasswordCB(cups_password_cb_t cb); +extern void cupsSetServer(const char *server); +extern void cupsSetUser(const char *user); +extern const char *cupsUser(void); + +/**** New in CUPS 1.1.20 ****/ +extern int cupsDoAuthentication(http_t *http, const char *method, + const char *resource); +extern http_status_t cupsGetFile(http_t *http, const char *resource, + const char *filename); +extern http_status_t cupsGetFd(http_t *http, const char *resource, int fd); +extern http_status_t cupsPutFile(http_t *http, const char *resource, + const char *filename); +extern http_status_t cupsPutFd(http_t *http, const char *resource, int fd); + +/**** New in CUPS 1.1.21 ****/ +extern const char *cupsGetDefault2(http_t *http); +extern int cupsGetDests2(http_t *http, cups_dest_t **dests); +extern int cupsGetJobs2(http_t *http, cups_job_t **jobs, + const char *dest, int myjobs, + int completed); +extern const char *cupsGetPPD2(http_t *http, const char *printer); +extern int cupsPrintFile2(http_t *http, const char *printer, + const char *filename, + const char *title, int num_options, + cups_option_t *options); +extern int cupsPrintFiles2(http_t *http, const char *printer, + int num_files, const char **files, + const char *title, int num_options, + cups_option_t *options); +extern int cupsSetDests2(http_t *http, int num_dests, + cups_dest_t *dests); + +/**** New in CUPS 1.2 ****/ +extern ssize_t cupsBackChannelRead(char *buffer, size_t bytes, + double timeout); +extern ssize_t cupsBackChannelWrite(const char *buffer, size_t bytes, + double timeout); +extern void cupsEncodeOptions2(ipp_t *ipp, int num_options, + cups_option_t *options, + ipp_tag_t group_tag); +extern const char *cupsLastErrorString(void); +extern char *cupsNotifySubject(cups_lang_t *lang, ipp_t *event); +extern char *cupsNotifyText(cups_lang_t *lang, ipp_t *event); +extern int cupsRemoveOption(const char *name, int num_options, + cups_option_t **options); +extern cups_file_t *cupsTempFile2(char *filename, int len); + +/**** New in CUPS 1.3 ****/ +extern ipp_t *cupsDoIORequest(http_t *http, ipp_t *request, + const char *resource, int infile, + int outfile); +extern char *cupsGetServerPPD(http_t *http, const char *name); +extern int cupsRemoveDest(const char *name, + const char *instance, + int num_dests, cups_dest_t **dests); +extern void cupsSetDefaultDest(const char *name, + const char *instance, + int num_dests, + cups_dest_t *dests); + + +# ifdef __cplusplus +} +# endif /* __cplusplus */ + +#endif /* !_CUPS_CUPS_H_ */ + +/* + * End of "$Id: cups.h 6981 2007-09-19 21:51:55Z mike $". + */ Index: files/cups/file.h =================================================================== RCS file: files/cups/file.h diff -N files/cups/file.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/cups/file.h 11 Jul 2007 21:46:42 -0000 @@ -0,0 +1,104 @@ +/* + * "$Id: file.h 6649 2007-07-11 21:46:42Z mike $" + * + * Public file definitions for the Common UNIX Printing System (CUPS). + * + * Since stdio files max out at 256 files on many systems, we have to + * write similar functions without this limit. At the same time, using + * our own file functions allows us to provide transparent support of + * gzip'd print files, PPD files, etc. + * + * Copyright 2007 by Apple Inc. + * Copyright 1997-2007 by Easy Software Products, all rights reserved. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". + */ + +#ifndef _CUPS_FILE_H_ +# define _CUPS_FILE_H_ + + +/* + * Include necessary headers... + */ + +# include +# if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED) +# define __CUPS_SSIZE_T_DEFINED +/* Windows does not support the ssize_t type, so map it to off_t... */ +typedef off_t ssize_t; /* @private@ */ +# endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */ + + +/* + * C++ magic... + */ + +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ + + +/* + * CUPS file definitions... + */ + +# define CUPS_FILE_NONE 0 /* No compression */ +# define CUPS_FILE_GZIP 1 /* GZIP compression */ + + +/* + * Types and structures... + */ + +typedef struct _cups_file_s cups_file_t;/**** CUPS file type ****/ + + +/* + * Prototypes... + */ + +extern int cupsFileClose(cups_file_t *fp); +extern int cupsFileCompression(cups_file_t *fp); +extern int cupsFileEOF(cups_file_t *fp); +extern const char *cupsFileFind(const char *filename, const char *path, + int executable, char *buffer, + int bufsize); +extern int cupsFileFlush(cups_file_t *fp); +extern int cupsFileGetChar(cups_file_t *fp); +extern char *cupsFileGetConf(cups_file_t *fp, char *buf, size_t buflen, + char **value, int *linenum); +extern size_t cupsFileGetLine(cups_file_t *fp, char *buf, + size_t buflen); +extern char *cupsFileGets(cups_file_t *fp, char *buf, size_t buflen); +extern int cupsFileLock(cups_file_t *fp, int block); +extern int cupsFileNumber(cups_file_t *fp); +extern cups_file_t *cupsFileOpen(const char *filename, const char *mode); +extern cups_file_t *cupsFileOpenFd(int fd, const char *mode); +extern int cupsFilePeekChar(cups_file_t *fp); +extern int cupsFilePrintf(cups_file_t *fp, const char *format, ...); +extern int cupsFilePutChar(cups_file_t *fp, int c); +extern int cupsFilePuts(cups_file_t *fp, const char *s); +extern ssize_t cupsFileRead(cups_file_t *fp, char *buf, size_t bytes); +extern off_t cupsFileRewind(cups_file_t *fp); +extern off_t cupsFileSeek(cups_file_t *fp, off_t pos); +extern cups_file_t *cupsFileStderr(void); +extern cups_file_t *cupsFileStdin(void); +extern cups_file_t *cupsFileStdout(void); +extern off_t cupsFileTell(cups_file_t *fp); +extern int cupsFileUnlock(cups_file_t *fp); +extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes); + + +# ifdef __cplusplus +} +# endif /* __cplusplus */ +#endif /* !_CUPS_FILE_H_ */ + +/* + * End of "$Id: file.h 6649 2007-07-11 21:46:42Z mike $". + */ Index: files/cups/http.h =================================================================== RCS file: files/cups/http.h diff -N files/cups/http.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/cups/http.h 25 Jul 2007 17:19:09 -0000 @@ -0,0 +1,461 @@ +/* + * "$Id: http.h 6722 2007-07-25 17:19:09Z mike $" + * + * Hyper-Text Transport Protocol definitions for the Common UNIX Printing + * System (CUPS). + * + * Copyright 2007 by Apple Inc. + * Copyright 1997-2007 by Easy Software Products, all rights reserved. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * This file is subject to the Apple OS-Developed Software exception. + */ + +#ifndef _CUPS_HTTP_H_ +# define _CUPS_HTTP_H_ + +/* + * Include necessary headers... + */ + +# include +# include +# include +# ifdef WIN32 +# ifndef __CUPS_SSIZE_T_DEFINED +# define __CUPS_SSIZE_T_DEFINED +/* Windows does not support the ssize_t type, so map it to off_t... */ +typedef off_t ssize_t; /* @private@ */ +# endif /* !__CUPS_SSIZE_T_DEFINED */ +# include +# include +# else +# ifdef __sgi +# define INET6 /* IRIX IPv6 support... */ +# endif /* __sgi */ +# include +# include +# include +# include +# include +# include +# include +# include +# if !defined(__APPLE__) || !defined(TCP_NODELAY) +# include +# endif /* !__APPLE__ || !TCP_NODELAY */ +# if defined(AF_UNIX) && !defined(AF_LOCAL) +# define AF_LOCAL AF_UNIX /* Older UNIX's have old names... */ +# endif /* AF_UNIX && !AF_LOCAL */ +# ifdef AF_LOCAL +# include +# endif /* AF_LOCAL */ +# if defined(LOCAL_PEERCRED) && !defined(SO_PEERCRED) +# define SO_PEERCRED LOCAL_PEERCRED +# endif /* LOCAL_PEERCRED && !SO_PEERCRED */ +# endif /* WIN32 */ + +/* + * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get + * a warning at compile-time. + */ + +# if defined(__GNUC__) && __GNUC__ > 2 +# define _HTTP_DEPRECATED __attribute__ ((__deprecated__)) +# else +# define _HTTP_DEPRECATED +# endif /* __GNUC__ && __GNUC__ > 2 */ + + +/* + * C++ magic... + */ + +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ + + +/* + * Oh, the wonderful world of IPv6 compatibility. Apparently some + * implementations expose the (more logical) 32-bit address parts + * to everyone, while others only expose it to kernel code... To + * make supporting IPv6 even easier, each vendor chose different + * core structure and union names, so the same defines or code + * can't be used on all platforms. + * + * The following will likely need tweaking on new platforms that + * support IPv6 - the "s6_addr32" define maps to the 32-bit integer + * array in the in6_addr union, which is named differently on various + * platforms. + */ + +#if defined(AF_INET6) && !defined(s6_addr32) +# if defined(__sun) +# define s6_addr32 _S6_un._S6_u32 +# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || 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 + * requires special casing of all raw address code... + */ +# define s6_addr32 error_need_win32_specific_code +# endif /* __sun */ +#endif /* AF_INET6 && !s6_addr32 */ + + +/* + * Limits... + */ + +# define HTTP_MAX_URI 1024 /* Max length of URI string */ +# define HTTP_MAX_HOST 256 /* Max length of hostname string */ +# define HTTP_MAX_BUFFER 2048 /* Max length of data buffer */ +# define HTTP_MAX_VALUE 256 /* Max header field value length */ + + +/* + * Types and structures... + */ + +typedef enum http_auth_e /**** HTTP authentication types ****/ +{ + HTTP_AUTH_NONE, /* No authentication in use */ + HTTP_AUTH_BASIC, /* Basic authentication in use */ + HTTP_AUTH_MD5, /* Digest authentication in use */ + HTTP_AUTH_MD5_SESS, /* MD5-session authentication in use */ + HTTP_AUTH_MD5_INT, /* Digest authentication in use for body */ + HTTP_AUTH_MD5_SESS_INT, /* MD5-session authentication in use for body */ + HTTP_AUTH_NEGOTIATE /* GSSAPI authentication in use @since CUPS 1.3@ */ +} http_auth_t; + +typedef enum http_encoding_e /**** HTTP transfer encoding values ****/ +{ + HTTP_ENCODE_LENGTH, /* Data is sent with Content-Length */ + HTTP_ENCODE_CHUNKED, /* Data is chunked */ + HTTP_ENCODE_FIELDS /* Sending HTTP fields */ +} http_encoding_t; + +typedef enum http_encryption_e /**** HTTP encryption values ****/ +{ + HTTP_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */ + HTTP_ENCRYPT_NEVER, /* Never encrypt */ + HTTP_ENCRYPT_REQUIRED, /* Encryption is required (TLS upgrade) */ + HTTP_ENCRYPT_ALWAYS /* Always encrypt (SSL) */ +} http_encryption_t; + +typedef enum http_field_e /**** HTTP field names ****/ +{ + HTTP_FIELD_UNKNOWN = -1, /* Unknown field */ + HTTP_FIELD_ACCEPT_LANGUAGE, /* Accept-Language field */ + HTTP_FIELD_ACCEPT_RANGES, /* Accept-Ranges field */ + HTTP_FIELD_AUTHORIZATION, /* Authorization field */ + HTTP_FIELD_CONNECTION, /* Connection field */ + HTTP_FIELD_CONTENT_ENCODING, /* Content-Encoding field */ + HTTP_FIELD_CONTENT_LANGUAGE, /* Content-Language field */ + HTTP_FIELD_CONTENT_LENGTH, /* Content-Length field */ + HTTP_FIELD_CONTENT_LOCATION, /* Content-Location field */ + HTTP_FIELD_CONTENT_MD5, /* Content-MD5 field */ + HTTP_FIELD_CONTENT_RANGE, /* Content-Range field */ + HTTP_FIELD_CONTENT_TYPE, /* Content-Type field */ + HTTP_FIELD_CONTENT_VERSION, /* Content-Version field */ + HTTP_FIELD_DATE, /* Date field */ + HTTP_FIELD_HOST, /* Host field */ + HTTP_FIELD_IF_MODIFIED_SINCE, /* If-Modified-Since field */ + HTTP_FIELD_IF_UNMODIFIED_SINCE, /* If-Unmodified-Since field */ + HTTP_FIELD_KEEP_ALIVE, /* Keep-Alive field */ + HTTP_FIELD_LAST_MODIFIED, /* Last-Modified field */ + HTTP_FIELD_LINK, /* Link field */ + HTTP_FIELD_LOCATION, /* Location field */ + HTTP_FIELD_RANGE, /* Range field */ + HTTP_FIELD_REFERER, /* Referer field */ + HTTP_FIELD_RETRY_AFTER, /* Retry-After field */ + HTTP_FIELD_TRANSFER_ENCODING, /* Transfer-Encoding field */ + HTTP_FIELD_UPGRADE, /* Upgrade field */ + HTTP_FIELD_USER_AGENT, /* User-Agent field */ + HTTP_FIELD_WWW_AUTHENTICATE, /* WWW-Authenticate field */ + HTTP_FIELD_MAX /* Maximum field index */ +} http_field_t; + +typedef enum http_keepalive_e /**** HTTP keep-alive values ****/ +{ + HTTP_KEEPALIVE_OFF = 0, /* No keep alive support */ + HTTP_KEEPALIVE_ON /* Use keep alive */ +} http_keepalive_t; + +typedef enum http_state_e /**** HTTP state values; states + **** are server-oriented... + ****/ +{ + HTTP_WAITING, /* Waiting for command */ + HTTP_OPTIONS, /* OPTIONS command, waiting for blank line */ + HTTP_GET, /* GET command, waiting for blank line */ + HTTP_GET_SEND, /* GET command, sending data */ + HTTP_HEAD, /* HEAD command, waiting for blank line */ + HTTP_POST, /* POST command, waiting for blank line */ + HTTP_POST_RECV, /* POST command, receiving data */ + HTTP_POST_SEND, /* POST command, sending data */ + HTTP_PUT, /* PUT command, waiting for blank line */ + HTTP_PUT_RECV, /* PUT command, receiving data */ + HTTP_DELETE, /* DELETE command, waiting for blank line */ + HTTP_TRACE, /* TRACE command, waiting for blank line */ + HTTP_CLOSE, /* CLOSE command, waiting for blank line */ + HTTP_STATUS /* Command complete, sending status */ +} http_state_t; + +typedef enum http_status_e /**** HTTP status codes ****/ +{ + HTTP_ERROR = -1, /* An error response from httpXxxx() */ + + HTTP_CONTINUE = 100, /* Everything OK, keep going... */ + HTTP_SWITCHING_PROTOCOLS, /* HTTP upgrade to TLS/SSL */ + + HTTP_OK = 200, /* OPTIONS/GET/HEAD/POST/TRACE command was successful */ + HTTP_CREATED, /* PUT command was successful */ + HTTP_ACCEPTED, /* DELETE command was successful */ + HTTP_NOT_AUTHORITATIVE, /* Information isn't authoritative */ + HTTP_NO_CONTENT, /* Successful command, no new data */ + HTTP_RESET_CONTENT, /* Content was reset/recreated */ + HTTP_PARTIAL_CONTENT, /* Only a partial file was recieved/sent */ + + HTTP_MULTIPLE_CHOICES = 300, /* Multiple files match request */ + HTTP_MOVED_PERMANENTLY, /* Document has moved permanently */ + HTTP_MOVED_TEMPORARILY, /* Document has moved temporarily */ + HTTP_SEE_OTHER, /* See this other link... */ + HTTP_NOT_MODIFIED, /* File not modified */ + HTTP_USE_PROXY, /* Must use a proxy to access this URI */ + + HTTP_BAD_REQUEST = 400, /* Bad request */ + HTTP_UNAUTHORIZED, /* Unauthorized to access host */ + HTTP_PAYMENT_REQUIRED, /* Payment required */ + HTTP_FORBIDDEN, /* Forbidden to access this URI */ + HTTP_NOT_FOUND, /* URI was not found */ + HTTP_METHOD_NOT_ALLOWED, /* Method is not allowed */ + HTTP_NOT_ACCEPTABLE, /* Not Acceptable */ + HTTP_PROXY_AUTHENTICATION, /* Proxy Authentication is Required */ + HTTP_REQUEST_TIMEOUT, /* Request timed out */ + HTTP_CONFLICT, /* Request is self-conflicting */ + HTTP_GONE, /* Server has gone away */ + HTTP_LENGTH_REQUIRED, /* A content length or encoding is required */ + HTTP_PRECONDITION, /* Precondition failed */ + 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_NOT_IMPLEMENTED, /* Feature not implemented */ + HTTP_BAD_GATEWAY, /* Bad gateway */ + HTTP_SERVICE_UNAVAILABLE, /* Service is unavailable */ + HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */ + HTTP_NOT_SUPPORTED /* HTTP version not supported */ +} http_status_t; + +typedef enum http_uri_status_e /**** URI separation status @since CUPS1.2@ ****/ +{ + HTTP_URI_OVERFLOW = -8, /* URI buffer for httpAssembleURI is too small */ + HTTP_URI_BAD_ARGUMENTS = -7, /* Bad arguments to function (error) */ + HTTP_URI_BAD_RESOURCE = -6, /* Bad resource in URI (error) */ + HTTP_URI_BAD_PORT = -5, /* Bad port number in URI (error) */ + HTTP_URI_BAD_HOSTNAME = -4, /* Bad hostname in URI (error) */ + HTTP_URI_BAD_USERNAME = -3, /* Bad username in URI (error) */ + HTTP_URI_BAD_SCHEME = -2, /* Bad scheme in URI (error) */ + HTTP_URI_BAD_URI = -1, /* Bad/empty URI (error) */ + HTTP_URI_OK = 0, /* URI decoded OK */ + HTTP_URI_MISSING_SCHEME, /* Missing scheme in URI (warning) */ + HTTP_URI_UNKNOWN_SCHEME, /* Unknown scheme in URI (warning) */ + HTTP_URI_MISSING_RESOURCE /* Missing resource in URI (warning) */ +} http_uri_status_t; + +typedef enum http_uri_coding_e /**** URI en/decode flags ****/ +{ + HTTP_URI_CODING_NONE = 0, /* Don't en/decode anything */ + HTTP_URI_CODING_USERNAME = 1, /* En/decode the username portion */ + HTTP_URI_CODING_HOSTNAME = 2, /* En/decode the hostname portion */ + HTTP_URI_CODING_RESOURCE = 4, /* En/decode the resource portion */ + HTTP_URI_CODING_MOST = 7, /* En/decode all but the query */ + HTTP_URI_CODING_QUERY = 8, /* En/decode the query portion */ + HTTP_URI_CODING_ALL = 15 /* En/decode everything */ +} http_uri_coding_t; + +typedef enum http_version_e /**** HTTP version numbers ****/ +{ + HTTP_0_9 = 9, /* HTTP/0.9 */ + HTTP_1_0 = 100, /* HTTP/1.0 */ + HTTP_1_1 = 101 /* HTTP/1.1 */ +} http_version_t; + +typedef union _http_addr_u /**** Socket address union, which + **** makes using IPv6 and other + **** address types easier and + **** more portable. @since CUPS 1.2@ + ****/ +{ + struct sockaddr addr; /* Base structure for family value */ + struct sockaddr_in ipv4; /* IPv4 address */ +#ifdef AF_INET6 + struct sockaddr_in6 ipv6; /* IPv6 address */ +#endif /* AF_INET6 */ +#ifdef AF_LOCAL + struct sockaddr_un un; /* Domain socket file */ +#endif /* AF_LOCAL */ + char pad[256]; /* Padding to ensure binary compatibility */ +} http_addr_t; + +typedef struct http_addrlist_s /**** Socket address list, which is + **** used to enumerate all of the + **** addresses that are associated + **** with a hostname. @since CUPS 1.2@ + ****/ +{ + struct http_addrlist_s *next; /* Pointer to next address in list */ + http_addr_t addr; /* Address */ +} http_addrlist_t; + +typedef struct _http_s http_t; /**** HTTP connection type ****/ + + +/* + * Prototypes... + */ + +extern void httpBlocking(http_t *http, int b); +extern int httpCheck(http_t *http); +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); +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); +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); +extern int httpHead(http_t *http, const char *uri); +extern void httpInitialize(void); +extern int httpOptions(http_t *http, const char *uri); +extern int httpPost(http_t *http, const char *uri); +extern int httpPrintf(http_t *http, const char *format, ...) +# ifdef __GNUC__ +__attribute__ ((__format__ (__printf__, 2, 3))) +# endif /* __GNUC__ */ +; +extern int httpPut(http_t *http, const char *uri); +extern int httpRead(http_t *http, char *buffer, int length) _HTTP_DEPRECATED; +extern int httpReconnect(http_t *http); +extern void httpSeparate(const char *uri, char *method, + char *username, char *host, int *port, + char *resource) _HTTP_DEPRECATED; +extern void httpSetField(http_t *http, http_field_t field, + const char *value); +extern const char *httpStatus(http_status_t status); +extern int httpTrace(http_t *http, const char *uri); +extern http_status_t httpUpdate(http_t *http); +extern int httpWrite(http_t *http, const char *buffer, int length) _HTTP_DEPRECATED; +extern char *httpEncode64(char *out, const char *in) _HTTP_DEPRECATED; +extern char *httpDecode64(char *out, const char *in) _HTTP_DEPRECATED; +extern int httpGetLength(http_t *http) _HTTP_DEPRECATED; +extern char *httpMD5(const char *, const char *, const char *, + char [33]); +extern char *httpMD5Final(const char *, const char *, const char *, + char [33]); +extern char *httpMD5String(const unsigned char *, char [33]); + +/**** New in CUPS 1.1.19 ****/ +extern void httpClearCookie(http_t *http); +extern const char *httpGetCookie(http_t *http); +extern void httpSetCookie(http_t *http, const char *cookie); +extern int httpWait(http_t *http, int msec); + +/**** New in CUPS 1.1.21 ****/ +extern char *httpDecode64_2(char *out, int *outlen, const char *in); +extern char *httpEncode64_2(char *out, int outlen, const char *in, + int inlen); +extern void httpSeparate2(const char *uri, + char *method, int methodlen, + char *username, int usernamelen, + char *host, int hostlen, int *port, + char *resource, int resourcelen) _HTTP_DEPRECATED; + +/**** New in CUPS 1.2 ****/ +extern int httpAddrAny(const http_addr_t *addr); +extern http_addrlist_t *httpAddrConnect(http_addrlist_t *addrlist, int *sock); +extern int httpAddrEqual(const http_addr_t *addr1, + const http_addr_t *addr2); +extern void httpAddrFreeList(http_addrlist_t *addrlist); +extern http_addrlist_t *httpAddrGetList(const char *hostname, int family, + const char *service); +extern int httpAddrLength(const http_addr_t *addr); +extern int httpAddrLocalhost(const http_addr_t *addr); +extern char *httpAddrLookup(const http_addr_t *addr, + char *name, int namelen); +extern char *httpAddrString(const http_addr_t *addr, + char *s, int slen); +extern http_uri_status_t httpAssembleURI(http_uri_coding_t encoding, + char *uri, int urilen, + const char *scheme, + const char *username, + const char *host, int port, + const char *resource); +extern http_uri_status_t httpAssembleURIf(http_uri_coding_t encoding, + char *uri, int urilen, + const char *scheme, + const char *username, + 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 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); +extern ssize_t httpRead2(http_t *http, char *buffer, size_t length); +extern http_uri_status_t httpSeparateURI(http_uri_coding_t decoding, + const char *uri, + char *scheme, int schemelen, + 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); + +/**** New in CUPS 1.3 ****/ +extern char *httpGetAuthString(http_t *http); +extern void httpSetAuthString(http_t *http, const char *scheme, + const char *data); + +/* + * C++ magic... + */ + +# ifdef __cplusplus +} +# endif /* __cplusplus */ +#endif /* !_CUPS_HTTP_H_ */ + +/* + * End of "$Id: http.h 6722 2007-07-25 17:19:09Z mike $". + */ Index: files/cups/ipp.h =================================================================== RCS file: files/cups/ipp.h diff -N files/cups/ipp.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/cups/ipp.h 11 Jul 2007 21:46:42 -0000 @@ -0,0 +1,496 @@ +/* + * "$Id: ipp.h 6649 2007-07-11 21:46:42Z mike $" + * + * Internet Printing Protocol definitions for the Common UNIX Printing + * System (CUPS). + * + * Copyright 2007 by Apple Inc. + * Copyright 1997-2006 by Easy Software Products. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * This file is subject to the Apple OS-Developed Software exception. + */ + +#ifndef _CUPS_IPP_H_ +# define _CUPS_IPP_H_ + +/* + * Include necessary headers... + */ + +# include "http.h" + + +/* + * C++ magic... + */ + +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ + + +/* + * IPP version string... + */ + +# define IPP_VERSION "\001\001" + +/* + * IPP registered port number... + * + * Note: Applications should never use IPP_PORT, but instead use the + * ippPort() function to allow overrides via the IPP_PORT environment + * variable and services file if needed! + */ + +# define IPP_PORT 631 + +/* + * Common limits... + */ + +# define IPP_MAX_NAME 256 +# define IPP_MAX_VALUES 8 /* Power-of-2 allocation increment */ + + +/* + * Types and structures... + */ + +typedef enum ipp_tag_e /**** Format tags for attributes... ****/ +{ + IPP_TAG_ZERO = 0x00, /* Zero tag - used for separators */ + IPP_TAG_OPERATION, /* Operation group */ + IPP_TAG_JOB, /* Job group */ + IPP_TAG_END, /* End-of-attributes */ + IPP_TAG_PRINTER, /* Printer group */ + IPP_TAG_UNSUPPORTED_GROUP, /* Unsupported attributes group */ + IPP_TAG_SUBSCRIPTION, /* Subscription group */ + IPP_TAG_EVENT_NOTIFICATION, /* Event group */ + IPP_TAG_UNSUPPORTED_VALUE = 0x10, /* Unsupported value */ + IPP_TAG_DEFAULT, /* Default value */ + IPP_TAG_UNKNOWN, /* Unknown value */ + IPP_TAG_NOVALUE, /* No-value value */ + IPP_TAG_NOTSETTABLE = 0x15, /* Not-settable value */ + IPP_TAG_DELETEATTR, /* Delete-attribute value */ + IPP_TAG_ADMINDEFINE, /* Admin-defined value */ + IPP_TAG_INTEGER = 0x21, /* Integer value */ + IPP_TAG_BOOLEAN, /* Boolean value */ + IPP_TAG_ENUM, /* Enumeration value */ + IPP_TAG_STRING = 0x30, /* Octet string value */ + IPP_TAG_DATE, /* Date/time value */ + IPP_TAG_RESOLUTION, /* Resolution value */ + IPP_TAG_RANGE, /* Range value */ + IPP_TAG_BEGIN_COLLECTION, /* Beginning of collection value */ + IPP_TAG_TEXTLANG, /* Text-with-language value */ + IPP_TAG_NAMELANG, /* Name-with-language value */ + IPP_TAG_END_COLLECTION, /* End of collection value */ + IPP_TAG_TEXT = 0x41, /* Text value */ + IPP_TAG_NAME, /* Name value */ + IPP_TAG_KEYWORD = 0x44, /* Keyword value */ + IPP_TAG_URI, /* URI value */ + IPP_TAG_URISCHEME, /* URI scheme value */ + IPP_TAG_CHARSET, /* Character set value */ + IPP_TAG_LANGUAGE, /* Language value */ + IPP_TAG_MIMETYPE, /* MIME media type value */ + IPP_TAG_MEMBERNAME, /* Collection member name value */ + IPP_TAG_MASK = 0x7fffffff, /* Mask for copied attribute values */ + IPP_TAG_COPY = -0x7fffffff-1 /* Bitflag for copied attribute values */ +} ipp_tag_t; + +typedef enum ipp_res_e /**** Resolution units... ****/ +{ + IPP_RES_PER_INCH = 3, /* Pixels per inch */ + IPP_RES_PER_CM /* Pixels per centimeter */ +} ipp_res_t; + +typedef enum ipp_finish_e /**** Finishings... ****/ +{ + IPP_FINISHINGS_NONE = 3, /* No finishing */ + IPP_FINISHINGS_STAPLE, /* Staple (any location) */ + IPP_FINISHINGS_PUNCH, /* Punch (any location/count) */ + IPP_FINISHINGS_COVER, /* Add cover */ + IPP_FINISHINGS_BIND, /* Bind */ + IPP_FINISHINGS_SADDLE_STITCH, /* Staple interior */ + IPP_FINISHINGS_EDGE_STITCH, /* Stitch along any side */ + IPP_FINISHINGS_FOLD, /* Fold (any type) */ + IPP_FINISHINGS_TRIM, /* Trim (any type) */ + IPP_FINISHINGS_BALE, /* Bale (any type) */ + IPP_FINISHINGS_BOOKLET_MAKER, /* Fold to make booklet */ + IPP_FINISHINGS_JOB_OFFSET, /* Offset for binding (any type) */ + IPP_FINISHINGS_STAPLE_TOP_LEFT = 20, /* Staple top left corner */ + IPP_FINISHINGS_STAPLE_BOTTOM_LEFT, /* Staple bottom left corner */ + IPP_FINISHINGS_STAPLE_TOP_RIGHT, /* Staple top right corner */ + IPP_FINISHINGS_STAPLE_BOTTOM_RIGHT, /* Staple bottom right corner */ + IPP_FINISHINGS_EDGE_STITCH_LEFT, /* Stitch along left side */ + IPP_FINISHINGS_EDGE_STITCH_TOP, /* Stitch along top edge */ + IPP_FINISHINGS_EDGE_STITCH_RIGHT, /* Stitch along right side */ + IPP_FINISHINGS_EDGE_STITCH_BOTTOM, /* Stitch along bottom edge */ + IPP_FINISHINGS_STAPLE_DUAL_LEFT, /* Two staples on left */ + IPP_FINISHINGS_STAPLE_DUAL_TOP, /* Two staples on top */ + IPP_FINISHINGS_STAPLE_DUAL_RIGHT, /* Two staples on right */ + IPP_FINISHINGS_STAPLE_DUAL_BOTTOM, /* Two staples on bottom */ + IPP_FINISHINGS_BIND_LEFT = 50, /* Bind on left */ + IPP_FINISHINGS_BIND_TOP, /* Bind on top */ + IPP_FINISHINGS_BIND_RIGHT, /* Bind on right */ + IPP_FINISHINGS_BIND_BOTTOM /* Bind on bottom */ +} ipp_finish_t; + +typedef enum ipp_orient_e /**** Orientation... ****/ +{ + IPP_PORTRAIT = 3, /* No rotation */ + IPP_LANDSCAPE, /* 90 degrees counter-clockwise */ + IPP_REVERSE_LANDSCAPE, /* 90 degrees clockwise */ + IPP_REVERSE_PORTRAIT /* 180 degrees */ +} ipp_orient_t; + +typedef enum ipp_quality_e /**** Qualities... ****/ +{ + IPP_QUALITY_DRAFT = 3, /* Draft quality */ + IPP_QUALITY_NORMAL, /* Normal quality */ + IPP_QUALITY_HIGH /* High quality */ +} ipp_quality_t; + +typedef enum ipp_jstate_e /**** Job States.... */ +{ + IPP_JOB_PENDING = 3, /* Job is waiting to be printed */ + IPP_JOB_HELD, /* Job is held for printing */ + IPP_JOB_PROCESSING, /* Job is currently printing */ + IPP_JOB_STOPPED, /* Job has been stopped */ + IPP_JOB_CANCELED, /* Job has been canceled */ + IPP_JOB_ABORTED, /* Job has aborted due to error */ + IPP_JOB_COMPLETED /* Job has completed successfully */ +} ipp_jstate_t; +#define IPP_JOB_CANCELLED IPP_JOB_CANCELED + +typedef enum ipp_pstate_e /**** Printer States.... */ +{ + IPP_PRINTER_IDLE = 3, /* Printer is idle */ + IPP_PRINTER_PROCESSING, /* Printer is working */ + IPP_PRINTER_STOPPED /* Printer is stopped */ +} ipp_pstate_t; + +typedef enum ipp_state_e /**** IPP states... ****/ +{ + IPP_ERROR = -1, /* An error occurred */ + IPP_IDLE, /* Nothing is happening/request completed */ + IPP_HEADER, /* The request header needs to be sent/received */ + IPP_ATTRIBUTE, /* One or more attributes need to be sent/received */ + IPP_DATA /* IPP request data needs to be sent/received */ +} ipp_state_t; + +typedef enum ipp_op_e /**** IPP operations... ****/ +{ + IPP_PRINT_JOB = 0x0002, /* Print a single file */ + IPP_PRINT_URI, /* Print a single URL @private@ */ + IPP_VALIDATE_JOB, /* Validate job options */ + IPP_CREATE_JOB, /* Create an empty print job */ + IPP_SEND_DOCUMENT, /* Add a file to a job */ + IPP_SEND_URI, /* Add a URL to a job @private@ */ + IPP_CANCEL_JOB, /* Cancel a job */ + IPP_GET_JOB_ATTRIBUTES, /* Get job attributes */ + IPP_GET_JOBS, /* Get a list of jobs */ + IPP_GET_PRINTER_ATTRIBUTES, /* Get printer attributes */ + IPP_HOLD_JOB, /* Hold a job for printing */ + IPP_RELEASE_JOB, /* Release a job for printing */ + IPP_RESTART_JOB, /* Reprint a job */ + IPP_PAUSE_PRINTER = 0x0010, /* Stop a printer */ + IPP_RESUME_PRINTER, /* Start a printer */ + IPP_PURGE_JOBS, /* Cancel all jobs */ + IPP_SET_PRINTER_ATTRIBUTES, /* Set printer attributes @private@ */ + IPP_SET_JOB_ATTRIBUTES, /* Set job attributes */ + IPP_GET_PRINTER_SUPPORTED_VALUES, /* Get supported attribute values */ + IPP_CREATE_PRINTER_SUBSCRIPTION, /* Create a printer subscription @since CUPS 1.2@ */ + IPP_CREATE_JOB_SUBSCRIPTION, /* Create a job subscription @since CUPS 1.2@ */ + IPP_GET_SUBSCRIPTION_ATTRIBUTES, /* Get subscription attributes @since CUPS 1.2@ */ + IPP_GET_SUBSCRIPTIONS, /* Get list of subscriptions @since CUPS 1.2@ */ + IPP_RENEW_SUBSCRIPTION, /* Renew a printer subscription @since CUPS 1.2@ */ + IPP_CANCEL_SUBSCRIPTION, /* Cancel a subscription @since CUPS 1.2@ */ + IPP_GET_NOTIFICATIONS, /* Get notification events @since CUPS 1.2@ */ + IPP_SEND_NOTIFICATIONS, /* Send notification events @private@ */ + IPP_GET_PRINT_SUPPORT_FILES = 0x0021, /* Get printer support files @private@ */ + IPP_ENABLE_PRINTER, /* Start a printer */ + IPP_DISABLE_PRINTER, /* Stop a printer */ + IPP_PAUSE_PRINTER_AFTER_CURRENT_JOB, /* Stop printer after the current job @private@ */ + IPP_HOLD_NEW_JOBS, /* Hold new jobs @private@ */ + IPP_RELEASE_HELD_NEW_JOBS, /* Release new jobs @private@ */ + IPP_DEACTIVATE_PRINTER, /* Stop a printer @private@ */ + IPP_ACTIVATE_PRINTER, /* Start a printer @private@ */ + IPP_RESTART_PRINTER, /* Restart a printer @private@ */ + IPP_SHUTDOWN_PRINTER, /* Turn a printer off @private@ */ + IPP_STARTUP_PRINTER, /* Turn a printer on @private@ */ + IPP_REPROCESS_JOB, /* Reprint a job @private@ */ + IPP_CANCEL_CURRENT_JOB, /* Cancel the current job @private@ */ + IPP_SUSPEND_CURRENT_JOB, /* Suspend the current job @private@ */ + IPP_RESUME_JOB, /* Resume the current job @private@ */ + IPP_PROMOTE_JOB, /* Promote a job to print sooner @private@ */ + IPP_SCHEDULE_JOB_AFTER, /* Schedule a job to print after another @private@ */ + IPP_PRIVATE = 0x4000, /* Reserved @private@ */ + CUPS_GET_DEFAULT, /* Get the default printer */ + CUPS_GET_PRINTERS, /* Get a list of printers and/or classes */ + CUPS_ADD_MODIFY_PRINTER, /* Add or modify a printer */ + CUPS_DELETE_PRINTER, /* Delete a printer */ + CUPS_GET_CLASSES, /* Get a list of classes @deprecated@ */ + CUPS_ADD_MODIFY_CLASS, /* Add or modify a class */ + CUPS_DELETE_CLASS, /* Delete a class */ + CUPS_ACCEPT_JOBS, /* Accept new jobs on a printer */ + CUPS_REJECT_JOBS, /* Reject new jobs on a printer */ + CUPS_SET_DEFAULT, /* Set the default printer */ + CUPS_GET_DEVICES, /* Get a list of supported devices */ + CUPS_GET_PPDS, /* Get a list of supported drivers */ + CUPS_MOVE_JOB, /* Move a job to a different printer */ + CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2@ */ + CUPS_GET_PPD /* Get a PPD file @since CUPS 1.3@ */ +} ipp_op_t; + +/* Old names for the operations */ +#define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER +#define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS + +typedef enum ipp_status_e /**** IPP status codes... ****/ +{ + IPP_OK = 0x0000, /* successful-ok */ + IPP_OK_SUBST, /* successful-ok-ignored-or-substituted-attributes */ + IPP_OK_CONFLICT, /* successful-ok-conflicting-attributes */ + IPP_OK_IGNORED_SUBSCRIPTIONS, /* successful-ok-ignored-subscriptions */ + IPP_OK_IGNORED_NOTIFICATIONS, /* successful-ok-ignored-notifications */ + IPP_OK_TOO_MANY_EVENTS, /* successful-ok-too-many-events */ + IPP_OK_BUT_CANCEL_SUBSCRIPTION, /* successful-ok-but-cancel-subscription */ + IPP_OK_EVENTS_COMPLETE, /* successful-ok-events-complete */ + IPP_REDIRECTION_OTHER_SITE = 0x200, /* */ + CUPS_SEE_OTHER = 0x280, /* cups-see-other */ + IPP_BAD_REQUEST = 0x0400, /* client-error-bad-request */ + IPP_FORBIDDEN, /* client-error-forbidden */ + IPP_NOT_AUTHENTICATED, /* client-error-not-authenticated */ + IPP_NOT_AUTHORIZED, /* client-error-not-authorized */ + IPP_NOT_POSSIBLE, /* client-error-not-possible */ + IPP_TIMEOUT, /* client-error-timeout */ + IPP_NOT_FOUND, /* client-error-not-found */ + IPP_GONE, /* client-error-gone */ + IPP_REQUEST_ENTITY, /* client-error-request-entity-too-large */ + IPP_REQUEST_VALUE, /* client-error-request-value-too-long */ + IPP_DOCUMENT_FORMAT, /* client-error-document-format-not-supported */ + IPP_ATTRIBUTES, /* client-error-attributes-or-values-not-supported */ + IPP_URI_SCHEME, /* client-error-uri-scheme-not-supported */ + IPP_CHARSET, /* client-error-charset-not-supported */ + IPP_CONFLICT, /* client-error-conflicting-attributes */ + IPP_COMPRESSION_NOT_SUPPORTED, /* client-error-compression-not-supported */ + IPP_COMPRESSION_ERROR, /* client-error-compression-error */ + IPP_DOCUMENT_FORMAT_ERROR, /* client-error-document-format-error */ + IPP_DOCUMENT_ACCESS_ERROR, /* client-error-document-access-error */ + IPP_ATTRIBUTES_NOT_SETTABLE, /* client-error-attributes-not-settable */ + IPP_IGNORED_ALL_SUBSCRIPTIONS, /* client-error-ignored-all-subscriptions */ + IPP_TOO_MANY_SUBSCRIPTIONS, /* client-error-too-many-subscriptions */ + IPP_IGNORED_ALL_NOTIFICATIONS, /* client-error-ignored-all-notifications */ + IPP_PRINT_SUPPORT_FILE_NOT_FOUND, /* client-error-print-support-file-not-found */ + + IPP_INTERNAL_ERROR = 0x0500, /* server-error-internal-error */ + IPP_OPERATION_NOT_SUPPORTED, /* server-error-operation-not-supported */ + IPP_SERVICE_UNAVAILABLE, /* server-error-service-unavailable */ + IPP_VERSION_NOT_SUPPORTED, /* server-error-version-not-supported */ + IPP_DEVICE_ERROR, /* server-error-device-error */ + IPP_TEMPORARY_ERROR, /* server-error-temporary-error */ + IPP_NOT_ACCEPTING, /* server-error-not-accepting-jobs */ + IPP_PRINTER_BUSY, /* server-error-busy */ + IPP_ERROR_JOB_CANCELED, /* server-error-job-canceled */ + IPP_MULTIPLE_JOBS_NOT_SUPPORTED, /* server-error-multiple-document-jobs-not-supported */ + IPP_PRINTER_IS_DEACTIVATED /* server-error-printer-is-deactivated */ +} ipp_status_t; +#define IPP_ERROR_JOB_CANCELLED IPP_ERROR_JOB_CANCELED + +typedef unsigned char ipp_uchar_t; /**** Unsigned 8-bit integer/character ****/ + +/**** New in CUPS 1.2 ****/ +typedef ssize_t (*ipp_iocb_t)(void *, ipp_uchar_t *, size_t); + /**** IPP IO Callback Function @since CUPS 1.2@ ****/ + +typedef union ipp_request_u /**** Request Header ****/ +{ + struct /* Any Header */ + { + ipp_uchar_t version[2]; /* Protocol version number */ + int op_status; /* Operation ID or status code*/ + int request_id; /* Request ID */ + } any; + + struct /* Operation Header */ + { + ipp_uchar_t version[2]; /* Protocol version number */ + ipp_op_t operation_id; /* Operation ID */ + int request_id; /* Request ID */ + } op; + + struct /* Status Header */ + { + ipp_uchar_t version[2]; /* Protocol version number */ + ipp_status_t status_code; /* Status code */ + int request_id; /* Request ID */ + } status; + + /**** New in CUPS 1.1.19 ****/ + struct /* Event Header */ + { + ipp_uchar_t version[2]; /* Protocol version number */ + ipp_status_t status_code; /* Status code */ + int request_id; /* Request ID */ + } event; +} ipp_request_t; + +/**** New in CUPS 1.1.19 ****/ +typedef struct ipp_s ipp_t; + +typedef union ipp_value_u /**** Attribute Value ****/ +{ + int integer; /* Integer/enumerated value */ + + char boolean; /* Boolean value */ + + ipp_uchar_t date[11]; /* Date/time value */ + + struct + { + int xres, /* Horizontal resolution */ + yres; /* Vertical resolution */ + ipp_res_t units; /* Resolution units */ + } resolution; /* Resolution value */ + + struct + { + int lower, /* Lower value */ + upper; /* Upper value */ + } range; /* Range of integers value */ + + struct + { + char *charset; /* Character set */ + char *text; /* String */ + } string; /* String with language value */ + + struct + { + int length; /* Length of attribute */ + void *data; /* Data in attribute */ + } unknown; /* Unknown attribute type */ + +/**** New in CUPS 1.1.19 ****/ + ipp_t *collection; /* Collection value */ +} ipp_value_t; + +typedef struct ipp_attribute_s /**** Attribute ****/ +{ + struct ipp_attribute_s *next; /* Next attribute in list */ + ipp_tag_t group_tag, /* Job/Printer/Operation group tag */ + value_tag; /* What type of value is it? */ + char *name; /* Name of attribute */ + int num_values; /* Number of values */ + ipp_value_t values[1]; /* Values */ +} ipp_attribute_t; + +struct ipp_s /**** IPP Request/Response/Notification ****/ +{ + ipp_state_t state; /* State of request */ + ipp_request_t request; /* Request header */ + ipp_attribute_t *attrs; /* Attributes */ + ipp_attribute_t *last; /* Last attribute in list */ + ipp_attribute_t *current; /* Current attribute (for read/write) */ + ipp_tag_t curtag; /* Current attribute group tag */ + +/**** New in CUPS 1.2 ****/ + ipp_attribute_t *prev; /* Previous attribute (for read) */ +}; + + +/* + * Prototypes... + */ + +extern ipp_attribute_t *ippAddBoolean(ipp_t *ipp, ipp_tag_t group, + const char *name, char value); +extern ipp_attribute_t *ippAddBooleans(ipp_t *ipp, ipp_tag_t group, + const char *name, int num_values, + const char *values); +extern ipp_attribute_t *ippAddDate(ipp_t *ipp, ipp_tag_t group, + const char *name, const ipp_uchar_t *value); +extern ipp_attribute_t *ippAddInteger(ipp_t *ipp, ipp_tag_t group, + ipp_tag_t type, const char *name, + int value); +extern ipp_attribute_t *ippAddIntegers(ipp_t *ipp, ipp_tag_t group, + ipp_tag_t type, const char *name, + int num_values, const int *values); +extern ipp_attribute_t *ippAddRange(ipp_t *ipp, ipp_tag_t group, + const char *name, int lower, int upper); +extern ipp_attribute_t *ippAddRanges(ipp_t *ipp, ipp_tag_t group, + const char *name, int num_values, + const int *lower, const int *upper); +extern ipp_attribute_t *ippAddResolution(ipp_t *ipp, ipp_tag_t group, + const char *name, ipp_res_t units, + int xres, int yres); +extern ipp_attribute_t *ippAddResolutions(ipp_t *ipp, ipp_tag_t group, + const char *name, int num_values, + ipp_res_t units, const int *xres, + const int *yres); +extern ipp_attribute_t *ippAddSeparator(ipp_t *ipp); +extern ipp_attribute_t *ippAddString(ipp_t *ipp, ipp_tag_t group, + ipp_tag_t type, const char *name, + const char *charset, const char *value); +extern ipp_attribute_t *ippAddStrings(ipp_t *ipp, ipp_tag_t group, + ipp_tag_t type, const char *name, + int num_values, const char *charset, + const char * const *values); +extern time_t ippDateToTime(const ipp_uchar_t *date); +extern void ippDelete(ipp_t *ipp); +extern const char *ippErrorString(ipp_status_t error); +extern ipp_attribute_t *ippFindAttribute(ipp_t *ipp, const char *name, + ipp_tag_t type); +extern ipp_attribute_t *ippFindNextAttribute(ipp_t *ipp, const char *name, + ipp_tag_t type); +extern size_t ippLength(ipp_t *ipp); +extern ipp_t *ippNew(void); +extern ipp_state_t ippRead(http_t *http, ipp_t *ipp); +extern const ipp_uchar_t *ippTimeToDate(time_t t); +extern ipp_state_t ippWrite(http_t *http, ipp_t *ipp); +extern int ippPort(void); +extern void ippSetPort(int p); + +/**** New in CUPS 1.1.19 ****/ +extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group, + const char *name, ipp_t *value); +extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group, + const char *name, int num_values, + const ipp_t **values); +extern void ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr); +extern ipp_state_t ippReadFile(int fd, ipp_t *ipp); +extern ipp_state_t ippWriteFile(int fd, ipp_t *ipp); + +/**** New in CUPS 1.2 ****/ +extern ipp_attribute_t *ippAddOctetString(ipp_t *ipp, ipp_tag_t group, + const char *name, + const void *data, int datalen); +extern ipp_status_t ippErrorValue(const char *name); +extern ipp_t *ippNewRequest(ipp_op_t op); +extern const char *ippOpString(ipp_op_t op); +extern ipp_op_t ippOpValue(const char *name); +extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking, + ipp_t *parent, ipp_t *ipp); +extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking, + ipp_t *parent, ipp_t *ipp); + + +/* + * C++ magic... + */ + +# ifdef __cplusplus +} +# endif /* __cplusplus */ +#endif /* !_CUPS_IPP_H_ */ + +/* + * End of "$Id: ipp.h 6649 2007-07-11 21:46:42Z mike $". + */ Index: files/cups/language.h =================================================================== RCS file: files/cups/language.h diff -N files/cups/language.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/cups/language.h 11 Jul 2007 21:46:42 -0000 @@ -0,0 +1,114 @@ +/* + * "$Id: language.h 6649 2007-07-11 21:46:42Z mike $" + * + * Multi-language support for the Common UNIX Printing System (CUPS). + * + * Copyright 2007 by Apple Inc. + * Copyright 1997-2006 by Easy Software Products. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * This file is subject to the Apple OS-Developed Software exception. + */ + +#ifndef _CUPS_LANGUAGE_H_ +# define _CUPS_LANGUAGE_H_ + +/* + * Include necessary headers... + */ + +# include +# include "array.h" + +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ + + +/* + * Types... + */ + +typedef enum cups_encoding_e /**** Language Encodings ****/ +{ + CUPS_AUTO_ENCODING = -1, /* Auto-detect the encoding @private@ */ + CUPS_US_ASCII, /* US ASCII */ + CUPS_ISO8859_1, /* ISO-8859-1 */ + CUPS_ISO8859_2, /* ISO-8859-2 */ + CUPS_ISO8859_3, /* ISO-8859-3 */ + CUPS_ISO8859_4, /* ISO-8859-4 */ + CUPS_ISO8859_5, /* ISO-8859-5 */ + CUPS_ISO8859_6, /* ISO-8859-6 */ + CUPS_ISO8859_7, /* ISO-8859-7 */ + CUPS_ISO8859_8, /* ISO-8859-8 */ + CUPS_ISO8859_9, /* ISO-8859-9 */ + CUPS_ISO8859_10, /* ISO-8859-10 */ + CUPS_UTF8, /* UTF-8 */ + CUPS_ISO8859_13, /* ISO-8859-13 */ + CUPS_ISO8859_14, /* ISO-8859-14 */ + CUPS_ISO8859_15, /* ISO-8859-15 */ + CUPS_WINDOWS_874, /* CP-874 */ + CUPS_WINDOWS_1250, /* CP-1250 */ + CUPS_WINDOWS_1251, /* CP-1251 */ + CUPS_WINDOWS_1252, /* CP-1252 */ + CUPS_WINDOWS_1253, /* CP-1253 */ + CUPS_WINDOWS_1254, /* CP-1254 */ + CUPS_WINDOWS_1255, /* CP-1255 */ + CUPS_WINDOWS_1256, /* CP-1256 */ + CUPS_WINDOWS_1257, /* CP-1257 */ + CUPS_WINDOWS_1258, /* CP-1258 */ + CUPS_KOI8_R, /* KOI-8-R */ + CUPS_KOI8_U, /* KOI-8-U */ + CUPS_ISO8859_11, /* ISO-8859-11 */ + CUPS_ISO8859_16, /* ISO-8859-16 */ + CUPS_MAC_ROMAN, /* MacRoman */ + CUPS_ENCODING_SBCS_END = 63, /* End of single-bybte encodings @private@ */ + + CUPS_WINDOWS_932, /* Japanese JIS X0208-1990 */ + CUPS_WINDOWS_936, /* Simplified Chinese GB 2312-80 */ + CUPS_WINDOWS_949, /* Korean KS C5601-1992 */ + CUPS_WINDOWS_950, /* Traditional Chinese Big Five */ + CUPS_WINDOWS_1361, /* Korean Johab */ + CUPS_ENCODING_DBCS_END = 127, /* End of double-byte encodings @private@ */ + + CUPS_EUC_CN, /* EUC Simplified Chinese */ + CUPS_EUC_JP, /* EUC Japanese */ + CUPS_EUC_KR, /* EUC Korean */ + CUPS_EUC_TW, /* EUC Traditional Chinese */ + CUPS_ENCODING_VBCS_END = 191 /* End of variable-length encodings @private@ */ +} cups_encoding_t; + +typedef struct cups_lang_s /**** Language Cache Structure ****/ +{ + struct cups_lang_s *next; /* Next language in cache */ + int used; /* Number of times this entry has been used. */ + cups_encoding_t encoding; /* Text encoding */ + char language[16]; /* Language/locale name */ + cups_array_t *strings; /* Message strings @private@ */ +} cups_lang_t; + + +/* + * Prototypes... + */ + +extern cups_lang_t *cupsLangDefault(void); +extern const char *cupsLangEncoding(cups_lang_t *lang); +extern void cupsLangFlush(void); +extern void cupsLangFree(cups_lang_t *lang); +extern cups_lang_t *cupsLangGet(const char *language); + +# ifdef __cplusplus +} +# endif /* __cplusplus */ + +#endif /* !_CUPS_LANGUAGE_H_ */ + +/* + * End of "$Id: language.h 6649 2007-07-11 21:46:42Z mike $". + */ Index: files/cups/ppd.h =================================================================== RCS file: files/cups/ppd.h diff -N files/cups/ppd.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/cups/ppd.h 11 Jul 2007 21:46:42 -0000 @@ -0,0 +1,409 @@ +/* + * "$Id: ppd.h 6649 2007-07-11 21:46:42Z mike $" + * + * PostScript Printer Description definitions for the Common UNIX Printing + * System (CUPS). + * + * Copyright 2007 by Apple Inc. + * Copyright 1997-2007 by Easy Software Products, all rights reserved. + * + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * which should have been included with this file. If this file is + * file is missing or damaged, see the license at "http://www.cups.org/". + * + * PostScript is a trademark of Adobe Systems, Inc. + * + * This code and any derivative of it may be used and distributed + * freely under the terms of the GNU General Public License when + * used with GNU Ghostscript or its derivatives. Use of the code + * (or any derivative of it) with software other than GNU + * GhostScript (or its derivatives) is governed by the CUPS license + * agreement. + * + * This file is subject to the Apple OS-Developed Software exception. + */ + +#ifndef _CUPS_PPD_H_ +# define _CUPS_PPD_H_ + +/* + * Include necessary headers... + */ + +# include +# include "array.h" +# include "file.h" + + +/* + * C++ magic... + */ + +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ + + +/* + * PPD version... + */ + +# define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */ + + +/* + * PPD size limits (defined in Adobe spec) + */ + +# define PPD_MAX_NAME 41 /* Maximum size of name + 1 for nul */ +# define PPD_MAX_TEXT 81 /* Maximum size of text + 1 for nul */ +# define PPD_MAX_LINE 256 /* Maximum size of line + 1 for nul */ + + +/* + * Types and structures... + */ + +typedef enum ppd_ui_e /**** UI Types ****/ +{ + PPD_UI_BOOLEAN, /* True or False option */ + PPD_UI_PICKONE, /* Pick one from a list */ + PPD_UI_PICKMANY /* Pick zero or more from a list */ +} ppd_ui_t; + +typedef enum ppd_section_e /**** Order dependency sections ****/ +{ + PPD_ORDER_ANY, /* Option code can be anywhere in the file */ + PPD_ORDER_DOCUMENT, /* ... must be in the DocumentSetup section */ + PPD_ORDER_EXIT, /* ... must be sent prior to the document */ + PPD_ORDER_JCL, /* ... must be sent as a JCL command */ + PPD_ORDER_PAGE, /* ... must be in the PageSetup section */ + PPD_ORDER_PROLOG /* ... must be in the Prolog section */ +} ppd_section_t; + +typedef enum ppd_cs_e /**** Colorspaces ****/ +{ + PPD_CS_CMYK = -4, /* CMYK colorspace */ + PPD_CS_CMY, /* CMY colorspace */ + PPD_CS_GRAY = 1, /* Grayscale colorspace */ + PPD_CS_RGB = 3, /* RGB colorspace */ + PPD_CS_RGBK, /* RGBK (K = gray) colorspace */ + PPD_CS_N /* DeviceN colorspace */ +} ppd_cs_t; + +typedef enum ppd_status_e /**** Status Codes @since CUPS 1.1.19@ ****/ +{ + PPD_OK = 0, /* OK */ + PPD_FILE_OPEN_ERROR, /* Unable to open PPD file */ + PPD_NULL_FILE, /* NULL PPD file pointer */ + PPD_ALLOC_ERROR, /* Memory allocation error */ + PPD_MISSING_PPDADOBE4, /* Missing PPD-Adobe-4.x header */ + PPD_MISSING_VALUE, /* Missing value string */ + PPD_INTERNAL_ERROR, /* Internal error */ + PPD_BAD_OPEN_GROUP, /* Bad OpenGroup */ + PPD_NESTED_OPEN_GROUP, /* OpenGroup without a CloseGroup first */ + PPD_BAD_OPEN_UI, /* Bad OpenUI/JCLOpenUI */ + PPD_NESTED_OPEN_UI, /* OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first */ + PPD_BAD_ORDER_DEPENDENCY, /* Bad OrderDependency */ + PPD_BAD_UI_CONSTRAINTS, /* Bad UIConstraints */ + PPD_MISSING_ASTERISK, /* Missing asterisk in column 0 */ + PPD_LINE_TOO_LONG, /* Line longer than 255 chars */ + PPD_ILLEGAL_CHARACTER, /* Illegal control character */ + PPD_ILLEGAL_MAIN_KEYWORD, /* Illegal main keyword string */ + PPD_ILLEGAL_OPTION_KEYWORD, /* Illegal option keyword string */ + PPD_ILLEGAL_TRANSLATION, /* Illegal translation string */ + PPD_ILLEGAL_WHITESPACE, /* Illegal whitespace character */ + PPD_BAD_CUSTOM_PARAM /* Bad custom parameter */ +} ppd_status_t; + +typedef enum ppd_conform_e /**** Conformance Levels @since CUPS 1.1.19@ ****/ +{ + PPD_CONFORM_RELAXED, /* Relax whitespace and control char */ + PPD_CONFORM_STRICT /* Require strict conformance */ +} ppd_conform_t; + +typedef struct ppd_attr_s /**** PPD Attribute Structure @since CUPS 1.1.19@ ****/ +{ + char name[PPD_MAX_NAME]; /* Name of attribute (cupsXYZ) */ + char spec[PPD_MAX_NAME]; /* Specifier string, if any */ + char text[PPD_MAX_TEXT]; /* Human-readable text, if any */ + char *value; /* Value string */ +} ppd_attr_t; + +typedef struct ppd_option_s ppd_option_t; + /**** Options ****/ + +typedef struct ppd_choice_s /**** Option choices ****/ +{ + char marked; /* 0 if not selected, 1 otherwise */ + char choice[PPD_MAX_NAME]; /* Computer-readable option name */ + char text[PPD_MAX_TEXT]; /* Human-readable option name */ + char *code; /* Code to send for this option */ + ppd_option_t *option; /* Pointer to parent option structure */ +} ppd_choice_t; + +struct ppd_option_s /**** Options ****/ +{ + char conflicted; /* 0 if no conflicts exist, 1 otherwise */ + char keyword[PPD_MAX_NAME]; /* Option keyword name ("PageSize", etc.) */ + char defchoice[PPD_MAX_NAME];/* Default option choice */ + char text[PPD_MAX_TEXT]; /* Human-readable text */ + ppd_ui_t ui; /* Type of UI option */ + ppd_section_t section; /* Section for command */ + float order; /* Order number */ + int num_choices; /* Number of option choices */ + ppd_choice_t *choices; /* Option choices */ +}; + +typedef struct ppd_group_s /**** Groups ****/ +{ + /**** Group text strings are limited to 39 chars + nul in order to + **** preserve binary compatibility and allow applications to get + **** the group's keyword name. + ****/ + char text[PPD_MAX_TEXT - PPD_MAX_NAME]; + /* Human-readable group name */ + char name[PPD_MAX_NAME]; /* Group name @since CUPS 1.1.18@ */ + int num_options; /* Number of options */ + ppd_option_t *options; /* Options */ + int num_subgroups; /* Number of sub-groups */ + struct ppd_group_s *subgroups; /* Sub-groups (max depth = 1) */ +} ppd_group_t; + +typedef struct /**** Constraints ****/ +{ + char option1[PPD_MAX_NAME]; /* First keyword */ + char choice1[PPD_MAX_NAME]; /* First option/choice (blank for all) */ + char option2[PPD_MAX_NAME]; /* Second keyword */ + char choice2[PPD_MAX_NAME]; /* Second option/choice (blank for all) */ +} ppd_const_t; + +typedef struct ppd_size_s /**** Page Sizes ****/ +{ + int marked; /* Page size selected? */ + char name[PPD_MAX_NAME]; /* Media size option */ + float width; /* Width of media in points */ + float length; /* Length of media in points */ + float left; /* Left printable margin in points */ + float bottom; /* Bottom printable margin in points */ + float right; /* Right printable margin in points */ + float top; /* Top printable margin in points */ +} ppd_size_t; + +typedef struct ppd_emul_s /**** Emulators ****/ +{ + char name[PPD_MAX_NAME]; /* Emulator name */ + char *start; /* Code to switch to this emulation */ + char *stop; /* Code to stop this emulation */ +} ppd_emul_t; + +typedef struct ppd_profile_s /**** sRGB Color Profiles ****/ +{ + char resolution[PPD_MAX_NAME]; + /* Resolution or "-" */ + char media_type[PPD_MAX_NAME]; + /* Media type or "-" */ + float density; /* Ink density to use */ + float gamma; /* Gamma correction to use */ + float matrix[3][3]; /* Transform matrix */ +} ppd_profile_t; + +/**** New in CUPS 1.2 ****/ +typedef enum ppd_cptype_e /**** Custom Parameter Type @since CUPS 1.2@ ****/ +{ + PPD_CUSTOM_CURVE, /* Curve value for f(x) = x^value */ + PPD_CUSTOM_INT, /* Integer number value */ + PPD_CUSTOM_INVCURVE, /* Curve value for f(x) = x^(1/value) */ + PPD_CUSTOM_PASSCODE, /* String of (hidden) numbers */ + PPD_CUSTOM_PASSWORD, /* String of (hidden) characters */ + PPD_CUSTOM_POINTS, /* Measurement value in points */ + PPD_CUSTOM_REAL, /* Real number value */ + PPD_CUSTOM_STRING /* String of characters */ +} ppd_cptype_t; + +typedef union ppd_cplimit_u /**** Custom Parameter Limit @since CUPS 1.2@ ****/ +{ + float custom_curve; /* Gamma value */ + int custom_int; /* Integer value */ + float custom_invcurve; /* Gamma value */ + int custom_passcode; /* Passcode length */ + int custom_password; /* Password length */ + float custom_points; /* Measurement value */ + float custom_real; /* Real value */ + int custom_string; /* String length */ +} ppd_cplimit_t; + +typedef union ppd_cpvalue_u /**** Custom Parameter Value @since CUPS 1.2@ ****/ +{ + float custom_curve; /* Gamma value */ + int custom_int; /* Integer value */ + float custom_invcurve; /* Gamma value */ + char *custom_passcode; /* Passcode value */ + char *custom_password; /* Password value */ + float custom_points; /* Measurement value */ + float custom_real; /* Real value */ + char *custom_string; /* String value */ +} ppd_cpvalue_t; + +typedef struct ppd_cparam_s /**** Custom Parameter @since CUPS 1.2@ ****/ +{ + char name[PPD_MAX_NAME]; /* Parameter name */ + char text[PPD_MAX_TEXT]; /* Human-readable text */ + int order; /* Order (0 to N) */ + ppd_cptype_t type; /* Parameter type */ + ppd_cplimit_t minimum, /* Minimum value */ + maximum; /* Maximum value */ + ppd_cpvalue_t current; /* Current value */ +} ppd_cparam_t; + +typedef struct ppd_coption_s /**** Custom Option @since CUPS 1.2@ ****/ +{ + char keyword[PPD_MAX_NAME]; /* Name of option that is being extended... */ + ppd_option_t *option; /* Option that is being extended... */ + int marked; /* Extended option is marked */ + cups_array_t *params; /* Parameters */ +} ppd_coption_t; + +typedef struct ppd_file_s /**** PPD File ****/ +{ + int language_level; /* Language level of device */ + int color_device; /* 1 = color device, 0 = grayscale */ + int variable_sizes; /* 1 = supports variable sizes, 0 = doesn't */ + int accurate_screens; /* 1 = supports accurate screens, 0 = not */ + int contone_only; /* 1 = continuous tone only, 0 = not */ + int landscape; /* -90 or 90 */ + int model_number; /* Device-specific model number */ + int manual_copies; /* 1 = Copies done manually, 0 = hardware */ + int throughput; /* Pages per minute */ + ppd_cs_t colorspace; /* Default colorspace */ + char *patches; /* Patch commands to be sent to printer */ + int num_emulations; /* Number of emulations supported */ + ppd_emul_t *emulations; /* Emulations and the code to invoke them */ + char *jcl_begin; /* Start JCL commands */ + char *jcl_ps; /* Enter PostScript interpreter */ + char *jcl_end; /* End JCL commands */ + char *lang_encoding; /* Language encoding */ + char *lang_version; /* Language version (English, Spanish, etc.) */ + char *modelname; /* Model name (general) */ + char *ttrasterizer; /* Truetype rasterizer */ + char *manufacturer; /* Manufacturer name */ + char *product; /* Product name (from PS RIP/interpreter) */ + char *nickname; /* Nickname (specific) */ + char *shortnickname; /* Short version of nickname */ + int num_groups; /* Number of UI groups */ + ppd_group_t *groups; /* UI groups */ + int num_sizes; /* Number of page sizes */ + ppd_size_t *sizes; /* Page sizes */ + float custom_min[2]; /* Minimum variable page size */ + float custom_max[2]; /* Maximum variable page size */ + float custom_margins[4]; /* Margins around page */ + int num_consts; /* Number of UI/Non-UI constraints */ + ppd_const_t *consts; /* UI/Non-UI constraints */ + int num_fonts; /* Number of pre-loaded fonts */ + char **fonts; /* Pre-loaded fonts */ + int num_profiles; /* Number of sRGB color profiles */ + ppd_profile_t *profiles; /* sRGB color profiles */ + int num_filters; /* Number of filters */ + char **filters; /* Filter strings... */ + + /**** New in CUPS 1.1 ****/ + int flip_duplex; /* 1 = Flip page for back sides @deprecated@ */ + + /**** New in CUPS 1.1.19 ****/ + char *protocols; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19@ */ + char *pcfilename; /* PCFileName string @since CUPS 1.1.19@ */ + int num_attrs; /* Number of attributes @since CUPS 1.1.19@ @private@ */ + int cur_attr; /* Current attribute @since CUPS 1.1.19@ @private@ */ + ppd_attr_t **attrs; /* Attributes @since CUPS 1.1.19@ @private@ */ + + /**** New in CUPS 1.2 ****/ + cups_array_t *sorted_attrs; /* Attribute lookup array @since CUPS 1.2@ @private@ */ + cups_array_t *options; /* Option lookup array @since CUPS 1.2@ @private@ */ + cups_array_t *coptions; /* Custom options array @since CUPS 1.2@ @private@ */ + + /**** New in CUPS 1.3 ****/ + cups_array_t *marked; /* Marked choices @since CUPS 1.3@ @private@ */ +} ppd_file_t; + + +/* + * Prototypes... + */ + +extern void ppdClose(ppd_file_t *ppd); +extern int ppdCollect(ppd_file_t *ppd, ppd_section_t section, + ppd_choice_t ***choices); +extern int ppdConflicts(ppd_file_t *ppd); +extern int ppdEmit(ppd_file_t *ppd, FILE *fp, + ppd_section_t section); +extern int ppdEmitFd(ppd_file_t *ppd, int fd, + ppd_section_t section); +extern int ppdEmitJCL(ppd_file_t *ppd, FILE *fp, int job_id, + const char *user, const char *title); +extern ppd_choice_t *ppdFindChoice(ppd_option_t *o, const char *option); +extern ppd_choice_t *ppdFindMarkedChoice(ppd_file_t *ppd, const char *keyword); +extern ppd_option_t *ppdFindOption(ppd_file_t *ppd, const char *keyword); +extern int ppdIsMarked(ppd_file_t *ppd, const char *keyword, + const char *option); +extern void ppdMarkDefaults(ppd_file_t *ppd); +extern int ppdMarkOption(ppd_file_t *ppd, const char *keyword, + const char *option); +extern ppd_file_t *ppdOpen(FILE *fp); +extern ppd_file_t *ppdOpenFd(int fd); +extern ppd_file_t *ppdOpenFile(const char *filename); +extern float ppdPageLength(ppd_file_t *ppd, const char *name); +extern ppd_size_t *ppdPageSize(ppd_file_t *ppd, const char *name); +extern float ppdPageWidth(ppd_file_t *ppd, const char *name); + +/**** New in CUPS 1.1.19 ****/ +extern const char *ppdErrorString(ppd_status_t status); +extern ppd_attr_t *ppdFindAttr(ppd_file_t *ppd, const char *name, + const char *spec); +extern ppd_attr_t *ppdFindNextAttr(ppd_file_t *ppd, const char *name, + const char *spec); +extern ppd_status_t ppdLastError(int *line); + +/**** New in CUPS 1.1.20 ****/ +extern void ppdSetConformance(ppd_conform_t c); + +/**** New in CUPS 1.2 ****/ +extern int ppdCollect2(ppd_file_t *ppd, ppd_section_t section, + float min_order, ppd_choice_t ***choices); +extern int ppdEmitAfterOrder(ppd_file_t *ppd, FILE *fp, + ppd_section_t section, int limit, + float min_order); +extern int ppdEmitJCLEnd(ppd_file_t *ppd, FILE *fp); +extern char *ppdEmitString(ppd_file_t *ppd, ppd_section_t section, + float min_order); +extern ppd_coption_t *ppdFindCustomOption(ppd_file_t *ppd, + const char *keyword); +extern ppd_cparam_t *ppdFindCustomParam(ppd_coption_t *opt, + const char *name); +extern ppd_cparam_t *ppdFirstCustomParam(ppd_coption_t *opt); +extern ppd_option_t *ppdFirstOption(ppd_file_t *ppd); +extern ppd_cparam_t *ppdNextCustomParam(ppd_coption_t *opt); +extern ppd_option_t *ppdNextOption(ppd_file_t *ppd); +extern int ppdLocalize(ppd_file_t *ppd); +extern ppd_file_t *ppdOpen2(cups_file_t *fp); + +/**** New in CUPS 1.3 ****/ +extern const char *ppdLocalizeIPPReason(ppd_file_t *ppd, + const char *reason, + const char *scheme, + char *buffer, size_t bufsize); + + +/* + * C++ magic... + */ + +# ifdef __cplusplus +} +# endif /* __cplusplus */ +#endif /* !_CUPS_PPD_H_ */ + +/* + * End of "$Id: ppd.h 6649 2007-07-11 21:46:42Z mike $". + */ >Release-Note: >Audit-Trail: >Unformatted: