diff --git a/CHANGES.md b/CHANGES.md index f3620c529..17a0851df 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,7 +22,9 @@ libcups v3.0b1 (Month DD, YYYY) - Added a roll to the default color ippeveprinter printer. - Added new DNS-SD API (Issue #19) - Added new PWG media sizes. -- Added new `EXPECT-ALL-VALUES-FROM` predicate for ipptool files (Issue #20) +- Added new `WITH-ALL-VALUES-FROM` predicate for ipptool files (Issue #20) +- Added new `SAVE-ALL-CONTENT`, `WITH-ALL-CONTENT`, and `WITH-ALL-MIME-TYPES` + predicates for ipptool files (Issue #22) - Added, modernized, and promoted the localization interfaces to public API (Issue #24) - Added public JSON API (Issue #31) diff --git a/doc/ippevepcl.html b/doc/ippevepcl.html index 2d50b0455..2cc14faf1 100644 --- a/doc/ippevepcl.html +++ b/doc/ippevepcl.html @@ -16,7 +16,7 @@ text-align: justify; } --> - + Documentation @@ -47,7 +47,7 @@

Description

Status and progress messages are sent to the standard error.

ippevepcl -prints to B&W HP PCL laser printers and supports printing of HP PCL (application/vnd.hp-pcl), PWG Raster (image/pwg-raster), and Apple Raster (image/urf) print files. +prints to B&W HP PCL laser printers and supports printing of HP PCL (application/vnd.hp-pcl), PWG Raster (image/pwg-raster), and Apple Raster (image/urf) print files.

ippeveps print to Adobe PostScript printers and supports printing of PDF (application/pdf), PostScript (application/postscript), JPEG (image/jpeg), PWG Raster (image/pwg-raster), and Apple Raster (image/urf) print files. diff --git a/doc/ippeveprinter.html b/doc/ippeveprinter.html index 63b638c92..324681336 100644 --- a/doc/ippeveprinter.html +++ b/doc/ippeveprinter.html @@ -16,7 +16,7 @@ text-align: justify; } --> - + Documentation @@ -113,7 +113,7 @@

Options

--pam-service service
Set the PAM service name. -The default service is "cups". +The default service is "cups".

--version
Show the CUPS version. @@ -128,25 +128,25 @@

Options

-D device-uri
Set the device URI for print output. -The URI can be a filename, directory, or a network socket URI of the form "socket://ADDRESS[:PORT]" (where the default port number is 9100). +The URI can be a filename, directory, or a network socket URI of the form "socket://ADDRESS[:PORT]" (where the default port number is 9100). When specifying a directory, ippeveprinter will create an output file using the job ID and name.

-F output-type/subtype[,...]
Specifies the output MIME media type. -The default is "application/postscript" when the -P option is specified. +The default is "application/postscript" when the -P option is specified.

-M manufacturer
Set the manufacturer of the printer. -The default is "Example". +The default is "Example".

-P filename.ppd
Load printer attributes from the specified PPD file. This option is typically used in conjunction with the ippeveps(7) -printer command ("-c ippeveps"). +printer command ("-c ippeveps").

-V 1.1

@@ -156,13 +156,13 @@

Options

-c command
Run the specified command for each document that is printed. -If "command" is not an absolute path ("/path/to/command"), +If "command" is not an absolute path ("/path/to/command"), ippeveprinter -looks for the command in the "command" subdirectory of the CUPS binary directory, typically /usr/lib/cups/command or /usr/libexec/cups/command. +looks for the command in the "command" subdirectory of the CUPS binary directory, typically /usr/lib/cups/command or /usr/libexec/cups/command. The cups-config(1) -command can be used to discover the correct binary directory ("cups-config --serverbin"). +command can be used to discover the correct binary directory ("cups-config --serverbin"). In addition, the CUPS_SERVERBIN environment variable can be used to override the default location of this directory - see the cups(1) @@ -190,7 +190,7 @@

Options

-m model
Specifies the model name of the printer. -The default is "Printer". +The default is "Printer".

-n hostname
Specifies the hostname that is reported by the server. @@ -209,12 +209,12 @@

Options

-r subtype[,subtype]
Specifies the DNS-SD subtype(s) to advertise. Separate multiple subtypes with a comma. -The default is "_print". +The default is "_print".

-s speed[,color-speed]
Specifies the printer speed in pages per minute. If two numbers are specified and the second number is greater than zero, the server will report support for color printing. -The default is "10,0". +The default is "10,0".

-v[vvv]
Be (very) verbose when logging activity to standard error. @@ -234,17 +234,17 @@

Conforming To

Environment

ippeveprinter -adds environment variables starting with "IPP_" for all IPP Job attributes in the print request. -For example, when executing a command for an IPP Job containing the "media" Job Template attribute, the "IPP_MEDIA" environment variable will be set to the value of that attribute. +adds environment variables starting with "IPP_" for all IPP Job attributes in the print request. +For example, when executing a command for an IPP Job containing the "media" Job Template attribute, the "IPP_MEDIA" environment variable will be set to the value of that attribute.

-

In addition, all IPP "xxx-default" and "pwg-xxx" Printer Description attributes are added to the environment. -For example, the "IPP_MEDIA_DEFAULT" environment variable will be set to the default value for the "media" Job Template attribute. +

In addition, all IPP "xxx-default" and "pwg-xxx" Printer Description attributes are added to the environment. +For example, the "IPP_MEDIA_DEFAULT" environment variable will be set to the default value for the "media" Job Template attribute.

Enumerated values are converted to their keyword equivalents. -For example, a "print-quality" Job Template attribute with a enum value of 3 will become the "IPP_PRINT_QUALITY" environment variable with a value of "draft". -This string conversion only happens for standard Job Template attributes, currently "finishings", "orientation-requested", and "print-quality". +For example, a "print-quality" Job Template attribute with a enum value of 3 will become the "IPP_PRINT_QUALITY" environment variable with a value of "draft". +This string conversion only happens for standard Job Template attributes, currently "finishings", "orientation-requested", and "print-quality".

