Comparar commits

..

1 Commits

Autor SHA1 Mensagem Data
msweet f9a559303b Import cups.org releases
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/tags/release-1.5.1@4306 a1ca3aef-8c08-0410-bb20-df032aa958be
2013-05-10 18:56:23 +00:00
381 arquivos alterados com 10555 adições e 28648 exclusões
-81
Ver Arquivo
@@ -1,87 +1,6 @@
CHANGES-1.5.txt
---------------
CHANGES IN CUPS V1.5.4
- Documentation updates (STR #4112)
- Localized empty strings contained the message catalog metadata
(STR #4119)
- Fixed a crash in the libusb-based USB backend (STR #4099)
- The cups-lpd mini-daemon no longer handled jobs with multiple copies
(STR #4118)
- Multiple libusb backend fixes (STR #4098, STR #4100)
- The IPP backend no longer tries to get the job status for printers
that do not implement the required operation (STR #4083)
- Sending a document in an unsupported format to an IPP printer now
automatically cancels the job (STR #4093)
- Fix some error reporting issues when printing from /dev/null and
other unusual situations (STR #4015)
- The scheduler now sets the CUPS_MAX_MESSAGE environment variable for
filters (STR #4074)
- Fixed a build issue when using older versions of autoconf (STR #4084)
- The IPP backend now treats the client-error-not-possible status code
as a job history issue, allowing IPP printing to Windows to work
(STR #4047)
- The IPP backend incorrectly included the document-format and
compression attributes in Create-Job requests (STR #4086)
- The libusb-based USB backend did not work on non-Linux platforms
(STR #4088)
CHANGES IN CUPS V1.5.3
- httpReconnect() did not reset the read/write buffers (STR #4065)
- Compiling without threading support failed (STR #4060)
- Fixed compile problem with old versions of OpenSSL (STR #4036)
- The network backends did not check SNMP supply levels regularly
(STR #4040)
- The online help always included the "help on help" text (STR #4042)
- Fixed a SSL handshake issue on OS X (STR #4045)
- The scheduler could crash if a PPD file contained an invalid paper
size (STR #4049)
- The CUPS polling daemon did not reinitialize its connection to the
remote server on errors in all cases (STR #4031)
- PostScript auto-configuration was slow and unreliable with some
printers (STR #4028)
- Missing localizations caused empty output (STR #4033)
- The cups-driverd program could temporarily "forget" a PPD file if it
was updated in place.
- The dnssd backend now prefers IPPS over IPP.
- The USB backend now uses and requires LIBUSB 1.0 or later (STR #3477)
- The LIBUSB-based USB backend now supports the back-channel (STR #2890)
- Changed how timeouts are implemented in the LPD backend (STR #4013)
- Added more supported color names for SNMP supplies (STR #3981)
- The default InputSlot setting was never used (STR #3957)
- POSIX ACLs are now set properly on certificate files (STR #3970)
- Supplies with commas in their names were not reported correctly
(STR #4020)
- The cupsGetPPD3() function created a temporary file when one was not
needed (STR #4018)
- The scheduler now ensures that job notifications contain a value for
the notify-printer-uri attribute (STR #4014)
- The lp and lpr commands did not cancel jobs queued from stdin on an
error (STR #4015)
- Fixed the IPP backend's handling of HTTP/1.0 compatibility (STR #3988)
- The IPP backend did not always setup username/password authentication
for printers (STR #3985)
- The IPP backend no longer re-queues print jobs that are too large for
the printer/server (STR #3977)
- The RPM spec file did not work (STR #4021, STR #4057)
- Encryption did not work when the server name ended with "."
(STR #4011)
- The multi-purpose tray is now mapped to the IPP "by-pass-tray"
(STR #4009)
- The correct media size was not always passed to IPP printers
(STR #4001)
- Finishing options were not passed to IPP printers (STR #3995)
- Fixed iCloud-based Back to My Mac printing (STR #3996)
CHANGES IN CUPS V1.5.2
- Reposted what should have been CUPS 1.5.1.
CHANGES IN CUPS V1.5.1
- Documentation updates (STR #3885, STR #3886, STR #3946, STR #3969)
+1 -22
Ver Arquivo
@@ -1,31 +1,10 @@
CHANGES-IPPTOOL.txt - 2012-02-28
CHANGES-IPPTOOL.txt - 2012-01-10
--------------------------------
This file provides a list of changes to the ipptool binary distribution posted
on cups.org.
2012-02-28
- Changed behavior of WITH-VALUES "/regex/" to not require all values to
match.
- Added WITH-ALL-VALUES directive for EXPECT predicates that require all
values to match.
- Updated test files to use WITH-ALL-VALUES where necessary.
- Updated test files to use new ABNF for media names from PWG Media
Names 2.0.
2012-02-06
- Fixed the packaging of ipptool on Windows (removed unnecessary DLLs)
- Fixed an crash in ipptool when mixing DISPLAY with -I and a failed
request.
- Added a Print-Job test file.
- Added a "setdebug" batch file for Windows
- Added support for a CUPS_DISABLE_ASYNC_CONNECT environment variable.
2012-01-10
- Fixed an issue with the IPP/1.1 test file where the "waiting for job
+2 -40
Ver Arquivo
@@ -1,46 +1,8 @@
CHANGES.txt - 1.6rc1 - 2012-06-21
---------------------------------
CHANGES IN CUPS V1.6rc1
- Added a new Japanese localization (STR #4122)
- The SNMP backend no longer exits if it is unable to obtain an IPv6
socket (STR #4109)
- The LPD backend incorrectly used "localhost" in the control file
instead of the current hostname.
CHANGES.txt - 1.6b1 - 2012-01-30
--------------------------------
CHANGES IN CUPS V1.6b1
- Documentation updates (STR #3927, STR #3980, STR #4010, STR #4068)
- The scheduler now consolidates all PPD updates from filters at the
end of the job (STR #4075)
- CUPS now supports color management using colord (STR #3808)
- CUPS now supports Bonjour using Avahi (STR #3066)
- The PreserveJobFiles and PreserveJobHistory directives now support
specification of a time interval (STR #3143)
- PPD files can now be archived in (gzip'd) tar files to further reduce
the disk space used by PPD files (STR #3772)
- The network backends now deal with printers that report their levels
in percent but do not specify a maximum capacity of 100 (STR #3551)
- The network backends now report full/almost-full waste bins in
printers along with end-of-life for cleaning pads (STR #4017)
- Added a configure option to set the permissions of the installed
cupsd (STR #3459)
- Added a new WITH-ALL-VALUES directive to ipptool EXPECT predicates
(STR #3949)
- CUPS now supports a User directive in client.conf and the CUPS_USER
environment variable for overriding the default username (STR #3114)
- Now set the PJL USERNAME variable as needed (STR #3100)
- Added support for usernames and passwords longer than 32 characters
(STR #2856)
- Added a new MaxHoldTime directive to automatically cancel jobs that
have been held indefinitely after a specific number of seconds
(STR #2291)
- The LPD backend now uses the originating host name when it is not the
local system (STR #2053)
- CUPS now prefers the suffix "dpcm" when reporting resolution in dots-
per-centimeter (STR #4006)
- The configure script and build system no longer support building of
separate 32-bit and 64-bit libraries.
- The "brightness", "columns", "fitplot", "gamma", "hue",
+4 -4
Ver Arquivo
@@ -1,12 +1,12 @@
INSTALL - CUPS v1.6rc1 - 2012-06-21
-----------------------------------
INSTALL - CUPS v1.5.0 - 2011-07-25
----------------------------------
This file describes how to compile and install CUPS from source code. For more
information on CUPS see the file called "README.txt". A complete change log can
be found in "CHANGES.txt".
**** IF YOU HAVE A NON-POSTSCRIPT PRINTER AND ARE NOT ****
**** RUNNING OS X, YOU WILL ALSO NEED TO INSTALL GPL ****
**** RUNNING MAC OS X, YOU WILL ALSO NEED TO INSTALL GPL ****
**** GHOSTSCRIPT WITH THE "cups" DRIVER AFTER YOU INSTALL ****
**** CUPS. ****
@@ -34,7 +34,7 @@ BEFORE YOU BEGIN
PostScript filter needed by non-PostScript printers. You *must* download
GPL Ghostscript separately from the CUPS web site if you want to print
PostScript files to non-PostScript printers on operating systems other than
OS X.
Mac OS X.
COMPILING THE SUBVERSION REPOSITORY CODE
+11 -52
Ver Arquivo
@@ -1,4 +1,4 @@
IPPTOOL.txt - 2012-02-06
IPPTOOL.txt - 2011-12-02
------------------------
See the file CHANGES-IPPTOOL.txt for a list of changes to this software.
@@ -6,11 +6,11 @@ See the file CHANGES-IPPTOOL.txt for a list of changes to this software.
INTRODUCTION
CUPS includes a user program called ipptool that can be used to send
arbitrary IPP requests to a CUPS server or IPP printer. This tool started
life as part of the CUPS automated test suite and has grown to support
complex conformance tests and a simple way to query printer, job, and
subscription attributes.
Starting with CUPS 1.5, CUPS now installs a user program called ipptool that
can be used to send arbitrary IPP requests to a CUPS server or IPP printer.
This tool started life as part of the CUPS automated test suite and has
grown to support complex conformance tests and a simple way to query
printer, job, and subscription attributes.
BASIC USAGE
@@ -46,22 +46,6 @@ BASIC USAGE
75,pending-held,testfile.txt,msweet
STANDARD TEST FILES
The following standard test files are included with ipptool:
create-printer-subscription.test Creates a printer subscription for
state change notifications
get-completed-jobs.test Shows a list of completed jobs
get-jobs.test Shows a list of pending jobs
get-printer-attributes.test Shows printer attributes
ipp-1.1.test IPP/1.1 conformance test suite
ipp-2.0.test IPP/2.0 conformance test suite
ipp-2.1.test IPP/2.1 conformance test suite
ipp-2.2.test IPP/2.2 conformance test suite
print-job.test Prints a file
CONFORMANCE TESTS
We provide basic IPP conformance tests for IPP/1.1, IPP/2.0, IPP/2.1, and
@@ -87,29 +71,6 @@ CONFORMANCE TESTS
onepage-a4.ps
onepage-letter.pdf
onepage-letter.ps
testfile.jpg
testfile.pcl
testfile.pdf
testfile.ps
testfile.txt
Useful options include the following:
-4 Connect using IPv4
-6 Connect using IPv6
-C Send chunked requests (default)
-d name=val Define a variable
-E Test IPP with HTTP Upgrade to TLS
-L Send requests using the Content-Length header (HTTP/1.0)
-S Test IPP over HTTPS (default for ipps: URIs)
-T seconds Set a timeout for responses in seconds
-v Be verbose, showing all attributes sent and received
The printer-uri must be a URI supported by the printer using the "ipp" or
"ipps" scheme, for example:
ipp://192.168.0.1/ipp
ipps://192.168.0.1/ipp/print
Print-by-reference (URL) printing can be tested by defining the document-uri
variable to a URL, for example:
@@ -119,9 +80,7 @@ CONFORMANCE TESTS
The standard test files are available on cups.org under the "test"
directory, for example:
ipptool -tf document-a4.pdf \
-d document-uri=http://www.cups.org/test/document-a4.pdf \
ipp://192.168.0.1/ipp -I -V 2.0 ipp-2.0.test
http://www.cups.org/test/document-a4.pdf
The "document" test files contain 4 pages each. Doing the IPP conformance
tests will will produce up to 90 pages on various media, depending on the
@@ -131,8 +90,7 @@ CONFORMANCE TESTS
READING THE DOCUMENTATION
The command usage is described in the ipptest(1) man page, while the file
format is described in the ipptestfile(5) man page. Both are provided in
HTML format with the standalone releases of ipptool.
format is described in the ipptestfile(5) man page.
GETTING SUPPORT AND OTHER RESOURCES
@@ -160,7 +118,8 @@ REPORTING BUGS
test with debug logging enabled. Run the following commands on Windows to
enable debug logging:
setdebug.bat
set CUPS_DEBUG_LOG=ipptool.log
set CUPS_DEBUG_LEVEL=6
For Linux and Mac OS X use:
@@ -174,7 +133,7 @@ REPORTING BUGS
LEGAL STUFF
CUPS is Copyright 2007-2012 by Apple Inc. CUPS and the CUPS logo are
CUPS is Copyright 2007-2011 by Apple Inc. CUPS and the CUPS logo are
trademarks of Apple Inc.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
+6 -6
Ver Arquivo
@@ -1,6 +1,6 @@
CUPS License Agreement
Copyright 2007-2012 by Apple Inc.
Copyright 2007-2011 by Apple Inc.
1 Infinite Loop
Cupertino, CA 95014 USA
@@ -68,11 +68,11 @@ the following special exceptions:
source code of the Apple OS-Developed Software.
b. An Apple Operating System means any operating system
software developed and/or marketed by Apple Inc.,
including but not limited to all existing releases and
versions of Apple's Darwin, OS X, and OS X Server
products and all follow-on releases and future
versions thereof.
software developed and/or marketed by Apple Computer,
Inc., including but not limited to all existing
releases and versions of Apple's Darwin, Mac OS X,
and Mac OS X Server products and all follow-on
releases and future versions thereof.
c. This exception is only available for Apple
OS-Developed Software and does not apply to software
+1 -3
Ver Arquivo
@@ -24,7 +24,7 @@ CHMOD = @CHMOD@
CXX = @LIBTOOL@ @CXX@
DSO = @DSO@
DSOXX = @DSOXX@
GZIP = @GZIP@
HTMLDOC = @HTMLDOC@
INSTALL = @INSTALL@
LD = @LD@
LIBTOOL = @LIBTOOL@
@@ -41,7 +41,6 @@ SHELL = /bin/sh
#
INSTALL_BIN = $(LIBTOOL) $(INSTALL) -c -m 555 @INSTALL_STRIP@
INSTALL_COMPDATA = $(INSTALL) -c -m 444 @INSTALL_GZIP@
INSTALL_CONFIG = $(INSTALL) -c -m @CUPS_CONFIG_FILE_PERM@
INSTALL_DATA = $(INSTALL) -c -m 444
INSTALL_DIR = $(INSTALL) -d
@@ -63,7 +62,6 @@ CUPS_PRIMARY_SYSTEM_GROUP = @CUPS_PRIMARY_SYSTEM_GROUP@
#
CUPS_CONFIG_FILE_PERM = @CUPS_CONFIG_FILE_PERM@
CUPS_CUPSD_FILE_PERM = @CUPS_CUPSD_FILE_PERM@
CUPS_LOG_FILE_PERM = @CUPS_LOG_FILE_PERM@
#
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
#
# Top-level Makefile for CUPS.
#
# Copyright 2007-2012 by Apple Inc.
# Copyright 2007-2010 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
@@ -275,10 +275,10 @@ docset: apihelp
doc/help/api-*.tokens
$(RM) doc/help/api-*.tokens
echo Indexing docset...
/Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil index org.cups.docset
/Developer/usr/bin/docsetutil index org.cups.docset
echo Generating docset archive and feed...
$(RM) org.cups.docset.atom
/Applications/Xcode.app/Contents/Developer/usr/bin/docsetutil package --output org.cups.docset.xar \
/Developer/usr/bin/docsetutil package --output org.cups.docset.xar \
--atom org.cups.docset.atom \
--download-url http://www.cups.org/org.cups.docset.xar \
org.cups.docset
+2 -2
Ver Arquivo
@@ -1,4 +1,4 @@
README - CUPS v1.6rc1 - 2012-06-21
README - CUPS v1.5.0 - 2011-07-25
----------------------------------
Looking for compile instructions? Read the file "INSTALL.txt"
@@ -150,7 +150,7 @@ PRINTING FILES
LEGAL STUFF
CUPS is Copyright 2007-2012 by Apple Inc. CUPS and the CUPS logo are
CUPS is Copyright 2007-2011 by Apple Inc. CUPS and the CUPS logo are
trademarks of Apple Inc.
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
+59 -57
Ver Arquivo
@@ -1,70 +1,72 @@
ipp.o: ipp.c backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/debug-private.h \
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h \
../cups/array-private.h
ipp.o: ipp.c backend-private.h ../cups/cups-private.h ../cups/cups.h \
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
../cups/array.h ../cups/language.h ../cups/string-private.h \
../config.h ../cups/debug-private.h ../cups/ppd-private.h \
../cups/ppd.h ../cups/pwg-private.h ../cups/http-private.h \
../cups/md5-private.h ../cups/ipp-private.h ../cups/language-private.h \
../cups/transcode.h ../cups/thread-private.h ../cups/snmp-private.h \
../cups/backend.h ../cups/sidechannel.h ../cups/array-private.h
lpd.o: lpd.c ../cups/http-private.h ../config.h ../cups/http.h \
../cups/versioning.h ../cups/array.h ../cups/md5-private.h \
../cups/ipp-private.h ../cups/ipp.h backend-private.h \
../cups/cups-private.h ../cups/string-private.h \
../cups/debug-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
dnssd.o: dnssd.c backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/debug-private.h \
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
snmp.o: snmp.c backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/debug-private.h \
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
../cups/cups-private.h ../cups/cups.h ../cups/file.h \
../cups/language.h ../cups/string-private.h ../cups/debug-private.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/pwg-private.h \
../cups/language-private.h ../cups/transcode.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h
dnssd.o: dnssd.c backend-private.h ../cups/cups-private.h ../cups/cups.h \
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
../cups/array.h ../cups/language.h ../cups/string-private.h \
../config.h ../cups/debug-private.h ../cups/ppd-private.h \
../cups/ppd.h ../cups/pwg-private.h ../cups/http-private.h \
../cups/md5-private.h ../cups/ipp-private.h ../cups/language-private.h \
../cups/transcode.h ../cups/thread-private.h ../cups/snmp-private.h \
../cups/backend.h ../cups/sidechannel.h
snmp.o: snmp.c backend-private.h ../cups/cups-private.h ../cups/cups.h \
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
../cups/array.h ../cups/language.h ../cups/string-private.h \
../config.h ../cups/debug-private.h ../cups/ppd-private.h \
../cups/ppd.h ../cups/pwg-private.h ../cups/http-private.h \
../cups/md5-private.h ../cups/ipp-private.h ../cups/language-private.h \
../cups/transcode.h ../cups/thread-private.h ../cups/snmp-private.h \
../cups/backend.h ../cups/sidechannel.h
socket.o: socket.c ../cups/http-private.h ../config.h ../cups/http.h \
../cups/versioning.h ../cups/array.h ../cups/md5-private.h \
../cups/ipp-private.h ../cups/ipp.h backend-private.h \
../cups/cups-private.h ../cups/string-private.h \
../cups/debug-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
../cups/cups-private.h ../cups/cups.h ../cups/file.h \
../cups/language.h ../cups/string-private.h ../cups/debug-private.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/pwg-private.h \
../cups/language-private.h ../cups/transcode.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h
test1284.o: test1284.c ../cups/string-private.h ../config.h ieee1284.c \
backend-private.h ../cups/cups-private.h ../cups/debug-private.h \
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
backend-private.h ../cups/cups-private.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/debug-private.h ../cups/ppd-private.h \
../cups/ppd.h ../cups/pwg-private.h ../cups/http-private.h \
../cups/md5-private.h ../cups/ipp-private.h ../cups/language-private.h \
../cups/transcode.h ../cups/thread-private.h ../cups/snmp-private.h \
../cups/backend.h ../cups/sidechannel.h
testbackend.o: testbackend.c ../cups/string-private.h ../config.h \
../cups/cups.h ../cups/file.h ../cups/versioning.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/language.h \
../cups/sidechannel.h
testsupplies.o: testsupplies.c backend-private.h ../cups/cups-private.h \
../cups/cups.h ../cups/file.h ../cups/versioning.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/language.h \
../cups/string-private.h ../config.h ../cups/debug-private.h \
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h
usb.o: usb.c backend-private.h ../cups/cups-private.h \
../cups/string-private.h ../config.h ../cups/debug-private.h \
../cups/versioning.h ../cups/ipp-private.h ../cups/ipp.h \
../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h \
../cups/snmp-private.h ../cups/backend.h ../cups/sidechannel.h \
usb-darwin.c ../cups/file-private.h
../cups/ppd-private.h ../cups/ppd.h ../cups/pwg-private.h \
../cups/http-private.h ../cups/md5-private.h ../cups/ipp-private.h \
../cups/language-private.h ../cups/transcode.h \
../cups/thread-private.h ../cups/snmp-private.h ../cups/backend.h \
../cups/sidechannel.h
usb.o: usb.c backend-private.h ../cups/cups-private.h ../cups/cups.h \
../cups/file.h ../cups/versioning.h ../cups/ipp.h ../cups/http.h \
../cups/array.h ../cups/language.h ../cups/string-private.h \
../config.h ../cups/debug-private.h ../cups/ppd-private.h \
../cups/ppd.h ../cups/pwg-private.h ../cups/http-private.h \
../cups/md5-private.h ../cups/ipp-private.h ../cups/language-private.h \
../cups/transcode.h ../cups/thread-private.h ../cups/snmp-private.h \
../cups/backend.h ../cups/sidechannel.h usb-darwin.c \
../cups/file-private.h
+1 -7
Ver Arquivo
@@ -21,12 +21,6 @@ include ../Makedefs
# Object files...
#
# RBACKENDS are installed mode 0700 so cupsd will run them as root...
#
# UBACKENDS are installed mode 0755 so cupsd will run them as an unprivileged
# user...
#
# See http://www.cups.org/documentation.php/api-filter.html for more info...
RBACKENDS = \
ipp \
lpd \
@@ -280,7 +274,7 @@ socket: socket.o ../cups/$(LIBCUPS) libbackend.a
usb: usb.o ../cups/$(LIBCUPS) libbackend.a
echo Linking $@...
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \
$(CC) $(LDFLAGS) -o usb usb.o libbackend.a $(LIBUSB) \
$(BACKLIBS) $(LIBS)
usb.o: usb.c usb-darwin.c usb-libusb.c usb-unix.c
+1 -15
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backend support definitions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -259,20 +259,6 @@ extern "C" {
#define CUPS_TC_inserts 33
#define CUPS_TC_covers 34
#define CUPS_TC_tenThousandthsOfInches 3
#define CUPS_TC_micrometers 4
#define CUPS_TC_impressions 7
#define CUPS_TC_sheets 8
#define CUPS_TC_hours 11
#define CUPS_TC_thousandthsOfOunces 12
#define CUPS_TC_tenthsOfGrams 13
#define CUPS_TC_hundrethsOfFluidOunces 14
#define CUPS_TC_tenthsOfMilliliters 15
#define CUPS_TC_feet 16
#define CUPS_TC_meters 17
#define CUPS_TC_items 18
#define CUPS_TC_percent 19
/* These come from RFC 3808 to define character sets we support */
/* Also see http://www.iana.org/assignments/character-sets */
#define CUPS_TC_csASCII 3
+248 -563
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+85 -215
Ver Arquivo
@@ -45,12 +45,8 @@
# define kPMPrintUIToolAgent "com.apple.printuitool.agent"
# define kPMStartJob 100
# define kPMWaitForJob 101
# ifdef HAVE_XPC_PRIVATE_H
# include <xpc/private.h>
# else
extern void xpc_connection_set_target_uid(xpc_connection_t connection,
uid_t uid);
# endif /* HAVE_XPC_PRIVATE_H */
#endif /* HAVE_GSSAPI && HAVE_XPC */
@@ -66,8 +62,7 @@ typedef struct _cups_monitor_s /**** Monitoring data ****/
*resource; /* Resource path */
int port, /* Port number */
version, /* IPP version */
job_id, /* Job ID for submitted job */
get_job_attrs; /* Support Get-Job-Attributes? */
job_id; /* Job ID for submitted job */
const char *job_name; /* Job name for submitted job */
http_encryption_t encryption; /* Use encryption? */
ipp_jstate_t job_state; /* Current job state */
@@ -95,9 +90,7 @@ static const char * const jattrs[] = /* Job attributes we want */
};
static int job_canceled = 0;
/* Job cancelled? */
static char username[256] = "",
/* Username for device URI */
*password = NULL;
static char *password = NULL;
/* Password for device URI */
static int password_tries = 0;
/* Password tries */
@@ -196,6 +189,7 @@ main(int argc, /* I - Number of command-line args */
const char *device_uri; /* Device URI */
char scheme[255], /* Scheme in URI */
hostname[1024], /* Hostname */
username[255], /* Username info */
resource[1024], /* Resource info (printer name) */
addrname[256], /* Address name */
*optptr, /* Pointer to URI options */
@@ -242,7 +236,6 @@ main(int argc, /* I - Number of command-line args */
ipp_attribute_t *printer_state; /* printer-state attribute */
ipp_attribute_t *printer_accepting; /* printer-is-accepting-jobs */
int create_job = 0, /* Does printer support Create-Job? */
get_job_attrs = 0, /* Does printer support Get-Job-Attributes? */
send_document = 0, /* Does printer support Send-Document? */
validate_job = 0; /* Does printer support Validate-Job? */
int copies, /* Number of copies for job */
@@ -617,10 +610,7 @@ main(int argc, /* I - Number of command-line args */
const char *ptr = getenv("AUTH_USERNAME");
if (ptr)
{
strlcpy(username, ptr, sizeof(username));
cupsSetUser(ptr);
}
password = getenv("AUTH_PASSWORD");
}
@@ -647,9 +637,6 @@ main(int argc, /* I - Number of command-line args */
update_reasons(NULL, "-connecting-to-device");
return (CUPS_BACKEND_STOP);
}
if (job_canceled)
return (CUPS_BACKEND_OK);
}
http = _httpCreate(hostname, port, addrlist, cupsEncryption(), AF_UNSPEC);
@@ -754,7 +741,7 @@ main(int argc, /* I - Number of command-line args */
case ECONNREFUSED :
default :
_cupsLangPrintFilter(stderr, "WARNING",
_("The printer is in use."));
_("The printer is busy."));
break;
}
@@ -777,9 +764,7 @@ main(int argc, /* I - Number of command-line args */
}
while (http->fd < 0);
if (job_canceled)
return (CUPS_BACKEND_OK);
else if (!http)
if (job_canceled || !http)
return (CUPS_BACKEND_FAILED);
update_reasons(NULL, "-connecting-to-device");
@@ -854,9 +839,7 @@ main(int argc, /* I - Number of command-line args */
fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n",
ippErrorString(ipp_status), cupsLastErrorString());
if (ipp_status <= IPP_OK_CONFLICT)
password_tries = 0;
else
if (ipp_status > IPP_OK_CONFLICT)
{
fprintf(stderr, "DEBUG: Get-Printer-Attributes returned %s.\n",
ippErrorString(ipp_status));
@@ -871,7 +854,7 @@ main(int argc, /* I - Number of command-line args */
return (CUPS_BACKEND_FAILED);
}
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
_cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
report_printer_state(supported);
@@ -889,14 +872,14 @@ main(int argc, /* I - Number of command-line args */
if (version >= 20)
{
_cupsLangPrintFilter(stderr, "INFO",
_("The printer does not support IPP/%d.%d, trying "
_("Printer does not support IPP/%d.%d, trying "
"IPP/%s."), version / 10, version % 10, "1.1");
version = 11;
}
else
{
_cupsLangPrintFilter(stderr, "INFO",
_("The printer does not support IPP/%d.%d, trying "
_("Printer does not support IPP/%d.%d, trying "
"IPP/%s."), version / 10, version % 10, "1.0");
version = 10;
}
@@ -913,21 +896,16 @@ main(int argc, /* I - Number of command-line args */
return (CUPS_BACKEND_STOP);
}
else if (ipp_status == IPP_FORBIDDEN ||
ipp_status == IPP_AUTHENTICATION_CANCELED)
else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
{
const char *www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
/* WWW-Authenticate field value */
if (!strncmp(www_auth, "Negotiate", 9))
if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
"Negotiate", 9))
auth_info_required = "negotiate";
else if (www_auth[0])
auth_info_required = "username,password";
fprintf(stderr, "ATTR: auth-info-required=%s\n", auth_info_required);
return (CUPS_BACKEND_AUTH_REQUIRED);
}
else if (ipp_status != IPP_NOT_AUTHORIZED)
else
{
_cupsLangPrintFilter(stderr, "ERROR",
_("Unable to get printer status."));
@@ -977,7 +955,7 @@ main(int argc, /* I - Number of command-line args */
if (busy)
{
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
_cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
report_printer_state(supported);
@@ -1076,18 +1054,13 @@ main(int argc, /* I - Number of command-line args */
create_job = 1;
else if (operations_sup->values[i].integer == IPP_SEND_DOCUMENT)
send_document = 1;
else if (operations_sup->values[i].integer == IPP_GET_JOB_ATTRIBUTES)
get_job_attrs = 1;
}
if (create_job && !send_document)
if (!send_document)
{
fputs("DEBUG: Printer supports Create-Job but not Send-Document.\n",
stderr);
create_job = 0;
update_reasons(NULL, "+cups-ipp-conformance-failure-report,"
"cups-ipp-missing-send-document");
}
if (!validate_job)
@@ -1104,10 +1077,7 @@ main(int argc, /* I - Number of command-line args */
report_printer_state(supported);
}
while (!job_canceled && ipp_status > IPP_OK_CONFLICT);
if (job_canceled)
return (CUPS_BACKEND_OK);
while (ipp_status > IPP_OK_CONFLICT);
/*
* See if the printer is accepting jobs and is not stopped; if either
@@ -1158,7 +1128,12 @@ main(int argc, /* I - Number of command-line args */
copies = atoi(argv[4]);
if (copies_sup || argc < 7)
{
copies_remaining = 1;
if (argc < 7 && !_cups_strncasecmp(final_content_type, "image/", 6))
copies = 1;
}
else
copies_remaining = copies;
@@ -1193,8 +1168,7 @@ main(int argc, /* I - Number of command-line args */
if (format_sup != NULL)
{
for (i = 0; i < format_sup->num_values; i ++)
if (!_cups_strcasecmp(final_content_type,
format_sup->values[i].string.text))
if (!_cups_strcasecmp(final_content_type, format_sup->values[i].string.text))
{
document_format = final_content_type;
break;
@@ -1204,7 +1178,7 @@ main(int argc, /* I - Number of command-line args */
{
for (i = 0; i < format_sup->num_values; i ++)
if (!_cups_strcasecmp("application/octet-stream",
format_sup->values[i].string.text))
format_sup->values[i].string.text))
{
document_format = "application/octet-stream";
break;
@@ -1212,9 +1186,6 @@ main(int argc, /* I - Number of command-line args */
}
}
fprintf(stderr, "DEBUG: final_content_type=\"%s\", document_format=\"%s\"\n",
final_content_type, document_format ? document_format : "(null)");
/*
* If the printer does not support HTTP/1.1 (which IPP requires), copy stdin
* to a temporary file so that we can do a HTTP/1.0 submission...
@@ -1232,17 +1203,8 @@ main(int argc, /* I - Number of command-line args */
_cupsLangPrintFilter(stderr, "INFO", _("Copying print data."));
if ((compatsize = write(fd, buffer, bytes)) < 0)
{
perror("DEBUG: Unable to write temporary file");
return (CUPS_BACKEND_FAILED);
}
if ((bytes = backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0,
backendNetworkSideCB)) < 0)
return (CUPS_BACKEND_FAILED);
compatsize += bytes;
compatsize = backendRunLoop(-1, fd, snmp_fd, &(addrlist->addr), 0, 0,
backendNetworkSideCB);
close(fd);
@@ -1269,7 +1231,6 @@ main(int argc, /* I - Number of command-line args */
monitor.port = port;
monitor.version = version;
monitor.job_id = 0;
monitor.get_job_attrs = get_job_attrs;
monitor.encryption = cupsEncryption();
monitor.job_state = IPP_JOB_PENDING;
monitor.printer_state = IPP_PRINTER_IDLE;
@@ -1310,21 +1271,29 @@ main(int argc, /* I - Number of command-line args */
if (ipp_status == IPP_SERVICE_UNAVAILABLE || ipp_status == IPP_PRINTER_BUSY)
{
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
_cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
sleep(10);
}
else if (ipp_status == IPP_DOCUMENT_FORMAT)
goto cleanup;
else if (ipp_status == IPP_FORBIDDEN ||
else if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN ||
ipp_status == IPP_AUTHENTICATION_CANCELED)
{
const char *www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
/* WWW-Authenticate field value */
/*
* Update auth-info-required as needed...
*/
if (!strncmp(www_auth, "Negotiate", 9))
fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));
/*
* Normal authentication goes through the password callback, which sets
* auth_info_required to "username,password". Kerberos goes directly
* through GSSAPI, so look for Negotiate in the WWW-Authenticate header
* here and set auth_info_required as needed...
*/
if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
"Negotiate", 9))
auth_info_required = "negotiate";
else if (www_auth[0])
auth_info_required = "username,password";
goto cleanup;
}
@@ -1338,8 +1307,7 @@ main(int argc, /* I - Number of command-line args */
"cups-ipp-missing-validate-job");
break;
}
else if (ipp_status < IPP_REDIRECTION_OTHER_SITE ||
ipp_status == IPP_BAD_REQUEST)
else if (ipp_status < IPP_REDIRECTION_OTHER_SITE)
break;
}
@@ -1461,7 +1429,7 @@ main(int argc, /* I - Number of command-line args */
ipp_status == IPP_NOT_POSSIBLE ||
ipp_status == IPP_PRINTER_BUSY)
{
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
_cupsLangPrintFilter(stderr, "INFO", _("The printer is busy."));
sleep(10);
if (num_files == 0)
@@ -1476,8 +1444,6 @@ main(int argc, /* I - Number of command-line args */
}
else if (ipp_status == IPP_ERROR_JOB_CANCELED)
goto cleanup;
else if (ipp_status == IPP_NOT_AUTHORIZED)
continue;
else
{
/*
@@ -1487,24 +1453,21 @@ main(int argc, /* I - Number of command-line args */
_cupsLangPrintFilter(stderr, "ERROR",
_("Print file was not accepted."));
if (ipp_status == IPP_FORBIDDEN ||
ipp_status == IPP_AUTHENTICATION_CANCELED)
if (ipp_status == IPP_NOT_AUTHORIZED || ipp_status == IPP_FORBIDDEN)
{
const char *www_auth = httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE);
/* WWW-Authenticate field value */
fprintf(stderr, "DEBUG: WWW-Authenticate=\"%s\"\n",
httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE));
if (!strncmp(www_auth, "Negotiate", 9))
auth_info_required = "negotiate";
else if (www_auth[0])
auth_info_required = "username,password";
}
else if (ipp_status == IPP_REQUEST_VALUE)
{
/*
* Print file is too large, abort this job...
/*
* Normal authentication goes through the password callback, which sets
* auth_info_required to "username,password". Kerberos goes directly
* through GSSAPI, so look for Negotiate in the WWW-Authenticate header
* here and set auth_info_required as needed...
*/
goto cleanup;
if (!strncmp(httpGetField(http, HTTP_FIELD_WWW_AUTHENTICATE),
"Negotiate", 9))
auth_info_required = "negotiate";
}
else
sleep(10);
@@ -1531,7 +1494,6 @@ main(int argc, /* I - Number of command-line args */
}
else
{
password_tries = 0;
monitor.job_id = job_id = job_id_attr->values[0].integer;
_cupsLangPrintFilter(stderr, "INFO",
_("Print file accepted - job ID %d."), job_id);
@@ -1574,9 +1536,8 @@ main(int argc, /* I - Number of command-line args */
if ((i + 1) >= num_files)
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);
if (document_format)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, document_format);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, document_format);
fprintf(stderr, "DEBUG: Sending file %d using chunking...\n", i + 1);
http_status = cupsSendRequest(http, request, resource, 0);
@@ -1601,11 +1562,10 @@ main(int argc, /* I - Number of command-line args */
if (fd >= 0)
{
while (!job_canceled && http_status == HTTP_CONTINUE &&
while (!job_canceled &&
(bytes = read(fd, buffer, sizeof(buffer))) > 0)
{
if ((http_status = cupsWriteRequestData(http, buffer, bytes))
!= HTTP_CONTINUE)
if (cupsWriteRequestData(http, buffer, bytes) != HTTP_CONTINUE)
break;
else
{
@@ -1635,13 +1595,8 @@ main(int argc, /* I - Number of command-line args */
_("Unable to add document to print job."));
break;
}
else
{
password_tries = 0;
if (num_files == 0 || fd < 0)
break;
}
else if (num_files == 0 || fd < 0)
break;
}
}
@@ -1654,14 +1609,6 @@ main(int argc, /* I - Number of command-line args */
ipp_status == IPP_NOT_POSSIBLE ||
ipp_status == IPP_PRINTER_BUSY)
continue;
else if (ipp_status == IPP_REQUEST_VALUE)
{
/*
* Print file is too large, abort this job...
*/
goto cleanup;
}
else
copies_remaining --;
@@ -1669,7 +1616,7 @@ main(int argc, /* I - Number of command-line args */
* Wait for the job to complete...
*/
if (!job_id || !waitjob || !get_job_attrs)
if (!job_id || !waitjob)
continue;
_cupsLangPrintFilter(stderr, "INFO", _("Waiting for job to complete."));
@@ -1712,7 +1659,7 @@ main(int argc, /* I - Number of command-line args */
response = cupsDoRequest(http, request, resource);
ipp_status = cupsLastError();
if (ipp_status == IPP_NOT_FOUND || ipp_status == IPP_NOT_POSSIBLE)
if (ipp_status == IPP_NOT_FOUND)
{
/*
* Job has gone away and/or the server has no job history...
@@ -1729,14 +1676,16 @@ main(int argc, /* I - Number of command-line args */
fprintf(stderr, "DEBUG: Get-Job-Attributes: %s (%s)\n",
ippErrorString(ipp_status), cupsLastErrorString());
if (ipp_status <= IPP_OK_CONFLICT)
password_tries = 0;
else
if (ipp_status > IPP_OK_CONFLICT)
{
if (ipp_status != IPP_SERVICE_UNAVAILABLE &&
ipp_status != IPP_NOT_POSSIBLE &&
ipp_status != IPP_PRINTER_BUSY)
{
ippDelete(response);
_cupsLangPrintFilter(stderr, "ERROR",
_("Unable to get print job status."));
ipp_status = IPP_OK;
break;
}
@@ -1812,7 +1761,7 @@ main(int argc, /* I - Number of command-line args */
* Cancel the job as needed...
*/
if (job_canceled > 0 && job_id > 0)
if (job_canceled && job_id)
cancel_job(http, uri, job_id, resource, argv[2], version);
/*
@@ -1881,25 +1830,16 @@ main(int argc, /* I - Number of command-line args */
return (CUPS_BACKEND_AUTH_REQUIRED);
else if (ipp_status == IPP_INTERNAL_ERROR)
return (CUPS_BACKEND_STOP);
else if (ipp_status == IPP_CONFLICT)
else if (ipp_status == IPP_DOCUMENT_FORMAT ||
ipp_status == IPP_CONFLICT)
return (CUPS_BACKEND_FAILED);
else if (ipp_status == IPP_REQUEST_VALUE ||
ipp_status == IPP_DOCUMENT_FORMAT || job_canceled < 0)
{
if (ipp_status == IPP_REQUEST_VALUE)
_cupsLangPrintFilter(stderr, "ERROR", _("Print job too large."));
else if (ipp_status == IPP_DOCUMENT_FORMAT)
_cupsLangPrintFilter(stderr, "ERROR",
_("Printer cannot print supplied content."));
else
_cupsLangPrintFilter(stderr, "ERROR", _("Print job canceled at printer."));
return (CUPS_BACKEND_CANCEL);
}
else if (ipp_status > IPP_OK_CONFLICT && ipp_status != IPP_ERROR_JOB_CANCELED)
return (CUPS_BACKEND_RETRY_CURRENT);
else
{
_cupsLangPrintFilter(stderr, "INFO", _("Ready to print."));
return (CUPS_BACKEND_OK);
}
}
@@ -1995,9 +1935,6 @@ check_printer_state(
fprintf(stderr, "DEBUG: Get-Printer-Attributes: %s (%s)\n",
ippErrorString(cupsLastError()), cupsLastErrorString());
if (cupsLastError() <= IPP_OK_CONFLICT)
password_tries = 0;
/*
* Return the printer-state value...
*/
@@ -2105,8 +2042,6 @@ monitor_printer(
http = _httpCreate(monitor->hostname, monitor->port, NULL, monitor->encryption,
AF_UNSPEC);
httpSetTimeout(http, 30.0, timeout_cb, NULL);
if (username[0])
cupsSetUser(username);
cupsSetPasswordCB(password_cb);
/*
@@ -2136,8 +2071,7 @@ monitor_printer(
* Check the status of the job itself...
*/
job_op = (monitor->job_id > 0 && monitor->get_job_attrs) ?
IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS;
job_op = monitor->job_id > 0 ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS;
request = ippNewRequest(job_op);
request->request.op.version[0] = monitor->version / 10;
request->request.op.version[1] = monitor->version % 10;
@@ -2162,12 +2096,9 @@ monitor_printer(
response = cupsDoRequest(http, request, monitor->resource);
fprintf(stderr, "DEBUG: (monitor) %s: %s (%s)\n", ippOpString(job_op),
fprintf(stderr, "DEBUG: %s: %s (%s)\n", ippOpString(job_op),
ippErrorString(cupsLastError()), cupsLastErrorString());
if (cupsLastError() <= IPP_OK_CONFLICT)
password_tries = 0;
if (job_op == IPP_GET_JOB_ATTRIBUTES)
{
if ((attr = ippFindAttribute(response, "job-state",
@@ -2226,14 +2157,6 @@ monitor_printer(
ippDelete(response);
fprintf(stderr, "DEBUG: (monitor) job-state=%s\n",
ippEnumString("job-state", monitor->job_state));
if (!job_canceled &&
(monitor->job_state == IPP_JOB_CANCELED ||
monitor->job_state == IPP_JOB_ABORTED))
job_canceled = -1;
/*
* Disconnect from the printer - we'll reconnect on the next poll...
*/
@@ -2254,7 +2177,7 @@ monitor_printer(
* Cancel the job if necessary...
*/
if (job_canceled > 0 && monitor->job_id > 0)
if (job_canceled && monitor->job_id > 0)
if (!httpReconnect(http))
cancel_job(http, monitor->uri, monitor->job_id, monitor->resource,
monitor->user, monitor->version);
@@ -2335,7 +2258,7 @@ new_request(
fprintf(stderr, "DEBUG: job-name=\"%s\"\n", title);
}
if (format && op != IPP_CREATE_JOB)
if (format)
{
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, format);
@@ -2343,7 +2266,7 @@ new_request(
}
#ifdef HAVE_LIBZ
if (compression && op != IPP_CREATE_JOB)
if (compression)
{
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"compression", NULL, compression);
@@ -2482,46 +2405,9 @@ new_request(
NULL, "two-sided-short-edge");
}
if ((keyword = cupsGetOption("multiple-document-handling",
num_options, options)) != NULL)
{
if (strstr(keyword, "uncollated"))
keyword = "false";
else
keyword = "true";
}
else if ((keyword = cupsGetOption("collate", num_options,
options)) == NULL)
keyword = "true";
if (format)
{
if (!_cups_strcasecmp(format, "image/gif") ||
!_cups_strcasecmp(format, "image/jp2") ||
!_cups_strcasecmp(format, "image/jpeg") ||
!_cups_strcasecmp(format, "image/png") ||
!_cups_strcasecmp(format, "image/tiff") ||
!_cups_strncasecmp(format, "image/x-", 8))
{
/*
* Collation makes no sense for single page image formats...
*/
keyword = "false";
}
else if (!_cups_strncasecmp(format, "image/", 6) ||
!_cups_strcasecmp(format, "application/vnd.cups-raster"))
{
/*
* Multi-page image formats will have copies applied by the upstream
* filters...
*/
copies = 1;
}
}
if (doc_handling_sup)
if (doc_handling_sup &&
(!format || _cups_strncasecmp(format, "image/", 6)) &&
(keyword = cupsGetOption("collate", num_options, options)) != NULL)
{
if (!_cups_strcasecmp(keyword, "true"))
collate_str = "separate-documents-collated-copies";
@@ -2535,9 +2421,6 @@ new_request(
"multiple-document-handling", NULL, collate_str);
break;
}
if (i >= doc_handling_sup->num_values)
copies = 1;
}
/*
@@ -2583,10 +2466,10 @@ new_request(
* When talking to another CUPS server, send all options...
*/
cupsEncodeOptions2(request, num_options, options, IPP_TAG_JOB);
cupsEncodeOptions(request, num_options, options);
}
if (copies > 1 && (!pc || copies <= pc->max_copies))
if (copies > 1)
ippAddInteger(request, IPP_TAG_JOB, IPP_TAG_INTEGER, "copies", copies);
}
@@ -2601,9 +2484,6 @@ new_request(
static const char * /* O - Password */
password_cb(const char *prompt) /* I - Prompt (not used) */
{
fprintf(stderr, "DEBUG: password_cb(prompt=\"%s\"), password=%p, "
"password_tries=%d\n", prompt, password, password_tries);
(void)prompt;
/*
@@ -2666,23 +2546,17 @@ report_attr(ipp_attribute_t *attr) /* I - Attribute */
case IPP_TAG_TEXT :
case IPP_TAG_NAME :
case IPP_TAG_KEYWORD :
*valptr++ = '\'';
*valptr++ = '\"';
for (attrptr = attr->values[i].string.text;
*attrptr && valptr < (value + sizeof(value) - 10);
attrptr ++)
{
if (*attrptr == '\\' || *attrptr == '\"' || *attrptr == '\'')
{
if (*attrptr == '\\' || *attrptr == '\"')
*valptr++ = '\\';
*valptr++ = '\\';
*valptr++ = '\\';
}
*valptr++ = *attrptr;
}
*valptr++ = '\"';
*valptr++ = '\'';
break;
default :
@@ -3031,8 +2905,6 @@ sigterm_handler(int sig) /* I - Signal */
{
(void)sig; /* remove compiler warnings... */
write(2, "DEBUG: Got SIGTERM.\n", 20);
#if defined(HAVE_GSSAPI) && defined(HAVE_XPC)
if (child_pid)
{
@@ -3047,8 +2919,6 @@ sigterm_handler(int sig) /* I - Signal */
* Flag that the job should be canceled...
*/
write(2, "DEBUG: job_canceled = 1.\n", 25);
job_canceled = 1;
return;
}
+74 -50
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Line Printer Daemon backend for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -19,6 +19,7 @@
* main() - Send a file to the printer or server.
* lpd_command() - Send an LPR command sequence and wait for a reply.
* lpd_queue() - Queue a file using the Line Printer Daemon protocol.
* lpd_timeout() - Handle timeout alarms...
* lpd_write() - Write a buffer of data to an LPD server.
* rresvport_af() - A simple implementation of rresvport_af().
* sigterm_handler() - Handle 'terminate' signals that stop the backend.
@@ -86,13 +87,14 @@ static int abort_job = 0; /* Non-zero if we get SIGTERM */
* Local functions...
*/
static int lpd_command(int lpd_fd, char *format, ...);
static int lpd_command(int lpd_fd, int timeout, char *format, ...);
static int lpd_queue(const char *hostname, http_addrlist_t *addrlist,
const char *printer, int print_fd, int snmp_fd,
int mode, const char *user, const char *title,
int copies, int banner, int format, int order,
int reserve, int manual_copies, int timeout,
int contimeout, const char *orighost);
int contimeout);
static void lpd_timeout(int sig);
static int lpd_write(int lpd_fd, char *buffer, int length);
#ifndef HAVE_RRESVPORT_AF
static int rresvport_af(int *port, int family);
@@ -144,8 +146,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
int num_jobopts; /* Number of job options */
cups_option_t *jobopts = NULL; /* Job options */
/*
@@ -193,8 +193,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
return (CUPS_BACKEND_FAILED);
}
num_jobopts = cupsParseOptions(argv[5], 0, &jobopts);
/*
* Extract the hostname and printer name from the URI...
*/
@@ -529,9 +527,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
status = lpd_queue(hostname, addrlist, resource + 1, fd, snmp_fd, mode,
username, title, copies, banner, format, order, reserve,
manual_copies, timeout, contimeout,
cupsGetOption("job-originating-host-name", num_jobopts,
jobopts));
manual_copies, timeout, contimeout);
if (!status)
fprintf(stderr, "PAGE: 1 %d\n", atoi(argv[4]));
@@ -539,9 +535,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
else
status = lpd_queue(hostname, addrlist, resource + 1, fd, snmp_fd, mode,
username, title, 1, banner, format, order, reserve, 1,
timeout, contimeout,
cupsGetOption("job-originating-host-name", num_jobopts,
jobopts));
timeout, contimeout);
/*
* Remove the temporary file if necessary...
@@ -570,6 +564,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
static int /* O - Status of command */
lpd_command(int fd, /* I - Socket connection to LPD host */
int timeout, /* I - Seconds to wait for a response */
char *format, /* I - printf()-style format string */
...) /* I - Additional args as necessary */
{
@@ -614,12 +609,18 @@ lpd_command(int fd, /* I - Socket connection to LPD host */
fputs("DEBUG: Reading command status...\n", stderr);
alarm(timeout);
if (recv(fd, &status, 1, 0) < 1)
{
_cupsLangPrintFilter(stderr, "WARNING", _("The printer did not respond."));
_cupsLangPrintFilter(stderr, "WARNING",
_("Printer did not respond after %d seconds."),
timeout);
status = errno;
}
alarm(0);
fprintf(stderr, "DEBUG: lpd_command returning %d\n", status);
return (status);
@@ -646,8 +647,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
int reserve, /* I - Reserve ports? */
int manual_copies,/* I - Do copies by hand... */
int timeout, /* I - Timeout... */
int contimeout, /* I - Connection timeout */
const char *orighost) /* I - job-originating-host-name */
int contimeout) /* I - Connection timeout */
{
char localhost[255]; /* Local host name */
int error; /* Error number */
@@ -666,13 +666,27 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
size_t nbytes; /* Number of bytes written */
off_t tbytes; /* Total bytes written */
char buffer[32768]; /* Output buffer */
#ifdef WIN32
DWORD tv; /* Timeout in milliseconds */
#else
struct timeval tv; /* Timeout in secs and usecs */
#endif /* WIN32 */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
#endif /* HAVE_SIGACTION && !HAVE_SIGSET */
/*
* Setup an alarm handler for timeouts...
*/
#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
sigset(SIGALRM, lpd_timeout);
#elif defined(HAVE_SIGACTION)
memset(&action, 0, sizeof(action));
sigemptyset(&action.sa_mask);
action.sa_handler = lpd_timeout;
sigaction(SIGALRM, &action, NULL);
#else
signal(SIGALRM, lpd_timeout);
#endif /* HAVE_SIGSET */
/*
* Remember when we started trying to connect to the printer...
*/
@@ -825,7 +839,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
case ECONNREFUSED :
default :
_cupsLangPrintFilter(stderr, "WARNING",
_("The printer is in use."));
_("The printer is busy."));
break;
}
@@ -850,23 +864,6 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
}
}
/*
* Set the timeout...
*/
#ifdef WIN32
tv = (DWORD)(timeout * 1000);
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv));
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv));
#else
tv.tv_sec = timeout;
tv.tv_usec = 0;
setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
#endif /* WIN32 */
fputs("STATE: -connecting-to-device\n", stderr);
_cupsLangPrintFilter(stderr, "INFO", _("Connected to printer."));
@@ -929,17 +926,14 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
* literal output...
*/
if (lpd_command(fd, "\002%s\n",
if (lpd_command(fd, timeout, "\002%s\n",
printer)) /* Receive print job(s) */
{
close(fd);
return (CUPS_BACKEND_FAILED);
}
if (orighost && _cups_strcasecmp(orighost, "localhost"))
strlcpy(localhost, orighost, sizeof(localhost));
else
httpGetHostname(NULL, localhost, sizeof(localhost));
httpGetHostname(NULL, localhost, sizeof(localhost));
snprintf(control, sizeof(control),
"H%.31s\n" /* RFC 1179, Section 7.2 - host name <= 31 chars */
@@ -984,7 +978,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
* Send the control file...
*/
if (lpd_command(fd, "\002%d cfA%03.3d%.15s\n", strlen(control),
if (lpd_command(fd, timeout, "\002%d cfA%03.3d%.15s\n", strlen(control),
(int)getpid() % 1000, localhost))
{
close(fd);
@@ -1003,12 +997,17 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
}
else
{
alarm(timeout);
if (read(fd, &status, 1) < 1)
{
_cupsLangPrintFilter(stderr, "WARNING",
_("The printer did not respond."));
_("Printer did not respond after %d seconds."),
timeout);
status = errno;
}
alarm(0);
}
if (status != 0)
@@ -1034,7 +1033,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
* Send the print file...
*/
if (lpd_command(fd, "\003" CUPS_LLFMT " dfA%03.3d%.15s\n",
if (lpd_command(fd, timeout, "\003" CUPS_LLFMT " dfA%03.3d%.15s\n",
CUPS_LLCAST filestats.st_size, (int)getpid() % 1000,
localhost))
{
@@ -1085,12 +1084,17 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
* want to requeue it over and over...
*/
alarm(timeout);
if (recv(fd, &status, 1, 0) < 1)
{
_cupsLangPrintFilter(stderr, "WARNING",
_("The printer did not respond."));
_("Printer did not respond after %d seconds."),
timeout);
status = 0;
}
alarm(0);
}
}
else
@@ -1117,7 +1121,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
* Send control file...
*/
if (lpd_command(fd, "\002%d cfA%03.3d%.15s\n", strlen(control),
if (lpd_command(fd, timeout, "\002%d cfA%03.3d%.15s\n", strlen(control),
(int)getpid() % 1000, localhost))
{
close(fd);
@@ -1135,12 +1139,17 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
}
else
{
alarm(timeout);
if (read(fd, &status, 1) < 1)
{
_cupsLangPrintFilter(stderr, "WARNING",
_("The printer did not respond."));
_("Printer did not respond after %d seconds."),
timeout);
status = errno;
}
alarm(0);
}
if (status != 0)
@@ -1183,6 +1192,21 @@ lpd_queue(const char *hostname, /* I - Host to connect to */
}
/*
* 'lpd_timeout()' - Handle timeout alarms...
*/
static void
lpd_timeout(int sig) /* I - Signal number */
{
(void)sig;
#if !defined(HAVE_SIGSET) && !defined(HAVE_SIGACTION)
signal(SIGALRM, lpd_timeout);
#endif /* !HAVE_SIGSET && !HAVE_SIGACTION */
}
/*
* 'lpd_write()' - Write a buffer of data to an LPD server.
*/
+3 -29
Ver Arquivo
@@ -92,7 +92,7 @@ backendNetworkSideCB(
status = CUPS_SC_STATUS_NOT_IMPLEMENTED;
else if (backendDrainOutput(print_fd, device_fd))
status = CUPS_SC_STATUS_IO_ERROR;
else
else
status = CUPS_SC_STATUS_OK;
datalen = 0;
@@ -119,35 +119,8 @@ backendNetworkSideCB(
if (snmp_fd >= 0)
{
char *dataptr; /* Pointer into data */
cups_snmp_t packet; /* Packet from printer */
const char *snmp_value; /* CUPS_SNMP_VALUE env var */
if ((snmp_value = getenv("CUPS_SNMP_VALUE")) != NULL)
{
const char *snmp_count; /* CUPS_SNMP_COUNT env var */
int count; /* Repetition count */
if ((snmp_count = getenv("CUPS_SNMP_COUNT")) != NULL)
{
if ((count = atoi(snmp_count)) <= 0)
count = 1;
}
else
count = 1;
for (dataptr = data + strlen(data) + 1;
count > 0 && dataptr < (data + sizeof(data) - 1);
count --, dataptr += strlen(dataptr))
strlcpy(dataptr, snmp_value, sizeof(data) - (dataptr - data));
fprintf(stderr, "DEBUG: Returning %s %s\n", data,
data + strlen(data) + 1);
status = CUPS_SC_STATUS_OK;
datalen = dataptr - data;
break;
}
if (!_cupsSNMPStringToOID(data, packet.object_name, CUPS_SNMP_MAX_OID))
{
@@ -168,6 +141,7 @@ backendNetworkSideCB(
{
if (_cupsSNMPRead(snmp_fd, &packet, 1.0))
{
char *dataptr; /* Pointer into data */
int i; /* Looping var */
@@ -198,7 +172,7 @@ backendNetworkSideCB(
case CUPS_ASN1_OCTET_STRING :
if (packet.object_value.string.num_bytes < 0)
i = 0;
else if (packet.object_value.string.num_bytes <
else if (packet.object_value.string.num_bytes <
(sizeof(data) - (dataptr - data)))
i = packet.object_value.string.num_bytes;
else
+12 -32
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Common run loop APIs for CUPS backends.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 2006-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -92,8 +92,7 @@ backendDrainOutput(int print_fd, /* I - Print file descriptor */
if (errno != EAGAIN || errno != EINTR)
{
fprintf(stderr, "DEBUG: Read failed: %s\n", strerror(errno));
_cupsLangPrintFilter(stderr, "ERROR", _("Unable to read print data."));
_cupsLangPrintError("ERROR", _("Unable to read print data"));
return (-1);
}
@@ -251,7 +250,7 @@ backendRunLoop(
{
fputs("STATE: +offline-report\n", stderr);
_cupsLangPrintFilter(stderr, "INFO",
_("The printer is not connected."));
_("Printer is not currently connected."));
offline = 1;
}
else if (errno == EINTR && total_bytes == 0)
@@ -320,9 +319,7 @@ backendRunLoop(
if (errno != EAGAIN || errno != EINTR)
{
fprintf(stderr, "DEBUG: Read failed: %s\n", strerror(errno));
_cupsLangPrintFilter(stderr, "ERROR",
_("Unable to read print data."));
_cupsLangPrintError("ERROR", _("Unable to read print data"));
return (-1);
}
@@ -371,7 +368,7 @@ backendRunLoop(
{
fputs("STATE: +offline-report\n", stderr);
_cupsLangPrintFilter(stderr, "INFO",
_("The printer is not connected."));
_("Printer is not currently connected."));
offline = 1;
}
}
@@ -392,8 +389,7 @@ backendRunLoop(
if (offline && update_state)
{
fputs("STATE: -offline-report\n", stderr);
_cupsLangPrintFilter(stderr, "INFO",
_("The printer is now connected."));
_cupsLangPrintFilter(stderr, "INFO", _("Printer is now connected."));
offline = 0;
}
@@ -438,11 +434,9 @@ backendWaitLoop(
int use_bc, /* I - Use back-channel? */
_cups_sccb_t side_cb) /* I - Side-channel callback */
{
int nfds; /* Number of file descriptors */
fd_set input; /* Input set for reading */
time_t curtime = 0, /* Current time */
snmp_update = 0;/* Last SNMP status update */
struct timeval timeout; /* Timeout for select() */
fd_set input; /* Input set for reading */
time_t curtime, /* Current time */
snmp_update = 0; /* Last SNMP status update */
fprintf(stderr, "DEBUG: backendWaitLoop(snmp_fd=%d, addr=%p, side_cb=%p)\n",
@@ -452,9 +446,6 @@ backendWaitLoop(
* Now loop until we receive data from stdin...
*/
if (snmp_fd >= 0)
snmp_update = time(NULL) + 5;
for (;;)
{
/*
@@ -466,18 +457,7 @@ backendWaitLoop(
if (side_cb)
FD_SET(CUPS_SC_FD, &input);
if (snmp_fd >= 0)
{
curtime = time(NULL);
timeout.tv_sec = curtime >= snmp_update ? 0 : snmp_update - curtime;
timeout.tv_usec = 0;
nfds = select(CUPS_SC_FD + 1, &input, NULL, NULL, &timeout);
}
else
nfds = select(CUPS_SC_FD + 1, &input, NULL, NULL, NULL);
if (nfds < 0)
if (select(CUPS_SC_FD + 1, &input, NULL, NULL, NULL) < 0)
{
/*
* Pause printing to clear any pending errors...
@@ -521,10 +501,10 @@ backendWaitLoop(
* Do SNMP updates periodically...
*/
if (snmp_fd >= 0 && curtime >= snmp_update)
if (snmp_fd >= 0 && time(&curtime) >= snmp_update)
{
if (backendSNMPSupplies(snmp_fd, addr, NULL, NULL))
snmp_fd = -1;
snmp_update = INT_MAX;
else
snmp_update = curtime + 5;
}
+31 -122
Ver Arquivo
@@ -3,7 +3,7 @@
*
* SNMP supplies functions for CUPS.
*
* Copyright 2008-2012 by Apple Inc.
* Copyright 2008-2011 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -36,21 +36,14 @@
#define CUPS_MAX_SUPPLIES 32 /* Maximum number of supplies for a printer */
#define CUPS_SUPPLY_TIMEOUT 2.0 /* Timeout for SNMP lookups */
#define CUPS_DEVELOPER_LOW 0x0001
#define CUPS_DEVELOPER_EMPTY 0x0002
#define CUPS_MARKER_SUPPLY_LOW 0x0004
#define CUPS_MARKER_SUPPLY_EMPTY 0x0008
#define CUPS_OPC_NEAR_EOL 0x0010
#define CUPS_OPC_LIFE_OVER 0x0020
#define CUPS_TONER_LOW 0x0040
#define CUPS_TONER_EMPTY 0x0080
#define CUPS_WASTE_ALMOST_FULL 0x0100
#define CUPS_WASTE_FULL 0x0200
#define CUPS_CLEANER_NEAR_EOL 0x0400 /* Proposed JPS3 */
#define CUPS_CLEANER_LIFE_OVER 0x0800 /* Proposed JPS3 */
#define CUPS_SNMP_NONE 0x0000
#define CUPS_SNMP_CAPACITY 0x0001 /* Supply levels reported as percentages */
#define CUPS_DEVELOPER_LOW 1
#define CUPS_DEVELOPER_EMPTY 2
#define CUPS_MARKER_SUPPLY_LOW 4
#define CUPS_MARKER_SUPPLY_EMPTY 8
#define CUPS_OPC_NEAR_EOL 16
#define CUPS_OPC_LIFE_OVER 32
#define CUPS_TONER_LOW 64
#define CUPS_TONER_EMPTY 128
/*
@@ -82,8 +75,6 @@ static http_addr_t current_addr; /* Current address */
static int current_state = -1;
/* Current device state bits */
static int charset = -1; /* Character set for supply names */
static unsigned quirks = CUPS_SNMP_NONE;
/* Quirks we have to work around */
static int num_supplies = 0;
/* Number of supplies found */
static backend_supplies_t supplies[CUPS_MAX_SUPPLIES];
@@ -155,17 +146,10 @@ static const int prtMarkerSuppliesType[] =
(sizeof(prtMarkerSuppliesType) /
sizeof(prtMarkerSuppliesType[0]));
/* Offset to supply index */
static const int prtMarkerSuppliesSupplyUnit[] =
{ CUPS_OID_prtMarkerSuppliesSupplyUnit, -1 },
/* Units OID */
prtMarkerSuppliesSupplyUnitOffset =
(sizeof(prtMarkerSuppliesSupplyUnit) /
sizeof(prtMarkerSuppliesSupplyUnit[0]));
/* Offset to supply index */
static const backend_state_t const printer_states[] =
{
/* { CUPS_TC_lowPaper, "media-low-report" }, */
{ CUPS_TC_lowPaper, "media-low-report" },
{ CUPS_TC_noPaper | CUPS_TC_inputTrayEmpty, "media-empty-warning" },
/* { CUPS_TC_lowToner, "toner-low-report" }, */ /* now use prtMarkerSupplies */
/* { CUPS_TC_noToner, "toner-empty-warning" }, */ /* now use prtMarkerSupplies */
@@ -189,11 +173,7 @@ static const backend_state_t const supply_states[] =
{ CUPS_OPC_NEAR_EOL, "opc-near-eol-report" },
{ CUPS_OPC_LIFE_OVER, "opc-life-over-warning" },
{ CUPS_TONER_LOW, "toner-low-report" },
{ CUPS_TONER_EMPTY, "toner-empty-warning" },
{ CUPS_WASTE_ALMOST_FULL, "waste-receptacle-almost-full-report" },
{ CUPS_WASTE_FULL, "waste-receptacle-full-warning" },
{ CUPS_CLEANER_NEAR_EOL, "cleaner-life-almost-over-report" },
{ CUPS_CLEANER_LIFE_OVER, "cleaner-life-over-warning" },
{ CUPS_TONER_EMPTY, "toner-empty-warning" }
};
@@ -251,9 +231,6 @@ backendSNMPSupplies(
{
if (supplies[i].max_capacity > 0 && supplies[i].level >= 0)
percent = 100 * supplies[i].level / supplies[i].max_capacity;
else if (supplies[i].level >= 0 && supplies[i].level <= 100 &&
(quirks & CUPS_SNMP_CAPACITY))
percent = supplies[i].level;
else
percent = 50;
@@ -268,6 +245,9 @@ backendSNMPSupplies(
else
new_supply_state |= CUPS_TONER_LOW;
break;
case CUPS_TC_wasteToner :
case CUPS_TC_wasteInk :
break;
case CUPS_TC_ink :
case CUPS_TC_inkCartridge :
case CUPS_TC_inkRibbon :
@@ -293,31 +273,13 @@ backendSNMPSupplies(
else
new_supply_state |= CUPS_OPC_NEAR_EOL;
break;
case CUPS_TC_wasteInk :
case CUPS_TC_wastePaper :
case CUPS_TC_wasteToner :
case CUPS_TC_wasteWater :
case CUPS_TC_wasteWax :
if (percent <= 1)
new_supply_state |= CUPS_WASTE_FULL;
else
new_supply_state |= CUPS_WASTE_ALMOST_FULL;
break;
case CUPS_TC_cleanerUnit :
case CUPS_TC_fuserCleaningPad :
if (percent <= 1)
new_supply_state |= CUPS_CLEANER_LIFE_OVER;
else
new_supply_state |= CUPS_CLEANER_NEAR_EOL;
break;
}
}
if (i)
*ptr++ = ',';
if ((supplies[i].max_capacity > 0 || (quirks & CUPS_SNMP_CAPACITY)) &&
supplies[i].level >= 0)
if (supplies[i].max_capacity > 0 && supplies[i].level >= 0)
sprintf(ptr, "%d", percent);
else
strcpy(ptr, "-1");
@@ -446,7 +408,7 @@ backend_init_supplies(
cachefilename[1024], /* Cache filename */
description[CUPS_SNMP_MAX_STRING],
/* Device description string */
value[CUPS_MAX_SUPPLIES * (CUPS_SNMP_MAX_STRING * 4 + 3)],
value[CUPS_MAX_SUPPLIES * (CUPS_SNMP_MAX_STRING * 2 + 3)],
/* Value string */
*ptr, /* Pointer into value string */
*name_ptr; /* Pointer into name string */
@@ -515,12 +477,6 @@ backend_init_supplies(
return;
}
if ((ppdattr = ppdFindAttr(ppd, "cupsSNMPQuirks", NULL)) != NULL)
{
if (!_cups_strcasecmp(ppdattr->value, "capacity"))
quirks |= CUPS_SNMP_CAPACITY;
}
ppdClose(ppd);
/*
@@ -703,8 +659,7 @@ backend_init_supplies(
fprintf(stderr, "ATTR: marker-colors=%s\n", value);
/*
* Output the marker-names attribute (the double quoting is necessary to deal
* with embedded quotes and commas in the marker names...)
* Output the marker-names attribute...
*/
for (i = 0, ptr = value; i < num_supplies; i ++)
@@ -712,21 +667,15 @@ backend_init_supplies(
if (i)
*ptr++ = ',';
*ptr++ = '\'';
*ptr++ = '\"';
for (name_ptr = supplies[i].name; *name_ptr;)
{
if (*name_ptr == '\\' || *name_ptr == '\"' || *name_ptr == '\'')
{
if (*name_ptr == '\\' || *name_ptr == '\"')
*ptr++ = '\\';
*ptr++ = '\\';
*ptr++ = '\\';
}
*ptr++ = *name_ptr++;
}
*ptr++ = '\"';
*ptr++ = '\'';
}
*ptr = '\0';
@@ -763,33 +712,16 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
void *data) /* I - User data (unused) */
{
int i, j, k; /* Looping vars */
static const char * const colors[][2] =
static const char * const colors[8][2] =
{ /* Standard color names */
{ "black", "#000000" },
{ "blue", "#0000FF" },
{ "brown", "#A52A2A" },
{ "cyan", "#00FFFF" },
{ "dark-gray", "#404040" },
{ "dark gray", "#404040" },
{ "dark-yellow", "#FFCC00" },
{ "dark yellow", "#FFCC00" },
{ "gold", "#FFD700" },
{ "gray", "#808080" },
{ "green", "#00FF00" },
{ "light-black", "#606060" },
{ "light black", "#606060" },
{ "light-cyan", "#E0FFFF" },
{ "light cyan", "#E0FFFF" },
{ "light-gray", "#D3D3D3" },
{ "light gray", "#D3D3D3" },
{ "light-magenta", "#FF77FF" },
{ "light magenta", "#FF77FF" },
{ "magenta", "#FF00FF" },
{ "orange", "#FFA500" },
{ "red", "#FF0000" },
{ "silver", "#C0C0C0" },
{ "white", "#FFFFFF" },
{ "yellow", "#FFFF00" }
{ "black", "#000000" },
{ "blue", "#0000FF" },
{ "cyan", "#00FFFF" },
{ "green", "#00FF00" },
{ "magenta", "#FF00FF" },
{ "red", "#FF0000" },
{ "white", "#FFFFFF" },
{ "yellow", "#FFFF00" }
};
@@ -811,8 +743,7 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
if (supplies[j].colorant == i)
{
for (k = 0; k < (int)(sizeof(colors) / sizeof(colors[0])); k ++)
if (!_cups_strcasecmp(colors[k][0],
(char *)packet->object_value.string.bytes))
if (!strcmp(colors[k][0], (char *)packet->object_value.string.bytes))
{
strcpy(supplies[j].color, colors[k][1]);
break;
@@ -903,6 +834,7 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
{
char *src, *dst; /* Pointers into strings */
/*
* Loop safe because both the object_value and supplies char arrays
* are CUPS_SNMP_MAX_STRING elements long.
@@ -947,8 +879,7 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
supplies[i - 1].level = packet->object_value.integer;
}
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesMaxCapacity) &&
!(quirks & CUPS_SNMP_CAPACITY))
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesMaxCapacity))
{
/*
* Get max capacity...
@@ -965,9 +896,7 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
if (i > num_supplies)
num_supplies = i;
if (supplies[i - 1].max_capacity == 0 &&
packet->object_value.integer > 0)
supplies[i - 1].max_capacity = packet->object_value.integer;
supplies[i - 1].max_capacity = packet->object_value.integer;
}
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesType))
{
@@ -988,26 +917,6 @@ backend_walk_cb(cups_snmp_t *packet, /* I - SNMP packet */
supplies[i - 1].type = packet->object_value.integer;
}
else if (_cupsSNMPIsOIDPrefixed(packet, prtMarkerSuppliesSupplyUnit))
{
/*
* Get units for capacity...
*/
i = packet->object_name[prtMarkerSuppliesSupplyUnitOffset];
if (i < 1 || i > CUPS_MAX_SUPPLIES ||
packet->object_type != CUPS_ASN1_INTEGER)
return;
fprintf(stderr, "DEBUG2: prtMarkerSuppliesSupplyUnit.1.%d = %d\n", i,
packet->object_value.integer);
if (i > num_supplies)
num_supplies = i;
if (packet->object_value.integer == CUPS_TC_percent)
supplies[i - 1].max_capacity = 100;
}
}
+1 -1
Ver Arquivo
@@ -251,7 +251,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
#ifdef AF_INET6
if ((ipv6 = _cupsSNMPOpen(AF_INET6)) < 0)
perror("DEBUG: Unable to create IPv6 socket");
return (1);
#else
ipv6 = -1;
#endif /* AF_INET6 */
+4 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* AppSocket backend for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -371,7 +371,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
case ECONNREFUSED :
default :
_cupsLangPrintFilter(stderr, "WARNING",
_("The printer is in use."));
_("The printer is busy."));
break;
}
@@ -472,6 +472,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */
if (print_fd != 0)
close(print_fd);
_cupsLangPrintFilter(stderr, "INFO", _("Ready to print."));
return (CUPS_BACKEND_OK);
}
+8 -14
Ver Arquivo
@@ -98,18 +98,12 @@ main(int argc, /* I - Number of command-line args */
(ptr = strrchr(libpath, '/')) != NULL && !strcmp(ptr, "/backend"))
{
strlcpy(ptr, "/cups", sizeof(libpath) - (ptr - libpath));
if (!access(libpath, 0))
{
if (access(libpath, 0))
#ifdef __APPLE__
fprintf(stderr, "Setting DYLD_LIBRARY_PATH to \"%s\".\n", libpath);
setenv("DYLD_LIBRARY_PATH", libpath, 1);
#else
fprintf(stderr, "Setting LD_LIBRARY_PATH to \"%s\".\n", libpath);
setenv("LD_LIBRARY_PATH", libpath, 1);
#endif /* __APPLE__ */
}
else
perror(libpath);
}
/*
@@ -573,13 +567,13 @@ main(int argc, /* I - Number of command-line args */
length = sizeof(buffer);
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %d bytes (%s)\n", oid,
statuses[scstatus], (int)length, buffer);
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %s\n", oid,
statuses[scstatus], buffer);
length = sizeof(buffer);
scstatus = cupsSideChannelSNMPGet(oid, buffer, &length, 5.0);
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %d bytes (%s)\n", oid,
statuses[scstatus], (int)length, buffer);
printf("CUPS_SC_CMD_SNMP_GET %s returned %s, %s\n", oid,
statuses[scstatus], buffer);
}
length = 0;
@@ -638,13 +632,13 @@ sigterm_handler(int sig) /* I - Signal */
static void
usage(void)
{
puts("Usage: testbackend [-cancel] [-d] [-ps | -pcl] [-s [-get OID] "
puts("Usage: testbackend [-cancel] [-d] [-ps | -pcl] [-s [-oid OID] "
"[-walk OID]] [-t] device-uri job-id user title copies options [file]");
puts("");
puts("Options:");
puts(" -cancel Simulate a canceled print job after 2 seconds.");
puts(" -d Show log messages from backend.");
puts(" -get OID Lookup the specified SNMP OID.");
puts(" -oid OID Lookup the specified SNMP OID.");
puts(" (.1.3.6.1.2.1.43.10.2.1.4.1.1 is a good one for printers)");
puts(" -pcl Send PCL+PJL query and test page to backend.");
puts(" -ps Send PostScript query and test page to backend.");
@@ -667,7 +661,7 @@ walk_cb(const char *oid, /* I - OID */
int datalen, /* I - Length of data */
void *context) /* I - Context (unused) */
{
printf("CUPS_SC_CMD_SNMP_WALK %s, %d bytes (%s)\n", oid, datalen, data);
printf("CUPS_SC_CMD_SNMP_WALK %s=%s (%d bytes)\n", oid, data, datalen);
}
+6 -6
Ver Arquivo
@@ -1,7 +1,7 @@
/*
* "$Id$"
*
* Copyright 2005-2012 Apple Inc. All rights reserved.
* Copyright 2005-2011 Apple Inc. All rights reserved.
*
* IMPORTANT: This Apple software is supplied to you by Apple Computer,
* Inc. ("Apple") in consideration of your agreement to the following
@@ -820,10 +820,10 @@ print_device(const char *uri, /* I - Device URI */
/*
* If it didn't exit abort the pending read and wait an additional second...
*/
if (!g.read_thread_done)
{
fputs("DEBUG: Read thread still active, aborting the pending read...\n",
fputs("DEBUG: Read thread still active, aborting the pending read...\n",
stderr);
g.wait_eof = 0;
@@ -833,7 +833,7 @@ print_device(const char *uri, /* I - Device URI */
gettimeofday(&tv, NULL);
cond_timeout.tv_sec = tv.tv_sec + 1;
cond_timeout.tv_nsec = tv.tv_usec * 1000;
while (!g.read_thread_done)
{
if (pthread_cond_timedwait(&g.read_thread_cond, &g.read_thread_mutex,
@@ -1283,7 +1283,7 @@ static Boolean find_device_cb(void *refcon,
if (!keepLooking && g.status_timer != NULL)
{
fputs("STATE: -offline-report\n", stderr);
_cupsLangPrintFilter(stderr, "INFO", _("The printer is now online."));
_cupsLangPrintFilter(stderr, "INFO", _("Printer is now online."));
CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), g.status_timer, kCFRunLoopDefaultMode);
CFRelease(g.status_timer);
g.status_timer = NULL;
@@ -1304,7 +1304,7 @@ static void status_timer_cb(CFRunLoopTimerRef timer,
(void)info;
fputs("STATE: +offline-report\n", stderr);
_cupsLangPrintFilter(stderr, "INFO", _("The printer is offline."));
_cupsLangPrintFilter(stderr, "INFO", _("Printer is offline."));
if (getenv("CLASS") != NULL)
{
+224 -921
Ver Arquivo
Diferenças do arquivo suprimidas por serem muito extensas Carregar Diff
+10 -4
Ver Arquivo
@@ -5,7 +5,7 @@
*
* This file is included from "usb.c" when compiled on UNIX/Linux.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -128,12 +128,16 @@ print_device(const char *uri, /* I - Device URI */
if (errno == EBUSY)
{
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
_cupsLangPrintFilter(stderr, "INFO",
_("Printer busy, will retry in 10 seconds."));
sleep(10);
}
else if (errno == ENXIO || errno == EIO || errno == ENOENT ||
errno == ENODEV)
{
_cupsLangPrintFilter(stderr, "INFO",
_("Printer not connected, will retry in 30 "
"seconds."));
sleep(30);
}
else
@@ -421,7 +425,8 @@ open_device(const char *uri, /* I - Device URI */
*/
if (busy)
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
_cupsLangPrintFilter(stderr, "INFO",
_("Printer is busy, will retry in 5 seconds."));
sleep(5);
}
@@ -504,7 +509,8 @@ open_device(const char *uri, /* I - Device URI */
if (busy)
{
_cupsLangPrintFilter(stderr, "INFO", _("The printer is in use."));
_cupsLangPrintFilter(stderr, "INFO",
_("Printer is busy, will retry in 5 seconds."));
sleep(5);
}
}
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* USB port backend for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -55,7 +55,7 @@ int print_device(const char *uri, const char *hostname,
* Include the vendor-specific USB implementation...
*/
#ifdef HAVE_LIBUSB
#ifdef HAVE_USB_H
# include "usb-libusb.c"
#elif defined(__APPLE__)
# include "usb-darwin.c"
@@ -118,7 +118,7 @@ print_device(const char *uri, /* I - Device URI */
return (CUPS_BACKEND_FAILED);
}
#endif /* HAVE_LIBUSB */
#endif /* __APPLE__ */
/*
+28 -25
Ver Arquivo
@@ -1,25 +1,28 @@
lpc.o: lpc.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
../cups/debug-private.h ../cups/versioning.h ../cups/ipp-private.h \
../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h
lpq.o: lpq.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
../cups/debug-private.h ../cups/versioning.h ../cups/ipp-private.h \
../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h
lpr.o: lpr.c ../cups/cups-private.h ../cups/string-private.h ../config.h \
../cups/debug-private.h ../cups/versioning.h ../cups/ipp-private.h \
../cups/ipp.h ../cups/http.h ../cups/array.h ../cups/http-private.h \
../cups/md5-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/language.h ../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h
lprm.o: lprm.c ../cups/cups-private.h ../cups/string-private.h \
../config.h ../cups/debug-private.h ../cups/versioning.h \
../cups/ipp-private.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/http-private.h ../cups/md5-private.h \
../cups/language-private.h ../cups/transcode.h ../cups/language.h \
../cups/pwg-private.h ../cups/cups.h ../cups/file.h \
../cups/ppd-private.h ../cups/ppd.h ../cups/thread-private.h
lpc.o: lpc.c ../cups/cups-private.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/string-private.h ../config.h \
../cups/debug-private.h ../cups/ppd-private.h ../cups/ppd.h \
../cups/pwg-private.h ../cups/http-private.h ../cups/md5-private.h \
../cups/ipp-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/thread-private.h
lpq.o: lpq.c ../cups/cups-private.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/string-private.h ../config.h \
../cups/debug-private.h ../cups/ppd-private.h ../cups/ppd.h \
../cups/pwg-private.h ../cups/http-private.h ../cups/md5-private.h \
../cups/ipp-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/thread-private.h
lpr.o: lpr.c ../cups/cups-private.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/string-private.h ../config.h \
../cups/debug-private.h ../cups/ppd-private.h ../cups/ppd.h \
../cups/pwg-private.h ../cups/http-private.h ../cups/md5-private.h \
../cups/ipp-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/thread-private.h
lprm.o: lprm.c ../cups/cups-private.h ../cups/cups.h ../cups/file.h \
../cups/versioning.h ../cups/ipp.h ../cups/http.h ../cups/array.h \
../cups/language.h ../cups/string-private.h ../config.h \
../cups/debug-private.h ../cups/ppd-private.h ../cups/ppd.h \
../cups/pwg-private.h ../cups/http-private.h ../cups/md5-private.h \
../cups/ipp-private.h ../cups/language-private.h ../cups/transcode.h \
../cups/thread-private.h
+2 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpc" command for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -364,8 +364,7 @@ show_status(http_t *http, /* I - HTTP connection to server */
for (ptr = printer;
*ptr != '\0' && *dptr != '\0' && *ptr == *dptr;
ptr ++, dptr ++)
/* do nothing */;
ptr ++, dptr ++);
if (*ptr == '\0' && (*dptr == '\0' || *dptr == ',' ||
isspace(*dptr & 255)))
+4 -9
Ver Arquivo
@@ -3,7 +3,7 @@
*
* "lpr" command for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -89,7 +89,7 @@ main(int argc, /* I - Number of command-line arguments */
cupsSetUser(argv[i]);
}
break;
case 'H' : /* Connect to host */
if (argv[i][2] != '\0')
cupsSetServer(argv[i] + 2);
@@ -377,6 +377,7 @@ main(int argc, /* I - Number of command-line arguments */
const char *format; /* Document format */
ssize_t bytes; /* Bytes read */
if (cupsGetOption("raw", num_options, options))
format = CUPS_FORMAT_RAW;
else if ((format = cupsGetOption("document-format", num_options,
@@ -394,17 +395,11 @@ main(int argc, /* I - Number of command-line arguments */
{
_cupsLangPrintf(stderr, _("%s: Error - unable to queue from stdin - %s."),
argv[0], httpStatus(status));
cupsFinishDocument(CUPS_HTTP_DEFAULT, printer);
cupsCancelJob2(CUPS_HTTP_DEFAULT, printer, job_id, 0);
return (1);
}
if (cupsFinishDocument(CUPS_HTTP_DEFAULT, printer) != IPP_OK)
{
_cupsLangPrintf(stderr, "%s: %s", argv[0], cupsLastErrorString());
cupsCancelJob2(CUPS_HTTP_DEFAULT, printer, job_id, 0);
return (1);
}
job_id = 0;
}
if (job_id < 1)
+45 -67
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Administration CGI for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -523,7 +523,7 @@ do_add_rss_subscription(http_t *http) /* I - HTTP connection */
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(_("Add RSS Subscription"));
cgiShowIPPError(_("Unable to add RSS subscription"));
cgiShowIPPError(_("Unable to add RSS subscription:"));
}
else
{
@@ -810,8 +810,8 @@ do_am_class(http_t *http, /* I - HTTP connection */
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(modify ? _("Unable to modify class") :
_("Unable to add class"));
cgiShowIPPError(modify ? _("Unable to modify class:") :
_("Unable to add class:"));
}
else
{
@@ -1055,8 +1055,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
else
{
cgiStartHTML(title);
cgiShowIPPError(modify ? _("Unable to modify printer") :
_("Unable to add printer"));
cgiShowIPPError(modify ? _("Unable to modify printer:") :
_("Unable to add printer:"));
cgiEndHTML();
return;
}
@@ -1317,7 +1317,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */
else
{
cgiStartHTML(title);
cgiShowIPPError(_("Unable to get list of printer drivers"));
cgiShowIPPError(_("Unable to get list of printer drivers:"));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
}
@@ -1415,8 +1415,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(modify ? _("Unable to modify printer") :
_("Unable to add printer"));
cgiShowIPPError(modify ? _("Unable to modify printer:") :
_("Unable to add printer:"));
}
else if (modify)
{
@@ -1522,7 +1522,7 @@ do_cancel_subscription(http_t *http)/* I - HTTP connection */
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(_("Cancel RSS Subscription"));
cgiShowIPPError(_("Unable to cancel RSS subscription"));
cgiShowIPPError(_("Unable to cancel RSS subscription:"));
}
else
{
@@ -1557,8 +1557,6 @@ do_config_server(http_t *http) /* I - HTTP connection */
int advanced, /* Advanced settings shown? */
changed; /* Have settings changed? */
const char *debug_logging, /* DEBUG_LOGGING value */
*preserve_jobs = NULL,
/* PRESERVE_JOBS value */
*remote_admin, /* REMOTE_ADMIN value */
*remote_any, /* REMOTE_ANY value */
*share_printers,/* SHARE_PRINTERS value */
@@ -1613,36 +1611,19 @@ do_config_server(http_t *http) /* I - HTTP connection */
*/
browse_web_if = cgiGetVariable("BROWSE_WEB_IF") ? "Yes" : "No";
preserve_job_history = cgiGetVariable("PRESERVE_JOB_HISTORY") ? "Yes" : "No";
preserve_job_files = cgiGetVariable("PRESERVE_JOB_FILES") ? "Yes" : "No";
max_clients = cgiGetVariable("MAX_CLIENTS");
max_jobs = cgiGetVariable("MAX_JOBS");
max_log_size = cgiGetVariable("MAX_LOG_SIZE");
preserve_jobs = cgiGetVariable("PRESERVE_JOBS");
if (preserve_jobs)
{
max_jobs = cgiGetVariable("MAX_JOBS");
preserve_job_history = cgiGetVariable("PRESERVE_JOB_HISTORY");
preserve_job_files = cgiGetVariable("PRESERVE_JOB_FILES");
if (!max_jobs || atoi(max_jobs) < 0)
max_jobs = "500";
if (!preserve_job_history)
preserve_job_history = "On";
if (!preserve_job_files)
preserve_job_files = "1d";
}
else
{
max_jobs = "0";
preserve_job_history = "No";
preserve_job_files = "No";
}
if (!max_clients || atoi(max_clients) <= 0)
max_clients = "100";
if (!max_log_size || atoi(max_log_size) <= 0.0)
if (!max_jobs || atoi(max_jobs) <= 0)
max_jobs = "500";
if (!max_log_size || atof(max_log_size) <= 0.0)
max_log_size = "1m";
}
@@ -1654,7 +1635,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
{
cgiStartHTML(cgiText(_("Change Settings")));
cgiSetVariable("MESSAGE",
cgiText(_("Unable to change server settings")));
cgiText(_("Unable to change server settings:")));
cgiSetVariable("ERROR", cupsLastErrorString());
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -1693,7 +1674,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
if ((current_preserve_job_files = cupsGetOption("PreserveJobFiles",
num_settings,
settings)) == NULL)
current_preserve_job_files = "1d";
current_preserve_job_files = "No";
if ((current_max_clients = cupsGetOption("MaxClients", num_settings,
settings)) == NULL)
@@ -1796,7 +1777,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
cgiStartHTML(cgiText(_("Change Settings")));
cgiSetVariable("MESSAGE",
cgiText(_("Unable to change server settings")));
cgiText(_("Unable to change server settings:")));
cgiSetVariable("ERROR", cupsLastErrorString());
cgiCopyTemplateLang("error.tmpl");
}
@@ -1847,7 +1828,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
if ((tempfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0)
{
cgiStartHTML(cgiText(_("Edit Configuration File")));
cgiSetVariable("MESSAGE", cgiText(_("Unable to create temporary file")));
cgiSetVariable("MESSAGE", cgiText(_("Unable to create temporary file:")));
cgiSetVariable("ERROR", strerror(errno));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -1859,7 +1840,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
if ((temp = cupsFileOpenFd(tempfd, "w")) == NULL)
{
cgiStartHTML(cgiText(_("Edit Configuration File")));
cgiSetVariable("MESSAGE", cgiText(_("Unable to create temporary file")));
cgiSetVariable("MESSAGE", cgiText(_("Unable to create temporary file:")));
cgiSetVariable("ERROR", strerror(errno));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -1909,7 +1890,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
else if (status != HTTP_CREATED)
{
cgiSetVariable("MESSAGE",
cgiText(_("Unable to upload cupsd.conf file")));
cgiText(_("Unable to upload cupsd.conf file:")));
cgiSetVariable("ERROR", httpStatus(status));
cgiStartHTML(cgiText(_("Edit Configuration File")));
@@ -1956,7 +1937,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
{
cgiStartHTML(cgiText(_("Edit Configuration File")));
cgiSetVariable("MESSAGE",
cgiText(_("Unable to access cupsd.conf file")));
cgiText(_("Unable to access cupsd.conf file:")));
cgiSetVariable("ERROR", strerror(errno));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -1969,7 +1950,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
{
cgiStartHTML(cgiText(_("Edit Configuration File")));
cgiSetVariable("MESSAGE",
cgiText(_("Unable to access cupsd.conf file")));
cgiText(_("Unable to access cupsd.conf file:")));
cgiSetVariable("ERROR",
cgiText(_("Unable to edit cupsd.conf files larger than "
"1MB")));
@@ -1993,7 +1974,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
cgiStartHTML(cgiText(_("Edit Configuration File")));
cgiSetVariable("MESSAGE",
cgiText(_("Unable to access cupsd.conf file")));
cgiText(_("Unable to access cupsd.conf file:")));
cgiSetVariable("ERROR", strerror(errno));
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -2150,7 +2131,7 @@ do_delete_class(http_t *http) /* I - HTTP connection */
cgiStartHTML(cgiText(_("Delete Class")));
if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Unable to delete class"));
cgiShowIPPError(_("Unable to delete class:"));
else
cgiCopyTemplateLang("class-deleted.tmpl");
@@ -2235,7 +2216,7 @@ do_delete_printer(http_t *http) /* I - HTTP connection */
cgiStartHTML(cgiText(_("Delete Printer")));
if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Unable to delete printer"));
cgiShowIPPError(_("Unable to delete printer:"));
else
cgiCopyTemplateLang("printer-deleted.tmpl");
@@ -2639,6 +2620,10 @@ do_menu(http_t *http) /* I - HTTP connection */
#endif /* HAVE_GSSAPI */
cgiSetVariable("KERBEROS", "");
#ifdef HAVE_DNSSD
cgiSetVariable("HAVE_DNSSD", "1");
#endif /* HAVE_DNSSD */
if ((val = cupsGetOption("BrowseWebIF", num_settings,
settings)) == NULL)
val = "No";
@@ -2651,25 +2636,18 @@ do_menu(http_t *http) /* I - HTTP connection */
settings)) == NULL)
val = "Yes";
if (val &&
(!_cups_strcasecmp(val, "0") || !_cups_strcasecmp(val, "no") ||
!_cups_strcasecmp(val, "off") || !_cups_strcasecmp(val, "false") ||
!_cups_strcasecmp(val, "disabled")))
if (!_cups_strcasecmp(val, "yes") || !_cups_strcasecmp(val, "on") ||
!_cups_strcasecmp(val, "true"))
{
cgiSetVariable("PRESERVE_JOB_HISTORY", "0");
cgiSetVariable("PRESERVE_JOB_FILES", "0");
}
else
{
cgiSetVariable("PRESERVE_JOBS", "CHECKED");
cgiSetVariable("PRESERVE_JOB_HISTORY", val);
cgiSetVariable("PRESERVE_JOB_HISTORY", "CHECKED");
if ((val = cupsGetOption("PreserveJobFiles", num_settings,
settings)) == NULL)
val = "1d";
cgiSetVariable("PRESERVE_JOB_FILES", val);
val = "No";
if (!_cups_strcasecmp(val, "yes") || !_cups_strcasecmp(val, "on") ||
!_cups_strcasecmp(val, "true"))
cgiSetVariable("PRESERVE_JOB_FILES", "CHECKED");
}
if ((val = cupsGetOption("MaxClients", num_settings, settings)) == NULL)
@@ -2837,7 +2815,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
exit(0);
}
else if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Unable to get printer attributes"));
cgiShowIPPError(_("Unable to get printer attributes:"));
else
cgiCopyTemplateLang("users.tmpl");
@@ -2987,7 +2965,7 @@ do_set_allowed_users(http_t *http) /* I - HTTP connection */
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(cgiText(_("Set Allowed Users")));
cgiShowIPPError(_("Unable to change printer"));
cgiShowIPPError(_("Unable to change printer:"));
}
else
{
@@ -3074,7 +3052,7 @@ do_set_default(http_t *http) /* I - HTTP connection */
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(_("Unable to set server default"));
cgiShowIPPError(_("Unable to set server default:"));
}
else
{
@@ -3183,7 +3161,7 @@ do_set_options(http_t *http, /* I - HTTP connection */
if ((ppd = ppdOpenFile(filename)) == NULL)
{
cgiSetVariable("ERROR", ppdErrorString(ppdLastError(&i)));
cgiSetVariable("MESSAGE", cgiText(_("Unable to open PPD file")));
cgiSetVariable("MESSAGE", cgiText(_("Unable to open PPD file:")));
cgiStartHTML(title);
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -3804,7 +3782,7 @@ do_set_options(http_t *http, /* I - HTTP connection */
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(_("Unable to set options"));
cgiShowIPPError(_("Unable to set options:"));
}
else
{
@@ -3903,7 +3881,7 @@ do_set_sharing(http_t *http) /* I - HTTP connection */
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(cgiText(_("Set Publishing")));
cgiShowIPPError(_("Unable to change printer-is-shared attribute"));
cgiShowIPPError(_("Unable to change printer-is-shared attribute:"));
}
else
{
+4 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Class status CGI for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -257,7 +257,7 @@ do_class_op(http_t *http, /* I - HTTP connection */
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(_("Unable to do maintenance command"));
cgiShowIPPError(_("Unable to do maintenance command:"));
}
else
{
@@ -447,7 +447,7 @@ show_all_classes(http_t *http, /* I - Connection to server */
* Show the error...
*/
cgiShowIPPError(_("Unable to get class list"));
cgiShowIPPError(_("Unable to get class list:"));
}
cgiEndHTML();
@@ -546,7 +546,7 @@ show_class(http_t *http, /* I - Connection to server */
*/
cgiStartHTML(pclass);
cgiShowIPPError(_("Unable to get class status"));
cgiShowIPPError(_("Unable to get class status:"));
}
cgiEndHTML();
+10 -15
Ver Arquivo
@@ -39,8 +39,7 @@ main(int argc, /* I - Number of command-line arguments */
const char *query; /* Search query */
const char *cache_dir; /* CUPS_CACHEDIR environment variable */
const char *docroot; /* CUPS_DOCROOT environment variable */
const char *helpfile, /* Current help file */
*helptitle = NULL; /* Current help title */
const char *helpfile; /* Current help file */
const char *topic; /* Current topic */
char topic_data[1024]; /* Topic form data */
const char *section; /* Current section */
@@ -89,7 +88,7 @@ main(int argc, /* I - Number of command-line arguments */
perror(filename);
cgiStartHTML(cgiText(_("Online Help")));
cgiSetVariable("ERROR", cgiText(_("Unable to load help index.")));
cgiSetVariable("ERROR", "Unable to load help index!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -130,7 +129,7 @@ main(int argc, /* I - Number of command-line arguments */
perror(filename);
cgiStartHTML(cgiText(_("Online Help")));
cgiSetVariable("ERROR", cgiText(_("Unable to access help file.")));
cgiSetVariable("ERROR", "Unable to access help file!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -140,7 +139,7 @@ main(int argc, /* I - Number of command-line arguments */
if ((n = helpFindNode(hi, helpfile, NULL)) == NULL)
{
cgiStartHTML(cgiText(_("Online Help")));
cgiSetVariable("ERROR", cgiText(_("Help file not in index.")));
cgiSetVariable("ERROR", "Help file not in index!");
cgiCopyTemplateLang("error.tmpl");
cgiEndHTML();
@@ -148,11 +147,12 @@ main(int argc, /* I - Number of command-line arguments */
}
/*
* Save the page title and help file...
* Set the page title and save the help file...
*/
helptitle = n->text;
topic = n->section;
cgiSetVariable("HELPFILE", helpfile);
cgiSetVariable("HELPTITLE", n->text);
cgiSetVariable("TOPIC", n->section);
/*
* Send a standard page header...
@@ -170,8 +170,6 @@ main(int argc, /* I - Number of command-line arguments */
*/
cgiStartHTML(cgiText(_("Online Help")));
topic = cgiGetVariable("TOPIC");
}
/*
@@ -182,6 +180,7 @@ main(int argc, /* I - Number of command-line arguments */
cgiSetVariable("QUERY", "");
query = cgiGetVariable("QUERY");
topic = cgiGetVariable("TOPIC");
si = helpSearchIndex(hi, query, topic, helpfile);
cgiClearVariables();
@@ -189,10 +188,6 @@ main(int argc, /* I - Number of command-line arguments */
cgiSetVariable("QUERY", query);
if (topic)
cgiSetVariable("TOPIC", topic);
if (helpfile)
cgiSetVariable("HELPFILE", helpfile);
if (helptitle)
cgiSetVariable("HELPTITLE", helptitle);
fprintf(stderr, "DEBUG: query=\"%s\", topic=\"%s\"\n",
query ? query : "(null)", topic ? topic : "(null)");
@@ -361,7 +356,7 @@ main(int argc, /* I - Number of command-line arguments */
else
{
perror(filename);
cgiSetVariable("ERROR", cgiText(_("Unable to open help file.")));
cgiSetVariable("ERROR", "Unable to open help file.");
cgiCopyTemplateLang("error.tmpl");
}
}
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* CGI <-> IPP variable routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -792,7 +792,7 @@ cgiPrintTestPage(http_t *http, /* I - Connection to server */
cgiStartHTML(cgiText(_("Print Test Page")));
if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Unable to print test page"));
cgiShowIPPError(_("Unable to print test page:"));
else
{
cgiSetVariable("PRINTER_NAME", dest);
@@ -1219,7 +1219,7 @@ cgiSetIPPObjectVars(
"%dx%d%s", attr->values[i].resolution.xres,
attr->values[i].resolution.yres,
attr->values[i].resolution.units == IPP_RES_PER_INCH ?
"dpi" : "dpcm");
"dpi" : "dpc");
break;
case IPP_TAG_URI :
+2 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Job status CGI for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -195,7 +195,7 @@ do_job_op(http_t *http, /* I - HTTP connection */
cgiStartHTML(cgiText(_("Jobs")));
if (cupsLastError() > IPP_OK_CONFLICT)
cgiShowIPPError(_("Job operation failed"));
cgiShowIPPError(_("Job operation failed:"));
else if (op == IPP_CANCEL_JOB)
cgiCopyTemplateLang("job-cancel.tmpl");
else if (op == IPP_HOLD_JOB)
+2 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Xcode documentation set generator.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -31,7 +31,7 @@
* Include necessary headers...
*/
#include "cgi-private.h"
#include "cgi.h"
#include <errno.h>
+4 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Printer status CGI for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -266,7 +266,7 @@ do_printer_op(http_t *http, /* I - HTTP connection */
else if (cupsLastError() > IPP_OK_CONFLICT)
{
cgiStartHTML(title);
cgiShowIPPError(_("Unable to do maintenance command"));
cgiShowIPPError(_("Unable to do maintenance command:"));
}
else
{
@@ -464,7 +464,7 @@ show_all_printers(http_t *http, /* I - Connection to server */
* Show the error...
*/
cgiShowIPPError(_("Unable to get printer list"));
cgiShowIPPError(_("Unable to get printer list:"));
}
cgiEndHTML();
@@ -566,7 +566,7 @@ show_printer(http_t *http, /* I - Connection to server */
*/
cgiStartHTML(printer);
cgiShowIPPError(_("Unable to get printer status"));
cgiShowIPPError(_("Unable to get printer status:"));
}
cgiEndHTML();
-6
Ver Arquivo
@@ -167,8 +167,6 @@ cgiClearVariables(void)
_cgi_var_t *v; /* Current variable */
fputs("DEBUG: cgiClearVariables called.\n", stderr);
for (v = form_vars, i = form_count; i > 0; v ++, i --)
{
_cupsStrFree(v->name);
@@ -403,8 +401,6 @@ cgiSetArray(const char *name, /* I - Name of variable */
if (name == NULL || value == NULL || element < 0 || element > 100000)
return;
fprintf(stderr, "DEBUG: cgiSetArray: %s[%d]=\"%s\"\n", name, element, value);
if ((var = cgi_find_variable(name)) == NULL)
{
cgi_add_variable(name, element, value);
@@ -536,8 +532,6 @@ cgiSetVariable(const char *name, /* I - Name of variable */
if (name == NULL || value == NULL)
return;
fprintf(stderr, "cgiSetVariable: %s=\"%s\"\n", name, value);
if ((var = cgi_find_variable(name)) == NULL)
{
cgi_add_variable(name, 0, value);
+26 -29
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-common.m4 10512 2012-05-25 02:19:37Z mike $"
dnl "$Id: cups-common.m4 10192 2012-01-20 21:49:02Z mike $"
dnl
dnl Common configuration stuff for CUPS.
dnl
dnl Copyright 2007-2012 by Apple Inc.
dnl Copyright 2007-2011 by Apple Inc.
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -20,7 +20,7 @@ dnl Set the name of the config header file...
AC_CONFIG_HEADER(config.h)
dnl Version number information...
CUPS_VERSION="1.6b1"
CUPS_VERSION="1.6svn"
CUPS_REVISION=""
if test -z "$CUPS_REVISION" -a -d .svn; then
CUPS_REVISION="-r`svnversion . | awk -F: '{print $NF}' | sed -e '1,$s/[[a-zA-Z]]*//g'`"
@@ -50,7 +50,7 @@ AC_PROG_CXX
AC_PROG_RANLIB
AC_PATH_PROG(AR,ar)
AC_PATH_PROG(CHMOD,chmod)
AC_PATH_PROG(GZIP,gzip)
AC_PATH_PROG(HTMLDOC,htmldoc)
AC_PATH_PROG(LD,ld)
AC_PATH_PROG(LN,ln)
AC_PATH_PROG(MV,mv)
@@ -92,9 +92,8 @@ dnl Check for pkg-config, which is used for some other tests later on...
AC_PATH_PROG(PKGCONFIG, pkg-config)
dnl Check for libraries...
AC_SEARCH_LIBS(abs, m, AC_DEFINE(HAVE_ABS))
AC_SEARCH_LIBS(crypt, crypt)
AC_SEARCH_LIBS(fmod, m)
AC_SEARCH_LIBS(crypt, crypt)
AC_SEARCH_LIBS(getspent, sec gen)
LIBMALLOC=""
@@ -226,20 +225,19 @@ AC_ARG_ENABLE(libusb, [ --enable-libusb use libusb for USB printing])
LIBUSB=""
AC_SUBST(LIBUSB)
if test "x$PKGCONFIG" != x; then
if test x$enable_libusb = xyes -o $uname != Darwin; then
AC_MSG_CHECKING(for libusb-1.0)
if $PKGCONFIG --exists libusb-1.0; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LIBUSB)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags libusb-1.0`"
LIBUSB="`$PKGCONFIG --libs libusb-1.0`"
else
AC_MSG_RESULT(no)
fi
fi
elif test x$enable_libusb = xyes; then
AC_MSG_ERROR(Need pkg-config to enable libusb support.)
if test x$enable_libusb = xyes; then
check_libusb=yes
elif test x$enable_libusb != xno -a $uname != Darwin; then
check_libusb=yes
else
check_libusb=no
fi
if test $check_libusb = yes; then
AC_CHECK_LIB(usb, usb_get_string_simple,[
AC_CHECK_HEADER(usb.h,
AC_DEFINE(HAVE_USB_H)
LIBUSB="-lusb")])
fi
dnl See if we have libwrap for TCP wrappers support...
@@ -256,17 +254,12 @@ if test x$enable_tcp_wrappers = xyes; then
fi
dnl ZLIB
INSTALL_GZIP=""
LIBZ=""
AC_CHECK_HEADER(zlib.h,
AC_CHECK_LIB(z, gzgets,
AC_DEFINE(HAVE_LIBZ)
LIBZ="-lz"
LIBS="$LIBS -lz"
if test "x$GZIP" != z; then
INSTALL_GZIP="-z"
fi))
AC_SUBST(INSTALL_GZIP)
LIBS="$LIBS -lz"))
AC_SUBST(LIBZ)
dnl Flags for "ar" command...
@@ -355,6 +348,12 @@ case $uname in
dnl Check for dynamic store function...
AC_CHECK_FUNCS(SCDynamicStoreCopyComputerName)
dnl Check for new ColorSync APIs...
SAVELIBS="$LIBS"
LIBS="$LIBS -framework ApplicationServices"
AC_CHECK_FUNCS(ColorSyncRegisterDevice)
LIBS="$SAVELIBS"
dnl Check for the new membership functions in MacOSX 10.4...
AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H))
AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H))
@@ -417,8 +416,6 @@ case $uname in
AC_CHECK_HEADER(xpc/xpc.h,
AC_DEFINE(HAVE_XPC)
INSTALLXPC="install-xpc")
AC_CHECK_HEADER(xpc/private.h,
AC_DEFINE(HAVE_XPC_PRIVATE_H))
;;
esac
@@ -452,5 +449,5 @@ esac
AC_SUBST(BUILDDIRS)
dnl
dnl End of "$Id: cups-common.m4 10512 2012-05-25 02:19:37Z mike $".
dnl End of "$Id: cups-common.m4 10192 2012-01-20 21:49:02Z mike $".
dnl
+8 -14
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-defaults.m4 10424 2012-04-23 17:26:57Z mike $"
dnl "$Id: cups-defaults.m4 10104 2011-11-04 06:37:03Z mike $"
dnl
dnl Default cupsd configuration settings for CUPS.
dnl
dnl Copyright 2007-2012 by Apple Inc.
dnl Copyright 2007-2011 by Apple Inc.
dnl Copyright 2006-2007 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -14,7 +14,7 @@ dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
dnl Default languages...
LANGUAGES="`ls -1 locale/cups_*.po 2>/dev/null | sed -e '1,$s/locale\/cups_//' -e '1,$s/\.po//' | tr '\n' ' '`"
LANGUAGES="`ls -1 locale/cups_*.po | sed -e '1,$s/locale\/cups_//' -e '1,$s/\.po//' | tr '\n' ' '`"
AC_ARG_WITH(languages, [ --with-languages set installed languages, default=all ],[
case "$withval" in
@@ -24,8 +24,8 @@ AC_ARG_WITH(languages, [ --with-languages set installed languages, defau
esac])
AC_SUBST(LANGUAGES)
dnl OS X bundle-based localization support
AC_ARG_WITH(bundledir, [ --with-bundledir set OS X localization bundle directory ],
dnl Mac OS X bundle-based localization support
AC_ARG_WITH(bundledir, [ --with-bundledir set Mac OS X localization bundle directory ],
CUPS_BUNDLEDIR="$withval",
if test "x$uname" = xDarwin -a $uversion -ge 100; then
CUPS_BUNDLEDIR="/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/PrintCore.framework/Versions/A"
@@ -50,12 +50,6 @@ AC_ARG_WITH(config_file_perm, [ --with-config-file-perm set default ConfigFileP
AC_SUBST(CUPS_CONFIG_FILE_PERM)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_CONFIG_FILE_PERM, 0$CUPS_CONFIG_FILE_PERM)
dnl Default permissions for cupsd
AC_ARG_WITH(cupsd_file_perm, [ --with-cupsd-file-perm set default cupsd permissions, default=0500],
CUPS_CUPSD_FILE_PERM="$withval",
CUPS_CUPSD_FILE_PERM="500")
AC_SUBST(CUPS_CUPSD_FILE_PERM)
dnl Default LogFilePerm
AC_ARG_WITH(log_file_perm, [ --with-log-file-perm set default LogFilePerm value, default=0644],
CUPS_LOG_FILE_PERM="$withval",
@@ -102,7 +96,7 @@ AC_ARG_WITH(local_protocols, [ --with-local-protocols set default BrowseLocalP
if test x$with_local_protocols != xno; then
if test "x$default_local_protocols" = "xdefault"; then
if test "x$DNSSD_BACKEND" != "x"; then
if test "x$DNSSDLIBS" != "x"; then
CUPS_BROWSE_LOCAL_PROTOCOLS="dnssd"
else
CUPS_BROWSE_LOCAL_PROTOCOLS=""
@@ -373,7 +367,7 @@ AC_SUBST(DEFAULT_IPP_PORT)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT)
dnl Web interface...
AC_ARG_ENABLE(webif, [ --enable-webif enable the web interface by default, default=no for OS X])
AC_ARG_ENABLE(webif, [ --enable-webif enable the web interface by default, default=no for Mac OS X])
case "x$enable_webif" in
xno)
CUPS_WEBIF=No
@@ -398,5 +392,5 @@ AC_SUBST(CUPS_WEBIF)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_WEBIF, $CUPS_DEFAULT_WEBIF)
dnl
dnl End of "$Id: cups-defaults.m4 10424 2012-04-23 17:26:57Z mike $".
dnl End of "$Id: cups-defaults.m4 10104 2011-11-04 06:37:03Z mike $".
dnl
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-directories.m4 10424 2012-04-23 17:26:57Z mike $"
dnl "$Id: cups-directories.m4 9771 2011-05-12 05:21:56Z mike $"
dnl
dnl Directory stuff for CUPS.
dnl
dnl Copyright 2007-2012 by Apple Inc.
dnl Copyright 2007-2011 by Apple Inc.
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -424,7 +424,7 @@ AC_SUBST(CUPS_SERVERROOT)
# Transient run-time state
case "$uname" in
Darwin*)
# Darwin (OS X)
# Darwin (Mac OS X)
CUPS_STATEDIR="$CUPS_SERVERROOT"
;;
*)
@@ -436,5 +436,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$CUPS_STATEDIR")
AC_SUBST(CUPS_STATEDIR)
dnl
dnl End of "$Id: cups-directories.m4 10424 2012-04-23 17:26:57Z mike $".
dnl End of "$Id: cups-directories.m4 9771 2011-05-12 05:21:56Z mike $".
dnl
+7 -19
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-dnssd.m4 10471 2012-05-16 22:57:03Z mike $"
dnl "$Id: cups-dnssd.m4 9771 2011-05-12 05:21:56Z mike $"
dnl
dnl DNS Service Discovery (aka Bonjour) stuff for CUPS.
dnl
dnl Copyright 2007-2012 by Apple Inc.
dnl Copyright 2007-2011 by Apple Inc.
dnl
dnl These coded instructions, statements, and computer programs are the
dnl property of Apple Inc. and are protected by Federal copyright
@@ -12,8 +12,7 @@ dnl which should have been included with this file. If this file is
dnl file is missing or damaged, see the license at "http://www.cups.org/".
dnl
AC_ARG_ENABLE(avahi, [ --disable-avahi disable DNS Service Discovery support using Avahi])
AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support using mDNSResponder])
AC_ARG_ENABLE(dnssd, [ --disable-dnssd disable DNS Service Discovery support])
AC_ARG_WITH(dnssd-libs, [ --with-dnssd-libs set directory for DNS Service Discovery library],
LDFLAGS="-L$withval $LDFLAGS"
DSOFLAGS="-L$withval $DSOFLAGS",)
@@ -24,25 +23,14 @@ AC_ARG_WITH(dnssd-includes, [ --with-dnssd-includes set directory for DNS Ser
DNSSDLIBS=""
DNSSD_BACKEND=""
if test "x$PKGCONFIG" != x -a x$enable_avahi != xno; then
AC_MSG_CHECKING(for Avahi)
if $PKGCONFIG --exists avahi-client; then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags avahi-client`"
DNSSDLIBS="`$PKGCONFIG --libs avahi-client`"
DNSSD_BACKEND="dnssd"
AC_DEFINE(HAVE_AVAHI)
else
AC_MSG_RESULT(no)
fi
fi
if test "x$DNSSD_BACKEND" = x -a x$enable_dnssd != xno; then
if test x$enable_dnssd != xno; then
AC_CHECK_HEADER(dns_sd.h, [
case "$uname" in
Darwin*)
# Darwin and MacOS X...
AC_DEFINE(HAVE_DNSSD)
AC_DEFINE(HAVE_COREFOUNDATION)
AC_DEFINE(HAVE_SYSTEMCONFIGURATION)
DNSSDLIBS="-framework CoreFoundation -framework SystemConfiguration"
DNSSD_BACKEND="dnssd"
;;
@@ -72,5 +60,5 @@ AC_SUBST(DNSSDLIBS)
AC_SUBST(DNSSD_BACKEND)
dnl
dnl End of "$Id: cups-dnssd.m4 10471 2012-05-16 22:57:03Z mike $".
dnl End of "$Id: cups-dnssd.m4 9771 2011-05-12 05:21:56Z mike $".
dnl
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-gssapi.m4 10424 2012-04-23 17:26:57Z mike $"
dnl "$Id: cups-gssapi.m4 10137 2011-12-02 04:04:49Z mike $"
dnl
dnl GSSAPI/Kerberos library detection for CUPS.
dnl
dnl Copyright 2007-2012 by Apple Inc.
dnl Copyright 2007-2011 by Apple Inc.
dnl Copyright 2006-2007 by Easy Software Products.
dnl
dnl This file contains Kerberos support code, copyright 2006 by
@@ -26,7 +26,7 @@ if test x$enable_gssapi != xno; then
if test "x$KRB5CONFIG" != x; then
case "$uname" in
Darwin)
# OS X weak-links to the Kerberos framework...
# Mac OS X weak-links to the Kerberos framework...
LIBGSSAPI="-weak_framework Kerberos"
AC_MSG_CHECKING(for GSS framework)
if test -d /System/Library/Frameworks/GSS.framework; then
@@ -167,5 +167,5 @@ AC_SUBST(CUPS_DEFAULT_GSSSERVICENAME)
AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GSSSERVICENAME, "$CUPS_DEFAULT_GSSSERVICENAME")
dnl
dnl End of "$Id: cups-gssapi.m4 10424 2012-04-23 17:26:57Z mike $".
dnl End of "$Id: cups-gssapi.m4 10137 2011-12-02 04:04:49Z mike $".
dnl
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-manpages.m4 10424 2012-04-23 17:26:57Z mike $"
dnl "$Id: cups-manpages.m4 9771 2011-05-12 05:21:56Z mike $"
dnl
dnl Manpage stuff for CUPS.
dnl
dnl Copyright 2007-2012 by Apple Inc.
dnl Copyright 2007-2011 by Apple Inc.
dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -68,7 +68,7 @@ case "$uname" in
MAN8DIR=1m
;;
Linux* | GNU* | Darwin*)
# Linux, GNU Hurd, and OS X
# Linux, GNU Hurd, and Mac OS X
MAN1EXT=1.gz
MAN5EXT=5.gz
MAN7EXT=7.gz
@@ -92,5 +92,5 @@ AC_SUBST(MAN8EXT)
AC_SUBST(MAN8DIR)
dnl
dnl End of "$Id: cups-manpages.m4 10424 2012-04-23 17:26:57Z mike $".
dnl End of "$Id: cups-manpages.m4 9771 2011-05-12 05:21:56Z mike $".
dnl
+4 -4
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-pam.m4 10424 2012-04-23 17:26:57Z mike $"
dnl "$Id: cups-pam.m4 9771 2011-05-12 05:21:56Z mike $"
dnl
dnl PAM stuff for CUPS.
dnl
dnl Copyright 2007-2012 by Apple Inc.
dnl Copyright 2007-2011 by Apple Inc.
dnl Copyright 1997-2005 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -61,7 +61,7 @@ if test x$enable_pam != xno; then
case "$uname" in
Darwin*)
# Darwin/OS X
# Darwin/Mac OS X
if test "x$with_pam_module" != x; then
PAMFILE="pam.$with_pam_module"
elif test -f /usr/lib/pam/pam_opendirectory.so.2; then
@@ -98,5 +98,5 @@ AC_SUBST(PAMMOD)
AC_SUBST(PAMMODAUTH)
dnl
dnl End of "$Id: cups-pam.m4 10424 2012-04-23 17:26:57Z mike $".
dnl End of "$Id: cups-pam.m4 9771 2011-05-12 05:21:56Z mike $".
dnl
+15 -13
Ver Arquivo
@@ -1,9 +1,9 @@
dnl
dnl "$Id: cups-ssl.m4 10521 2012-06-15 22:23:24Z mike $"
dnl "$Id: cups-ssl.m4 9837 2011-06-16 20:12:16Z mike $"
dnl
dnl OpenSSL/GNUTLS stuff for CUPS.
dnl
dnl Copyright 2007-2012 by Apple Inc.
dnl Copyright 2007-2011 by Apple Inc.
dnl Copyright 1997-2007 by Easy Software Products, all rights reserved.
dnl
dnl These coded instructions, statements, and computer programs are the
@@ -56,6 +56,12 @@ if test x$enable_ssl != xno; then
AC_CHECK_HEADER(Security/SecIdentitySearchPriv.h,
AC_DEFINE(HAVE_SECIDENTITYSEARCHPRIV_H))
dnl Check for SSLSetProtocolVersionMax...
SAVELIBS="$LIBS"
LIBS="$LIBS -framework Security"
AC_CHECK_FUNC(SSLSetProtocolVersionMax)
LIBS="$SAVELIBS"
dnl Check for SecCertificateCopyData..
AC_MSG_CHECKING(for SecCertificateCopyData)
if test $uversion -ge 100; then
@@ -118,7 +124,7 @@ if test x$enable_ssl != xno; then
dnl Check for the OpenSSL library last...
if test $have_ssl = 0 -a "x$enable_openssl" != "xno"; then
AC_CHECK_HEADER(openssl/ssl.h,[
AC_CHECK_HEADER(openssl/ssl.h,
dnl Save the current libraries so the crypto stuff isn't always
dnl included...
SAVELIBS="$LIBS"
@@ -130,9 +136,9 @@ if test x$enable_ssl != xno; then
dnl case the RSAREF libraries are needed.
for libcrypto in \
"-lcrypto" \
"-lcrypto -lrsaref" \
"-lcrypto -lRSAglue -lrsaref"
"-lcrypto" \
"-lcrypto -lrsaref" \
"-lcrypto -lRSAglue -lrsaref"
do
AC_CHECK_LIB(ssl,SSL_new,
[have_ssl=1
@@ -147,12 +153,7 @@ if test x$enable_ssl != xno; then
fi
done
if test "x${SSLLIBS}" != "x"; then
LIBS="$SAVELIBS $SSLLIBS"
AC_CHECK_FUNCS(SSL_set_tlsext_host_name)
fi
LIBS="$SAVELIBS"])
LIBS="$SAVELIBS")
fi
fi
@@ -172,6 +173,7 @@ AC_SUBST(SSLLIBS)
EXPORT_SSLLIBS="$SSLLIBS"
AC_SUBST(EXPORT_SSLLIBS)
dnl
dnl End of "$Id: cups-ssl.m4 10521 2012-06-15 22:23:24Z mike $".
dnl End of "$Id: cups-ssl.m4 9837 2011-06-16 20:12:16Z mike $".
dnl
+26 -36
Ver Arquivo
@@ -295,13 +295,6 @@
#undef HAVE_SSL
/*
* Do we have the SSL_set_tlsext_host_name function?
*/
#undef HAVE_SSL_SET_TLSEXT_HOST_NAME
/*
* What Security framework headers do we have?
*/
@@ -345,6 +338,13 @@
#undef HAVE_SECPOLICYCREATESSL
/*
* Do we have the SSLSetProtocolVersionMax function?
*/
#undef HAVE_SSLSETPROTOCOLVERSIONMAX
/*
* Do we have the cssmErrorString function?
*/
@@ -379,19 +379,12 @@
/*
* Do we have mDNSResponder for DNS Service Discovery (aka Bonjour)?
* Do we have DNS Service Discovery (aka Bonjour)?
*/
#undef HAVE_DNSSD
/*
* Do we have Avahi for DNS Service Discovery (aka Bonjour)?
*/
#undef HAVE_AVAHI
/*
* Do we have <sys/ioctl.h>?
*/
@@ -530,6 +523,14 @@
#define CUPS_GHOSTSCRIPT "/usr/bin/gs"
/*
* Do we have Darwin's CoreFoundation and SystemConfiguration frameworks?
*/
#undef HAVE_COREFOUNDATION
#undef HAVE_SYSTEMCONFIGURATION
/*
* Do we have CoreFoundation public and private headers?
*/
@@ -554,7 +555,7 @@
/*
* Do we have OS X 10.4's mbr_XXX functions?
* Do we have Mac OS X 10.4's mbr_XXX functions?
*/
#undef HAVE_MEMBERSHIP_H
@@ -686,7 +687,7 @@
* Do we have libusb?
*/
#undef HAVE_LIBUSB
#undef HAVE_USB_H
/*
@@ -716,18 +717,24 @@
/*
* Location of OS X localization bundle, if any.
* Location of Mac OS X localization bundle, if any.
*/
#undef CUPS_BUNDLEDIR
/*
* Do we have the ColorSyncRegisterDevice function?
*/
#undef HAVE_COLORSYNCREGISTERDEVICE
/*
* Do we have XPC?
*/
#undef HAVE_XPC
#undef HAVE_XPC_PRIVATE_H
/*
@@ -737,23 +744,6 @@
#undef HAVE_MXML_H
/*
* Do we have the C99 abs() function?
*/
#undef HAVE_ABS
#if !defined(HAVE_ABS) && !defined(abs)
# if defined(__GNUC__) || __STDC_VERSION__ >= 199901L
# define abs(x) _cups_abs(x)
static inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
# elif defined(_MSC_VER)
# define abs(x) _cups_abs(x)
static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
# else
# define abs(x) ((x) < 0 ? -(x) : (x))
# endif /* __GNUC__ || __STDC_VERSION__ */
#endif /* !HAVE_ABS && !abs */
#endif /* !_CUPS_CONFIG_H_ */
/*
-1
Ver Arquivo
@@ -74,7 +74,6 @@ AC_OUTPUT(Makedefs
man/cups-deviced.man
man/cups-driverd.man
man/cups-lpd.man
man/cups-snmp.man
man/cupsaddsmb.man
man/cupsd.conf.man
man/cupsd.man
+210 -220
Ver Arquivo
@@ -1,221 +1,211 @@
adminutil.o: adminutil.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h adminutil.h
adminutil.o: adminutil.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h adminutil.h
array.o: array.c string-private.h ../config.h debug-private.h \
../cups/versioning.h array-private.h ../cups/array.h
attr.o: attr.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
auth.o: auth.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
attr.o: attr.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
auth.o: auth.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
backchannel.o: backchannel.c cups.h file.h versioning.h ipp.h http.h \
array.h language.h
backend.o: backend.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h backend.h
conflicts.o: conflicts.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
custom.o: custom.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
debug.o: debug.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
dest.o: dest.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
dest-job.o: dest-job.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
dest-localization.o: dest-localization.c cups-private.h string-private.h \
../config.h debug-private.h ../cups/versioning.h ipp-private.h \
../cups/ipp.h http.h array.h http-private.h md5-private.h \
language-private.h ../cups/transcode.h language.h pwg-private.h \
../cups/cups.h file.h ppd-private.h ../cups/ppd.h thread-private.h
dest-options.o: dest-options.c cups-private.h string-private.h \
../config.h debug-private.h ../cups/versioning.h ipp-private.h \
../cups/ipp.h http.h array.h http-private.h md5-private.h \
language-private.h ../cups/transcode.h language.h pwg-private.h \
../cups/cups.h file.h ppd-private.h ../cups/ppd.h thread-private.h
backend.o: backend.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h backend.h
conflicts.o: conflicts.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
custom.o: custom.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
debug.o: debug.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
dest.o: dest.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
dest-job.o: dest-job.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
dest-localization.o: dest-localization.c cups-private.h ../cups/cups.h \
file.h versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
dest-options.o: dest-options.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
dir.o: dir.c string-private.h ../config.h debug-private.h \
../cups/versioning.h dir.h
emit.o: emit.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
encode.o: encode.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
file.o: file.c file-private.h cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
getdevices.o: getdevices.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
emit.o: emit.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
encode.o: encode.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
file.o: file.c file-private.h cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
getdevices.o: getdevices.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
getifaddrs.o: getifaddrs.c http-private.h ../config.h ../cups/http.h \
versioning.h array.h md5-private.h ipp-private.h ../cups/ipp.h
getputfile.o: getputfile.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
globals.o: globals.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
http.o: http.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
http-addr.o: http-addr.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
http-addrlist.o: http-addrlist.c cups-private.h string-private.h \
../config.h debug-private.h ../cups/versioning.h ipp-private.h \
../cups/ipp.h http.h array.h http-private.h md5-private.h \
language-private.h ../cups/transcode.h language.h pwg-private.h \
../cups/cups.h file.h ppd-private.h ../cups/ppd.h thread-private.h
http-support.o: http-support.c cups-private.h string-private.h \
../config.h debug-private.h ../cups/versioning.h ipp-private.h \
../cups/ipp.h http.h array.h http-private.h md5-private.h \
language-private.h ../cups/transcode.h language.h pwg-private.h \
../cups/cups.h file.h ppd-private.h ../cups/ppd.h thread-private.h
ipp.o: ipp.c cups-private.h string-private.h ../config.h debug-private.h \
../cups/versioning.h ipp-private.h ../cups/ipp.h http.h array.h \
http-private.h md5-private.h language-private.h ../cups/transcode.h \
language.h pwg-private.h ../cups/cups.h file.h ppd-private.h \
../cups/ppd.h thread-private.h
ipp-support.o: ipp-support.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
langprintf.o: langprintf.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
language.o: language.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
localize.o: localize.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
mark.o: mark.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
getputfile.o: getputfile.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
globals.o: globals.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
http.o: http.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
http-addr.o: http-addr.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
http-addrlist.o: http-addrlist.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
http-support.o: http-support.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
ipp.o: ipp.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
ipp-support.o: ipp-support.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
langprintf.o: langprintf.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
language.o: language.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
localize.o: localize.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
mark.o: mark.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
md5.o: md5.c md5-private.h string-private.h ../config.h
md5passwd.o: md5passwd.c http-private.h ../config.h ../cups/http.h \
versioning.h array.h md5-private.h ipp-private.h ../cups/ipp.h \
string-private.h
notify.o: notify.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
options.o: options.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
notify.o: notify.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
options.o: options.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
page.o: page.c string-private.h ../config.h debug-private.h \
../cups/versioning.h ppd.h cups.h file.h ipp.h http.h array.h \
language.h
ppd.o: ppd.c cups-private.h string-private.h ../config.h debug-private.h \
../cups/versioning.h ipp-private.h ../cups/ipp.h http.h array.h \
http-private.h md5-private.h language-private.h ../cups/transcode.h \
language.h pwg-private.h ../cups/cups.h file.h ppd-private.h \
../cups/ppd.h thread-private.h
ppd-cache.o: ppd-cache.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
pwg-media.o: pwg-media.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
request.o: request.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
ppd.o: ppd.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
ppd-cache.o: ppd-cache.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
pwg-media.o: pwg-media.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
request.o: request.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
sidechannel.o: sidechannel.c sidechannel.h versioning.h cups-private.h \
string-private.h ../config.h debug-private.h ipp-private.h \
../cups/ipp.h http.h array.h http-private.h md5-private.h \
language-private.h ../cups/transcode.h language.h pwg-private.h \
../cups/cups.h file.h ppd-private.h ../cups/ppd.h thread-private.h
snmp.o: snmp.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h snmp-private.h
../cups/cups.h file.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
snmp.o: snmp.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h \
snmp-private.h
snprintf.o: snprintf.c string-private.h ../config.h
string.o: string.c string-private.h ../config.h debug-private.h \
../cups/versioning.h thread-private.h array.h
tempfile.o: tempfile.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
thread.o: thread.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
transcode.o: transcode.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
usersys.o: usersys.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
util.o: util.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
tempfile.o: tempfile.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
thread.o: thread.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
transcode.o: transcode.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
usersys.o: usersys.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
util.o: util.c cups-private.h ../cups/cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h debug-private.h \
ppd-private.h ../cups/ppd.h pwg-private.h http-private.h md5-private.h \
ipp-private.h language-private.h ../cups/transcode.h thread-private.h
testadmin.o: testadmin.c adminutil.h cups.h file.h versioning.h ipp.h \
http.h array.h language.h string-private.h ../config.h
testarray.o: testarray.c string-private.h ../config.h debug-private.h \
@@ -233,28 +223,28 @@ testi18n.o: testi18n.c string-private.h ../config.h language-private.h \
../cups/transcode.h language.h array.h versioning.h
testipp.o: testipp.c file.h versioning.h string-private.h ../config.h \
ipp-private.h ../cups/ipp.h http.h array.h
testoptions.o: testoptions.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
testlang.o: testlang.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
testppd.o: testppd.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h
testoptions.o: testoptions.c cups-private.h ../cups/cups.h file.h \
versioning.h ipp.h http.h array.h language.h string-private.h \
../config.h debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
testlang.o: testlang.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
testppd.o: testppd.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h
testpwg.o: testpwg.c ppd-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h ../cups/ppd.h pwg-private.h \
file-private.h cups-private.h string-private.h ../config.h \
debug-private.h ipp-private.h http-private.h md5-private.h \
debug-private.h http-private.h md5-private.h ipp-private.h \
language-private.h ../cups/transcode.h thread-private.h
testsnmp.o: testsnmp.c cups-private.h string-private.h ../config.h \
debug-private.h ../cups/versioning.h ipp-private.h ../cups/ipp.h \
http.h array.h http-private.h md5-private.h language-private.h \
../cups/transcode.h language.h pwg-private.h ../cups/cups.h file.h \
ppd-private.h ../cups/ppd.h thread-private.h snmp-private.h
testsnmp.o: testsnmp.c cups-private.h ../cups/cups.h file.h versioning.h \
ipp.h http.h array.h language.h string-private.h ../config.h \
debug-private.h ppd-private.h ../cups/ppd.h pwg-private.h \
http-private.h md5-private.h ipp-private.h language-private.h \
../cups/transcode.h thread-private.h snmp-private.h
+5 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Administration utility API definitions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -65,7 +65,7 @@ static void write_option(cups_file_t *dstfp, int order,
/*
* 'cupsAdminCreateWindowsPPD()' - Create the Windows PPD file for a printer.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - PPD file or NULL */
@@ -393,7 +393,7 @@ cupsAdminCreateWindowsPPD(
/*
* 'cupsAdminExportSamba()' - Export a printer to Samba.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
@@ -843,7 +843,7 @@ cupsAdminExportSamba(
* The returned settings should be freed with cupsFreeOptions() when
* you are done with them.
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
@@ -1159,7 +1159,7 @@ cupsAdminGetServerSettings(
/*
* 'cupsAdminSetServerSettings()' - Set settings on the server.
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
+5 -5
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-filter.shtml 10424 2012-04-23 17:26:57Z mike $"
"$Id: api-filter.shtml 9799 2011-05-20 18:09:22Z mike $"
Filter and backend programming introduction for CUPS.
Copyright 2007-2012 by Apple Inc.
Copyright 2007-2011 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -81,7 +81,7 @@ directory to write to.</p>
<p>In addition, some operating systems provide additional security mechanisms
that further limit file system access, even for backends running as root. On
OS X, for example, no backend may write to a user's home directory.</p>
Mac OS X, for example, no backend may write to a user's home directory.</p>
</blockquote>
<h3><a name="SIGNALS">Canceled Jobs and Signal Handling</a></h3>
@@ -153,7 +153,7 @@ when running print filters and backends:</p>
<dt>APPLE_LANGUAGE</dt>
<dd>The Apple language identifier associated with the job
(OS X only).</dd>
(Mac OS X only).</dd>
<dt>CHARSET</dt>
<dd>The job character set, typically "utf-8".</dd>
@@ -474,7 +474,7 @@ sub-state and not an issue that applies when a job is not printing.</p>
<blockquote><b>Note:</b>
<p>"STATE:" messages often provide visible alerts to the user. For example,
on OS X setting a printer-state-reason value with an "-error" or
on Mac OS X setting a printer-state-reason value with an "-error" or
"-warning" suffix will cause the printer's dock item to bounce if the
corresponding reason is localized with a cupsIPPReason keyword in the
printer's PPD file.</p>
+52 -46
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-httpipp.shtml 10388 2012-03-26 21:15:41Z mike $"
"$Id: api-httpipp.shtml 9727 2011-04-28 21:20:12Z mike $"
HTTP and IPP API introduction for CUPS.
Copyright 2007-2012 by Apple Inc.
Copyright 2007-2011 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -29,20 +29,35 @@ The constant <code>CUPS_HTTP_DEFAULT</code> can be used with all of the
<code>cups</code> functions to refer to the default CUPS server - the functions
create a per-thread <a href='#http_t'><code>http_t</code></a> as needed.</p>
<p>The IPP APIs use two opaque structures for requests (messages sent to the CUPS scheduler) and responses (messages sent back to your application from the scheduler). The <a href='#ipp_t'><code>ipp_t</code></a> type holds a complete request or response and is allocated using the <a href='#ippNew'><code>ippNew</code></a> or <a href='#ippNewRequest'><code>ippNewRequest</code></a> functions and freed using the <a href='#ippDelete'><code>ippDelete</code></a> function.</p>
<p>The IPP APIs use two structures for requests (messages sent to the CUPS
scheduler) and responses (messages sent back to your application from the
scheduler). The <a href='#ipp_t'><code>ipp_t</code></a> structure holds a
complete request or response and is allocated using the
<a href='#ippNew'><code>ippNew</code></a> or
<a href='#ippNewRequest'><code>ippNewRequest</code></a> functions and
freed using the <a href='#ippDelete'><code>ippDelete</code></a> function.</p>
<p>The second opaque structure is called <a href='#ipp_attribute_t'><code>ipp_attribute_t</code></a> and holds a single IPP attribute which consists of a group tag (<a href='#ippGetGroupTag'><code>ippGetGroupTag</code></a>), a value type tag (<a href='#ippGetValueTag'><code>ippGetValueTag</code></a>), the attribute name (<a href='#ippGetName'><code>ippGetName</code></a>), and 1 or more values (<a href='#ippGetCount'><code>ippGetCount</code></a>, <a href='#ippGetBoolean'><code>ippGetBoolean</code></a>, <a href='#ippGetCollection'><code>ippGetCollection</code></a>, <a href='#ippGetDate'><code>ippGetDate</code></a>, <a href='#ippGetInteger'><code>ippGetInteger</code></a>, <a href='#ippGetRange'><code>ippGetRange</code></a>, <a href='#ippGetResolution'><code>ippGetResolution</code></a>, and <a href='#ippGetString'><code>ippGetString</code></a>). Attributes are added to an <a href='#ipp_t'><code>ipp_t</code></a> pointer using one of the <code>ippAdd</code> functions. For example, use <a href='#ippAddString'><code>ippAddString</code></a> to add the "printer-uri" and "requesting-user-name" string attributes to a request:</p>
<p>The second structure is called
<a href='#ipp_attribute_t'><code>ipp_attribute_t</code></a> and holds a
single IPP attribute which consists of a group tag (<code>group_tag</code>), a
value type tag (<code>value_tag</code>), the attribute name (<code>name</code>),
and 1 or more values (<code>values[]</code>). Attributes are added to an
<a href='#ipp_t'><code>ipp_t</code></a> structure using one of the
<code>ippAdd</code> functions. For example, use
<a href='#ippAddString'><code>ippAddString</code></a> to add a
"requesting-user-name" string attribute to a request:</p>
<pre class='example'>
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(IPP_GET_JOBS);
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, "ipp://localhost/printers/");
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
</pre>
<p>Once you have created an IPP request, use the <code>cups</code> functions to send the request to and read the response from the server. For example, the <a href='#cupsDoRequest'><code>cupsDoRequest</code></a> function can be used for simple query operations that do not involve files:</p>
<p>Once you have created an IPP request, use the <code>cups</code>
functions to send the request to and read the response from the server.
For example, the <a href='#cupsDoRequest'><code>cupsDoRequest</code></a>
function can be used for simple query operations that do not involve files:</p>
<pre class='example'>
#include &lt;cups/cups.h&gt;
@@ -52,8 +67,6 @@ create a per-thread <a href='#http_t'><code>http_t</code></a> as needed.</p>
{
<a href='#ipp_t'>ipp_t</a> *request = <a href='#ippNewRequest'>ippNewRequest</a>(IPP_GET_JOBS);
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, "ipp://localhost/printers/");
<a href='#ippAddString'>ippAddString</a>(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
@@ -61,7 +74,13 @@ create a per-thread <a href='#http_t'><code>http_t</code></a> as needed.</p>
}
</pre>
<p>The <a href='#cupsDoRequest'><code>cupsDoRequest</code></a> function frees the request and returns an IPP response or <code>NULL</code> pointer if the request could not be sent to the server. Once you have a response from the server, you can either use the <a href='#ippFindAttribute'><code>ippFindAttribute</code></a> and <a href='#ippFindNextAttribute'><code>ippFindNextAttribute</code></a> functions to find specific attributes, for example:</p>
<p>The <a href='#cupsDoRequest'><code>cupsDoRequest</code></a> function frees
the request structure and returns an IPP response structure or NULL pointer if
the request could not be sent to the server. Once you have a response from
the server, you can either use the
<a href='#ippFindAttribute'><code>ippFindAttribute</code></a> and
<a href='#ippFindNextAttribute'><code>ippFindNextAttribute</code></a> functions
to find specific attributes, for example:</p>
<pre class='example'>
<a href='#ipp_t'>ipp_t</a> *response;
@@ -70,20 +89,25 @@ create a per-thread <a href='#http_t'><code>http_t</code></a> as needed.</p>
attr = <a href='#ippFindAttribute'>ippFindAttribute</a>(response, "printer-state", IPP_TAG_ENUM);
</pre>
<p>You can also walk the list of attributes with a simple <code>for</code> loop like this:</p>
<p>You can also walk the list of attributes with a simple <code>for</code> loop
like this:</p>
<pre class='example'>
<a href='#ipp_t'>ipp_t</a> *response;
<a href='#ipp_attribute_t'>ipp_attribute_t</a> *attr;
for (attr = <a href='#ippFirstAttribute'>ippFirstAttribute</a>(response); attr != NULL; attr = <a href='#ippNextAttribute'>ippNextAttribute</a>(response))
if (ippGetName(attr) == NULL)
for (attr = response->attrs; attr != NULL; attr = attr->next)
if (attr->name == NULL)
puts("--SEPARATOR--");
else
puts(ippGetName(attr));
puts(attr->name);
</pre>
<p>The <code>for</code> loop approach is normally used when collecting attributes for multiple objects (jobs, printers, etc.) in a response. Attributes with <code>NULL</code> names indicate a separator between the attributes of each object. For example, the following code will list the jobs returned from our previous <a href='#get_jobs'><code>get_jobs</code></a> example code:</p>
<p>The <code>for</code> loop approach is normally used when collecting
attributes for multiple objects (jobs, printers, etc.) in a response. Attributes
with <code>NULL</code> names indicate a separator between the attributes of
each object. For example, the following code will list the jobs returned from
our previous <a href='#get_jobs'><code>get_jobs</code></a> example code:</p>
<pre class='example'>
<a href='#ipp_t'>ipp_t</a> *response = <a href='#get_jobs'>get_jobs</a>();
@@ -91,55 +115,37 @@ for (attr = <a href='#ippFirstAttribute'>ippFirstAttribute</a>(response); attr !
if (response != NULL)
{
<a href='#ipp_attribute_t'>ipp_attribute_t</a> *attr;
const char *attrname;
int job_id = 0;
const char *job_name = NULL;
const char *job_originating_user_name = NULL;
char *job_name = NULL;
char *job_originating_user_name = NULL;
puts("Job ID Owner Title");
puts("------ ---------------- ---------------------------------");
for (attr = <a href='#ippFirstAttribute'>ippFirstAttribute</a>(response); attr != NULL; attr = <a href='#ippNextAttribute'>ippNextAttribute</a>(response))
for (attr = response->attrs; attr != NULL; attr = attr->next)
{
/* Attributes without names are separators between jobs */
attrname = ippGetName(attr);
if (attrname == NULL)
if (attr->name == NULL)
{
if (job_id > 0)
{
if (job_name == NULL)
job_name = "(withheld)";
if (job_originating_user_name == NULL)
job_originating_user_name = "(withheld)";
if (job_id > 0 &amp;&amp; job_name != NULL &amp;&amp; job_originating_user_name != NULL)
printf("%5d %-16s %s\n", job_id, job_originating_user_name, job_name);
}
job_id = 0;
job_name = NULL;
job_originating_user_name = NULL;
continue;
}
else if (!strcmp(attrname, "job-id") &amp;&amp; ippGetValueTag(attr) == IPP_TAG_INTEGER)
job_id = ippGetInteger(attr, 0);
else if (!strcmp(attrname, "job-name") &amp;&amp; ippGetValueTag(attr) == IPP_TAG_NAME)
job_name = ippGetString(attr, 0, NULL);
else if (!strcmp(attrname, "job-originating-user-name") &amp;&amp;
ippGetValueTag(attr) == IPP_TAG_NAME)
job_originating_user_name = ippGetString(attr, 0, NULL);
else if (!strcmp(attr->name, "job-id") &amp;&amp; attr->value_tag == IPP_TAG_INTEGER)
job_id = attr->values[0].integer;
else if (!strcmp(attr->name, "job-name") &amp;&amp; attr->value_tag == IPP_TAG_NAME)
job_name = attr->values[0].string.text;
else if (!strcmp(attr->name, "job-originating-user-name") &amp;&amp;
attr->value_tag == IPP_TAG_NAME)
job_originating_user_name = attr->values[0].string.text;
}
if (job_id > 0)
{
if (job_name == NULL)
job_name = "(withheld)";
if (job_originating_user_name == NULL)
job_originating_user_name = "(withheld)";
if (job_id > 0 &amp;&amp; job_name != NULL &amp;&amp; job_originating_user_name != NULL)
printf("%5d %-16s %s\n", job_id, job_originating_user_name, job_name);
}
}
</pre>
+3 -3
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-ppd.header 10424 2012-04-23 17:26:57Z mike $"
"$Id: api-ppd.header 10103 2011-11-03 20:44:57Z mike $"
PPD API header for CUPS.
Copyright 2008-2012 by Apple Inc.
Copyright 2008-2011 by Apple Inc.
These coded instructions, statements, and computer programs are the
property of Apple Inc. and are protected by Federal copyright
@@ -14,7 +14,7 @@
<h1 class='title'>PPD API (DEPRECATED)</h1>
<blockquote>The PPD API is deprecated starting in CUPS 1.6/OS X 10.8. Please use the new Job Ticket APIs in the <a href="api-cups.html">CUPS API</a> documentation. These functions will be removed in a future release of CUPS.</blockquote>
<blockquote>The PPD API is deprecated starting in CUPS 1.6. Please use the new Job Ticket APIs in the <a href="api-cups.html">CUPS API</a> documentation. These functions will be removed in a future release of CUPS.</blockquote>
<div class='summary'><table summary='General Information'>
<thead>
+3 -3
Ver Arquivo
@@ -1,9 +1,9 @@
<!--
"$Id: api-ppd.shtml 10424 2012-04-23 17:26:57Z mike $"
"$Id: api-ppd.shtml 10103 2011-11-03 20:44:57Z mike $"
PPD API introduction for CUPS.
Copyright 2007-2012 by Apple Inc.
Copyright 2007-2011 by Apple Inc.
Copyright 1997-2006 by Easy Software Products, all rights reserved.
These coded instructions, statements, and computer programs are the
@@ -15,7 +15,7 @@
<h2 class='title'><a name='OVERVIEW'>Overview</a></h2>
<blockquote>The PPD API is deprecated starting in CUPS 1.6/OS X 10.8. Please use the new Job Ticket APIs in the <a href="api-cups.html">CUPS API</a> documentation. These functions will be removed in a future release of CUPS.</blockquote>
<blockquote>The PPD API is deprecated starting in CUPS 1.6. Please use the new Job Ticket APIs in the <a href="api-cups.html">CUPS API</a> documentation. These functions will be removed in a future release of CUPS.</blockquote>
<p>The CUPS PPD API provides read-only access the data in PostScript Printer
Description ("PPD") files which are used for all printers with a driver. With
+24 -24
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Sorted array routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -110,7 +110,7 @@ static int cups_array_find(cups_array_t *a, void *e, int prev, int *rdiff);
* appended at the end of the run of identical elements. For unsorted arrays,
* the element is appended to the end of the array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
@@ -202,7 +202,7 @@ _cupsArrayAddStrings(cups_array_t *a, /* I - Array */
* The caller is responsible for freeing the memory used by the
* elements themselves.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void
@@ -244,7 +244,7 @@ cupsArrayClear(cups_array_t *a) /* I - Array */
/*
* 'cupsArrayCount()' - Get the number of elements in the array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Number of elements */
@@ -271,7 +271,7 @@ cupsArrayCount(cups_array_t *a) /* I - Array */
* The current element is undefined until you call @link cupsArrayFind@,
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - Element */
@@ -301,7 +301,7 @@ cupsArrayCurrent(cups_array_t *a) /* I - Array */
* The caller is responsible for freeing the memory used by the
* elements themselves.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void
@@ -345,7 +345,7 @@ cupsArrayDelete(cups_array_t *a) /* I - Array */
/*
* 'cupsArrayDup()' - Duplicate the array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_array_t * /* O - Duplicate array */
@@ -430,7 +430,7 @@ cupsArrayDup(cups_array_t *a) /* I - Array */
/*
* 'cupsArrayFind()' - Find an element in the array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - Element found or @code NULL@ */
@@ -525,7 +525,7 @@ cupsArrayFind(cups_array_t *a, /* I - Array */
/*
* 'cupsArrayFirst()' - Get the first element in the array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - First element or @code NULL@ if the array is empty */
@@ -554,7 +554,7 @@ cupsArrayFirst(cups_array_t *a) /* I - Array */
* The current element is undefined until you call @link cupsArrayFind@,
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - Index of the current element, starting at 0 */
@@ -570,7 +570,7 @@ cupsArrayGetIndex(cups_array_t *a) /* I - Array */
/*
* 'cupsArrayGetInsert()' - Get the index of the last inserted element.
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - Index of the last inserted element, starting at 0 */
@@ -586,7 +586,7 @@ cupsArrayGetInsert(cups_array_t *a) /* I - Array */
/*
* 'cupsArrayIndex()' - Get the N-th element in the array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - N-th element or @code NULL@ */
@@ -609,7 +609,7 @@ cupsArrayIndex(cups_array_t *a, /* I - Array */
* inserted at the beginning of the run of identical elements. For unsorted
* arrays, the element is inserted at the beginning of the array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on failure, 1 on success */
@@ -639,7 +639,7 @@ cupsArrayInsert(cups_array_t *a, /* I - Array */
/*
* 'cupsArrayLast()' - Get the last element in the array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - Last element or @code NULL@ if the array is empty */
@@ -670,7 +670,7 @@ cupsArrayLast(cups_array_t *a) /* I - Array */
* data pointer argument can safely be omitted when not required so functions
* like @code strcmp@ can be used for sorted string arrays.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_array_t * /* O - Array */
@@ -692,7 +692,7 @@ cupsArrayNew(cups_array_func_t f, /* I - Comparison function or @code NULL@ for
* The hash function ("h") is used to implement cached lookups with the
* specified hash size ("hsize").
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
cups_array_t * /* O - Array */
@@ -722,7 +722,7 @@ cupsArrayNew2(cups_array_func_t f, /* I - Comparison function or @code NULL@ fo
* The free function ("cf") is used to automatically free/release elements when
* removed or the array is deleted.
*
* @since CUPS 1.5/OS X 10.7@
* @since CUPS 1.5/Mac OS X 10.7@
*/
cups_array_t * /* O - Array */
@@ -805,7 +805,7 @@ _cupsArrayNewStrings(const char *s) /* I - Comma-delimited strings or NULL */
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
* to set the current element.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - Next element or @code NULL@ */
@@ -838,7 +838,7 @@ cupsArrayNext(cups_array_t *a) /* I - Array */
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
* to set the current element.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - Previous element or @code NULL@ */
@@ -871,7 +871,7 @@ cupsArrayPrev(cups_array_t *a) /* I - Array */
* The caller is responsible for freeing the memory used by the
* removed element.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
@@ -936,7 +936,7 @@ cupsArrayRemove(cups_array_t *a, /* I - Array */
/*
* 'cupsArrayRestore()' - Reset the current element to the last @link cupsArraySave@.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - New current element */
@@ -967,7 +967,7 @@ cupsArrayRestore(cups_array_t *a) /* I - Array */
*
* The save/restore stack is guaranteed to be at least 32 elements deep.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
@@ -989,7 +989,7 @@ cupsArraySave(cups_array_t *a) /* I - Array */
/*
* 'cupsArrayUserData()' - Return the user data for an array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - User data */
@@ -1005,7 +1005,7 @@ cupsArrayUserData(cups_array_t *a) /* I - Array */
/*
* 'cups_array_add()' - Insert or append an element to the array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
static int /* O - 1 on success, 0 on failure */
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD model-specific attribute routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -30,7 +30,7 @@
/*
* 'ppdFindAttr()' - Find the first matching attribute.
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
ppd_attr_t * /* O - Attribute or @code NULL@ if not found */
@@ -87,7 +87,7 @@ ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
/*
* 'ppdFindNextAttr()' - Find the next matching attribute.
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
ppd_attr_t * /* O - Attribute or @code NULL@ if not found */
+11 -13
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Authentication functions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* This file contains Kerberos support code, copyright 2006 by
@@ -115,7 +115,7 @@ static int cups_local_auth(http_t *http);
* This function should be called in response to a @code HTTP_UNAUTHORIZED@
* status, prior to resubmitting your request.
*
* @since CUPS 1.1.20/OS X 10.4@
* @since CUPS 1.1.20/Mac OS X 10.4@
*/
int /* O - 0 on success, -1 on error */
@@ -124,8 +124,7 @@ cupsDoAuthentication(
const char *method, /* I - Request method ("GET", "POST", "PUT") */
const char *resource) /* I - Resource path */
{
const char *password, /* Password string */
*www_auth; /* WWW-Authenticate header */
const char *password; /* Password string */
char prompt[1024], /* Prompt for user */
realm[HTTP_MAX_VALUE], /* realm="xyz" string */
nonce[HTTP_MAX_VALUE]; /* nonce="xyz" string */
@@ -180,11 +179,9 @@ cupsDoAuthentication(
* Nope, see if we should retry the current username:password...
*/
www_auth = http->fields[HTTP_FIELD_WWW_AUTHENTICATE];
if ((http->digest_tries > 1 || !http->userpass[0]) &&
(!_cups_strncasecmp(www_auth, "Basic", 5) ||
!_cups_strncasecmp(www_auth, "Digest", 6)))
(!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5) ||
!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Digest", 6)))
{
/*
* Nope - get a new password from the user...
@@ -200,7 +197,8 @@ cupsDoAuthentication(
cupsUser(),
http->hostname[0] == '/' ? "localhost" : http->hostname);
http->digest_tries = _cups_strncasecmp(www_auth, "Digest", 6) != 0;
http->digest_tries = _cups_strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE],
"Digest", 5) != 0;
http->userpass[0] = '\0';
if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
@@ -229,7 +227,7 @@ cupsDoAuthentication(
*/
#ifdef HAVE_GSSAPI
if (!_cups_strncasecmp(www_auth, "Negotiate", 9))
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
{
/*
* Kerberos authentication...
@@ -243,7 +241,7 @@ cupsDoAuthentication(
}
else
#endif /* HAVE_GSSAPI */
if (!_cups_strncasecmp(www_auth, "Basic", 5))
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Basic", 5))
{
/*
* Basic authentication...
@@ -256,7 +254,7 @@ cupsDoAuthentication(
(int)strlen(http->userpass));
httpSetAuthString(http, "Basic", encode);
}
else if (!_cups_strncasecmp(www_auth, "Digest", 6))
else if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Digest", 6))
{
/*
* Digest authentication...
@@ -279,7 +277,7 @@ cupsDoAuthentication(
else
{
DEBUG_printf(("1cupsDoAuthentication: Unknown auth type: \"%s\"",
www_auth));
http->fields[HTTP_FIELD_WWW_AUTHENTICATE]));
http->status = HTTP_AUTHORIZATION_CANCELED;
return (-1);
}
+5 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Backchannel functions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -18,7 +18,7 @@
*
* cupsBackChannelRead() - Read data from the backchannel.
* cupsBackChannelWrite() - Write data to the backchannel.
* cups_setup() - Setup select()
* cups_setup() - Setup select()
*/
/*
@@ -50,7 +50,7 @@ static void cups_setup(fd_set *set, struct timeval *tval,
* parameter controls how many seconds to wait for the data - use 0.0 to
* return immediately if there is no data, -1.0 to wait for data indefinitely.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Bytes read or -1 on error */
@@ -101,7 +101,7 @@ cupsBackChannelRead(char *buffer, /* I - Buffer to read into */
* 0.0 to return immediately if the data cannot be written, -1.0 to wait
* indefinitely.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Bytes written or -1 on error */
@@ -178,7 +178,7 @@ cupsBackChannelWrite(
/*
* 'cups_setup()' - Setup select()
* 'cups_setup()' - Setup select()
*/
static void
+2 -13
Ver Arquivo
@@ -44,7 +44,7 @@ static void quote_string(const char *s);
* variable or the device URI passed in argv[0], whichever is found
* first.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - Device URI or @code NULL@ */
@@ -54,8 +54,6 @@ cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */
*auth_info_required; /* AUTH_INFO_REQUIRED env var */
_cups_globals_t *cg = _cupsGlobals(); /* Global info */
int options; /* Resolve options */
ppd_file_t *ppd; /* PPD file */
ppd_attr_t *ppdattr; /* PPD attribute */
if ((device_uri = getenv("DEVICE_URI")) == NULL)
@@ -71,15 +69,6 @@ cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */
!strcmp(auth_info_required, "negotiate"))
options |= _HTTP_RESOLVE_FQDN;
if ((ppd = ppdOpenFile(getenv("PPD"))) != NULL)
{
if ((ppdattr = ppdFindAttr(ppd, "cupsIPPFaxOut", NULL)) != NULL &&
!_cups_strcasecmp(ppdattr->value, "true"))
options |= _HTTP_RESOLVE_FAXOUT;
ppdClose(ppd);
}
return (_httpResolveURI(device_uri, cg->resolved_uri,
sizeof(cg->resolved_uri), options, NULL, NULL));
}
@@ -92,7 +81,7 @@ cupsBackendDeviceURI(char **argv) /* I - Command-line arguments */
* It handles quoting of special characters in the device-make-and-model,
* device-info, device-id, and device-location strings.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
void
+4 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Option marking routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -79,7 +79,7 @@ static cups_array_t *ppd_test_constraints(ppd_file_t *ppd,
* the conflicting options. The returned option array must be freed using
* @link cupsFreeOptions@.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
int /* O - Number of conflicting options */
@@ -178,7 +178,7 @@ cupsGetConflicts(
* choice for the conflicting option, then iterating over all possible choices
* until a non-conflicting option choice is found.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -650,7 +650,7 @@ ppdConflicts(ppd_file_t *ppd) /* I - PPD to check */
* This function tests whether a particular option choice is available based
* on constraints against options in the "InstallableOptions" group.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
int /* O - 1 if conflicting, 0 if not conflicting */
+3 -12
Ver Arquivo
@@ -22,15 +22,15 @@
* Include necessary headers...
*/
# include <cups/cups.h>
# include "string-private.h"
# include "debug-private.h"
# include "ipp-private.h"
# include "ppd-private.h"
# include "http-private.h"
# include "ipp-private.h"
# include "language-private.h"
# include "pwg-private.h"
# include "ppd-private.h"
# include "thread-private.h"
# include <cups/cups.h>
# ifdef __APPLE__
# include <sys/cdefs.h>
# include <CoreFoundation/CoreFoundation.h>
@@ -190,22 +190,13 @@ typedef struct _cups_media_db_s /* Media database */
* millimeters */
} _cups_media_db_t;
typedef struct _cups_dconstres_s /* Constraint/resolver */
{
char *name; /* Name of resolver */
ipp_t *collection; /* Collection containing attrs */
} _cups_dconstres_t;
struct _cups_dinfo_s /* Destination capability and status
* information */
{
const char *uri; /* Printer URI */
char *resource; /* Resource path */
ipp_t *attrs; /* Printer attributes */
int num_defaults; /* Number of default options */
cups_option_t *defaults; /* Default options */
cups_array_t *constraints; /* Job constraints */
cups_array_t *resolvers; /* Job resolvers */
cups_array_t *localizations; /* Localization information */
cups_array_t *media_db; /* Media database */
_cups_media_db_t min_size, /* Minimum size */
+23 -26
Ver Arquivo
@@ -52,10 +52,10 @@ extern "C" {
* Constants...
*/
# define CUPS_VERSION 1.0600
# define CUPS_VERSION 1.0599
# define CUPS_VERSION_MAJOR 1
# define CUPS_VERSION_MINOR 6
# define CUPS_VERSION_PATCH 0
# define CUPS_VERSION_PATCH -1
# define CUPS_BC_FD 3
/* Back-channel file descriptor for
@@ -230,20 +230,20 @@ enum cups_ptype_e /* Printer type/capability bit
CUPS_PRINTER_FAX = 0x40000, /* Fax queue */
CUPS_PRINTER_REJECTING = 0x80000, /* Printer is rejecting jobs */
CUPS_PRINTER_DELETE = 0x100000, /* Delete printer
* @since CUPS 1.2/OS X 10.5@ */
* @since CUPS 1.2/Mac OS X 10.5@ */
CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared
* @since CUPS 1.2/OS X 10.5@ */
* @since CUPS 1.2/Mac OS X 10.5@ */
CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication
* @since CUPS 1.2/OS X 10.5@ */
* @since CUPS 1.2/Mac OS X 10.5@ */
CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands
* @since CUPS 1.2/OS X 10.5@ */
* @since CUPS 1.2/Mac OS X 10.5@ */
CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered
* and added @private@
* @since Deprecated@ */
CUPS_PRINTER_SCANNER = 0x2000000, /* Scanner-only device
* @since CUPS 1.4/OS X 10.6@ */
* @since CUPS 1.4/Mac OS X 10.6@ */
CUPS_PRINTER_MFP = 0x4000000, /* Printer with scanning capabilities
* @since CUPS 1.4/OS X 10.6@ */
* @since CUPS 1.4/Mac OS X 10.6@ */
CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT |
* DEFAULT | FAX | REJECTING | DELETE |
* NOT_SHARED | AUTHENTICATED |
@@ -267,7 +267,7 @@ typedef struct cups_dest_s /**** Destination ****/
typedef struct _cups_dinfo_s cups_dinfo_t;
/* Destination capability and status
* information @since CUPS 1.6/OS X 10.8@ */
* information @since CUPS 1.6@ */
typedef struct cups_job_s /**** Job ****/
{
@@ -284,7 +284,7 @@ typedef struct cups_job_s /**** Job ****/
time_t processing_time; /* Time the job was processed */
} cups_job_t;
typedef struct cups_size_s /**** Media Size @since CUPS 1.6/OS X 10.8@ ****/
typedef struct cups_size_s /**** Media Size @since CUPS 1.6@ ****/
{
char media[128]; /* Media name to use */
int width, /* Width in hundredths of millimeters */
@@ -304,17 +304,17 @@ typedef int (*cups_client_cert_cb_t)(http_t *http, void *tls,
cups_array_t *distinguished_names,
void *user_data);
/* Client credentials callback
* @since CUPS 1.5/OS X 10.7@ */
* @since CUPS 1.5/Mac OS X 10.7@ */
typedef int (*cups_dest_cb_t)(void *user_data, unsigned flags,
cups_dest_t *dest);
/* Destination enumeration callback
* @since CUPS 1.6/OS X 10.8@ */
* @since CUPS 1.6@ */
# ifdef __BLOCKS__
typedef int (^cups_dest_block_t)(unsigned flags, cups_dest_t *dest);
/* Destination enumeration block
* @since CUPS 1.6/OS X 10.8@ */
* @since CUPS 1.6@ */
# endif /* __BLOCKS__ */
typedef void (*cups_device_cb_t)(const char *device_class,
@@ -323,7 +323,7 @@ typedef void (*cups_device_cb_t)(const char *device_class,
const char *device_uri,
const char *device_location, void *user_data);
/* Device callback
* @since CUPS 1.4/OS X 10.6@ */
* @since CUPS 1.4/Mac OS X 10.6@ */
typedef const char *(*cups_password_cb_t)(const char *prompt);
/* Password callback */
@@ -333,12 +333,12 @@ typedef const char *(*cups_password_cb2_t)(const char *prompt, http_t *http,
const char *resource,
void *user_data);
/* New password callback
* @since CUPS 1.4/OS X 10.6@ */
* @since CUPS 1.4/Mac OS X 10.6@ */
typedef int (*cups_server_cert_cb_t)(http_t *http, void *tls,
cups_array_t *certs, void *user_data);
/* Server credentials callback
* @since CUPS 1.5/OS X 10.7@ */
* @since CUPS 1.5/Mac OS X 10.7@ */
/*
@@ -429,7 +429,7 @@ extern int cupsPrintFiles2(http_t *http, const char *name,
extern int cupsSetDests2(http_t *http, int num_dests,
cups_dest_t *dests) _CUPS_API_1_1_21;
/**** New in CUPS 1.2/OS X 10.5 ****/
/**** New in CUPS 1.2/Mac OS X 10.5 ****/
extern ssize_t cupsBackChannelRead(char *buffer, size_t bytes,
double timeout) _CUPS_API_1_2;
extern ssize_t cupsBackChannelWrite(const char *buffer, size_t bytes,
@@ -446,7 +446,7 @@ extern int cupsRemoveOption(const char *name, int num_options,
cups_option_t **options) _CUPS_API_1_2;
extern cups_file_t *cupsTempFile2(char *filename, int len) _CUPS_API_1_2;
/**** New in CUPS 1.3/OS X 10.5 ****/
/**** New in CUPS 1.3/Mac OS X 10.5 ****/
extern ipp_t *cupsDoIORequest(http_t *http, ipp_t *request,
const char *resource, int infile,
int outfile) _CUPS_API_1_3;
@@ -461,7 +461,7 @@ extern void cupsSetDefaultDest(const char *name,
int num_dests,
cups_dest_t *dests) _CUPS_API_1_3;
/**** New in CUPS 1.4/OS X 10.6 ****/
/**** New in CUPS 1.4/Mac OS X 10.6 ****/
extern ipp_status_t cupsCancelJob2(http_t *http, const char *name,
int job_id, int purge) _CUPS_API_1_4;
extern int cupsCreateJob(http_t *http, const char *name,
@@ -498,14 +498,14 @@ extern http_status_t cupsStartDocument(http_t *http, const char *name,
extern http_status_t cupsWriteRequestData(http_t *http, const char *buffer,
size_t length) _CUPS_API_1_4;
/**** New in CUPS 1.5/OS X 10.7 ****/
/**** New in CUPS 1.5 ****/
extern void cupsSetClientCertCB(cups_client_cert_cb_t cb,
void *user_data) _CUPS_API_1_5;
extern int cupsSetCredentials(cups_array_t *certs) _CUPS_API_1_5;
extern void cupsSetServerCertCB(cups_server_cert_cb_t cb,
void *user_data) _CUPS_API_1_5;
/**** New in CUPS 1.6/OS X 10.8 ****/
/**** New in CUPS 1.6 ****/
extern ipp_status_t cupsCancelDestJob(http_t *http, cups_dest_t *dest,
int job_id) _CUPS_API_1_6;
extern int cupsCheckDestSupported(http_t *http, cups_dest_t *dest,
@@ -513,8 +513,7 @@ extern int cupsCheckDestSupported(http_t *http, cups_dest_t *dest,
const char *option,
const char *value) _CUPS_API_1_6;
extern ipp_status_t cupsCloseDestJob(http_t *http, cups_dest_t *dest,
cups_dinfo_t *info, int job_id)
_CUPS_API_1_6;
int job_id) _CUPS_API_1_6;
extern http_t *cupsConnectDest(cups_dest_t *dest, unsigned flags,
int msec, int *cancel,
char *resource, size_t resourcesize,
@@ -559,9 +558,7 @@ extern int cupsEnumDestsBlock(unsigned flags, int msec,
_CUPS_API_1_6;
# endif /* __BLOCKS__ */
extern ipp_status_t cupsFinishDestDocument(http_t *http,
cups_dest_t *dest,
cups_dinfo_t *info)
_CUPS_API_1_6;
cups_dest_t *dest) _CUPS_API_1_6;
extern void cupsFreeDestInfo(cups_dinfo_t *dinfo) _CUPS_API_1_6;
extern int cupsGetDestMediaByName(http_t *http, cups_dest_t *dest,
cups_dinfo_t *dinfo,
+5 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD custom option routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -41,7 +41,7 @@
/*
* 'ppdFindCustomOption()' - Find a custom option.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_coption_t * /* O - Custom option or NULL */
@@ -62,7 +62,7 @@ ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */
/*
* 'ppdFindCustomParam()' - Find a parameter for a custom option.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_cparam_t * /* O - Custom parameter or NULL */
@@ -88,7 +88,7 @@ ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
/*
* 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_cparam_t * /* O - Custom parameter or NULL */
@@ -104,7 +104,7 @@ ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */
/*
* 'ppdNextCustomParam()' - Return the next parameter for a custom option.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_cparam_t * /* O - Custom parameter or NULL */
+11 -1
Ver Arquivo
@@ -45,8 +45,8 @@ _cups_gettimeofday(struct timeval *tv, /* I - Timeval struct */
#else
# include <sys/time.h>
# include <unistd.h>
# include <regex.h>
#endif /* WIN32 */
#include <regex.h>
#include <fcntl.h>
@@ -65,8 +65,10 @@ int _cups_debug_level = 1;
* Local globals...
*/
# ifndef WIN32
static regex_t *debug_filter = NULL;
/* Filter expression for messages */
# endif /* !WIN32 */
static int debug_init = 0; /* Did we initialize debugging? */
static _cups_mutex_t debug_mutex = _CUPS_MUTEX_INITIALIZER;
/* Mutex to control initialization */
@@ -453,6 +455,7 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
if (level > _cups_debug_level)
return;
# ifndef WIN32
if (debug_filter)
{
int result; /* Filter result */
@@ -464,6 +467,7 @@ _cups_debug_printf(const char *format, /* I - Printf-style format string */
if (result)
return;
}
# endif /* !WIN32 */
/*
* Format the message...
@@ -534,6 +538,7 @@ _cups_debug_puts(const char *s) /* I - String to output */
if (level > _cups_debug_level)
return;
# ifndef WIN32
if (debug_filter)
{
int result; /* Filter result */
@@ -545,6 +550,7 @@ _cups_debug_puts(const char *s) /* I - String to output */
if (result)
return;
}
# endif /* !WIN32 */
/*
* Format the message...
@@ -600,11 +606,13 @@ _cups_debug_set(const char *logfile, /* I - Log file or NULL */
_cups_debug_fd = -1;
}
# ifndef WIN32
if (debug_filter)
{
regfree((regex_t *)debug_filter);
debug_filter = NULL;
}
# endif /* !WIN32 */
_cups_debug_level = 1;
@@ -631,6 +639,7 @@ _cups_debug_set(const char *logfile, /* I - Log file or NULL */
if (level)
_cups_debug_level = atoi(level);
# ifndef WIN32
if (filter)
{
if ((debug_filter = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
@@ -644,6 +653,7 @@ _cups_debug_set(const char *logfile, /* I - Log file or NULL */
debug_filter = NULL;
}
}
# endif /* !WIN32 */
debug_init = 1;
}
+24 -237
Ver Arquivo
@@ -37,7 +37,7 @@
* Returns IPP_OK on success and IPP_NOT_AUTHORIZED or IPP_FORBIDDEN on
* failure.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_status_t
@@ -53,94 +53,29 @@ cupsCancelDestJob(http_t *http, /* I - Connection to destination */
* 'cupsCloseDestJob()' - Close a job and start printing.
*
* Use when the last call to cupsStartDocument passed 0 for "last_document".
* "job_id" is the job ID returned by cupsCreateDestJob. Returns @code IPP_OK@
* on success.
* "job_id" is the job ID returned by cupsCreateDestJob. Returns IPP_OK on
* success.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_status_t /* O - IPP status code */
ipp_status_t
cupsCloseDestJob(
http_t *http, /* I - Connection to destination */
cups_dest_t *dest, /* I - Destination */
cups_dinfo_t *info, /* I - Destination information */
int job_id) /* I - Job ID */
http_t *http, /* I - Connection to destination */
cups_dest_t *dest, /* I - Destination */
int job_id) /* I - Job ID */
{
int i; /* Looping var */
ipp_t *request = NULL;/* Close-Job/Send-Document request */
ipp_attribute_t *attr; /* operations-supported attribute */
DEBUG_printf(("cupsCloseDestJob(http=%p, dest=%p(%s/%s), info=%p, job_id=%d)",
http, dest, dest ? dest->name : NULL,
dest ? dest->instance : NULL, info, job_id));
/*
* Range check input...
*/
if (!http || !dest || !info || job_id <= 0)
{
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
DEBUG_puts("1cupsCloseDestJob: Bad arguments.");
return (IPP_INTERNAL_ERROR);
}
/*
* Build a Close-Job or empty Send-Document request...
*/
if ((attr = ippFindAttribute(info->attrs, "operations-supported",
IPP_TAG_ENUM)) != NULL)
{
for (i = 0; i < attr->num_values; i ++)
if (attr->values[i].integer == IPP_CLOSE_JOB)
{
request = ippNewRequest(IPP_CLOSE_JOB);
break;
}
}
if (!request)
request = ippNewRequest(IPP_SEND_DOCUMENT);
if (!request)
{
_cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
DEBUG_puts("1cupsCloseDestJob: Unable to create Close-Job/Send-Document "
"request.");
return (IPP_INTERNAL_ERROR);
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, info->uri);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id",
job_id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
if (ippGetOperation(request) == IPP_SEND_DOCUMENT)
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);
/*
* Send the request and return the status...
*/
ippDelete(cupsDoRequest(http, request, info->resource));
DEBUG_printf(("1cupsCloseDestJob: %s (%s)", ippErrorString(cupsLastError()),
cupsLastErrorString()));
return (cupsLastError());
return (IPP_NOT_FOUND);
}
/*
* 'cupsCreateDestJob()' - Create a job on a destination.
*
* Returns @code IPP_OK@ or @code IPP_OK_SUBST@ on success, saving the job ID
* in the variable pointed to by "job_id".
* Returns IPP_OK or IPP_OK_SUBST on success, saving the job ID in the variable
* pointed to by "job_id".
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_status_t /* O - IPP status code */
@@ -153,117 +88,26 @@ cupsCreateDestJob(
int num_options, /* I - Number of job options */
cups_option_t *options) /* I - Job options */
{
ipp_t *request, /* Create-Job request */
*response; /* Create-Job response */
ipp_attribute_t *attr; /* job-id attribute */
*job_id = 0;
DEBUG_printf(("cupsCreateDestJob(http=%p, dest=%p(%s/%s), info=%p, "
"job_id=%p, title=\"%s\", num_options=%d, options=%p)",
http, dest, dest ? dest->name : NULL,
dest ? dest->instance : NULL, info, job_id, title, num_options,
options));
/*
* Range check input...
*/
if (job_id)
*job_id = 0;
if (!http || !dest || !info || !job_id)
{
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
DEBUG_puts("1cupsCreateDestJob: Bad arguments.");
return (IPP_INTERNAL_ERROR);
}
/*
* Build a Create-Job request...
*/
if ((request = ippNewRequest(IPP_CREATE_JOB)) == NULL)
{
_cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
DEBUG_puts("1cupsCreateDestJob: Unable to create Create-Job request.");
return (IPP_INTERNAL_ERROR);
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, info->uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
if (title)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
title);
cupsEncodeOptions2(request, num_options, options, IPP_TAG_JOB);
cupsEncodeOptions2(request, num_options, options, IPP_TAG_SUBSCRIPTION);
/*
* Send the request and get the job-id...
*/
response = cupsDoRequest(http, request, info->resource);
if ((attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) != NULL)
{
*job_id = attr->values[0].integer;
DEBUG_printf(("1cupsCreateDestJob: job-id=%d", *job_id));
}
ippDelete(response);
/*
* Return the status code from the Create-Job request...
*/
DEBUG_printf(("1cupsCreateDestJob: %s (%s)", ippErrorString(cupsLastError()),
cupsLastErrorString()));
return (cupsLastError());
return (IPP_NOT_POSSIBLE);
}
/*
* 'cupsFinishDestDocument()' - Finish the current document.
*
* Returns @code IPP_OK@ or @code IPP_OK_SUBST@ on success.
* Returns IPP_OK on success.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_status_t /* O - Status of document submission */
ipp_status_t
cupsFinishDestDocument(
http_t *http, /* I - Connection to destination */
cups_dest_t *dest, /* I - Destination */
cups_dinfo_t *info) /* I - Destination information */
http_t *http, /* I - Connection to destination */
cups_dest_t *dest) /* I - Destination */
{
DEBUG_printf(("cupsFinishDestDocument(http=%p, dest=%p(%s/%s), info=%p)",
http, dest, dest ? dest->name : NULL,
dest ? dest->instance : NULL, info));
/*
* Range check input...
*/
if (!http || !dest || !info)
{
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
DEBUG_puts("1cupsFinishDestDocument: Bad arguments.");
return (IPP_INTERNAL_ERROR);
}
/*
* Get the response at the end of the document and return it...
*/
ippDelete(cupsGetResponse(http, info->resource));
DEBUG_printf(("1cupsFinishDestDocument: %s (%s)",
ippErrorString(cupsLastError()), cupsLastErrorString()));
return (cupsLastError());
return (IPP_NOT_FOUND);
}
@@ -275,12 +119,12 @@ cupsFinishDestDocument(
* document (see CUPS_FORMAT_xxx constants), and "num_options" and "options"
* are the options do be applied to the document. "last_document" should be 1
* if this is the last document to be submitted in the job. Returns
* @code HTTP_CONTINUE@ on success.
* HTTP_CONTINUE on success.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
http_status_t /* O - Status of document creation */
http_status_t
cupsStartDestDocument(
http_t *http, /* I - Connection to destination */
cups_dest_t *dest, /* I - Destination */
@@ -292,64 +136,7 @@ cupsStartDestDocument(
cups_option_t *options, /* I - Document options */
int last_document) /* I - 1 if this is the last document */
{
ipp_t *request; /* Send-Document request */
http_status_t status; /* HTTP status */
DEBUG_printf(("cupsStartDestDocument(http=%p, dest=%p(%s/%s), info=%p, "
"job_id=%d, docname=\"%s\", format=\"%s\", num_options=%d, "
"options=%p, last_document=%d)",
http, dest, dest ? dest->name : NULL,
dest ? dest->instance : NULL, info, job_id, docname, format,
num_options, options, last_document));
/*
* Range check input...
*/
if (!http || !dest || !info || job_id <= 0)
{
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
DEBUG_puts("1cupsStartDestDocument: Bad arguments.");
return (HTTP_ERROR);
}
/*
* Create a Send-Document request...
*/
if ((request = ippNewRequest(IPP_SEND_DOCUMENT)) == NULL)
{
_cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
DEBUG_puts("1cupsStartDestDocument: Unable to create Send-Document "
"request.");
return (HTTP_ERROR);
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, info->uri);
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", job_id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
if (docname)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "document-name",
NULL, docname);
if (format)
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
"document-format", NULL, format);
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", last_document);
cupsEncodeOptions2(request, num_options, options, IPP_TAG_DOCUMENT);
/*
* Send and delete the request, then return the status...
*/
status = cupsSendRequest(http, request, info->resource, CUPS_LENGTH_VARIABLE);
ippDelete(request);
return (status);
return (HTTP_CONTINUE);
}
+12 -322
Ver Arquivo
@@ -15,14 +15,10 @@
*
* Contents:
*
* cupsLocalizeDestOption() - Get the localized string for a destination
* option.
* cupsLocalizeDestValue() - Get the localized string for a destination
* option+value pair.
* cups_create_localizations() - Create the localizations array for a
* destination.
* cups_read_strings() - Read a pair of strings from a .strings file.
* cups_scan_strings() - Scan a quoted string.
 * cupsLocalizeDestOption() - Get the localized string for a destination
* option.
* cupsLocalizeDestValue() - Get the localized string for a destination
* option+value pair.
*/
/*
@@ -32,24 +28,14 @@
#include "cups-private.h"
/*
* Local functions...
*/
static void cups_create_localizations(http_t *http, cups_dinfo_t *dinfo);
static int cups_read_strings(cups_file_t *fp, char *buffer, size_t bufsize,
char **id, char **str);
static char *cups_scan_strings(char *buffer);
/*
* 'cupsLocalizeDestOption()' - Get the localized string for a destination
* option.
*
* The returned string is stored in the destination information and will become
* invalid if the destination information is deleted.
* The returned string is stored in the localization array and will become
* invalid if the localization array is deleted.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
const char * /* O - Localized string */
@@ -59,25 +45,7 @@ cupsLocalizeDestOption(
cups_dinfo_t *dinfo, /* I - Destination information */
const char *option) /* I - Option to localize */
{
_cups_message_t key, /* Search key */
*match; /* Matching entry */
if (!http || !dest || !dinfo)
return (option);
if (!dinfo->localizations)
cups_create_localizations(http, dinfo);
if (cupsArrayCount(dinfo->localizations) == 0)
return (option);
key.id = (char *)option;
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations,
&key)) != NULL)
return (match->str);
else
return (option);
return (option);
}
@@ -85,10 +53,10 @@ cupsLocalizeDestOption(
* 'cupsLocalizeDestValue()' - Get the localized string for a destination
* option+value pair.
*
* The returned string is stored in the destination information and will become
* invalid if the destination information is deleted.
* The returned string is stored in the localization array and will become
* invalid if the localization array is deleted.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
const char * /* O - Localized string */
@@ -99,288 +67,10 @@ cupsLocalizeDestValue(
const char *option, /* I - Option to localize */
const char *value) /* I - Value to localize */
{
_cups_message_t key, /* Search key */
*match; /* Matching entry */
char pair[256]; /* option.value pair */
if (!http || !dest || !dinfo)
return (value);
if (!dinfo->localizations)
cups_create_localizations(http, dinfo);
if (cupsArrayCount(dinfo->localizations) == 0)
return (value);
snprintf(pair, sizeof(pair), "%s.%s", option, value);
key.id = pair;
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations,
&key)) != NULL)
return (match->str);
else
return (value);
return (value);
}
/*
* 'cups_create_localizations()' - Create the localizations array for a
* destination.
*/
static void
cups_create_localizations(
http_t *http, /* I - Connection to destination */
cups_dinfo_t *dinfo) /* I - Destination informations */
{
http_t *http2; /* Connection for strings file */
http_status_t status; /* Request status */
ipp_attribute_t *attr; /* "printer-strings-uri" attribute */
char scheme[32], /* URI scheme */
userpass[256], /* Username/password info */
hostname[256], /* Hostname */
resource[1024], /* Resource */
http_hostname[256],
/* Hostname of connection */
tempfile[1024]; /* Temporary filename */
int port; /* Port number */
http_encryption_t encryption; /* Encryption to use */
cups_file_t *temp; /* Temporary file */
/*
* Create an empty message catalog...
*/
dinfo->localizations = _cupsMessageNew(NULL);
/*
* See if there are any localizations...
*/
if ((attr = ippFindAttribute(dinfo->attrs, "printer-strings-uri",
IPP_TAG_URI)) == NULL)
{
/*
* Nope...
*/
DEBUG_puts("4cups_create_localizations: No printer-strings-uri (uri) "
"value.");
return; /* Nope */
}
/*
* Pull apart the URI and determine whether we need to try a different
* server...
*/
if (httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[0].string.text,
scheme, sizeof(scheme), userpass, sizeof(userpass),
hostname, sizeof(hostname), &port, resource,
sizeof(resource)) < HTTP_URI_OK)
{
DEBUG_printf(("4cups_create_localizations: Bad printer-strings-uri value "
"\"%s\".", attr->values[0].string.text));
return;
}
httpGetHostname(http, http_hostname, sizeof(http_hostname));
if (!_cups_strcasecmp(http_hostname, hostname) &&
port == _httpAddrPort(http->hostaddr))
{
/*
* Use the same connection...
*/
http2 = http;
}
else
{
/*
* Connect to the alternate host...
*/
if (!strcmp(scheme, "https"))
encryption = HTTP_ENCRYPT_ALWAYS;
else
encryption = HTTP_ENCRYPT_IF_REQUESTED;
if ((http2 = httpConnectEncrypt(hostname, port, encryption)) == NULL)
{
DEBUG_printf(("4cups_create_localizations: Unable to connect to "
"%s:%d: %s", hostname, port, cupsLastErrorString()));
return;
}
}
/*
* Get a temporary file...
*/
if ((temp = cupsTempFile2(tempfile, sizeof(tempfile))) == NULL)
{
DEBUG_printf(("4cups_create_localizations: Unable to create temporary "
"file: %s", cupsLastErrorString()));
if (http2 != http)
httpClose(http2);
return;
}
status = cupsGetFd(http2, resource, cupsFileNumber(temp));
DEBUG_printf(("4cups_create_localizations: GET %s = %s", resource,
httpStatus(status)));
if (status == HTTP_OK)
{
/*
* Got the file, read it...
*/
char buffer[8192], /* Message buffer */
*id, /* ID string */
*str; /* Translated message */
_cups_message_t *m; /* Current message */
lseek(cupsFileNumber(temp), 0, SEEK_SET);
while (cups_read_strings(temp, buffer, sizeof(buffer), &id, &str))
{
if ((m = malloc(sizeof(_cups_message_t))) == NULL)
break;
m->id = strdup(id);
m->str = strdup(str);
if (m->id && m->str)
cupsArrayAdd(dinfo->localizations, m);
else
{
if (m->id)
free(m->id);
if (m->str)
free(m->str);
free(m);
break;
}
}
}
DEBUG_printf(("4cups_create_localizations: %d messages loaded.",
cupsArrayCount(dinfo->localizations)));
/*
* Cleanup...
*/
unlink(tempfile);
cupsFileClose(temp);
if (http2 != http)
httpClose(http2);
}
/*
* 'cups_read_strings()' - Read a pair of strings from a .strings file.
*/
static int /* O - 1 on success, 0 on failure */
cups_read_strings(cups_file_t *strings, /* I - .strings file */
char *buffer, /* I - Line buffer */
size_t bufsize, /* I - Size of line buffer */
char **id, /* O - Pointer to ID string */
char **str) /* O - Pointer to translation string */
{
char *bufptr; /* Pointer into buffer */
while (cupsFileGets(strings, buffer, bufsize))
{
if (buffer[0] != '\"')
continue;
*id = buffer + 1;
bufptr = cups_scan_strings(buffer);
if (*bufptr != '\"')
continue;
*bufptr++ = '\0';
while (*bufptr && *bufptr != '\"')
bufptr ++;
if (!*bufptr)
continue;
*str = bufptr + 1;
bufptr = cups_scan_strings(bufptr);
if (*bufptr != '\"')
continue;
*bufptr = '\0';
return (1);
}
return (0);
}
/*
* 'cups_scan_strings()' - Scan a quoted string.
*/
static char * /* O - End of string */
cups_scan_strings(char *buffer) /* I - Start of string */
{
char *bufptr; /* Pointer into string */
for (bufptr = buffer + 1; *bufptr && *bufptr != '\"'; bufptr ++)
{
if (*bufptr == '\\')
{
if (bufptr[1] >= '0' && bufptr[1] <= '3' &&
bufptr[2] >= '0' && bufptr[2] <= '7' &&
bufptr[3] >= '0' && bufptr[3] <= '7')
{
/*
* Decode \nnn octal escape...
*/
*bufptr = ((((bufptr[1] - '0') << 3) | (bufptr[2] - '0')) << 3) |
(bufptr[3] - '0');
_cups_strcpy(bufptr + 1, bufptr + 4);
}
else
{
/*
* Decode \C escape...
*/
_cups_strcpy(bufptr, bufptr + 1);
if (*bufptr == 'n')
*bufptr = '\n';
else if (*bufptr == 'r')
*bufptr = '\r';
else if (*bufptr == 't')
*bufptr = '\t';
}
}
}
return (bufptr);
}
/*
* End of "$Id$".
*/
+34 -635
Ver Arquivo
@@ -15,28 +15,23 @@
*
* Contents:
*
* cupsCheckDestSupported() - Check that the option and value are supported
* by the destination.
* cupsCopyDestConflicts() - Get conflicts and resolutions for a new
* option/value pair.
* cupsCopyDestInfo() - Get the supported values/capabilities for the
* destination.
* cupsFreeDestInfo() - Free destination information obtained using
* @link cupsCopyDestInfo@.
* cupsGetDestMediaByName() - Get media names, dimensions, and margins.
* cupsGetDestMediaBySize() - Get media names, dimensions, and margins.
* cups_add_dconstres() - Add a constraint or resolver to an array.
* cups_compare_dconstres() - Compare to resolver entries.
* cups_compare_media_db() - Compare two media entries.
* cups_copy_media_db() - Copy a media entry.
* cups_create_constraints() - Create the constraints and resolvers arrays.
* cups_create_defaults() - Create the -default option array.
* cups_create_media_db() - Create the media database.
* cups_free_media_cb() - Free a media entry.
* cups_get_media_db() - Lookup the media entry for a given size.
* cups_is_close_media_db() - Compare two media entries to see if they are
* close to the same size.
* cups_test_constraints() - Test constraints.
 * cupsCheckDestSupported() - Check that the option and value are supported
* by the destination.
* cupsCopyDestConflicts() - Get conflicts and resolutions for a new
* option/value pair.
* cupsCopyDestInfo() - Get the supported values/capabilities for the
* destination.
* cupsFreeDestInfo() - Free destination information obtained using
* @link cupsCopyDestInfo@.
* cupsGetDestMediaByName() - Get media names, dimensions, and margins.
* cupsGetDestMediaBySize() - Get media names, dimensions, and margins.
* cups_compare_media_db() - Compare two media entries.
* cups_copy_media_db() - Copy a media entry.
* cups_create_media_db() - Create the media database.
* cups_free_media_cb() - Free a media entry.
* cups_get_media_db() - Lookup the media entry for a given size.
* cups_is_close_media_db() - Compare two media entries to see if they are
* close to the same size.
*/
/*
@@ -50,14 +45,9 @@
* Local functions...
*/
static void cups_add_dconstres(cups_array_t *a, ipp_t *collection);
static int cups_compare_dconstres(_cups_dconstres_t *a,
_cups_dconstres_t *b);
static int cups_compare_media_db(_cups_media_db_t *a,
_cups_media_db_t *b);
static _cups_media_db_t *cups_copy_media_db(_cups_media_db_t *mdb);
static void cups_create_constraints(cups_dinfo_t *dinfo);
static void cups_create_defaults(cups_dinfo_t *dinfo);
static void cups_create_media_db(cups_dinfo_t *dinfo);
static void cups_free_media_db(_cups_media_db_t *mdb);
static int cups_get_media_db(cups_dinfo_t *dinfo,
@@ -65,14 +55,6 @@ static int cups_get_media_db(cups_dinfo_t *dinfo,
cups_size_t *size);
static int cups_is_close_media_db(_cups_media_db_t *a,
_cups_media_db_t *b);
static cups_array_t *cups_test_constraints(cups_dinfo_t *dinfo,
const char *new_option,
const char *new_value,
int num_options,
cups_option_t *options,
int *num_conflicts,
cups_option_t **conflicts);
/*
* 'cupsCheckDestSupported()' - Check that the option and value are supported
@@ -80,7 +62,7 @@ static cups_array_t *cups_test_constraints(cups_dinfo_t *dinfo,
*
* Returns 1 if supported, 0 otherwise.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 if supported, 0 otherwise */
@@ -194,15 +176,6 @@ cupsCheckDestSupported(
case IPP_TAG_BOOLEAN :
return (attr->values[0].boolean);
case IPP_TAG_RANGE :
int_value = atoi(value);
for (i = 0; i < attr->num_values; i ++)
if (int_value >= attr->values[i].range.lower &&
int_value <= attr->values[i].range.upper)
return (1);
break;
case IPP_TAG_RESOLUTION :
if (sscanf(value, "%dx%d%15s", &xres_value, &yres_value, temp) != 3)
{
@@ -214,7 +187,7 @@ cupsCheckDestSupported(
if (!strcmp(temp, "dpi"))
units_value = IPP_RES_PER_INCH;
else if (!strcmp(temp, "dpc") || !strcmp(temp, "dpcm"))
else if (!strcmp(temp, "dpc"))
units_value = IPP_RES_PER_CM;
else
return (0);
@@ -266,8 +239,7 @@ cupsCheckDestSupported(
* user. "new_option" and "new_value" are the setting the user has just
* changed.
*
* Returns 1 if there is a conflict, 0 if there are no conflicts, and -1 if
* there was an unrecoverable error such as a resolver loop.
* Returns 1 if there is a conflict and 0 otherwise.
*
* If "num_conflicts" and "conflicts" are not NULL, they are set to contain the
* list of conflicting option/value pairs. Similarly, if "num_resolved" and
@@ -277,10 +249,10 @@ cupsCheckDestSupported(
* If cupsCopyDestConflicts returns 1 but "num_resolved" and "resolved" are set
* to 0 and NULL, respectively, then the conflict cannot be resolved.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 if there is a conflict, 0 if none, -1 on error */
int /* O - 1 if there is a conflict */
cupsCopyDestConflicts(
http_t *http, /* I - Connection to destination */
cups_dest_t *dest, /* I - Destination */
@@ -294,27 +266,6 @@ cupsCopyDestConflicts(
int *num_resolved, /* O - Number of options to resolve */
cups_option_t **resolved) /* O - Resolved options */
{
int i, /* Looping var */
have_conflicts = 0, /* Do we have conflicts? */
changed, /* Did we change something? */
tries, /* Number of tries for resolution */
num_myconf = 0, /* My number of conflicting options */
num_myres = 0; /* My number of resolved options */
cups_option_t *myconf = NULL, /* My conflicting options */
*myres = NULL, /* My resolved options */
*myoption, /* My current option */
*option; /* Current option */
cups_array_t *active, /* Active conflicts */
*pass = NULL, /* Resolvers for this pass */
*resolvers = NULL, /* Resolvers we have used */
*test; /* Test array for conflicts */
_cups_dconstres_t *c, /* Current constraint */
*r; /* Current resolver */
ipp_attribute_t *attr; /* Current attribute */
char value[2048]; /* Current attribute value as string */
const char *myvalue; /* Current value of an option */
/*
* Clear returned values...
*/
@@ -335,223 +286,18 @@ cupsCopyDestConflicts(
* Range check input...
*/
if (!http || !dest || !dinfo ||
if (!http || !dest || !dinfo || !new_option || !new_value ||
(num_conflicts != NULL) != (conflicts != NULL) ||
(num_resolved != NULL) != (resolved != NULL))
return (0);
/*
* Load constraints as needed...
* Check for an resolve any conflicts...
*/
if (!dinfo->constraints)
cups_create_constraints(dinfo);
/* TODO: implement me! */
if (cupsArrayCount(dinfo->constraints) == 0)
return (0);
if (!dinfo->num_defaults)
cups_create_defaults(dinfo);
/*
* If we are resolving, create a shadow array...
*/
if (num_resolved)
{
for (i = num_options, option = options; i > 0; i --, option ++)
num_myres = cupsAddOption(option->name, option->value, num_myres, &myres);
if (new_option && new_value)
num_myres = cupsAddOption(new_option, new_value, num_myres, &myres);
}
else
{
num_myres = num_options;
myres = options;
}
/*
* Check for any conflicts...
*/
if (num_resolved)
pass = cupsArrayNew((cups_array_func_t)cups_compare_dconstres, NULL);
for (tries = 0; tries < 100; tries ++)
{
/*
* Check for any conflicts...
*/
if (num_conflicts || num_resolved)
{
cupsFreeOptions(num_myconf, myconf);
num_myconf = 0;
myconf = NULL;
active = cups_test_constraints(dinfo, new_option, new_value,
num_myres, myres, &num_myconf,
&myconf);
}
else
active = cups_test_constraints(dinfo, new_option, new_value, num_myres,
myres, NULL, NULL);
have_conflicts = (active != NULL);
if (!active || !num_resolved)
break; /* All done */
/*
* Scan the constraints that were triggered to apply resolvers...
*/
if (!resolvers)
resolvers = cupsArrayNew((cups_array_func_t)cups_compare_dconstres, NULL);
for (c = (_cups_dconstres_t *)cupsArrayFirst(active), changed = 0;
c;
c = (_cups_dconstres_t *)cupsArrayNext(active))
{
if (cupsArrayFind(pass, c))
continue; /* Already applied this resolver... */
if (cupsArrayFind(resolvers, c))
{
DEBUG_printf(("1cupsCopyDestConflicts: Resolver loop with %s.",
c->name));
have_conflicts = -1;
goto cleanup;
}
if ((r = cupsArrayFind(dinfo->resolvers, c)) == NULL)
{
DEBUG_printf(("1cupsCopyDestConflicts: Resolver %s not found.",
c->name));
have_conflicts = -1;
goto cleanup;
}
/*
* Add the options from the resolver...
*/
cupsArrayAdd(pass, r);
cupsArrayAdd(resolvers, r);
for (attr = ippFirstAttribute(r->collection);
attr;
attr = ippNextAttribute(r->collection))
{
if (new_option && !strcmp(attr->name, new_option))
continue; /* Ignore this if we just changed it */
if (ippAttributeString(attr, value, sizeof(value)) >= sizeof(value))
continue; /* Ignore if the value is too long */
if ((test = cups_test_constraints(dinfo, attr->name, value, num_myres,
myres, NULL, NULL)) == NULL)
{
/*
* That worked, flag it...
*/
changed = 1;
}
else
cupsArrayDelete(test);
/*
* Add the option/value from the resolver regardless of whether it
* worked; this makes sure that we can cascade several changes to
* make things resolve...
*/
num_myres = cupsAddOption(attr->name, value, num_myres, &myres);
}
}
if (!changed)
{
DEBUG_puts("1cupsCopyDestConflicts: Unable to resolve constraints.");
have_conflicts = -1;
goto cleanup;
}
cupsArrayClear(pass);
cupsArrayDelete(active);
active = NULL;
}
if (tries >= 0)
{
DEBUG_puts("1cupsCopyDestConflicts: Unable to resolve after 100 tries.");
have_conflicts = -1;
goto cleanup;
}
/*
* Copy resolved options as needed...
*/
if (num_resolved)
{
for (i = num_myres, myoption = myres; i > 0; i --, myoption ++)
{
if ((myvalue = cupsGetOption(myoption->name, num_options,
options)) == NULL ||
strcmp(myvalue, myoption->value))
{
if (new_option && !strcmp(new_option, myoption->name) &&
new_value && !strcmp(new_value, myoption->value))
continue;
*num_resolved = cupsAddOption(myoption->name, myoption->value,
*num_resolved, resolved);
}
}
}
/*
* Clean up...
*/
cleanup:
cupsArrayDelete(active);
cupsArrayDelete(pass);
cupsArrayDelete(resolvers);
if (num_resolved)
{
/*
* Free shadow copy of options...
*/
cupsFreeOptions(num_myres, myres);
}
if (num_conflicts)
{
/*
* Return conflicting options to caller...
*/
*num_conflicts = num_myconf;
*conflicts = myconf;
}
else
{
/*
* Free conflicting options...
*/
cupsFreeOptions(num_myconf, myconf);
}
return (have_conflicts);
return (0);
}
@@ -562,7 +308,7 @@ cupsCopyDestConflicts(
* The caller is responsible for calling @link cupsFreeDestInfo@ on the return
* value. @code NULL@ is returned on error.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
cups_dinfo_t * /* O - Destination information */
@@ -573,9 +319,6 @@ cupsCopyDestInfo(
cups_dinfo_t *dinfo; /* Destination information */
ipp_t *request, /* Get-Printer-Attributes request */
*response; /* Supported attributes */
int tries, /* Number of tries so far */
delay, /* Current retry delay */
prev_delay; /* Next retry delay */
const char *uri; /* Printer URI */
char resource[1024]; /* Resource path */
int version; /* IPP version */
@@ -609,10 +352,7 @@ cupsCopyDestInfo(
* Get the supported attributes...
*/
delay = 1;
prev_delay = 1;
tries = 0;
version = 20;
version = 20;
do
{
@@ -643,22 +383,11 @@ cupsCopyDestInfo(
if (status == IPP_VERSION_NOT_SUPPORTED && version > 11)
version = 11;
else if (status == IPP_PRINTER_BUSY)
{
sleep(delay);
delay = _cupsNextDelay(delay, &prev_delay);
}
else
return (NULL);
}
tries ++;
}
while (!response && tries < 10);
if (!response)
return (NULL);
while (!response);
/*
* Allocate a cups_dinfo_t structure and return it...
@@ -700,15 +429,14 @@ cupsFreeDestInfo(cups_dinfo_t *dinfo) /* I - Destination information */
_cupsStrFree(dinfo->resource);
ippDelete(dinfo->attrs);
cupsArrayDelete(dinfo->constraints);
cupsArrayDelete(dinfo->resolvers);
cupsArrayDelete(dinfo->localizations);
cupsArrayDelete(dinfo->media_db);
ippDelete(dinfo->attrs);
free(dinfo);
}
@@ -731,7 +459,7 @@ cupsFreeDestInfo(cups_dinfo_t *dinfo) /* I - Destination information */
*
* Returns 1 when there is a match and 0 if there is not a match.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on match, 0 on failure */
@@ -797,7 +525,7 @@ cupsGetDestMediaByName(
*
* Returns 1 when there is a match and 0 if there is not a match.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on match, 0 on failure */
@@ -848,46 +576,6 @@ cupsGetDestMediaBySize(
}
/*
* 'cups_add_dconstres()' - Add a constraint or resolver to an array.
*/
static void
cups_add_dconstres(
cups_array_t *a, /* I - Array */
ipp_t *collection) /* I - Collection value */
{
ipp_attribute_t *attr; /* Attribute */
_cups_dconstres_t *temp; /* Current constraint/resolver */
if ((attr = ippFindAttribute(collection, "resolver-name",
IPP_TAG_NAME)) == NULL)
return;
if ((temp = calloc(1, sizeof(_cups_dconstres_t))) == NULL)
return;
temp->name = attr->values[0].string.text;
temp->collection = collection;
cupsArrayAdd(a, temp);
}
/*
* 'cups_compare_dconstres()' - Compare to resolver entries.
*/
static int /* O - Result of comparison */
cups_compare_dconstres(
_cups_dconstres_t *a, /* I - First resolver */
_cups_dconstres_t *b) /* I - Second resolver */
{
return (strcmp(a->name, b->name));
}
/*
* 'cups_compare_media_db()' - Compare two media entries.
*/
@@ -945,93 +633,6 @@ cups_copy_media_db(
}
/*
* 'cups_create_constraints()' - Create the constraints and resolvers arrays.
*/
static void
cups_create_constraints(
cups_dinfo_t *dinfo) /* I - Destination information */
{
int i; /* Looping var */
ipp_attribute_t *attr; /* Attribute */
_ipp_value_t *val; /* Current value */
dinfo->constraints = cupsArrayNew3(NULL, NULL, NULL, 0, NULL,
(cups_afree_func_t)free);
dinfo->resolvers = cupsArrayNew3((cups_array_func_t)cups_compare_dconstres,
NULL, NULL, 0, NULL,
(cups_afree_func_t)free);
if ((attr = ippFindAttribute(dinfo->attrs, "job-constraints-supported",
IPP_TAG_BEGIN_COLLECTION)) != NULL)
{
for (i = attr->num_values, val = attr->values; i > 0; i --, val ++)
cups_add_dconstres(dinfo->constraints, val->collection);
}
if ((attr = ippFindAttribute(dinfo->attrs, "job-resolvers-supported",
IPP_TAG_BEGIN_COLLECTION)) != NULL)
{
for (i = attr->num_values, val = attr->values; i > 0; i --, val ++)
cups_add_dconstres(dinfo->resolvers, val->collection);
}
}
/*
* 'cups_create_defaults()' - Create the -default option array.
*
* TODO: Need to support collection defaults...
*/
static void
cups_create_defaults(
cups_dinfo_t *dinfo) /* I - Destination information */
{
ipp_attribute_t *attr; /* Current attribute */
char name[IPP_MAX_NAME + 1],
/* Current name */
*nameptr, /* Pointer into current name */
value[2048]; /* Current value */
/*
* Iterate through the printer attributes looking for xxx-default and adding
* xxx=value to the defaults option array.
*/
for (attr = ippFirstAttribute(dinfo->attrs);
attr;
attr = ippNextAttribute(dinfo->attrs))
{
if (!attr->name || attr->group_tag != IPP_TAG_PRINTER)
continue;
if (attr->value_tag == IPP_TAG_BEGIN_COLLECTION)
continue; /* TODO: STR #4096 */
if ((nameptr = attr->name + strlen(attr->name) - 8) <= attr->name ||
strcmp(nameptr, "-default"))
continue;
strlcpy(name, attr->name, sizeof(name));
if ((nameptr = name + strlen(name) - 8) <= name ||
strcmp(nameptr, "-default"))
continue;
*nameptr = '\0';
if (ippAttributeString(attr, value, sizeof(value)) >= sizeof(value))
continue;
dinfo->num_defaults = cupsAddOption(name, value, dinfo->num_defaults,
&dinfo->defaults);
}
}
/*
* 'cups_create_media_db()' - Create the media database.
*/
@@ -1220,7 +821,7 @@ cups_create_media_db(
mdb.top =
mdb.bottom = 1270; /* Default 1/2" top/bottom margins */
for (i = media_attr->num_values, val = media_attr->values;
for (i = media_col_db->num_values, val = media_col_db->values;
i > 0;
i --, val ++)
{
@@ -1558,208 +1159,6 @@ cups_is_close_media_db(
}
/*
* 'cups_test_constraints()' - Test constraints.
*
* TODO: STR #4096 - Need to properly support media-col contraints...
*/
static cups_array_t * /* O - Active constraints */
cups_test_constraints(
cups_dinfo_t *dinfo, /* I - Destination information */
const char *new_option, /* I - Newly selected option */
const char *new_value, /* I - Newly selected value */
int num_options, /* I - Number of options */
cups_option_t *options, /* I - Options */
int *num_conflicts, /* O - Number of conflicting options */
cups_option_t **conflicts) /* O - Conflicting options */
{
int i, /* Looping var */
match; /* Value matches? */
int num_matching; /* Number of matching options */
cups_option_t *matching; /* Matching options */
_cups_dconstres_t *c; /* Current constraint */
cups_array_t *active = NULL; /* Active constraints */
ipp_attribute_t *attr; /* Current attribute */
_ipp_value_t *attrval; /* Current attribute value */
const char *value; /* Current value */
char temp[1024]; /* Temporary string */
int int_value; /* Integer value */
int xres_value, /* Horizontal resolution */
yres_value; /* Vertical resolution */
ipp_res_t units_value; /* Resolution units */
for (c = (_cups_dconstres_t *)cupsArrayFirst(dinfo->constraints);
c;
c = (_cups_dconstres_t *)cupsArrayNext(dinfo->constraints))
{
num_matching = 0;
matching = NULL;
for (attr = ippFirstAttribute(c->collection);
attr;
attr = ippNextAttribute(c->collection))
{
if (attr->value_tag == IPP_TAG_BEGIN_COLLECTION)
break; /* TODO: STR #4096 */
/*
* Get the value for the current attribute in the constraint...
*/
if (new_option && new_value && !strcmp(attr->name, new_option))
value = new_value;
else if ((value = cupsGetOption(attr->name, num_options,
options)) == NULL)
value = cupsGetOption(attr->name, dinfo->num_defaults, dinfo->defaults);
if (!value)
{
/*
* Not set so this constraint does not apply...
*/
break;
}
match = 0;
switch (attr->value_tag)
{
case IPP_TAG_INTEGER :
case IPP_TAG_ENUM :
int_value = atoi(value);
for (i = attr->num_values, attrval = attr->values;
i > 0;
i --, attrval ++)
{
if (attrval->integer == int_value)
{
match = 1;
break;
}
}
break;
case IPP_TAG_BOOLEAN :
int_value = !strcmp(value, "true");
for (i = attr->num_values, attrval = attr->values;
i > 0;
i --, attrval ++)
{
if (attrval->boolean == int_value)
{
match = 1;
break;
}
}
break;
case IPP_TAG_RANGE :
int_value = atoi(value);
for (i = attr->num_values, attrval = attr->values;
i > 0;
i --, attrval ++)
{
if (int_value >= attrval->range.lower &&
int_value <= attrval->range.upper)
{
match = 1;
break;
}
}
break;
case IPP_TAG_RESOLUTION :
if (sscanf(value, "%dx%d%15s", &xres_value, &yres_value, temp) != 3)
{
if (sscanf(value, "%d%15s", &xres_value, temp) != 2)
break;
yres_value = xres_value;
}
if (!strcmp(temp, "dpi"))
units_value = IPP_RES_PER_INCH;
else if (!strcmp(temp, "dpc") || !strcmp(temp, "dpcm"))
units_value = IPP_RES_PER_CM;
else
break;
for (i = attr->num_values, attrval = attr->values;
i > 0;
i --, attrval ++)
{
if (attrval->resolution.xres == xres_value &&
attrval->resolution.yres == yres_value &&
attrval->resolution.units == units_value)
{
match = 1;
break;
}
}
break;
case IPP_TAG_TEXT :
case IPP_TAG_NAME :
case IPP_TAG_KEYWORD :
case IPP_TAG_CHARSET :
case IPP_TAG_URI :
case IPP_TAG_URISCHEME :
case IPP_TAG_MIMETYPE :
case IPP_TAG_LANGUAGE :
case IPP_TAG_TEXTLANG :
case IPP_TAG_NAMELANG :
for (i = attr->num_values, attrval = attr->values;
i > 0;
i --, attrval ++)
{
if (!strcmp(attrval->string.text, value))
{
match = 1;
break;
}
}
break;
default :
break;
}
if (!match)
break;
num_matching = cupsAddOption(attr->name, value, num_matching, &matching);
}
if (!attr)
{
if (!active)
active = cupsArrayNew(NULL, NULL);
cupsArrayAdd(active, c);
if (num_conflicts && conflicts)
{
cups_option_t *moption; /* Matching option */
for (i = num_matching, moption = matching; i > 0; i --, moption ++)
*num_conflicts = cupsAddOption(moption->name, moption->value,
*num_conflicts, conflicts);
}
}
cupsFreeOptions(num_matching, matching);
}
return (active);
}
/*
* End of "$Id$".
*/
+69 -497
Ver Arquivo
@@ -62,17 +62,13 @@
* cups_block_cb() - Enumeration callback for block API.
* cups_compare_dests() - Compare two destinations.
* cups_dnssd_browse_cb() - Browse for printers.
* cups_dnssd_browse_cb() - Browse for printers.
* cups_dnssd_client_cb() - Avahi client callback function.
* cups_dnssd_compare_device() - Compare two devices.
* cups_dnssd_free_device() - Free the memory used by a device.
* cups_dnssd_get_device() - Lookup a device and create it as needed.
* cups_dnssd_local_cb() - Browse for local printers.
* cups_dnssd_poll_cb() - Wait for input on the specified file
* descriptors.
* cups_dnssd_query_cb() - Process query data.
* cups_dnssd_resolve() - Resolve a Bonjour printer URI.
* cups_dnssd_resolve_cb() - See if we should continue resolving.
* cups_dnssd_resolve() - Resolve a Bonjour printer URI.
* cups_dnssd_resolve_cb() - See if we should continue resolving.
* cups_dnssd_unquote() - Unquote a name string.
* cups_find_dest() - Find a destination using a binary search.
* cups_get_default() - Get the default destination from an
@@ -101,16 +97,6 @@
# include <dns_sd.h>
#endif /* HAVE_DNSSD */
#ifdef HAVE_AVAHI
# include <avahi-client/client.h>
# include <avahi-client/lookup.h>
# include <avahi-common/simple-watch.h>
# include <avahi-common/domain.h>
# include <avahi-common/error.h>
# include <avahi-common/malloc.h>
#define kDNSServiceMaxDomainName AVAHI_DOMAIN_NAME_MAX
#endif /* HAVE_AVAHI */
/*
* Constants...
@@ -131,7 +117,7 @@
* Types...
*/
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
#ifdef HAVE_DNSSD
typedef enum _cups_dnssd_state_e /* Enumerated device state */
{
_CUPS_DNSSD_NEW,
@@ -139,19 +125,12 @@ typedef enum _cups_dnssd_state_e /* Enumerated device state */
_CUPS_DNSSD_PENDING,
_CUPS_DNSSD_ACTIVE,
_CUPS_DNSSD_LOCAL,
_CUPS_DNSSD_INCOMPATIBLE,
_CUPS_DNSSD_ERROR
} _cups_dnssd_state_t;
typedef struct _cups_dnssd_data_s /* Enumeration data */
{
# ifdef HAVE_DNSSD
DNSServiceRef main_ref; /* Main service reference */
# else /* HAVE_AVAHI */
AvahiSimplePoll *simple_poll; /* Polling interface */
AvahiClient *client; /* Client information */
int got_data; /* Did we get data? */
# endif /* HAVE_DNSSD */
cups_dest_cb_t cb; /* Callback */
void *user_data; /* User data pointer */
cups_ptype_t type, /* Printer type filter */
@@ -162,11 +141,7 @@ typedef struct _cups_dnssd_data_s /* Enumeration data */
typedef struct _cups_dnssd_device_s /* Enumerated device */
{
_cups_dnssd_state_t state; /* State of device listing */
# ifdef HAVE_DNSSD
DNSServiceRef ref; /* Service reference for query */
# else /* HAVE_AVAHI */
AvahiRecordBrowser *ref; /* Browser for query */
# endif /* HAVE_DNSSD */
char *domain, /* Domain name */
*fullName, /* Full name */
*regtype; /* Registration type */
@@ -190,8 +165,8 @@ typedef struct _cups_dnssd_resolve_s /* Data for resolving URI */
static CFArrayRef appleCopyLocations(void);
static CFStringRef appleCopyNetwork(void);
static char *appleGetPaperSize(char *name, int namesize);
static CFStringRef appleGetPrinter(CFArrayRef locations,
CFStringRef network, CFIndex *locindex);
static CFStringRef appleGetPrinter(CFArrayRef locations, CFStringRef network,
CFIndex *locindex);
#endif /* __APPLE__ */
static cups_dest_t *cups_add_dest(const char *name, const char *instance,
int *num_dests, cups_dest_t **dests);
@@ -200,8 +175,7 @@ static int cups_block_cb(cups_dest_block_t block, unsigned flags,
cups_dest_t *dest);
#endif /* __BLOCKS__ */
static int cups_compare_dests(cups_dest_t *a, cups_dest_t *b);
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
# ifdef HAVE_DNSSD
#ifdef HAVE_DNSSD
static void cups_dnssd_browse_cb(DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
@@ -210,20 +184,6 @@ static void cups_dnssd_browse_cb(DNSServiceRef sdRef,
const char *regtype,
const char *replyDomain,
void *context);
# else /* HAVE_AVAHI */
static void cups_dnssd_browse_cb(AvahiServiceBrowser *browser,
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiBrowserEvent event,
const char *serviceName,
const char *regtype,
const char *replyDomain,
AvahiLookupResultFlags flags,
void *context);
static void cups_dnssd_client_cb(AvahiClient *client,
AvahiClientState state,
void *context);
# endif /* HAVE_DNSSD */
static int cups_dnssd_compare_devices(_cups_dnssd_device_t *a,
_cups_dnssd_device_t *b);
static void cups_dnssd_free_device(_cups_dnssd_device_t *device,
@@ -233,7 +193,6 @@ static _cups_dnssd_device_t *
const char *serviceName,
const char *regtype,
const char *replyDomain);
# ifdef HAVE_DNSSD
static void cups_dnssd_local_cb(DNSServiceRef sdRef,
DNSServiceFlags flags,
uint32_t interfaceIndex,
@@ -250,27 +209,13 @@ static void cups_dnssd_query_cb(DNSServiceRef sdRef,
uint16_t rrtype, uint16_t rrclass,
uint16_t rdlen, const void *rdata,
uint32_t ttl, void *context);
# else /* HAVE_AVAHI */
static int cups_dnssd_poll_cb(struct pollfd *pollfds,
unsigned int num_pollfds,
int timeout, void *context);
static void cups_dnssd_query_cb(AvahiRecordBrowser *browser,
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiBrowserEvent event,
const char *name, uint16_t rrclass,
uint16_t rrtype, const void *rdata,
size_t rdlen,
AvahiLookupResultFlags flags,
void *context);
# endif /* HAVE_DNSSD */
static const char *cups_dnssd_resolve(cups_dest_t *dest, const char *uri,
int msec, int *cancel,
cups_dest_cb_t cb, void *user_data);
static int cups_dnssd_resolve_cb(void *context);
static void cups_dnssd_unquote(char *dst, const char *src,
size_t dstsize);
#endif /* HAVE_DNSSD || HAVE_AVAHI */
#endif /* HAVE_DNSSD */
static int cups_find_dest(const char *name, const char *instance,
int num_dests, cups_dest_t *dests, int prev,
int *rdiff);
@@ -403,6 +348,11 @@ _cupsAppleCopyDefaultPrinter(void)
return (NULL);
}
//# ifdef DEBUG
// CFStringGetCString(network, name, namesize, kCFStringEncodingUTF8);
// DEBUG_printf(("2_cupsUserDefault: network=\"%s\"", name));
//# endif /* DEBUG */
/*
* Lookup the network in the preferences...
*/
@@ -599,7 +549,7 @@ _cupsAppleSetUseLastPrinter(
* to by "cancel" is non-zero, or the callback function (or block) returns 0,
* The caller is responsible for calling httpClose() on the returned object.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
http_t * /* O - Connection to server or @code NULL@ */
@@ -660,14 +610,14 @@ cupsConnectDest(
return (NULL);
}
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
#ifdef HAVE_DNSSD
if (strstr(uri, "._tcp"))
{
if ((uri = cups_dnssd_resolve(dest, uri, msec, cancel, cb,
user_data)) == NULL)
return (NULL);
}
#endif /* HAVE_DNSSD || HAVE_AVAHI */
#endif /* HAVE_DNSSD */
if (httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme),
userpass, sizeof(userpass), hostname, sizeof(hostname),
@@ -765,7 +715,7 @@ cupsConnectDest(
* to by "cancel" is non-zero, or the callback function (or block) returns 0,
* The caller is responsible for calling httpClose() on the returned object.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
http_t * /* O - Connection to server or @code NULL@ */
@@ -791,7 +741,7 @@ cupsConnectDestBlock(
* copy) - for use with the cupsEnumDests* functions. The caller is responsible
* for calling cupsFreeDests() on the returned object(s).
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int
@@ -871,7 +821,7 @@ cupsCopyDest(cups_dest_t *dest,
* Enumeration happens on the current thread and does not return until all
* destinations have been enumerated or the callback function returns 0.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -887,43 +837,34 @@ cupsEnumDests(
{
int i, /* Looping var */
num_dests; /* Number of destinations */
cups_dest_t *dests = NULL, /* Destinations */
cups_dest_t *dests, /* Destinations */
*dest; /* Current destination */
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
int count, /* Number of queries started */
#ifdef HAVE_DNSSD
int nfds, /* Number of files responded */
count, /* Number of queries started */
remaining; /* Remainder of timeout */
_cups_dnssd_data_t data; /* Data for callback */
_cups_dnssd_device_t *device; /* Current device */
# ifdef HAVE_DNSSD
int nfds, /* Number of files responded */
main_fd; /* File descriptor for lookups */
int main_fd; /* File descriptor for lookups */
DNSServiceRef ipp_ref, /* IPP browser */
local_ipp_ref; /* Local IPP browser */
# ifdef HAVE_SSL
# ifdef HAVE_SSL
DNSServiceRef ipps_ref, /* IPPS browser */
local_ipps_ref; /* Local IPPS browser */
# endif /* HAVE_SSL */
# ifdef HAVE_POLL
# endif /* HAVE_SSL */
# ifdef HAVE_POLL
struct pollfd pfd; /* Polling data */
# else
# else
fd_set input; /* Input set for select() */
struct timeval timeout; /* Timeout for select() */
# endif /* HAVE_POLL */
# else /* HAVE_AVAHI */
int error; /* Error value */
AvahiServiceBrowser *ipp_ref; /* IPP browser */
# ifdef HAVE_SSL
AvahiServiceBrowser *ipps_ref; /* IPPS browser */
# endif /* HAVE_SSL */
# endif /* HAVE_DNSSD */
#endif /* HAVE_DNSSD || HAVE_AVAHI */
# endif /* HAVE_POLL */
#endif /* HAVE_DNSSD */
/*
* Range check input...
*/
(void)flags;
if (!cb)
return (0);
@@ -946,7 +887,7 @@ cupsEnumDests(
if (i > 0 || msec == 0)
return (1);
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
#ifdef HAVE_DNSSD
/*
* Get Bonjour-shared printers...
*/
@@ -957,7 +898,6 @@ cupsEnumDests(
NULL, NULL, 0, NULL,
(cups_afree_func_t)cups_dnssd_free_device);
# ifdef HAVE_DNSSD
if (DNSServiceCreateConnection(&data.main_ref) != kDNSServiceErr_NoError)
return (0);
@@ -965,56 +905,27 @@ cupsEnumDests(
ipp_ref = data.main_ref;
DNSServiceBrowse(&ipp_ref, kDNSServiceFlagsShareConnection, 0,
"_ipp._tcp", NULL,
"_ipp._tcp,_cups", NULL,
(DNSServiceBrowseReply)cups_dnssd_browse_cb, &data);
local_ipp_ref = data.main_ref;
DNSServiceBrowse(&local_ipp_ref, kDNSServiceFlagsShareConnection,
kDNSServiceInterfaceIndexLocalOnly,
"_ipp._tcp", NULL,
"_ipp._tcp,_cups", NULL,
(DNSServiceBrowseReply)cups_dnssd_local_cb, &data);
# ifdef HAVE_SSL
# ifdef HAVE_SSL
ipps_ref = data.main_ref;
DNSServiceBrowse(&ipps_ref, kDNSServiceFlagsShareConnection, 0,
"_ipps._tcp", NULL,
"_ipps._tcp,_cups", NULL,
(DNSServiceBrowseReply)cups_dnssd_browse_cb, &data);
local_ipps_ref = data.main_ref;
DNSServiceBrowse(&local_ipps_ref, kDNSServiceFlagsShareConnection,
kDNSServiceInterfaceIndexLocalOnly,
"_ipps._tcp", NULL,
"_ipps._tcp,_cups", NULL,
(DNSServiceBrowseReply)cups_dnssd_local_cb, &data);
# endif /* HAVE_SSL */
# else /* HAVE_AVAHI */
if ((data.simple_poll = avahi_simple_poll_new()) == NULL)
{
DEBUG_puts("cupsEnumDests: Unable to create Avahi simple poll object.");
return (1);
}
avahi_simple_poll_set_func(data.simple_poll, cups_dnssd_poll_cb, &data);
data.client = avahi_client_new(avahi_simple_poll_get(data.simple_poll),
0, cups_dnssd_client_cb, &data,
&error);
if (!data.client)
{
DEBUG_puts("cupsEnumDests: Unable to create Avahi client.");
avahi_simple_poll_free(data.simple_poll);
return (1);
}
ipp_ref = avahi_service_browser_new(data.client, AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, "_ipp._tcp", NULL,
0, cups_dnssd_browse_cb, &data);
# ifdef HAVE_SSL
ipps_ref = avahi_service_browser_new(data.client, AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, "_ipps._tcp", NULL,
0, cups_dnssd_browse_cb, &data);
# endif /* HAVE_SSL */
# endif /* HAVE_DNSSD */
# endif /* HAVE_SSL */
if (msec < 0)
remaining = INT_MAX;
@@ -1027,14 +938,13 @@ cupsEnumDests(
* Check for input...
*/
# ifdef HAVE_DNSSD
# ifdef HAVE_POLL
# ifdef HAVE_POLL
pfd.fd = main_fd;
pfd.events = POLLIN;
nfds = poll(&pfd, 1, remaining > 250 ? 250 : remaining);
# else
# else
FD_ZERO(&input);
FD_SET(main_fd, &input);
@@ -1042,30 +952,13 @@ cupsEnumDests(
timeout.tv_usec = remaining > 250 ? 250000 : remaining * 1000;
nfds = select(main_fd + 1, &input, NULL, NULL, &timeout);
# endif /* HAVE_POLL */
# endif /* HAVE_POLL */
if (nfds > 0)
DNSServiceProcessResult(data.main_ref);
else if (nfds == 0)
remaining -= 250;
# else /* HAVE_AVAHI */
data.got_data = 0;
if ((error = avahi_simple_poll_iterate(data.simple_poll, 250)) > 0)
{
/*
* We've been told to exit the loop. Perhaps the connection to
* Avahi failed.
*/
break;
}
if (!data.got_data)
remaining -= 250;
# endif /* HAVE_DNSSD */
for (device = (_cups_dnssd_device_t *)cupsArrayFirst(data.devices),
count = 0;
device;
@@ -1076,11 +969,10 @@ cupsEnumDests(
if (!device->ref && device->state == _CUPS_DNSSD_NEW)
{
DEBUG_printf(("1cupsEnumDests: Querying '%s'.", device->fullName));
# ifdef HAVE_DNSSD
device->ref = data.main_ref;
DEBUG_printf(("1cupsEnumDests: Querying '%s'.", device->fullName));
if (DNSServiceQueryRecord(&(device->ref),
kDNSServiceFlagsShareConnection,
0, device->fullName,
@@ -1098,39 +990,14 @@ cupsEnumDests(
DEBUG_puts("1cupsEnumDests: Query failed.");
}
# else /* HAVE_AVAHI */
if ((device->ref = avahi_record_browser_new(data.client,
AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC,
device->fullName,
AVAHI_DNS_CLASS_IN,
AVAHI_DNS_TYPE_TXT,
0,
cups_dnssd_query_cb,
&data)) != NULL)
{
count ++;
}
else
{
device->state = _CUPS_DNSSD_ERROR;
DEBUG_printf(("1cupsEnumDests: Query failed: %s",
avahi_strerror(avahi_client_errno(data.client))));
}
# endif /* HAVE_DNSSD */
}
else if (device->ref && device->state == _CUPS_DNSSD_PENDING)
{
if ((device->type & mask) == type)
{
if (!(*cb)(user_data, CUPS_DEST_FLAGS_NONE, &device->dest))
{
remaining = -1;
break;
}
}
if (!(*cb)(user_data, CUPS_DEST_FLAGS_NONE, &device->dest))
{
remaining = -1;
break;
}
device->state = _CUPS_DNSSD_ACTIVE;
}
@@ -1139,27 +1006,16 @@ cupsEnumDests(
cupsArrayDelete(data.devices);
# ifdef HAVE_DNSSD
DNSServiceRefDeallocate(ipp_ref);
DNSServiceRefDeallocate(local_ipp_ref);
# ifdef HAVE_SSL
# ifdef HAVE_SSL
DNSServiceRefDeallocate(ipp_ref);
DNSServiceRefDeallocate(local_ipp_ref);
# endif /* HAVE_SSL */
# endif /* HAVE_SSL */
DNSServiceRefDeallocate(data.main_ref);
# else /* HAVE_AVAHI */
avahi_service_browser_free(ipp_ref);
# ifdef HAVE_SSL
avahi_service_browser_free(ipps_ref);
# endif /* HAVE_SSL */
avahi_client_free(data.client);
avahi_simple_poll_free(data.simple_poll);
# endif /* HAVE_DNSSD */
#endif /* HAVE_DNSSD || HAVE_DNSSD */
#endif /* HAVE_DNSSD */
return (1);
}
@@ -1177,7 +1033,7 @@ cupsEnumDests(
* Enumeration happens on the current thread and does not return until all
* destinations have been enumerated or the block returns 0.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -1357,7 +1213,7 @@ _cupsGetDestResource(
* Free the memory used by the destination array using the @link cupsFreeDests@
* function.
*
* Note: On OS X this function also gets the default paper from the system
* Note: On Mac OS X this function also gets the default paper from the system
* preferences (~/L/P/org.cups.PrintingPrefs.plist) and includes it in the
* options array for each destination that supports it.
*/
@@ -1650,7 +1506,7 @@ cupsGetDests(cups_dest_t **dests) /* O - Destinations */
* Use the @link cupsFreeDests@ function to free the destination list and
* the @link cupsGetDest@ function to find a particular destination.
*
* @since CUPS 1.1.21/OS X 10.4@
* @since CUPS 1.1.21/Mac OS X 10.4@
*/
int /* O - Number of destinations */
@@ -1833,7 +1689,7 @@ cupsGetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
* The returned destination must be freed using @link cupsFreeDests@ with a
* "num_dests" value of 1.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
cups_dest_t * /* O - Destination or @code NULL@ */
@@ -1958,7 +1814,7 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
* @link cupsSetDests@ or @link cupsSetDests2@ functions to save the new
* options for the user.
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - New number of destinations */
@@ -2004,7 +1860,7 @@ cupsRemoveDest(const char *name, /* I - Destination name */
/*
* 'cupsSetDefaultDest()' - Set the default destination.
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
void
@@ -2059,7 +1915,7 @@ cupsSetDests(int num_dests, /* I - Number of destinations */
* This function saves the destinations to /etc/cups/lpoptions when run
* as root and ~/.cups/lpoptions when run as a normal user.
*
* @since CUPS 1.1.21/OS X 10.4@
* @since CUPS 1.1.21/Mac OS X 10.4@
*/
int /* O - 0 on success, -1 on error */
@@ -2078,7 +1934,7 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
#endif /* WIN32 */
char filename[1024]; /* lpoptions file */
int num_temps; /* Number of temporary destinations */
cups_dest_t *temps = NULL, /* Temporary destinations */
cups_dest_t *temps, /* Temporary destinations */
*temp; /* Current temporary dest */
const char *val; /* Value of temporary option */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
@@ -2620,8 +2476,7 @@ cups_compare_dests(cups_dest_t *a, /* I - First destination */
}
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
# ifdef HAVE_DNSSD
#ifdef HAVE_DNSSD
/*
* 'cups_dnssd_browse_cb()' - Browse for printers.
*/
@@ -2662,102 +2517,6 @@ cups_dnssd_browse_cb(
}
# else /* HAVE_AVAHI */
/*
* 'cups_dnssd_browse_cb()' - Browse for printers.
*/
static void
cups_dnssd_browse_cb(
AvahiServiceBrowser *browser, /* I - Browser */
AvahiIfIndex interface, /* I - Interface index (unused) */
AvahiProtocol protocol, /* I - Network protocol (unused) */
AvahiBrowserEvent event, /* I - What happened */
const char *name, /* I - Service name */
const char *type, /* I - Registration type */
const char *domain, /* I - Domain */
AvahiLookupResultFlags flags, /* I - Flags */
void *context) /* I - Devices array */
{
AvahiClient *client = avahi_service_browser_get_client(browser);
/* Client information */
_cups_dnssd_data_t *data = (_cups_dnssd_data_t *)context;
/* Enumeration data */
(void)interface;
(void)protocol;
(void)context;
switch (event)
{
case AVAHI_BROWSER_FAILURE:
DEBUG_printf(("cups_dnssd_browse_cb: %s",
avahi_strerror(avahi_client_errno(client))));
avahi_simple_poll_quit(data->simple_poll);
break;
case AVAHI_BROWSER_NEW:
/*
* This object is new on the network.
*/
if (flags & AVAHI_LOOKUP_RESULT_LOCAL)
{
/*
* This comes from the local machine so ignore it.
*/
DEBUG_printf(("cups_dnssd_browse_cb: Ignoring local service \"%s\".",
name));
}
else
{
/*
* Create a device entry for it if it doesn't yet exist.
*/
cups_dnssd_get_device(data, name, type, domain);
}
break;
case AVAHI_BROWSER_REMOVE:
case AVAHI_BROWSER_ALL_FOR_NOW:
case AVAHI_BROWSER_CACHE_EXHAUSTED:
break;
}
}
/*
* 'cups_dnssd_client_cb()' - Avahi client callback function.
*/
static void
cups_dnssd_client_cb(
AvahiClient *client, /* I - Client information (unused) */
AvahiClientState state, /* I - Current state */
void *context) /* I - User data (unused) */
{
_cups_dnssd_data_t *data = (_cups_dnssd_data_t *)context;
/* Enumeration data */
(void)client;
/*
* If the connection drops, quit.
*/
if (state == AVAHI_CLIENT_FAILURE)
{
DEBUG_puts("cups_dnssd_client_cb: Avahi connection failed.");
avahi_simple_poll_quit(data->simple_poll);
}
}
# endif /* HAVE_DNSSD */
/*
* 'cups_dnssd_compare_device()' - Compare two devices.
*/
@@ -2783,13 +2542,8 @@ cups_dnssd_free_device(
DEBUG_printf(("5cups_dnssd_free_device(device=%p(%s), data=%p)", device,
device->dest.name, data));
# ifdef HAVE_DNSSD
if (device->ref)
DNSServiceRefDeallocate(device->ref);
# else /* HAVE_AVAHI */
if (device->ref)
avahi_record_browser_free(device->ref);
# endif /* HAVE_DNSSD */
_cupsStrFree(device->domain);
_cupsStrFree(device->fullName);
@@ -2899,25 +2653,14 @@ cups_dnssd_get_device(
* Set the "full name" of this service, which is used for queries...
*/
# ifdef HAVE_DNSSD
DNSServiceConstructFullName(fullName, device->dest.name, device->regtype,
device->domain);
# else /* HAVE_AVAHI */
avahi_service_name_join(fullName, kDNSServiceMaxDomainName, serviceName,
regtype, replyDomain);
# endif /* HAVE_DNSSD */
_cupsStrFree(device->fullName);
device->fullName = _cupsStrAlloc(fullName);
if (device->ref)
{
# ifdef HAVE_DNSSD
DNSServiceRefDeallocate(device->ref);
# else /* HAVE_AVAHI */
avahi_record_browser_free(device->ref);
# endif /* HAVE_DNSSD */
device->ref = 0;
}
@@ -2931,7 +2674,6 @@ cups_dnssd_get_device(
}
# ifdef HAVE_DNSSD
/*
* 'cups_dnssd_local_cb()' - Browse for local printers.
*/
@@ -2989,51 +2731,12 @@ cups_dnssd_local_cb(
device->state = _CUPS_DNSSD_LOCAL;
}
# endif /* HAVE_DNSSD */
# ifdef HAVE_AVAHI
/*
* 'cups_dnssd_poll_cb()' - Wait for input on the specified file descriptors.
*
* Note: This function is needed because avahi_simple_poll_iterate is broken
* and always uses a timeout of 0 (!) milliseconds.
* (Avahi Ticket #364)
*/
static int /* O - Number of file descriptors matching */
cups_dnssd_poll_cb(
struct pollfd *pollfds, /* I - File descriptors */
unsigned int num_pollfds, /* I - Number of file descriptors */
int timeout, /* I - Timeout in milliseconds (unused) */
void *context) /* I - User data (unused) */
{
_cups_dnssd_data_t *data = (_cups_dnssd_data_t *)context;
/* Enumeration data */
int val; /* Return value */
(void)timeout;
val = poll(pollfds, num_pollfds, 250);
if (val < 0)
{
DEBUG_printf(("cups_dnssd_poll_cb: %s", strerror(errno)));
}
else if (val > 0)
data->got_data = 1;
return (val);
}
# endif /* HAVE_AVAHI */
/*
* 'cups_dnssd_query_cb()' - Process query data.
*/
# ifdef HAVE_DNSSD
static void
cups_dnssd_query_cb(
DNSServiceRef sdRef, /* I - Service reference */
@@ -3048,25 +2751,6 @@ cups_dnssd_query_cb(
uint32_t ttl, /* I - Time-to-live */
void *context) /* I - Enumeration data */
{
# else /* HAVE_AVAHI */
static void
cups_dnssd_query_cb(
AvahiRecordBrowser *browser, /* I - Record browser */
AvahiIfIndex interfaceIndex,
/* I - Interface index (unused) */
AvahiProtocol protocol, /* I - Network protocol (unused) */
AvahiBrowserEvent event, /* I - What happened? */
const char *fullName, /* I - Service name */
uint16_t rrclass, /* I - Record class */
uint16_t rrtype, /* I - Record type */
const void *rdata, /* I - TXT record */
size_t rdlen, /* I - Length of TXT record */
AvahiLookupResultFlags flags, /* I - Flags */
void *context) /* I - Enumeration data */
{
AvahiClient *client = avahi_record_browser_get_client(browser);
/* Client information */
# endif /* HAVE_DNSSD */
_cups_dnssd_data_t *data = (_cups_dnssd_data_t *)context;
/* Enumeration data */
char name[1024], /* Service name */
@@ -3075,7 +2759,6 @@ cups_dnssd_query_cb(
*device; /* Device */
# ifdef HAVE_DNSSD
DEBUG_printf(("5cups_dnssd_query_cb(sdRef=%p, flags=%x, "
"interfaceIndex=%d, errorCode=%d, fullName=\"%s\", "
"rrtype=%u, rrclass=%u, rdlen=%u, rdata=%p, ttl=%u, "
@@ -3089,27 +2772,6 @@ cups_dnssd_query_cb(
if (errorCode != kDNSServiceErr_NoError || !(flags & kDNSServiceFlagsAdd))
return;
# else /* HAVE_AVAHI */
DEBUG_printf(("5cups_dnssd_query_cb(browser=%p, interfaceIndex=%d, "
"protocol=%d, event=%d, fullName=\"%s\", rrclass=%u, "
"rrtype=%u, rdata=%p, rdlen=%u, flags=%x, context=%p)",
browser, interfaceIndex, protocol, event, fullName, rrclass,
rrtype, rdata, (unsigned)rdlen, flags, context));
/*
* Only process "add" data...
*/
if (event != AVAHI_BROWSER_NEW)
{
if (event == AVAHI_BROWSER_FAILURE)
DEBUG_printf(("cups_dnssd_query_cb: %s",
avahi_strerror(avahi_client_errno(client))));
return;
}
# endif /* HAVE_DNSSD */
/*
* Lookup the service in the devices array.
*/
@@ -3124,7 +2786,8 @@ cups_dnssd_query_cb(
if ((device = cupsArrayFind(data->devices, &dkey)) != NULL)
{
/*
* Found it, pull out the make and model from the TXT record and save it...
* Found it, pull out the priority and make and model from the TXT
* record and save it...
*/
const uint8_t *txt, /* Pointer into data */
@@ -3138,13 +2801,11 @@ cups_dnssd_query_cb(
model[256], /* Model */
uriname[1024], /* Name for URI */
uri[1024]; /* Printer URI */
cups_ptype_t type = CUPS_PRINTER_REMOTE | CUPS_PRINTER_BW;
/* Printer type */
int saw_printer_type = 0;
/* Did we see a printer-type key? */
cups_ptype_t type; /* Device type */
device->state = _CUPS_DNSSD_PENDING;
make_and_model[0] = '\0';
type = CUPS_PRINTER_REMOTE;
strcpy(model, "Unknown");
@@ -3215,102 +2876,19 @@ cups_dnssd_query_cb(
if ((ptr = strchr(model, ',')) != NULL)
*ptr = '\0';
}
else if (!_cups_strcasecmp(key, "note"))
device->dest.num_options = cupsAddOption("printer-location", value,
device->dest.num_options,
&device->dest.options);
else if (!_cups_strcasecmp(key, "pdl"))
{
/*
* Look for PDF-capable printers; only PDF-capable printers are shown.
*/
const char *start, *next; /* Pointer into value */
int have_pdf = 0; /* Have PDF? */
for (start = value; start && *start; start = next)
{
if (!_cups_strncasecmp(start, "application/pdf", 15) &&
(!start[15] || start[15] == ','))
{
have_pdf = 1;
break;
}
if ((next = strchr(start, ',')) != NULL)
next ++;
}
if (!have_pdf)
device->state = _CUPS_DNSSD_INCOMPATIBLE;
}
else if (!_cups_strcasecmp(key, "printer-type"))
{
/*
* Value is either NNNN or 0xXXXX
*/
saw_printer_type = 1;
type = strtol(value, NULL, 0);
}
else if (!saw_printer_type)
{
if (!_cups_strcasecmp(key, "air") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_AUTHENTICATED;
else if (!_cups_strcasecmp(key, "bind") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_BIND;
else if (!_cups_strcasecmp(key, "collate") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_COLLATE;
else if (!_cups_strcasecmp(key, "color") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_COLOR;
else if (!_cups_strcasecmp(key, "copies") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_COPIES;
else if (!_cups_strcasecmp(key, "duplex") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_DUPLEX;
else if (!_cups_strcasecmp(key, "fax") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_MFP;
else if (!_cups_strcasecmp(key, "papercustom") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_VARIABLE;
else if (!_cups_strcasecmp(key, "papermax"))
{
if (!_cups_strcasecmp(value, "legal-a4"))
type |= CUPS_PRINTER_SMALL;
else if (!_cups_strcasecmp(value, "isoc-a2"))
type |= CUPS_PRINTER_MEDIUM;
else if (!_cups_strcasecmp(value, ">isoc-a2"))
type |= CUPS_PRINTER_LARGE;
}
else if (!_cups_strcasecmp(key, "punch") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_PUNCH;
else if (!_cups_strcasecmp(key, "scan") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_MFP;
else if (!_cups_strcasecmp(key, "sort") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_SORT;
else if (!_cups_strcasecmp(key, "staple") &&
!_cups_strcasecmp(value, "t"))
type |= CUPS_PRINTER_STAPLE;
device->dest.num_options = cupsAddOption("printer-type", value,
device->dest.num_options,
&device->dest.options);
type = strtol(value, NULL, 0);
}
}
/*
* Save the printer-xxx values...
* Save the make-and-model...
*/
device->dest.num_options = cupsAddOption("printer-info", name,
device->dest.num_options,
&device->dest.options);
if (make_and_model[0])
{
strlcat(make_and_model, " ", sizeof(make_and_model));
@@ -3327,12 +2905,6 @@ cups_dnssd_query_cb(
device->dest.num_options,
&device->dest.options);
device->type = type;
snprintf(value, sizeof(value), "%u", type);
device->dest.num_options = cupsAddOption("printer-type", value,
device->dest.num_options,
&device->dest.options);
/*
* Save the URI...
*/
@@ -3340,7 +2912,7 @@ cups_dnssd_query_cb(
cups_dnssd_unquote(uriname, device->fullName, sizeof(uriname));
httpAssembleURI(HTTP_URI_CODING_ALL, uri, sizeof(uri),
!strcmp(device->regtype, "_ipps._tcp") ? "ipps" : "ipp",
NULL, uriname, 0, saw_printer_type ? "/cups" : "/");
NULL, uriname, 0, "/cups");
DEBUG_printf(("6cups_dnssd_query: printer-uri-supported=\"%s\"", uri));
+9 -9
Ver Arquivo
@@ -5,7 +5,7 @@
*
* This set of APIs abstracts enumeration of directory entries.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -79,7 +79,7 @@ _cups_dir_time(FILETIME ft) /* I - File time */
/*
* 'cupsDirClose()' - Close a directory.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void
@@ -110,7 +110,7 @@ cupsDirClose(cups_dir_t *dp) /* I - Directory pointer */
/*
* 'cupsDirOpen()' - Open a directory.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_dir_t * /* O - Directory pointer or @code NULL@ if the directory could not be opened. */
@@ -153,7 +153,7 @@ cupsDirOpen(const char *directory) /* I - Directory name */
/*
* 'cupsDirRead()' - Read the next directory entry.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_dentry_t * /* O - Directory entry or @code NULL@ if there are no more */
@@ -213,7 +213,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
/*
* 'cupsDirRewind()' - Rewind to the start of the directory.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void
@@ -263,7 +263,7 @@ struct _cups_dir_s /**** Directory data structure ****/
/*
* 'cupsDirClose()' - Close a directory.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void
@@ -290,7 +290,7 @@ cupsDirClose(cups_dir_t *dp) /* I - Directory pointer */
/*
* 'cupsDirOpen()' - Open a directory.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_dir_t * /* O - Directory pointer or @code NULL@ if the directory could not be opened. */
@@ -344,7 +344,7 @@ cupsDirOpen(const char *directory) /* I - Directory name */
/*
* 'cupsDirRead()' - Read the next directory entry.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_dentry_t * /* O - Directory entry or @code NULL@ when there are no more */
@@ -442,7 +442,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
/*
* 'cupsDirRewind()' - Rewind to the start of the directory.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void
+10 -22
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD code emission routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -87,7 +87,7 @@ ppdCollect(ppd_file_t *ppd, /* I - PPD file data */
* The choices array should be freed using @code free@ when you are
* finished with it.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Number of options marked */
@@ -260,7 +260,7 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */
*
* When "limit" is zero, this function is identical to ppdEmit().
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on failure */
@@ -519,27 +519,15 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
*/
if (display && strcmp(display->value, "job"))
{
fprintf(fp, "@PJL JOB NAME = \"%s\"\n", temp);
else if (display && !strcmp(display->value, "rdymsg"))
fprintf(fp, "@PJL RDYMSG DISPLAY = \"%s\"\n", displaymsg);
if (display && !strcmp(display->value, "rdymsg"))
fprintf(fp, "@PJL RDYMSG DISPLAY = \"%s\"\n", displaymsg);
}
else
fprintf(fp, "@PJL JOB NAME = \"%s\" DISPLAY = \"%s\"\n", temp,
displaymsg);
/*
* Replace double quotes with single quotes and UTF-8 characters with
* question marks so that the user does not cause a PJL syntax error.
*/
strlcpy(temp, user, sizeof(temp));
for (ptr = temp; *ptr; ptr ++)
if (*ptr == '\"')
*ptr = '\'';
else if (!charset && (*ptr & 128))
*ptr = '?';
fprintf(fp, "@PJL SET USERNAME = \"%s\"\n", temp);
}
else
fputs(ppd->jcl_begin, fp);
@@ -554,7 +542,7 @@ ppdEmitJCL(ppd_file_t *ppd, /* I - PPD file record */
/*
* 'ppdEmitJCLEnd()' - Emit JCLEnd code to a file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on failure */
@@ -613,7 +601,7 @@ ppdEmitJCLEnd(ppd_file_t *ppd, /* I - PPD file record */
* The return string is allocated on the heap and should be freed using
* @code free@ when you are done with it.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - String containing option code or @code NULL@ if there is no option code */
+3 -4
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Option encoding routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -227,7 +227,7 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
* function multiple times for each group, or use cupsEncodeOptions()
* to add the standard groups.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void
@@ -539,8 +539,7 @@ cupsEncodeOptions2(
else
attr->values[j].resolution.yres = attr->values[j].resolution.xres;
if (!_cups_strcasecmp(s, "dpc") ||
!_cups_strcasecmp(s, "dpcm"))
if (!_cups_strcasecmp(s, "dpc"))
attr->values[j].resolution.units = IPP_RES_PER_CM;
else
attr->values[j].resolution.units = IPP_RES_PER_INCH;
+28 -28
Ver Arquivo
@@ -8,7 +8,7 @@
* our own file functions allows us to provide transparent support of
* gzip'd print files, PPD files, etc.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -352,7 +352,7 @@ _cupsFileCheckFilter(
/*
* 'cupsFileClose()' - Close a CUPS file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
@@ -484,7 +484,7 @@ cupsFileClose(cups_file_t *fp) /* I - CUPS file */
/*
* 'cupsFileCompression()' - Return whether a file is compressed.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - @code CUPS_FILE_NONE@ or @code CUPS_FILE_GZIP@ */
@@ -497,7 +497,7 @@ cupsFileCompression(cups_file_t *fp) /* I - CUPS file */
/*
* 'cupsFileEOF()' - Return the end-of-file status.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on end of file, 0 otherwise */
@@ -516,7 +516,7 @@ cupsFileEOF(cups_file_t *fp) /* I - CUPS file */
* the supplied paths, @code NULL@ is returned. A @code NULL@ path only
* matches the current directory.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - Full path to file or @code NULL@ if not found */
@@ -619,7 +619,7 @@ cupsFileFind(const char *filename, /* I - File to find */
/*
* 'cupsFileFlush()' - Flush pending output.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
@@ -667,7 +667,7 @@ cupsFileFlush(cups_file_t *fp) /* I - CUPS file */
/*
* 'cupsFileGetChar()' - Get a single character from a file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Character or -1 on end of file */
@@ -711,7 +711,7 @@ cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
/*
* 'cupsFileGetConf()' - Get a line from a configuration file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Line read or @code NULL@ on end of file or error */
@@ -855,7 +855,7 @@ cupsFileGetConf(cups_file_t *fp, /* I - CUPS file */
* nul-terminated, however you should use the returned length to determine
* the number of bytes on the line.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
size_t /* O - Number of bytes on line or 0 on end of file */
@@ -930,7 +930,7 @@ cupsFileGetLine(cups_file_t *fp, /* I - File to read from */
/*
* 'cupsFileGets()' - Get a CR and/or LF-terminated line.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Line read or @code NULL@ on end of file or error */
@@ -1012,7 +1012,7 @@ cupsFileGets(cups_file_t *fp, /* I - CUPS file */
/*
* 'cupsFileLock()' - Temporarily lock access to a file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
@@ -1041,7 +1041,7 @@ cupsFileLock(cups_file_t *fp, /* I - CUPS file */
/*
* 'cupsFileNumber()' - Return the file descriptor associated with a CUPS file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - File descriptor */
@@ -1070,7 +1070,7 @@ cupsFileNumber(cups_file_t *fp) /* I - CUPS file */
* connection as needed, generally preferring IPv6 connections when there is
* a choice.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file or @code NULL@ if the file or socket cannot be opened */
@@ -1192,7 +1192,7 @@ cupsFileOpen(const char *filename, /* I - Name of file */
* supplied which enables Flate compression of the file. Compression is
* not supported for the "a" (append) mode.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file or @code NULL@ if the file could not be opened */
@@ -1304,7 +1304,7 @@ cupsFileOpenFd(int fd, /* I - File descriptor */
/*
* 'cupsFilePeekChar()' - Peek at the next character from a file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Character or -1 on end of file */
@@ -1336,7 +1336,7 @@ cupsFilePeekChar(cups_file_t *fp) /* I - CUPS file */
/*
* 'cupsFilePrintf()' - Write a formatted string.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Number of bytes written or -1 on error */
@@ -1433,7 +1433,7 @@ cupsFilePrintf(cups_file_t *fp, /* I - CUPS file */
/*
* 'cupsFilePutChar()' - Write a character.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
@@ -1487,7 +1487,7 @@ cupsFilePutChar(cups_file_t *fp, /* I - CUPS file */
*
* This function handles any comment escaping of the value.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
ssize_t /* O - Number of bytes written or -1 on error */
@@ -1548,7 +1548,7 @@ cupsFilePutConf(cups_file_t *fp, /* I - CUPS file */
*
* Like the @code fputs@ function, no newline is appended to the string.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Number of bytes written or -1 on error */
@@ -1612,7 +1612,7 @@ cupsFilePuts(cups_file_t *fp, /* I - CUPS file */
/*
* 'cupsFileRead()' - Read from a file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Number of bytes read or -1 on error */
@@ -1689,7 +1689,7 @@ cupsFileRead(cups_file_t *fp, /* I - CUPS file */
* 'cupsFileRewind()' - Set the current file position to the beginning of the
* file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
off_t /* O - New file position or -1 on error */
@@ -1761,7 +1761,7 @@ cupsFileRewind(cups_file_t *fp) /* I - CUPS file */
/*
* 'cupsFileSeek()' - Seek in a file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
off_t /* O - New file position or -1 on error */
@@ -1914,7 +1914,7 @@ cupsFileSeek(cups_file_t *fp, /* I - CUPS file */
/*
* 'cupsFileStderr()' - Return a CUPS file associated with stderr.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file */
@@ -1950,7 +1950,7 @@ cupsFileStderr(void)
/*
* 'cupsFileStdin()' - Return a CUPS file associated with stdin.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file */
@@ -1980,7 +1980,7 @@ cupsFileStdin(void)
/*
* 'cupsFileStdout()' - Return a CUPS file associated with stdout.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file */
@@ -2016,7 +2016,7 @@ cupsFileStdout(void)
/*
* 'cupsFileTell()' - Return the current file position.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
off_t /* O - File position */
@@ -2033,7 +2033,7 @@ cupsFileTell(cups_file_t *fp) /* I - CUPS file */
/*
* 'cupsFileUnlock()' - Unlock access to a file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
@@ -2063,7 +2063,7 @@ cupsFileUnlock(cups_file_t *fp) /* I - CUPS file */
/*
* 'cupsFileWrite()' - Write to a file.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Number of bytes written or -1 on error */
+2 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* cupsGetDevices implementation for CUPS.
*
* Copyright 2008-2012 by Apple Inc.
* Copyright 2008-2011 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -34,7 +34,7 @@
* parameters provide comma-delimited lists of backends to include or omit from
* the request respectively.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
ipp_status_t /* O - Request status - @code IPP_OK@ on success. */
+5 -5
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Get/put file functions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -41,7 +41,7 @@
*
* This function returns @code HTTP_OK@ when the file is successfully retrieved.
*
* @since CUPS 1.1.20/OS X 10.4@
* @since CUPS 1.1.20/Mac OS X 10.4@
*/
http_status_t /* O - HTTP status */
@@ -187,7 +187,7 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
*
* This function returns @code HTTP_OK@ when the file is successfully retrieved.
*
* @since CUPS 1.1.20/OS X 10.4@
* @since CUPS 1.1.20/Mac OS X 10.4@
*/
http_status_t /* O - HTTP status */
@@ -255,7 +255,7 @@ cupsGetFile(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DE
* This function returns @code HTTP_CREATED@ when the file is stored
* successfully.
*
* @since CUPS 1.1.20/OS X 10.4@
* @since CUPS 1.1.20/Mac OS X 10.4@
*/
http_status_t /* O - HTTP status */
@@ -446,7 +446,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
* This function returns @code HTTP_CREATED@ when the file is stored
* successfully.
*
* @since CUPS 1.1.20/OS X 10.4@
* @since CUPS 1.1.20/Mac OS X 10.4@
*/
http_status_t /* O - HTTP status */
+19 -49
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Global variable access routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -20,7 +20,6 @@
* _cupsGlobals() - Return a pointer to thread local storage
* _cupsGlobalUnlock() - Unlock the global mutex.
* DllMain() - Main entry for library.
* cups_fix_path() - Fix a file path to use forward slashes consistently.
* cups_globals_alloc() - Allocate and initialize global data.
* cups_globals_free() - Free global data.
* cups_globals_init() - Initialize environment variables.
@@ -44,23 +43,16 @@ static _cups_threadkey_t cups_globals_key = _CUPS_THREADKEY_INITIALIZER;
static pthread_once_t cups_globals_key_once = PTHREAD_ONCE_INIT;
/* One-time initialization object */
#endif /* HAVE_PTHREAD_H */
#if defined(HAVE_PTHREAD_H) || defined(WIN32)
static _cups_mutex_t cups_global_mutex = _CUPS_MUTEX_INITIALIZER;
/* Global critical section */
#endif /* HAVE_PTHREAD_H || WIN32 */
/*
* Local functions...
*/
#ifdef WIN32
static void cups_fix_path(char *path);
#endif /* WIN32 */
static _cups_globals_t *cups_globals_alloc(void);
#if defined(HAVE_PTHREAD_H) || defined(WIN32)
static void cups_globals_free(_cups_globals_t *g);
#endif /* HAVE_PTHREAD_H || WIN32 */
#ifdef HAVE_PTHREAD_H
static void cups_globals_init(void);
#endif /* HAVE_PTHREAD_H */
@@ -195,9 +187,9 @@ cups_globals_alloc(void)
#ifdef WIN32
HKEY key; /* Registry key */
DWORD size; /* Size of string */
static char installdir[1024] = "", /* Install directory */
confdir[1024] = "", /* Server root directory */
localedir[1024] = ""; /* Locale directory */
static char installdir[1024], /* Install directory */
confdir[1024], /* Server root directory */
localedir[1024]; /* Locale directory */
#endif /* WIN32 */
@@ -221,47 +213,27 @@ cups_globals_alloc(void)
*/
#ifdef WIN32
if (!installdir[0])
/*
* Open the registry...
*/
strcpy(installdir, "C:/Program Files/cups.org");
if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\cups.org", 0, KEY_READ,
&key))
{
/*
* Open the registry...
* Grab the installation directory...
*/
strcpy(installdir, "C:/Program Files/cups.org");
if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\cups.org", 0, KEY_READ,
&key))
{
/*
* Grab the installation directory...
*/
char *ptr; /* Pointer into installdir */
size = sizeof(installdir);
RegQueryValueEx(key, "installdir", NULL, NULL, installdir, &size);
RegCloseKey(key);
for (ptr = installdir; *ptr;)
{
if (*ptr == '\\')
{
if (ptr[1])
*ptr++ = '/';
else
*ptr = '\0'; /* Strip trailing \ */
}
else if (*ptr == '/' && !ptr[1])
*ptr = '\0'; /* Strip trailing / */
else
ptr ++;
}
}
snprintf(confdir, sizeof(confdir), "%s/conf", installdir);
snprintf(localedir, sizeof(localedir), "%s/locale", installdir);
size = sizeof(installdir);
RegQueryValueEx(key, "installdir", NULL, NULL, installdir, &size);
RegCloseKey(key);
}
snprintf(confdir, sizeof(confdir), "%s/conf", installdir);
snprintf(localedir, sizeof(localedir), "%s/locale", installdir);
if ((cg->cups_datadir = getenv("CUPS_DATADIR")) == NULL)
cg->cups_datadir = installdir;
@@ -326,7 +298,6 @@ cups_globals_alloc(void)
* 'cups_globals_free()' - Free global data.
*/
#if defined(HAVE_PTHREAD_H) || defined(WIN32)
static void
cups_globals_free(_cups_globals_t *cg) /* I - Pointer to global data */
{
@@ -359,7 +330,6 @@ cups_globals_free(_cups_globals_t *cg) /* I - Pointer to global data */
free(cg);
}
#endif /* HAVE_PTHREAD_H || WIN32 */
#ifdef HAVE_PTHREAD_H
+12 -10
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTTP address routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -34,16 +34,18 @@
#ifdef HAVE_RESOLV_H
# include <resolv.h>
#endif /* HAVE_RESOLV_H */
#ifdef __APPLE__
#ifdef HAVE_COREFOUNDATION
# include <CoreFoundation/CoreFoundation.h>
#endif /* HAVE_COREFOUNDATION */
#ifdef HAVE_SYSTEMCONFIGURATION
# include <SystemConfiguration/SystemConfiguration.h>
#endif /* __APPLE__ */
#endif /* HAVE_SYSTEMCONFIGURATION */
/*
* 'httpAddrAny()' - Check for the "any" address.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 if "any", 0 otherwise */
@@ -69,7 +71,7 @@ httpAddrAny(const http_addr_t *addr) /* I - Address to check */
/*
* 'httpAddrEqual()' - Compare two addresses.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 if equal, 0 if not */
@@ -102,7 +104,7 @@ httpAddrEqual(const http_addr_t *addr1, /* I - First address */
/*
* 'httpAddrLength()' - Return the length of the address in bytes.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Length in bytes */
@@ -133,7 +135,7 @@ httpAddrLength(const http_addr_t *addr) /* I - Address */
/*
* 'httpAddrLocalhost()' - Check for the local loopback address.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 if local host, 0 otherwise */
@@ -172,7 +174,7 @@ httpAddrLocalhost(
/*
* 'httpAddrLookup()' - Lookup the hostname associated with the address.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Host name */
@@ -340,7 +342,7 @@ _httpAddrSetPort(http_addr_t *addr, /* I - Address */
/*
* 'httpAddrString()' - Convert an address to a numeric string.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Numeric address string */
@@ -614,7 +616,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
* Otherwise, return the FQDN for the local system using both gethostname()
* and gethostbyname() to get the local hostname with domain.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - FQDN for connection or system */
+13 -26
Ver Arquivo
@@ -32,15 +32,12 @@
#ifdef HAVE_POLL
# include <poll.h>
#endif /* HAVE_POLL */
#ifndef WIN32
# include <sys/fcntl.h>
#endif /* WIN32 */
/*
* 'httpAddrConnect()' - Connect to any of the addresses in the list.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
http_addrlist_t * /* O - Connected address or NULL on failure */
@@ -58,7 +55,7 @@ httpAddrConnect(
* 'httpAddrConnect2()' - Connect to any of the addresses in the list with a
* timeout and optional cancel.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
http_addrlist_t * /* O - Connected address or NULL on failure */
@@ -71,7 +68,6 @@ httpAddrConnect2(
int val; /* Socket option value */
#ifdef O_NONBLOCK
socklen_t len; /* Length of value */
http_addr_t peer; /* Peer address */
int flags, /* Socket flags */
remaining; /* Remaining timeout */
# ifdef HAVE_POLL
@@ -101,7 +97,7 @@ httpAddrConnect2(
if (cancel && *cancel)
return (NULL);
if (msec <= 0 || getenv("CUPS_DISABLE_ASYNC_CONNECT"))
if (msec <= 0)
msec = INT_MAX;
/*
@@ -110,9 +106,6 @@ httpAddrConnect2(
while (addrlist)
{
if (cancel && *cancel)
return (NULL);
/*
* Create the socket...
*/
@@ -184,12 +177,8 @@ httpAddrConnect2(
DEBUG_printf(("httpAddrConnect2: Setting non-blocking connect()"));
flags = fcntl(*sock, F_GETFL, 0);
if (msec != INT_MAX)
{
DEBUG_puts("httpAddrConnect2: Setting non-blocking connect()");
if (msec > 0)
fcntl(*sock, F_SETFL, flags | O_NONBLOCK);
}
#endif /* O_NONBLOCK */
/*
@@ -212,16 +201,13 @@ httpAddrConnect2(
#ifdef O_NONBLOCK
# ifdef WIN32
if (WSAGetLastError() == WSAEINPROGRESS ||
WSAGetLastError() == WSAEWOULDBLOCK)
if (errno == WSAEINPROGRESS)
# else
if (errno == EINPROGRESS || errno == EWOULDBLOCK)
if (errno == EINPROGRESS)
# endif /* WIN32 */
{
DEBUG_puts("1httpAddrConnect2: Finishing async connect()");
fcntl(*sock, F_SETFL, flags);
for (remaining = msec; remaining > 0; remaining -= 250)
{
do
@@ -277,13 +263,14 @@ httpAddrConnect2(
if (nfds > 0)
{
len = sizeof(peer);
if (!getpeername(*sock, (struct sockaddr *)&peer, &len))
len = sizeof(val);
if (getsockopt(*sock, SOL_SOCKET, SO_ERROR, &val, &len) >= 0)
{
DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...",
httpAddrString(&peer, temp, sizeof(temp)),
_httpAddrPort(&peer)));
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
_httpAddrPort(&(addrlist->addr))));
fcntl(*sock, F_SETFL, flags);
return (addrlist);
}
@@ -330,7 +317,7 @@ httpAddrConnect2(
/*
* 'httpAddrFreeList()' - Free an address list.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void
@@ -358,7 +345,7 @@ httpAddrFreeList(
/*
* 'httpAddrGetList()' - Get a list of addresses for a hostname.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
http_addrlist_t * /* O - List of addresses or NULL */
+1 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Private HTTP definitions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -154,7 +154,6 @@ extern "C" {
#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 */
#define _HTTP_RESOLVE_FAXOUT 4 /* Resolve FaxOut service? */
/*
+86 -454
Ver Arquivo
@@ -3,7 +3,7 @@
*
* HTTP support routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -16,37 +16,33 @@
*
* Contents:
*
* httpAssembleURI() - Assemble a uniform resource identifier from its
* components.
* httpAssembleURI() - Assemble a uniform resource identifier from its
* components.
* httpAssembleURIf() - Assemble a uniform resource identifier from its
* components with a formatted resource.
* components with a formatted resource.
* _httpAssembleUUID() - Make a UUID URI conforming to RFC 4122.
* httpDecode64() - Base64-decode a string.
* httpDecode64_2() - Base64-decode a string.
* httpEncode64() - Base64-encode a string.
* httpEncode64_2() - Base64-encode a string.
* httpDecode64() - Base64-decode a string.
* httpDecode64_2() - Base64-decode a string.
* httpEncode64() - Base64-encode a string.
* httpEncode64_2() - Base64-encode a string.
* httpGetDateString() - Get a formatted date/time string from a time value.
* httpGetDateString2() - Get a formatted date/time string from a time value.
* httpGetDateTime() - Get a time value from a formatted date/time string.
* httpSeparate() - Separate a Universal Resource Identifier into its
* components.
* httpSeparate2() - Separate a Universal Resource Identifier into its
* components.
* httpSeparateURI() - Separate a Universal Resource Identifier into its
* components.
* httpStatus() - Return a short string describing a HTTP status
* code.
* _cups_hstrerror() - hstrerror() emulation function for Solaris and
* others.
* _httpDecodeURI() - Percent-decode a HTTP request URI.
* _httpEncodeURI() - Percent-encode a HTTP request URI.
* _httpResolveURI() - Resolve a DNS-SD URI.
* http_client_cb() - Client callback for resolving URI.
* httpGetDateTime() - Get a time value from a formatted date/time string.
* httpSeparate() - Separate a Universal Resource Identifier into its
* components.
* httpSeparate2() - Separate a Universal Resource Identifier into its
* components.
* httpSeparateURI() - Separate a Universal Resource Identifier into its
* components.
* httpStatus() - Return a short string describing a HTTP status code.
* _cups_hstrerror() - hstrerror() emulation function for Solaris and
* others.
* _httpDecodeURI() - Percent-decode a HTTP request URI.
* _httpEncodeURI() - Percent-encode a HTTP request URI.
* _httpResolveURI() - Resolve a DNS-SD URI.
* http_copy_decode() - Copy and decode a URI.
* http_copy_encode() - Copy and encode a URI.
* http_poll_cb() - Wait for input on the specified file descriptors.
* http_resolve_cb() - Build a device URI for the given service name.
* http_resolve_cb() - Build a device URI for the given service name.
* http_resolve_cb() - Build a device URI for the given service name.
*/
/*
@@ -63,10 +59,6 @@
# else
# include <sys/select.h>
# endif /* WIN32 */
#elif defined(HAVE_AVAHI)
# include <avahi-client/client.h>
# include <avahi-client/lookup.h>
# include <avahi-common/simple-watch.h>
#endif /* HAVE_DNSSD */
@@ -76,12 +68,9 @@
typedef struct _http_uribuf_s /* URI buffer */
{
#ifdef HAVE_AVAHI
AvahiSimplePoll *poll; /* Poll state */
#endif /* HAVE_AVAHI */
char *buffer; /* Pointer to buffer */
size_t bufsize; /* Size of buffer */
int options; /* Options passed to _httpResolveURI */
char *buffer; /* Pointer to buffer */
size_t bufsize; /* Size of buffer */
int options; /* Options passed to _httpResolveURI */
} _http_uribuf_t;
@@ -138,22 +127,6 @@ static void DNSSD_API http_resolve_cb(DNSServiceRef sdRef,
void *context);
#endif /* HAVE_DNSSD */
#ifdef HAVE_AVAHI
static void http_client_cb(AvahiClient *client,
AvahiClientState state, void *simple_poll);
static int http_poll_cb(struct pollfd *pollfds, unsigned int num_pollfds,
int timeout, void *context);
static void http_resolve_cb(AvahiServiceResolver *resolver,
AvahiIfIndex interface,
AvahiProtocol protocol,
AvahiResolverEvent event,
const char *name, const char *type,
const char *domain, const char *host_name,
const AvahiAddress *address, uint16_t port,
AvahiStringList *txt,
AvahiLookupResultFlags flags, void *context);
#endif /* HAVE_AVAHI */
/*
* 'httpAssembleURI()' - Assemble a uniform resource identifier from its
@@ -164,7 +137,7 @@ static void http_resolve_cb(AvahiServiceResolver *resolver,
* place of traditional string functions whenever you need to create a
* URI string.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
http_uri_status_t /* O - URI status */
@@ -414,7 +387,7 @@ httpAssembleURI(
* this function in place of traditional string functions whenever
* you need to create a URI string.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
http_uri_status_t /* O - URI status */
@@ -544,7 +517,7 @@ httpDecode64(char *out, /* I - String to write to */
/*
* 'httpDecode64_2()' - Base64-decode a string.
*
* @since CUPS 1.1.21/OS X 10.4@
* @since CUPS 1.1.21/Mac OS X 10.4@
*/
char * /* O - Decoded string */
@@ -663,7 +636,7 @@ httpEncode64(char *out, /* I - String to write to */
/*
* 'httpEncode64_2()' - Base64-encode a string.
*
* @since CUPS 1.1.21/OS X 10.4@
* @since CUPS 1.1.21/Mac OS X 10.4@
*/
char * /* O - Encoded string */
@@ -772,7 +745,7 @@ httpGetDateString(time_t t) /* I - UNIX time */
/*
* 'httpGetDateString2()' - Get a formatted date/time string from a time value.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - Date/time string */
@@ -784,13 +757,10 @@ httpGetDateString2(time_t t, /* I - UNIX time */
tdate = gmtime(&t);
if (tdate)
snprintf(s, slen, "%s, %02d %s %d %02d:%02d:%02d GMT",
http_days[tdate->tm_wday], tdate->tm_mday,
http_months[tdate->tm_mon], tdate->tm_year + 1900,
tdate->tm_hour, tdate->tm_min, tdate->tm_sec);
else
s[0] = '\0';
snprintf(s, slen, "%s, %02d %s %d %02d:%02d:%02d GMT",
http_days[tdate->tm_wday], tdate->tm_mday,
http_months[tdate->tm_mon], tdate->tm_year + 1900,
tdate->tm_hour, tdate->tm_min, tdate->tm_sec);
return (s);
}
@@ -892,7 +862,7 @@ httpSeparate(const char *uri, /* I - Universal Resource Identifier */
*
* This function is deprecated; use the httpSeparateURI() function instead.
*
* @since CUPS 1.1.21/OS X 10.4@
* @since CUPS 1.1.21/Mac OS X 10.4@
* @deprecated@
*/
@@ -917,7 +887,7 @@ httpSeparate2(const char *uri, /* I - Universal Resource Identifier */
* 'httpSeparateURI()' - Separate a Universal Resource Identifier into its
* components.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
http_uri_status_t /* O - Result of separation */
@@ -1461,29 +1431,24 @@ _httpResolveURI(
if (strstr(hostname, "._tcp"))
{
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
char *regtype, /* Pointer to type in hostname */
*domain; /* Pointer to domain in hostname */
_http_uribuf_t uribuf; /* URI buffer */
int offline = 0; /* offline-report state set? */
# ifdef HAVE_DNSSD
# ifdef WIN32
# pragma comment(lib, "dnssd.lib")
# endif /* WIN32 */
#ifdef HAVE_DNSSD
# ifdef WIN32
# pragma comment(lib, "dnssd.lib")
# endif /* WIN32 */
DNSServiceRef ref, /* DNS-SD master service reference */
domainref, /* DNS-SD service reference for domain */
localref; /* DNS-SD service reference for .local */
int domainsent = 0; /* Send the domain resolve? */
# ifdef HAVE_POLL
int domainsent = 0, /* Send the domain resolve? */
offline = 0; /* offline-report state set? */
char *regtype, /* Pointer to type in hostname */
*domain; /* Pointer to domain in hostname */
_http_uribuf_t uribuf; /* URI buffer */
#ifdef HAVE_POLL
struct pollfd polldata; /* Polling data */
# else /* select() */
#else /* select() */
fd_set input_set; /* Input set for select() */
struct timeval stimeout; /* Timeout value for select() */
# endif /* HAVE_POLL */
# elif defined(HAVE_AVAHI)
AvahiClient *client; /* Client information */
int error; /* Status */
# endif /* HAVE_DNSSD */
#endif /* HAVE_POLL */
if (options & _HTTP_RESOLVE_STDERR)
fprintf(stderr, "DEBUG: Resolving \"%s\"...\n", hostname);
@@ -1523,7 +1488,6 @@ _httpResolveURI(
uribuf.buffer = resolved_uri;
uribuf.bufsize = resolved_size;
uribuf.options = options;
resolved_uri[0] = '\0';
DEBUG_printf(("6_httpResolveURI: Resolving hostname=\"%s\", regtype=\"%s\", "
@@ -1537,22 +1501,18 @@ _httpResolveURI(
uri = NULL;
# ifdef HAVE_DNSSD
if (DNSServiceCreateConnection(&ref) == kDNSServiceErr_NoError)
{
localref = ref;
if (DNSServiceResolve(&localref,
kDNSServiceFlagsShareConnection, 0, hostname, regtype,
"local.", http_resolve_cb,
if (DNSServiceResolve(&localref, kDNSServiceFlagsShareConnection, 0,
hostname, regtype, "local.", http_resolve_cb,
&uribuf) == kDNSServiceErr_NoError)
{
int fds; /* Number of ready descriptors */
time_t timeout, /* Poll timeout */
start_time = time(NULL),/* Start time */
end_time = start_time + 90;
/* End time */
start_time = time(NULL);/* Start time */
while (time(NULL) < end_time)
for (;;)
{
if (options & _HTTP_RESOLVE_STDERR)
_cupsLangPrintFilter(stderr, "INFO", _("Looking for printer."));
@@ -1564,32 +1524,28 @@ _httpResolveURI(
}
/*
* Wakeup every 2 seconds to emit a "looking for printer" message...
* For the first minute (or forever if we have a callback), wakeup
* every 2 seconds to emit a "looking for printer" message...
*/
if ((timeout = end_time - time(NULL)) > 2)
timeout = 2;
timeout = (time(NULL) < (start_time + 60) || cb) ? 2000 : -1;
# ifdef HAVE_POLL
#ifdef HAVE_POLL
polldata.fd = DNSServiceRefSockFD(ref);
polldata.events = POLLIN;
fds = poll(&polldata, 1, 1000 * timeout);
fds = poll(&polldata, 1, timeout);
# else /* select() */
#else /* select() */
FD_ZERO(&input_set);
FD_SET(DNSServiceRefSockFD(ref), &input_set);
# ifdef WIN32
stimeout.tv_sec = (long)timeout;
# else
stimeout.tv_sec = timeout;
# endif /* WIN32 */
stimeout.tv_usec = 0;
stimeout.tv_sec = ((int)timeout) / 1000;
stimeout.tv_usec = ((int)(timeout) * 1000) % 1000000;
fds = select(DNSServiceRefSockFD(ref)+1, &input_set, NULL, NULL,
&stimeout);
# endif /* HAVE_POLL */
timeout < 0.0 ? NULL : &stimeout);
#endif /* HAVE_POLL */
if (fds < 0)
{
@@ -1606,7 +1562,7 @@ _httpResolveURI(
* comes in, do an additional domain resolution...
*/
if (domainsent == 0 && domain && _cups_strcasecmp(domain, "local."))
if (domainsent == 0 && (domain && _cups_strcasecmp(domain, "local.")))
{
if (options & _HTTP_RESOLVE_STDERR)
fprintf(stderr,
@@ -1615,11 +1571,10 @@ _httpResolveURI(
domain ? domain : "");
domainref = ref;
if (DNSServiceResolve(&domainref,
kDNSServiceFlagsShareConnection,
if (DNSServiceResolve(&domainref, kDNSServiceFlagsShareConnection,
0, hostname, regtype, domain,
http_resolve_cb,
&uribuf) == kDNSServiceErr_NoError)
http_resolve_cb, &uribuf)
== kDNSServiceErr_NoError)
domainsent = 1;
}
@@ -1653,96 +1608,24 @@ _httpResolveURI(
DNSServiceRefDeallocate(ref);
}
# else /* HAVE_AVAHI */
if ((uribuf.poll = avahi_simple_poll_new()) != NULL)
{
avahi_simple_poll_set_func(uribuf.poll, http_poll_cb, NULL);
if ((client = avahi_client_new(avahi_simple_poll_get(uribuf.poll),
0, http_client_cb,
&uribuf, &error)) != NULL)
{
if (avahi_service_resolver_new(client, AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, hostname,
regtype, "local.", AVAHI_PROTO_UNSPEC, 0,
http_resolve_cb, &uribuf) != NULL)
{
time_t start_time = time(NULL),
/* Start time */
end_time = start_time + 90;
/* End time */
int pstatus; /* Poll status */
pstatus = avahi_simple_poll_iterate(uribuf.poll, 2000);
if (pstatus == 0 && !resolved_uri[0] && domain &&
_cups_strcasecmp(domain, "local."))
{
/*
* Resolve for .local hasn't returned anything, try the listed
* domain...
*/
avahi_service_resolver_new(client, AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, hostname,
regtype, domain, AVAHI_PROTO_UNSPEC, 0,
http_resolve_cb, &uribuf);
}
while (!pstatus && !resolved_uri[0] && time(NULL) < end_time)
{
if ((pstatus = avahi_simple_poll_iterate(uribuf.poll, 2000)) != 0)
break;
/*
* If it hasn't resolved within 5 seconds set the offline-report
* printer-state-reason...
*/
if ((options & _HTTP_RESOLVE_STDERR) && offline == 0 &&
time(NULL) > (start_time + 5))
{
fputs("STATE: +offline-report\n", stderr);
offline = 1;
}
}
/*
* Collect the result (if we got one).
*/
if (resolved_uri[0])
uri = resolved_uri;
}
avahi_client_free(client);
}
avahi_simple_poll_free(uribuf.poll);
}
# endif /* HAVE_DNSSD */
if (options & _HTTP_RESOLVE_STDERR)
{
if (uri)
{
fprintf(stderr, "DEBUG: Resolved as \"%s\"...\n", uri);
fputs("STATE: -connecting-to-device,offline-report\n", stderr);
}
else
{
fputs("DEBUG: Unable to resolve URI\n", stderr);
fputs("STATE: -connecting-to-device\n", stderr);
}
fputs("STATE: -connecting-to-device,offline-report\n", stderr);
}
#else /* HAVE_DNSSD || HAVE_AVAHI */
#else
/*
* No DNS-SD support...
*/
uri = NULL;
#endif /* HAVE_DNSSD || HAVE_AVAHI */
#endif /* HAVE_DNSSD */
if ((options & _HTTP_RESOLVE_STDERR) && !uri)
_cupsLangPrintFilter(stderr, "ERROR", _("Unable to find printer."));
@@ -1763,35 +1646,6 @@ _httpResolveURI(
}
#ifdef HAVE_AVAHI
/*
* 'http_client_cb()' - Client callback for resolving URI.
*/
static void
http_client_cb(
AvahiClient *client, /* I - Client information */
AvahiClientState state, /* I - Current state */
void *context) /* I - Pointer to URI buffer */
{
DEBUG_printf(("7http_client_cb(client=%p, state=%d, context=%p)", client,
state, context));
/*
* If the connection drops, quit.
*/
if (state == AVAHI_CLIENT_FAILURE)
{
_http_uribuf_t *uribuf = (_http_uribuf_t *)context;
/* URI buffer */
avahi_simple_poll_quit(uribuf->poll);
}
}
#endif /* HAVE_AVAHI */
/*
* 'http_copy_decode()' - Copy and decode a URI.
*/
@@ -1927,16 +1781,13 @@ http_resolve_cb(
const unsigned char *txtRecord, /* I - TXT record data */
void *context) /* I - Pointer to URI buffer */
{
_http_uribuf_t *uribuf = (_http_uribuf_t *)context;
/* URI buffer */
const char *scheme, /* URI scheme */
*hostptr, /* Pointer into hostTarget */
*reskey, /* "rp" or "rfo" */
*resdefault; /* Default path */
char resource[257], /* Remote path */
*hostptr; /* Pointer into hostTarget */
char rp[257], /* Remote printer */
fqdn[256]; /* FQDN of the .local name */
const void *value; /* Value from TXT record */
uint8_t valueLen; /* Length of value */
_http_uribuf_t *uribuf; /* URI buffer */
DEBUG_printf(("7http_resolve_cb(sdRef=%p, flags=%x, interfaceIndex=%u, "
@@ -1945,6 +1796,8 @@ http_resolve_cb(
interfaceIndex, errorCode, fullName, hostTarget, port, txtLen,
txtRecord, context));
uribuf = (_http_uribuf_t *)context;
/*
* Figure out the scheme from the full name...
*/
@@ -1968,29 +1821,17 @@ http_resolve_cb(
* Extract the "remote printer" key from the TXT record...
*/
if ((uribuf->options & _HTTP_RESOLVE_FAXOUT) &&
(!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")))
{
reskey = "rfo";
resdefault = "/ipp/faxout";
}
else
{
reskey = "rp";
resdefault = "/";
}
if ((value = TXTRecordGetValuePtr(txtLen, txtRecord, reskey,
if ((value = TXTRecordGetValuePtr(txtLen, txtRecord, "rp",
&valueLen)) != NULL)
{
if (((char *)value)[0] == '/')
{
/*
* Value (incorrectly) has a leading slash already...
* "rp" value (incorrectly) has a leading slash already...
*/
memcpy(resource, value, valueLen);
resource[valueLen] = '\0';
memcpy(rp, value, valueLen);
rp[valueLen] = '\0';
}
else
{
@@ -1998,18 +1839,19 @@ http_resolve_cb(
* Convert to resource by concatenating with a leading "/"...
*/
resource[0] = '/';
memcpy(resource + 1, value, valueLen);
resource[valueLen + 1] = '\0';
rp[0] = '/';
memcpy(rp + 1, value, valueLen);
rp[valueLen + 1] = '\0';
}
}
else
{
/*
* Use the default value...
* Default "rp" value is blank, mapping to a path of "/"...
*/
strlcpy(resource, resdefault, sizeof(resource));
rp[0] = '/';
rp[1] = '\0';
}
/*
@@ -2065,220 +1907,10 @@ http_resolve_cb(
*/
httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, uribuf->bufsize, scheme,
NULL, hostTarget, ntohs(port), resource);
NULL, hostTarget, ntohs(port), rp);
DEBUG_printf(("8http_resolve_cb: Resolved URI is \"%s\"...", uribuf->buffer));
}
#elif defined(HAVE_AVAHI)
/*
* 'http_poll_cb()' - Wait for input on the specified file descriptors.
*
* Note: This function is needed because avahi_simple_poll_iterate is broken
* and always uses a timeout of 0 (!) milliseconds.
* (Avahi Ticket #364)
*/
static int /* O - Number of file descriptors matching */
http_poll_cb(
struct pollfd *pollfds, /* I - File descriptors */
unsigned int num_pollfds, /* I - Number of file descriptors */
int timeout, /* I - Timeout in milliseconds (used) */
void *context) /* I - User data (unused) */
{
(void)timeout;
(void)context;
return (poll(pollfds, num_pollfds, 2000));
}
/*
* 'http_resolve_cb()' - Build a device URI for the given service name.
*/
static void
http_resolve_cb(
AvahiServiceResolver *resolver, /* I - Resolver (unused) */
AvahiIfIndex interface, /* I - Interface index (unused) */
AvahiProtocol protocol, /* I - Network protocol (unused) */
AvahiResolverEvent event, /* I - Event (found, etc.) */
const char *name, /* I - Service name */
const char *type, /* I - Registration type */
const char *domain, /* I - Domain (unused) */
const char *hostTarget, /* I - Hostname */
const AvahiAddress *address, /* I - Address (unused) */
uint16_t port, /* I - Port number */
AvahiStringList *txt, /* I - TXT record */
AvahiLookupResultFlags flags, /* I - Lookup flags (unused) */
void *context) /* I - Pointer to URI buffer */
{
_http_uribuf_t *uribuf = (_http_uribuf_t *)context;
/* URI buffer */
const char *scheme, /* URI scheme */
*hostptr, /* Pointer into hostTarget */
*reskey, /* "rp" or "rfo" */
*resdefault; /* Default path */
char resource[257], /* Remote path */
fqdn[256]; /* FQDN of the .local name */
AvahiStringList *pair; /* Current TXT record key/value pair */
char *value; /* Value for "rp" key */
size_t valueLen = 0; /* Length of "rp" key */
DEBUG_printf(("7http_resolve_cb(resolver=%p, "
"interface=%d, protocol=%d, event=%d, name=\"%s\", "
"type=\"%s\", domain=\"%s\", hostTarget=\"%s\", address=%p, "
"port=%d, txt=%p, flags=%d, context=%p)",
resolver, interface, protocol, event, name, type, domain,
hostTarget, address, port, txt, flags, context));
if (event != AVAHI_RESOLVER_FOUND)
{
avahi_service_resolver_free(resolver);
avahi_simple_poll_quit(uribuf->poll);
return;
}
/*
* Figure out the scheme from the full name...
*/
if (strstr(type, "_ipp."))
scheme = "ipp";
else if (strstr(type, "_printer."))
scheme = "lpd";
else if (strstr(type, "_pdl-datastream."))
scheme = "socket";
else
scheme = "riousbprint";
if (!strncmp(type, "_ipps.", 6) || !strncmp(type, "_ipp-tls.", 9))
scheme = "ipps";
else if (!strncmp(type, "_ipp.", 5) || !strncmp(type, "_fax-ipp.", 9))
scheme = "ipp";
else if (!strncmp(type, "_http.", 6))
scheme = "http";
else if (!strncmp(type, "_https.", 7))
scheme = "https";
else if (!strncmp(type, "_printer.", 9))
scheme = "lpd";
else if (!strncmp(type, "_pdl-datastream.", 16))
scheme = "socket";
else
{
avahi_service_resolver_free(resolver);
avahi_simple_poll_quit(uribuf->poll);
return;
}
/*
* Extract the remote resource key from the TXT record...
*/
if ((uribuf->options & _HTTP_RESOLVE_FAXOUT) &&
(!strcmp(scheme, "ipp") || !strcmp(scheme, "ipps")))
{
reskey = "rfo";
resdefault = "/ipp/faxout";
}
else
{
reskey = "rp";
resdefault = "/";
}
if ((pair = avahi_string_list_find(txt, reskey)) != NULL)
{
avahi_string_list_get_pair(pair, NULL, &value, &valueLen);
if (value[0] == '/')
{
/*
* Value (incorrectly) has a leading slash already...
*/
memcpy(resource, value, valueLen);
resource[valueLen] = '\0';
}
else
{
/*
* Convert to resource by concatenating with a leading "/"...
*/
resource[0] = '/';
memcpy(resource + 1, value, valueLen);
resource[valueLen + 1] = '\0';
}
}
else
{
/*
* Use the default value...
*/
strlcpy(resource, resdefault, sizeof(resource));
}
/*
* Lookup the FQDN if needed...
*/
if ((uribuf->options & _HTTP_RESOLVE_FQDN) &&
(hostptr = hostTarget + strlen(hostTarget) - 6) > hostTarget &&
!_cups_strcasecmp(hostptr, ".local"))
{
/*
* OK, we got a .local name but the caller needs a real domain. Start by
* getting the IP address of the .local name and then do reverse-lookups...
*/
http_addrlist_t *addrlist, /* List of addresses */
*addr; /* Current address */
DEBUG_printf(("8http_resolve_cb: Looking up \"%s\".", hostTarget));
snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port));
if ((addrlist = httpAddrGetList(hostTarget, AF_UNSPEC, fqdn)) != NULL)
{
for (addr = addrlist; addr; addr = addr->next)
{
int error = getnameinfo(&(addr->addr.addr),
httpAddrLength(&(addr->addr)),
fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
if (!error)
{
DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
_cups_strcasecmp(hostptr, ".local"))
{
hostTarget = fqdn;
break;
}
}
#ifdef DEBUG
else
DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
error));
#endif /* DEBUG */
}
}
}
/*
* Assemble the final device URI using the resolved hostname...
*/
httpAssembleURI(HTTP_URI_CODING_ALL, uribuf->buffer, uribuf->bufsize, scheme,
NULL, hostTarget, port, resource);
DEBUG_printf(("8http_resolve_cb: Resolved URI is \"%s\".", uribuf->buffer));
avahi_simple_poll_quit(uribuf->poll);
}
#endif /* HAVE_DNSSD */
+82 -123
Ver Arquivo
@@ -258,7 +258,7 @@ static BIO_METHOD http_bio_methods =
*
* Use @code cupsArrayNew(NULL, NULL)@ to create a credentials array.
*
* @since CUPS 1.5/OS X 10.7@
* @since CUPS 1.5/Mac OS X 10.7@
*/
int /* O - 0 on success, -1 on error */
@@ -331,7 +331,7 @@ httpCheck(http_t *http) /* I - Connection to server */
/*
* 'httpClearCookie()' - Clear the cookie value(s).
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
void
@@ -494,7 +494,7 @@ httpConnectEncrypt(
* 'httpCopyCredentials()' - Copy the credentials associated with an encrypted
* connection.
*
* @since CUPS 1.5/OS X 10.7@
* @since CUPS 1.5/Mac OS X 10.7@
*/
int /* O - Status of call (0 = success) */
@@ -835,7 +835,7 @@ httpFlush(http_t *http) /* I - Connection to server */
/*
* 'httpFlushWrite()' - Flush data in write buffer.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Bytes written or -1 on error */
@@ -937,7 +937,7 @@ httpGet(http_t *http, /* I - Connection to server */
* string to use with httpSetField() for the HTTP_FIELD_AUTHORIZATION
* value.
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
char * /* O - Authorization string */
@@ -953,7 +953,7 @@ httpGetAuthString(http_t *http) /* I - Connection to server */
/*
* 'httpGetBlocking()' - Get the blocking/non-block state of a connection.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 if blocking, 0 if non-blocking */
@@ -966,7 +966,7 @@ httpGetBlocking(http_t *http) /* I - Connection to server */
/*
* 'httpGetCookie()' - Get any cookie data from the response.
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
const char * /* O - Cookie data or NULL */
@@ -979,7 +979,7 @@ httpGetCookie(http_t *http) /* I - HTTP connecion */
/*
* 'httpGetFd()' - Get the file descriptor associated with a connection.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - File descriptor or -1 if none */
@@ -1049,7 +1049,7 @@ httpGetLength(http_t *http) /* I - Connection to server */
* This function returns the complete content length, even for
* content larger than 2^31 - 1.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
off_t /* O - Content length */
@@ -1183,10 +1183,6 @@ httpGets(char *line, /* I - Line to read into */
DEBUG_printf(("4httpGets: read %d bytes...", bytes));
#ifdef DEBUG
http_debug_hex("httpGets", http->buffer + http->used, bytes);
#endif /* DEBUG */
if (bytes < 0)
{
/*
@@ -1307,7 +1303,7 @@ httpGetState(http_t *http) /* I - Connection to server */
/*
* 'httpGetStatus()' - Get the status of the last HTTP request.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
http_status_t /* O - HTTP status */
@@ -1336,7 +1332,7 @@ httpGetSubField(http_t *http, /* I - Connection to server */
/*
* 'httpGetSubField2()' - Get a sub-field value.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Value or NULL */
@@ -1668,8 +1664,6 @@ _httpPeek(http_t *http, /* I - Connection to server */
* Buffer small reads for better performance...
*/
ssize_t buflen; /* Length of read for buffer */
if (!http->blocking)
{
while (!httpWait(http, http->wait_value))
@@ -1682,69 +1676,48 @@ _httpPeek(http_t *http, /* I - Connection to server */
}
if (http->data_remaining > sizeof(http->buffer))
buflen = sizeof(http->buffer);
bytes = sizeof(http->buffer);
else
buflen = http->data_remaining;
bytes = http->data_remaining;
DEBUG_printf(("2_httpPeek: Reading %d bytes into buffer.", (int)buflen));
do
{
#ifdef HAVE_SSL
if (http->tls)
bytes = http_read_ssl(http, http->buffer, buflen);
else
if (http->tls)
bytes = http_read_ssl(http, http->buffer, bytes);
else
#endif /* HAVE_SSL */
bytes = recv(http->fd, http->buffer, buflen, 0);
{
DEBUG_printf(("2_httpPeek: reading %d bytes from socket into buffer...",
(int)bytes));
if (bytes < 0)
{
#ifdef WIN32
if (WSAGetLastError() != WSAEINTR)
{
http->error = WSAGetLastError();
return (-1);
}
else if (WSAGetLastError() == WSAEWOULDBLOCK)
{
if (!http->timeout_cb ||
!(*http->timeout_cb)(http, http->timeout_data))
{
http->error = WSAEWOULDBLOCK;
return (-1);
}
}
#else
if (errno == EWOULDBLOCK || errno == EAGAIN)
{
if (http->timeout_cb && !(*http->timeout_cb)(http, http->timeout_data))
{
http->error = errno;
return (-1);
}
else if (!http->timeout_cb && errno != EAGAIN)
{
http->error = errno;
return (-1);
}
}
else if (errno != EINTR)
{
http->error = errno;
return (-1);
}
#endif /* WIN32 */
}
bytes = recv(http->fd, http->buffer, bytes, 0);
DEBUG_printf(("2_httpPeek: read %d bytes from socket into buffer...",
(int)bytes));
}
while (bytes < 0);
DEBUG_printf(("2_httpPeek: Read " CUPS_LLFMT " bytes into buffer.",
CUPS_LLCAST bytes));
#ifdef DEBUG
http_debug_hex("_httpPeek", http->buffer, (int)bytes);
#endif /* DEBUG */
http->used = bytes;
if (bytes > 0)
http->used = bytes;
else if (bytes < 0)
{
#ifdef WIN32
if (WSAGetLastError() != WSAEINTR && WSAGetLastError() != WSAEWOULDBLOCK)
{
http->error = WSAGetLastError();
return (-1);
}
#else
if (errno != EINTR && errno != EAGAIN)
{
http->error = errno;
return (-1);
}
#endif /* WIN32 */
}
else
{
http->error = EPIPE;
return (0);
}
}
if (http->used > 0)
@@ -1877,7 +1850,7 @@ httpRead(http_t *http, /* I - Connection to server */
/*
* 'httpRead2()' - Read data from a HTTP connection.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Number of bytes read */
@@ -2025,11 +1998,7 @@ httpRead2(http_t *http, /* I - Connection to server */
}
while (bytes < 0);
DEBUG_printf(("2httpRead2: Read " CUPS_LLFMT " bytes into buffer.",
CUPS_LLCAST bytes));
#ifdef DEBUG
http_debug_hex("httpRead2", http->buffer, (int)bytes);
#endif /* DEBUG */
DEBUG_printf(("2httpRead2: Read %d bytes into buffer.", (int)bytes));
http->used = bytes;
}
@@ -2132,9 +2101,6 @@ httpRead2(http_t *http, /* I - Connection to server */
DEBUG_printf(("2httpRead2: read " CUPS_LLFMT " bytes from socket...",
CUPS_LLCAST bytes));
#ifdef DEBUG
http_debug_hex("httpRead2", buffer, (int)bytes);
#endif /* DEBUG */
}
if (bytes > 0)
@@ -2170,12 +2136,20 @@ httpRead2(http_t *http, /* I - Connection to server */
{
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
httpGets(len, sizeof(len), http);
else if (http->state == HTTP_POST_RECV)
http->state ++;
else
http->state = HTTP_WAITING;
if (http->data_encoding != HTTP_ENCODE_CHUNKED)
{
if (http->state == HTTP_POST_RECV)
http->state ++;
else
http->state = HTTP_WAITING;
}
}
#ifdef DEBUG
http_debug_hex("httpRead2", buffer, (int)bytes);
#endif /* DEBUG */
return (bytes);
}
@@ -2352,23 +2326,6 @@ httpReconnect2(http_t *http, /* I - Connection to server */
http->fd = -1;
}
/*
* Reset all state (except fields, which may be reused)...
*/
http->state = HTTP_WAITING;
http->status = HTTP_CONTINUE;
http->version = HTTP_1_1;
http->keep_alive = HTTP_KEEPALIVE_OFF;
memset(&http->_hostaddr, 0, sizeof(http->_hostaddr));
http->data_encoding = HTTP_ENCODE_LENGTH;
http->_data_remaining = 0;
http->used = 0;
http->expect = 0;
http->data_remaining = 0;
http->hostaddr = NULL;
http->wused = 0;
/*
* Connect to the server...
*/
@@ -2407,6 +2364,8 @@ httpReconnect2(http_t *http, /* I - Connection to server */
http->hostaddr = &(addr->addr);
http->error = 0;
http->status = HTTP_CONTINUE;
http->state = HTTP_WAITING;
#ifdef HAVE_SSL
if (http->encryption == HTTP_ENCRYPT_ALWAYS)
@@ -2446,7 +2405,7 @@ httpReconnect2(http_t *http, /* I - Connection to server */
* HTTP_FIELD_AUTHORIZATION prior to issuing a HTTP request using httpGet(),
* httpHead(), httpOptions(), httpPost, or httpPut().
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
void
@@ -2503,7 +2462,7 @@ httpSetAuthString(http_t *http, /* I - Connection to server */
* 'httpSetCredentials()' - Set the credentials associated with an encrypted
* connection.
*
* @since CUPS 1.5/OS X 10.7@
* @since CUPS 1.5/Mac OS X 10.7@
*/
int /* O - Status of call (0 = success) */
@@ -2524,7 +2483,7 @@ httpSetCredentials(http_t *http, /* I - Connection to server */
/*
* 'httpSetCookie()' - Set the cookie value(s).
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
void
@@ -2549,7 +2508,7 @@ httpSetCookie(http_t *http, /* I - Connection */
*
* Currently only HTTP_CONTINUE is supported for the "expect" argument.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void
@@ -2634,7 +2593,7 @@ httpSetField(http_t *http, /* I - Connection to server */
/*
* 'httpSetLength()' - Set the content-length and content-encoding.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
void
@@ -2664,7 +2623,7 @@ httpSetLength(http_t *http, /* I - Connection to server */
* The optional timeout callback receives both the HTTP connection and a user
* data pointer and must return 1 to continue or 0 to error (time) out.
*
* @since CUPS 1.5/OS X 10.7@
* @since CUPS 1.5/Mac OS X 10.7@
*/
void
@@ -3032,7 +2991,7 @@ _httpWait(http_t *http, /* I - Connection to server */
/*
* 'httpWait()' - Wait for data available on a connection.
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
int /* O - 1 if data is available, 0 otherwise */
@@ -3095,7 +3054,7 @@ httpWrite(http_t *http, /* I - Connection to server */
/*
* 'httpWrite2()' - Write data to a HTTP connection.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Number of bytes written */
@@ -3979,9 +3938,7 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
http->tls = SSL_new(context);
SSL_set_bio(http->tls, bio, bio);
# ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME
SSL_set_tlsext_host_name(http->tls, hostname);
# endif /* HAVE_SSL_SET_TLSEXT_HOST_NAME */
if (SSL_connect(http->tls) != 1)
{
@@ -4102,6 +4059,15 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
cg->expired_root, (int)error));
}
# ifdef HAVE_SSLSETPROTOCOLVERSIONMAX
if (!error)
{
error = SSLSetProtocolVersionMax(http->tls, kTLSProtocol1);
DEBUG_printf(("4http_setup_ssl: SSLSetProtocolVersionMax(kTLSProtocol1), "
"error=%d", (int)error));
}
# endif /* HAVE_SSLSETPROTOCOLVERSIONMAX */
/*
* In general, don't verify certificates since things like the common name
* often do not match...
@@ -4176,8 +4142,7 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
break;
case errSSLWouldBlock :
error = noErr; /* Force a retry */
usleep(1000); /* in 1 millisecond */
usleep(1000);
break;
# ifdef HAVE_SECCERTIFICATECOPYDATA
@@ -4213,7 +4178,7 @@ http_setup_ssl(http_t *http) /* I - Connection to server */
{
data = (CFDataRef)CFArrayGetValueAtIndex(dn_array, i);
if ((credential = malloc(sizeof(*credential))) != NULL)
if ((credential = malloc(sizeof(*credential))))
{
credential->datalen = CFDataGetLength(data);
if ((credential->data = malloc(credential->datalen)))
@@ -4515,8 +4480,6 @@ http_write(http_t *http, /* I - Connection to server */
while (length > 0)
{
DEBUG_printf(("3http_write: About to write %d bytes.", (int)length));
if (http->timeout_cb)
{
#ifdef HAVE_POLL
@@ -4534,8 +4497,7 @@ http_write(http_t *http, /* I - Connection to server */
pfd.events = POLLOUT;
while ((nfds = poll(&pfd, 1, http->wait_value)) < 0 &&
(errno == EINTR || errno == EAGAIN))
/* do nothing */;
(errno == EINTR || errno == EAGAIN));
#else
do
@@ -4581,9 +4543,6 @@ http_write(http_t *http, /* I - Connection to server */
#endif /* HAVE_SSL */
bytes = send(http->fd, buffer, length, 0);
DEBUG_printf(("3http_write: Write of %d bytes returned %d.", (int)length,
(int)bytes));
if (bytes < 0)
{
#ifdef WIN32
+10 -10
Ver Arquivo
@@ -124,7 +124,7 @@ typedef enum http_auth_e /**** HTTP authentication types ****/
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/OS X 10.5@ */
HTTP_AUTH_NEGOTIATE /* GSSAPI authentication in use @since CUPS 1.3/Mac OS X 10.5@ */
} http_auth_t;
typedef enum http_encoding_e /**** HTTP transfer encoding values ****/
@@ -251,7 +251,7 @@ typedef enum http_status_e /**** HTTP status codes ****/
HTTP_NOT_SUPPORTED, /* HTTP version not supported */
HTTP_AUTHORIZATION_CANCELED = 1000, /* User canceled authorization @since CUPS 1.4@ */
HTTP_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/OS X 10.7@ */
HTTP_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/Mac OS X 10.7@ */
HTTP_WEBIF_DISABLED /* Web interface is disabled @private@ */
} http_status_t;
@@ -292,7 +292,7 @@ typedef enum http_version_e /**** HTTP version numbers ****/
typedef union _http_addr_u /**** Socket address union, which
**** makes using IPv6 and other
**** address types easier and
**** more portable. @since CUPS 1.2/OS X 10.5@
**** more portable. @since CUPS 1.2/Mac OS X 10.5@
****/
{
struct sockaddr addr; /* Base structure for family value */
@@ -309,7 +309,7 @@ typedef union _http_addr_u /**** Socket address union, which
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/OS X 10.5@
**** with a hostname. @since CUPS 1.2/Mac OS X 10.5@
****/
{
struct http_addrlist_s *next; /* Pointer to next address in list */
@@ -318,14 +318,14 @@ typedef struct http_addrlist_s /**** Socket address list, which is
typedef struct _http_s http_t; /**** HTTP connection type ****/
typedef struct http_credential_s /**** HTTP credential data @since CUPS 1.5/OS X 10.7@ ****/
typedef struct http_credential_s /**** HTTP credential data @since CUPS 1.5/Mac OS X 10.7@ ****/
{
void *data; /* Pointer to credential data */
size_t datalen; /* Credential length */
} http_credential_t;
typedef int (*http_timeout_cb_t)(http_t *http, void *user_data);
/**** HTTP timeout callback @since CUPS 1.5/OS X 10.7@ ****/
/**** HTTP timeout callback @since CUPS 1.5/Mac OS X 10.7@ ****/
@@ -395,7 +395,7 @@ extern void httpSeparate2(const char *uri,
char *host, int hostlen, int *port,
char *resource, int resourcelen) _CUPS_DEPRECATED;
/**** New in CUPS 1.2/OS X 10.5 ****/
/**** New in CUPS 1.2/Mac OS X 10.5 ****/
extern int httpAddrAny(const http_addr_t *addr) _CUPS_API_1_2;
extern http_addrlist_t *httpAddrConnect(http_addrlist_t *addrlist, int *sock) _CUPS_API_1_2;
extern int httpAddrEqual(const http_addr_t *addr1,
@@ -443,12 +443,12 @@ extern void httpSetLength(http_t *http, size_t length) _CUPS_API_1_2;
extern ssize_t httpWrite2(http_t *http, const char *buffer,
size_t length) _CUPS_API_1_2;
/**** New in CUPS 1.3/OS X 10.5 ****/
/**** New in CUPS 1.3/Mac OS X 10.5 ****/
extern char *httpGetAuthString(http_t *http) _CUPS_API_1_3;
extern void httpSetAuthString(http_t *http, const char *scheme,
const char *data) _CUPS_API_1_3;
/**** New in CUPS 1.5/OS X 10.7 ****/
/**** New in CUPS 1.5/Mac OS X 10.7 ****/
extern int httpAddCredential(cups_array_t *credentials,
const void *data, size_t datalen)
_CUPS_API_1_5;
@@ -462,7 +462,7 @@ extern void httpSetTimeout(http_t *http, double timeout,
http_timeout_cb_t cb, void *user_data)
_CUPS_API_1_5;
/**** New in CUPS 1.6/OS X 10.8 ****/
/**** New in CUPS 1.6 ****/
extern http_addrlist_t *httpAddrConnect2(http_addrlist_t *addrlist, int *sock,
int msec, int *cancel)
_CUPS_API_1_6;
+97
Ver Arquivo
@@ -46,6 +46,103 @@ extern "C" {
* Structures...
*/
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 @since CUPS 1.1.19/Mac OS X 10.3@ */
{
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 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 *language; /* Language code */
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 @since CUPS 1.1.19/Mac OS X 10.3@ */
} _ipp_value_t;
struct _ipp_attribute_s /**** Attribute ****/
{
ipp_attribute_t *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 */
};
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) @since CUPS 1.2/Mac OS X 10.5@ */
/**** New in CUPS 1.4.4 ****/
int use; /* Use count @since CUPS 1.4.4/Mac OS X 10.6.?@ */
};
typedef struct /**** Attribute mapping data ****/
{
int multivalue; /* Option has multiple values? */
+12 -17
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Internet Printing Protocol support functions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -78,11 +78,7 @@ static const char * const ipp_status_oks[] = /* "OK" status codes */
"client-error-ignored-all-subscriptions",
"client-error-too-many-subscriptions",
"(client-error-ignored-all-notifications)",
"(client-error-client-print-support-file-not-found)",
"client-error-document-password-error",
"client-error-document-permission-error",
"client-error-document-security-error",
"client-error-document-unprintable-error"
"(client-error-client-print-support-file-not-found)"
},
* const ipp_status_500s[] = /* Server errors */
{
@@ -162,7 +158,7 @@ static const char * const ipp_std_ops[] =
"Suspend-Current-Job",
"Resume-Job",
/* 0x0030 - 0x003d */
/* 0x0030 - 0x003b */
"Promote-Job",
"Schedule-Job-After",
"0x32",
@@ -175,8 +171,7 @@ static const char * const ipp_std_ops[] =
"Cancel-My-Jobs",
"Resubmit-Job",
"Close-Job",
"Identify-Printer",
"Validate-Document"
"Identify-Printer"
},
* const ipp_cups_ops[] =
{
@@ -411,7 +406,7 @@ static size_t ipp_col_string(ipp_t *col, char *buffer, size_t bufsize);
* trailing nul. The buffer pointer can be NULL to get the required length,
* just like (v)snprintf.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
size_t /* O - Number of bytes less nul */
@@ -492,12 +487,12 @@ ippAttributeString(
bufptr += snprintf(bufptr, bufend - bufptr + 1, "%dx%d%s",
val->resolution.xres, val->resolution.yres,
val->resolution.units == IPP_RES_PER_INCH ?
"dpi" : "dpcm");
"dpi" : "dpc");
else
bufptr += snprintf(temp, sizeof(temp), "%dx%d%s",
val->resolution.xres, val->resolution.yres,
val->resolution.units == IPP_RES_PER_INCH ?
"dpi" : "dpcm");
"dpi" : "dpc");
break;
case IPP_TAG_DATE :
@@ -821,7 +816,7 @@ ippErrorString(ipp_status_t error) /* I - Error status */
/*
* 'ippErrorValue()' - Return a status code for the given name.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_status_t /* O - IPP status code */
@@ -859,7 +854,7 @@ ippErrorValue(const char *name) /* I - Name */
/*
* 'ippOpString()' - Return a name for the given operation id.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - Name */
@@ -894,7 +889,7 @@ ippOpString(ipp_op_t op) /* I - Operation ID */
/*
* 'ippOpValue()' - Return an operation id for the given name.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_op_t /* O - Operation ID */
@@ -970,7 +965,7 @@ ippSetPort(int p) /* I - Port number to use */
*
* The returned names are defined in RFC 2911 and 3382.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
const char * /* O - Tag name */
@@ -990,7 +985,7 @@ ippTagString(ipp_tag_t tag) /* I - Tag value */
*
* The tag names are defined in RFC 2911 and 3382.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
ipp_tag_t /* O - Tag value */
+155 -127
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Internet Printing Protocol functions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -120,24 +120,17 @@
* Local functions...
*/
static ipp_attribute_t *ipp_add_attr(ipp_t *ipp, const char *name,
ipp_tag_t group_tag, ipp_tag_t value_tag,
int num_values);
static void ipp_free_values(ipp_attribute_t *attr, int element,
int count);
static char *ipp_get_code(const char *locale, char *buffer,
size_t bufsize)
__attribute__((nonnull(1,2)));
static char *ipp_lang_code(const char *locale, char *buffer,
size_t bufsize)
__attribute__((nonnull(1,2)));
static ipp_attribute_t *ipp_add_attr(ipp_t *ipp, const char *name, ipp_tag_t group_tag,
ipp_tag_t value_tag, int num_values);
static void ipp_free_values(ipp_attribute_t *attr, int element, int count);
static char *ipp_get_code(const char *locale, char *buffer, size_t bufsize);
static char *ipp_lang_code(const char *locale, char *buffer, size_t bufsize);
static size_t ipp_length(ipp_t *ipp, int collection);
static ssize_t ipp_read_http(http_t *http, ipp_uchar_t *buffer,
size_t length);
static ssize_t ipp_read_file(int *fd, ipp_uchar_t *buffer,
size_t length);
static _ipp_value_t *ipp_set_value(ipp_t *ipp, ipp_attribute_t **attr,
int element);
static _ipp_value_t *ipp_set_value(ipp_t *ipp, ipp_attribute_t **attr, int element);
static ssize_t ipp_write_file(int *fd, ipp_uchar_t *buffer,
size_t length);
@@ -308,7 +301,7 @@ ippAddBooleans(ipp_t *ipp, /* I - IPP message */
* (@code IPP_TAG_OPERATION@), printer (@code IPP_TAG_PRINTER@), subscription
* (@code IPP_TAG_SUBSCRIPTION@), or unsupported (@code IPP_TAG_UNSUPPORTED_GROUP@).
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
ipp_attribute_t * /* O - New attribute */
@@ -359,7 +352,7 @@ ippAddCollection(ipp_t *ipp, /* I - IPP message */
* (@code IPP_TAG_OPERATION@), printer (@code IPP_TAG_PRINTER@), subscription
* (@code IPP_TAG_SUBSCRIPTION@), or unsupported (@code IPP_TAG_UNSUPPORTED_GROUP@).
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
ipp_attribute_t * /* O - New attribute */
@@ -609,7 +602,7 @@ ippAddIntegers(ipp_t *ipp, /* I - IPP message */
* (@code IPP_TAG_OPERATION@), printer (@code IPP_TAG_PRINTER@), subscription
* (@code IPP_TAG_SUBSCRIPTION@), or unsupported (@code IPP_TAG_UNSUPPORTED_GROUP@).
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_attribute_t * /* O - New attribute */
@@ -672,7 +665,7 @@ ippAddOctetString(ipp_t *ipp, /* I - IPP message */
* (@code IPP_TAG_NOTSETTABLE@), delete-attribute (@code IPP_TAG_DELETEATTR@), and
* admin-define (@code IPP_TAG_ADMINDEFINE@).
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_attribute_t * /* O - New attribute */
@@ -1065,17 +1058,14 @@ ippAddString(ipp_t *ipp, /* I - IPP message */
attr->values[0].string.language = _cupsStrAlloc(ipp_lang_code(language, code,
sizeof(code)));
if (value)
{
if (value_tag == IPP_TAG_CHARSET)
attr->values[0].string.text = _cupsStrAlloc(ipp_get_code(value, code,
sizeof(code)));
else if (value_tag == IPP_TAG_LANGUAGE)
attr->values[0].string.text = _cupsStrAlloc(ipp_lang_code(value, code,
sizeof(code)));
else
attr->values[0].string.text = _cupsStrAlloc(value);
}
if (value_tag == IPP_TAG_CHARSET)
attr->values[0].string.text = _cupsStrAlloc(ipp_get_code(value, code,
sizeof(code)));
else if (value_tag == IPP_TAG_LANGUAGE)
attr->values[0].string.text = _cupsStrAlloc(ipp_lang_code(value, code,
sizeof(code)));
else
attr->values[0].string.text = _cupsStrAlloc(value);
}
return (attr);
@@ -1231,7 +1221,7 @@ ippAddStrings(
* created - this should only be done as long as the original source IPP message will
* not be freed for the life of the destination.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
@@ -1482,7 +1472,7 @@ ippCopyAttribute(
* 0 to skip it. The function may also choose to do a partial copy of the source attribute
* itself.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on error */
@@ -1610,7 +1600,7 @@ ippDelete(ipp_t *ipp) /* I - IPP message */
/*
* 'ippDeleteAttribute()' - Delete a single attribute in an IPP message.
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
void
@@ -1685,7 +1675,7 @@ ippDeleteAttribute(
*
* Deleting all values in an attribute deletes the attribute.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -1812,7 +1802,7 @@ ippFindNextAttribute(ipp_t *ipp, /* I - IPP message */
/*
* 'ippFirstAttribute()' - Return the first attribute in the message.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_attribute_t * /* O - First attribute or @code NULL@ if none */
@@ -1839,7 +1829,7 @@ ippFirstAttribute(ipp_t *ipp) /* I - IPP message */
* The @code element@ parameter specifies which value to get from 0 to
* @link ippGetCount(attr)@ - 1.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - Boolean value or -1 on error */
@@ -1868,7 +1858,7 @@ ippGetBoolean(ipp_attribute_t *attr, /* I - IPP attribute */
* The @code element@ parameter specifies which value to get from 0 to
* @link ippGetCount(attr)@ - 1.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_t * /* O - Collection value or @code NULL@ on error */
@@ -1895,7 +1885,7 @@ ippGetCollection(
/*
* 'ippGetCount()' - Get the number of values in an attribute.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - Number of values or -1 on error */
@@ -1922,7 +1912,7 @@ ippGetCount(ipp_attribute_t *attr) /* I - IPP attribute */
* The @code element@ parameter specifies which value to get from 0 to
* @link ippGetCount(attr)@ - 1.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
const ipp_uchar_t * /* O - Date value or @code NULL@ */
@@ -1948,7 +1938,7 @@ ippGetDate(ipp_attribute_t *attr, /* I - IPP attribute */
/*
* 'ippGetGroupTag()' - Get the group associated with an attribute.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_tag_t /* O - Group tag or @code IPP_TAG_ZERO@ on error */
@@ -1975,7 +1965,7 @@ ippGetGroupTag(ipp_attribute_t *attr) /* I - IPP attribute */
* The @code element@ parameter specifies which value to get from 0 to
* @link ippGetCount(attr)@ - 1.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - Value or -1 on error */
@@ -2001,7 +1991,7 @@ ippGetInteger(ipp_attribute_t *attr, /* I - IPP attribute */
/*
* 'ippGetName()' - Get the attribute name.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
const char * /* O - Attribute name or @code NULL@ for separators */
@@ -2025,7 +2015,7 @@ ippGetName(ipp_attribute_t *attr) /* I - IPP attribute */
/*
* 'ippGetOperation()' - Get the operation ID in an IPP message.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_op_t /* O - Operation ID or -1 on error */
@@ -2052,7 +2042,7 @@ ippGetOperation(ipp_t *ipp) /* I - IPP request message */
* The @code element@ parameter specifies which value to get from 0 to
* @link ippGetCount(attr)@ - 1.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - Lower value of range or -1 */
@@ -2087,7 +2077,7 @@ ippGetRange(ipp_attribute_t *attr, /* I - IPP attribute */
/*
* 'ippGetRequestId()' - Get the request ID from an IPP message.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - Request ID or -1 on error */
@@ -2114,7 +2104,7 @@ ippGetRequestId(ipp_t *ipp) /* I - IPP message */
* The @code element@ parameter specifies which value to get from 0 to
* @link ippGetCount(attr)@ - 1.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - Horizontal/cross feed resolution or -1 */
@@ -2149,7 +2139,7 @@ ippGetResolution(
/*
* 'ippGetState()' - Get the IPP message state.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_state_t /* O - IPP message state value */
@@ -2173,7 +2163,7 @@ ippGetState(ipp_t *ipp) /* I - IPP message */
/*
* 'ippGetStatusCode()' - Get the status code from an IPP response or event message.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_status_t /* O - Status code in IPP message */
@@ -2200,7 +2190,7 @@ ippGetStatusCode(ipp_t *ipp) /* I - IPP response or event message */
* The @code element@ parameter specifies which value to get from 0 to
* @link ippGetCount(attr)@ - 1.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
const char *
@@ -2231,7 +2221,7 @@ ippGetString(ipp_attribute_t *attr, /* I - IPP attribute */
/*
* 'ippGetValueTag()' - Get the value tag for an attribute.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_tag_t /* O - Value tag or @code IPP_TAG_ZERO@ on error */
@@ -2255,7 +2245,7 @@ ippGetValueTag(ipp_attribute_t *attr) /* I - IPP attribute */
/*
* 'ippGetVersion()' - Get the major and minor version number from an IPP message.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - Major version number or -1 on error */
@@ -2299,7 +2289,7 @@ ippLength(ipp_t *ipp) /* I - IPP message */
/*
* 'ippNextAttribute()' - Return the next attribute in the message.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
ipp_attribute_t * /* O - Next attribute or @code NULL@ if none */
@@ -2356,7 +2346,7 @@ ippNew(void)
* attributes-natural-language attributes added. The
* attributes-natural-language value is derived from the current locale.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_t * /* O - IPP request message */
@@ -2438,7 +2428,7 @@ ippRead(http_t *http, /* I - HTTP connection */
/*
* 'ippReadFile()' - Read data for an IPP message from a file.
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
ipp_state_t /* O - Current state */
@@ -2454,7 +2444,7 @@ ippReadFile(int fd, /* I - HTTP data */
/*
* 'ippReadIO()' - Read data for an IPP message.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_state_t /* O - Current state */
@@ -2477,7 +2467,7 @@ ippReadIO(void *src, /* I - Data source */
DEBUG_printf(("ippReadIO(src=%p, cb=%p, blocking=%d, parent=%p, ipp=%p)",
src, cb, blocking, parent, ipp));
DEBUG_printf(("2ippReadIO: ipp->state=%d", ipp ? ipp->state : IPP_ERROR));
DEBUG_printf(("2ippReadIO: ipp->state=%d", ipp->state));
if (!src || !ipp)
return (IPP_ERROR);
@@ -2577,7 +2567,7 @@ ippReadIO(void *src, /* I - Data source */
*/
_cupsSetError(IPP_INTERNAL_ERROR, _("IPP extension tag larger than 0x7FFFFFFF."), 1);
DEBUG_printf(("1ippReadIO: bad tag 0x%x.", tag));
DEBUG_printf(("1ippReadIO: bad name length %d.", n));
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
@@ -2846,7 +2836,7 @@ ippReadIO(void *src, /* I - Data source */
else
_cupsSetError(IPP_INTERNAL_ERROR,
_("IPP enum value not 4 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad integer value length %d.", n));
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
@@ -2872,7 +2862,7 @@ ippReadIO(void *src, /* I - Data source */
{
_cupsSetError(IPP_INTERNAL_ERROR, _("IPP boolean value not 1 byte."),
1);
DEBUG_printf(("1ippReadIO: bad boolean value length %d.", n));
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
@@ -2913,14 +2903,11 @@ ippReadIO(void *src, /* I - Data source */
case IPP_TAG_CHARSET :
case IPP_TAG_LANGUAGE :
case IPP_TAG_MIMETYPE :
if (n > 0)
{
if ((*cb)(src, buffer, n) < n)
{
DEBUG_puts("1ippReadIO: unable to read string value.");
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
if ((*cb)(src, buffer, n) < n)
{
DEBUG_puts("1ippReadIO: unable to read string value.");
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
buffer[n] = '\0';
@@ -2932,7 +2919,7 @@ ippReadIO(void *src, /* I - Data source */
if (n != 11)
{
_cupsSetError(IPP_INTERNAL_ERROR, _("IPP date value not 11 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad date value length %d.", n));
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
@@ -2950,7 +2937,7 @@ ippReadIO(void *src, /* I - Data source */
{
_cupsSetError(IPP_INTERNAL_ERROR,
_("IPP resolution value not 9 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad resolution value length %d.", n));
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
@@ -2977,8 +2964,7 @@ ippReadIO(void *src, /* I - Data source */
{
_cupsSetError(IPP_INTERNAL_ERROR,
_("IPP rangeOfInteger value not 8 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad rangeOfInteger value length "
"%d.", n));
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
@@ -3010,8 +2996,7 @@ ippReadIO(void *src, /* I - Data source */
_cupsSetError(IPP_INTERNAL_ERROR,
_("IPP nameWithLanguage value less than "
"minimum 4 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad stringWithLanguage value "
"length %d.", n));
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
@@ -3043,8 +3028,7 @@ ippReadIO(void *src, /* I - Data source */
{
_cupsSetError(IPP_INTERNAL_ERROR,
_("IPP language length overflows value."), 1);
DEBUG_printf(("1ippReadIO: bad language value length %d.",
n));
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
@@ -3061,7 +3045,7 @@ ippReadIO(void *src, /* I - Data source */
{
_cupsSetError(IPP_INTERNAL_ERROR,
_("IPP string length overflows value."), 1);
DEBUG_printf(("1ippReadIO: bad string value length %d.", n));
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
@@ -3116,15 +3100,7 @@ ippReadIO(void *src, /* I - Data source */
* we need to carry over...
*/
if (n == 0)
{
_cupsSetError(IPP_INTERNAL_ERROR,
_("IPP memberName value is empty."), 1);
DEBUG_puts("1ippReadIO: Empty member name value.");
_cupsBufferRelease((char *)buffer);
return (IPP_ERROR);
}
else if ((*cb)(src, buffer, n) < n)
if ((*cb)(src, buffer, n) < n)
{
DEBUG_puts("1ippReadIO: Unable to read member name value.");
_cupsBufferRelease((char *)buffer);
@@ -3203,7 +3179,7 @@ ippReadIO(void *src, /* I - Data source */
* The @code element@ parameter specifies which value to set from 0 to
* @link ippGetCount(attr)@.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3245,7 +3221,7 @@ ippSetBoolean(ipp_t *ipp, /* IO - IPP message */
* The @code element@ parameter specifies which value to set from 0 to
* @link ippGetCount(attr)@.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3294,7 +3270,7 @@ ippSetCollection(
* The @code element@ parameter specifies which value to set from 0 to
* @link ippGetCount(attr)@.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3339,7 +3315,7 @@ ippSetDate(ipp_t *ipp, /* IO - IPP message */
* (@code IPP_TAG_OPERATION@), printer (@code IPP_TAG_PRINTER@), subscription
* (@code IPP_TAG_SUBSCRIPTION@), or unsupported (@code IPP_TAG_UNSUPPORTED_GROUP@).
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3377,7 +3353,7 @@ ippSetGroupTag(
* The @code element@ parameter specifies which value to set from 0 to
* @link ippGetCount(attr)@.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3417,7 +3393,7 @@ ippSetInteger(ipp_t *ipp, /* IO - IPP message */
*
* The @code attr@ parameter may be modified as a result of setting the value.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3457,7 +3433,7 @@ ippSetName(ipp_t *ipp, /* IO - IPP message */
* The @code ipp@ parameter refers to an IPP message previously created using the
* @link ippNew@ or @link ippNewRequest@ functions.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3492,7 +3468,7 @@ ippSetOperation(ipp_t *ipp, /* I - IPP request message */
* The @code element@ parameter specifies which value to set from 0 to
* @link ippGetCount(attr)@.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3535,7 +3511,7 @@ ippSetRange(ipp_t *ipp, /* IO - IPP message */
*
* The @code request_id@ parameter must be greater than 0.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3572,7 +3548,7 @@ ippSetRequestId(ipp_t *ipp, /* I - IPP message */
* The @code element@ parameter specifies which value to set from 0 to
* @link ippGetCount(attr)@.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3614,7 +3590,7 @@ ippSetResolution(
/*
* 'ippSetState()' - Set the current state of the IPP message.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3645,7 +3621,7 @@ ippSetState(ipp_t *ipp, /* I - IPP message */
* The @code ipp@ parameter refers to an IPP message previously created using the
* @link ippNew@ or @link ippNewRequest@ functions.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3680,7 +3656,7 @@ ippSetStatusCode(ipp_t *ipp, /* I - IPP response or event message */
* The @code element@ parameter specifies which value to set from 0 to
* @link ippGetCount(attr)@.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3697,11 +3673,7 @@ ippSetString(ipp_t *ipp, /* IO - IPP message */
* Range check input...
*/
if (!ipp || !attr || !*attr ||
((*attr)->value_tag != IPP_TAG_TEXTLANG &&
(*attr)->value_tag != IPP_TAG_NAMELANG &&
((*attr)->value_tag < IPP_TAG_TEXT ||
(*attr)->value_tag > IPP_TAG_MIMETYPE)) ||
if (!ipp || !attr || !*attr || (*attr)->value_tag != IPP_TAG_INTEGER ||
element < 0 || element > (*attr)->num_values || !strvalue)
return (0);
@@ -3751,7 +3723,7 @@ ippSetString(ipp_t *ipp, /* IO - IPP message */
* code in the "attributes-natural-language" attribute or, if not present, the language
* code for the current locale.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -3908,7 +3880,7 @@ ippSetValueTag(
*
* The valid version numbers are currently 1.0, 1.1, 2.0, 2.1, and 2.2.
*
* @since CUPS 1.6/OS X 10.8@
* @since CUPS 1.6@
*/
int /* O - 1 on success, 0 on failure */
@@ -4002,7 +3974,7 @@ ippWrite(http_t *http, /* I - HTTP connection */
/*
* 'ippWriteFile()' - Write data for an IPP message to a file.
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
ipp_state_t /* O - Current state */
@@ -4020,7 +3992,7 @@ ippWriteFile(int fd, /* I - HTTP data */
/*
* 'ippWriteIO()' - Write data for an IPP message.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_state_t /* O - Current state */
@@ -5301,8 +5273,9 @@ ipp_read_http(http_t *http, /* I - Client connection */
ipp_uchar_t *buffer, /* O - Buffer for data */
size_t length) /* I - Total length */
{
int tbytes, /* Total bytes read */
bytes; /* Bytes read this pass */
int tbytes, /* Total bytes read */
bytes; /* Bytes read this pass */
char len[32]; /* Length string */
DEBUG_printf(("7ipp_read_http(http=%p, buffer=%p, length=%d)",
@@ -5322,36 +5295,91 @@ ipp_read_http(http_t *http, /* I - Client connection */
if (http->state == HTTP_WAITING)
break;
if (http->used == 0 && !http->blocking)
if (http->used > 0 && http->data_encoding == HTTP_ENCODE_LENGTH)
{
/*
* Wait up to 10 seconds for more data on non-blocking sockets...
* Do "fast read" from HTTP buffer directly...
*/
if (!httpWait(http, 10000))
{
/*
* Signal no data...
*/
if (http->used > (int)(length - tbytes))
bytes = (int)(length - tbytes);
else
bytes = http->used;
bytes = -1;
break;
if (bytes == 1)
buffer[0] = http->buffer[0];
else
memcpy(buffer, http->buffer, bytes);
http->used -= bytes;
http->data_remaining -= bytes;
if (http->data_remaining <= INT_MAX)
http->_data_remaining = (int)http->data_remaining;
else
http->_data_remaining = INT_MAX;
if (http->used > 0)
memmove(http->buffer, http->buffer + bytes, http->used);
if (http->data_remaining == 0)
{
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
{
/*
* Get the trailing CR LF after the chunk...
*/
if (!httpGets(len, sizeof(len), http))
return (-1);
}
if (http->data_encoding != HTTP_ENCODE_CHUNKED)
{
if (http->state == HTTP_POST_RECV)
http->state ++;
else
http->state = HTTP_WAITING;
}
}
}
if ((bytes = httpRead2(http, (char *)buffer, length - tbytes)) < 0)
else
{
#ifdef WIN32
break;
#else
if (errno != EAGAIN && errno != EINTR)
break;
/*
* Wait a maximum of 1 second for data...
*/
bytes = 0;
if (!http->blocking)
{
/*
* Wait up to 10 seconds for more data on non-blocking sockets...
*/
if (!httpWait(http, 10000))
{
/*
* Signal no data...
*/
bytes = -1;
break;
}
}
if ((bytes = httpRead2(http, (char *)buffer, length - tbytes)) < 0)
{
#ifdef WIN32
break;
#else
if (errno != EAGAIN && errno != EINTR)
break;
bytes = 0;
#endif /* WIN32 */
}
else if (bytes == 0)
break;
}
else if (bytes == 0)
break;
}
/*
+20 -145
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Internet Printing Protocol definitions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -150,13 +150,13 @@ typedef enum ipp_op_e /**** IPP operations ****/
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/OS X 10.5@ */
IPP_CREATE_JOB_SUBSCRIPTION, /* Create a job subscription @since CUPS 1.2/OS X 10.5@ */
IPP_GET_SUBSCRIPTION_ATTRIBUTES, /* Get subscription attributes @since CUPS 1.2/OS X 10.5@ */
IPP_GET_SUBSCRIPTIONS, /* Get list of subscriptions @since CUPS 1.2/OS X 10.5@ */
IPP_RENEW_SUBSCRIPTION, /* Renew a printer subscription @since CUPS 1.2/OS X 10.5@ */
IPP_CANCEL_SUBSCRIPTION, /* Cancel a subscription @since CUPS 1.2/OS X 10.5@ */
IPP_GET_NOTIFICATIONS, /* Get notification events @since CUPS 1.2/OS X 10.5@ */
IPP_CREATE_PRINTER_SUBSCRIPTION, /* Create a printer subscription @since CUPS 1.2/Mac OS X 10.5@ */
IPP_CREATE_JOB_SUBSCRIPTION, /* Create a job subscription @since CUPS 1.2/Mac OS X 10.5@ */
IPP_GET_SUBSCRIPTION_ATTRIBUTES, /* Get subscription attributes @since CUPS 1.2/Mac OS X 10.5@ */
IPP_GET_SUBSCRIPTIONS, /* Get list of subscriptions @since CUPS 1.2/Mac OS X 10.5@ */
IPP_RENEW_SUBSCRIPTION, /* Renew a printer subscription @since CUPS 1.2/Mac OS X 10.5@ */
IPP_CANCEL_SUBSCRIPTION, /* Cancel a subscription @since CUPS 1.2/Mac OS X 10.5@ */
IPP_GET_NOTIFICATIONS, /* Get notification events @since CUPS 1.2/Mac OS X 10.5@ */
IPP_SEND_NOTIFICATIONS, /* Send notification events @private@ */
IPP_GET_RESOURCE_ATTRIBUTES, /* Get resource attributes @private@ */
IPP_GET_RESOURCE_DATA, /* Get resource data @private@ */
@@ -188,7 +188,6 @@ typedef enum ipp_op_e /**** IPP operations ****/
IPP_RESUBMIT_JOB, /* Resubmit-Job */
IPP_CLOSE_JOB, /* Close-Job */
IPP_IDENTIFY_PRINTER, /* Identify-Printer (proposed IPP JPS3) */
IPP_VALIDATE_DOCUMENT, /* Validate-Document (proposed IPP JPS3) */
IPP_PRIVATE = 0x4000, /* Reserved @private@ */
CUPS_GET_DEFAULT, /* Get the default printer */
CUPS_GET_PRINTERS, /* Get a list of printers and/or classes */
@@ -203,9 +202,9 @@ typedef enum ipp_op_e /**** IPP operations ****/
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/OS X 10.5@ */
CUPS_GET_PPD, /* Get a PPD file @since CUPS 1.3/OS X 10.5@ */
CUPS_GET_DOCUMENT = 0x4027 /* Get a document file @since CUPS 1.4/OS X 10.6@ */
CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2/Mac OS X 10.5@ */
CUPS_GET_PPD, /* Get a PPD file @since CUPS 1.3/Mac OS X 10.5@ */
CUPS_GET_DOCUMENT = 0x4027 /* Get a document file @since CUPS 1.4/Mac OS X 10.6@ */
/* Legacy names for the add operations */
#define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
@@ -305,8 +304,8 @@ typedef enum ipp_status_e /**** IPP status codes ****/
IPP_TOO_MANY_JOBS, /* server-error-too-many-jobs */
IPP_TOO_MANY_DOCUMENTS, /* server-error-too-many-documents */
IPP_AUTHENTICATION_CANCELED = 0x1000, /* Authentication canceled by user @since CUPS 1.5/OS X 10.7@ */
IPP_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/OS X 10.7@ */
IPP_AUTHENTICATION_CANCELED = 0x1000, /* Authentication canceled by user @since CUPS 1.5/Mac OS X 10.7@ */
IPP_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/Mac OS X 10.7@ */
IPP_UPGRADE_REQUIRED /* TLS upgrade required */
/* Legacy name for canceled status */
@@ -366,136 +365,12 @@ typedef struct _ipp_s ipp_t; /**** IPP request/response data ****/
typedef struct _ipp_attribute_s ipp_attribute_t;
/**** IPP attribute ****/
/**** New in CUPS 1.2/OS X 10.5 ****/
typedef ssize_t (*ipp_iocb_t)(void *context, ipp_uchar_t *buffer, size_t bytes);
/**** IPP IO Callback Function @since CUPS 1.2/OS X 10.5@ ****/
/**** New in CUPS 1.6/OS X 10.8 ****/
typedef int (*ipp_copycb_t)(void *context, ipp_t *dst, ipp_attribute_t *attr);
/*
* The following structures are PRIVATE starting with CUPS 1.6/OS X 10.8.
* Please use the new accessor functions available in CUPS 1.6 and later, as
* these definitions will be moved to a private header file in a future release.
*
* Define _IPP_PRIVATE_STRUCTURES to cause the private IPP structures to be
* exposed in CUPS 1.6. This happens automatically on OS X when compiling for
* a deployment target of 10.7 or earlier.
*/
# if defined(_CUPS_SOURCE) || defined(_CUPS_IPP_PRIVATE_H_)
/* Building CUPS */
# define _IPP_PRIVATE_STRUCTURES 1
# elif defined(__APPLE__)
# if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
/* Building for 10.7 and earlier */
# define _IPP_PRIVATE_STRUCTURES 1
# elif !defined(MAC_OS_X_VERSION_10_8)
/* Building for 10.7 and earlier */
# define _IPP_PRIVATE_STRUCTURES 1
# endif /* MAC_OS_X_VERSION_10_8 && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 */
# endif /* _CUPS_SOURCE || _CUPS_IPP_PRIVATE_H_ */
# ifdef _IPP_PRIVATE_STRUCTURES
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 @since CUPS 1.1.19/OS X 10.3@ */
{
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 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 *language; /* Language code */
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 @since CUPS 1.1.19/OS X 10.3@ */
} _ipp_value_t;
typedef _ipp_value_t ipp_value_t; /**** Convenience typedef that will be removed @private@ ****/
struct _ipp_attribute_s /**** Attribute ****/
{
ipp_attribute_t *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 */
};
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) @since CUPS 1.2/OS X 10.5@ */
typedef ssize_t (*ipp_iocb_t)(void *context, ipp_uchar_t *buffer, size_t bytes);
/**** IPP IO Callback Function @since CUPS 1.2/Mac OS X 10.5@ ****/
/**** New in CUPS 1.4.4 ****/
int use; /* Use count @since CUPS 1.4.4/OS X 10.6.?@ */
};
# endif /* _IPP_PRIVATE_STRUCTURES */
/**** New in CUPS 1.6 ****/
typedef int (*ipp_copycb_t)(void *context, ipp_t *dst, ipp_attribute_t *attr);
/*
@@ -560,7 +435,7 @@ extern void ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr) _CUPS_API_1_1
extern ipp_state_t ippReadFile(int fd, ipp_t *ipp) _CUPS_API_1_1_19;
extern ipp_state_t ippWriteFile(int fd, ipp_t *ipp) _CUPS_API_1_1_19;
/**** New in CUPS 1.2/OS X 10.5 ****/
/**** New in CUPS 1.2/Mac OS X 10.5 ****/
extern ipp_attribute_t *ippAddOctetString(ipp_t *ipp, ipp_tag_t group,
const char *name,
const void *data, int datalen) _CUPS_API_1_2;
@@ -573,11 +448,11 @@ extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking,
extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking,
ipp_t *parent, ipp_t *ipp) _CUPS_API_1_2;
/**** New in CUPS 1.4/OS X 10.6 ****/
/**** New in CUPS 1.4/Mac OS X 10.6 ****/
extern const char *ippTagString(ipp_tag_t tag) _CUPS_API_1_4;
extern ipp_tag_t ippTagValue(const char *name) _CUPS_API_1_4;
/**** New in CUPS 1.6/OS X 10.8 ****/
/**** New in CUPS 1.6 ****/
extern ipp_attribute_t *ippAddOutOfBand(ipp_t *ipp, ipp_tag_t group,
ipp_tag_t value_tag, const char *name)
_CUPS_API_1_6;
-1
Ver Arquivo
@@ -71,7 +71,6 @@ extern const char *_cupsLangString(cups_lang_t *lang,
extern void _cupsMessageFree(cups_array_t *a);
extern cups_array_t *_cupsMessageLoad(const char *filename, int unquote);
extern const char *_cupsMessageLookup(cups_array_t *a, const char *m);
extern cups_array_t *_cupsMessageNew(void *context);
extern void _cupsSetLocale(char *argv[]);
+22 -71
Ver Arquivo
@@ -3,7 +3,7 @@
*
* I18N/language support for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -17,27 +17,26 @@
* Contents:
*
* _cupsAppleLanguage() - Get the Apple language identifier associated with
* a locale ID.
* a locale ID.
* _cupsEncodingName() - Return the character encoding name string for the
* given encoding enumeration.
* cupsLangDefault() - Return the default language.
* cupsLangEncoding() - Return the character encoding (us-ascii, etc.)
* for the given language.
* cupsLangFlush() - Flush all language data out of the cache.
* cupsLangFree() - Free language data.
* cupsLangGet() - Get a language.
* _cupsLangString() - Get a message string.
* given encoding enumeration.
* cupsLangDefault() - Return the default language.
* cupsLangEncoding() - Return the character encoding (us-ascii, etc.) for
* the given language.
* cupsLangFlush() - Flush all language data out of the cache.
* cupsLangFree() - Free language data.
* cupsLangGet() - Get a language.
* _cupsLangString() - Get a message string.
* _cupsMessageFree() - Free a messages array.
* _cupsMessageLoad() - Load a .po file into a messages array.
* _cupsMessageLookup() - Lookup a message string.
* _cupsMessageNew() - Make a new message catalog array.
* appleLangDefault() - Get the default locale string.
* appleMessageLoad() - Load a message catalog from a localizable bundle.
* cups_cache_lookup() - Lookup a language in the cache...
* cups_message_compare() - Compare two messages.
* cups_message_free() - Free a message.
* cups_message_load() - Load the message catalog for a language.
* cups_unquote() - Unquote characters in strings...
* cups_unquote() - Unquote characters in strings...
*/
/*
@@ -788,7 +787,7 @@ _cupsLangString(cups_lang_t *lang, /* I - Language */
* Range check input...
*/
if (!lang || !message || !*message)
if (!lang || !message)
return (message);
_cupsMutexLock(&lang_mutex);
@@ -855,7 +854,10 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
* Create an array to hold the messages...
*/
if ((a = _cupsMessageNew(NULL)) == NULL)
if ((a = cupsArrayNew3((cups_array_func_t)cups_message_compare, NULL,
(cups_ahash_func_t)NULL, 0,
(cups_acopy_func_t)NULL,
(cups_afree_func_t)cups_message_free)) == NULL)
{
DEBUG_puts("5_cupsMessageLoad: Unable to allocate array!");
return (NULL);
@@ -936,23 +938,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
*/
if (m)
{
if (m->str && m->str[0])
{
cupsArrayAdd(a, m);
}
else
{
/*
* Translation is empty, don't add it... (STR #4033)
*/
free(m->id);
if (m->str)
free(m->str);
free(m);
}
}
cupsArrayAdd(a, m);
/*
* Create a new message with the given msgid string...
@@ -982,11 +968,6 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
if ((temp = realloc(m->str ? m->str : m->id,
length + strlen(ptr) + 1)) == NULL)
{
if (m->str)
free(m->str);
free(m->id);
free(m);
cupsFileClose(fp);
return (a);
}
@@ -1024,9 +1005,6 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
if ((m->str = strdup(ptr)) == NULL)
{
free(m->id);
free(m);
cupsFileClose(fp);
return (a);
}
@@ -1038,23 +1016,7 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
*/
if (m)
{
if (m->str && m->str[0])
{
cupsArrayAdd(a, m);
}
else
{
/*
* Translation is empty, don't add it... (STR #4033)
*/
free(m->id);
if (m->str)
free(m->str);
free(m);
}
}
cupsArrayAdd(a, m);
/*
* Close the message catalog file and return the new array...
@@ -1138,20 +1100,6 @@ _cupsMessageLookup(cups_array_t *a, /* I - Message array */
}
/*
* '_cupsMessageNew()' - Make a new message catalog array.
*/
cups_array_t * /* O - Array */
_cupsMessageNew(void *context) /* I - User data */
{
return (cupsArrayNew3((cups_array_func_t)cups_message_compare, context,
(cups_ahash_func_t)NULL, 0,
(cups_acopy_func_t)NULL,
(cups_afree_func_t)cups_message_free));
}
#ifdef __APPLE__
/*
* 'appleLangDefault()' - Get the default locale string.
@@ -1386,7 +1334,10 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
* plist as the user data.
*/
return (_cupsMessageNew((void *)plist));
return (cupsArrayNew3((cups_array_func_t)cups_message_compare, (void *)plist,
(cups_ahash_func_t)NULL, 0,
(cups_acopy_func_t)NULL,
(cups_afree_func_t)cups_message_free));
}
# endif /* CUPS_BUNDLEDIR */
#endif /* __APPLE__ */
-75
Ver Arquivo
@@ -1,75 +0,0 @@
// Microsoft Visual C++ generated resource script.
//
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
#include "WinVersRes.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION MASTER_PROD_VERS
PRODUCTVERSION MASTER_PROD_VERS
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", MASTER_COMPANY_NAME
VALUE "FileDescription", "CUPS Library"
VALUE "FileVersion", MASTER_PROD_VERS_STR
VALUE "InternalName", "libcups2.dll"
VALUE "LegalCopyright", MASTER_LEGAL_COPYRIGHT
VALUE "OriginalFilename", "libcups2.dll"
VALUE "ProductName", MASTER_PROD_NAME
VALUE "ProductVersion", MASTER_PROD_VERS_STR
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
+9 -9
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD localization routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -61,7 +61,7 @@ static cups_lang_t *ppd_ll_CC(char *ll_CC, int ll_CC_size);
* descriptions, printer presets, and custom option parameters. Each
* localized string uses the UTF-8 character encoding.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
@@ -246,7 +246,7 @@ ppdLocalizeAttr(ppd_file_t *ppd, /* I - PPD file */
*
* If no value of the requested scheme can be found, NULL is returned.
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
const char * /* O - Value or NULL if not found */
@@ -310,9 +310,9 @@ ppdLocalizeIPPReason(
!strncmp(reason, "shutdown", 8))
message = _("The printer is not connected.");
else if (!strncmp(reason, "toner-low", 9))
message = _("The printer is running low on toner.");
message = _("The printer is low on toner.");
else if (!strncmp(reason, "toner-empty", 11))
message = _("The printer may be out of toner.");
message = _("The printer is out of toner.");
else if (!strncmp(reason, "cover-open", 10))
message = _("The printer's cover is open.");
else if (!strncmp(reason, "interlock-open", 14))
@@ -332,7 +332,7 @@ ppdLocalizeIPPReason(
else if (!strncmp(reason, "output-area-full", 16))
message = _("The output bin is full.");
else if (!strncmp(reason, "marker-supply-low", 17))
message = _("The printer is running low on ink.");
message = _("The printer is low on ink.");
else if (!strncmp(reason, "marker-supply-empty", 19))
message = _("The printer may be out of ink.");
else if (!strncmp(reason, "marker-waste-almost-full", 24))
@@ -351,7 +351,7 @@ ppdLocalizeIPPReason(
message = _("The developer unit will need to be replaced soon.");
else if (!strncmp(reason, "developer-empty", 15))
message = _("The developer unit needs to be replaced.");
if (message)
{
strlcpy(buffer, _cupsLangString(lang, message), bufsize);
@@ -499,7 +499,7 @@ ppdLocalizeIPPReason(
* text from the attribute value. If no localized text for the requested
* name can be found, @code NULL@ is returned.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
const char * /* O - Value or @code NULL@ if not found */
@@ -637,7 +637,7 @@ _ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
/*
* '_ppdHashName()' - Generate a hash value for a device or profile name.
*
* This function is primarily used on OS X, but is generally accessible
* This function is primarily used on Mac OS X, but is generally accessible
* since cupstestppd needs to check for profile name collisions in PPD files...
*/
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Option marking routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -575,7 +575,7 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */
*
* Options are returned from all groups in ascending alphanumeric order.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_option_t * /* O - First option or @code NULL@ */
@@ -593,7 +593,7 @@ ppdFirstOption(ppd_file_t *ppd) /* I - PPD file */
*
* Options are returned from all groups in ascending alphanumeric order.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_option_t * /* O - Next option or @code NULL@ */
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Notification routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2010 by Apple Inc.
* Copyright 2005-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -33,7 +33,7 @@
*
* The returned string must be freed by the caller using @code free@.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Subject string or @code NULL@ */
@@ -164,7 +164,7 @@ cupsNotifySubject(cups_lang_t *lang, /* I - Language data */
*
* The returned string must be freed by the caller using @code free@.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Message text or @code NULL@ */
+2 -2
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Option routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -438,7 +438,7 @@ cupsParseOptions(
/*
* 'cupsRemoveOption()' - Remove an option from an option array.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - New number of options */
+3 -3
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Page size functions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -34,7 +34,7 @@
/*
* 'ppdPageSize()' - Get the page size record for the named size.
* 'ppdPageSize()' - Get the page size record for the given size.
*/
ppd_size_t * /* O - Size record for page or NULL */
@@ -198,7 +198,7 @@ ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
* If the specified PPD file does not support custom page sizes, both
* "minimum" and "maximum" are filled with zeroes.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
int /* O - 1 if custom sizes are supported, 0 otherwise */
+5 -29
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD cache implementation for CUPS.
*
* Copyright 2010-2012 by Apple Inc.
* Copyright 2010-2011 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -171,8 +171,6 @@ _ppdCacheCreateWithFile(
goto create_error;
}
pc->max_copies = 9999;
/*
* Read the file...
*/
@@ -555,8 +553,6 @@ _ppdCacheCreateWithFile(
cupsArrayAdd(pc->finishings, finishings);
}
else if (!_cups_strcasecmp(line, "MaxCopies"))
pc->max_copies = atoi(value);
else
{
DEBUG_printf(("_ppdCacheCreateWithFile: Unknown %s on line %d.", line,
@@ -753,15 +749,12 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
}
/*
* If we have a similar paper with non-zero margins then we only want to
* keep it if it has a larger imageable area length. The NULL check is for
* dimensions that are <= 0...
* If we have a similar paper with non-zero margins then we only
* want to keep it if it has a larger imageable area length.
*/
if ((pwg_media = _pwgMediaForSize(_PWG_FROMPTS(ppd_size->width),
_PWG_FROMPTS(ppd_size->length))) == NULL)
continue;
pwg_media = _pwgMediaForSize(_PWG_FROMPTS(ppd_size->width),
_PWG_FROMPTS(ppd_size->length));
new_width = pwg_media->width;
new_length = pwg_media->length;
new_left = _PWG_FROMPTS(ppd_size->left);
@@ -1355,17 +1348,6 @@ _ppdCacheCreateWithPPD(ppd_file_t *ppd) /* I - PPD file */
NULL)) != NULL);
}
/*
* Max copies...
*/
if ((ppd_attr = ppdFindAttr(ppd, "cupsMaxCopies", NULL)) != NULL)
pc->max_copies = atoi(ppd_attr->value);
else if (ppd->manual_copies)
pc->max_copies = 1;
else
pc->max_copies = 9999;
/*
* Return the cache data...
*/
@@ -2351,12 +2333,6 @@ _ppdCacheWriteFile(
cupsFilePutChar(fp, '\n');
}
/*
* Max copies...
*/
cupsFilePrintf(fp, "MaxCopies %d\n", pc->max_copies);
/*
* IPP attributes, if any...
*/
+1 -2
Ver Arquivo
@@ -49,7 +49,7 @@ extern "C" {
* Constants...
*/
# define _PPD_CACHE_VERSION 3 /* Version number in cache file */
# define _PPD_CACHE_VERSION 2 /* Version number in cache file */
/*
@@ -141,7 +141,6 @@ struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
*prefilters; /* cupsPreFilter values */
int single_file; /* cupsSingleFile value */
cups_array_t *finishings; /* cupsIPPFinishings values */
int max_copies; /* cupsMaxCopies value */
};
+9 -9
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PPD file routines for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -327,7 +327,7 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */
/*
* 'ppdErrorString()' - Returns the text assocated with a status.
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
const char * /* O - Status string */
@@ -397,7 +397,7 @@ _ppdGetEncoding(const char *name) /* I - LanguageEncoding string */
/*
* 'ppdLastError()' - Return the status from the last ppdOpen*().
*
* @since CUPS 1.1.19/OS X 10.3@
* @since CUPS 1.1.19/Mac OS X 10.3@
*/
ppd_status_t /* O - Status code */
@@ -417,7 +417,7 @@ ppdLastError(int *line) /* O - Line number */
/*
* '_ppdOpen()' - Read a PPD file into memory.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_file_t * /* O - PPD file record or @code NULL@ if the PPD file could not be opened. */
@@ -462,8 +462,8 @@ _ppdOpen(
ppd_attr_t *custom_attr; /* CustomFoo attribute */
char ll[4], /* Language + '.' */
ll_CC[7]; /* Language + country + '.' */
size_t ll_len = 0, /* Language length */
ll_CC_len = 0; /* Language + country length */
size_t ll_len, /* Language length */
ll_CC_len; /* Language + country length */
static const char * const ui_keywords[] =
{
#ifdef CUPS_USE_FULL_UI_KEYWORDS_LIST
@@ -2106,7 +2106,7 @@ ppdOpen(FILE *fp) /* I - File to read from */
/*
* 'ppdOpen2()' - Read a PPD file into memory.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_file_t * /* O - PPD file record or @code NULL@ if the PPD file could not be opened. */
@@ -2231,7 +2231,7 @@ ppdOpenFile(const char *filename) /* I - File to read from */
/*
* 'ppdSetConformance()' - Set the conformance level for PPD files.
*
* @since CUPS 1.1.20/OS X 10.4@
* @since CUPS 1.1.20/Mac OS X 10.4@
*/
void
@@ -3062,7 +3062,7 @@ ppd_read(cups_file_t *fp, /* I - File to read from */
DEBUG_printf(("9ppd_read: LINE=\"%s\"", line->buffer));
/*
* The dynamically created PPDs for older style OS X
* The dynamically created PPDs for older style Mac OS X
* drivers include a large blob of data inserted as comments
* at the end of the file. As an optimization we can stop
* reading the PPD when we get to the start of this data.
+30 -42
Ver Arquivo
@@ -7,7 +7,7 @@
* -D_PPD_DEPRECATED="" TO YOUR COMPILE OPTIONS. THIS HEADER AND THESE
* FUNCTIONS WILL BE REMOVED IN A FUTURE RELEASE OF CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
@@ -56,19 +56,7 @@ extern "C" {
*/
# ifndef _PPD_DEPRECATED
# if defined(__APPLE__)
# if defined(MAC_OS_X_VERSION_10_8) && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
/* Building for OS X 10.7 and earlier */
# define _PPD_DEPRECATED
# elif !defined(MAC_OS_X_VERSION_10_8)
/* Building for OS X 10.7 and earlier */
# define _PPD_DEPRECATED
# else
# define _PPD_DEPRECATED _CUPS_DEPRECATED
# endif /* MAC_OS_X_VERSION_10_8 && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8 */
# else
# define _PPD_DEPRECATED _CUPS_DEPRECATED
# endif /* __APPLE__ */
# define _PPD_DEPRECATED _CUPS_DEPRECATED
# endif /* !_PPD_DEPRECATED */
@@ -119,7 +107,7 @@ typedef enum ppd_cs_e /**** Colorspaces ****/
PPD_CS_N /* DeviceN colorspace */
} ppd_cs_t;
typedef enum ppd_status_e /**** Status Codes @since CUPS 1.1.19/OS X 10.3@ ****/
typedef enum ppd_status_e /**** Status Codes @since CUPS 1.1.19/Mac OS X 10.3@ ****/
{
PPD_OK = 0, /* OK */
PPD_FILE_OPEN_ERROR, /* Unable to open PPD file */
@@ -148,16 +136,16 @@ typedef enum ppd_status_e /**** Status Codes @since CUPS 1.1.19/OS X 10.3@ ****
PPD_MAX_STATUS /* @private@ */
} ppd_status_t;
enum ppd_conform_e /**** Conformance Levels @since CUPS 1.1.19/OS X 10.3@ ****/
enum ppd_conform_e /**** Conformance Levels @since CUPS 1.1.19/Mac OS X 10.3@ ****/
{
PPD_CONFORM_RELAXED, /* Relax whitespace and control char */
PPD_CONFORM_STRICT /* Require strict conformance */
};
typedef enum ppd_conform_e ppd_conform_t;
/**** Conformance Levels @since CUPS 1.1.19/OS X 10.3@ ****/
/**** Conformance Levels @since CUPS 1.1.19/Mac OS X 10.3@ ****/
typedef struct ppd_attr_s /**** PPD Attribute Structure @since CUPS 1.1.19/OS X 10.3@ ****/
typedef struct ppd_attr_s /**** PPD Attribute Structure @since CUPS 1.1.19/Mac OS X 10.3@ ****/
{
char name[PPD_MAX_NAME]; /* Name of attribute (cupsXYZ) */
char spec[PPD_MAX_NAME]; /* Specifier string, if any */
@@ -198,7 +186,7 @@ typedef struct ppd_group_s /**** Groups ****/
****/
char text[PPD_MAX_TEXT - PPD_MAX_NAME];
/* Human-readable group name */
char name[PPD_MAX_NAME]; /* Group name @since CUPS 1.1.18/OS X 10.3@ */
char name[PPD_MAX_NAME]; /* Group name @since CUPS 1.1.18/Mac OS X 10.3@ */
int num_options; /* Number of options */
ppd_option_t *options; /* Options */
int num_subgroups; /* Number of sub-groups */
@@ -243,8 +231,8 @@ typedef struct ppd_profile_s /**** sRGB Color Profiles ****/
float matrix[3][3]; /* Transform matrix */
} ppd_profile_t;
/**** New in CUPS 1.2/OS X 10.5 ****/
typedef enum ppd_cptype_e /**** Custom Parameter Type @since CUPS 1.2/OS X 10.5@ ****/
/**** New in CUPS 1.2/Mac OS X 10.5 ****/
typedef enum ppd_cptype_e /**** Custom Parameter Type @since CUPS 1.2/Mac OS X 10.5@ ****/
{
PPD_CUSTOM_CURVE, /* Curve value for f(x) = x^value */
PPD_CUSTOM_INT, /* Integer number value */
@@ -256,7 +244,7 @@ typedef enum ppd_cptype_e /**** Custom Parameter Type @since CUPS 1.2/OS X 10.5
PPD_CUSTOM_STRING /* String of characters */
} ppd_cptype_t;
typedef union ppd_cplimit_u /**** Custom Parameter Limit @since CUPS 1.2/OS X 10.5@ ****/
typedef union ppd_cplimit_u /**** Custom Parameter Limit @since CUPS 1.2/Mac OS X 10.5@ ****/
{
float custom_curve; /* Gamma value */
int custom_int; /* Integer value */
@@ -268,7 +256,7 @@ typedef union ppd_cplimit_u /**** Custom Parameter Limit @since CUPS 1.2/OS X 1
int custom_string; /* String length */
} ppd_cplimit_t;
typedef union ppd_cpvalue_u /**** Custom Parameter Value @since CUPS 1.2/OS X 10.5@ ****/
typedef union ppd_cpvalue_u /**** Custom Parameter Value @since CUPS 1.2/Mac OS X 10.5@ ****/
{
float custom_curve; /* Gamma value */
int custom_int; /* Integer value */
@@ -280,7 +268,7 @@ typedef union ppd_cpvalue_u /**** Custom Parameter Value @since CUPS 1.2/OS X 1
char *custom_string; /* String value */
} ppd_cpvalue_t;
typedef struct ppd_cparam_s /**** Custom Parameter @since CUPS 1.2/OS X 10.5@ ****/
typedef struct ppd_cparam_s /**** Custom Parameter @since CUPS 1.2/Mac OS X 10.5@ ****/
{
char name[PPD_MAX_NAME]; /* Parameter name */
char text[PPD_MAX_TEXT]; /* Human-readable text */
@@ -291,7 +279,7 @@ typedef struct ppd_cparam_s /**** Custom Parameter @since CUPS 1.2/OS X 10.5@ *
ppd_cpvalue_t current; /* Current value */
} ppd_cparam_t;
typedef struct ppd_coption_s /**** Custom Option @since CUPS 1.2/OS X 10.5@ ****/
typedef struct ppd_coption_s /**** Custom Option @since CUPS 1.2/Mac OS X 10.5@ ****/
{
char keyword[PPD_MAX_NAME]; /* Name of option that is being extended... */
ppd_option_t *option; /* Option that is being extended... */
@@ -300,7 +288,7 @@ typedef struct ppd_coption_s /**** Custom Option @since CUPS 1.2/OS X 10.5@ ***
} ppd_coption_t;
typedef struct _ppd_cache_s _ppd_cache_t;
/**** PPD cache and mapping data @since CUPS 1.5/OS X 10.7@ @private@ ****/
/**** PPD cache and mapping data @since CUPS 1.5/Mac OS X 10.7@ @private@ ****/
typedef struct ppd_file_s /**** PPD File ****/
{
@@ -348,25 +336,25 @@ typedef struct ppd_file_s /**** PPD File ****/
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/OS X 10.3@ */
char *pcfilename; /* PCFileName string @since CUPS 1.1.19/OS X 10.3@ */
int num_attrs; /* Number of attributes @since CUPS 1.1.19/OS X 10.3@ @private@ */
int cur_attr; /* Current attribute @since CUPS 1.1.19/OS X 10.3@ @private@ */
ppd_attr_t **attrs; /* Attributes @since CUPS 1.1.19/OS X 10.3@ @private@ */
char *protocols; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19/Mac OS X 10.3@ */
char *pcfilename; /* PCFileName string @since CUPS 1.1.19/Mac OS X 10.3@ */
int num_attrs; /* Number of attributes @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
int cur_attr; /* Current attribute @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
ppd_attr_t **attrs; /* Attributes @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
/**** New in CUPS 1.2/OS X 10.5 ****/
cups_array_t *sorted_attrs; /* Attribute lookup array @since CUPS 1.2/OS X 10.5@ @private@ */
cups_array_t *options; /* Option lookup array @since CUPS 1.2/OS X 10.5@ @private@ */
cups_array_t *coptions; /* Custom options array @since CUPS 1.2/OS X 10.5@ @private@ */
/**** New in CUPS 1.2/Mac OS X 10.5 ****/
cups_array_t *sorted_attrs; /* Attribute lookup array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
cups_array_t *options; /* Option lookup array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
cups_array_t *coptions; /* Custom options array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
/**** New in CUPS 1.3/OS X 10.5 ****/
cups_array_t *marked; /* Marked choices @since CUPS 1.3/OS X 10.5@ @private@ */
/**** New in CUPS 1.3/Mac OS X 10.5 ****/
cups_array_t *marked; /* Marked choices @since CUPS 1.3/Mac OS X 10.5@ @private@ */
/**** New in CUPS 1.4/OS X 10.6 ****/
cups_array_t *cups_uiconstraints; /* cupsUIConstraints @since CUPS 1.4/OS X 10.6@ @private@ */
/**** New in CUPS 1.4/Mac OS X 10.6 ****/
cups_array_t *cups_uiconstraints; /* cupsUIConstraints @since CUPS 1.4/Mac OS X 10.6@ @private@ */
/**** New in CUPS 1.5 ****/
_ppd_cache_t *cache; /* PPD cache and mapping data @since CUPS 1.5/OS X 10.7@ @private@ */
_ppd_cache_t *cache; /* PPD cache and mapping data @since CUPS 1.5/Mac OS X 10.7@ @private@ */
} ppd_file_t;
@@ -434,14 +422,14 @@ extern ppd_option_t *ppdNextOption(ppd_file_t *ppd) _PPD_DEPRECATED;
extern int ppdLocalize(ppd_file_t *ppd) _PPD_DEPRECATED;
extern ppd_file_t *ppdOpen2(cups_file_t *fp) _PPD_DEPRECATED;
/**** New in CUPS 1.3/OS X 10.5 ****/
/**** New in CUPS 1.3/Mac OS X 10.5 ****/
extern const char *ppdLocalizeIPPReason(ppd_file_t *ppd,
const char *reason,
const char *scheme,
char *buffer,
size_t bufsize) _PPD_DEPRECATED;
/**** New in CUPS 1.4/OS X 10.6 ****/
/**** New in CUPS 1.4/Mac OS X 10.6 ****/
extern int cupsGetConflicts(ppd_file_t *ppd, const char *option,
const char *choice,
cups_option_t **options)
+33 -110
Ver Arquivo
@@ -3,7 +3,7 @@
*
* PWG media name API implementation for CUPS.
*
* Copyright 2009-2012 by Apple Inc.
* Copyright 2009-2011 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
@@ -15,6 +15,17 @@
*
* Contents:
*
* _pwgGenerateSize() - Generate a PWG size keyword.
* _pwgInitSize() - Initialize a PWG size using IPP job template
* attributes.
* _pwgMediaForLegacy() - Find a PWG media size by ISO/IPP legacy name.
* _pwgMediaForPPD() - Find a PWG media size by Adobe PPD name.
* _pwgMediaForPWG() - Find a PWG media size by 5101.1 self-describing
* name.
* _pwgMediaForSize() - Get the PWG media name for a given size.
* pwg_compare_legacy() - Compare two sizes using the legacy names.
* pwg_compare_ppd() - Compare two sizes using the PPD names.
* pwg_compare_pwg() - Compare two sizes using the PWG names.
*/
/*
@@ -106,7 +117,7 @@ static _pwg_media_t const cups_pwg_media[] =
/* Chinese Standard Sheet Media Inch Sizes */
_PWG_MEDIA_IN("roc_16k_7.75x10.75in", NULL, "roc16k", 7.75, 10.75),
_PWG_MEDIA_IN("roc_8k_10.75x15.5in", NULL, "roc8k", 10.75, 15.5),
_PWG_MEDIA_IN("roc_8k_10.75x15.5in", NULL, NULL, 10.75, 15.5),
/* ISO Standard Sheet Media Sizes */
_PWG_MEDIA_MM("iso_a10_26x37mm", "iso-a10", "A10", 26, 37),
@@ -117,7 +128,7 @@ static _pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_MM("iso_a5_148x210mm", "iso-a5", "A5", 148, 210),
_PWG_MEDIA_MM("iso_a5-extra_174x235mm", NULL, "A5Extra", 174, 235),
_PWG_MEDIA_MM("iso_a4_210x297mm", "iso-a4", "A4", 210, 297),
_PWG_MEDIA_MM("iso_a4-tab_225x297mm", NULL, "A4Tab", 225, 297),
_PWG_MEDIA_MM("iso_a4-tab_225x297mm", NULL, NULL, 225, 297),
_PWG_MEDIA_MM("iso_a4-extra_235.5x322.3mm", NULL, "A4Extra", 235.5, 322.3),
_PWG_MEDIA_MM("iso_a3_297x420mm", "iso-a3", "A3", 297, 420),
_PWG_MEDIA_MM("iso_a4x3_297x630mm", "iso-a4x3", NULL, 297, 630),
@@ -193,7 +204,6 @@ static _pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_MM("jpn_chou4_90x205mm", NULL, "EnvChou4", 90, 205),
_PWG_MEDIA_MM("jpn_hagaki_100x148mm", NULL, "Postcard", 100, 148),
_PWG_MEDIA_MM("jpn_you4_105x235mm", NULL, "EnvYou4", 105, 235),
_PWG_MEDIA_MM("jpn_you6_98x190mm", NULL, "EnvYou6", 98, 190),
_PWG_MEDIA_MM("jpn_chou2_111.1x146mm", NULL, NULL, 111.1, 146),
_PWG_MEDIA_MM("jpn_chou3_120x235mm", NULL, "EnvChou3", 120, 235),
_PWG_MEDIA_MM("jpn_oufuku_148x200mm", NULL, "DoublePostcardRotated", 148, 200),
@@ -223,90 +233,13 @@ static _pwg_media_t const cups_pwg_media[] =
_PWG_MEDIA_MM("om_small-photo_100x150mm", NULL, "om_small-photo", 100, 150),
_PWG_MEDIA_MM("om_italian_110x230mm", NULL, "EnvItalian", 110, 230),
_PWG_MEDIA_MM("om_postfix_114x229mm", NULL, NULL, 114, 229),
_PWG_MEDIA_MM("om_large-photo_200x300", NULL, "om_large-photo", 200, 300),
_PWG_MEDIA_MM("om_large-photo_200x300", NULL, NULL, 200, 300),
_PWG_MEDIA_MM("om_folio_210x330mm", "folio", "Folio", 210, 330),
_PWG_MEDIA_MM("om_folio-sp_215x315mm", NULL, "FolioSP", 215, 315),
_PWG_MEDIA_MM("om_folio-sp_215x315mm", NULL, NULL, 215, 315),
_PWG_MEDIA_MM("om_invite_220x220mm", NULL, "EnvInvite", 220, 220)
};
/*
* '_pwgFormatInches()' - Convert and format PWG units as inches.
*/
char * /* O - String */
_pwgFormatInches(char *buf, /* I - Buffer */
size_t bufsize, /* I - Size of buffer */
int val) /* I - Value in hundredths of millimeters */
{
int thousandths, /* Thousandths of inches */
integer, /* Integer portion */
fraction; /* Fractional portion */
/*
* Convert hundredths of millimeters to thousandths of inches and round to
* the nearest thousandth.
*/
thousandths = (val * 1000 + 1270) / 2540;
integer = thousandths / 1000;
fraction = thousandths % 1000;
/*
* Format as a pair of integers (avoids locale stuff), avoiding trailing
* zeros...
*/
if (fraction == 0)
snprintf(buf, bufsize, "%d", integer);
else if (fraction % 10)
snprintf(buf, bufsize, "%d.%03d", integer, fraction);
else if (fraction % 100)
snprintf(buf, bufsize, "%d.%02d", integer, fraction / 10);
else
snprintf(buf, bufsize, "%d.%01d", integer, fraction / 100);
return (buf);
}
/*
* '_pwgFormatMillimeters()' - Convert and format PWG units as millimeters.
*/
char * /* O - String */
_pwgFormatMillimeters(char *buf, /* I - Buffer */
size_t bufsize, /* I - Size of buffer */
int val) /* I - Value in hundredths of millimeters */
{
int integer, /* Integer portion */
fraction; /* Fractional portion */
/*
* Convert hundredths of millimeters to integer and fractional portions.
*/
integer = val / 100;
fraction = val % 100;
/*
* Format as a pair of integers (avoids locale stuff), avoiding trailing
* zeros...
*/
if (fraction == 0)
snprintf(buf, bufsize, "%d", integer);
else if (fraction % 10)
snprintf(buf, bufsize, "%d.%02d", integer, fraction);
else
snprintf(buf, bufsize, "%d.%01d", integer, fraction / 10);
return (buf);
}
/*
* '_pwgGenerateSize()' - Generate a PWG size keyword.
*/
@@ -319,21 +252,25 @@ _pwgGenerateSize(char *keyword, /* I - Keyword buffer */
int width, /* I - Width of page in 2540ths */
int length) /* I - Length of page in 2540ths */
{
struct lconv *loc; /* Locale conversion data */
double uwidth, /* Width in inches or millimeters */
ulength; /* Height in inches or millimeters */
const char *units; /* Units to report */
char usize[12 + 1 + 12 + 3], /* Unit size: NNNNNNNNNNNNxNNNNNNNNNNNNuu */
*uptr; /* Pointer into unit size */
char *(*format)(char *, size_t, int);
/* Formatting function */
loc = localeconv();
if ((width % 635) == 0 && (length % 635) == 0)
{
/*
* Use inches since the size is a multiple of 1/4 inch.
*/
uwidth = width / 2540.0;
ulength = length / 2540.0;
units = "in";
format = _pwgFormatInches;
if (!prefix)
prefix = "oe";
@@ -344,25 +281,26 @@ _pwgGenerateSize(char *keyword, /* I - Keyword buffer */
* Use millimeters since the size is not a multiple of 1/4 inch.
*/
uwidth = width * 0.01;
ulength = length * 0.01;
units = "mm";
format = _pwgFormatMillimeters;
if (!prefix)
prefix = "om";
}
uptr = usize;
(*format)(uptr, sizeof(usize) - (uptr - usize), width);
_cupsStrFormatd(uptr, uptr + 12, uwidth, loc);
uptr += strlen(uptr);
*uptr++ = 'x';
(*format)(uptr, sizeof(usize) - (uptr - usize), length);
_cupsStrFormatd(uptr, uptr + 12, ulength, loc);
uptr += strlen(uptr);
/*
* Safe because usize can hold up to 12 + 1 + 12 + 4 bytes.
*/
memcpy(uptr, units, 3);
strcpy(uptr, units);
if (!name)
name = usize;
@@ -822,11 +760,8 @@ _pwgMediaForSize(int width, /* I - Width in 2540ths */
int length) /* I - Length in 2540ths */
{
int i; /* Looping var */
_pwg_media_t *media, /* Current media */
*best_media = NULL; /* Best match */
int dw, dl, /* Difference in width and length */
best_dw = 999, /* Best difference in width and length */
best_dl = 999;
_pwg_media_t *media; /* Current media */
int dw, dl; /* Difference in width and length */
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
@@ -851,25 +786,13 @@ _pwgMediaForSize(int width, /* I - Width in 2540ths */
* is just about 176/2540ths...
*/
dw = abs(media->width - width);
dl = abs(media->length - length);
dw = media->width - width;
dl = media->length - length;
if (!dw && !dl)
if (dw > -176 && dw < 176 && dl > -176 && dl < 176)
return (media);
else if (dw < 176 && dl < 176)
{
if (dw <= best_dw && dl <= best_dl)
{
best_media = media;
best_dw = dw;
best_dl = dl;
}
}
}
if (best_media)
return (best_media);
/*
* Not a standard size; convert it to a PWG custom name of the form:
*
+1 -3
Ver Arquivo
@@ -79,9 +79,6 @@ typedef struct _pwg_size_s /**** Size element - PPD to/from PWG */
* Functions...
*/
extern char *_pwgFormatInches(char *buf, size_t bufsize, int val);
extern char *_pwgFormatMillimeters(char *buf, size_t bufsize,
int val);
extern void _pwgGenerateSize(char *keyword, size_t keysize,
const char *prefix,
const char *name,
@@ -93,6 +90,7 @@ extern _pwg_media_t *_pwgMediaForPPD(const char *ppd);
extern _pwg_media_t *_pwgMediaForPWG(const char *pwg);
extern _pwg_media_t *_pwgMediaForSize(int width, int length);
# ifdef __cplusplus
}
# endif /* __cplusplus */
+4 -1
Ver Arquivo
@@ -36,7 +36,7 @@
/*
* min/max macros...
* min/max/abs macros...
*/
# ifndef max
@@ -45,6 +45,9 @@
# ifndef min
# define min(a,b) ((a) < (b) ? (a) : (b))
# endif /* !min */
# ifndef abs
# define abs(a) ((a) < 0 ? -(a) : (a))
# endif /* !abs */
/*
+32 -32
Ver Arquivo
@@ -3,7 +3,7 @@
*
* Raster file definitions for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* This file is part of the CUPS Imaging library.
@@ -117,28 +117,28 @@ typedef enum cups_cspace_e /**** cupsColorSpace attribute values ****/
CUPS_CSPACE_GOLD = 13, /* Gold foil @deprecated@ */
CUPS_CSPACE_SILVER = 14, /* Silver foil @deprecated@ */
CUPS_CSPACE_CIEXYZ = 15, /* CIE XYZ @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_CIELab = 16, /* CIE Lab @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white (DeviceRGB, sRGB by default) @since CUPS 1.2/OS X 10.5@ */
CUPS_CSPACE_CIEXYZ = 15, /* CIE XYZ @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_CIELab = 16, /* CIE Lab @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white (DeviceRGB, sRGB by default) @since CUPS 1.2/Mac OS X 10.5@ */
CUPS_CSPACE_SW = 18, /* Luminance (gamma 2.2) @since CUPS 1.4.5@ */
CUPS_CSPACE_SRGB = 19, /* Red, green, blue (sRGB) @since CUPS 1.4.5@ */
CUPS_CSPACE_ADOBERGB = 20, /* Red, green, blue (Adobe RGB) @since CUPS 1.4.5@ */
CUPS_CSPACE_ICC1 = 32, /* ICC-based, 1 color @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICC2 = 33, /* ICC-based, 2 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICC3 = 34, /* ICC-based, 3 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICC4 = 35, /* ICC-based, 4 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICC5 = 36, /* ICC-based, 5 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICC6 = 37, /* ICC-based, 6 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICC7 = 38, /* ICC-based, 7 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICC8 = 39, /* ICC-based, 8 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICC9 = 40, /* ICC-based, 9 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICCA = 41, /* ICC-based, 10 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICCB = 42, /* ICC-based, 11 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICCC = 43, /* ICC-based, 12 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICCD = 44, /* ICC-based, 13 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICCE = 45, /* ICC-based, 14 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICCF = 46, /* ICC-based, 15 colors @since CUPS 1.1.19/OS X 10.3@ */
CUPS_CSPACE_ICC1 = 32, /* ICC-based, 1 color @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICC2 = 33, /* ICC-based, 2 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICC3 = 34, /* ICC-based, 3 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICC4 = 35, /* ICC-based, 4 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICC5 = 36, /* ICC-based, 5 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICC6 = 37, /* ICC-based, 6 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICC7 = 38, /* ICC-based, 7 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICC8 = 39, /* ICC-based, 8 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICC9 = 40, /* ICC-based, 9 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICCA = 41, /* ICC-based, 10 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICCB = 42, /* ICC-based, 11 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICCC = 43, /* ICC-based, 12 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICCD = 44, /* ICC-based, 13 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICCE = 45, /* ICC-based, 14 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_ICCF = 46, /* ICC-based, 15 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_DEVICE1 = 48, /* DeviceN, 1 color @since CUPS 1.4.5@ */
CUPS_CSPACE_DEVICE2 = 49, /* DeviceN, 2 colors @since CUPS 1.4.5@ */
@@ -186,8 +186,8 @@ enum cups_mode_e /**** cupsRasterOpen modes ****/
{
CUPS_RASTER_READ = 0, /* Open stream for reading */
CUPS_RASTER_WRITE = 1, /* Open stream for writing */
CUPS_RASTER_WRITE_COMPRESSED = 2, /* Open stream for compressed writing @since CUPS 1.3/OS X 10.5@ */
CUPS_RASTER_WRITE_PWG = 3 /* Open stream for compressed writing in PWG mode @since CUPS 1.5/OS X 10.7@ */
CUPS_RASTER_WRITE_COMPRESSED = 2, /* Open stream for compressed writing @since CUPS 1.3/Mac OS X 10.5@ */
CUPS_RASTER_WRITE_PWG = 3 /* Open stream for compressed writing in PWG mode @since CUPS 1.5/Mac OS X 10.7@ */
};
typedef enum cups_mode_e cups_mode_t; /**** cupsRasterOpen modes ****/
@@ -266,7 +266,7 @@ typedef struct cups_page_header_s /**** Version 1 page header @deprecated@ ****/
} cups_page_header_t;
/**** New in CUPS 1.2 ****/
typedef struct cups_page_header2_s /**** Version 2 page header @since CUPS 1.2/OS X 10.5@ ****/
typedef struct cups_page_header2_s /**** Version 2 page header @since CUPS 1.2/Mac OS X 10.5@ ****/
{
/**** Standard Page Device Dictionary String Values ****/
char MediaClass[64]; /* MediaClass string */
@@ -314,20 +314,20 @@ typedef struct cups_page_header2_s /**** Version 2 page header @since CUPS 1.2/O
unsigned cupsRowStep; /* Spacing between lines */
/**** Version 2 Dictionary Values ****/
unsigned cupsNumColors; /* Number of color compoents @since CUPS 1.2/OS X 10.5@ */
unsigned cupsNumColors; /* Number of color compoents @since CUPS 1.2/Mac OS X 10.5@ */
float cupsBorderlessScalingFactor;
/* Scaling that was applied to page data @since CUPS 1.2/OS X 10.5@ */
/* Scaling that was applied to page data @since CUPS 1.2/Mac OS X 10.5@ */
float cupsPageSize[2]; /* Floating point PageSize (scaling *
* factor not applied) @since CUPS 1.2/OS X 10.5@ */
* factor not applied) @since CUPS 1.2/Mac OS X 10.5@ */
float cupsImagingBBox[4]; /* Floating point ImagingBoundingBox
* (scaling factor not applied, left,
* bottom, right, top) @since CUPS 1.2/OS X 10.5@ */
unsigned cupsInteger[16]; /* User-defined integer values @since CUPS 1.2/OS X 10.5@ */
float cupsReal[16]; /* User-defined floating-point values @since CUPS 1.2/OS X 10.5@ */
char cupsString[16][64]; /* User-defined string values @since CUPS 1.2/OS X 10.5@ */
char cupsMarkerType[64]; /* Ink/toner type @since CUPS 1.2/OS X 10.5@ */
char cupsRenderingIntent[64];/* Color rendering intent @since CUPS 1.2/OS X 10.5@ */
char cupsPageSizeName[64]; /* PageSize name @since CUPS 1.2/OS X 10.5@ */
* bottom, right, top) @since CUPS 1.2/Mac OS X 10.5@ */
unsigned cupsInteger[16]; /* User-defined integer values @since CUPS 1.2/Mac OS X 10.5@ */
float cupsReal[16]; /* User-defined floating-point values @since CUPS 1.2/Mac OS X 10.5@ */
char cupsString[16][64]; /* User-defined string values @since CUPS 1.2/Mac OS X 10.5@ */
char cupsMarkerType[64]; /* Ink/toner type @since CUPS 1.2/Mac OS X 10.5@ */
char cupsRenderingIntent[64];/* Color rendering intent @since CUPS 1.2/Mac OS X 10.5@ */
char cupsPageSizeName[64]; /* PageSize name @since CUPS 1.2/Mac OS X 10.5@ */
} cups_page_header2_t;
typedef struct _cups_raster_s cups_raster_t;
+18 -12
Ver Arquivo
@@ -3,7 +3,7 @@
*
* IPP utilities for CUPS.
*
* Copyright 2007-2012 by Apple Inc.
* Copyright 2007-2011 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
@@ -112,7 +112,7 @@ cupsDoFileRequest(http_t *http, /* I - Connection to server or @code CUPS_HT
* If "outfile" is a valid file descriptor, cupsDoIORequest() copies
* all of the data after the IPP response message to the file.
*
* @since CUPS 1.3/OS X 10.5@
* @since CUPS 1.3/Mac OS X 10.5@
*/
ipp_t * /* O - Response data */
@@ -335,7 +335,7 @@ cupsDoRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
* additional data, use httpRead() after getting a successful response,
* otherwise call httpFlush() to complete the response processing.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
ipp_t * /* O - Response or @code NULL@ on HTTP error */
@@ -415,8 +415,9 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
ippDelete(response);
response = NULL;
_cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
http->status = status = HTTP_ERROR;
http->error = EINVAL;
http->error = EIO;
}
}
else if (status != HTTP_ERROR)
@@ -475,6 +476,10 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
attr ? attr->values[0].string.text :
ippErrorString(response->request.status.status_code), 0);
}
else if (status == HTTP_ERROR)
_cupsSetError(IPP_INTERNAL_ERROR, strerror(http->error), 0);
else if (status != HTTP_OK)
_cupsSetHTTPError(status);
return (response);
}
@@ -494,7 +499,7 @@ cupsLastError(void)
/*
* 'cupsLastErrorString()' - Return the last IPP status-message.
*
* @since CUPS 1.2/OS X 10.5@
* @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - status-message text from last request */
@@ -540,7 +545,7 @@ _cupsNextDelay(int current, /* I - Current delay value or 0 */
* This function is used after cupsGetResponse() to read the PPD or document
* files for CUPS_GET_PPD and CUPS_GET_DOCUMENT requests, respectively.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
ssize_t /* O - Bytes read, 0 on EOF, -1 on error */
@@ -587,7 +592,7 @@ cupsReadResponseData(
* Unlike cupsDoFileRequest(), cupsDoIORequest(), and cupsDoRequest(), the
* request is not freed.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
http_status_t /* O - Initial HTTP status */
@@ -638,10 +643,11 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
}
else if (http->state != HTTP_WAITING)
{
DEBUG_printf(("1cupsSendRequest: Unknown HTTP state (%d), "
"reconnecting.", http->state));
if (httpReconnect(http))
return (HTTP_ERROR);
DEBUG_printf(("1cupsSendRequest: Unknown HTTP state (%d), bailing.",
http->state));
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
return (HTTP_ERROR);
}
#ifdef HAVE_SSL
@@ -879,7 +885,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
* This function is used after @link cupsSendRequest@ to provide a PPD and
* after @link cupsStartDocument@ to provide a document file.
*
* @since CUPS 1.4/OS X 10.6@
* @since CUPS 1.4/Mac OS X 10.6@
*/
http_status_t /* O - @code HTTP_CONTINUE@ if OK or HTTP status on error */

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais