mirror of
https://github.com/MopriaAlliance/CUPS-for-Android.git
synced 2026-02-04 12:16:40 +08:00
Upgrading to CUPS 2.2.1
This commit is contained in:
parent
52519bfb65
commit
130bd3bb59
19
Android.mk
19
Android.mk
@ -19,25 +19,22 @@ include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES:= \
|
||||
cups/array.c \
|
||||
cups/attr.c \
|
||||
cups/auth.c \
|
||||
cups/backchannel.c \
|
||||
cups/backend.c \
|
||||
cups/conflicts.c \
|
||||
cups/custom.c \
|
||||
cups/debug.c \
|
||||
cups/dest.c \
|
||||
cups/dest-job.c \
|
||||
cups/dest-localization.c \
|
||||
cups/dest-options.c \
|
||||
cups/dir.c \
|
||||
cups/emit.c \
|
||||
cups/encode.c \
|
||||
cups/file.c \
|
||||
cups/getdevices.c \
|
||||
cups/getifaddrs.c \
|
||||
cups/getputfile.c \
|
||||
cups/globals.c \
|
||||
cups/hash.c \
|
||||
cups/http.c \
|
||||
cups/http-addr.c \
|
||||
cups/http-addrlist.c \
|
||||
@ -46,15 +43,17 @@ LOCAL_SRC_FILES:= \
|
||||
cups/ipp-support.c \
|
||||
cups/langprintf.c \
|
||||
cups/language.c \
|
||||
cups/localize.c \
|
||||
cups/mark.c \
|
||||
cups/md5.c \
|
||||
cups/md5passwd.c \
|
||||
cups/notify.c \
|
||||
cups/options.c \
|
||||
cups/page.c \
|
||||
cups/ppd.c \
|
||||
cups/ppd-attr.c \
|
||||
cups/ppd-cache.c \
|
||||
cups/ppd-conflicts.c \
|
||||
cups/ppd-custom.c \
|
||||
cups/ppd-mark.c \
|
||||
cups/ppd-page.c \
|
||||
cups/pwg-media.c \
|
||||
cups/request.c \
|
||||
cups/sidechannel.c \
|
||||
@ -63,6 +62,7 @@ LOCAL_SRC_FILES:= \
|
||||
cups/string.c \
|
||||
cups/tempfile.c \
|
||||
cups/thread.c \
|
||||
cups/tls-gnutls.c \
|
||||
cups/transcode.c \
|
||||
cups/usersys.c \
|
||||
cups/util.c \
|
||||
@ -73,10 +73,11 @@ disabled_src_files:= \
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(LOCAL_PATH)/cups \
|
||||
$(LOCAL_PATH)/../openssl/include
|
||||
$(LOCAL_PATH)/../gnutls/include
|
||||
LOCAL_CFLAGS := -D_PPD_DEPRECATED=
|
||||
LOCAL_MODULE := lib$(PRIV_LIB_NAME)cups
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_LDLIBS += -lz -llog
|
||||
LOCAL_STATIC_LIBRARIES := libssl libcrypto
|
||||
LOCAL_STATIC_LIBRARIES := libgnutls
|
||||
LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
244
CHANGES-1.6.txt
Normal file
244
CHANGES-1.6.txt
Normal file
@ -0,0 +1,244 @@
|
||||
CHANGES-1.6.txt
|
||||
---------------
|
||||
|
||||
CHANGES IN CUPS V1.6.4
|
||||
|
||||
- Removed some duplicate size definitions for some ISO sizes that were
|
||||
causing problems (<rdar://problem/14722721>)
|
||||
- The IPP backend did not add the "last-document" attribute
|
||||
(<rdar://problem/114660379>)
|
||||
- Added a SyncOnClose directive to cups-files.conf to force cupsd to
|
||||
call fsync before closing any configuration/state files it writes
|
||||
(<rdar://problem/14523043>)
|
||||
- Added USB quirk rule for Lexmark E238 (<rdar://problem/14493054>)
|
||||
- Closed server connections were still not always detected
|
||||
(<rdar://problem/14484313>)
|
||||
- The libusb-based USB backend now loads its list of quirks from files
|
||||
in /usr/share/cups/usb instead of using a hardcoded table
|
||||
(<rdar://problem/14442769>)
|
||||
- The scheduler did not properly register ICC color profiles with
|
||||
colord (<rdar://problem/14455625>)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.6.3
|
||||
|
||||
- The configure script now prefers Clang over GCC.
|
||||
- Fixed a compile problem on AIX (STR #4307)
|
||||
- The default IPP version did not always get set before creating a new
|
||||
IPP request message (<rdar://problem/14401718>)
|
||||
- The lp, lpq, lpr, and lpstat now display an error message advising the
|
||||
use of the /version=1.1 ServerName option (<rdar://problem/14290628>)
|
||||
- Added documentation about the /version=1.1 option to ServerName in
|
||||
client.conf (<rdar://problem/14216262>)
|
||||
- httpStatus(HTTP_ERROR) did not return a useful error message
|
||||
(<rdar://problem/14217326>)
|
||||
- The lp, lpq, lpr, and lpstat commands incorrectly ignored the default
|
||||
printer set in the lpoptions file (<rdar://problem/14216472>)
|
||||
- Fixed a URI encoding issue for hostnames containing the ` (backquote)
|
||||
character (<rdar://problem/14243133>)
|
||||
- Added support for RFC 6874's IPv6 link local address format in URIs
|
||||
(<rdar://problem/13979453>)
|
||||
- The USB backend could crash on libusb-based systems if USB was
|
||||
disabled in the BIOS (<rdar://problem/13875729>)
|
||||
- Fixed a rounding error in the PWG media size mapping code
|
||||
(<rdar://problem/13493241>)
|
||||
- Fixed several ipptool test files that used old STATUS names.
|
||||
- Kerberos credentials could get truncated when printing to a shared
|
||||
printer.
|
||||
- Printing using "ipps" URIs was not encrypted.
|
||||
- Insecure ICC profiles prevented installation of user profiles for a
|
||||
printer on OS X.
|
||||
- Added more USB quirks for the libusb-based backend (STR #4311,
|
||||
<rdar://problem/13736470>)
|
||||
- The Russian web interface templates were broken (STR #4310)
|
||||
- The scheduler no longer tries to do Kerberos authentication over the
|
||||
loopback interface.
|
||||
- The IPP backend could fail to pause a job for authentication
|
||||
(STR #4298)
|
||||
- Fixed a regression on the handling of auth keys on OS X if the
|
||||
cups-files.conf was not present or did not contain a SystemAuthKey
|
||||
value.
|
||||
- The scheduler incorrectly did a reverse lookup of the server address
|
||||
when HostNameLookups was turned off (STR #4302)
|
||||
- The scheduler incorrectly computed the final content type value when
|
||||
null filters were present.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.6.2
|
||||
|
||||
- Documentation fixes (STR #4229, STR #4239, STR #4234, STR #4248,
|
||||
STR #4259)
|
||||
- Security: All file, directory, user, and group settings are now stored
|
||||
in a separate cups-files.conf configuration file that cannot be set
|
||||
through the CUPS web interface or APIs (STR #4223)
|
||||
- Added a Czech localization (STR #4201)
|
||||
- Added a French localization (STR #4247)
|
||||
- Added a Russian localization (STR #4228, STR #4285)
|
||||
- Updated the Catalan localization (STR #4202)
|
||||
- Local certificate authentication did not guard against an empty
|
||||
certification file (STR #4293)
|
||||
- The scheduler did not reject device URIs with spaces.
|
||||
- Added USB quirk rule for Epson Stylus Photo 750 (STR #4286)
|
||||
- The IPP backend could crash if the printer disconnects early
|
||||
(STR #4284)
|
||||
- cupsGetPPD did not work with statically-configured CUPS shared
|
||||
queues (STR #4178)
|
||||
- The scheduler did not support long MIME media types (STR #4270)
|
||||
- The cupsfilter command did not set the CHARSET environment variable
|
||||
for the text filters (STR #4273)
|
||||
- The lp command did not show errors for unknown "--foo" (STR #4261)
|
||||
- Bad IPP responses could crash ipptool (STR #4262)
|
||||
- Updated USB quirk rules for Canon and Xerox printers (STR #4217,
|
||||
STR #4263)
|
||||
- Added USB blacklisting for printers that require a custom backend
|
||||
(STR #4218)
|
||||
- The PPD compiler did not correctly JCL options (STR #4115, STR #4203)
|
||||
- The ipptool program now supports DEFINE-MATCH and DEFINE-NO-MATCH
|
||||
predicates for STATUS directives.
|
||||
- Fixed a problem with local Kerberos authentication (STR #4140)
|
||||
- Coverity scan: fixed some minor issues (STR #4242)
|
||||
- The scheduler did not remove color profiles after deleting a printer
|
||||
(STR #4232, STR #4276)
|
||||
- The CUPS library did not always detect a timed out connection to the
|
||||
server which could cause temporary loss of printing from applications
|
||||
(STR #4187)
|
||||
- The ipptool program now supports variable substitution in OPERATION
|
||||
and DELAY directives (STR #4175)
|
||||
- The IPP backend now stops queues when the server configuration
|
||||
prevents successful job submission (STR #4125)
|
||||
- The XML output of ipptool contained empty dictionaries (STR #4136)
|
||||
- The scheduler did not delete job control backup files (STR #4244)
|
||||
- cupsGetPPD3 could return a local PPD instead of the correct remote
|
||||
PPD.
|
||||
- The scheduler incorrectly advertised auth-info-required for local
|
||||
queues needing local authentication (STR #4205)
|
||||
- CUPS 1.6 clients using the ServerName directive in client.conf did not
|
||||
work with CUPS 1.3.x or older servers (STR #4231, STR #4291)
|
||||
- The SNMP backend now tries to work around broken printers that use a
|
||||
newline to separate key/value pairs.
|
||||
- The IPP backend did not send a cancel request to printers when a job
|
||||
was canceled and the printer did not support Create-Job.
|
||||
- Fixed EPM packaging files (STR #4199)
|
||||
- OpenBSD build fix (STR #4195, STR #4196, STR #4197)
|
||||
- The scheduler could crash when using Avahi (STR #4183, STR #4192,
|
||||
STR #4200, STR #4213)
|
||||
- The IPP backend could get stuck in an endless loop on certain network
|
||||
errors (STR #4194)
|
||||
- 32-bit builds failed on Debian (STR #4133)
|
||||
- The scheduler no longer accepts or sends job description attributes.
|
||||
- The IPP backend now works around some conformance issues for broken
|
||||
printers (STR #4190)
|
||||
- cupsBackendReport() now filters out all control characters from the
|
||||
reported 1284 device IDs (STR #4124)
|
||||
- The scheduler no longer allows job-name values that are not valid
|
||||
network Unicode strings (STR #4072)
|
||||
- The web interface did not preserve the order of classes, jobs, or
|
||||
printers (STR #4170)
|
||||
- The network backends now support disabling of SNMP supply level
|
||||
queries via the "snmp" URI option (STR #4106)
|
||||
- The IPP backend did not specify the compression used (STR #4181)
|
||||
- ipptool did not support octetString values.
|
||||
- The scheduler did not recognize dnssd: or ipps: URIs as Bonjour shared
|
||||
queues (STR #4158)
|
||||
- Applications could not get the PPD file for statically-configured
|
||||
Bonjour-shared print queues (STR #4159)
|
||||
- The cupsd.conf file included obsolete browsing directives (STR #4157)
|
||||
- Fixed a USB backend compatibility issue on systems using libusb
|
||||
(STR #4155, STR #4191)
|
||||
- Some Bonjour features were not available on systems with Avahi
|
||||
(STR #4156)
|
||||
- CUPS now includes the port number in the Host: header for HTTP
|
||||
requests.
|
||||
- Fixed REPEAT-MATCH for STATUS and EXPECT - was incorrectly erroring
|
||||
out.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.6.1
|
||||
|
||||
- Documentation fix (STR #4149)
|
||||
- RPM packaging fixes (STR #4129, #4145)
|
||||
- The Japanese and English web interface headers were swapped
|
||||
(STR #4148)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.6.0
|
||||
|
||||
- Document changes (STR #4131)
|
||||
- Added new Catalan (STR #4107) and Spanish (STR #4137) localizations.
|
||||
|
||||
|
||||
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 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",
|
||||
"natural-scaling", "penwidth", "position", "ppi", "saturation", and
|
||||
"scaling" options are not longer supported (STR #4010)
|
||||
- The "page-bottom", "page-left", "page-right", "page-top",
|
||||
"prettyprint", and "wrap" options have been deprecated (STR #4010)
|
||||
- The scheduler now reports the standard "number-of-documents" attribute
|
||||
instead of the CUPS-specific "document-count" attribute in
|
||||
job objects.
|
||||
- Added new destination connection and enumeration functions (STR #3924)
|
||||
- Added new option, localization, and job submission functions that do
|
||||
not depend on PPD files (STR #3925)
|
||||
- Added a new MaxJobTime directive for cupsd that specifies the maximum
|
||||
amount of time allowed for a job to complete before it is canceled.
|
||||
- The default password callback now supports passwords up to 127
|
||||
characters.
|
||||
- The scheduler now supports a DefaultAuthType of "auto" to
|
||||
automatically choose between Basic (username/password) and Negotiate
|
||||
(Kerberos) authentication.
|
||||
- cupsSideChannelSNMPGet/Walk now support OIDs and values up to 64k in
|
||||
length.
|
||||
- CUPS no longer supports automatic remote printers or implicit classes
|
||||
via the CUPS, LDAP, or SLP protocols (STR #3922, STR #3923)
|
||||
- The PPD APIs are now deprecated and will be removed in a future
|
||||
version of CUPS (STR #3927)
|
||||
- The default IPP version for requests is now 2.0 (STR #3929)
|
||||
- The IPP APIs no longer expose the ipp_t or ipp_attribute_t structures
|
||||
and instead provide accessor functions (STR #3928)
|
||||
- The scheduler will no longer run programs with group write permission.
|
||||
- The PHP module has been removed (STR #3932)
|
||||
- The bannertops, commandtoescpx, commandtopclx, imagetops,
|
||||
imagetoraster, pdftops, rastertoescpx, rastertopclx, and texttops
|
||||
filters have been removed (STR #3930)
|
||||
- The serial and parallel backends have been removed (STR 3935)
|
||||
250
CHANGES-1.7.txt
Normal file
250
CHANGES-1.7.txt
Normal file
@ -0,0 +1,250 @@
|
||||
CHANGES-1.7.txt
|
||||
---------------
|
||||
|
||||
CHANGES IN CUPS V1.7.5
|
||||
|
||||
- Security: Addressed some more situations where symlinked files would
|
||||
be served by the web interface (STR #4455)
|
||||
- The LPD backend did not work with some versions of glibc (STR #4452)
|
||||
- CGI scripts did not work (STR #4454)
|
||||
- The cupsd.conf man page did not list the ErrorPolicy directive
|
||||
(STR #4457)
|
||||
- Updated the Brazilian Portuguese translation (STR #4456)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.7.4
|
||||
|
||||
- Security: The web interface incorrectly served symlinked files and
|
||||
files that were not world-readable, potentially leading to a
|
||||
disclosure of information (STR #4450)
|
||||
- The CUPS headers incorrectly needed libdispatch for blocks support
|
||||
(STR #4397)
|
||||
- CUPS did not compile when Avahi or mDNSResponder was not present
|
||||
(STR #4402, STR #4424)
|
||||
- The "snmp" option did not work with the network backends (STR #4422)
|
||||
- The User directive in client.conf did not override the USER
|
||||
environment variable (STR #4426)
|
||||
- The web interface now properly shows a "Go" button for all text-based
|
||||
browsers (STR #4425)
|
||||
- The MaxJobTime directive now properly supports time values (STR #4434)
|
||||
- The RPM spec file did not work due to the new Brazilian Portuguese
|
||||
localization (STR #4436)
|
||||
- Fixed an "IPP read error" issue (STR #4440)
|
||||
- Fixed the --disable-libusb configure option (STR #4439)
|
||||
- Fixed the debug output from the DNS-SD backend when using Avahi
|
||||
(STR #4444)
|
||||
- Fixed a bug in the CUPS_SC_GET_DEVICE_ID handling by the network
|
||||
backends (STR #4447)
|
||||
- Added USB quirk rule for Lexmark E230 (STR #4448)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.7.3
|
||||
|
||||
- Added Brazilian Portuguese translation (STR #4409)
|
||||
- Fixed mapping of OutputBin values such as "Tray1"
|
||||
(<rdar://problem/16685606>)
|
||||
- Several ippGet* functions incorrectly returned -1 instead of 0 on
|
||||
error.
|
||||
- The cupsGetResponse function did not work properly with
|
||||
CUPS_HTTP_DEFAULT (<rdar://problem/16762593>)
|
||||
- The IPP backend did not abort a job when the printer did not validate
|
||||
the supplied options (<rdar://problem/16836752>)
|
||||
- Fixed an authentication race condition in cupsSendRequest (STR #4403)
|
||||
- The scheduler did not add the "job-hold-until-specified" reason when
|
||||
holding a job using the lp command (STR #4405)
|
||||
- The configure script incorrectly added libgcrypt as a GNU TLS
|
||||
dependency (STR #4399)
|
||||
- cupsGetDestMediaCount did not work for CUPS_MEDIA_FLAGS DEFAULT
|
||||
(STR #4414)
|
||||
- Auto-typing of PWG Raster files did not work (STR #4417)
|
||||
- IPP queues using hardcoded credentials would ask for credentials
|
||||
(STR #4371)
|
||||
- Dates in non-UTF-8 locales did not display correctly (STR #4388)
|
||||
- The RPM spec file now looks for libusb-devel 1.0 or later.
|
||||
- Fixed the "create-printer-subscription.test" file for IPPTOOL
|
||||
(STR #4420)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.7.2
|
||||
|
||||
- Security: The scheduler now blocks URLs containing embedded HTML
|
||||
(STR #4356)
|
||||
- Documentation fixes (STR #3259, STR #4346, STR #4355)
|
||||
- Fixed the Japanese localization (STR #4385)
|
||||
- Added a German localization (STR #4363)
|
||||
- The cupsfilter command incorrectly read the cupsd.conf file; it now
|
||||
reads the cups-files.conf file instead.
|
||||
- Fixed OS X builds with Xcode 5.x (<rdar://problem/15914959>)
|
||||
- Fixed SSL support on Windows (STR #4358)
|
||||
- Fixed documentation and naming of Create-Job/Printer-Subscriptions
|
||||
operations (STR #4389)
|
||||
- Phone numbers in fax jobs were not properly filtered for IPP FaxOut
|
||||
(<rdar://problem/16351701>)
|
||||
- Updated Linux "relro" support (STR #4349)
|
||||
- Fixed a memory leak in the label printer driver (STR #4393)
|
||||
- cupsEnumDests did not set the "is_default" field (STR #4332)
|
||||
- cupsDoIORequest could miss the server status, causing failed lpadmin
|
||||
and other administrative commands (STR #4386)
|
||||
- cupsEnumDests didn't always call the callback function (STR #4380)
|
||||
- "lp -i job-id -H hold" did not work (STR #nnn)
|
||||
- CUPS didn't compile on older platforms (STR #4338)
|
||||
- Several libcups files did not have the Apple license exception
|
||||
notice (STR #4361)
|
||||
- Fixed a D-BUS threading issue that caused the scheduler to crash
|
||||
(STR #4347)
|
||||
- The scheduler now automatically reconnects to Avahi as needed
|
||||
(STR #4370, STR #4373)
|
||||
- The scheduler did not handle GET requests for the log files properly
|
||||
(STR #3265)
|
||||
- The dnssd backend did not always report all discovered printers using
|
||||
Avahi (STR #4365)
|
||||
- The Zebra printer driver did not properly handle negative "label top"
|
||||
values (STR #4354)
|
||||
- The scheduler did not always update the MakeModel value in
|
||||
printers.conf after updating the driver (STR #4264)
|
||||
- The LPD mini daemon did not support print jobs larger than 2GB
|
||||
(STR #4351)
|
||||
- Fixed a bug in the status reading code when sending a compressed data
|
||||
stream to an IPP printer/server (<rdar://problem/16019623>)
|
||||
- The IPP backend might not include all job attributes in Validate-Job
|
||||
operations (<rdar://problem/16025435>)
|
||||
- Fixed some clang-reported issues (<rdar://problem/15936066>)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.7.1
|
||||
|
||||
- Security: the lppasswd program incorrectly used settings from
|
||||
~/.cups/client.conf (STR #4319)
|
||||
- Auto debug logging was broken in 1.7.0 (<rdar://problem/15331639>)
|
||||
- Some gzip'd PPD files could not be used (<rdar://problem/15386424>)
|
||||
- Cleaned up some job logging in the scheduler
|
||||
(<rdar://problem/15332672>)
|
||||
- ATTR messages could cause string pool memory corruption in the
|
||||
scheduler (<rdar://problem/15382819>)
|
||||
- The RPM spec file did not list the build requirements; this was on
|
||||
purpose, but now we are listing the Red Hat package names
|
||||
(<rdar://problem/15375760>, STR #4322)
|
||||
- Printing to a raw queue could result in corrupt output due to
|
||||
opportunistic compression (<rdar://problem/15008524>)
|
||||
- The GNU TLS support code triggered many compiler warnings due to the
|
||||
use of old GNU TLS compatibility type names
|
||||
(<rdar://problem/15392966>)
|
||||
- The "make check" test suite did not work on Linux without the
|
||||
cups-filters package installed (<rdar://problem/14292998>)
|
||||
- Japanese PPDs using with the Shift-JIS encoding did not work
|
||||
(<rdar://problem/15427759>)
|
||||
- "tel:" URIs incorrectly had slashes (<rdar://problem/15418463>)
|
||||
- The libusb-based USB backend incorrectly used write timeouts
|
||||
(<rdar://problem/15564888>)
|
||||
- Shared printers could become inaccessible after a few days on OS X
|
||||
(<rdar://problem/15426838>)
|
||||
- The IPP backend did not wait for a busy printer to become available
|
||||
before attempting to print (<rdar://problem/15465667>)
|
||||
- CUPS did not support "auto-monochrome" or "process-monochrome" for the
|
||||
"print-color-mode" option (<rdar://problem/15482520>)
|
||||
- Using "@IF(name)" in an Allow or Deny rule did not work (STR #4328)
|
||||
- lpq and lpstat did not list jobs in the correct order when priorities
|
||||
were specified (STR #4326)
|
||||
- The D-BUS notifier did not remove its lockfile (STR #4314)
|
||||
- CUPS incorrectly used the USER environment variable when the name did
|
||||
not match the user ID (STR #4327)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.7.0
|
||||
|
||||
- Updated the Japanese localization.
|
||||
- The lpadmin command did not send the PPD name from the "-m" option
|
||||
(<rdar://problem/15264697>)
|
||||
- Network backends now use the prtMarkerSuppliesClass property to
|
||||
determine the direction of supply level values
|
||||
(<rdar://problem/14302628>)
|
||||
- The scheduler did not remove backup PPD files when a printer was
|
||||
deleted (<rdar://problem/15065555>)
|
||||
- The scheduler incorrectly responded to HEAD requests when the web
|
||||
interface was disabled (<rdar://problem/15090332>)
|
||||
- The scheduler did not respond using the hostname specified by the
|
||||
client (<rdar://problem/14583574>)
|
||||
- Fax queues did not work when shared via Bonjour
|
||||
(<rdar://problem/14498310>)
|
||||
- Error messages from the scheduler were not localized using the
|
||||
language specified in the client's IPP request
|
||||
(<rdar://problem/14128011>)
|
||||
- Added an Italian localization (<rdar://problem/14481578>)
|
||||
- Fixed a couple memory leaks in ippfind that were reported by Clang.
|
||||
- Fixed a compile issue on 64-bit Linux with Clang - need to use the
|
||||
-pie option instead of -Wl,-pie now (<rdar://problem/14480938>)
|
||||
- The ippfind utility reported the wrong port numbers when compiled
|
||||
against Avahi (<rdar://problem/14508324>)
|
||||
- httpGetFd, httpGetFile, httpPutFd, and httpPutFile did not
|
||||
automatically reconnect if the server closed the connecion after the
|
||||
previous response.
|
||||
- Fixed a compile error in libcups (<rdar://problem/14467141>)
|
||||
- The scheduler incorrectly did not pass a FINAL_CONTENT_TYPE
|
||||
environment variable to the filters or backend
|
||||
(<rdar://problem/14355011>)
|
||||
- The cups-exec helper program could fail randomly on OS X due to
|
||||
sandbox violations when closing excess file descriptors
|
||||
(<rdar://problem/14421943>)
|
||||
- The scheduler incorrectly did not use the kqueue interface on OS X.
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.7rc1
|
||||
|
||||
- Printer xxx-default values were not reported by Get-Printer-Attributes
|
||||
or lpoptions (<rdar://problem/14401795>)
|
||||
- Fixed deprecation warnings for many functions on OS X so they are tied
|
||||
to the deployment version when building (<rdar://problem/14210079>)
|
||||
- Fixed a build issue on ARM-based Linux systems - unable to validate
|
||||
va_list arguments.
|
||||
- Added a new ippfind tool for finding IPP printers and other Bonjour
|
||||
services (<rdar://problem/13876199>)
|
||||
- Fixed some issues with conversion of PWG media size names to
|
||||
hundredths of millimeters (<rdar://problem/14065748>)
|
||||
- The IPP backend could crash on OS X when printing to a Kerberized
|
||||
printer (<rdar://problem/14040186>)
|
||||
- The ipptool program now automatically extends timeouts when the
|
||||
output buffer is filled (<rdar://problem/14016099>)
|
||||
- The ipptool program now supports the --help and --version options.
|
||||
- The ipptool program did not continue past include file errors by
|
||||
default (<rdar://problem/13875803>)
|
||||
- The ipptool program now supports FILE-ID and TEST-ID directives and
|
||||
includes their values in its XML output (<rdar://problem/13876038>)
|
||||
- The ipptool program now supports WITH-HOSTNAME, WITH-RESOURCE, and
|
||||
WITH-SCHEME expect predicates to compare the corresponding URI
|
||||
components (<rdar://problem/13876091>)
|
||||
|
||||
|
||||
CHANGES IN CUPS V1.7b1
|
||||
|
||||
- The configure script now supports a --with-rundir option to change
|
||||
the transient run-time state directory from the default to other
|
||||
locations like /run/cups (STR #4306)
|
||||
- The scheduler now supports PPD lookups for classes (STR #4296)
|
||||
- The cupsfilter program did not set the FINAL_CONTENT_TYPE
|
||||
environment variable for filters.
|
||||
- Added a new "-x" option to the cancel command (STR #4103)
|
||||
- Made the PWG media handling APIs public (STR #4267)
|
||||
- Implemented ready media support for the cupsGetDestMediaXxx APIs
|
||||
(STR #4289)
|
||||
- Added new cupsFindDestDefault, cupsFindDestReady, and
|
||||
cupsFindDestSupported APIs (STR #4289)
|
||||
- Added new cupsGetDestMediaByIndex, cupsGetDestMediaCount, and
|
||||
cupsGetDestMediaDefault APIs (STR #4289)
|
||||
- Added new ippGet/SetOctetString APIs for getting and setting an
|
||||
octetString value (STR #4289)
|
||||
- Added new ippCreateRequestedArray API for generating a array of
|
||||
attributes from the requested-attributes attribute.
|
||||
- The ipptool utility now supports compression, conditional tests based
|
||||
on the presence of files, and new DEFINE predicates for STATUS.
|
||||
- Added new IPP APIs for checking values (STR #4167)
|
||||
- Added new IPP APis for adding and setting formatted strings.
|
||||
- Added new HTTP APIs to support basic server functionality via libcups.
|
||||
- The dnssd backend now generates a 1284 device ID as needed (STR #3702)
|
||||
- CUPS now supports compressing and decompressing streamed data
|
||||
(STR #4168)
|
||||
- CUPS now supports higher-level PIN printing, external accounting
|
||||
systems, and "print here" printing environments (STR #4169)
|
||||
- IRIX is no longer a supported operating system (STR #4092)
|
||||
- The PPD compiler now supports JCL options properly (STR #4115)
|
||||
- The web interface now checks whether the web browser has cookies
|
||||
enabled and displays a suitable error message (STR #4141)
|
||||
215
CHANGES-2.0.txt
Normal file
215
CHANGES-2.0.txt
Normal file
@ -0,0 +1,215 @@
|
||||
CHANGES-2.0.txt
|
||||
---------------
|
||||
|
||||
CHANGES IN CUPS V2.0.4
|
||||
|
||||
- Fixed a bug in cupsRasterWritePixels (STR #4650)
|
||||
- Fixed redirection in the web interface (STR #4538)
|
||||
- The IPP backend did not respond to side-channel requests (STR #4645)
|
||||
- The scheduler did not start all pending jobs at once (STR #4646)
|
||||
- The web search incorrectly searched time-at-xxx values (STR #4652)
|
||||
- Fixed an RPM spec file issue (STR #4657)
|
||||
- The scheduler incorrectly started jobs while canceling multiple jobs
|
||||
(STR #4648)
|
||||
- Fixed processing of server overrides without port numbers (STR #4675)
|
||||
- Documentation changes (STR #4651, STR #4674)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.0.3
|
||||
|
||||
- Security: Fixed CERT VU #810572 exploiting the dynamic linker
|
||||
(STR #4609)
|
||||
- Security: The scheduler could hang with malformed gzip data
|
||||
(STR #4602)
|
||||
- Restored missing generic printer icon file (STR #4587)
|
||||
- Fixed logging of configuration errors to show up as errors (STR #4582)
|
||||
- Fixed potential buffer overflows in raster code and filters
|
||||
(STR #4598, STR #4599, STR #4600, STR #4601)
|
||||
- Fixed a gzip processing bug (#4602)
|
||||
- Fixed <Limit> inside <Location> (STR #4575)
|
||||
- Fixed lpadmin when both -m and -o are used (STR #4578)
|
||||
- The web interface always showed support for 2-sided printing
|
||||
(STR #4595)
|
||||
- cupsRasterReadHeader did not fully validate the raster header
|
||||
(STR #4596)
|
||||
- The rastertopwg filter did not check for truncated input (STR #4597)
|
||||
- The cups-lpd mini-daemon did not check for request parameters
|
||||
(STR #4603)
|
||||
- The scheduler could get caught in a busy loop (STR #4605)
|
||||
- The sample Epson driver could crash (STR #4616)
|
||||
- The IPP backend now correctly monitors jobs
|
||||
(<rdar://problem/20495955>)
|
||||
- The ppdhtml and ppdpo utilities crashed when the -D option was used
|
||||
before a driver information file (STR #4627)
|
||||
- ippfind incorrectly substituted "=port" for service_port.
|
||||
- The IPP/1.1 test file did not handle the initial print job
|
||||
completing early (STR #4576)
|
||||
- Fixed a memory leak in cupsConnectDest (STR #4634)
|
||||
- PWG Raster Format output contained invalid ImageBox values
|
||||
(<rdar://problem/21144309>)
|
||||
- Added Russian translation (STR #4577)
|
||||
- Added German translation (STR #4635)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.0.2
|
||||
|
||||
- Security: cupsRasterReadPixels buffer overflow with invalid page
|
||||
header and compressed raster data (STR #4551)
|
||||
- Command-line programs were not localized on Mac OS X
|
||||
(<rdar://problem/14546232>)
|
||||
- The scheduler incorrectly cleared the MakeModel string in the
|
||||
printers.conf file after a restart (<rdar://problem/16827518>)
|
||||
- CUPS did not compile with older versions of GNU TLS (STR #4527)
|
||||
- CUPS did not compile without Avahi or mDNSResponder (STR #4523)
|
||||
- ippLength() did not return the correct length for IPP_TAG_CONST
|
||||
string values.
|
||||
- The scheduler incorrectly aborted jobs after a job was restarted
|
||||
(<rdar://problem/19129387>)
|
||||
- The cups-files.conf file contained the old ServerCertificate/Key
|
||||
directives instead of ServerKeychain.
|
||||
- Fixed builds when no SSL/TLS library is available, or when explicitly
|
||||
disabled (STR #4531)
|
||||
- Fixed an OpenBSD charset transcoding issue.
|
||||
- Fixed USB printing on OpenBSD (STR #4525)
|
||||
- The --without-xinetd configure option did not work (STR #4542)
|
||||
- Backends needing to load OS X kernel extensions did not work
|
||||
(<rdar://problem/19015679>)
|
||||
- Mapping of PPD keywords to IPP keywords did not work if the PPD
|
||||
keyword was already an IPP keyword (<rdar://problem/19121005>)
|
||||
- cupsGetPPD* sent bad requests (STR #4567)
|
||||
- ippserver used the wrong temporary directory on Windows (STR #4547)
|
||||
- ippserver did not handle Bonjour registrations properly (STR #4548)
|
||||
- The scheduler could crash during shutdown if Avahi was shutdown
|
||||
first (STR #4550)
|
||||
- Added a USB quirk rule for Intermec printers (STR #4553)
|
||||
- The scheduler did not always log which configuration file had the
|
||||
error (STR #4559)
|
||||
- The ippfind and ipptool programs now correctly match hostnames with
|
||||
trailing dots (STR #4563)
|
||||
- The ipptool timeout option did not work (STR #4515)
|
||||
- Fixed several issues with client.conf, CUPS_SERVER, and the "-h"
|
||||
option of most commands (STR #4528)
|
||||
- Another change for OpenBSD (STR #4526)
|
||||
- Added Japanese localization (STR #4524)
|
||||
- Documentation changes (STR #4569)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.0.1
|
||||
|
||||
- Security: SSLv3 is now disabled by default to protect against the
|
||||
POODLE attack (STR #4476)
|
||||
- Printer sharing did not work when systemd was being used (STR #4497)
|
||||
- cupsGetPPD* would return a symlink to the PPD in /etc/cups/ppd even if
|
||||
it was not readable by the user (STR #4500)
|
||||
- The web interface now protects against frame "click-jacking" attacks
|
||||
(STR #4492)
|
||||
- Fixed a crash in ippAttributeString (<rdar://problem/17903871>)
|
||||
- Fixed a crash in the scheduler on Linux/*BSD if colord was not running
|
||||
(STR #4496)
|
||||
- Fixed a random crash in the scheduler when not using systemd
|
||||
(STR #4484)
|
||||
- Added systemd support for cups-lpd (STR #4493)
|
||||
- The scheduler did not honor the FatalErrors directive for mis-
|
||||
configured Group and SystemGroup values (STR #4495)
|
||||
- The network backends no longer report waste-receptacle conditions when
|
||||
using SNMP (STR #4499)
|
||||
- The IPP backend did not work with some configurations of Windows
|
||||
(STR #4503)
|
||||
- RPMs did not build (STR #4490)
|
||||
- Added a USB quirk rule for the Brother HL-1250 (STR #4519)
|
||||
- Fixed compiles on unsupported platforms (STR #4510)
|
||||
- "cancel -a" did not cancel all jobs on all destinations (STR #4513)
|
||||
- The web interface did not work on OpenBSD (STR #4496)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.0.0
|
||||
|
||||
- The scheduler did not preserve listener sockets from launchd or
|
||||
systemd after a restart (<rdar://problem/18112848>)
|
||||
- Added some USB quirk rules for the libusb-based USB backend
|
||||
(STR #4482)
|
||||
- Spanish localization update (STR #4487)
|
||||
- Updated documentation for 2.0.0 release.
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.0rc1
|
||||
|
||||
- Documentation updates (STR #4464)
|
||||
- The scheduler now monitors the AC power status on OS X, allowing for
|
||||
"sleep printing" when sharing printers (<rdar://problem/17325852>)
|
||||
- The scheduler incorrectly called launch_activate_socket multiple times
|
||||
on OS X (<rdar://problem/17523218>)
|
||||
- The ippserver test program now passes the IPP Everywhere self-
|
||||
certification tests (STR #4101)
|
||||
- Relaxed the new OS X filter sandbox slightly (STR #4471,
|
||||
<rdar://problem/17483959>)
|
||||
- Dropped the old Epson Stylus Color/Photo sample drivers since they
|
||||
don't work with any current printers and there are free alternatives
|
||||
that produce much better output (<rdar://problem/18036889>)
|
||||
- Log and configuration files that are not world-readable are again
|
||||
accessible via the web interface (STR #4461)
|
||||
- PPD files are now created using the permissions specified by the
|
||||
ConfigFilePerm directive.
|
||||
- Fixed RPM build issues (STR #4459)
|
||||
- Fixed the spinner image and restart page when reconfiguring the
|
||||
scheduler through the web interface (STR #4475)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.0b1
|
||||
|
||||
- Added a "--list-filters" option to the cupsfilter command (STR #4325)
|
||||
- Added systemd support (STR #3917)
|
||||
- Added support for re-sending a job as a raster file if a higher-level
|
||||
format such as PDF fails (<rdar://problem/15583721>)
|
||||
- Added support for regular expression matching in the MIME type rules
|
||||
(<rdar://problem/11131245>)
|
||||
- Added support for TLS certificate validation and policy enforcement
|
||||
(STR #1616)
|
||||
- Added support for simultaneous XML and test output from ipptool.
|
||||
- Added support for PAUSE directive in ipptool test files.
|
||||
- Added support for auto-typing of TIFF files by ipptool (STR #4418)
|
||||
- The scheduler now returns completed jobs in the correct newest-to-
|
||||
oldest order (STR #4396)
|
||||
- The configure script now supports target-specific tools for pkg-config
|
||||
and others (STR #4423)
|
||||
- The ipptool program now supports EXPECT statements for collection
|
||||
member attributes (<rdar://problem/15355218>)
|
||||
- The ipptool program now supports collection attributes with multiple
|
||||
values (<rdar://problem/15355124>)
|
||||
- The sample drivers now include all of the installed localizations by
|
||||
default (<rdar://problem/14756625>)
|
||||
- Adopted Linux man page conventions and updated all man pages
|
||||
(STR #4372, STR #4329)
|
||||
- The scheduler now supports the "first-index" operation attribute for
|
||||
the Get-Jobs operation (STR #2913)
|
||||
- Changed the default AccessLogLevel and PageLogFormat to disable the
|
||||
access_log and page_log files by default (<rdar://problem/16495000>)
|
||||
- cupsRasterInterpretPPD now supports the Orientation header in order to
|
||||
support long-edge feed raster printers (<rdar://problem/15837926>)
|
||||
- The scheduler now allows run-as-root backends to have group read and
|
||||
execute permissions (STR #2935)
|
||||
- The ippFindAttribute and ippFindNextAttribute functions now support
|
||||
hierarchical searches (STR #4395)
|
||||
- Dropped OpenSSL support in favor of GNU TLS.
|
||||
- Dropped "dark wake" support on OS X, which was preventing portables
|
||||
from going to sleep when there was a stuck job. We now use a variation
|
||||
of the CUPS 1.4 sleep support to do a cleaner sleep
|
||||
(<rdar://problem/14323704>)
|
||||
- Dropped support for AIX, HP-UX, and OSF/1 (aka Digital UNIX)
|
||||
- Dropped lppasswd and support for Digest authentication in in the
|
||||
scheduler (STR #4321)
|
||||
- The cupsGetClasses, cupsGetPrinters, and cupsTempFile functions are no
|
||||
longer supported.
|
||||
- The scheduler now caches more job history data and limits the number
|
||||
of completed jobs returned by Get-Jobs as needed in order to prevent a
|
||||
denial-of-service on busy servers (STR #2913)
|
||||
- The filter/backend sandbox on OS X now defaults to a more strict
|
||||
whitelist (<rdar://problem/15939788>)
|
||||
- Increased the default idle exit timeout to 60 seconds on OS X
|
||||
(<rdar://problem/16041820>)
|
||||
- Printer classes were not accessible on OS X
|
||||
(<rdar://problem/16385643>)
|
||||
- The scheduler now uses </DefaultPrinter> to close the default printer
|
||||
definition in printers.conf (STR #4153)
|
||||
- Canceling all jobs in the web interface now just cancels the jobs
|
||||
(STR #1914)
|
||||
150
CHANGES-2.1.txt
Normal file
150
CHANGES-2.1.txt
Normal file
@ -0,0 +1,150 @@
|
||||
CHANGES-2.1.txt
|
||||
---------------
|
||||
|
||||
CHANGES IN CUPS V2.1.4
|
||||
|
||||
- Fixed reporting of 1284 Device IDs (Issue #3835, PR #3836)
|
||||
- Fixed printing of multiple files to raw queues (Issue #4782)
|
||||
- The scheduler did not implement the Hold-New-Jobs opertion correctly
|
||||
(Issue #4767)
|
||||
- The ipptool program truncated values at 8k (Issue #4786)
|
||||
- The ipptool program did not correctly report uriScheme values in plist
|
||||
output (Issue #4785)
|
||||
- The cups-lpd mini-daemon incorrectly included the document-name
|
||||
attribute when creating a job. It should only be included when
|
||||
sending a job (Issue #4790)
|
||||
- USB quirk updates (Issue #4778, Issue #4789)
|
||||
- Documentation update (Issue #4772)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.1.3
|
||||
|
||||
- The default password function did not work on some platforms
|
||||
(Issue #4750)
|
||||
- The scheduler should not exit under memory pressure
|
||||
(<rdar://problem/23255001>)
|
||||
- The EPL2 and ZPL sample drivers did not properly support the CutMedia
|
||||
option.
|
||||
- Pending subscriptions would prevent the scheduler from idle exiting
|
||||
(Issue #4754)
|
||||
- Fixed some issues in ipptool for skipped tests
|
||||
(<rdar://problem/24137160>)
|
||||
- The "lp -H resume" command did not reset the "job-state-reasons"
|
||||
attribute value (Issue #4752)
|
||||
- cupsEncodeOptions2 incorrectly handled escaped values
|
||||
(<rdar://problem/19736672>)
|
||||
- The scheduler did not allow access to resource files (icons, etc.)
|
||||
when the web interface was disabled (Issue #4755)
|
||||
- Localization fix (Issue #4756)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.1.2
|
||||
|
||||
- Re-release of CUPS 2.1.1 as CUPS 2.1.2 due to error in tagging of the
|
||||
2.1.1 release (pulled content from the 2.2.x tree instead)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.1.1
|
||||
|
||||
- Security hardening fixes (<rdar://problem/23131948>,
|
||||
<rdar://problem/23132108>, <rdar://problem/23132353>,
|
||||
<rdar://problem/23132803>, <rdar://problem/23133230>,
|
||||
<rdar://problem/23133393>, <rdar://problem/23133466>,
|
||||
<rdar://problem/23133833>, <rdar://problem/23133998>,
|
||||
<rdar://problem/23134228>, <rdar://problem/23134299>,
|
||||
<rdar://problem/23134356>, <rdar://problem/23134415>,
|
||||
<rdar://problem/23134506>, <rdar://problem/23135066>,
|
||||
<rdar://problem/23135122>, <rdar://problem/23135207>,
|
||||
<rdar://problem/23144290>, <rdar://problem/23144358>,
|
||||
<rdar://problem/23144461>)
|
||||
- The cupsGetPPD* functions did not work with IPP printers (Issue #4725)
|
||||
- Some older HP LaserJet printers need a delayed close when printing
|
||||
using the libusb-based USB backend (Issue #4549)
|
||||
- The libusb-based USB backend did not unload the kernel usblp module
|
||||
if it was preventing the backend from accessing the printer
|
||||
(Issue #4707)
|
||||
- Current Primera printers were incorrectly reported as Fargo printers
|
||||
(Issue #4708)
|
||||
- The IPP backend did not always handle jobs getting canceled at the
|
||||
printer (<rdar://problem/22716820>)
|
||||
- Scheduler logging change (Issue #4728)
|
||||
- Added USB quirk for Canon MP530 (Issue #4730)
|
||||
- The scheduler did not deliver job notifications for jobs submitted to
|
||||
classes (Issue #4733)
|
||||
- Changing the printer-is-shared value for a remote queue did not
|
||||
produce an error (Issue #4738)
|
||||
- The IPP backend incorrectly included the job-password attribute in
|
||||
Validate-Job requests (<rdar://problem/23531939>)
|
||||
- Updated localizations (Issue #4709)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.1.0
|
||||
|
||||
- Fixed more scheduler crash bugs in the new logging code (Issue #4687,
|
||||
Issue #4690)
|
||||
- The scheduler did not use the ConfigFilePerm setting when copying PPD
|
||||
files or interface scripts attached to a request (Issue #4703)
|
||||
- Now support new Chinese locale IDs and their correct fallback locales
|
||||
(<rdar://problem/22086642>, <rdar://problem/22130168>)
|
||||
- "make check" incorrectly reported an expectation of 18 warning
|
||||
messages when 8 were expected (Issue #4684)
|
||||
- The new PDF file type rule did not work (Issue #4692)
|
||||
- The scheduler did not update the jobs.cache file when job files were
|
||||
expired (Issue #4706)
|
||||
- Fixed some configure script issues (Issue #4694, Issue #4695, Issue #4698)
|
||||
- Documentation updates (Issue #4691, Issue #4693)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.1rc1
|
||||
|
||||
- Added support for 3D printers (basic types only, no built-in filters)
|
||||
based on PWG white paper.
|
||||
- Fixed bugs in the new journald support (Issue #4655, Issue #4658,
|
||||
Issue #4661)
|
||||
- Fixed domain socket support on Linux (Issue #4679)
|
||||
- Fixed signal handlers in the dnssd and usb backends (Issue #4671)
|
||||
- <Limit All> in <Policy> sections now applies to all operations when
|
||||
used by itself (Issue #4659)
|
||||
- Configure script changes for systemd support (Issue #4669)
|
||||
- Updated autoconf sources to use newer form of AC_INIT (Issue #4664)
|
||||
|
||||
|
||||
CHANGES IN CUPS V2.1b1
|
||||
|
||||
- Improved speed of ppdMarkDefaults for complex/large PPDs
|
||||
(<rdar://problem/15146999>)
|
||||
- The IPP backend now stops sending print data if the printer indicates
|
||||
the job has been aborted or canceled (<rdar://problem/17837631>)
|
||||
- The IPP backend now sends the job-pages-per-set attribute when
|
||||
printing multiple copy jobs with finishings
|
||||
(<rdar://problem/16792757>)
|
||||
- The IPP backend now updates the cupsMandatory values when the printer
|
||||
configuration changes (<rdar://problem/18126570>)
|
||||
- No longer install banner files since third-party banner filters now
|
||||
supply their own (Issue #4518)
|
||||
- Added support for EXPECT-ALL directive in ipptool test files
|
||||
(Issue #4469)
|
||||
- Added support for WITH-VALUE-FROM predicate in ipptool test files
|
||||
(Issue #4470)
|
||||
- The scheduler no longer listens on the loopback interface unless the
|
||||
web interface or printer sharing are enabled
|
||||
(<rdar://problem/9136448>)
|
||||
- Added a PPD generator for IPP Everywhere printers (Issue #4258)
|
||||
- Now install "default" versions of more configuration files
|
||||
(<rdar://problem/19024491>)
|
||||
- The cupstestppd program did not handle "maxsize(nnn)" entries in
|
||||
cupsFilter/cupsFilter2 values (<rdar://problem/18974858>)
|
||||
- The scheduler now checks the return value of rename() calls
|
||||
(Issue #4589)
|
||||
- The scheduler now validates ErrorPolicy values in config files
|
||||
(Issue #4591)
|
||||
- Long cookies caused the web interface to stop working (Issue #4619)
|
||||
- Added SSLOptions values to allow Diffie-Hellman key exchange and
|
||||
disable TLS/1.0 support.
|
||||
- Updated the scheduler to support more IPP Everywhere attributes
|
||||
(Issue #4630)
|
||||
- The scheduler now supports advanced ASL and journald logging when
|
||||
"syslog" output is configured (Issue #4474)
|
||||
- The scheduler now supports logging to stderr when running in the
|
||||
foreground (Issue #4505)
|
||||
|
||||
13
CREDITS.txt
13
CREDITS.txt
@ -1,9 +1,10 @@
|
||||
CREDITS.txt - 2012-07-16
|
||||
CREDITS.txt - 2016-06-21
|
||||
------------------------
|
||||
|
||||
Few projects are completed by one person, and CUPS is no exception. We'd
|
||||
like to thank the following individuals for their contributions:
|
||||
|
||||
Niklas 'Nille' Åkerström - Swedish localization.
|
||||
Nathaniel Barbour - Lots of testing and feedback.
|
||||
N. Becker - setsid().
|
||||
Philippe Combes - French localization and buttons script.
|
||||
@ -17,20 +18,20 @@ like to thank the following individuals for their contributions:
|
||||
Wang Jian - CUPS RPM corrections.
|
||||
Roderick Johnstone - Beta tester of the millenium.
|
||||
Till Kamppeter - Bug fixes, beta testing, evangelism.
|
||||
Iñaki Larrañaga - Basque localization.
|
||||
Kenshi Muto - Japanese localization, patches, and
|
||||
testing.
|
||||
Tomohiro Kato - Japanese localization.
|
||||
Kiko - Bug fixes.
|
||||
Sergey V. Kovalyov - ESP Print Pro and CUPS beta tester.
|
||||
Marek Laane - Estonian translation.
|
||||
Iñaki Larrañaga - Basque localization.
|
||||
Mark Lawrence - Microsoft interoperability testing.
|
||||
Jeff Licquia - Bug fixes, beta testing, evangelism.
|
||||
Jason McMullan - Original CUPS RPM distributions.
|
||||
Àngel Mompó - Catalan localization.
|
||||
Wes Morgan - *BSD fixes.
|
||||
Kenshi Muto - Japanese localization, patches, and
|
||||
testing.
|
||||
Brian Norris - Upstart support.
|
||||
Daniel Nylander - Swedish localization.
|
||||
Niklas 'Nille' Åkerström - Swedish localization.
|
||||
Naruiko Ogasawara - Japanese localization.
|
||||
Giulio Orsero - Bug fixes and testing.
|
||||
Michal Osowiecki - Polish localization.
|
||||
@ -39,6 +40,8 @@ like to thank the following individuals for their contributions:
|
||||
Vincenzo Reale - Italian localization.
|
||||
Petter Reinholdtsen - HP-UX compiler stuff.
|
||||
Juan Pablo González Riopedre - Spanish localization.
|
||||
Giovanni Scafora - Italian localization.
|
||||
Joachim Schwender - German localization.
|
||||
Opher Shachar - Hebrew localization.
|
||||
Stuart Stevens - HP JetDirect IPP information.
|
||||
Andrea Suatoni - IRIX desktop integration and testing.
|
||||
|
||||
61
INSTALL.txt
61
INSTALL.txt
@ -1,4 +1,4 @@
|
||||
INSTALL - CUPS v1.6.3 - 2013-07-11
|
||||
INSTALL - CUPS v2.2.1 - 2016-10-03
|
||||
----------------------------------
|
||||
|
||||
This file describes how to compile and install CUPS from source code. For more
|
||||
@ -29,27 +29,16 @@ BEFORE YOU BEGIN
|
||||
Compaq, HP, SGI, and Sun. BSD users should use GNU make (gmake) since BSD
|
||||
make does not support "include".
|
||||
|
||||
Besides these tools you'll want the JPEG, PNG, TIFF, and ZLIB libraries for
|
||||
image support, the CDSA, GNU TLS, or OpenSSL libraries for encryption
|
||||
support, the OpenLDAP and OpenSLP libraries for directory services support,
|
||||
and either MIT (1.6.3 or higher) or Heimdal Kerberos for Kerberos support.
|
||||
CUPS will compile and run without these, however you'll miss out on many of
|
||||
the features provided by CUPS.
|
||||
Besides these tools you'll want ZLIB library for compression support, the
|
||||
GNU TLS library for encryption support on platforms other than iOS, macOS,
|
||||
or Windows, and either MIT (1.6.3 or higher) or Heimdal Kerberos for
|
||||
Kerberos support. CUPS will compile and run without these, however you'll
|
||||
miss out on many of the features provided by CUPS.
|
||||
|
||||
Also, please note that CUPS does not include the Ghostscript-based
|
||||
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.
|
||||
|
||||
|
||||
COMPILING THE SUBVERSION REPOSITORY CODE
|
||||
|
||||
The CUPS Subversion repository doesn't hold a copy of the pre-built
|
||||
configure script. You'll need to run the GNU autoconf software (2.60 or
|
||||
higher) to create it:
|
||||
|
||||
autoconf
|
||||
Also, please note that CUPS does not include print filters to support PDF
|
||||
or raster printing. You *must* download GPL Ghostscript and/or the Open
|
||||
Printing CUPS filters package separately to print on operating systems
|
||||
other than macOS.
|
||||
|
||||
|
||||
CONFIGURATION
|
||||
@ -100,6 +89,19 @@ CONFIGURATION
|
||||
and diagnose a variety of common problems - use the "--enable-unit-tests"
|
||||
configure option to run them at build time.
|
||||
|
||||
On macOS, use the "--with-archflags" option to build with the correct set of
|
||||
architectures:
|
||||
|
||||
./configure --with-archflags="-arch i386 -arch x86_64" ...
|
||||
|
||||
Note: Current versions of macOS DO NOT allow installation to
|
||||
/usr with the default system integrity settings. In addition,
|
||||
we do not recommend replacing the CUPS supplied with macOS
|
||||
because not all versions of CUPS are compatible with every
|
||||
macOS release, and because software updates will replace parts
|
||||
of your local installation potentially rendering your system
|
||||
unusable.
|
||||
|
||||
Once you have configured things, just type:
|
||||
|
||||
make ENTER
|
||||
@ -138,6 +140,10 @@ INSTALLING THE SOFTWARE
|
||||
|
||||
gmake install ENTER
|
||||
|
||||
Use the BUILDROOT variable to install to an alternate root directory:
|
||||
|
||||
make BUILDROOT=/some/other/root/directory install ENTER
|
||||
|
||||
You can also build binary packages that can be installed on other machines
|
||||
using the RPM spec file ("packaging/cups.spec") or EPM list file
|
||||
("packaging/cups.list"). The latter also supports building of binary RPMs,
|
||||
@ -149,7 +155,7 @@ INSTALLING THE SOFTWARE
|
||||
|
||||
The EPM software is available at:
|
||||
|
||||
http://www.epmhome.org/
|
||||
http://www.msweet.org/
|
||||
|
||||
|
||||
CREATING BINARY DISTRIBUTIONS WITH EPM
|
||||
@ -167,17 +173,11 @@ CREATING BINARY DISTRIBUTIONS WITH EPM
|
||||
following:
|
||||
|
||||
epm - Builds a script + tarfile package
|
||||
aix - Builds an AIX package
|
||||
bsd - Builds a *BSD package
|
||||
deb - Builds a Debian package
|
||||
depot - Builds a HP-UX package (also swinstall)
|
||||
inst - Builds an IRIX package (also tardist)
|
||||
pkg - Builds a Solaris package
|
||||
rpm - Builds a RPM package
|
||||
setld - Build a Tru64 UNIX package
|
||||
slackware - Build a Slackware package
|
||||
swinstall - Build a HP-UX package (also depot)
|
||||
tardist - Builds an IRIX package (also inst)
|
||||
|
||||
|
||||
GETTING DEBUG LOGGING FROM CUPS
|
||||
@ -199,10 +199,9 @@ GETTING DEBUG LOGGING FROM CUPS
|
||||
REPORTING PROBLEMS
|
||||
|
||||
If you have problems, READ THE DOCUMENTATION FIRST! If the documentation
|
||||
does not solve your problems, please post a message on the "cups.general"
|
||||
forum at:
|
||||
does not solve your problems, please post a message on the users forum at:
|
||||
|
||||
http://www.cups.org/newsgroups.php
|
||||
http://www.cups.org/
|
||||
|
||||
Include your operating system and version, compiler and version, and any
|
||||
errors or problems you've run into. The "config.log" file and the output
|
||||
|
||||
24
LICENSE.txt
24
LICENSE.txt
@ -1,6 +1,6 @@
|
||||
CUPS License Agreement
|
||||
|
||||
Copyright 2007-2012 by Apple Inc.
|
||||
Copyright 2007-2016 by Apple Inc.
|
||||
1 Infinite Loop
|
||||
Cupertino, CA 95014 USA
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
INTRODUCTION
|
||||
|
||||
CUPS(tm) is provided under the GNU General Public License ("GPL")
|
||||
and GNU Library General Public License ("LGPL"), Version 2, with
|
||||
exceptions for Apple operating systems and the OpenSSL toolkit. A
|
||||
copy of the exceptions and licenses follow this introduction.
|
||||
and GNU Library General Public License ("LGPL"), Version 2, with an
|
||||
exception for Apple operating systems. A copy of the exception and
|
||||
licenses follow this introduction.
|
||||
|
||||
The GNU LGPL applies to the CUPS and CUPS Imaging libraries
|
||||
located in the "cups" and "filter" subdirectories of the CUPS
|
||||
@ -45,7 +45,7 @@ application, driver, or filter.
|
||||
LICENSE EXCEPTIONS
|
||||
|
||||
In addition, as the copyright holder of CUPS, Apple Inc. grants
|
||||
the following special exceptions:
|
||||
the following special exception:
|
||||
|
||||
1. Apple Operating System Development License Exception;
|
||||
|
||||
@ -70,8 +70,8 @@ the following special exceptions:
|
||||
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 of Apple's Darwin, iOS, macOS, macOS Server, and
|
||||
tvOS products and all follow-on releases and future
|
||||
versions thereof.
|
||||
|
||||
c. This exception is only available for Apple
|
||||
@ -86,14 +86,8 @@ the following special exceptions:
|
||||
This file is subject to the Apple OS-Developed
|
||||
Software exception.
|
||||
|
||||
2. OpenSSL Toolkit License Exception;
|
||||
|
||||
a. Apple Inc. explicitly allows the compilation and
|
||||
distribution of the CUPS software with the OpenSSL
|
||||
Toolkit.
|
||||
|
||||
No developer is required to provide these exceptions in a
|
||||
derived work.
|
||||
No developer is required to provide this exception in a derived
|
||||
work.
|
||||
|
||||
|
||||
KERBEROS SUPPORT CODE
|
||||
|
||||
47
Makedefs.in
47
Makedefs.in
@ -1,16 +1,14 @@
|
||||
#
|
||||
# "$Id: Makedefs.in 7900 2008-09-03 13:47:57Z mike $"
|
||||
# Common makefile definitions for CUPS.
|
||||
#
|
||||
# Common makefile definitions for CUPS.
|
||||
# Copyright 2007-2014 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# Copyright 2007-2012 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
# which should have been included with this file. If this file is
|
||||
# file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
# which should have been included with this file. If this file is
|
||||
# file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
#
|
||||
|
||||
#
|
||||
@ -121,9 +119,9 @@ INSTALLXPC = @INSTALLXPC@
|
||||
#
|
||||
|
||||
ALL_CFLAGS = -I.. -D_CUPS_SOURCE $(CFLAGS) $(SSLFLAGS) \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(ONDEMANDFLAGS) $(OPTIONS)
|
||||
ALL_CXXFLAGS = -I.. -D_CUPS_SOURCE $(CXXFLAGS) $(SSLFLAGS) \
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(OPTIONS)
|
||||
@LARGEFILE@ @PTHREAD_FLAGS@ $(ONDEMANDFLAGS) $(OPTIONS)
|
||||
ARCHFLAGS = @ARCHFLAGS@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
BACKLIBS = @BACKLIBS@
|
||||
@ -138,13 +136,16 @@ DNSSD_BACKEND = @DNSSD_BACKEND@
|
||||
DSOFLAGS = -L../cups @DSOFLAGS@
|
||||
DSOLIBS = @DSOLIBS@ $(COMMONLIBS)
|
||||
DNSSDLIBS = @DNSSDLIBS@
|
||||
LAUNCHDLIBS = @LAUNCHDLIBS@
|
||||
IPPFIND_BIN = @IPPFIND_BIN@
|
||||
IPPFIND_MAN = @IPPFIND_MAN@
|
||||
LDFLAGS = -L../cgi-bin -L../cups -L../filter -L../ppdc \
|
||||
-L../scheduler @LDARCHFLAGS@ \
|
||||
@LDFLAGS@ @RELROFLAGS@ @PIEFLAGS@ $(OPTIM)
|
||||
LINKCUPS = @LINKCUPS@ $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(LIBZ)
|
||||
LINKCUPS = @LINKCUPS@ $(LIBGSSAPI) $(DNSSDLIBS) $(LIBZ)
|
||||
LINKCUPSIMAGE = @LINKCUPSIMAGE@
|
||||
LIBS = $(LINKCUPS) $(COMMONLIBS)
|
||||
ONDEMANDFLAGS = @ONDEMANDFLAGS@
|
||||
ONDEMANDLIBS = @ONDEMANDLIBS@
|
||||
OPTIM = @OPTIM@
|
||||
OPTIONS =
|
||||
PAMLIBS = @PAMLIBS@
|
||||
@ -198,8 +199,6 @@ DATADIR = $(BUILDROOT)@CUPS_DATADIR@
|
||||
DOCDIR = $(BUILDROOT)@CUPS_DOCROOT@
|
||||
ICONDIR = @ICONDIR@
|
||||
INCLUDEDIR = $(BUILDROOT)$(includedir)
|
||||
INITDIR = @INITDIR@
|
||||
INITDDIR = @INITDDIR@
|
||||
LIBDIR = $(BUILDROOT)$(libdir)
|
||||
LOCALEDIR = $(BUILDROOT)@CUPS_LOCALEDIR@
|
||||
LOGDIR = $(BUILDROOT)@CUPS_LOGDIR@
|
||||
@ -214,9 +213,7 @@ REQUESTS = $(BUILDROOT)@CUPS_REQUESTS@
|
||||
SBINDIR = $(BUILDROOT)@sbindir@
|
||||
SERVERBIN = $(BUILDROOT)@CUPS_SERVERBIN@
|
||||
SERVERROOT = $(BUILDROOT)@CUPS_SERVERROOT@
|
||||
SMFMANIFESTDIR = @SMFMANIFESTDIR@
|
||||
STATEDIR = $(BUILDROOT)@CUPS_STATEDIR@
|
||||
XINETD = @XINETD@
|
||||
|
||||
MAN1EXT = @MAN1EXT@
|
||||
MAN5EXT = @MAN5EXT@
|
||||
@ -227,8 +224,15 @@ MAN8DIR = @MAN8DIR@
|
||||
PAMDIR = @PAMDIR@
|
||||
PAMFILE = @PAMFILE@
|
||||
|
||||
DEFAULT_LAUNCHD_CONF = @DEFAULT_LAUNCHD_CONF@
|
||||
DBUSDIR = @DBUSDIR@
|
||||
INITDIR = @INITDIR@
|
||||
INITDDIR = @INITDDIR@
|
||||
LAUNCHD_DIR = @LAUNCHD_DIR@
|
||||
SMFMANIFESTDIR = @SMFMANIFESTDIR@
|
||||
SYSTEMD_DIR = @SYSTEMD_DIR@
|
||||
XINETD = @XINETD@
|
||||
|
||||
USBQUIRKS = @USBQUIRKS@
|
||||
|
||||
|
||||
#
|
||||
@ -255,8 +259,3 @@ DBUSDIR = @DBUSDIR@
|
||||
echo -n Compressing $<...
|
||||
$(RM) $@
|
||||
gzip -v9 <$< >$@
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id: Makedefs.in 7900 2008-09-03 13:47:57Z mike $"
|
||||
#
|
||||
|
||||
99
Makefile
99
Makefile
@ -1,16 +1,14 @@
|
||||
#
|
||||
# "$Id: Makefile 9391 2010-11-30 21:53:04Z mike $"
|
||||
# Top-level Makefile for CUPS.
|
||||
#
|
||||
# Top-level Makefile for CUPS.
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# Copyright 2007-2013 by Apple Inc.
|
||||
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
# which should have been included with this file. If this file is
|
||||
# file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
# which should have been included with this file. If this file is
|
||||
# file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
#
|
||||
|
||||
include Makedefs
|
||||
@ -98,24 +96,18 @@ clean:
|
||||
|
||||
distclean: clean
|
||||
$(RM) Makedefs config.h config.log config.status
|
||||
$(RM) conf/cups-files.conf conf/cupsd.conf conf/mime.convs conf/pam.std conf/snmp.conf
|
||||
$(RM) cups-config
|
||||
$(RM) conf/cups-files.conf conf/cupsd.conf
|
||||
$(RM) conf/mime.convs conf/pam.std conf/snmp.conf
|
||||
$(RM) doc/help/ref-cups-files-conf.html doc/help/ref-cupsd-conf.html
|
||||
$(RM) doc/help/standard.html doc/index.html
|
||||
$(RM) man/client.conf.man
|
||||
$(RM) man/cups-deviced.man man/cups-driverd.man
|
||||
$(RM) man/cups-lpd.man man/cupsaddsmb.man man/cupsd.man
|
||||
$(RM) man/cupsd.conf.man man/drv.man man/lpoptions.man
|
||||
$(RM) packaging/cups.list
|
||||
$(RM) packaging/cups-desc.plist packaging/cups-info.plist
|
||||
$(RM) templates/header.tmpl
|
||||
$(RM) data/testprint
|
||||
$(RM) desktop/cups.desktop
|
||||
$(RM) scheduler/cups.sh scheduler/cups-lpd.xinetd
|
||||
$(RM) scheduler/org.cups.cups-lpd.plist scheduler/cups.xml
|
||||
$(RM) doc/index.html
|
||||
$(RM) man/client.conf.man man/cups-files.conf.man man/cups-lpd.man man/cups-snmp.man man/cupsaddsmb.man man/cupsd.conf.man man/cupsd.man man/lpoptions.man
|
||||
$(RM) packaging/cups.list
|
||||
$(RM) scheduler/cups-lpd.xinetd scheduler/cups.sh scheduler/cups.xml scheduler/org.cups.cups-lpd.plist scheduler/org.cups.cups-lpdAT.service scheduler/org.cups.cupsd.path scheduler/org.cups.cupsd.service scheduler/org.cups.cupsd.socket
|
||||
$(RM) templates/header.tmpl
|
||||
-$(RM) doc/*/index.html
|
||||
-$(RM) templates/*/header.tmpl
|
||||
-$(RM) -r autom4te*.cache clang cups/charmaps cups/locale driver/test
|
||||
-$(RM) -r autom4te*.cache clang cups/charmaps cups/locale
|
||||
|
||||
|
||||
#
|
||||
@ -130,8 +122,14 @@ depend:
|
||||
|
||||
|
||||
#
|
||||
# Run the clang.llvm.org static code analysis tool on the C sources.
|
||||
# (at least checker-231 is required for scan-build to work this way)
|
||||
# Run the Clang static code analysis tool on the sources, available here:
|
||||
#
|
||||
# http://clang-analyzer.llvm.org
|
||||
#
|
||||
# At least checker-231 is required.
|
||||
#
|
||||
# Alternatively, use "--analyze -Xanalyzer -analyzer-output=text" for OPTIM (text
|
||||
# output instead of HTML...)
|
||||
#
|
||||
|
||||
.PHONY: clang clang-changes
|
||||
@ -142,6 +140,26 @@ clang-changes:
|
||||
scan-build -V -k -o `pwd`/clang $(MAKE) $(MFLAGS) all
|
||||
|
||||
|
||||
#
|
||||
# Run the STACK tool on the sources, available here:
|
||||
#
|
||||
# http://css.csail.mit.edu/stack/
|
||||
#
|
||||
# Do the following to pass options to configure:
|
||||
#
|
||||
# make CONFIGFLAGS="--foo --bar" stack
|
||||
#
|
||||
|
||||
.PHONY: stack
|
||||
stack:
|
||||
stack-build ./configure $(CONFIGFLAGS)
|
||||
stack-build $(MAKE) $(MFLAGS) clean all
|
||||
poptck
|
||||
$(MAKE) $(MFLAGS) distclean
|
||||
$(RM) */*.ll
|
||||
$(RM) */*.ll.out
|
||||
|
||||
|
||||
#
|
||||
# Generate a ctags file...
|
||||
#
|
||||
@ -244,24 +262,18 @@ debugcheck: all unittests
|
||||
|
||||
|
||||
#
|
||||
# Create HTML documentation...
|
||||
# Create HTML documentation using Mini-XML's mxmldoc (http://www.msweet.org/)...
|
||||
#
|
||||
|
||||
apihelp:
|
||||
for dir in cgi-bin cups filter ppdc scheduler; do\
|
||||
for dir in cups filter; do\
|
||||
echo Generating API help in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) apihelp) || exit 1;\
|
||||
done
|
||||
|
||||
framedhelp:
|
||||
for dir in cgi-bin cups filter ppdc scheduler; do\
|
||||
echo Generating framed API help in $$dir... ;\
|
||||
(cd $$dir; $(MAKE) $(MFLAGS) framedhelp) || exit 1;\
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Create an Xcode docset...
|
||||
# Create an Xcode docset using Mini-XML's mxmldoc (http://www.msweet.org/)...
|
||||
#
|
||||
|
||||
docset: apihelp
|
||||
@ -297,28 +309,20 @@ sloc:
|
||||
|
||||
|
||||
#
|
||||
# Make software distributions using EPM (http://www.epmhome.org/)...
|
||||
# Make software distributions using EPM (http://www.msweet.org/)...
|
||||
#
|
||||
|
||||
EPMFLAGS = -v --output-dir dist $(EPMARCH)
|
||||
|
||||
aix bsd deb depot inst pkg setld slackware swinstall tardist:
|
||||
bsd deb epm pkg rpm slackware:
|
||||
epm $(EPMFLAGS) -f $@ cups packaging/cups.list
|
||||
|
||||
epm:
|
||||
epm $(EPMFLAGS) -s packaging/installer.gif cups packaging/cups.list
|
||||
|
||||
rpm:
|
||||
epm $(EPMFLAGS) -f rpm -s packaging/installer.gif cups packaging/cups.list
|
||||
|
||||
.PHONEY: dist
|
||||
dist: all
|
||||
$(RM) -r dist
|
||||
$(MAKE) $(MFLAGS) epm
|
||||
case `uname` in \
|
||||
*BSD*) $(MAKE) $(MFLAGS) bsd;; \
|
||||
Darwin*) $(MAKE) $(MFLAGS) osx;; \
|
||||
IRIX*) $(MAKE) $(MFLAGS) tardist;; \
|
||||
Linux*) test ! -x /usr/bin/rpm || $(MAKE) $(MFLAGS) rpm;; \
|
||||
SunOS*) $(MAKE) $(MFLAGS) pkg;; \
|
||||
esac
|
||||
@ -329,8 +333,3 @@ dist: all
|
||||
#
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id: Makefile 9391 2010-11-30 21:53:04Z mike $".
|
||||
#
|
||||
|
||||
31
README.txt
31
README.txt
@ -1,4 +1,4 @@
|
||||
README - CUPS v1.6.3 - 2013-07-11
|
||||
README - CUPS v2.2.1 - 2016-10-03
|
||||
---------------------------------
|
||||
|
||||
Looking for compile instructions? Read the file "INSTALL.txt" instead...
|
||||
@ -7,7 +7,7 @@ Looking for compile instructions? Read the file "INSTALL.txt" instead...
|
||||
INTRODUCTION
|
||||
|
||||
CUPS is a standards-based, open source printing system developed by Apple
|
||||
Inc. for OS® X and other UNIX®-like operating systems. CUPS uses the
|
||||
Inc. for macOS® and other UNIX®-like operating systems. CUPS uses the
|
||||
Internet Printing Protocol ("IPP") and provides System V and Berkeley
|
||||
command-line interfaces, a web interface, and a C API to manage printers and
|
||||
print jobs. It supports printing to both local (parallel, serial, USB) and
|
||||
@ -41,10 +41,10 @@ READING THE DOCUMENTATION
|
||||
|
||||
GETTING SUPPORT AND OTHER RESOURCES
|
||||
|
||||
If you have problems, READ THE DOCUMENTATION FIRST! We also provide many
|
||||
discussion forums which are available at:
|
||||
If you have problems, READ THE DOCUMENTATION FIRST! We also provide two
|
||||
mailing lists which are available at:
|
||||
|
||||
http://www.cups.org/newsgroups.php
|
||||
http://www.cups.org/lists.php
|
||||
|
||||
See the CUPS web site at "http://www.cups.org/" for other resources.
|
||||
|
||||
@ -78,10 +78,6 @@ SETTING UP PRINTER QUEUES FROM THE COMMAND-LINE
|
||||
----------------------------- ------------------------------
|
||||
Dymo Label Printers drv:///sample.drv/dymo.ppd
|
||||
Intellitech Intellibar drv:///sample.drv/intelbar.ppd
|
||||
EPSON Stylus Color Series drv:///sample.drv/stcolor.ppd
|
||||
EPSON Stylus Photo Series drv:///sample.drv/stphoto.ppd
|
||||
EPSON Stylus New Color Series drv:///sample.drv/stcolor2.ppd
|
||||
EPSON Stylus New Photo Series drv:///sample.drv/stphoto2.ppd
|
||||
EPSON 9-pin Series drv:///sample.drv/epson9.ppd
|
||||
EPSON 24-pin Series drv:///sample.drv/epson24.ppd
|
||||
Generic PCL Laser Printer drv:///sample.drv/generpcl.ppd
|
||||
@ -113,11 +109,7 @@ SETTING UP PRINTER QUEUES FROM THE COMMAND-LINE
|
||||
lpadmin -p printername -E -v lpd://11.22.33.44/ -m ppd-name
|
||||
|
||||
The sample drivers provide basic printing capabilities, but generally do not
|
||||
exercise the full potential of the printers or CUPS. The CUPS web site
|
||||
provides links and drivers:
|
||||
|
||||
http://www.cups.org/ppd.php PPD files
|
||||
http://www.cups.org/links.php Links to other drivers
|
||||
exercise the full potential of the printers or CUPS.
|
||||
|
||||
|
||||
PRINTING FILES
|
||||
@ -134,8 +126,8 @@ PRINTING FILES
|
||||
lpr -o media=A4 -o resolution=600dpi filename
|
||||
|
||||
CUPS recognizes many types of images files as well as PDF, PostScript,
|
||||
HP-GL/2, and text files, so you can print those files directly rather than
|
||||
through an application.
|
||||
and text files, so you can print those files directly rather than through
|
||||
an application.
|
||||
|
||||
If you have an application that generates output specifically for your
|
||||
printer then you need to use the "-oraw" or "-l" options:
|
||||
@ -143,19 +135,16 @@ PRINTING FILES
|
||||
lp -o raw filename
|
||||
lpr -l filename
|
||||
|
||||
This will prevent the filters from misinterpreting your print
|
||||
file.
|
||||
This will prevent the filters from misinterpreting your print file.
|
||||
|
||||
|
||||
LEGAL STUFF
|
||||
|
||||
CUPS is Copyright 2007-2013 by Apple Inc. CUPS and the CUPS logo are
|
||||
CUPS is Copyright 2007-2016 by Apple Inc. CUPS and the CUPS logo are
|
||||
trademarks of Apple Inc.
|
||||
|
||||
The MD5 Digest code is Copyright 1999 Aladdin Enterprises.
|
||||
|
||||
This software is based in part on the work of the Independent JPEG Group.
|
||||
|
||||
CUPS is provided under the terms of version 2 of the GNU General Public
|
||||
License and GNU Library General Public License. This program is distributed
|
||||
in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
|
||||
13
config.h
13
config.h
@ -18,6 +18,8 @@
|
||||
* rather than by running the configure script again.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifndef _CUPS_CONFIG_H_
|
||||
#define _CUPS_CONFIG_H_
|
||||
|
||||
@ -302,7 +304,7 @@
|
||||
|
||||
//#define HAVE_CDSASSL 1
|
||||
/* #undef HAVE_GNUTLS */
|
||||
#define HAVE_LIBSSL 1
|
||||
#define HAVE_GNUTLS 1
|
||||
#define HAVE_SSL 1
|
||||
|
||||
|
||||
@ -743,6 +745,15 @@ static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
|
||||
# endif /* __GNUC__ || __STDC_VERSION__ */
|
||||
#endif /* !HAVE_ABS && !abs */
|
||||
|
||||
// 11/23/2016 Mopria-notice: as lockf method is not defined in the Android, we defined our own.
|
||||
#define F_LOCK LOCK_EX
|
||||
#define F_ULOCK LOCK_UN
|
||||
#define F_TLOCK ( LOCK_EX | LOCK_NB )
|
||||
#define F_TULOCK ( LOCK_UN | LOCK_NB )
|
||||
static inline int lockf(int fd, int cmd, off_t ignored_len) {
|
||||
return flock(fd, cmd);
|
||||
}
|
||||
|
||||
#endif /* !_CUPS_CONFIG_H_ */
|
||||
|
||||
/*
|
||||
|
||||
197
config.h.in
197
config.h.in
@ -1,16 +1,14 @@
|
||||
/*
|
||||
* "$Id: config.h.in 7918 2008-09-08 22:03:01Z mike $"
|
||||
* Configuration file for CUPS.
|
||||
*
|
||||
* Configuration file for CUPS.
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_CONFIG_H_
|
||||
@ -93,7 +91,7 @@
|
||||
* Default MaxCopies value...
|
||||
*/
|
||||
|
||||
#define CUPS_DEFAULT_MAX_COPIES 100
|
||||
#define CUPS_DEFAULT_MAX_COPIES 9999
|
||||
|
||||
|
||||
/*
|
||||
@ -132,23 +130,25 @@
|
||||
|
||||
|
||||
/*
|
||||
* Do we have various image libraries?
|
||||
* Do we have posix_spawn?
|
||||
*/
|
||||
|
||||
#undef HAVE_POSIX_SPAWN
|
||||
|
||||
|
||||
/*
|
||||
* Do we have ZLIB?
|
||||
*/
|
||||
|
||||
#undef HAVE_LIBPNG
|
||||
#undef HAVE_LIBZ
|
||||
#undef HAVE_LIBJPEG
|
||||
#undef HAVE_LIBTIFF
|
||||
#undef HAVE_INFLATECOPY
|
||||
|
||||
|
||||
/*
|
||||
* Do we have PAM stuff?
|
||||
*/
|
||||
|
||||
#ifndef HAVE_LIBPAM
|
||||
#define HAVE_LIBPAM 0
|
||||
#endif /* !HAVE_LIBPAM */
|
||||
|
||||
#undef HAVE_PAM_PAM_APPL_H
|
||||
#undef HAVE_PAM_SET_ITEM
|
||||
#undef HAVE_PAM_SETCRED
|
||||
@ -168,13 +168,6 @@
|
||||
#undef HAVE_CRYPT_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have <scsi/sg.h>?
|
||||
*/
|
||||
|
||||
#undef HAVE_SCSI_SG_H
|
||||
|
||||
|
||||
/*
|
||||
* Use <stdint.h>?
|
||||
*/
|
||||
@ -247,6 +240,20 @@
|
||||
#undef HAVE_VSYSLOG
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the ASL functions?
|
||||
*/
|
||||
|
||||
#undef HAVE_ASL_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the systemd journal functions?
|
||||
*/
|
||||
|
||||
#undef HAVE_SYSTEMD_SD_JOURNAL_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the (v)snprintf() functions?
|
||||
*/
|
||||
@ -299,15 +306,22 @@
|
||||
|
||||
#undef HAVE_CDSASSL
|
||||
#undef HAVE_GNUTLS
|
||||
#undef HAVE_LIBSSL
|
||||
#undef HAVE_SSPISSL
|
||||
#undef HAVE_SSL
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SSL_set_tlsext_host_name function?
|
||||
* Do we have the gnutls_transport_set_pull_timeout_function function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SSL_SET_TLSEXT_HOST_NAME
|
||||
#undef HAVE_GNUTLS_TRANSPORT_SET_PULL_TIMEOUT_FUNCTION
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the gnutls_priority_set_direct function?
|
||||
*/
|
||||
|
||||
#undef HAVE_GNUTLS_PRIORITY_SET_DIRECT
|
||||
|
||||
|
||||
/*
|
||||
@ -325,34 +339,6 @@
|
||||
#undef HAVE_SECURETRANSPORTPRIV_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SecCertificateCopyData function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SECCERTIFICATECOPYDATA
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SecIdentitySearchCreateWithPolicy function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SecPolicyCreateSSL function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SECPOLICYCREATESSL
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SecPolicyCreateSSL function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SECPOLICYCREATESSL
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the cssmErrorString function?
|
||||
*/
|
||||
@ -360,6 +346,27 @@
|
||||
#undef HAVE_CSSMERRORSTRING
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SecGenerateSelfSignedCertificate function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SECGENERATESELFSIGNEDCERTIFICATE
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the SecKeychainOpen function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SECKEYCHAINOPEN
|
||||
|
||||
|
||||
/*
|
||||
* Do we have (a working) SSLSetEnabledCiphers function?
|
||||
*/
|
||||
|
||||
#undef HAVE_SSLSETENABLEDCIPHERS
|
||||
|
||||
|
||||
/*
|
||||
* Do we have libpaper?
|
||||
*/
|
||||
@ -465,13 +472,6 @@
|
||||
#undef HAVE_STRUCT_SOCKADDR_SA_LEN
|
||||
|
||||
|
||||
/*
|
||||
* Do we have the AIX usersec.h header file?
|
||||
*/
|
||||
|
||||
#undef HAVE_USERSEC_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have pthread support?
|
||||
*/
|
||||
@ -479,6 +479,13 @@
|
||||
#undef HAVE_PTHREAD_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have on-demand support (launchd/systemd/upstart)?
|
||||
*/
|
||||
|
||||
#undef HAVE_ONDEMAND
|
||||
|
||||
|
||||
/*
|
||||
* Do we have launchd support?
|
||||
*/
|
||||
@ -487,6 +494,20 @@
|
||||
#undef HAVE_LAUNCHD
|
||||
|
||||
|
||||
/*
|
||||
* Do we have systemd support?
|
||||
*/
|
||||
|
||||
#undef HAVE_SYSTEMD
|
||||
|
||||
|
||||
/*
|
||||
* Do we have upstart support?
|
||||
*/
|
||||
|
||||
#undef HAVE_UPSTART
|
||||
|
||||
|
||||
/*
|
||||
* Various scripting languages...
|
||||
*/
|
||||
@ -501,24 +522,6 @@
|
||||
#define CUPS_PYTHON "/usr/bin/python"
|
||||
|
||||
|
||||
/*
|
||||
* Location of the poppler/Xpdf pdftops program...
|
||||
*/
|
||||
|
||||
#undef HAVE_PDFTOPS
|
||||
#undef HAVE_PDFTOPS_WITH_ORIGPAGESIZES
|
||||
#define CUPS_PDFTOPS "/usr/bin/pdftops"
|
||||
|
||||
|
||||
/*
|
||||
* Location of the Ghostscript gs program...
|
||||
*/
|
||||
|
||||
#undef HAVE_GHOSTSCRIPT
|
||||
#undef HAVE_GHOSTSCRIPT_PS2WRITE
|
||||
#define CUPS_GHOSTSCRIPT "/usr/bin/gs"
|
||||
|
||||
|
||||
/*
|
||||
* Do we have CoreFoundation public and private headers?
|
||||
*/
|
||||
@ -543,7 +546,14 @@
|
||||
|
||||
|
||||
/*
|
||||
* Do we have OS X 10.4's mbr_XXX functions?
|
||||
* Do we have the getgrouplist() function?
|
||||
*/
|
||||
|
||||
#undef HAVE_GETGROUPLIST
|
||||
|
||||
|
||||
/*
|
||||
* Do we have macOS 10.4's mbr_XXX functions?
|
||||
*/
|
||||
|
||||
#undef HAVE_MEMBERSHIP_H
|
||||
@ -559,19 +569,13 @@
|
||||
#undef HAVE_NOTIFY_POST
|
||||
|
||||
|
||||
/*
|
||||
* Do we have Darwin's IOKit private headers?
|
||||
*/
|
||||
|
||||
#undef HAVE_IOKIT_PWR_MGT_IOPMLIBPRIVATE_H
|
||||
|
||||
|
||||
/*
|
||||
* Do we have DBUS?
|
||||
*/
|
||||
|
||||
#undef HAVE_DBUS
|
||||
#undef HAVE_DBUS_MESSAGE_ITER_INIT_APPEND
|
||||
#undef HAVE_DBUS_THREADS_INIT
|
||||
|
||||
|
||||
/*
|
||||
@ -648,7 +652,7 @@
|
||||
|
||||
#ifdef HAVE_ARC4RANDOM
|
||||
# define CUPS_RAND() arc4random()
|
||||
# define CUPS_SRAND(v) arc4random_stir()
|
||||
# define CUPS_SRAND(v)
|
||||
#elif defined(HAVE_RANDOM)
|
||||
# define CUPS_RAND() random()
|
||||
# define CUPS_SRAND(v) srandom(v)
|
||||
@ -661,13 +665,6 @@
|
||||
#endif /* HAVE_ARC4RANDOM */
|
||||
|
||||
|
||||
/*
|
||||
* Do we have vproc_transaction_begin/end?
|
||||
*/
|
||||
|
||||
#undef HAVE_VPROC_TRANSACTION_BEGIN
|
||||
|
||||
|
||||
/*
|
||||
* Do we have libusb?
|
||||
*/
|
||||
@ -702,7 +699,7 @@
|
||||
|
||||
|
||||
/*
|
||||
* Location of OS X localization bundle, if any.
|
||||
* Location of macOS localization bundle, if any.
|
||||
*/
|
||||
|
||||
#undef CUPS_BUNDLEDIR
|
||||
@ -741,7 +738,3 @@ static __inline int _cups_abs(int i) { return (i < 0 ? -i : i); }
|
||||
#endif /* !HAVE_ABS && !abs */
|
||||
|
||||
#endif /* !_CUPS_CONFIG_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: config.h.in 7918 2008-09-08 22:03:01Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,21 +1,19 @@
|
||||
#! /bin/sh
|
||||
#!/bin/sh
|
||||
#
|
||||
# "$Id: cups-config.in 9926 2011-08-27 09:23:01Z mike $"
|
||||
# CUPS configuration utility.
|
||||
#
|
||||
# CUPS configuration utility.
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 2001-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# Copyright 2007-2011 by Apple Inc.
|
||||
# Copyright 2001-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
# which should have been included with this file. If this file is
|
||||
# file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
# which should have been included with this file. If this file is
|
||||
# file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
#
|
||||
|
||||
VERSION="@CUPS_VERSION@"
|
||||
APIVERSION="1.6"
|
||||
APIVERSION="2.2"
|
||||
BUILD="@CUPS_BUILD@"
|
||||
|
||||
prefix=@prefix@
|
||||
@ -140,7 +138,3 @@ while test $# -gt 0; do
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
#
|
||||
# End of "$Id: cups-config.in 9926 2011-08-27 09:23:01Z mike $".
|
||||
#
|
||||
|
||||
@ -1,260 +1,316 @@
|
||||
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
|
||||
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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h ppd.h raster.h \
|
||||
adminutil.h
|
||||
array.o: array.c ../cups/cups.h file.h versioning.h ipp.h http.h array.h \
|
||||
language.h pwg.h string-private.h ../config.h debug-private.h \
|
||||
array-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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h
|
||||
backchannel.o: backchannel.c cups.h file.h versioning.h ipp.h http.h \
|
||||
array.h language.h
|
||||
array.h language.h pwg.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-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h backend.h ppd.h raster.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
../config.h debug-private.h ../cups/versioning.h array-private.h \
|
||||
../cups/array.h ipp-private.h ../cups/ipp.h http.h http-private.h \
|
||||
../cups/language.h md5-private.h language-private.h \
|
||||
../cups/transcode.h pwg-private.h ../cups/cups.h file.h pwg.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
|
||||
../config.h debug-private.h ../cups/versioning.h array-private.h \
|
||||
../cups/array.h ipp-private.h ../cups/ipp.h http.h http-private.h \
|
||||
../cups/language.h md5-private.h language-private.h \
|
||||
../cups/transcode.h pwg-private.h ../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h adminutil.h
|
||||
getifaddrs.o: getifaddrs.c http-private.h ../config.h ../cups/language.h \
|
||||
array.h versioning.h ../cups/http.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h
|
||||
hash.o: hash.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
../config.h debug-private.h ../cups/versioning.h array-private.h \
|
||||
../cups/array.h ipp-private.h ../cups/ipp.h http.h http-private.h \
|
||||
../cups/language.h md5-private.h language-private.h \
|
||||
../cups/transcode.h pwg-private.h ../cups/cups.h file.h pwg.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
|
||||
../config.h debug-private.h ../cups/versioning.h array-private.h \
|
||||
../cups/array.h ipp-private.h ../cups/ipp.h http.h http-private.h \
|
||||
../cups/language.h md5-private.h language-private.h \
|
||||
../cups/transcode.h pwg-private.h ../cups/cups.h file.h pwg.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
|
||||
../cups/versioning.h array-private.h ../cups/array.h ipp-private.h \
|
||||
../cups/ipp.h http.h http-private.h ../cups/language.h md5-private.h \
|
||||
language-private.h ../cups/transcode.h pwg-private.h ../cups/cups.h \
|
||||
file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
md5passwd.o: md5passwd.c http-private.h ../config.h ../cups/language.h \
|
||||
array.h versioning.h ../cups/http.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.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
|
||||
../cups/versioning.h array-private.h ../cups/array.h ipp-private.h \
|
||||
../cups/ipp.h http.h http-private.h ../cups/language.h md5-private.h \
|
||||
language-private.h ../cups/transcode.h pwg-private.h ../cups/cups.h \
|
||||
file.h pwg.h thread-private.h ppd-private.h ../cups/ppd.h raster.h
|
||||
ppd-attr.o: ppd-attr.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h ppd-private.h \
|
||||
../cups/ppd.h raster.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h ppd-private.h \
|
||||
../cups/ppd.h raster.h
|
||||
ppd-conflicts.o: ppd-conflicts.c cups-private.h string-private.h \
|
||||
../config.h debug-private.h ../cups/versioning.h array-private.h \
|
||||
../cups/array.h ipp-private.h ../cups/ipp.h http.h http-private.h \
|
||||
../cups/language.h md5-private.h language-private.h \
|
||||
../cups/transcode.h pwg-private.h ../cups/cups.h file.h pwg.h \
|
||||
thread-private.h ppd-private.h ../cups/ppd.h raster.h
|
||||
ppd-custom.o: ppd-custom.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h ppd-private.h \
|
||||
../cups/ppd.h raster.h
|
||||
ppd-emit.o: ppd-emit.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h ppd.h raster.h
|
||||
ppd-localize.o: ppd-localize.c cups-private.h string-private.h \
|
||||
../config.h debug-private.h ../cups/versioning.h array-private.h \
|
||||
../cups/array.h ipp-private.h ../cups/ipp.h http.h http-private.h \
|
||||
../cups/language.h md5-private.h language-private.h \
|
||||
../cups/transcode.h pwg-private.h ../cups/cups.h file.h pwg.h \
|
||||
thread-private.h ppd-private.h ../cups/ppd.h raster.h
|
||||
ppd-mark.o: ppd-mark.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h ppd-private.h \
|
||||
../cups/ppd.h raster.h
|
||||
ppd-page.o: ppd-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 pwg.h raster.h
|
||||
ppd-util.o: ppd-util.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h ppd-private.h \
|
||||
../cups/ppd.h raster.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
string-private.h ../config.h debug-private.h array-private.h \
|
||||
../cups/array.h ipp-private.h ../cups/ipp.h http.h http-private.h \
|
||||
../cups/language.h md5-private.h language-private.h \
|
||||
../cups/transcode.h pwg-private.h ../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
string.o: string.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h
|
||||
tls.o: tls.c cups-private.h string-private.h ../config.h debug-private.h \
|
||||
../cups/versioning.h array-private.h ../cups/array.h ipp-private.h \
|
||||
../cups/ipp.h http.h http-private.h ../cups/language.h md5-private.h \
|
||||
language-private.h ../cups/transcode.h pwg-private.h ../cups/cups.h \
|
||||
file.h pwg.h thread-private.h tls-darwin.c
|
||||
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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
http.h array.h language.h pwg.h string-private.h ../config.h
|
||||
testarray.o: testarray.c string-private.h ../config.h debug-private.h \
|
||||
../cups/versioning.h array.h dir.h
|
||||
../cups/versioning.h array-private.h ../cups/array.h dir.h
|
||||
testcache.o: testcache.c ppd-private.h ../cups/cups.h file.h versioning.h \
|
||||
ipp.h http.h array.h language.h pwg.h ../cups/ppd.h raster.h \
|
||||
pwg-private.h file-private.h cups-private.h string-private.h \
|
||||
../config.h debug-private.h array-private.h ipp-private.h \
|
||||
http-private.h md5-private.h language-private.h ../cups/transcode.h \
|
||||
thread-private.h
|
||||
testconflicts.o: testconflicts.c cups.h file.h versioning.h ipp.h http.h \
|
||||
array.h language.h ppd.h string-private.h ../config.h
|
||||
array.h language.h pwg.h ppd.h raster.h string-private.h ../config.h
|
||||
testcreds.o: testcreds.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h
|
||||
testcups.o: testcups.c string-private.h ../config.h cups.h file.h \
|
||||
versioning.h ipp.h http.h array.h language.h ppd.h
|
||||
versioning.h ipp.h http.h array.h language.h pwg.h ppd.h raster.h
|
||||
testdest.o: testdest.c cups.h file.h versioning.h ipp.h http.h array.h \
|
||||
language.h pwg.h
|
||||
testfile.o: testfile.c string-private.h ../config.h debug-private.h \
|
||||
../cups/versioning.h file.h
|
||||
testhttp.o: testhttp.c string-private.h ../config.h http-private.h \
|
||||
../cups/http.h versioning.h array.h md5-private.h ipp-private.h \
|
||||
../cups/ipp.h
|
||||
testhttp.o: testhttp.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h
|
||||
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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h ppd-private.h \
|
||||
../cups/ppd.h raster.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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h ppd-private.h \
|
||||
../cups/ppd.h raster.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 \
|
||||
language-private.h ../cups/transcode.h thread-private.h
|
||||
ipp.h http.h array.h language.h pwg.h ../cups/ppd.h raster.h \
|
||||
pwg-private.h file-private.h cups-private.h string-private.h \
|
||||
../config.h debug-private.h array-private.h ipp-private.h \
|
||||
http-private.h md5-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
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h snmp-private.h
|
||||
tlscheck.o: tlscheck.c cups-private.h string-private.h ../config.h \
|
||||
debug-private.h ../cups/versioning.h array-private.h ../cups/array.h \
|
||||
ipp-private.h ../cups/ipp.h http.h http-private.h ../cups/language.h \
|
||||
md5-private.h language-private.h ../cups/transcode.h pwg-private.h \
|
||||
../cups/cups.h file.h pwg.h thread-private.h
|
||||
|
||||
214
cups/Makefile
214
cups/Makefile
@ -1,22 +1,28 @@
|
||||
#
|
||||
# "$Id: Makefile 7871 2008-08-27 21:12:43Z mike $"
|
||||
# API library Makefile for CUPS.
|
||||
#
|
||||
# API library Makefile for CUPS.
|
||||
# Copyright 2007-2016 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
#
|
||||
# Copyright 2007-2012 by Apple Inc.
|
||||
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
# which should have been included with this file. If this file is
|
||||
# file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
#
|
||||
# These coded instructions, statements, and computer programs are the
|
||||
# property of Apple Inc. and are protected by Federal copyright
|
||||
# law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
# which should have been included with this file. If this file is
|
||||
# file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
#
|
||||
# This file is subject to the Apple OS-Developed Software exception.
|
||||
# This file is subject to the Apple OS-Developed Software exception.
|
||||
#
|
||||
|
||||
include ../Makedefs
|
||||
|
||||
|
||||
#
|
||||
# Options to build libcups without the use of deprecated APIs...
|
||||
#
|
||||
|
||||
OPTIONS = -D_CUPS_NO_DEPRECATED=1 -D_PPD_DEPRECATED=""
|
||||
|
||||
|
||||
#
|
||||
# Object files...
|
||||
#
|
||||
@ -24,25 +30,22 @@ include ../Makedefs
|
||||
LIBOBJS = \
|
||||
adminutil.o \
|
||||
array.o \
|
||||
attr.o \
|
||||
auth.o \
|
||||
backchannel.o \
|
||||
backend.o \
|
||||
conflicts.o \
|
||||
custom.o \
|
||||
debug.o \
|
||||
dest.o \
|
||||
dest-job.o \
|
||||
dest-localization.o \
|
||||
dest-options.o \
|
||||
dir.o \
|
||||
emit.o \
|
||||
encode.o \
|
||||
file.o \
|
||||
getdevices.o \
|
||||
getifaddrs.o \
|
||||
getputfile.o \
|
||||
globals.o \
|
||||
hash.o \
|
||||
http.o \
|
||||
http-addr.o \
|
||||
http-addrlist.o \
|
||||
@ -51,15 +54,20 @@ LIBOBJS = \
|
||||
ipp-support.o \
|
||||
langprintf.o \
|
||||
language.o \
|
||||
localize.o \
|
||||
mark.o \
|
||||
md5.o \
|
||||
md5passwd.o \
|
||||
notify.o \
|
||||
options.o \
|
||||
page.o \
|
||||
ppd.o \
|
||||
ppd-attr.o \
|
||||
ppd-cache.o \
|
||||
ppd-conflicts.o \
|
||||
ppd-custom.o \
|
||||
ppd-emit.o \
|
||||
ppd-localize.o \
|
||||
ppd-mark.o \
|
||||
ppd-page.o \
|
||||
ppd-util.o \
|
||||
pwg-media.o \
|
||||
request.o \
|
||||
sidechannel.o \
|
||||
@ -68,14 +76,18 @@ LIBOBJS = \
|
||||
string.o \
|
||||
tempfile.o \
|
||||
thread.o \
|
||||
tls.o \
|
||||
transcode.o \
|
||||
usersys.o \
|
||||
util.o
|
||||
TESTOBJS = \
|
||||
testadmin.o \
|
||||
testarray.o \
|
||||
testcache.o \
|
||||
testconflicts.o \
|
||||
testcreds.o \
|
||||
testcups.o \
|
||||
testdest.o \
|
||||
testfile.o \
|
||||
testhttp.o \
|
||||
testi18n.o \
|
||||
@ -84,7 +96,8 @@ TESTOBJS = \
|
||||
testlang.o \
|
||||
testppd.o \
|
||||
testpwg.o \
|
||||
testsnmp.o
|
||||
testsnmp.o \
|
||||
tlscheck.o
|
||||
OBJS = \
|
||||
$(LIBOBJS) \
|
||||
$(TESTOBJS)
|
||||
@ -105,6 +118,7 @@ HEADERS = \
|
||||
ipp.h \
|
||||
language.h \
|
||||
ppd.h \
|
||||
pwg.h \
|
||||
raster.h \
|
||||
sidechannel.h \
|
||||
transcode.h \
|
||||
@ -138,8 +152,11 @@ LIBTARGETS = \
|
||||
UNITTARGETS = \
|
||||
testadmin \
|
||||
testarray \
|
||||
testcache \
|
||||
testconflicts \
|
||||
testcreds \
|
||||
testcups \
|
||||
testdest \
|
||||
testfile \
|
||||
testhttp \
|
||||
testi18n \
|
||||
@ -148,7 +165,8 @@ UNITTARGETS = \
|
||||
testoptions \
|
||||
testppd \
|
||||
testpwg \
|
||||
testsnmp
|
||||
testsnmp \
|
||||
tlscheck
|
||||
|
||||
TARGETS = \
|
||||
$(LIBTARGETS)
|
||||
@ -181,7 +199,7 @@ unittests: $(UNITTARGETS)
|
||||
|
||||
clean:
|
||||
$(RM) $(OBJS) $(TARGETS) $(UNITTARGETS)
|
||||
$(RM) libcups.so libcups.sl libcups.dylib
|
||||
$(RM) libcups.so libcups.dylib
|
||||
|
||||
|
||||
#
|
||||
@ -248,7 +266,7 @@ install-libs: $(INSTALLSTATIC)
|
||||
echo Installing libraries in $(LIBDIR)...
|
||||
$(INSTALL_DIR) -m 755 $(LIBDIR)
|
||||
$(INSTALL_LIB) $(LIBCUPS) $(LIBDIR)
|
||||
if test $(LIBCUPS) = "libcups.so.2" -o $(LIBCUPS) = "libcups.sl.2"; then \
|
||||
if test $(LIBCUPS) = "libcups.so.2"; then \
|
||||
$(RM) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
|
||||
$(LN) $(LIBCUPS) $(LIBDIR)/`basename $(LIBCUPS) .2`; \
|
||||
fi
|
||||
@ -259,6 +277,7 @@ install-libs: $(INSTALLSTATIC)
|
||||
if test "x$(SYMROOT)" != "x"; then \
|
||||
$(INSTALL_DIR) $(SYMROOT); \
|
||||
cp $(LIBCUPS) $(SYMROOT); \
|
||||
dsymutil $(SYMROOT)/$(LIBCUPS); \
|
||||
fi
|
||||
|
||||
installstatic:
|
||||
@ -276,9 +295,6 @@ uninstall:
|
||||
$(RM) $(LIBDIR)/libcups.2.dylib
|
||||
$(RM) $(LIBDIR)/$(LIBCUPSSTATIC)
|
||||
$(RM) $(LIBDIR)/libcups.dylib
|
||||
$(RM) $(LIBDIR)/libcups_s.a
|
||||
$(RM) $(LIBDIR)/libcups.sl
|
||||
$(RM) $(LIBDIR)/libcups.sl.2
|
||||
$(RM) $(LIBDIR)/libcups.so
|
||||
$(RM) $(LIBDIR)/libcups.so.2
|
||||
-$(RMDIR) $(LIBDIR)
|
||||
@ -289,10 +305,10 @@ uninstall:
|
||||
|
||||
|
||||
#
|
||||
# libcups.so.2, libcups.sl.2
|
||||
# libcups.so.2
|
||||
#
|
||||
|
||||
libcups.so.2 libcups.sl.2: $(LIBOBJS)
|
||||
libcups.so.2: $(LIBOBJS)
|
||||
echo Linking $@...
|
||||
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS) $(LIBGSSAPI) \
|
||||
$(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
@ -306,13 +322,14 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS)
|
||||
|
||||
libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
|
||||
echo Creating export list for $@...
|
||||
nm $(LIBOBJS) 2>/dev/null | grep "T _" | awk '{print $$3}' | \
|
||||
grep -v -e '^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault|_httpWait)$$' | \
|
||||
nm -gm $(LIBOBJS) 2>/dev/null | grep "__text" | grep -v weak | \
|
||||
awk '{print $$NF}' | \
|
||||
grep -v -E -e '^(_cupsConnect|_cupsCharset|_cupsEncodingName|_cupsSetDefaults|_cupsSetHTTPError|_cupsUserDefault)$$' | \
|
||||
sort >t.exp
|
||||
echo Linking $@...
|
||||
$(DSO) $(ARCHFLAGS) $(DSOFLAGS) -o $@ \
|
||||
-install_name $(libdir)/$@ \
|
||||
-current_version 2.10.0 \
|
||||
-current_version 2.12.0 \
|
||||
-compatibility_version 2.0.0 \
|
||||
-exported_symbols_list t.exp \
|
||||
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
@ -321,19 +338,6 @@ libcups.2.dylib: $(LIBOBJS) $(LIBCUPSORDER)
|
||||
$(LN) $@ libcups.dylib
|
||||
|
||||
|
||||
#
|
||||
# libcups_s.a
|
||||
#
|
||||
|
||||
libcups_s.a: $(LIBOBJS) libcups_s.exp
|
||||
echo Creating $@...
|
||||
$(DSO) $(DSOFLAGS) -Wl,-bexport:libcups_s.exp -o libcups_s.o \
|
||||
$(LIBOBJS) $(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) \
|
||||
$(COMMONLIBS) $(LIBZ)
|
||||
$(RM) $@
|
||||
$(AR) $(ARFLAGS) $@ libcups_s.o
|
||||
|
||||
|
||||
#
|
||||
# libcups.la
|
||||
#
|
||||
@ -341,7 +345,7 @@ libcups_s.a: $(LIBOBJS) libcups_s.exp
|
||||
libcups.la: $(LIBOBJS)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(DSOFLAGS) -o $@ $(LIBOBJS:.o=.lo) \
|
||||
-rpath $(LIBDIR) -version-info 2:10 $(LIBGSSAPI) $(SSLLIBS) \
|
||||
-rpath $(LIBDIR) -version-info 2:12 $(LIBGSSAPI) $(SSLLIBS) \
|
||||
$(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
@ -356,6 +360,23 @@ libcups.a: $(LIBOBJS)
|
||||
$(RANLIB) $@
|
||||
|
||||
|
||||
#
|
||||
# libcups2.def (Windows DLL exports file...)
|
||||
#
|
||||
|
||||
libcups2.def: $(LIBOBJS) Makefile
|
||||
echo Generating $@...
|
||||
echo "LIBRARY libcups2" >libcups2.def
|
||||
echo "VERSION 2.12" >>libcups2.def
|
||||
echo "EXPORTS" >>libcups2.def
|
||||
(nm $(LIBOBJS) 2>/dev/null | grep "T _" | awk '{print $$3}'; \
|
||||
echo __cups_strcpy; echo __cups_strlcat; echo __cups_strlcpy) | \
|
||||
grep -v -E \
|
||||
-e 'cups_debug|Apple|BackChannel|Backend|FileCheck|Filter|GSSService|SetNegotiate|SideChannel' \
|
||||
-e 'Block$$' | \
|
||||
sed -e '1,$$s/^_//' | sort >>libcups2.def
|
||||
|
||||
|
||||
#
|
||||
# testadmin (dependency on static CUPS library is intentional)
|
||||
#
|
||||
@ -378,6 +399,16 @@ testarray: testarray.o $(LIBCUPSSTATIC)
|
||||
./testarray
|
||||
|
||||
|
||||
#
|
||||
# testcache (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testcache: testcache.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testcache.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testconflicts (dependency on static CUPS library is intentional)
|
||||
#
|
||||
@ -388,6 +419,16 @@ testconflicts: testconflicts.o $(LIBCUPSSTATIC)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testcreds (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testcreds: testcreds.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ testcreds.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testcups (dependency on static CUPS library is intentional)
|
||||
#
|
||||
@ -398,6 +439,16 @@ testcups: testcups.o $(LIBCUPSSTATIC)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testdest (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
testdest: testdest.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(LDFLAGS) -o $@ testdest.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# testfile (dependency on static CUPS library is intentional)
|
||||
#
|
||||
@ -504,6 +555,16 @@ testsnmp: testsnmp.o $(LIBCUPSSTATIC)
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# tlscheck (dependency on static CUPS library is intentional)
|
||||
#
|
||||
|
||||
tlscheck: tlscheck.o $(LIBCUPSSTATIC)
|
||||
echo Linking $@...
|
||||
$(CC) $(ARCHFLAGS) $(LDFLAGS) -o $@ tlscheck.o $(LIBCUPSSTATIC) \
|
||||
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
|
||||
|
||||
|
||||
#
|
||||
# Automatic API help files...
|
||||
#
|
||||
@ -515,6 +576,13 @@ apihelp:
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-overview.header --intro api-overview.shtml \
|
||||
>../doc/help/api-overview.html
|
||||
mxmldoc --section "Programming" --title "Administration APIs" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-admin.header --intro api-admin.shtml \
|
||||
api-admin.xml \
|
||||
adminutil.c adminutil.h getdevices.c >../doc/help/api-admin.html
|
||||
mxmldoc --tokens help/api-admin.html api-admin.xml >../doc/help/api-admin.tokens
|
||||
$(RM) api-admin.xml
|
||||
mxmldoc --section "Programming" --title "Array API" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-array.header --intro api-array.shtml \
|
||||
@ -526,8 +594,8 @@ apihelp:
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-cups.header --intro api-cups.shtml \
|
||||
api-cups.xml \
|
||||
cups.h adminutil.c dest*.c language.c notify.c \
|
||||
options.c tempfile.c usersys.c \
|
||||
cups.h pwg.h adminutil.c dest*.c language.c notify.c \
|
||||
options.c pwg-media.c tempfile.c usersys.c \
|
||||
util.c >../doc/help/api-cups.html
|
||||
mxmldoc --tokens help/api-cups.html api-cups.xml >../doc/help/api-cups.tokens
|
||||
$(RM) api-cups.xml
|
||||
@ -541,9 +609,7 @@ apihelp:
|
||||
mxmldoc --section "Programming" --title "PPD API (DEPRECATED)" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-ppd.header --intro api-ppd.shtml \
|
||||
api-ppd.xml \
|
||||
ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c page.c \
|
||||
ppd.c >../doc/help/api-ppd.html
|
||||
api-ppd.xml ppd.h ppd-*.c >../doc/help/api-ppd.html
|
||||
mxmldoc --tokens help/api-ppd.html api-ppd.xml >../doc/help/api-ppd.tokens
|
||||
$(RM) api-ppd.xml
|
||||
mxmldoc --section "Programming" --title "HTTP and IPP APIs" \
|
||||
@ -565,50 +631,6 @@ apihelp:
|
||||
mxmldoc --tokens help/api-filter.html api-filter.xml >../doc/help/api-filter.tokens
|
||||
$(RM) api-filter.xml
|
||||
|
||||
framedhelp:
|
||||
echo Generating CUPS API help files...
|
||||
mxmldoc --framed api-overview \
|
||||
--section "Programming" \
|
||||
--title "Introduction to CUPS Programming" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-overview.header --intro api-overview.shtml
|
||||
mxmldoc --framed api-array \
|
||||
--section "Programming" --title "Array API" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-array.header --intro api-array.shtml \
|
||||
array.h array.c
|
||||
mxmldoc --framed api-cups \
|
||||
--section "Programming" --title "CUPS API" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-cups.header --intro api-cups.shtml \
|
||||
cups.h adminutil.c dest*.c language.c notify.c \
|
||||
options.c tempfile.c usersys.c \
|
||||
util.c
|
||||
mxmldoc --framed api-filedir \
|
||||
--section "Programming" --title "File and Directory APIs" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-filedir.header --intro api-filedir.shtml \
|
||||
file.h file.c dir.h dir.c
|
||||
mxmldoc --framed api-ppd \
|
||||
--section "Programming" --title "PPD API (DEPRECATED)" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-ppd.header --intro api-ppd.shtml \
|
||||
ppd.h attr.c conflicts.c custom.c emit.c localize.c mark.c \
|
||||
page.c ppd.c
|
||||
mxmldoc --framed api-httpipp \
|
||||
--section "Programming" --title "HTTP and IPP APIs" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-httpipp.header --intro api-httpipp.shtml \
|
||||
http.h ipp.h auth.c getdevices.c getputfile.c encode.c \
|
||||
http.c http-addr.c http-support.c ipp.c ipp-support.c \
|
||||
md5passwd.c request.c
|
||||
mxmldoc --framed api-filter \
|
||||
--section "Programming" \
|
||||
--title "Filter and Backend Programming" \
|
||||
--css ../doc/cups-printable.css \
|
||||
--header api-filter.header --intro api-filter.shtml \
|
||||
backchannel.c backend.h backend.c sidechannel.c sidechannel.h
|
||||
|
||||
|
||||
#
|
||||
# Lines of code computation...
|
||||
@ -626,8 +648,4 @@ sloc:
|
||||
#
|
||||
|
||||
include Dependencies
|
||||
|
||||
|
||||
#
|
||||
# End of "$Id: Makefile 7871 2008-08-27 21:12:43Z mike $".
|
||||
#
|
||||
tls.o: tls-darwin.c tls-gnutls.c tls-sspi.c
|
||||
|
||||
225
cups/adminutil.c
225
cups/adminutil.c
@ -1,29 +1,16 @@
|
||||
/*
|
||||
* "$Id: adminutil.c 7850 2008-08-20 00:07:25Z mike $"
|
||||
* Administration utility API definitions for CUPS.
|
||||
*
|
||||
* Administration utility API definitions for CUPS.
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsAdminCreateWindowsPPD() - Create the Windows PPD file for a printer.
|
||||
* cupsAdminExportSamba() - Export a printer to Samba.
|
||||
* cupsAdminGetServerSettings() - Get settings from the server.
|
||||
* cupsAdminSetServerSettings() - Set settings on the server.
|
||||
* do_samba_command() - Do a SAMBA command.
|
||||
* get_cupsd_conf() - Get the current cupsd.conf file.
|
||||
* invalidate_cupsd_cache() - Invalidate the cached cupsd.conf settings.
|
||||
* write_option() - Write a CUPS option to a PPD file.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -31,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "cups-private.h"
|
||||
#include "ppd.h"
|
||||
#include "adminutil.h"
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
@ -52,7 +40,7 @@ static int do_samba_command(const char *command,
|
||||
FILE *logfile);
|
||||
static http_status_t get_cupsd_conf(http_t *http, _cups_globals_t *cg,
|
||||
time_t last_update, char *name,
|
||||
int namelen, int *remote);
|
||||
size_t namelen, int *remote);
|
||||
static void invalidate_cupsd_cache(_cups_globals_t *cg);
|
||||
static void write_option(cups_file_t *dstfp, int order,
|
||||
const char *name, const char *text,
|
||||
@ -129,7 +117,7 @@ cupsAdminCreateWindowsPPD(
|
||||
* Get the supported banner pages, etc. for the printer...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
|
||||
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
|
||||
|
||||
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
|
||||
"localhost", 0, "/printers/%s", dest);
|
||||
@ -145,7 +133,7 @@ cupsAdminCreateWindowsPPD(
|
||||
*/
|
||||
|
||||
response = cupsDoRequest(http, request, "/");
|
||||
if (!response || cupsLastError() > IPP_OK_CONFLICT)
|
||||
if (!response || cupsLastError() > IPP_STATUS_OK_CONFLICTING)
|
||||
{
|
||||
unlink(src);
|
||||
return (NULL);
|
||||
@ -253,7 +241,7 @@ cupsAdminCreateWindowsPPD(
|
||||
snprintf(line, sizeof(line),
|
||||
_cupsLangString(language, _("Missing value on line %d.")),
|
||||
linenum);
|
||||
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR, line, 0);
|
||||
|
||||
cupsFileClose(srcfp);
|
||||
cupsFileClose(dstfp);
|
||||
@ -272,7 +260,7 @@ cupsAdminCreateWindowsPPD(
|
||||
_cupsLangString(language,
|
||||
_("Missing double quote on line %d.")),
|
||||
linenum);
|
||||
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR, line, 0);
|
||||
|
||||
cupsFileClose(srcfp);
|
||||
cupsFileClose(dstfp);
|
||||
@ -291,7 +279,7 @@ cupsAdminCreateWindowsPPD(
|
||||
_cupsLangString(language,
|
||||
_("Bad option + choice on line %d.")),
|
||||
linenum);
|
||||
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR, line, 0);
|
||||
|
||||
cupsFileClose(srcfp);
|
||||
cupsFileClose(dstfp);
|
||||
@ -319,7 +307,7 @@ cupsAdminCreateWindowsPPD(
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(ptr + 1, sizeof(line) - (ptr - line + 1),
|
||||
snprintf(ptr + 1, sizeof(line) - (size_t)(ptr - line + 1),
|
||||
"%%cupsJobTicket: %s=%s\n\"\n*End", option, choice);
|
||||
|
||||
cupsFilePrintf(dstfp, "*%% Changed for CUPS Windows Driver...\n%s\n",
|
||||
@ -334,7 +322,7 @@ cupsAdminCreateWindowsPPD(
|
||||
|
||||
if (linenum == 0)
|
||||
{
|
||||
_cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, _("Empty PPD file."), 1);
|
||||
_cupsSetError(IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR, _("Empty PPD file."), 1);
|
||||
|
||||
cupsFileClose(dstfp);
|
||||
unlink(buffer);
|
||||
@ -424,7 +412,7 @@ cupsAdminExportSamba(
|
||||
|
||||
if (!dest || !ppd || !samba_server || !samba_user || !samba_password)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -434,7 +422,7 @@ cupsAdminExportSamba(
|
||||
|
||||
if ((fp = cupsTempFile2(authfile, sizeof(authfile))) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -487,7 +475,7 @@ cupsAdminExportSamba(
|
||||
_("Unable to copy Windows 2000 printer "
|
||||
"driver files (%d).")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPuts(logfile, message);
|
||||
@ -522,7 +510,7 @@ cupsAdminExportSamba(
|
||||
_("Unable to copy CUPS printer driver "
|
||||
"files (%d).")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPuts(logfile, message);
|
||||
@ -565,7 +553,7 @@ cupsAdminExportSamba(
|
||||
_("Unable to install Windows 2000 printer "
|
||||
"driver files (%d).")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPuts(logfile, message);
|
||||
@ -610,7 +598,7 @@ cupsAdminExportSamba(
|
||||
_("Unable to copy Windows 9x printer "
|
||||
"driver files (%d).")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPuts(logfile, message);
|
||||
@ -639,7 +627,7 @@ cupsAdminExportSamba(
|
||||
_("Unable to install Windows 9x printer "
|
||||
"driver files (%d).")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPuts(logfile, message);
|
||||
@ -691,7 +679,7 @@ cupsAdminExportSamba(
|
||||
_("Unable to copy 64-bit Windows printer "
|
||||
"driver files (%d).")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPuts(logfile, message);
|
||||
@ -726,7 +714,7 @@ cupsAdminExportSamba(
|
||||
_("Unable to copy 64-bit CUPS printer driver "
|
||||
"files (%d).")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPuts(logfile, message);
|
||||
@ -769,7 +757,7 @@ cupsAdminExportSamba(
|
||||
_("Unable to install Windows 2000 printer "
|
||||
"driver files (%d).")), status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPuts(logfile, message);
|
||||
@ -794,13 +782,13 @@ cupsAdminExportSamba(
|
||||
"are installed.")),
|
||||
sizeof(message));
|
||||
|
||||
_cupsSetError(IPP_NOT_FOUND, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, message, 0);
|
||||
_cupsLangPuts(logfile, message);
|
||||
}
|
||||
|
||||
if (have_drivers == 0)
|
||||
{
|
||||
_cupsSetError(IPP_NOT_FOUND, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, message, 0);
|
||||
|
||||
unlink(authfile);
|
||||
|
||||
@ -821,7 +809,7 @@ cupsAdminExportSamba(
|
||||
_("Unable to set Windows printer driver (%d).")),
|
||||
status);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
|
||||
if (logfile)
|
||||
_cupsLangPuts(logfile, message);
|
||||
@ -843,7 +831,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@ -882,9 +870,9 @@ cupsAdminGetServerSettings(
|
||||
*/
|
||||
|
||||
if (strcmp(cg->http->hostname, cg->server) ||
|
||||
cg->ipp_port != _httpAddrPort(cg->http->hostaddr) ||
|
||||
cg->ipp_port != httpAddrPort(cg->http->hostaddr) ||
|
||||
(cg->http->encryption != cg->encryption &&
|
||||
cg->http->encryption == HTTP_ENCRYPT_NEVER))
|
||||
cg->http->encryption == HTTP_ENCRYPTION_NEVER))
|
||||
{
|
||||
/*
|
||||
* Need to close the current connection because something has changed...
|
||||
@ -901,13 +889,13 @@ cupsAdminGetServerSettings(
|
||||
|
||||
if (!cg->http)
|
||||
{
|
||||
if ((cg->http = _httpCreate(cupsServer(), ippPort(), NULL,
|
||||
cupsEncryption(), AF_UNSPEC)) == NULL)
|
||||
if ((cg->http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC,
|
||||
cupsEncryption(), 1, 0, NULL)) == NULL)
|
||||
{
|
||||
if (errno)
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, NULL, 0);
|
||||
else
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE,
|
||||
_cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE,
|
||||
_("Unable to connect to host."), 1);
|
||||
|
||||
if (num_settings)
|
||||
@ -925,7 +913,7 @@ cupsAdminGetServerSettings(
|
||||
|
||||
if (!http || !num_settings || !settings)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
|
||||
if (num_settings)
|
||||
*num_settings = 0;
|
||||
@ -944,7 +932,7 @@ cupsAdminGetServerSettings(
|
||||
*/
|
||||
|
||||
if ((status = get_cupsd_conf(http, cg, cg->cupsd_update, cupsdconf,
|
||||
sizeof(cupsdconf), &remote)) == HTTP_OK)
|
||||
sizeof(cupsdconf), &remote)) == HTTP_STATUS_OK)
|
||||
{
|
||||
if ((cupsd = cupsFileOpen(cupsdconf, "r")) == NULL)
|
||||
{
|
||||
@ -954,7 +942,7 @@ cupsAdminGetServerSettings(
|
||||
snprintf(message, sizeof(message),
|
||||
_cupsLangString(cupsLangDefault(), _("Open of %s failed: %s")),
|
||||
cupsdconf, strerror(errno));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1136,7 +1124,7 @@ cupsAdminGetServerSettings(
|
||||
cg->cupsd_num_settings,
|
||||
&(cg->cupsd_settings));
|
||||
}
|
||||
else if (status != HTTP_NOT_MODIFIED)
|
||||
else if (status != HTTP_STATUS_NOT_MODIFIED)
|
||||
invalidate_cupsd_cache(cg);
|
||||
|
||||
/*
|
||||
@ -1159,7 +1147,7 @@ cupsAdminGetServerSettings(
|
||||
/*
|
||||
* 'cupsAdminSetServerSettings()' - Set settings on the server.
|
||||
*
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
* @since CUPS 1.3/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@ -1186,6 +1174,7 @@ cupsAdminSetServerSettings(
|
||||
in_cancel_job, /* In a cancel-job section? */
|
||||
in_admin_location, /* In the /admin location? */
|
||||
in_conf_location, /* In the /admin/conf location? */
|
||||
in_log_location, /* In the /admin/log location? */
|
||||
in_root_location; /* In the / location? */
|
||||
const char *val; /* Setting value */
|
||||
int share_printers, /* Share local printers */
|
||||
@ -1199,11 +1188,13 @@ cupsAdminSetServerSettings(
|
||||
wrote_loglevel, /* Wrote the LogLevel line? */
|
||||
wrote_admin_location, /* Wrote the /admin location? */
|
||||
wrote_conf_location, /* Wrote the /admin/conf location? */
|
||||
wrote_log_location, /* Wrote the /admin/log location? */
|
||||
wrote_root_location; /* Wrote the / location? */
|
||||
int indent; /* Indentation */
|
||||
int cupsd_num_settings; /* New number of settings */
|
||||
int old_share_printers, /* Share local printers */
|
||||
old_remote_admin, /* Remote administration allowed? */
|
||||
old_remote_any, /* Remote access from anywhere? */
|
||||
old_user_cancel_any, /* Cancel-job policy set? */
|
||||
old_debug_logging; /* LogLevel debug set? */
|
||||
cups_option_t *cupsd_settings, /* New settings */
|
||||
@ -1220,7 +1211,7 @@ cupsAdminSetServerSettings(
|
||||
|
||||
if (!http || !num_settings || !settings)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -1230,11 +1221,11 @@ cupsAdminSetServerSettings(
|
||||
*/
|
||||
|
||||
if (get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
|
||||
&remote) == HTTP_OK)
|
||||
&remote) == HTTP_STATUS_OK)
|
||||
{
|
||||
if ((cupsd = cupsFileOpen(cupsdconf, "r")) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
@ -1269,12 +1260,12 @@ cupsAdminSetServerSettings(
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
remote_any = atoi(val);
|
||||
old_remote_any = atoi(val);
|
||||
else
|
||||
remote_any = 0;
|
||||
old_remote_any = 0;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: old remote_any=%d",
|
||||
remote_any));
|
||||
old_remote_any));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_SHARE_PRINTERS, cupsd_num_settings,
|
||||
cupsd_settings)) != NULL)
|
||||
@ -1320,12 +1311,23 @@ cupsAdminSetServerSettings(
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: debug_logging=%d",
|
||||
debug_logging));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, num_settings,
|
||||
settings)) != NULL)
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ANY, num_settings, settings)) != NULL)
|
||||
{
|
||||
remote_any = atoi(val);
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: remote_any=%d",
|
||||
remote_any));
|
||||
if (remote_any == old_remote_any)
|
||||
{
|
||||
/*
|
||||
* No change to this setting...
|
||||
*/
|
||||
|
||||
remote_any = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
remote_any = -1;
|
||||
|
||||
DEBUG_printf(("1cupsAdminSetServerSettings: remote_any=%d", remote_any));
|
||||
|
||||
if ((val = cupsGetOption(CUPS_SERVER_REMOTE_ADMIN, num_settings,
|
||||
settings)) != NULL)
|
||||
@ -1398,7 +1400,7 @@ cupsAdminSetServerSettings(
|
||||
if (remote)
|
||||
unlink(cupsdconf);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1412,12 +1414,14 @@ cupsAdminSetServerSettings(
|
||||
in_conf_location = 0;
|
||||
in_default_policy = 0;
|
||||
in_location = 0;
|
||||
in_log_location = 0;
|
||||
in_policy = 0;
|
||||
in_root_location = 0;
|
||||
linenum = 0;
|
||||
wrote_admin_location = 0;
|
||||
wrote_browsing = 0;
|
||||
wrote_conf_location = 0;
|
||||
wrote_log_location = 0;
|
||||
wrote_loglevel = 0;
|
||||
wrote_policy = 0;
|
||||
wrote_port_listen = 0;
|
||||
@ -1438,7 +1442,7 @@ cupsAdminSetServerSettings(
|
||||
while (cupsFileGetConf(cupsd, line, sizeof(line), &value, &linenum))
|
||||
{
|
||||
if ((!_cups_strcasecmp(line, "Port") || !_cups_strcasecmp(line, "Listen")) &&
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
(remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
|
||||
{
|
||||
if (!wrote_port_listen)
|
||||
{
|
||||
@ -1561,8 +1565,10 @@ cupsAdminSetServerSettings(
|
||||
indent += 2;
|
||||
if (!strcmp(value, "/admin"))
|
||||
in_admin_location = 1;
|
||||
if (!strcmp(value, "/admin/conf"))
|
||||
else if (!strcmp(value, "/admin/conf"))
|
||||
in_conf_location = 1;
|
||||
else if (!strcmp(value, "/admin/log"))
|
||||
in_log_location = 1;
|
||||
else if (!strcmp(value, "/"))
|
||||
in_root_location = 1;
|
||||
|
||||
@ -1604,8 +1610,25 @@ cupsAdminSetServerSettings(
|
||||
cupsFilePrintf(temp, " Allow %s\n",
|
||||
remote_any > 0 ? "all" : "@LOCAL");
|
||||
}
|
||||
else if (in_log_location && remote_admin >= 0)
|
||||
{
|
||||
wrote_log_location = 1;
|
||||
|
||||
if (remote_admin)
|
||||
cupsFilePuts(temp, " # Allow remote access to the log "
|
||||
"files...\n");
|
||||
else
|
||||
cupsFilePuts(temp, " # Restrict access to the log "
|
||||
"files...\n");
|
||||
|
||||
cupsFilePuts(temp, " Order allow,deny\n");
|
||||
|
||||
if (remote_admin)
|
||||
cupsFilePrintf(temp, " Allow %s\n",
|
||||
remote_any > 0 ? "all" : "@LOCAL");
|
||||
}
|
||||
else if (in_root_location &&
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
(remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
|
||||
{
|
||||
wrote_root_location = 1;
|
||||
|
||||
@ -1630,6 +1653,7 @@ cupsAdminSetServerSettings(
|
||||
|
||||
in_admin_location = 0;
|
||||
in_conf_location = 0;
|
||||
in_log_location = 0;
|
||||
in_root_location = 0;
|
||||
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
@ -1707,7 +1731,7 @@ cupsAdminSetServerSettings(
|
||||
in_cancel_job = 0;
|
||||
}
|
||||
else if ((((in_admin_location || in_conf_location || in_root_location) &&
|
||||
(remote_admin >= 0 || remote_any > 0)) ||
|
||||
(remote_admin >= 0 || remote_any >= 0)) ||
|
||||
(in_root_location && share_printers >= 0)) &&
|
||||
(!_cups_strcasecmp(line, "Allow") || !_cups_strcasecmp(line, "Deny") ||
|
||||
!_cups_strcasecmp(line, "Order")))
|
||||
@ -1799,7 +1823,7 @@ cupsAdminSetServerSettings(
|
||||
}
|
||||
|
||||
if (!wrote_port_listen &&
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
(remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
|
||||
{
|
||||
if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
|
||||
{
|
||||
@ -1820,7 +1844,7 @@ cupsAdminSetServerSettings(
|
||||
}
|
||||
|
||||
if (!wrote_root_location &&
|
||||
(remote_admin >= 0 || remote_any > 0 || share_printers >= 0))
|
||||
(remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
|
||||
{
|
||||
if (remote_admin > 0 && share_printers > 0)
|
||||
cupsFilePuts(temp,
|
||||
@ -1878,6 +1902,25 @@ cupsAdminSetServerSettings(
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
}
|
||||
|
||||
if (!wrote_log_location && remote_admin >= 0)
|
||||
{
|
||||
if (remote_admin)
|
||||
cupsFilePuts(temp,
|
||||
"# Allow remote access to the log files...\n");
|
||||
else
|
||||
cupsFilePuts(temp, "# Restrict access to the log files...\n");
|
||||
|
||||
cupsFilePuts(temp, "<Location /admin/log>\n"
|
||||
" AuthType Default\n"
|
||||
" Require user @SYSTEM\n"
|
||||
" Order allow,deny\n");
|
||||
|
||||
if (remote_admin)
|
||||
cupsFilePrintf(temp, " Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
|
||||
|
||||
cupsFilePuts(temp, "</Location>\n");
|
||||
}
|
||||
|
||||
if (!wrote_policy && user_cancel_any >= 0)
|
||||
{
|
||||
cupsFilePuts(temp, "<Policy default>\n"
|
||||
@ -1954,7 +1997,7 @@ cupsAdminSetServerSettings(
|
||||
|
||||
status = cupsPutFile(http, "/admin/conf/cupsd.conf", tempfile);
|
||||
|
||||
if (status == HTTP_CREATED)
|
||||
if (status == HTTP_STATUS_CREATED)
|
||||
{
|
||||
/*
|
||||
* Updated OK, add the basic settings...
|
||||
@ -1978,9 +2021,14 @@ cupsAdminSetServerSettings(
|
||||
old_remote_admin ? "1" : "0",
|
||||
cupsd_num_settings, &cupsd_settings);
|
||||
|
||||
cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ANY,
|
||||
remote_any ? "1" : "0",
|
||||
cupsd_num_settings, &cupsd_settings);
|
||||
if (remote_any >= 0)
|
||||
cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ANY,
|
||||
remote_any ? "1" : "0",
|
||||
cupsd_num_settings, &cupsd_settings);
|
||||
else
|
||||
cupsd_num_settings = cupsAddOption(CUPS_SERVER_REMOTE_ANY,
|
||||
old_remote_any ? "1" : "0",
|
||||
cupsd_num_settings, &cupsd_settings);
|
||||
|
||||
if (share_printers >= 0)
|
||||
cupsd_num_settings = cupsAddOption(CUPS_SERVER_SHARE_PRINTERS,
|
||||
@ -2024,7 +2072,7 @@ cupsAdminSetServerSettings(
|
||||
|
||||
unlink(tempfile);
|
||||
|
||||
return (status == HTTP_CREATED);
|
||||
return (status == HTTP_STATUS_CREATED);
|
||||
}
|
||||
|
||||
|
||||
@ -2120,7 +2168,7 @@ get_cupsd_conf(
|
||||
_cups_globals_t *cg, /* I - Global data */
|
||||
time_t last_update, /* I - Last update time for file */
|
||||
char *name, /* I - Filename buffer */
|
||||
int namesize, /* I - Size of filename buffer */
|
||||
size_t namesize, /* I - Size of filename buffer */
|
||||
int *remote) /* O - Remote file? */
|
||||
{
|
||||
int fd; /* Temporary file descriptor */
|
||||
@ -2158,16 +2206,16 @@ get_cupsd_conf(
|
||||
snprintf(message, sizeof(message),
|
||||
_cupsLangString(cupsLangDefault(), _("stat of %s failed: %s")),
|
||||
name, strerror(errno));
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, message, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
|
||||
|
||||
*name = '\0';
|
||||
|
||||
return (HTTP_SERVER_ERROR);
|
||||
return (HTTP_STATUS_SERVER_ERROR);
|
||||
}
|
||||
else if (last_update && info.st_mtime <= last_update)
|
||||
status = HTTP_NOT_MODIFIED;
|
||||
status = HTTP_STATUS_NOT_MODIFIED;
|
||||
else
|
||||
status = HTTP_OK;
|
||||
status = HTTP_STATUS_OK;
|
||||
}
|
||||
else
|
||||
#endif /* !WIN32 */
|
||||
@ -2176,15 +2224,15 @@ get_cupsd_conf(
|
||||
* Read cupsd.conf via a HTTP GET request...
|
||||
*/
|
||||
|
||||
if ((fd = cupsTempFd(name, namesize)) < 0)
|
||||
if ((fd = cupsTempFd(name, (int)namesize)) < 0)
|
||||
{
|
||||
*name = '\0';
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
|
||||
|
||||
invalidate_cupsd_cache(cg);
|
||||
|
||||
return (HTTP_SERVER_ERROR);
|
||||
return (HTTP_STATUS_SERVER_ERROR);
|
||||
}
|
||||
|
||||
*remote = 1;
|
||||
@ -2199,7 +2247,7 @@ get_cupsd_conf(
|
||||
|
||||
close(fd);
|
||||
|
||||
if (status != HTTP_OK)
|
||||
if (status != HTTP_STATUS_OK)
|
||||
{
|
||||
unlink(name);
|
||||
*name = '\0';
|
||||
@ -2334,8 +2382,3 @@ write_option(cups_file_t *dstfp, /* I - PPD file */
|
||||
|
||||
cupsFilePrintf(dstfp, "*JCLCloseUI: *%s\n\n", name);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: adminutil.c 7850 2008-08-20 00:07:25Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: adminutil.h 7026 2007-10-19 00:57:45Z mike $"
|
||||
* Administration utility API definitions for CUPS.
|
||||
*
|
||||
* Administration utility API definitions for CUPS.
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2001-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_ADMINUTIL_H_
|
||||
@ -42,11 +40,23 @@ extern "C" {
|
||||
# define CUPS_SERVER_DEBUG_LOGGING "_debug_logging"
|
||||
# define CUPS_SERVER_REMOTE_ADMIN "_remote_admin"
|
||||
# define CUPS_SERVER_REMOTE_ANY "_remote_any"
|
||||
/*# define CUPS_SERVER_REMOTE_PRINTERS "_remote_printers"*/
|
||||
# define CUPS_SERVER_SHARE_PRINTERS "_share_printers"
|
||||
# define CUPS_SERVER_USER_CANCEL_ANY "_user_cancel_any"
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef void (*cups_device_cb_t)(const char *device_class,
|
||||
const char *device_id, const char *device_info,
|
||||
const char *device_make_and_model,
|
||||
const char *device_uri,
|
||||
const char *device_location, void *user_data);
|
||||
/* Device callback
|
||||
* @since CUPS 1.4/macOS 10.6@ */
|
||||
|
||||
|
||||
/*
|
||||
* Functions...
|
||||
*/
|
||||
@ -69,13 +79,15 @@ extern int cupsAdminSetServerSettings(http_t *http,
|
||||
cups_option_t *settings)
|
||||
_CUPS_API_1_3;
|
||||
|
||||
extern ipp_status_t cupsGetDevices(http_t *http, int timeout,
|
||||
const char *include_schemes,
|
||||
const char *exclude_schemes,
|
||||
cups_device_cb_t callback,
|
||||
void *user_data) _CUPS_API_1_4;
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_ADMINUTIL_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: adminutil.h 7026 2007-10-19 00:57:45Z mike $".
|
||||
*/
|
||||
|
||||
34
cups/api-admin.header
Normal file
34
cups/api-admin.header
Normal file
@ -0,0 +1,34 @@
|
||||
<!--
|
||||
Administrative API header for CUPS.
|
||||
|
||||
Copyright 2016 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h1 class='title'>Administrative APIs</h1>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Header</th>
|
||||
<th>cups/adminutil.h</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Library</th>
|
||||
<td>-lcups</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>See Also</th>
|
||||
<td>Programming: <a href='api-overview.html' target='_top'>Introduction to CUPS Programming</a><br>
|
||||
Programming: <a href='api-cups.html' target='_top'>CUPS API</a><br>
|
||||
Programming: <a href='api-httpipp.html' target='_top'>HTTP and IPP APIs</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table></div>
|
||||
96
cups/api-admin.shtml
Normal file
96
cups/api-admin.shtml
Normal file
@ -0,0 +1,96 @@
|
||||
<!--
|
||||
Administrative API documentation for CUPS.
|
||||
|
||||
Copyright 2016 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
which should have been included with this file. If this file is
|
||||
file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
-->
|
||||
|
||||
<h2 class="title"><a name="OVERVIEW">Overview</a></h2>
|
||||
|
||||
<p>The administrative APIs provide convenience functions to perform certain administrative functions with the CUPS scheduler.</p>
|
||||
|
||||
<blockquote><b>Note:<b>
|
||||
<p>Administrative functions normally require administrative privileges to execute and must not be used in ordinary user applications!</p>
|
||||
</blockquote>
|
||||
|
||||
<h3><a name="SETTINGS">Scheduler Settings</a></h3>
|
||||
|
||||
<p>The <a href="#cupsAdminGetServerSettings"><code>cupsAdminGetServerSettings</code></a> and <a href="#cupsAdminSetServerSettings"><code>cupsAdminSetServerSettings</code></a> functions allow you to get and set simple directives and their values, respectively, in the <var>cupsd.conf</var> file for the CUPS scheduler. Settings are stored in CUPS option arrays which provide a simple list of string name/value pairs. While any simple <var>cupsd.conf</var> directive name can be specified, the following convenience names are also defined to control common complex directives:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>CUPS_SERVER_DEBUG_LOGGING</code></li>: For <code>cupsAdminGetServerSettings</code>, a value of "1" means that the <code>LogLevel</code> directive is set to <code>debug</code> or <code>debug2</code> while a value of "0" means it is set to any other value. For <code>cupsAdminSetServerSettings</code> a value of "1" sets the <code>LogLeveL</code> to <code>debug</code> while a value of "0" sets it to <code>warn</code>.</li>
|
||||
<li><code>CUPS_SERVER_REMOTE_ADMIN</code></li>: A value of "1" specifies that administrative requests are accepted from remote addresses while "0" specifies that requests are only accepted from local addresses (loopback interface and domain sockets).</li>
|
||||
<li><code>CUPS_SERVER_REMOTE_ANY</code></li>: A value of "1" specifies that requests are accepts from any address while "0" specifies that requests are only accepted from the local subnet (when sharing is enabled) or local addresses (loopback interface and domain sockets).</li>
|
||||
<li><code>CUPS_SERVER_SHARE_PRINTERS</code></li>: A value of "1" specifies that printer sharing is enabled for selected printers and remote requests are accepted while a value of "0" specifies that printer sharing is disables and remote requests are not accepted.</li>
|
||||
<li><code>CUPS_SERVER_USER_CANCEL_ANY</code></li>: A value of "1" specifies that the default security policy allows any user to cancel any print job, regardless of the owner. A value of "0" specifies that only administrative users can cancel other user's jobs.</li>
|
||||
</ul>
|
||||
|
||||
<blockquote><b>Note:</b>
|
||||
<p>Changing settings will restart the CUPS scheduler.</p>
|
||||
<p>When printer sharing or the web interface are enabled, the scheduler's launch-on-demand functionality is effectively disabled. This can affect power usage, system performance, and the security profile of a system.</p>
|
||||
</blockquote>
|
||||
|
||||
<p>The recommended way to make changes to the <var>cupsd.conf</var> is to first call <a href="#cupsAdminGetServerSettings"><code>cupsAdminGetServerSettings</code></a>, make any changes to the returned option array, and then call <a href="#cupsAdminSetServerSettings"><code>cupsAdminSetServerSettings</code></a> to save those settings. For example, to enable the web interface:</p>
|
||||
|
||||
<pre class="example">
|
||||
#include <cups/cups.h>
|
||||
#include <cups/adminutil.h>
|
||||
|
||||
void
|
||||
enable_web_interface(void)
|
||||
{
|
||||
int num_settings = 0; /* Number of settings */
|
||||
cups_option_t *settings = NULL; /* Settings */
|
||||
|
||||
|
||||
if (!<a href="#cupsAdminGetServerSettings">cupsAdminGetServerSettings</a>(CUPS_HTTP_DEFAULT, &num_settings, &settings))
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to get server settings: %s\n", cupsLastErrorString());
|
||||
return;
|
||||
}
|
||||
|
||||
num_settings = <a href="api-cups.html#cupsAddOption">cupsAddOption</a>("WebInterface", "Yes", num_settings, &settings);
|
||||
|
||||
if (!<a href="#cupsAdminSetServerSettings">cupsAdminSetServerSettings</a>(CUPS_HTTP_DEFAULT, num_settings, settings))
|
||||
{
|
||||
fprintf(stderr, "ERROR: Unable to set server settings: %s\n", cupsLastErrorString());
|
||||
}
|
||||
|
||||
<a href="api-cups.html#cupsFreeOptions">cupsFreeOptions</a>(num_settings, settings);
|
||||
}
|
||||
</pre>
|
||||
|
||||
<h3><a name="DEVICES">Devices</a></h3>
|
||||
|
||||
<p>Printers can be discovered through the CUPS scheduler using the <a href="#cupsGetDevices"><code>cupsGetDevices</code></a> API. Typically this API is used to locate printers to add the the system. Each device that is found will cause a supplied callback function to be executed. For example, to list the available printer devices that can be found within 30 seconds:</p>
|
||||
|
||||
<pre class="example">
|
||||
#include <cups/cups.h>
|
||||
#include <cups/adminutil.h>
|
||||
|
||||
|
||||
void
|
||||
get_devices_cb(
|
||||
const char *device_class, /* I - Class */
|
||||
const char *device_id, /* I - 1284 device ID */
|
||||
const char *device_info, /* I - Description */
|
||||
const char *device_make_and_model, /* I - Make and model */
|
||||
const char *device_uri, /* I - Device URI */
|
||||
const char *device_location, /* I - Location */
|
||||
void *user_data) /* I - User data */
|
||||
{
|
||||
puts(device_uri);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
show_devices(void)
|
||||
{
|
||||
<a href="#cupsGetDevices">cupsGetDevices</a>(CUPS_HTTP_DEFAULT, 30, NULL, NULL, get_devices_cb, NULL);
|
||||
}
|
||||
</pre>
|
||||
@ -1,6 +1,4 @@
|
||||
<!--
|
||||
"$Id: api-array.header 7266 2008-01-29 02:15:29Z mike $"
|
||||
|
||||
Array API header for CUPS.
|
||||
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<!--
|
||||
"$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $"
|
||||
|
||||
Array API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<!--
|
||||
"$Id: api-cups.header 7279 2008-01-31 01:50:44Z mike $"
|
||||
|
||||
CUPS API header for CUPS.
|
||||
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<!--
|
||||
"$Id: api-cups.shtml 7337 2008-02-22 04:44:04Z mike $"
|
||||
|
||||
API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2013 by Apple Inc.
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<!--
|
||||
"$Id: api-filedir.header 7279 2008-01-31 01:50:44Z mike $"
|
||||
|
||||
File and Directory API header for CUPS.
|
||||
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<!--
|
||||
"$Id: api-filedir.shtml 7279 2008-01-31 01:50:44Z mike $"
|
||||
|
||||
File and directory API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
<!--
|
||||
"$Id: api-filter.header 7616 2008-05-28 00:34:13Z mike $"
|
||||
|
||||
Filter and backend programming header for CUPS.
|
||||
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
Copyright 2008-2016 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
@ -19,6 +17,7 @@
|
||||
<tr>
|
||||
<th>Headers</th>
|
||||
<th>cups/backend.h<br>
|
||||
cups/ppd.h<br>
|
||||
cups/sidechannel.h</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
<!--
|
||||
"$Id: api-filter.shtml 7677 2008-06-19 23:22:19Z mike $"
|
||||
|
||||
Filter and backend programming introduction for CUPS.
|
||||
|
||||
Copyright 2007-2013 by Apple Inc.
|
||||
Copyright 2007-2016 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
@ -81,7 +79,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>
|
||||
macOS, for example, no backend may write to a user's home directory. See the <a href="#SANDBOXING">Sandboxing on macOS</a> section for more information.</p>
|
||||
</blockquote>
|
||||
|
||||
<h3><a name="SIGNALS">Canceled Jobs and Signal Handling</a></h3>
|
||||
@ -153,7 +151,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>
|
||||
(macOS only).</dd>
|
||||
|
||||
<dt>CHARSET</dt>
|
||||
<dd>The job character set, typically "utf-8".</dd>
|
||||
@ -237,7 +235,7 @@ prefix strings:</p>
|
||||
<code>marker-types</code>, <code>printer-alert</code>, and
|
||||
<code>printer-alert-description</code> printer attributes. Standard
|
||||
<code>marker-types</code> values are listed in <a href='#TABLE1'>Table
|
||||
1</a>.</dd>
|
||||
1</a>. String values need special handling - see <a href="#ATTR_STRINGS">Reporting Attribute String Values</a> below.</dd>
|
||||
|
||||
<dt>CRIT: message</dt>
|
||||
<dd>Sets the printer-state-message attribute and adds the specified
|
||||
@ -287,7 +285,7 @@ prefix strings:</p>
|
||||
<dd>Sets or clears printer-state-reason keywords for the current queue.
|
||||
Typically this is used to indicate persistent media, ink, toner, and
|
||||
configuration conditions or errors on a printer.
|
||||
<a href='#TABLE2'>Table 2</a> lists the standard state keywords -
|
||||
<a href='#TABLE2'>Table 2</a> lists some of the standard "printer-state-reasons" keywords from the <a href="http://www.iana.org/assignments/ipp-registrations/ipp-registrations.xhtml#ipp-registrations-4">IANA IPP Registry</a> -
|
||||
use vendor-prefixed ("com.example.foo") keywords for custom states. See
|
||||
<a href="#MANAGING_STATE">Managing Printer State in a Filter</a> for more
|
||||
information.
|
||||
@ -320,11 +318,11 @@ the "DEBUG:" prefix string.</p>
|
||||
<td>Fuser unit</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>fuserCleaningPad</td>
|
||||
<td>fuser-cleaning-pad</td>
|
||||
<td>Fuser cleaning pad</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>fuserOil</td>
|
||||
<td>fuser-oil</td>
|
||||
<td>Fuser oil</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -336,7 +334,7 @@ the "DEBUG:" prefix string.</p>
|
||||
<td>Photo conductor</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>solidWax</td>
|
||||
<td>solid-wax</td>
|
||||
<td>Wax supply</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -348,19 +346,19 @@ the "DEBUG:" prefix string.</p>
|
||||
<td>Toner supply</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>transferUnit</td>
|
||||
<td>transfer-unit</td>
|
||||
<td>Transfer unit</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>wasteInk</td>
|
||||
<td>waste-ink</td>
|
||||
<td>Waste ink tank</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>wasteToner</td>
|
||||
<td>waste-toner</td>
|
||||
<td>Waste toner tank</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>wasteWax</td>
|
||||
<td>waste-wax</td>
|
||||
<td>Waste wax tank</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -440,6 +438,95 @@ the "DEBUG:" prefix string.</p>
|
||||
</tbody>
|
||||
</table></div>
|
||||
|
||||
|
||||
<h4><a name="ATTR_STRINGS">Reporting Attribute String Values</a></h4>
|
||||
|
||||
<p>When reporting string values using "ATTR:" messages, a filter or backend must take special care to appropriately quote those values. The scheduler uses the CUPS option parsing code for attributes, so the general syntax is:</p>
|
||||
|
||||
<pre class="example">
|
||||
name=simple
|
||||
name=simple,simple,...
|
||||
name='complex value'
|
||||
name="complex value"
|
||||
name='"complex value"','"complex value"',...
|
||||
</pre>
|
||||
|
||||
<p>Simple values are strings that do not contain spaces, quotes, backslashes, or the comma and can be placed verbatim in the "ATTR:" message, for example:</p>
|
||||
|
||||
<pre class="example">
|
||||
int levels[4] = { 40, 50, 60, 70 }; /* CMYK */
|
||||
|
||||
fputs("ATTR: marker-colors=#00FFFF,#FF00FF,#FFFF00,#000000\n", stderr);
|
||||
fputs("ATTR: marker-high-levels=100,100,100,100\n", stderr);
|
||||
fprintf(stderr, "ATTR: marker-levels=%d,%d,%d,%d\n", levels[0], levels[1],
|
||||
levels[2], levels[3], levels[4]);
|
||||
fputs("ATTR: marker-low-levels=5,5,5,5\n", stderr);
|
||||
fputs("ATTR: marker-types=toner,toner,toner,toner\n", stderr);
|
||||
</pre>
|
||||
|
||||
<p>Complex values that contains spaces, quotes, backslashes, or the comma must be quoted. For a single value a single set of quotes is sufficient:</p>
|
||||
|
||||
<pre class="example">
|
||||
fputs("ATTR: marker-message='Levels shown are approximate.'\n", stderr);
|
||||
</pre>
|
||||
|
||||
<p>When multiple values are reported, each value must be enclosed by a set of single and double quotes:</p>
|
||||
|
||||
<pre class="example">
|
||||
fputs("ATTR: marker-names='\"Cyan Toner\"','\"Magenta Toner\"',"
|
||||
"'\"Yellow Toner\"','\"Black Toner\"'\n", stderr);
|
||||
</pre>
|
||||
|
||||
<p>The IPP backend includes a <var>quote_string</var> function that may be used to properly quote a complex value in an "ATTR:" message:</p>
|
||||
|
||||
<pre class="example">
|
||||
static const char * /* O - Quoted string */
|
||||
quote_string(const char *s, /* I - String */
|
||||
char *q, /* I - Quoted string buffer */
|
||||
size_t qsize) /* I - Size of quoted string buffer */
|
||||
{
|
||||
char *qptr, /* Pointer into string buffer */
|
||||
*qend; /* End of string buffer */
|
||||
|
||||
|
||||
qptr = q;
|
||||
qend = q + qsize - 5;
|
||||
|
||||
if (qend < q)
|
||||
{
|
||||
*q = '\0';
|
||||
return (q);
|
||||
}
|
||||
|
||||
*qptr++ = '\'';
|
||||
*qptr++ = '\"';
|
||||
|
||||
while (*s && qptr < qend)
|
||||
{
|
||||
if (*s == '\\' || *s == '\"' || *s == '\'')
|
||||
{
|
||||
if (qptr < (qend - 4))
|
||||
{
|
||||
*qptr++ = '\\';
|
||||
*qptr++ = '\\';
|
||||
*qptr++ = '\\';
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
*qptr++ = *s++;
|
||||
}
|
||||
|
||||
*qptr++ = '\"';
|
||||
*qptr++ = '\'';
|
||||
*qptr = '\0';
|
||||
|
||||
return (q);
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
||||
<h4><a name="MANAGING_STATE">Managing Printer State in a Filter</a></h4>
|
||||
|
||||
<p>Filters are responsible for managing the state keywords they set using
|
||||
@ -474,7 +561,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 macOS 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>
|
||||
@ -763,3 +850,25 @@ void *my_data;
|
||||
|
||||
<a href="#cupsSideChannelSNMPWalk">cupsSNMPSideChannelWalk</a>(".1.3.6.1.2.1.43", 5.0, my_callback, my_data);
|
||||
</pre>
|
||||
|
||||
<h2><a name="SANDBOXING">Sandboxing on macOS</a></h2>
|
||||
|
||||
<p>Starting with macOS 10.6, filters and backends are run inside a security "sandbox" which further limits (beyond the normal UNIX user/group permissions) what a filter or backend can do. This helps to both secure the printing system from malicious software and enforce the functional separation of components in the CUPS filter chain. What follows is a list of actions that are explicitly allowed for all filters and backends:</p>
|
||||
|
||||
<ol>
|
||||
|
||||
<li>Reading of files: pursuant to normal UNIX file permissions, filters and backends can read files for the current job from the <var>/private/var/spool/cups</var> directory and other files on mounted filesystems <em>except</em> for user home directories under <var>/Users</var>.</li>
|
||||
|
||||
<li>Writing of files: pursuant to normal UNIX file permissions, filters and backends can read/write files to the cache directory specified by the <code>CUPS_CACHEDIR</code> environment variable, to the state directory specified by the <code>CUPS_STATEDIR</code> environment variable, to the temporary directory specified by the <code>TMPDIR</code> environment variable, and under the <var>/private/var/db</var>, <var>/private/var/folders</var>, <var>/private/var/lib</var>, <var>/private/var/mysql</var>, <var>/private/var/run</var>, <var>/private/var/spool</var> (except <var>/private/var/spool/cups</var>), <var>/Library/Application Support</var>, <var>/Library/Caches</var>, <var>/Library/Logs</var>, <var>/Library/Preferences</var>, <var>/Library/WebServer</var>, and <var>/Users/Shared</var> directories.</li>
|
||||
|
||||
<li>Execution of programs: pursuant to normal UNIX file permissions, filters and backends can execute any program not located under the <var>/Users</var> directory. Child processes inherit the sandbox and are subject to the same restrictions as the parent.</li>
|
||||
|
||||
<li>Bluetooth and USB: backends can access Bluetooth and USB printers through IOKit. <em>Filters cannot access Bluetooth and USB printers directly.</em></li>
|
||||
|
||||
<li>Network: filters and backends can access UNIX domain sockets under the <var>/private/tmp</var>, <var>/private/var/run</var>, and <var>/private/var/tmp</var> directories. Backends can also create IPv4 and IPv6 TCP (outgoing) and UDP (incoming and outgoing) socket, and bind to local source ports. <em>Filters cannot directly create IPv4 and IPv6 TCP or UDP sockets.</em></li>
|
||||
|
||||
<li>Notifications: filters and backends can send notifications via the Darwin <code>notify_post()</code> API.</li>
|
||||
|
||||
</ol>
|
||||
|
||||
<blockquote><b>Note:</b> The sandbox profile used in CUPS 2.0 still allows some actions that are not listed above - these privileges will be removed over time until the profile matches the list above.</blockquote>
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
<!--
|
||||
"$Id: api-httpipp.header 7258 2008-01-28 00:15:05Z mike $"
|
||||
|
||||
HTTP and IPP API header for CUPS.
|
||||
|
||||
Copyright 2007-2011 by Apple Inc.
|
||||
Copyright 2007-2016 by Apple Inc.
|
||||
Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
@ -18,8 +16,10 @@
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Header</th>
|
||||
<th>cups/cups.h</th>
|
||||
<th>Headers</th>
|
||||
<th>cups/cups.h<br>
|
||||
cups/http.h<br>
|
||||
cups/ipp.h</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<!--
|
||||
"$Id: api-httpipp.shtml 7684 2008-06-23 16:47:38Z mike $"
|
||||
|
||||
HTTP and IPP API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2012 by Apple Inc.
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
<!--
|
||||
"$Id: api-cups.header 7279 2008-01-31 01:50:44Z mike $"
|
||||
|
||||
Introduction to CUPS programming header for CUPS.
|
||||
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
Copyright 2008-2016 by Apple Inc.
|
||||
|
||||
These coded instructions, statements, and computer programs are the
|
||||
property of Apple Inc. and are protected by Federal copyright
|
||||
@ -19,20 +17,22 @@
|
||||
<tr>
|
||||
<th>Headers</th>
|
||||
<th>cups/cups.h<br>
|
||||
cups/adminutil.h<br>
|
||||
cups/array.h<br>
|
||||
cups/backend.h<br>
|
||||
cups/dir.h<br>
|
||||
cups/file.h<br>
|
||||
cups/http.h<br>
|
||||
cups/ipp.h<br>
|
||||
cups/language.h<br>
|
||||
cups/ppd.h<br>
|
||||
cups/raster.h<br>
|
||||
cups/sidechannel.h</th>
|
||||
cups/pwg.h<br>
|
||||
cups/raster.h</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Libraries</th>
|
||||
<td>-lcups<br>
|
||||
-lcupsimage</td>
|
||||
<td>-lcups</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>See Also</th>
|
||||
@ -40,11 +40,12 @@
|
||||
Programming: <a href='postscript-driver.html' target='_top'>Developing PostScript Printer Drivers</a><br>
|
||||
Programming: <a href='api-filter.html' target='_top'>Filter and Backend Programming</a><br>
|
||||
Programming: <a href='ppd-compiler.html' target='_top'>Introduction to the PPD Compiler</a><br>
|
||||
Programming: <a href='api-admin.html' target='_top'>Administrative APIs</a><br>
|
||||
Programming: <a href='api-array.html' target='_top'>Array API</a><br>
|
||||
Programming: <a href='api-cups.html' target='_top'>CUPS API</a><br>
|
||||
Programming: <a href='api-filedir.html' target='_top'>File and Directory APIs</a><br>
|
||||
Programming: <a href='api-httpipp.html' target='_top'>HTTP and IPP APIs</a><br>
|
||||
Programming: <a href='api-ppd.html' target='_top'>PPD API</a><br>
|
||||
Programming: <a href='api-ppd.html' target='_top'>PPD API (DEPRECATED)</a><br>
|
||||
Programming: <a href='api-raster.html' target='_top'>Raster API</a><br>
|
||||
References: <a href='ref-ppdcfile.html' target='_top'>PPD Compiler Driver Information File Reference</a><br>
|
||||
Specifications: <a href='spec-ppd.html' target='_top'>CUPS PPD Extensions</a></td>
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<!--
|
||||
"$Id: api-cups.header 7279 2008-01-31 01:50:44Z mike $"
|
||||
|
||||
Introduction to CUPS programming content for CUPS.
|
||||
|
||||
Copyright 2008-2011 by Apple Inc.
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<!--
|
||||
"$Id: api-ppd.header 7616 2008-05-28 00:34:13Z mike $"
|
||||
|
||||
PPD API header for CUPS.
|
||||
|
||||
Copyright 2008-2012 by Apple Inc.
|
||||
@ -14,7 +12,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/macOS 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>
|
||||
|
||||
<div class='summary'><table summary='General Information'>
|
||||
<thead>
|
||||
|
||||
@ -1,6 +1,4 @@
|
||||
<!--
|
||||
"$Id: api-ppd.shtml 7616 2008-05-28 00:34:13Z mike $"
|
||||
|
||||
PPD API introduction for CUPS.
|
||||
|
||||
Copyright 2007-2012 by Apple Inc.
|
||||
@ -15,7 +13,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/macOS 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>
|
||||
|
||||
<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
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
/*
|
||||
* "$Id: array-private.h 3448 2011-10-04 06:53:26Z msweet $"
|
||||
* Private array definitions for CUPS.
|
||||
*
|
||||
* Private array definitions for CUPS.
|
||||
* Copyright 2011-2012 by Apple Inc.
|
||||
*
|
||||
* Copyright 2011 by Apple Inc.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_ARRAY_PRIVATE_H_
|
||||
@ -37,15 +35,12 @@ extern "C" {
|
||||
* Functions...
|
||||
*/
|
||||
|
||||
extern int _cupsArrayAddStrings(cups_array_t *a, const char *s)
|
||||
_CUPS_API_1_5;
|
||||
extern cups_array_t *_cupsArrayNewStrings(const char *s) _CUPS_API_1_5;
|
||||
extern int _cupsArrayAddStrings(cups_array_t *a, const char *s,
|
||||
char delim) _CUPS_API_1_5;
|
||||
extern cups_array_t *_cupsArrayNewStrings(const char *s, char delim)
|
||||
_CUPS_API_1_5;
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_ARRAY_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: array-private.h 3448 2011-10-04 06:53:26Z msweet $".
|
||||
*/
|
||||
|
||||
209
cups/array.c
209
cups/array.c
@ -1,56 +1,23 @@
|
||||
/*
|
||||
* "$Id: array.c 7616 2008-05-28 00:34:13Z mike $"
|
||||
* Sorted array routines for CUPS.
|
||||
*
|
||||
* Sorted array routines for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsArrayAdd() - Add an element to the array.
|
||||
* _cupsArrayAddStrings() - Add zero or more comma-delimited strings to an
|
||||
* array.
|
||||
* cupsArrayClear() - Clear the array.
|
||||
* cupsArrayCount() - Get the number of elements in the array.
|
||||
* cupsArrayCurrent() - Return the current element in the array.
|
||||
* cupsArrayDelete() - Free all memory used by the array.
|
||||
* cupsArrayDup() - Duplicate the array.
|
||||
* cupsArrayFind() - Find an element in the array.
|
||||
* cupsArrayFirst() - Get the first element in the array.
|
||||
* cupsArrayGetIndex() - Get the index of the current element.
|
||||
* cupsArrayGetInsert() - Get the index of the last inserted element.
|
||||
* cupsArrayIndex() - Get the N-th element in the array.
|
||||
* cupsArrayInsert() - Insert an element in the array.
|
||||
* cupsArrayLast() - Get the last element in the array.
|
||||
* cupsArrayNew() - Create a new array.
|
||||
* cupsArrayNew2() - Create a new array with hash.
|
||||
* cupsArrayNew3() - Create a new array with hash and/or free function.
|
||||
* _cupsArrayNewStrings() - Create a new array of comma-delimited strings.
|
||||
* cupsArrayNext() - Get the next element in the array.
|
||||
* cupsArrayPrev() - Get the previous element in the array.
|
||||
* cupsArrayRemove() - Remove an element from the array.
|
||||
* cupsArrayRestore() - Reset the current element to the last @link
|
||||
* cupsArraySave@.
|
||||
* cupsArraySave() - Mark the current element for a later @link
|
||||
* cupsArrayRestore@.
|
||||
* cupsArrayUserData() - Return the user data for an array.
|
||||
* cups_array_add() - Insert or append an element to the array.
|
||||
* cups_array_find() - Find an element in the array.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include <cups/cups.h>
|
||||
#include "string-private.h"
|
||||
#include "debug-private.h"
|
||||
#include "array-private.h"
|
||||
@ -110,14 +77,14 @@ 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/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
cupsArrayAdd(cups_array_t *a, /* I - Array */
|
||||
void *e) /* I - Element */
|
||||
{
|
||||
DEBUG_printf(("2cupsArrayAdd(a=%p, e=%p)", a, e));
|
||||
DEBUG_printf(("2cupsArrayAdd(a=%p, e=%p)", (void *)a, e));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -138,8 +105,7 @@ cupsArrayAdd(cups_array_t *a, /* I - Array */
|
||||
|
||||
|
||||
/*
|
||||
* '_cupsArrayAddStrings()' - Add zero or more comma-delimited strings to an
|
||||
* array.
|
||||
* '_cupsArrayAddStrings()' - Add zero or more delimited strings to an array.
|
||||
*
|
||||
* Note: The array MUST be created using the @link _cupsArrayNewStrings@
|
||||
* function. Duplicate strings are NOT added. If the string pointer "s" is NULL
|
||||
@ -148,7 +114,8 @@ cupsArrayAdd(cups_array_t *a, /* I - Array */
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
_cupsArrayAddStrings(cups_array_t *a, /* I - Array */
|
||||
const char *s) /* I - Comma-delimited strings or NULL */
|
||||
const char *s, /* I - Delimited strings or NULL */
|
||||
char delim)/* I - Delimiter character */
|
||||
{
|
||||
char *buffer, /* Copy of string */
|
||||
*start, /* Start of string */
|
||||
@ -156,20 +123,46 @@ _cupsArrayAddStrings(cups_array_t *a, /* I - Array */
|
||||
int status = 1; /* Status of add */
|
||||
|
||||
|
||||
if (!a || !s || !*s)
|
||||
return (0);
|
||||
DEBUG_printf(("_cupsArrayAddStrings(a=%p, s=\"%s\", delim='%c')", (void *)a, s, delim));
|
||||
|
||||
if (!strchr(s, ','))
|
||||
if (!a || !s || !*s)
|
||||
{
|
||||
DEBUG_puts("1_cupsArrayAddStrings: Returning 0");
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (delim == ' ')
|
||||
{
|
||||
/*
|
||||
* String doesn't contain a comma, so add it as a single value...
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
DEBUG_puts("1_cupsArrayAddStrings: Skipping leading whitespace.");
|
||||
|
||||
while (*s && isspace(*s & 255))
|
||||
s ++;
|
||||
|
||||
DEBUG_printf(("1_cupsArrayAddStrings: Remaining string \"%s\".", s));
|
||||
}
|
||||
|
||||
if (!strchr(s, delim) &&
|
||||
(delim != ' ' || (!strchr(s, '\t') && !strchr(s, '\n'))))
|
||||
{
|
||||
/*
|
||||
* String doesn't contain a delimiter, so add it as a single value...
|
||||
*/
|
||||
|
||||
DEBUG_puts("1_cupsArrayAddStrings: No delimiter seen, adding a single "
|
||||
"value.");
|
||||
|
||||
if (!cupsArrayFind(a, (void *)s))
|
||||
status = cupsArrayAdd(a, (void *)s);
|
||||
}
|
||||
else if ((buffer = strdup(s)) == NULL)
|
||||
{
|
||||
DEBUG_puts("1_cupsArrayAddStrings: Unable to duplicate string.");
|
||||
status = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (start = end = buffer; *end; start = end)
|
||||
@ -179,11 +172,21 @@ _cupsArrayAddStrings(cups_array_t *a, /* I - Array */
|
||||
* it...
|
||||
*/
|
||||
|
||||
if ((end = strchr(start, ',')) != NULL)
|
||||
if (delim == ' ')
|
||||
{
|
||||
while (*end && !isspace(*end & 255))
|
||||
end ++;
|
||||
while (*end && isspace(*end & 255))
|
||||
*end++ = '\0';
|
||||
}
|
||||
else if ((end = strchr(start, delim)) != NULL)
|
||||
*end++ = '\0';
|
||||
else
|
||||
end = start + strlen(start);
|
||||
|
||||
DEBUG_printf(("1_cupsArrayAddStrings: Adding \"%s\", end=\"%s\"", start,
|
||||
end));
|
||||
|
||||
if (!cupsArrayFind(a, start))
|
||||
status &= cupsArrayAdd(a, start);
|
||||
}
|
||||
@ -191,6 +194,8 @@ _cupsArrayAddStrings(cups_array_t *a, /* I - Array */
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
DEBUG_printf(("1_cupsArrayAddStrings: Returning %d.", status));
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
@ -202,7 +207,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@ -244,7 +249,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Number of elements */
|
||||
@ -271,7 +276,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - Element */
|
||||
@ -301,7 +306,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@ -345,7 +350,7 @@ cupsArrayDelete(cups_array_t *a) /* I - Array */
|
||||
/*
|
||||
* 'cupsArrayDup()' - Duplicate the array.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Duplicate array */
|
||||
@ -384,7 +389,7 @@ cupsArrayDup(cups_array_t *a) /* I - Array */
|
||||
* Allocate memory for the elements...
|
||||
*/
|
||||
|
||||
da->elements = malloc(a->num_elements * sizeof(void *));
|
||||
da->elements = malloc((size_t)a->num_elements * sizeof(void *));
|
||||
if (!da->elements)
|
||||
{
|
||||
free(da);
|
||||
@ -412,7 +417,7 @@ cupsArrayDup(cups_array_t *a) /* I - Array */
|
||||
* Just copy raw pointers...
|
||||
*/
|
||||
|
||||
memcpy(da->elements, a->elements, a->num_elements * sizeof(void *));
|
||||
memcpy(da->elements, a->elements, (size_t)a->num_elements * sizeof(void *));
|
||||
}
|
||||
|
||||
da->num_elements = a->num_elements;
|
||||
@ -430,7 +435,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - Element found or @code NULL@ */
|
||||
@ -525,7 +530,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - First element or @code NULL@ if the array is empty */
|
||||
@ -554,7 +559,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Index of the current element, starting at 0 */
|
||||
@ -570,7 +575,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Index of the last inserted element, starting at 0 */
|
||||
@ -586,7 +591,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - N-th element or @code NULL@ */
|
||||
@ -609,14 +614,14 @@ 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/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on failure, 1 on success */
|
||||
cupsArrayInsert(cups_array_t *a, /* I - Array */
|
||||
void *e) /* I - Element */
|
||||
{
|
||||
DEBUG_printf(("2cupsArrayInsert(a=%p, e=%p)", a, e));
|
||||
DEBUG_printf(("2cupsArrayInsert(a=%p, e=%p)", (void *)a, e));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -639,7 +644,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - Last element or @code NULL@ if the array is empty */
|
||||
@ -670,7 +675,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Array */
|
||||
@ -692,7 +697,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Array */
|
||||
@ -722,7 +727,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/macOS 10.7@
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Array */
|
||||
@ -755,7 +760,7 @@ cupsArrayNew3(cups_array_func_t f, /* I - Comparison function or @code NULL@ fo
|
||||
{
|
||||
a->hashfunc = h;
|
||||
a->hashsize = hsize;
|
||||
a->hash = malloc(hsize * sizeof(int));
|
||||
a->hash = malloc((size_t)hsize * sizeof(int));
|
||||
|
||||
if (!a->hash)
|
||||
{
|
||||
@ -763,7 +768,7 @@ cupsArrayNew3(cups_array_func_t f, /* I - Comparison function or @code NULL@ fo
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
memset(a->hash, -1, hsize * sizeof(int));
|
||||
memset(a->hash, -1, (size_t)hsize * sizeof(int));
|
||||
}
|
||||
|
||||
a->copyfunc = cf;
|
||||
@ -782,7 +787,8 @@ cupsArrayNew3(cups_array_func_t f, /* I - Comparison function or @code NULL@ fo
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Array */
|
||||
_cupsArrayNewStrings(const char *s) /* I - Comma-delimited strings or NULL */
|
||||
_cupsArrayNewStrings(const char *s, /* I - Delimited strings or NULL */
|
||||
char delim) /* I - Delimiter character */
|
||||
{
|
||||
cups_array_t *a; /* Array */
|
||||
|
||||
@ -790,7 +796,7 @@ _cupsArrayNewStrings(const char *s) /* I - Comma-delimited strings or NULL */
|
||||
if ((a = cupsArrayNew3((cups_array_func_t)strcmp, NULL, NULL, 0,
|
||||
(cups_acopy_func_t)_cupsStrAlloc,
|
||||
(cups_afree_func_t)_cupsStrFree)) != NULL)
|
||||
_cupsArrayAddStrings(a, s);
|
||||
_cupsArrayAddStrings(a, s, delim);
|
||||
|
||||
return (a);
|
||||
}
|
||||
@ -805,7 +811,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - Next element or @code NULL@ */
|
||||
@ -838,7 +844,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - Previous element or @code NULL@ */
|
||||
@ -871,16 +877,16 @@ 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/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
cupsArrayRemove(cups_array_t *a, /* I - Array */
|
||||
void *e) /* I - Element */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
current, /* Current element */
|
||||
diff; /* Difference */
|
||||
ssize_t i, /* Looping var */
|
||||
current; /* Current element */
|
||||
int diff; /* Difference */
|
||||
|
||||
|
||||
/*
|
||||
@ -912,7 +918,7 @@ cupsArrayRemove(cups_array_t *a, /* I - Array */
|
||||
|
||||
if (current < a->num_elements)
|
||||
memmove(a->elements + current, a->elements + current + 1,
|
||||
(a->num_elements - current) * sizeof(void *));
|
||||
(size_t)(a->num_elements - current) * sizeof(void *));
|
||||
|
||||
if (current <= a->current)
|
||||
a->current --;
|
||||
@ -936,7 +942,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - New current element */
|
||||
@ -967,7 +973,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 on success, 0 on failure */
|
||||
@ -989,7 +995,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void * /* O - User data */
|
||||
@ -1005,7 +1011,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
static int /* O - 1 on success, 0 on failure */
|
||||
@ -1013,12 +1019,12 @@ cups_array_add(cups_array_t *a, /* I - Array */
|
||||
void *e, /* I - Element to add */
|
||||
int insert) /* I - 1 = insert, 0 = append */
|
||||
{
|
||||
int i, /* Looping var */
|
||||
current, /* Current element */
|
||||
diff; /* Comparison with current element */
|
||||
int i, /* Looping var */
|
||||
current; /* Current element */
|
||||
int diff; /* Comparison with current element */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_array_add(a=%p, e=%p, insert=%d)", a, e, insert));
|
||||
DEBUG_printf(("7cups_array_add(a=%p, e=%p, insert=%d)", (void *)a, e, insert));
|
||||
|
||||
/*
|
||||
* Verify we have room for the new element...
|
||||
@ -1039,7 +1045,7 @@ cups_array_add(cups_array_t *a, /* I - Array */
|
||||
if (a->alloc_elements == 0)
|
||||
{
|
||||
count = 16;
|
||||
temp = malloc(count * sizeof(void *));
|
||||
temp = malloc((size_t)count * sizeof(void *));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1048,10 +1054,10 @@ cups_array_add(cups_array_t *a, /* I - Array */
|
||||
else
|
||||
count = a->alloc_elements + 1024;
|
||||
|
||||
temp = realloc(a->elements, count * sizeof(void *));
|
||||
temp = realloc(a->elements, (size_t)count * sizeof(void *));
|
||||
}
|
||||
|
||||
DEBUG_printf(("9cups_array_add: count=%d", count));
|
||||
DEBUG_printf(("9cups_array_add: count=" CUPS_LLFMT, CUPS_LLCAST count));
|
||||
|
||||
if (!temp)
|
||||
{
|
||||
@ -1141,7 +1147,7 @@ cups_array_add(cups_array_t *a, /* I - Array */
|
||||
*/
|
||||
|
||||
memmove(a->elements + current + 1, a->elements + current,
|
||||
(a->num_elements - current) * sizeof(void *));
|
||||
(size_t)(a->num_elements - current) * sizeof(void *));
|
||||
|
||||
if (a->current >= current)
|
||||
a->current ++;
|
||||
@ -1150,11 +1156,11 @@ cups_array_add(cups_array_t *a, /* I - Array */
|
||||
if (a->saved[i] >= current)
|
||||
a->saved[i] ++;
|
||||
|
||||
DEBUG_printf(("9cups_array_add: insert element at index %d...", current));
|
||||
DEBUG_printf(("9cups_array_add: insert element at index " CUPS_LLFMT, CUPS_LLCAST current));
|
||||
}
|
||||
#ifdef DEBUG
|
||||
else
|
||||
DEBUG_printf(("9cups_array_add: append element at %d...", current));
|
||||
DEBUG_printf(("9cups_array_add: append element at " CUPS_LLFMT, CUPS_LLCAST current));
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (a->copyfunc)
|
||||
@ -1173,8 +1179,7 @@ cups_array_add(cups_array_t *a, /* I - Array */
|
||||
|
||||
#ifdef DEBUG
|
||||
for (current = 0; current < a->num_elements; current ++)
|
||||
DEBUG_printf(("9cups_array_add: a->elements[%d]=%p", current,
|
||||
a->elements[current]));
|
||||
DEBUG_printf(("9cups_array_add: a->elements[" CUPS_LLFMT "]=%p", CUPS_LLCAST current, a->elements[current]));
|
||||
#endif /* DEBUG */
|
||||
|
||||
DEBUG_puts("9cups_array_add: returning 1");
|
||||
@ -1199,8 +1204,7 @@ cups_array_find(cups_array_t *a, /* I - Array */
|
||||
diff; /* Comparison with current element */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_array_find(a=%p, e=%p, prev=%d, rdiff=%p)", a, e, prev,
|
||||
rdiff));
|
||||
DEBUG_printf(("7cups_array_find(a=%p, e=%p, prev=%d, rdiff=%p)", (void *)a, e, prev, (void *)rdiff));
|
||||
|
||||
if (a->compare)
|
||||
{
|
||||
@ -1319,8 +1323,3 @@ cups_array_find(cups_array_t *a, /* I - Array */
|
||||
|
||||
return (current);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: array.c 7616 2008-05-28 00:34:13Z mike $".
|
||||
*/
|
||||
|
||||
24
cups/array.h
24
cups/array.h
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: array.h 7266 2008-01-29 02:15:29Z mike $"
|
||||
* Sorted array definitions for CUPS.
|
||||
*
|
||||
* Sorted array definitions for CUPS.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_ARRAY_H_
|
||||
@ -86,7 +84,3 @@ extern void *cupsArrayUserData(cups_array_t *a) _CUPS_API_1_2;
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_ARRAY_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: array.h 7266 2008-01-29 02:15:29Z mike $".
|
||||
*/
|
||||
|
||||
92
cups/auth.c
92
cups/auth.c
@ -1,32 +1,19 @@
|
||||
/*
|
||||
* "$Id: auth.c 7720 2008-07-11 22:46:21Z mike $"
|
||||
* Authentication functions for CUPS.
|
||||
*
|
||||
* Authentication functions for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2013 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
* This file contains Kerberos support code, copyright 2006 by
|
||||
* Jelmer Vernooij.
|
||||
*
|
||||
* This file contains Kerberos support code, copyright 2006 by
|
||||
* Jelmer Vernooij.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsDoAuthentication() - Authenticate a request.
|
||||
* _cupsSetNegotiateAuthString() - Set the Kerberos authentication string.
|
||||
* cups_gss_acquire() - Kerberos credentials callback.
|
||||
* cups_gss_getname() - Get CUPS service credentials for
|
||||
* authentication.
|
||||
* cups_gss_printf() - Show debug error messages from GSSAPI.
|
||||
* cups_local_auth() - Get the local authorization certificate if
|
||||
* available/applicable.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -112,10 +99,10 @@ static int cups_local_auth(http_t *http);
|
||||
/*
|
||||
* 'cupsDoAuthentication()' - Authenticate a request.
|
||||
*
|
||||
* This function should be called in response to a @code HTTP_UNAUTHORIZED@
|
||||
* This function should be called in response to a @code HTTP_STATUS_UNAUTHORIZED@
|
||||
* status, prior to resubmitting your request.
|
||||
*
|
||||
* @since CUPS 1.1.20/OS X 10.4@
|
||||
* @since CUPS 1.1.20/macOS 10.4@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@ -133,8 +120,7 @@ cupsDoAuthentication(
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")",
|
||||
http, method, resource));
|
||||
DEBUG_printf(("cupsDoAuthentication(http=%p, method=\"%s\", resource=\"%s\")", (void *)http, method, resource));
|
||||
|
||||
if (!http)
|
||||
http = _cupsConnect();
|
||||
@ -164,14 +150,14 @@ cupsDoAuthentication(
|
||||
DEBUG_printf(("2cupsDoAuthentication: authstring=\"%s\"",
|
||||
http->authstring));
|
||||
|
||||
if (http->status == HTTP_UNAUTHORIZED)
|
||||
if (http->status == HTTP_STATUS_UNAUTHORIZED)
|
||||
http->digest_tries ++;
|
||||
|
||||
return (0);
|
||||
}
|
||||
else if (localauth == -1)
|
||||
{
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
return (-1); /* Error or canceled */
|
||||
}
|
||||
}
|
||||
@ -190,11 +176,18 @@ cupsDoAuthentication(
|
||||
* Nope - get a new password from the user...
|
||||
*/
|
||||
|
||||
char default_username[HTTP_MAX_VALUE];
|
||||
/* Default username */
|
||||
|
||||
cg = _cupsGlobals();
|
||||
|
||||
if (!cg->lang_default)
|
||||
cg->lang_default = cupsLangDefault();
|
||||
|
||||
if (httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "username",
|
||||
default_username))
|
||||
cupsSetUser(default_username);
|
||||
|
||||
snprintf(prompt, sizeof(prompt),
|
||||
_cupsLangString(cg->lang_default, _("Password for %s on %s? ")),
|
||||
cupsUser(),
|
||||
@ -205,22 +198,22 @@ cupsDoAuthentication(
|
||||
|
||||
if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
|
||||
{
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(),
|
||||
password);
|
||||
}
|
||||
else if (http->status == HTTP_UNAUTHORIZED)
|
||||
else if (http->status == HTTP_STATUS_UNAUTHORIZED)
|
||||
http->digest_tries ++;
|
||||
|
||||
if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
|
||||
if (http->status == HTTP_STATUS_UNAUTHORIZED && http->digest_tries >= 3)
|
||||
{
|
||||
DEBUG_printf(("1cupsDoAuthentication: Too many authentication tries (%d)",
|
||||
http->digest_tries));
|
||||
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -237,7 +230,7 @@ cupsDoAuthentication(
|
||||
|
||||
if (_cupsSetNegotiateAuthString(http, method, resource))
|
||||
{
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
@ -265,7 +258,6 @@ cupsDoAuthentication(
|
||||
char encode[33], /* MD5 buffer */
|
||||
digest[1024]; /* Digest auth data */
|
||||
|
||||
|
||||
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "realm", realm);
|
||||
httpGetSubField(http, HTTP_FIELD_WWW_AUTHENTICATE, "nonce", nonce);
|
||||
|
||||
@ -280,7 +272,7 @@ cupsDoAuthentication(
|
||||
{
|
||||
DEBUG_printf(("1cupsDoAuthentication: Unknown auth type: \"%s\"",
|
||||
www_auth));
|
||||
http->status = HTTP_AUTHORIZATION_CANCELED;
|
||||
http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
@ -316,7 +308,7 @@ _cupsSetNegotiateAuthString(
|
||||
* to use it...
|
||||
*/
|
||||
|
||||
if (gss_init_sec_context == NULL)
|
||||
if (&gss_init_sec_context == NULL)
|
||||
{
|
||||
DEBUG_puts("1_cupsSetNegotiateAuthString: Weak-linked GSSAPI/Kerberos "
|
||||
"framework is not present");
|
||||
@ -446,21 +438,21 @@ _cupsSetNegotiateAuthString(
|
||||
* arbitrarily large credentials...
|
||||
*/
|
||||
|
||||
int authsize = 10 + /* "Negotiate " */
|
||||
output_token.length * 4 / 3 + 1 + /* Base64 */
|
||||
1; /* nul */
|
||||
int authsize = 10 + /* "Negotiate " */
|
||||
(int)output_token.length * 4 / 3 + 1 + 1;
|
||||
/* Base64 + nul */
|
||||
|
||||
httpSetAuthString(http, NULL, NULL);
|
||||
|
||||
if ((http->authstring = malloc(authsize)) == NULL)
|
||||
if ((http->authstring = malloc((size_t)authsize)) == NULL)
|
||||
{
|
||||
http->authstring = http->_authstring;
|
||||
authsize = sizeof(http->_authstring);
|
||||
}
|
||||
|
||||
strcpy(http->authstring, "Negotiate ");
|
||||
strlcpy(http->authstring, "Negotiate ", (size_t)authsize);
|
||||
httpEncode64_2(http->authstring + 10, authsize - 10, output_token.value,
|
||||
output_token.length);
|
||||
(int)output_token.length);
|
||||
|
||||
gss_release_buffer(&minor_status, &output_token);
|
||||
}
|
||||
@ -673,8 +665,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
# endif /* HAVE_AUTHORIZATION_H */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_local_auth(http=%p) hostaddr=%s, hostname=\"%s\"",
|
||||
http, httpAddrString(http->hostaddr, filename, sizeof(filename)), http->hostname));
|
||||
DEBUG_printf(("7cups_local_auth(http=%p) hostaddr=%s, hostname=\"%s\"", (void *)http, httpAddrString(http->hostaddr, filename, sizeof(filename)), http->hostname));
|
||||
|
||||
/*
|
||||
* See if we are accessing localhost...
|
||||
@ -766,7 +757,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
|
||||
if (
|
||||
# ifdef HAVE_GSSAPI
|
||||
strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9) &&
|
||||
_cups_strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9) &&
|
||||
# endif /* HAVE_GSSAPI */
|
||||
# ifdef HAVE_AUTHORIZATION_H
|
||||
!httpGetSubField2(http, HTTP_FIELD_WWW_AUTHENTICATE, "authkey",
|
||||
@ -813,7 +804,7 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
filename, strerror(errno)));
|
||||
|
||||
# ifdef HAVE_GSSAPI
|
||||
if (!strncmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
|
||||
if (!_cups_strncasecmp(http->fields[HTTP_FIELD_WWW_AUTHENTICATE], "Negotiate", 9))
|
||||
{
|
||||
/*
|
||||
* Kerberos required, don't try the root certificate...
|
||||
@ -878,8 +869,3 @@ cups_local_auth(http_t *http) /* I - HTTP connection to server */
|
||||
return (1);
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: auth.c 7720 2008-07-11 22:46:21Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,24 +1,16 @@
|
||||
/*
|
||||
* "$Id: backchannel.c 7616 2008-05-28 00:34:13Z mike $"
|
||||
* Backchannel functions for CUPS.
|
||||
*
|
||||
* Backchannel functions for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsBackChannelRead() - Read data from the backchannel.
|
||||
* cupsBackChannelWrite() - Write data to the backchannel.
|
||||
* cups_setup() - Setup select()
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -50,7 +42,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Bytes read or -1 on error */
|
||||
@ -101,7 +93,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Bytes written or -1 on error */
|
||||
@ -169,7 +161,7 @@ cupsBackChannelWrite(
|
||||
*/
|
||||
|
||||
buffer += count;
|
||||
total += count;
|
||||
total += (size_t)count;
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,8 +184,3 @@ cups_setup(fd_set *set, /* I - Set for select() */
|
||||
FD_ZERO(set);
|
||||
FD_SET(3, set);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: backchannel.c 7616 2008-05-28 00:34:13Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,24 +1,16 @@
|
||||
/*
|
||||
* "$Id: backend.c 7810 2008-07-29 01:11:15Z mike $"
|
||||
* Backend functions for CUPS.
|
||||
*
|
||||
* Backend functions for CUPS.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 2006 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2006 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsBackendDeviceURI() - Get the device URI for a backend.
|
||||
* cupsBackendReport() - Write a device line from a backend.
|
||||
* quote_string() - Write a quoted string to stdout, escaping \ and ".
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -27,6 +19,7 @@
|
||||
|
||||
#include "cups-private.h"
|
||||
#include "backend.h"
|
||||
#include "ppd.h"
|
||||
|
||||
|
||||
/*
|
||||
@ -44,7 +37,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
const char * /* O - Device URI or @code NULL@ */
|
||||
@ -92,7 +85,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/macOS 10.6@
|
||||
*/
|
||||
|
||||
void
|
||||
@ -147,8 +140,3 @@ quote_string(const char *s) /* I - String to write */
|
||||
|
||||
putchar('\"');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: backend.c 7810 2008-07-29 01:11:15Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: backend.h 7810 2008-07-29 01:11:15Z mike $"
|
||||
* Backend definitions for CUPS.
|
||||
*
|
||||
* Backend definitions for CUPS.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_BACKEND_H_
|
||||
@ -72,7 +70,3 @@ extern void cupsBackendReport(const char *device_scheme,
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_BACKEND_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: backend.h 7810 2008-07-29 01:11:15Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: cups-private.h 9596 2011-03-11 18:26:36Z mike $"
|
||||
* Private definitions for CUPS.
|
||||
*
|
||||
* Private definitions for CUPS.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Copyright 2007-2013 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_CUPS_PRIVATE_H_
|
||||
@ -24,11 +22,11 @@
|
||||
|
||||
# include "string-private.h"
|
||||
# include "debug-private.h"
|
||||
# include "array-private.h"
|
||||
# include "ipp-private.h"
|
||||
# include "http-private.h"
|
||||
# include "language-private.h"
|
||||
# include "pwg-private.h"
|
||||
# include "ppd-private.h"
|
||||
# include "thread-private.h"
|
||||
# include <cups/cups.h>
|
||||
# ifdef __APPLE__
|
||||
@ -86,6 +84,11 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
char resolved_uri[1024];
|
||||
/* Buffer for cupsBackendDeviceURI */
|
||||
|
||||
/* debug.c */
|
||||
# ifdef DEBUG
|
||||
int thread_id; /* Friendly thread ID */
|
||||
# endif /* DEBUG */
|
||||
|
||||
/* file.c */
|
||||
cups_file_t *stdio_files[3];/* stdin, stdout, stderr */
|
||||
|
||||
@ -116,16 +119,11 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
char language[32]; /* Cached language */
|
||||
# endif /* __APPLE__ */
|
||||
|
||||
/* ppd.c */
|
||||
ppd_status_t ppd_status; /* Status of last ppdOpen*() */
|
||||
int ppd_line; /* Current line number */
|
||||
ppd_conform_t ppd_conform; /* Level of conformance required */
|
||||
|
||||
/* pwg-media.c */
|
||||
cups_array_t *leg_size_lut, /* Lookup table for legacy names */
|
||||
*ppd_size_lut, /* Lookup table for PPD names */
|
||||
*pwg_size_lut; /* Lookup table for PWG names */
|
||||
_pwg_media_t pwg_media; /* PWG media data for custom size */
|
||||
pwg_media_t pwg_media; /* PWG media data for custom size */
|
||||
char pwg_name[65]; /* PWG media name for custom size */
|
||||
|
||||
/* request.c */
|
||||
@ -145,6 +143,7 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
/* usersys.c */
|
||||
http_encryption_t encryption; /* Encryption setting */
|
||||
char user[65], /* User name */
|
||||
user_agent[256],/* User-Agent string */
|
||||
server[256], /* Server address */
|
||||
servername[256],/* Server hostname */
|
||||
password[128]; /* Password for default callback */
|
||||
@ -159,15 +158,14 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/
|
||||
void *server_cert_data;
|
||||
/* Server certificate user data */
|
||||
int server_version, /* Server IPP version */
|
||||
any_root, /* Allow any root */
|
||||
trust_first, /* Trust on first use? */
|
||||
any_root, /* Allow any (e.g., self-signed) root */
|
||||
expired_certs, /* Allow expired certs */
|
||||
expired_root; /* Allow expired root */
|
||||
validate_certs; /* Validate certificates */
|
||||
|
||||
/* util.c */
|
||||
char def_printer[256];
|
||||
/* Default printer */
|
||||
char ppd_filename[HTTP_MAX_URI];
|
||||
/* PPD filename */
|
||||
} _cups_globals_t;
|
||||
|
||||
typedef struct _cups_media_db_s /* Media database */
|
||||
@ -200,6 +198,7 @@ typedef struct _cups_dconstres_s /* Constraint/resolver */
|
||||
struct _cups_dinfo_s /* Destination capability and status
|
||||
* information */
|
||||
{
|
||||
int version; /* IPP version */
|
||||
const char *uri; /* Printer URI */
|
||||
char *resource; /* Resource path */
|
||||
ipp_t *attrs; /* Printer attributes */
|
||||
@ -211,6 +210,11 @@ struct _cups_dinfo_s /* Destination capability and status
|
||||
cups_array_t *media_db; /* Media database */
|
||||
_cups_media_db_t min_size, /* Minimum size */
|
||||
max_size; /* Maximum size */
|
||||
unsigned cached_flags; /* Flags used for cached media */
|
||||
cups_array_t *cached_db; /* Cache of media from last index/default */
|
||||
time_t ready_time; /* When xxx-ready attributes were last queried */
|
||||
ipp_t *ready_attrs; /* xxx-ready attributes */
|
||||
cups_array_t *ready_db; /* media[-col]-ready media database */
|
||||
};
|
||||
|
||||
|
||||
@ -231,6 +235,7 @@ extern char *_cupsBufferGet(size_t size);
|
||||
extern void _cupsBufferRelease(char *b);
|
||||
|
||||
extern http_t *_cupsConnect(void);
|
||||
extern char *_cupsCreateDest(const char *name, const char *info, const char *device_id, const char *device_uri, char *uri, size_t urisize);
|
||||
extern int _cupsGet1284Values(const char *device_id,
|
||||
cups_option_t **values);
|
||||
extern const char *_cupsGetDestResource(cups_dest_t *dest, char *resource,
|
||||
@ -266,7 +271,3 @@ extern char *_cupsUserDefault(char *name, size_t namesize);
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_CUPS_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: cups-private.h 9596 2011-03-11 18:26:36Z mike $".
|
||||
*/
|
||||
|
||||
141
cups/cups.h
141
cups/cups.h
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: cups.h 8781 2009-08-28 17:34:54Z mike $"
|
||||
* API definitions for CUPS.
|
||||
*
|
||||
* API definitions for CUPS.
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2013 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_CUPS_H_
|
||||
@ -26,17 +24,14 @@
|
||||
# if defined(WIN32) && !defined(__CUPS_SSIZE_T_DEFINED)
|
||||
# define __CUPS_SSIZE_T_DEFINED
|
||||
# include <stddef.h>
|
||||
/* Windows does not support the ssize_t type, so map it to off_t... */
|
||||
typedef off_t ssize_t; /* @private@ */
|
||||
/* Windows does not support the ssize_t type, so map it to long... */
|
||||
typedef long ssize_t; /* @private@ */
|
||||
# endif /* WIN32 && !__CUPS_SSIZE_T_DEFINED */
|
||||
|
||||
# ifdef __BLOCKS__
|
||||
# include <dispatch/dispatch.h>
|
||||
# endif /* __BLOCKS__ */
|
||||
|
||||
# include "file.h"
|
||||
# include "ipp.h"
|
||||
# include "language.h"
|
||||
# include "pwg.h"
|
||||
|
||||
|
||||
/*
|
||||
@ -52,10 +47,10 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define CUPS_VERSION 1.0603
|
||||
# define CUPS_VERSION_MAJOR 1
|
||||
# define CUPS_VERSION_MINOR 6
|
||||
# define CUPS_VERSION_PATCH 3
|
||||
# define CUPS_VERSION 2.0201
|
||||
# define CUPS_VERSION_MAJOR 2
|
||||
# define CUPS_VERSION_MINOR 2
|
||||
# define CUPS_VERSION_PATCH 1
|
||||
|
||||
# define CUPS_BC_FD 3
|
||||
/* Back-channel file descriptor for
|
||||
@ -230,20 +225,21 @@ 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/macOS 10.5@ */
|
||||
CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared
|
||||
* @since CUPS 1.2/OS X 10.5@ */
|
||||
* @since CUPS 1.2/macOS 10.5@ */
|
||||
CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication
|
||||
* @since CUPS 1.2/OS X 10.5@ */
|
||||
* @since CUPS 1.2/macOS 10.5@ */
|
||||
CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands
|
||||
* @since CUPS 1.2/OS X 10.5@ */
|
||||
* @since CUPS 1.2/macOS 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/macOS 10.6@ */
|
||||
CUPS_PRINTER_MFP = 0x4000000, /* Printer with scanning capabilities
|
||||
* @since CUPS 1.4/OS X 10.6@ */
|
||||
* @since CUPS 1.4/macOS 10.6@ */
|
||||
CUPS_PRINTER_3D = 0x8000000, /* Printer with 3D capabilities @since CUPS 2.1@ */
|
||||
CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT |
|
||||
* DEFAULT | FAX | REJECTING | DELETE |
|
||||
* NOT_SHARED | AUTHENTICATED |
|
||||
@ -267,7 +263,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/macOS 10.8@ */
|
||||
|
||||
typedef struct cups_job_s /**** Job ****/
|
||||
{
|
||||
@ -284,7 +280,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/macOS 10.8@ ****/
|
||||
{
|
||||
char media[128]; /* Media name to use */
|
||||
int width, /* Width in hundredths of millimeters */
|
||||
@ -304,27 +300,19 @@ 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/macOS 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/macOS 10.8@ */
|
||||
|
||||
# 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/macOS 10.8@ */
|
||||
# endif /* __BLOCKS__ */
|
||||
|
||||
typedef void (*cups_device_cb_t)(const char *device_class,
|
||||
const char *device_id, const char *device_info,
|
||||
const char *device_make_and_model,
|
||||
const char *device_uri,
|
||||
const char *device_location, void *user_data);
|
||||
/* Device callback
|
||||
* @since CUPS 1.4/OS X 10.6@ */
|
||||
|
||||
typedef const char *(*cups_password_cb_t)(const char *prompt);
|
||||
/* Password callback */
|
||||
|
||||
@ -333,12 +321,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/macOS 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/macOS 10.7@ */
|
||||
|
||||
|
||||
/*
|
||||
@ -353,12 +341,11 @@ extern ipp_t *cupsDoRequest(http_t *http, ipp_t *request,
|
||||
const char *resource);
|
||||
extern http_encryption_t cupsEncryption(void);
|
||||
extern void cupsFreeJobs(int num_jobs, cups_job_t *jobs);
|
||||
extern int cupsGetClasses(char ***classes) _CUPS_DEPRECATED;
|
||||
extern int cupsGetClasses(char ***classes) _CUPS_DEPRECATED_MSG("Use cupsGetDests instead.");
|
||||
extern const char *cupsGetDefault(void);
|
||||
extern int cupsGetJobs(cups_job_t **jobs, const char *name,
|
||||
int myjobs, int whichjobs);
|
||||
extern const char *cupsGetPPD(const char *name);
|
||||
extern int cupsGetPrinters(char ***printers) _CUPS_DEPRECATED;
|
||||
extern int cupsGetPrinters(char ***printers) _CUPS_DEPRECATED_MSG("Use cupsGetDests instead.");
|
||||
extern ipp_status_t cupsLastError(void);
|
||||
extern int cupsPrintFile(const char *name, const char *filename,
|
||||
const char *title, int num_options,
|
||||
@ -366,7 +353,7 @@ extern int cupsPrintFile(const char *name, const char *filename,
|
||||
extern int cupsPrintFiles(const char *name, int num_files,
|
||||
const char **files, const char *title,
|
||||
int num_options, cups_option_t *options);
|
||||
extern char *cupsTempFile(char *filename, int len) _CUPS_DEPRECATED;
|
||||
extern char *cupsTempFile(char *filename, int len) _CUPS_DEPRECATED_MSG("Use cupsTempFd or cupsTempFile2 instead.");
|
||||
extern int cupsTempFd(char *filename, int len);
|
||||
|
||||
extern int cupsAddDest(const char *name, const char *instance,
|
||||
@ -415,8 +402,6 @@ extern int cupsGetDests2(http_t *http, cups_dest_t **dests)
|
||||
extern int cupsGetJobs2(http_t *http, cups_job_t **jobs,
|
||||
const char *name, int myjobs,
|
||||
int whichjobs) _CUPS_API_1_1_21;
|
||||
extern const char *cupsGetPPD2(http_t *http, const char *name)
|
||||
_CUPS_API_1_1_21;
|
||||
extern int cupsPrintFile2(http_t *http, const char *name,
|
||||
const char *filename,
|
||||
const char *title, int num_options,
|
||||
@ -429,7 +414,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/macOS 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,12 +431,10 @@ 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/macOS 10.5 ****/
|
||||
extern ipp_t *cupsDoIORequest(http_t *http, ipp_t *request,
|
||||
const char *resource, int infile,
|
||||
int outfile) _CUPS_API_1_3;
|
||||
extern char *cupsGetServerPPD(http_t *http, const char *name)
|
||||
_CUPS_API_1_3;
|
||||
extern int cupsRemoveDest(const char *name,
|
||||
const char *instance,
|
||||
int num_dests, cups_dest_t **dests)
|
||||
@ -461,7 +444,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/macOS 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,
|
||||
@ -469,19 +452,11 @@ extern int cupsCreateJob(http_t *http, const char *name,
|
||||
cups_option_t *options) _CUPS_API_1_4;
|
||||
extern ipp_status_t cupsFinishDocument(http_t *http,
|
||||
const char *name) _CUPS_API_1_4;
|
||||
extern ipp_status_t cupsGetDevices(http_t *http, int timeout,
|
||||
const char *include_schemes,
|
||||
const char *exclude_schemes,
|
||||
cups_device_cb_t callback,
|
||||
void *user_data) _CUPS_API_1_4;
|
||||
extern cups_dest_t *cupsGetNamedDest(http_t *http, const char *name,
|
||||
const char *instance) _CUPS_API_1_4;
|
||||
extern const char *cupsGetPassword2(const char *prompt, http_t *http,
|
||||
const char *method,
|
||||
const char *resource) _CUPS_API_1_4;
|
||||
extern http_status_t cupsGetPPD3(http_t *http, const char *name,
|
||||
time_t *modtime, char *buffer,
|
||||
size_t bufsize) _CUPS_API_1_4;
|
||||
extern ipp_t *cupsGetResponse(http_t *http,
|
||||
const char *resource) _CUPS_API_1_4;
|
||||
extern ssize_t cupsReadResponseData(http_t *http, char *buffer,
|
||||
@ -498,14 +473,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/macOS 10.7 ****/
|
||||
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/macOS 10.8 ****/
|
||||
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,
|
||||
@ -590,12 +565,44 @@ extern http_status_t cupsStartDestDocument(http_t *http, cups_dest_t *dest,
|
||||
cups_option_t *options,
|
||||
int last_document) _CUPS_API_1_6;
|
||||
|
||||
/* New in CUPS 1.7 */
|
||||
extern ipp_attribute_t *cupsFindDestDefault(http_t *http, cups_dest_t *dest,
|
||||
cups_dinfo_t *dinfo,
|
||||
const char *option) _CUPS_API_1_7;
|
||||
extern ipp_attribute_t *cupsFindDestReady(http_t *http, cups_dest_t *dest,
|
||||
cups_dinfo_t *dinfo,
|
||||
const char *option) _CUPS_API_1_7;
|
||||
extern ipp_attribute_t *cupsFindDestSupported(http_t *http, cups_dest_t *dest,
|
||||
cups_dinfo_t *dinfo,
|
||||
const char *option)
|
||||
_CUPS_API_1_7;
|
||||
extern int cupsGetDestMediaByIndex(http_t *http, cups_dest_t *dest,
|
||||
cups_dinfo_t *dinfo, int n,
|
||||
unsigned flags,
|
||||
cups_size_t *size)
|
||||
_CUPS_API_1_7;
|
||||
extern int cupsGetDestMediaCount(http_t *http, cups_dest_t *dest,
|
||||
cups_dinfo_t *dinfo,
|
||||
unsigned flags) _CUPS_API_1_7;
|
||||
extern int cupsGetDestMediaDefault(http_t *http, cups_dest_t *dest,
|
||||
cups_dinfo_t *dinfo,
|
||||
unsigned flags,
|
||||
cups_size_t *size)
|
||||
_CUPS_API_1_7;
|
||||
extern void cupsSetUserAgent(const char *user_agent) _CUPS_API_1_7;
|
||||
extern const char *cupsUserAgent(void) _CUPS_API_1_7;
|
||||
|
||||
/* New in CUPS 2.0/macOS 10.10 */
|
||||
extern cups_dest_t *cupsGetDestWithURI(const char *name, const char *uri) _CUPS_API_2_0;
|
||||
extern const char *cupsLocalizeDestMedia(http_t *http, cups_dest_t *dest, cups_dinfo_t *info, unsigned flags, cups_size_t *size) _CUPS_API_2_0;
|
||||
extern int cupsMakeServerCredentials(const char *path, const char *common_name, int num_alt_names, const char **alt_names, time_t expiration_date) _CUPS_API_2_0;
|
||||
extern int cupsSetServerCredentials(const char *path, const char *common_name, int auto_create) _CUPS_API_2_0;
|
||||
|
||||
/* New in CUPS 2.2/macOS 10.12 */
|
||||
extern ssize_t cupsHashData(const char *algorithm, const void *data, size_t datalen, unsigned char *hash, size_t hashsize) _CUPS_API_2_2;
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_CUPS_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: cups.h 8781 2009-08-28 17:34:54Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
* Private debugging macros for CUPS.
|
||||
*
|
||||
* Private debugging macros for CUPS.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_DEBUG_PRIVATE_H_
|
||||
@ -111,7 +109,3 @@ extern int _cups_gettimeofday(struct timeval *tv, void *tz);
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_DEBUG_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
606
cups/debug.c
606
cups/debug.c
@ -1,24 +1,15 @@
|
||||
/*
|
||||
* "$Id: debug.c 3643 2012-02-13 16:35:48Z msweet $"
|
||||
* Debugging functions for CUPS.
|
||||
*
|
||||
* Debugging functions for CUPS.
|
||||
* Copyright 2008-2015 by Apple Inc.
|
||||
*
|
||||
* Copyright 2008-2012 by Apple Inc.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* debug_vsnprintf() - Format a string into a fixed size buffer.
|
||||
* _cups_debug_printf() - Write a formatted line to the log.
|
||||
* _cups_debug_puts() - Write a single line to the log.
|
||||
* _cups_debug_set() - Enable or disable debug logging.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -68,19 +59,279 @@ int _cups_debug_level = 1;
|
||||
static regex_t *debug_filter = NULL;
|
||||
/* Filter expression for messages */
|
||||
static int debug_init = 0; /* Did we initialize debugging? */
|
||||
static _cups_mutex_t debug_mutex = _CUPS_MUTEX_INITIALIZER;
|
||||
static _cups_mutex_t debug_init_mutex = _CUPS_MUTEX_INITIALIZER,
|
||||
/* Mutex to control initialization */
|
||||
debug_log_mutex = _CUPS_MUTEX_INITIALIZER;
|
||||
/* Mutex to serialize log entries */
|
||||
|
||||
|
||||
/*
|
||||
* 'debug_vsnprintf()' - Format a string into a fixed size buffer.
|
||||
* 'debug_thread_id()' - Return an integer representing the current thread.
|
||||
*/
|
||||
|
||||
static int /* O - Number of bytes formatted */
|
||||
debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
size_t bufsize, /* O - Size of output buffer */
|
||||
const char *format, /* I - printf-style format string */
|
||||
va_list ap) /* I - Pointer to additional arguments */
|
||||
static int /* O - Local thread ID */
|
||||
debug_thread_id(void)
|
||||
{
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Global data */
|
||||
|
||||
|
||||
return (cg->thread_id);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_printf()' - Write a formatted line to the log.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
...) /* I - Additional arguments as needed */
|
||||
{
|
||||
va_list ap; /* Pointer to arguments */
|
||||
struct timeval curtime; /* Current time */
|
||||
char buffer[2048]; /* Output buffer */
|
||||
ssize_t bytes; /* Number of bytes in buffer */
|
||||
int level; /* Log level in message */
|
||||
|
||||
|
||||
/*
|
||||
* See if we need to do any logging...
|
||||
*/
|
||||
|
||||
if (!debug_init)
|
||||
_cups_debug_set(getenv("CUPS_DEBUG_LOG"), getenv("CUPS_DEBUG_LEVEL"),
|
||||
getenv("CUPS_DEBUG_FILTER"), 0);
|
||||
|
||||
if (_cups_debug_fd < 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Filter as needed...
|
||||
*/
|
||||
|
||||
if (isdigit(format[0]))
|
||||
level = *format++ - '0';
|
||||
else
|
||||
level = 0;
|
||||
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
|
||||
_cupsMutexLock(&debug_init_mutex);
|
||||
result = regexec(debug_filter, format, 0, NULL, 0);
|
||||
_cupsMutexUnlock(&debug_init_mutex);
|
||||
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
*/
|
||||
|
||||
gettimeofday(&curtime, NULL);
|
||||
snprintf(buffer, sizeof(buffer), "T%03d %02d:%02d:%02d.%03d ",
|
||||
debug_thread_id(), (int)((curtime.tv_sec / 3600) % 24),
|
||||
(int)((curtime.tv_sec / 60) % 60),
|
||||
(int)(curtime.tv_sec % 60), (int)(curtime.tv_usec / 1000));
|
||||
|
||||
va_start(ap, format);
|
||||
bytes = _cups_safe_vsnprintf(buffer + 19, sizeof(buffer) - 20, format, ap) + 19;
|
||||
va_end(ap);
|
||||
|
||||
if ((size_t)bytes >= (sizeof(buffer) - 1))
|
||||
{
|
||||
buffer[sizeof(buffer) - 2] = '\n';
|
||||
bytes = sizeof(buffer) - 1;
|
||||
}
|
||||
else if (buffer[bytes - 1] != '\n')
|
||||
{
|
||||
buffer[bytes++] = '\n';
|
||||
buffer[bytes] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Write it out...
|
||||
*/
|
||||
|
||||
_cupsMutexLock(&debug_log_mutex);
|
||||
write(_cups_debug_fd, buffer, (size_t)bytes);
|
||||
_cupsMutexUnlock(&debug_log_mutex);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_puts()' - Write a single line to the log.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_puts(const char *s) /* I - String to output */
|
||||
{
|
||||
struct timeval curtime; /* Current time */
|
||||
char buffer[2048]; /* Output buffer */
|
||||
ssize_t bytes; /* Number of bytes in buffer */
|
||||
int level; /* Log level in message */
|
||||
|
||||
|
||||
/*
|
||||
* See if we need to do any logging...
|
||||
*/
|
||||
|
||||
if (!debug_init)
|
||||
_cups_debug_set(getenv("CUPS_DEBUG_LOG"), getenv("CUPS_DEBUG_LEVEL"),
|
||||
getenv("CUPS_DEBUG_FILTER"), 0);
|
||||
|
||||
if (_cups_debug_fd < 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Filter as needed...
|
||||
*/
|
||||
|
||||
if (isdigit(s[0]))
|
||||
level = *s++ - '0';
|
||||
else
|
||||
level = 0;
|
||||
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
|
||||
_cupsMutexLock(&debug_init_mutex);
|
||||
result = regexec(debug_filter, s, 0, NULL, 0);
|
||||
_cupsMutexUnlock(&debug_init_mutex);
|
||||
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
*/
|
||||
|
||||
gettimeofday(&curtime, NULL);
|
||||
bytes = snprintf(buffer, sizeof(buffer), "T%03d %02d:%02d:%02d.%03d %s",
|
||||
debug_thread_id(), (int)((curtime.tv_sec / 3600) % 24),
|
||||
(int)((curtime.tv_sec / 60) % 60),
|
||||
(int)(curtime.tv_sec % 60), (int)(curtime.tv_usec / 1000),
|
||||
s);
|
||||
|
||||
if ((size_t)bytes >= (sizeof(buffer) - 1))
|
||||
{
|
||||
buffer[sizeof(buffer) - 2] = '\n';
|
||||
bytes = sizeof(buffer) - 1;
|
||||
}
|
||||
else if (buffer[bytes - 1] != '\n')
|
||||
{
|
||||
buffer[bytes++] = '\n';
|
||||
buffer[bytes] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Write it out...
|
||||
*/
|
||||
|
||||
_cupsMutexLock(&debug_log_mutex);
|
||||
write(_cups_debug_fd, buffer, (size_t)bytes);
|
||||
_cupsMutexUnlock(&debug_log_mutex);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_set()' - Enable or disable debug logging.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_set(const char *logfile, /* I - Log file or NULL */
|
||||
const char *level, /* I - Log level or NULL */
|
||||
const char *filter, /* I - Filter string or NULL */
|
||||
int force) /* I - Force initialization */
|
||||
{
|
||||
_cupsMutexLock(&debug_init_mutex);
|
||||
|
||||
if (!debug_init || force)
|
||||
{
|
||||
/*
|
||||
* Restore debug settings to defaults...
|
||||
*/
|
||||
|
||||
if (_cups_debug_fd != -1)
|
||||
{
|
||||
close(_cups_debug_fd);
|
||||
_cups_debug_fd = -1;
|
||||
}
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
regfree((regex_t *)debug_filter);
|
||||
debug_filter = NULL;
|
||||
}
|
||||
|
||||
_cups_debug_level = 1;
|
||||
|
||||
/*
|
||||
* Open logs, set log levels, etc.
|
||||
*/
|
||||
|
||||
if (!logfile)
|
||||
_cups_debug_fd = -1;
|
||||
else if (!strcmp(logfile, "-"))
|
||||
_cups_debug_fd = 2;
|
||||
else
|
||||
{
|
||||
char buffer[1024]; /* Filename buffer */
|
||||
|
||||
snprintf(buffer, sizeof(buffer), logfile, getpid());
|
||||
|
||||
if (buffer[0] == '+')
|
||||
_cups_debug_fd = open(buffer + 1, O_WRONLY | O_APPEND | O_CREAT, 0644);
|
||||
else
|
||||
_cups_debug_fd = open(buffer, O_WRONLY | O_TRUNC | O_CREAT, 0644);
|
||||
}
|
||||
|
||||
if (level)
|
||||
_cups_debug_level = atoi(level);
|
||||
|
||||
if (filter)
|
||||
{
|
||||
if ((debug_filter = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
|
||||
fputs("Unable to allocate memory for CUPS_DEBUG_FILTER - results not "
|
||||
"filtered!\n", stderr);
|
||||
else if (regcomp(debug_filter, filter, REG_EXTENDED))
|
||||
{
|
||||
fputs("Bad regular expression in CUPS_DEBUG_FILTER - results not "
|
||||
"filtered!\n", stderr);
|
||||
free(debug_filter);
|
||||
debug_filter = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
debug_init = 1;
|
||||
}
|
||||
|
||||
_cupsMutexUnlock(&debug_init_mutex);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_safe_vsnprintf()' - Format a string into a fixed size buffer,
|
||||
* quoting special characters.
|
||||
*/
|
||||
|
||||
ssize_t /* O - Number of bytes formatted */
|
||||
_cups_safe_vsnprintf(
|
||||
char *buffer, /* O - Output buffer */
|
||||
size_t bufsize, /* O - Size of output buffer */
|
||||
const char *format, /* I - printf-style format string */
|
||||
va_list ap) /* I - Pointer to additional arguments */
|
||||
{
|
||||
char *bufptr, /* Pointer to position in buffer */
|
||||
*bufend, /* Pointer to end of buffer */
|
||||
@ -88,11 +339,11 @@ debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
type; /* Format type character */
|
||||
int width, /* Width of field */
|
||||
prec; /* Number of characters of precision */
|
||||
char tformat[100], /* Temporary format string for sprintf() */
|
||||
char tformat[100], /* Temporary format string for snprintf() */
|
||||
*tptr, /* Pointer into temporary format */
|
||||
temp[1024]; /* Buffer for formatted numbers */
|
||||
char *s; /* Pointer to string */
|
||||
int bytes; /* Total number of bytes needed */
|
||||
ssize_t bytes; /* Total number of bytes needed */
|
||||
|
||||
|
||||
if (!buffer || bufsize < 2 || !format)
|
||||
@ -133,7 +384,7 @@ debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
format ++;
|
||||
width = va_arg(ap, int);
|
||||
|
||||
snprintf(tptr, sizeof(tformat) - (tptr - tformat), "%d", width);
|
||||
snprintf(tptr, sizeof(tformat) - (size_t)(tptr - tformat), "%d", width);
|
||||
tptr += strlen(tptr);
|
||||
}
|
||||
else
|
||||
@ -165,7 +416,7 @@ debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
format ++;
|
||||
prec = va_arg(ap, int);
|
||||
|
||||
snprintf(tptr, sizeof(tformat) - (tptr - tformat), "%d", prec);
|
||||
snprintf(tptr, sizeof(tformat) - (size_t)(tptr - tformat), "%d", prec);
|
||||
tptr += strlen(tptr);
|
||||
}
|
||||
else
|
||||
@ -220,25 +471,17 @@ debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
case 'e' :
|
||||
case 'f' :
|
||||
case 'g' :
|
||||
if ((width + 2) > sizeof(temp))
|
||||
if ((size_t)(width + 2) > sizeof(temp))
|
||||
break;
|
||||
|
||||
sprintf(temp, tformat, va_arg(ap, double));
|
||||
snprintf(temp, sizeof(temp), tformat, va_arg(ap, double));
|
||||
|
||||
bytes += (int)strlen(temp);
|
||||
|
||||
if (bufptr)
|
||||
{
|
||||
if ((bufptr + strlen(temp)) > bufend)
|
||||
{
|
||||
strncpy(bufptr, temp, (size_t)(bufend - bufptr));
|
||||
bufptr = bufend;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(bufptr, temp);
|
||||
bufptr += strlen(temp);
|
||||
}
|
||||
strlcpy(bufptr, temp, (size_t)(bufend - bufptr));
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -250,56 +493,40 @@ debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
case 'o' :
|
||||
case 'u' :
|
||||
case 'x' :
|
||||
if ((width + 2) > sizeof(temp))
|
||||
if ((size_t)(width + 2) > sizeof(temp))
|
||||
break;
|
||||
|
||||
# ifdef HAVE_LONG_LONG
|
||||
if (size == 'L')
|
||||
sprintf(temp, tformat, va_arg(ap, long long));
|
||||
snprintf(temp, sizeof(temp), tformat, va_arg(ap, long long));
|
||||
else
|
||||
# endif /* HAVE_LONG_LONG */
|
||||
if (size == 'l')
|
||||
sprintf(temp, tformat, va_arg(ap, long));
|
||||
snprintf(temp, sizeof(temp), tformat, va_arg(ap, long));
|
||||
else
|
||||
sprintf(temp, tformat, va_arg(ap, int));
|
||||
snprintf(temp, sizeof(temp), tformat, va_arg(ap, int));
|
||||
|
||||
bytes += (int)strlen(temp);
|
||||
|
||||
if (bufptr)
|
||||
{
|
||||
if ((bufptr + strlen(temp)) > bufend)
|
||||
{
|
||||
strncpy(bufptr, temp, (size_t)(bufend - bufptr));
|
||||
bufptr = bufend;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(bufptr, temp);
|
||||
bufptr += strlen(temp);
|
||||
}
|
||||
strlcpy(bufptr, temp, (size_t)(bufend - bufptr));
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'p' : /* Pointer value */
|
||||
if ((width + 2) > sizeof(temp))
|
||||
if ((size_t)(width + 2) > sizeof(temp))
|
||||
break;
|
||||
|
||||
sprintf(temp, tformat, va_arg(ap, void *));
|
||||
snprintf(temp, sizeof(temp), tformat, va_arg(ap, void *));
|
||||
|
||||
bytes += (int)strlen(temp);
|
||||
|
||||
if (bufptr)
|
||||
{
|
||||
if ((bufptr + strlen(temp)) > bufend)
|
||||
{
|
||||
strncpy(bufptr, temp, (size_t)(bufend - bufptr));
|
||||
bufptr = bufend;
|
||||
}
|
||||
else
|
||||
{
|
||||
strcpy(bufptr, temp);
|
||||
bufptr += strlen(temp);
|
||||
}
|
||||
strlcpy(bufptr, temp, (size_t)(bufend - bufptr));
|
||||
bufptr += strlen(bufptr);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -309,7 +536,7 @@ debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
if (bufptr)
|
||||
{
|
||||
if (width <= 1)
|
||||
*bufptr++ = va_arg(ap, int);
|
||||
*bufptr++ = (char)va_arg(ap, int);
|
||||
else
|
||||
{
|
||||
if ((bufptr + width) > bufend)
|
||||
@ -390,7 +617,7 @@ debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
break;
|
||||
|
||||
case 'n' : /* Output number of chars so far */
|
||||
*(va_arg(ap, int *)) = bytes;
|
||||
*(va_arg(ap, int *)) = (int)bytes;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -413,246 +640,3 @@ debug_vsnprintf(char *buffer, /* O - Output buffer */
|
||||
|
||||
return (bytes);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_printf()' - Write a formatted line to the log.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_printf(const char *format, /* I - Printf-style format string */
|
||||
...) /* I - Additional arguments as needed */
|
||||
{
|
||||
va_list ap; /* Pointer to arguments */
|
||||
struct timeval curtime; /* Current time */
|
||||
char buffer[2048]; /* Output buffer */
|
||||
size_t bytes; /* Number of bytes in buffer */
|
||||
int level; /* Log level in message */
|
||||
|
||||
|
||||
/*
|
||||
* See if we need to do any logging...
|
||||
*/
|
||||
|
||||
if (!debug_init)
|
||||
_cups_debug_set(getenv("CUPS_DEBUG_LOG"), getenv("CUPS_DEBUG_LEVEL"),
|
||||
getenv("CUPS_DEBUG_FILTER"), 0);
|
||||
|
||||
if (_cups_debug_fd < 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Filter as needed...
|
||||
*/
|
||||
|
||||
if (isdigit(format[0]))
|
||||
level = *format++ - '0';
|
||||
else
|
||||
level = 0;
|
||||
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
|
||||
_cupsMutexLock(&debug_mutex);
|
||||
result = regexec(debug_filter, format, 0, NULL, 0);
|
||||
_cupsMutexUnlock(&debug_mutex);
|
||||
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
*/
|
||||
|
||||
gettimeofday(&curtime, NULL);
|
||||
snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d.%03d ",
|
||||
(int)((curtime.tv_sec / 3600) % 24),
|
||||
(int)((curtime.tv_sec / 60) % 60),
|
||||
(int)(curtime.tv_sec % 60), (int)(curtime.tv_usec / 1000));
|
||||
|
||||
va_start(ap, format);
|
||||
bytes = debug_vsnprintf(buffer + 13, sizeof(buffer) - 14, format, ap) + 13;
|
||||
va_end(ap);
|
||||
|
||||
if (bytes >= (sizeof(buffer) - 1))
|
||||
{
|
||||
buffer[sizeof(buffer) - 2] = '\n';
|
||||
bytes = sizeof(buffer) - 1;
|
||||
}
|
||||
else if (buffer[bytes - 1] != '\n')
|
||||
{
|
||||
buffer[bytes++] = '\n';
|
||||
buffer[bytes] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Write it out...
|
||||
*/
|
||||
|
||||
write(_cups_debug_fd, buffer, bytes);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_puts()' - Write a single line to the log.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_puts(const char *s) /* I - String to output */
|
||||
{
|
||||
struct timeval curtime; /* Current time */
|
||||
char buffer[2048]; /* Output buffer */
|
||||
size_t bytes; /* Number of bytes in buffer */
|
||||
int level; /* Log level in message */
|
||||
|
||||
|
||||
/*
|
||||
* See if we need to do any logging...
|
||||
*/
|
||||
|
||||
if (!debug_init)
|
||||
_cups_debug_set(getenv("CUPS_DEBUG_LOG"), getenv("CUPS_DEBUG_LEVEL"),
|
||||
getenv("CUPS_DEBUG_FILTER"), 0);
|
||||
|
||||
if (_cups_debug_fd < 0)
|
||||
return;
|
||||
|
||||
/*
|
||||
* Filter as needed...
|
||||
*/
|
||||
|
||||
if (isdigit(s[0]))
|
||||
level = *s++ - '0';
|
||||
else
|
||||
level = 0;
|
||||
|
||||
if (level > _cups_debug_level)
|
||||
return;
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
int result; /* Filter result */
|
||||
|
||||
_cupsMutexLock(&debug_mutex);
|
||||
result = regexec(debug_filter, s, 0, NULL, 0);
|
||||
_cupsMutexUnlock(&debug_mutex);
|
||||
|
||||
if (result)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Format the message...
|
||||
*/
|
||||
|
||||
gettimeofday(&curtime, NULL);
|
||||
bytes = snprintf(buffer, sizeof(buffer), "%02d:%02d:%02d.%03d %s",
|
||||
(int)((curtime.tv_sec / 3600) % 24),
|
||||
(int)((curtime.tv_sec / 60) % 60),
|
||||
(int)(curtime.tv_sec % 60), (int)(curtime.tv_usec / 1000),
|
||||
s);
|
||||
|
||||
if (bytes >= (sizeof(buffer) - 1))
|
||||
{
|
||||
buffer[sizeof(buffer) - 2] = '\n';
|
||||
bytes = sizeof(buffer) - 1;
|
||||
}
|
||||
else if (buffer[bytes - 1] != '\n')
|
||||
{
|
||||
buffer[bytes++] = '\n';
|
||||
buffer[bytes] = '\0';
|
||||
}
|
||||
|
||||
/*
|
||||
* Write it out...
|
||||
*/
|
||||
|
||||
write(_cups_debug_fd, buffer, bytes);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_cups_debug_set()' - Enable or disable debug logging.
|
||||
*/
|
||||
|
||||
void DLLExport
|
||||
_cups_debug_set(const char *logfile, /* I - Log file or NULL */
|
||||
const char *level, /* I - Log level or NULL */
|
||||
const char *filter, /* I - Filter string or NULL */
|
||||
int force) /* I - Force initialization */
|
||||
{
|
||||
_cupsMutexLock(&debug_mutex);
|
||||
|
||||
if (!debug_init || force)
|
||||
{
|
||||
/*
|
||||
* Restore debug settings to defaults...
|
||||
*/
|
||||
|
||||
if (_cups_debug_fd != -1)
|
||||
{
|
||||
close(_cups_debug_fd);
|
||||
_cups_debug_fd = -1;
|
||||
}
|
||||
|
||||
if (debug_filter)
|
||||
{
|
||||
regfree((regex_t *)debug_filter);
|
||||
debug_filter = NULL;
|
||||
}
|
||||
|
||||
_cups_debug_level = 1;
|
||||
|
||||
/*
|
||||
* Open logs, set log levels, etc.
|
||||
*/
|
||||
|
||||
if (!logfile)
|
||||
_cups_debug_fd = -1;
|
||||
else if (!strcmp(logfile, "-"))
|
||||
_cups_debug_fd = 2;
|
||||
else
|
||||
{
|
||||
char buffer[1024]; /* Filename buffer */
|
||||
|
||||
snprintf(buffer, sizeof(buffer), logfile, getpid());
|
||||
|
||||
if (buffer[0] == '+')
|
||||
_cups_debug_fd = open(buffer + 1, O_WRONLY | O_APPEND | O_CREAT, 0644);
|
||||
else
|
||||
_cups_debug_fd = open(buffer, O_WRONLY | O_TRUNC | O_CREAT, 0644);
|
||||
}
|
||||
|
||||
if (level)
|
||||
_cups_debug_level = atoi(level);
|
||||
|
||||
if (filter)
|
||||
{
|
||||
if ((debug_filter = (regex_t *)calloc(1, sizeof(regex_t))) == NULL)
|
||||
fputs("Unable to allocate memory for CUPS_DEBUG_FILTER - results not "
|
||||
"filtered!\n", stderr);
|
||||
else if (regcomp(debug_filter, filter, REG_EXTENDED))
|
||||
{
|
||||
fputs("Bad regular expression in CUPS_DEBUG_FILTER - results not "
|
||||
"filtered!\n", stderr);
|
||||
free(debug_filter);
|
||||
debug_filter = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
debug_init = 1;
|
||||
}
|
||||
|
||||
_cupsMutexUnlock(&debug_mutex);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: debug.c 3643 2012-02-13 16:35:48Z msweet $".
|
||||
*/
|
||||
|
||||
143
cups/dest-job.c
143
cups/dest-job.c
@ -1,25 +1,15 @@
|
||||
/*
|
||||
* "$Id: dest-job.c 3833 2012-05-23 22:51:18Z msweet $"
|
||||
* Destination job support for CUPS.
|
||||
*
|
||||
* Destination job support for CUPS.
|
||||
* Copyright 2012-2016 by Apple Inc.
|
||||
*
|
||||
* Copyright 2012 by Apple Inc.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsCancelDestJob() - Cancel a job on a destination.
|
||||
* cupsCloseDestJob() - Close a job and start printing.
|
||||
* cupsCreateDestJob() - Create a job on a destination.
|
||||
* cupsFinishDestDocument() - Finish the current document.
|
||||
* cupsStartDestDocument() - Start a new document.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -34,10 +24,11 @@
|
||||
*
|
||||
* The "job_id" is the number returned by cupsCreateDestJob.
|
||||
*
|
||||
* Returns IPP_OK on success and IPP_NOT_AUTHORIZED or IPP_FORBIDDEN on
|
||||
* failure.
|
||||
* Returns @code IPP_STATUS_OK@ on success and
|
||||
* @code IPP_STATUS_ERRPR_NOT_AUTHORIZED@ or
|
||||
* @code IPP_STATUS_ERROR_FORBIDDEN@ on failure.
|
||||
*
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
* @since CUPS 1.6/macOS 10.8@
|
||||
*/
|
||||
|
||||
ipp_status_t
|
||||
@ -45,7 +36,26 @@ cupsCancelDestJob(http_t *http, /* I - Connection to destination */
|
||||
cups_dest_t *dest, /* I - Destination */
|
||||
int job_id) /* I - Job ID */
|
||||
{
|
||||
return (IPP_NOT_FOUND);
|
||||
cups_dinfo_t *info; /* Destination information */
|
||||
|
||||
|
||||
if ((info = cupsCopyDestInfo(http, dest)) != NULL)
|
||||
{
|
||||
ipp_t *request; /* Cancel-Job request */
|
||||
|
||||
request = ippNewRequest(IPP_OP_CANCEL_JOB);
|
||||
|
||||
ippSetVersion(request, info->version / 10, info->version % 10);
|
||||
|
||||
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());
|
||||
|
||||
ippDelete(cupsDoRequest(http, request, info->resource));
|
||||
cupsFreeDestInfo(info);
|
||||
}
|
||||
|
||||
return (cupsLastError());
|
||||
}
|
||||
|
||||
|
||||
@ -53,10 +63,10 @@ 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@
|
||||
* "job_id" is the job ID returned by cupsCreateDestJob. Returns @code IPP_STATUS_OK@
|
||||
* on success.
|
||||
*
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
* @since CUPS 1.6/macOS 10.8@
|
||||
*/
|
||||
|
||||
ipp_status_t /* O - IPP status code */
|
||||
@ -71,9 +81,7 @@ cupsCloseDestJob(
|
||||
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));
|
||||
DEBUG_printf(("cupsCloseDestJob(http=%p, dest=%p(%s/%s), info=%p, job_id=%d)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info, job_id));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -81,9 +89,9 @@ cupsCloseDestJob(
|
||||
|
||||
if (!http || !dest || !info || job_id <= 0)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
DEBUG_puts("1cupsCloseDestJob: Bad arguments.");
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
return (IPP_STATUS_ERROR_INTERNAL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -94,31 +102,33 @@ cupsCloseDestJob(
|
||||
IPP_TAG_ENUM)) != NULL)
|
||||
{
|
||||
for (i = 0; i < attr->num_values; i ++)
|
||||
if (attr->values[i].integer == IPP_CLOSE_JOB)
|
||||
if (attr->values[i].integer == IPP_OP_CLOSE_JOB)
|
||||
{
|
||||
request = ippNewRequest(IPP_CLOSE_JOB);
|
||||
request = ippNewRequest(IPP_OP_CLOSE_JOB);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!request)
|
||||
request = ippNewRequest(IPP_SEND_DOCUMENT);
|
||||
request = ippNewRequest(IPP_OP_SEND_DOCUMENT);
|
||||
|
||||
if (!request)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOMEM), 0);
|
||||
DEBUG_puts("1cupsCloseDestJob: Unable to create Close-Job/Send-Document "
|
||||
"request.");
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
return (IPP_STATUS_ERROR_INTERNAL);
|
||||
}
|
||||
|
||||
ippSetVersion(request, info->version / 10, info->version % 10);
|
||||
|
||||
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)
|
||||
if (ippGetOperation(request) == IPP_OP_SEND_DOCUMENT)
|
||||
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);
|
||||
|
||||
/*
|
||||
@ -137,10 +147,10 @@ cupsCloseDestJob(
|
||||
/*
|
||||
* 'cupsCreateDestJob()' - Create a job on a destination.
|
||||
*
|
||||
* Returns @code IPP_OK@ or @code IPP_OK_SUBST@ on success, saving the job ID
|
||||
* Returns @code IPP_STATUS_OK@ or @code IPP_STATUS_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/macOS 10.8@
|
||||
*/
|
||||
|
||||
ipp_status_t /* O - IPP status code */
|
||||
@ -159,10 +169,7 @@ cupsCreateDestJob(
|
||||
|
||||
|
||||
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));
|
||||
"job_id=%p, title=\"%s\", num_options=%d, options=%p)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info, (void *)job_id, title, num_options, (void *)options));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -173,22 +180,24 @@ cupsCreateDestJob(
|
||||
|
||||
if (!http || !dest || !info || !job_id)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
DEBUG_puts("1cupsCreateDestJob: Bad arguments.");
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
return (IPP_STATUS_ERROR_INTERNAL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Build a Create-Job request...
|
||||
*/
|
||||
|
||||
if ((request = ippNewRequest(IPP_CREATE_JOB)) == NULL)
|
||||
if ((request = ippNewRequest(IPP_OP_CREATE_JOB)) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOMEM), 0);
|
||||
DEBUG_puts("1cupsCreateDestJob: Unable to create Create-Job request.");
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
return (IPP_STATUS_ERROR_INTERNAL);
|
||||
}
|
||||
|
||||
ippSetVersion(request, info->version / 10, info->version % 10);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
|
||||
NULL, info->uri);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
@ -197,6 +206,7 @@ cupsCreateDestJob(
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
|
||||
title);
|
||||
|
||||
cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);
|
||||
cupsEncodeOptions2(request, num_options, options, IPP_TAG_JOB);
|
||||
cupsEncodeOptions2(request, num_options, options, IPP_TAG_SUBSCRIPTION);
|
||||
|
||||
@ -228,9 +238,9 @@ cupsCreateDestJob(
|
||||
/*
|
||||
* 'cupsFinishDestDocument()' - Finish the current document.
|
||||
*
|
||||
* Returns @code IPP_OK@ or @code IPP_OK_SUBST@ on success.
|
||||
* Returns @code IPP_STATUS_OK@ or @code IPP_STATUS_OK_SUBST@ on success.
|
||||
*
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
* @since CUPS 1.6/macOS 10.8@
|
||||
*/
|
||||
|
||||
ipp_status_t /* O - Status of document submission */
|
||||
@ -239,9 +249,7 @@ cupsFinishDestDocument(
|
||||
cups_dest_t *dest, /* I - Destination */
|
||||
cups_dinfo_t *info) /* I - Destination information */
|
||||
{
|
||||
DEBUG_printf(("cupsFinishDestDocument(http=%p, dest=%p(%s/%s), info=%p)",
|
||||
http, dest, dest ? dest->name : NULL,
|
||||
dest ? dest->instance : NULL, info));
|
||||
DEBUG_printf(("cupsFinishDestDocument(http=%p, dest=%p(%s/%s), info=%p)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -249,9 +257,9 @@ cupsFinishDestDocument(
|
||||
|
||||
if (!http || !dest || !info)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
DEBUG_puts("1cupsFinishDestDocument: Bad arguments.");
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
return (IPP_STATUS_ERROR_INTERNAL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -277,7 +285,7 @@ cupsFinishDestDocument(
|
||||
* if this is the last document to be submitted in the job. Returns
|
||||
* @code HTTP_CONTINUE@ on success.
|
||||
*
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
* @since CUPS 1.6/macOS 10.8@
|
||||
*/
|
||||
|
||||
http_status_t /* O - Status of document creation */
|
||||
@ -296,12 +304,7 @@ cupsStartDestDocument(
|
||||
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));
|
||||
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)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info, job_id, docname, format, num_options, (void *)options, last_document));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -309,23 +312,25 @@ cupsStartDestDocument(
|
||||
|
||||
if (!http || !dest || !info || job_id <= 0)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
DEBUG_puts("1cupsStartDestDocument: Bad arguments.");
|
||||
return (HTTP_ERROR);
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a Send-Document request...
|
||||
*/
|
||||
|
||||
if ((request = ippNewRequest(IPP_SEND_DOCUMENT)) == NULL)
|
||||
if ((request = ippNewRequest(IPP_OP_SEND_DOCUMENT)) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOMEM), 0);
|
||||
DEBUG_puts("1cupsStartDestDocument: Unable to create Send-Document "
|
||||
"request.");
|
||||
return (HTTP_ERROR);
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
ippSetVersion(request, info->version / 10, info->version % 10);
|
||||
|
||||
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);
|
||||
@ -337,8 +342,9 @@ cupsStartDestDocument(
|
||||
if (format)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE,
|
||||
"document-format", NULL, format);
|
||||
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", last_document);
|
||||
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", (char)last_document);
|
||||
|
||||
cupsEncodeOptions2(request, num_options, options, IPP_TAG_OPERATION);
|
||||
cupsEncodeOptions2(request, num_options, options, IPP_TAG_DOCUMENT);
|
||||
|
||||
/*
|
||||
@ -351,8 +357,3 @@ cupsStartDestDocument(
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: dest-job.c 3833 2012-05-23 22:51:18Z msweet $".
|
||||
*/
|
||||
|
||||
@ -1,28 +1,15 @@
|
||||
/*
|
||||
* "$Id: dest-localization.c 3833 2012-05-23 22:51:18Z msweet $"
|
||||
* Destination localization support for CUPS.
|
||||
*
|
||||
* Destination localization support for CUPS.
|
||||
* Copyright 2012-2014 by Apple Inc.
|
||||
*
|
||||
* Copyright 2012 by Apple Inc.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* 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.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -42,6 +29,170 @@ static int cups_read_strings(cups_file_t *fp, char *buffer, size_t bufsize,
|
||||
static char *cups_scan_strings(char *buffer);
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsLocalizeDestMedia()' - Get the localized string for a destination media
|
||||
* size.
|
||||
*
|
||||
* The returned string is stored in the destination information and will become
|
||||
* invalid if the destination information is deleted.
|
||||
*
|
||||
* @since CUPS 2.0/macOS 10.10@
|
||||
*/
|
||||
|
||||
const char * /* O - Localized string */
|
||||
cupsLocalizeDestMedia(
|
||||
http_t *http, /* I - Connection to destination */
|
||||
cups_dest_t *dest, /* I - Destination */
|
||||
cups_dinfo_t *dinfo, /* I - Destination information */
|
||||
unsigned flags, /* I - Media flags */
|
||||
cups_size_t *size) /* I - Media size */
|
||||
{
|
||||
cups_lang_t *lang; /* Standard localizations */
|
||||
_cups_message_t key, /* Search key */
|
||||
*match; /* Matching entry */
|
||||
pwg_media_t *pwg; /* PWG media information */
|
||||
cups_array_t *db; /* Media database */
|
||||
_cups_media_db_t *mdb; /* Media database entry */
|
||||
char name[1024], /* Size name */
|
||||
temp[256]; /* Temporary string */
|
||||
const char *lsize, /* Localized media size */
|
||||
*lsource, /* Localized media source */
|
||||
*ltype; /* Localized media type */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!http || !dest || !dinfo || !size)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if the localization is cached...
|
||||
*/
|
||||
|
||||
if (!dinfo->localizations)
|
||||
cups_create_localizations(http, dinfo);
|
||||
|
||||
key.id = size->media;
|
||||
if ((match = (_cups_message_t *)cupsArrayFind(dinfo->localizations, &key)) != NULL)
|
||||
return (match->str);
|
||||
|
||||
/*
|
||||
* If not, get the localized size, source, and type strings...
|
||||
*/
|
||||
|
||||
lang = cupsLangDefault();
|
||||
pwg = pwgMediaForSize(size->width, size->length);
|
||||
|
||||
if (pwg->ppd)
|
||||
lsize = _cupsLangString(lang, pwg->ppd);
|
||||
else
|
||||
lsize = NULL;
|
||||
|
||||
if (!lsize)
|
||||
{
|
||||
if ((size->width % 635) == 0 && (size->length % 635) == 0)
|
||||
{
|
||||
/*
|
||||
* Use inches since the size is a multiple of 1/4 inch.
|
||||
*/
|
||||
|
||||
snprintf(temp, sizeof(temp), _cupsLangString(lang, _("%g x %g")), size->width / 2540.0, size->length / 2540.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Use millimeters since the size is not a multiple of 1/4 inch.
|
||||
*/
|
||||
|
||||
snprintf(temp, sizeof(temp), _cupsLangString(lang, _("%d x %d mm")), (size->width + 50) / 100, (size->length + 50) / 100);
|
||||
}
|
||||
|
||||
lsize = temp;
|
||||
}
|
||||
|
||||
if (flags & CUPS_MEDIA_FLAGS_READY)
|
||||
db = dinfo->ready_db;
|
||||
else
|
||||
db = dinfo->media_db;
|
||||
|
||||
DEBUG_printf(("1cupsLocalizeDestMedia: size->media=\"%s\"", size->media));
|
||||
|
||||
for (mdb = (_cups_media_db_t *)cupsArrayFirst(db); mdb; mdb = (_cups_media_db_t *)cupsArrayNext(db))
|
||||
{
|
||||
if (mdb->key && !strcmp(mdb->key, size->media))
|
||||
break;
|
||||
else if (mdb->size_name && !strcmp(mdb->size_name, size->media))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!mdb)
|
||||
{
|
||||
for (mdb = (_cups_media_db_t *)cupsArrayFirst(db); mdb; mdb = (_cups_media_db_t *)cupsArrayNext(db))
|
||||
{
|
||||
if (mdb->width == size->width && mdb->length == size->length && mdb->bottom == size->bottom && mdb->left == size->left && mdb->right == size->right && mdb->top == size->top)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mdb)
|
||||
{
|
||||
DEBUG_printf(("1cupsLocalizeDestMedia: MATCH mdb%p [key=\"%s\" size_name=\"%s\" source=\"%s\" type=\"%s\" width=%d length=%d B%d L%d R%d T%d]", (void *)mdb, mdb->key, mdb->size_name, mdb->source, mdb->type, mdb->width, mdb->length, mdb->bottom, mdb->left, mdb->right, mdb->top));
|
||||
|
||||
lsource = cupsLocalizeDestValue(http, dest, dinfo, "media-source", mdb->source);
|
||||
ltype = cupsLocalizeDestValue(http, dest, dinfo, "media-type", mdb->type);
|
||||
}
|
||||
else
|
||||
{
|
||||
lsource = NULL;
|
||||
ltype = NULL;
|
||||
}
|
||||
|
||||
if (!lsource && !ltype)
|
||||
{
|
||||
if (size->bottom || size->left || size->right || size->top)
|
||||
snprintf(name, sizeof(name), _cupsLangString(lang, _("%s (Borderless)")), lsize);
|
||||
else
|
||||
strlcpy(name, lsize, sizeof(name));
|
||||
}
|
||||
else if (!lsource)
|
||||
{
|
||||
if (size->bottom || size->left || size->right || size->top)
|
||||
snprintf(name, sizeof(name), _cupsLangString(lang, _("%s (Borderless, %s)")), lsize, ltype);
|
||||
else
|
||||
snprintf(name, sizeof(name), _cupsLangString(lang, _("%s (%s)")), lsize, ltype);
|
||||
}
|
||||
else if (!ltype)
|
||||
{
|
||||
if (size->bottom || size->left || size->right || size->top)
|
||||
snprintf(name, sizeof(name), _cupsLangString(lang, _("%s (Borderless, %s)")), lsize, lsource);
|
||||
else
|
||||
snprintf(name, sizeof(name), _cupsLangString(lang, _("%s (%s)")), lsize, lsource);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (size->bottom || size->left || size->right || size->top)
|
||||
snprintf(name, sizeof(name), _cupsLangString(lang, _("%s (Borderless, %s, %s)")), lsize, ltype, lsource);
|
||||
else
|
||||
snprintf(name, sizeof(name), _cupsLangString(lang, _("%s (%s, %s)")), lsize, ltype, lsource);
|
||||
}
|
||||
|
||||
if ((match = (_cups_message_t *)calloc(1, sizeof(_cups_message_t))) == NULL)
|
||||
return (NULL);
|
||||
|
||||
match->id = strdup(size->media);
|
||||
match->str = strdup(name);
|
||||
|
||||
cupsArrayAdd(dinfo->localizations, match);
|
||||
|
||||
return (match->str);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsLocalizeDestOption()' - Get the localized string for a destination
|
||||
* option.
|
||||
@ -49,7 +200,7 @@ static char *cups_scan_strings(char *buffer);
|
||||
* The returned string is stored in the destination information and will become
|
||||
* invalid if the destination information is deleted.
|
||||
*
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
* @since CUPS 1.6/macOS 10.8@
|
||||
*/
|
||||
|
||||
const char * /* O - Localized string */
|
||||
@ -88,7 +239,7 @@ cupsLocalizeDestOption(
|
||||
* The returned string is stored in the destination information and will become
|
||||
* invalid if the destination information is deleted.
|
||||
*
|
||||
* @since CUPS 1.6/OS X 10.8@
|
||||
* @since CUPS 1.6/macOS 10.8@
|
||||
*/
|
||||
|
||||
const char * /* O - Localized string */
|
||||
@ -178,7 +329,7 @@ cups_create_localizations(
|
||||
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)
|
||||
sizeof(resource)) < HTTP_URI_STATUS_OK)
|
||||
{
|
||||
DEBUG_printf(("4cups_create_localizations: Bad printer-strings-uri value "
|
||||
"\"%s\".", attr->values[0].string.text));
|
||||
@ -188,7 +339,7 @@ cups_create_localizations(
|
||||
httpGetHostname(http, http_hostname, sizeof(http_hostname));
|
||||
|
||||
if (!_cups_strcasecmp(http_hostname, hostname) &&
|
||||
port == _httpAddrPort(http->hostaddr))
|
||||
port == httpAddrPort(http->hostaddr))
|
||||
{
|
||||
/*
|
||||
* Use the same connection...
|
||||
@ -203,11 +354,12 @@ cups_create_localizations(
|
||||
*/
|
||||
|
||||
if (!strcmp(scheme, "https"))
|
||||
encryption = HTTP_ENCRYPT_ALWAYS;
|
||||
encryption = HTTP_ENCRYPTION_ALWAYS;
|
||||
else
|
||||
encryption = HTTP_ENCRYPT_IF_REQUESTED;
|
||||
encryption = HTTP_ENCRYPTION_IF_REQUESTED;
|
||||
|
||||
if ((http2 = httpConnectEncrypt(hostname, port, encryption)) == NULL)
|
||||
if ((http2 = httpConnect2(hostname, port, NULL, AF_UNSPEC, encryption, 1,
|
||||
30000, NULL)) == NULL)
|
||||
{
|
||||
DEBUG_printf(("4cups_create_localizations: Unable to connect to "
|
||||
"%s:%d: %s", hostname, port, cupsLastErrorString()));
|
||||
@ -233,7 +385,7 @@ cups_create_localizations(
|
||||
DEBUG_printf(("4cups_create_localizations: GET %s = %s", resource,
|
||||
httpStatus(status)));
|
||||
|
||||
if (status == HTTP_OK)
|
||||
if (status == HTTP_STATUS_OK)
|
||||
{
|
||||
/*
|
||||
* Got the file, read it...
|
||||
@ -355,8 +507,7 @@ cups_scan_strings(char *buffer) /* I - Start of string */
|
||||
* Decode \nnn octal escape...
|
||||
*/
|
||||
|
||||
*bufptr = ((((bufptr[1] - '0') << 3) | (bufptr[2] - '0')) << 3) |
|
||||
(bufptr[3] - '0');
|
||||
*bufptr = (char)(((((bufptr[1] - '0') << 3) | (bufptr[2] - '0')) << 3) | (bufptr[3] - '0'));
|
||||
_cups_strcpy(bufptr + 1, bufptr + 4);
|
||||
}
|
||||
else
|
||||
@ -378,9 +529,3 @@ cups_scan_strings(char *buffer) /* I - Start of string */
|
||||
|
||||
return (bufptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: dest-localization.c 3833 2012-05-23 22:51:18Z msweet $".
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
654
cups/dest.c
654
cups/dest.c
File diff suppressed because it is too large
Load Diff
60
cups/dir.c
60
cups/dir.c
@ -1,30 +1,16 @@
|
||||
/*
|
||||
* "$Id: dir.c 7279 2008-01-31 01:50:44Z mike $"
|
||||
* Directory routines for CUPS.
|
||||
*
|
||||
* Directory routines for CUPS.
|
||||
* This set of APIs abstracts enumeration of directory entries.
|
||||
*
|
||||
* This set of APIs abstracts enumeration of directory entries.
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _cups_dir_time() - Convert a FILETIME value to a UNIX time value.
|
||||
* cupsDirClose() - Close a directory.
|
||||
* cupsDirOpen() - Open a directory.
|
||||
* cupsDirRead() - Read the next directory entry.
|
||||
* cupsDirRewind() - Rewind to the start of the directory.
|
||||
* cupsDirClose() - Close a directory.
|
||||
* cupsDirOpen() - Open a directory.
|
||||
* cupsDirRead() - Read the next directory entry.
|
||||
* cupsDirRewind() - Rewind to the start of the directory.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -79,7 +65,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@ -110,7 +96,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
cups_dir_t * /* O - Directory pointer or @code NULL@ if the directory could not be opened. */
|
||||
@ -153,7 +139,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
cups_dentry_t * /* O - Directory entry or @code NULL@ if there are no more */
|
||||
@ -213,7 +199,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@ -263,13 +249,13 @@ struct _cups_dir_s /**** Directory data structure ****/
|
||||
/*
|
||||
* 'cupsDirClose()' - Close a directory.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
cupsDirClose(cups_dir_t *dp) /* I - Directory pointer */
|
||||
{
|
||||
DEBUG_printf(("cupsDirClose(dp=%p)", dp));
|
||||
DEBUG_printf(("cupsDirClose(dp=%p)", (void *)dp));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -290,7 +276,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
cups_dir_t * /* O - Directory pointer or @code NULL@ if the directory could not be opened. */
|
||||
@ -344,7 +330,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
cups_dentry_t * /* O - Directory entry or @code NULL@ when there are no more */
|
||||
@ -358,7 +344,7 @@ cupsDirRead(cups_dir_t *dp) /* I - Directory pointer */
|
||||
# endif /* HAVE_PTHREAD_H */
|
||||
|
||||
|
||||
DEBUG_printf(("2cupsDirRead(dp=%p)", dp));
|
||||
DEBUG_printf(("2cupsDirRead(dp=%p)", (void *)dp));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -442,13 +428,13 @@ 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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
cupsDirRewind(cups_dir_t *dp) /* I - Directory pointer */
|
||||
{
|
||||
DEBUG_printf(("cupsDirRewind(dp=%p)", dp));
|
||||
DEBUG_printf(("cupsDirRewind(dp=%p)", (void *)dp));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -463,10 +449,4 @@ cupsDirRewind(cups_dir_t *dp) /* I - Directory pointer */
|
||||
|
||||
rewinddir(dp->dir);
|
||||
}
|
||||
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
||||
/*
|
||||
* End of "$Id: dir.c 7279 2008-01-31 01:50:44Z mike $".
|
||||
*/
|
||||
|
||||
24
cups/dir.h
24
cups/dir.h
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: dir.h 7026 2007-10-19 00:57:45Z mike $"
|
||||
* Public directory definitions for CUPS.
|
||||
*
|
||||
* Public directory definitions for CUPS.
|
||||
* This set of APIs abstracts enumeration of directory entries.
|
||||
*
|
||||
* This set of APIs abstracts enumeration of directory entries.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* 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
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_DIR_H_
|
||||
@ -63,7 +61,3 @@ extern void cupsDirRewind(cups_dir_t *dp) _CUPS_API_1_2;
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_DIR_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: dir.h 7026 2007-10-19 00:57:45Z mike $".
|
||||
*/
|
||||
|
||||
304
cups/encode.c
304
cups/encode.c
@ -1,26 +1,16 @@
|
||||
/*
|
||||
* "$Id: encode.c 7696 2008-06-26 00:54:42Z mike $"
|
||||
* Option encoding routines for CUPS.
|
||||
*
|
||||
* Option encoding routines for CUPS.
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsEncodeOptions() - Encode printer options into IPP attributes.
|
||||
* cupsEncodeOptions2() - Encode printer options into IPP attributes for
|
||||
* a group.
|
||||
* _ippFindOption() - Find the attribute information for an option.
|
||||
* compare_ipp_options() - Compare two IPP options.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -31,14 +21,87 @@
|
||||
|
||||
|
||||
/*
|
||||
* Local list of option names and the value tags they should use...
|
||||
* Local list of option names, the value tags they should use, and the list of
|
||||
* supported operations...
|
||||
*
|
||||
* **** THIS LIST MUST BE SORTED ****
|
||||
* **** THIS LIST MUST BE SORTED BY ATTRIBUTE NAME ****
|
||||
*/
|
||||
|
||||
static const ipp_op_t ipp_job_creation[] =
|
||||
{
|
||||
IPP_OP_PRINT_JOB,
|
||||
IPP_OP_PRINT_URI,
|
||||
IPP_OP_VALIDATE_JOB,
|
||||
IPP_OP_CREATE_JOB,
|
||||
IPP_OP_HOLD_JOB,
|
||||
IPP_OP_SET_JOB_ATTRIBUTES,
|
||||
IPP_OP_CUPS_NONE
|
||||
};
|
||||
|
||||
static const ipp_op_t ipp_doc_creation[] =
|
||||
{
|
||||
IPP_OP_PRINT_JOB,
|
||||
IPP_OP_PRINT_URI,
|
||||
IPP_OP_SEND_DOCUMENT,
|
||||
IPP_OP_SEND_URI,
|
||||
IPP_OP_SET_JOB_ATTRIBUTES,
|
||||
IPP_OP_SET_DOCUMENT_ATTRIBUTES,
|
||||
IPP_OP_CUPS_NONE
|
||||
};
|
||||
|
||||
static const ipp_op_t ipp_sub_creation[] =
|
||||
{
|
||||
IPP_OP_PRINT_JOB,
|
||||
IPP_OP_PRINT_URI,
|
||||
IPP_OP_CREATE_JOB,
|
||||
IPP_OP_CREATE_PRINTER_SUBSCRIPTIONS,
|
||||
IPP_OP_CREATE_JOB_SUBSCRIPTIONS,
|
||||
IPP_OP_CUPS_NONE
|
||||
};
|
||||
|
||||
static const ipp_op_t ipp_all_print[] =
|
||||
{
|
||||
IPP_OP_PRINT_JOB,
|
||||
IPP_OP_PRINT_URI,
|
||||
IPP_OP_VALIDATE_JOB,
|
||||
IPP_OP_CREATE_JOB,
|
||||
IPP_OP_SEND_DOCUMENT,
|
||||
IPP_OP_SEND_URI,
|
||||
IPP_OP_CUPS_NONE
|
||||
};
|
||||
|
||||
static const ipp_op_t ipp_set_printer[] =
|
||||
{
|
||||
IPP_OP_SET_PRINTER_ATTRIBUTES,
|
||||
IPP_OP_CUPS_ADD_MODIFY_PRINTER,
|
||||
IPP_OP_CUPS_ADD_MODIFY_CLASS,
|
||||
IPP_OP_CUPS_NONE
|
||||
};
|
||||
|
||||
static const ipp_op_t cups_schemes[] =
|
||||
{
|
||||
IPP_OP_CUPS_GET_DEVICES,
|
||||
IPP_OP_CUPS_GET_PPDS,
|
||||
IPP_OP_CUPS_NONE
|
||||
};
|
||||
|
||||
static const ipp_op_t cups_get_ppds[] =
|
||||
{
|
||||
IPP_OP_CUPS_GET_PPDS,
|
||||
IPP_OP_CUPS_NONE
|
||||
};
|
||||
|
||||
static const ipp_op_t cups_ppd_name[] =
|
||||
{
|
||||
IPP_OP_CUPS_ADD_MODIFY_PRINTER,
|
||||
IPP_OP_CUPS_GET_PPD,
|
||||
IPP_OP_CUPS_NONE
|
||||
};
|
||||
|
||||
static const _ipp_option_t ipp_options[] =
|
||||
{
|
||||
{ 1, "auth-info", IPP_TAG_TEXT, IPP_TAG_JOB },
|
||||
{ 1, "auth-info-default", IPP_TAG_TEXT, IPP_TAG_PRINTER },
|
||||
{ 1, "auth-info-required", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ 0, "blackplot", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
{ 0, "blackplot-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
@ -46,18 +109,29 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "brightness-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "columns", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "columns-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "compression", IPP_TAG_KEYWORD, IPP_TAG_OPERATION },
|
||||
{ 0, "compression", IPP_TAG_KEYWORD, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
ipp_doc_creation },
|
||||
{ 0, "copies", IPP_TAG_INTEGER, IPP_TAG_JOB,
|
||||
IPP_TAG_DOCUMENT },
|
||||
{ 0, "copies-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "date-time-at-completed",IPP_TAG_DATE, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "date-time-at-creation", IPP_TAG_DATE, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "date-time-at-processing",IPP_TAG_DATE, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "device-uri", IPP_TAG_URI, IPP_TAG_PRINTER },
|
||||
{ 1, "document-copies", IPP_TAG_RANGE, IPP_TAG_JOB,
|
||||
IPP_TAG_DOCUMENT },
|
||||
{ 0, "document-format", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION },
|
||||
IPP_TAG_DOCUMENT,
|
||||
ipp_doc_creation },
|
||||
{ 0, "document-format", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
ipp_doc_creation },
|
||||
{ 0, "document-format-default", IPP_TAG_MIMETYPE, IPP_TAG_PRINTER },
|
||||
{ 1, "document-numbers", IPP_TAG_RANGE, IPP_TAG_JOB,
|
||||
IPP_TAG_DOCUMENT },
|
||||
{ 1, "exclude-schemes", IPP_TAG_NAME, IPP_TAG_OPERATION },
|
||||
IPP_TAG_DOCUMENT,
|
||||
ipp_all_print },
|
||||
{ 1, "exclude-schemes", IPP_TAG_NAME, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_schemes },
|
||||
{ 1, "finishings", IPP_TAG_ENUM, IPP_TAG_JOB,
|
||||
IPP_TAG_DOCUMENT },
|
||||
{ 1, "finishings-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
@ -70,7 +144,17 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "gamma-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "hue", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "hue-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 1, "include-schemes", IPP_TAG_NAME, IPP_TAG_OPERATION },
|
||||
{ 1, "include-schemes", IPP_TAG_NAME, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_schemes },
|
||||
{ 0, "job-account-id", IPP_TAG_NAME, IPP_TAG_JOB },
|
||||
{ 0, "job-account-id-default",IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "job-accounting-user-id", IPP_TAG_NAME, IPP_TAG_JOB },
|
||||
{ 0, "job-accounting-user-id-default", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "job-authorization-uri", IPP_TAG_URI, IPP_TAG_OPERATION },
|
||||
{ 0, "job-cancel-after", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "job-cancel-after-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "job-hold-until", IPP_TAG_KEYWORD, IPP_TAG_JOB },
|
||||
{ 0, "job-id", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-impressions", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-impressions-completed", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
@ -80,6 +164,12 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "job-media-sheets", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-media-sheets-completed", IPP_TAG_INTEGER, IPP_TAG_ZERO }, /* never send as option */
|
||||
{ 0, "job-page-limit", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "job-password", IPP_TAG_STRING, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
ipp_job_creation },
|
||||
{ 0, "job-password-encryption", IPP_TAG_KEYWORD, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
ipp_job_creation },
|
||||
{ 0, "job-priority", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "job-quota-period", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 1, "job-sheets", IPP_TAG_NAME, IPP_TAG_JOB },
|
||||
@ -149,7 +239,33 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "penwidth-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "port-monitor", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "ppd-name", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "ppd-device-id", IPP_TAG_TEXT, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_get_ppds },
|
||||
{ 0, "ppd-make", IPP_TAG_TEXT, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_get_ppds },
|
||||
{ 0, "ppd-make-and-model", IPP_TAG_TEXT, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_get_ppds },
|
||||
{ 0, "ppd-model-number", IPP_TAG_INTEGER, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_get_ppds },
|
||||
{ 0, "ppd-name", IPP_TAG_NAME, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_ppd_name },
|
||||
{ 0, "ppd-natural-language", IPP_TAG_LANGUAGE, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_get_ppds },
|
||||
{ 0, "ppd-product", IPP_TAG_TEXT, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_get_ppds },
|
||||
{ 0, "ppd-psversion", IPP_TAG_TEXT, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_get_ppds },
|
||||
{ 0, "ppd-type", IPP_TAG_KEYWORD, IPP_TAG_OPERATION,
|
||||
IPP_TAG_ZERO,
|
||||
cups_get_ppds },
|
||||
{ 0, "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB },
|
||||
{ 0, "ppi-default", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
|
||||
{ 0, "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
|
||||
@ -159,9 +275,11 @@ static const _ipp_option_t ipp_options[] =
|
||||
{ 0, "print-quality-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
|
||||
{ 1, "printer-commands", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-error-policy", IPP_TAG_NAME, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-geo-location", IPP_TAG_URI, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-info", IPP_TAG_TEXT, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-is-shared", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-is-temporary", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-location", IPP_TAG_TEXT, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-make-and-model", IPP_TAG_TEXT, IPP_TAG_PRINTER },
|
||||
{ 0, "printer-more-info", IPP_TAG_URI, IPP_TAG_PRINTER },
|
||||
@ -220,7 +338,7 @@ cupsEncodeOptions(ipp_t *ipp, /* I - Request to add to */
|
||||
int num_options, /* I - Number of options */
|
||||
cups_option_t *options) /* I - Options */
|
||||
{
|
||||
DEBUG_printf(("cupsEncodeOptions(%p, %d, %p)", ipp, num_options, options));
|
||||
DEBUG_printf(("cupsEncodeOptions(%p, %d, %p)", (void *)ipp, num_options, (void *)options));
|
||||
|
||||
/*
|
||||
* Add the options in the proper groups & order...
|
||||
@ -239,7 +357,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@ -249,23 +367,24 @@ cupsEncodeOptions2(
|
||||
cups_option_t *options, /* I - Options */
|
||||
ipp_tag_t group_tag) /* I - Group to encode */
|
||||
{
|
||||
int i, j; /* Looping vars */
|
||||
int count; /* Number of values */
|
||||
char *s, /* Pointer into option value */
|
||||
*val, /* Pointer to option value */
|
||||
*copy, /* Copy of option value */
|
||||
*sep, /* Option separator */
|
||||
quote; /* Quote character */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
ipp_tag_t value_tag; /* IPP value tag */
|
||||
cups_option_t *option; /* Current option */
|
||||
ipp_t *collection; /* Collection value */
|
||||
int num_cols; /* Number of collection values */
|
||||
cups_option_t *cols; /* Collection values */
|
||||
int i, j; /* Looping vars */
|
||||
int count; /* Number of values */
|
||||
char *s, /* Pointer into option value */
|
||||
*val, /* Pointer to option value */
|
||||
*copy, /* Copy of option value */
|
||||
*sep, /* Option separator */
|
||||
quote; /* Quote character */
|
||||
ipp_attribute_t *attr; /* IPP attribute */
|
||||
ipp_tag_t value_tag; /* IPP value tag */
|
||||
cups_option_t *option; /* Current option */
|
||||
ipp_t *collection; /* Collection value */
|
||||
int num_cols; /* Number of collection values */
|
||||
cups_option_t *cols; /* Collection values */
|
||||
ipp_op_t op; /* Operation for this request */
|
||||
const ipp_op_t *ops; /* List of allowed operations */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsEncodeOptions2(ipp=%p, num_options=%d, options=%p, "
|
||||
"group_tag=%x)", ipp, num_options, options, group_tag));
|
||||
DEBUG_printf(("cupsEncodeOptions2(ipp=%p(%s), num_options=%d, options=%p, group_tag=%x)", (void *)ipp, ipp ? ippOpString(ippGetOperation(ipp)) : "", num_options, (void *)options, group_tag));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -278,13 +397,18 @@ cupsEncodeOptions2(
|
||||
* Do special handling for the document-format/raw options...
|
||||
*/
|
||||
|
||||
if (group_tag == IPP_TAG_OPERATION)
|
||||
op = ippGetOperation(ipp);
|
||||
|
||||
if (group_tag == IPP_TAG_OPERATION &&
|
||||
(op == IPP_OP_PRINT_JOB || op == IPP_OP_PRINT_URI ||
|
||||
op == IPP_OP_SEND_DOCUMENT || op == IPP_OP_SEND_URI))
|
||||
{
|
||||
/*
|
||||
* Handle the document format stuff first...
|
||||
*/
|
||||
|
||||
if ((val = (char *)cupsGetOption("document-format", num_options, options)) != NULL)
|
||||
if ((val = (char *)cupsGetOption("document-format", num_options,
|
||||
options)) != NULL)
|
||||
ippAddString(ipp, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format",
|
||||
NULL, val);
|
||||
else if (cupsGetOption("raw", num_options, options))
|
||||
@ -323,6 +447,22 @@ cupsEncodeOptions2(
|
||||
continue;
|
||||
|
||||
value_tag = match->value_tag;
|
||||
|
||||
if (match->operations)
|
||||
ops = match->operations;
|
||||
else if (group_tag == IPP_TAG_JOB)
|
||||
ops = ipp_job_creation;
|
||||
else if (group_tag == IPP_TAG_DOCUMENT)
|
||||
ops = ipp_doc_creation;
|
||||
else if (group_tag == IPP_TAG_SUBSCRIPTION)
|
||||
ops = ipp_sub_creation;
|
||||
else if (group_tag == IPP_TAG_PRINTER)
|
||||
ops = ipp_set_printer;
|
||||
else
|
||||
{
|
||||
DEBUG_printf(("2cupsEncodeOptions2: Skipping \"%s\".", option->name));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -336,10 +476,23 @@ cupsEncodeOptions2(
|
||||
strcmp(option->name + namelen - 10, "-supported")))
|
||||
{
|
||||
if (group_tag != IPP_TAG_JOB && group_tag != IPP_TAG_DOCUMENT)
|
||||
{
|
||||
DEBUG_printf(("2cupsEncodeOptions2: Skipping \"%s\".", option->name));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (group_tag != IPP_TAG_PRINTER)
|
||||
{
|
||||
DEBUG_printf(("2cupsEncodeOptions2: Skipping \"%s\".", option->name));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (group_tag == IPP_TAG_JOB)
|
||||
ops = ipp_job_creation;
|
||||
else if (group_tag == IPP_TAG_DOCUMENT)
|
||||
ops = ipp_doc_creation;
|
||||
else
|
||||
ops = ipp_set_printer;
|
||||
|
||||
if (!_cups_strcasecmp(option->value, "true") ||
|
||||
!_cups_strcasecmp(option->value, "false"))
|
||||
@ -348,6 +501,22 @@ cupsEncodeOptions2(
|
||||
value_tag = IPP_TAG_NAME;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify that we send this attribute for this operation...
|
||||
*/
|
||||
|
||||
while (*ops != IPP_OP_CUPS_NONE)
|
||||
if (op == *ops)
|
||||
break;
|
||||
else
|
||||
ops ++;
|
||||
|
||||
if (*ops == IPP_OP_CUPS_NONE && op != IPP_OP_CUPS_NONE)
|
||||
{
|
||||
DEBUG_printf(("2cupsEncodeOptions2: Skipping \"%s\".", option->name));
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Count the number of values...
|
||||
*/
|
||||
@ -369,14 +538,13 @@ cupsEncodeOptions2(
|
||||
else if (*sep == ',' && !quote)
|
||||
count ++;
|
||||
else if (*sep == '\\' && sep[1])
|
||||
sep ++;
|
||||
sep += 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
count = 1;
|
||||
|
||||
DEBUG_printf(("2cupsEncodeOptions2: option=\"%s\", count=%d",
|
||||
option->name, count));
|
||||
DEBUG_printf(("2cupsEncodeOptions2: option=\"%s\", value=\"%s\", count=%d", option->name, option->value, count));
|
||||
|
||||
/*
|
||||
* Allocate memory for the attribute values...
|
||||
@ -460,6 +628,7 @@ cupsEncodeOptions2(
|
||||
* Skip quoted character...
|
||||
*/
|
||||
|
||||
memmove(sep, sep + 1, strlen(sep));
|
||||
sep ++;
|
||||
}
|
||||
}
|
||||
@ -480,7 +649,7 @@ cupsEncodeOptions2(
|
||||
* Integer/enumeration value...
|
||||
*/
|
||||
|
||||
attr->values[j].integer = strtol(val, &s, 10);
|
||||
attr->values[j].integer = (int)strtol(val, &s, 10);
|
||||
|
||||
DEBUG_printf(("2cupsEncodeOptions2: Added integer option value "
|
||||
"%d...", attr->values[j].integer));
|
||||
@ -522,12 +691,12 @@ cupsEncodeOptions2(
|
||||
s = val;
|
||||
}
|
||||
else
|
||||
attr->values[j].range.lower = strtol(val, &s, 10);
|
||||
attr->values[j].range.lower = (int)strtol(val, &s, 10);
|
||||
|
||||
if (*s == '-')
|
||||
{
|
||||
if (s[1])
|
||||
attr->values[j].range.upper = strtol(s + 1, NULL, 10);
|
||||
attr->values[j].range.upper = (int)strtol(s + 1, NULL, 10);
|
||||
else
|
||||
attr->values[j].range.upper = 2147483647;
|
||||
}
|
||||
@ -544,10 +713,10 @@ cupsEncodeOptions2(
|
||||
* Resolution...
|
||||
*/
|
||||
|
||||
attr->values[j].resolution.xres = strtol(val, &s, 10);
|
||||
attr->values[j].resolution.xres = (int)strtol(val, &s, 10);
|
||||
|
||||
if (*s == 'x')
|
||||
attr->values[j].resolution.yres = strtol(s + 1, &s, 10);
|
||||
attr->values[j].resolution.yres = (int)strtol(s + 1, &s, 10);
|
||||
else
|
||||
attr->values[j].resolution.yres = attr->values[j].resolution.xres;
|
||||
|
||||
@ -623,6 +792,26 @@ cupsEncodeOptions2(
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* '_ippCheckOptions()' - Validate that the option array is sorted properly.
|
||||
*/
|
||||
|
||||
const char * /* O - First out-of-order option or NULL */
|
||||
_ippCheckOptions(void)
|
||||
{
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
for (i = 0; i < (int)(sizeof(ipp_options) / sizeof(ipp_options[0]) - 1); i ++)
|
||||
if (strcmp(ipp_options[i].name, ipp_options[i + 1].name) >= 0)
|
||||
return (ipp_options[i + 1].name);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
/*
|
||||
* '_ippFindOption()' - Find the attribute information for an option.
|
||||
*/
|
||||
@ -657,8 +846,3 @@ compare_ipp_options(_ipp_option_t *a, /* I - First option */
|
||||
{
|
||||
return (strcmp(a->name, b->name));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: encode.c 7696 2008-06-26 00:54:42Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,21 +1,21 @@
|
||||
/*
|
||||
* "$Id: file-private.h 3275 2011-05-20 07:26:13Z msweet $"
|
||||
* Private file definitions for CUPS.
|
||||
*
|
||||
* Private file definitions for CUPS.
|
||||
* Since stdio files max out at 256 files on many systems, we have to
|
||||
* write similar functions without this limit. At the same time, using
|
||||
* our own file functions allows us to provide transparent support of
|
||||
* gzip'd print files, PPD files, etc.
|
||||
*
|
||||
* Since stdio files max out at 256 files on many systems, we have to
|
||||
* write similar functions without this limit. At the same time, using
|
||||
* our own file functions allows us to provide transparent support of
|
||||
* gzip'd print files, PPD files, etc.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* 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
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_FILE_PRIVATE_H_
|
||||
@ -131,7 +131,3 @@ extern void _cupsFileCheckFilter(void *context,
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_FILE_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: file-private.h 3275 2011-05-20 07:26:13Z msweet $".
|
||||
*/
|
||||
|
||||
443
cups/file.c
443
cups/file.c
File diff suppressed because it is too large
Load Diff
30
cups/file.h
30
cups/file.h
@ -1,21 +1,21 @@
|
||||
/*
|
||||
* "$Id: file.h 7460 2008-04-16 02:19:54Z mike $"
|
||||
* Public file definitions for CUPS.
|
||||
*
|
||||
* Public file definitions for CUPS.
|
||||
* Since stdio files max out at 256 files on many systems, we have to
|
||||
* write similar functions without this limit. At the same time, using
|
||||
* our own file functions allows us to provide transparent support of
|
||||
* gzip'd print files, PPD files, etc.
|
||||
*
|
||||
* Since stdio files max out at 256 files on many systems, we have to
|
||||
* write similar functions without this limit. At the same time, using
|
||||
* our own file functions allows us to provide transparent support of
|
||||
* gzip'd print files, PPD files, etc.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* 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
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_FILE_H_
|
||||
@ -110,7 +110,3 @@ extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf,
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_FILE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: file.h 7460 2008-04-16 02:19:54Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,21 +1,15 @@
|
||||
/*
|
||||
* "$Id: getdevices.c 3794 2012-04-23 22:44:16Z msweet $"
|
||||
* cupsGetDevices implementation for CUPS.
|
||||
*
|
||||
* cupsGetDevices implementation for CUPS.
|
||||
* Copyright 2008-2016 by Apple Inc.
|
||||
*
|
||||
* Copyright 2008-2012 by Apple Inc.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsGetDevices() - Get available printer devices.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -23,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "cups-private.h"
|
||||
#include "adminutil.h"
|
||||
|
||||
|
||||
/*
|
||||
@ -34,7 +29,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/macOS 10.6@
|
||||
*/
|
||||
|
||||
ipp_status_t /* O - Request status - @code IPP_OK@ on success. */
|
||||
@ -65,25 +60,22 @@ cupsGetDevices(
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsGetDevices(http=%p, timeout=%d, include_schemes=\"%s\", "
|
||||
"exclude_schemes=\"%s\", callback=%p, user_data=%p)", http,
|
||||
timeout, include_schemes, exclude_schemes, callback,
|
||||
user_data));
|
||||
DEBUG_printf(("cupsGetDevices(http=%p, timeout=%d, include_schemes=\"%s\", exclude_schemes=\"%s\", callback=%p, user_data=%p)", (void *)http, timeout, include_schemes, exclude_schemes, (void *)callback, user_data));
|
||||
|
||||
if (!callback)
|
||||
return (IPP_INTERNAL_ERROR);
|
||||
return (IPP_STATUS_ERROR_INTERNAL);
|
||||
|
||||
if (!http)
|
||||
http = _cupsConnect();
|
||||
|
||||
if (!http)
|
||||
return (IPP_SERVICE_UNAVAILABLE);
|
||||
return (IPP_STATUS_ERROR_SERVICE_UNAVAILABLE);
|
||||
|
||||
/*
|
||||
* Create a CUPS-Get-Devices request...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(CUPS_GET_DEVICES);
|
||||
request = ippNewRequest(IPP_OP_CUPS_GET_DEVICES);
|
||||
|
||||
if (timeout > 0)
|
||||
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "timeout",
|
||||
@ -115,14 +107,14 @@ cupsGetDevices(
|
||||
status = cupsSendRequest(http, request, "/", ippLength(request));
|
||||
|
||||
DEBUG_puts("2cupsGetDevices: Waiting for response status...");
|
||||
while (status == HTTP_CONTINUE)
|
||||
while (status == HTTP_STATUS_CONTINUE)
|
||||
status = httpUpdate(http);
|
||||
|
||||
if (status != HTTP_OK)
|
||||
if (status != HTTP_STATUS_OK)
|
||||
{
|
||||
httpFlush(http);
|
||||
|
||||
if (status == HTTP_UNAUTHORIZED)
|
||||
if (status == HTTP_STATUS_UNAUTHORIZED)
|
||||
{
|
||||
/*
|
||||
* See if we can do authentication...
|
||||
@ -131,16 +123,16 @@ cupsGetDevices(
|
||||
DEBUG_puts("2cupsGetDevices: Need authorization...");
|
||||
|
||||
if (!cupsDoAuthentication(http, "POST", "/"))
|
||||
httpReconnect(http);
|
||||
httpReconnect2(http, 30000, NULL);
|
||||
else
|
||||
{
|
||||
status = HTTP_AUTHORIZATION_CANCELED;
|
||||
status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
else if (status == HTTP_UPGRADE_REQUIRED)
|
||||
else if (status == HTTP_STATUS_UPGRADE_REQUIRED)
|
||||
{
|
||||
/*
|
||||
* Force a reconnect with encryption...
|
||||
@ -148,19 +140,20 @@ cupsGetDevices(
|
||||
|
||||
DEBUG_puts("2cupsGetDevices: Need encryption...");
|
||||
|
||||
if (!httpReconnect(http))
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
|
||||
if (!httpReconnect2(http, 30000, NULL))
|
||||
httpEncryption(http, HTTP_ENCRYPTION_REQUIRED);
|
||||
}
|
||||
#endif /* HAVE_SSL */
|
||||
}
|
||||
}
|
||||
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
|
||||
while (status == HTTP_STATUS_UNAUTHORIZED ||
|
||||
status == HTTP_STATUS_UPGRADE_REQUIRED);
|
||||
|
||||
DEBUG_printf(("2cupsGetDevices: status=%d", status));
|
||||
|
||||
ippDelete(request);
|
||||
|
||||
if (status != HTTP_OK)
|
||||
if (status != HTTP_STATUS_OK)
|
||||
{
|
||||
_cupsSetHTTPError(status);
|
||||
return (cupsLastError());
|
||||
@ -186,11 +179,10 @@ cupsGetDevices(
|
||||
|
||||
do
|
||||
{
|
||||
if ((state = ippRead(http, response)) == IPP_ERROR)
|
||||
if ((state = ippRead(http, response)) == IPP_STATE_ERROR)
|
||||
break;
|
||||
|
||||
DEBUG_printf(("2cupsGetDevices: state=%d, response->last=%p", state,
|
||||
response->last));
|
||||
DEBUG_printf(("2cupsGetDevices: state=%d, response->last=%p", state, (void *)response->last));
|
||||
|
||||
if (!response->attrs)
|
||||
continue;
|
||||
@ -240,10 +232,9 @@ cupsGetDevices(
|
||||
device_uri = attr->values[0].string.text;
|
||||
}
|
||||
}
|
||||
while (state != IPP_DATA);
|
||||
while (state != IPP_STATE_DATA);
|
||||
|
||||
DEBUG_printf(("2cupsGetDevices: state=%d, response->last=%p", state,
|
||||
response->last));
|
||||
DEBUG_printf(("2cupsGetDevices: state=%d, response->last=%p", state, (void *)response->last));
|
||||
|
||||
if (device_class && device_id && device_info && device_make_and_model &&
|
||||
device_uri)
|
||||
@ -257,8 +248,8 @@ cupsGetDevices(
|
||||
httpBlocking(http, blocking);
|
||||
httpFlush(http);
|
||||
|
||||
if (status == HTTP_ERROR)
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(http->error), 0);
|
||||
if (status == HTTP_STATUS_ERROR)
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(http->error), 0);
|
||||
else
|
||||
{
|
||||
attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
|
||||
@ -276,8 +267,3 @@ cupsGetDevices(
|
||||
|
||||
return (cupsLastError());
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: getdevices.c 3794 2012-04-23 22:44:16Z msweet $".
|
||||
*/
|
||||
|
||||
@ -1,21 +1,14 @@
|
||||
/*
|
||||
* "$Id: getifaddrs.c 6649 2007-07-11 21:46:42Z mike $"
|
||||
* Network interface functions for CUPS.
|
||||
*
|
||||
* Network interface functions for CUPS.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _cups_getifaddrs() - Get a list of network interfaces on the system.
|
||||
* _cups_freeifaddrs() - Free an interface list...
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* "LICENSE" which should have been included with this file. If this
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -259,8 +252,3 @@ _cups_freeifaddrs(struct ifaddrs *addrs)/* I - Interface list to free */
|
||||
}
|
||||
}
|
||||
#endif /* !HAVE_GETIFADDRS */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: getifaddrs.c 6649 2007-07-11 21:46:42Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,25 +1,16 @@
|
||||
/*
|
||||
* "$Id: getputfile.c 7359 2008-02-29 19:01:35Z mike $"
|
||||
* Get/put file functions for CUPS.
|
||||
*
|
||||
* Get/put file functions for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsGetFd() - Get a file from the server.
|
||||
* cupsGetFile() - Get a file from the server.
|
||||
* cupsPutFd() - Put a file on the server.
|
||||
* cupsPutFile() - Put a file on the server.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -39,9 +30,9 @@
|
||||
/*
|
||||
* 'cupsGetFd()' - Get a file from the server.
|
||||
*
|
||||
* This function returns @code HTTP_OK@ when the file is successfully retrieved.
|
||||
* This function returns @code HTTP_STATUS_OK@ when the file is successfully retrieved.
|
||||
*
|
||||
* @since CUPS 1.1.20/OS X 10.4@
|
||||
* @since CUPS 1.1.20/macOS 10.4@
|
||||
*/
|
||||
|
||||
http_status_t /* O - HTTP status */
|
||||
@ -49,7 +40,7 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
const char *resource, /* I - Resource name */
|
||||
int fd) /* I - File descriptor */
|
||||
{
|
||||
int bytes; /* Number of bytes read */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
char buffer[8192]; /* Buffer for file */
|
||||
http_status_t status; /* HTTP status from server */
|
||||
char if_modified_since[HTTP_MAX_VALUE];
|
||||
@ -60,20 +51,19 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsGetFd(http=%p, resource=\"%s\", fd=%d)", http,
|
||||
resource, fd));
|
||||
DEBUG_printf(("cupsGetFd(http=%p, resource=\"%s\", fd=%d)", (void *)http, resource, fd));
|
||||
|
||||
if (!resource || fd < 0)
|
||||
{
|
||||
if (http)
|
||||
http->error = EINVAL;
|
||||
|
||||
return (HTTP_ERROR);
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
if (!http)
|
||||
if ((http = _cupsConnect()) == NULL)
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
|
||||
/*
|
||||
* Then send GET requests to the HTTP server...
|
||||
@ -84,27 +74,37 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
|
||||
do
|
||||
{
|
||||
if (!_cups_strcasecmp(httpGetField(http, HTTP_FIELD_CONNECTION), "close"))
|
||||
{
|
||||
httpClearFields(http);
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
status = HTTP_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
httpClearFields(http);
|
||||
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
|
||||
httpSetField(http, HTTP_FIELD_IF_MODIFIED_SINCE, if_modified_since);
|
||||
|
||||
if (httpGet(http, resource))
|
||||
{
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
status = HTTP_ERROR;
|
||||
status = HTTP_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = HTTP_UNAUTHORIZED;
|
||||
status = HTTP_STATUS_UNAUTHORIZED;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
while ((status = httpUpdate(http)) == HTTP_CONTINUE);
|
||||
while ((status = httpUpdate(http)) == HTTP_STATUS_CONTINUE);
|
||||
|
||||
if (status == HTTP_UNAUTHORIZED)
|
||||
if (status == HTTP_STATUS_UNAUTHORIZED)
|
||||
{
|
||||
/*
|
||||
* Flush any error message...
|
||||
@ -118,53 +118,53 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
|
||||
if (cupsDoAuthentication(http, "GET", resource))
|
||||
{
|
||||
status = HTTP_AUTHORIZATION_CANCELED;
|
||||
status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
status = HTTP_ERROR;
|
||||
status = HTTP_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
#ifdef HAVE_SSL
|
||||
else if (status == HTTP_UPGRADE_REQUIRED)
|
||||
else if (status == HTTP_STATUS_UPGRADE_REQUIRED)
|
||||
{
|
||||
/* Flush any error message... */
|
||||
httpFlush(http);
|
||||
|
||||
/* Reconnect... */
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
status = HTTP_ERROR;
|
||||
status = HTTP_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Upgrade with encryption... */
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
|
||||
httpEncryption(http, HTTP_ENCRYPTION_REQUIRED);
|
||||
|
||||
/* Try again, this time with encryption enabled... */
|
||||
continue;
|
||||
}
|
||||
#endif /* HAVE_SSL */
|
||||
}
|
||||
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
|
||||
while (status == HTTP_STATUS_UNAUTHORIZED || status == HTTP_STATUS_UPGRADE_REQUIRED);
|
||||
|
||||
/*
|
||||
* See if we actually got the file or an error...
|
||||
*/
|
||||
|
||||
if (status == HTTP_OK)
|
||||
if (status == HTTP_STATUS_OK)
|
||||
{
|
||||
/*
|
||||
* Yes, copy the file...
|
||||
*/
|
||||
|
||||
while ((bytes = httpRead2(http, buffer, sizeof(buffer))) > 0)
|
||||
write(fd, buffer, bytes);
|
||||
write(fd, buffer, (size_t)bytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -185,9 +185,9 @@ cupsGetFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
/*
|
||||
* 'cupsGetFile()' - Get a file from the server.
|
||||
*
|
||||
* This function returns @code HTTP_OK@ when the file is successfully retrieved.
|
||||
* This function returns @code HTTP_STATUS_OK@ when the file is successfully retrieved.
|
||||
*
|
||||
* @since CUPS 1.1.20/OS X 10.4@
|
||||
* @since CUPS 1.1.20/macOS 10.4@
|
||||
*/
|
||||
|
||||
http_status_t /* O - HTTP status */
|
||||
@ -208,7 +208,7 @@ cupsGetFile(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DE
|
||||
if (http)
|
||||
http->error = EINVAL;
|
||||
|
||||
return (HTTP_ERROR);
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -223,7 +223,7 @@ cupsGetFile(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DE
|
||||
|
||||
http->error = errno;
|
||||
|
||||
return (HTTP_ERROR);
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -238,7 +238,7 @@ cupsGetFile(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DE
|
||||
|
||||
close(fd);
|
||||
|
||||
if (status != HTTP_OK)
|
||||
if (status != HTTP_STATUS_OK)
|
||||
unlink(filename);
|
||||
|
||||
/*
|
||||
@ -252,10 +252,10 @@ cupsGetFile(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DE
|
||||
/*
|
||||
* 'cupsPutFd()' - Put a file on the server.
|
||||
*
|
||||
* This function returns @code HTTP_CREATED@ when the file is stored
|
||||
* This function returns @code HTTP_STATUS_CREATED@ when the file is stored
|
||||
* successfully.
|
||||
*
|
||||
* @since CUPS 1.1.20/OS X 10.4@
|
||||
* @since CUPS 1.1.20/macOS 10.4@
|
||||
*/
|
||||
|
||||
http_status_t /* O - HTTP status */
|
||||
@ -263,8 +263,8 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
const char *resource, /* I - Resource name */
|
||||
int fd) /* I - File descriptor */
|
||||
{
|
||||
int bytes, /* Number of bytes read */
|
||||
retries; /* Number of retries */
|
||||
ssize_t bytes; /* Number of bytes read */
|
||||
int retries; /* Number of retries */
|
||||
char buffer[8192]; /* Buffer for file */
|
||||
http_status_t status; /* HTTP status from server */
|
||||
|
||||
@ -273,20 +273,19 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsPutFd(http=%p, resource=\"%s\", fd=%d)", http,
|
||||
resource, fd));
|
||||
DEBUG_printf(("cupsPutFd(http=%p, resource=\"%s\", fd=%d)", (void *)http, resource, fd));
|
||||
|
||||
if (!resource || fd < 0)
|
||||
{
|
||||
if (http)
|
||||
http->error = EINVAL;
|
||||
|
||||
return (HTTP_ERROR);
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
if (!http)
|
||||
if ((http = _cupsConnect()) == NULL)
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
|
||||
/*
|
||||
* Then send PUT requests to the HTTP server...
|
||||
@ -296,24 +295,34 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
|
||||
do
|
||||
{
|
||||
if (!_cups_strcasecmp(httpGetField(http, HTTP_FIELD_CONNECTION), "close"))
|
||||
{
|
||||
httpClearFields(http);
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
status = HTTP_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_printf(("2cupsPutFd: starting attempt, authstring=\"%s\"...",
|
||||
http->authstring));
|
||||
|
||||
httpClearFields(http);
|
||||
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
|
||||
httpSetField(http, HTTP_FIELD_TRANSFER_ENCODING, "chunked");
|
||||
httpSetExpect(http, HTTP_CONTINUE);
|
||||
httpSetExpect(http, HTTP_STATUS_CONTINUE);
|
||||
|
||||
if (httpPut(http, resource))
|
||||
{
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
status = HTTP_ERROR;
|
||||
status = HTTP_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
status = HTTP_UNAUTHORIZED;
|
||||
status = HTTP_STATUS_UNAUTHORIZED;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -325,9 +334,9 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
if (httpWait(http, 1000))
|
||||
status = httpUpdate(http);
|
||||
else
|
||||
status = HTTP_CONTINUE;
|
||||
status = HTTP_STATUS_CONTINUE;
|
||||
|
||||
if (status == HTTP_CONTINUE)
|
||||
if (status == HTTP_STATUS_CONTINUE)
|
||||
{
|
||||
/*
|
||||
* Copy the file...
|
||||
@ -338,21 +347,21 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
|
||||
if (httpCheck(http))
|
||||
{
|
||||
if ((status = httpUpdate(http)) != HTTP_CONTINUE)
|
||||
if ((status = httpUpdate(http)) != HTTP_STATUS_CONTINUE)
|
||||
break;
|
||||
}
|
||||
else
|
||||
httpWrite2(http, buffer, bytes);
|
||||
httpWrite2(http, buffer, (size_t)bytes);
|
||||
}
|
||||
|
||||
if (status == HTTP_CONTINUE)
|
||||
if (status == HTTP_STATUS_CONTINUE)
|
||||
{
|
||||
httpWrite2(http, buffer, 0);
|
||||
|
||||
while ((status = httpUpdate(http)) == HTTP_CONTINUE);
|
||||
while ((status = httpUpdate(http)) == HTTP_STATUS_CONTINUE);
|
||||
}
|
||||
|
||||
if (status == HTTP_ERROR && !retries)
|
||||
if (status == HTTP_STATUS_ERROR && !retries)
|
||||
{
|
||||
DEBUG_printf(("2cupsPutFd: retry on status %d", status));
|
||||
|
||||
@ -362,9 +371,9 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
httpFlush(http);
|
||||
|
||||
/* Reconnect... */
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
status = HTTP_ERROR;
|
||||
status = HTTP_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -374,7 +383,7 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
|
||||
DEBUG_printf(("2cupsPutFd: status=%d", status));
|
||||
|
||||
if (status == HTTP_UNAUTHORIZED)
|
||||
if (status == HTTP_STATUS_UNAUTHORIZED)
|
||||
{
|
||||
/*
|
||||
* Flush any error message...
|
||||
@ -388,47 +397,47 @@ cupsPutFd(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFA
|
||||
|
||||
if (cupsDoAuthentication(http, "PUT", resource))
|
||||
{
|
||||
status = HTTP_AUTHORIZATION_CANCELED;
|
||||
status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
break;
|
||||
}
|
||||
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
status = HTTP_ERROR;
|
||||
status = HTTP_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
#ifdef HAVE_SSL
|
||||
else if (status == HTTP_UPGRADE_REQUIRED)
|
||||
else if (status == HTTP_STATUS_UPGRADE_REQUIRED)
|
||||
{
|
||||
/* Flush any error message... */
|
||||
httpFlush(http);
|
||||
|
||||
/* Reconnect... */
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
status = HTTP_ERROR;
|
||||
status = HTTP_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Upgrade with encryption... */
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
|
||||
httpEncryption(http, HTTP_ENCRYPTION_REQUIRED);
|
||||
|
||||
/* Try again, this time with encryption enabled... */
|
||||
continue;
|
||||
}
|
||||
#endif /* HAVE_SSL */
|
||||
}
|
||||
while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED ||
|
||||
(status == HTTP_ERROR && retries < 2));
|
||||
while (status == HTTP_STATUS_UNAUTHORIZED || status == HTTP_STATUS_UPGRADE_REQUIRED ||
|
||||
(status == HTTP_STATUS_ERROR && retries < 2));
|
||||
|
||||
/*
|
||||
* See if we actually put the file or an error...
|
||||
*/
|
||||
|
||||
if (status != HTTP_CREATED)
|
||||
if (status != HTTP_STATUS_CREATED)
|
||||
{
|
||||
_cupsSetHTTPError(status);
|
||||
httpFlush(http);
|
||||
@ -446,7 +455,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/macOS 10.4@
|
||||
*/
|
||||
|
||||
http_status_t /* O - HTTP status */
|
||||
@ -467,7 +476,7 @@ cupsPutFile(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DE
|
||||
if (http)
|
||||
http->error = EINVAL;
|
||||
|
||||
return (HTTP_ERROR);
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -482,7 +491,7 @@ cupsPutFile(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DE
|
||||
|
||||
http->error = errno;
|
||||
|
||||
return (HTTP_ERROR);
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -495,8 +504,3 @@ cupsPutFile(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DE
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: getputfile.c 7359 2008-02-29 19:01:35Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,29 +1,16 @@
|
||||
/*
|
||||
* "$Id: globals.c 7870 2008-08-27 18:14:10Z mike $"
|
||||
* Global variable access routines for CUPS.
|
||||
*
|
||||
* Global variable access routines for CUPS.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Copyright 2007-2013 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _cupsGlobalLock() - Lock the global mutex.
|
||||
* _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.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -37,7 +24,10 @@
|
||||
* Local globals...
|
||||
*/
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
static int cups_global_index = 0;
|
||||
/* Next thread number */
|
||||
#endif /* DEBUG */
|
||||
static _cups_threadkey_t cups_globals_key = _CUPS_THREADKEY_INITIALIZER;
|
||||
/* Thread local storage key */
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
@ -212,9 +202,18 @@ cups_globals_alloc(void)
|
||||
memset(cg, 0, sizeof(_cups_globals_t));
|
||||
cg->encryption = (http_encryption_t)-1;
|
||||
cg->password_cb = (cups_password_cb2_t)_cupsGetPassword;
|
||||
cg->any_root = 1;
|
||||
cg->expired_certs = 1;
|
||||
cg->expired_root = 1;
|
||||
cg->trust_first = -1;
|
||||
cg->any_root = -1;
|
||||
cg->expired_certs = -1;
|
||||
cg->validate_certs = -1;
|
||||
|
||||
#ifdef DEBUG
|
||||
/*
|
||||
* Friendly thread ID for debugging...
|
||||
*/
|
||||
|
||||
cg->thread_id = ++ cups_global_index;
|
||||
#endif /* DEBUG */
|
||||
|
||||
/*
|
||||
* Then set directories as appropriate...
|
||||
@ -227,7 +226,7 @@ cups_globals_alloc(void)
|
||||
* Open the registry...
|
||||
*/
|
||||
|
||||
strcpy(installdir, "C:/Program Files/cups.org");
|
||||
strlcpy(installdir, "C:/Program Files/cups.org", sizeof(installdir));
|
||||
|
||||
if (!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\cups.org", 0, KEY_READ,
|
||||
&key))
|
||||
@ -349,7 +348,9 @@ cups_globals_free(_cups_globals_t *cg) /* I - Pointer to global data */
|
||||
|
||||
httpClose(cg->http);
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
_httpFreeCredentials(cg->tls_credentials);
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
cupsFileClose(cg->stdio_files[0]);
|
||||
cupsFileClose(cg->stdio_files[1]);
|
||||
@ -377,8 +378,3 @@ cups_globals_init(void)
|
||||
pthread_key_create(&cups_globals_key, (void (*)(void *))cups_globals_free);
|
||||
}
|
||||
#endif /* HAVE_PTHREAD_H */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: globals.c 7870 2008-08-27 18:14:10Z mike $".
|
||||
*/
|
||||
|
||||
245
cups/hash.c
Normal file
245
cups/hash.c
Normal file
@ -0,0 +1,245 @@
|
||||
/*
|
||||
* Hashing function for CUPS.
|
||||
*
|
||||
* Copyright 2015-2016 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cups-private.h"
|
||||
#ifdef __APPLE__
|
||||
# include <CommonCrypto/CommonDigest.h>
|
||||
#elif defined(HAVE_GNUTLS)
|
||||
# include <gnutls/crypto.h>
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsHashData()' - Perform a hash function on the given data.
|
||||
*
|
||||
* The "algorithm" argument can be any of the registered, non-deprecated IPP
|
||||
* hash algorithms for the "job-password-encryption" attribute, including
|
||||
* "sha" for SHA-1, "sha-256" for SHA2-256, etc.
|
||||
*
|
||||
* The "hash" argument points to a buffer of "hashsize" bytes and should be at
|
||||
* least 64 bytes in length for all of the supported algorithms.
|
||||
*
|
||||
* The returned hash is binary data.
|
||||
*
|
||||
* @since CUPS 2.2/macOS 10.12@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Size of hash or -1 on error */
|
||||
cupsHashData(const char *algorithm, /* I - Algorithm name */
|
||||
const void *data, /* I - Data to hash */
|
||||
size_t datalen, /* I - Length of data to hash */
|
||||
unsigned char *hash, /* I - Hash buffer */
|
||||
size_t hashsize) /* I - Size of hash buffer */
|
||||
{
|
||||
if (!algorithm || !data || datalen == 0 || !hash || hashsize == 0)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad arguments to function"), 1);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
if (!strcmp(algorithm, "sha"))
|
||||
{
|
||||
/*
|
||||
* SHA-1...
|
||||
*/
|
||||
|
||||
CC_SHA1_CTX ctx; /* SHA-1 context */
|
||||
|
||||
if (hashsize < CC_SHA1_DIGEST_LENGTH)
|
||||
goto too_small;
|
||||
|
||||
CC_SHA1_Init(&ctx);
|
||||
CC_SHA1_Update(&ctx, data, (CC_LONG)datalen);
|
||||
CC_SHA1_Final(hash, &ctx);
|
||||
|
||||
return (CC_SHA1_DIGEST_LENGTH);
|
||||
}
|
||||
else if (!strcmp(algorithm, "sha2-224"))
|
||||
{
|
||||
CC_SHA256_CTX ctx; /* SHA-224 context */
|
||||
|
||||
if (hashsize < CC_SHA224_DIGEST_LENGTH)
|
||||
goto too_small;
|
||||
|
||||
CC_SHA224_Init(&ctx);
|
||||
CC_SHA224_Update(&ctx, data, (CC_LONG)datalen);
|
||||
CC_SHA224_Final(hash, &ctx);
|
||||
|
||||
return (CC_SHA224_DIGEST_LENGTH);
|
||||
}
|
||||
else if (!strcmp(algorithm, "sha2-256"))
|
||||
{
|
||||
CC_SHA256_CTX ctx; /* SHA-256 context */
|
||||
|
||||
if (hashsize < CC_SHA256_DIGEST_LENGTH)
|
||||
goto too_small;
|
||||
|
||||
CC_SHA256_Init(&ctx);
|
||||
CC_SHA256_Update(&ctx, data, (CC_LONG)datalen);
|
||||
CC_SHA256_Final(hash, &ctx);
|
||||
|
||||
return (CC_SHA256_DIGEST_LENGTH);
|
||||
}
|
||||
else if (!strcmp(algorithm, "sha2-384"))
|
||||
{
|
||||
CC_SHA512_CTX ctx; /* SHA-384 context */
|
||||
|
||||
if (hashsize < CC_SHA384_DIGEST_LENGTH)
|
||||
goto too_small;
|
||||
|
||||
CC_SHA384_Init(&ctx);
|
||||
CC_SHA384_Update(&ctx, data, (CC_LONG)datalen);
|
||||
CC_SHA384_Final(hash, &ctx);
|
||||
|
||||
return (CC_SHA384_DIGEST_LENGTH);
|
||||
}
|
||||
else if (!strcmp(algorithm, "sha2-512"))
|
||||
{
|
||||
CC_SHA512_CTX ctx; /* SHA-512 context */
|
||||
|
||||
if (hashsize < CC_SHA512_DIGEST_LENGTH)
|
||||
goto too_small;
|
||||
|
||||
CC_SHA512_Init(&ctx);
|
||||
CC_SHA512_Update(&ctx, data, (CC_LONG)datalen);
|
||||
CC_SHA512_Final(hash, &ctx);
|
||||
|
||||
return (CC_SHA512_DIGEST_LENGTH);
|
||||
}
|
||||
else if (!strcmp(algorithm, "sha2-512_224"))
|
||||
{
|
||||
CC_SHA512_CTX ctx; /* SHA-512 context */
|
||||
unsigned char temp[CC_SHA512_DIGEST_LENGTH];
|
||||
/* SHA-512 hash */
|
||||
|
||||
/*
|
||||
* SHA2-512 truncated to 224 bits (28 bytes)...
|
||||
*/
|
||||
|
||||
if (hashsize < CC_SHA224_DIGEST_LENGTH)
|
||||
goto too_small;
|
||||
|
||||
CC_SHA512_Init(&ctx);
|
||||
CC_SHA512_Update(&ctx, data, (CC_LONG)datalen);
|
||||
CC_SHA512_Final(temp, &ctx);
|
||||
|
||||
memcpy(hash, temp, CC_SHA224_DIGEST_LENGTH);
|
||||
|
||||
return (CC_SHA224_DIGEST_LENGTH);
|
||||
}
|
||||
else if (!strcmp(algorithm, "sha2-512_256"))
|
||||
{
|
||||
CC_SHA512_CTX ctx; /* SHA-512 context */
|
||||
unsigned char temp[CC_SHA512_DIGEST_LENGTH];
|
||||
/* SHA-512 hash */
|
||||
|
||||
/*
|
||||
* SHA2-512 truncated to 256 bits (32 bytes)...
|
||||
*/
|
||||
|
||||
if (hashsize < CC_SHA256_DIGEST_LENGTH)
|
||||
goto too_small;
|
||||
|
||||
CC_SHA512_Init(&ctx);
|
||||
CC_SHA512_Update(&ctx, data, (CC_LONG)datalen);
|
||||
CC_SHA512_Final(temp, &ctx);
|
||||
|
||||
memcpy(hash, temp, CC_SHA256_DIGEST_LENGTH);
|
||||
|
||||
return (CC_SHA256_DIGEST_LENGTH);
|
||||
}
|
||||
|
||||
#elif defined(HAVE_GNUTLS)
|
||||
gnutls_digest_algorithm_t alg = GNUTLS_DIG_UNKNOWN;
|
||||
/* Algorithm */
|
||||
unsigned char temp[64]; /* Temporary hash buffer */
|
||||
size_t tempsize = 0; /* Truncate to this size? */
|
||||
|
||||
if (!strcmp(algorithm, "sha"))
|
||||
alg = GNUTLS_DIG_SHA1;
|
||||
else if (!strcmp(algorithm, "sha2-224"))
|
||||
alg = GNUTLS_DIG_SHA224;
|
||||
else if (!strcmp(algorithm, "sha2-256"))
|
||||
alg = GNUTLS_DIG_SHA256;
|
||||
else if (!strcmp(algorithm, "sha2-384"))
|
||||
alg = GNUTLS_DIG_SHA384;
|
||||
else if (!strcmp(algorithm, "sha2-512"))
|
||||
alg = GNUTLS_DIG_SHA512;
|
||||
else if (!strcmp(algorithm, "sha2-512_224"))
|
||||
{
|
||||
alg = GNUTLS_DIG_SHA512;
|
||||
tempsize = 28;
|
||||
}
|
||||
else if (!strcmp(algorithm, "sha2-512_256"))
|
||||
{
|
||||
alg = GNUTLS_DIG_SHA512;
|
||||
tempsize = 32;
|
||||
}
|
||||
|
||||
if (alg != GNUTLS_DIG_UNKNOWN)
|
||||
{
|
||||
if (tempsize > 0)
|
||||
{
|
||||
/*
|
||||
* Truncate result to tempsize bytes...
|
||||
*/
|
||||
|
||||
if (hashsize < tempsize)
|
||||
goto too_small;
|
||||
|
||||
gnutls_hash_fast(alg, data, datalen, temp);
|
||||
memcpy(hash, temp, tempsize);
|
||||
|
||||
return ((ssize_t)tempsize);
|
||||
}
|
||||
|
||||
if (hashsize < gnutls_hash_get_len(alg))
|
||||
goto too_small;
|
||||
|
||||
gnutls_hash_fast(alg, data, datalen, hash);
|
||||
|
||||
return (gnutls_hash_get_len(alg));
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
* No hash support without CommonCrypto or GNU TLS...
|
||||
*/
|
||||
|
||||
if (hashsize < 64)
|
||||
goto too_small;
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
/*
|
||||
* Unknown hash algorithm...
|
||||
*/
|
||||
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unknown hash algorithm."), 1);
|
||||
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* We get here if the buffer is too small.
|
||||
*/
|
||||
|
||||
too_small:
|
||||
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Hash buffer too small."), 1);
|
||||
return (-1);
|
||||
}
|
||||
385
cups/http-addr.c
385
cups/http-addr.c
@ -1,29 +1,16 @@
|
||||
/*
|
||||
* "$Id: http-addr.c 7910 2008-09-06 00:25:17Z mike $"
|
||||
* HTTP address routines for CUPS.
|
||||
*
|
||||
* HTTP address routines for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* httpAddrAny() - Check for the "any" address.
|
||||
* httpAddrEqual() - Compare two addresses.
|
||||
* httpAddrLocalhost() - Check for the local loopback address.
|
||||
* httpAddrLookup() - Lookup the hostname associated with the address.
|
||||
* _httpAddrPort() - Get the port number associated with an address.
|
||||
* _httpAddrSetPort() - Set the port number associated with an address.
|
||||
* httpAddrString() - Convert an IP address to a dotted string.
|
||||
* httpGetHostByName() - Lookup a hostname or IP address, and return
|
||||
* address records for the specified name.
|
||||
* httpGetHostname() - Get the FQDN for the local system.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -31,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "cups-private.h"
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_RESOLV_H
|
||||
# include <resolv.h>
|
||||
#endif /* HAVE_RESOLV_H */
|
||||
@ -43,7 +31,7 @@
|
||||
/*
|
||||
* 'httpAddrAny()' - Check for the "any" address.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 if "any", 0 otherwise */
|
||||
@ -66,10 +54,41 @@ httpAddrAny(const http_addr_t *addr) /* I - Address to check */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAddrClose()' - Close a socket created by @link httpAddrConnect@ or
|
||||
* @link httpAddrListen@.
|
||||
*
|
||||
* Pass @code NULL@ for sockets created with @link httpAddrConnect@ and the
|
||||
* listen address for sockets created with @link httpAddrListen@. This will
|
||||
* ensure that domain sockets are removed when closed.
|
||||
*
|
||||
* @since CUPS 2.0/OS 10.10@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on failure */
|
||||
httpAddrClose(http_addr_t *addr, /* I - Listen address or @code NULL@ */
|
||||
int fd) /* I - Socket file descriptor */
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (closesocket(fd))
|
||||
#else
|
||||
if (close(fd))
|
||||
#endif /* WIN32 */
|
||||
return (-1);
|
||||
|
||||
#ifdef AF_LOCAL
|
||||
if (addr && addr->addr.sa_family == AF_LOCAL)
|
||||
return (unlink(addr->un.sun_path));
|
||||
#endif /* AF_LOCAL */
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAddrEqual()' - Compare two addresses.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 if equal, 0 if not */
|
||||
@ -102,7 +121,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - Length in bytes */
|
||||
@ -118,8 +137,7 @@ httpAddrLength(const http_addr_t *addr) /* I - Address */
|
||||
#endif /* AF_INET6 */
|
||||
#ifdef AF_LOCAL
|
||||
if (addr->addr.sa_family == AF_LOCAL)
|
||||
return (offsetof(struct sockaddr_un, sun_path) +
|
||||
strlen(addr->un.sun_path) + 1);
|
||||
return ((int)(offsetof(struct sockaddr_un, sun_path) + strlen(addr->un.sun_path) + 1));
|
||||
else
|
||||
#endif /* AF_LOCAL */
|
||||
if (addr->addr.sa_family == AF_INET)
|
||||
@ -130,10 +148,137 @@ httpAddrLength(const http_addr_t *addr) /* I - Address */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAddrListen()' - Create a listening socket bound to the specified
|
||||
* address and port.
|
||||
*
|
||||
* @since CUPS 1.7/macOS 10.9@
|
||||
*/
|
||||
|
||||
int /* O - Socket or -1 on error */
|
||||
httpAddrListen(http_addr_t *addr, /* I - Address to bind to */
|
||||
int port) /* I - Port number to bind to */
|
||||
{
|
||||
int fd = -1, /* Socket */
|
||||
val, /* Socket value */
|
||||
status; /* Bind status */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!addr || port < 0)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Create the socket and set options...
|
||||
*/
|
||||
|
||||
if ((fd = socket(addr->addr.sa_family, SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
_cupsSetHTTPError(HTTP_STATUS_ERROR);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
val = 1;
|
||||
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, CUPS_SOCAST &val, sizeof(val));
|
||||
|
||||
#ifdef IPV6_V6ONLY
|
||||
if (addr->addr.sa_family == AF_INET6)
|
||||
setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, CUPS_SOCAST &val, sizeof(val));
|
||||
#endif /* IPV6_V6ONLY */
|
||||
|
||||
/*
|
||||
* Bind the socket...
|
||||
*/
|
||||
|
||||
#ifdef AF_LOCAL
|
||||
if (addr->addr.sa_family == AF_LOCAL)
|
||||
{
|
||||
mode_t mask; /* Umask setting */
|
||||
|
||||
/*
|
||||
* Remove any existing domain socket file...
|
||||
*/
|
||||
|
||||
unlink(addr->un.sun_path);
|
||||
|
||||
/*
|
||||
* Save the current umask and set it to 0 so that all users can access
|
||||
* the domain socket...
|
||||
*/
|
||||
|
||||
mask = umask(0);
|
||||
|
||||
/*
|
||||
* Bind the domain socket...
|
||||
*/
|
||||
|
||||
status = bind(fd, (struct sockaddr *)addr, (socklen_t)httpAddrLength(addr));
|
||||
|
||||
/*
|
||||
* Restore the umask and fix permissions...
|
||||
*/
|
||||
|
||||
umask(mask);
|
||||
chmod(addr->un.sun_path, 0140777);
|
||||
}
|
||||
else
|
||||
#endif /* AF_LOCAL */
|
||||
{
|
||||
_httpAddrSetPort(addr, port);
|
||||
|
||||
status = bind(fd, (struct sockaddr *)addr, (socklen_t)httpAddrLength(addr));
|
||||
}
|
||||
|
||||
if (status)
|
||||
{
|
||||
_cupsSetHTTPError(HTTP_STATUS_ERROR);
|
||||
|
||||
close(fd);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Listen...
|
||||
*/
|
||||
|
||||
if (listen(fd, 5))
|
||||
{
|
||||
_cupsSetHTTPError(HTTP_STATUS_ERROR);
|
||||
|
||||
close(fd);
|
||||
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Close on exec...
|
||||
*/
|
||||
|
||||
#ifndef WIN32
|
||||
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
|
||||
#endif /* !WIN32 */
|
||||
|
||||
#ifdef SO_NOSIGPIPE
|
||||
/*
|
||||
* Disable SIGPIPE for this socket.
|
||||
*/
|
||||
|
||||
val = 1;
|
||||
setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, CUPS_SOCAST &val, sizeof(val));
|
||||
#endif /* SO_NOSIGPIPE */
|
||||
|
||||
return (fd);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAddrLocalhost()' - Check for the local loopback address.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 1 if local host, 0 otherwise */
|
||||
@ -162,17 +307,10 @@ httpAddrLocalhost(
|
||||
}
|
||||
|
||||
|
||||
#ifdef __sgi
|
||||
# define ADDR_CAST (struct sockaddr *)
|
||||
#else
|
||||
# define ADDR_CAST (char *)
|
||||
#endif /* __sgi */
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAddrLookup()' - Lookup the hostname associated with the address.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Host name */
|
||||
@ -185,8 +323,7 @@ httpAddrLookup(
|
||||
/* Global data */
|
||||
|
||||
|
||||
DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)", addr, name,
|
||||
namelen));
|
||||
DEBUG_printf(("httpAddrLookup(addr=%p, name=%p, namelen=%d)", (void *)addr, (void *)name, namelen));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -203,7 +340,7 @@ httpAddrLookup(
|
||||
#ifdef AF_LOCAL
|
||||
if (addr->addr.sa_family == AF_LOCAL)
|
||||
{
|
||||
strlcpy(name, addr->un.sun_path, namelen);
|
||||
strlcpy(name, addr->un.sun_path, (size_t)namelen);
|
||||
return (name);
|
||||
}
|
||||
#endif /* AF_LOCAL */
|
||||
@ -214,7 +351,7 @@ httpAddrLookup(
|
||||
|
||||
if (httpAddrLocalhost(addr))
|
||||
{
|
||||
strlcpy(name, "localhost", namelen);
|
||||
strlcpy(name, "localhost", (size_t)namelen);
|
||||
return (name);
|
||||
}
|
||||
|
||||
@ -249,8 +386,7 @@ httpAddrLookup(
|
||||
* do...
|
||||
*/
|
||||
|
||||
int error = getnameinfo(&addr->addr, httpAddrLength(addr), name, namelen,
|
||||
NULL, 0, 0);
|
||||
int error = getnameinfo(&addr->addr, (socklen_t)httpAddrLength(addr), name, (socklen_t)namelen, NULL, 0, 0);
|
||||
|
||||
if (error)
|
||||
{
|
||||
@ -267,11 +403,11 @@ httpAddrLookup(
|
||||
|
||||
# ifdef AF_INET6
|
||||
if (addr->addr.sa_family == AF_INET6)
|
||||
host = gethostbyaddr(ADDR_CAST &(addr->ipv6.sin6_addr),
|
||||
host = gethostbyaddr((char *)&(addr->ipv6.sin6_addr),
|
||||
sizeof(struct in_addr), AF_INET6);
|
||||
else
|
||||
# endif /* AF_INET6 */
|
||||
host = gethostbyaddr(ADDR_CAST &(addr->ipv4.sin_addr),
|
||||
host = gethostbyaddr((char *)&(addr->ipv4.sin_addr),
|
||||
sizeof(struct in_addr), AF_INET);
|
||||
|
||||
if (host == NULL)
|
||||
@ -286,7 +422,7 @@ httpAddrLookup(
|
||||
return (httpAddrString(addr, name, namelen));
|
||||
}
|
||||
|
||||
strlcpy(name, host->h_name, namelen);
|
||||
strlcpy(name, host->h_name, (size_t)namelen);
|
||||
}
|
||||
#endif /* HAVE_GETNAMEINFO */
|
||||
|
||||
@ -297,14 +433,30 @@ httpAddrLookup(
|
||||
|
||||
|
||||
/*
|
||||
* '_httpAddrPort()' - Get the port number associated with an address.
|
||||
* 'httpAddrFamily()' - Get the address family of an address.
|
||||
*/
|
||||
|
||||
int /* O - Address family */
|
||||
httpAddrFamily(http_addr_t *addr) /* I - Address */
|
||||
{
|
||||
if (addr)
|
||||
return (addr->addr.sa_family);
|
||||
else
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAddrPort()' - Get the port number associated with an address.
|
||||
*
|
||||
* @since CUPS 1.7/macOS 10.9@
|
||||
*/
|
||||
|
||||
int /* O - Port number */
|
||||
_httpAddrPort(http_addr_t *addr) /* I - Address */
|
||||
httpAddrPort(http_addr_t *addr) /* I - Address */
|
||||
{
|
||||
if (!addr)
|
||||
return (ippPort());
|
||||
return (-1);
|
||||
#ifdef AF_INET6
|
||||
else if (addr->addr.sa_family == AF_INET6)
|
||||
return (ntohs(addr->ipv6.sin6_port));
|
||||
@ -312,7 +464,7 @@ _httpAddrPort(http_addr_t *addr) /* I - Address */
|
||||
else if (addr->addr.sa_family == AF_INET)
|
||||
return (ntohs(addr->ipv4.sin_port));
|
||||
else
|
||||
return (ippPort());
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@ -340,7 +492,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Numeric address string */
|
||||
@ -348,7 +500,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
char *s, /* I - String buffer */
|
||||
int slen) /* I - Length of string */
|
||||
{
|
||||
DEBUG_printf(("httpAddrString(addr=%p, s=%p, slen=%d)", addr, s, slen));
|
||||
DEBUG_printf(("httpAddrString(addr=%p, s=%p, slen=%d)", (void *)addr, (void *)s, slen));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -366,9 +518,9 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
if (addr->addr.sa_family == AF_LOCAL)
|
||||
{
|
||||
if (addr->un.sun_path[0] == '/')
|
||||
strlcpy(s, addr->un.sun_path, slen);
|
||||
strlcpy(s, addr->un.sun_path, (size_t)slen);
|
||||
else
|
||||
strlcpy(s, "localhost", slen);
|
||||
strlcpy(s, "localhost", (size_t)slen);
|
||||
}
|
||||
else
|
||||
#endif /* AF_LOCAL */
|
||||
@ -376,10 +528,9 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
{
|
||||
unsigned temp; /* Temporary address */
|
||||
|
||||
|
||||
temp = ntohl(addr->ipv4.sin_addr.s_addr);
|
||||
|
||||
snprintf(s, slen, "%d.%d.%d.%d", (temp >> 24) & 255,
|
||||
snprintf(s, (size_t)slen, "%d.%d.%d.%d", (temp >> 24) & 255,
|
||||
(temp >> 16) & 255, (temp >> 8) & 255, temp & 255);
|
||||
}
|
||||
#ifdef AF_INET6
|
||||
@ -389,8 +540,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
temps[64]; /* Temporary string for address */
|
||||
|
||||
# ifdef HAVE_GETNAMEINFO
|
||||
if (getnameinfo(&addr->addr, httpAddrLength(addr), temps, sizeof(temps),
|
||||
NULL, 0, NI_NUMERICHOST))
|
||||
if (getnameinfo(&addr->addr, (socklen_t)httpAddrLength(addr), temps, sizeof(temps), NULL, 0, NI_NUMERICHOST))
|
||||
{
|
||||
/*
|
||||
* If we get an error back, then the address type is not supported
|
||||
@ -421,8 +571,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
{
|
||||
temp = ntohl(addr->ipv6.sin6_addr.s6_addr32[i]);
|
||||
|
||||
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
|
||||
(temp >> 16) & 0xffff);
|
||||
snprintf(sptr, sizeof(temps) - (size_t)(sptr - temps), "%s%x", prefix, (temp >> 16) & 0xffff);
|
||||
prefix = ":";
|
||||
sptr += strlen(sptr);
|
||||
|
||||
@ -430,7 +579,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
|
||||
if (temp || i == 3 || addr->ipv6.sin6_addr.s6_addr32[i + 1])
|
||||
{
|
||||
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix, temp);
|
||||
snprintf(sptr, sizeof(temps) - (size_t)(sptr - temps), "%s%x", prefix, temp);
|
||||
sptr += strlen(sptr);
|
||||
}
|
||||
}
|
||||
@ -442,7 +591,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
|
||||
if (i < 4)
|
||||
{
|
||||
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s:", prefix);
|
||||
snprintf(sptr, sizeof(temps) - (size_t)(sptr - temps), "%s:", prefix);
|
||||
prefix = ":";
|
||||
sptr += strlen(sptr);
|
||||
|
||||
@ -453,13 +602,11 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
if ((temp & 0xffff0000) ||
|
||||
(i > 0 && addr->ipv6.sin6_addr.s6_addr32[i - 1]))
|
||||
{
|
||||
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
|
||||
(temp >> 16) & 0xffff);
|
||||
snprintf(sptr, sizeof(temps) - (size_t)(sptr - temps), "%s%x", prefix, (temp >> 16) & 0xffff);
|
||||
sptr += strlen(sptr);
|
||||
}
|
||||
|
||||
snprintf(sptr, sizeof(temps) - (sptr - temps), "%s%x", prefix,
|
||||
temp & 0xffff);
|
||||
snprintf(sptr, sizeof(temps) - (size_t)(sptr - temps), "%s%x", prefix, temp & 0xffff);
|
||||
sptr += strlen(sptr);
|
||||
}
|
||||
}
|
||||
@ -477,7 +624,7 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
* Empty at end...
|
||||
*/
|
||||
|
||||
strlcpy(sptr, "::", sizeof(temps) - (sptr - temps));
|
||||
strlcpy(sptr, "::", sizeof(temps) - (size_t)(sptr - temps));
|
||||
}
|
||||
}
|
||||
# endif /* HAVE_GETNAMEINFO */
|
||||
@ -486,11 +633,11 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
* Add "[v1." and "]" around IPv6 address to convert to URI form.
|
||||
*/
|
||||
|
||||
snprintf(s, slen, "[v1.%s]", temps);
|
||||
snprintf(s, (size_t)slen, "[v1.%s]", temps);
|
||||
}
|
||||
#endif /* AF_INET6 */
|
||||
else
|
||||
strlcpy(s, "UNKNOWN", slen);
|
||||
strlcpy(s, "UNKNOWN", (size_t)slen);
|
||||
|
||||
DEBUG_printf(("1httpAddrString: returning \"%s\"...", s));
|
||||
|
||||
@ -498,6 +645,24 @@ httpAddrString(const http_addr_t *addr, /* I - Address to convert */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpGetAddress()' - Get the address of the connected peer of a connection.
|
||||
*
|
||||
* Returns @code NULL@ if the socket is currently unconnected.
|
||||
*
|
||||
* @since CUPS 2.0/OS 10.10@
|
||||
*/
|
||||
|
||||
http_addr_t * /* O - Connected address or @code NULL@ */
|
||||
httpGetAddress(http_t *http) /* I - HTTP connection */
|
||||
{
|
||||
if (http)
|
||||
return (http->hostaddr);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpGetHostByName()' - Lookup a hostname or IPv4 address, and return
|
||||
* address records for the specified name.
|
||||
@ -547,7 +712,7 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
|
||||
cg->hostent.h_name = (char *)name;
|
||||
cg->hostent.h_aliases = NULL;
|
||||
cg->hostent.h_addrtype = AF_LOCAL;
|
||||
cg->hostent.h_length = strlen(name) + 1;
|
||||
cg->hostent.h_length = (int)strlen(name) + 1;
|
||||
cg->hostent.h_addr_list = cg->ip_ptrs;
|
||||
cg->ip_ptrs[0] = (char *)name;
|
||||
cg->ip_ptrs[1] = NULL;
|
||||
@ -573,8 +738,9 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
|
||||
if (ip[0] > 255 || ip[1] > 255 || ip[2] > 255 || ip[3] > 255)
|
||||
return (NULL); /* Invalid byte ranges! */
|
||||
|
||||
cg->ip_addr = htonl(((((((ip[0] << 8) | ip[1]) << 8) | ip[2]) << 8) |
|
||||
ip[3]));
|
||||
cg->ip_addr = htonl((((((((unsigned)ip[0] << 8) | (unsigned)ip[1]) << 8) |
|
||||
(unsigned)ip[2]) << 8) |
|
||||
(unsigned)ip[3]));
|
||||
|
||||
/*
|
||||
* Fill in the host entry and return it...
|
||||
@ -610,11 +776,12 @@ httpGetHostByName(const char *name) /* I - Hostname or IP address */
|
||||
* 'httpGetHostname()' - Get the FQDN for the connection or local system.
|
||||
*
|
||||
* When "http" points to a connected socket, return the hostname or
|
||||
* address that was used in the call to httpConnect() or httpConnectEncrypt().
|
||||
* address that was used in the call to httpConnect() or httpConnectEncrypt(),
|
||||
* or the address of the client for the connection from httpAcceptConnection().
|
||||
* 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/macOS 10.5@
|
||||
*/
|
||||
|
||||
const char * /* O - FQDN for connection or system */
|
||||
@ -622,15 +789,19 @@ httpGetHostname(http_t *http, /* I - HTTP connection or NULL */
|
||||
char *s, /* I - String buffer for name */
|
||||
int slen) /* I - Size of buffer */
|
||||
{
|
||||
if (!s || slen <= 1)
|
||||
return (NULL);
|
||||
|
||||
if (http)
|
||||
{
|
||||
if (http->hostname[0] == '/')
|
||||
strlcpy(s, "localhost", slen);
|
||||
if (!s || slen <= 1)
|
||||
{
|
||||
if (http->hostname[0] == '/')
|
||||
return ("localhost");
|
||||
else
|
||||
return (http->hostname);
|
||||
}
|
||||
else if (http->hostname[0] == '/')
|
||||
strlcpy(s, "localhost", (size_t)slen);
|
||||
else
|
||||
strlcpy(s, http->hostname, slen);
|
||||
strlcpy(s, http->hostname, (size_t)slen);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -638,8 +809,11 @@ httpGetHostname(http_t *http, /* I - HTTP connection or NULL */
|
||||
* Get the hostname...
|
||||
*/
|
||||
|
||||
if (gethostname(s, slen) < 0)
|
||||
strlcpy(s, "localhost", slen);
|
||||
if (!s || slen <= 1)
|
||||
return (NULL);
|
||||
|
||||
if (gethostname(s, (size_t)slen) < 0)
|
||||
strlcpy(s, "localhost", (size_t)slen);
|
||||
|
||||
if (!strchr(s, '.'))
|
||||
{
|
||||
@ -663,7 +837,7 @@ httpGetHostname(http_t *http, /* I - HTTP connection or NULL */
|
||||
* Append ".local." to the hostname we get...
|
||||
*/
|
||||
|
||||
snprintf(s, slen, "%s.local.", localStr);
|
||||
snprintf(s, (size_t)slen, "%s.local.", localStr);
|
||||
}
|
||||
|
||||
if (local)
|
||||
@ -684,10 +858,17 @@ httpGetHostname(http_t *http, /* I - HTTP connection or NULL */
|
||||
* Use the resolved hostname...
|
||||
*/
|
||||
|
||||
strlcpy(s, host->h_name, slen);
|
||||
strlcpy(s, host->h_name, (size_t)slen);
|
||||
}
|
||||
#endif /* HAVE_SCDYNAMICSTORECOPYCOMPUTERNAME */
|
||||
}
|
||||
|
||||
/*
|
||||
* Make sure .local hostnames end with a period...
|
||||
*/
|
||||
|
||||
if (strlen(s) > 6 && !strcmp(s + strlen(s) - 6, ".local"))
|
||||
strlcat(s, ".", (size_t)slen);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -699,5 +880,41 @@ httpGetHostname(http_t *http, /* I - HTTP connection or NULL */
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: http-addr.c 7910 2008-09-06 00:25:17Z mike $".
|
||||
* 'httpResolveHostname()' - Resolve the hostname of the HTTP connection
|
||||
* address.
|
||||
*
|
||||
* @since CUPS 2.0/OS 10.10@
|
||||
*/
|
||||
|
||||
const char * /* O - Resolved hostname or @code NULL@ */
|
||||
httpResolveHostname(http_t *http, /* I - HTTP connection */
|
||||
char *buffer, /* I - Hostname buffer */
|
||||
size_t bufsize) /* I - Size of buffer */
|
||||
{
|
||||
if (!http)
|
||||
return (NULL);
|
||||
|
||||
if (isdigit(http->hostname[0] & 255) || http->hostname[0] == '[')
|
||||
{
|
||||
char temp[1024]; /* Temporary string */
|
||||
|
||||
if (httpAddrLookup(http->hostaddr, temp, sizeof(temp)))
|
||||
strlcpy(http->hostname, temp, sizeof(http->hostname));
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (buffer)
|
||||
{
|
||||
if (http->hostname[0] == '/')
|
||||
strlcpy(buffer, "localhost", bufsize);
|
||||
else
|
||||
strlcpy(buffer, http->hostname, bufsize);
|
||||
|
||||
return (buffer);
|
||||
}
|
||||
else if (http->hostname[0] == '/')
|
||||
return ("localhost");
|
||||
else
|
||||
return (http->hostname);
|
||||
}
|
||||
|
||||
@ -1,24 +1,16 @@
|
||||
/*
|
||||
* "$Id: http-addrlist.c 7910 2008-09-06 00:25:17Z mike $"
|
||||
* HTTP address list routines for CUPS.
|
||||
*
|
||||
* HTTP address list routines for CUPS.
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* httpAddrConnect() - Connect to any of the addresses in the list.
|
||||
* httpAddrConnect2() - Connect to any of the addresses in the list with a
|
||||
* timeout and optional cancel.
|
||||
* httpAddrFreeList() - Free an address list.
|
||||
* httpAddrGetList() - Get a list of addresses for a hostname.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -40,7 +32,7 @@
|
||||
/*
|
||||
* 'httpAddrConnect()' - Connect to any of the addresses in the list.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
http_addrlist_t * /* O - Connected address or NULL on failure */
|
||||
@ -48,7 +40,7 @@ httpAddrConnect(
|
||||
http_addrlist_t *addrlist, /* I - List of potential addresses */
|
||||
int *sock) /* O - Socket */
|
||||
{
|
||||
DEBUG_printf(("httpAddrConnect(addrlist=%p, sock=%p)", addrlist, sock));
|
||||
DEBUG_printf(("httpAddrConnect(addrlist=%p, sock=%p)", (void *)addrlist, (void *)sock));
|
||||
|
||||
return (httpAddrConnect2(addrlist, sock, 30000, NULL));
|
||||
}
|
||||
@ -58,7 +50,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.7/macOS 10.9@
|
||||
*/
|
||||
|
||||
http_addrlist_t * /* O - Connected address or NULL on failure */
|
||||
@ -69,268 +61,370 @@ httpAddrConnect2(
|
||||
int *cancel) /* I - Pointer to "cancel" variable */
|
||||
{
|
||||
int val; /* Socket option value */
|
||||
#ifndef WIN32
|
||||
int flags; /* Socket flags */
|
||||
#endif /* !WIN32 */
|
||||
int remaining; /* Remaining timeout */
|
||||
int i, /* Looping var */
|
||||
nfds, /* Number of file descriptors */
|
||||
fds[100], /* Socket file descriptors */
|
||||
result; /* Result from select() or poll() */
|
||||
http_addrlist_t *addrs[100]; /* Addresses */
|
||||
#ifndef HAVE_POLL
|
||||
int max_fd = -1; /* Highest file descriptor */
|
||||
#endif /* !HAVE_POLL */
|
||||
#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
|
||||
struct pollfd pfd; /* Polled file descriptor */
|
||||
struct pollfd pfds[100]; /* Polled file descriptors */
|
||||
# else
|
||||
fd_set input_set, /* select() input set */
|
||||
output_set; /* select() output set */
|
||||
output_set, /* select() output set */
|
||||
error_set; /* select() error set */
|
||||
struct timeval timeout; /* Timeout */
|
||||
# endif /* HAVE_POLL */
|
||||
int nfds; /* Result from select()/poll() */
|
||||
#endif /* O_NONBLOCK */
|
||||
#ifdef DEBUG
|
||||
socklen_t len; /* Length of value */
|
||||
http_addr_t peer; /* Peer address */
|
||||
char temp[256]; /* Temporary address string */
|
||||
#endif /* DEBUG */
|
||||
|
||||
|
||||
DEBUG_printf(("httpAddrConnect2(addrlist=%p, sock=%p, msec=%d, cancel=%p)",
|
||||
addrlist, sock, msec, cancel));
|
||||
DEBUG_printf(("httpAddrConnect2(addrlist=%p, sock=%p, msec=%d, cancel=%p)", (void *)addrlist, (void *)sock, msec, (void *)cancel));
|
||||
|
||||
if (!sock)
|
||||
{
|
||||
errno = EINVAL;
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (cancel && *cancel)
|
||||
return (NULL);
|
||||
|
||||
if (msec <= 0 || getenv("CUPS_DISABLE_ASYNC_CONNECT"))
|
||||
if (msec <= 0)
|
||||
msec = INT_MAX;
|
||||
|
||||
/*
|
||||
* Loop through each address until we connect or run out of addresses...
|
||||
*/
|
||||
|
||||
while (addrlist)
|
||||
nfds = 0;
|
||||
remaining = msec;
|
||||
|
||||
while (remaining > 0)
|
||||
{
|
||||
if (cancel && *cancel)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Create the socket...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("2httpAddrConnect2: Trying %s:%d...",
|
||||
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
|
||||
_httpAddrPort(&(addrlist->addr))));
|
||||
|
||||
if ((*sock = (int)socket(_httpAddrFamily(&(addrlist->addr)), SOCK_STREAM,
|
||||
0)) < 0)
|
||||
{
|
||||
/*
|
||||
* Don't abort yet, as this could just be an issue with the local
|
||||
* system not being configured with IPv4/IPv6/domain socket enabled...
|
||||
*/
|
||||
while (nfds > 0)
|
||||
{
|
||||
nfds --;
|
||||
httpAddrClose(NULL, fds[nfds]);
|
||||
}
|
||||
|
||||
addrlist = addrlist->next;
|
||||
continue;
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set options...
|
||||
*/
|
||||
if (addrlist && nfds < (int)(sizeof(fds) / sizeof(fds[0])))
|
||||
{
|
||||
/*
|
||||
* Create the socket...
|
||||
*/
|
||||
|
||||
val = 1;
|
||||
#ifdef WIN32
|
||||
setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, (const char *)&val,
|
||||
sizeof(val));
|
||||
#else
|
||||
setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val));
|
||||
#endif /* WIN32 */
|
||||
DEBUG_printf(("2httpAddrConnect2: Trying %s:%d...", httpAddrString(&(addrlist->addr), temp, sizeof(temp)), httpAddrPort(&(addrlist->addr))));
|
||||
|
||||
if ((fds[nfds] = (int)socket(httpAddrFamily(&(addrlist->addr)), SOCK_STREAM, 0)) < 0)
|
||||
{
|
||||
/*
|
||||
* Don't abort yet, as this could just be an issue with the local
|
||||
* system not being configured with IPv4/IPv6/domain socket enabled.
|
||||
*
|
||||
* Just skip this address...
|
||||
*/
|
||||
|
||||
addrlist = addrlist->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set options...
|
||||
*/
|
||||
|
||||
val = 1;
|
||||
setsockopt(fds[nfds], SOL_SOCKET, SO_REUSEADDR, CUPS_SOCAST &val, sizeof(val));
|
||||
|
||||
#ifdef SO_REUSEPORT
|
||||
val = 1;
|
||||
setsockopt(*sock, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val));
|
||||
val = 1;
|
||||
setsockopt(fds[nfds], SOL_SOCKET, SO_REUSEPORT, CUPS_SOCAST &val, sizeof(val));
|
||||
#endif /* SO_REUSEPORT */
|
||||
|
||||
#ifdef SO_NOSIGPIPE
|
||||
val = 1;
|
||||
setsockopt(*sock, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val));
|
||||
val = 1;
|
||||
setsockopt(fds[nfds], SOL_SOCKET, SO_NOSIGPIPE, CUPS_SOCAST &val, sizeof(val));
|
||||
#endif /* SO_NOSIGPIPE */
|
||||
|
||||
/*
|
||||
* Using TCP_NODELAY improves responsiveness, especially on systems
|
||||
* with a slow loopback interface...
|
||||
*/
|
||||
/*
|
||||
* Using TCP_NODELAY improves responsiveness, especially on systems
|
||||
* with a slow loopback interface...
|
||||
*/
|
||||
|
||||
val = 1;
|
||||
#ifdef WIN32
|
||||
setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&val,
|
||||
sizeof(val));
|
||||
#else
|
||||
setsockopt(*sock, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
|
||||
#endif /* WIN32 */
|
||||
val = 1;
|
||||
setsockopt(fds[nfds], IPPROTO_TCP, TCP_NODELAY, CUPS_SOCAST &val, sizeof(val));
|
||||
|
||||
#ifdef FD_CLOEXEC
|
||||
/*
|
||||
* Close this socket when starting another process...
|
||||
*/
|
||||
/*
|
||||
* Close this socket when starting another process...
|
||||
*/
|
||||
|
||||
fcntl(*sock, F_SETFD, FD_CLOEXEC);
|
||||
fcntl(fds[nfds], F_SETFD, FD_CLOEXEC);
|
||||
#endif /* FD_CLOEXEC */
|
||||
|
||||
#ifdef O_NONBLOCK
|
||||
/*
|
||||
* Do an asynchronous connect by setting the socket non-blocking...
|
||||
*/
|
||||
/*
|
||||
* Do an asynchronous connect by setting the socket non-blocking...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("httpAddrConnect2: Setting non-blocking connect()"));
|
||||
DEBUG_printf(("httpAddrConnect2: Setting non-blocking connect()"));
|
||||
|
||||
flags = fcntl(*sock, F_GETFL, 0);
|
||||
if (msec != INT_MAX)
|
||||
{
|
||||
DEBUG_puts("httpAddrConnect2: Setting non-blocking connect()");
|
||||
|
||||
fcntl(*sock, F_SETFL, flags | O_NONBLOCK);
|
||||
}
|
||||
flags = fcntl(fds[nfds], F_GETFL, 0);
|
||||
fcntl(fds[nfds], F_SETFL, flags | O_NONBLOCK);
|
||||
#endif /* O_NONBLOCK */
|
||||
|
||||
/*
|
||||
* Then connect...
|
||||
*/
|
||||
/*
|
||||
* Then connect...
|
||||
*/
|
||||
|
||||
if (!connect(*sock, &(addrlist->addr.addr),
|
||||
httpAddrLength(&(addrlist->addr))))
|
||||
{
|
||||
DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...",
|
||||
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
|
||||
_httpAddrPort(&(addrlist->addr))));
|
||||
|
||||
#ifdef O_NONBLOCK
|
||||
fcntl(*sock, F_SETFL, flags);
|
||||
#endif /* O_NONBLOCK */
|
||||
|
||||
return (addrlist);
|
||||
}
|
||||
|
||||
#ifdef O_NONBLOCK
|
||||
# ifdef WIN32
|
||||
if (WSAGetLastError() == WSAEINPROGRESS ||
|
||||
WSAGetLastError() == WSAEWOULDBLOCK)
|
||||
# else
|
||||
if (errno == EINPROGRESS || errno == EWOULDBLOCK)
|
||||
# endif /* WIN32 */
|
||||
{
|
||||
DEBUG_puts("1httpAddrConnect2: Finishing async connect()");
|
||||
|
||||
fcntl(*sock, F_SETFL, flags);
|
||||
|
||||
for (remaining = msec; remaining > 0; remaining -= 250)
|
||||
if (!connect(fds[nfds], &(addrlist->addr.addr), (socklen_t)httpAddrLength(&(addrlist->addr))))
|
||||
{
|
||||
do
|
||||
{
|
||||
if (cancel && *cancel)
|
||||
{
|
||||
/*
|
||||
* Close this socket and return...
|
||||
*/
|
||||
DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...", httpAddrString(&(addrlist->addr), temp, sizeof(temp)), httpAddrPort(&(addrlist->addr))));
|
||||
|
||||
DEBUG_puts("1httpAddrConnect2: Canceled connect()");
|
||||
|
||||
# ifdef WIN32
|
||||
closesocket(*sock);
|
||||
# else
|
||||
close(*sock);
|
||||
# endif /* WIN32 */
|
||||
|
||||
*sock = -1;
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
# ifdef HAVE_POLL
|
||||
pfd.fd = *sock;
|
||||
pfd.events = POLLIN | POLLOUT;
|
||||
|
||||
nfds = poll(&pfd, 1, remaining > 250 ? 250 : remaining);
|
||||
|
||||
DEBUG_printf(("1httpAddrConnect2: poll() returned %d (%d)", nfds,
|
||||
errno));
|
||||
|
||||
# else
|
||||
FD_ZERO(&input_set);
|
||||
FD_SET(*sock, &input_set);
|
||||
output_set = input_set;
|
||||
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = (remaining > 250 ? 250 : remaining) * 1000;
|
||||
|
||||
nfds = select(*sock + 1, &input_set, &output_set, NULL, &timeout);
|
||||
|
||||
DEBUG_printf(("1httpAddrConnect2: select() returned %d (%d)", nfds,
|
||||
errno));
|
||||
# endif /* HAVE_POLL */
|
||||
}
|
||||
# ifdef WIN32
|
||||
while (nfds < 0 && (WSAGetLastError() == WSAEINTR ||
|
||||
WSAGetLastError() == WSAEWOULDBLOCK));
|
||||
# else
|
||||
while (nfds < 0 && (errno == EINTR || errno == EAGAIN));
|
||||
# endif /* WIN32 */
|
||||
|
||||
if (nfds > 0)
|
||||
{
|
||||
len = sizeof(peer);
|
||||
if (!getpeername(*sock, (struct sockaddr *)&peer, &len))
|
||||
{
|
||||
DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...",
|
||||
httpAddrString(&peer, temp, sizeof(temp)),
|
||||
_httpAddrPort(&peer)));
|
||||
|
||||
return (addrlist);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef O_NONBLOCK
|
||||
fcntl(fds[nfds], F_SETFL, flags);
|
||||
#endif /* O_NONBLOCK */
|
||||
|
||||
DEBUG_printf(("1httpAddrConnect2: Unable to connect to %s:%d: %s",
|
||||
httpAddrString(&(addrlist->addr), temp, sizeof(temp)),
|
||||
_httpAddrPort(&(addrlist->addr)), strerror(errno)));
|
||||
*sock = fds[nfds];
|
||||
|
||||
while (nfds > 0)
|
||||
{
|
||||
nfds --;
|
||||
httpAddrClose(NULL, fds[nfds]);
|
||||
}
|
||||
|
||||
return (addrlist);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if (WSAGetLastError() != WSAEINPROGRESS && WSAGetLastError() != WSAEWOULDBLOCK)
|
||||
#else
|
||||
if (errno != EINPROGRESS && errno != EWOULDBLOCK)
|
||||
#endif /* WIN32 */
|
||||
{
|
||||
DEBUG_printf(("1httpAddrConnect2: Unable to connect to %s:%d: %s", httpAddrString(&(addrlist->addr), temp, sizeof(temp)), httpAddrPort(&(addrlist->addr)), strerror(errno)));
|
||||
httpAddrClose(NULL, fds[nfds]);
|
||||
addrlist = addrlist->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
if (errno == EINPROGRESS)
|
||||
errno = ETIMEDOUT;
|
||||
fcntl(fds[nfds], F_SETFL, flags);
|
||||
#endif /* !WIN32 */
|
||||
|
||||
#ifndef HAVE_POLL
|
||||
if (fds[nfds] > max_fd)
|
||||
max_fd = fds[nfds];
|
||||
#endif /* !HAVE_POLL */
|
||||
|
||||
addrs[nfds] = addrlist;
|
||||
nfds ++;
|
||||
addrlist = addrlist->next;
|
||||
}
|
||||
|
||||
if (!addrlist && nfds == 0)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Close this socket and move to the next address...
|
||||
* See if we can connect to any of the addresses so far...
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
closesocket(*sock);
|
||||
#else
|
||||
close(*sock);
|
||||
#endif /* WIN32 */
|
||||
#ifdef O_NONBLOCK
|
||||
DEBUG_puts("1httpAddrConnect2: Finishing async connect()");
|
||||
|
||||
*sock = -1;
|
||||
addrlist = addrlist->next;
|
||||
do
|
||||
{
|
||||
if (cancel && *cancel)
|
||||
{
|
||||
/*
|
||||
* Close this socket and return...
|
||||
*/
|
||||
|
||||
DEBUG_puts("1httpAddrConnect2: Canceled connect()");
|
||||
|
||||
while (nfds > 0)
|
||||
{
|
||||
nfds --;
|
||||
httpAddrClose(NULL, fds[nfds]);
|
||||
}
|
||||
|
||||
*sock = -1;
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
# ifdef HAVE_POLL
|
||||
for (i = 0; i < nfds; i ++)
|
||||
{
|
||||
pfds[i].fd = fds[i];
|
||||
pfds[i].events = POLLIN | POLLOUT;
|
||||
}
|
||||
|
||||
result = poll(pfds, (nfds_t)nfds, addrlist ? 100 : remaining > 250 ? 250 : remaining);
|
||||
|
||||
DEBUG_printf(("1httpAddrConnect2: poll() returned %d (%d)", result, errno));
|
||||
|
||||
# else
|
||||
FD_ZERO(&input_set);
|
||||
for (i = 0; i < nfds; i ++)
|
||||
FD_SET(fds[i], &input_set);
|
||||
output_set = input_set;
|
||||
error_set = input_set;
|
||||
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = (addrlist ? 100 : remaining > 250 ? 250 : remaining) * 1000;
|
||||
|
||||
result = select(max_fd + 1, &input_set, &output_set, &error_set, &timeout);
|
||||
|
||||
DEBUG_printf(("1httpAddrConnect2: select() returned %d (%d)", result, errno));
|
||||
# endif /* HAVE_POLL */
|
||||
}
|
||||
# ifdef WIN32
|
||||
while (result < 0 && (WSAGetLastError() == WSAEINTR || WSAGetLastError() == WSAEWOULDBLOCK));
|
||||
# else
|
||||
while (result < 0 && (errno == EINTR || errno == EAGAIN));
|
||||
# endif /* WIN32 */
|
||||
|
||||
if (result > 0)
|
||||
{
|
||||
http_addrlist_t *connaddr = NULL; /* Connected address, if any */
|
||||
|
||||
for (i = 0; i < nfds; i ++)
|
||||
{
|
||||
# ifdef HAVE_POLL
|
||||
DEBUG_printf(("pfds[%d].revents=%x\n", i, pfds[i].revents));
|
||||
if (pfds[i].revents && !(pfds[i].revents & (POLLERR | POLLHUP)))
|
||||
# else
|
||||
if (FD_ISSET(fds[i], &input) && !FD_ISSET(fds[i], &error))
|
||||
# endif /* HAVE_POLL */
|
||||
{
|
||||
*sock = fds[i];
|
||||
connaddr = addrs[i];
|
||||
|
||||
# ifdef DEBUG
|
||||
len = sizeof(peer);
|
||||
if (!getpeername(fds[i], (struct sockaddr *)&peer, &len))
|
||||
DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...", httpAddrString(&peer, temp, sizeof(temp)), httpAddrPort(&peer)));
|
||||
# endif /* DEBUG */
|
||||
}
|
||||
# ifdef HAVE_POLL
|
||||
else if (pfds[i].revents & (POLLERR | POLLHUP))
|
||||
# else
|
||||
else if (FD_ISSET(fds[i], &error))
|
||||
# endif /* HAVE_POLL */
|
||||
{
|
||||
/*
|
||||
* Error on socket, remove from the "pool"...
|
||||
*/
|
||||
|
||||
httpAddrClose(NULL, fds[i]);
|
||||
nfds --;
|
||||
if (i < nfds)
|
||||
{
|
||||
memmove(fds + i, fds + i + 1, (size_t)(nfds - i) * (sizeof(fds[0])));
|
||||
memmove(addrs + i, addrs + i + 1, (size_t)(nfds - i) * (sizeof(addrs[0])));
|
||||
}
|
||||
i --;
|
||||
}
|
||||
}
|
||||
|
||||
if (connaddr)
|
||||
return (connaddr);
|
||||
}
|
||||
#endif /* O_NONBLOCK */
|
||||
|
||||
if (addrlist)
|
||||
remaining -= 100;
|
||||
else
|
||||
remaining -= 250;
|
||||
}
|
||||
|
||||
while (nfds > 0)
|
||||
{
|
||||
nfds --;
|
||||
httpAddrClose(NULL, fds[nfds]);
|
||||
}
|
||||
|
||||
if (!addrlist)
|
||||
#ifdef WIN32
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, "Connection failed", 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, "Connection failed", 0);
|
||||
#else
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, strerror(errno), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, strerror(errno), 0);
|
||||
#endif /* WIN32 */
|
||||
|
||||
return (addrlist);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAddrCopyList()' - Copy an address list.
|
||||
*
|
||||
* @since CUPS 1.7/macOS 10.9@
|
||||
*/
|
||||
|
||||
http_addrlist_t * /* O - New address list or @code NULL@ on error */
|
||||
httpAddrCopyList(
|
||||
http_addrlist_t *src) /* I - Source address list */
|
||||
{
|
||||
http_addrlist_t *dst = NULL, /* First list entry */
|
||||
*prev = NULL, /* Previous list entry */
|
||||
*current = NULL;/* Current list entry */
|
||||
|
||||
|
||||
while (src)
|
||||
{
|
||||
if ((current = malloc(sizeof(http_addrlist_t))) == NULL)
|
||||
{
|
||||
current = dst;
|
||||
|
||||
while (current)
|
||||
{
|
||||
prev = current;
|
||||
current = current->next;
|
||||
|
||||
free(prev);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
memcpy(current, src, sizeof(http_addrlist_t));
|
||||
|
||||
current->next = NULL;
|
||||
|
||||
if (prev)
|
||||
prev->next = current;
|
||||
else
|
||||
dst = current;
|
||||
|
||||
prev = current;
|
||||
src = src->next;
|
||||
}
|
||||
|
||||
return (dst);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'httpAddrFreeList()' - Free an address list.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
void
|
||||
@ -358,7 +452,7 @@ httpAddrFreeList(
|
||||
/*
|
||||
* 'httpAddrGetList()' - Get a list of addresses for a hostname.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
http_addrlist_t * /* O - List of addresses or NULL */
|
||||
@ -423,6 +517,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
|
||||
if ((first = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t))) != NULL)
|
||||
{
|
||||
addr = first;
|
||||
first->addr.un.sun_family = AF_LOCAL;
|
||||
strlcpy(first->addr.un.sun_path, hostname, sizeof(first->addr.un.sun_path));
|
||||
}
|
||||
@ -508,7 +603,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
if (!temp)
|
||||
{
|
||||
httpAddrFreeList(first);
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@ -543,7 +638,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
if (error == EAI_FAIL)
|
||||
cg->need_res_init = 1;
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, gai_strerror(error), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, gai_strerror(error), 0);
|
||||
}
|
||||
|
||||
#else
|
||||
@ -606,9 +701,10 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
return (NULL);
|
||||
|
||||
first->addr.ipv4.sin_family = AF_INET;
|
||||
first->addr.ipv4.sin_addr.s_addr = htonl(((((((ip[0] << 8) |
|
||||
ip[1]) << 8) |
|
||||
ip[2]) << 8) | ip[3]));
|
||||
first->addr.ipv4.sin_addr.s_addr = htonl((((((((unsigned)ip[0] << 8) |
|
||||
(unsigned)ip[1]) << 8) |
|
||||
(unsigned)ip[2]) << 8) |
|
||||
(unsigned)ip[3]));
|
||||
first->addr.ipv4.sin_port = htons(portnum);
|
||||
}
|
||||
}
|
||||
@ -667,7 +763,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
if (h_errno == NO_RECOVERY)
|
||||
cg->need_res_init = 1;
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, hstrerror(h_errno), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, hstrerror(h_errno), 0);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_GETADDRINFO */
|
||||
@ -707,7 +803,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
{
|
||||
httpAddrFreeList(first);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("Unknown service name."), 1);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unknown service name."), 1);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@ -730,7 +826,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
temp = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t));
|
||||
if (!temp)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
|
||||
httpAddrFreeList(first);
|
||||
return (NULL);
|
||||
}
|
||||
@ -759,7 +855,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
temp = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t));
|
||||
if (!temp)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
|
||||
httpAddrFreeList(first);
|
||||
return (NULL);
|
||||
}
|
||||
@ -791,7 +887,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
temp = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t));
|
||||
if (!temp)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
|
||||
httpAddrFreeList(first);
|
||||
return (NULL);
|
||||
}
|
||||
@ -815,7 +911,7 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
temp = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t));
|
||||
if (!temp)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
|
||||
httpAddrFreeList(first);
|
||||
return (NULL);
|
||||
}
|
||||
@ -838,8 +934,3 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p
|
||||
|
||||
return (first);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: http-addrlist.c 7910 2008-09-06 00:25:17Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: http-private.h 7850 2008-08-20 00:07:25Z mike $"
|
||||
* Private HTTP definitions for CUPS.
|
||||
*
|
||||
* Private HTTP definitions for CUPS.
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_HTTP_PRIVATE_H_
|
||||
@ -23,6 +21,7 @@
|
||||
*/
|
||||
|
||||
# include "config.h"
|
||||
# include <cups/language.h>
|
||||
# include <stddef.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
@ -34,11 +33,12 @@
|
||||
# ifdef WIN32
|
||||
# include <io.h>
|
||||
# include <winsock2.h>
|
||||
# define CUPS_SOCAST (const char *)
|
||||
# else
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <sys/socket.h>
|
||||
# define closesocket(f) close(f)
|
||||
# define CUPS_SOCAST
|
||||
# endif /* WIN32 */
|
||||
|
||||
# ifdef HAVE_GSSAPI
|
||||
@ -58,27 +58,22 @@
|
||||
# include <Security/Authorization.h>
|
||||
# endif /* HAVE_AUTHORIZATION_H */
|
||||
|
||||
# if defined(__sgi) || (defined(__APPLE__) && !defined(_SOCKLEN_T))
|
||||
# if defined(__APPLE__) && !defined(_SOCKLEN_T)
|
||||
/*
|
||||
* IRIX and MacOS X 10.2.x do not define socklen_t, and in fact use an int instead of
|
||||
* macOS 10.2.x does not define socklen_t, and in fact uses an int instead of
|
||||
* unsigned type for length values...
|
||||
*/
|
||||
|
||||
typedef int socklen_t;
|
||||
# endif /* __sgi || (__APPLE__ && !_SOCKLEN_T) */
|
||||
# endif /* __APPLE__ && !_SOCKLEN_T */
|
||||
|
||||
# include <cups/http.h>
|
||||
# include "md5-private.h"
|
||||
# include "ipp-private.h"
|
||||
|
||||
# if defined HAVE_LIBSSL
|
||||
# include <openssl/err.h>
|
||||
# include <openssl/rand.h>
|
||||
# include <openssl/ssl.h>
|
||||
# elif defined HAVE_GNUTLS
|
||||
# ifdef HAVE_GNUTLS
|
||||
# include <gnutls/gnutls.h>
|
||||
# include <gnutls/x509.h>
|
||||
# include <gcrypt.h>
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
# include <CoreFoundation/CoreFoundation.h>
|
||||
# include <Security/Security.h>
|
||||
@ -96,6 +91,38 @@ typedef int socklen_t;
|
||||
# include <Security/SecCertificate.h>
|
||||
# include <Security/SecIdentity.h>
|
||||
# endif /* HAVE_SECCERTIFICATE_H */
|
||||
# ifdef HAVE_SECCERTIFICATEPRIV_H
|
||||
# include <Security/SecCertificatePriv.h>
|
||||
# else
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
# ifndef _SECURITY_VERSION_GREATER_THAN_57610_
|
||||
typedef CF_OPTIONS(uint32_t, SecKeyUsage) {
|
||||
kSecKeyUsageAll = 0x7FFFFFFF
|
||||
};
|
||||
# endif /* !_SECURITY_VERSION_GREATER_THAN_57610_ */
|
||||
extern const void * kSecCSRChallengePassword;
|
||||
extern const void * kSecSubjectAltName;
|
||||
extern const void * kSecCertificateKeyUsage;
|
||||
extern const void * kSecCSRBasicContraintsPathLen;
|
||||
extern const void * kSecCertificateExtensions;
|
||||
extern const void * kSecCertificateExtensionsEncoded;
|
||||
extern const void * kSecOidCommonName;
|
||||
extern const void * kSecOidCountryName;
|
||||
extern const void * kSecOidStateProvinceName;
|
||||
extern const void * kSecOidLocalityName;
|
||||
extern const void * kSecOidOrganization;
|
||||
extern const void * kSecOidOrganizationalUnit;
|
||||
extern SecCertificateRef SecCertificateCreateWithBytes(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex length);
|
||||
extern bool SecCertificateIsValid(SecCertificateRef certificate, CFAbsoluteTime verifyTime);
|
||||
extern CFAbsoluteTime SecCertificateNotValidAfter(SecCertificateRef certificate);
|
||||
extern SecCertificateRef SecGenerateSelfSignedCertificate(CFArrayRef subject, CFDictionaryRef parameters, SecKeyRef publicKey, SecKeyRef privateKey);
|
||||
extern SecIdentityRef SecIdentityCreate(CFAllocatorRef allocator, SecCertificateRef certificate, SecKeyRef privateKey);
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
# endif /* HAVE_SECCERTIFICATEPRIV_H */
|
||||
# ifdef HAVE_SECITEMPRIV_H
|
||||
# include <Security/SecItemPriv.h>
|
||||
# endif /* HAVE_SECITEMPRIV_H */
|
||||
@ -106,11 +133,17 @@ typedef int socklen_t;
|
||||
# include <Security/SecPolicyPriv.h>
|
||||
# endif /* HAVE_SECPOLICYPRIV_H */
|
||||
# elif defined(HAVE_SSPISSL)
|
||||
# include "sspi-private.h"
|
||||
# endif /* HAVE_LIBSSL */
|
||||
# include <wincrypt.h>
|
||||
# include <wintrust.h>
|
||||
# include <schannel.h>
|
||||
# define SECURITY_WIN32
|
||||
# include <security.h>
|
||||
# include <sspi.h>
|
||||
# endif /* HAVE_GNUTLS */
|
||||
|
||||
# ifndef WIN32
|
||||
# include <net/if.h>
|
||||
# include <resolv.h>
|
||||
# ifdef HAVE_GETIFADDRS
|
||||
# include <ifaddrs.h>
|
||||
# else
|
||||
@ -121,6 +154,10 @@ typedef int socklen_t;
|
||||
# endif /* HAVE_GETIFADDRS */
|
||||
# endif /* !WIN32 */
|
||||
|
||||
# ifdef HAVE_LIBZ
|
||||
# include <zlib.h>
|
||||
# endif /* HAVE_LIBZ */
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
@ -136,40 +173,30 @@ extern "C" {
|
||||
*/
|
||||
|
||||
|
||||
#define _HTTP_MAX_SBUFFER 65536 /* Size of (de)compression buffer */
|
||||
#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? */
|
||||
|
||||
#define _HTTP_TLS_NONE 0 /* No TLS options */
|
||||
#define _HTTP_TLS_ALLOW_RC4 1 /* Allow RC4 cipher suites */
|
||||
#define _HTTP_TLS_ALLOW_SSL3 2 /* Allow SSL 3.0 */
|
||||
#define _HTTP_TLS_ALLOW_DH 4 /* Allow DH/DHE key negotiation */
|
||||
#define _HTTP_TLS_DENY_TLS10 16 /* Deny TLS 1.0 */
|
||||
|
||||
|
||||
/*
|
||||
* Types and functions for SSL support...
|
||||
*/
|
||||
|
||||
# if defined HAVE_LIBSSL
|
||||
/*
|
||||
* The OpenSSL library provides its own SSL/TLS context structure for its
|
||||
* IO and protocol management. However, we need to provide our own BIO
|
||||
* (basic IO) implementation to do timeouts...
|
||||
*/
|
||||
|
||||
typedef SSL *http_tls_t;
|
||||
typedef void *http_tls_credentials_t;
|
||||
|
||||
extern BIO_METHOD *_httpBIOMethods(void);
|
||||
|
||||
# elif defined HAVE_GNUTLS
|
||||
# ifdef HAVE_GNUTLS
|
||||
/*
|
||||
* The GNU TLS library is more of a "bare metal" SSL/TLS library...
|
||||
*/
|
||||
|
||||
typedef gnutls_session http_tls_t;
|
||||
typedef void *http_tls_credentials_t;
|
||||
|
||||
extern ssize_t _httpReadGNUTLS(gnutls_transport_ptr ptr, void *data,
|
||||
size_t length);
|
||||
extern ssize_t _httpWriteGNUTLS(gnutls_transport_ptr ptr, const void *data,
|
||||
size_t length);
|
||||
typedef gnutls_session_t http_tls_t;
|
||||
typedef gnutls_certificate_credentials_t *http_tls_credentials_t;
|
||||
|
||||
# elif defined(HAVE_CDSASSL)
|
||||
/*
|
||||
@ -180,10 +207,6 @@ extern ssize_t _httpWriteGNUTLS(gnutls_transport_ptr ptr, const void *data,
|
||||
# if !defined(HAVE_SECBASEPRIV_H) && defined(HAVE_CSSMERRORSTRING) /* Declare prototype for function in that header... */
|
||||
extern const char *cssmErrorString(int error);
|
||||
# endif /* !HAVE_SECBASEPRIV_H && HAVE_CSSMERRORSTRING */
|
||||
# ifndef HAVE_SECITEMPRIV_H /* Declare constants from that header... */
|
||||
extern const CFTypeRef kSecClassCertificate;
|
||||
extern const CFTypeRef kSecClassIdentity;
|
||||
# endif /* !HAVE_SECITEMPRIV_H */
|
||||
# if !defined(HAVE_SECIDENTITYSEARCHPRIV_H) && defined(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY) /* Declare prototype for function in that header... */
|
||||
extern OSStatus SecIdentitySearchCreateWithPolicy(SecPolicyRef policy,
|
||||
CFStringRef idString, CSSM_KEYUSE keyUsage,
|
||||
@ -199,18 +222,31 @@ extern OSStatus SecPolicySetValue(SecPolicyRef policyRef,
|
||||
typedef SSLContextRef http_tls_t;
|
||||
typedef CFArrayRef http_tls_credentials_t;
|
||||
|
||||
extern OSStatus _httpReadCDSA(SSLConnectionRef connection, void *data,
|
||||
size_t *dataLength);
|
||||
extern OSStatus _httpWriteCDSA(SSLConnectionRef connection, const void *data,
|
||||
size_t *dataLength);
|
||||
|
||||
# elif defined(HAVE_SSPISSL)
|
||||
/*
|
||||
* Windows' SSPI library gets a CUPS wrapper...
|
||||
*/
|
||||
|
||||
typedef _sspi_struct_t * http_tls_t;
|
||||
typedef void *http_tls_credentials_t;
|
||||
typedef struct _http_sspi_s /**** SSPI/SSL data structure ****/
|
||||
{
|
||||
CredHandle creds; /* Credentials */
|
||||
CtxtHandle context; /* SSL context */
|
||||
BOOL contextInitialized; /* Is context init'd? */
|
||||
SecPkgContext_StreamSizes streamSizes;/* SSL data stream sizes */
|
||||
BYTE *decryptBuffer; /* Data pre-decryption*/
|
||||
size_t decryptBufferLength; /* Length of decrypt buffer */
|
||||
size_t decryptBufferUsed; /* Bytes used in buffer */
|
||||
BYTE *readBuffer; /* Data post-decryption */
|
||||
int readBufferLength; /* Length of read buffer */
|
||||
int readBufferUsed; /* Bytes used in buffer */
|
||||
BYTE *writeBuffer; /* Data pre-encryption */
|
||||
int writeBufferLength; /* Length of write buffer */
|
||||
PCCERT_CONTEXT localCert, /* Local certificate */
|
||||
remoteCert; /* Remote (peer's) certificate */
|
||||
char error[256]; /* Most recent error message */
|
||||
} _http_sspi_t;
|
||||
typedef _http_sspi_t *http_tls_t;
|
||||
typedef PCCERT_CONTEXT http_tls_credentials_t;
|
||||
|
||||
# else
|
||||
/*
|
||||
@ -219,9 +255,25 @@ typedef void *http_tls_credentials_t;
|
||||
|
||||
typedef void *http_tls_t;
|
||||
typedef void *http_tls_credentials_t;
|
||||
# endif /* HAVE_LIBSSL */
|
||||
# endif /* HAVE_GNUTLS */
|
||||
|
||||
struct _http_s /**** HTTP connection structure. ****/
|
||||
typedef enum _http_coding_e /**** HTTP content coding enumeration ****/
|
||||
{
|
||||
_HTTP_CODING_IDENTITY, /* No content coding */
|
||||
_HTTP_CODING_GZIP, /* LZ77+gzip decompression */
|
||||
_HTTP_CODING_DEFLATE, /* LZ77+zlib compression */
|
||||
_HTTP_CODING_GUNZIP, /* LZ77+gzip decompression */
|
||||
_HTTP_CODING_INFLATE /* LZ77+zlib decompression */
|
||||
} _http_coding_t;
|
||||
|
||||
typedef enum _http_mode_e /**** HTTP mode enumeration ****/
|
||||
{
|
||||
_HTTP_MODE_CLIENT, /* Client connected to server */
|
||||
_HTTP_MODE_SERVER /* Server connected (accepted) from client */
|
||||
} _http_mode_t;
|
||||
|
||||
# ifndef _HTTP_NO_PRIVATE
|
||||
struct _http_s /**** HTTP connection structure ****/
|
||||
{
|
||||
int fd; /* File descriptor for this socket */
|
||||
int blocking; /* To block or not to block */
|
||||
@ -234,31 +286,34 @@ struct _http_s /**** HTTP connection structure. ****/
|
||||
struct sockaddr_in _hostaddr; /* Address of connected host (deprecated) */
|
||||
char hostname[HTTP_MAX_HOST],
|
||||
/* Name of connected host */
|
||||
fields[HTTP_FIELD_MAX][HTTP_MAX_VALUE];
|
||||
/* Field values */
|
||||
fields[HTTP_FIELD_ACCEPT_ENCODING][HTTP_MAX_VALUE];
|
||||
/* Field values up to Accept-Encoding */
|
||||
char *data; /* Pointer to data buffer */
|
||||
http_encoding_t data_encoding; /* Chunked or not */
|
||||
int _data_remaining;/* Number of bytes left (deprecated) */
|
||||
int used; /* Number of bytes used in buffer */
|
||||
char buffer[HTTP_MAX_BUFFER];
|
||||
/* Buffer for incoming data */
|
||||
int auth_type; /* Authentication in use */
|
||||
int _auth_type; /* Authentication in use (deprecated) */
|
||||
_cups_md5_state_t md5_state; /* MD5 state */
|
||||
char nonce[HTTP_MAX_VALUE];
|
||||
/* Nonce value */
|
||||
int nonce_count; /* Nonce count */
|
||||
http_tls_t tls; /* TLS state information */
|
||||
http_encryption_t encryption; /* Encryption requirements */
|
||||
|
||||
/**** New in CUPS 1.1.19 ****/
|
||||
fd_set *input_set; /* select() set for httpWait() (deprecated) */
|
||||
http_status_t expect; /* Expect: header */
|
||||
char *cookie; /* Cookie value(s) */
|
||||
|
||||
/**** New in CUPS 1.1.20 ****/
|
||||
char _authstring[HTTP_MAX_VALUE],
|
||||
/* Current Authentication value (deprecated) */
|
||||
/* Current Authorization value (deprecated) */
|
||||
userpass[HTTP_MAX_VALUE];
|
||||
/* Username:password string */
|
||||
int digest_tries; /* Number of tries for digest auth */
|
||||
|
||||
/**** New in CUPS 1.2 ****/
|
||||
off_t data_remaining; /* Number of bytes left */
|
||||
http_addr_t *hostaddr; /* Current host address and port */
|
||||
@ -266,10 +321,11 @@ struct _http_s /**** HTTP connection structure. ****/
|
||||
char wbuffer[HTTP_MAX_BUFFER];
|
||||
/* Buffer for outgoing data */
|
||||
int wused; /* Write buffer bytes used */
|
||||
|
||||
/**** New in CUPS 1.3 ****/
|
||||
char *field_authorization;
|
||||
/* Authorization field */
|
||||
char *authstring; /* Current authorization field */
|
||||
char *authstring; /* Current Authorization field */
|
||||
# ifdef HAVE_GSSAPI
|
||||
gss_OID gssmech; /* Authentication mechanism */
|
||||
gss_ctx_id_t gssctx; /* Authentication context */
|
||||
@ -278,6 +334,7 @@ struct _http_s /**** HTTP connection structure. ****/
|
||||
# ifdef HAVE_AUTHORIZATION_H
|
||||
AuthorizationRef auth_ref; /* Authorization ref */
|
||||
# endif /* HAVE_AUTHORIZATION_H */
|
||||
|
||||
/**** New in CUPS 1.5 ****/
|
||||
http_tls_credentials_t tls_credentials;
|
||||
/* TLS credentials */
|
||||
@ -288,7 +345,25 @@ struct _http_s /**** HTTP connection structure. ****/
|
||||
# ifdef HAVE_GSSAPI
|
||||
char gsshost[256]; /* Hostname for Kerberos */
|
||||
# endif /* HAVE_GSSAPI */
|
||||
|
||||
/**** New in CUPS 1.7 ****/
|
||||
int tls_upgrade; /* Non-zero if we are doing an upgrade */
|
||||
_http_mode_t mode; /* _HTTP_MODE_CLIENT or _HTTP_MODE_SERVER */
|
||||
char *accept_encoding,
|
||||
/* Accept-Encoding field */
|
||||
*allow, /* Allow field */
|
||||
*server, /* Server field */
|
||||
*default_accept_encoding,
|
||||
*default_server,
|
||||
*default_user_agent;
|
||||
/* Default field values */
|
||||
# ifdef HAVE_LIBZ
|
||||
_http_coding_t coding; /* _HTTP_CODING_xxx */
|
||||
z_stream stream; /* (De)compression stream */
|
||||
Bytef *sbuffer; /* (De)compression buffer */
|
||||
# endif /* HAVE_LIBZ */
|
||||
};
|
||||
# endif /* !_HTTP_NO_PRIVATE */
|
||||
|
||||
|
||||
/*
|
||||
@ -298,11 +373,6 @@ struct _http_s /**** HTTP connection structure. ****/
|
||||
# ifndef HAVE_HSTRERROR
|
||||
extern const char *_cups_hstrerror(int error);
|
||||
# define hstrerror _cups_hstrerror
|
||||
# elif defined(_AIX) || defined(__osf__)
|
||||
/*
|
||||
* AIX and Tru64 UNIX don't provide a prototype but do provide the function...
|
||||
*/
|
||||
extern const char *hstrerror(int error);
|
||||
# endif /* !HAVE_HSTRERROR */
|
||||
|
||||
|
||||
@ -352,16 +422,7 @@ extern void _cups_freeifaddrs(struct ifaddrs *addrs);
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
#define _httpAddrFamily(addrp) (addrp)->addr.sa_family
|
||||
extern int _httpAddrPort(http_addr_t *addr);
|
||||
extern void _httpAddrSetPort(http_addr_t *addr, int port);
|
||||
extern char *_httpAssembleUUID(const char *server, int port,
|
||||
const char *name, int number,
|
||||
char *buffer, size_t bufsize);
|
||||
extern http_t *_httpCreate(const char *host, int port,
|
||||
http_addrlist_t *addrlist,
|
||||
http_encryption_t encryption,
|
||||
int family);
|
||||
extern http_tls_credentials_t
|
||||
_httpCreateCredentials(cups_array_t *credentials);
|
||||
extern char *_httpDecodeURI(char *dst, const char *src,
|
||||
@ -370,11 +431,19 @@ extern void _httpDisconnect(http_t *http);
|
||||
extern char *_httpEncodeURI(char *dst, const char *src,
|
||||
size_t dstsize);
|
||||
extern void _httpFreeCredentials(http_tls_credentials_t credentials);
|
||||
extern ssize_t _httpPeek(http_t *http, char *buffer, size_t length);
|
||||
extern const char *_httpResolveURI(const char *uri, char *resolved_uri,
|
||||
size_t resolved_size, int options,
|
||||
int (*cb)(void *context),
|
||||
void *context);
|
||||
extern const char *_httpStatus(cups_lang_t *lang, http_status_t status);
|
||||
extern void _httpTLSInitialize(void);
|
||||
extern size_t _httpTLSPending(http_t *http);
|
||||
extern int _httpTLSRead(http_t *http, char *buf, int len);
|
||||
extern int _httpTLSSetCredentials(http_t *http);
|
||||
extern void _httpTLSSetOptions(int options);
|
||||
extern int _httpTLSStart(http_t *http);
|
||||
extern void _httpTLSStop(http_t *http);
|
||||
extern int _httpTLSWrite(http_t *http, const char *buf, int len);
|
||||
extern int _httpUpdate(http_t *http, http_status_t *status);
|
||||
extern int _httpWait(http_t *http, int msec, int usessl);
|
||||
|
||||
@ -388,7 +457,3 @@ extern int _httpWait(http_t *http, int msec, int usessl);
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_HTTP_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: http-private.h 7850 2008-08-20 00:07:25Z mike $".
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
4439
cups/http.c
4439
cups/http.c
File diff suppressed because it is too large
Load Diff
405
cups/http.h
405
cups/http.h
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: http.h 7026 2007-10-19 00:57:45Z mike $"
|
||||
* Hyper-Text Transport Protocol definitions for CUPS.
|
||||
*
|
||||
* Hyper-Text Transport Protocol definitions for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_HTTP_H_
|
||||
@ -36,9 +34,6 @@ typedef off_t ssize_t; /* @private@ */
|
||||
# include <winsock2.h>
|
||||
# include <ws2tcpip.h>
|
||||
# else
|
||||
# ifdef __sgi
|
||||
# define INET6 /* IRIX IPv6 support... */
|
||||
# endif /* __sgi */
|
||||
# include <unistd.h>
|
||||
# include <sys/time.h>
|
||||
# include <sys/socket.h>
|
||||
@ -90,8 +85,6 @@ extern "C" {
|
||||
# define s6_addr32 _S6_un._S6_u32
|
||||
# elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)|| defined(__DragonFly__)
|
||||
# define s6_addr32 __u6_addr.__u6_addr32
|
||||
# elif defined(__osf__)
|
||||
# define s6_addr32 s6_un.sa6_laddr
|
||||
# elif defined(WIN32)
|
||||
/*
|
||||
* Windows only defines byte and 16-bit word members of the union and
|
||||
@ -124,22 +117,35 @@ 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/macOS 10.5@ */
|
||||
} http_auth_t;
|
||||
|
||||
typedef enum http_encoding_e /**** HTTP transfer encoding values ****/
|
||||
{
|
||||
HTTP_ENCODE_LENGTH, /* Data is sent with Content-Length */
|
||||
HTTP_ENCODE_CHUNKED, /* Data is chunked */
|
||||
HTTP_ENCODE_FIELDS /* Sending HTTP fields */
|
||||
HTTP_ENCODING_LENGTH, /* Data is sent with Content-Length */
|
||||
HTTP_ENCODING_CHUNKED, /* Data is chunked */
|
||||
HTTP_ENCODING_FIELDS /* Sending HTTP fields */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define HTTP_ENCODE_LENGTH HTTP_ENCODING_LENGTH
|
||||
# define HTTP_ENCODE_CHUNKED HTTP_ENCODING_CHUNKED
|
||||
# define HTTP_ENCODE_FIELDS HTTP_ENCODING_FIELDS
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} http_encoding_t;
|
||||
|
||||
typedef enum http_encryption_e /**** HTTP encryption values ****/
|
||||
{
|
||||
HTTP_ENCRYPT_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */
|
||||
HTTP_ENCRYPT_NEVER, /* Never encrypt */
|
||||
HTTP_ENCRYPT_REQUIRED, /* Encryption is required (TLS upgrade) */
|
||||
HTTP_ENCRYPT_ALWAYS /* Always encrypt (SSL) */
|
||||
HTTP_ENCRYPTION_IF_REQUESTED, /* Encrypt if requested (TLS upgrade) */
|
||||
HTTP_ENCRYPTION_NEVER, /* Never encrypt */
|
||||
HTTP_ENCRYPTION_REQUIRED, /* Encryption is required (TLS upgrade) */
|
||||
HTTP_ENCRYPTION_ALWAYS /* Always encrypt (SSL) */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define HTTP_ENCRYPT_IF_REQUESTED HTTP_ENCRYPTION_IF_REQUESTED
|
||||
# define HTTP_ENCRYPT_NEVER HTTP_ENCRYPTION_NEVER
|
||||
# define HTTP_ENCRYPT_REQUIRED HTTP_ENCRYPTION_REQUIRED
|
||||
# define HTTP_ENCRYPT_ALWAYS HTTP_ENCRYPTION_ALWAYS
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} http_encryption_t;
|
||||
|
||||
typedef enum http_field_e /**** HTTP field names ****/
|
||||
@ -172,6 +178,9 @@ typedef enum http_field_e /**** HTTP field names ****/
|
||||
HTTP_FIELD_UPGRADE, /* Upgrade field */
|
||||
HTTP_FIELD_USER_AGENT, /* User-Agent field */
|
||||
HTTP_FIELD_WWW_AUTHENTICATE, /* WWW-Authenticate field */
|
||||
HTTP_FIELD_ACCEPT_ENCODING, /* Accepting-Encoding field @since CUPS 1.7/macOS 10.9@ */
|
||||
HTTP_FIELD_ALLOW, /* Allow field @since CUPS 1.7/macOS 10.9@ */
|
||||
HTTP_FIELD_SERVER, /* Server field @since CUPS 1.7/macOS 10.9@ */
|
||||
HTTP_FIELD_MAX /* Maximum field index */
|
||||
} http_field_t;
|
||||
|
||||
@ -185,90 +194,191 @@ typedef enum http_state_e /**** HTTP state values; states
|
||||
**** are server-oriented...
|
||||
****/
|
||||
{
|
||||
HTTP_WAITING, /* Waiting for command */
|
||||
HTTP_OPTIONS, /* OPTIONS command, waiting for blank line */
|
||||
HTTP_GET, /* GET command, waiting for blank line */
|
||||
HTTP_GET_SEND, /* GET command, sending data */
|
||||
HTTP_HEAD, /* HEAD command, waiting for blank line */
|
||||
HTTP_POST, /* POST command, waiting for blank line */
|
||||
HTTP_POST_RECV, /* POST command, receiving data */
|
||||
HTTP_POST_SEND, /* POST command, sending data */
|
||||
HTTP_PUT, /* PUT command, waiting for blank line */
|
||||
HTTP_PUT_RECV, /* PUT command, receiving data */
|
||||
HTTP_DELETE, /* DELETE command, waiting for blank line */
|
||||
HTTP_TRACE, /* TRACE command, waiting for blank line */
|
||||
HTTP_CLOSE, /* CLOSE command, waiting for blank line */
|
||||
HTTP_STATUS /* Command complete, sending status */
|
||||
HTTP_STATE_ERROR = -1, /* Error on socket */
|
||||
HTTP_STATE_WAITING, /* Waiting for command */
|
||||
HTTP_STATE_OPTIONS, /* OPTIONS command, waiting for blank line */
|
||||
HTTP_STATE_GET, /* GET command, waiting for blank line */
|
||||
HTTP_STATE_GET_SEND, /* GET command, sending data */
|
||||
HTTP_STATE_HEAD, /* HEAD command, waiting for blank line */
|
||||
HTTP_STATE_POST, /* POST command, waiting for blank line */
|
||||
HTTP_STATE_POST_RECV, /* POST command, receiving data */
|
||||
HTTP_STATE_POST_SEND, /* POST command, sending data */
|
||||
HTTP_STATE_PUT, /* PUT command, waiting for blank line */
|
||||
HTTP_STATE_PUT_RECV, /* PUT command, receiving data */
|
||||
HTTP_STATE_DELETE, /* DELETE command, waiting for blank line */
|
||||
HTTP_STATE_TRACE, /* TRACE command, waiting for blank line */
|
||||
HTTP_STATE_CONNECT, /* CONNECT command, waiting for blank line */
|
||||
HTTP_STATE_STATUS, /* Command complete, sending status */
|
||||
HTTP_STATE_UNKNOWN_METHOD, /* Unknown request method, waiting for blank line @since CUPS 1.7/macOS 10.9@ */
|
||||
HTTP_STATE_UNKNOWN_VERSION /* Unknown request method, waiting for blank line @since CUPS 1.7/macOS 10.9@ */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define HTTP_WAITING HTTP_STATE_WAITING
|
||||
# define HTTP_OPTIONS HTTP_STATE_OPTIONS
|
||||
# define HTTP_GET HTTP_STATE_GET
|
||||
# define HTTP_GET_SEND HTTP_STATE_GET_SEND
|
||||
# define HTTP_HEAD HTTP_STATE_HEAD
|
||||
# define HTTP_POST HTTP_STATE_POST
|
||||
# define HTTP_POST_RECV HTTP_STATE_POST_RECV
|
||||
# define HTTP_POST_SEND HTTP_STATE_POST_SEND
|
||||
# define HTTP_PUT HTTP_STATE_PUT
|
||||
# define HTTP_PUT_RECV HTTP_STATE_PUT_RECV
|
||||
# define HTTP_DELETE HTTP_STATE_DELETE
|
||||
# define HTTP_TRACE HTTP_STATE_TRACE
|
||||
# define HTTP_CLOSE HTTP_STATE_CONNECT
|
||||
# define HTTP_STATUS HTTP_STATE_STATUS
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} http_state_t;
|
||||
|
||||
typedef enum http_status_e /**** HTTP status codes ****/
|
||||
{
|
||||
HTTP_ERROR = -1, /* An error response from httpXxxx() */
|
||||
HTTP_STATUS_ERROR = -1, /* An error response from httpXxxx() */
|
||||
HTTP_STATUS_NONE = 0, /* No Expect value @since CUPS 1.7/macOS 10.9@ */
|
||||
|
||||
HTTP_CONTINUE = 100, /* Everything OK, keep going... */
|
||||
HTTP_SWITCHING_PROTOCOLS, /* HTTP upgrade to TLS/SSL */
|
||||
HTTP_STATUS_CONTINUE = 100, /* Everything OK, keep going... */
|
||||
HTTP_STATUS_SWITCHING_PROTOCOLS, /* HTTP upgrade to TLS/SSL */
|
||||
|
||||
HTTP_OK = 200, /* OPTIONS/GET/HEAD/POST/TRACE command was successful */
|
||||
HTTP_CREATED, /* PUT command was successful */
|
||||
HTTP_ACCEPTED, /* DELETE command was successful */
|
||||
HTTP_NOT_AUTHORITATIVE, /* Information isn't authoritative */
|
||||
HTTP_NO_CONTENT, /* Successful command, no new data */
|
||||
HTTP_RESET_CONTENT, /* Content was reset/recreated */
|
||||
HTTP_PARTIAL_CONTENT, /* Only a partial file was recieved/sent */
|
||||
HTTP_STATUS_OK = 200, /* OPTIONS/GET/HEAD/POST/TRACE command was successful */
|
||||
HTTP_STATUS_CREATED, /* PUT command was successful */
|
||||
HTTP_STATUS_ACCEPTED, /* DELETE command was successful */
|
||||
HTTP_STATUS_NOT_AUTHORITATIVE, /* Information isn't authoritative */
|
||||
HTTP_STATUS_NO_CONTENT, /* Successful command, no new data */
|
||||
HTTP_STATUS_RESET_CONTENT, /* Content was reset/recreated */
|
||||
HTTP_STATUS_PARTIAL_CONTENT, /* Only a partial file was received/sent */
|
||||
|
||||
HTTP_MULTIPLE_CHOICES = 300, /* Multiple files match request */
|
||||
HTTP_MOVED_PERMANENTLY, /* Document has moved permanently */
|
||||
HTTP_MOVED_TEMPORARILY, /* Document has moved temporarily */
|
||||
HTTP_SEE_OTHER, /* See this other link... */
|
||||
HTTP_NOT_MODIFIED, /* File not modified */
|
||||
HTTP_USE_PROXY, /* Must use a proxy to access this URI */
|
||||
HTTP_STATUS_MULTIPLE_CHOICES = 300, /* Multiple files match request */
|
||||
HTTP_STATUS_MOVED_PERMANENTLY, /* Document has moved permanently */
|
||||
HTTP_STATUS_MOVED_TEMPORARILY, /* Document has moved temporarily */
|
||||
HTTP_STATUS_SEE_OTHER, /* See this other link... */
|
||||
HTTP_STATUS_NOT_MODIFIED, /* File not modified */
|
||||
HTTP_STATUS_USE_PROXY, /* Must use a proxy to access this URI */
|
||||
|
||||
HTTP_BAD_REQUEST = 400, /* Bad request */
|
||||
HTTP_UNAUTHORIZED, /* Unauthorized to access host */
|
||||
HTTP_PAYMENT_REQUIRED, /* Payment required */
|
||||
HTTP_FORBIDDEN, /* Forbidden to access this URI */
|
||||
HTTP_NOT_FOUND, /* URI was not found */
|
||||
HTTP_METHOD_NOT_ALLOWED, /* Method is not allowed */
|
||||
HTTP_NOT_ACCEPTABLE, /* Not Acceptable */
|
||||
HTTP_PROXY_AUTHENTICATION, /* Proxy Authentication is Required */
|
||||
HTTP_REQUEST_TIMEOUT, /* Request timed out */
|
||||
HTTP_CONFLICT, /* Request is self-conflicting */
|
||||
HTTP_GONE, /* Server has gone away */
|
||||
HTTP_LENGTH_REQUIRED, /* A content length or encoding is required */
|
||||
HTTP_PRECONDITION, /* Precondition failed */
|
||||
HTTP_REQUEST_TOO_LARGE, /* Request entity too large */
|
||||
HTTP_URI_TOO_LONG, /* URI too long */
|
||||
HTTP_UNSUPPORTED_MEDIATYPE, /* The requested media type is unsupported */
|
||||
HTTP_REQUESTED_RANGE, /* The requested range is not satisfiable */
|
||||
HTTP_EXPECTATION_FAILED, /* The expectation given in an Expect header field was not met */
|
||||
HTTP_UPGRADE_REQUIRED = 426, /* Upgrade to SSL/TLS required */
|
||||
HTTP_STATUS_BAD_REQUEST = 400, /* Bad request */
|
||||
HTTP_STATUS_UNAUTHORIZED, /* Unauthorized to access host */
|
||||
HTTP_STATUS_PAYMENT_REQUIRED, /* Payment required */
|
||||
HTTP_STATUS_FORBIDDEN, /* Forbidden to access this URI */
|
||||
HTTP_STATUS_NOT_FOUND, /* URI was not found */
|
||||
HTTP_STATUS_METHOD_NOT_ALLOWED, /* Method is not allowed */
|
||||
HTTP_STATUS_NOT_ACCEPTABLE, /* Not Acceptable */
|
||||
HTTP_STATUS_PROXY_AUTHENTICATION, /* Proxy Authentication is Required */
|
||||
HTTP_STATUS_REQUEST_TIMEOUT, /* Request timed out */
|
||||
HTTP_STATUS_CONFLICT, /* Request is self-conflicting */
|
||||
HTTP_STATUS_GONE, /* Server has gone away */
|
||||
HTTP_STATUS_LENGTH_REQUIRED, /* A content length or encoding is required */
|
||||
HTTP_STATUS_PRECONDITION, /* Precondition failed */
|
||||
HTTP_STATUS_REQUEST_TOO_LARGE, /* Request entity too large */
|
||||
HTTP_STATUS_URI_TOO_LONG, /* URI too long */
|
||||
HTTP_STATUS_UNSUPPORTED_MEDIATYPE, /* The requested media type is unsupported */
|
||||
HTTP_STATUS_REQUESTED_RANGE, /* The requested range is not satisfiable */
|
||||
HTTP_STATUS_EXPECTATION_FAILED, /* The expectation given in an Expect header field was not met */
|
||||
HTTP_STATUS_UPGRADE_REQUIRED = 426, /* Upgrade to SSL/TLS required */
|
||||
|
||||
HTTP_SERVER_ERROR = 500, /* Internal server error */
|
||||
HTTP_NOT_IMPLEMENTED, /* Feature not implemented */
|
||||
HTTP_BAD_GATEWAY, /* Bad gateway */
|
||||
HTTP_SERVICE_UNAVAILABLE, /* Service is unavailable */
|
||||
HTTP_GATEWAY_TIMEOUT, /* Gateway connection timed out */
|
||||
HTTP_NOT_SUPPORTED, /* HTTP version not supported */
|
||||
HTTP_STATUS_SERVER_ERROR = 500, /* Internal server error */
|
||||
HTTP_STATUS_NOT_IMPLEMENTED, /* Feature not implemented */
|
||||
HTTP_STATUS_BAD_GATEWAY, /* Bad gateway */
|
||||
HTTP_STATUS_SERVICE_UNAVAILABLE, /* Service is unavailable */
|
||||
HTTP_STATUS_GATEWAY_TIMEOUT, /* Gateway connection timed out */
|
||||
HTTP_STATUS_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_WEBIF_DISABLED /* Web interface is disabled @private@ */
|
||||
HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED = 1000,
|
||||
/* User canceled authorization @since CUPS 1.4@ */
|
||||
HTTP_STATUS_CUPS_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/macOS 10.7@ */
|
||||
HTTP_STATUS_CUPS_WEBIF_DISABLED /* Web interface is disabled @private@ */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
/* Old names for this enumeration */
|
||||
# define HTTP_ERROR HTTP_STATUS_ERROR
|
||||
|
||||
# define HTTP_CONTINUE HTTP_STATUS_CONTINUE
|
||||
# define HTTP_SWITCHING_PROTOCOLS HTTP_STATUS_SWITCHING_PROTOCOLS
|
||||
|
||||
# define HTTP_OK HTTP_STATUS_OK
|
||||
# define HTTP_CREATED HTTP_STATUS_CREATED
|
||||
# define HTTP_ACCEPTED HTTP_STATUS_ACCEPTED
|
||||
# define HTTP_NOT_AUTHORITATIVE HTTP_STATUS_NOT_AUTHORITATIVE
|
||||
# define HTTP_NO_CONTENT HTTP_STATUS_NO_CONTENT
|
||||
# define HTTP_RESET_CONTENT HTTP_STATUS_RESET_CONTENT
|
||||
# define HTTP_PARTIAL_CONTENT HTTP_STATUS_PARTIAL_CONTENT
|
||||
|
||||
# define HTTP_MULTIPLE_CHOICES HTTP_STATUS_MULTIPLE_CHOICES
|
||||
# define HTTP_MOVED_PERMANENTLY HTTP_STATUS_MOVED_PERMANENTLY
|
||||
# define HTTP_MOVED_TEMPORARILY HTTP_STATUS_MOVED_TEMPORARILY
|
||||
# define HTTP_SEE_OTHER HTTP_STATUS_SEE_OTHER
|
||||
# define HTTP_NOT_MODIFIED HTTP_STATUS_NOT_MODIFIED
|
||||
# define HTTP_USE_PROXY HTTP_STATUS_USE_PROXY
|
||||
|
||||
# define HTTP_BAD_REQUEST HTTP_STATUS_BAD_REQUEST
|
||||
# define HTTP_UNAUTHORIZED HTTP_STATUS_UNAUTHORIZED
|
||||
# define HTTP_PAYMENT_REQUIRED HTTP_STATUS_PAYMENT_REQUIRED
|
||||
# define HTTP_FORBIDDEN HTTP_STATUS_FORBIDDEN
|
||||
# define HTTP_NOT_FOUND HTTP_STATUS_NOT_FOUND
|
||||
# define HTTP_METHOD_NOT_ALLOWED HTTP_STATUS_METHOD_NOT_ALLOWED
|
||||
# define HTTP_NOT_ACCEPTABLE HTTP_STATUS_NOT_ACCEPTABLE
|
||||
# define HTTP_PROXY_AUTHENTICATION HTTP_STATUS_PROXY_AUTHENTICATION
|
||||
# define HTTP_REQUEST_TIMEOUT HTTP_STATUS_REQUEST_TIMEOUT
|
||||
# define HTTP_CONFLICT HTTP_STATUS_CONFLICT
|
||||
# define HTTP_GONE HTTP_STATUS_GONE
|
||||
# define HTTP_LENGTH_REQUIRED HTTP_STATUS_LENGTH_REQUIRED
|
||||
# define HTTP_PRECONDITION HTTP_STATUS_PRECONDITION
|
||||
# define HTTP_REQUEST_TOO_LARGE HTTP_STATUS_REQUEST_TOO_LARGE
|
||||
# define HTTP_URI_TOO_LONG HTTP_STATUS_URI_TOO_LONG
|
||||
# define HTTP_UNSUPPORTED_MEDIATYPE HTTP_STATUS_UNSUPPORTED_MEDIATYPE
|
||||
# define HTTP_REQUESTED_RANGE HTTP_STATUS_REQUESTED_RANGE
|
||||
# define HTTP_EXPECTATION_FAILED HTTP_STATUS_EXPECTATION_FAILED
|
||||
# define HTTP_UPGRADE_REQUIRED HTTP_STATUS_UPGRADE_REQUIRED
|
||||
|
||||
# define HTTP_SERVER_ERROR HTTP_STATUS_SERVER_ERROR
|
||||
# define HTTP_NOT_IMPLEMENTED HTTP_STATUS_NOT_IMPLEMENTED
|
||||
# define HTTP_BAD_GATEWAY HTTP_STATUS_BAD_GATEWAY
|
||||
# define HTTP_SERVICE_UNAVAILABLE HTTP_STATUS_SERVICE_UNAVAILABLE
|
||||
# define HTTP_GATEWAY_TIMEOUT HTTP_STATUS_GATEWAY_TIMEOUT
|
||||
# define HTTP_NOT_SUPPORTED HTTP_STATUS_NOT_SUPPORTED
|
||||
|
||||
# define HTTP_AUTHORIZATION_CANCELED HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED
|
||||
# define HTTP_PKI_ERROR HTTP_STATUS_CUPS_PKI_ERROR
|
||||
# define HTTP_WEBIF_DISABLED HTTP_STATUS_CUPS_WEBIF_DISABLED
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} http_status_t;
|
||||
|
||||
typedef enum http_trust_e /**** Level of trust for credentials @since CUPS 2.0/OS 10.10@ */
|
||||
{
|
||||
HTTP_TRUST_OK = 0, /* Credentials are OK/trusted */
|
||||
HTTP_TRUST_INVALID, /* Credentials are invalid */
|
||||
HTTP_TRUST_CHANGED, /* Credentials have changed */
|
||||
HTTP_TRUST_EXPIRED, /* Credentials are expired */
|
||||
HTTP_TRUST_RENEWED, /* Credentials have been renewed */
|
||||
HTTP_TRUST_UNKNOWN, /* Credentials are unknown/new */
|
||||
} http_trust_t;
|
||||
|
||||
typedef enum http_uri_status_e /**** URI separation status @since CUPS 1.2@ ****/
|
||||
{
|
||||
HTTP_URI_OVERFLOW = -8, /* URI buffer for httpAssembleURI is too small */
|
||||
HTTP_URI_BAD_ARGUMENTS = -7, /* Bad arguments to function (error) */
|
||||
HTTP_URI_BAD_RESOURCE = -6, /* Bad resource in URI (error) */
|
||||
HTTP_URI_BAD_PORT = -5, /* Bad port number in URI (error) */
|
||||
HTTP_URI_BAD_HOSTNAME = -4, /* Bad hostname in URI (error) */
|
||||
HTTP_URI_BAD_USERNAME = -3, /* Bad username in URI (error) */
|
||||
HTTP_URI_BAD_SCHEME = -2, /* Bad scheme in URI (error) */
|
||||
HTTP_URI_BAD_URI = -1, /* Bad/empty URI (error) */
|
||||
HTTP_URI_OK = 0, /* URI decoded OK */
|
||||
HTTP_URI_MISSING_SCHEME, /* Missing scheme in URI (warning) */
|
||||
HTTP_URI_UNKNOWN_SCHEME, /* Unknown scheme in URI (warning) */
|
||||
HTTP_URI_MISSING_RESOURCE /* Missing resource in URI (warning) */
|
||||
HTTP_URI_STATUS_OVERFLOW = -8, /* URI buffer for httpAssembleURI is too small */
|
||||
HTTP_URI_STATUS_BAD_ARGUMENTS = -7, /* Bad arguments to function (error) */
|
||||
HTTP_URI_STATUS_BAD_RESOURCE = -6, /* Bad resource in URI (error) */
|
||||
HTTP_URI_STATUS_BAD_PORT = -5, /* Bad port number in URI (error) */
|
||||
HTTP_URI_STATUS_BAD_HOSTNAME = -4, /* Bad hostname in URI (error) */
|
||||
HTTP_URI_STATUS_BAD_USERNAME = -3, /* Bad username in URI (error) */
|
||||
HTTP_URI_STATUS_BAD_SCHEME = -2, /* Bad scheme in URI (error) */
|
||||
HTTP_URI_STATUS_BAD_URI = -1, /* Bad/empty URI (error) */
|
||||
HTTP_URI_STATUS_OK = 0, /* URI decoded OK */
|
||||
HTTP_URI_STATUS_MISSING_SCHEME, /* Missing scheme in URI (warning) */
|
||||
HTTP_URI_STATUS_UNKNOWN_SCHEME, /* Unknown scheme in URI (warning) */
|
||||
HTTP_URI_STATUS_MISSING_RESOURCE /* Missing resource in URI (warning) */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define HTTP_URI_OVERFLOW HTTP_URI_STATUS_OVERFLOW
|
||||
# define HTTP_URI_BAD_ARGUMENTS HTTP_URI_STATUS_BAD_ARGUMENTS
|
||||
# define HTTP_URI_BAD_RESOURCE HTTP_URI_STATUS_BAD_RESOURCE
|
||||
# define HTTP_URI_BAD_PORT HTTP_URI_STATUS_BAD_PORT
|
||||
# define HTTP_URI_BAD_HOSTNAME HTTP_URI_STATUS_BAD_HOSTNAME
|
||||
# define HTTP_URI_BAD_USERNAME HTTP_URI_STATUS_BAD_USERNAME
|
||||
# define HTTP_URI_BAD_SCHEME HTTP_URI_STATUS_BAD_SCHEME
|
||||
# define HTTP_URI_BAD_URI HTTP_URI_STATUS_BAD_URI
|
||||
# define HTTP_URI_OK HTTP_URI_STATUS_OK
|
||||
# define HTTP_URI_MISSING_SCHEME HTTP_URI_STATUS_MISSING_SCHEME
|
||||
# define HTTP_URI_UNKNOWN_SCHEME HTTP_URI_STATUS_UNKNOWN_SCHEME
|
||||
# define HTTP_URI_MISSING_RESOURCE HTTP_URI_STATUS_MISSING_RESOURCE
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} http_uri_status_t;
|
||||
|
||||
typedef enum http_uri_coding_e /**** URI en/decode flags ****/
|
||||
@ -285,15 +395,21 @@ typedef enum http_uri_coding_e /**** URI en/decode flags ****/
|
||||
|
||||
typedef enum http_version_e /**** HTTP version numbers ****/
|
||||
{
|
||||
HTTP_0_9 = 9, /* HTTP/0.9 */
|
||||
HTTP_1_0 = 100, /* HTTP/1.0 */
|
||||
HTTP_1_1 = 101 /* HTTP/1.1 */
|
||||
HTTP_VERSION_0_9 = 9, /* HTTP/0.9 */
|
||||
HTTP_VERSION_1_0 = 100, /* HTTP/1.0 */
|
||||
HTTP_VERSION_1_1 = 101 /* HTTP/1.1 */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define HTTP_0_9 HTTP_VERSION_0_9
|
||||
# define HTTP_1_0 HTTP_VERSION_1_0
|
||||
# define HTTP_1_1 HTTP_VERSION_1_1
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} http_version_t;
|
||||
|
||||
typedef union _http_addr_u /**** Socket address union, which
|
||||
**** makes using IPv6 and other
|
||||
**** address types easier and
|
||||
**** more portable. @since CUPS 1.2/OS X 10.5@
|
||||
**** more portable. @since CUPS 1.2/macOS 10.5@
|
||||
****/
|
||||
{
|
||||
struct sockaddr addr; /* Base structure for family value */
|
||||
@ -310,7 +426,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/macOS 10.5@
|
||||
****/
|
||||
{
|
||||
struct http_addrlist_s *next; /* Pointer to next address in list */
|
||||
@ -319,14 +435,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/macOS 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/macOS 10.7@ ****/
|
||||
|
||||
|
||||
|
||||
@ -338,9 +454,11 @@ extern void httpBlocking(http_t *http, int b);
|
||||
extern int httpCheck(http_t *http);
|
||||
extern void httpClearFields(http_t *http);
|
||||
extern void httpClose(http_t *http);
|
||||
extern http_t *httpConnect(const char *host, int port);
|
||||
extern http_t *httpConnect(const char *host, int port)
|
||||
_CUPS_DEPRECATED_1_7_MSG("Use httpConnect2 instead.");
|
||||
extern http_t *httpConnectEncrypt(const char *host, int port,
|
||||
http_encryption_t encryption);
|
||||
http_encryption_t encryption)
|
||||
_CUPS_DEPRECATED_1_7_MSG("Use httpConnect2 instead.");
|
||||
extern int httpDelete(http_t *http, const char *uri);
|
||||
extern int httpEncryption(http_t *http, http_encryption_t e);
|
||||
extern int httpError(http_t *http);
|
||||
@ -360,20 +478,20 @@ extern int httpPost(http_t *http, const char *uri);
|
||||
extern int httpPrintf(http_t *http, const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
extern int httpPut(http_t *http, const char *uri);
|
||||
extern int httpRead(http_t *http, char *buffer, int length) _CUPS_DEPRECATED;
|
||||
extern int httpReconnect(http_t *http);
|
||||
extern int httpRead(http_t *http, char *buffer, int length) _CUPS_DEPRECATED_MSG("Use httpRead2 instead.");
|
||||
extern int httpReconnect(http_t *http) _CUPS_DEPRECATED_1_6_MSG("Use httpReconnect2 instead.");
|
||||
extern void httpSeparate(const char *uri, char *method,
|
||||
char *username, char *host, int *port,
|
||||
char *resource) _CUPS_DEPRECATED;
|
||||
char *resource) _CUPS_DEPRECATED_MSG("Use httpSeparateURI instead.");
|
||||
extern void httpSetField(http_t *http, http_field_t field,
|
||||
const char *value);
|
||||
extern const char *httpStatus(http_status_t status);
|
||||
extern int httpTrace(http_t *http, const char *uri);
|
||||
extern http_status_t httpUpdate(http_t *http);
|
||||
extern int httpWrite(http_t *http, const char *buffer, int length) _CUPS_DEPRECATED;
|
||||
extern char *httpEncode64(char *out, const char *in) _CUPS_DEPRECATED;
|
||||
extern char *httpDecode64(char *out, const char *in) _CUPS_DEPRECATED;
|
||||
extern int httpGetLength(http_t *http) _CUPS_DEPRECATED;
|
||||
extern int httpWrite(http_t *http, const char *buffer, int length) _CUPS_DEPRECATED_MSG("Use httpWrite2 instead.");
|
||||
extern char *httpEncode64(char *out, const char *in) _CUPS_DEPRECATED_MSG("Use httpEncode64_2 instead.");
|
||||
extern char *httpDecode64(char *out, const char *in) _CUPS_DEPRECATED_MSG("Use httpDecode64_2 instead.");
|
||||
extern int httpGetLength(http_t *http) _CUPS_DEPRECATED_MSG("Use httpGetLength2 instead.");
|
||||
extern char *httpMD5(const char *, const char *, const char *,
|
||||
char [33]);
|
||||
extern char *httpMD5Final(const char *, const char *, const char *,
|
||||
@ -394,9 +512,9 @@ extern void httpSeparate2(const char *uri,
|
||||
char *method, int methodlen,
|
||||
char *username, int usernamelen,
|
||||
char *host, int hostlen, int *port,
|
||||
char *resource, int resourcelen) _CUPS_DEPRECATED;
|
||||
char *resource, int resourcelen) _CUPS_DEPRECATED_MSG("Use httpSeparateURI instead.");
|
||||
|
||||
/**** New in CUPS 1.2/OS X 10.5 ****/
|
||||
/**** New in CUPS 1.2/macOS 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,
|
||||
@ -444,12 +562,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/macOS 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/macOS 10.7 ****/
|
||||
extern int httpAddCredential(cups_array_t *credentials,
|
||||
const void *data, size_t datalen)
|
||||
_CUPS_API_1_5;
|
||||
@ -463,7 +581,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/macOS 10.8 ****/
|
||||
extern http_addrlist_t *httpAddrConnect2(http_addrlist_t *addrlist, int *sock,
|
||||
int msec, int *cancel)
|
||||
_CUPS_API_1_6;
|
||||
@ -473,6 +591,59 @@ extern int httpReconnect2(http_t *http, int msec, int *cancel)
|
||||
_CUPS_API_1_6;
|
||||
|
||||
|
||||
/**** New in CUPS 1.7/macOS 10.9 ****/
|
||||
extern http_t *httpAcceptConnection(int fd, int blocking)
|
||||
_CUPS_API_1_7;
|
||||
extern http_addrlist_t *httpAddrCopyList(http_addrlist_t *src) _CUPS_API_1_7;
|
||||
extern int httpAddrListen(http_addr_t *addr, int port)
|
||||
_CUPS_API_1_7;
|
||||
extern int httpAddrPort(http_addr_t *addr) _CUPS_API_1_7;
|
||||
extern char *httpAssembleUUID(const char *server, int port,
|
||||
const char *name, int number,
|
||||
char *buffer, size_t bufsize)
|
||||
_CUPS_API_1_7;
|
||||
extern http_t *httpConnect2(const char *host, int port,
|
||||
http_addrlist_t *addrlist,
|
||||
int family, http_encryption_t encryption,
|
||||
int blocking, int msec, int *cancel)
|
||||
_CUPS_API_1_7;
|
||||
extern const char *httpGetContentEncoding(http_t *http) _CUPS_API_1_7;
|
||||
extern http_status_t httpGetExpect(http_t *http) _CUPS_API_1_7;
|
||||
extern ssize_t httpPeek(http_t *http, char *buffer, size_t length)
|
||||
_CUPS_API_1_7;
|
||||
extern http_state_t httpReadRequest(http_t *http, char *resource,
|
||||
size_t resourcelen) _CUPS_API_1_7;
|
||||
extern void httpSetDefaultField(http_t *http, http_field_t field,
|
||||
const char *value) _CUPS_API_1_7;
|
||||
extern http_state_t httpWriteResponse(http_t *http,
|
||||
http_status_t status) _CUPS_API_1_7;
|
||||
|
||||
/* New in CUPS 2.0/macOS 10.10 */
|
||||
extern int httpAddrClose(http_addr_t *addr, int fd) _CUPS_API_2_0;
|
||||
extern int httpAddrFamily(http_addr_t *addr) _CUPS_API_2_0;
|
||||
extern int httpCompareCredentials(cups_array_t *cred1, cups_array_t *cred2) _CUPS_API_2_0;
|
||||
extern int httpCredentialsAreValidForName(cups_array_t *credentials, const char *common_name);
|
||||
extern time_t httpCredentialsGetExpiration(cups_array_t *credentials) _CUPS_API_2_0;
|
||||
extern http_trust_t httpCredentialsGetTrust(cups_array_t *credentials, const char *common_name) _CUPS_API_2_0;
|
||||
extern size_t httpCredentialsString(cups_array_t *credentials, char *buffer, size_t bufsize) _CUPS_API_2_0;
|
||||
extern http_field_t httpFieldValue(const char *name) _CUPS_API_2_0;
|
||||
extern time_t httpGetActivity(http_t *http) _CUPS_API_2_0;
|
||||
extern http_addr_t *httpGetAddress(http_t *http) _CUPS_API_2_0;
|
||||
extern http_encryption_t httpGetEncryption(http_t *http) _CUPS_API_2_0;
|
||||
extern http_keepalive_t httpGetKeepAlive(http_t *http) _CUPS_API_2_0;
|
||||
extern size_t httpGetPending(http_t *http) _CUPS_API_2_0;
|
||||
extern size_t httpGetReady(http_t *http) _CUPS_API_2_0;
|
||||
extern size_t httpGetRemaining(http_t *http) _CUPS_API_2_0;
|
||||
extern int httpIsChunked(http_t *http) _CUPS_API_2_0;
|
||||
extern int httpIsEncrypted(http_t *http) _CUPS_API_2_0;
|
||||
extern int httpLoadCredentials(const char *path, cups_array_t **credentials, const char *common_name) _CUPS_API_2_0;
|
||||
extern const char *httpResolveHostname(http_t *http, char *buffer, size_t bufsize) _CUPS_API_2_0;
|
||||
extern int httpSaveCredentials(const char *path, cups_array_t *credentials, const char *common_name) _CUPS_API_2_0;
|
||||
extern void httpSetKeepAlive(http_t *http, http_keepalive_t keep_alive) _CUPS_API_2_0;
|
||||
extern void httpShutdown(http_t *http) _CUPS_API_2_0;
|
||||
extern const char *httpStateString(http_state_t state) _CUPS_API_2_0;
|
||||
extern const char *httpURIStatusString(http_uri_status_t status) _CUPS_API_2_0;
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
@ -481,7 +652,3 @@ extern int httpReconnect2(http_t *http, int msec, int *cancel)
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_HTTP_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: http.h 7026 2007-10-19 00:57:45Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: ipp-private.h 7259 2008-01-28 22:26:04Z mike $"
|
||||
* Private IPP definitions for CUPS.
|
||||
*
|
||||
* Private IPP definitions for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_IPP_PRIVATE_H_
|
||||
@ -54,6 +52,7 @@ typedef struct /**** Attribute mapping data ****/
|
||||
ipp_tag_t group_tag; /* Group tag for this attribute */
|
||||
ipp_tag_t alt_group_tag; /* Alternate group tag for this
|
||||
* attribute */
|
||||
const ipp_op_t *operations; /* Allowed operations for this attr */
|
||||
} _ipp_option_t;
|
||||
|
||||
|
||||
@ -61,9 +60,11 @@ typedef struct /**** Attribute mapping data ****/
|
||||
* Prototypes for private functions...
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
extern const char *_ippCheckOptions(void);
|
||||
#endif /* DEBUG */
|
||||
extern _ipp_option_t *_ippFindOption(const char *name);
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
@ -72,7 +73,3 @@ extern _ipp_option_t *_ippFindOption(const char *name);
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_IPP_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: ipp-private.h 7259 2008-01-28 22:26:04Z mike $".
|
||||
*/
|
||||
|
||||
1456
cups/ipp-support.c
1456
cups/ipp-support.c
File diff suppressed because it is too large
Load Diff
2679
cups/ipp.c
2679
cups/ipp.c
File diff suppressed because it is too large
Load Diff
762
cups/ipp.h
762
cups/ipp.h
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: ipp.h 7847 2008-08-19 04:22:14Z mike $"
|
||||
* Internet Printing Protocol definitions for CUPS.
|
||||
*
|
||||
* Internet Printing Protocol definitions for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_IPP_H_
|
||||
@ -23,6 +21,7 @@
|
||||
*/
|
||||
|
||||
# include "http.h"
|
||||
# include <stdarg.h>
|
||||
|
||||
|
||||
/*
|
||||
@ -54,10 +53,25 @@ extern "C" {
|
||||
* Common limits...
|
||||
*/
|
||||
|
||||
# define IPP_MAX_CHARSET 64 /* Maximum length of charset values w/nul */
|
||||
# define IPP_MAX_KEYWORD 256 /* Maximum length of keyword values w/nul */
|
||||
# define IPP_MAX_LANGUAGE 64 /* Maximum length of naturalLanguage values w/nul */
|
||||
# define IPP_MAX_LENGTH 32767 /* Maximum size of any single value */
|
||||
# define IPP_MAX_NAME 256 /* Maximum length of common name values */
|
||||
# define IPP_MAX_MIMETYPE 256 /* Maximum length of mimeMediaType values w/nul */
|
||||
# define IPP_MAX_NAME 256 /* Maximum length of common name values w/nul */
|
||||
# define IPP_MAX_OCTETSTRING 1023 /* Maximum length of octetString values w/o nul */
|
||||
# define IPP_MAX_TEXT 1024 /* Maximum length of text values w/nul */
|
||||
# define IPP_MAX_URI 1024 /* Maximum length of uri values w/nul */
|
||||
# define IPP_MAX_URISCHEME 64 /* Maximum length of uriScheme values w/nul */
|
||||
# define IPP_MAX_VALUES 8 /* Power-of-2 allocation increment */
|
||||
|
||||
/*
|
||||
* Macro to flag a text string attribute as "const" (static storage) vs.
|
||||
* allocated.
|
||||
*/
|
||||
|
||||
# define IPP_CONST_TAG(x) (ipp_tag_t)(IPP_TAG_CUPS_CONST | (x))
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
@ -65,14 +79,22 @@ extern "C" {
|
||||
|
||||
typedef enum ipp_dstate_e /**** Document states ****/
|
||||
{
|
||||
IPP_DOCUMENT_PENDING = 3,
|
||||
IPP_DOCUMENT_PROCESSING = 5,
|
||||
IPP_DOCUMENT_CANCELED = 7,
|
||||
IPP_DOCUMENT_ABORTED,
|
||||
IPP_DOCUMENT_COMPLETED
|
||||
IPP_DOCUMENT_PENDING = 3, /* Document is pending */
|
||||
IPP_DOCUMENT_PROCESSING = 5, /* Document is processing */
|
||||
IPP_DOCUMENT_CANCELED = 7, /* Document is canceled */
|
||||
IPP_DOCUMENT_ABORTED, /* Document is aborted */
|
||||
IPP_DOCUMENT_COMPLETED /* Document is completed */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_DOCUMENT_PENDING IPP_DSTATE_PENDING
|
||||
# define IPP_DOCUMENT_PROCESSING IPP_DSTATE_PROCESSING
|
||||
# define IPP_DOCUMENT_CANCELED IPP_DSTATE_CANCELED
|
||||
# define IPP_DOCUMENT_ABORTED IPP_DSTATE_ABORTED
|
||||
# define IPP_DOCUMENT_COMPLETED IPP_DSTATE_COMPLETED
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} ipp_dstate_t;
|
||||
|
||||
typedef enum ipp_finish_e /**** Finishings ****/
|
||||
typedef enum ipp_finishings_e /**** Finishings ****/
|
||||
{
|
||||
IPP_FINISHINGS_NONE = 3, /* No finishing */
|
||||
IPP_FINISHINGS_STAPLE, /* Staple (any location) */
|
||||
@ -85,7 +107,9 @@ typedef enum ipp_finish_e /**** Finishings ****/
|
||||
IPP_FINISHINGS_TRIM, /* Trim (any type) */
|
||||
IPP_FINISHINGS_BALE, /* Bale (any type) */
|
||||
IPP_FINISHINGS_BOOKLET_MAKER, /* Fold to make booklet */
|
||||
IPP_FINISHINGS_JOB_OFFSET, /* Offset for binding (any type) */
|
||||
IPP_FINISHINGS_JOG_OFFSET, /* Offset for binding (any type) */
|
||||
IPP_FINISHINGS_COAT, /* Apply protective liquid or powder coating */
|
||||
IPP_FINISHINGS_LAMINATE, /* Apply protective (solid) material */
|
||||
IPP_FINISHINGS_STAPLE_TOP_LEFT = 20, /* Staple top left corner */
|
||||
IPP_FINISHINGS_STAPLE_BOTTOM_LEFT, /* Staple bottom left corner */
|
||||
IPP_FINISHINGS_STAPLE_TOP_RIGHT, /* Staple top right corner */
|
||||
@ -98,6 +122,10 @@ typedef enum ipp_finish_e /**** Finishings ****/
|
||||
IPP_FINISHINGS_STAPLE_DUAL_TOP, /* Two staples on top */
|
||||
IPP_FINISHINGS_STAPLE_DUAL_RIGHT, /* Two staples on right */
|
||||
IPP_FINISHINGS_STAPLE_DUAL_BOTTOM, /* Two staples on bottom */
|
||||
IPP_FINISHINGS_STAPLE_TRIPLE_LEFT, /* Three staples on left */
|
||||
IPP_FINISHINGS_STAPLE_TRIPLE_TOP, /* Three staples on top */
|
||||
IPP_FINISHINGS_STAPLE_TRIPLE_RIGHT, /* Three staples on right */
|
||||
IPP_FINISHINGS_STAPLE_TRIPLE_BOTTOM, /* Three staples on bottom */
|
||||
IPP_FINISHINGS_BIND_LEFT = 50, /* Bind on left */
|
||||
IPP_FINISHINGS_BIND_TOP, /* Bind on top */
|
||||
IPP_FINISHINGS_BIND_RIGHT, /* Bind on right */
|
||||
@ -105,126 +133,321 @@ typedef enum ipp_finish_e /**** Finishings ****/
|
||||
IPP_FINISHINGS_TRIM_AFTER_PAGES = 60, /* Trim output after each page */
|
||||
IPP_FINISHINGS_TRIM_AFTER_DOCUMENTS, /* Trim output after each document */
|
||||
IPP_FINISHINGS_TRIM_AFTER_COPIES, /* Trim output after each copy */
|
||||
IPP_FINISHINGS_TRIM_AFTER_JOB /* Trim output after job */
|
||||
} ipp_finish_t;
|
||||
IPP_FINISHINGS_TRIM_AFTER_JOB, /* Trim output after job */
|
||||
IPP_FINISHINGS_PUNCH_TOP_LEFT = 70, /* Punch 1 hole top left */
|
||||
IPP_FINISHINGS_PUNCH_BOTTOM_LEFT, /* Punch 1 hole bottom left */
|
||||
IPP_FINISHINGS_PUNCH_TOP_RIGHT, /* Punch 1 hole top right */
|
||||
IPP_FINISHINGS_PUNCH_BOTTOM_RIGHT, /* Punch 1 hole bottom right */
|
||||
IPP_FINISHINGS_PUNCH_DUAL_LEFT, /* Punch 2 holes left side */
|
||||
IPP_FINISHINGS_PUNCH_DUAL_TOP, /* Punch 2 holes top edge */
|
||||
IPP_FINISHINGS_PUNCH_DUAL_RIGHT, /* Punch 2 holes right side */
|
||||
IPP_FINISHINGS_PUNCH_DUAL_BOTTOM, /* Punch 2 holes bottom edge */
|
||||
IPP_FINISHINGS_PUNCH_TRIPLE_LEFT, /* Punch 3 holes left side */
|
||||
IPP_FINISHINGS_PUNCH_TRIPLE_TOP, /* Punch 3 holes top edge */
|
||||
IPP_FINISHINGS_PUNCH_TRIPLE_RIGHT, /* Punch 3 holes right side */
|
||||
IPP_FINISHINGS_PUNCH_TRIPLE_BOTTOM, /* Punch 3 holes bottom edge */
|
||||
IPP_FINISHINGS_PUNCH_QUAD_LEFT, /* Punch 4 holes left side */
|
||||
IPP_FINISHINGS_PUNCH_QUAD_TOP, /* Punch 4 holes top edge */
|
||||
IPP_FINISHINGS_PUNCH_QUAD_RIGHT, /* Punch 4 holes right side */
|
||||
IPP_FINISHINGS_PUNCH_QUAD_BOTTOM, /* Punch 4 holes bottom edge */
|
||||
IPP_FINISHINGS_FOLD_ACCORDIAN = 90, /* Accordian-fold the paper vertically into four sections */
|
||||
IPP_FINISHINGS_FOLD_DOUBLE_GATE, /* Fold the top and bottom quarters of the paper towards the midline, then fold in half vertically */
|
||||
IPP_FINISHINGS_FOLD_GATE, /* Fold the top and bottom quarters of the paper towards the midline */
|
||||
IPP_FINISHINGS_FOLD_HALF, /* Fold the paper in half vertically */
|
||||
IPP_FINISHINGS_FOLD_HALF_Z, /* Fold the paper in half horizontally, then Z-fold the paper vertically */
|
||||
IPP_FINISHINGS_FOLD_LEFT_GATE, /* Fold the top quarter of the paper towards the midline */
|
||||
IPP_FINISHINGS_FOLD_LETTER, /* Fold the paper into three sections vertically; sometimes also known as a C fold*/
|
||||
IPP_FINISHINGS_FOLD_PARALLEL, /* Fold the paper in half vertically two times, yielding four sections */
|
||||
IPP_FINISHINGS_FOLD_POSTER, /* Fold the paper in half horizontally and vertically; sometimes also called a cross fold */
|
||||
IPP_FINISHINGS_FOLD_RIGHT_GATE, /* Fold the bottom quarter of the paper towards the midline */
|
||||
IPP_FINISHINGS_FOLD_Z, /* Fold the paper vertically into three sections, forming a Z */
|
||||
|
||||
/* CUPS extensions for finishings (pre-standard versions of values above) */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_TOP_LEFT = 0x40000046,
|
||||
/* Punch 1 hole top left */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_BOTTOM_LEFT,/* Punch 1 hole bottom left */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_TOP_RIGHT, /* Punch 1 hole top right */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_BOTTOM_RIGHT,
|
||||
/* Punch 1 hole bottom right */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_DUAL_LEFT, /* Punch 2 holes left side */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_DUAL_TOP, /* Punch 2 holes top edge */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_DUAL_RIGHT, /* Punch 2 holes right side */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_DUAL_BOTTOM,/* Punch 2 holes bottom edge */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_TRIPLE_LEFT,/* Punch 3 holes left side */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_TRIPLE_TOP, /* Punch 3 holes top edge */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_TRIPLE_RIGHT,
|
||||
/* Punch 3 holes right side */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_TRIPLE_BOTTOM,
|
||||
/* Punch 3 holes bottom edge */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_QUAD_LEFT, /* Punch 4 holes left side */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_QUAD_TOP, /* Punch 4 holes top edge */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_QUAD_RIGHT, /* Punch 4 holes right side */
|
||||
IPP_FINISHINGS_CUPS_PUNCH_QUAD_BOTTOM,/* Punch 4 holes bottom edge */
|
||||
|
||||
IPP_FINISHINGS_CUPS_FOLD_ACCORDIAN = 0x4000005A,
|
||||
/* Accordian-fold the paper vertically into four sections */
|
||||
IPP_FINISHINGS_CUPS_FOLD_DOUBLE_GATE, /* Fold the top and bottom quarters of the paper towards the midline, then fold in half vertically */
|
||||
IPP_FINISHINGS_CUPS_FOLD_GATE, /* Fold the top and bottom quarters of the paper towards the midline */
|
||||
IPP_FINISHINGS_CUPS_FOLD_HALF, /* Fold the paper in half vertically */
|
||||
IPP_FINISHINGS_CUPS_FOLD_HALF_Z, /* Fold the paper in half horizontally, then Z-fold the paper vertically */
|
||||
IPP_FINISHINGS_CUPS_FOLD_LEFT_GATE, /* Fold the top quarter of the paper towards the midline */
|
||||
IPP_FINISHINGS_CUPS_FOLD_LETTER, /* Fold the paper into three sections vertically; sometimes also known as a C fold*/
|
||||
IPP_FINISHINGS_CUPS_FOLD_PARALLEL, /* Fold the paper in half vertically two times, yielding four sections */
|
||||
IPP_FINISHINGS_CUPS_FOLD_POSTER, /* Fold the paper in half horizontally and vertically; sometimes also called a cross fold */
|
||||
IPP_FINISHINGS_CUPS_FOLD_RIGHT_GATE, /* Fold the bottom quarter of the paper towards the midline */
|
||||
IPP_FINISHINGS_CUPS_FOLD_Z /* Fold the paper vertically into three sections, forming a Z */
|
||||
} ipp_finishings_t;
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_FINISHINGS_JOB_OFFSET IPP_FINISHINGS_JOG_OFFSET
|
||||
/* Long-time misspelling... */
|
||||
typedef enum ipp_finishings_e ipp_finish_t;
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
|
||||
typedef enum ipp_jcollate_e /**** Job collation types ****/
|
||||
{
|
||||
IPP_JOB_UNCOLLATED_SHEETS = 3,
|
||||
IPP_JOB_COLLATED_DOCUMENTS,
|
||||
IPP_JOB_UNCOLLATED_DOCUMENTS
|
||||
IPP_JCOLLATE_UNCOLLATED_SHEETS = 3,
|
||||
IPP_JCOLLATE_COLLATED_DOCUMENTS,
|
||||
IPP_JCOLLATE_UNCOLLATED_DOCUMENTS
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_JOB_UNCOLLATED_SHEETS IPP_JCOLLATE_UNCOLLATED_SHEETS
|
||||
# define IPP_JOB_COLLATED_DOCUMENTS IPP_JCOLLATE_COLLATED_DOCUMENTS
|
||||
# define IPP_JOB_UNCOLLATED_DOCUMENTS IPP_JCOLLATE_UNCOLLATED_DOCUMENTS
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} ipp_jcollate_t;
|
||||
|
||||
typedef enum ipp_jstate_e /**** Job states ****/
|
||||
{
|
||||
IPP_JOB_PENDING = 3, /* Job is waiting to be printed */
|
||||
IPP_JOB_HELD, /* Job is held for printing */
|
||||
IPP_JOB_PROCESSING, /* Job is currently printing */
|
||||
IPP_JOB_STOPPED, /* Job has been stopped */
|
||||
IPP_JOB_CANCELED, /* Job has been canceled */
|
||||
IPP_JOB_ABORTED, /* Job has aborted due to error */
|
||||
IPP_JOB_COMPLETED /* Job has completed successfully */
|
||||
IPP_JSTATE_PENDING = 3, /* Job is waiting to be printed */
|
||||
IPP_JSTATE_HELD, /* Job is held for printing */
|
||||
IPP_JSTATE_PROCESSING, /* Job is currently printing */
|
||||
IPP_JSTATE_STOPPED, /* Job has been stopped */
|
||||
IPP_JSTATE_CANCELED, /* Job has been canceled */
|
||||
IPP_JSTATE_ABORTED, /* Job has aborted due to error */
|
||||
IPP_JSTATE_COMPLETED /* Job has completed successfully */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_JOB_PENDING IPP_JSTATE_PENDING
|
||||
# define IPP_JOB_HELD IPP_JSTATE_HELD
|
||||
# define IPP_JOB_PROCESSING IPP_JSTATE_PROCESSING
|
||||
# define IPP_JOB_STOPPED IPP_JSTATE_STOPPED
|
||||
# define IPP_JOB_CANCELED IPP_JSTATE_CANCELED
|
||||
# define IPP_JOB_ABORTED IPP_JSTATE_ABORTED
|
||||
# define IPP_JOB_COMPLETED IPP_JSTATE_COMPLETED
|
||||
/* Legacy name for canceled state */
|
||||
#define IPP_JOB_CANCELLED IPP_JOB_CANCELED
|
||||
# define IPP_JOB_CANCELLED IPP_JSTATE_CANCELED
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} ipp_jstate_t;
|
||||
|
||||
typedef enum ipp_op_e /**** IPP operations ****/
|
||||
{
|
||||
IPP_OP_CUPS_INVALID = -1, /* Invalid operation name for @link ippOpValue@ */
|
||||
IPP_PRINT_JOB = 0x0002, /* Print a single file */
|
||||
IPP_PRINT_URI, /* Print a single URL @private@ */
|
||||
IPP_VALIDATE_JOB, /* Validate job options */
|
||||
IPP_CREATE_JOB, /* Create an empty print job */
|
||||
IPP_SEND_DOCUMENT, /* Add a file to a job */
|
||||
IPP_SEND_URI, /* Add a URL to a job @private@ */
|
||||
IPP_CANCEL_JOB, /* Cancel a job */
|
||||
IPP_GET_JOB_ATTRIBUTES, /* Get job attributes */
|
||||
IPP_GET_JOBS, /* Get a list of jobs */
|
||||
IPP_GET_PRINTER_ATTRIBUTES, /* Get printer attributes */
|
||||
IPP_HOLD_JOB, /* Hold a job for printing */
|
||||
IPP_RELEASE_JOB, /* Release a job for printing */
|
||||
IPP_RESTART_JOB, /* Reprint a job */
|
||||
IPP_PAUSE_PRINTER = 0x0010, /* Stop a printer */
|
||||
IPP_RESUME_PRINTER, /* Start a printer */
|
||||
IPP_PURGE_JOBS, /* Cancel all jobs */
|
||||
IPP_SET_PRINTER_ATTRIBUTES, /* Set printer attributes @private@ */
|
||||
IPP_SET_JOB_ATTRIBUTES, /* Set job attributes */
|
||||
IPP_GET_PRINTER_SUPPORTED_VALUES, /* Get supported attribute values */
|
||||
IPP_CREATE_PRINTER_SUBSCRIPTION, /* Create a printer subscription @since CUPS 1.2/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_SEND_NOTIFICATIONS, /* Send notification events @private@ */
|
||||
IPP_GET_RESOURCE_ATTRIBUTES, /* Get resource attributes @private@ */
|
||||
IPP_GET_RESOURCE_DATA, /* Get resource data @private@ */
|
||||
IPP_GET_RESOURCES, /* Get list of resources @private@ */
|
||||
IPP_GET_PRINT_SUPPORT_FILES, /* Get printer support files @private@ */
|
||||
IPP_ENABLE_PRINTER, /* Start a printer */
|
||||
IPP_DISABLE_PRINTER, /* Stop a printer */
|
||||
IPP_PAUSE_PRINTER_AFTER_CURRENT_JOB, /* Stop printer after the current job @private@ */
|
||||
IPP_HOLD_NEW_JOBS, /* Hold new jobs @private@ */
|
||||
IPP_RELEASE_HELD_NEW_JOBS, /* Release new jobs @private@ */
|
||||
IPP_DEACTIVATE_PRINTER, /* Stop a printer @private@ */
|
||||
IPP_ACTIVATE_PRINTER, /* Start a printer @private@ */
|
||||
IPP_RESTART_PRINTER, /* Restart a printer @private@ */
|
||||
IPP_SHUTDOWN_PRINTER, /* Turn a printer off @private@ */
|
||||
IPP_STARTUP_PRINTER, /* Turn a printer on @private@ */
|
||||
IPP_REPROCESS_JOB, /* Reprint a job @private@ */
|
||||
IPP_CANCEL_CURRENT_JOB, /* Cancel the current job @private@ */
|
||||
IPP_SUSPEND_CURRENT_JOB, /* Suspend the current job @private@ */
|
||||
IPP_RESUME_JOB, /* Resume the current job @private@ */
|
||||
IPP_PROMOTE_JOB, /* Promote a job to print sooner @private@ */
|
||||
IPP_SCHEDULE_JOB_AFTER, /* Schedule a job to print after another @private@ */
|
||||
IPP_CANCEL_DOCUMENT = 0x0033, /* Cancel-Document @private@ */
|
||||
IPP_GET_DOCUMENT_ATTRIBUTES, /* Get-Document-Attributes @private@ */
|
||||
IPP_GET_DOCUMENTS, /* Get-Documents @private@ */
|
||||
IPP_DELETE_DOCUMENT, /* Delete-Document @private@ */
|
||||
IPP_SET_DOCUMENT_ATTRIBUTES, /* Set-Document-Attributes @private@ */
|
||||
IPP_CANCEL_JOBS, /* Cancel-Jobs */
|
||||
IPP_CANCEL_MY_JOBS, /* Cancel-My-Jobs */
|
||||
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 */
|
||||
CUPS_ADD_MODIFY_PRINTER, /* Add or modify a printer */
|
||||
CUPS_DELETE_PRINTER, /* Delete a printer */
|
||||
CUPS_GET_CLASSES, /* Get a list of classes @deprecated@ */
|
||||
CUPS_ADD_MODIFY_CLASS, /* Add or modify a class */
|
||||
CUPS_DELETE_CLASS, /* Delete a class */
|
||||
CUPS_ACCEPT_JOBS, /* Accept new jobs on a printer */
|
||||
CUPS_REJECT_JOBS, /* Reject new jobs on a printer */
|
||||
CUPS_SET_DEFAULT, /* Set the default printer */
|
||||
CUPS_GET_DEVICES, /* Get a list of supported devices */
|
||||
CUPS_GET_PPDS, /* Get a list of supported drivers */
|
||||
CUPS_MOVE_JOB, /* Move a job to a different printer */
|
||||
CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2/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@ */
|
||||
IPP_OP_CUPS_NONE = 0, /* No operation @private@ */
|
||||
IPP_OP_PRINT_JOB = 0x0002, /* Print a single file */
|
||||
IPP_OP_PRINT_URI, /* Print a single URL */
|
||||
IPP_OP_VALIDATE_JOB, /* Validate job options */
|
||||
IPP_OP_CREATE_JOB, /* Create an empty print job */
|
||||
IPP_OP_SEND_DOCUMENT, /* Add a file to a job */
|
||||
IPP_OP_SEND_URI, /* Add a URL to a job */
|
||||
IPP_OP_CANCEL_JOB, /* Cancel a job */
|
||||
IPP_OP_GET_JOB_ATTRIBUTES, /* Get job attributes */
|
||||
IPP_OP_GET_JOBS, /* Get a list of jobs */
|
||||
IPP_OP_GET_PRINTER_ATTRIBUTES, /* Get printer attributes */
|
||||
IPP_OP_HOLD_JOB, /* Hold a job for printing */
|
||||
IPP_OP_RELEASE_JOB, /* Release a job for printing */
|
||||
IPP_OP_RESTART_JOB, /* Reprint a job */
|
||||
IPP_OP_PAUSE_PRINTER = 0x0010, /* Stop a printer */
|
||||
IPP_OP_RESUME_PRINTER, /* Start a printer */
|
||||
IPP_OP_PURGE_JOBS, /* Cancel all jobs */
|
||||
IPP_OP_SET_PRINTER_ATTRIBUTES, /* Set printer attributes */
|
||||
IPP_OP_SET_JOB_ATTRIBUTES, /* Set job attributes */
|
||||
IPP_OP_GET_PRINTER_SUPPORTED_VALUES, /* Get supported attribute values */
|
||||
IPP_OP_CREATE_PRINTER_SUBSCRIPTIONS, /* Create one or more printer subscriptions @since CUPS 1.2/macOS 10.5@ */
|
||||
IPP_OP_CREATE_JOB_SUBSCRIPTIONS, /* Create one of more job subscriptions @since CUPS 1.2/macOS 10.5@ */
|
||||
IPP_OP_GET_SUBSCRIPTION_ATTRIBUTES, /* Get subscription attributes @since CUPS 1.2/macOS 10.5@ */
|
||||
IPP_OP_GET_SUBSCRIPTIONS, /* Get list of subscriptions @since CUPS 1.2/macOS 10.5@ */
|
||||
IPP_OP_RENEW_SUBSCRIPTION, /* Renew a printer subscription @since CUPS 1.2/macOS 10.5@ */
|
||||
IPP_OP_CANCEL_SUBSCRIPTION, /* Cancel a subscription @since CUPS 1.2/macOS 10.5@ */
|
||||
IPP_OP_GET_NOTIFICATIONS, /* Get notification events @since CUPS 1.2/macOS 10.5@ */
|
||||
IPP_OP_SEND_NOTIFICATIONS, /* Send notification events @private@ */
|
||||
IPP_OP_GET_RESOURCE_ATTRIBUTES, /* Get resource attributes @private@ */
|
||||
IPP_OP_GET_RESOURCE_DATA, /* Get resource data @private@ */
|
||||
IPP_OP_GET_RESOURCES, /* Get list of resources @private@ */
|
||||
IPP_OP_GET_PRINT_SUPPORT_FILES, /* Get printer support files @private@ */
|
||||
IPP_OP_ENABLE_PRINTER, /* Start a printer */
|
||||
IPP_OP_DISABLE_PRINTER, /* Stop a printer */
|
||||
IPP_OP_PAUSE_PRINTER_AFTER_CURRENT_JOB,
|
||||
/* Stop printer after the current job */
|
||||
IPP_OP_HOLD_NEW_JOBS, /* Hold new jobs */
|
||||
IPP_OP_RELEASE_HELD_NEW_JOBS, /* Release new jobs */
|
||||
IPP_OP_DEACTIVATE_PRINTER, /* Stop a printer */
|
||||
IPP_OP_ACTIVATE_PRINTER, /* Start a printer */
|
||||
IPP_OP_RESTART_PRINTER, /* Restart a printer */
|
||||
IPP_OP_SHUTDOWN_PRINTER, /* Turn a printer off */
|
||||
IPP_OP_STARTUP_PRINTER, /* Turn a printer on */
|
||||
IPP_OP_REPROCESS_JOB, /* Reprint a job */
|
||||
IPP_OP_CANCEL_CURRENT_JOB, /* Cancel the current job */
|
||||
IPP_OP_SUSPEND_CURRENT_JOB, /* Suspend the current job */
|
||||
IPP_OP_RESUME_JOB, /* Resume the current job */
|
||||
IPP_OP_PROMOTE_JOB, /* Promote a job to print sooner */
|
||||
IPP_OP_SCHEDULE_JOB_AFTER, /* Schedule a job to print after another */
|
||||
IPP_OP_CANCEL_DOCUMENT = 0x0033, /* Cancel-Document */
|
||||
IPP_OP_GET_DOCUMENT_ATTRIBUTES, /* Get-Document-Attributes */
|
||||
IPP_OP_GET_DOCUMENTS, /* Get-Documents */
|
||||
IPP_OP_DELETE_DOCUMENT, /* Delete-Document */
|
||||
IPP_OP_SET_DOCUMENT_ATTRIBUTES, /* Set-Document-Attributes */
|
||||
IPP_OP_CANCEL_JOBS, /* Cancel-Jobs */
|
||||
IPP_OP_CANCEL_MY_JOBS, /* Cancel-My-Jobs */
|
||||
IPP_OP_RESUBMIT_JOB, /* Resubmit-Job */
|
||||
IPP_OP_CLOSE_JOB, /* Close-Job */
|
||||
IPP_OP_IDENTIFY_PRINTER, /* Identify-Printer */
|
||||
IPP_OP_VALIDATE_DOCUMENT, /* Validate-Document */
|
||||
IPP_OP_ADD_DOCUMENT_IMAGES, /* Add-Document-Images */
|
||||
IPP_OP_ACKNOWLEDGE_DOCUMENT, /* Acknowledge-Document */
|
||||
IPP_OP_ACKNOWLEDGE_IDENTIFY_PRINTER, /* Acknowledge-Identify-Printer */
|
||||
IPP_OP_ACKNOWLEDGE_JOB, /* Acknowledge-Job */
|
||||
IPP_OP_FETCH_DOCUMENT, /* Fetch-Document */
|
||||
IPP_OP_FETCH_JOB, /* Fetch-Job */
|
||||
IPP_OP_GET_OUTPUT_DEVICE_ATTRIBUTES, /* Get-Output-Device-Attributes */
|
||||
IPP_OP_UPDATE_ACTIVE_JOBS, /* Update-Active-Jobs */
|
||||
IPP_OP_DEREGISTER_OUTPUT_DEVICE, /* Deregister-Output-Device */
|
||||
IPP_OP_UPDATE_DOCUMENT_STATUS, /* Update-Document-Status */
|
||||
IPP_OP_UPDATE_JOB_STATUS, /* Update-Job-Status */
|
||||
IPP_OP_UPDATE_OUTPUT_DEVICE_ATTRIBUTES,
|
||||
/* Update-Output-Device-Attributes */
|
||||
IPP_OP_GET_NEXT_DOCUMENT_DATA, /* Get-Next-Document-Data */
|
||||
|
||||
/* Legacy names for the add operations */
|
||||
#define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER
|
||||
#define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS
|
||||
IPP_OP_PRIVATE = 0x4000, /* Reserved @private@ */
|
||||
IPP_OP_CUPS_GET_DEFAULT, /* Get the default printer */
|
||||
IPP_OP_CUPS_GET_PRINTERS, /* Get a list of printers and/or classes */
|
||||
IPP_OP_CUPS_ADD_MODIFY_PRINTER, /* Add or modify a printer */
|
||||
IPP_OP_CUPS_DELETE_PRINTER, /* Delete a printer */
|
||||
IPP_OP_CUPS_GET_CLASSES, /* Get a list of classes @deprecated@ */
|
||||
IPP_OP_CUPS_ADD_MODIFY_CLASS, /* Add or modify a class */
|
||||
IPP_OP_CUPS_DELETE_CLASS, /* Delete a class */
|
||||
IPP_OP_CUPS_ACCEPT_JOBS, /* Accept new jobs on a printer */
|
||||
IPP_OP_CUPS_REJECT_JOBS, /* Reject new jobs on a printer */
|
||||
IPP_OP_CUPS_SET_DEFAULT, /* Set the default printer */
|
||||
IPP_OP_CUPS_GET_DEVICES, /* Get a list of supported devices @deprecated@ */
|
||||
IPP_OP_CUPS_GET_PPDS, /* Get a list of supported drivers @deprecated@ */
|
||||
IPP_OP_CUPS_MOVE_JOB, /* Move a job to a different printer */
|
||||
IPP_OP_CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2/macOS 10.5@ */
|
||||
IPP_OP_CUPS_GET_PPD, /* Get a PPD file @deprecated@ */
|
||||
IPP_OP_CUPS_GET_DOCUMENT = 0x4027, /* Get a document file @since CUPS 1.4/macOS 10.6@ */
|
||||
IPP_OP_CUPS_CREATE_LOCAL_PRINTER /* Create a local (temporary) printer @since CUPS 2.2 */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_PRINT_JOB IPP_OP_PRINT_JOB
|
||||
# define IPP_PRINT_URI IPP_OP_PRINT_URI
|
||||
# define IPP_VALIDATE_JOB IPP_OP_VALIDATE_JOB
|
||||
# define IPP_CREATE_JOB IPP_OP_CREATE_JOB
|
||||
# define IPP_SEND_DOCUMENT IPP_OP_SEND_DOCUMENT
|
||||
# define IPP_SEND_URI IPP_OP_SEND_URI
|
||||
# define IPP_CANCEL_JOB IPP_OP_CANCEL_JOB
|
||||
# define IPP_GET_JOB_ATTRIBUTES IPP_OP_GET_JOB_ATTRIBUTES
|
||||
# define IPP_GET_JOBS IPP_OP_GET_JOBS
|
||||
# define IPP_GET_PRINTER_ATTRIBUTES IPP_OP_GET_PRINTER_ATTRIBUTES
|
||||
# define IPP_HOLD_JOB IPP_OP_HOLD_JOB
|
||||
# define IPP_RELEASE_JOB IPP_OP_RELEASE_JOB
|
||||
# define IPP_RESTART_JOB IPP_OP_RESTART_JOB
|
||||
# define IPP_PAUSE_PRINTER IPP_OP_PAUSE_PRINTER
|
||||
# define IPP_RESUME_PRINTER IPP_OP_RESUME_PRINTER
|
||||
# define IPP_PURGE_JOBS IPP_OP_PURGE_JOBS
|
||||
# define IPP_SET_PRINTER_ATTRIBUTES IPP_OP_SET_PRINTER_ATTRIBUTES
|
||||
# define IPP_SET_JOB_ATTRIBUTES IPP_OP_SET_JOB_ATTRIBUTES
|
||||
# define IPP_GET_PRINTER_SUPPORTED_VALUES IPP_OP_GET_PRINTER_SUPPORTED_VALUES
|
||||
# define IPP_CREATE_PRINTER_SUBSCRIPTION IPP_OP_CREATE_PRINTER_SUBSCRIPTIONS
|
||||
# define IPP_CREATE_JOB_SUBSCRIPTION IPP_OP_CREATE_JOB_SUBSCRIPTIONS
|
||||
# define IPP_OP_CREATE_PRINTER_SUBSCRIPTION IPP_OP_CREATE_PRINTER_SUBSCRIPTIONS
|
||||
# define IPP_OP_CREATE_JOB_SUBSCRIPTION IPP_OP_CREATE_JOB_SUBSCRIPTIONS
|
||||
# define IPP_GET_SUBSCRIPTION_ATTRIBUTES IPP_OP_GET_SUBSCRIPTION_ATTRIBUTES
|
||||
# define IPP_GET_SUBSCRIPTIONS IPP_OP_GET_SUBSCRIPTIONS
|
||||
# define IPP_RENEW_SUBSCRIPTION IPP_OP_RENEW_SUBSCRIPTION
|
||||
# define IPP_CANCEL_SUBSCRIPTION IPP_OP_CANCEL_SUBSCRIPTION
|
||||
# define IPP_GET_NOTIFICATIONS IPP_OP_GET_NOTIFICATIONS
|
||||
# define IPP_SEND_NOTIFICATIONS IPP_OP_SEND_NOTIFICATIONS
|
||||
# define IPP_GET_RESOURCE_ATTRIBUTES IPP_OP_GET_RESOURCE_ATTRIBUTES
|
||||
# define IPP_GET_RESOURCE_DATA IPP_OP_GET_RESOURCE_DATA
|
||||
# define IPP_GET_RESOURCES IPP_OP_GET_RESOURCES
|
||||
# define IPP_GET_PRINT_SUPPORT_FILES IPP_OP_GET_PRINT_SUPPORT_FILES
|
||||
# define IPP_ENABLE_PRINTER IPP_OP_ENABLE_PRINTER
|
||||
# define IPP_DISABLE_PRINTER IPP_OP_DISABLE_PRINTER
|
||||
# define IPP_PAUSE_PRINTER_AFTER_CURRENT_JOB IPP_OP_PAUSE_PRINTER_AFTER_CURRENT_JOB
|
||||
# define IPP_HOLD_NEW_JOBS IPP_OP_HOLD_NEW_JOBS
|
||||
# define IPP_RELEASE_HELD_NEW_JOBS IPP_OP_RELEASE_HELD_NEW_JOBS
|
||||
# define IPP_DEACTIVATE_PRINTER IPP_OP_DEACTIVATE_PRINTER
|
||||
# define IPP_ACTIVATE_PRINTER IPP_OP_ACTIVATE_PRINTER
|
||||
# define IPP_RESTART_PRINTER IPP_OP_RESTART_PRINTER
|
||||
# define IPP_SHUTDOWN_PRINTER IPP_OP_SHUTDOWN_PRINTER
|
||||
# define IPP_STARTUP_PRINTER IPP_OP_STARTUP_PRINTER
|
||||
# define IPP_REPROCESS_JOB IPP_OP_REPROCESS_JOB
|
||||
# define IPP_CANCEL_CURRENT_JOB IPP_OP_CANCEL_CURRENT_JOB
|
||||
# define IPP_SUSPEND_CURRENT_JOB IPP_OP_SUSPEND_CURRENT_JOB
|
||||
# define IPP_RESUME_JOB IPP_OP_RESUME_JOB
|
||||
# define IPP_PROMOTE_JOB IPP_OP_PROMOTE_JOB
|
||||
# define IPP_SCHEDULE_JOB_AFTER IPP_OP_SCHEDULE_JOB_AFTER
|
||||
# define IPP_CANCEL_DOCUMENT IPP_OP_CANCEL_DOCUMENT
|
||||
# define IPP_GET_DOCUMENT_ATTRIBUTES IPP_OP_GET_DOCUMENT_ATTRIBUTES
|
||||
# define IPP_GET_DOCUMENTS IPP_OP_GET_DOCUMENTS
|
||||
# define IPP_DELETE_DOCUMENT IPP_OP_DELETE_DOCUMENT
|
||||
# define IPP_SET_DOCUMENT_ATTRIBUTES IPP_OP_SET_DOCUMENT_ATTRIBUTES
|
||||
# define IPP_CANCEL_JOBS IPP_OP_CANCEL_JOBS
|
||||
# define IPP_CANCEL_MY_JOBS IPP_OP_CANCEL_MY_JOBS
|
||||
# define IPP_RESUBMIT_JOB IPP_OP_RESUBMIT_JOB
|
||||
# define IPP_CLOSE_JOB IPP_OP_CLOSE_JOB
|
||||
# define IPP_IDENTIFY_PRINTER IPP_OP_IDENTIFY_PRINTER
|
||||
# define IPP_VALIDATE_DOCUMENT IPP_OP_VALIDATE_DOCUMENT
|
||||
# define IPP_OP_SEND_HARDCOPY_DOCUMENT IPP_OP_ADD_DOCUMENT_IMAGES
|
||||
# define IPP_PRIVATE IPP_OP_PRIVATE
|
||||
# define CUPS_GET_DEFAULT IPP_OP_CUPS_GET_DEFAULT
|
||||
# define CUPS_GET_PRINTERS IPP_OP_CUPS_GET_PRINTERS
|
||||
# define CUPS_ADD_MODIFY_PRINTER IPP_OP_CUPS_ADD_MODIFY_PRINTER
|
||||
# define CUPS_DELETE_PRINTER IPP_OP_CUPS_DELETE_PRINTER
|
||||
# define CUPS_GET_CLASSES IPP_OP_CUPS_GET_CLASSES
|
||||
# define CUPS_ADD_MODIFY_CLASS IPP_OP_CUPS_ADD_MODIFY_CLASS
|
||||
# define CUPS_DELETE_CLASS IPP_OP_CUPS_DELETE_CLASS
|
||||
# define CUPS_ACCEPT_JOBS IPP_OP_CUPS_ACCEPT_JOBS
|
||||
# define CUPS_REJECT_JOBS IPP_OP_CUPS_REJECT_JOBS
|
||||
# define CUPS_SET_DEFAULT IPP_OP_CUPS_SET_DEFAULT
|
||||
# define CUPS_GET_DEVICES IPP_OP_CUPS_GET_DEVICES
|
||||
# define CUPS_GET_PPDS IPP_OP_CUPS_GET_PPDS
|
||||
# define CUPS_MOVE_JOB IPP_OP_CUPS_MOVE_JOB
|
||||
# define CUPS_AUTHENTICATE_JOB IPP_OP_CUPS_AUTHENTICATE_JOB
|
||||
# define CUPS_GET_PPD IPP_OP_CUPS_GET_PPD
|
||||
# define CUPS_GET_DOCUMENT IPP_OP_CUPS_GET_DOCUMENT
|
||||
/* Legacy names */
|
||||
# define CUPS_ADD_PRINTER IPP_OP_CUPS_ADD_MODIFY_PRINTER
|
||||
# define CUPS_ADD_CLASS IPP_OP_CUPS_ADD_MODIFY_CLASS
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} ipp_op_t;
|
||||
|
||||
typedef enum ipp_orient_e /**** Orientation values ****/
|
||||
{
|
||||
IPP_PORTRAIT = 3, /* No rotation */
|
||||
IPP_LANDSCAPE, /* 90 degrees counter-clockwise */
|
||||
IPP_REVERSE_LANDSCAPE, /* 90 degrees clockwise */
|
||||
IPP_REVERSE_PORTRAIT /* 180 degrees */
|
||||
IPP_ORIENT_PORTRAIT = 3, /* No rotation */
|
||||
IPP_ORIENT_LANDSCAPE, /* 90 degrees counter-clockwise */
|
||||
IPP_ORIENT_REVERSE_LANDSCAPE, /* 90 degrees clockwise */
|
||||
IPP_ORIENT_REVERSE_PORTRAIT, /* 180 degrees */
|
||||
IPP_ORIENT_NONE /* No rotation */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_PORTRAIT IPP_ORIENT_PORTRAIT
|
||||
# define IPP_LANDSCAPE IPP_ORIENT_LANDSCAPE
|
||||
# define IPP_REVERSE_LANDSCAPE IPP_ORIENT_REVERSE_LANDSCAPE
|
||||
# define IPP_REVERSE_PORTRAIT IPP_ORIENT_REVERSE_PORTRAIT
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} ipp_orient_t;
|
||||
|
||||
typedef enum ipp_pstate_e /**** Printer states ****/
|
||||
{
|
||||
IPP_PRINTER_IDLE = 3, /* Printer is idle */
|
||||
IPP_PRINTER_PROCESSING, /* Printer is working */
|
||||
IPP_PRINTER_STOPPED /* Printer is stopped */
|
||||
IPP_PSTATE_IDLE = 3, /* Printer is idle */
|
||||
IPP_PSTATE_PROCESSING, /* Printer is working */
|
||||
IPP_PSTATE_STOPPED /* Printer is stopped */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_PRINTER_IDLE IPP_PSTATE_IDLE
|
||||
# define IPP_PRINTER_PROCESSING IPP_PSTATE_PROCESSING
|
||||
# define IPP_PRINTER_STOPPED IPP_PSTATE_STOPPED
|
||||
# endif /* _CUPS_NO_DEPRECATED */
|
||||
} ipp_pstate_t;
|
||||
|
||||
typedef enum ipp_quality_e /**** Qualities ****/
|
||||
@ -242,76 +465,170 @@ typedef enum ipp_res_e /**** Resolution units ****/
|
||||
|
||||
typedef enum ipp_state_e /**** IPP states ****/
|
||||
{
|
||||
IPP_ERROR = -1, /* An error occurred */
|
||||
IPP_IDLE, /* Nothing is happening/request completed */
|
||||
IPP_HEADER, /* The request header needs to be sent/received */
|
||||
IPP_ATTRIBUTE, /* One or more attributes need to be sent/received */
|
||||
IPP_DATA /* IPP request data needs to be sent/received */
|
||||
IPP_STATE_ERROR = -1, /* An error occurred */
|
||||
IPP_STATE_IDLE, /* Nothing is happening/request completed */
|
||||
IPP_STATE_HEADER, /* The request header needs to be sent/received */
|
||||
IPP_STATE_ATTRIBUTE, /* One or more attributes need to be sent/received */
|
||||
IPP_STATE_DATA /* IPP request data needs to be sent/received */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_ERROR IPP_STATE_ERROR
|
||||
# define IPP_IDLE IPP_STATE_IDLE
|
||||
# define IPP_HEADER IPP_STATE_HEADER
|
||||
# define IPP_ATTRIBUTE IPP_STATE_ATTRIBUTE
|
||||
# define IPP_DATA IPP_STATE_DATA
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} ipp_state_t;
|
||||
|
||||
typedef enum ipp_status_e /**** IPP status codes ****/
|
||||
{
|
||||
IPP_STATUS_CUPS_INVALID = -1, /* Invalid status name for @link ippErrorValue@ */
|
||||
IPP_OK = 0x0000, /* successful-ok */
|
||||
IPP_OK_SUBST, /* successful-ok-ignored-or-substituted-attributes */
|
||||
IPP_OK_CONFLICT, /* successful-ok-conflicting-attributes */
|
||||
IPP_OK_IGNORED_SUBSCRIPTIONS, /* successful-ok-ignored-subscriptions */
|
||||
IPP_OK_IGNORED_NOTIFICATIONS, /* successful-ok-ignored-notifications @private@ */
|
||||
IPP_OK_TOO_MANY_EVENTS, /* successful-ok-too-many-events */
|
||||
IPP_OK_BUT_CANCEL_SUBSCRIPTION, /* successful-ok-but-cancel-subscription @private@ */
|
||||
IPP_OK_EVENTS_COMPLETE, /* successful-ok-events-complete */
|
||||
IPP_REDIRECTION_OTHER_SITE = 0x200, /* redirection-other-site @private@ */
|
||||
CUPS_SEE_OTHER = 0x280, /* cups-see-other */
|
||||
IPP_BAD_REQUEST = 0x0400, /* client-error-bad-request */
|
||||
IPP_FORBIDDEN, /* client-error-forbidden */
|
||||
IPP_NOT_AUTHENTICATED, /* client-error-not-authenticated */
|
||||
IPP_NOT_AUTHORIZED, /* client-error-not-authorized */
|
||||
IPP_NOT_POSSIBLE, /* client-error-not-possible */
|
||||
IPP_TIMEOUT, /* client-error-timeout */
|
||||
IPP_NOT_FOUND, /* client-error-not-found */
|
||||
IPP_GONE, /* client-error-gone */
|
||||
IPP_REQUEST_ENTITY, /* client-error-request-entity-too-large */
|
||||
IPP_REQUEST_VALUE, /* client-error-request-value-too-long */
|
||||
IPP_DOCUMENT_FORMAT, /* client-error-document-format-not-supported */
|
||||
IPP_ATTRIBUTES, /* client-error-attributes-or-values-not-supported */
|
||||
IPP_URI_SCHEME, /* client-error-uri-scheme-not-supported */
|
||||
IPP_CHARSET, /* client-error-charset-not-supported */
|
||||
IPP_CONFLICT, /* client-error-conflicting-attributes */
|
||||
IPP_COMPRESSION_NOT_SUPPORTED, /* client-error-compression-not-supported */
|
||||
IPP_COMPRESSION_ERROR, /* client-error-compression-error */
|
||||
IPP_DOCUMENT_FORMAT_ERROR, /* client-error-document-format-error */
|
||||
IPP_DOCUMENT_ACCESS_ERROR, /* client-error-document-access-error */
|
||||
IPP_ATTRIBUTES_NOT_SETTABLE, /* client-error-attributes-not-settable */
|
||||
IPP_IGNORED_ALL_SUBSCRIPTIONS, /* client-error-ignored-all-subscriptions */
|
||||
IPP_TOO_MANY_SUBSCRIPTIONS, /* client-error-too-many-subscriptions */
|
||||
IPP_IGNORED_ALL_NOTIFICATIONS, /* client-error-ignored-all-notifications @private@ */
|
||||
IPP_PRINT_SUPPORT_FILE_NOT_FOUND, /* client-error-print-support-file-not-found @private@ */
|
||||
IPP_DOCUMENT_PASSWORD_ERROR, /* client-error-document-password-error */
|
||||
IPP_DOCUMENT_PERMISSION_ERROR, /* client-error-document-permission-error */
|
||||
IPP_DOCUMENT_SECURITY_ERROR, /* client-error-document-security-error */
|
||||
IPP_DOCUMENT_UNPRINTABLE_ERROR, /* client-error-document-unprintable-error */
|
||||
IPP_STATUS_OK = 0x0000, /* successful-ok */
|
||||
IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED, /* successful-ok-ignored-or-substituted-attributes */
|
||||
IPP_STATUS_OK_CONFLICTING, /* successful-ok-conflicting-attributes */
|
||||
IPP_STATUS_OK_IGNORED_SUBSCRIPTIONS, /* successful-ok-ignored-subscriptions */
|
||||
IPP_STATUS_OK_IGNORED_NOTIFICATIONS, /* successful-ok-ignored-notifications @private@ */
|
||||
IPP_STATUS_OK_TOO_MANY_EVENTS, /* successful-ok-too-many-events */
|
||||
IPP_STATUS_OK_BUT_CANCEL_SUBSCRIPTION,/* successful-ok-but-cancel-subscription @private@ */
|
||||
IPP_STATUS_OK_EVENTS_COMPLETE, /* successful-ok-events-complete */
|
||||
IPP_STATUS_REDIRECTION_OTHER_SITE = 0x0200,
|
||||
/* redirection-other-site @private@ */
|
||||
IPP_STATUS_CUPS_SEE_OTHER = 0x0280, /* cups-see-other */
|
||||
IPP_STATUS_ERROR_BAD_REQUEST = 0x0400,/* client-error-bad-request */
|
||||
IPP_STATUS_ERROR_FORBIDDEN, /* client-error-forbidden */
|
||||
IPP_STATUS_ERROR_NOT_AUTHENTICATED, /* client-error-not-authenticated */
|
||||
IPP_STATUS_ERROR_NOT_AUTHORIZED, /* client-error-not-authorized */
|
||||
IPP_STATUS_ERROR_NOT_POSSIBLE, /* client-error-not-possible */
|
||||
IPP_STATUS_ERROR_TIMEOUT, /* client-error-timeout */
|
||||
IPP_STATUS_ERROR_NOT_FOUND, /* client-error-not-found */
|
||||
IPP_STATUS_ERROR_GONE, /* client-error-gone */
|
||||
IPP_STATUS_ERROR_REQUEST_ENTITY, /* client-error-request-entity-too-large */
|
||||
IPP_STATUS_ERROR_REQUEST_VALUE, /* client-error-request-value-too-long */
|
||||
IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED,
|
||||
/* client-error-document-format-not-supported */
|
||||
IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES,/* client-error-attributes-or-values-not-supported */
|
||||
IPP_STATUS_ERROR_URI_SCHEME, /* client-error-uri-scheme-not-supported */
|
||||
IPP_STATUS_ERROR_CHARSET, /* client-error-charset-not-supported */
|
||||
IPP_STATUS_ERROR_CONFLICTING, /* client-error-conflicting-attributes */
|
||||
IPP_STATUS_ERROR_COMPRESSION_NOT_SUPPORTED,
|
||||
/* client-error-compression-not-supported */
|
||||
IPP_STATUS_ERROR_COMPRESSION_ERROR, /* client-error-compression-error */
|
||||
IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR,
|
||||
/* client-error-document-format-error */
|
||||
IPP_STATUS_ERROR_DOCUMENT_ACCESS, /* client-error-document-access-error */
|
||||
IPP_STATUS_ERROR_ATTRIBUTES_NOT_SETTABLE,
|
||||
/* client-error-attributes-not-settable */
|
||||
IPP_STATUS_ERROR_IGNORED_ALL_SUBSCRIPTIONS,
|
||||
/* client-error-ignored-all-subscriptions */
|
||||
IPP_STATUS_ERROR_TOO_MANY_SUBSCRIPTIONS,
|
||||
/* client-error-too-many-subscriptions */
|
||||
IPP_STATUS_ERROR_IGNORED_ALL_NOTIFICATIONS,
|
||||
/* client-error-ignored-all-notifications @private@ */
|
||||
IPP_STATUS_ERROR_PRINT_SUPPORT_FILE_NOT_FOUND,
|
||||
/* client-error-print-support-file-not-found @private@ */
|
||||
IPP_STATUS_ERROR_DOCUMENT_PASSWORD, /* client-error-document-password-error */
|
||||
IPP_STATUS_ERROR_DOCUMENT_PERMISSION, /* client-error-document-permission-error */
|
||||
IPP_STATUS_ERROR_DOCUMENT_SECURITY, /* client-error-document-security-error */
|
||||
IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE,/* client-error-document-unprintable-error */
|
||||
IPP_STATUS_ERROR_ACCOUNT_INFO_NEEDED, /* client-error-account-info-needed */
|
||||
IPP_STATUS_ERROR_ACCOUNT_CLOSED, /* client-error-account-closed */
|
||||
IPP_STATUS_ERROR_ACCOUNT_LIMIT_REACHED,
|
||||
/* client-error-account-limit-reached */
|
||||
IPP_STATUS_ERROR_ACCOUNT_AUTHORIZATION_FAILED,
|
||||
/* client-error-account-authorization-failed */
|
||||
IPP_STATUS_ERROR_NOT_FETCHABLE, /* client-error-not-fetchable */
|
||||
|
||||
IPP_INTERNAL_ERROR = 0x0500, /* server-error-internal-error */
|
||||
IPP_OPERATION_NOT_SUPPORTED, /* server-error-operation-not-supported */
|
||||
IPP_SERVICE_UNAVAILABLE, /* server-error-service-unavailable */
|
||||
IPP_VERSION_NOT_SUPPORTED, /* server-error-version-not-supported */
|
||||
IPP_DEVICE_ERROR, /* server-error-device-error */
|
||||
IPP_TEMPORARY_ERROR, /* server-error-temporary-error */
|
||||
IPP_NOT_ACCEPTING, /* server-error-not-accepting-jobs */
|
||||
IPP_PRINTER_BUSY, /* server-error-busy */
|
||||
IPP_ERROR_JOB_CANCELED, /* server-error-job-canceled */
|
||||
IPP_MULTIPLE_JOBS_NOT_SUPPORTED, /* server-error-multiple-document-jobs-not-supported */
|
||||
IPP_PRINTER_IS_DEACTIVATED, /* server-error-printer-is-deactivated */
|
||||
IPP_TOO_MANY_JOBS, /* server-error-too-many-jobs */
|
||||
IPP_TOO_MANY_DOCUMENTS, /* server-error-too-many-documents */
|
||||
/* Legacy status codes for paid printing */
|
||||
IPP_STATUS_ERROR_CUPS_ACCOUNT_INFO_NEEDED = 0x049C,
|
||||
/* cups-error-account-info-needed @deprecated@ */
|
||||
IPP_STATUS_ERROR_CUPS_ACCOUNT_CLOSED, /* cups-error-account-closed @deprecate@ */
|
||||
IPP_STATUS_ERROR_CUPS_ACCOUNT_LIMIT_REACHED,
|
||||
/* cups-error-account-limit-reached @deprecated@ */
|
||||
IPP_STATUS_ERROR_CUPS_ACCOUNT_AUTHORIZATION_FAILED,
|
||||
/* cups-error-account-authorization-failed @deprecated@ */
|
||||
|
||||
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_UPGRADE_REQUIRED /* TLS upgrade required */
|
||||
IPP_STATUS_ERROR_INTERNAL = 0x0500, /* server-error-internal-error */
|
||||
IPP_STATUS_ERROR_OPERATION_NOT_SUPPORTED,
|
||||
/* server-error-operation-not-supported */
|
||||
IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, /* server-error-service-unavailable */
|
||||
IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED,
|
||||
/* server-error-version-not-supported */
|
||||
IPP_STATUS_ERROR_DEVICE, /* server-error-device-error */
|
||||
IPP_STATUS_ERROR_TEMPORARY, /* server-error-temporary-error */
|
||||
IPP_STATUS_ERROR_NOT_ACCEPTING_JOBS, /* server-error-not-accepting-jobs */
|
||||
IPP_STATUS_ERROR_BUSY, /* server-error-busy */
|
||||
IPP_STATUS_ERROR_JOB_CANCELED, /* server-error-job-canceled */
|
||||
IPP_STATUS_ERROR_MULTIPLE_JOBS_NOT_SUPPORTED,
|
||||
/* server-error-multiple-document-jobs-not-supported */
|
||||
IPP_STATUS_ERROR_PRINTER_IS_DEACTIVATED,
|
||||
/* server-error-printer-is-deactivated */
|
||||
IPP_STATUS_ERROR_TOO_MANY_JOBS, /* server-error-too-many-jobs */
|
||||
IPP_STATUS_ERROR_TOO_MANY_DOCUMENTS, /* server-error-too-many-documents */
|
||||
|
||||
/* Legacy name for canceled status */
|
||||
#define IPP_ERROR_JOB_CANCELLED IPP_ERROR_JOB_CANCELED
|
||||
/* These are internal and never sent over the wire... */
|
||||
IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED = 0x1000,
|
||||
/* cups-authentication-canceled - Authentication canceled by user @since CUPS 1.5/macOS 10.7@ */
|
||||
IPP_STATUS_ERROR_CUPS_PKI, /* cups-pki-error - Error negotiating a secure connection @since CUPS 1.5/macOS 10.7@ */
|
||||
IPP_STATUS_ERROR_CUPS_UPGRADE_REQUIRED/* cups-upgrade-required - TLS upgrade required */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_OK IPP_STATUS_OK
|
||||
# define IPP_OK_SUBST IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED
|
||||
# define IPP_OK_CONFLICT IPP_STATUS_OK_CONFLICTING
|
||||
# define IPP_OK_IGNORED_SUBSCRIPTIONS IPP_STATUS_OK_IGNORED_SUBSCRIPTIONS
|
||||
# define IPP_OK_IGNORED_NOTIFICATIONS IPP_STATUS_OK_IGNORED_NOTIFICATIONS
|
||||
# define IPP_OK_TOO_MANY_EVENTS IPP_STATUS_OK_TOO_MANY_EVENTS
|
||||
# define IPP_OK_BUT_CANCEL_SUBSCRIPTION IPP_STATUS_OK_BUT_CANCEL_SUBSCRIPTION
|
||||
# define IPP_OK_EVENTS_COMPLETE IPP_STATUS_OK_EVENTS_COMPLETE
|
||||
# define IPP_REDIRECTION_OTHER_SITE IPP_STATUS_REDIRECTION_OTHER_SITE
|
||||
# define CUPS_SEE_OTHER IPP_STATUS_CUPS_SEE_OTHER
|
||||
# define IPP_BAD_REQUEST IPP_STATUS_ERROR_BAD_REQUEST
|
||||
# define IPP_FORBIDDEN IPP_STATUS_ERROR_FORBIDDEN
|
||||
# define IPP_NOT_AUTHENTICATED IPP_STATUS_ERROR_NOT_AUTHENTICATED
|
||||
# define IPP_NOT_AUTHORIZED IPP_STATUS_ERROR_NOT_AUTHORIZED
|
||||
# define IPP_NOT_POSSIBLE IPP_STATUS_ERROR_NOT_POSSIBLE
|
||||
# define IPP_TIMEOUT IPP_STATUS_ERROR_TIMEOUT
|
||||
# define IPP_NOT_FOUND IPP_STATUS_ERROR_NOT_FOUND
|
||||
# define IPP_GONE IPP_STATUS_ERROR_GONE
|
||||
# define IPP_REQUEST_ENTITY IPP_STATUS_ERROR_REQUEST_ENTITY
|
||||
# define IPP_REQUEST_VALUE IPP_STATUS_ERROR_REQUEST_VALUE
|
||||
# define IPP_DOCUMENT_FORMAT IPP_STATUS_ERROR_DOCUMENT_FORMAT_NOT_SUPPORTED
|
||||
# define IPP_ATTRIBUTES IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES
|
||||
# define IPP_URI_SCHEME IPP_STATUS_ERROR_URI_SCHEME
|
||||
# define IPP_CHARSET IPP_STATUS_ERROR_CHARSET
|
||||
# define IPP_CONFLICT IPP_STATUS_ERROR_CONFLICTING
|
||||
# define IPP_COMPRESSION_NOT_SUPPORTED IPP_STATUS_ERROR_COMPRESSION_NOT_SUPPORTED
|
||||
# define IPP_COMPRESSION_ERROR IPP_STATUS_ERROR_COMPRESSION_ERROR
|
||||
# define IPP_DOCUMENT_FORMAT_ERROR IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR
|
||||
# define IPP_DOCUMENT_ACCESS_ERROR IPP_STATUS_ERROR_DOCUMENT_ACCESS
|
||||
# define IPP_ATTRIBUTES_NOT_SETTABLE IPP_STATUS_ERROR_ATTRIBUTES_NOT_SETTABLE
|
||||
# define IPP_IGNORED_ALL_SUBSCRIPTIONS IPP_STATUS_ERROR_IGNORED_ALL_SUBSCRIPTIONS
|
||||
# define IPP_TOO_MANY_SUBSCRIPTIONS IPP_STATUS_ERROR_TOO_MANY_SUBSCRIPTIONS
|
||||
# define IPP_IGNORED_ALL_NOTIFICATIONS IPP_STATUS_ERROR_IGNORED_ALL_NOTIFICATIONS
|
||||
# define IPP_PRINT_SUPPORT_FILE_NOT_FOUND IPP_STATUS_ERROR_PRINT_SUPPORT_FILE_NOT_FOUND
|
||||
# define IPP_DOCUMENT_PASSWORD_ERROR IPP_STATUS_ERROR_DOCUMENT_PASSWORD
|
||||
# define IPP_DOCUMENT_PERMISSION_ERROR IPP_STATUS_ERROR_DOCUMENT_PERMISSION
|
||||
# define IPP_DOCUMENT_SECURITY_ERROR IPP_STATUS_ERROR_DOCUMENT_SECURITY
|
||||
# define IPP_DOCUMENT_UNPRINTABLE_ERROR IPP_STATUS_ERROR_DOCUMENT_UNPRINTABLE
|
||||
# define IPP_INTERNAL_ERROR IPP_STATUS_ERROR_INTERNAL
|
||||
# define IPP_OPERATION_NOT_SUPPORTED IPP_STATUS_ERROR_OPERATION_NOT_SUPPORTED
|
||||
# define IPP_SERVICE_UNAVAILABLE IPP_STATUS_ERROR_SERVICE_UNAVAILABLE
|
||||
# define IPP_VERSION_NOT_SUPPORTED IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED
|
||||
# define IPP_DEVICE_ERROR IPP_STATUS_ERROR_DEVICE
|
||||
# define IPP_TEMPORARY_ERROR IPP_STATUS_ERROR_TEMPORARY
|
||||
# define IPP_NOT_ACCEPTING IPP_STATUS_ERROR_NOT_ACCEPTING_JOBS
|
||||
# define IPP_PRINTER_BUSY IPP_STATUS_ERROR_BUSY
|
||||
# define IPP_ERROR_JOB_CANCELED IPP_STATUS_ERROR_JOB_CANCELED
|
||||
# define IPP_MULTIPLE_JOBS_NOT_SUPPORTED IPP_STATUS_ERROR_MULTIPLE_JOBS_NOT_SUPPORTED
|
||||
# define IPP_PRINTER_IS_DEACTIVATED IPP_STATUS_ERROR_PRINTER_IS_DEACTIVATED
|
||||
# define IPP_TOO_MANY_JOBS IPP_STATUS_ERROR_TOO_MANY_JOBS
|
||||
# define IPP_TOO_MANY_DOCUMENTS IPP_STATUS_ERROR_TOO_MANY_DOCUMENTS
|
||||
# define IPP_AUTHENTICATION_CANCELED IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED
|
||||
# define IPP_PKI_ERROR IPP_STATUS_ERROR_CUPS_PKI
|
||||
# define IPP_UPGRADE_REQUIRED IPP_STATUS_ERROR_CUPS_UPGRADE_REQUIRED
|
||||
/* Legacy name for canceled status */
|
||||
# define IPP_ERROR_JOB_CANCELLED IPP_STATUS_ERROR_JOB_CANCELED
|
||||
# endif /* _CUPS_NO_DEPRECATED */
|
||||
} ipp_status_t;
|
||||
|
||||
typedef enum ipp_tag_e /**** Format tags for attributes ****/
|
||||
@ -356,9 +673,14 @@ typedef enum ipp_tag_e /**** Format tags for attributes ****/
|
||||
IPP_TAG_MIMETYPE, /* MIME media type value */
|
||||
IPP_TAG_MEMBERNAME, /* Collection member name value */
|
||||
IPP_TAG_EXTENSION = 0x7f, /* Extension point for 32-bit tags */
|
||||
IPP_TAG_MASK = 0x7fffffff, /* Mask for copied attribute values @private@ */
|
||||
IPP_TAG_CUPS_MASK = 0x7fffffff, /* Mask for copied attribute values @private@ */
|
||||
/* The following expression is used to avoid compiler warnings with +/-0x80000000 */
|
||||
IPP_TAG_COPY = -0x7fffffff-1 /* Bitflag for copied attribute values @private@ */
|
||||
IPP_TAG_CUPS_CONST = -0x7fffffff-1 /* Bitflag for copied/const attribute values @private@ */
|
||||
|
||||
# ifndef _CUPS_NO_DEPRECATED
|
||||
# define IPP_TAG_MASK IPP_TAG_CUPS_MASK
|
||||
# define IPP_TAG_COPY IPP_TAG_CUPS_CONST
|
||||
# endif /* !_CUPS_NO_DEPRECATED */
|
||||
} ipp_tag_t;
|
||||
|
||||
typedef unsigned char ipp_uchar_t; /**** Unsigned 8-bit integer/character ****/
|
||||
@ -366,25 +688,31 @@ 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 ****/
|
||||
/**** New in CUPS 1.2/macOS 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@ ****/
|
||||
/**** IPP IO Callback Function @since CUPS 1.2/macOS 10.5@ ****/
|
||||
|
||||
/**** New in CUPS 1.6/OS X 10.8 ****/
|
||||
/**** New in CUPS 1.6/macOS 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.
|
||||
* The following structures are PRIVATE starting with CUPS 1.6/macOS 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
|
||||
* Define _IPP_PRIVATE_STRUCTURES to 1 to cause the private IPP structures to be
|
||||
* exposed in CUPS 1.6. This happens automatically on macOS when compiling for
|
||||
* a deployment target of 10.7 or earlier.
|
||||
*
|
||||
* Define _IPP_PRIVATE_STRUCTURES to 0 to prevent the private IPP structures
|
||||
* from being exposed. This is useful when migrating existing code to the new
|
||||
* accessors.
|
||||
*/
|
||||
|
||||
# if defined(_CUPS_SOURCE) || defined(_CUPS_IPP_PRIVATE_H_)
|
||||
# ifdef _IPP_PRIVATE_STRUCTURES
|
||||
/* Somebody has overridden the value */
|
||||
# elif defined(_CUPS_SOURCE) || defined(_CUPS_IPP_PRIVATE_H_)
|
||||
/* Building CUPS */
|
||||
# define _IPP_PRIVATE_STRUCTURES 1
|
||||
# elif defined(__APPLE__)
|
||||
@ -395,9 +723,11 @@ typedef int (*ipp_copycb_t)(void *context, ipp_t *dst, ipp_attribute_t *attr);
|
||||
/* 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 */
|
||||
# else
|
||||
# define _IPP_PRIVATE_STRUCTURES 0
|
||||
# endif /* _CUPS_SOURCE || _CUPS_IPP_PRIVATE_H_ */
|
||||
|
||||
# ifdef _IPP_PRIVATE_STRUCTURES
|
||||
# if _IPP_PRIVATE_STRUCTURES
|
||||
typedef union _ipp_request_u /**** Request Header ****/
|
||||
{
|
||||
struct /* Any Header */
|
||||
@ -422,7 +752,7 @@ typedef union _ipp_request_u /**** Request Header ****/
|
||||
} status;
|
||||
|
||||
/**** New in CUPS 1.1.19 ****/
|
||||
struct /* Event Header @since CUPS 1.1.19/OS X 10.3@ */
|
||||
struct /* Event Header @since CUPS 1.1.19/macOS 10.3@ */
|
||||
{
|
||||
ipp_uchar_t version[2]; /* Protocol version number */
|
||||
ipp_status_t status_code; /* Status code */
|
||||
@ -466,7 +796,7 @@ typedef union _ipp_value_u /**** Attribute Value ****/
|
||||
} 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_t *collection; /* Collection value @since CUPS 1.1.19/macOS 10.3@ */
|
||||
} _ipp_value_t;
|
||||
typedef _ipp_value_t ipp_value_t; /**** Convenience typedef that will be removed @private@ ****/
|
||||
|
||||
@ -490,10 +820,13 @@ struct _ipp_s /**** IPP Request/Response/Notification ****/
|
||||
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@ */
|
||||
ipp_attribute_t *prev; /* Previous attribute (for read) @since CUPS 1.2/macOS 10.5@ */
|
||||
|
||||
/**** New in CUPS 1.4.4 ****/
|
||||
int use; /* Use count @since CUPS 1.4.4/OS X 10.6.?@ */
|
||||
int use; /* Use count @since CUPS 1.4.4/macOS 10.6.?@ */
|
||||
/**** New in CUPS 2.0 ****/
|
||||
int atend, /* At end of list? */
|
||||
curindex; /* Current attribute index for hierarchical search */
|
||||
};
|
||||
# endif /* _IPP_PRIVATE_STRUCTURES */
|
||||
|
||||
@ -560,7 +893,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/macOS 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 +906,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/macOS 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/macOS 10.8 ****/
|
||||
extern ipp_attribute_t *ippAddOutOfBand(ipp_t *ipp, ipp_tag_t group,
|
||||
ipp_tag_t value_tag, const char *name)
|
||||
_CUPS_API_1_6;
|
||||
@ -656,6 +989,41 @@ extern int ippSetValueTag(ipp_t *ipp, ipp_attribute_t **attr,
|
||||
extern int ippSetVersion(ipp_t *ipp, int major, int minor)
|
||||
_CUPS_API_1_6;
|
||||
|
||||
/**** New in CUPS 1.7 ****/
|
||||
extern ipp_attribute_t *ippAddStringf(ipp_t *ipp, ipp_tag_t group,
|
||||
ipp_tag_t value_tag, const char *name,
|
||||
const char *language, const char *format,
|
||||
...) _CUPS_API_1_7;
|
||||
extern ipp_attribute_t *ippAddStringfv(ipp_t *ipp, ipp_tag_t group,
|
||||
ipp_tag_t value_tag, const char *name,
|
||||
const char *language,
|
||||
const char *format, va_list ap)
|
||||
_CUPS_API_1_7;
|
||||
extern int ippContainsInteger(ipp_attribute_t *attr, int value)
|
||||
_CUPS_API_1_7;
|
||||
extern int ippContainsString(ipp_attribute_t *attr,
|
||||
const char *value) _CUPS_API_1_7;
|
||||
extern cups_array_t *ippCreateRequestedArray(ipp_t *request) _CUPS_API_1_7;
|
||||
extern void *ippGetOctetString(ipp_attribute_t *attr, int element,
|
||||
int *datalen) _CUPS_API_1_7;
|
||||
extern ipp_t *ippNewResponse(ipp_t *request) _CUPS_API_1_7;
|
||||
extern int ippSetOctetString(ipp_t *ipp, ipp_attribute_t **attr,
|
||||
int element, const void *data,
|
||||
int datalen) _CUPS_API_1_7;
|
||||
extern int ippSetStringf(ipp_t *ipp, ipp_attribute_t **attr,
|
||||
int element, const char *format,
|
||||
...) _CUPS_API_1_7;
|
||||
extern int ippSetStringfv(ipp_t *ipp, ipp_attribute_t **attr,
|
||||
int element, const char *format,
|
||||
va_list ap) _CUPS_API_1_7;
|
||||
extern int ippValidateAttribute(ipp_attribute_t *attr)
|
||||
_CUPS_API_1_7;
|
||||
extern int ippValidateAttributes(ipp_t *ipp) _CUPS_API_1_7;
|
||||
|
||||
|
||||
/**** New in CUPS 2.0 ****/
|
||||
extern const char *ippStateString(ipp_state_t state) _CUPS_API_2_0;
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
@ -665,7 +1033,3 @@ extern int ippSetVersion(ipp_t *ipp, int major, int minor)
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_IPP_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: ipp.h 7847 2008-08-19 04:22:14Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,27 +1,16 @@
|
||||
/*
|
||||
* "$Id: langprintf.c 7802 2008-07-28 18:50:45Z mike $"
|
||||
* Localized printf/puts functions for CUPS.
|
||||
*
|
||||
* Localized printf/puts functions for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2002-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 2002-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _cupsLangPrintError() - Print a message followed by a standard error.
|
||||
* _cupsLangPrintFilter() - Print a formatted filter message string to a file.
|
||||
* _cupsLangPrintf() - Print a formatted message string to a file.
|
||||
* _cupsLangPuts() - Print a static message string to a file.
|
||||
* _cupsSetLocale() - Set the current locale and transcode the
|
||||
* command-line.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -39,7 +28,7 @@ void
|
||||
_cupsLangPrintError(const char *prefix, /* I - Non-localized message prefix */
|
||||
const char *message)/* I - Message */
|
||||
{
|
||||
int bytes; /* Number of bytes formatted */
|
||||
ssize_t bytes; /* Number of bytes formatted */
|
||||
int last_errno; /* Last error */
|
||||
char buffer[2048], /* Message buffer */
|
||||
*bufptr, /* Pointer into buffer */
|
||||
@ -81,7 +70,7 @@ _cupsLangPrintError(const char *prefix, /* I - Non-localized message prefix */
|
||||
else
|
||||
bufptr = buffer;
|
||||
|
||||
snprintf(bufptr, sizeof(buffer) - (bufptr - buffer),
|
||||
snprintf(bufptr, sizeof(buffer) - (size_t)(bufptr - buffer),
|
||||
/* TRANSLATORS: Message is "subject: error" */
|
||||
_cupsLangString(cg->lang_default, _("%s: %s")),
|
||||
_cupsLangString(cg->lang_default, message), strerror(last_errno));
|
||||
@ -95,7 +84,7 @@ _cupsLangPrintError(const char *prefix, /* I - Non-localized message prefix */
|
||||
cg->lang_default->encoding);
|
||||
|
||||
if (bytes > 0)
|
||||
fwrite(output, 1, bytes, stderr);
|
||||
fwrite(output, 1, (size_t)bytes, stderr);
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +99,7 @@ _cupsLangPrintFilter(
|
||||
const char *message, /* I - Message string to use */
|
||||
...) /* I - Additional arguments as needed */
|
||||
{
|
||||
int bytes; /* Number of bytes formatted */
|
||||
ssize_t bytes; /* Number of bytes formatted */
|
||||
char temp[2048], /* Temporary format buffer */
|
||||
buffer[2048], /* Message buffer */
|
||||
output[8192]; /* Output buffer */
|
||||
@ -152,9 +141,9 @@ _cupsLangPrintFilter(
|
||||
*/
|
||||
|
||||
if (bytes > 0)
|
||||
return ((int)fwrite(output, 1, bytes, fp));
|
||||
return ((int)fwrite(output, 1, (size_t)bytes, fp));
|
||||
else
|
||||
return (bytes);
|
||||
return ((int)bytes);
|
||||
}
|
||||
|
||||
|
||||
@ -167,7 +156,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */
|
||||
const char *message, /* I - Message string to use */
|
||||
...) /* I - Additional arguments as needed */
|
||||
{
|
||||
int bytes; /* Number of bytes formatted */
|
||||
ssize_t bytes; /* Number of bytes formatted */
|
||||
char buffer[2048], /* Message buffer */
|
||||
output[8192]; /* Output buffer */
|
||||
va_list ap; /* Pointer to additional arguments */
|
||||
@ -209,9 +198,9 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */
|
||||
*/
|
||||
|
||||
if (bytes > 0)
|
||||
return ((int)fwrite(output, 1, bytes, fp));
|
||||
return ((int)fwrite(output, 1, (size_t)bytes, fp));
|
||||
else
|
||||
return (bytes);
|
||||
return ((int)bytes);
|
||||
}
|
||||
|
||||
|
||||
@ -223,7 +212,7 @@ int /* O - Number of bytes written */
|
||||
_cupsLangPuts(FILE *fp, /* I - File to write to */
|
||||
const char *message) /* I - Message string to use */
|
||||
{
|
||||
int bytes; /* Number of bytes formatted */
|
||||
ssize_t bytes; /* Number of bytes formatted */
|
||||
char output[8192]; /* Message buffer */
|
||||
_cups_globals_t *cg; /* Global data */
|
||||
|
||||
@ -248,18 +237,16 @@ _cupsLangPuts(FILE *fp, /* I - File to write to */
|
||||
(cups_utf8_t *)_cupsLangString(cg->lang_default,
|
||||
message),
|
||||
sizeof(output) - 4, cg->lang_default->encoding);
|
||||
bytes += cupsUTF8ToCharset(output + bytes, (cups_utf8_t *)"\n",
|
||||
sizeof(output) - bytes,
|
||||
cg->lang_default->encoding);
|
||||
bytes += cupsUTF8ToCharset(output + bytes, (cups_utf8_t *)"\n", (int)(sizeof(output) - (size_t)bytes), cg->lang_default->encoding);
|
||||
|
||||
/*
|
||||
* Write the string and return the number of bytes written...
|
||||
*/
|
||||
|
||||
if (bytes > 0)
|
||||
return ((int)fwrite(output, 1, bytes, fp));
|
||||
return ((int)fwrite(output, 1, (size_t)bytes, fp));
|
||||
else
|
||||
return (bytes);
|
||||
return ((int)bytes);
|
||||
}
|
||||
|
||||
|
||||
@ -301,10 +288,10 @@ _cupsSetLocale(char *argv[]) /* IO - Command-line arguments */
|
||||
if ((charset = strchr(new_lc_time, '.')) == NULL)
|
||||
charset = new_lc_time + strlen(new_lc_time);
|
||||
|
||||
strlcpy(charset, ".UTF-8", sizeof(new_lc_time) - (charset - new_lc_time));
|
||||
strlcpy(charset, ".UTF-8", sizeof(new_lc_time) - (size_t)(charset - new_lc_time));
|
||||
}
|
||||
else
|
||||
strcpy(new_lc_time, "C");
|
||||
strlcpy(new_lc_time, "C", sizeof(new_lc_time));
|
||||
|
||||
setlocale(LC_TIME, new_lc_time);
|
||||
#endif /* LC_TIME */
|
||||
@ -345,8 +332,3 @@ _cupsSetLocale(char *argv[]) /* IO - Command-line arguments */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: langprintf.c 7802 2008-07-28 18:50:45Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
* Private localization support for CUPS.
|
||||
*
|
||||
* Private localization support for CUPS.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_LANGUAGE_PRIVATE_H_
|
||||
@ -80,7 +78,3 @@ extern void _cupsSetLocale(char *argv[]);
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_LANGUAGE_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
214
cups/language.c
214
cups/language.c
@ -1,43 +1,16 @@
|
||||
/*
|
||||
* "$Id: language.c 7558 2008-05-12 23:46:44Z mike $"
|
||||
* I18N/language support for CUPS.
|
||||
*
|
||||
* I18N/language support for CUPS.
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* _cupsAppleLanguage() - Get the Apple language identifier associated with
|
||||
* 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.
|
||||
* _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...
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -134,7 +107,7 @@ static const char * const lang_encodings[] =
|
||||
"unknown", "unknown",
|
||||
"euc-cn", "euc-jp",
|
||||
"euc-kr", "euc-tw",
|
||||
"jis-x0213"
|
||||
"shift_jisx0213"
|
||||
};
|
||||
|
||||
#ifdef __APPLE__
|
||||
@ -227,8 +200,8 @@ _cupsAppleLanguage(const char *locale, /* I - Locale ID */
|
||||
*/
|
||||
|
||||
language[2] = '_';
|
||||
language[3] = toupper(language[3] & 255);
|
||||
language[4] = toupper(language[4] & 255);
|
||||
language[3] = (char)toupper(language[3] & 255);
|
||||
language[4] = (char)toupper(language[4] & 255);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -253,7 +226,7 @@ _cupsAppleLanguage(const char *locale, /* I - Locale ID */
|
||||
if ((langid = CFLocaleCreateCanonicalLanguageIdentifierFromString(
|
||||
kCFAllocatorDefault, localeid)) != NULL)
|
||||
{
|
||||
CFStringGetCString(langid, language, langsize, kCFStringEncodingASCII);
|
||||
CFStringGetCString(langid, language, (CFIndex)langsize, kCFStringEncodingASCII);
|
||||
CFRelease(langid);
|
||||
}
|
||||
|
||||
@ -278,8 +251,8 @@ const char * /* O - Character encoding */
|
||||
_cupsEncodingName(
|
||||
cups_encoding_t encoding) /* I - Encoding value */
|
||||
{
|
||||
if (encoding < 0 ||
|
||||
encoding >= (sizeof(lang_encodings) / sizeof(const char *)))
|
||||
if (encoding < CUPS_US_ASCII ||
|
||||
encoding >= (cups_encoding_t)(sizeof(lang_encodings) / sizeof(lang_encodings[0])))
|
||||
{
|
||||
DEBUG_printf(("1_cupsEncodingName(encoding=%d) = out of range (\"%s\")",
|
||||
encoding, lang_encodings[0]));
|
||||
@ -446,7 +419,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
* Set the character set to UTF-8...
|
||||
*/
|
||||
|
||||
strcpy(charset, "UTF8");
|
||||
strlcpy(charset, "UTF8", sizeof(charset));
|
||||
|
||||
/*
|
||||
* Apple's setlocale doesn't give us the user's localization
|
||||
@ -582,7 +555,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
*/
|
||||
|
||||
if (!charset[0])
|
||||
strcpy(charset, "UTF8");
|
||||
strlcpy(charset, "UTF8", sizeof(charset));
|
||||
|
||||
/*
|
||||
* Parse the language string passed in to a locale string. "C" is the
|
||||
@ -597,7 +570,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
|
||||
if (language == NULL || !language[0] ||
|
||||
!strcmp(language, "POSIX"))
|
||||
strcpy(langname, "C");
|
||||
strlcpy(langname, "C", sizeof(langname));
|
||||
else
|
||||
{
|
||||
/*
|
||||
@ -608,7 +581,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
if (*language == '_' || *language == '-' || *language == '.')
|
||||
break;
|
||||
else if (ptr < (langname + sizeof(langname) - 1))
|
||||
*ptr++ = tolower(*language & 255);
|
||||
*ptr++ = (char)tolower(*language & 255);
|
||||
|
||||
*ptr = '\0';
|
||||
|
||||
@ -622,7 +595,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
if (*language == '.')
|
||||
break;
|
||||
else if (ptr < (country + sizeof(country) - 1))
|
||||
*ptr++ = toupper(*language & 255);
|
||||
*ptr++ = (char)toupper(*language & 255);
|
||||
|
||||
*ptr = '\0';
|
||||
}
|
||||
@ -635,7 +608,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
|
||||
for (language ++, ptr = charset; *language; language ++)
|
||||
if (_cups_isalnum(*language) && ptr < (charset + sizeof(charset) - 1))
|
||||
*ptr++ = toupper(*language & 255);
|
||||
*ptr++ = (char)toupper(*language & 255);
|
||||
|
||||
*ptr = '\0';
|
||||
}
|
||||
@ -646,7 +619,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
|
||||
if (strlen(langname) != 2)
|
||||
{
|
||||
strcpy(langname, "C");
|
||||
strlcpy(langname, "C", sizeof(langname));
|
||||
country[0] = '\0';
|
||||
charset[0] = '\0';
|
||||
}
|
||||
@ -701,7 +674,7 @@ cupsLangGet(const char *language) /* I - Language or locale */
|
||||
if (country[0])
|
||||
snprintf(real, sizeof(real), "%s_%s", langname, country);
|
||||
else
|
||||
strcpy(real, langname);
|
||||
strlcpy(real, langname, sizeof(real));
|
||||
|
||||
_cupsMutexLock(&lang_mutex);
|
||||
|
||||
@ -846,7 +819,8 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
char s[4096], /* String buffer */
|
||||
*ptr, /* Pointer into buffer */
|
||||
*temp; /* New string */
|
||||
int length; /* Length of combined strings */
|
||||
size_t length, /* Length of combined strings */
|
||||
ptrlen; /* Length of string */
|
||||
|
||||
|
||||
DEBUG_printf(("4_cupsMessageLoad(filename=\"%s\")", filename));
|
||||
@ -977,10 +951,10 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
* Append to current string...
|
||||
*/
|
||||
|
||||
length = (int)strlen(m->str ? m->str : m->id);
|
||||
length = strlen(m->str ? m->str : m->id);
|
||||
ptrlen = strlen(ptr);
|
||||
|
||||
if ((temp = realloc(m->str ? m->str : m->id,
|
||||
length + strlen(ptr) + 1)) == NULL)
|
||||
if ((temp = realloc(m->str ? m->str : m->id, length + ptrlen + 1)) == NULL)
|
||||
{
|
||||
if (m->str)
|
||||
free(m->str);
|
||||
@ -995,25 +969,25 @@ _cupsMessageLoad(const char *filename, /* I - Message catalog to load */
|
||||
{
|
||||
/*
|
||||
* Copy the new portion to the end of the msgstr string - safe
|
||||
* to use strcpy because the buffer is allocated to the correct
|
||||
* to use memcpy because the buffer is allocated to the correct
|
||||
* size...
|
||||
*/
|
||||
|
||||
m->str = temp;
|
||||
|
||||
strcpy(m->str + length, ptr);
|
||||
memcpy(m->str + length, ptr, ptrlen + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Copy the new portion to the end of the msgid string - safe
|
||||
* to use strcpy because the buffer is allocated to the correct
|
||||
* to use memcpy because the buffer is allocated to the correct
|
||||
* size...
|
||||
*/
|
||||
|
||||
m->id = temp;
|
||||
|
||||
strcpy(m->id + length, ptr);
|
||||
memcpy(m->id + length, ptr, ptrlen + 1);
|
||||
}
|
||||
}
|
||||
else if (!strncmp(s, "msgstr", 6) && m)
|
||||
@ -1163,7 +1137,7 @@ appleLangDefault(void)
|
||||
int i; /* Looping var */
|
||||
CFBundleRef bundle; /* Main bundle (if any) */
|
||||
CFArrayRef bundleList; /* List of localizations in bundle */
|
||||
CFPropertyListRef localizationList;
|
||||
CFPropertyListRef localizationList = NULL;
|
||||
/* List of localization data */
|
||||
CFStringRef languageName; /* Current name */
|
||||
CFStringRef localeName; /* Canonical from of name */
|
||||
@ -1182,24 +1156,67 @@ appleLangDefault(void)
|
||||
{
|
||||
if (getenv("SOFTWARE") != NULL && (lang = getenv("LANG")) != NULL)
|
||||
{
|
||||
DEBUG_printf(("3appleLangDefault: Using LANG=%s", lang));
|
||||
strlcpy(cg->language, lang, sizeof(cg->language));
|
||||
return (cg->language);
|
||||
}
|
||||
else if ((bundle = CFBundleGetMainBundle()) != NULL &&
|
||||
(bundleList = CFBundleCopyBundleLocalizations(bundle)) != NULL)
|
||||
{
|
||||
localizationList =
|
||||
CFBundleCopyPreferredLocalizationsFromArray(bundleList);
|
||||
CFURLRef resources = CFBundleCopyResourcesDirectoryURL(bundle);
|
||||
|
||||
DEBUG_puts("3appleLangDefault: Getting localizationList from bundle.");
|
||||
|
||||
if (resources)
|
||||
{
|
||||
CFStringRef cfpath = CFURLCopyPath(resources);
|
||||
char path[1024];
|
||||
|
||||
if (cfpath)
|
||||
{
|
||||
/*
|
||||
* See if we have an Info.plist file in the bundle...
|
||||
*/
|
||||
|
||||
CFStringGetCString(cfpath, path, sizeof(path), kCFStringEncodingUTF8);
|
||||
DEBUG_printf(("3appleLangDefault: Got a resource URL (\"%s\")", path));
|
||||
strlcat(path, "Contents/Info.plist", sizeof(path));
|
||||
|
||||
if (!access(path, R_OK))
|
||||
localizationList = CFBundleCopyPreferredLocalizationsFromArray(bundleList);
|
||||
else
|
||||
DEBUG_puts("3appleLangDefault: No Info.plist, ignoring resource URL...");
|
||||
|
||||
CFRelease(cfpath);
|
||||
}
|
||||
|
||||
CFRelease(resources);
|
||||
}
|
||||
else
|
||||
DEBUG_puts("3appleLangDefault: No resource URL.");
|
||||
|
||||
CFRelease(bundleList);
|
||||
}
|
||||
else
|
||||
|
||||
if (!localizationList)
|
||||
{
|
||||
DEBUG_puts("3appleLangDefault: Getting localizationList from preferences.");
|
||||
|
||||
localizationList =
|
||||
CFPreferencesCopyAppValue(CFSTR("AppleLanguages"),
|
||||
kCFPreferencesCurrentApplication);
|
||||
}
|
||||
|
||||
if (localizationList)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
if (CFGetTypeID(localizationList) == CFArrayGetTypeID())
|
||||
DEBUG_printf(("3appleLangDefault: Got localizationList, %d entries.",
|
||||
(int)CFArrayGetCount(localizationList)));
|
||||
else
|
||||
DEBUG_puts("3appleLangDefault: Got localizationList but not an array.");
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (CFGetTypeID(localizationList) == CFArrayGetTypeID() &&
|
||||
CFArrayGetCount(localizationList) > 0)
|
||||
{
|
||||
@ -1217,7 +1234,7 @@ appleLangDefault(void)
|
||||
kCFStringEncodingASCII);
|
||||
CFRelease(localeName);
|
||||
|
||||
DEBUG_printf(("9appleLangDefault: cg->language=\"%s\"",
|
||||
DEBUG_printf(("3appleLangDefault: cg->language=\"%s\"",
|
||||
cg->language));
|
||||
|
||||
/*
|
||||
@ -1231,7 +1248,7 @@ appleLangDefault(void)
|
||||
{
|
||||
if (!strcmp(cg->language, apple_language_locale[i].language))
|
||||
{
|
||||
DEBUG_printf(("9appleLangDefault: mapping \"%s\" to \"%s\"...",
|
||||
DEBUG_printf(("3appleLangDefault: mapping \"%s\" to \"%s\"...",
|
||||
cg->language, apple_language_locale[i].locale));
|
||||
strlcpy(cg->language, apple_language_locale[i].locale,
|
||||
sizeof(cg->language));
|
||||
@ -1249,6 +1266,8 @@ appleLangDefault(void)
|
||||
if (!strchr(cg->language, '.'))
|
||||
strlcat(cg->language, ".UTF-8", sizeof(cg->language));
|
||||
}
|
||||
else
|
||||
DEBUG_puts("3appleLangDefault: Unable to get localeName.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1260,8 +1279,13 @@ appleLangDefault(void)
|
||||
*/
|
||||
|
||||
if (!cg->language[0])
|
||||
{
|
||||
DEBUG_puts("3appleLangDefault: Defaulting to en_US.");
|
||||
strlcpy(cg->language, "en_US.UTF-8", sizeof(cg->language));
|
||||
}
|
||||
}
|
||||
else
|
||||
DEBUG_printf(("3appleLangDefault: Using previous locale \"%s\".", cg->language));
|
||||
|
||||
/*
|
||||
* Return the cached locale...
|
||||
@ -1280,7 +1304,8 @@ static cups_array_t * /* O - Message catalog */
|
||||
appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
{
|
||||
char filename[1024], /* Path to cups.strings file */
|
||||
applelang[256]; /* Apple language ID */
|
||||
applelang[256], /* Apple language ID */
|
||||
baselang[3]; /* Base language */
|
||||
CFURLRef url; /* URL to cups.strings file */
|
||||
CFReadStreamRef stream = NULL; /* File stream */
|
||||
CFPropertyListRef plist = NULL; /* Localization file */
|
||||
@ -1298,6 +1323,30 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
snprintf(filename, sizeof(filename),
|
||||
CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings",
|
||||
_cupsAppleLanguage(locale, applelang, sizeof(applelang)));
|
||||
|
||||
if (access(filename, 0))
|
||||
{
|
||||
/*
|
||||
* <rdar://problem/22086642>
|
||||
*
|
||||
* Try with original locale string...
|
||||
*/
|
||||
|
||||
snprintf(filename, sizeof(filename), CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", locale);
|
||||
}
|
||||
|
||||
if (access(filename, 0))
|
||||
{
|
||||
/*
|
||||
* <rdar://problem/25292403>
|
||||
*
|
||||
* Try with just the language code...
|
||||
*/
|
||||
|
||||
strlcpy(baselang, locale, sizeof(baselang));
|
||||
snprintf(filename, sizeof(filename), CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", baselang);
|
||||
}
|
||||
|
||||
DEBUG_printf(("1appleMessageLoad: filename=\"%s\"", filename));
|
||||
|
||||
if (access(filename, 0))
|
||||
@ -1308,7 +1357,9 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
|
||||
if (!strncmp(locale, "en", 2))
|
||||
locale = "English";
|
||||
else if (!strncmp(locale, "nb", 2) || !strncmp(locale, "nl", 2))
|
||||
else if (!strncmp(locale, "nb", 2))
|
||||
locale = "no";
|
||||
else if (!strncmp(locale, "nl", 2))
|
||||
locale = "Dutch";
|
||||
else if (!strncmp(locale, "fr", 2))
|
||||
locale = "French";
|
||||
@ -1320,6 +1371,28 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
locale = "Japanese";
|
||||
else if (!strncmp(locale, "es", 2))
|
||||
locale = "Spanish";
|
||||
else if (!strcmp(locale, "zh_HK"))
|
||||
{
|
||||
/*
|
||||
* <rdar://problem/22130168>
|
||||
*
|
||||
* Try zh_TW first, then zh... Sigh...
|
||||
*/
|
||||
|
||||
if (!access(CUPS_BUNDLEDIR "/Resources/zh_TW.lproj/cups.strings", 0))
|
||||
locale = "zh_TW";
|
||||
else
|
||||
locale = "zh";
|
||||
}
|
||||
else if (strstr(locale, "_") != NULL || strstr(locale, "-") != NULL)
|
||||
{
|
||||
/*
|
||||
* Drop country code, just try language...
|
||||
*/
|
||||
|
||||
strlcpy(baselang, locale, sizeof(baselang));
|
||||
locale = baselang;
|
||||
}
|
||||
|
||||
snprintf(filename, sizeof(filename),
|
||||
CUPS_BUNDLEDIR "/Resources/%s.lproj/cups.strings", locale);
|
||||
@ -1328,7 +1401,7 @@ appleMessageLoad(const char *locale) /* I - Locale ID */
|
||||
|
||||
url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault,
|
||||
(UInt8 *)filename,
|
||||
strlen(filename), false);
|
||||
(CFIndex)strlen(filename), false);
|
||||
if (url)
|
||||
{
|
||||
stream = CFReadStreamCreateWithFile(kCFAllocatorDefault, url);
|
||||
@ -1415,7 +1488,7 @@ cups_cache_lookup(
|
||||
for (lang = lang_cache; lang != NULL; lang = lang->next)
|
||||
{
|
||||
DEBUG_printf(("9cups_cache_lookup: lang=%p, language=\"%s\", "
|
||||
"encoding=%d(%s)", lang, lang->language, lang->encoding,
|
||||
"encoding=%d(%s)", (void *)lang, lang->language, lang->encoding,
|
||||
lang_encodings[lang->encoding]));
|
||||
|
||||
if (!strcmp(lang->language, name) &&
|
||||
@ -1560,8 +1633,3 @@ cups_unquote(char *d, /* O - Unquoted string */
|
||||
|
||||
*d = '\0';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: language.c 7558 2008-05-12 23:46:44Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: language.h 6649 2007-07-11 21:46:42Z mike $"
|
||||
* Multi-language support for CUPS.
|
||||
*
|
||||
* Multi-language support for CUPS.
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_LANGUAGE_H_
|
||||
@ -109,7 +107,3 @@ extern cups_lang_t *cupsLangGet(const char *language);
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_LANGUAGE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: language.h 6649 2007-07-11 21:46:42Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,382 +1,547 @@
|
||||
LIBRARY libcups2
|
||||
VERSION 2.9
|
||||
EXPORTS
|
||||
_cupsBufferGet
|
||||
_cupsBufferRelease
|
||||
_cupsGet1284Values
|
||||
_cupsGetDests
|
||||
_cupsGetPassword
|
||||
_cupsGlobals
|
||||
_cupsLangPrintError
|
||||
_cupsLangPrintf
|
||||
_cupsLangPuts
|
||||
_cupsLangString
|
||||
_cupsMD5Append
|
||||
_cupsMD5Finish
|
||||
_cupsMD5Init
|
||||
_cupsMessageFree
|
||||
_cupsMessageLoad
|
||||
_cupsMessageLookup
|
||||
_cupsMutexLock
|
||||
_cupsMutexUnlock
|
||||
_cupsNextDelay
|
||||
_cupsSetError
|
||||
_cupsSetLocale
|
||||
_cupsStrAlloc
|
||||
_cupsStrFlush
|
||||
_cupsStrFormatd
|
||||
_cupsStrFree
|
||||
_cupsStrRetain
|
||||
_cupsStrScand
|
||||
_cupsStrStatistics
|
||||
_cups_strcasecmp
|
||||
_cups_strncasecmp
|
||||
_cups_strcpy
|
||||
_cups_strlcat
|
||||
_cups_strlcpy
|
||||
_httpAddrPort
|
||||
_httpAddrSetPort
|
||||
_httpAssembleUUID
|
||||
_httpCreate
|
||||
_httpEncodeURI
|
||||
_httpPeek
|
||||
_httpResolveURI
|
||||
_httpWait
|
||||
_ippFindOption
|
||||
_ppdCacheCreateWithFile
|
||||
_ppdCacheCreateWithPPD
|
||||
_ppdCacheDestroy
|
||||
_ppdCacheGetBin
|
||||
_ppdCacheGetInputSlot
|
||||
_ppdCacheGetMediaType
|
||||
_ppdCacheGetOutputBin
|
||||
_ppdCacheGetPageSize
|
||||
_ppdCacheGetSize
|
||||
_ppdCacheGetSource
|
||||
_ppdCacheGetType
|
||||
_ppdCacheWriteFile
|
||||
_ppdFreeLanguages
|
||||
_ppdGetEncoding
|
||||
_ppdGetLanguages
|
||||
_ppdHashName
|
||||
_ppdLocalizedAttr
|
||||
_ppdNormalizeMakeAndModel
|
||||
_ppdOpen
|
||||
_ppdOpenFile
|
||||
_ppdParseOptions
|
||||
_pwgGenerateSize
|
||||
_pwgInitSize
|
||||
_pwgMediaForLegacy
|
||||
_pwgMediaForPPD
|
||||
_pwgMediaForPWG
|
||||
_pwgMediaForSize
|
||||
_pwgMediaTypeForType
|
||||
_pwgPageSizeForMedia
|
||||
cupsAddDest
|
||||
cupsAddOption
|
||||
cupsAdminCreateWindowsPPD
|
||||
cupsAdminExportSamba
|
||||
cupsArrayAdd
|
||||
cupsArrayClear
|
||||
cupsArrayCount
|
||||
cupsArrayCurrent
|
||||
cupsArrayDelete
|
||||
cupsArrayDup
|
||||
cupsArrayFind
|
||||
cupsArrayFirst
|
||||
cupsArrayGetIndex
|
||||
cupsArrayGetInsert
|
||||
cupsArrayIndex
|
||||
cupsArrayInsert
|
||||
cupsArrayLast
|
||||
cupsArrayNew
|
||||
cupsArrayNew2
|
||||
cupsArrayNew3
|
||||
cupsArrayNext
|
||||
cupsArrayPrev
|
||||
cupsArrayRemove
|
||||
cupsArrayRestore
|
||||
cupsArraySave
|
||||
cupsArrayUserData
|
||||
cupsCancelJob
|
||||
cupsCharsetToUTF8
|
||||
cupsDirClose
|
||||
cupsDirOpen
|
||||
cupsDirRead
|
||||
cupsDirRewind
|
||||
cupsDoAuthentication
|
||||
cupsDoFileRequest
|
||||
cupsDoIORequest
|
||||
cupsDoRequest
|
||||
cupsEncodeOptions
|
||||
cupsEncodeOptions2
|
||||
cupsEncryption
|
||||
cupsFileClose
|
||||
cupsFileCompression
|
||||
cupsFileEOF
|
||||
cupsFileFind
|
||||
cupsFileFlush
|
||||
cupsFileGetChar
|
||||
cupsFileGetConf
|
||||
cupsFileGetLine
|
||||
cupsFileGets
|
||||
cupsFileLock
|
||||
cupsFileNumber
|
||||
cupsFileOpen
|
||||
cupsFileOpenFd
|
||||
cupsFilePeekChar
|
||||
cupsFilePrintf
|
||||
cupsFilePutChar
|
||||
cupsFilePuts
|
||||
cupsFileRead
|
||||
cupsFileRewind
|
||||
cupsFileSeek
|
||||
cupsFileStderr
|
||||
cupsFileStdin
|
||||
cupsFileStdout
|
||||
cupsFileTell
|
||||
cupsFileUnlock
|
||||
cupsFileWrite
|
||||
cupsFreeDests
|
||||
cupsFreeJobs
|
||||
cupsFreeOptions
|
||||
cupsGetClasses
|
||||
cupsGetDefault
|
||||
cupsGetDefault2
|
||||
cupsGetDest
|
||||
cupsGetDests
|
||||
cupsGetDests2
|
||||
cupsGetFd
|
||||
cupsGetFile
|
||||
cupsGetJobs
|
||||
cupsGetJobs2
|
||||
cupsGetOption
|
||||
cupsGetPPD
|
||||
cupsGetPPD2
|
||||
cupsGetPassword
|
||||
cupsGetPrinters
|
||||
cupsGetResponse
|
||||
cupsLangDefault
|
||||
cupsLangEncoding
|
||||
cupsLangFlush
|
||||
cupsLangFree
|
||||
cupsLangGet
|
||||
cupsLastError
|
||||
cupsLastErrorString
|
||||
cupsMarkOptions
|
||||
cupsNotifySubject
|
||||
cupsNotifyText
|
||||
cupsParseOptions
|
||||
cupsPrintFile
|
||||
cupsPrintFile2
|
||||
cupsPrintFiles
|
||||
cupsPrintFiles2
|
||||
cupsPutFd
|
||||
cupsPutFile
|
||||
cupsRemoveOption
|
||||
cupsResolveConflicts
|
||||
cupsSendRequest
|
||||
cupsServer
|
||||
cupsSetClientCertCB
|
||||
cupsSetCredentials
|
||||
cupsSetDests
|
||||
cupsSetDests2
|
||||
cupsSetEncryption
|
||||
cupsSetPasswordCB
|
||||
cupsSetServer
|
||||
cupsSetServerCertCB
|
||||
cupsSetUser
|
||||
cupsTempFd
|
||||
cupsTempFile
|
||||
cupsTempFile2
|
||||
cupsUTF32ToUTF8
|
||||
cupsUTF8ToCharset
|
||||
cupsUTF8ToUTF32
|
||||
cupsUser
|
||||
cupsWriteRequestData
|
||||
httpAddCredential
|
||||
httpAddrAny
|
||||
httpAddrConnect
|
||||
httpAddrEqual
|
||||
httpAddrFreeList
|
||||
httpAddrGetList
|
||||
httpAddrLength
|
||||
httpAddrLocalhost
|
||||
httpAddrLookup
|
||||
httpAddrString
|
||||
httpAssembleURI
|
||||
httpAssembleURIf
|
||||
httpBlocking
|
||||
httpCheck
|
||||
httpClearCookie
|
||||
httpClearFields
|
||||
httpClose
|
||||
httpConnect
|
||||
httpConnectEncrypt
|
||||
httpCopyCredentials
|
||||
httpDecode64
|
||||
httpDecode64_2
|
||||
httpDelete
|
||||
httpEncode64
|
||||
httpEncode64_2
|
||||
httpEncryption
|
||||
httpError
|
||||
httpFlush
|
||||
httpFlushWrite
|
||||
httpFreeCredentials
|
||||
httpGet
|
||||
httpGetBlocking
|
||||
httpGetCookie
|
||||
httpGetDateString
|
||||
httpGetDateString2
|
||||
httpGetDateTime
|
||||
httpGetFd
|
||||
httpGetField
|
||||
httpGetHostByName
|
||||
httpGetHostname
|
||||
httpGetLength
|
||||
httpGetLength2
|
||||
httpGetStatus
|
||||
httpGetSubField
|
||||
httpGetSubField2
|
||||
httpGets
|
||||
httpHead
|
||||
httpInitialize
|
||||
httpMD5
|
||||
httpMD5Final
|
||||
httpMD5String
|
||||
httpOptions
|
||||
httpPost
|
||||
httpPrintf
|
||||
httpPut
|
||||
httpRead
|
||||
httpRead2
|
||||
httpReconnect
|
||||
httpSeparate
|
||||
httpSeparate2
|
||||
httpSeparateURI
|
||||
httpSetCookie
|
||||
httpSetCredentials
|
||||
httpSetExpect
|
||||
httpSetField
|
||||
httpSetLength
|
||||
httpSetTimeout
|
||||
httpStatus
|
||||
httpTrace
|
||||
httpUpdate
|
||||
httpWait
|
||||
httpWrite
|
||||
httpWrite2
|
||||
ippAddBoolean
|
||||
ippAddBooleans
|
||||
ippAddCollection
|
||||
ippAddCollections
|
||||
ippAddDate
|
||||
ippAddInteger
|
||||
ippAddIntegers
|
||||
ippAddOctetString
|
||||
ippAddOutOfBand
|
||||
ippAddRange
|
||||
ippAddRanges
|
||||
ippAddResolution
|
||||
ippAddResolutions
|
||||
ippAddSeparator
|
||||
ippAddString
|
||||
ippAddStrings
|
||||
ippAttributeString
|
||||
ippCopyAttribute
|
||||
ippCopyAttributes
|
||||
ippDateToTime
|
||||
ippDelete
|
||||
ippDeleteAttribute
|
||||
ippDeleteValues
|
||||
ippEnumString
|
||||
ippEnumValue
|
||||
ippErrorString
|
||||
ippErrorValue
|
||||
ippFindAttribute
|
||||
ippFindNextAttribute
|
||||
ippFirstAttribute
|
||||
ippGetBoolean
|
||||
ippGetCollection
|
||||
ippGetCount
|
||||
ippGetDate
|
||||
ippGetGroupTag
|
||||
ippGetInteger
|
||||
ippGetName
|
||||
ippGetOperation
|
||||
ippGetRange
|
||||
ippGetRequestId
|
||||
ippGetResolution
|
||||
ippGetState
|
||||
ippGetStatusCode
|
||||
ippGetString
|
||||
ippGetValueTag
|
||||
ippGetVersion
|
||||
ippLength
|
||||
ippNew
|
||||
ippNewRequest
|
||||
ippNextAttribute
|
||||
ippOpString
|
||||
ippOpValue
|
||||
ippPort
|
||||
ippRead
|
||||
ippReadFile
|
||||
ippReadIO
|
||||
ippSetPort
|
||||
ippSetBoolean
|
||||
ippSetCollection
|
||||
ippSetDate
|
||||
ippSetGroupTag
|
||||
ippSetInteger
|
||||
ippSetName
|
||||
ippSetOperation
|
||||
ippSetRange
|
||||
ippSetRequestId
|
||||
ippSetResolution
|
||||
ippSetState
|
||||
ippSetStatusCode
|
||||
ippSetString
|
||||
ippSetValueTag
|
||||
ippSetVersion
|
||||
ippTagString
|
||||
ippTagValue
|
||||
ippTimeToDate
|
||||
ippWrite
|
||||
ippWriteFile
|
||||
ippWriteIO
|
||||
ppdClose
|
||||
ppdCollect
|
||||
ppdCollect2
|
||||
ppdConflicts
|
||||
ppdEmit
|
||||
ppdEmitAfterOrder
|
||||
ppdEmitFd
|
||||
ppdEmitJCL
|
||||
ppdEmitJCLEnd
|
||||
ppdEmitString
|
||||
ppdErrorString
|
||||
ppdFindAttr
|
||||
ppdFindChoice
|
||||
ppdFindCustomOption
|
||||
ppdFindCustomParam
|
||||
ppdFindMarkedChoice
|
||||
ppdFindNextAttr
|
||||
ppdFindOption
|
||||
ppdFirstCustomParam
|
||||
ppdFirstOption
|
||||
ppdIsMarked
|
||||
ppdLastError
|
||||
ppdLocalize
|
||||
ppdMarkDefaults
|
||||
ppdMarkOption
|
||||
ppdNextCustomParam
|
||||
ppdNextOption
|
||||
ppdOpen
|
||||
ppdOpen2
|
||||
ppdOpenFd
|
||||
ppdOpenFile
|
||||
ppdPageLength
|
||||
ppdPageSize
|
||||
ppdPageWidth
|
||||
ppdSetConformance
|
||||
LIBRARY libcups2
|
||||
VERSION 2.12
|
||||
EXPORTS
|
||||
_cupsArrayAddStrings
|
||||
_cupsArrayNewStrings
|
||||
_cupsBufferGet
|
||||
_cupsBufferRelease
|
||||
_cupsCharmapFlush
|
||||
_cupsCondBroadcast
|
||||
_cupsCondInit
|
||||
_cupsCondWait
|
||||
_cupsConnect
|
||||
_cupsConvertOptions
|
||||
_cupsCreateDest
|
||||
_cupsEncodingName
|
||||
_cupsGet1284Values
|
||||
_cupsGetDestResource
|
||||
_cupsGetDests
|
||||
_cupsGetPassword
|
||||
_cupsGlobalLock
|
||||
_cupsGlobalUnlock
|
||||
_cupsGlobals
|
||||
_cupsLangPrintError
|
||||
_cupsLangPrintf
|
||||
_cupsLangPuts
|
||||
_cupsLangString
|
||||
_cupsMD5Append
|
||||
_cupsMD5Finish
|
||||
_cupsMD5Init
|
||||
_cupsMessageFree
|
||||
_cupsMessageLoad
|
||||
_cupsMessageLookup
|
||||
_cupsMessageNew
|
||||
_cupsMutexInit
|
||||
_cupsMutexLock
|
||||
_cupsMutexUnlock
|
||||
_cupsNextDelay
|
||||
_cupsRWInit
|
||||
_cupsRWLockRead
|
||||
_cupsRWLockWrite
|
||||
_cupsRWUnlock
|
||||
_cupsSNMPClose
|
||||
_cupsSNMPCopyOID
|
||||
_cupsSNMPDefaultCommunity
|
||||
_cupsSNMPIsOID
|
||||
_cupsSNMPIsOIDPrefixed
|
||||
_cupsSNMPOIDToString
|
||||
_cupsSNMPOpen
|
||||
_cupsSNMPRead
|
||||
_cupsSNMPSetDebug
|
||||
_cupsSNMPStringToOID
|
||||
_cupsSNMPWalk
|
||||
_cupsSNMPWrite
|
||||
_cupsSetDefaults
|
||||
_cupsSetError
|
||||
_cupsSetHTTPError
|
||||
_cupsSetLocale
|
||||
_cupsStrAlloc
|
||||
_cupsStrDate
|
||||
_cupsStrFlush
|
||||
_cupsStrFormatd
|
||||
_cupsStrFree
|
||||
_cupsStrRetain
|
||||
_cupsStrScand
|
||||
_cupsStrStatistics
|
||||
_cupsThreadCancel
|
||||
_cupsThreadCreate
|
||||
_cupsThreadWait
|
||||
_cupsUserDefault
|
||||
_cups_safe_vsnprintf
|
||||
_cups_strcasecmp
|
||||
_cups_strcpy
|
||||
_cups_strcpy
|
||||
_cups_strlcat
|
||||
_cups_strlcpy
|
||||
_cups_strncasecmp
|
||||
_httpAddrSetPort
|
||||
_httpCreateCredentials
|
||||
_httpDecodeURI
|
||||
_httpDisconnect
|
||||
_httpEncodeURI
|
||||
_httpFreeCredentials
|
||||
_httpResolveURI
|
||||
_httpStatus
|
||||
_httpTLSInitialize
|
||||
_httpTLSPending
|
||||
_httpTLSRead
|
||||
_httpTLSSetOptions
|
||||
_httpTLSStart
|
||||
_httpTLSStop
|
||||
_httpTLSWrite
|
||||
_httpUpdate
|
||||
_httpWait
|
||||
_ippCheckOptions
|
||||
_ippFindOption
|
||||
_ppdCacheCreateWithFile
|
||||
_ppdCacheCreateWithPPD
|
||||
_ppdCacheDestroy
|
||||
_ppdCacheGetBin
|
||||
_ppdCacheGetFinishingOptions
|
||||
_ppdCacheGetFinishingValues
|
||||
_ppdCacheGetInputSlot
|
||||
_ppdCacheGetMediaType
|
||||
_ppdCacheGetOutputBin
|
||||
_ppdCacheGetPageSize
|
||||
_ppdCacheGetSize
|
||||
_ppdCacheGetSource
|
||||
_ppdCacheGetType
|
||||
_ppdCacheWriteFile
|
||||
_ppdCreateFromIPP
|
||||
_ppdFreeLanguages
|
||||
_ppdGetEncoding
|
||||
_ppdGetLanguages
|
||||
_ppdGlobals
|
||||
_ppdHashName
|
||||
_ppdLocalizedAttr
|
||||
_ppdNormalizeMakeAndModel
|
||||
_ppdOpen
|
||||
_ppdOpenFile
|
||||
_ppdParseOptions
|
||||
_pwgGenerateSize
|
||||
_pwgInitSize
|
||||
_pwgInputSlotForSource
|
||||
_pwgMediaNearSize
|
||||
_pwgMediaTable
|
||||
_pwgMediaTypeForType
|
||||
_pwgPageSizeForMedia
|
||||
cupsAddDest
|
||||
cupsAddOption
|
||||
cupsAdminCreateWindowsPPD
|
||||
cupsAdminExportSamba
|
||||
cupsAdminGetServerSettings
|
||||
cupsAdminSetServerSettings
|
||||
cupsArrayAdd
|
||||
cupsArrayClear
|
||||
cupsArrayCount
|
||||
cupsArrayCurrent
|
||||
cupsArrayDelete
|
||||
cupsArrayDup
|
||||
cupsArrayFind
|
||||
cupsArrayFirst
|
||||
cupsArrayGetIndex
|
||||
cupsArrayGetInsert
|
||||
cupsArrayIndex
|
||||
cupsArrayInsert
|
||||
cupsArrayLast
|
||||
cupsArrayNew
|
||||
cupsArrayNew2
|
||||
cupsArrayNew3
|
||||
cupsArrayNext
|
||||
cupsArrayPrev
|
||||
cupsArrayRemove
|
||||
cupsArrayRestore
|
||||
cupsArraySave
|
||||
cupsArrayUserData
|
||||
cupsCancelDestJob
|
||||
cupsCancelJob
|
||||
cupsCancelJob2
|
||||
cupsCharsetToUTF8
|
||||
cupsCheckDestSupported
|
||||
cupsCloseDestJob
|
||||
cupsConnectDest
|
||||
cupsCopyDest
|
||||
cupsCopyDestConflicts
|
||||
cupsCopyDestInfo
|
||||
cupsCreateDestJob
|
||||
cupsCreateJob
|
||||
cupsDirClose
|
||||
cupsDirOpen
|
||||
cupsDirRead
|
||||
cupsDirRewind
|
||||
cupsDoAuthentication
|
||||
cupsDoFileRequest
|
||||
cupsDoIORequest
|
||||
cupsDoRequest
|
||||
cupsEncodeOptions
|
||||
cupsEncodeOptions2
|
||||
cupsEncryption
|
||||
cupsEnumDests
|
||||
cupsFileClose
|
||||
cupsFileCompression
|
||||
cupsFileEOF
|
||||
cupsFileFind
|
||||
cupsFileFlush
|
||||
cupsFileGetChar
|
||||
cupsFileGetConf
|
||||
cupsFileGetLine
|
||||
cupsFileGets
|
||||
cupsFileLock
|
||||
cupsFileNumber
|
||||
cupsFileOpen
|
||||
cupsFileOpenFd
|
||||
cupsFilePeekChar
|
||||
cupsFilePrintf
|
||||
cupsFilePutChar
|
||||
cupsFilePutConf
|
||||
cupsFilePuts
|
||||
cupsFileRead
|
||||
cupsFileRewind
|
||||
cupsFileSeek
|
||||
cupsFileStderr
|
||||
cupsFileStdin
|
||||
cupsFileStdout
|
||||
cupsFileTell
|
||||
cupsFileUnlock
|
||||
cupsFileWrite
|
||||
cupsFindDestDefault
|
||||
cupsFindDestReady
|
||||
cupsFindDestSupported
|
||||
cupsFinishDestDocument
|
||||
cupsFinishDocument
|
||||
cupsFreeDestInfo
|
||||
cupsFreeDests
|
||||
cupsFreeJobs
|
||||
cupsFreeOptions
|
||||
cupsGetClasses
|
||||
cupsGetConflicts
|
||||
cupsGetDefault
|
||||
cupsGetDefault2
|
||||
cupsGetDest
|
||||
cupsGetDestMediaByIndex
|
||||
cupsGetDestMediaByName
|
||||
cupsGetDestMediaBySize
|
||||
cupsGetDestMediaCount
|
||||
cupsGetDestMediaDefault
|
||||
cupsGetDestWithURI
|
||||
cupsGetDests
|
||||
cupsGetDests2
|
||||
cupsGetDevices
|
||||
cupsGetFd
|
||||
cupsGetFile
|
||||
cupsGetJobs
|
||||
cupsGetJobs2
|
||||
cupsGetNamedDest
|
||||
cupsGetOption
|
||||
cupsGetPPD
|
||||
cupsGetPPD2
|
||||
cupsGetPPD3
|
||||
cupsGetPassword
|
||||
cupsGetPassword2
|
||||
cupsGetPrinters
|
||||
cupsGetResponse
|
||||
cupsGetServerPPD
|
||||
cupsHashData
|
||||
cupsLangDefault
|
||||
cupsLangEncoding
|
||||
cupsLangFlush
|
||||
cupsLangFree
|
||||
cupsLangGet
|
||||
cupsLastError
|
||||
cupsLastErrorString
|
||||
cupsLocalizeDestMedia
|
||||
cupsLocalizeDestOption
|
||||
cupsLocalizeDestValue
|
||||
cupsMakeServerCredentials
|
||||
cupsMarkOptions
|
||||
cupsNotifySubject
|
||||
cupsNotifyText
|
||||
cupsParseOptions
|
||||
cupsPrintFile
|
||||
cupsPrintFile2
|
||||
cupsPrintFiles
|
||||
cupsPrintFiles2
|
||||
cupsPutFd
|
||||
cupsPutFile
|
||||
cupsReadResponseData
|
||||
cupsRemoveDest
|
||||
cupsRemoveOption
|
||||
cupsResolveConflicts
|
||||
cupsSendRequest
|
||||
cupsServer
|
||||
cupsSetClientCertCB
|
||||
cupsSetCredentials
|
||||
cupsSetDefaultDest
|
||||
cupsSetDests
|
||||
cupsSetDests2
|
||||
cupsSetEncryption
|
||||
cupsSetPasswordCB
|
||||
cupsSetPasswordCB2
|
||||
cupsSetServer
|
||||
cupsSetServerCertCB
|
||||
cupsSetServerCredentials
|
||||
cupsSetUser
|
||||
cupsSetUserAgent
|
||||
cupsStartDestDocument
|
||||
cupsStartDocument
|
||||
cupsTempFd
|
||||
cupsTempFile
|
||||
cupsTempFile2
|
||||
cupsUTF32ToUTF8
|
||||
cupsUTF8ToCharset
|
||||
cupsUTF8ToUTF32
|
||||
cupsUser
|
||||
cupsUserAgent
|
||||
cupsWriteRequestData
|
||||
httpAcceptConnection
|
||||
httpAddCredential
|
||||
httpAddrAny
|
||||
httpAddrClose
|
||||
httpAddrConnect
|
||||
httpAddrConnect2
|
||||
httpAddrCopyList
|
||||
httpAddrEqual
|
||||
httpAddrFamily
|
||||
httpAddrFreeList
|
||||
httpAddrGetList
|
||||
httpAddrLength
|
||||
httpAddrListen
|
||||
httpAddrLocalhost
|
||||
httpAddrLookup
|
||||
httpAddrPort
|
||||
httpAddrString
|
||||
httpAssembleURI
|
||||
httpAssembleURIf
|
||||
httpAssembleUUID
|
||||
httpBlocking
|
||||
httpCheck
|
||||
httpClearCookie
|
||||
httpClearFields
|
||||
httpClose
|
||||
httpCompareCredentials
|
||||
httpConnect
|
||||
httpConnect2
|
||||
httpConnectEncrypt
|
||||
httpCopyCredentials
|
||||
httpCredentialsAreValidForName
|
||||
httpCredentialsGetExpiration
|
||||
httpCredentialsGetTrust
|
||||
httpCredentialsString
|
||||
httpDecode64
|
||||
httpDecode64_2
|
||||
httpDelete
|
||||
httpEncode64
|
||||
httpEncode64_2
|
||||
httpEncryption
|
||||
httpError
|
||||
httpFieldValue
|
||||
httpFlush
|
||||
httpFlushWrite
|
||||
httpFreeCredentials
|
||||
httpGet
|
||||
httpGetActivity
|
||||
httpGetAddress
|
||||
httpGetAuthString
|
||||
httpGetBlocking
|
||||
httpGetContentEncoding
|
||||
httpGetCookie
|
||||
httpGetDateString
|
||||
httpGetDateString2
|
||||
httpGetDateTime
|
||||
httpGetEncryption
|
||||
httpGetExpect
|
||||
httpGetFd
|
||||
httpGetField
|
||||
httpGetHostByName
|
||||
httpGetHostname
|
||||
httpGetKeepAlive
|
||||
httpGetLength
|
||||
httpGetLength2
|
||||
httpGetPending
|
||||
httpGetReady
|
||||
httpGetRemaining
|
||||
httpGetState
|
||||
httpGetStatus
|
||||
httpGetSubField
|
||||
httpGetSubField2
|
||||
httpGetVersion
|
||||
httpGets
|
||||
httpHead
|
||||
httpInitialize
|
||||
httpIsChunked
|
||||
httpIsEncrypted
|
||||
httpLoadCredentials
|
||||
httpMD5
|
||||
httpMD5Final
|
||||
httpMD5String
|
||||
httpOptions
|
||||
httpPeek
|
||||
httpPost
|
||||
httpPrintf
|
||||
httpPut
|
||||
httpRead
|
||||
httpRead2
|
||||
httpReadRequest
|
||||
httpReconnect
|
||||
httpReconnect2
|
||||
httpResolveHostname
|
||||
httpSaveCredentials
|
||||
httpSeparate
|
||||
httpSeparate2
|
||||
httpSeparateURI
|
||||
httpSetAuthString
|
||||
httpSetCookie
|
||||
httpSetCredentials
|
||||
httpSetDefaultField
|
||||
httpSetExpect
|
||||
httpSetField
|
||||
httpSetKeepAlive
|
||||
httpSetLength
|
||||
httpSetTimeout
|
||||
httpShutdown
|
||||
httpStateString
|
||||
httpStatus
|
||||
httpTrace
|
||||
httpURIStatusString
|
||||
httpUpdate
|
||||
httpWait
|
||||
httpWrite
|
||||
httpWrite2
|
||||
httpWriteResponse
|
||||
ippAddBoolean
|
||||
ippAddBooleans
|
||||
ippAddCollection
|
||||
ippAddCollections
|
||||
ippAddDate
|
||||
ippAddInteger
|
||||
ippAddIntegers
|
||||
ippAddOctetString
|
||||
ippAddOutOfBand
|
||||
ippAddRange
|
||||
ippAddRanges
|
||||
ippAddResolution
|
||||
ippAddResolutions
|
||||
ippAddSeparator
|
||||
ippAddString
|
||||
ippAddStringf
|
||||
ippAddStringfv
|
||||
ippAddStrings
|
||||
ippAttributeString
|
||||
ippContainsInteger
|
||||
ippContainsString
|
||||
ippCopyAttribute
|
||||
ippCopyAttributes
|
||||
ippCreateRequestedArray
|
||||
ippDateToTime
|
||||
ippDelete
|
||||
ippDeleteAttribute
|
||||
ippDeleteValues
|
||||
ippEnumString
|
||||
ippEnumValue
|
||||
ippErrorString
|
||||
ippErrorValue
|
||||
ippFindAttribute
|
||||
ippFindNextAttribute
|
||||
ippFirstAttribute
|
||||
ippGetBoolean
|
||||
ippGetCollection
|
||||
ippGetCount
|
||||
ippGetDate
|
||||
ippGetGroupTag
|
||||
ippGetInteger
|
||||
ippGetName
|
||||
ippGetOctetString
|
||||
ippGetOperation
|
||||
ippGetRange
|
||||
ippGetRequestId
|
||||
ippGetResolution
|
||||
ippGetState
|
||||
ippGetStatusCode
|
||||
ippGetString
|
||||
ippGetValueTag
|
||||
ippGetVersion
|
||||
ippLength
|
||||
ippNew
|
||||
ippNewRequest
|
||||
ippNewResponse
|
||||
ippNextAttribute
|
||||
ippOpString
|
||||
ippOpValue
|
||||
ippPort
|
||||
ippRead
|
||||
ippReadFile
|
||||
ippReadIO
|
||||
ippSetBoolean
|
||||
ippSetCollection
|
||||
ippSetDate
|
||||
ippSetGroupTag
|
||||
ippSetInteger
|
||||
ippSetName
|
||||
ippSetOctetString
|
||||
ippSetOperation
|
||||
ippSetPort
|
||||
ippSetRange
|
||||
ippSetRequestId
|
||||
ippSetResolution
|
||||
ippSetState
|
||||
ippSetStatusCode
|
||||
ippSetString
|
||||
ippSetStringf
|
||||
ippSetStringfv
|
||||
ippSetValueTag
|
||||
ippSetVersion
|
||||
ippStateString
|
||||
ippTagString
|
||||
ippTagValue
|
||||
ippTimeToDate
|
||||
ippValidateAttribute
|
||||
ippValidateAttributes
|
||||
ippWrite
|
||||
ippWriteFile
|
||||
ippWriteIO
|
||||
ppdClose
|
||||
ppdCollect
|
||||
ppdCollect2
|
||||
ppdConflicts
|
||||
ppdEmit
|
||||
ppdEmitAfterOrder
|
||||
ppdEmitFd
|
||||
ppdEmitJCL
|
||||
ppdEmitJCLEnd
|
||||
ppdEmitString
|
||||
ppdErrorString
|
||||
ppdFindAttr
|
||||
ppdFindChoice
|
||||
ppdFindCustomOption
|
||||
ppdFindCustomParam
|
||||
ppdFindMarkedChoice
|
||||
ppdFindNextAttr
|
||||
ppdFindOption
|
||||
ppdFirstCustomParam
|
||||
ppdFirstOption
|
||||
ppdInstallableConflict
|
||||
ppdIsMarked
|
||||
ppdLastError
|
||||
ppdLocalize
|
||||
ppdLocalizeAttr
|
||||
ppdLocalizeIPPReason
|
||||
ppdLocalizeMarkerName
|
||||
ppdMarkDefaults
|
||||
ppdMarkOption
|
||||
ppdNextCustomParam
|
||||
ppdNextOption
|
||||
ppdOpen
|
||||
ppdOpen2
|
||||
ppdOpenFd
|
||||
ppdOpenFile
|
||||
ppdPageLength
|
||||
ppdPageSize
|
||||
ppdPageSizeLimits
|
||||
ppdPageWidth
|
||||
ppdSetConformance
|
||||
pwgFormatSizeName
|
||||
pwgInitSize
|
||||
pwgMediaForLegacy
|
||||
pwgMediaForPPD
|
||||
pwgMediaForPWG
|
||||
pwgMediaForSize
|
||||
|
||||
@ -1,31 +1,29 @@
|
||||
/*
|
||||
* "$Id$"
|
||||
* Private MD5 definitions for CUPS.
|
||||
*
|
||||
* Private MD5 definitions for CUPS.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2005 by Easy Software Products
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2005 by Easy Software Products
|
||||
* Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
|
||||
*
|
||||
* Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* L. Peter Deutsch
|
||||
* ghost@aladdin.com
|
||||
* L. Peter Deutsch
|
||||
* ghost@aladdin.com
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -73,7 +71,3 @@ void _cupsMD5Finish(_cups_md5_state_t *pms, unsigned char digest[16]);
|
||||
} /* end extern "C" */
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_MD5_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id$".
|
||||
*/
|
||||
|
||||
57
cups/md5.c
57
cups/md5.c
@ -1,31 +1,28 @@
|
||||
/*
|
||||
* "$Id: md5.c 9042 2010-03-24 00:45:34Z mike $"
|
||||
* Private MD5 implementation for CUPS.
|
||||
*
|
||||
* Private MD5 implementation for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2005 by Easy Software Products
|
||||
* Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 2005 by Easy Software Products
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Copyright (C) 1999 Aladdin Enterprises. All rights reserved.
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
* L. Peter Deutsch
|
||||
* ghost@aladdin.com
|
||||
* L. Peter Deutsch
|
||||
* ghost@aladdin.com
|
||||
*/
|
||||
/*
|
||||
Independent implementation of MD5 (RFC 1321).
|
||||
@ -133,7 +130,8 @@ _cups_md5_process(_cups_md5_state_t *pms, const unsigned char *data /*[64]*/)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 16; ++i, xp += 4)
|
||||
X[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
|
||||
X[i] = (unsigned)xp[0] + ((unsigned)xp[1] << 8) +
|
||||
((unsigned)xp[2] << 16) + ((unsigned)xp[3] << 24);
|
||||
|
||||
#else /* !ARCH_IS_BIG_ENDIAN */
|
||||
|
||||
@ -291,7 +289,7 @@ _cupsMD5Append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes)
|
||||
return;
|
||||
|
||||
/* Update the message length. */
|
||||
pms->count[1] += nbytes >> 29;
|
||||
pms->count[1] += (unsigned)nbytes >> 29;
|
||||
pms->count[0] += nbits;
|
||||
if (pms->count[0] < nbits)
|
||||
pms->count[1]++;
|
||||
@ -300,7 +298,7 @@ _cupsMD5Append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes)
|
||||
if (offset) {
|
||||
int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
|
||||
|
||||
memcpy(pms->buf + offset, p, copy);
|
||||
memcpy(pms->buf + offset, p, (size_t)copy);
|
||||
if (offset + copy < 64)
|
||||
return;
|
||||
p += copy;
|
||||
@ -314,7 +312,7 @@ _cupsMD5Append(_cups_md5_state_t *pms, const unsigned char *data, int nbytes)
|
||||
|
||||
/* Process a final partial block. */
|
||||
if (left)
|
||||
memcpy(pms->buf, p, left);
|
||||
memcpy(pms->buf, p, (size_t)left);
|
||||
}
|
||||
|
||||
void
|
||||
@ -333,14 +331,9 @@ _cupsMD5Finish(_cups_md5_state_t *pms, unsigned char digest[16])
|
||||
for (i = 0; i < 8; ++i)
|
||||
data[i] = (unsigned char)(pms->count[i >> 2] >> ((i & 3) << 3));
|
||||
/* Pad to 56 bytes mod 64. */
|
||||
_cupsMD5Append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
|
||||
_cupsMD5Append(pms, pad, (int)((55 - (pms->count[0] >> 3)) & 63) + 1);
|
||||
/* Append the length. */
|
||||
_cupsMD5Append(pms, data, 8);
|
||||
for (i = 0; i < 16; ++i)
|
||||
digest[i] = (unsigned char)(pms->abcd[i >> 2] >> ((i & 3) << 3));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: md5.c 9042 2010-03-24 00:45:34Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,25 +1,16 @@
|
||||
/*
|
||||
* "$Id: md5passwd.c 6649 2007-07-11 21:46:42Z mike $"
|
||||
* MD5 password support for CUPS.
|
||||
*
|
||||
* MD5 password support for CUPS.
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2010 by Apple Inc.
|
||||
* Copyright 1997-2005 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* httpMD5() - Compute the MD5 sum of the username:group:password.
|
||||
* httpMD5Nonce() - Combine the MD5 sum of the username, group, and password
|
||||
* with the server-supplied nonce value.
|
||||
* httpMD5String() - Convert an MD5 sum to a character string.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -135,8 +126,3 @@ httpMD5String(const unsigned char *sum, /* I - MD5 sum data */
|
||||
|
||||
return (md5);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: md5passwd.c 6649 2007-07-11 21:46:42Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,24 +1,16 @@
|
||||
/*
|
||||
* "$Id: notify.c 7337 2008-02-22 04:44:04Z mike $"
|
||||
* Notification routines for CUPS.
|
||||
*
|
||||
* Notification routines for CUPS.
|
||||
* Copyright 2007-2013 by Apple Inc.
|
||||
* Copyright 2005-2006 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2005-2006 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsNotifySubject() - Return the subject for the given notification
|
||||
* message.
|
||||
* cupsNotifyText() - Return the text for the given notification message.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -33,7 +25,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Subject string or @code NULL@ */
|
||||
@ -83,25 +75,25 @@ cupsNotifySubject(cups_lang_t *lang, /* I - Language data */
|
||||
|
||||
switch (job_state->values[0].integer)
|
||||
{
|
||||
case IPP_JOB_PENDING :
|
||||
case IPP_JSTATE_PENDING :
|
||||
state = _cupsLangString(lang, _("pending"));
|
||||
break;
|
||||
case IPP_JOB_HELD :
|
||||
case IPP_JSTATE_HELD :
|
||||
state = _cupsLangString(lang, _("held"));
|
||||
break;
|
||||
case IPP_JOB_PROCESSING :
|
||||
case IPP_JSTATE_PROCESSING :
|
||||
state = _cupsLangString(lang, _("processing"));
|
||||
break;
|
||||
case IPP_JOB_STOPPED :
|
||||
case IPP_JSTATE_STOPPED :
|
||||
state = _cupsLangString(lang, _("stopped"));
|
||||
break;
|
||||
case IPP_JOB_CANCELED :
|
||||
case IPP_JSTATE_CANCELED :
|
||||
state = _cupsLangString(lang, _("canceled"));
|
||||
break;
|
||||
case IPP_JOB_ABORTED :
|
||||
case IPP_JSTATE_ABORTED :
|
||||
state = _cupsLangString(lang, _("aborted"));
|
||||
break;
|
||||
case IPP_JOB_COMPLETED :
|
||||
case IPP_JSTATE_COMPLETED :
|
||||
state = _cupsLangString(lang, _("completed"));
|
||||
break;
|
||||
default :
|
||||
@ -127,13 +119,13 @@ cupsNotifySubject(cups_lang_t *lang, /* I - Language data */
|
||||
|
||||
switch (printer_state->values[0].integer)
|
||||
{
|
||||
case IPP_PRINTER_IDLE :
|
||||
case IPP_PSTATE_IDLE :
|
||||
state = _cupsLangString(lang, _("idle"));
|
||||
break;
|
||||
case IPP_PRINTER_PROCESSING :
|
||||
case IPP_PSTATE_PROCESSING :
|
||||
state = _cupsLangString(lang, _("processing"));
|
||||
break;
|
||||
case IPP_PRINTER_STOPPED :
|
||||
case IPP_PSTATE_STOPPED :
|
||||
state = _cupsLangString(lang, _("stopped"));
|
||||
break;
|
||||
default :
|
||||
@ -164,7 +156,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/macOS 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Message text or @code NULL@ */
|
||||
@ -195,8 +187,3 @@ cupsNotifyText(cups_lang_t *lang, /* I - Language data */
|
||||
|
||||
return (strdup(notify_text->values[0].string.text));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: notify.c 7337 2008-02-22 04:44:04Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,29 +1,16 @@
|
||||
/*
|
||||
* "$Id: options.c 8181 2008-12-10 17:29:57Z mike $"
|
||||
* Option routines for CUPS.
|
||||
*
|
||||
* Option routines for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsAddOption() - Add an option to an option array.
|
||||
* cupsFreeOptions() - Free all memory used by options.
|
||||
* cupsGetOption() - Get an option value.
|
||||
* cupsParseOptions() - Parse options from a command-line argument.
|
||||
* cupsRemoveOption() - Remove an option from an option array.
|
||||
* _cupsGet1284Values() - Get 1284 device ID keys and values.
|
||||
* cups_compare_options() - Compare two options.
|
||||
* cups_find_option() - Find an option using a binary search.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -60,8 +47,7 @@ cupsAddOption(const char *name, /* I - Name of option */
|
||||
diff; /* Result of search */
|
||||
|
||||
|
||||
DEBUG_printf(("2cupsAddOption(name=\"%s\", value=\"%s\", num_options=%d, "
|
||||
"options=%p)", name, value, num_options, options));
|
||||
DEBUG_printf(("2cupsAddOption(name=\"%s\", value=\"%s\", num_options=%d, options=%p)", name, value, num_options, (void *)options));
|
||||
|
||||
if (!name || !name[0] || !value || !options || num_options < 0)
|
||||
{
|
||||
@ -99,10 +85,9 @@ cupsAddOption(const char *name, /* I - Name of option */
|
||||
if (num_options == 0)
|
||||
temp = (cups_option_t *)malloc(sizeof(cups_option_t));
|
||||
else
|
||||
temp = (cups_option_t *)realloc(*options, sizeof(cups_option_t) *
|
||||
(num_options + 1));
|
||||
temp = (cups_option_t *)realloc(*options, sizeof(cups_option_t) * (size_t)(num_options + 1));
|
||||
|
||||
if (temp == NULL)
|
||||
if (!temp)
|
||||
{
|
||||
DEBUG_puts("3cupsAddOption: Unable to expand option array, returning 0");
|
||||
return (0);
|
||||
@ -114,8 +99,7 @@ cupsAddOption(const char *name, /* I - Name of option */
|
||||
{
|
||||
DEBUG_printf(("4cupsAddOption: Shifting %d options...",
|
||||
(int)(num_options - insert)));
|
||||
memmove(temp + insert + 1, temp + insert,
|
||||
(num_options - insert) * sizeof(cups_option_t));
|
||||
memmove(temp + insert + 1, temp + insert, (size_t)(num_options - insert) * sizeof(cups_option_t));
|
||||
}
|
||||
|
||||
temp += insert;
|
||||
@ -155,8 +139,7 @@ cupsFreeOptions(
|
||||
int i; /* Looping var */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsFreeOptions(num_options=%d, options=%p)", num_options,
|
||||
options));
|
||||
DEBUG_printf(("cupsFreeOptions(num_options=%d, options=%p)", num_options, (void *)options));
|
||||
|
||||
if (num_options <= 0 || !options)
|
||||
return;
|
||||
@ -184,8 +167,7 @@ cupsGetOption(const char *name, /* I - Name of option */
|
||||
match; /* Matching index */
|
||||
|
||||
|
||||
DEBUG_printf(("2cupsGetOption(name=\"%s\", num_options=%d, options=%p)",
|
||||
name, num_options, options));
|
||||
DEBUG_printf(("2cupsGetOption(name=\"%s\", num_options=%d, options=%p)", name, num_options, (void *)options));
|
||||
|
||||
if (!name || num_options <= 0 || !options)
|
||||
{
|
||||
@ -230,8 +212,7 @@ cupsParseOptions(
|
||||
quote; /* Quote character */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsParseOptions(arg=\"%s\", num_options=%d, options=%p)",
|
||||
arg, num_options, options));
|
||||
DEBUG_printf(("cupsParseOptions(arg=\"%s\", num_options=%d, options=%p)", arg, num_options, (void *)options));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -438,7 +419,7 @@ cupsParseOptions(
|
||||
/*
|
||||
* 'cupsRemoveOption()' - Remove an option from an option array.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - New number of options */
|
||||
@ -451,8 +432,7 @@ cupsRemoveOption(
|
||||
cups_option_t *option; /* Current option */
|
||||
|
||||
|
||||
DEBUG_printf(("2cupsRemoveOption(name=\"%s\", num_options=%d, options=%p)",
|
||||
name, num_options, options));
|
||||
DEBUG_printf(("2cupsRemoveOption(name=\"%s\", num_options=%d, options=%p)", name, num_options, (void *)options));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -487,7 +467,7 @@ cupsRemoveOption(
|
||||
_cupsStrFree(option->value);
|
||||
|
||||
if (i > 0)
|
||||
memmove(option, option + 1, i * sizeof(cups_option_t));
|
||||
memmove(option, option + 1, (size_t)i * sizeof(cups_option_t));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -613,9 +593,7 @@ cups_find_option(
|
||||
cups_option_t key; /* Search key */
|
||||
|
||||
|
||||
DEBUG_printf(("7cups_find_option(name=\"%s\", num_options=%d, options=%p, "
|
||||
"prev=%d, rdiff=%p)", name, num_options, options, prev,
|
||||
rdiff));
|
||||
DEBUG_printf(("7cups_find_option(name=\"%s\", num_options=%d, options=%p, prev=%d, rdiff=%p)", name, num_options, (void *)options, prev, (void *)rdiff));
|
||||
|
||||
#ifdef DEBUG
|
||||
for (left = 0; left < num_options; left ++)
|
||||
@ -704,8 +682,3 @@ cups_find_option(
|
||||
|
||||
return (current);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: options.c 8181 2008-12-10 17:29:57Z mike $".
|
||||
*/
|
||||
|
||||
314
cups/ppd-attr.c
Normal file
314
cups/ppd-attr.c
Normal file
@ -0,0 +1,314 @@
|
||||
/*
|
||||
* PPD model-specific attribute routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cups-private.h"
|
||||
#include "ppd-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdFindAttr()' - Find the first matching attribute.
|
||||
*
|
||||
* @since CUPS 1.1.19/macOS 10.3@
|
||||
*/
|
||||
|
||||
ppd_attr_t * /* O - Attribute or @code NULL@ if not found */
|
||||
ppdFindAttr(ppd_file_t *ppd, /* I - PPD file data */
|
||||
const char *name, /* I - Attribute name */
|
||||
const char *spec) /* I - Specifier string or @code NULL@ */
|
||||
{
|
||||
ppd_attr_t key, /* Search key */
|
||||
*attr; /* Current attribute */
|
||||
|
||||
|
||||
DEBUG_printf(("2ppdFindAttr(ppd=%p, name=\"%s\", spec=\"%s\")", ppd, name,
|
||||
spec));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!ppd || !name || ppd->num_attrs == 0)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Search for a matching attribute...
|
||||
*/
|
||||
|
||||
memset(&key, 0, sizeof(key));
|
||||
strlcpy(key.name, name, sizeof(key.name));
|
||||
|
||||
/*
|
||||
* Return the first matching attribute, if any...
|
||||
*/
|
||||
|
||||
if ((attr = (ppd_attr_t *)cupsArrayFind(ppd->sorted_attrs, &key)) != NULL)
|
||||
{
|
||||
if (spec)
|
||||
{
|
||||
/*
|
||||
* Loop until we find the first matching attribute for "spec"...
|
||||
*/
|
||||
|
||||
while (attr && _cups_strcasecmp(spec, attr->spec))
|
||||
{
|
||||
if ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) != NULL &&
|
||||
_cups_strcasecmp(attr->name, name))
|
||||
attr = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (attr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdFindNextAttr()' - Find the next matching attribute.
|
||||
*
|
||||
* @since CUPS 1.1.19/macOS 10.3@
|
||||
*/
|
||||
|
||||
ppd_attr_t * /* O - Attribute or @code NULL@ if not found */
|
||||
ppdFindNextAttr(ppd_file_t *ppd, /* I - PPD file data */
|
||||
const char *name, /* I - Attribute name */
|
||||
const char *spec) /* I - Specifier string or @code NULL@ */
|
||||
{
|
||||
ppd_attr_t *attr; /* Current attribute */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!ppd || !name || ppd->num_attrs == 0)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* See if there are more attributes to return...
|
||||
*/
|
||||
|
||||
while ((attr = (ppd_attr_t *)cupsArrayNext(ppd->sorted_attrs)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Check the next attribute to see if it is a match...
|
||||
*/
|
||||
|
||||
if (_cups_strcasecmp(attr->name, name))
|
||||
{
|
||||
/*
|
||||
* Nope, reset the current pointer to the end of the array...
|
||||
*/
|
||||
|
||||
cupsArrayIndex(ppd->sorted_attrs, cupsArrayCount(ppd->sorted_attrs));
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (!spec || !_cups_strcasecmp(attr->spec, spec))
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the next attribute's value...
|
||||
*/
|
||||
|
||||
return (attr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_ppdNormalizeMakeAndModel()' - Normalize a product/make-and-model string.
|
||||
*
|
||||
* This function tries to undo the mistakes made by many printer manufacturers
|
||||
* to produce a clean make-and-model string we can use.
|
||||
*/
|
||||
|
||||
char * /* O - Normalized make-and-model string or NULL on error */
|
||||
_ppdNormalizeMakeAndModel(
|
||||
const char *make_and_model, /* I - Original make-and-model string */
|
||||
char *buffer, /* I - String buffer */
|
||||
size_t bufsize) /* I - Size of string buffer */
|
||||
{
|
||||
char *bufptr; /* Pointer into buffer */
|
||||
|
||||
|
||||
if (!make_and_model || !buffer || bufsize < 1)
|
||||
{
|
||||
if (buffer)
|
||||
*buffer = '\0';
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (_cups_isspace(*make_and_model))
|
||||
make_and_model ++;
|
||||
|
||||
/*
|
||||
* Remove parenthesis and add manufacturers as needed...
|
||||
*/
|
||||
|
||||
if (make_and_model[0] == '(')
|
||||
{
|
||||
strlcpy(buffer, make_and_model + 1, bufsize);
|
||||
|
||||
if ((bufptr = strrchr(buffer, ')')) != NULL)
|
||||
*bufptr = '\0';
|
||||
}
|
||||
else if (!_cups_strncasecmp(make_and_model, "XPrint", 6))
|
||||
{
|
||||
/*
|
||||
* Xerox XPrint...
|
||||
*/
|
||||
|
||||
snprintf(buffer, bufsize, "Xerox %s", make_and_model);
|
||||
}
|
||||
else if (!_cups_strncasecmp(make_and_model, "Eastman", 7))
|
||||
{
|
||||
/*
|
||||
* Kodak...
|
||||
*/
|
||||
|
||||
snprintf(buffer, bufsize, "Kodak %s", make_and_model + 7);
|
||||
}
|
||||
else if (!_cups_strncasecmp(make_and_model, "laserwriter", 11))
|
||||
{
|
||||
/*
|
||||
* Apple LaserWriter...
|
||||
*/
|
||||
|
||||
snprintf(buffer, bufsize, "Apple LaserWriter%s", make_and_model + 11);
|
||||
}
|
||||
else if (!_cups_strncasecmp(make_and_model, "colorpoint", 10))
|
||||
{
|
||||
/*
|
||||
* Seiko...
|
||||
*/
|
||||
|
||||
snprintf(buffer, bufsize, "Seiko %s", make_and_model);
|
||||
}
|
||||
else if (!_cups_strncasecmp(make_and_model, "fiery", 5))
|
||||
{
|
||||
/*
|
||||
* EFI...
|
||||
*/
|
||||
|
||||
snprintf(buffer, bufsize, "EFI %s", make_and_model);
|
||||
}
|
||||
else if (!_cups_strncasecmp(make_and_model, "ps ", 3) ||
|
||||
!_cups_strncasecmp(make_and_model, "colorpass", 9))
|
||||
{
|
||||
/*
|
||||
* Canon...
|
||||
*/
|
||||
|
||||
snprintf(buffer, bufsize, "Canon %s", make_and_model);
|
||||
}
|
||||
else if (!_cups_strncasecmp(make_and_model, "designjet", 9) ||
|
||||
!_cups_strncasecmp(make_and_model, "deskjet", 7))
|
||||
{
|
||||
/*
|
||||
* HP...
|
||||
*/
|
||||
|
||||
snprintf(buffer, bufsize, "HP %s", make_and_model);
|
||||
}
|
||||
else
|
||||
strlcpy(buffer, make_and_model, bufsize);
|
||||
|
||||
/*
|
||||
* Clean up the make...
|
||||
*/
|
||||
|
||||
if (!_cups_strncasecmp(buffer, "agfa", 4))
|
||||
{
|
||||
/*
|
||||
* Replace with AGFA (all uppercase)...
|
||||
*/
|
||||
|
||||
buffer[0] = 'A';
|
||||
buffer[1] = 'G';
|
||||
buffer[2] = 'F';
|
||||
buffer[3] = 'A';
|
||||
}
|
||||
else if (!_cups_strncasecmp(buffer, "Hewlett-Packard hp ", 19))
|
||||
{
|
||||
/*
|
||||
* Just put "HP" on the front...
|
||||
*/
|
||||
|
||||
buffer[0] = 'H';
|
||||
buffer[1] = 'P';
|
||||
_cups_strcpy(buffer + 2, buffer + 18);
|
||||
}
|
||||
else if (!_cups_strncasecmp(buffer, "Hewlett-Packard ", 16))
|
||||
{
|
||||
/*
|
||||
* Just put "HP" on the front...
|
||||
*/
|
||||
|
||||
buffer[0] = 'H';
|
||||
buffer[1] = 'P';
|
||||
_cups_strcpy(buffer + 2, buffer + 15);
|
||||
}
|
||||
else if (!_cups_strncasecmp(buffer, "Lexmark International", 21))
|
||||
{
|
||||
/*
|
||||
* Strip "International"...
|
||||
*/
|
||||
|
||||
_cups_strcpy(buffer + 8, buffer + 21);
|
||||
}
|
||||
else if (!_cups_strncasecmp(buffer, "herk", 4))
|
||||
{
|
||||
/*
|
||||
* Replace with LHAG...
|
||||
*/
|
||||
|
||||
buffer[0] = 'L';
|
||||
buffer[1] = 'H';
|
||||
buffer[2] = 'A';
|
||||
buffer[3] = 'G';
|
||||
}
|
||||
else if (!_cups_strncasecmp(buffer, "linotype", 8))
|
||||
{
|
||||
/*
|
||||
* Replace with LHAG...
|
||||
*/
|
||||
|
||||
buffer[0] = 'L';
|
||||
buffer[1] = 'H';
|
||||
buffer[2] = 'A';
|
||||
buffer[3] = 'G';
|
||||
_cups_strcpy(buffer + 4, buffer + 8);
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove trailing whitespace and return...
|
||||
*/
|
||||
|
||||
for (bufptr = buffer + strlen(buffer) - 1;
|
||||
bufptr >= buffer && _cups_isspace(*bufptr);
|
||||
bufptr --);
|
||||
|
||||
bufptr[1] = '\0';
|
||||
|
||||
return (buffer[0] ? buffer : NULL);
|
||||
}
|
||||
1803
cups/ppd-cache.c
1803
cups/ppd-cache.c
File diff suppressed because it is too large
Load Diff
1193
cups/ppd-conflicts.c
Normal file
1193
cups/ppd-conflicts.c
Normal file
File diff suppressed because it is too large
Load Diff
109
cups/ppd-custom.c
Normal file
109
cups/ppd-custom.c
Normal file
@ -0,0 +1,109 @@
|
||||
/*
|
||||
* PPD custom option routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
*
|
||||
* This code and any derivative of it may be used and distributed
|
||||
* freely under the terms of the GNU General Public License when
|
||||
* used with GNU Ghostscript or its derivatives. Use of the code
|
||||
* (or any derivative of it) with software other than GNU
|
||||
* GhostScript (or its derivatives) is governed by the CUPS license
|
||||
* agreement.
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include "cups-private.h"
|
||||
#include "ppd-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdFindCustomOption()' - Find a custom option.
|
||||
*
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
ppd_coption_t * /* O - Custom option or NULL */
|
||||
ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *keyword)/* I - Custom option name */
|
||||
{
|
||||
ppd_coption_t key; /* Custom option search key */
|
||||
|
||||
|
||||
if (!ppd)
|
||||
return (NULL);
|
||||
|
||||
strlcpy(key.keyword, keyword, sizeof(key.keyword));
|
||||
return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdFindCustomParam()' - Find a parameter for a custom option.
|
||||
*
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
ppd_cparam_t * /* O - Custom parameter or NULL */
|
||||
ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */
|
||||
const char *name) /* I - Parameter name */
|
||||
{
|
||||
ppd_cparam_t *param; /* Current custom parameter */
|
||||
|
||||
|
||||
if (!opt)
|
||||
return (NULL);
|
||||
|
||||
for (param = (ppd_cparam_t *)cupsArrayFirst(opt->params);
|
||||
param;
|
||||
param = (ppd_cparam_t *)cupsArrayNext(opt->params))
|
||||
if (!_cups_strcasecmp(param->name, name))
|
||||
break;
|
||||
|
||||
return (param);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
|
||||
*
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
ppd_cparam_t * /* O - Custom parameter or NULL */
|
||||
ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */
|
||||
{
|
||||
if (!opt)
|
||||
return (NULL);
|
||||
|
||||
return ((ppd_cparam_t *)cupsArrayFirst(opt->params));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdNextCustomParam()' - Return the next parameter for a custom option.
|
||||
*
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
ppd_cparam_t * /* O - Custom parameter or NULL */
|
||||
ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */
|
||||
{
|
||||
if (!opt)
|
||||
return (NULL);
|
||||
|
||||
return ((ppd_cparam_t *)cupsArrayNext(opt->params));
|
||||
}
|
||||
1200
cups/ppd-emit.c
Normal file
1200
cups/ppd-emit.c
Normal file
File diff suppressed because it is too large
Load Diff
783
cups/ppd-localize.c
Normal file
783
cups/ppd-localize.c
Normal file
@ -0,0 +1,783 @@
|
||||
/*
|
||||
* PPD localization routines for CUPS.
|
||||
*
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
*
|
||||
* This code and any derivative of it may be used and distributed
|
||||
* freely under the terms of the GNU General Public License when
|
||||
* used with GNU Ghostscript or its derivatives. Use of the code
|
||||
* (or any derivative of it) with software other than GNU
|
||||
* GhostScript (or its derivatives) is governed by the CUPS license
|
||||
* agreement.
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers.
|
||||
*/
|
||||
|
||||
#include "cups-private.h"
|
||||
#include "ppd-private.h"
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static cups_lang_t *ppd_ll_CC(char *ll_CC, size_t ll_CC_size);
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdLocalize()' - Localize the PPD file to the current locale.
|
||||
*
|
||||
* All groups, options, and choices are localized, as are ICC profile
|
||||
* descriptions, printer presets, and custom option parameters. Each
|
||||
* localized string uses the UTF-8 character encoding.
|
||||
*
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
ppdLocalize(ppd_file_t *ppd) /* I - PPD file */
|
||||
{
|
||||
int i, j, k; /* Looping vars */
|
||||
ppd_group_t *group; /* Current group */
|
||||
ppd_option_t *option; /* Current option */
|
||||
ppd_choice_t *choice; /* Current choice */
|
||||
ppd_coption_t *coption; /* Current custom option */
|
||||
ppd_cparam_t *cparam; /* Current custom parameter */
|
||||
ppd_attr_t *attr, /* Current attribute */
|
||||
*locattr; /* Localized attribute */
|
||||
char ckeyword[PPD_MAX_NAME], /* Custom keyword */
|
||||
ll_CC[6]; /* Language + country locale */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("ppdLocalize(ppd=%p)", ppd));
|
||||
|
||||
if (!ppd)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Get the default language...
|
||||
*/
|
||||
|
||||
ppd_ll_CC(ll_CC, sizeof(ll_CC));
|
||||
|
||||
/*
|
||||
* Now lookup all of the groups, options, choices, etc.
|
||||
*/
|
||||
|
||||
for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++)
|
||||
{
|
||||
if ((locattr = _ppdLocalizedAttr(ppd, "Translation", group->name,
|
||||
ll_CC)) != NULL)
|
||||
strlcpy(group->text, locattr->text, sizeof(group->text));
|
||||
|
||||
for (j = group->num_options, option = group->options; j > 0; j --, option ++)
|
||||
{
|
||||
if ((locattr = _ppdLocalizedAttr(ppd, "Translation", option->keyword,
|
||||
ll_CC)) != NULL)
|
||||
strlcpy(option->text, locattr->text, sizeof(option->text));
|
||||
|
||||
for (k = option->num_choices, choice = option->choices;
|
||||
k > 0;
|
||||
k --, choice ++)
|
||||
{
|
||||
if (strcmp(choice->choice, "Custom") ||
|
||||
!ppdFindCustomOption(ppd, option->keyword))
|
||||
locattr = _ppdLocalizedAttr(ppd, option->keyword, choice->choice,
|
||||
ll_CC);
|
||||
else
|
||||
{
|
||||
snprintf(ckeyword, sizeof(ckeyword), "Custom%s", option->keyword);
|
||||
|
||||
locattr = _ppdLocalizedAttr(ppd, ckeyword, "True", ll_CC);
|
||||
}
|
||||
|
||||
if (locattr)
|
||||
strlcpy(choice->text, locattr->text, sizeof(choice->text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate any custom parameters...
|
||||
*/
|
||||
|
||||
for (coption = (ppd_coption_t *)cupsArrayFirst(ppd->coptions);
|
||||
coption;
|
||||
coption = (ppd_coption_t *)cupsArrayNext(ppd->coptions))
|
||||
{
|
||||
for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params);
|
||||
cparam;
|
||||
cparam = (ppd_cparam_t *)cupsArrayNext(coption->params))
|
||||
{
|
||||
snprintf(ckeyword, sizeof(ckeyword), "ParamCustom%s", coption->keyword);
|
||||
|
||||
if ((locattr = _ppdLocalizedAttr(ppd, ckeyword, cparam->name,
|
||||
ll_CC)) != NULL)
|
||||
strlcpy(cparam->text, locattr->text, sizeof(cparam->text));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate ICC profile names...
|
||||
*/
|
||||
|
||||
if ((attr = ppdFindAttr(ppd, "APCustomColorMatchingName", NULL)) != NULL)
|
||||
{
|
||||
if ((locattr = _ppdLocalizedAttr(ppd, "APCustomColorMatchingName",
|
||||
attr->spec, ll_CC)) != NULL)
|
||||
strlcpy(attr->text, locattr->text, sizeof(attr->text));
|
||||
}
|
||||
|
||||
for (attr = ppdFindAttr(ppd, "cupsICCProfile", NULL);
|
||||
attr;
|
||||
attr = ppdFindNextAttr(ppd, "cupsICCProfile", NULL))
|
||||
{
|
||||
cupsArraySave(ppd->sorted_attrs);
|
||||
|
||||
if ((locattr = _ppdLocalizedAttr(ppd, "cupsICCProfile", attr->spec,
|
||||
ll_CC)) != NULL)
|
||||
strlcpy(attr->text, locattr->text, sizeof(attr->text));
|
||||
|
||||
cupsArrayRestore(ppd->sorted_attrs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Translate printer presets...
|
||||
*/
|
||||
|
||||
for (attr = ppdFindAttr(ppd, "APPrinterPreset", NULL);
|
||||
attr;
|
||||
attr = ppdFindNextAttr(ppd, "APPrinterPreset", NULL))
|
||||
{
|
||||
cupsArraySave(ppd->sorted_attrs);
|
||||
|
||||
if ((locattr = _ppdLocalizedAttr(ppd, "APPrinterPreset", attr->spec,
|
||||
ll_CC)) != NULL)
|
||||
strlcpy(attr->text, locattr->text, sizeof(attr->text));
|
||||
|
||||
cupsArrayRestore(ppd->sorted_attrs);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdLocalizeAttr()' - Localize an attribute.
|
||||
*
|
||||
* This function uses the current locale to find the localized attribute for
|
||||
* the given main and option keywords. If no localized version of the
|
||||
* attribute exists for the current locale, the unlocalized version is returned.
|
||||
*/
|
||||
|
||||
ppd_attr_t * /* O - Localized attribute or @code NULL@ if none exists */
|
||||
ppdLocalizeAttr(ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *keyword, /* I - Main keyword */
|
||||
const char *spec) /* I - Option keyword or @code NULL@ for none */
|
||||
{
|
||||
ppd_attr_t *locattr; /* Localized attribute */
|
||||
char ll_CC[6]; /* Language + country locale */
|
||||
|
||||
|
||||
/*
|
||||
* Get the default language...
|
||||
*/
|
||||
|
||||
ppd_ll_CC(ll_CC, sizeof(ll_CC));
|
||||
|
||||
/*
|
||||
* Find the localized attribute...
|
||||
*/
|
||||
|
||||
if (spec)
|
||||
locattr = _ppdLocalizedAttr(ppd, keyword, spec, ll_CC);
|
||||
else
|
||||
locattr = _ppdLocalizedAttr(ppd, "Translation", keyword, ll_CC);
|
||||
|
||||
if (!locattr)
|
||||
locattr = ppdFindAttr(ppd, keyword, spec);
|
||||
|
||||
return (locattr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdLocalizeIPPReason()' - Get the localized version of a cupsIPPReason
|
||||
* attribute.
|
||||
*
|
||||
* This function uses the current locale to find the corresponding reason
|
||||
* text or URI from the attribute value. If "scheme" is NULL or "text",
|
||||
* the returned value contains human-readable (UTF-8) text from the translation
|
||||
* string or attribute value. Otherwise the corresponding URI is returned.
|
||||
*
|
||||
* If no value of the requested scheme can be found, NULL is returned.
|
||||
*
|
||||
* @since CUPS 1.3/macOS 10.5@
|
||||
*/
|
||||
|
||||
const char * /* O - Value or NULL if not found */
|
||||
ppdLocalizeIPPReason(
|
||||
ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *reason, /* I - IPP reason keyword to look up */
|
||||
const char *scheme, /* I - URI scheme or NULL for text */
|
||||
char *buffer, /* I - Value buffer */
|
||||
size_t bufsize) /* I - Size of value buffer */
|
||||
{
|
||||
cups_lang_t *lang; /* Current language */
|
||||
ppd_attr_t *locattr; /* Localized attribute */
|
||||
char ll_CC[6], /* Language + country locale */
|
||||
*bufptr, /* Pointer into buffer */
|
||||
*bufend, /* Pointer to end of buffer */
|
||||
*valptr; /* Pointer into value */
|
||||
int ch; /* Hex-encoded character */
|
||||
size_t schemelen; /* Length of scheme name */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (buffer)
|
||||
*buffer = '\0';
|
||||
|
||||
if (!ppd || !reason || (scheme && !*scheme) ||
|
||||
!buffer || bufsize < PPD_MAX_TEXT)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Get the default language...
|
||||
*/
|
||||
|
||||
lang = ppd_ll_CC(ll_CC, sizeof(ll_CC));
|
||||
|
||||
/*
|
||||
* Find the localized attribute...
|
||||
*/
|
||||
|
||||
if ((locattr = _ppdLocalizedAttr(ppd, "cupsIPPReason", reason,
|
||||
ll_CC)) == NULL)
|
||||
locattr = ppdFindAttr(ppd, "cupsIPPReason", reason);
|
||||
|
||||
if (!locattr)
|
||||
{
|
||||
if (lang && (!scheme || !strcmp(scheme, "text")))
|
||||
{
|
||||
/*
|
||||
* Try to localize a standard printer-state-reason keyword...
|
||||
*/
|
||||
|
||||
const char *message = NULL; /* Localized message */
|
||||
|
||||
if (!strncmp(reason, "media-needed", 12))
|
||||
message = _("Load paper.");
|
||||
else if (!strncmp(reason, "media-jam", 9))
|
||||
message = _("Paper jam.");
|
||||
else if (!strncmp(reason, "offline", 7) ||
|
||||
!strncmp(reason, "shutdown", 8))
|
||||
message = _("The printer is not connected.");
|
||||
else if (!strncmp(reason, "toner-low", 9))
|
||||
message = _("The printer is low on toner.");
|
||||
else if (!strncmp(reason, "toner-empty", 11))
|
||||
message = _("The printer may be out of toner.");
|
||||
else if (!strncmp(reason, "cover-open", 10))
|
||||
message = _("The printer's cover is open.");
|
||||
else if (!strncmp(reason, "interlock-open", 14))
|
||||
message = _("The printer's interlock is open.");
|
||||
else if (!strncmp(reason, "door-open", 9))
|
||||
message = _("The printer's door is open.");
|
||||
else if (!strncmp(reason, "input-tray-missing", 18))
|
||||
message = _("Paper tray is missing.");
|
||||
else if (!strncmp(reason, "media-low", 9))
|
||||
message = _("Paper tray is almost empty.");
|
||||
else if (!strncmp(reason, "media-empty", 11))
|
||||
message = _("Paper tray is empty.");
|
||||
else if (!strncmp(reason, "output-tray-missing", 19))
|
||||
message = _("Output bin is missing.");
|
||||
else if (!strncmp(reason, "output-area-almost-full", 23))
|
||||
message = _("Output bin is almost full.");
|
||||
else if (!strncmp(reason, "output-area-full", 16))
|
||||
message = _("Output bin is full.");
|
||||
else if (!strncmp(reason, "marker-supply-low", 17))
|
||||
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))
|
||||
message = _("The printer's waste bin is almost full.");
|
||||
else if (!strncmp(reason, "marker-waste-full", 17))
|
||||
message = _("The printer's waste bin is full.");
|
||||
else if (!strncmp(reason, "fuser-over-temp", 15))
|
||||
message = _("The fuser's temperature is high.");
|
||||
else if (!strncmp(reason, "fuser-under-temp", 16))
|
||||
message = _("The fuser's temperature is low.");
|
||||
else if (!strncmp(reason, "opc-near-eol", 12))
|
||||
message = _("The optical photoconductor will need to be replaced soon.");
|
||||
else if (!strncmp(reason, "opc-life-over", 13))
|
||||
message = _("The optical photoconductor needs to be replaced.");
|
||||
else if (!strncmp(reason, "developer-low", 13))
|
||||
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);
|
||||
return (buffer);
|
||||
}
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now find the value we need...
|
||||
*/
|
||||
|
||||
bufend = buffer + bufsize - 1;
|
||||
|
||||
if (!scheme || !strcmp(scheme, "text"))
|
||||
{
|
||||
/*
|
||||
* Copy a text value (either the translation text or text:... URIs from
|
||||
* the value...
|
||||
*/
|
||||
|
||||
strlcpy(buffer, locattr->text, bufsize);
|
||||
|
||||
for (valptr = locattr->value, bufptr = buffer; *valptr && bufptr < bufend;)
|
||||
{
|
||||
if (!strncmp(valptr, "text:", 5))
|
||||
{
|
||||
/*
|
||||
* Decode text: URI and add to the buffer...
|
||||
*/
|
||||
|
||||
valptr += 5;
|
||||
|
||||
while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
|
||||
{
|
||||
if (*valptr == '%' && isxdigit(valptr[1] & 255) &&
|
||||
isxdigit(valptr[2] & 255))
|
||||
{
|
||||
/*
|
||||
* Pull a hex-encoded character from the URI...
|
||||
*/
|
||||
|
||||
valptr ++;
|
||||
|
||||
if (isdigit(*valptr & 255))
|
||||
ch = (*valptr - '0') << 4;
|
||||
else
|
||||
ch = (tolower(*valptr) - 'a' + 10) << 4;
|
||||
valptr ++;
|
||||
|
||||
if (isdigit(*valptr & 255))
|
||||
*bufptr++ = (char)(ch | (*valptr - '0'));
|
||||
else
|
||||
*bufptr++ = (char)(ch | (tolower(*valptr) - 'a' + 10));
|
||||
valptr ++;
|
||||
}
|
||||
else if (*valptr == '+')
|
||||
{
|
||||
*bufptr++ = ' ';
|
||||
valptr ++;
|
||||
}
|
||||
else
|
||||
*bufptr++ = *valptr++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Skip this URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !_cups_isspace(*valptr))
|
||||
valptr++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip whitespace...
|
||||
*/
|
||||
|
||||
while (_cups_isspace(*valptr))
|
||||
valptr ++;
|
||||
}
|
||||
|
||||
if (bufptr > buffer)
|
||||
*bufptr = '\0';
|
||||
|
||||
return (buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Copy a URI...
|
||||
*/
|
||||
|
||||
schemelen = strlen(scheme);
|
||||
if (scheme[schemelen - 1] == ':') /* Force scheme to be just the name */
|
||||
schemelen --;
|
||||
|
||||
for (valptr = locattr->value, bufptr = buffer; *valptr && bufptr < bufend;)
|
||||
{
|
||||
if ((!strncmp(valptr, scheme, schemelen) && valptr[schemelen] == ':') ||
|
||||
(*valptr == '/' && !strcmp(scheme, "file")))
|
||||
{
|
||||
/*
|
||||
* Copy URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !_cups_isspace(*valptr) && bufptr < bufend)
|
||||
*bufptr++ = *valptr++;
|
||||
|
||||
*bufptr = '\0';
|
||||
|
||||
return (buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Skip this URI...
|
||||
*/
|
||||
|
||||
while (*valptr && !_cups_isspace(*valptr))
|
||||
valptr++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip whitespace...
|
||||
*/
|
||||
|
||||
while (_cups_isspace(*valptr))
|
||||
valptr ++;
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdLocalizeMarkerName()' - Get the localized version of a marker-names
|
||||
* attribute value.
|
||||
*
|
||||
* This function uses the current locale to find the corresponding name
|
||||
* text from the attribute value. If no localized text for the requested
|
||||
* name can be found, @code NULL@ is returned.
|
||||
*
|
||||
* @since CUPS 1.4/macOS 10.6@
|
||||
*/
|
||||
|
||||
const char * /* O - Value or @code NULL@ if not found */
|
||||
ppdLocalizeMarkerName(
|
||||
ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *name) /* I - Marker name to look up */
|
||||
{
|
||||
ppd_attr_t *locattr; /* Localized attribute */
|
||||
char ll_CC[6]; /* Language + country locale */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!ppd || !name)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Get the default language...
|
||||
*/
|
||||
|
||||
ppd_ll_CC(ll_CC, sizeof(ll_CC));
|
||||
|
||||
/*
|
||||
* Find the localized attribute...
|
||||
*/
|
||||
|
||||
if ((locattr = _ppdLocalizedAttr(ppd, "cupsMarkerName", name,
|
||||
ll_CC)) == NULL)
|
||||
locattr = ppdFindAttr(ppd, "cupsMarkerName", name);
|
||||
|
||||
return (locattr ? locattr->text : NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_ppdFreeLanguages()' - Free an array of languages from _ppdGetLanguages.
|
||||
*/
|
||||
|
||||
void
|
||||
_ppdFreeLanguages(
|
||||
cups_array_t *languages) /* I - Languages array */
|
||||
{
|
||||
char *language; /* Current language */
|
||||
|
||||
|
||||
for (language = (char *)cupsArrayFirst(languages);
|
||||
language;
|
||||
language = (char *)cupsArrayNext(languages))
|
||||
free(language);
|
||||
|
||||
cupsArrayDelete(languages);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_ppdGetLanguages()' - Get an array of languages from a PPD file.
|
||||
*/
|
||||
|
||||
cups_array_t * /* O - Languages array */
|
||||
_ppdGetLanguages(ppd_file_t *ppd) /* I - PPD file */
|
||||
{
|
||||
cups_array_t *languages; /* Languages array */
|
||||
ppd_attr_t *attr; /* cupsLanguages attribute */
|
||||
char *value, /* Copy of attribute value */
|
||||
*start, /* Start of current language */
|
||||
*ptr; /* Pointer into languages */
|
||||
|
||||
|
||||
/*
|
||||
* See if we have a cupsLanguages attribute...
|
||||
*/
|
||||
|
||||
if ((attr = ppdFindAttr(ppd, "cupsLanguages", NULL)) == NULL || !attr->value)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Yes, load the list...
|
||||
*/
|
||||
|
||||
if ((languages = cupsArrayNew((cups_array_func_t)strcmp, NULL)) == NULL)
|
||||
return (NULL);
|
||||
|
||||
if ((value = strdup(attr->value)) == NULL)
|
||||
{
|
||||
cupsArrayDelete(languages);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
for (ptr = value; *ptr;)
|
||||
{
|
||||
/*
|
||||
* Skip leading whitespace...
|
||||
*/
|
||||
|
||||
while (_cups_isspace(*ptr))
|
||||
ptr ++;
|
||||
|
||||
if (!*ptr)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Find the end of this language name...
|
||||
*/
|
||||
|
||||
for (start = ptr; *ptr && !_cups_isspace(*ptr); ptr ++);
|
||||
|
||||
if (*ptr)
|
||||
*ptr++ = '\0';
|
||||
|
||||
if (!strcmp(start, "en"))
|
||||
continue;
|
||||
|
||||
cupsArrayAdd(languages, strdup(start));
|
||||
}
|
||||
|
||||
/*
|
||||
* Free the temporary string and return either an array with one or more
|
||||
* values or a NULL pointer...
|
||||
*/
|
||||
|
||||
free(value);
|
||||
|
||||
if (cupsArrayCount(languages) == 0)
|
||||
{
|
||||
cupsArrayDelete(languages);
|
||||
return (NULL);
|
||||
}
|
||||
else
|
||||
return (languages);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_ppdHashName()' - Generate a hash value for a device or profile name.
|
||||
*
|
||||
* This function is primarily used on macOS, but is generally accessible
|
||||
* since cupstestppd needs to check for profile name collisions in PPD files...
|
||||
*/
|
||||
|
||||
unsigned /* O - Hash value */
|
||||
_ppdHashName(const char *name) /* I - Name to hash */
|
||||
{
|
||||
unsigned mult, /* Multiplier */
|
||||
hash = 0; /* Hash value */
|
||||
|
||||
|
||||
for (mult = 1; *name && mult <= 128; mult ++, name ++)
|
||||
hash += (*name & 255) * mult;
|
||||
|
||||
return (hash);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* '_ppdLocalizedAttr()' - Find a localized attribute.
|
||||
*/
|
||||
|
||||
ppd_attr_t * /* O - Localized attribute or NULL */
|
||||
_ppdLocalizedAttr(ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *keyword, /* I - Main keyword */
|
||||
const char *spec, /* I - Option keyword */
|
||||
const char *ll_CC) /* I - Language + country locale */
|
||||
{
|
||||
char lkeyword[PPD_MAX_NAME]; /* Localization keyword */
|
||||
ppd_attr_t *attr; /* Current attribute */
|
||||
|
||||
|
||||
DEBUG_printf(("4_ppdLocalizedAttr(ppd=%p, keyword=\"%s\", spec=\"%s\", "
|
||||
"ll_CC=\"%s\")", ppd, keyword, spec, ll_CC));
|
||||
|
||||
/*
|
||||
* Look for Keyword.ll_CC, then Keyword.ll...
|
||||
*/
|
||||
|
||||
snprintf(lkeyword, sizeof(lkeyword), "%s.%s", ll_CC, keyword);
|
||||
if ((attr = ppdFindAttr(ppd, lkeyword, spec)) == NULL)
|
||||
{
|
||||
/*
|
||||
* <rdar://problem/22130168>
|
||||
*
|
||||
* Hong Kong locale needs special handling... Sigh...
|
||||
*/
|
||||
|
||||
if (!strcmp(ll_CC, "zh_HK"))
|
||||
{
|
||||
snprintf(lkeyword, sizeof(lkeyword), "zh_TW.%s", keyword);
|
||||
attr = ppdFindAttr(ppd, lkeyword, spec);
|
||||
}
|
||||
|
||||
if (!attr)
|
||||
{
|
||||
snprintf(lkeyword, sizeof(lkeyword), "%2.2s.%s", ll_CC, keyword);
|
||||
attr = ppdFindAttr(ppd, lkeyword, spec);
|
||||
}
|
||||
|
||||
if (!attr)
|
||||
{
|
||||
if (!strncmp(ll_CC, "ja", 2))
|
||||
{
|
||||
/*
|
||||
* Due to a bug in the CUPS DDK 1.1.0 ppdmerge program, Japanese
|
||||
* PPD files were incorrectly assigned "jp" as the locale name
|
||||
* instead of "ja". Support both the old (incorrect) and new
|
||||
* locale names for Japanese...
|
||||
*/
|
||||
|
||||
snprintf(lkeyword, sizeof(lkeyword), "jp.%s", keyword);
|
||||
attr = ppdFindAttr(ppd, lkeyword, spec);
|
||||
}
|
||||
else if (!strncmp(ll_CC, "nb", 2))
|
||||
{
|
||||
/*
|
||||
* Norway has two languages, "Bokmal" (the primary one)
|
||||
* and "Nynorsk" (new Norwegian); this code maps from the (currently)
|
||||
* recommended "nb" to the previously recommended "no"...
|
||||
*/
|
||||
|
||||
snprintf(lkeyword, sizeof(lkeyword), "no.%s", keyword);
|
||||
attr = ppdFindAttr(ppd, lkeyword, spec);
|
||||
}
|
||||
else if (!strncmp(ll_CC, "no", 2))
|
||||
{
|
||||
/*
|
||||
* Norway has two languages, "Bokmal" (the primary one)
|
||||
* and "Nynorsk" (new Norwegian); we map "no" to "nb" here as
|
||||
* recommended by the locale folks...
|
||||
*/
|
||||
|
||||
snprintf(lkeyword, sizeof(lkeyword), "nb.%s", keyword);
|
||||
attr = ppdFindAttr(ppd, lkeyword, spec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
if (attr)
|
||||
DEBUG_printf(("5_ppdLocalizedAttr: *%s %s/%s: \"%s\"\n", attr->name,
|
||||
attr->spec, attr->text, attr->value ? attr->value : ""));
|
||||
else
|
||||
DEBUG_puts("5_ppdLocalizedAttr: NOT FOUND");
|
||||
#endif /* DEBUG */
|
||||
|
||||
return (attr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppd_ll_CC()' - Get the current locale names.
|
||||
*/
|
||||
|
||||
static cups_lang_t * /* O - Current language */
|
||||
ppd_ll_CC(char *ll_CC, /* O - Country-specific locale name */
|
||||
size_t ll_CC_size) /* I - Size of country-specific name */
|
||||
{
|
||||
cups_lang_t *lang; /* Current language */
|
||||
|
||||
|
||||
/*
|
||||
* Get the current locale...
|
||||
*/
|
||||
|
||||
if ((lang = cupsLangDefault()) == NULL)
|
||||
{
|
||||
strlcpy(ll_CC, "en_US", ll_CC_size);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Copy the locale name...
|
||||
*/
|
||||
|
||||
strlcpy(ll_CC, lang->language, ll_CC_size);
|
||||
|
||||
if (strlen(ll_CC) == 2)
|
||||
{
|
||||
/*
|
||||
* Map "ll" to primary/origin country locales to have the best
|
||||
* chance of finding a match...
|
||||
*/
|
||||
|
||||
if (!strcmp(ll_CC, "cs"))
|
||||
strlcpy(ll_CC, "cs_CZ", ll_CC_size);
|
||||
else if (!strcmp(ll_CC, "en"))
|
||||
strlcpy(ll_CC, "en_US", ll_CC_size);
|
||||
else if (!strcmp(ll_CC, "ja"))
|
||||
strlcpy(ll_CC, "ja_JP", ll_CC_size);
|
||||
else if (!strcmp(ll_CC, "sv"))
|
||||
strlcpy(ll_CC, "sv_SE", ll_CC_size);
|
||||
else if (!strcmp(ll_CC, "zh")) /* Simplified Chinese */
|
||||
strlcpy(ll_CC, "zh_CN", ll_CC_size);
|
||||
}
|
||||
|
||||
DEBUG_printf(("8ppd_ll_CC: lang->language=\"%s\", ll_CC=\"%s\"...",
|
||||
lang->language, ll_CC));
|
||||
return (lang);
|
||||
}
|
||||
1082
cups/ppd-mark.c
Normal file
1082
cups/ppd-mark.c
Normal file
File diff suppressed because it is too large
Load Diff
382
cups/ppd-page.c
Normal file
382
cups/ppd-page.c
Normal file
@ -0,0 +1,382 @@
|
||||
/*
|
||||
* Page size functions for CUPS.
|
||||
*
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "string-private.h"
|
||||
#include "debug-private.h"
|
||||
#include "ppd.h"
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdPageSize()' - Get the page size record for the named size.
|
||||
*/
|
||||
|
||||
ppd_size_t * /* O - Size record for page or NULL */
|
||||
ppdPageSize(ppd_file_t *ppd, /* I - PPD file record */
|
||||
const char *name) /* I - Size name */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
ppd_size_t *size; /* Current page size */
|
||||
double w, l; /* Width and length of page */
|
||||
char *nameptr; /* Pointer into name */
|
||||
struct lconv *loc; /* Locale data */
|
||||
ppd_coption_t *coption; /* Custom option for page size */
|
||||
ppd_cparam_t *cparam; /* Custom option parameter */
|
||||
|
||||
|
||||
DEBUG_printf(("2ppdPageSize(ppd=%p, name=\"%s\")", ppd, name));
|
||||
|
||||
if (!ppd)
|
||||
{
|
||||
DEBUG_puts("3ppdPageSize: Bad PPD pointer, returning NULL...");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (name)
|
||||
{
|
||||
if (!strncmp(name, "Custom.", 7) && ppd->variable_sizes)
|
||||
{
|
||||
/*
|
||||
* Find the custom page size...
|
||||
*/
|
||||
|
||||
for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++)
|
||||
if (!strcmp("Custom", size->name))
|
||||
break;
|
||||
|
||||
if (!i)
|
||||
{
|
||||
DEBUG_puts("3ppdPageSize: No custom sizes, returning NULL...");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Variable size; size name can be one of the following:
|
||||
*
|
||||
* Custom.WIDTHxLENGTHin - Size in inches
|
||||
* Custom.WIDTHxLENGTHft - Size in feet
|
||||
* Custom.WIDTHxLENGTHcm - Size in centimeters
|
||||
* Custom.WIDTHxLENGTHmm - Size in millimeters
|
||||
* Custom.WIDTHxLENGTHm - Size in meters
|
||||
* Custom.WIDTHxLENGTH[pt] - Size in points
|
||||
*/
|
||||
|
||||
loc = localeconv();
|
||||
w = _cupsStrScand(name + 7, &nameptr, loc);
|
||||
if (!nameptr || *nameptr != 'x')
|
||||
return (NULL);
|
||||
|
||||
l = _cupsStrScand(nameptr + 1, &nameptr, loc);
|
||||
if (!nameptr)
|
||||
return (NULL);
|
||||
|
||||
if (!_cups_strcasecmp(nameptr, "in"))
|
||||
{
|
||||
w *= 72.0;
|
||||
l *= 72.0;
|
||||
}
|
||||
else if (!_cups_strcasecmp(nameptr, "ft"))
|
||||
{
|
||||
w *= 12.0 * 72.0;
|
||||
l *= 12.0 * 72.0;
|
||||
}
|
||||
else if (!_cups_strcasecmp(nameptr, "mm"))
|
||||
{
|
||||
w *= 72.0 / 25.4;
|
||||
l *= 72.0 / 25.4;
|
||||
}
|
||||
else if (!_cups_strcasecmp(nameptr, "cm"))
|
||||
{
|
||||
w *= 72.0 / 2.54;
|
||||
l *= 72.0 / 2.54;
|
||||
}
|
||||
else if (!_cups_strcasecmp(nameptr, "m"))
|
||||
{
|
||||
w *= 72.0 / 0.0254;
|
||||
l *= 72.0 / 0.0254;
|
||||
}
|
||||
|
||||
size->width = (float)w;
|
||||
size->length = (float)l;
|
||||
size->left = ppd->custom_margins[0];
|
||||
size->bottom = ppd->custom_margins[1];
|
||||
size->right = (float)(w - ppd->custom_margins[2]);
|
||||
size->top = (float)(l - ppd->custom_margins[3]);
|
||||
|
||||
/*
|
||||
* Update the custom option records for the page size, too...
|
||||
*/
|
||||
|
||||
if ((coption = ppdFindCustomOption(ppd, "PageSize")) != NULL)
|
||||
{
|
||||
if ((cparam = ppdFindCustomParam(coption, "Width")) != NULL)
|
||||
cparam->current.custom_points = (float)w;
|
||||
|
||||
if ((cparam = ppdFindCustomParam(coption, "Height")) != NULL)
|
||||
cparam->current.custom_points = (float)l;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the page size...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("3ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
|
||||
size->name, size->width, size->length));
|
||||
|
||||
return (size);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Lookup by name...
|
||||
*/
|
||||
|
||||
for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++)
|
||||
if (!_cups_strcasecmp(name, size->name))
|
||||
{
|
||||
DEBUG_printf(("3ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
|
||||
size->name, size->width, size->length));
|
||||
|
||||
return (size);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Find default...
|
||||
*/
|
||||
|
||||
for (i = ppd->num_sizes, size = ppd->sizes; i > 0; i --, size ++)
|
||||
if (size->marked)
|
||||
{
|
||||
DEBUG_printf(("3ppdPageSize: Returning %p (\"%s\", %gx%g)", size,
|
||||
size->name, size->width, size->length));
|
||||
|
||||
return (size);
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_puts("3ppdPageSize: Size not found, returning NULL");
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdPageSizeLimits()' - Return the custom page size limits.
|
||||
*
|
||||
* This function returns the minimum and maximum custom page sizes and printable
|
||||
* areas based on the currently-marked (selected) options.
|
||||
*
|
||||
* If the specified PPD file does not support custom page sizes, both
|
||||
* "minimum" and "maximum" are filled with zeroes.
|
||||
*
|
||||
* @since CUPS 1.4/macOS 10.6@
|
||||
*/
|
||||
|
||||
int /* O - 1 if custom sizes are supported, 0 otherwise */
|
||||
ppdPageSizeLimits(ppd_file_t *ppd, /* I - PPD file record */
|
||||
ppd_size_t *minimum, /* O - Minimum custom size */
|
||||
ppd_size_t *maximum) /* O - Maximum custom size */
|
||||
{
|
||||
ppd_choice_t *qualifier2, /* Second media qualifier */
|
||||
*qualifier3; /* Third media qualifier */
|
||||
ppd_attr_t *attr; /* Attribute */
|
||||
float width, /* Min/max width */
|
||||
length; /* Min/max length */
|
||||
char spec[PPD_MAX_NAME]; /* Selector for min/max */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!ppd || !ppd->variable_sizes || !minimum || !maximum)
|
||||
{
|
||||
if (minimum)
|
||||
memset(minimum, 0, sizeof(ppd_size_t));
|
||||
|
||||
if (maximum)
|
||||
memset(maximum, 0, sizeof(ppd_size_t));
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* See if we have the cupsMediaQualifier2 and cupsMediaQualifier3 attributes...
|
||||
*/
|
||||
|
||||
cupsArraySave(ppd->sorted_attrs);
|
||||
|
||||
if ((attr = ppdFindAttr(ppd, "cupsMediaQualifier2", NULL)) != NULL &&
|
||||
attr->value)
|
||||
qualifier2 = ppdFindMarkedChoice(ppd, attr->value);
|
||||
else
|
||||
qualifier2 = NULL;
|
||||
|
||||
if ((attr = ppdFindAttr(ppd, "cupsMediaQualifier3", NULL)) != NULL &&
|
||||
attr->value)
|
||||
qualifier3 = ppdFindMarkedChoice(ppd, attr->value);
|
||||
else
|
||||
qualifier3 = NULL;
|
||||
|
||||
/*
|
||||
* Figure out the current minimum width and length...
|
||||
*/
|
||||
|
||||
width = ppd->custom_min[0];
|
||||
length = ppd->custom_min[1];
|
||||
|
||||
if (qualifier2)
|
||||
{
|
||||
/*
|
||||
* Try getting cupsMinSize...
|
||||
*/
|
||||
|
||||
if (qualifier3)
|
||||
{
|
||||
snprintf(spec, sizeof(spec), ".%s.%s", qualifier2->choice,
|
||||
qualifier3->choice);
|
||||
attr = ppdFindAttr(ppd, "cupsMinSize", spec);
|
||||
}
|
||||
else
|
||||
attr = NULL;
|
||||
|
||||
if (!attr)
|
||||
{
|
||||
snprintf(spec, sizeof(spec), ".%s.", qualifier2->choice);
|
||||
attr = ppdFindAttr(ppd, "cupsMinSize", spec);
|
||||
}
|
||||
|
||||
if (!attr && qualifier3)
|
||||
{
|
||||
snprintf(spec, sizeof(spec), "..%s", qualifier3->choice);
|
||||
attr = ppdFindAttr(ppd, "cupsMinSize", spec);
|
||||
}
|
||||
|
||||
if ((attr && attr->value &&
|
||||
sscanf(attr->value, "%f%f", &width, &length) != 2) || !attr)
|
||||
{
|
||||
width = ppd->custom_min[0];
|
||||
length = ppd->custom_min[1];
|
||||
}
|
||||
}
|
||||
|
||||
minimum->width = width;
|
||||
minimum->length = length;
|
||||
minimum->left = ppd->custom_margins[0];
|
||||
minimum->bottom = ppd->custom_margins[1];
|
||||
minimum->right = width - ppd->custom_margins[2];
|
||||
minimum->top = length - ppd->custom_margins[3];
|
||||
|
||||
/*
|
||||
* Figure out the current maximum width and length...
|
||||
*/
|
||||
|
||||
width = ppd->custom_max[0];
|
||||
length = ppd->custom_max[1];
|
||||
|
||||
if (qualifier2)
|
||||
{
|
||||
/*
|
||||
* Try getting cupsMaxSize...
|
||||
*/
|
||||
|
||||
if (qualifier3)
|
||||
{
|
||||
snprintf(spec, sizeof(spec), ".%s.%s", qualifier2->choice,
|
||||
qualifier3->choice);
|
||||
attr = ppdFindAttr(ppd, "cupsMaxSize", spec);
|
||||
}
|
||||
else
|
||||
attr = NULL;
|
||||
|
||||
if (!attr)
|
||||
{
|
||||
snprintf(spec, sizeof(spec), ".%s.", qualifier2->choice);
|
||||
attr = ppdFindAttr(ppd, "cupsMaxSize", spec);
|
||||
}
|
||||
|
||||
if (!attr && qualifier3)
|
||||
{
|
||||
snprintf(spec, sizeof(spec), "..%s", qualifier3->choice);
|
||||
attr = ppdFindAttr(ppd, "cupsMaxSize", spec);
|
||||
}
|
||||
|
||||
if (!attr ||
|
||||
(attr->value && sscanf(attr->value, "%f%f", &width, &length) != 2))
|
||||
{
|
||||
width = ppd->custom_max[0];
|
||||
length = ppd->custom_max[1];
|
||||
}
|
||||
}
|
||||
|
||||
maximum->width = width;
|
||||
maximum->length = length;
|
||||
maximum->left = ppd->custom_margins[0];
|
||||
maximum->bottom = ppd->custom_margins[1];
|
||||
maximum->right = width - ppd->custom_margins[2];
|
||||
maximum->top = length - ppd->custom_margins[3];
|
||||
|
||||
/*
|
||||
* Return the min and max...
|
||||
*/
|
||||
|
||||
cupsArrayRestore(ppd->sorted_attrs);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdPageWidth()' - Get the page width for the given size.
|
||||
*/
|
||||
|
||||
float /* O - Width of page in points or 0.0 */
|
||||
ppdPageWidth(ppd_file_t *ppd, /* I - PPD file record */
|
||||
const char *name) /* I - Size name */
|
||||
{
|
||||
ppd_size_t *size; /* Page size */
|
||||
|
||||
|
||||
if ((size = ppdPageSize(ppd, name)) == NULL)
|
||||
return (0.0);
|
||||
else
|
||||
return (size->width);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'ppdPageLength()' - Get the page length for the given size.
|
||||
*/
|
||||
|
||||
float /* O - Length of page in points or 0.0 */
|
||||
ppdPageLength(ppd_file_t *ppd, /* I - PPD file */
|
||||
const char *name) /* I - Size name */
|
||||
{
|
||||
ppd_size_t *size; /* Page size */
|
||||
|
||||
|
||||
if ((size = ppdPageSize(ppd, name)) == NULL)
|
||||
return (0.0);
|
||||
else
|
||||
return (size->length);
|
||||
}
|
||||
@ -1,27 +1,25 @@
|
||||
/*
|
||||
* "$Id: ppd-private.h 3683 2012-02-16 22:03:53Z msweet $"
|
||||
* Private PPD definitions for CUPS.
|
||||
*
|
||||
* Private PPD definitions for CUPS.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* 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
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
*
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
* This code and any derivative of it may be used and distributed
|
||||
* freely under the terms of the GNU General Public License when
|
||||
* used with GNU Ghostscript or its derivatives. Use of the code
|
||||
* (or any derivative of it) with software other than GNU
|
||||
* GhostScript (or its derivatives) is governed by the CUPS license
|
||||
* agreement.
|
||||
*
|
||||
* This code and any derivative of it may be used and distributed
|
||||
* freely under the terms of the GNU General Public License when
|
||||
* used with GNU Ghostscript or its derivatives. Use of the code
|
||||
* (or any derivative of it) with software other than GNU
|
||||
* GhostScript (or its derivatives) is governed by the CUPS license
|
||||
* agreement.
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_PPD_PRIVATE_H_
|
||||
@ -49,13 +47,25 @@ extern "C" {
|
||||
* Constants...
|
||||
*/
|
||||
|
||||
# define _PPD_CACHE_VERSION 3 /* Version number in cache file */
|
||||
# define _PPD_CACHE_VERSION 7 /* Version number in cache file */
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef struct _ppd_globals_s /**** CUPS PPD global state data ****/
|
||||
{
|
||||
/* ppd.c */
|
||||
ppd_status_t ppd_status; /* Status of last ppdOpen*() */
|
||||
int ppd_line; /* Current line number */
|
||||
ppd_conform_t ppd_conform; /* Level of conformance required */
|
||||
|
||||
/* ppd-util.c */
|
||||
char ppd_filename[HTTP_MAX_URI];
|
||||
/* PPD filename */
|
||||
} _ppd_globals_t;
|
||||
|
||||
typedef enum _ppd_localization_e /**** Selector for _ppdOpen ****/
|
||||
{
|
||||
_PPD_LOCALIZATION_DEFAULT, /* Load only the default localization */
|
||||
@ -104,17 +114,25 @@ typedef enum _pwg_print_quality_e /**** PWG print-quality values ****/
|
||||
|
||||
typedef struct _pwg_finishings_s /**** PWG finishings mapping data ****/
|
||||
{
|
||||
ipp_finish_t value; /* finishings value */
|
||||
int num_options; /* Number of options to apply */
|
||||
cups_option_t *options; /* Options to apply */
|
||||
ipp_finishings_t value; /* finishings value */
|
||||
int num_options; /* Number of options to apply */
|
||||
cups_option_t *options; /* Options to apply */
|
||||
} _pwg_finishings_t;
|
||||
|
||||
typedef struct _pwg_material_s /**** PWG material mapping data ****/
|
||||
{
|
||||
char *key, /* material-key value */
|
||||
*name; /* material-name value */
|
||||
int num_props; /* Number of properties */
|
||||
cups_option_t *props; /* Material properties */
|
||||
} _pwg_material_t;
|
||||
|
||||
struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
|
||||
{
|
||||
int num_bins; /* Number of output bins */
|
||||
_pwg_map_t *bins; /* Output bins */
|
||||
pwg_map_t *bins; /* Output bins */
|
||||
int num_sizes; /* Number of media sizes */
|
||||
_pwg_size_t *sizes; /* Media sizes */
|
||||
pwg_size_t *sizes; /* Media sizes */
|
||||
int custom_max_width, /* Maximum custom width in 2540ths */
|
||||
custom_max_length, /* Maximum custom length in 2540ths */
|
||||
custom_min_width, /* Minimum custom width in 2540ths */
|
||||
@ -122,12 +140,12 @@ struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
|
||||
char *custom_max_keyword, /* Maximum custom size PWG keyword */
|
||||
*custom_min_keyword, /* Minimum custom size PWG keyword */
|
||||
custom_ppd_size[41]; /* Custom PPD size name */
|
||||
_pwg_size_t custom_size; /* Custom size record */
|
||||
pwg_size_t custom_size; /* Custom size record */
|
||||
char *source_option; /* PPD option for media source */
|
||||
int num_sources; /* Number of media sources */
|
||||
_pwg_map_t *sources; /* Media sources */
|
||||
pwg_map_t *sources; /* Media sources */
|
||||
int num_types; /* Number of media types */
|
||||
_pwg_map_t *types; /* Media types */
|
||||
pwg_map_t *types; /* Media types */
|
||||
int num_presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
|
||||
/* Number of print-color-mode/print-quality options */
|
||||
cups_option_t *presets[_PWG_PRINT_COLOR_MODE_MAX][_PWG_PRINT_QUALITY_MAX];
|
||||
@ -141,7 +159,18 @@ 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 */
|
||||
int max_copies, /* cupsMaxCopies value */
|
||||
account_id, /* cupsJobAccountId value */
|
||||
accounting_user_id; /* cupsJobAccountingUserId value */
|
||||
char *password; /* cupsJobPassword value */
|
||||
cups_array_t *mandatory; /* cupsMandatory value */
|
||||
char *charge_info_uri; /* cupsChargeInfoURI value */
|
||||
cups_array_t *support_files; /* Support files - ICC profiles, etc. */
|
||||
char *cups_3d, /* cups3D value */
|
||||
*cups_layer_order; /* cupsLayerOrder value */
|
||||
int cups_accuracy[3]; /* cupsAccuracy value - x, y, and z in nanometers */
|
||||
int cups_volume[3]; /* cupsVolume value - x, y, and z in millimeters */
|
||||
cups_array_t *materials; /* cupsMaterial values */
|
||||
};
|
||||
|
||||
|
||||
@ -149,18 +178,23 @@ struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern int _cupsConvertOptions(ipp_t *request, ppd_file_t *ppd, _ppd_cache_t *pc, ipp_attribute_t *media_col_sup, ipp_attribute_t *doc_handling_sup, ipp_attribute_t *print_color_mode_sup, const char *user, const char *format, int copies, int num_options, cups_option_t *options);
|
||||
extern _ppd_cache_t *_ppdCacheCreateWithFile(const char *filename,
|
||||
ipp_t **attrs);
|
||||
extern _ppd_cache_t *_ppdCacheCreateWithPPD(ppd_file_t *ppd);
|
||||
extern void _ppdCacheDestroy(_ppd_cache_t *pc);
|
||||
extern const char *_ppdCacheGetBin(_ppd_cache_t *pc,
|
||||
const char *output_bin);
|
||||
extern int _ppdCacheGetFinishingOptions(_ppd_cache_t *pc, ipp_t *job,
|
||||
ipp_finish_t value, int num_options,
|
||||
extern int _ppdCacheGetFinishingOptions(_ppd_cache_t *pc,
|
||||
ipp_t *job,
|
||||
ipp_finishings_t value,
|
||||
int num_options,
|
||||
cups_option_t **options);
|
||||
extern int _ppdCacheGetFinishingValues(_ppd_cache_t *pc, int num_options,
|
||||
extern int _ppdCacheGetFinishingValues(_ppd_cache_t *pc,
|
||||
int num_options,
|
||||
cups_option_t *options,
|
||||
int max_values, int *values);
|
||||
int max_values,
|
||||
int *values);
|
||||
extern const char *_ppdCacheGetInputSlot(_ppd_cache_t *pc, ipp_t *job,
|
||||
const char *keyword);
|
||||
extern const char *_ppdCacheGetMediaType(_ppd_cache_t *pc, ipp_t *job,
|
||||
@ -169,7 +203,7 @@ extern const char *_ppdCacheGetOutputBin(_ppd_cache_t *pc,
|
||||
const char *keyword);
|
||||
extern const char *_ppdCacheGetPageSize(_ppd_cache_t *pc, ipp_t *job,
|
||||
const char *keyword, int *exact);
|
||||
extern _pwg_size_t *_ppdCacheGetSize(_ppd_cache_t *pc,
|
||||
extern pwg_size_t *_ppdCacheGetSize(_ppd_cache_t *pc,
|
||||
const char *page_size);
|
||||
extern const char *_ppdCacheGetSource(_ppd_cache_t *pc,
|
||||
const char *input_slot);
|
||||
@ -177,9 +211,11 @@ extern const char *_ppdCacheGetType(_ppd_cache_t *pc,
|
||||
const char *media_type);
|
||||
extern int _ppdCacheWriteFile(_ppd_cache_t *pc,
|
||||
const char *filename, ipp_t *attrs);
|
||||
extern char *_ppdCreateFromIPP(char *buffer, size_t bufsize, ipp_t *response);
|
||||
extern void _ppdFreeLanguages(cups_array_t *languages);
|
||||
extern cups_encoding_t _ppdGetEncoding(const char *name);
|
||||
extern cups_array_t *_ppdGetLanguages(ppd_file_t *ppd);
|
||||
extern _ppd_globals_t *_ppdGlobals(void);
|
||||
extern unsigned _ppdHashName(const char *name);
|
||||
extern ppd_attr_t *_ppdLocalizedAttr(ppd_file_t *ppd, const char *keyword,
|
||||
const char *spec, const char *ll_CC);
|
||||
@ -197,7 +233,7 @@ extern const char *_pwgInputSlotForSource(const char *media_source,
|
||||
char *name, size_t namesize);
|
||||
extern const char *_pwgMediaTypeForType(const char *media_type,
|
||||
char *name, size_t namesize);
|
||||
extern const char *_pwgPageSizeForMedia(_pwg_media_t *media,
|
||||
extern const char *_pwgPageSizeForMedia(pwg_media_t *media,
|
||||
char *name, size_t namesize);
|
||||
|
||||
|
||||
@ -209,7 +245,3 @@ extern const char *_pwgPageSizeForMedia(_pwg_media_t *media,
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_PPD_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: ppd-private.h 3683 2012-02-16 22:03:53Z msweet $".
|
||||
*/
|
||||
|
||||
716
cups/ppd-util.c
Normal file
716
cups/ppd-util.c
Normal file
@ -0,0 +1,716 @@
|
||||
/*
|
||||
* PPD utilities for CUPS.
|
||||
*
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include necessary headers...
|
||||
*/
|
||||
|
||||
#include "cups-private.h"
|
||||
#include "ppd-private.h"
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
# include <io.h>
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif /* WIN32 || __EMX__ */
|
||||
|
||||
|
||||
/*
|
||||
* Local functions...
|
||||
*/
|
||||
|
||||
static int cups_get_printer_uri(http_t *http, const char *name,
|
||||
char *host, int hostsize, int *port,
|
||||
char *resource, int resourcesize,
|
||||
int depth);
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetPPD()' - Get the PPD file for a printer on the default server.
|
||||
*
|
||||
* For classes, @code cupsGetPPD@ returns the PPD file for the first printer
|
||||
* in the class.
|
||||
*
|
||||
* The returned filename is stored in a static buffer and is overwritten with
|
||||
* each call to @code cupsGetPPD@ or @link cupsGetPPD2@. The caller "owns" the
|
||||
* file that is created and must @code unlink@ the returned filename.
|
||||
*/
|
||||
|
||||
const char * /* O - Filename for PPD file */
|
||||
cupsGetPPD(const char *name) /* I - Destination name */
|
||||
{
|
||||
_ppd_globals_t *pg = _ppdGlobals(); /* Pointer to library globals */
|
||||
time_t modtime = 0; /* Modification time */
|
||||
|
||||
|
||||
/*
|
||||
* Return the PPD file...
|
||||
*/
|
||||
|
||||
pg->ppd_filename[0] = '\0';
|
||||
|
||||
if (cupsGetPPD3(CUPS_HTTP_DEFAULT, name, &modtime, pg->ppd_filename,
|
||||
sizeof(pg->ppd_filename)) == HTTP_STATUS_OK)
|
||||
return (pg->ppd_filename);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetPPD2()' - Get the PPD file for a printer from the specified server.
|
||||
*
|
||||
* For classes, @code cupsGetPPD2@ returns the PPD file for the first printer
|
||||
* in the class.
|
||||
*
|
||||
* The returned filename is stored in a static buffer and is overwritten with
|
||||
* each call to @link cupsGetPPD@ or @code cupsGetPPD2@. The caller "owns" the
|
||||
* file that is created and must @code unlink@ the returned filename.
|
||||
*
|
||||
* @since CUPS 1.1.21/macOS 10.4@
|
||||
*/
|
||||
|
||||
const char * /* O - Filename for PPD file */
|
||||
cupsGetPPD2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
|
||||
const char *name) /* I - Destination name */
|
||||
{
|
||||
_ppd_globals_t *pg = _ppdGlobals(); /* Pointer to library globals */
|
||||
time_t modtime = 0; /* Modification time */
|
||||
|
||||
|
||||
pg->ppd_filename[0] = '\0';
|
||||
|
||||
if (cupsGetPPD3(http, name, &modtime, pg->ppd_filename,
|
||||
sizeof(pg->ppd_filename)) == HTTP_STATUS_OK)
|
||||
return (pg->ppd_filename);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetPPD3()' - Get the PPD file for a printer on the specified
|
||||
* server if it has changed.
|
||||
*
|
||||
* The "modtime" parameter contains the modification time of any
|
||||
* locally-cached content and is updated with the time from the PPD file on
|
||||
* the server.
|
||||
*
|
||||
* The "buffer" parameter contains the local PPD filename. If it contains
|
||||
* the empty string, a new temporary file is created, otherwise the existing
|
||||
* file will be overwritten as needed. The caller "owns" the file that is
|
||||
* created and must @code unlink@ the returned filename.
|
||||
*
|
||||
* On success, @code HTTP_STATUS_OK@ is returned for a new PPD file and
|
||||
* @code HTTP_STATUS_NOT_MODIFIED@ if the existing PPD file is up-to-date. Any other
|
||||
* status is an error.
|
||||
*
|
||||
* For classes, @code cupsGetPPD3@ returns the PPD file for the first printer
|
||||
* in the class.
|
||||
*
|
||||
* @since CUPS 1.4/macOS 10.6@
|
||||
*/
|
||||
|
||||
http_status_t /* O - HTTP status */
|
||||
cupsGetPPD3(http_t *http, /* I - HTTP connection or @code CUPS_HTTP_DEFAULT@ */
|
||||
const char *name, /* I - Destination name */
|
||||
time_t *modtime, /* IO - Modification time */
|
||||
char *buffer, /* I - Filename buffer */
|
||||
size_t bufsize) /* I - Size of filename buffer */
|
||||
{
|
||||
int http_port; /* Port number */
|
||||
char http_hostname[HTTP_MAX_HOST];
|
||||
/* Hostname associated with connection */
|
||||
http_t *http2; /* Alternate HTTP connection */
|
||||
int fd; /* PPD file */
|
||||
char localhost[HTTP_MAX_URI],/* Local hostname */
|
||||
hostname[HTTP_MAX_URI], /* Hostname */
|
||||
resource[HTTP_MAX_URI]; /* Resource name */
|
||||
int port; /* Port number */
|
||||
http_status_t status; /* HTTP status from server */
|
||||
char tempfile[1024] = ""; /* Temporary filename */
|
||||
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsGetPPD3(http=%p, name=\"%s\", modtime=%p(%d), buffer=%p, "
|
||||
"bufsize=%d)", http, name, modtime,
|
||||
modtime ? (int)*modtime : 0, buffer, (int)bufsize));
|
||||
|
||||
if (!name)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No printer name"), 1);
|
||||
return (HTTP_STATUS_NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
if (!modtime)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No modification time"), 1);
|
||||
return (HTTP_STATUS_NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
if (!buffer || bufsize <= 1)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad filename buffer"), 1);
|
||||
return (HTTP_STATUS_NOT_ACCEPTABLE);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
/*
|
||||
* See if the PPD file is available locally...
|
||||
*/
|
||||
|
||||
if (http)
|
||||
httpGetHostname(http, hostname, sizeof(hostname));
|
||||
else
|
||||
{
|
||||
strlcpy(hostname, cupsServer(), sizeof(hostname));
|
||||
if (hostname[0] == '/')
|
||||
strlcpy(hostname, "localhost", sizeof(hostname));
|
||||
}
|
||||
|
||||
if (!_cups_strcasecmp(hostname, "localhost"))
|
||||
{
|
||||
char ppdname[1024]; /* PPD filename */
|
||||
struct stat ppdinfo; /* PPD file information */
|
||||
|
||||
|
||||
snprintf(ppdname, sizeof(ppdname), "%s/ppd/%s.ppd", cg->cups_serverroot,
|
||||
name);
|
||||
if (!stat(ppdname, &ppdinfo) && !access(ppdname, R_OK))
|
||||
{
|
||||
/*
|
||||
* OK, the file exists and is readable, use it!
|
||||
*/
|
||||
|
||||
if (buffer[0])
|
||||
{
|
||||
unlink(buffer);
|
||||
|
||||
if (symlink(ppdname, buffer) && errno != EEXIST)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
|
||||
|
||||
return (HTTP_STATUS_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int tries; /* Number of tries */
|
||||
const char *tmpdir; /* TMPDIR environment variable */
|
||||
struct timeval curtime; /* Current time */
|
||||
|
||||
/*
|
||||
* Previously we put root temporary files in the default CUPS temporary
|
||||
* directory under /var/spool/cups. However, since the scheduler cleans
|
||||
* out temporary files there and runs independently of the user apps, we
|
||||
* don't want to use it unless specifically told to by cupsd.
|
||||
*/
|
||||
|
||||
if ((tmpdir = getenv("TMPDIR")) == NULL)
|
||||
# ifdef __APPLE__
|
||||
tmpdir = "/private/tmp"; /* /tmp is a symlink to /private/tmp */
|
||||
# else
|
||||
tmpdir = "/tmp";
|
||||
# endif /* __APPLE__ */
|
||||
|
||||
/*
|
||||
* Make the temporary name using the specified directory...
|
||||
*/
|
||||
|
||||
tries = 0;
|
||||
|
||||
do
|
||||
{
|
||||
/*
|
||||
* Get the current time of day...
|
||||
*/
|
||||
|
||||
gettimeofday(&curtime, NULL);
|
||||
|
||||
/*
|
||||
* Format a string using the hex time values...
|
||||
*/
|
||||
|
||||
snprintf(buffer, bufsize, "%s/%08lx%05lx", tmpdir,
|
||||
(unsigned long)curtime.tv_sec,
|
||||
(unsigned long)curtime.tv_usec);
|
||||
|
||||
/*
|
||||
* Try to make a symlink...
|
||||
*/
|
||||
|
||||
if (!symlink(ppdname, buffer))
|
||||
break;
|
||||
|
||||
tries ++;
|
||||
}
|
||||
while (tries < 1000);
|
||||
|
||||
if (tries >= 1000)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
|
||||
|
||||
return (HTTP_STATUS_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if (*modtime >= ppdinfo.st_mtime)
|
||||
return (HTTP_STATUS_NOT_MODIFIED);
|
||||
else
|
||||
{
|
||||
*modtime = ppdinfo.st_mtime;
|
||||
return (HTTP_STATUS_OK);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* !WIN32 */
|
||||
|
||||
/*
|
||||
* Try finding a printer URI for this printer...
|
||||
*/
|
||||
|
||||
if (!http)
|
||||
if ((http = _cupsConnect()) == NULL)
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
|
||||
if (!cups_get_printer_uri(http, name, hostname, sizeof(hostname), &port,
|
||||
resource, sizeof(resource), 0))
|
||||
return (HTTP_STATUS_NOT_FOUND);
|
||||
|
||||
DEBUG_printf(("2cupsGetPPD3: Printer hostname=\"%s\", port=%d", hostname,
|
||||
port));
|
||||
|
||||
if (cupsServer()[0] == '/' && !_cups_strcasecmp(hostname, "localhost") && port == ippPort())
|
||||
{
|
||||
/*
|
||||
* Redirect localhost to domain socket...
|
||||
*/
|
||||
|
||||
strlcpy(hostname, cupsServer(), sizeof(hostname));
|
||||
port = 0;
|
||||
|
||||
DEBUG_printf(("2cupsGetPPD3: Redirecting to \"%s\".", hostname));
|
||||
}
|
||||
|
||||
/*
|
||||
* Remap local hostname to localhost...
|
||||
*/
|
||||
|
||||
httpGetHostname(NULL, localhost, sizeof(localhost));
|
||||
|
||||
DEBUG_printf(("2cupsGetPPD3: Local hostname=\"%s\"", localhost));
|
||||
|
||||
if (!_cups_strcasecmp(localhost, hostname))
|
||||
strlcpy(hostname, "localhost", sizeof(hostname));
|
||||
|
||||
/*
|
||||
* Get the hostname and port number we are connected to...
|
||||
*/
|
||||
|
||||
httpGetHostname(http, http_hostname, sizeof(http_hostname));
|
||||
http_port = httpAddrPort(http->hostaddr);
|
||||
|
||||
DEBUG_printf(("2cupsGetPPD3: Connection hostname=\"%s\", port=%d",
|
||||
http_hostname, http_port));
|
||||
|
||||
/*
|
||||
* Reconnect to the correct server as needed...
|
||||
*/
|
||||
|
||||
if (!_cups_strcasecmp(http_hostname, hostname) && port == http_port)
|
||||
http2 = http;
|
||||
else if ((http2 = httpConnect2(hostname, port, NULL, AF_UNSPEC,
|
||||
cupsEncryption(), 1, 30000, NULL)) == NULL)
|
||||
{
|
||||
DEBUG_puts("1cupsGetPPD3: Unable to connect to server");
|
||||
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a temp file...
|
||||
*/
|
||||
|
||||
if (buffer[0])
|
||||
fd = open(buffer, O_CREAT | O_TRUNC | O_WRONLY, 0600);
|
||||
else
|
||||
fd = cupsTempFd(tempfile, sizeof(tempfile));
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
/*
|
||||
* Can't open file; close the server connection and return NULL...
|
||||
*/
|
||||
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
|
||||
|
||||
if (http2 != http)
|
||||
httpClose(http2);
|
||||
|
||||
return (HTTP_STATUS_SERVER_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
* And send a request to the HTTP server...
|
||||
*/
|
||||
|
||||
strlcat(resource, ".ppd", sizeof(resource));
|
||||
|
||||
if (*modtime > 0)
|
||||
httpSetField(http2, HTTP_FIELD_IF_MODIFIED_SINCE,
|
||||
httpGetDateString(*modtime));
|
||||
|
||||
status = cupsGetFd(http2, resource, fd);
|
||||
|
||||
close(fd);
|
||||
|
||||
/*
|
||||
* See if we actually got the file or an error...
|
||||
*/
|
||||
|
||||
if (status == HTTP_STATUS_OK)
|
||||
{
|
||||
*modtime = httpGetDateTime(httpGetField(http2, HTTP_FIELD_DATE));
|
||||
|
||||
if (tempfile[0])
|
||||
strlcpy(buffer, tempfile, bufsize);
|
||||
}
|
||||
else if (status != HTTP_STATUS_NOT_MODIFIED)
|
||||
{
|
||||
_cupsSetHTTPError(status);
|
||||
|
||||
if (buffer[0])
|
||||
unlink(buffer);
|
||||
else if (tempfile[0])
|
||||
unlink(tempfile);
|
||||
}
|
||||
else if (tempfile[0])
|
||||
unlink(tempfile);
|
||||
|
||||
if (http2 != http)
|
||||
httpClose(http2);
|
||||
|
||||
/*
|
||||
* Return the PPD file...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("1cupsGetPPD3: Returning status %d", status));
|
||||
|
||||
return (status);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsGetServerPPD()' - Get an available PPD file from the server.
|
||||
*
|
||||
* This function returns the named PPD file from the server. The
|
||||
* list of available PPDs is provided by the IPP @code CUPS_GET_PPDS@
|
||||
* operation.
|
||||
*
|
||||
* You must remove (unlink) the PPD file when you are finished with
|
||||
* it. The PPD filename is stored in a static location that will be
|
||||
* overwritten on the next call to @link cupsGetPPD@, @link cupsGetPPD2@,
|
||||
* or @link cupsGetServerPPD@.
|
||||
*
|
||||
* @since CUPS 1.3/macOS 10.5@
|
||||
*/
|
||||
|
||||
char * /* O - Name of PPD file or @code NULL@ on error */
|
||||
cupsGetServerPPD(http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
|
||||
const char *name) /* I - Name of PPD file ("ppd-name") */
|
||||
{
|
||||
int fd; /* PPD file descriptor */
|
||||
ipp_t *request; /* IPP request */
|
||||
_ppd_globals_t *pg = _ppdGlobals();
|
||||
/* Pointer to library globals */
|
||||
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
*/
|
||||
|
||||
if (!name)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No PPD name"), 1);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (!http)
|
||||
if ((http = _cupsConnect()) == NULL)
|
||||
return (NULL);
|
||||
|
||||
/*
|
||||
* Get a temp file...
|
||||
*/
|
||||
|
||||
if ((fd = cupsTempFd(pg->ppd_filename, sizeof(pg->ppd_filename))) < 0)
|
||||
{
|
||||
/*
|
||||
* Can't open file; close the server connection and return NULL...
|
||||
*/
|
||||
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the PPD file...
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_OP_CUPS_GET_PPD);
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name", NULL,
|
||||
name);
|
||||
|
||||
ippDelete(cupsDoIORequest(http, request, "/", -1, fd));
|
||||
|
||||
close(fd);
|
||||
|
||||
if (cupsLastError() != IPP_STATUS_OK)
|
||||
{
|
||||
unlink(pg->ppd_filename);
|
||||
return (NULL);
|
||||
}
|
||||
else
|
||||
return (pg->ppd_filename);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 'cups_get_printer_uri()' - Get the printer-uri-supported attribute for the
|
||||
* first printer in a class.
|
||||
*/
|
||||
|
||||
static int /* O - 1 on success, 0 on failure */
|
||||
cups_get_printer_uri(
|
||||
http_t *http, /* I - Connection to server */
|
||||
const char *name, /* I - Name of printer or class */
|
||||
char *host, /* I - Hostname buffer */
|
||||
int hostsize, /* I - Size of hostname buffer */
|
||||
int *port, /* O - Port number */
|
||||
char *resource, /* I - Resource buffer */
|
||||
int resourcesize, /* I - Size of resource buffer */
|
||||
int depth) /* I - Depth of query */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int http_port; /* Port number */
|
||||
http_t *http2; /* Alternate HTTP connection */
|
||||
ipp_t *request, /* IPP request */
|
||||
*response; /* IPP response */
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
char uri[HTTP_MAX_URI], /* printer-uri attribute */
|
||||
scheme[HTTP_MAX_URI], /* Scheme name */
|
||||
username[HTTP_MAX_URI], /* Username:password */
|
||||
classname[255], /* Temporary class name */
|
||||
http_hostname[HTTP_MAX_HOST];
|
||||
/* Hostname associated with connection */
|
||||
static const char * const requested_attrs[] =
|
||||
{ /* Requested attributes */
|
||||
"device-uri",
|
||||
"member-uris",
|
||||
"printer-uri-supported",
|
||||
"printer-type"
|
||||
};
|
||||
|
||||
|
||||
DEBUG_printf(("4cups_get_printer_uri(http=%p, name=\"%s\", host=%p, hostsize=%d, resource=%p, resourcesize=%d, depth=%d)", http, name, host, hostsize, resource, resourcesize, depth));
|
||||
|
||||
/*
|
||||
* Setup the printer URI...
|
||||
*/
|
||||
|
||||
if (httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", name) < HTTP_URI_STATUS_OK)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unable to create printer-uri"), 1);
|
||||
|
||||
*host = '\0';
|
||||
*resource = '\0';
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
DEBUG_printf(("5cups_get_printer_uri: printer-uri=\"%s\"", uri));
|
||||
|
||||
/*
|
||||
* Get the hostname and port number we are connected to...
|
||||
*/
|
||||
|
||||
httpGetHostname(http, http_hostname, sizeof(http_hostname));
|
||||
http_port = httpAddrPort(http->hostaddr);
|
||||
|
||||
DEBUG_printf(("5cups_get_printer_uri: http_hostname=\"%s\"", http_hostname));
|
||||
|
||||
/*
|
||||
* Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following
|
||||
* attributes:
|
||||
*
|
||||
* attributes-charset
|
||||
* attributes-natural-language
|
||||
* printer-uri
|
||||
* requested-attributes
|
||||
*/
|
||||
|
||||
request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
|
||||
|
||||
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", sizeof(requested_attrs) / sizeof(requested_attrs[0]), NULL, requested_attrs);
|
||||
|
||||
/*
|
||||
* Do the request and get back a response...
|
||||
*/
|
||||
|
||||
snprintf(resource, (size_t)resourcesize, "/printers/%s", name);
|
||||
|
||||
if ((response = cupsDoRequest(http, request, resource)) != NULL)
|
||||
{
|
||||
const char *device_uri = NULL; /* device-uri value */
|
||||
|
||||
if ((attr = ippFindAttribute(response, "device-uri", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
device_uri = attr->values[0].string.text;
|
||||
DEBUG_printf(("5cups_get_printer_uri: device-uri=\"%s\"", device_uri));
|
||||
}
|
||||
|
||||
if (device_uri &&
|
||||
(((!strncmp(device_uri, "ipp://", 6) || !strncmp(device_uri, "ipps://", 7)) &&
|
||||
(strstr(device_uri, "/printers/") != NULL || strstr(device_uri, "/classes/") != NULL)) ||
|
||||
((strstr(device_uri, "._ipp.") != NULL || strstr(device_uri, "._ipps.") != NULL) &&
|
||||
!strcmp(device_uri + strlen(device_uri) - 5, "/cups"))))
|
||||
{
|
||||
/*
|
||||
* Statically-configured shared printer.
|
||||
*/
|
||||
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, _httpResolveURI(device_uri, uri, sizeof(uri), _HTTP_RESOLVE_DEFAULT, NULL, NULL), scheme, sizeof(scheme), username, sizeof(username), host, hostsize, port, resource, resourcesize);
|
||||
ippDelete(response);
|
||||
|
||||
DEBUG_printf(("5cups_get_printer_uri: Resolved to host=\"%s\", port=%d, resource=\"%s\"", host, *port, resource));
|
||||
return (1);
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "member-uris", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
/*
|
||||
* Get the first actual printer name in the class...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("5cups_get_printer_uri: Got member-uris with %d values.", ippGetCount(attr)));
|
||||
|
||||
for (i = 0; i < attr->num_values; i ++)
|
||||
{
|
||||
DEBUG_printf(("5cups_get_printer_uri: member-uris[%d]=\"%s\"", i, ippGetString(attr, i, NULL)));
|
||||
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[i].string.text, scheme, sizeof(scheme), username, sizeof(username), host, hostsize, port, resource, resourcesize);
|
||||
if (!strncmp(resource, "/printers/", 10))
|
||||
{
|
||||
/*
|
||||
* Found a printer!
|
||||
*/
|
||||
|
||||
ippDelete(response);
|
||||
|
||||
DEBUG_printf(("5cups_get_printer_uri: Found printer member with host=\"%s\", port=%d, resource=\"%s\"", host, *port, resource));
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* No printers in this class - try recursively looking for a printer,
|
||||
* but not more than 3 levels deep...
|
||||
*/
|
||||
|
||||
if (depth < 3)
|
||||
{
|
||||
for (i = 0; i < attr->num_values; i ++)
|
||||
{
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[i].string.text,
|
||||
scheme, sizeof(scheme), username, sizeof(username),
|
||||
host, hostsize, port, resource, resourcesize);
|
||||
if (!strncmp(resource, "/classes/", 9))
|
||||
{
|
||||
/*
|
||||
* Found a class! Connect to the right server...
|
||||
*/
|
||||
|
||||
if (!_cups_strcasecmp(http_hostname, host) && *port == http_port)
|
||||
http2 = http;
|
||||
else if ((http2 = httpConnect2(host, *port, NULL, AF_UNSPEC, cupsEncryption(), 1, 30000, NULL)) == NULL)
|
||||
{
|
||||
DEBUG_puts("8cups_get_printer_uri: Unable to connect to server");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Look up printers on that server...
|
||||
*/
|
||||
|
||||
strlcpy(classname, resource + 9, sizeof(classname));
|
||||
|
||||
cups_get_printer_uri(http2, classname, host, hostsize, port,
|
||||
resource, resourcesize, depth + 1);
|
||||
|
||||
/*
|
||||
* Close the connection as needed...
|
||||
*/
|
||||
|
||||
if (http2 != http)
|
||||
httpClose(http2);
|
||||
|
||||
if (*host)
|
||||
return (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "printer-uri-supported", IPP_TAG_URI)) != NULL)
|
||||
{
|
||||
httpSeparateURI(HTTP_URI_CODING_ALL, _httpResolveURI(attr->values[0].string.text, uri, sizeof(uri), _HTTP_RESOLVE_DEFAULT, NULL, NULL), scheme, sizeof(scheme), username, sizeof(username), host, hostsize, port, resource, resourcesize);
|
||||
ippDelete(response);
|
||||
|
||||
DEBUG_printf(("5cups_get_printer_uri: Resolved to host=\"%s\", port=%d, resource=\"%s\"", host, *port, resource));
|
||||
|
||||
if (!strncmp(resource, "/classes/", 9))
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No printer-uri found for class"), 1);
|
||||
|
||||
*host = '\0';
|
||||
*resource = '\0';
|
||||
|
||||
DEBUG_puts("5cups_get_printer_uri: Not returning class.");
|
||||
return (0);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
ippDelete(response);
|
||||
}
|
||||
|
||||
if (cupsLastError() != IPP_STATUS_ERROR_NOT_FOUND)
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No printer-uri found"), 1);
|
||||
|
||||
*host = '\0';
|
||||
*resource = '\0';
|
||||
|
||||
DEBUG_puts("5cups_get_printer_uri: Printer URI not found.");
|
||||
return (0);
|
||||
}
|
||||
549
cups/ppd.c
549
cups/ppd.c
File diff suppressed because it is too large
Load Diff
184
cups/ppd.h
184
cups/ppd.h
@ -1,31 +1,29 @@
|
||||
/*
|
||||
* "$Id: ppd.h 7791 2008-07-24 00:55:30Z mike $"
|
||||
* PostScript Printer Description definitions for CUPS.
|
||||
*
|
||||
* PostScript Printer Description definitions for CUPS.
|
||||
* THESE APIS ARE DEPRECATED. TO COMPILE WITHOUT WARNINGS ADD
|
||||
* -D_PPD_DEPRECATED="" TO YOUR COMPILE OPTIONS. THIS HEADER AND THESE
|
||||
* FUNCTIONS WILL BE REMOVED IN A FUTURE RELEASE OF CUPS.
|
||||
*
|
||||
* THESE APIS ARE DEPRECATED. TO COMPILE WITHOUT WARNINGS ADD
|
||||
* -D_PPD_DEPRECATED="" TO YOUR COMPILE OPTIONS. THIS HEADER AND THESE
|
||||
* FUNCTIONS WILL BE REMOVED IN A FUTURE RELEASE OF CUPS.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
*
|
||||
* PostScript is a trademark of Adobe Systems, Inc.
|
||||
* This code and any derivative of it may be used and distributed
|
||||
* freely under the terms of the GNU General Public License when
|
||||
* used with GNU Ghostscript or its derivatives. Use of the code
|
||||
* (or any derivative of it) with software other than GNU
|
||||
* GhostScript (or its derivatives) is governed by the CUPS license
|
||||
* agreement.
|
||||
*
|
||||
* This code and any derivative of it may be used and distributed
|
||||
* freely under the terms of the GNU General Public License when
|
||||
* used with GNU Ghostscript or its derivatives. Use of the code
|
||||
* (or any derivative of it) with software other than GNU
|
||||
* GhostScript (or its derivatives) is governed by the CUPS license
|
||||
* agreement.
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_PPD_H_
|
||||
@ -39,6 +37,7 @@
|
||||
# include "cups.h"
|
||||
# include "array.h"
|
||||
# include "file.h"
|
||||
# include "raster.h"
|
||||
|
||||
|
||||
/*
|
||||
@ -56,19 +55,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_1_6_MSG("Use cupsCopyDestInfo and friends instead.")
|
||||
# endif /* !_PPD_DEPRECATED */
|
||||
|
||||
|
||||
@ -119,7 +106,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/macOS 10.3@ ****/
|
||||
{
|
||||
PPD_OK = 0, /* OK */
|
||||
PPD_FILE_OPEN_ERROR, /* Unable to open PPD file */
|
||||
@ -148,16 +135,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/macOS 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/macOS 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/macOS 10.3@ ****/
|
||||
{
|
||||
char name[PPD_MAX_NAME]; /* Name of attribute (cupsXYZ) */
|
||||
char spec[PPD_MAX_NAME]; /* Specifier string, if any */
|
||||
@ -198,7 +185,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/macOS 10.3@ */
|
||||
int num_options; /* Number of options */
|
||||
ppd_option_t *options; /* Options */
|
||||
int num_subgroups; /* Number of sub-groups */
|
||||
@ -243,8 +230,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/macOS 10.5 ****/
|
||||
typedef enum ppd_cptype_e /**** Custom Parameter Type @since CUPS 1.2/macOS 10.5@ ****/
|
||||
{
|
||||
PPD_CUSTOM_CURVE, /* Curve value for f(x) = x^value */
|
||||
PPD_CUSTOM_INT, /* Integer number value */
|
||||
@ -256,7 +243,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/macOS 10.5@ ****/
|
||||
{
|
||||
float custom_curve; /* Gamma value */
|
||||
int custom_int; /* Integer value */
|
||||
@ -268,7 +255,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/macOS 10.5@ ****/
|
||||
{
|
||||
float custom_curve; /* Gamma value */
|
||||
int custom_int; /* Integer value */
|
||||
@ -280,7 +267,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/macOS 10.5@ ****/
|
||||
{
|
||||
char name[PPD_MAX_NAME]; /* Parameter name */
|
||||
char text[PPD_MAX_TEXT]; /* Human-readable text */
|
||||
@ -291,7 +278,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/macOS 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 +287,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/macOS 10.7@ @private@ ****/
|
||||
|
||||
typedef struct ppd_file_s /**** PPD File ****/
|
||||
{
|
||||
@ -348,25 +335,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/macOS 10.3@ */
|
||||
char *pcfilename; /* PCFileName string @since CUPS 1.1.19/macOS 10.3@ */
|
||||
int num_attrs; /* Number of attributes @since CUPS 1.1.19/macOS 10.3@ @private@ */
|
||||
int cur_attr; /* Current attribute @since CUPS 1.1.19/macOS 10.3@ @private@ */
|
||||
ppd_attr_t **attrs; /* Attributes @since CUPS 1.1.19/macOS 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/macOS 10.5 ****/
|
||||
cups_array_t *sorted_attrs; /* Attribute lookup array @since CUPS 1.2/macOS 10.5@ @private@ */
|
||||
cups_array_t *options; /* Option lookup array @since CUPS 1.2/macOS 10.5@ @private@ */
|
||||
cups_array_t *coptions; /* Custom options array @since CUPS 1.2/macOS 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/macOS 10.5 ****/
|
||||
cups_array_t *marked; /* Marked choices @since CUPS 1.3/macOS 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/macOS 10.6 ****/
|
||||
cups_array_t *cups_uiconstraints; /* cupsUIConstraints @since CUPS 1.4/macOS 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/macOS 10.7@ @private@ */
|
||||
} ppd_file_t;
|
||||
|
||||
|
||||
@ -374,33 +361,44 @@ typedef struct ppd_file_s /**** PPD File ****/
|
||||
* Prototypes...
|
||||
*/
|
||||
|
||||
extern int cupsMarkOptions(ppd_file_t *ppd, int num_options,
|
||||
cups_option_t *options);
|
||||
extern void ppdClose(ppd_file_t *ppd);
|
||||
extern const char *cupsGetPPD(const char *name) _PPD_DEPRECATED;
|
||||
extern const char *cupsGetPPD2(http_t *http, const char *name) _PPD_DEPRECATED;
|
||||
extern http_status_t cupsGetPPD3(http_t *http, const char *name, time_t *modtime, char *buffer, size_t bufsize) _PPD_DEPRECATED;
|
||||
extern char *cupsGetServerPPD(http_t *http, const char *name) _PPD_DEPRECATED;
|
||||
extern int cupsMarkOptions(ppd_file_t *ppd, int num_options, cups_option_t *options) _PPD_DEPRECATED;
|
||||
|
||||
extern void ppdClose(ppd_file_t *ppd) _PPD_DEPRECATED;
|
||||
extern int ppdCollect(ppd_file_t *ppd, ppd_section_t section,
|
||||
ppd_choice_t ***choices);
|
||||
extern int ppdConflicts(ppd_file_t *ppd);
|
||||
ppd_choice_t ***choices) _PPD_DEPRECATED;
|
||||
extern int ppdConflicts(ppd_file_t *ppd) _PPD_DEPRECATED;
|
||||
extern int ppdEmit(ppd_file_t *ppd, FILE *fp,
|
||||
ppd_section_t section);
|
||||
ppd_section_t section) _PPD_DEPRECATED;
|
||||
extern int ppdEmitFd(ppd_file_t *ppd, int fd,
|
||||
ppd_section_t section);
|
||||
ppd_section_t section) _PPD_DEPRECATED;
|
||||
extern int ppdEmitJCL(ppd_file_t *ppd, FILE *fp, int job_id,
|
||||
const char *user, const char *title);
|
||||
extern ppd_choice_t *ppdFindChoice(ppd_option_t *o, const char *option);
|
||||
const char *user, const char *title)
|
||||
_PPD_DEPRECATED;
|
||||
extern ppd_choice_t *ppdFindChoice(ppd_option_t *o, const char *option)
|
||||
_PPD_DEPRECATED;
|
||||
extern ppd_choice_t *ppdFindMarkedChoice(ppd_file_t *ppd,
|
||||
const char *keyword);
|
||||
extern ppd_option_t *ppdFindOption(ppd_file_t *ppd, const char *keyword);
|
||||
const char *keyword)
|
||||
_PPD_DEPRECATED;
|
||||
extern ppd_option_t *ppdFindOption(ppd_file_t *ppd, const char *keyword)
|
||||
_PPD_DEPRECATED;
|
||||
extern int ppdIsMarked(ppd_file_t *ppd, const char *keyword,
|
||||
const char *option);
|
||||
extern void ppdMarkDefaults(ppd_file_t *ppd);
|
||||
const char *option) _PPD_DEPRECATED;
|
||||
extern void ppdMarkDefaults(ppd_file_t *ppd) _PPD_DEPRECATED;
|
||||
extern int ppdMarkOption(ppd_file_t *ppd, const char *keyword,
|
||||
const char *option);
|
||||
extern ppd_file_t *ppdOpen(FILE *fp);
|
||||
extern ppd_file_t *ppdOpenFd(int fd);
|
||||
extern ppd_file_t *ppdOpenFile(const char *filename);
|
||||
extern float ppdPageLength(ppd_file_t *ppd, const char *name);
|
||||
extern ppd_size_t *ppdPageSize(ppd_file_t *ppd, const char *name);
|
||||
extern float ppdPageWidth(ppd_file_t *ppd, const char *name);
|
||||
const char *option) _PPD_DEPRECATED;
|
||||
extern ppd_file_t *ppdOpen(FILE *fp) _PPD_DEPRECATED;
|
||||
extern ppd_file_t *ppdOpenFd(int fd) _PPD_DEPRECATED;
|
||||
extern ppd_file_t *ppdOpenFile(const char *filename) _PPD_DEPRECATED;
|
||||
extern float ppdPageLength(ppd_file_t *ppd, const char *name)
|
||||
_PPD_DEPRECATED;
|
||||
extern ppd_size_t *ppdPageSize(ppd_file_t *ppd, const char *name)
|
||||
_PPD_DEPRECATED;
|
||||
extern float ppdPageWidth(ppd_file_t *ppd, const char *name)
|
||||
_PPD_DEPRECATED;
|
||||
|
||||
/**** New in CUPS 1.1.19 ****/
|
||||
extern const char *ppdErrorString(ppd_status_t status) _PPD_DEPRECATED;
|
||||
@ -414,38 +412,46 @@ extern ppd_status_t ppdLastError(int *line) _PPD_DEPRECATED;
|
||||
extern void ppdSetConformance(ppd_conform_t c) _PPD_DEPRECATED;
|
||||
|
||||
/**** New in CUPS 1.2 ****/
|
||||
extern int cupsRasterInterpretPPD(cups_page_header2_t *h,
|
||||
ppd_file_t *ppd,
|
||||
int num_options,
|
||||
cups_option_t *options,
|
||||
cups_interpret_cb_t func) _PPD_DEPRECATED;
|
||||
extern int ppdCollect2(ppd_file_t *ppd, ppd_section_t section,
|
||||
float min_order, ppd_choice_t ***choices)
|
||||
_PPD_DEPRECATED;
|
||||
extern int ppdEmitAfterOrder(ppd_file_t *ppd, FILE *fp,
|
||||
ppd_section_t section, int limit,
|
||||
float min_order) _PPD_DEPRECATED;
|
||||
extern int ppdEmitJCLEnd(ppd_file_t *ppd, FILE *fp) _PPD_DEPRECATED;
|
||||
extern int ppdEmitJCLEnd(ppd_file_t *ppd, FILE *fp)
|
||||
_PPD_DEPRECATED;
|
||||
extern char *ppdEmitString(ppd_file_t *ppd, ppd_section_t section,
|
||||
float min_order) _PPD_DEPRECATED;
|
||||
extern ppd_coption_t *ppdFindCustomOption(ppd_file_t *ppd,
|
||||
const char *keyword) _PPD_DEPRECATED;
|
||||
const char *keyword)
|
||||
_PPD_DEPRECATED;
|
||||
extern ppd_cparam_t *ppdFindCustomParam(ppd_coption_t *opt,
|
||||
const char *name) _PPD_DEPRECATED;
|
||||
extern ppd_cparam_t *ppdFirstCustomParam(ppd_coption_t *opt) _PPD_DEPRECATED;
|
||||
extern ppd_cparam_t *ppdFirstCustomParam(ppd_coption_t *opt)
|
||||
_PPD_DEPRECATED;
|
||||
extern ppd_option_t *ppdFirstOption(ppd_file_t *ppd) _PPD_DEPRECATED;
|
||||
extern ppd_cparam_t *ppdNextCustomParam(ppd_coption_t *opt) _PPD_DEPRECATED;
|
||||
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/macOS 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/macOS 10.6 ****/
|
||||
extern int cupsGetConflicts(ppd_file_t *ppd, const char *option,
|
||||
const char *choice,
|
||||
cups_option_t **options)
|
||||
_PPD_DEPRECATED;
|
||||
_PPD_DEPRECATED;
|
||||
extern int cupsResolveConflicts(ppd_file_t *ppd,
|
||||
const char *option,
|
||||
const char *choice,
|
||||
@ -455,7 +461,7 @@ extern int cupsResolveConflicts(ppd_file_t *ppd,
|
||||
extern int ppdInstallableConflict(ppd_file_t *ppd,
|
||||
const char *option,
|
||||
const char *choice)
|
||||
_PPD_DEPRECATED;
|
||||
_PPD_DEPRECATED;
|
||||
extern ppd_attr_t *ppdLocalizeAttr(ppd_file_t *ppd, const char *keyword,
|
||||
const char *spec) _PPD_DEPRECATED;
|
||||
extern const char *ppdLocalizeMarkerName(ppd_file_t *ppd,
|
||||
@ -474,7 +480,3 @@ extern int ppdPageSizeLimits(ppd_file_t *ppd,
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
#endif /* !_CUPS_PPD_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: ppd.h 7791 2008-07-24 00:55:30Z mike $".
|
||||
*/
|
||||
|
||||
1506
cups/pwg-media.c
1506
cups/pwg-media.c
File diff suppressed because it is too large
Load Diff
@ -1,17 +1,15 @@
|
||||
/*
|
||||
* "$Id: pwg-private.h 3833 2012-05-23 22:51:18Z msweet $"
|
||||
* Private PWG media API definitions for CUPS.
|
||||
*
|
||||
* Private PWG media API definitions for CUPS.
|
||||
* Copyright 2009-2016 by Apple Inc.
|
||||
*
|
||||
* Copyright 2009-2012 by Apple Inc.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_PWG_PRIVATE_H_
|
||||
@ -34,71 +32,23 @@ extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* Macros...
|
||||
*/
|
||||
|
||||
/* Convert from points to 2540ths */
|
||||
# define _PWG_FROMPTS(n) (int)(((n) * 2540 + 36) / 72)
|
||||
/* Convert from 2540ths to points */
|
||||
# define _PWG_TOPTS(n) ((n) * 72.0 / 2540.0)
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef struct _pwg_map_s /**** Map element - PPD to/from PWG */
|
||||
{
|
||||
char *pwg, /* PWG media keyword */
|
||||
*ppd; /* PPD option keyword */
|
||||
} _pwg_map_t;
|
||||
|
||||
typedef struct _pwg_media_s /**** Common media size data ****/
|
||||
{
|
||||
const char *pwg, /* PWG 5101.1 "self describing" name */
|
||||
*legacy, /* IPP/ISO legacy name */
|
||||
*ppd; /* Standard Adobe PPD name */
|
||||
int width, /* Width in 2540ths */
|
||||
length; /* Length in 2540ths */
|
||||
} _pwg_media_t;
|
||||
|
||||
typedef struct _pwg_size_s /**** Size element - PPD to/from PWG */
|
||||
{
|
||||
_pwg_map_t map; /* Map element */
|
||||
int width, /* Width in 2540ths */
|
||||
length, /* Length in 2540ths */
|
||||
left, /* Left margin in 2540ths */
|
||||
bottom, /* Bottom margin in 2540ths */
|
||||
right, /* Right margin in 2540ths */
|
||||
top; /* Top margin in 2540ths */
|
||||
} _pwg_size_t;
|
||||
|
||||
|
||||
/*
|
||||
* 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,
|
||||
int width, int length);
|
||||
extern int _pwgInitSize(_pwg_size_t *size, ipp_t *job,
|
||||
int *margins_set);
|
||||
extern _pwg_media_t *_pwgMediaForLegacy(const char *legacy);
|
||||
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);
|
||||
int width, int length)
|
||||
_CUPS_INTERNAL_MSG("Use pwgFormatSizeName instead.");
|
||||
extern int _pwgInitSize(pwg_size_t *size, ipp_t *job,
|
||||
int *margins_set)
|
||||
_CUPS_INTERNAL_MSG("Use pwgInitSize instead.");
|
||||
extern const pwg_media_t *_pwgMediaTable(size_t *num_media);
|
||||
extern pwg_media_t *_pwgMediaNearSize(int width, int length, int epsilon);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_PWG_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: pwg-private.h 3833 2012-05-23 22:51:18Z msweet $".
|
||||
*/
|
||||
|
||||
88
cups/pwg.h
Normal file
88
cups/pwg.h
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* PWG media API definitions for CUPS.
|
||||
*
|
||||
* Copyright 2009-2013 by Apple Inc.
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_PWG_H_
|
||||
# define _CUPS_PWG_H_
|
||||
|
||||
|
||||
/*
|
||||
* C++ magic...
|
||||
*/
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* Macros...
|
||||
*/
|
||||
|
||||
/* Convert from points to hundredths of millimeters */
|
||||
# define PWG_FROM_POINTS(n) (int)(((n) * 2540 + 36) / 72)
|
||||
/* Convert from hundredths of millimeters to points */
|
||||
# define PWG_TO_POINTS(n) ((n) * 72.0 / 2540.0)
|
||||
|
||||
|
||||
/*
|
||||
* Types and structures...
|
||||
*/
|
||||
|
||||
typedef struct pwg_map_s /**** Map element - PPD to/from PWG */
|
||||
{
|
||||
char *pwg, /* PWG media keyword */
|
||||
*ppd; /* PPD option keyword */
|
||||
} pwg_map_t;
|
||||
|
||||
typedef struct pwg_media_s /**** Common media size data ****/
|
||||
{
|
||||
const char *pwg, /* PWG 5101.1 "self describing" name */
|
||||
*legacy, /* IPP/ISO legacy name */
|
||||
*ppd; /* Standard Adobe PPD name */
|
||||
int width, /* Width in 2540ths */
|
||||
length; /* Length in 2540ths */
|
||||
} pwg_media_t;
|
||||
|
||||
typedef struct pwg_size_s /**** Size element - PPD to/from PWG */
|
||||
{
|
||||
pwg_map_t map; /* Map element */
|
||||
int width, /* Width in 2540ths */
|
||||
length, /* Length in 2540ths */
|
||||
left, /* Left margin in 2540ths */
|
||||
bottom, /* Bottom margin in 2540ths */
|
||||
right, /* Right margin in 2540ths */
|
||||
top; /* Top margin in 2540ths */
|
||||
} pwg_size_t;
|
||||
|
||||
|
||||
/*
|
||||
* Functions...
|
||||
*/
|
||||
|
||||
extern int pwgFormatSizeName(char *keyword, size_t keysize,
|
||||
const char *prefix, const char *name,
|
||||
int width, int length,
|
||||
const char *units) _CUPS_API_1_7;
|
||||
extern int pwgInitSize(pwg_size_t *size, ipp_t *job,
|
||||
int *margins_set) _CUPS_API_1_7;
|
||||
extern pwg_media_t *pwgMediaForLegacy(const char *legacy) _CUPS_API_1_7;
|
||||
extern pwg_media_t *pwgMediaForPPD(const char *ppd) _CUPS_API_1_7;
|
||||
extern pwg_media_t *pwgMediaForPWG(const char *pwg) _CUPS_API_1_7;
|
||||
extern pwg_media_t *pwgMediaForSize(int width, int length) _CUPS_API_1_7;
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_PWG_H_ */
|
||||
@ -1,18 +1,16 @@
|
||||
/*
|
||||
* "$Id: raster-private.h 3794 2012-04-23 22:44:16Z msweet $"
|
||||
* Private image library definitions for CUPS.
|
||||
*
|
||||
* Private image library definitions for CUPS.
|
||||
* Copyright 2007-2015 by Apple Inc.
|
||||
* Copyright 1993-2006 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2011 by Apple Inc.
|
||||
* Copyright 1993-2006 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_RASTER_PRIVATE_H_
|
||||
@ -60,7 +58,3 @@ extern void _cupsRasterAddError(const char *f, ...)
|
||||
extern void _cupsRasterClearError(void);
|
||||
|
||||
#endif /* !_CUPS_RASTER_PRIVATE_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: raster-private.h 3794 2012-04-23 22:44:16Z msweet $".
|
||||
*/
|
||||
|
||||
121
cups/raster.h
121
cups/raster.h
@ -1,20 +1,18 @@
|
||||
/*
|
||||
* "$Id: raster.h 3794 2012-04-23 22:44:16Z msweet $"
|
||||
* Raster file definitions for CUPS.
|
||||
*
|
||||
* Raster file definitions for CUPS.
|
||||
* Copyright 2007-2016 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2006 by Easy Software Products.
|
||||
* This file is part of the CUPS Imaging library.
|
||||
*
|
||||
* This file is part of the CUPS Imaging library.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
#ifndef _CUPS_RASTER_H_
|
||||
@ -25,7 +23,6 @@
|
||||
*/
|
||||
|
||||
# include "cups.h"
|
||||
# include "ppd.h"
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
@ -57,7 +54,6 @@ extern "C" {
|
||||
|
||||
# define CUPS_RASTER_SYNC_PWG CUPS_RASTER_SYNCv2
|
||||
|
||||
|
||||
/*
|
||||
* The following definition can be used to determine if the
|
||||
* colorimetric colorspaces (CIEXYZ, CIELAB, and ICCn) are
|
||||
@ -79,6 +75,25 @@ extern "C" {
|
||||
|
||||
# define CUPS_RASTER_HAVE_PWGRASTER 1
|
||||
|
||||
/*
|
||||
* The following PWG 5102.4 definitions specify indices into the
|
||||
* cupsInteger[] array in the raster header.
|
||||
*/
|
||||
|
||||
# define CUPS_RASTER_PWG_TotalPageCount 0
|
||||
# define CUPS_RASTER_PWG_CrossFeedTransform 1
|
||||
# define CUPS_RASTER_PWG_FeedTransform 2
|
||||
# define CUPS_RASTER_PWG_ImageBoxLeft 3
|
||||
# define CUPS_RASTER_PWG_ImageBoxTop 4
|
||||
# define CUPS_RASTER_PWG_ImageBoxRight 5
|
||||
# define CUPS_RASTER_PWG_ImageBoxBottom 6
|
||||
# define CUPS_RASTER_PWG_AlternatePrimary 7
|
||||
# define CUPS_RASTER_PWG_PrintQuality 8
|
||||
# define CUPS_RASTER_PWG_VendorIdentifier 14
|
||||
# define CUPS_RASTER_PWG_VendorLength 15
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Types...
|
||||
@ -117,28 +132,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/macOS 10.3@ */
|
||||
CUPS_CSPACE_CIELab = 16, /* CIE Lab @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white (DeviceRGB, sRGB by default) @since CUPS 1.2/macOS 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/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICC2 = 33, /* ICC-based, 2 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICC3 = 34, /* ICC-based, 3 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICC4 = 35, /* ICC-based, 4 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICC5 = 36, /* ICC-based, 5 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICC6 = 37, /* ICC-based, 6 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICC7 = 38, /* ICC-based, 7 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICC8 = 39, /* ICC-based, 8 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICC9 = 40, /* ICC-based, 9 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICCA = 41, /* ICC-based, 10 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICCB = 42, /* ICC-based, 11 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICCC = 43, /* ICC-based, 12 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICCD = 44, /* ICC-based, 13 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICCE = 45, /* ICC-based, 14 colors @since CUPS 1.1.19/macOS 10.3@ */
|
||||
CUPS_CSPACE_ICCF = 46, /* ICC-based, 15 colors @since CUPS 1.1.19/macOS 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 +201,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/macOS 10.5@ */
|
||||
CUPS_RASTER_WRITE_PWG = 3 /* Open stream for compressed writing in PWG mode @since CUPS 1.5/macOS 10.7@ */
|
||||
};
|
||||
|
||||
typedef enum cups_mode_e cups_mode_t; /**** cupsRasterOpen modes ****/
|
||||
@ -266,7 +281,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/macOS 10.5@ ****/
|
||||
{
|
||||
/**** Standard Page Device Dictionary String Values ****/
|
||||
char MediaClass[64]; /* MediaClass string */
|
||||
@ -314,20 +329,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/macOS 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/macOS 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/macOS 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/macOS 10.5@ */
|
||||
unsigned cupsInteger[16]; /* User-defined integer values @since CUPS 1.2/macOS 10.5@ */
|
||||
float cupsReal[16]; /* User-defined floating-point values @since CUPS 1.2/macOS 10.5@ */
|
||||
char cupsString[16][64]; /* User-defined string values @since CUPS 1.2/macOS 10.5@ */
|
||||
char cupsMarkerType[64]; /* Ink/toner type @since CUPS 1.2/macOS 10.5@ */
|
||||
char cupsRenderingIntent[64];/* Color rendering intent @since CUPS 1.2/macOS 10.5@ */
|
||||
char cupsPageSizeName[64]; /* PageSize name @since CUPS 1.2/macOS 10.5@ */
|
||||
} cups_page_header2_t;
|
||||
|
||||
typedef struct _cups_raster_s cups_raster_t;
|
||||
@ -368,20 +383,15 @@ typedef ssize_t (*cups_raster_iocb_t)(void *ctx, unsigned char *buffer, size_t l
|
||||
extern void cupsRasterClose(cups_raster_t *r);
|
||||
extern cups_raster_t *cupsRasterOpen(int fd, cups_mode_t mode);
|
||||
extern unsigned cupsRasterReadHeader(cups_raster_t *r,
|
||||
cups_page_header_t *h) _CUPS_DEPRECATED;
|
||||
cups_page_header_t *h) _CUPS_DEPRECATED_MSG("Use cupsRasterReadHeader2 instead.");
|
||||
extern unsigned cupsRasterReadPixels(cups_raster_t *r,
|
||||
unsigned char *p, unsigned len);
|
||||
extern unsigned cupsRasterWriteHeader(cups_raster_t *r,
|
||||
cups_page_header_t *h) _CUPS_DEPRECATED;
|
||||
cups_page_header_t *h) _CUPS_DEPRECATED_MSG("Use cupsRasterWriteHeader2 instead.");
|
||||
extern unsigned cupsRasterWritePixels(cups_raster_t *r,
|
||||
unsigned char *p, unsigned len);
|
||||
|
||||
/**** New in CUPS 1.2 ****/
|
||||
extern int cupsRasterInterpretPPD(cups_page_header2_t *h,
|
||||
ppd_file_t *ppd,
|
||||
int num_options,
|
||||
cups_option_t *options,
|
||||
cups_interpret_cb_t func) _CUPS_API_1_2;
|
||||
extern unsigned cupsRasterReadHeader2(cups_raster_t *r,
|
||||
cups_page_header2_t *h) _CUPS_API_1_2;
|
||||
extern unsigned cupsRasterWriteHeader2(cups_raster_t *r,
|
||||
@ -394,12 +404,11 @@ extern const char *cupsRasterErrorString(void) _CUPS_API_1_3;
|
||||
extern cups_raster_t *cupsRasterOpenIO(cups_raster_iocb_t iocb, void *ctx,
|
||||
cups_mode_t mode);
|
||||
|
||||
/**** New in CUPS 2.2/macOS 10.12 ****/
|
||||
extern int cupsRasterInitPWGHeader(cups_page_header2_t *h, pwg_media_t *media, const char *type, int xdpi, int ydpi, const char *sides, const char *sheet_back) _CUPS_API_2_2;
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif /* __cplusplus */
|
||||
|
||||
#endif /* !_CUPS_RASTER_H_ */
|
||||
|
||||
/*
|
||||
* End of "$Id: raster.h 3794 2012-04-23 22:44:16Z msweet $".
|
||||
*/
|
||||
|
||||
388
cups/request.c
388
cups/request.c
@ -1,34 +1,16 @@
|
||||
/*
|
||||
* "$Id: request.c 7946 2008-09-16 23:27:54Z mike $"
|
||||
* IPP utilities for CUPS.
|
||||
*
|
||||
* IPP utilities for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 1997-2007 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsDoFileRequest() - Do an IPP request with a file.
|
||||
* cupsDoIORequest() - Do an IPP request with file descriptors.
|
||||
* cupsDoRequest() - Do an IPP request.
|
||||
* cupsGetResponse() - Get a response to an IPP request.
|
||||
* cupsLastError() - Return the last IPP status code.
|
||||
* cupsLastErrorString() - Return the last IPP status-message.
|
||||
* _cupsNextDelay() - Return the next retry delay value.
|
||||
* cupsReadResponseData() - Read additional data after the IPP response.
|
||||
* cupsSendRequest() - Send an IPP request.
|
||||
* cupsWriteRequestData() - Write additional data after an IPP request.
|
||||
* _cupsConnect() - Get the default server connection...
|
||||
* _cupsSetError() - Set the last IPP status code and status-message.
|
||||
* _cupsSetHTTPError() - Set the last error using the HTTP status.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -46,6 +28,9 @@
|
||||
#ifndef O_BINARY
|
||||
# define O_BINARY 0
|
||||
#endif /* O_BINARY */
|
||||
#ifndef MSG_DONTWAIT
|
||||
# define MSG_DONTWAIT 0
|
||||
#endif /* !MSG_DONTWAIT */
|
||||
|
||||
|
||||
/*
|
||||
@ -66,10 +51,7 @@ cupsDoFileRequest(http_t *http, /* I - Connection to server or @code CUPS_HT
|
||||
int infile; /* Input file */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsDoFileRequest(http=%p, request=%p(%s), resource=\"%s\", "
|
||||
"filename=\"%s\")", http, request,
|
||||
request ? ippOpString(request->request.op.operation_id) : "?",
|
||||
resource, filename));
|
||||
DEBUG_printf(("cupsDoFileRequest(http=%p, request=%p(%s), resource=\"%s\", filename=\"%s\")", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource, filename));
|
||||
|
||||
if (filename)
|
||||
{
|
||||
@ -79,7 +61,7 @@ cupsDoFileRequest(http_t *http, /* I - Connection to server or @code CUPS_HT
|
||||
* Can't get file information!
|
||||
*/
|
||||
|
||||
_cupsSetError(errno == ENOENT ? IPP_NOT_FOUND : IPP_NOT_AUTHORIZED,
|
||||
_cupsSetError(errno == ENOENT ? IPP_STATUS_ERROR_NOT_FOUND : IPP_STATUS_ERROR_NOT_AUTHORIZED,
|
||||
NULL, 0);
|
||||
|
||||
ippDelete(request);
|
||||
@ -112,7 +94,7 @@ cupsDoFileRequest(http_t *http, /* I - Connection to server or @code CUPS_HT
|
||||
* If "outfile" is a valid file descriptor, @code 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/macOS 10.5@
|
||||
*/
|
||||
|
||||
ipp_t * /* O - Response data */
|
||||
@ -126,14 +108,11 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
size_t length = 0; /* Content-Length value */
|
||||
http_status_t status; /* Status of HTTP request */
|
||||
struct stat fileinfo; /* File information */
|
||||
int bytes; /* Number of bytes read/written */
|
||||
ssize_t bytes; /* Number of bytes read/written */
|
||||
char buffer[32768]; /* Output buffer */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsDoIORequest(http=%p, request=%p(%s), resource=\"%s\", "
|
||||
"infile=%d, outfile=%d)", http, request,
|
||||
request ? ippOpString(request->request.op.operation_id) : "?",
|
||||
resource, infile, outfile));
|
||||
DEBUG_printf(("cupsDoIORequest(http=%p, request=%p(%s), resource=\"%s\", infile=%d, outfile=%d)", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource, infile, outfile));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -143,7 +122,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
{
|
||||
ippDelete(request);
|
||||
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
@ -172,7 +151,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Can't get file information!
|
||||
*/
|
||||
|
||||
_cupsSetError(errno == EBADF ? IPP_NOT_FOUND : IPP_NOT_AUTHORIZED,
|
||||
_cupsSetError(errno == EBADF ? IPP_STATUS_ERROR_NOT_FOUND : IPP_STATUS_ERROR_NOT_AUTHORIZED,
|
||||
NULL, 0);
|
||||
|
||||
ippDelete(request);
|
||||
@ -192,7 +171,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
ippDelete(request);
|
||||
|
||||
_cupsSetError(IPP_NOT_POSSIBLE, strerror(EISDIR), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_NOT_POSSIBLE, strerror(EISDIR), 0);
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
@ -202,7 +181,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
length = 0; /* Chunk when piping */
|
||||
else
|
||||
#endif /* !WIN32 */
|
||||
length = ippLength(request) + fileinfo.st_size;
|
||||
length = ippLength(request) + (size_t)fileinfo.st_size;
|
||||
}
|
||||
else
|
||||
length = ippLength(request);
|
||||
@ -233,7 +212,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
DEBUG_printf(("2cupsDoIORequest: status=%d", status));
|
||||
|
||||
if (status == HTTP_CONTINUE && request->state == IPP_DATA && infile >= 0)
|
||||
if (status == HTTP_STATUS_CONTINUE && request->state == IPP_STATE_DATA && infile >= 0)
|
||||
{
|
||||
DEBUG_puts("2cupsDoIORequest: file write...");
|
||||
|
||||
@ -246,10 +225,10 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
#endif /* WIN32 */
|
||||
lseek(infile, 0, SEEK_SET);
|
||||
|
||||
while ((bytes = (int)read(infile, buffer, sizeof(buffer))) > 0)
|
||||
while ((bytes = read(infile, buffer, sizeof(buffer))) > 0)
|
||||
{
|
||||
if ((status = cupsWriteRequestData(http, buffer, bytes))
|
||||
!= HTTP_CONTINUE)
|
||||
if ((status = cupsWriteRequestData(http, buffer, (size_t)bytes))
|
||||
!= HTTP_STATUS_CONTINUE)
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -258,7 +237,7 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Get the server's response...
|
||||
*/
|
||||
|
||||
if (status != HTTP_ERROR)
|
||||
if (status <= HTTP_STATUS_CONTINUE || status == HTTP_STATUS_OK)
|
||||
{
|
||||
response = cupsGetResponse(http, resource);
|
||||
status = httpGetStatus(http);
|
||||
@ -266,9 +245,9 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
DEBUG_printf(("2cupsDoIORequest: status=%d", status));
|
||||
|
||||
if (status == HTTP_ERROR ||
|
||||
(status >= HTTP_BAD_REQUEST && status != HTTP_UNAUTHORIZED &&
|
||||
status != HTTP_UPGRADE_REQUIRED))
|
||||
if (status == HTTP_STATUS_ERROR ||
|
||||
(status >= HTTP_STATUS_BAD_REQUEST && status != HTTP_STATUS_UNAUTHORIZED &&
|
||||
status != HTTP_STATUS_UPGRADE_REQUIRED))
|
||||
{
|
||||
_cupsSetHTTPError(status);
|
||||
break;
|
||||
@ -280,12 +259,12 @@ cupsDoIORequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Write trailing data to file...
|
||||
*/
|
||||
|
||||
while ((bytes = (int)httpRead2(http, buffer, sizeof(buffer))) > 0)
|
||||
if (write(outfile, buffer, bytes) < bytes)
|
||||
while ((bytes = httpRead2(http, buffer, sizeof(buffer))) > 0)
|
||||
if (write(outfile, buffer, (size_t)bytes) < bytes)
|
||||
break;
|
||||
}
|
||||
|
||||
if (http->state != HTTP_WAITING)
|
||||
if (http->state != HTTP_STATE_WAITING)
|
||||
{
|
||||
/*
|
||||
* Flush any remaining data...
|
||||
@ -317,10 +296,7 @@ cupsDoRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
ipp_t *request, /* I - IPP request */
|
||||
const char *resource) /* I - HTTP resource for POST */
|
||||
{
|
||||
DEBUG_printf(("cupsDoRequest(http=%p, request=%p(%s), resource=\"%s\")",
|
||||
http, request,
|
||||
request ? ippOpString(request->request.op.operation_id) : "?",
|
||||
resource));
|
||||
DEBUG_printf(("cupsDoRequest(http=%p, request=%p(%s), resource=\"%s\")", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource));
|
||||
|
||||
return (cupsDoIORequest(http, request, resource, -1, -1));
|
||||
}
|
||||
@ -334,7 +310,7 @@ cupsDoRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
|
||||
* @link cupsReadResponseData@ after getting a successful response,
|
||||
* otherwise call @link httpFlush@ to complete the response processing.
|
||||
*
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
* @since CUPS 1.4/macOS 10.6@
|
||||
*/
|
||||
|
||||
ipp_t * /* O - Response or @code NULL@ on HTTP error */
|
||||
@ -346,23 +322,38 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
ipp_t *response = NULL; /* IPP response */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsGetResponse(http=%p, resource=\"%s\")", http, resource));
|
||||
DEBUG_printf(("cupsGetResponse(http=%p, resource=\"%s\")", (void *)http, resource));
|
||||
DEBUG_printf(("1cupsGetResponse: http->state=%d", http ? http->state : HTTP_STATE_ERROR));
|
||||
|
||||
/*
|
||||
* Connect to the default server as needed...
|
||||
*/
|
||||
|
||||
if (!http)
|
||||
http = _cupsConnect();
|
||||
{
|
||||
_cups_globals_t *cg = _cupsGlobals();
|
||||
/* Pointer to library globals */
|
||||
|
||||
if (!http || (http->state != HTTP_POST_RECV && http->state != HTTP_POST_SEND))
|
||||
if ((http = cg->http) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No active connection."), 1);
|
||||
DEBUG_puts("1cupsGetResponse: No active connection - returning NULL.");
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
if (http->state != HTTP_STATE_POST_RECV && http->state != HTTP_STATE_POST_SEND)
|
||||
{
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No request sent."), 1);
|
||||
DEBUG_puts("1cupsGetResponse: Not in POST state - returning NULL.");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for an unfinished chunked request...
|
||||
*/
|
||||
|
||||
if (http->data_encoding == HTTP_ENCODE_CHUNKED)
|
||||
if (http->data_encoding == HTTP_ENCODING_CHUNKED)
|
||||
{
|
||||
/*
|
||||
* Send a 0-length chunk to finish off the request...
|
||||
@ -385,11 +376,11 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
{
|
||||
status = httpUpdate(http);
|
||||
}
|
||||
while (status != HTTP_ERROR && http->state == HTTP_POST_RECV);
|
||||
while (status == HTTP_STATUS_CONTINUE);
|
||||
|
||||
DEBUG_printf(("2cupsGetResponse: status=%d", status));
|
||||
|
||||
if (status == HTTP_OK)
|
||||
if (status == HTTP_STATUS_OK)
|
||||
{
|
||||
/*
|
||||
* Get the IPP response...
|
||||
@ -397,11 +388,11 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
response = ippNew();
|
||||
|
||||
while ((state = ippRead(http, response)) != IPP_DATA)
|
||||
if (state == IPP_ERROR)
|
||||
while ((state = ippRead(http, response)) != IPP_STATE_DATA)
|
||||
if (state == IPP_STATE_ERROR)
|
||||
break;
|
||||
|
||||
if (state == IPP_ERROR)
|
||||
if (state == IPP_STATE_ERROR)
|
||||
{
|
||||
/*
|
||||
* Flush remaining data and delete the response...
|
||||
@ -414,11 +405,11 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
ippDelete(response);
|
||||
response = NULL;
|
||||
|
||||
http->status = status = HTTP_ERROR;
|
||||
http->status = status = HTTP_STATUS_ERROR;
|
||||
http->error = EINVAL;
|
||||
}
|
||||
}
|
||||
else if (status != HTTP_ERROR)
|
||||
else if (status != HTTP_STATUS_ERROR)
|
||||
{
|
||||
/*
|
||||
* Flush any error message...
|
||||
@ -430,7 +421,7 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Then handle encryption and authentication...
|
||||
*/
|
||||
|
||||
if (status == HTTP_UNAUTHORIZED)
|
||||
if (status == HTTP_STATUS_UNAUTHORIZED)
|
||||
{
|
||||
/*
|
||||
* See if we can do authentication...
|
||||
@ -439,13 +430,13 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
DEBUG_puts("2cupsGetResponse: Need authorization...");
|
||||
|
||||
if (!cupsDoAuthentication(http, "POST", resource))
|
||||
httpReconnect(http);
|
||||
httpReconnect2(http, 30000, NULL);
|
||||
else
|
||||
http->status = status = HTTP_AUTHORIZATION_CANCELED;
|
||||
http->status = status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
else if (status == HTTP_UPGRADE_REQUIRED)
|
||||
else if (status == HTTP_STATUS_UPGRADE_REQUIRED)
|
||||
{
|
||||
/*
|
||||
* Force a reconnect with encryption...
|
||||
@ -453,8 +444,8 @@ cupsGetResponse(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
DEBUG_puts("2cupsGetResponse: Need encryption...");
|
||||
|
||||
if (!httpReconnect(http))
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
|
||||
if (!httpReconnect2(http, 30000, NULL))
|
||||
httpEncryption(http, HTTP_ENCRYPTION_REQUIRED);
|
||||
}
|
||||
#endif /* HAVE_SSL */
|
||||
}
|
||||
@ -495,7 +486,7 @@ cupsLastError(void)
|
||||
* 'cupsLastErrorString()' - Return the last IPP status-message received on the
|
||||
* current thread.
|
||||
*
|
||||
* @since CUPS 1.2/OS X 10.5@
|
||||
* @since CUPS 1.2/macOS 10.5@
|
||||
*/
|
||||
|
||||
const char * /* O - status-message text from last request */
|
||||
@ -542,7 +533,7 @@ _cupsNextDelay(int current, /* I - Current delay value or 0 */
|
||||
* files from @code CUPS_GET_PPD@ and @code CUPS_GET_DOCUMENT@ requests,
|
||||
* respectively.
|
||||
*
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
* @since CUPS 1.4/macOS 10.6@
|
||||
*/
|
||||
|
||||
ssize_t /* O - Bytes read, 0 on EOF, -1 on error */
|
||||
@ -555,8 +546,7 @@ cupsReadResponseData(
|
||||
* Get the default connection as needed...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsReadResponseData(http=%p, buffer=%p, "
|
||||
"length=" CUPS_LLFMT ")", http, buffer, CUPS_LLCAST length));
|
||||
DEBUG_printf(("cupsReadResponseData(http=%p, buffer=%p, length=" CUPS_LLFMT ")", (void *)http, (void *)buffer, CUPS_LLCAST length));
|
||||
|
||||
if (!http)
|
||||
{
|
||||
@ -565,7 +555,7 @@ cupsReadResponseData(
|
||||
|
||||
if ((http = cg->http) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("No active connection"), 1);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No active connection"), 1);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
@ -587,13 +577,13 @@ cupsReadResponseData(
|
||||
* response. Only one request can be sent/queued at a time per @code http_t@
|
||||
* connection.
|
||||
*
|
||||
* Returns the initial HTTP status code, which will be @code HTTP_CONTINUE@
|
||||
* Returns the initial HTTP status code, which will be @code HTTP_STATUS_CONTINUE@
|
||||
* on a successful send of the request.
|
||||
*
|
||||
* Note: Unlike @link cupsDoFileRequest@, @link cupsDoIORequest@, and
|
||||
* @link cupsDoRequest@, the request is NOT freed with @link ippDelete@.
|
||||
*
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
* @since CUPS 1.4/macOS 10.6@
|
||||
*/
|
||||
|
||||
http_status_t /* O - Initial HTTP status */
|
||||
@ -602,16 +592,13 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
const char *resource, /* I - Resource path */
|
||||
size_t length) /* I - Length of data to follow or @code CUPS_LENGTH_VARIABLE@ */
|
||||
{
|
||||
http_status_t status; /* Status of HTTP request */
|
||||
int got_status; /* Did we get the status? */
|
||||
ipp_state_t state; /* State of IPP processing */
|
||||
http_status_t expect; /* Expect: header to use */
|
||||
http_status_t status; /* Status of HTTP request */
|
||||
int got_status; /* Did we get the status? */
|
||||
ipp_state_t state; /* State of IPP processing */
|
||||
http_status_t expect; /* Expect: header to use */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", "
|
||||
"length=" CUPS_LLFMT ")", http, request,
|
||||
request ? ippOpString(request->request.op.operation_id) : "?",
|
||||
resource, CUPS_LLCAST length));
|
||||
DEBUG_printf(("cupsSendRequest(http=%p, request=%p(%s), resource=\"%s\", length=" CUPS_LLFMT ")", (void *)http, (void *)request, request ? ippOpString(request->request.op.operation_id) : "?", resource, CUPS_LLCAST length));
|
||||
|
||||
/*
|
||||
* Range check input...
|
||||
@ -619,9 +606,9 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
if (!request || !resource)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
|
||||
|
||||
return (HTTP_ERROR);
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -630,24 +617,24 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
if (!http)
|
||||
if ((http = _cupsConnect()) == NULL)
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
|
||||
/*
|
||||
* If the prior request was not flushed out, do so now...
|
||||
*/
|
||||
|
||||
if (http->state == HTTP_GET_SEND ||
|
||||
http->state == HTTP_POST_SEND)
|
||||
if (http->state == HTTP_STATE_GET_SEND ||
|
||||
http->state == HTTP_STATE_POST_SEND)
|
||||
{
|
||||
DEBUG_puts("2cupsSendRequest: Flush prior response.");
|
||||
httpFlush(http);
|
||||
}
|
||||
else if (http->state != HTTP_WAITING)
|
||||
else if (http->state != HTTP_STATE_WAITING)
|
||||
{
|
||||
DEBUG_printf(("1cupsSendRequest: Unknown HTTP state (%d), "
|
||||
"reconnecting.", http->state));
|
||||
if (httpReconnect(http))
|
||||
return (HTTP_ERROR);
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
@ -659,10 +646,10 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
if (ippFindAttribute(request, "auth-info", IPP_TAG_TEXT) &&
|
||||
!httpAddrLocalhost(http->hostaddr) && !http->tls &&
|
||||
httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
|
||||
httpEncryption(http, HTTP_ENCRYPTION_REQUIRED))
|
||||
{
|
||||
DEBUG_puts("1cupsSendRequest: Unable to encrypt connection.");
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
@ -674,10 +661,10 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
{
|
||||
DEBUG_puts("2cupsSendRequest: Connection: close");
|
||||
httpClearFields(http);
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,7 +672,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Loop until we can send the request without authorization problems.
|
||||
*/
|
||||
|
||||
expect = HTTP_CONTINUE;
|
||||
expect = HTTP_STATUS_CONTINUE;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
@ -725,10 +712,10 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
if (httpPost(http, resource))
|
||||
{
|
||||
DEBUG_puts("2cupsSendRequest: POST failed, reconnecting.");
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
@ -740,30 +727,44 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
DEBUG_puts("2cupsSendRequest: Writing IPP request...");
|
||||
|
||||
request->state = IPP_IDLE;
|
||||
status = HTTP_CONTINUE;
|
||||
request->state = IPP_STATE_IDLE;
|
||||
status = HTTP_STATUS_CONTINUE;
|
||||
got_status = 0;
|
||||
|
||||
while ((state = ippWrite(http, request)) != IPP_DATA)
|
||||
if (state == IPP_ERROR)
|
||||
break;
|
||||
else if (httpCheck(http))
|
||||
while ((state = ippWrite(http, request)) != IPP_STATE_DATA)
|
||||
{
|
||||
if (httpCheck(http))
|
||||
{
|
||||
got_status = 1;
|
||||
|
||||
_httpUpdate(http, &status);
|
||||
if (status >= HTTP_MULTIPLE_CHOICES)
|
||||
if (status >= HTTP_STATUS_MULTIPLE_CHOICES)
|
||||
break;
|
||||
}
|
||||
else if (state == IPP_STATE_ERROR)
|
||||
break;
|
||||
}
|
||||
|
||||
if (state == IPP_ERROR)
|
||||
if (state == IPP_STATE_ERROR)
|
||||
{
|
||||
DEBUG_puts("1cupsSendRequest: Unable to send IPP request.");
|
||||
/*
|
||||
* We weren't able to send the IPP request. But did we already get a HTTP
|
||||
* error status?
|
||||
*/
|
||||
|
||||
http->status = HTTP_ERROR;
|
||||
http->state = HTTP_WAITING;
|
||||
if (!got_status || status < HTTP_STATUS_MULTIPLE_CHOICES)
|
||||
{
|
||||
/*
|
||||
* No, something else went wrong.
|
||||
*/
|
||||
|
||||
return (HTTP_ERROR);
|
||||
DEBUG_puts("1cupsSendRequest: Unable to send IPP request.");
|
||||
|
||||
http->status = HTTP_STATUS_ERROR;
|
||||
http->state = HTTP_STATE_WAITING;
|
||||
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -772,7 +773,7 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
|
||||
if (!got_status)
|
||||
{
|
||||
if (expect == HTTP_CONTINUE)
|
||||
if (expect == HTTP_STATUS_CONTINUE)
|
||||
{
|
||||
DEBUG_puts("2cupsSendRequest: Waiting for 100-continue...");
|
||||
|
||||
@ -789,69 +790,72 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
* Process the current HTTP status...
|
||||
*/
|
||||
|
||||
if (status >= HTTP_MULTIPLE_CHOICES)
|
||||
if (status >= HTTP_STATUS_MULTIPLE_CHOICES)
|
||||
{
|
||||
int temp_status; /* Temporary status */
|
||||
|
||||
_cupsSetHTTPError(status);
|
||||
|
||||
do
|
||||
{
|
||||
status = httpUpdate(http);
|
||||
temp_status = httpUpdate(http);
|
||||
}
|
||||
while (status != HTTP_ERROR && http->state == HTTP_POST_RECV);
|
||||
while (temp_status != HTTP_STATUS_ERROR &&
|
||||
http->state == HTTP_STATE_POST_RECV);
|
||||
|
||||
httpFlush(http);
|
||||
}
|
||||
|
||||
switch (status)
|
||||
{
|
||||
case HTTP_ERROR :
|
||||
case HTTP_CONTINUE :
|
||||
case HTTP_OK :
|
||||
case HTTP_STATUS_CONTINUE :
|
||||
case HTTP_STATUS_OK :
|
||||
case HTTP_STATUS_ERROR :
|
||||
DEBUG_printf(("1cupsSendRequest: Returning %d.", status));
|
||||
return (status);
|
||||
|
||||
case HTTP_UNAUTHORIZED :
|
||||
case HTTP_STATUS_UNAUTHORIZED :
|
||||
if (cupsDoAuthentication(http, "POST", resource))
|
||||
{
|
||||
DEBUG_puts("1cupsSendRequest: Returning HTTP_AUTHORIZATION_CANCELED.");
|
||||
return (HTTP_AUTHORIZATION_CANCELED);
|
||||
DEBUG_puts("1cupsSendRequest: Returning HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED.");
|
||||
return (HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED);
|
||||
}
|
||||
|
||||
DEBUG_puts("2cupsSendRequest: Reconnecting after HTTP_UNAUTHORIZED.");
|
||||
DEBUG_puts("2cupsSendRequest: Reconnecting after HTTP_STATUS_UNAUTHORIZED.");
|
||||
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
break;
|
||||
|
||||
#ifdef HAVE_SSL
|
||||
case HTTP_UPGRADE_REQUIRED :
|
||||
case HTTP_STATUS_UPGRADE_REQUIRED :
|
||||
/*
|
||||
* Flush any error message, reconnect, and then upgrade with
|
||||
* encryption...
|
||||
*/
|
||||
|
||||
DEBUG_puts("2cupsSendRequest: Reconnecting after "
|
||||
"HTTP_UPGRADE_REQUIRED.");
|
||||
"HTTP_STATUS_UPGRADE_REQUIRED.");
|
||||
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
|
||||
DEBUG_puts("2cupsSendRequest: Upgrading to TLS.");
|
||||
if (httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
|
||||
if (httpEncryption(http, HTTP_ENCRYPTION_REQUIRED))
|
||||
{
|
||||
DEBUG_puts("1cupsSendRequest: Unable to encrypt connection.");
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
break;
|
||||
#endif /* HAVE_SSL */
|
||||
|
||||
case HTTP_EXPECTATION_FAILED :
|
||||
case HTTP_STATUS_EXPECTATION_FAILED :
|
||||
/*
|
||||
* Don't try using the Expect: header the next time around...
|
||||
*/
|
||||
@ -861,10 +865,10 @@ cupsSendRequest(http_t *http, /* I - Connection to server or @code CUPS_HTTP
|
||||
DEBUG_puts("2cupsSendRequest: Reconnecting after "
|
||||
"HTTP_EXPECTATION_FAILED.");
|
||||
|
||||
if (httpReconnect(http))
|
||||
if (httpReconnect2(http, 30000, NULL))
|
||||
{
|
||||
DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
|
||||
return (HTTP_SERVICE_UNAVAILABLE);
|
||||
return (HTTP_STATUS_SERVICE_UNAVAILABLE);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -885,10 +889,10 @@ 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/macOS 10.6@
|
||||
*/
|
||||
|
||||
http_status_t /* O - @code HTTP_CONTINUE@ if OK or HTTP status on error */
|
||||
http_status_t /* O - @code HTTP_STATUS_CONTINUE@ if OK or HTTP status on error */
|
||||
cupsWriteRequestData(
|
||||
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
|
||||
const char *buffer, /* I - Bytes to write */
|
||||
@ -901,8 +905,7 @@ cupsWriteRequestData(
|
||||
* Get the default connection as needed...
|
||||
*/
|
||||
|
||||
DEBUG_printf(("cupsWriteRequestData(http=%p, buffer=%p, "
|
||||
"length=" CUPS_LLFMT ")", http, buffer, CUPS_LLCAST length));
|
||||
DEBUG_printf(("cupsWriteRequestData(http=%p, buffer=%p, length=" CUPS_LLFMT ")", (void *)http, (void *)buffer, CUPS_LLCAST length));
|
||||
|
||||
if (!http)
|
||||
{
|
||||
@ -911,9 +914,9 @@ cupsWriteRequestData(
|
||||
|
||||
if ((http = cg->http) == NULL)
|
||||
{
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, _("No active connection"), 1);
|
||||
DEBUG_puts("1cupsWriteRequestData: Returning HTTP_ERROR.");
|
||||
return (HTTP_ERROR);
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No active connection"), 1);
|
||||
DEBUG_puts("1cupsWriteRequestData: Returning HTTP_STATUS_ERROR.");
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@ -925,9 +928,9 @@ cupsWriteRequestData(
|
||||
|
||||
if (httpWrite2(http, buffer, length) < 0)
|
||||
{
|
||||
DEBUG_puts("1cupsWriteRequestData: Returning HTTP_ERROR.");
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(http->error), 0);
|
||||
return (HTTP_ERROR);
|
||||
DEBUG_puts("1cupsWriteRequestData: Returning HTTP_STATUS_ERROR.");
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(http->error), 0);
|
||||
return (HTTP_STATUS_ERROR);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -936,7 +939,7 @@ cupsWriteRequestData(
|
||||
|
||||
if (length >= HTTP_MAX_BUFFER ||
|
||||
http->wused < wused ||
|
||||
(wused > 0 && http->wused == length))
|
||||
(wused > 0 && (size_t)http->wused == length))
|
||||
{
|
||||
/*
|
||||
* We've written something to the server, so check for response data...
|
||||
@ -947,7 +950,7 @@ cupsWriteRequestData(
|
||||
http_status_t status; /* Status from _httpUpdate */
|
||||
|
||||
_httpUpdate(http, &status);
|
||||
if (status >= HTTP_MULTIPLE_CHOICES)
|
||||
if (status >= HTTP_STATUS_MULTIPLE_CHOICES)
|
||||
{
|
||||
_cupsSetHTTPError(status);
|
||||
|
||||
@ -955,7 +958,7 @@ cupsWriteRequestData(
|
||||
{
|
||||
status = httpUpdate(http);
|
||||
}
|
||||
while (status != HTTP_ERROR && http->state == HTTP_POST_RECV);
|
||||
while (status != HTTP_STATUS_ERROR && http->state == HTTP_STATE_POST_RECV);
|
||||
|
||||
httpFlush(http);
|
||||
}
|
||||
@ -965,8 +968,8 @@ cupsWriteRequestData(
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_puts("1cupsWriteRequestData: Returning HTTP_CONTINUE.");
|
||||
return (HTTP_CONTINUE);
|
||||
DEBUG_puts("1cupsWriteRequestData: Returning HTTP_STATUS_CONTINUE.");
|
||||
return (HTTP_STATUS_CONTINUE);
|
||||
}
|
||||
|
||||
|
||||
@ -993,9 +996,9 @@ _cupsConnect(void)
|
||||
*/
|
||||
|
||||
if (strcmp(cg->http->hostname, cg->server) ||
|
||||
cg->ipp_port != _httpAddrPort(cg->http->hostaddr) ||
|
||||
cg->ipp_port != httpAddrPort(cg->http->hostaddr) ||
|
||||
(cg->http->encryption != cg->encryption &&
|
||||
cg->http->encryption == HTTP_ENCRYPT_NEVER))
|
||||
cg->http->encryption == HTTP_ENCRYPTION_NEVER))
|
||||
{
|
||||
/*
|
||||
* Need to close the current connection because something has changed...
|
||||
@ -1010,10 +1013,16 @@ _cupsConnect(void)
|
||||
* Same server, see if the connection is still established...
|
||||
*/
|
||||
|
||||
char ch; /* Connection check byte */
|
||||
char ch; /* Connection check byte */
|
||||
ssize_t n; /* Number of bytes */
|
||||
|
||||
if (recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) < 0 &&
|
||||
errno != EWOULDBLOCK)
|
||||
#ifdef WIN32
|
||||
if ((n = recv(cg->http->fd, &ch, 1, MSG_PEEK)) == 0 ||
|
||||
(n < 0 && WSAGetLastError() != WSAEWOULDBLOCK))
|
||||
#else
|
||||
if ((n = recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT)) == 0 ||
|
||||
(n < 0 && errno != EWOULDBLOCK))
|
||||
#endif /* WIN32 */
|
||||
{
|
||||
/*
|
||||
* Nope, close the connection...
|
||||
@ -1031,13 +1040,13 @@ _cupsConnect(void)
|
||||
|
||||
if (!cg->http)
|
||||
{
|
||||
if ((cg->http = httpConnectEncrypt(cupsServer(), ippPort(),
|
||||
cupsEncryption())) == NULL)
|
||||
if ((cg->http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC,
|
||||
cupsEncryption(), 1, 30000, NULL)) == NULL)
|
||||
{
|
||||
if (errno)
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
|
||||
_cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, NULL, 0);
|
||||
else
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE,
|
||||
_cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE,
|
||||
_("Unable to connect to host."), 1);
|
||||
}
|
||||
}
|
||||
@ -1110,59 +1119,54 @@ _cupsSetHTTPError(http_status_t status) /* I - HTTP status code */
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case HTTP_NOT_FOUND :
|
||||
_cupsSetError(IPP_NOT_FOUND, httpStatus(status), 0);
|
||||
case HTTP_STATUS_NOT_FOUND :
|
||||
_cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_UNAUTHORIZED :
|
||||
_cupsSetError(IPP_NOT_AUTHENTICATED, httpStatus(status), 0);
|
||||
case HTTP_STATUS_UNAUTHORIZED :
|
||||
_cupsSetError(IPP_STATUS_ERROR_NOT_AUTHENTICATED, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_AUTHORIZATION_CANCELED :
|
||||
_cupsSetError(IPP_AUTHENTICATION_CANCELED, httpStatus(status), 0);
|
||||
case HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED :
|
||||
_cupsSetError(IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_FORBIDDEN :
|
||||
_cupsSetError(IPP_FORBIDDEN, httpStatus(status), 0);
|
||||
case HTTP_STATUS_FORBIDDEN :
|
||||
_cupsSetError(IPP_STATUS_ERROR_FORBIDDEN, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_BAD_REQUEST :
|
||||
_cupsSetError(IPP_BAD_REQUEST, httpStatus(status), 0);
|
||||
case HTTP_STATUS_BAD_REQUEST :
|
||||
_cupsSetError(IPP_STATUS_ERROR_BAD_REQUEST, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_REQUEST_TOO_LARGE :
|
||||
_cupsSetError(IPP_REQUEST_VALUE, httpStatus(status), 0);
|
||||
case HTTP_STATUS_REQUEST_TOO_LARGE :
|
||||
_cupsSetError(IPP_STATUS_ERROR_REQUEST_VALUE, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_NOT_IMPLEMENTED :
|
||||
_cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status), 0);
|
||||
case HTTP_STATUS_NOT_IMPLEMENTED :
|
||||
_cupsSetError(IPP_STATUS_ERROR_OPERATION_NOT_SUPPORTED, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_NOT_SUPPORTED :
|
||||
_cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status), 0);
|
||||
case HTTP_STATUS_NOT_SUPPORTED :
|
||||
_cupsSetError(IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_UPGRADE_REQUIRED :
|
||||
_cupsSetError(IPP_UPGRADE_REQUIRED, httpStatus(status), 0);
|
||||
case HTTP_STATUS_UPGRADE_REQUIRED :
|
||||
_cupsSetError(IPP_STATUS_ERROR_CUPS_UPGRADE_REQUIRED, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_PKI_ERROR :
|
||||
_cupsSetError(IPP_PKI_ERROR, httpStatus(status), 0);
|
||||
case HTTP_STATUS_CUPS_PKI_ERROR :
|
||||
_cupsSetError(IPP_STATUS_ERROR_CUPS_PKI, httpStatus(status), 0);
|
||||
break;
|
||||
|
||||
case HTTP_ERROR :
|
||||
_cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
|
||||
case HTTP_STATUS_ERROR :
|
||||
_cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
|
||||
break;
|
||||
|
||||
default :
|
||||
DEBUG_printf(("4_cupsSetHTTPError: HTTP error %d mapped to "
|
||||
"IPP_SERVICE_UNAVAILABLE!", status));
|
||||
_cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status), 0);
|
||||
"IPP_STATUS_ERROR_SERVICE_UNAVAILABLE!", status));
|
||||
_cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, httpStatus(status), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: request.c 7946 2008-09-16 23:27:54Z mike $".
|
||||
*/
|
||||
|
||||
@ -1,27 +1,16 @@
|
||||
/*
|
||||
* "$Id: sidechannel.c 7720 2008-07-11 22:46:21Z mike $"
|
||||
* Side-channel API code for CUPS.
|
||||
*
|
||||
* Side-channel API code for CUPS.
|
||||
* Copyright 2007-2014 by Apple Inc.
|
||||
* Copyright 2006 by Easy Software Products.
|
||||
*
|
||||
* Copyright 2007-2012 by Apple Inc.
|
||||
* Copyright 2006 by Easy Software Products.
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* These coded instructions, statements, and computer programs are the
|
||||
* property of Apple Inc. and are protected by Federal copyright
|
||||
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
|
||||
* which should have been included with this file. If this file is
|
||||
* file is missing or damaged, see the license at "http://www.cups.org/".
|
||||
*
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsSideChannelDoRequest() - Send a side-channel command to a backend and
|
||||
* wait for a response.
|
||||
* cupsSideChannelRead() - Read a side-channel message.
|
||||
* cupsSideChannelSNMPGet() - Query a SNMP OID's value.
|
||||
* cupsSideChannelSNMPWalk() - Query multiple SNMP OID values.
|
||||
* cupsSideChannelWrite() - Write a side-channel message.
|
||||
* This file is subject to the Apple OS-Developed Software exception.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -35,12 +24,8 @@
|
||||
#else
|
||||
# include <unistd.h>
|
||||
#endif /* WIN32 */
|
||||
#ifdef __hpux
|
||||
# include <sys/time.h>
|
||||
#elif !defined(WIN32)
|
||||
# include <sys/select.h>
|
||||
#endif /* __hpux */
|
||||
#ifndef WIN32
|
||||
# include <sys/select.h>
|
||||
# include <sys/time.h>
|
||||
#endif /* !WIN32 */
|
||||
#ifdef HAVE_POLL
|
||||
@ -69,7 +54,7 @@
|
||||
* pointed to by the "data" parameter. cupsSideChannelDoRequest() will
|
||||
* update the value to contain the number of data bytes in the buffer.
|
||||
*
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
* @since CUPS 1.3/macOS 10.5@
|
||||
*/
|
||||
|
||||
cups_sc_status_t /* O - Status of command */
|
||||
@ -108,7 +93,7 @@ cupsSideChannelDoRequest(
|
||||
* pointed to by the "data" parameter. cupsSideChannelDoRequest() will
|
||||
* update the value to contain the number of data bytes in the buffer.
|
||||
*
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
* @since CUPS 1.3/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@ -120,7 +105,7 @@ cupsSideChannelRead(
|
||||
double timeout) /* I - Timeout in seconds */
|
||||
{
|
||||
char *buffer; /* Message buffer */
|
||||
int bytes; /* Bytes read */
|
||||
ssize_t bytes; /* Bytes read */
|
||||
int templen; /* Data length from message */
|
||||
int nfds; /* Number of file descriptors */
|
||||
#ifdef HAVE_POLL
|
||||
@ -151,7 +136,7 @@ cupsSideChannelRead(
|
||||
pfd.events = POLLIN;
|
||||
|
||||
while ((nfds = poll(&pfd, 1,
|
||||
timeout < 0.0 ? -1 : (long)(timeout * 1000))) < 0 &&
|
||||
timeout < 0.0 ? -1 : (int)(timeout * 1000))) < 0 &&
|
||||
(errno == EINTR || errno == EAGAIN))
|
||||
;
|
||||
|
||||
@ -214,7 +199,7 @@ cupsSideChannelRead(
|
||||
|
||||
if (bytes < 4)
|
||||
{
|
||||
DEBUG_printf(("1cupsSideChannelRead: Short read of %d bytes", bytes));
|
||||
DEBUG_printf(("1cupsSideChannelRead: Short read of " CUPS_LLFMT " bytes", CUPS_LLCAST bytes));
|
||||
|
||||
_cupsBufferRelease(buffer);
|
||||
|
||||
@ -277,7 +262,7 @@ cupsSideChannelRead(
|
||||
*status = (cups_sc_status_t)buffer[1];
|
||||
*datalen = templen;
|
||||
|
||||
memcpy(data, buffer + 4, templen);
|
||||
memcpy(data, buffer + 4, (size_t)templen);
|
||||
}
|
||||
|
||||
_cupsBufferRelease(buffer);
|
||||
@ -308,7 +293,7 @@ cupsSideChannelRead(
|
||||
* support SNMP queries. @code CUPS_SC_STATUS_NO_RESPONSE@ is returned when
|
||||
* the printer does not respond to the SNMP query.
|
||||
*
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
* @since CUPS 1.4/macOS 10.6@
|
||||
*/
|
||||
|
||||
cups_sc_status_t /* O - Query status */
|
||||
@ -368,7 +353,7 @@ cupsSideChannelSNMPGet(
|
||||
* Parse the response of the form "oid\0value"...
|
||||
*/
|
||||
|
||||
real_oidlen = strlen(real_data) + 1;
|
||||
real_oidlen = (int)strlen(real_data) + 1;
|
||||
real_datalen -= real_oidlen;
|
||||
|
||||
if ((real_datalen + 1) > *datalen)
|
||||
@ -377,7 +362,7 @@ cupsSideChannelSNMPGet(
|
||||
return (CUPS_SC_STATUS_TOO_BIG);
|
||||
}
|
||||
|
||||
memcpy(data, real_data + real_oidlen, real_datalen);
|
||||
memcpy(data, real_data + real_oidlen, (size_t)real_datalen);
|
||||
data[real_datalen] = '\0';
|
||||
|
||||
*datalen = real_datalen;
|
||||
@ -414,7 +399,7 @@ cupsSideChannelSNMPGet(
|
||||
* support SNMP queries. @code CUPS_SC_STATUS_NO_RESPONSE@ is returned when
|
||||
* the printer does not respond to the first SNMP query.
|
||||
*
|
||||
* @since CUPS 1.4/OS X 10.6@
|
||||
* @since CUPS 1.4/macOS 10.6@
|
||||
*/
|
||||
|
||||
cups_sc_status_t /* O - Status of first query of @code CUPS_SC_STATUS_OK@ on success */
|
||||
@ -427,8 +412,8 @@ cupsSideChannelSNMPWalk(
|
||||
cups_sc_status_t status; /* Status of command */
|
||||
cups_sc_command_t rcommand; /* Response command */
|
||||
char *real_data; /* Real data buffer for response */
|
||||
int real_datalen, /* Real length of data buffer */
|
||||
real_oidlen, /* Length of returned OID string */
|
||||
int real_datalen; /* Real length of data buffer */
|
||||
size_t real_oidlen, /* Length of returned OID string */
|
||||
oidlen; /* Length of first OID */
|
||||
const char *current_oid; /* Current OID */
|
||||
char last_oid[2048]; /* Last OID */
|
||||
@ -452,7 +437,7 @@ cupsSideChannelSNMPWalk(
|
||||
*/
|
||||
|
||||
current_oid = oid;
|
||||
oidlen = (int)strlen(oid);
|
||||
oidlen = strlen(oid);
|
||||
last_oid[0] = '\0';
|
||||
|
||||
do
|
||||
@ -499,11 +484,11 @@ cupsSideChannelSNMPWalk(
|
||||
return (CUPS_SC_STATUS_OK);
|
||||
}
|
||||
|
||||
if (real_datalen < sizeof(real_data))
|
||||
if ((size_t)real_datalen < sizeof(real_data))
|
||||
real_data[real_datalen] = '\0';
|
||||
|
||||
real_oidlen = strlen(real_data) + 1;
|
||||
real_datalen -= real_oidlen;
|
||||
real_datalen -= (int)real_oidlen;
|
||||
|
||||
/*
|
||||
* Call the callback with the OID and data...
|
||||
@ -533,7 +518,7 @@ cupsSideChannelSNMPWalk(
|
||||
* This function is normally only called by backend programs to send
|
||||
* responses to a filter, driver, or port monitor program.
|
||||
*
|
||||
* @since CUPS 1.3/OS X 10.5@
|
||||
* @since CUPS 1.3/macOS 10.5@
|
||||
*/
|
||||
|
||||
int /* O - 0 on success, -1 on error */
|
||||
@ -545,7 +530,7 @@ cupsSideChannelWrite(
|
||||
double timeout) /* I - Timeout in seconds */
|
||||
{
|
||||
char *buffer; /* Message buffer */
|
||||
int bytes; /* Bytes written */
|
||||
ssize_t bytes; /* Bytes written */
|
||||
#ifdef HAVE_POLL
|
||||
struct pollfd pfd; /* Poll structure for poll() */
|
||||
#else /* select() */
|
||||
@ -575,7 +560,7 @@ cupsSideChannelWrite(
|
||||
if (poll(&pfd, 1, -1) < 1)
|
||||
return (-1);
|
||||
}
|
||||
else if (poll(&pfd, 1, (long)(timeout * 1000)) < 1)
|
||||
else if (poll(&pfd, 1, (int)(timeout * 1000)) < 1)
|
||||
return (-1);
|
||||
|
||||
#else /* select() */
|
||||
@ -608,23 +593,23 @@ cupsSideChannelWrite(
|
||||
* 4-N Data
|
||||
*/
|
||||
|
||||
if ((buffer = _cupsBufferGet(datalen + 4)) == NULL)
|
||||
if ((buffer = _cupsBufferGet((size_t)datalen + 4)) == NULL)
|
||||
return (-1);
|
||||
|
||||
buffer[0] = command;
|
||||
buffer[1] = status;
|
||||
buffer[2] = datalen >> 8;
|
||||
buffer[3] = datalen & 255;
|
||||
buffer[2] = (char)(datalen >> 8);
|
||||
buffer[3] = (char)(datalen & 255);
|
||||
|
||||
bytes = 4;
|
||||
|
||||
if (datalen > 0)
|
||||
{
|
||||
memcpy(buffer + 4, data, datalen);
|
||||
memcpy(buffer + 4, data, (size_t)datalen);
|
||||
bytes += datalen;
|
||||
}
|
||||
|
||||
while (write(CUPS_SC_FD, buffer, bytes) < 0)
|
||||
while (write(CUPS_SC_FD, buffer, (size_t)bytes) < 0)
|
||||
if (errno != EINTR && errno != EAGAIN)
|
||||
{
|
||||
_cupsBufferRelease(buffer);
|
||||
@ -635,8 +620,3 @@ cupsSideChannelWrite(
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* End of "$Id: sidechannel.c 7720 2008-07-11 22:46:21Z mike $".
|
||||
*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user