-

Finally, the "CONTENT_TYPE" environment variable contains the MIME media type of the document being printed, the "DEVICE_URI" environment variable contains the device URI as specified with the "-D" option, the "OUTPUT_FORMAT" environment variable contains the output MIME media type, and the "PPD" environment variable contains the PPD filename as specified with the "-P" option. +

Finally, the "CONTENT_TYPE" environment variable contains the MIME media type of the document being printed, the "DEVICE_URI" environment variable contains the device URI as specified with the "-D" option, the "OUTPUT_FORMAT" environment variable contains the output MIME media type, and the "PPD" environment variable contains the PPD filename as specified with the "-P" option.

Command Output

Unless they communicate directly with a printer, print commands send printer-ready data to the standard output. @@ -255,25 +255,25 @@

Command Output

ATTR: attribute=value[ attribute=value]
Sets the named attribute(s) to the given values. -Currently only the "job-impressions" and "job-impressions-completed" Job Status attributes and the "marker-xxx", "printer-alert", "printer-alert-description", "printer-supply", and "printer-supply-description" Printer Status attributes can be set. +Currently only the "job-impressions" and "job-impressions-completed" Job Status attributes and the "marker-xxx", "printer-alert", "printer-alert-description", "printer-supply", and "printer-supply-description" Printer Status attributes can be set.

DEBUG: Debugging message
Logs a debugging message if at least two -v's have been specified.

ERROR: Error message
-Logs an error message and copies the message to the "job-state-message" attribute. +Logs an error message and copies the message to the "job-state-message" attribute.

INFO: Informational message
-Logs an informational/progress message if -v has been specified and copies the message to the "job-state-message" attribute unless an error has been reported. +Logs an informational/progress message if -v has been specified and copies the message to the "job-state-message" attribute unless an error has been reported.

STATE: keyword[,keyword,...]
-Sets the printer's "printer-state-reasons" attribute to the listed keywords. +Sets the printer's "printer-state-reasons" attribute to the listed keywords.

STATE: -keyword[,keyword,...]
-Removes the listed keywords from the printer's "printer-state-reasons" attribute. +Removes the listed keywords from the printer's "printer-state-reasons" attribute.

STATE: +keyword[,keyword,...]
-Adds the listed keywords to the printer's "printer-state-reasons" attribute. +Adds the listed keywords to the printer's "printer-state-reasons" attribute.

Examples

Run @@ -281,7 +281,7 @@

Examples

with a service name of My Cool Printer:

-    ippeveprinter "My Cool Printer"
+    ippeveprinter "My Cool Printer"
 

Run the file(1) @@ -289,7 +289,7 @@

Examples

command whenever a job is sent to the server:

-    ippeveprinter -c /usr/bin/file "My Cool Printer"
+    ippeveprinter -c /usr/bin/file "My Cool Printer"
 

See Also

ippevepcl(7), diff --git a/doc/ippfind.html b/doc/ippfind.html index bd5ef1578..475e58266 100644 --- a/doc/ippfind.html +++ b/doc/ippfind.html @@ -16,7 +16,7 @@ text-align: justify; } --> - + Documentation @@ -95,7 +95,7 @@

Expressions

-l

--ls
-Lists attributes returned by Get-Printer-Attributes for IPP printers and traditional find "-ls" output for HTTP URLs. +Lists attributes returned by Get-Printer-Attributes for IPP printers and traditional find "-ls" output for HTTP URLs. The result is true if the URI is accessible, false otherwise.

--local
@@ -161,7 +161,7 @@

Expressions

--exec utility [ argument ... ] ;
Executes the specified program if the current result is true. -"{foo}" arguments are replaced with the corresponding value - see SUBSTITUTIONS below. +"{foo}" arguments are replaced with the corresponding value - see SUBSTITUTIONS below.

Expressions may also contain modifiers:

@@ -182,30 +182,30 @@

Expressions

Logical OR of expressions.

Substitutions

-

The substitutions for "{foo}" in -e and --exec are: +

The substitutions for "{foo}" in -e and --exec are:

{service_domain}
-Domain name, e.g., "example.com.", "local.", etc. +Domain name, e.g., "example.com.", "local.", etc.

{service_hostname}
-Fully-qualified domain name, e.g., "printer.example.com.", "printer.local.", etc. +Fully-qualified domain name, e.g., "printer.example.com.", "printer.local.", etc.

{service_name}
-Service instance name, e.g., "My Fine Printer". +Service instance name, e.g., "My Fine Printer".

{service_port}
Port number for server, typically 631 for IPP and 80 for HTTP.

{service_regtype}
-DNS-SD registration type, e.g., "_ipp._tcp", "_http._tcp", etc. +DNS-SD registration type, e.g., "_ipp._tcp", "_http._tcp", etc.

{service_scheme}
-URI scheme for DNS-SD registration type, e.g., "ipp", "http", etc. +URI scheme for DNS-SD registration type, e.g., "ipp", "http", etc.

{}

{service_uri}
-URI for service, e.g., "ipp://printer.local./ipp/print", "http://printer.local./", etc. +URI for service, e.g., "ipp://printer.local./ipp/print", "http://printer.local./", etc.

{txt_key}
Value of TXT record key (lowercase). @@ -232,7 +232,7 @@

Options

-V version
Specifies the IPP version when listing. -Supported values are "1.1", "2.0", "2.1", and "2.2". +Supported values are "1.1", "2.0", "2.1", and "2.2".

Exit Status

ippfind returns 0 if the result for all processed expressions is true, 1 if the result of any processed expression is false, 2 if browsing or any query or resolution failed, 3 if an undefined option or invalid expression was specified, and 4 if it ran out of memory. @@ -241,25 +241,25 @@

Environment

When executing a program, ippfind sets the following environment variables for the matching service registration:

