* Prototypes for private functions...
*/
-extern ipp_attribute_t *_ippAddAttr(ipp_t *, int);
+extern ipp_attribute_t *_ippAddAttr(ipp_t *ipp, int num_values);
+extern size_t _ippAttrString(ipp_attribute_t *attr, char *buffer,
+ size_t bufsize);
extern _ipp_option_t *_ippFindOption(const char *name);
-extern void _ippFreeAttr(ipp_attribute_t *);
+extern void _ippFreeAttr(ipp_attribute_t *attr);
/*
*
* Contents:
*
+ * _ippAttrString() - Convert the attribute's value to a string.
* ippErrorString() - Return a name for the given status code.
* ippErrorValue() - Return a status code for the given name.
* ippOpString() - Return a name for the given operation id.
* ippSetPort() - Set the default port number.
* ippTagString() - Return the tag name corresponding to a tag value.
* ippTagValue() - Return the tag value corresponding to a tag name.
+ * ipp_col_string() - Convert a collection to a string.
*/
/*
"mimeMediaType", /* 0x49 */
"memberAttrName" /* 0x4a */
};
+static const char * const job_states[] =
+{ /* job-state enums */
+ "pending",
+ "pending-held",
+ "processing",
+ "processing-stopped"
+ "canceled",
+ "aborted",
+ "completed"
+};
+static const char * const printer_states[] =
+{ /* printer-state enums */
+ "idle",
+ "processing",
+ "stopped",
+};
+
+
+/*
+ * Local functions...
+ */
+
+static size_t ipp_col_string(ipp_t *col, char *buffer, size_t bufsize);
+
+
+/*
+ * '_ippAttrString()' - Convert the attribute's value to a string.
+ *
+ * Returns the number of bytes that would be written, not including the
+ * trailing nul. The buffer pointer can be NULL to get the required length,
+ * just like (v)snprintf.
+ */
+
+size_t /* O - Number of bytes less nul */
+_ippAttrString(ipp_attribute_t *attr, /* I - Attribute */
+ char *buffer, /* I - String buffer or NULL */
+ size_t bufsize) /* I - Size of string buffer */
+{
+ int i; /* Looping var */
+ char *bufptr, /* Pointer into buffer */
+ *bufend, /* End of buffer */
+ temp[256]; /* Temporary string */
+ const char *ptr; /* Pointer into string */
+ ipp_value_t *val; /* Current value */
+
+
+ if (!attr || !attr->name)
+ {
+ if (buffer)
+ *buffer = '\0';
+
+ return (0);
+ }
+
+ bufptr = buffer;
+ if (buffer)
+ bufend = buffer + bufsize - 1;
+ else
+ bufend = NULL;
+
+ for (i = attr->num_values, val = attr->values; i > 0; i --, val ++)
+ {
+ if (val > attr->values)
+ {
+ if (bufptr < bufend)
+ *bufptr++ = ',';
+ else
+ bufptr ++;
+ }
+
+ switch (attr->value_tag)
+ {
+ case IPP_TAG_ENUM :
+ if (!strcmp(attr->name, "printer-state") &&
+ val->integer >= IPP_PRINTER_IDLE &&
+ val->integer <= IPP_PRINTER_STOPPED)
+ {
+ ptr = printer_states[val->integer - IPP_PRINTER_IDLE];
+
+ if (bufptr < bufend)
+ strlcpy(bufptr, ptr, bufend - bufptr + 1);
+
+ bufptr += strlen(ptr);
+ break;
+ }
+ else if (!strcmp(attr->name, "job-state") &&
+ val->integer >= IPP_JOB_PENDING &&
+ val->integer <= IPP_JOB_COMPLETED)
+ {
+ ptr = job_states[val->integer - IPP_JOB_PENDING];
+
+ if (bufptr < bufend)
+ strlcpy(bufptr, ptr, bufend - bufptr + 1);
+
+ bufptr += strlen(ptr);
+ break;
+ }
+
+ case IPP_TAG_INTEGER :
+ if (bufptr < bufend)
+ bufptr += snprintf(bufptr, bufend - bufptr + 1, "%d", val->integer);
+ else
+ bufptr += snprintf(temp, sizeof(temp), "%d", val->integer);
+ break;
+
+ case IPP_TAG_BOOLEAN :
+ if (bufptr < bufend)
+ strlcpy(bufptr, val->boolean ? "true" : "false",
+ bufend - bufptr + 1);
+
+ bufptr += val->boolean ? 4 : 5;
+ break;
+
+ case IPP_TAG_RANGE :
+ if (bufptr < bufend)
+ bufptr += snprintf(bufptr, bufend - bufptr + 1, "%d-%d",
+ val->range.lower, val->range.upper);
+ else
+ bufptr += snprintf(temp, sizeof(temp), "%d-%d", val->range.lower,
+ val->range.upper);
+ break;
+
+ case IPP_TAG_RESOLUTION :
+ if (bufptr < bufend)
+ bufptr += snprintf(bufptr, bufend - bufptr + 1, "%dx%d%s",
+ val->resolution.xres, val->resolution.yres,
+ val->resolution.units == IPP_RES_PER_INCH ?
+ "dpi" : "dpc");
+ else
+ bufptr += snprintf(temp, sizeof(temp), "%dx%d%s",
+ val->resolution.xres, val->resolution.yres,
+ val->resolution.units == IPP_RES_PER_INCH ?
+ "dpi" : "dpc");
+ break;
+
+ case IPP_TAG_DATE :
+ {
+ unsigned year; /* Year */
+
+ year = (val->date[0] << 8) + val->date[1];
+
+ if (val->date[9] == 0 && val->date[10] == 0)
+ snprintf(temp, sizeof(temp), "%04u-%02u-%02uT%02u:%02u:%02uZ",
+ year, val->date[2], val->date[3], val->date[4],
+ val->date[5], val->date[6]);
+ else
+ snprintf(temp, sizeof(temp),
+ "%04u-%02u-%02uT%02u:%02u:%02u%c%02u%02u",
+ year, val->date[2], val->date[3], val->date[4],
+ val->date[5], val->date[6], val->date[8], val->date[9],
+ val->date[10]);
+
+ if (bufptr < bufend)
+ strlcpy(bufptr, temp, bufend - bufptr + 1);
+
+ bufptr += strlen(temp);
+ }
+ break;
+
+ case IPP_TAG_TEXT :
+ case IPP_TAG_NAME :
+ case IPP_TAG_KEYWORD :
+ case IPP_TAG_CHARSET :
+ case IPP_TAG_URI :
+ case IPP_TAG_MIMETYPE :
+ case IPP_TAG_LANGUAGE :
+ case IPP_TAG_TEXTLANG :
+ case IPP_TAG_NAMELANG :
+ for (ptr = val->string.text; *ptr; ptr ++)
+ {
+ if (*ptr == '\\' || *ptr == '\"')
+ {
+ if (bufptr < bufend)
+ *bufptr = '\\';
+ bufptr ++;
+ }
+
+ if (bufptr < bufend)
+ *bufptr = *ptr;
+ bufptr ++;
+ }
+ break;
+
+ case IPP_TAG_BEGIN_COLLECTION :
+ if (bufptr < bufend)
+ bufptr += ipp_col_string(val->collection, bufptr,
+ bufend - bufptr + 1);
+ else
+ bufptr += ipp_col_string(val->collection, NULL, 0);
+ break;
+
+ case IPP_TAG_STRING :
+ for (ptr = val->string.text; *ptr; ptr ++)
+ {
+ if (*ptr == '\\' || isspace(*ptr & 255))
+ {
+ if (bufptr < bufend)
+ *bufptr = '\\';
+ bufptr ++;
+
+ if (bufptr < bufend)
+ *bufptr = *ptr;
+ bufptr ++;
+ }
+ else if (!isprint(*ptr & 255))
+ {
+ if (bufptr < bufend)
+ bufptr += snprintf(bufptr, bufend - bufptr + 1, "\\%03o",
+ *ptr & 255);
+ else
+ bufptr += snprintf(temp, sizeof(temp), "\\%03o",
+ *ptr & 255);
+ }
+ else
+ {
+ if (bufptr < bufend)
+ *bufptr = *ptr;
+ bufptr ++;
+ }
+ }
+ break;
+
+ default :
+ ptr = ippTagString(attr->value_tag);
+ if (bufptr < bufend)
+ strlcpy(bufptr, ptr, bufend - bufptr + 1);
+ bufptr += strlen(ptr);
+ break;
+ }
+ }
+
+ if (bufptr < bufend)
+ *bufptr = '\0';
+ else if (bufend)
+ *bufend = '\0';
+
+ return (bufptr - buffer);
+}
/*
}
+/*
+ * 'ipp_col_string()' - Convert a collection to a string.
+ */
+
+static size_t /* O - Number of bytes */
+ipp_col_string(ipp_t *col, /* I - Collection attribute */
+ char *buffer, /* I - Buffer or NULL */
+ size_t bufsize) /* I - Size of buffer */
+{
+ char *bufptr, /* Position in buffer */
+ *bufend, /* End of buffer */
+ temp[256]; /* Temporary string */
+ ipp_attribute_t *attr; /* Current member attribute */
+
+
+ bufptr = buffer;
+ bufend = buffer + bufsize - 1;
+
+ if (bufptr < bufend)
+ *bufptr = '{';
+ bufptr ++;
+
+ for (attr = col->attrs; attr; attr = attr->next)
+ {
+ if (!attr->name)
+ continue;
+
+ if (bufptr < bufend)
+ bufptr += snprintf(bufptr, bufend - bufptr + 1, "%s=", attr->name);
+ else
+ bufptr += snprintf(temp, sizeof(temp), "%s=", attr->name);
+
+ if (bufptr < bufend)
+ bufptr += _ippAttrString(attr, bufptr, bufend - bufptr + 1);
+ else
+ bufptr += _ippAttrString(attr, temp, sizeof(temp));
+ }
+
+ if (bufptr < bufend)
+ *bufptr = '}';
+ bufptr ++;
+
+ return (bufptr - buffer);
+}
+
+
/*
* End of "$Id$".
*/
help/man-cupstestppd.html \
help/man-drv.html \
help/man-filter.html \
+ help/man-ipptool.html \
+ help/man-ipptoolfile.html \
help/man-lp.html \
help/man-lpadmin.html \
help/man-lpc.html \
#
# "$Id$"
#
-# Man page makefile for the Common UNIX Printing System (CUPS).
+# Man page makefile for CUPS.
#
# Copyright 2007-2010 by Apple Inc.
# Copyright 1993-2006 by Easy Software Products.
cups-config.$(MAN1EXT) \
cupstestdsc.$(MAN1EXT) \
cupstestppd.$(MAN1EXT) \
- ipptest.$(MAN1EXT) \
+ ipptool.$(MAN1EXT) \
lp.$(MAN1EXT) \
lpoptions.$(MAN1EXT) \
lppasswd.$(MAN1EXT) \
client.conf.$(MAN5EXT) \
cups-snmp.conf.$(MAN5EXT) \
cupsd.conf.$(MAN5EXT) \
- ipp.test.$(MAN5EXT) \
+ ipptoolfile.$(MAN5EXT) \
mailto.conf.$(MAN5EXT) \
mime.convs.$(MAN5EXT) \
mime.types.$(MAN5EXT) \
+++ /dev/null
-.\"
-.\" "$Id$"
-.\"
-.\" ipptest man page for CUPS.
-.\"
-.\" Copyright 2010 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/".
-.\"
-.TH ipptest 1 "CUPS" "15 February 2010" "Apple Inc."
-.SH NAME
-ipptest - perform internet printing protocol tests
-.SH SYNOPSIS
-.B ipptest
-[ -E ] [ -V
-.I version
-] [ -X ] [ -c ] [ -d
-.I name=value
-] [ -f
-.I filename
-] [ -i
-.I seconds
-] [ -l ] [ -v ]
-.I URI
-.I filename.test
-[
-.I ... filenameN.test
-]
-.SH DESCRIPTION
-\fIipptest\fR sends IPP requests to the specified URI and tests the results.
-Each test file contains one or more test requests, including the expected
-response status, attributes, and values. Output is either a plain text or XML
-report on the standard output, with a non-zero exit status indicating that one
-or more tests have failed. The test file format is described in
-\fIipp.test(5)\fR.
-.SH OPTIONS
-The following options are recognized by \fIipptest\fR:
-.TP 5
--E
-Forces encryption when connecting to the server.
-.TP 5
--V version
-Specifies the default IPP version to use: 1.0, 1.1, 2.0, 2.1, or 2.2. If not
-specified, version 1.1 is used.
-.TP 5
--X
-Specifies that XML (Apple plist) output is desired instead of the plain text
-report. This option is incompatible with the \fI-i\fR (interval) option.
-.TP 5
--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.
-.TP 5
--d name=value
-Defines the named variable.
-.TP 5
--f filename
-Defines the default request filename for tests.
-.TP 5
--i seconds
-Specifies that the (last) test should be repeated at the specified interval.
-This option is incompatible with the \fI-X\fR (XML output) option.
-.TP 5
--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.
-.TP 5
--v
-Specifies that all request and response attributes should be output. This is the
-default for XML output.
-.SH COMPATIBILITY
-The \fIipptest\fR program is unique to CUPS.
-.SH SEE ALSO
-\fIipp.test(5)\fR,
-.br
-http://localhost:631/help
-.SH COPYRIGHT
-Copyright 2007-2010 by Apple Inc.
-.\"
-.\" End of "$Id$".
-.\"
--- /dev/null
+.\"
+.\" "$Id$"
+.\"
+.\" ipptool man page for CUPS.
+.\"
+.\" Copyright 2010 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/".
+.\"
+.TH ipptool 1 "CUPS" "6 April 2010" "Apple Inc."
+.SH NAME
+ipptool - perform internet printing protocol requests
+.SH SYNOPSIS
+.B ipptool
+[ -C ] [ -E ] [ -L ] [ -S ] [ -V
+.I version
+] [ -X ] [ -c ] [ -d
+.I name=value
+] [ -f
+.I filename
+] [ -i
+.I seconds
+] [ -n
+.I repeat-count
+] [ -q ] [ -t ] [ -v ]
+.I URI
+.I filename
+[
+.I ... filenameN
+]
+.SH DESCRIPTION
+\fIipptool\fR sends IPP requests to the specified URI and tests and/or displays the results. Each named file defines one or more requests, including the expected response status, attributes, and values. Output is either a plain text, formatted text, CSV, or XML report on the standard output, with a non-zero exit status indicating that one or more tests have failed. The file format is described in \fIipptoolfile(5)\fR.
+.SH OPTIONS
+The following options are recognized by \fIipptool\fR:
+.TP 5
+-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.
+.TP 5
+-E
+Forces TLS encryption when connecting to the server using the HTTP "Upgrade" header.
+.TP 5
+-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.
+.TP 5
+-S
+Forces (dedicated) SSL encryption when connecting to the server.
+.TP 5
+-V version
+Specifies the default IPP version to use: 1.0, 1.1, 2.0, 2.1, or 2.2. If not specified, version 1.1 is used.
+.TP 5
+-X
+Specifies that XML (Apple plist) output is desired instead of the plain text report. This option is incompatible with the \fI-i\fR (interval) and \fI-n\fR (repeat-count) options.
+.TP 5
+-c
+Specifies that CSV (comma-separated values) output is desired instead of the plain text output.
+.TP 5
+-d name=value
+Defines the named variable.
+.TP 5
+-f filename
+Defines the default request filename for tests.
+.TP 5
+-i seconds
+Specifies that the (last) file should be repeated at the specified interval. This option is incompatible with the \fI-x\fR (XML plist output) option.
+.TP 5
+-l
+Specifies that plain text output is desired.
+.TP 5
+-n repeat-count
+Specifies that the (last) file should be repeated the specified number of times. This option is incompatible with the \fI-X\fR (XML plist output) option.
+.TP 5
+-t
+Specifies that CUPS test report output is desired instead of the plain text output.
+.TP 5
+-v
+Specifies that all request and response attributes should be output in CUPS test mode (\fI-t\fR). This is the default for XML output.
+.SH COMPATIBILITY
+The \fIipptool\fR program is unique to CUPS.
+.SH EXAMPLES
+Get a list of completed jobs for "myprinter":
+.nf
+ ipptool ipp://localhost/printers/myprinter get-completed-jobs.test
+.fi
+.LP
+Send email notifications to "user@example.com" when "myprinter" changes:
+.nf
+ ipptool -d recipient=mailto:user@example.com \
+ ipp://localhost/printers/myprinter create-printer-subscription.test
+.fi
+.SH STANDARD FILES
+The following standard files are available:
+.nf
+ create-printer-subscription.test
+ get-completed-jobs.test
+ get-jobs.test
+ ipp-1.1.test
+ ipp-2.0.test
+ ipp-2.1.test
+ testfile.jpg
+ testfile.pdf
+ testfile.ps
+ testfile.txt
+.fi
+.SH SEE ALSO
+\fIipptoolfile(5)\fR,
+.br
+http://localhost:631/help
+.SH COPYRIGHT
+Copyright 2007-2010 by Apple Inc.
+.\"
+.\" End of "$Id$".
+.\"
.\"
.\" "$Id$"
.\"
-.\" ipp.test man page for CUPS.
+.\" ipptoolfile man page for CUPS.
.\"
.\" Copyright 2010 by Apple Inc.
.\"
.\" 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/".
.\"
-.TH ipp.test 5 "CUPS" "4 April 2010" "Apple Inc."
+.TH ipptoolfile 5 "CUPS" "6 April 2010" "Apple Inc."
.SH NAME
-ipp.test \- ipptest test file format
+ipptoolfile \- ipptool file format
.SH DESCRIPTION
-The \fIipptest(1)\fR program accepts free-form plain text files that describe
-one or more IPP operation tests. Comments start with the "#" character and
-continue to the end of the line. Each test is enclosed by curley braces, for
-example:
+The \fIipptool(1)\fR 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. Each request is enclosed by curley braces, for example:
.nf
# This is a comment
.TP 5
DEFINE variable-name value
Defines the named variable to the given value. This is equivalent to specifying
-"-d variable-name=value" on the \fIipptest\fR command-line.
+"-d variable-name=value" on the \fIipptool\fR command-line.
.TP 5
INCLUDE "filename"
.TP 5
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 \fIipptest\fR
+current test file, while the second form includes a file from the \fIipptool\fR
include directory.
.TP 5
TRANSFER auto
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
-\fIipptest\fR command-line. Support for chunked requests is required for
+\fIipptool\fR command-line. Support for chunked requests is required for
conformance with all versions of IPP.
.TP 5
TRANSFER length
Specifies that tests will, by default, use the HTTP/1.0 "Content-Length:"
-header. This is equivalent to specifying "-l" on the \fIipptest\fR command-line.
+header. This is equivalent to specifying "-l" on the \fIipptool\fR command-line.
Support for content length requests is required for conformance with all
versions of IPP.
.TP 5
.TP 5
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 \fIipptest\fR program.
+The default is the resource from the URI provided to the \fIipptool\fR program.
.TP 5
STATUS status-code [ predicate ]
Specifies an expected response status-code value. Additional requirements can be
.fi
.SH VARIABLES
-The \fIipptest\fR program maintains a list of variables that can be used in any
+The \fIipptool\fR 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:
environment variable is not defined.
.TP 5
$filename
-Inserts the filename provided to \fIipptest\fR with the "-f" option.
+Inserts the filename provided to \fIipptool\fR with the "-f" option.
.TP 5
$hostname
-Inserts the hostname from the URI provided to \fIipptest\fR.
+Inserts the hostname from the URI provided to \fIipptool\fR.
.TP 5
$job-id
Inserts the last job-id value returned in a test response or 0 if no job-id has
no job-uri has been seen.
.TP 5
$scheme
-Inserts the scheme from the URI provided to \fIipptest\fR.
+Inserts the scheme from the URI provided to \fIipptool\fR.
.TP 5
$notify-subscription-id
Inserts the last notify-subscription-id value returnd in a test response or 0 if
no notify-subscription-id has been seen.
.TP 5
$port
-Inserts the port number from the URI provided to \fIipptest\fR.
+Inserts the port number from the URI provided to \fIipptool\fR.
.TP 5
$resource
-Inserts the resource path from the URI provided to \fIipptest\fR.
+Inserts the resource path from the URI provided to \fIipptool\fR.
.TP 5
$uri
-Inserts the URI provided to \fIipptest\fR.
+Inserts the URI provided to \fIipptool\fR.
.TP 5
$user
Inserts the current user's login name.
.TP 5
$username
-Inserts the username from the URI provided to \fIipptest\fR, if any.
+Inserts the username from the URI provided to \fIipptool\fR, if any.
.SH SEE ALSO
-\fIipptest(1)\fR,
+\fIipptool(1)\fR,
.br
http://localhost:631/help
f 0555 root sys $BINDIR/cancel systemv/cancel
f 0555 root sys $BINDIR/cupstestdsc systemv/cupstestdsc
f 0555 root sys $BINDIR/cupstestppd systemv/cupstestppd
-f 0555 root sys $BINDIR/ipptest test/ipptest
+f 0555 root sys $BINDIR/ipptool test/ipptool
f 0555 root sys $BINDIR/lp systemv/lp
f 0555 root sys $BINDIR/lpoptions systemv/lpoptions
f 0555 root sys $BINDIR/lppasswd systemv/lppasswd
d 0755 root sys $DATADIR/fonts -
f 0444 root sys $DATADIR/fonts fonts/Monospace*
-d 0755 root sys $DATADIR/ipptest -
-f 0444 root sys $DATADIR/ipptest test/ipp-*.test
-f 0444 root sys $DATADIR/ipptest test/testfile.*
+d 0755 root sys $DATADIR/ipptool -
+f 0444 root sys $DATADIR/ipptool/create-printer-subscription.test test/create-printer-subscription.test
+f 0444 root sys $DATADIR/ipptool/get-completed-jobs.test test/get-completed-jobs.test
+f 0444 root sys $DATADIR/ipptool/get-jobs.test test/get-jobs.test
+f 0444 root sys $DATADIR/ipptool test/ipp-*.test
+f 0444 root sys $DATADIR/ipptool test/testfile.*
d 0755 root sys $DATADIR/mime -
f 0444 root sys $DATADIR/mime/mime.convs conf/mime.convs
f 0444 root sys $MANDIR/man1/cancel.$MAN1EXT man/cancel.$MAN1EXT
f 0444 root sys $MANDIR/man1/cupstestdsc.$MAN1EXT man/cupstestdsc.$MAN1EXT
f 0444 root sys $MANDIR/man1/cupstestppd.$MAN1EXT man/cupstestppd.$MAN1EXT
-f 0444 root sys $MANDIR/man1/ipptest.$MAN1EXT man/ipptest.$MAN1EXT
+f 0444 root sys $MANDIR/man1/ipptool.$MAN1EXT man/ipptool.$MAN1EXT
f 0444 root sys $MANDIR/man1/lpoptions.$MAN1EXT man/lpoptions.$MAN1EXT
f 0444 root sys $MANDIR/man1/lppasswd.$MAN1EXT man/lppasswd.$MAN1EXT
f 0444 root sys $MANDIR/man1/lpq.$MAN1EXT man/lpq.$MAN1EXT
f 0444 root sys $MANDIR/man5/classes.conf.$MAN5EXT man/classes.conf.$MAN5EXT
f 0444 root sys $MANDIR/man5/cupsd.conf.$MAN5EXT man/cupsd.conf.$MAN5EXT
-f 0444 root sys $MANDIR/man5/ipp.test.$MAN5EXT man/ipp.test.$MAN5EXT
+f 0444 root sys $MANDIR/man5/ipptoolfile.$MAN5EXT man/ipptoolfile.$MAN5EXT
f 0444 root sys $MANDIR/man5/mailto.conf.$MAN5EXT man/mailto.conf.$MAN5EXT
f 0444 root sys $MANDIR/man5/mime.convs.$MAN5EXT man/mime.convs.$MAN5EXT
f 0444 root sys $MANDIR/man5/mime.types.$MAN5EXT man/mime.types.$MAN5EXT
/usr/bin/cancel
/usr/bin/cupstestdsc
/usr/bin/cupstestppd
-/usr/bin/ipptest
+/usr/bin/ipptool
/usr/bin/lp*
%dir /usr/lib/cups
%dir /usr/lib/cups/backend
/usr/share/cups/drv/*
%dir /usr/share/cups/fonts
/usr/share/cups/fonts/*
-%dir /usr/share/cups/ipptest
-/usr/share/cups/ipptest/*
+%dir /usr/share/cups/ipptool
+/usr/share/cups/ipptool/*
%dir /usr/share/cups/mime
/usr/share/cups/mime/*
%dir /usr/share/cups/model
/usr/share/man/man1/cancel.1.gz
/usr/share/man/man1/cupstestdsc.1.gz
/usr/share/man/man1/cupstestppd.1.gz
-/usr/share/man/man1/ipptest.1.gz
+/usr/share/man/man1/ipptool.1.gz
/usr/share/man/man1/lp.1.gz
/usr/share/man/man1/lpoptions.1.gz
/usr/share/man/man1/lppasswd.1.gz
/usr/share/man/man1/lpstat.1.gz
%dir /usr/share/man/man5
/usr/share/man/man5/*.conf.5.gz
-/usr/share/man/man5/ipp.test.5.gz
+/usr/share/man/man5/ipptoolfile.5.gz
/usr/share/man/man5/mime.*.5.gz
%dir /usr/share/man/man7
/usr/share/man/man7/drv*
#
TESTFILES = \
+ create-printer-subscription.test \
+ get-completed-jobs.test \
+ get-jobs.test \
ipp-1.1.test \
ipp-2.0.test \
ipp-2.1.test \
# Make all targets...
#
-all: ipptest ipptest-static
+all: ipptool ipptool-static
#
#
clean:
- $(RM) ipptest ipptest.o ipptest-static
+ $(RM) ipptool ipptool.o ipptool-static
#
#
depend:
- makedepend -Y -I.. -fDependencies ipptest.c >/dev/null 2>&1
+ makedepend -Y -I.. -fDependencies ipptool.c >/dev/null 2>&1
#
#
install-data:
- echo Installing sample ipptest files in $(DATADIR)/ipptest...
- $(INSTALL_DIR) -m 755 $(DATADIR)/ipptest
+ echo Installing sample ipptool files in $(DATADIR)/ipptool...
+ $(INSTALL_DIR) -m 755 $(DATADIR)/ipptool
for file in $(TESTFILES); do \
- $(INSTALL_DATA) $$file $(DATADIR)/ipptest; \
+ $(INSTALL_DATA) $$file $(DATADIR)/ipptool; \
done
#
install-exec:
- echo Installing ipptest in $(BINDIR)...
+ echo Installing ipptool in $(BINDIR)...
$(INSTALL_DIR) -m 755 $(BINDIR)
- $(INSTALL_BIN) ipptest $(BINDIR)
+ $(INSTALL_BIN) ipptool $(BINDIR)
if test "x$(SYMROOT)" != "x"; then \
$(INSTALL_DIR) $(SYMROOT); \
- cp ipptest $(SYMROOT); \
+ cp ipptool $(SYMROOT); \
fi
#
-# ipptest
+# ipptool
#
-ipptest: ipptest.o ../cups/$(LIBCUPS)
+ipptool: ipptool.o ../cups/$(LIBCUPS)
echo Linking $@...
- $(CC) $(LDFLAGS) -o $@ ipptest.o $(LIBS)
+ $(CC) $(LDFLAGS) -o $@ ipptool.o $(LIBS)
#
-# ipptest-static
+# ipptool-static
#
-ipptest-static: ipptest.o ../cups/$(LIBCUPSSTATIC)
+ipptool-static: ipptool.o ../cups/$(LIBCUPSSTATIC)
echo Linking $@...
- $(CC) $(LDFLAGS) -o $@ ipptest.o ../cups/$(LIBCUPSSTATIC) \
+ $(CC) $(LDFLAGS) -o $@ ipptool.o ../cups/$(LIBCUPSSTATIC) \
$(LIBGSSAPI) $(SSLLIBS) $(DNSSDLIBS) $(COMMONLIBS) $(LIBZ)
#
-# "$Id: 4.4-subscription-ops.test 4840 2005-11-14 21:53:30Z mike $"
+# "$Id$"
#
-# Verify that the CUPS subscription operations work.
+# Create a printer subscription.
#
+# Copyright 2007-2010 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/".
+#
+# Usage:
+#
+# ./ipptool -d recipient=uri printer-uri create-printer-subscription.test
+#
+
+
{
# The name of the test...
- NAME "Add Printer Subscription w/Lease"
+ NAME "Create a printer subscription"
# The operation to use
OPERATION Create-Printer-Subscription
- RESOURCE /
# The attributes to send
- GROUP operation
+ GROUP operation-attributes-tag
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
ATTR uri printer-uri $uri
- GROUP subscription
- ATTR uri notify-recipient testnotify://nowait
+ GROUP subscription-attributes-tag
+ ATTR uri notify-recipient $recipient
ATTR keyword notify-events printer-state-changed
# What statuses are OK?
STATUS successful-ok
# What attributes do we expect?
- EXPECT attributes-charset
- EXPECT attributes-natural-language
- EXPECT notify-subscription-id
+ EXPECT notify-subscription-id OF-TYPE integer WITH-VALUE >0
DISPLAY notify-subscription-id
}
+
#
-# End of "$Id: 4.4-subscription-ops.test 4840 2005-11-14 21:53:30Z mike $"
+# End of "$Id$"
#
--- /dev/null
+#
+# "$Id$"
+#
+# Get list of completed jobs.
+#
+# Copyright 2007-2010 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/".
+#
+# Usage:
+#
+# ./ipptool printer-uri get-jobs.test
+#
+
+
+{
+ # The name of the test...
+ NAME "Get completed jobs"
+
+ # The operation to use
+ OPERATION Get-Jobs
+
+ # Attributes, starting in the operation group...
+ GROUP operation-attributes-tag
+ ATTR charset attributes-charset utf-8
+ ATTR language attributes-natural-language en
+ ATTR uri printer-uri $uri
+ ATTR keyword which-jobs completed
+ ATTR keyword requested-attributes
+ job-id,job-name,document-format,job-media-sheets-completed,job-originating-user-name
+
+ # What statuses are OK?
+ STATUS successful-ok
+
+ # What attributes to display
+ DISPLAY job-id
+ DISPLAY job-name
+ DISPLAY document-format
+ DISPLAY job-media-sheets-completed
+ DISPLAY job-originating-user-name
+}
+
+
+#
+# End of "$Id$".
+#
-# Get list of jobs
+#
+# "$Id$"
+#
+# Get list of not-completed jobs.
+#
+# Copyright 2007-2010 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/".
+#
+# Usage:
+#
+# ./ipptool printer-uri get-jobs.test
+#
+
+
{
# The name of the test...
- NAME "Get-Jobs"
-
- # The resource to use for the POST
- # RESOURCE /admin
+ NAME "Get pending jobs"
# The operation to use
OPERATION Get-Jobs
# Attributes, starting in the operation group...
- GROUP operation
+ GROUP operation-attributes-tag
ATTR charset attributes-charset utf-8
ATTR language attributes-natural-language en
ATTR uri printer-uri $uri
-# ATTR keyword which-jobs completed
+ ATTR keyword requested-attributes
+ job-id,job-name,document-format,job-media-sheets-completed,job-originating-user-name
# What statuses are OK?
STATUS successful-ok
+
+ # What attributes to display
+ DISPLAY job-id
+ DISPLAY job-name
+ DISPLAY document-format
+ DISPLAY job-media-sheets-completed
+ DISPLAY job-originating-user-name
}
+
+
+#
+# End of "$Id$".
+#
#
# Usage:
#
-# ./ipptest -f filename printer-uri ipp-1.1.test
+# ./ipptool -f filename -t printer-uri ipp-1.1.test
#
# Test that a request-id value of 0 is not accepted.
#
# Usage:
#
-# ./ipptest -V 2.0 -f filename printer-uri ipp-2.0.test
+# ./ipptool -V 2.0 -f filename -t printer-uri ipp-2.0.test
#
# Do all of the IPP/1.1 tests as an IPP/2.0 client
STATUS successful-ok
# Job template attributes
- EXPECT ?media-default OF-TYPE keyword|name IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?media-ready OF-TYPE keyword|name IN-GROUP printer-attributes-tag
- EXPECT ?media-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag
- EXPECT ?multiple-document-handling-default OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE "/^(single-document|separate-documents-uncollated-copies|separate-documents-collated-copies|single-document-new-sheet)$$/"
- EXPECT ?multiple-document-handling-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE "/^(single-document|separate-documents-uncollated-copies|separate-documents-collated-copies|single-document-new-sheet)$$/"
- EXPECT ?number-up-default OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0
- EXPECT ?number-up-supported OF-TYPE integer|rangeOfInteger IN-GROUP printer-attributes-tag WITH-VALUE >0
- EXPECT ?number-up-supported WITH-VALUE 1
- EXPECT ?orientation-requested-default OF-TYPE enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE 3,4,5,6
- EXPECT ?orientation-requested-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 3,4,5,6
- EXPECT ?pages-ranges-supported OF-TYPE boolean IN-GROUP printer-attributes-tag
- EXPECT ?print-quality-default OF-TYPE enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE 3,4,5
- EXPECT ?print-quality-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 3,4,5
- EXPECT ?printer-resolution-default OF-TYPE resolution IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?printer-resolution-supported OF-TYPE resolution IN-GROUP printer-attributes-tag
- EXPECT ?sides-default OF-TYPE keyword IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^(one-sided|two-sided-long-edge|two-sided-short-edge)$$/"
- EXPECT ?sides-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE "/^(one-sided|two-sided-long-edge|two-sided-short-edge)$$/"
+ EXPECT copies-default OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0
+ EXPECT copies-supported OF-TYPE rangeOfInteger IN-GROUP printer-attributes-tag
+ EXPECT finishings-default OF-TYPE enum IN-GROUP printer-attributes-tag
+ EXPECT finishings-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 3
+ EXPECT media-default OF-TYPE keyword|name IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT media-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag
+ EXPECT orientation-requested-default OF-TYPE enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE 3,4,5,6
+ EXPECT orientation-requested-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 3,4,5,6
+ EXPECT output-bin-default OF-TYPE keyword|name IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT output-bin-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag
+ EXPECT print-quality-default OF-TYPE enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE 3,4,5
+ EXPECT print-quality-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 3,4,5
+ EXPECT printer-resolution-default OF-TYPE resolution IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT printer-resolution-supported OF-TYPE resolution IN-GROUP printer-attributes-tag
+ EXPECT sides-default OF-TYPE keyword IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^(one-sided|two-sided-long-edge|two-sided-short-edge)$$/"
+ EXPECT sides-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE "/^(one-sided|two-sided-long-edge|two-sided-short-edge)$$/"
# Printer description attributes
- EXPECT ?color-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?job-impressions-supported OF-TYPE rangeOfInteger IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?job-k-octets-supported OF-TYPE rangeOfInteger IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?job-media-sheets-supported OF-TYPE rangeOfInteger IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?multiple-document-jobs-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?multiple-operation-time-out OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0
- EXPECT ?pages-per-minute OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?pages-per-minute-color OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?printer-driver-installer OF-TYPE uri IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?printer-info OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
- EXPECT ?printer-location OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
- EXPECT ?printer-make-and-model OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
- EXPECT ?printer-message-from-operator OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
- EXPECT ?printer-more-info OF-TYPE uri IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?printer-more-info-manufacturer OF-TYPE uri IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?printer-state-message OF-TYPE text IN-GROUP printer-attributes-tag
- EXPECT ?reference-uri-schemes-supported OF-TYPE uriScheme IN-GROUP printer-attributes-tag
- EXPECT charset-configured OF-TYPE charset IN-GROUP printer-attributes-tag COUNT 1
- EXPECT charset-supported OF-TYPE charset IN-GROUP printer-attributes-tag WITH-VALUE utf-8
- EXPECT compression-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE none
- EXPECT document-format-default OF-TYPE mimeMediaType IN-GROUP printer-attributes-tag COUNT 1
- EXPECT document-format-supported OF-TYPE mimeMediaType IN-GROUP printer-attributes-tag
- EXPECT generated-natural-language-supported OF-TYPE naturalLanguage IN-GROUP printer-attributes-tag
- EXPECT ipp-versions-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE 1.1
- EXPECT natural-language-configured OF-TYPE naturalLanguage IN-GROUP printer-attributes-tag COUNT 1
- EXPECT operations-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 0x0002 # Print-Job
- # Not requiring 0x0004 Validate-Job since it is deprecated
- EXPECT operations-supported WITH-VALUE 0x0008 # Cancel-Job
- EXPECT operations-supported WITH-VALUE 0x0009 # Get-Job-Attributes
- EXPECT operations-supported WITH-VALUE 0x000A # Get-Jobs
- EXPECT operations-supported WITH-VALUE 0x000B # Get-Printer-Attributes
- EXPECT pdl-override-supported OF-TYPE keyword IN-GROUP printer-attributes-tag COUNT 1
- EXPECT printer-is-accepting-jobs OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1
- EXPECT printer-name OF-TYPE name IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{1,127}$$/"
- EXPECT printer-state OF-TYPE enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE 3,4,5
- EXPECT printer-state-reasons OF-TYPE keyword IN-GROUP printer-attributes-tag
- EXPECT printer-up-time OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0
- EXPECT printer-uri-supported OF-TYPE uri IN-GROUP printer-attributes-tag SAME-COUNT-AS uri-security-supported
- EXPECT queued-job-count OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
- EXPECT uri-authentication-supported OF-TYPE keyword IN-GROUP printer-attributes-tag
- EXPECT uri-security-supported OF-TYPE keyword IN-GROUP printer-attributes-tag SAME-COUNT-AS uri-authentication-supported
+ EXPECT color-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT pages-per-minute OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT pages-per-minute-color OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT printer-info OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
+ EXPECT printer-location OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
+ EXPECT printer-make-and-model OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
+ EXPECT printer-more-info OF-TYPE uri IN-GROUP printer-attributes-tag COUNT 1
}
#
# Usage:
#
-# ./ipptest -V 2.1 -f filename printer-uri ipp-2.0.test
+# ./ipptool -V 2.1 -f filename -t printer-uri ipp-2.1.test
#
# Do all of the IPP/1.1 and IPP/2.0 tests as an IPP/2.1 client
STATUS successful-ok
# Job template attributes
- EXPECT ?media-default OF-TYPE keyword|name IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?media-ready OF-TYPE keyword|name IN-GROUP printer-attributes-tag
- EXPECT ?media-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag
- EXPECT ?multiple-document-handling-default OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE "/^(single-document|separate-documents-uncollated-copies|separate-documents-collated-copies|single-document-new-sheet)$$/"
- EXPECT ?multiple-document-handling-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE "/^(single-document|separate-documents-uncollated-copies|separate-documents-collated-copies|single-document-new-sheet)$$/"
- EXPECT ?number-up-default OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0
- EXPECT ?number-up-supported OF-TYPE integer|rangeOfInteger IN-GROUP printer-attributes-tag WITH-VALUE >0
- EXPECT ?number-up-supported WITH-VALUE 1
- EXPECT ?orientation-requested-default OF-TYPE enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE 3,4,5,6
- EXPECT ?orientation-requested-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 3,4,5,6
- EXPECT ?pages-ranges-supported OF-TYPE boolean IN-GROUP printer-attributes-tag
- EXPECT ?print-quality-default OF-TYPE enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE 3,4,5
- EXPECT ?print-quality-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 3,4,5
- EXPECT ?printer-resolution-default OF-TYPE resolution IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?printer-resolution-supported OF-TYPE resolution IN-GROUP printer-attributes-tag
- EXPECT ?sides-default OF-TYPE keyword IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^(one-sided|two-sided-long-edge|two-sided-short-edge)$$/"
- EXPECT ?sides-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE "/^(one-sided|two-sided-long-edge|two-sided-short-edge)$$/"
+ EXPECT job-hold-until-default OF-TYPE keyword|name IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT job-hold-until-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag WITH-VALUE no-hold
+ EXPECT job-priority-default OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0,<101
+ EXPECT job-priority-supported OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0,<101
+ EXPECT job-settable-attributes-supported OF-TYPE keyword IN-GROUP printer-attributes-tag
+ EXPECT job-sheets-default OF-TYPE keyword|name IN-GROUP printer-attributes-tag
+ EXPECT job-sheets-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag WITH-VALUE none
+ EXPECT media-col-default OF-TYPE collection IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT media-col-supported OF-TYPE keyword IN-GROUP printer-attributes-tag
+ EXPECT media-col-supported WITH-VALUE media-size
+ EXPECT media-default OF-TYPE keyword|name IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT media-supported OF-TYPE keyword|name IN-GROUP printer-attributes-tag
+
+ # Subscription attributes
+ EXPECT notify-events-default OF-TYPE keyword IN-GROUP printer-attributes-tag
+ EXPECT notify-events-supported OF-TYPE keyword IN-GROUP printer-attributes-tag
+ EXPECT notify-lease-duration-default OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT notify-lease-duration-supported OF-TYPE integer|rangeOfInteger IN-GROUP printer-attributes-tag
+ EXPECT notify-max-events-supported OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >1
+ EXPECT notify-pull-method-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE ippget
# Printer description attributes
- EXPECT ?color-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?job-impressions-supported OF-TYPE rangeOfInteger IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?job-k-octets-supported OF-TYPE rangeOfInteger IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?job-media-sheets-supported OF-TYPE rangeOfInteger IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?multiple-document-jobs-supported OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?multiple-operation-time-out OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0
- EXPECT ?pages-per-minute OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?pages-per-minute-color OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?printer-driver-installer OF-TYPE uri IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?printer-info OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
- EXPECT ?printer-location OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
- EXPECT ?printer-make-and-model OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
- EXPECT ?printer-message-from-operator OF-TYPE text IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{0,127}$$/"
- EXPECT ?printer-more-info OF-TYPE uri IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?printer-more-info-manufacturer OF-TYPE uri IN-GROUP printer-attributes-tag COUNT 1
- EXPECT ?printer-state-message OF-TYPE text IN-GROUP printer-attributes-tag
- EXPECT ?reference-uri-schemes-supported OF-TYPE uriScheme IN-GROUP printer-attributes-tag
- EXPECT charset-configured OF-TYPE charset IN-GROUP printer-attributes-tag COUNT 1
- EXPECT charset-supported OF-TYPE charset IN-GROUP printer-attributes-tag WITH-VALUE utf-8
- EXPECT compression-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE none
- EXPECT document-format-default OF-TYPE mimeMediaType IN-GROUP printer-attributes-tag COUNT 1
- EXPECT document-format-supported OF-TYPE mimeMediaType IN-GROUP printer-attributes-tag
- EXPECT generated-natural-language-supported OF-TYPE naturalLanguage IN-GROUP printer-attributes-tag
- EXPECT ipp-versions-supported OF-TYPE keyword IN-GROUP printer-attributes-tag WITH-VALUE 1.1
- EXPECT natural-language-configured OF-TYPE naturalLanguage IN-GROUP printer-attributes-tag COUNT 1
- EXPECT operations-supported OF-TYPE enum IN-GROUP printer-attributes-tag WITH-VALUE 0x0002 # Print-Job
- # Not requiring 0x0004 Validate-Job since it is deprecated
- EXPECT operations-supported WITH-VALUE 0x0008 # Cancel-Job
- EXPECT operations-supported WITH-VALUE 0x0009 # Get-Job-Attributes
- EXPECT operations-supported WITH-VALUE 0x000A # Get-Jobs
- EXPECT operations-supported WITH-VALUE 0x000B # Get-Printer-Attributes
- EXPECT pdl-override-supported OF-TYPE keyword IN-GROUP printer-attributes-tag COUNT 1
- EXPECT printer-is-accepting-jobs OF-TYPE boolean IN-GROUP printer-attributes-tag COUNT 1
- EXPECT printer-name OF-TYPE name IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE "/^.{1,127}$$/"
- EXPECT printer-state OF-TYPE enum IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE 3,4,5
+ EXPECT ippget-event-life OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
+ EXPECT multiple-operation-time-out OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0
+
+ EXPECT operations-supported WITH-VALUE 0x0005 # Create-Job
+ EXPECT operations-supported WITH-VALUE 0x0006 # Send-Document
+ EXPECT operations-supported WITH-VALUE 0x000C # Hold-Job
+ EXPECT operations-supported WITH-VALUE 0x000D # Release-Job
+ EXPECT operations-supported WITH-VALUE 0x000E # Restart-Job
+ EXPECT operations-supported WITH-VALUE 0x0010 # Pause-Printer
+ EXPECT operations-supported WITH-VALUE 0x0011 # Resume-Printer
+ EXPECT operations-supported WITH-VALUE 0x0012 # Purge-Jobs
+ EXPECT operations-supported WITH-VALUE 0x0013 # Set-Printer-Attributes
+ EXPECT operations-supported WITH-VALUE 0x0014 # Set-Job-Attributes
+ EXPECT operations-supported WITH-VALUE 0x0015 # Get-Printer-Supported-Values
+ EXPECT operations-supported WITH-VALUE 0x0016 # Create-Printer-Subscriptions
+ EXPECT operations-supported WITH-VALUE 0x0018 # Get-Subscription-Attributes
+ EXPECT operations-supported WITH-VALUE 0x0019 # Get-Subscriptions
+ EXPECT operations-supported WITH-VALUE 0x001A # Renew-Subscription
+ EXPECT operations-supported WITH-VALUE 0x001B # Cancel-Subscription
+ EXPECT operations-supported WITH-VALUE 0x001C # Get-Notifications
+ EXPECT operations-supported WITH-VALUE 0x0022 # Enable-Printer
+ EXPECT operations-supported WITH-VALUE 0x0023 # Disable-Printer
+
+ ?EXPECT printer-alert OF-TYPE octetString IN-GROUP printer-attributes-tag
+ ?EXPECT printer-alert-description OF-TYPE text IN-GROUP printer-attributes-tag SAME-COUNT-AS printer-alert
+ EXPECT printer-settable-attributes-supported OF-TYPE keyword IN-GROUP printer-attributes-tag
+ EXPECT printer-state-change-time OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
EXPECT printer-state-reasons OF-TYPE keyword IN-GROUP printer-attributes-tag
- EXPECT printer-up-time OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1 WITH-VALUE >0
- EXPECT printer-uri-supported OF-TYPE uri IN-GROUP printer-attributes-tag SAME-COUNT-AS uri-security-supported
- EXPECT queued-job-count OF-TYPE integer IN-GROUP printer-attributes-tag COUNT 1
- EXPECT uri-authentication-supported OF-TYPE keyword IN-GROUP printer-attributes-tag
- EXPECT uri-security-supported OF-TYPE keyword IN-GROUP printer-attributes-tag SAME-COUNT-AS uri-authentication-supported
}
/*
* "$Id$"
*
- * IPP test command for CUPS.
+ * ipptool command for CUPS.
*
* Copyright 2007-2010 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
* dateTime value.
* print_attr() - Print an attribute on the screen.
* print_col() - Print a collection attribute on the screen.
+ * print_csv() - Print a line of CSV text.
* print_fatal_error() - Print a fatal error message.
+ * print_line() - Print a line of formatted text.
* print_test_error() - Print a test error message.
* print_xml_header() - Print a standard XML plist header.
* print_xml_string() - Print an XML string with escaping.
* Types...
*/
-typedef enum /**** How to send request data ****/
+typedef enum _cups_transfer_e /**** How to send request data ****/
{
_CUPS_TRANSFER_AUTO, /* Chunk for files, length for static */
_CUPS_TRANSFER_CHUNKED, /* Chunk always */
_CUPS_TRANSFER_LENGTH /* Length always */
} _cups_transfer_t;
+typedef enum _cups_output_e /**** Output mode ****/
+{
+ _CUPS_OUTPUT_QUIET, /* No output */
+ _CUPS_OUTPUT_TEST, /* Traditional CUPS test output */
+ _CUPS_OUTPUT_PLIST, /* XML plist test output */
+ _CUPS_OUTPUT_LIST, /* Tabular list output */
+ _CUPS_OUTPUT_CSV /* Comma-separated values output */
+} _cups_output_t;
+
typedef struct _cups_expect_s /**** Expected attribute info ****/
{
int optional, /* Optional attribute? */
_cups_transfer_t Transfer = _CUPS_TRANSFER_AUTO;
/* How to transfer requests */
+_cups_output_t Output = _CUPS_OUTPUT_LIST;
+ /* Output mode */
int Verbosity = 0, /* Show all attributes? */
Version = 11, /* Default IPP version */
- XML = 0, /* Produce XML output? */
XMLHeader = 0; /* 1 if header is written */
const char * const URIStatusStrings[] = /* URI status strings */
{
static char *iso_date(ipp_uchar_t *date);
static void print_attr(ipp_attribute_t *attr);
static void print_col(ipp_t *col);
+static void print_csv(ipp_attribute_t *attr, int num_displayed,
+ char **displayed, size_t *widths);
static void print_fatal_error(const char *s, ...)
#ifdef __GNUC__
__attribute__ ((__format__ (__printf__, 1, 2)))
#endif /* __GNUC__ */
;
+static void print_line(ipp_attribute_t *attr, int num_displayed,
+ char **displayed, size_t *widths);
static void print_test_error(const char *s, ...)
#ifdef __GNUC__
__attribute__ ((__format__ (__printf__, 1, 2)))
int status; /* Status of tests... */
char *opt, /* Current option */
name[1024], /* Name/value buffer */
- *value; /* Pointer to value */
+ *value, /* Pointer to value */
+ filename[1024], /* Real filename */
+ testname[1024]; /* Real test filename */
const char *testfile; /* Test file to use */
- int interval; /* Test interval */
+ int interval, /* Test interval */
+ repeat; /* Repeat count */
_cups_vars_t vars; /* Variables */
http_uri_status_t uri_status; /* URI separation status */
+ _cups_globals_t *cg = _cupsGlobals();
+ /* Global data */
+
/*
/*
* We need at least:
*
- * ipptest URI testfile
+ * ipptool URI testfile
*/
- testfile = NULL;
- status = 0;
interval = 0;
+ repeat = 0;
+ status = 0;
+ testfile = NULL;
for (i = 1; i < argc; i ++)
{
{
switch (*opt)
{
- case 'E' : /* Encrypt */
+ case 'C' : /* Enable HTTP chunking */
+ Transfer = _CUPS_TRANSFER_CHUNKED;
+ break;
+
+ case 'E' : /* Encrypt with TLS */
#ifdef HAVE_SSL
vars.encryption = HTTP_ENCRYPT_REQUIRED;
#else
#endif /* HAVE_SSL */
break;
+ case 'L' : /* Disable HTTP chunking */
+ Transfer = _CUPS_TRANSFER_LENGTH;
+ break;
+
+ case 'S' : /* Encrypt with SSL */
+#ifdef HAVE_SSL
+ vars.encryption = HTTP_ENCRYPT_ALWAYS;
+#else
+ _cupsLangPrintf(stderr,
+ _("%s: Sorry, no encryption support compiled in\n"),
+ argv[0]);
+#endif /* HAVE_SSL */
+ break;
+
case 'V' : /* Set IPP version */
i ++;
if (i >= argc)
{
_cupsLangPuts(stderr,
- _("ipptest: Missing version for \"-V\".\n"));
+ _("ipptool: Missing version for \"-V\".\n"));
usage();
}
else
{
_cupsLangPrintf(stderr,
- _("ipptest: Bad version %s for \"-V\".\n"),
+ _("ipptool: Bad version %s for \"-V\".\n"),
argv[i]);
usage();
}
break;
case 'X' : /* Produce XML output */
- XML = 1;
+ Output = _CUPS_OUTPUT_PLIST;
- if (interval)
+ if (interval || repeat)
{
- _cupsLangPuts(stderr, _("ipptest: \"-i\" is incompatible with "
- "\"-x\".\n"));
+ _cupsLangPuts(stderr, _("ipptool: \"-i\" and \"-n\" are "
+ "incompatible with -X\".\n"));
usage();
}
break;
- case 'c' : /* Enable HTTP chunking */
- Transfer = _CUPS_TRANSFER_CHUNKED;
+ case 'c' : /* CSV output */
+ Output = _CUPS_OUTPUT_CSV;
break;
case 'd' : /* Define a variable */
if (i >= argc)
{
_cupsLangPuts(stderr,
- _("ipptest: Missing name=value for \"-d\".\n"));
+ _("ipptool: Missing name=value for \"-d\".\n"));
usage();
}
if (i >= argc)
{
_cupsLangPuts(stderr,
- _("ipptest: Missing filename for \"-f\".\n"));
+ _("ipptool: Missing filename for \"-f\".\n"));
usage();
}
- vars.filename = argv[i];
+ if (access(argv[i], 0) && argv[i][0] != '/')
+ {
+ snprintf(filename, sizeof(filename), "%s/ipptool/%s",
+ cg->cups_datadir, argv[i]);
+ if (access(argv[i], 0))
+ vars.filename = argv[i];
+ else
+ vars.filename = filename;
+ }
+ else
+ vars.filename = argv[i];
break;
case 'i' : /* Test every N seconds */
- i++;
+ i ++;
if (i >= argc)
{
_cupsLangPuts(stderr,
- _("ipptest: Missing seconds for \"-i\".\n"));
+ _("ipptool: Missing seconds for \"-i\".\n"));
usage();
}
else
interval = atoi(argv[i]);
- if (XML && interval)
+ if (Output == _CUPS_OUTPUT_PLIST && interval)
{
- _cupsLangPuts(stderr, _("ipptest: \"-i\" is incompatible with "
- "\"-x\".\n"));
+ _cupsLangPuts(stderr, _("ipptool: \"-i\" is incompatible with "
+ "\"-X\".\n"));
usage();
}
break;
- case 'l' : /* Disable HTTP chunking */
- Transfer = _CUPS_TRANSFER_LENGTH;
+ case 'l' : /* List as a table */
+ Output = _CUPS_OUTPUT_LIST;
+ break;
+
+ case 'n' : /* Repeat count */
+ i ++;
+
+ if (i >= argc)
+ {
+ _cupsLangPuts(stderr,
+ _("ipptool: Missing count for \"-n\".\n"));
+ usage();
+ }
+ else
+ repeat = atoi(argv[i]);
+
+ if (Output == _CUPS_OUTPUT_PLIST && repeat)
+ {
+ _cupsLangPuts(stderr, _("ipptool: \"-n\" is incompatible with "
+ "\"-X\".\n"));
+ usage();
+ }
+ break;
+
+ case 'q' : /* Be quiet */
+ Output = _CUPS_OUTPUT_QUIET;
+ break;
+
+ case 't' : /* CUPS test output */
+ Output = _CUPS_OUTPUT_TEST;
break;
case 'v' : /* Be verbose */
break;
default :
- _cupsLangPrintf(stderr, _("ipptest: Unknown option \"-%c\".\n"),
+ _cupsLangPrintf(stderr, _("ipptool: Unknown option \"-%c\".\n"),
*opt);
usage();
break;
if (vars.uri)
{
- _cupsLangPuts(stderr, _("ipptest: May only specify a single URI.\n"));
+ _cupsLangPuts(stderr, _("ipptool: May only specify a single URI.\n"));
usage();
}
if (uri_status != HTTP_URI_OK)
{
- _cupsLangPrintf(stderr, _("ipptest: Bad URI - %s.\n"),
+ _cupsLangPrintf(stderr, _("ipptool: Bad URI - %s.\n"),
URIStatusStrings[uri_status - HTTP_URI_OVERFLOW]);
return (1);
}
if (strcmp(vars.scheme, "http") && strcmp(vars.scheme, "https") &&
strcmp(vars.scheme, "ipp"))
{
- _cupsLangPuts(stderr, _("ipptest: Only http, https, and ipp URIs are "
+ _cupsLangPuts(stderr, _("ipptool: Only http, https, and ipp URIs are "
"supported."));
return (1);
}
if (!vars.uri)
{
- _cupsLangPuts(stderr, _("ipptest: URI required before test file."));
+ _cupsLangPuts(stderr, _("ipptool: URI required before test file."));
usage();
}
- testfile = argv[i];
+ if (access(argv[i], 0) && argv[i][0] != '/')
+ {
+ snprintf(testname, sizeof(testname), "%s/ipptool/%s", cg->cups_datadir,
+ argv[i]);
+ if (access(testname, 0))
+ testfile = argv[i];
+ else
+ testfile = testname;
+ }
+ else
+ testfile = argv[i];
if (!do_tests(&vars, testfile))
status = 1;
* Loop if the interval is set...
*/
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
print_xml_trailer(!status, NULL);
+ else if (interval && repeat > 0)
+ {
+ while (repeat > 1)
+ {
+ sleep(interval);
+ do_tests(&vars, testfile);
+ repeat --;
+ }
+ }
else if (interval)
{
for (;;)
*expect, /* Current expected attribute */
*last_expect; /* Last EXPECT (for predicates) */
int num_displayed = 0; /* Number of displayed attributes */
- char *displayed[100]; /* Displayed attributes */
+ char *displayed[200]; /* Displayed attributes */
+ size_t widths[200]; /* Width of columns */
/*
* Loop on tests...
*/
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
print_xml_header();
- else
+ else if (Output == _CUPS_OUTPUT_TEST)
printf("\"%s\":\n", testfile);
CUPS_SRAND(time(NULL));
request->request.op.operation_id = op;
request->request.op.request_id = request_id;
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
{
puts("<dict>");
puts("<key>Name</key>");
print_attr(attrptr);
puts("</dict>");
}
- else
+ else if (Output == _CUPS_OUTPUT_TEST)
{
if (Verbosity)
{
}
}
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
{
puts("<key>Successful</key>");
puts(pass ? "<true />" : "<false />");
print_attr(attrptr);
puts("</dict>");
}
- else
+ else if (Output == _CUPS_OUTPUT_TEST)
{
puts(pass ? "PASS]" : "FAIL]");
}
}
}
+ else if (!pass)
+ fprintf(stderr, "%s\n", cupsLastErrorString());
- if (pass && !XML && !Verbosity && num_displayed > 0)
+ if (pass && Output != _CUPS_OUTPUT_PLIST && Output != _CUPS_OUTPUT_QUIET &&
+ !Verbosity && num_displayed > 0)
{
- for (attrptr = response->attrs;
- attrptr != NULL;
- attrptr = attrptr->next)
- if (attrptr->name)
- for (i = 0; i < num_displayed; i ++)
- if (!strcmp(displayed[i], attrptr->name))
+ if (Output >= _CUPS_OUTPUT_LIST)
+ {
+ size_t width; /* Length of value */
+
+
+ for (i = 0; i < num_displayed; i ++)
+ {
+ widths[i] = strlen(displayed[i]);
+
+ for (attrptr = ippFindAttribute(response, displayed[i], IPP_TAG_ZERO);
+ attrptr;
+ attrptr = ippFindNextAttribute(response, displayed[i],
+ IPP_TAG_ZERO))
+ {
+ width = _ippAttrString(attrptr, NULL, 0);
+ if (width > widths[i])
+ widths[i] = width;
+ }
+ }
+
+ if (Output == _CUPS_OUTPUT_CSV)
+ print_csv(NULL, num_displayed, displayed, widths);
+ else
+ print_line(NULL, num_displayed, displayed, widths);
+
+ attrptr = response->attrs;
+
+ while (attrptr)
+ {
+ while (attrptr && attrptr->group_tag <= IPP_TAG_OPERATION)
+ attrptr = attrptr->next;
+
+ if (attrptr)
+ {
+ if (Output == _CUPS_OUTPUT_CSV)
+ print_csv(attrptr, num_displayed, displayed, widths);
+ else
+ print_line(attrptr, num_displayed, displayed, widths);
+
+ while (attrptr && attrptr->group_tag > IPP_TAG_OPERATION)
+ attrptr = attrptr->next;
+ }
+ }
+ }
+ else
+ {
+ for (attrptr = response->attrs;
+ attrptr != NULL;
+ attrptr = attrptr->next)
+ {
+ if (attrptr->name)
+ {
+ for (i = 0; i < num_displayed; i ++)
{
- print_attr(attrptr);
- break;
+ if (!strcmp(displayed[i], attrptr->name))
+ {
+ print_attr(attrptr);
+ break;
+ }
}
+ }
+ }
+ }
}
else if (!pass)
{
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
{
puts("<key>Errors</key>");
puts("<array>");
}
}
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
puts("</array>");
}
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
puts("</dict>");
ippDelete(response);
if (*src == '<' && src[strlen(src) - 1] == '>')
{
/*
- * Map <filename> to CUPS_DATADIR/ipptest/filename...
+ * Map <filename> to CUPS_DATADIR/ipptool/filename...
*/
- snprintf(dst, dstsize, "%s/ipptest/%s", cg->cups_datadir, src + 1);
+ snprintf(dst, dstsize, "%s/ipptool/%s", cg->cups_datadir, src + 1);
dstptr = dst + strlen(dst) - 1;
if (*dstptr == '>')
*dstptr = '\0';
ipp_attribute_t *colattr; /* Collection attribute */
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
{
if (!attr->name)
{
if (attr->num_values > 1)
puts("<array>");
}
- else
+ else if (Output == _CUPS_OUTPUT_TEST)
{
if (!attr->name)
{
case IPP_TAG_INTEGER :
case IPP_TAG_ENUM :
for (i = 0; i < attr->num_values; i ++)
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
printf("<integer>%d</integer>\n", attr->values[i].integer);
else
printf("%d ", attr->values[i].integer);
case IPP_TAG_BOOLEAN :
for (i = 0; i < attr->num_values; i ++)
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
puts(attr->values[i].boolean ? "<true />" : "<false />");
else if (attr->values[i].boolean)
fputs("true ", stdout);
case IPP_TAG_RANGE :
for (i = 0; i < attr->num_values; i ++)
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
printf("<dict><key>lower</key><integer>%d</integer>"
"<key>upper</key><integer>%d</integer></dict>\n",
attr->values[i].range.lower, attr->values[i].range.upper);
case IPP_TAG_RESOLUTION :
for (i = 0; i < attr->num_values; i ++)
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
printf("<dict><key>xres</key><integer>%d</integer>"
"<key>yres</key><integer>%d</integer>"
"<key>units</key><string>%s</string></dict>\n",
case IPP_TAG_DATE :
for (i = 0; i < attr->num_values; i ++)
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
printf("<date>%s</date>\n", iso_date(attr->values[i].date));
else
printf("%s ", iso_date(attr->values[i].date));
case IPP_TAG_MIMETYPE :
case IPP_TAG_LANGUAGE :
for (i = 0; i < attr->num_values; i ++)
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
print_xml_string("string", attr->values[i].string.text);
else
printf("\"%s\" ", attr->values[i].string.text);
case IPP_TAG_TEXTLANG :
case IPP_TAG_NAMELANG :
for (i = 0; i < attr->num_values; i ++)
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
{
fputs("<dict><key>language</key><string>", stdout);
print_xml_string(NULL, attr->values[i].string.charset);
case IPP_TAG_BEGIN_COLLECTION :
for (i = 0; i < attr->num_values; i ++)
{
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
{
puts("<dict>");
for (colattr = attr->values[i].collection->attrs;
break;
default :
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
printf("<string><<%s>></string>\n",
ippTagString(attr->value_tag));
else
break;
}
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
{
if (attr->num_values > 1)
puts("</array>");
}
+/*
+ * 'print_csv()' - Print a line of CSV text.
+ */
+
+static void
+print_csv(
+ ipp_attribute_t *attr, /* I - First attribute for line */
+ int num_displayed, /* I - Number of attributes to display */
+ char **displayed, /* I - Attributes to display */
+ size_t *widths) /* I - Column widths */
+{
+ int i; /* Looping var */
+ size_t maxlength; /* Max length of all columns */
+ char *buffer, /* String buffer */
+ *bufptr; /* Pointer into buffer */
+ ipp_attribute_t *current; /* Current attribute */
+
+
+ /*
+ * Get the maximum string length we have to show and allocate...
+ */
+
+ for (i = 1, maxlength = widths[0]; i < num_displayed; i ++)
+ if (widths[i] > maxlength)
+ maxlength = widths[i];
+
+ maxlength += 2;
+
+ if ((buffer = malloc(maxlength)) == NULL)
+ return;
+
+ /*
+ * Loop through the attributes to display...
+ */
+
+ if (attr)
+ {
+ for (i = 0; i < num_displayed; i ++)
+ {
+ if (i)
+ putchar(',');
+
+ buffer[0] = '\0';
+
+ for (current = attr; current; current = current->next)
+ {
+ if (!current->name)
+ break;
+ else if (!strcmp(current->name, displayed[i]))
+ {
+ _ippAttrString(current, buffer, maxlength);
+ break;
+ }
+ }
+
+ if (strchr(buffer, ',') != NULL || strchr(buffer, '\"') != NULL ||
+ strchr(buffer, '\\') != NULL)
+ {
+ putchar('\"');
+ for (bufptr = buffer; *bufptr; bufptr ++)
+ {
+ if (*bufptr == '\\' || *bufptr == '\"')
+ putchar('\\');
+ putchar(*bufptr);
+ }
+ putchar('\"');
+ }
+ else
+ fputs(buffer, stdout);
+ }
+ putchar('\n');
+ }
+ else
+ {
+ for (i = 0; i < num_displayed; i ++)
+ {
+ if (i)
+ putchar(',');
+
+ fputs(displayed[i], stdout);
+ }
+ putchar('\n');
+ }
+
+ free(buffer);
+}
+
+
/*
* 'print_fatal_error()' - Print a fatal error message.
*/
* Then output it...
*/
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
{
print_xml_header();
print_xml_trailer(0, buffer);
}
else
- _cupsLangPrintf(stderr, "ipptest: %s\n", buffer);
+ _cupsLangPrintf(stderr, "ipptool: %s\n", buffer);
+}
+
+
+/*
+ * 'print_line()' - Print a line of formatted or CSV text.
+ */
+
+static void
+print_line(
+ ipp_attribute_t *attr, /* I - First attribute for line */
+ int num_displayed, /* I - Number of attributes to display */
+ char **displayed, /* I - Attributes to display */
+ size_t *widths) /* I - Column widths */
+{
+ int i; /* Looping var */
+ size_t maxlength; /* Max length of all columns */
+ char *buffer; /* String buffer */
+ ipp_attribute_t *current; /* Current attribute */
+
+
+ /*
+ * Get the maximum string length we have to show and allocate...
+ */
+
+ for (i = 1, maxlength = widths[0]; i < num_displayed; i ++)
+ if (widths[i] > maxlength)
+ maxlength = widths[i];
+
+ maxlength += 2;
+
+ if ((buffer = malloc(maxlength)) == NULL)
+ return;
+
+ /*
+ * Loop through the attributes to display...
+ */
+
+ if (attr)
+ {
+ for (i = 0; i < num_displayed; i ++)
+ {
+ if (i)
+ putchar(' ');
+
+ buffer[0] = '\0';
+
+ for (current = attr; current; current = current->next)
+ {
+ if (!current->name)
+ break;
+ else if (!strcmp(current->name, displayed[i]))
+ {
+ _ippAttrString(current, buffer, maxlength);
+ break;
+ }
+ }
+
+ printf("%*s", (int)-widths[i], buffer);
+ }
+ putchar('\n');
+ }
+ else
+ {
+ for (i = 0; i < num_displayed; i ++)
+ {
+ if (i)
+ putchar(' ');
+
+ printf("%*s", (int)-widths[i], displayed[i]);
+ }
+ putchar('\n');
+
+ for (i = 0; i < num_displayed; i ++)
+ {
+ if (i)
+ putchar(' ');
+
+ memset(buffer, '-', widths[i]);
+ buffer[widths[i]] = '\0';
+ fputs(buffer, stdout);
+ }
+ putchar('\n');
+ }
+
+ free(buffer);
}
* Then output it...
*/
- if (XML)
+ if (Output == _CUPS_OUTPUT_PLIST)
print_xml_string("string", buffer);
else
printf(" %s\n", buffer);
usage(void)
{
_cupsLangPuts(stderr,
- _("Usage: ipptest [options] URI filename.test [ ... "
- "filenameN.test ]\n"
+ _("Usage: ipptool [options] URI filename [ ... "
+ "filenameN ]\n"
"\n"
"Options:\n"
"\n"
- "-E Test with encryption.\n"
+ "-C Send requests using chunking (default)\n"
+ "-E Test with TLS encryption.\n"
+ "-L Send requests using content-length\n"
+ "-S Test with SSL encryption.\n"
"-V version Set default IPP version.\n"
- "-X Produce XML instead of plain text.\n"
- "-c Send requests using chunking (default)\n"
+ "-X Produce XML plist instead of plain text.\n"
"-d name=value Define variable.\n"
- "-f filename Set default test file.\n"
- "-i seconds Repeat the last test file with the given "
+ "-f filename Set default request filename.\n"
+ "-i seconds Repeat the last file with the given time "
"interval.\n"
- "-l Send requests using content-length\n"
+ "-n count Repeat the last file the given number of "
+ "times.\n"
+ "-q Be quiet - no output except errors.\n"
+ "-t Produce a test report.\n"
"-v Show all attributes sent and received.\n"));
exit(1);
# Perform the complete set of IPP compliance tests specified in the
# CUPS Software Test Plan.
#
-# Copyright 2007-2009 by Apple Inc.
+# Copyright 2007-2010 by Apple Inc.
# Copyright 1997-2007 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
echo "Performing $file..."
echo "" >>$strfile
- ./ipptest ipp://localhost:$port/printers $file | tee -a $strfile
+ ./ipptool -t ipp://localhost:$port/printers $file | tee -a $strfile
status=$?
if test $status != 0; then
Version="8.00"\r
Name="cupstestppd"\r
ProjectGUID="{B246D91E-61F2-4433-BFD2-6C2A96FBD4D4}"\r
- RootNamespace="ipptest"\r
+ RootNamespace="ipptool"\r
Keyword="Win32Proj"\r
>\r
<Platforms>\r
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"\r
>\r
<File\r
- RelativePath="..\test\ipptest.c"\r
+ RelativePath="..\test\ipptool.c"\r
>\r
</File>\r
</Filter>\r
{CB4AA6F2-3E84-45BE-B505-95CD375E8BE3} = {CB4AA6F2-3E84-45BE-B505-95CD375E8BE3}\r
EndProjectSection\r
EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ipptest", "ipptest.vcproj", "{B246D91E-61F2-4433-BFD2-6C2A96FBD4D4}"\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ipptool", "ipptool.vcproj", "{B246D91E-61F2-4433-BFD2-6C2A96FBD4D4}"\r
ProjectSection(ProjectDependencies) = postProject\r
{CB4AA6F2-3E84-45BE-B505-95CD375E8BE3} = {CB4AA6F2-3E84-45BE-B505-95CD375E8BE3}\r
EndProjectSection\r
<VisualStudioProject\r
ProjectType="Visual C++"\r
Version="9.00"\r
- Name="ipptest"\r
+ Name="ipptool"\r
ProjectGUID="{B246D91E-61F2-4433-BFD2-6C2A96FBD4D4}"\r
- RootNamespace="ipptest"\r
+ RootNamespace="ipptool"\r
Keyword="Win32Proj"\r
TargetFrameworkVersion="131072"\r
>\r
>\r
</File>\r
<File\r
- RelativePath="..\test\ipptest.c"\r
+ RelativePath="..\test\ipptool.c"\r
>\r
</File>\r
<File\r