IPPFIND_SERVICE_DOMAIN
-Domain name, e.g., "example.com.", "local.", etc. +Domain name, e.g., "example.com.", "local.", etc.

IPPFIND_SERVICE_HOSTNAME
-Fully-qualified domain name, e.g., "printer.example.com.", "printer.local.", etc. +Fully-qualified domain name, e.g., "printer.example.com.", "printer.local.", etc.

IPPFIND_SERVICE_NAME
-Service instance name, e.g., "My Fine Printer". +Service instance name, e.g., "My Fine Printer".

IPPFIND_SERVICE_PORT
Port number for server, typically 631 for IPP and 80 for HTTP.

IPPFIND_SERVICE_REGTYPE
-DNS-SD registration type, e.g., "_ipp._tcp", "_http._tcp", etc. +DNS-SD registration type, e.g., "_ipp._tcp", "_http._tcp", etc.

IPPFIND_SERVICE_SCHEME
-URI scheme for DNS-SD registration type, e.g., "ipp", "http", etc. +URI scheme for DNS-SD registration type, e.g., "ipp", "http", etc.

IPPFIND_SERVICE_URI
-URI for service, e.g., "ipp://printer.local./ipp/print", "http://printer.local./", etc. +URI for service, e.g., "ipp://printer.local./ipp/print", "http://printer.local./", etc.

IPPFIND_TXT_KEY
Values of TXT record KEY (uppercase). diff --git a/doc/ipptool.html b/doc/ipptool.html index db7072925..ffd97a5b4 100644 --- a/doc/ipptool.html +++ b/doc/ipptool.html @@ -16,7 +16,7 @@ text-align: justify; } --> - + Documentation @@ -140,11 +140,11 @@

Options

must connect to the printer or server using IPv6.

-C
-Specifies that requests should be sent using the HTTP/1.1 "Transfer-Encoding: chunked" header, which is required for conformance by all versions of IPP. -The default is to use "Transfer-Encoding: chunked" for requests with attached files and "Content-Length:" for requests without attached files. +Specifies that requests should be sent using the HTTP/1.1 "Transfer-Encoding: chunked" header, which is required for conformance by all versions of IPP. +The default is to use "Transfer-Encoding: chunked" for requests with attached files and "Content-Length:" for requests without attached files.

-E
-Forces TLS encryption when connecting to the server using the HTTP "Upgrade" header. +Forces TLS encryption when connecting to the server using the HTTP "Upgrade" header.

-I
Specifies that @@ -152,8 +152,8 @@

Options

will continue past errors.

-L
-Specifies that requests should be sent using the HTTP/1.0 "Content-Length:" header, which is required for conformance by all versions of IPP. -The default is to use "Transfer-Encoding: chunked" for requests with attached files and "Content-Length:" for requests without attached files. +Specifies that requests should be sent using the HTTP/1.0 "Content-Length:" header, which is required for conformance by all versions of IPP. +The default is to use "Transfer-Encoding: chunked" for requests with attached files and "Content-Length:" for requests without attached files.

-P filename.plist
@@ -267,12 +267,12 @@

Conforming To

program is unique to CUPS and conforms to the Internet Printing Protocol up to version 2.2.

Examples

-

Get a list of completed jobs for "myprinter": +

Get a list of completed jobs for "myprinter":

     ipptool ipp://localhost/printers/myprinter get-completed-jobs.test
 
-

Send email notifications to "user@example.com" when "myprinter" changes: +

Send email notifications to "user@example.com" when "myprinter" changes:

     ipptool -d recipient=mailto:user@example.com \
diff --git a/doc/ipptoolfile.html b/doc/ipptoolfile.html
index c0667cd16..c19c2d569 100644
--- a/doc/ipptoolfile.html
+++ b/doc/ipptoolfile.html
@@ -16,7 +16,7 @@
   text-align: justify;
 }
 -->
-    
+    
     Documentation
   
   
@@ -29,14 +29,14 @@ 

Description

ipptool(1) program accepts free-form plain text files that describe one or more IPP requests. -Comments start with the "#" character and continue to the end of the line. +Comments start with the "#" character and continue to the end of the line. Each request is enclosed by curly braces, for example:

     # This is a comment
     {
       # The name of the test
-      NAME "Print PDF File"
+      NAME "Print PDF File"
 
       # The request to send
       OPERATION Print-Job
@@ -50,7 +50,7 @@ 

Description

GROUP job-attributes-tag ATTR collection media-col { - # US Letter plain paper from the "main" tray + # US Letter plain paper from the "main" tray MEMBER collection media-size { MEMBER integer x-dimension 21590 MEMBER integer y-dimension 27940 @@ -59,8 +59,8 @@

Description

MEMBER integer media-bottom-margin 423 MEMBER integer media-left-margin 423 MEMBER integer media-right-margin 423 - MEMBER keyword media-source "main" - MEMBER keyword media-type "stationery" + MEMBER keyword media-source "main" + MEMBER keyword media-type "stationery" } FILE testfile.pdf @@ -72,7 +72,7 @@

Description

} { # The name of the test - NAME "Wait for Job to Complete" + NAME "Wait for Job to Complete" # The request to send OPERATION Get-Job-Attributes @@ -89,7 +89,7 @@

Description

EXPECT job-id OF-TYPE integer WITH-VALUE $job-id EXPECT job-uri OF-TYPE uri EXPECT job-state OF-TYPE enum WITH-VALUE >5 REPEAT-NO-MATCH - EXPECT job-originating-user-name OF-TYPE name WITH-VALUE "$user" + EXPECT job-originating-user-name OF-TYPE name WITH-VALUE "$user" # Show the job state until completed... DISPLAY job-state @@ -111,7 +111,7 @@

Top-Level Directives

DEFINE-DEFAULT variable-name value
Defines the named variable to the given value if it does not already have a value.

-

FILE-ID "identifier"
+

FILE-ID "identifier"
Specifies an identifier string for the current file.

IGNORE-ERRORS yes
@@ -122,25 +122,25 @@

Top-Level Directives

-

INCLUDE "filename"
+

INCLUDE "filename"

-

INCLUDE <filename>
+

INCLUDE <filename>
Includes another test file. The first form includes a file relative to the current test file, while the second form includes a file from the ipptool(8) include directory.

-

INCLUDE-IF-DEFINED name "filename"
+

INCLUDE-IF-DEFINED name "filename"

-

INCLUDE-IF-DEFINED name <filename>
+

INCLUDE-IF-DEFINED name <filename>
Includes another test file if the named variable is defined. The first form includes a file relative to the current test file, while the second form includes a file from the ipptool(8) include directory.

-

INCLUDE-IF-NOT-DEFINED name "filename"
+

INCLUDE-IF-NOT-DEFINED name "filename"

-

INCLUDE-IF-NOT-DEFINED name <filename>
+

INCLUDE-IF-NOT-DEFINED name <filename>
Includes another test file if the named variable is not defined. The first form includes a file relative to the current test file, while the second form includes a file from the ipptool(8) @@ -157,16 +157,16 @@

Top-Level Directives

TRANSFER auto
-Specifies that tests will, by default, use "Transfer-Encoding: chunked" for requests with attached files and "Content-Length:" for requests without attached files. +Specifies that tests will, by default, use "Transfer-Encoding: chunked" for requests with attached files and "Content-Length:" for requests without attached files.

TRANSFER chunked
-Specifies that tests will, by default, use the HTTP/1.1 "Transfer-Encoding: chunked" header. This is the default and is equivalent to specifying -c on the +Specifies that tests will, by default, use the HTTP/1.1 "Transfer-Encoding: chunked" header. This is the default and is equivalent to specifying -c on the ipptool(8) command-line. Support for chunked requests is required for conformance with all versions of IPP.

TRANSFER length
-Specifies that tests will, by default, use the HTTP/1.0 "Content-Length:" header. This is equivalent to specifying -l on the +Specifies that tests will, by default, use the HTTP/1.0 "Content-Length:" header. This is equivalent to specifying -l on the ipptool(8) command-line. Support for content length requests is required for conformance with all versions of IPP. @@ -190,7 +190,7 @@

Test Directives

ATTR tag attribute-name value(s)
Adds an attribute to the test request. Out-of-band tags (admin-define, delete-attribute, no-value, not-settable, unknown, unsupported) have no value. -Values for other tags are delimited by the comma (",") character - escape commas using the "\" character. +Values for other tags are delimited by the comma (",") character - escape commas using the "\" character. Common attributes and values are listed in the IANA IPP registry - see references below.

ATTR collection attribute-name { MEMBER tag member-name value(s) ... } [ ... ,{ ... } ]
@@ -218,7 +218,7 @@

Test Directives

EXPECT ?attribute-name predicate(s)

EXPECT !attribute-name
-Specifies that the response must/may/must not include the named attribute. Additional requirements can be added as predicates - see the "EXPECT PREDICATES" section for more information on predicates. Attribute names can specify member attributes by separating the attribute and member names with the forward slash, for example "media-col/media-size/x-dimension". +Specifies that the response must/may/must not include the named attribute. Additional requirements can be added as predicates - see the "EXPECT PREDICATES" section for more information on predicates. Attribute names can specify member attributes by separating the attribute and member names with the forward slash, for example "media-col/media-size/x-dimension".

EXPECT-ALL attribute-name [ predicate(s) ]

@@ -232,7 +232,7 @@

Test Directives

Specifies that ipptool should generate PWG or Apple raster data for the printer. -See the "GENERATE-FILE PARAMETERS" section for information on the parameters you can specify. +See the "GENERATE-FILE PARAMETERS" section for information on the parameters you can specify.

GROUP tag
Specifies the group tag for subsequent attributes in the request. @@ -249,7 +249,7 @@

Test Directives

Specifies printer state monitoring tests to run in parallel with the test operation. The monitoring tests will run until all of the EXPECT conditions are satisfied or the primary test operation has completed, whichever occurs first.

-

NAME "literal string"
+

NAME "literal string"
Specifies the human-readable name of the test.

OPERATION operation-code
@@ -260,13 +260,13 @@

Test Directives

PASS-IF-NOT-DEFINED variable-name
Specifies that the current test should be passed automatically when the variable is or is not defined.

-

PAUSE "message"
+

PAUSE "message"
Displays the provided message and waits for the user to press a key to continue.

REQUEST-ID number

REQUEST-ID random
-Specifies the request-id value to use in the request, either an integer or the word "random" to use a randomly generated value (the default). +Specifies the request-id value to use in the request, either an integer or the word "random" to use a randomly generated value (the default).

RESOURCE path
Specifies an alternate resource path that is used for the HTTP POST request. The default is the resource from the URI provided to the @@ -288,19 +288,19 @@

Test Directives

will skip the current test if the previous test resulted in an error/failure.

STATUS status-code [ predicate ]
-Specifies an expected response status-code value. Additional requirements can be added as predicates - see the "STATUS PREDICATES" section for more information on predicates. +Specifies an expected response status-code value. Additional requirements can be added as predicates - see the "STATUS PREDICATES" section for more information on predicates.

-

TEST-ID "identifier"
+

TEST-ID "identifier"
Specifies an identifier string for the current test.

TRANSFER auto
-Specifies that this test will use "Transfer-Encoding: chunked" if it has an attached file or "Content-Length:" otherwise. +Specifies that this test will use "Transfer-Encoding: chunked" if it has an attached file or "Content-Length:" otherwise.

TRANSFER chunked
-Specifies that this test will use the HTTP/1.1 "Transfer-Encoding: chunked" header. +Specifies that this test will use the HTTP/1.1 "Transfer-Encoding: chunked" header.

TRANSFER length
-Specifies that this test will use the HTTP/1.0 "Content-Length:" header. +Specifies that this test will use the HTTP/1.0 "Content-Length:" header.

VERSION 1.0

@@ -320,18 +320,18 @@

Expect Predicates

Requires the EXPECT attribute to have the specified number of values.

DEFINE-MATCH variable-name
-Defines the variable to "1" when the EXPECT condition matches. +Defines the variable to "1" when the EXPECT condition matches. A side-effect of this predicate is that this EXPECT will never fail a test.

DEFINE-NO-MATCH variable-name
-Defines the variable to "1" when the EXPECT condition does not match. +Defines the variable to "1" when the EXPECT condition does not match. A side-effect of this predicate is that this EXPECT will never fail a test.

DEFINE-VALUE variable-name
Defines the variable to the value of the attribute when the EXPECT condition matches. A side-effect of this predicate is that this EXPECT will never fail a test.

-

DISPLAY-MATCH "message"
+

DISPLAY-MATCH "message"
Displays the specified message when the EXPECT condition matches.

IF-DEFINED variable-name
@@ -345,7 +345,7 @@

Expect Predicates

OF-TYPE tag[(limits)|tag|...]
Requires the EXPECT attribute to use one of the specified value tag(s). -Most value tags also support the specification of limits in parenthesis, for example "name(42)" would allow nameWith/WithoutLanguage strings up to 42 octets in length, "name(4:MAX)" would allow nameWith/WithoutLanguage strings between 4 and 255 octets in length, and "integer(-273:MAX)" would allow integers between -273 and 2147483647. +Most value tags also support the specification of limits in parenthesis, for example "name(42)" would allow nameWith/WithoutLanguage strings up to 42 octets in length, "name(4:MAX)" would allow nameWith/WithoutLanguage strings between 4 and 255 octets in length, and "integer(-273:MAX)" would allow integers between -273 and 2147483647.

REPEAT-LIMIT number

@@ -359,98 +359,132 @@

Expect Predicates

SAME-COUNT-AS attribute-name
Requires the EXPECT attribute to have the same number of values as the specified parallel attribute.

-

WITH-ALL-HOSTNAMES "literal string"
+

SAVE-CONTENT filespec

-

WITH-ALL-HOSTNAMES "/regular expression/"
+

SAVE-ALL-CONTENT filespec
+Saves all "http" or "https" URI values to the specified location. +The filespec value is a filename or directory path and can contain the special strings "%basename%" to insert the base filename from the URI, "%ext%" to insert the extension from the URI, and "%index%" to insert the value number starting at 1. +

+

WITH-ALL-CONTENT available
+

+

WITH-CONTENT available
+Requires that all URI values be accessible. +A "http" or "https" URI must respond to a GET request while a "ipp" or "ipps" URI must respond to a HEAD request. +

+

WITH-ALL-CONTENT valid
+

+

WITH-CONTENT valid
+Requires that all "http" and "https" URI values be accessible and provide valid content. +

+

WITH-ALL-CONTENT valid-icon
+

+

WITH-CONTENT valid-icon
+Requires that all "http" and "https" URI values be accessible and provide valid PNG images for icons - 48x48, 128x128, or 512x512 in size with transparency. +

+

WITH-ALL-HOSTNAMES "literal string"
+

+

WITH-ALL-HOSTNAMES "/regular expression/"
Requires that all URI values contain a matching hostname.

-

WITH-ALL-RESOURCES "literal string"
+

WITH-ALL-MIME-TYPES mime/type[,...,mime/type]
+

+

WITH-MIME-TYPES mime/type[,...,mime/type]
+Requires that all URI values provide one of the listed MIME media types. +For non-content tests, the target Printer must respond to HTTP HEAD requests with the MIME media type that would be returned by a GET or POST requests. +For "http" and "https" content tests, +ipptool +sends a HTTP GET request. +For "ipp" and "ipps" content tests, +ipptool +sends an IPP Get-Printer-Attributes request. +

+

WITH-ALL-RESOURCES "literal string"

-

WITH-ALL-RESOURCES "/regular expression/"
+

WITH-ALL-RESOURCES "/regular expression/"
Requires that all URI values contain a matching resource (including leading /).

-

WITH-ALL-SCHEMES "literal string"
+

WITH-ALL-SCHEMES "literal string"

-

WITH-ALL-SCHEMES "/regular expression/"
+

WITH-ALL-SCHEMES "/regular expression/"
Requires that all URI values contain a matching scheme.

-

WITH-ALL-VALUES "literal string"
+

WITH-ALL-VALUES "literal string"
Requires that all values of the EXPECT attribute match the literal string. Comparisons are case-sensitive.

-

WITH-ALL-VALUES <number
+

WITH-ALL-VALUES <number

WITH-ALL-VALUES =number

WITH-ALL-VALUES >number

WITH-ALL-VALUES number[,...,number]
-Requires that all values of the EXPECT attribute match the number(s) or numeric comparison. When comparing rangeOfInteger values, the "<" and ">" operators only check the upper bound of the range. +Requires that all values of the EXPECT attribute match the number(s) or numeric comparison. When comparing rangeOfInteger values, the "<" and ">" operators only check the upper bound of the range.

-

WITH-ALL-VALUES "false"
+

WITH-ALL-VALUES "false"

-

WITH-ALL-VALUES "true"
+

WITH-ALL-VALUES "true"
Requires that all values of the EXPECT attribute match the boolean value given.

-

WITH-ALL-VALUES "/regular expression/"
+

WITH-ALL-VALUES "/regular expression/"
Requires that all values of the EXPECT attribute match the regular expression, which must conform to the POSIX regular expression syntax. Comparisons are case-sensitive.

WITH-ALL-VALUES-FROM attribute-name
Requires that all value(s) of the EXPECT attribute matches the value(s) in the specified attribute. -For example, "EXPECT-ALL media-col-database/media-source WITH-ALL-VALUES-FROM media-source-supported" requires that all the "media-source" values are listed as a value of the "media-source-supported" attribute. +For example, "EXPECT-ALL media-col-database/media-source WITH-ALL-VALUES-FROM media-source-supported" requires that all the "media-source" values are listed as a value of the "media-source-supported" attribute.

WITH-DISTINCT-VALUES
Requires that all values of the EXPECT attribute are unique. Comparisons are case-sensitive. Only charset, collection, enum, integer, keyword, mimeMediaType, naturalLanguage, rangeOfInteger, resolution, uriScheme attributes support this predicate.

-

WITH-HOSTNAME "literal string"
+

WITH-HOSTNAME "literal string"

-

WITH-HOSTNAME "/regular expression/"
+

WITH-HOSTNAME "/regular expression/"
Requires that at least one URI value contains a matching hostname.

-

WITH-RESOURCE "literal string"
+

WITH-RESOURCE "literal string"

-

WITH-RESOURCE "/regular expression/"
+

WITH-RESOURCE "/regular expression/"
Requires that at least one URI value contains a matching resource (including leading /).

-

WITH-SCHEME "literal string"
+

WITH-SCHEME "literal string"

-

WITH-SCHEME "/regular expression/"
+

WITH-SCHEME "/regular expression/"
Requires that at least one URI value contains a matching scheme.

-

WITH-VALUE "literal string"
+

WITH-VALUE "literal string"
Requires that at least one value of the EXPECT attribute matches the literal string. Comparisons are case-sensitive.

-

WITH-VALUE <number
+

WITH-VALUE <number

WITH-VALUE =number

WITH-VALUE >number

WITH-VALUE number[,...,number]
-Requires that at least one value of the EXPECT attribute matches the number(s) or numeric comparison. When comparing rangeOfInteger values, the "<" and ">" operators only check the upper bound of the range. +Requires that at least one value of the EXPECT attribute matches the number(s) or numeric comparison. When comparing rangeOfInteger values, the "<" and ">" operators only check the upper bound of the range.

-

WITH-VALUE "false"
+

WITH-VALUE "false"

-

WITH-VALUE "true"
+

WITH-VALUE "true"
Requires that at least one value of the EXPECT attribute matches the boolean value given.

-

WITH-VALUE "/regular expression/"
+

WITH-VALUE "/regular expression/"
Requires that at least one value of the EXPECT attribute matches the regular expression, which must conform to the POSIX regular expression syntax. Comparisons are case-sensitive.

WITH-VALUE-FROM attribute-name
Requires that the value(s) of the EXPECT attribute matches the value(s) in the specified attribute. -For example, "EXPECT job-sheets WITH-VALUE-FROM job-sheets-supported" requires that the "job-sheets" value is listed as a value of the "job-sheets-supported" attribute. +For example, "EXPECT job-sheets WITH-VALUE-FROM job-sheets-supported" requires that the "job-sheets" value is listed as a value of the "job-sheets-supported" attribute.

Status Predicates

The following predicates are understood following the STATUS test directive:

DEFINE-MATCH variable-name
-Defines the variable to "1" when the STATUS matches. A side-effect of this predicate is that this STATUS will never fail a test. +Defines the variable to "1" when the STATUS matches. A side-effect of this predicate is that this STATUS will never fail a test.

DEFINE-NO-MATCH variable-name
-Defines the variable to "1" when the STATUS does not match. A side-effect of this predicate is that this STATUS will never fail a test. +Defines the variable to "1" when the STATUS does not match. A side-effect of this predicate is that this STATUS will never fail a test.

IF-DEFINED variable-name
Makes the STATUS apply only if the specified variable is defined. @@ -692,10 +726,10 @@

Variables

The ipptool(8) -program maintains a list of variables that can be used in any literal string or attribute value by specifying "$variable-name". Aside from variables defined using the -d option or DEFINE directive, the following pre-defined variables are available: +program maintains a list of variables that can be used in any literal string or attribute value by specifying "$variable-name". Aside from variables defined using the -d option or DEFINE directive, the following pre-defined variables are available:

$$
-Inserts a single "$" character. +Inserts a single "$" character.

$ENV[name]
Inserts the value of the named environment variable, or an empty string if the environment variable is not defined. @@ -707,10 +741,10 @@

Variables

with the -f option.

$date-current
-Inserts the current date and time using the ISO-8601 format ("yyyy-mm-ddThh:mm:ssZ"). +Inserts the current date and time using the ISO-8601 format ("yyyy-mm-ddThh:mm:ssZ").

$date-start
-Inserts the starting date and time using the ISO-8601 format ("yyyy-mm-ddThh:mm:ssZ"). +Inserts the starting date and time using the ISO-8601 format ("yyyy-mm-ddThh:mm:ssZ").

$filename
Inserts the filename provided to @@ -730,13 +764,13 @@

Variables

$job-id
-Inserts the last "job-id" attribute value returned in a test response or 0 if no "job-id" attribute has been seen. +Inserts the last "job-id" attribute value returned in a test response or 0 if no "job-id" attribute has been seen.

$job-uri
-Inserts the last "job-uri" attribute value returned in a test response or an empty string if no "job-uri" attribute has been seen. +Inserts the last "job-uri" attribute value returned in a test response or an empty string if no "job-uri" attribute has been seen.

$notify-subscription-id
-Inserts the last "notify-subscription-id" attribute value returned in a test response or 0 if no "notify-subscription-id" attribute has been seen. +Inserts the last "notify-subscription-id" attribute value returned in a test response or 0 if no "notify-subscription-id" attribute has been seen.

$port
Inserts the port number from the URI provided to @@ -771,7 +805,7 @@

Generate-File Parameters

The GENERATE-FILE directive dynamically generates raster pages for the destination printer. -Each page consists of a black border and the text "TEST-PAGE ####" repeated in the interior in several shades of gray and colors. +Each page consists of a black border and the text "TEST-PAGE ####" repeated in the interior in several shades of gray and colors. The following parameters are supported:

COLORSPACE auto
@@ -784,15 +818,15 @@

Generate-File Parameters

COLORSPACE colorspace_bits
Specifies the output color space and bit depth. -"auto" chooses an available combination with preference for full color, "bi-level" chooses a B&W (bitmap) color space, "color" chooses a full color combination, and "monochrome" chooses a grayscale combination. -Otherwise, the value must be one of the registered IPP "pwg-raster-document-type-supported" keywords. -NOTE: The "device N" color spaces are not current supported. +"auto" chooses an available combination with preference for full color, "bi-level" chooses a B&W (bitmap) color space, "color" chooses a full color combination, and "monochrome" chooses a grayscale combination. +Otherwise, the value must be one of the registered IPP "pwg-raster-document-type-supported" keywords. +NOTE: The "device N" color spaces are not current supported.

FORMAT image/pwg-raster

FORMAT image/urf
-Specifies the raster format to use, either "image/pwg-raster" (PWG Raster) or "image/urf" (Apple Raster). -The default is "image/urf" if supported, "image/pwg-raster" otherwise. +Specifies the raster format to use, either "image/pwg-raster" (PWG Raster) or "image/urf" (Apple Raster). +The default is "image/urf" if supported, "image/pwg-raster" otherwise.

MEDIA default

@@ -800,7 +834,7 @@

Generate-File Parameters

MEDIA media-size-name
Specifies the output media size. -"default" uses the printer's default media size while "ready" uses the first ready (loaded) media reported by the printer. +"default" uses the printer's default media size while "ready" uses the first ready (loaded) media reported by the printer. Other media size names must conform the PWG self-describing media size format.

NUM-COPIES copies
@@ -819,7 +853,7 @@

Generate-File Parameters

ORIENTATION reverse-portrait
Specifies the orientation of the output. -The default is "portrait". +The default is "portrait".

RESOLUTION default

@@ -835,7 +869,7 @@

Generate-File Parameters

RESOLUTION horizontalxverticaldpi
Specifies the output resolution using the printer's supported resolutions or as specified in dots per inch or dots per centimeter. -"default" uses the median resolution of the printer and is the default, "min" uses the lowest resolution of the printer, and "max" uses the highest resolution of the printer. +"default" uses the median resolution of the printer and is the default, "min" uses the lowest resolution of the printer, and "max" uses the highest resolution of the printer.

SIDES one-sided

@@ -843,13 +877,13 @@

Generate-File Parameters

SIDES two-sided-short-edge
Specifies whether to print on one or both sides of the media. -The default is "two-sided-long-edge" for portrait output and "two-sided-short-edge" for landscape output when supported by the printer, otherwise "one-sided" is used. +The default is "two-sided-long-edge" for portrait output and "two-sided-short-edge" for landscape output when supported by the printer, otherwise "one-sided" is used.

Examples

-

Query the "foo-default" and "foo-supported" Printer Description attributes and validate that all of its values are 'bar', 'baz', or 'none': +

Query the "foo-default" and "foo-supported" Printer Description attributes and validate that all of its values are 'bar', 'baz', or 'none':

{
-  NAME "Validate 'foo' Attribute"
+  NAME "Validate 'foo' Attribute"
   OPERATION Get-Printer-Attributes
   GROUP operation-attributes-tag
   ATTR charset attributes-charset utf-8
@@ -857,15 +891,15 @@ 

Examples

ATTR uri printer-uri $uri ATTR keyword requested-attributes foo-default,foo-supported EXPECT foo-default OF-TYPE keyword IN-GROUP printer-attributes-tag - COUNT 1 WITH-VALUE "/^(bar|baz|none)$$/" + COUNT 1 WITH-VALUE "/^(bar|baz|none)$$/" EXPECT foo-supported OF-TYPE keyword IN-GROUP printer-attributes-tag - WITH-ALL-VALUES "/^(bar|baz|none)$$/" + WITH-ALL-VALUES "/^(bar|baz|none)$$/" }
-

Query the "media-col-ready" Printer Status attribute and validate that the collection values contain "media-size" and "media-source" member attributes: +

Query the "media-col-ready" Printer Status attribute and validate that the collection values contain "media-size" and "media-source" member attributes:

{
-  NAME "Validate 'foo' Attribute"
+  NAME "Validate 'foo' Attribute"
   OPERATION Get-Printer-Attributes
   GROUP operation-attributes-tag
   ATTR charset attributes-charset utf-8
@@ -892,6 +926,6 @@ 

See Also

RFC 8011 (https://datatracker.ietf.org/doc/html/rfc8011)

Copyright

-

Copyright © 2021-2022 by OpenPrinting. +

Copyright © 2021-2023 by OpenPrinting. diff --git a/man/ipptoolfile.5 b/man/ipptoolfile.5 index 6737a9e21..e869bb580 100644 --- a/man/ipptoolfile.5 +++ b/man/ipptoolfile.5 @@ -7,7 +7,7 @@ .\" Licensed under Apache License v2.0. See the file "LICENSE" for more .\" information. .\" -.TH ipptoolfile 5 "CUPS" "2023-01-19" "OpenPrinting" +.TH ipptoolfile 5 "CUPS" "2023-01-28" "OpenPrinting" .SH NAME ipptoolfile \- ipptool file format .SH DESCRIPTION @@ -338,11 +338,39 @@ Requires the \fBEXPECT\fR attribute to have the same number of values as the spe Saves all "http" or "https" URI values to the specified location. The filespec value is a filename or directory path and can contain the special strings "%basename%" to insert the base filename from the URI, "%ext%" to insert the extension from the URI, and "%index%" to insert the value number starting at 1. .TP 5 +\fBWITH\-ALL\-CONTENT available\fR +.TP 5 +\fBWITH\-CONTENT available\fR +Requires that all URI values be accessible. +A "http" or "https" URI must respond to a GET request while a "ipp" or "ipps" URI must respond to a HEAD request. +.TP 5 +\fBWITH\-ALL\-CONTENT valid\fR +.TP 5 +\fBWITH\-CONTENT valid\fR +Requires that all "http" and "https" URI values be accessible and provide valid content. +.TP 5 +\fBWITH\-ALL\-CONTENT valid-icon\fR +.TP 5 +\fBWITH\-CONTENT valid-icon\fR +Requires that all "http" and "https" URI values be accessible and provide valid PNG images for icons - 48x48, 128x128, or 512x512 in size with transparency. +.TP 5 \fBWITH\-ALL\-HOSTNAMES "\fIliteral string\fB"\fR .TP 5 \fBWITH\-ALL\-HOSTNAMES "/\fIregular expression\fB/"\fR Requires that all URI values contain a matching hostname. .TP 5 +\fBWITH\-ALL\-MIME\-TYPES \fImime/type[,...,mime/type]\fR +.TP 5 +\fBWITH\-MIME\-TYPES \fImime/type[,...,mime/type]\fR +Requires that all URI values provide one of the listed MIME media types. +For non-content tests, the target Printer must respond to HTTP HEAD requests with the MIME media type that would be returned by a GET or POST requests. +For "http" and "https" content tests, +.B ipptool +sends a HTTP GET request. +For "ipp" and "ipps" content tests, +.B ipptool +sends an IPP Get-Printer-Attributes request. +.TP 5 \fBWITH\-ALL\-RESOURCES "\fIliteral string\fB"\fR .TP 5 \fBWITH\-ALL\-RESOURCES "/\fIregular expression\fB/"\fR @@ -350,7 +378,7 @@ Requires that all URI values contain a matching resource (including leading /). .TP 5 \fBWITH\-ALL\-SCHEMES "\fIliteral string\fB"\fR .TP 5 -\fBWITH\-ALL-SCHEMES "/\fIregular expression\fB/"\fR +\fBWITH\-ALL\-SCHEMES "/\fIregular expression\fB/"\fR Requires that all URI values contain a matching scheme. .TP 5 \fBWITH\-ALL\-VALUES "\fIliteral string\fB"\fR @@ -378,22 +406,6 @@ Comparisons are case-sensitive. Requires that all value(s) of the \fBEXPECT\fR attribute matches the value(s) in the specified attribute. For example, "EXPECT-ALL media\-col\-database/media\-source WITH\-ALL\-VALUES\-FROM media\-source\-supported" requires that all the "media\-source" values are listed as a value of the "media\-source\-supported" attribute. .TP 5 -\fBWITH\-CONTENT available\fR -.TP 5 -\fBWITH\-ALL\-CONTENT available\fR -Requires that all URI values be accessible. -A "http" or "https" URI must respond to a GET request while a "ipp" or "ipps" URI must respond to a HEAD request. -.TP 5 -\fBWITH\-CONTENT valid\fR -.TP 5 -\fBWITH\-ALL\-CONTENT valid\fR -Requires that all "http" and "https" URI values be accessible and provide valid content. -.TP 5 -\fBWITH\-CONTENT valid-icon\fR -.TP 5 -\fBWITH\-ALL\-CONTENT valid-icon\fR -Requires that all "http" and "https" URI values be accessible and provide valid PNG images for icons - 48x48, 128x128, or 512x512 in size with transparency. -.TP 5 \fBWITH\-DISTINCT\-VALUES\fR Requires that all values of the \fBEXPECT\fR attribute are unique. Comparisons are case-sensitive. @@ -870,4 +882,4 @@ PWG 5101.1-2013: PWG Media Standardized Names v2.0 (https://ftp.pwg.org/pub/pwg/ .PP RFC 8011 (https://datatracker.ietf.org/doc/html/rfc8011) .SH COPYRIGHT -Copyright \[co] 2021-2022 by OpenPrinting. +Copyright \[co] 2021-2023 by OpenPrinting. diff --git a/tools/ipptool.c b/tools/ipptool.c index e361938df..fd9cb20d6 100644 --- a/tools/ipptool.c +++ b/tools/ipptool.c @@ -7020,7 +7020,7 @@ with_content( { if (_cups_strcasecmp(content_type, "image/png")) { - add_stringf(errors, "Got unexpected Content-Type '%s' for HEAD request to '%s'.", content_type, uri); + add_stringf(errors, "Got unexpected Content-Type '%s' for GET request to '%s'.", content_type, uri); ret = false; goto get_done; } @@ -7044,18 +7044,6 @@ with_content( goto get_done; } } - else if (!_cups_strcasecmp(content_type, "application/pdf")) - { - // TODO: Validate PDF file - } - else if (!_cups_strcasecmp(content_type, "application/ipp")) - { - // TODO: Validate IPP message file - } - else if (!_cups_strcasecmp(content_type, "application/vnd.iccprofile")) - { - // TODO: Validate ICC profile file - } else if (!_cups_strcasecmp(content_type, "image/jpeg") || !_cups_strcasecmp(content_type, "image/png")) { if (!valid_image(filename, &width, &height, &depth)) @@ -7065,17 +7053,15 @@ with_content( goto get_done; } } - else if (!_cups_strcasecmp(content_type, "text/css")) - { - // TODO: Validate CSS file - } - else if (!_cups_strcasecmp(content_type, "text/html")) - { - // TODO: Validate HTML file - } - else if (!_cups_strcasecmp(content_type, "text/strings")) + else if (!_cups_strcasecmp(content_type, "application/pdf") || !_cups_strcasecmp(content_type, "application/ipp") || !_cups_strcasecmp(content_type, "application/vnd.iccprofile") || !_cups_strcasecmp(content_type, "text/css") || !_cups_strcasecmp(content_type, "text/html") || !_cups_strcasecmp(content_type, "text/strings")) { - // TODO: Validate strings file + // Just require these files to be non-empty for now, might add more checks in the future... + if (fileinfo.st_size == 0) + { + add_stringf(errors, "Empty resource '%s'.", uri); + ret = false; + goto get_done; + } } else {