From: jlovell Date: Thu, 26 Jan 2006 21:39:43 +0000 (+0000) Subject: Load cups into easysw/current. X-Git-Tag: release-1.6.3~255 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa73b22906f71080fa5056485d8204612717adac;p=thirdparty%2Fcups.git Load cups into easysw/current. git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@13 a1ca3aef-8c08-0410-bb20-df032aa958be --- diff --git a/CHANGES.txt b/CHANGES.txt index b2e1670fc5..2e9f452f2b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,15 @@ -CHANGES.txt - 01/12/2006 +CHANGES.txt - 01/18/2006 ------------------------ CHANGES IN CUPS V1.2.0b1 + - All of the Berkeley (except for lpc) and System V + commands now support specification of user, host, and + port (STR #1028, STR #1029, STR #1087) + - The lpmove command now allows you to move all jobs for + a given queue (STR #56) + - The web interface now supports moving of a job or jobs + to another queue (STR #56) - The web interface now provides searching, paging, and changing of the sort/display order of classes, jobs, and printers. @@ -13,9 +20,9 @@ CHANGES IN CUPS V1.2.0b1 UI text (STR #1101) - Printer names can now (reliably) contain Unicode characters (STR #896) - - The "lpstat -p" command now shows the time and date of - the last printer state change instead of the hardcoded - "Jan 01 00:00" (STR #659) + - The lpstat command now shows the time and date of the + last printer state change instead of the hardcoded "Jan + 01 00:00" (STR #659) - The scheduler now adds a job-actual-printer-uri attribute to job objects when printing to a class (STR #116) diff --git a/Makefile b/Makefile index 5d28e1bfa0..2c99a07f71 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,9 @@ # -# "$Id: Makefile 4835 2005-11-12 22:00:16Z mike $" +# "$Id: Makefile 4971 2006-01-24 14:33:18Z mike $" # # Top-level Makefile for the Common UNIX Printing System (CUPS). # -# Copyright 1997-2004 by Easy Software Products, all rights reserved. +# Copyright 1997-2006 by Easy Software Products, all rights reserved. # # These coded instructions, statements, and computer programs are the # property of Easy Software Products and are protected by Federal @@ -92,25 +92,25 @@ install: installhdrs echo Installing startup script... if test "x$(INITDIR)" != "x"; then \ $(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/init.d; \ - $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \ + $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \ $(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc0.d; \ - $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \ + $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc0.d/K00cups; \ $(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc2.d; \ - $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \ + $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc2.d/S99cups; \ $(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc3.d; \ - $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \ + $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc3.d/S99cups; \ $(INSTALL_DIR) $(BUILDROOT)$(INITDIR)/rc5.d; \ - $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \ + $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDIR)/rc5.d/S99cups; \ fi if test "x$(INITDIR)" = "x" -a "x$(INITDDIR)" != "x"; then \ $(INSTALL_DIR) $(BUILDROOT)$(INITDDIR); \ if test "$(INITDDIR)" = "/System/Library/StartupItems/PrintingServices"; then \ - $(INSTALL_SCRIPT) cups.osx $(BUILDROOT)$(INITDDIR)/PrintingServices; \ - $(INSTALL_DATA) cups.plist $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \ + $(INSTALL_SCRIPT) init/cups.osx $(BUILDROOT)$(INITDDIR)/PrintingServices; \ + $(INSTALL_DATA) init/cups.plist $(BUILDROOT)$(INITDDIR)/StartupParameters.plist; \ $(INSTALL_DIR) $(BUILDROOT)$(INITDDIR)/Resources/English.lproj; \ - $(INSTALL_DATA) cups.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \ + $(INSTALL_DATA) init/cups.strings $(BUILDROOT)$(INITDDIR)/Resources/English.lproj/Localizable.strings; \ else \ - $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDDIR)/cups; \ + $(INSTALL_SCRIPT) init/cups.sh $(BUILDROOT)$(INITDDIR)/cups; \ fi \ fi @@ -167,5 +167,5 @@ tardist: epm $(EPMFLAGS) -f tardist cups packaging/cups.list # -# End of "$Id: Makefile 4835 2005-11-12 22:00:16Z mike $". +# End of "$Id: Makefile 4971 2006-01-24 14:33:18Z mike $". # diff --git a/backend/ipp.c b/backend/ipp.c index 47cee2b916..468f69dd2f 100644 --- a/backend/ipp.c +++ b/backend/ipp.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: ipp.c 4926 2006-01-13 03:12:13Z mike $" * * IPP backend for the Common UNIX Printing System (CUPS). * @@ -68,8 +68,7 @@ static char tmpfilename[1024] = ""; /* Temporary spool file name */ * Local functions... */ -void check_printer_state(http_t *http, cups_lang_t *language, - const char *charset, const char *uri, /* I - Printer URI */ +void check_printer_state(http_t *http, const char *uri, const char *resource, const char *user, int version); const char *password_cb(const char *); @@ -119,12 +118,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ ipp_attribute_t *job_sheets; /* job-media-sheets-completed attribute */ ipp_attribute_t *job_state; /* job-state attribute */ ipp_attribute_t *copies_sup; /* copies-supported attribute */ - ipp_attribute_t *charset_sup; /* charset-supported attribute */ ipp_attribute_t *format_sup; /* document-format-supported attribute */ ipp_attribute_t *printer_state; /* printer-state attribute */ ipp_attribute_t *printer_accepting; /* printer-is-accepting-jobs attribute */ - const char *charset; /* Character set to use */ - cups_lang_t *language; /* Default language */ int copies; /* Number of copies remaining */ const char *content_type; /* CONTENT_TYPE environment variable */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) @@ -135,7 +131,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ static const char * const pattrs[] = { /* Printer attributes we want */ "copies-supported", - "charset-supported", "document-format-supported", "printer-is-accepting-jobs", "printer-state", @@ -539,11 +534,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * don't support the copies attribute... */ - language = cupsLangDefault(); - charset_sup = NULL; - copies_sup = NULL; - format_sup = NULL; - supported = NULL; + copies_sup = NULL; + format_sup = NULL; + supported = NULL; do { @@ -551,17 +544,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Build the IPP request... */ - request = ippNew(); - request->request.op.version[1] = version; - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, "utf-8"); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, - language != NULL ? language->language : "en"); + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); + request->request.op.version[1] = version; ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -634,10 +618,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ copies_sup = NULL; /* No */ } - charset_sup = ippFindAttribute(supported, "charset-supported", - IPP_TAG_CHARSET); - format_sup = ippFindAttribute(supported, "document-format-supported", - IPP_TAG_MIMETYPE); + format_sup = ippFindAttribute(supported, "document-format-supported", + IPP_TAG_MIMETYPE); if (format_sup) { @@ -704,43 +686,6 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ else copies = atoi(argv[4]); - /* - * Figure out the character set to use... - */ - - charset = language ? cupsLangEncoding(language) : "us-ascii"; - - if (charset_sup) - { - /* - * See if IPP server supports the requested character set... - */ - - for (i = 0; i < charset_sup->num_values; i ++) - if (strcasecmp(charset, charset_sup->values[i].string.text) == 0) - break; - - /* - * If not, choose us-ascii or utf-8... - */ - - if (i >= charset_sup->num_values) - { - /* - * See if us-ascii is supported... - */ - - for (i = 0; i < charset_sup->num_values; i ++) - if (strcasecmp("us-ascii", charset_sup->values[i].string.text) == 0) - break; - - if (i < charset_sup->num_values) - charset = "us-ascii"; - else - charset = "utf-8"; - } - } - /* * Then issue the print-job request... */ @@ -753,17 +698,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Build the IPP request... */ - request = ippNew(); - request->request.op.version[1] = version; - request->request.op.operation_id = IPP_PRINT_JOB; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, charset); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, - language != NULL ? language->language : "en"); + request = ippNewRequest(IPP_PRINT_JOB); + request->request.op.version[1] = version; ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -923,17 +859,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Build an IPP_GET_JOB_ATTRIBUTES request... */ - request = ippNew(); - request->request.op.version[1] = version; - request->request.op.operation_id = IPP_GET_JOB_ATTRIBUTES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, charset); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, - language != NULL ? language->language : "en"); + request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES); + request->request.op.version[1] = version; ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -999,8 +926,9 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if (job_state->values[0].integer > IPP_JOB_PROCESSING || job_state->values[0].integer == IPP_JOB_HELD) { - if ((job_sheets = ippFindAttribute(response, "job-media-sheets-completed", - IPP_TAG_INTEGER)) != NULL) + if ((job_sheets = ippFindAttribute(response, + "job-media-sheets-completed", + IPP_TAG_INTEGER)) != NULL) fprintf(stderr, "PAGE: total %d\n", job_sheets->values[0].integer); ippDelete(response); @@ -1016,11 +944,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Check the printer state and report it if necessary... */ -/* if (!copies_sup) - httpReconnect(http);*/ - - check_printer_state(http, language, charset, uri, resource, argv[2], - version); + check_printer_state(http, uri, resource, argv[2], version); /* * Wait 10 seconds before polling again... @@ -1037,7 +961,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ /* if (!copies_sup) httpReconnect(http);*/ - check_printer_state(http, language, charset, uri, resource, argv[2], version); + check_printer_state(http, uri, resource, argv[2], version); /* * Free memory... @@ -1073,16 +997,12 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ */ void -check_printer_state(http_t *http, /* I - HTTP connection */ - cups_lang_t *language, - /* I - Language */ - const char *charset, - /* I - Charset */ - const char *uri, /* I - Printer URI */ - const char *resource, - /* I - Resource path */ - const char *user, /* I - Username, if any */ - int version)/* I - IPP version */ +check_printer_state( + http_t *http, /* I - HTTP connection */ + const char *uri, /* I - Printer URI */ + const char *resource, /* I - Resource path */ + const char *user, /* I - Username, if any */ + int version) /* I - IPP version */ { ipp_t *request, /* IPP request */ *response; /* IPP response */ @@ -1092,17 +1012,8 @@ check_printer_state(http_t *http, /* I - HTTP connection */ * Check on the printer state... */ - request = ippNew(); - request->request.op.version[1] = version; - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, charset); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, - language != NULL ? language->language : "en"); + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); + request->request.op.version[1] = version; ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1130,8 +1041,8 @@ check_printer_state(http_t *http, /* I - HTTP connection */ * 'password_cb()' - Disable the password prompt for cupsDoFileRequest(). */ -const char * /* O - Password */ -password_cb(const char *prompt) /* I - Prompt (not used) */ +const char * /* O - Password */ +password_cb(const char *prompt) /* I - Prompt (not used) */ { (void)prompt; @@ -1279,17 +1190,17 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */ * PostScript file for printing... */ -int /* O - Exit status of filter */ -run_pictwps_filter(char **argv, /* I - Command-line arguments */ - const char *filename) /* I - Filename */ +int /* O - Exit status of filter */ +run_pictwps_filter(char **argv, /* I - Command-line arguments */ + const char *filename)/* I - Filename */ { - struct stat fileinfo; /* Print file information */ - const char *ppdfile; /* PPD file for destination printer */ - int pid; /* Child process ID */ - int fd; /* Temporary file descriptor */ - int status; /* Exit status of filter */ - const char *printer; /* PRINTER env var */ - static char ppdenv[1024]; /* PPD environment variable */ + struct stat fileinfo; /* Print file information */ + const char *ppdfile; /* PPD file for destination printer */ + int pid; /* Child process ID */ + int fd; /* Temporary file descriptor */ + int status; /* Exit status of filter */ + const char *printer; /* PRINTER env var */ + static char ppdenv[1024]; /* PPD environment variable */ /* @@ -1464,5 +1375,5 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: ipp.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: ipp.c 4926 2006-01-13 03:12:13Z mike $". */ diff --git a/backend/lpd.c b/backend/lpd.c index ee6d3deaa3..9407fe6cf5 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -1,5 +1,5 @@ /* - * "$Id: lpd.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lpd.c 4991 2006-01-26 15:01:46Z mike $" * * Line Printer Daemon backend for the Common UNIX Printing System (CUPS). * @@ -59,6 +59,10 @@ # include # include #endif /* WIN32 */ +#ifdef __APPLE__ +# include +# include +#endif /* __APPLE__ */ /* @@ -95,7 +99,7 @@ static int lpd_queue(const char *hostname, int port, const char *printer, const char *filename, const char *user, const char *title, int copies, int banner, int format, int order, int reserve, - int manual_copies, int timeout); + int manual_copies, int timeout, int contimeout); static void lpd_timeout(int sig); static int lpd_write(int lpd_fd, char *buffer, int length); #ifndef HAVE_RRESVPORT_AF @@ -135,6 +139,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ int sanitize_title; /* Sanitize title string? */ int manual_copies, /* Do manual copies? */ timeout, /* Timeout */ + contimeout, /* Connection timeout */ copies; /* Number of copies */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) struct sigaction action; /* Actions for POSIX signals */ @@ -243,18 +248,41 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * See if there are any options... */ - banner = 0; - format = 'l'; - order = ORDER_CONTROL_DATA; - reserve = RESERVE_ANY; - manual_copies = 1; - timeout = 300; - sanitize_title = 1; + banner = 0; + format = 'l'; + order = ORDER_CONTROL_DATA; + reserve = RESERVE_ANY; + manual_copies = 1; + timeout = 300; + contimeout = 7 * 24 * 60 * 60; -#if defined(__APPLE__) +#ifdef __APPLE__ /* We want to pass utf-8 characters, not re-map them (3071945) */ - sanitize_title= 0; -#endif + sanitize_title = 0; + + { + CFPropertyListRef pvalue; /* Preference value */ + SInt32 toval; /* Timeout value */ + + + pvalue = CFPreferencesCopyValue(CFSTR("timeout"), + CFSTR("com.apple.print.backends"), + kCFPreferencesAnyUser, + kCFPreferencesCurrentHost); + if (pvalue) + { + if (CFGetTypeID(pvalue) == CFNumberGetTypeID()) + { + CFNumberGetValue(pvalue, kCFNumberSInt32Type, &toval); + contimeout = (int)toval; + } + + CFRelease(pvalue); + } + } +#else + sanitize_title = 1; +#endif /* __APPLE__ */ if ((options = strchr(resource, '?')) != NULL) { @@ -293,7 +321,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ *ptr++ = *options++; *ptr = '\0'; - if (*options == '+') + if (*options == '+' || *options == '&') options ++; } else @@ -303,51 +331,47 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ * Process the option... */ - if (strcasecmp(name, "banner") == 0) + if (!strcasecmp(name, "banner")) { /* * Set the banner... */ - banner = !value[0] || - strcasecmp(value, "on") == 0 || - strcasecmp(value, "yes") == 0 || - strcasecmp(value, "true") == 0; + banner = !value[0] || !strcasecmp(value, "on") || + !strcasecmp(value, "yes") || !strcasecmp(value, "true"); } - else if (strcasecmp(name, "format") == 0 && value[0]) + else if (!strcasecmp(name, "format") && value[0]) { /* * Set output format... */ - if (strchr("cdfglnoprtv", value[0]) != NULL) + if (strchr("cdfglnoprtv", value[0])) format = value[0]; else fprintf(stderr, "ERROR: Unknown format character \"%c\"\n", value[0]); } - else if (strcasecmp(name, "order") == 0 && value[0]) + else if (!strcasecmp(name, "order") && value[0]) { /* * Set control/data order... */ - if (strcasecmp(value, "control,data") == 0) + if (!strcasecmp(value, "control,data")) order = ORDER_CONTROL_DATA; - else if (strcasecmp(value, "data,control") == 0) + else if (!strcasecmp(value, "data,control")) order = ORDER_DATA_CONTROL; else fprintf(stderr, "ERROR: Unknown file order \"%s\"\n", value); } - else if (strcasecmp(name, "reserve") == 0) + else if (!strcasecmp(name, "reserve")) { /* * Set port reservation mode... */ - if (!value[0] || - !strcasecmp(value, "on") || - !strcasecmp(value, "yes") || - !strcasecmp(value, "true") || + if (!value[0] || !strcasecmp(value, "on") || + !strcasecmp(value, "yes") || !strcasecmp(value, "true") || !strcasecmp(value, "rfc1179")) reserve = RESERVE_RFC1179; else if (!strcasecmp(value, "any")) @@ -355,29 +379,25 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ else reserve = RESERVE_NONE; } - else if (strcasecmp(name, "manual_copies") == 0) + else if (!strcasecmp(name, "manual_copies")) { /* * Set manual copies... */ - manual_copies = !value[0] || - strcasecmp(value, "on") == 0 || - strcasecmp(value, "yes") == 0 || - strcasecmp(value, "true") == 0; + manual_copies = !value[0] || !strcasecmp(value, "on") || + !strcasecmp(value, "yes") || !strcasecmp(value, "true"); } - else if (strcasecmp(name, "sanitize_title") == 0) + else if (!strcasecmp(name, "sanitize_title")) { /* * Set sanitize title... */ - sanitize_title = !value[0] || - strcasecmp(value, "on") == 0 || - strcasecmp(value, "yes") == 0 || - strcasecmp(value, "true") == 0; + sanitize_title = !value[0] || !strcasecmp(value, "on") || + !strcasecmp(value, "yes") || !strcasecmp(value, "true"); } - else if (strcasecmp(name, "timeout") == 0) + else if (!strcasecmp(name, "timeout")) { /* * Set the timeout... @@ -386,6 +406,15 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if (atoi(value) > 0) timeout = atoi(value); } + else if (!strcasecmp(name, "contimeout")) + { + /* + * Set the timeout... + */ + + if (atoi(value) > 0) + contimeout = atoi(value); + } } } @@ -426,7 +455,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ status = lpd_queue(hostname, port, resource + 1, filename, username, title, copies, - banner, format, order, reserve, manual_copies, timeout); + banner, format, order, reserve, manual_copies, + timeout, contimeout); if (!status) fprintf(stderr, "PAGE: 1 %d\n", atoi(argv[4])); @@ -434,7 +464,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ else status = lpd_queue(hostname, port, resource + 1, filename, username, title, 1, - banner, format, order, reserve, 1, timeout); + banner, format, order, reserve, 1, + timeout, contimeout); /* * Remove the temporary file if necessary... @@ -536,7 +567,8 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ int order, /* I - Order of data/control files */ int reserve, /* I - Reserve ports? */ int manual_copies, /* I - Do copies by hand... */ - int timeout) /* I - Timeout... */ + int timeout, /* I - Timeout... */ + int contimeout) /* I - Connection timeout */ { FILE *fp; /* Job file */ char localhost[255]; /* Local host name */ @@ -551,6 +583,10 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ http_addrlist_t *addrlist, /* Address list */ *addr; /* Socket address */ int copy; /* Copies written */ + time_t start_time; /* Time of first connect */ +#ifdef __APPLE__ + int recoverable; /* Recoverable error shown? */ +#endif /* __APPLE__ */ size_t nbytes; /* Number of bytes written */ off_t tbytes; /* Total bytes written */ char buffer[65536]; /* Output buffer */ @@ -588,6 +624,15 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ return (CUPS_BACKEND_STOP); } + /* + * Remember when we starting trying to connect to the printer... + */ + +#ifdef __APPLE__ + recoverable = 0; +#endif /* __APPLE__ */ + start_time = time(NULL); + /* * Loop forever trying to print the file... */ @@ -714,7 +759,20 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ if (error == ECONNREFUSED || error == EHOSTDOWN || error == EHOSTUNREACH) { - fprintf(stderr, "WARNING: Network host \'%s\' is busy, down, or unreachable; will retry in 30 seconds...\n", + if (contimeout && (time(NULL) - start_time) > contimeout) + { + fputs("ERROR: Printer not responding!\n", stderr); + return (CUPS_BACKEND_FAILED); + } + +#ifdef __APPLE__ + recoverable = 1; + fprintf(stderr, "WARNING: recoverable: " +#else + fprintf(stderr, "WARNING: " +#endif /* __APPLE__ */ + "Network host \'%s\' is busy, down, or " + "unreachable; will retry in 30 seconds...\n", hostname); sleep(30); } @@ -728,11 +786,31 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ } else { - perror("ERROR: Unable to connect to printer; will retry in 30 seconds..."); +#ifdef __APPLE__ + recoverable = 1; + perror("ERROR: recoverable: " +#else + perror("ERROR: " +#endif /* __APPLE__ */ + "Unable to connect to printer; will retry in 30 seconds..."); sleep(30); } } +#ifdef __APPLE__ + if (recoverable) + { + /* + * If we've shown a recoverable error make sure the printer proxies + * have a chance to see the recovered message. Not pretty but + * necessary for now... + */ + + fputs("INFO: recovered: \n", stderr); + sleep(5); + } +#endif /* __APPLE__ */ + fprintf(stderr, "INFO: Connected to %s...\n", hostname); fprintf(stderr, "DEBUG: Connected on ports %d (local %d)...\n", port, lport); @@ -1145,5 +1223,5 @@ sigterm_handler(int sig) /* I - Signal */ /* - * End of "$Id: lpd.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lpd.c 4991 2006-01-26 15:01:46Z mike $". */ diff --git a/backend/socket.c b/backend/socket.c index 54b6a7796f..240adca1ff 100644 --- a/backend/socket.c +++ b/backend/socket.c @@ -1,5 +1,5 @@ /* - * "$Id: socket.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: socket.c 4974 2006-01-25 07:04:33Z mike $" * * AppSocket backend for the Common UNIX Printing System (CUPS). * @@ -71,9 +71,14 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ char method[255], /* Method in URI */ hostname[1024], /* Hostname */ username[255], /* Username info (not used) */ - resource[1024]; /* Resource info (not used) */ + resource[1024], /* Resource info (not used) */ + *options, /* Pointer to options */ + name[255], /* Name of option */ + value[255], /* Value of option */ + *ptr; /* Pointer into name or value */ int fp; /* Print file */ int copies; /* Number of copies to print */ + int waiteof; /* Wait for end-of-file? */ int port; /* Port number */ char portname[255]; /* Port name */ int delay; /* Delay for retries... */ @@ -166,6 +171,71 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if (port == 0) port = 9100; /* Default to HP JetDirect/Tektronix PhaserShare */ + /* + * Get options, if any... + */ + + waiteof = 1; + + if ((options = strchr(resource, '?')) != NULL) + { + /* + * Yup, terminate the device name string and move to the first + * character of the options... + */ + + *options++ = '\0'; + + /* + * Parse options... + */ + + while (*options) + { + /* + * Get the name... + */ + + for (ptr = name; *options && *options != '=';) + if (ptr < (name + sizeof(name) - 1)) + *ptr++ = *options++; + *ptr = '\0'; + + if (*options == '=') + { + /* + * Get the value... + */ + + options ++; + + for (ptr = value; *options && *options != '+' && *options != '&';) + if (ptr < (value + sizeof(value) - 1)) + *ptr++ = *options++; + *ptr = '\0'; + + if (*options == '+' || *options == '&') + options ++; + } + else + value[0] = '\0'; + + /* + * Process the option... + */ + + if (!strcasecmp(name, "waiteof")) + { + /* + * Set the wait-for-eof value... + */ + + waiteof = !value[0] || !strcasecmp(value, "on") || + !strcasecmp(value, "yes") || !strcasecmp(value, "true"); + } + } + } + /* * Then try to connect to the remote host... */ @@ -346,48 +416,51 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ (unsigned long)tbytes); } - /* - * Shutdown the socket and wait for the other end to finish... - */ - - fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr); - - shutdown(fd, 1); - - for (;;) + if (waiteof) { /* - * Wait a maximum of 90 seconds for backchannel data or a closed - * connection... + * Shutdown the socket and wait for the other end to finish... */ - timeout.tv_sec = 90; - timeout.tv_usec = 0; + fputs("INFO: Print file sent, waiting for printer to finish...\n", stderr); - FD_ZERO(&input); - FD_SET(fd, &input); + shutdown(fd, 1); -#ifdef __hpux - if (select(fd + 1, (int *)&input, NULL, NULL, &timeout) > 0) -#else - if (select(fd + 1, &input, NULL, NULL, &timeout) > 0) -#endif /* __hpux */ + for (;;) { /* - * Grab the data coming back and spit it out to stderr... + * Wait a maximum of 90 seconds for backchannel data or a closed + * connection... */ - if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0) + timeout.tv_sec = 90; + timeout.tv_usec = 0; + + FD_ZERO(&input); + FD_SET(fd, &input); + + #ifdef __hpux + if (select(fd + 1, (int *)&input, NULL, NULL, &timeout) > 0) + #else + if (select(fd + 1, &input, NULL, NULL, &timeout) > 0) + #endif /* __hpux */ { - fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n", - rbytes); - cupsBackchannelWrite(resource, rbytes, 1.0); - } + /* + * Grab the data coming back and spit it out to stderr... + */ + + if ((rbytes = recv(fd, resource, sizeof(resource), 0)) > 0) + { + fprintf(stderr, "DEBUG: Received %d bytes of back-channel data!\n", + rbytes); + cupsBackchannelWrite(resource, rbytes, 1.0); + } + else + break; + } else break; } - else - break; } /* @@ -414,5 +487,5 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ /* - * End of "$Id: socket.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: socket.c 4974 2006-01-25 07:04:33Z mike $". */ diff --git a/berkeley/lpc.c b/berkeley/lpc.c index 4b80a618d2..5edbeafb7e 100644 --- a/berkeley/lpc.c +++ b/berkeley/lpc.c @@ -1,5 +1,5 @@ /* - * "$Id: lpc.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lpc.c 4948 2006-01-19 03:23:41Z mike $" * * "lpc" command for the Common UNIX Printing System (CUPS). * @@ -85,7 +85,7 @@ main(int argc, /* I - Number of command-line arguments */ * Do the command prompt thing... */ - printf("lpc> "); + _cupsLangPuts(stdout, _("lpc> ")); while (fgets(line, sizeof(line), stdin) != NULL) { /* @@ -113,7 +113,7 @@ main(int argc, /* I - Number of command-line arguments */ * Nothing left, just show a prompt... */ - printf("lpc> "); + _cupsLangPuts(stdout, _("lpc> ")); continue; } @@ -149,7 +149,7 @@ main(int argc, /* I - Number of command-line arguments */ * Put another prompt out to the user... */ - printf("lpc> "); + _cupsLangPuts(stdout, _("lpc> ")); } } @@ -197,7 +197,7 @@ do_command(http_t *http, /* I - HTTP connection to server */ else if (!compare_strings(command, "help", 1) || !strcmp(command, "?")) show_help(params); else - _cupsLangPrintf(stdout, cupsLangDefault(), + _cupsLangPrintf(stdout, _("%s is not implemented by the CUPS version of lpc.\n"), command); } @@ -212,20 +212,17 @@ show_help(const char *command) /* I - Command to describe or NULL */ { if (!command) { - _cupsLangPrintf(stdout, cupsLangDefault(), + _cupsLangPrintf(stdout, _("Commands may be abbreviated. Commands are:\n" "\n" "exit help quit status ?\n")); } else if (!compare_strings(command, "help", 1) || !strcmp(command, "?")) - _cupsLangPrintf(stdout, cupsLangDefault(), - _("help\t\tget help on commands\n")); + _cupsLangPrintf(stdout, _("help\t\tget help on commands\n")); else if (!compare_strings(command, "status", 4)) - _cupsLangPrintf(stdout, cupsLangDefault(), - _("status\t\tshow status of daemon and queue\n")); + _cupsLangPrintf(stdout, _("status\t\tshow status of daemon and queue\n")); else - _cupsLangPrintf(stdout, cupsLangDefault(), - _("?Invalid help command unknown\n")); + _cupsLangPrintf(stdout, _("?Invalid help command unknown\n")); } @@ -474,7 +471,7 @@ show_status(http_t *http, /* I - HTTP connection to server */ printf("%s:\n", printer); if (!strncmp(device, "file:", 5)) - _cupsLangPrintf(stdout, language, + _cupsLangPrintf(stdout, _("\tprinter is on device \'%s\' speed -1\n"), device + 5); else @@ -486,28 +483,28 @@ show_status(http_t *http, /* I - HTTP connection to server */ if ((delimiter = strchr(device, ':')) != NULL ) { *delimiter = '\0'; - _cupsLangPrintf(stdout, language, + _cupsLangPrintf(stdout, _("\tprinter is on device \'%s\' speed -1\n"), device); } } if (accepting) - _cupsLangPuts(stdout, language, _("\tqueuing is enabled\n")); + _cupsLangPuts(stdout, _("\tqueuing is enabled\n")); else - _cupsLangPuts(stdout, language, _("\tqueuing is disabled\n")); + _cupsLangPuts(stdout, _("\tqueuing is disabled\n")); if (pstate != IPP_PRINTER_STOPPED) - _cupsLangPuts(stdout, language, _("\tprinting is enabled\n")); + _cupsLangPuts(stdout, _("\tprinting is enabled\n")); else - _cupsLangPuts(stdout, language, _("\tprinting is disabled\n")); + _cupsLangPuts(stdout, _("\tprinting is disabled\n")); if (jobcount == 0) - _cupsLangPuts(stdout, language, _("\tno entries\n")); + _cupsLangPuts(stdout, _("\tno entries\n")); else - _cupsLangPrintf(stdout, language, _("\t%d entries\n"), jobcount); + _cupsLangPrintf(stdout, _("\t%d entries\n"), jobcount); - _cupsLangPuts(stdout, language, _("\tdaemon present\n")); + _cupsLangPuts(stdout, _("\tdaemon present\n")); } if (attr == NULL) @@ -520,5 +517,5 @@ show_status(http_t *http, /* I - HTTP connection to server */ /* - * End of "$Id: lpc.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lpc.c 4948 2006-01-19 03:23:41Z mike $". */ diff --git a/berkeley/lpq.c b/berkeley/lpq.c index a5e009171c..6fd1dfc91e 100644 --- a/berkeley/lpq.c +++ b/berkeley/lpq.c @@ -1,5 +1,5 @@ /* - * "$Id: lpq.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lpq.c 4948 2006-01-19 03:23:41Z mike $" * * "lpq" command for the Common UNIX Printing System (CUPS). * @@ -49,9 +49,9 @@ * Local functions... */ -static int show_jobs(http_t *, const char *, const char *, const int, - const int); -static void show_printer(http_t *, const char *); +static int show_jobs(const char *, http_t *, const char *, + const char *, const int, const int); +static void show_printer(const char *, http_t *, const char *); static void usage(void); @@ -60,24 +60,24 @@ static void usage(void); */ int -main(int argc, /* I - Number of command-line arguments */ - char *argv[]) /* I - Command-line arguments */ +main(int argc, /* I - Number of command-line arguments */ + char *argv[]) /* I - Command-line arguments */ { - int i; /* Looping var */ - http_t *http; /* Connection to server */ - const char *dest, /* Desired printer */ - *user, /* Desired user */ - *val; /* Environment variable name */ - char *instance; /* Printer instance */ - int id, /* Desired job ID */ - all, /* All printers */ - interval, /* Reporting interval */ - longstatus; /* Show file details */ - int num_dests; /* Number of destinations */ - cups_dest_t *dests; /* Destinations */ - cups_lang_t *language; /* Language */ + int i; /* Looping var */ + http_t *http; /* Connection to server */ + const char *dest, /* Desired printer */ + *user, /* Desired user */ + *val; /* Environment variable name */ + char *instance; /* Printer instance */ + int id, /* Desired job ID */ + all, /* All printers */ + interval, /* Reporting interval */ + longstatus; /* Show file details */ + int num_dests; /* Number of destinations */ + cups_dest_t *dests; /* Destinations */ + cups_lang_t *language; /* Language */ #ifdef HAVE_SSL - http_encryption_t encryption; /* Encryption? */ + http_encryption_t encryption; /* Encryption? */ #endif /* HAVE_SSL */ @@ -90,8 +90,7 @@ main(int argc, /* I - Number of command-line arguments */ if ((http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption())) == NULL) { - _cupsLangPuts(stderr, language, - _("lpq: Unable to contact server!\n")); + _cupsLangPrintf(stderr, _("%s: Unable to contact server!\n"), argv[0]); return (1); } @@ -121,12 +120,31 @@ main(int argc, /* I - Number of command-line arguments */ if (http) httpEncryption(http, encryption); #else - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), argv[0]); #endif /* HAVE_SSL */ break; + case 'U' : /* Username */ + if (argv[i][2] != '\0') + cupsSetUser(argv[i] + 2); + else + { + i ++; + if (i >= argc) + { + _cupsLangPrintf(stderr, + _("%s: Error - expected username after " + "\'-U\' option!\n"), + argv[0]); + return (1); + } + + cupsSetUser(argv[i]); + } + break; + case 'P' : /* Printer */ if (argv[i][2]) dest = argv[i] + 2; @@ -151,12 +169,13 @@ main(int argc, /* I - Number of command-line arguments */ if (cupsGetDest(dest, instance, num_dests, dests) == NULL) { if (instance) - _cupsLangPrintf(stderr, language, - _("lpq: Unknown destination \"%s/%s\"!\n"), - dest, instance); + _cupsLangPrintf(stderr, + _("%s: Error - unknown destination \"%s/%s\"!\n"), + argv[0], dest, instance); else - _cupsLangPrintf(stderr, language, - _("lpq: Unknown destination \"%s\"!\n"), dest); + _cupsLangPrintf(stderr, + _("%s: Unknown destination \"%s\"!\n"), + argv[0], dest); return (1); } @@ -166,6 +185,29 @@ main(int argc, /* I - Number of command-line arguments */ all = 1; break; + case 'h' : /* Connect to host */ + if (http != NULL) + httpClose(http); + + if (argv[i][2] != '\0') + cupsSetServer(argv[i] + 2); + else + { + i ++; + + if (i >= argc) + { + _cupsLangPrintf(stderr, + _("%s: Error - expected hostname after " + "\'-h\' option!\n"), + argv[0]); + return (1); + } + else + cupsSetServer(argv[i]); + } + break; + case 'l' : /* Long status */ longstatus = 1; break; @@ -207,13 +249,14 @@ main(int argc, /* I - Number of command-line arguments */ val = "LPDEST"; if (dest && !cupsGetDest(dest, NULL, num_dests, dests)) - _cupsLangPrintf(stderr, language, - _("lp: error - %s environment variable names " + _cupsLangPrintf(stderr, + _("%s: error - %s environment variable names " "non-existent destination \"%s\"!\n"), - val, dest); + argv[0], val, dest); else - _cupsLangPuts(stderr, language, - _("lpq: error - no default destination available.\n")); + _cupsLangPrintf(stderr, + _("%s: error - no default destination available.\n"), + argv[0]); httpClose(http); cupsFreeDests(num_dests, dests); return (1); @@ -227,9 +270,9 @@ main(int argc, /* I - Number of command-line arguments */ for (;;) { if (dest) - show_printer(http, dest); + show_printer(argv[0], http, dest); - i = show_jobs(http, dest, user, id, longstatus); + i = show_jobs(argv[0], http, dest, user, id, longstatus); if (i && interval) { @@ -255,33 +298,33 @@ main(int argc, /* I - Number of command-line arguments */ * 'show_jobs()' - Show jobs. */ -static int /* O - Number of jobs in queue */ -show_jobs(http_t *http, /* I - HTTP connection to server */ - const char *dest, /* I - Destination */ - const char *user, /* I - User */ - const int id, /* I - Job ID */ - const int longstatus)/* I - 1 if long report desired */ +static int /* O - Number of jobs in queue */ +show_jobs(const char *command, /* I - Command name */ + http_t *http, /* I - HTTP connection to server */ + const char *dest, /* I - Destination */ + const char *user, /* I - User */ + const int id, /* I - Job ID */ + const int longstatus) /* I - 1 if long report desired */ { - ipp_t *request, /* IPP Request */ - *response; /* IPP Response */ - ipp_attribute_t *attr; /* Current attribute */ - cups_lang_t *language; /* Default language */ - const char *jobdest, /* Pointer into job-printer-uri */ - *jobuser, /* Pointer to job-originating-user-name */ - *jobname; /* Pointer to job-name */ - ipp_jstate_t jobstate; /* job-state */ - int jobid, /* job-id */ - jobsize, /* job-k-octets */ + ipp_t *request, /* IPP Request */ + *response; /* IPP Response */ + ipp_attribute_t *attr; /* Current attribute */ + const char *jobdest, /* Pointer into job-printer-uri */ + *jobuser, /* Pointer to job-originating-user-name */ + *jobname; /* Pointer to job-name */ + ipp_jstate_t jobstate; /* job-state */ + int jobid, /* job-id */ + jobsize, /* job-k-octets */ #ifdef __osf__ - jobpriority, /* job-priority */ + jobpriority, /* job-priority */ #endif /* __osf__ */ - jobcount, /* Number of jobs */ - jobcopies, /* Number of copies */ - rank; /* Rank of job */ - char resource[1024]; /* Resource string */ - char rankstr[255]; /* Rank string */ - char namestr[1024]; /* Job name string */ - static const char *ranks[10] =/* Ranking strings */ + jobcount, /* Number of jobs */ + jobcopies, /* Number of copies */ + rank; /* Rank of job */ + char resource[1024]; /* Resource string */ + char rankstr[255]; /* Rank string */ + char namestr[1024]; /* Job name string */ + static const char *ranks[10] = /* Ranking strings */ { "th", "st", @@ -311,18 +354,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ * job-uri or printer-uri */ - request = ippNew(); - - request->request.op.operation_id = id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - attr = ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS); if (dest == NULL) { @@ -360,8 +392,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ { if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, language, _("lpq: get-jobs failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString()); ippDelete(response); return (0); } @@ -401,38 +432,38 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ while (attr != NULL && attr->group_tag == IPP_TAG_JOB) { - if (strcmp(attr->name, "job-id") == 0 && + if (!strcmp(attr->name, "job-id") && attr->value_tag == IPP_TAG_INTEGER) jobid = attr->values[0].integer; - if (strcmp(attr->name, "job-k-octets") == 0 && + if (!strcmp(attr->name, "job-k-octets") && attr->value_tag == IPP_TAG_INTEGER) jobsize = attr->values[0].integer; #ifdef __osf__ - if (strcmp(attr->name, "job-priority") == 0 && + if (!strcmp(attr->name, "job-priority") && attr->value_tag == IPP_TAG_INTEGER) jobpriority = attr->values[0].integer; #endif /* __osf__ */ - if (strcmp(attr->name, "job-state") == 0 && + if (!strcmp(attr->name, "job-state") && attr->value_tag == IPP_TAG_ENUM) jobstate = (ipp_jstate_t)attr->values[0].integer; - if (strcmp(attr->name, "job-printer-uri") == 0 && + if (!strcmp(attr->name, "job-printer-uri") && attr->value_tag == IPP_TAG_URI) if ((jobdest = strrchr(attr->values[0].string.text, '/')) != NULL) jobdest ++; - if (strcmp(attr->name, "job-originating-user-name") == 0 && + if (!strcmp(attr->name, "job-originating-user-name") && attr->value_tag == IPP_TAG_NAME) jobuser = attr->values[0].string.text; - if (strcmp(attr->name, "job-name") == 0 && + if (!strcmp(attr->name, "job-name") && attr->value_tag == IPP_TAG_NAME) jobname = attr->values[0].string.text; - if (strcmp(attr->name, "copies") == 0 && + if (!strcmp(attr->name, "copies") && attr->value_tag == IPP_TAG_INTEGER) jobcopies = attr->values[0].integer; @@ -453,11 +484,11 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ if (!longstatus && jobcount == 0) #ifdef __osf__ - _cupsLangPuts(stdout, language, + _cupsLangPuts(stdout, _("Rank Owner Pri Job Files" " Total Size\n")); #else - _cupsLangPuts(stdout, language, + _cupsLangPuts(stdout, _("Rank Owner Job File(s)" " Total Size\n")); #endif /* __osf__ */ @@ -487,7 +518,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ if (longstatus) { - _cupsLangPuts(stdout, language, ""); + _cupsLangPuts(stdout, "\n"); if (jobcopies > 1) snprintf(namestr, sizeof(namestr), "%d copies of %s", jobcopies, @@ -495,19 +526,19 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ else strlcpy(namestr, jobname, sizeof(namestr)); - _cupsLangPrintf(stdout, language, _("%s: %-33.33s [job %d localhost]\n"), + _cupsLangPrintf(stdout, _("%s: %-33.33s [job %d localhost]\n"), jobuser, rankstr, jobid); - _cupsLangPrintf(stdout, language, _(" %-39.39s %.0f bytes\n"), + _cupsLangPrintf(stdout, _(" %-39.39s %.0f bytes\n"), namestr, 1024.0 * jobsize); } else #ifdef __osf__ - _cupsLangPrintf(stdout, language, + _cupsLangPrintf(stdout, _("%-6s %-10.10s %-4d %-10d %-27.27s %.0f bytes\n"), rankstr, jobuser, jobpriority, jobid, jobname, 1024.0 * jobsize); #else - _cupsLangPrintf(stdout, language, + _cupsLangPrintf(stdout, _("%-7s %-7.7s %-7d %-31.31s %.0f bytes\n"), rankstr, jobuser, jobid, jobname, 1024.0 * jobsize); #endif /* __osf */ @@ -520,13 +551,12 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ } else { - _cupsLangPrintf(stderr, language, _("lpq: get-jobs failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString()); return (0); } if (jobcount == 0) - _cupsLangPuts(stdout, language, _("no entries\n")); + _cupsLangPuts(stdout, _("no entries\n")); return (jobcount); } @@ -537,16 +567,15 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ */ static void -show_printer(http_t *http, /* I - HTTP connection to server */ - const char *dest) /* I - Destination */ +show_printer(const char *command, /* I - Command name */ + http_t *http, /* I - HTTP connection to server */ + const char *dest) /* I - Destination */ { - ipp_t *request, /* IPP Request */ - *response; /* IPP Response */ - ipp_attribute_t *attr; /* Current attribute */ - cups_lang_t *language; /* Default language */ - ipp_pstate_t state; /* Printer state */ - char uri[HTTP_MAX_URI]; - /* Printer URI */ + ipp_t *request, /* IPP Request */ + *response; /* IPP Response */ + ipp_attribute_t *attr; /* Current attribute */ + ipp_pstate_t state; /* Printer state */ + char uri[HTTP_MAX_URI]; /* Printer URI */ if (http == NULL) @@ -561,18 +590,7 @@ show_printer(http_t *http, /* I - HTTP connection to server */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", dest); @@ -587,9 +605,7 @@ show_printer(http_t *http, /* I - HTTP connection to server */ { if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, language, - _("lpq: get-printer-attributes failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString()); ippDelete(response); return; } @@ -602,23 +618,21 @@ show_printer(http_t *http, /* I - HTTP connection to server */ switch (state) { case IPP_PRINTER_IDLE : - _cupsLangPrintf(stdout, language, _("%s is ready\n"), dest); + _cupsLangPrintf(stdout, _("%s is ready\n"), dest); break; case IPP_PRINTER_PROCESSING : - _cupsLangPrintf(stdout, language, _("%s is ready and printing\n"), + _cupsLangPrintf(stdout, _("%s is ready and printing\n"), dest); break; case IPP_PRINTER_STOPPED : - _cupsLangPrintf(stdout, language, _("%s is not ready\n"), dest); + _cupsLangPrintf(stdout, _("%s is not ready\n"), dest); break; } ippDelete(response); } else - _cupsLangPrintf(stderr, language, - _("lpq: get-printer-attributes failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString()); } @@ -629,12 +643,13 @@ show_printer(http_t *http, /* I - HTTP connection to server */ static void usage(void) { - _cupsLangPuts(stderr, cupsLangDefault(), - _("Usage: lpq [-P dest] [-l] [+interval]\n")); + _cupsLangPuts(stderr, + _("Usage: lpq [-P dest] [-U username] [-h hostname[:port]] " + "[-l] [+interval]\n")); exit(1); } /* - * End of "$Id: lpq.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lpq.c 4948 2006-01-19 03:23:41Z mike $". */ diff --git a/berkeley/lpr.c b/berkeley/lpr.c index 58c9202f4a..c909892e3e 100644 --- a/berkeley/lpr.c +++ b/berkeley/lpr.c @@ -1,5 +1,5 @@ /* - * "$Id: lpr.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lpr.c 4974 2006-01-25 07:04:33Z mike $" * * "lpr" command for the Common UNIX Printing System (CUPS). * @@ -64,31 +64,33 @@ char tempfile[1024]; /* Temporary file for printing from stdin */ */ int -main(int argc, /* I - Number of command-line arguments */ - char *argv[]) /* I - Command-line arguments */ +main(int argc, /* I - Number of command-line arguments */ + char *argv[]) /* I - Command-line arguments */ { - int i, j; /* Looping var */ - int job_id; /* Job ID */ - char ch; /* Option character */ - char *printer, /* Destination printer or class */ - *instance; /* Instance */ - const char *title, /* Job title */ - *val; /* Environment variable name */ - int num_copies; /* Number of copies per file */ - int num_files; /* Number of files to print */ - const char *files[1000]; /* Files to print */ - int num_dests; /* Number of destinations */ - cups_dest_t *dests, /* Destinations */ - *dest; /* Selected destination */ - int num_options; /* Number of options */ - cups_option_t *options; /* Options */ - int deletefile; /* Delete file after print? */ - char buffer[8192]; /* Copy buffer */ - int temp; /* Temporary file descriptor */ - cups_lang_t *language; /* Language information */ + int i, j; /* Looping var */ + int job_id; /* Job ID */ + char ch; /* Option character */ + char *printer, /* Destination printer or class */ + *instance; /* Instance */ + const char *title, /* Job title */ + *val; /* Environment variable name */ + int num_copies; /* Number of copies per file */ + int num_files; /* Number of files to print */ + const char *files[1000]; /* Files to print */ + int num_dests; /* Number of destinations */ + cups_dest_t *dests, /* Destinations */ + *dest; /* Selected destination */ + int num_options; /* Number of options */ + cups_option_t *options; /* Options */ + int deletefile; /* Delete file after print? */ + char buffer[8192]; /* Copy buffer */ + ssize_t bytes; /* Bytes copied */ + off_t filesize; /* Size of temp file */ + int temp; /* Temporary file descriptor */ + cups_lang_t *language; /* Language information */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) - struct sigaction action; /* Signal action */ - struct sigaction oldaction; /* Old signal action */ + struct sigaction action; /* Signal action */ + struct sigaction oldaction; /* Old signal action */ #endif /* HAVE_SIGACTION && !HAVE_SIGSET */ @@ -110,12 +112,51 @@ main(int argc, /* I - Number of command-line arguments */ #ifdef HAVE_SSL cupsSetEncryption(HTTP_ENCRYPT_REQUIRED); #else - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), argv[0]); #endif /* HAVE_SSL */ break; + case 'U' : /* Username */ + if (argv[i][2] != '\0') + cupsSetUser(argv[i] + 2); + else + { + i ++; + if (i >= argc) + { + _cupsLangPrintf(stderr, + _("%s: Error - expected username after " + "\'-U\' option!\n"), + argv[0]); + return (1); + } + + cupsSetUser(argv[i]); + } + break; + + case 'H' : /* Connect to host */ + if (argv[i][2] != '\0') + cupsSetServer(argv[i] + 2); + else + { + i ++; + + if (i >= argc) + { + _cupsLangPrintf(stderr, + _("%s: Error - expected hostname after " + "\'-H\' option!\n"), + argv[0]); + return (1); + } + else + cupsSetServer(argv[i]); + } + break; + case '1' : /* TROFF font set 1 */ case '2' : /* TROFF font set 2 */ case '3' : /* TROFF font set 3 */ @@ -128,9 +169,9 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPrintf(stderr, language, - _("lpr: error - expected value after -%c " - "option!\n"), ch); + _cupsLangPrintf(stderr, + _("%s: Error - expected value after \'-%c\' " + "option!\n"), argv[0], ch); return (1); } } @@ -142,9 +183,10 @@ main(int argc, /* I - Number of command-line arguments */ case 'n' : /* Ditroff */ case 't' : /* Troff */ case 'v' : /* Raster image */ - _cupsLangPrintf(stderr, language, - _("lpr: warning - \'%c\' format modifier not " - "supported - output may not be correct!\n"), ch); + _cupsLangPrintf(stderr, + _("%s: Warning - \'%c\' format modifier not " + "supported - output may not be correct!\n"), + argv[0], ch); break; case 'o' : /* Option */ @@ -155,9 +197,10 @@ main(int argc, /* I - Number of command-line arguments */ i ++; if (i >= argc) { - _cupsLangPuts(stderr, language, - _("lpr: error - expected option=value after " - "-o option!\n")); + _cupsLangPrintf(stderr, + _("%s: error - expected option=value after " + "\'-o\' option!\n"), + argv[0]); return (1); } @@ -170,20 +213,28 @@ main(int argc, /* I - Number of command-line arguments */ break; case 'p' : /* Prettyprint */ - num_options = cupsAddOption("prettyprint", "", num_options, &options); + num_options = cupsAddOption("prettyprint", "", num_options, + &options); break; case 'h' : /* Suppress burst page */ - num_options = cupsAddOption("job-sheets", "none", num_options, &options); + num_options = cupsAddOption("job-sheets", "none", num_options, + &options); break; case 's' : /* Don't use symlinks */ break; case 'm' : /* Mail on completion */ - _cupsLangPuts(stderr, language, - _("lpr: warning - email notification is not " - "currently supported!\n")); + { + char email[1024]; /* EMail address */ + + + snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(), + httpGetHostname(buffer, sizeof(buffer))); + num_options = cupsAddOption("notify-recipient", email, + num_options, &options); + } break; case 'q' : /* Queue file but don't print */ @@ -203,9 +254,10 @@ main(int argc, /* I - Number of command-line arguments */ i ++; if (i >= argc) { - _cupsLangPuts(stderr, language, - _("lpr: error - expected destination after -P " - "option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected destination after " + "\'-P\' option!\n"), + argv[0]); return (1); } @@ -221,7 +273,8 @@ main(int argc, /* I - Number of command-line arguments */ if ((dest = cupsGetDest(printer, instance, num_dests, dests)) != NULL) { for (j = 0; j < dest->num_options; j ++) - if (cupsGetOption(dest->options[j].name, num_options, options) == NULL) + if (cupsGetOption(dest->options[j].name, num_options, + options) == NULL) num_options = cupsAddOption(dest->options[j].name, dest->options[j].value, num_options, &options); @@ -236,9 +289,10 @@ main(int argc, /* I - Number of command-line arguments */ i ++; if (i >= argc) { - _cupsLangPuts(stderr, language, - _("lpr: error - expected copy count after -# " - "option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected copy count after " + "\'-#\' option!\n"), + argv[0]); return (1); } @@ -259,9 +313,9 @@ main(int argc, /* I - Number of command-line arguments */ i ++; if (i >= argc) { - _cupsLangPrintf(stderr, language, - _("lpr: error - expected name after -%c " - "option!\n"), ch); + _cupsLangPrintf(stderr, + _("%s: Error - expected name after \'-%c\' " + "option!\n"), argv[0], ch); return (1); } @@ -269,28 +323,10 @@ main(int argc, /* I - Number of command-line arguments */ } break; - case 'U' : /* User */ - if (argv[i][2] != '\0') - cupsSetUser(argv[i] + 2); - else - { - i ++; - if (i >= argc) - { - _cupsLangPuts(stderr, language, - _("lpr: error - expected username after -U " - "option!\n")); - return (1); - } - - cupsSetUser(argv[i]); - } - break; - default : - _cupsLangPrintf(stderr, language, - _("lpr: error - unknown option \'%c\'!\n"), - argv[i][1]); + _cupsLangPrintf(stderr, + _("%s: Error - unknown option \'%c\'!\n"), + argv[0], argv[i][1]); return (1); } else if (num_files < 1000) @@ -301,9 +337,9 @@ main(int argc, /* I - Number of command-line arguments */ if (access(argv[i], R_OK) != 0) { - _cupsLangPrintf(stderr, language, - _("lpr: error - unable to access \"%s\" - %s\n"), - argv[i], strerror(errno)); + _cupsLangPrintf(stderr, + _("%s: Error - unable to access \"%s\" - %s\n"), + argv[0], argv[i], strerror(errno)); return (1); } @@ -319,8 +355,9 @@ main(int argc, /* I - Number of command-line arguments */ } } else - _cupsLangPrintf(stderr, language, - _("lpr: error - too many files - \"%s\"\n"), argv[i]); + _cupsLangPrintf(stderr, + _("%s: Error - too many files - \"%s\"\n"), + argv[0], argv[i]); /* * See if we have any files to print; if not, print from stdin... */ @@ -360,16 +397,18 @@ main(int argc, /* I - Number of command-line arguments */ val = "LPDEST"; if (printer && !cupsGetDest(printer, NULL, num_dests, dests)) - _cupsLangPrintf(stderr, language, - _("lpr: error - %s environment variable names " + _cupsLangPrintf(stderr, + _("%s: Error - %s environment variable names " "non-existent destination \"%s\"!\n"), - val, printer); + argv[0], val, printer); else if (cupsLastError() == IPP_NOT_FOUND) - _cupsLangPuts(stderr, language, - _("lpr: error - no default destination available.\n")); + _cupsLangPrintf(stderr, + _("%s: Error - no default destination available.\n"), + argv[0]); else - _cupsLangPuts(stderr, language, - _("lpr: error - scheduler not responding!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - scheduler not responding!\n"), + argv[0]); return (1); } @@ -417,32 +456,33 @@ main(int argc, /* I - Number of command-line arguments */ if ((temp = cupsTempFd(tempfile, sizeof(tempfile))) < 0) { - _cupsLangPrintf(stderr, language, - _("lpr: error - unable to create temporary file " + _cupsLangPrintf(stderr, + _("%s: Error - unable to create temporary file " "\"%s\" - %s\n"), - tempfile, strerror(errno)); + argv[0], tempfile, strerror(errno)); return (1); } - while ((i = read(0, buffer, sizeof(buffer))) > 0) - if (write(temp, buffer, i) < 0) + while ((bytes = read(0, buffer, sizeof(buffer))) > 0) + if (write(temp, buffer, bytes) < 0) { - _cupsLangPrintf(stderr, language, - _("lpr: error - unable to write to temporary file " + _cupsLangPrintf(stderr, + _("%s: Error - unable to write to temporary file " "\"%s\" - %s\n"), - tempfile, strerror(errno)); + argv[0], tempfile, strerror(errno)); close(temp); unlink(tempfile); return (1); } - i = lseek(temp, 0, SEEK_CUR); + filesize = lseek(temp, 0, SEEK_CUR); close(temp); - if (i == 0) + if (filesize <= 0) { - _cupsLangPuts(stderr, language, - _("lpr: error - stdin is empty, so no job has been sent.\n")); + _cupsLangPrintf(stderr, + _("%s: Error - stdin is empty, so no job has been sent.\n"), + argv[0]); unlink(tempfile); return (1); } @@ -457,9 +497,7 @@ main(int argc, /* I - Number of command-line arguments */ if (job_id < 1) { - _cupsLangPrintf(stderr, language, - _("lpr: error - unable to print file: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString()); return (1); } @@ -473,7 +511,7 @@ main(int argc, /* I - Number of command-line arguments */ */ void -sighandler(int s) /* I - Signal number */ +sighandler(int s) /* I - Signal number */ { /* * Remove the temporary file we're using to print from stdin... @@ -491,5 +529,5 @@ sighandler(int s) /* I - Signal number */ /* - * End of "$Id: lpr.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lpr.c 4974 2006-01-25 07:04:33Z mike $". */ diff --git a/berkeley/lprm.c b/berkeley/lprm.c index f6fe9fc6b4..8497ff532b 100644 --- a/berkeley/lprm.c +++ b/berkeley/lprm.c @@ -1,5 +1,5 @@ /* - * "$Id: lprm.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lprm.c 4948 2006-01-19 03:23:41Z mike $" * * "lprm" command for the Common UNIX Printing System (CUPS). * @@ -84,7 +84,7 @@ main(int argc, /* I - Number of command-line arguments */ if ((http = httpConnectEncrypt(cupsServer(), ippPort(), encryption)) == NULL) { - _cupsLangPuts(stderr, language, _("lprm: Unable to contact server!\n")); + _cupsLangPuts(stderr, _("lprm: Unable to contact server!\n")); cupsFreeDests(num_dests, dests); return (1); } @@ -103,7 +103,7 @@ main(int argc, /* I - Number of command-line arguments */ httpEncryption(http, encryption); #else - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), argv[0]); #endif /* HAVE_SSL */ @@ -123,17 +123,61 @@ main(int argc, /* I - Number of command-line arguments */ if (cupsGetDest(dest, NULL, num_dests, dests) == NULL) { - _cupsLangPrintf(stderr, language, - _("lprm: Unknown destination \"%s\"!\n"), dest); + _cupsLangPrintf(stderr, + _("%s: Error - unknown destination \"%s\"!\n"), + argv[0], dest); cupsFreeDests(num_dests, dests); httpClose(http); return(1); } break; + case 'U' : /* Username */ + if (argv[i][2] != '\0') + cupsSetUser(argv[i] + 2); + else + { + i ++; + if (i >= argc) + { + _cupsLangPrintf(stderr, + _("%s: Error - expected username after " + "\'-U\' option!\n"), + argv[0]); + return (1); + } + + cupsSetUser(argv[i]); + } + break; + + case 'h' : /* Connect to host */ + if (http != NULL) + httpClose(http); + + if (argv[i][2] != '\0') + cupsSetServer(argv[i] + 2); + else + { + i ++; + + if (i >= argc) + { + _cupsLangPrintf(stderr, + _("%s: Error - expected hostname after " + "\'-h\' option!\n"), + argv[0]); + return (1); + } + else + cupsSetServer(argv[i]); + } + break; + default : - _cupsLangPrintf(stderr, language, - _("lprm: Unknown option \'%c\'!\n"), argv[i][1]); + _cupsLangPrintf(stderr, + _("%s: Error - unknown option \'%c\'!\n"), + argv[0], argv[i][1]); cupsFreeDests(num_dests, dests); httpClose(http); return (1); @@ -151,7 +195,7 @@ main(int argc, /* I - Number of command-line arguments */ op = IPP_CANCEL_JOB; job_id = atoi(argv[i]); } - else if (strcmp(argv[i], "-") == 0) + else if (!strcmp(argv[i], "-")) { /* * Cancel all jobs @@ -175,16 +219,7 @@ main(int argc, /* I - Number of command-line arguments */ * [requesting-user-name] */ - request = ippNew(); - - request->request.op.operation_id = op; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(op); if (dest) { @@ -214,43 +249,12 @@ main(int argc, /* I - Number of command-line arguments */ else response = cupsDoRequest(http, request, "/jobs/"); - if (response != NULL) - { - switch (response->request.status.status_code) - { - case IPP_NOT_FOUND : - _cupsLangPuts(stderr, language, - _("lprm: Job or printer not found!\n")); - break; - case IPP_NOT_AUTHORIZED : - _cupsLangPuts(stderr, language, - _("lprm: Not authorized to lprm job(s)!\n")); - break; - case IPP_FORBIDDEN : - _cupsLangPrintf(stderr, language, - _("lprm: You don't own job ID %d!\n"), job_id); - break; - default : - if (response->request.status.status_code > IPP_OK_CONFLICT) - _cupsLangPuts(stderr, language, - _("lprm: Unable to lprm job(s)!\n")); - break; - } - - if (response->request.status.status_code > IPP_OK_CONFLICT) - { - ippDelete(response); - cupsFreeDests(num_dests, dests); - httpClose(http); - return (1); - } - - ippDelete(response); - } - else + ippDelete(response); + + if (cupsLastError() > IPP_OK_CONFLICT) { - _cupsLangPuts(stderr, language, - _("lprm: Unable to cancel job(s)!\n")); + _cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString()); + cupsFreeDests(num_dests, dests); httpClose(http); return (1); @@ -265,8 +269,7 @@ main(int argc, /* I - Number of command-line arguments */ if (response == NULL) if (!cupsCancelJob(dest, 0)) { - _cupsLangPuts(stderr, language, - _("lprm: Unable to cancel job(s)!\n")); + _cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString()); cupsFreeDests(num_dests, dests); httpClose(http); return (1); @@ -280,5 +283,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: lprm.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lprm.c 4948 2006-01-19 03:23:41Z mike $". */ diff --git a/cgi-bin/Dependencies b/cgi-bin/Dependencies index fbcdc3d504..1bfd5141fa 100644 --- a/cgi-bin/Dependencies +++ b/cgi-bin/Dependencies @@ -1,50 +1,50 @@ # DO NOT DELETE help-index.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -help-index.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -help-index.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h +help-index.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +help-index.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h help-index.o: ../cups/array.h ../cups/string.h ../config.h ../cups/dir.h html.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -html.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -html.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h -html.o: ../cups/string.h ../config.h +html.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +html.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h +html.o: ../cups/array.h ../cups/string.h ../config.h ipp-var.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -ipp-var.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -ipp-var.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h -ipp-var.o: ../cups/string.h ../config.h +ipp-var.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +ipp-var.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h +ipp-var.o: ../cups/array.h ../cups/string.h ../config.h search.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -search.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -search.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h -search.o: ../cups/string.h ../config.h +search.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +search.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h +search.o: ../cups/array.h ../cups/string.h ../config.h template.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -template.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -template.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h -template.o: ../cups/string.h ../config.h +template.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +template.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h +template.o: ../cups/array.h ../cups/string.h ../config.h var.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -var.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -var.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h -var.o: ../cups/string.h ../config.h +var.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +var.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h +var.o: ../cups/array.h ../cups/string.h ../config.h admin.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -admin.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -admin.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h -admin.o: ../cups/string.h ../config.h ../cups/file.h +admin.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +admin.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h +admin.o: ../cups/array.h ../cups/string.h ../config.h ../cups/file.h classes.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -classes.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -classes.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h -classes.o: ../cups/string.h ../config.h +classes.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +classes.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h +classes.o: ../cups/array.h ../cups/string.h ../config.h help.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -help.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -help.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h -help.o: ../cups/string.h ../config.h +help.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +help.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h +help.o: ../cups/array.h ../cups/string.h ../config.h jobs.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -jobs.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -jobs.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h -jobs.o: ../cups/string.h ../config.h +jobs.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +jobs.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h +jobs.o: ../cups/array.h ../cups/string.h ../config.h printers.o: cgi-private.h cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h -printers.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h help-index.h -printers.o: ../cups/debug.h ../cups/i18n.h ../cups/language.h ../cups/array.h -printers.o: ../cups/string.h ../config.h +printers.o: ../cups/md5.h ../cups/ppd.h ../cups/file.h ../cups/array.h +printers.o: help-index.h ../cups/debug.h ../cups/i18n.h ../cups/language.h +printers.o: ../cups/array.h ../cups/string.h ../config.h testcgi.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h -testcgi.o: ../cups/ppd.h ../cups/file.h help-index.h +testcgi.o: ../cups/ppd.h ../cups/file.h ../cups/array.h help-index.h testhi.o: cgi.h ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h -testhi.o: ../cups/ppd.h ../cups/file.h help-index.h +testhi.o: ../cups/ppd.h ../cups/file.h ../cups/array.h help-index.h diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c index 37be8beaa0..01252ba5cf 100644 --- a/cgi-bin/admin.c +++ b/cgi-bin/admin.c @@ -1,5 +1,5 @@ /* - * "$Id: admin.c 4921 2006-01-12 21:26:26Z mike $" + * "$Id: admin.c 4943 2006-01-18 20:30:42Z mike $" * * Administration CGI for the Common UNIX Printing System (CUPS). * @@ -24,13 +24,13 @@ * Contents: * * main() - Main entry for CGI. - * compare_printer_devices() - Compare two printer devices. * do_am_class() - Add or modify a class. * do_am_printer() - Add or modify a printer. * do_config_printer() - Configure the default options for a printer. * do_config_server() - Configure server settings. * do_delete_class() - Delete a class... * do_delete_printer() - Delete a printer... + * do_export() - Export printers to Samba... * do_menu() - Show the main menu... * do_printer_op() - Do a printer operation. * do_set_allowed_users() - Set the allowed/denied users for a queue. @@ -45,23 +45,27 @@ #include "cgi-private.h" #include #include +#include +#include +#include /* * Local functions... */ -static void do_am_class(http_t *http, cups_lang_t *language, int modify); -static void do_am_printer(http_t *http, cups_lang_t *language, int modify); -static void do_config_printer(http_t *http, cups_lang_t *language); -static void do_config_server(http_t *http, cups_lang_t *language); -static void do_delete_class(http_t *http, cups_lang_t *language); -static void do_delete_printer(http_t *http, cups_lang_t *language); -static void do_menu(http_t *http, cups_lang_t *language); -static void do_printer_op(http_t *http, cups_lang_t *language, +static void do_am_class(http_t *http, int modify); +static void do_am_printer(http_t *http, int modify); +static void do_config_printer(http_t *http); +static void do_config_server(http_t *http); +static void do_delete_class(http_t *http); +static void do_delete_printer(http_t *http); +static void do_export(http_t *http); +static void do_menu(http_t *http); +static void do_printer_op(http_t *http, ipp_op_t op, const char *title); -static void do_set_allowed_users(http_t *http, cups_lang_t *language); -static void do_set_sharing(http_t *http, cups_lang_t *language); +static void do_set_allowed_users(http_t *http); +static void do_set_sharing(http_t *http); static int match_string(const char *a, const char *b); @@ -73,17 +77,10 @@ int /* O - Exit status */ main(int argc, /* I - Number of command-line arguments */ char *argv[]) /* I - Command-line arguments */ { - cups_lang_t *language; /* Language information */ http_t *http; /* Connection to the server */ const char *op; /* Operation name */ - /* - * Get the request language... - */ - - language = cupsLangDefault(); - /* * Connect to the HTTP server... */ @@ -106,7 +103,7 @@ main(int argc, /* I - Number of command-line arguments */ * Nope, send the administration menu... */ - do_menu(http, language); + do_menu(http); } else if ((op = cgiGetVariable("OP")) != NULL) { @@ -125,57 +122,53 @@ main(int argc, /* I - Number of command-line arguments */ puts("Location: /admin\n"); } else if (!strcmp(op, "start-printer")) - do_printer_op(http, language, IPP_RESUME_PRINTER, "Start Printer"); + do_printer_op(http, IPP_RESUME_PRINTER, cgiText(_("Start Printer"))); else if (!strcmp(op, "stop-printer")) - do_printer_op(http, language, IPP_PAUSE_PRINTER, "Stop Printer"); + do_printer_op(http, IPP_PAUSE_PRINTER, cgiText(_("Stop Printer"))); else if (!strcmp(op, "start-class")) - do_printer_op(http, language, IPP_RESUME_PRINTER, "Start Class"); + do_printer_op(http, IPP_RESUME_PRINTER, cgiText(_("Start Class"))); else if (!strcmp(op, "stop-class")) - do_printer_op(http, language, IPP_PAUSE_PRINTER, "Stop Class"); + do_printer_op(http, IPP_PAUSE_PRINTER, cgiText(_("Stop Class"))); else if (!strcmp(op, "accept-jobs")) - do_printer_op(http, language, CUPS_ACCEPT_JOBS, "Accept Jobs"); + do_printer_op(http, CUPS_ACCEPT_JOBS, cgiText(_("Accept Jobs"))); else if (!strcmp(op, "reject-jobs")) - do_printer_op(http, language, CUPS_REJECT_JOBS, "Reject Jobs"); + do_printer_op(http, CUPS_REJECT_JOBS, cgiText(_("Reject Jobs"))); else if (!strcmp(op, "purge-jobs")) - do_printer_op(http, language, IPP_PURGE_JOBS, "Purge Jobs"); + do_printer_op(http, IPP_PURGE_JOBS, cgiText(_("Purge Jobs"))); else if (!strcmp(op, "set-allowed-users")) - do_set_allowed_users(http, language); + do_set_allowed_users(http); else if (!strcmp(op, "set-as-default")) - do_printer_op(http, language, CUPS_SET_DEFAULT, "Set As Default"); + do_printer_op(http, CUPS_SET_DEFAULT, cgiText(_("Set As Default"))); else if (!strcmp(op, "set-sharing")) - do_set_sharing(http, language); + do_set_sharing(http); else if (!strcmp(op, "add-class")) - do_am_class(http, language, 0); + do_am_class(http, 0); else if (!strcmp(op, "add-printer")) - do_am_printer(http, language, 0); + do_am_printer(http, 0); else if (!strcmp(op, "modify-class")) - do_am_class(http, language, 1); + do_am_class(http, 1); else if (!strcmp(op, "modify-printer")) - do_am_printer(http, language, 1); + do_am_printer(http, 1); else if (!strcmp(op, "delete-class")) - do_delete_class(http, language); + do_delete_class(http); else if (!strcmp(op, "delete-printer")) - do_delete_printer(http, language); + do_delete_printer(http); else if (!strcmp(op, "set-printer-options")) - do_config_printer(http, language); + do_config_printer(http); else if (!strcmp(op, "config-server")) - do_config_server(http, language); + do_config_server(http); + else if (!strcmp(op, "export-samba")) + do_export(http); else { /* * Bad operation code... Display an error... */ - cgiStartHTML("Error"); - cgiCopyTemplateLang("admin-op.tmpl"); + cgiStartHTML(cgiText(_("Administration"))); + cgiCopyTemplateLang("error-op.tmpl"); cgiEndHTML(); } - - /* - * Close the HTTP server connection... - */ - - httpClose(http); } else { @@ -183,16 +176,16 @@ main(int argc, /* I - Number of command-line arguments */ * Form data but no operation code... Display an error... */ - cgiStartHTML("Error"); - cgiCopyTemplateLang("admin-op.tmpl"); + cgiStartHTML(cgiText(_("Administration"))); + cgiCopyTemplateLang("error-op.tmpl"); cgiEndHTML(); } /* - * Free the request language... + * Close the HTTP server connection... */ - cupsLangFree(language); + httpClose(http); /* * Return with no errors... @@ -202,26 +195,13 @@ main(int argc, /* I - Number of command-line arguments */ } -/* - * 'compare_printer_devices()' - Compare two printer devices. - */ - -static int /* O - Result of comparison */ -compare_printer_devices(const void *a, /* I - First device */ - const void *b) /* I - Second device */ -{ - return (strcmp(*((char **)a), *((char **)b))); -} - - /* * 'do_am_class()' - Add or modify a class. */ static void -do_am_class(http_t *http, /* I - HTTP connection */ - cups_lang_t *language, /* I - Client's language */ - int modify) /* I - Modify the printer? */ +do_am_class(http_t *http, /* I - HTTP connection */ + int modify) /* I - Modify the printer? */ { int i, j; /* Looping vars */ int element; /* Element number */ @@ -229,7 +209,6 @@ do_am_class(http_t *http, /* I - HTTP connection */ ipp_t *request, /* IPP request */ *response; /* IPP response */ ipp_attribute_t *attr; /* member-uris attribute */ - ipp_status_t status; /* Request status */ char uri[HTTP_MAX_URI]; /* Device or printer URI */ const char *name, /* Pointer to class name */ *ptr; /* Pointer to CGI variable */ @@ -242,7 +221,7 @@ do_am_class(http_t *http, /* I - HTTP connection */ }; - title = modify ? "Modify Class" : "Add Class"; + title = cgiText(modify ? _("Modify Class") : _("Add Class")); name = cgiGetVariable("PRINTER_NAME"); if (cgiGetVariable("PRINTER_LOCATION") == NULL) @@ -256,16 +235,7 @@ do_am_class(http_t *http, /* I - HTTP connection */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = CUPS_GET_PRINTERS; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_GET_PRINTERS); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, "ipp://localhost/printers"); @@ -331,16 +301,7 @@ do_am_class(http_t *http, /* I - HTTP connection */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/classes/%s", name); @@ -420,9 +381,11 @@ do_am_class(http_t *http, /* I - HTTP connection */ if (*ptr || ptr == name || strlen(name) > 127) { - cgiSetVariable("ERROR", "The class name may only contain up to 127 printable " - "characters and may not contain spaces, slashes (/), " - "or the pound sign (#)."); + cgiSetVariable("ERROR", + cgiText(_("The class name may only contain up to " + "127 printable characters and may not " + "contain spaces, slashes (/), or the " + "pound sign (#)."))); cgiStartHTML(title); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -443,16 +406,7 @@ do_am_class(http_t *http, /* I - HTTP connection */ * member-uris */ - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_CLASS; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_ADD_CLASS); httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/classes/%s", cgiGetVariable("PRINTER_NAME")); @@ -482,19 +436,13 @@ do_am_class(http_t *http, /* I - HTTP connection */ * Do the request and get back a response... */ - if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) - { - status = response->request.status.status_code; - ippDelete(response); - } - else - status = cupsLastError(); + ippDelete(cupsDoRequest(http, request, "/admin/")); - if (status > IPP_OK_CONFLICT) + if (cupsLastError() > IPP_OK_CONFLICT) { cgiStartHTML(title); - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); + cgiShowIPPError(modify ? _("Unable to modify class:") : + _("Unable to add class:")); } else { @@ -505,7 +453,7 @@ do_am_class(http_t *http, /* I - HTTP connection */ char refresh[1024]; /* Refresh URL */ cgiFormEncode(uri, name, sizeof(uri)); - snprintf(refresh, sizeof(refresh), "5;/admin?OP=redirect&URL=/classes/%s", + snprintf(refresh, sizeof(refresh), "5;/admin/?OP=redirect&URL=/classes/%s", uri); cgiSetVariable("refresh_page", refresh); @@ -526,9 +474,8 @@ do_am_class(http_t *http, /* I - HTTP connection */ */ static void -do_am_printer(http_t *http, /* I - HTTP connection */ - cups_lang_t *language, /* I - Client's language */ - int modify) /* I - Modify the printer? */ +do_am_printer(http_t *http, /* I - HTTP connection */ + int modify) /* I - Modify the printer? */ { int i; /* Looping var */ int element; /* Element number */ @@ -537,7 +484,6 @@ do_am_printer(http_t *http, /* I - HTTP connection */ ipp_t *request, /* IPP request */ *response, /* IPP response */ *oldinfo; /* Old printer information */ - ipp_status_t status; /* Request status */ const cgi_file_t *file; /* Uploaded file, if any */ const char *var; /* CGI variable */ char uri[HTTP_MAX_URI], /* Device or printer URI */ @@ -562,7 +508,10 @@ do_am_printer(http_t *http, /* I - HTTP connection */ }; - title = modify ? "Modify Printer" : "Add Printer"; + fprintf(stderr, "DEBUG: do_am_printer: DEVICE_URI=\"%s\"\n", + cgiGetVariable("DEVICE_URI")); + + title = cgiText(modify ? _("Modify Printer") : _("Add Printer")); if (modify) { @@ -575,16 +524,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", cgiGetVariable("PRINTER_NAME")); @@ -639,9 +579,11 @@ do_am_printer(http_t *http, /* I - HTTP connection */ if (*ptr || ptr == name || strlen(name) > 127) { - cgiSetVariable("ERROR", "The printer name may only contain up to 127 printable " - "characters and may not contain spaces, slashes (/), " - "or the pound sign (#)."); + cgiSetVariable("ERROR", + cgiText(_("The printer name may only contain up to " + "127 printable characters and may not " + "contain spaces, slashes (/), or the " + "pound sign (#)."))); cgiStartHTML(title); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -669,16 +611,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = CUPS_GET_DEVICES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_GET_DEVICES); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, "ipp://localhost/printers/"); @@ -860,21 +793,11 @@ do_am_printer(http_t *http, /* I - HTTP connection */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = CUPS_GET_PPDS; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_GET_PPDS); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, "ipp://localhost/printers/"); - if ((var = cgiGetVariable("PPD_MAKE")) != NULL) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_TEXT, "ppd-make", NULL, var); @@ -973,13 +896,8 @@ do_am_printer(http_t *http, /* I - HTTP connection */ } else { - char message[1024]; - - - snprintf(message, sizeof(message), "Unable to get list of printer drivers: %s", - ippErrorString(cupsLastError())); - cgiSetVariable("ERROR", message); cgiStartHTML(title); + cgiShowIPPError(_("Unable to get list of printer drivers:")); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); } @@ -1001,16 +919,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ * printer-state */ - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_PRINTER; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_ADD_PRINTER); httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", cgiGetVariable("PRINTER_NAME")); @@ -1036,7 +945,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ if ((uriptr = strrchr(uri, '|')) != NULL) *uriptr = '\0'; - if (strncmp(uri, "serial:", 7) == 0) + if (!strncmp(uri, "serial:", 7)) { /* * Update serial port URI to include baud rate, etc. @@ -1064,23 +973,15 @@ do_am_printer(http_t *http, /* I - HTTP connection */ */ if (file) - response = cupsDoFileRequest(http, request, "/admin/", file->tempfile); + ippDelete(cupsDoFileRequest(http, request, "/admin/", file->tempfile)); else - response = cupsDoRequest(http, request, "/admin/"); + ippDelete(cupsDoRequest(http, request, "/admin/")); - if (response) - { - status = response->request.status.status_code; - ippDelete(response); - } - else - status = cupsLastError(); - - if (status > IPP_OK_CONFLICT) + if (cupsLastError() > IPP_OK_CONFLICT) { cgiStartHTML(title); - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); + cgiShowIPPError(modify ? _("Unable to modify printer:") : + _("Unable to add printer:")); } else { @@ -1095,10 +996,10 @@ do_am_printer(http_t *http, /* I - HTTP connection */ if (modify) snprintf(refresh, sizeof(refresh), - "5;/admin?OP=redirect&URL=/printers/%s", uri); + "5;/admin/?OP=redirect&URL=/printers/%s", uri); else snprintf(refresh, sizeof(refresh), - "5;/admin?OP=set-printer-options&PRINTER_NAME=%s", uri); + "5;/admin/?OP=set-printer-options&PRINTER_NAME=%s", uri); cgiSetVariable("refresh_page", refresh); @@ -1123,8 +1024,7 @@ do_am_printer(http_t *http, /* I - HTTP connection */ */ static void -do_config_printer(http_t *http, /* I - HTTP connection */ - cups_lang_t *language)/* I - Client's language */ +do_config_printer(http_t *http) /* I - HTTP connection */ { int i, j, k, m; /* Looping vars */ int have_options; /* Have options? */ @@ -1134,7 +1034,6 @@ do_config_printer(http_t *http, /* I - HTTP connection */ char uri[HTTP_MAX_URI]; /* Job URI */ const char *var; /* Variable value */ const char *printer; /* Printer printer name */ - ipp_status_t status; /* Operation status... */ const char *filename; /* PPD filename */ char tempfile[1024]; /* Temporary filename */ cups_file_t *in, /* Input file */ @@ -1146,8 +1045,11 @@ do_config_printer(http_t *http, /* I - HTTP connection */ ppd_group_t *group; /* Option group */ ppd_option_t *option; /* Option */ ppd_attr_t *protocol; /* cupsProtocol attribute */ + const char *title; /* Page title */ + title = cgiText(_("Set Printer Options")); + /* * Get the printer name... */ @@ -1157,8 +1059,8 @@ do_config_printer(http_t *http, /* I - HTTP connection */ "/printers/%s", printer); else { - cgiSetVariable("ERROR", ippErrorString(IPP_NOT_FOUND)); - cgiStartHTML("Set Printer Options"); + cgiSetVariable("ERROR", cgiText(_("Missing form variable!"))); + cgiStartHTML(title); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); return; @@ -1170,35 +1072,17 @@ do_config_printer(http_t *http, /* I - HTTP connection */ if ((filename = cupsGetPPD(printer)) == NULL) { - if (cupsLastError() == IPP_NOT_FOUND) - { - /* - * No PPD file for this printer, so we can't configure it! - */ - - cgiSetVariable("ERROR", ippErrorString(IPP_NOT_POSSIBLE)); - cgiStartHTML("Set Printer Options"); - cgiCopyTemplateLang("error.tmpl"); - cgiEndHTML(); - } - else - { - /* - * Unable to access the PPD file for some reason... - */ - - cgiSetVariable("ERROR", ippErrorString(cupsLastError())); - cgiStartHTML("Set Printer Options"); - cgiCopyTemplateLang("error.tmpl"); - cgiEndHTML(); - } + cgiStartHTML(title); + cgiShowIPPError(_("Unable to get PPD file!")); + cgiEndHTML(); return; } if ((ppd = ppdOpenFile(filename)) == NULL) { - cgiSetVariable("ERROR", ippErrorString(IPP_DEVICE_ERROR)); - cgiStartHTML("Set Printer Options"); + cgiSetVariable("ERROR", ppdErrorString(ppdLastError(&i))); + cgiSetVariable("MESSAGE", cgiText(_("Unable to open PPD file:"))); + cgiStartHTML(title); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); return; @@ -1243,6 +1127,8 @@ do_config_printer(http_t *http, /* I - HTTP connection */ * Show the options to the user... */ + ppdLocalize(ppd); + cgiStartHTML("Set Printer Options"); cgiCopyTemplateLang("set-printer-options-header.tmpl"); @@ -1265,8 +1151,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */ i --, group ++) { if (!strcmp(group->name, "InstallableOptions")) - cgiSetVariable("GROUP", - _cupsLangString(language, _("Options Installed"))); + cgiSetVariable("GROUP", cgiText(_("Options Installed"))); else cgiSetVariable("GROUP", group->text); @@ -1333,16 +1218,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); @@ -1355,13 +1231,14 @@ do_config_printer(http_t *http, /* I - HTTP connection */ if ((response = cupsDoRequest(http, request, "/")) != NULL) { - if ((attr = ippFindAttribute(response, "job-sheets-supported", IPP_TAG_ZERO)) != NULL) + if ((attr = ippFindAttribute(response, "job-sheets-supported", + IPP_TAG_ZERO)) != NULL) { /* * Add the job sheets options... */ - cgiSetVariable("GROUP", "Banners"); + cgiSetVariable("GROUP", cgiText(_("Banners"))); cgiCopyTemplateLang("option-header.tmpl"); cgiSetSize("CHOICES", attr->num_values); @@ -1375,14 +1252,14 @@ do_config_printer(http_t *http, /* I - HTTP connection */ attr = ippFindAttribute(response, "job-sheets-default", IPP_TAG_ZERO); cgiSetVariable("KEYWORD", "job_sheets_start"); - cgiSetVariable("KEYTEXT", "Starting Banner"); + cgiSetVariable("KEYTEXT", cgiText(_("Starting Banner"))); cgiSetVariable("DEFCHOICE", attr == NULL ? "" : attr->values[0].string.text); cgiCopyTemplateLang("option-pickone.tmpl"); cgiSetVariable("KEYWORD", "job_sheets_end"); - cgiSetVariable("KEYTEXT", "Ending Banner"); + cgiSetVariable("KEYTEXT", cgiText(_("Ending Banner"))); cgiSetVariable("DEFCHOICE", attr == NULL && attr->num_values > 1 ? "" : attr->values[1].string.text); @@ -1400,7 +1277,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */ * Add the error and operation policy options... */ - cgiSetVariable("GROUP", "Policies"); + cgiSetVariable("GROUP", cgiText(_("Policies"))); cgiCopyTemplateLang("option-header.tmpl"); /* @@ -1424,7 +1301,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */ IPP_TAG_ZERO); cgiSetVariable("KEYWORD", "printer_error_policy"); - cgiSetVariable("KEYTEXT", "Error Policy"); + cgiSetVariable("KEYTEXT", cgiText(_("Error Policy"))); cgiSetVariable("DEFCHOICE", attr == NULL ? "" : attr->values[0].string.text); } @@ -1451,7 +1328,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */ attr = ippFindAttribute(response, "printer-op-policy", IPP_TAG_ZERO); cgiSetVariable("KEYWORD", "printer_op_policy"); - cgiSetVariable("KEYTEXT", "Operation Policy"); + cgiSetVariable("KEYTEXT", cgiText(_("Operation Policy"))); cgiSetVariable("DEFCHOICE", attr == NULL ? "" : attr->values[0].string.text); @@ -1472,13 +1349,13 @@ do_config_printer(http_t *http, /* I - HTTP connection */ { protocol = ppdFindAttr(ppd, "cupsProtocol", NULL); - cgiSetVariable("GROUP", "PS Binary Protocol"); + cgiSetVariable("GROUP", cgiText(_("PS Binary Protocol"))); cgiCopyTemplateLang("option-header.tmpl"); cgiSetSize("CHOICES", 2); cgiSetSize("TEXT", 2); cgiSetArray("CHOICES", 0, "None"); - cgiSetArray("TEXT", 0, "None"); + cgiSetArray("TEXT", 0, cgiText(_("None"))); if (strstr(ppd->protocols, "TBCP")) { @@ -1492,7 +1369,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */ } cgiSetVariable("KEYWORD", "protocol"); - cgiSetVariable("KEYTEXT", "PS Binary Protocol"); + cgiSetVariable("KEYTEXT", cgiText(_("PS Binary Protocol"))); cgiSetVariable("DEFCHOICE", protocol ? protocol->value : "None"); cgiCopyTemplateLang("option-pickone.tmpl"); @@ -1581,16 +1458,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */ * [ppd file] */ - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_PRINTER; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_ADD_PRINTER); httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", cgiGetVariable("PRINTER_NAME")); @@ -1614,19 +1482,12 @@ do_config_printer(http_t *http, /* I - HTTP connection */ * Do the request and get back a response... */ - if ((response = cupsDoFileRequest(http, request, "/admin/", tempfile)) != NULL) - { - status = response->request.status.status_code; - ippDelete(response); - } - else - status = cupsLastError(); + ippDelete(cupsDoFileRequest(http, request, "/admin/", tempfile)); - if (status > IPP_OK_CONFLICT) + if (cupsLastError() > IPP_OK_CONFLICT) { - cgiStartHTML("Set Printer Options"); - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); + cgiStartHTML(title); + cgiShowIPPError(_("Unable to set options:")); } else { @@ -1636,12 +1497,13 @@ do_config_printer(http_t *http, /* I - HTTP connection */ char refresh[1024]; /* Refresh URL */ + cgiFormEncode(uri, printer, sizeof(uri)); - snprintf(refresh, sizeof(refresh), "5;/admin?OP=redirect&URL=/printers/%s", + snprintf(refresh, sizeof(refresh), "5;/admin/?OP=redirect&URL=/printers/%s", uri); cgiSetVariable("refresh_page", refresh); - cgiStartHTML("Set Printer Options"); + cgiStartHTML(title); cgiCopyTemplateLang("printer-configured.tmpl"); } @@ -1660,8 +1522,7 @@ do_config_printer(http_t *http, /* I - HTTP connection */ */ static void -do_config_server(http_t *http, /* I - HTTP connection */ - cups_lang_t *language) /* I - Client's language */ +do_config_server(http_t *http) /* I - HTTP connection */ { if (cgiIsPOST() && !cgiGetVariable("CUPSDCONF")) { @@ -1727,7 +1588,8 @@ do_config_server(http_t *http, /* I - HTTP connection */ * Unable to open - log an error... */ - cgiStartHTML("Change Settings"); + cgiStartHTML(cgiText(_("Change Settings"))); + cgiSetVariable("MESSAGE", cgiText(_("Unable to change server settings:"))); cgiSetVariable("ERROR", strerror(errno)); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -1742,7 +1604,8 @@ do_config_server(http_t *http, /* I - HTTP connection */ if ((tempfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0) { - cgiStartHTML("Change Settings"); + cgiStartHTML(cgiText(_("Change Settings"))); + cgiSetVariable("MESSAGE", cgiText(_("Unable to change server settings:"))); cgiSetVariable("ERROR", strerror(errno)); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -1754,7 +1617,8 @@ do_config_server(http_t *http, /* I - HTTP connection */ if ((temp = cupsFileOpenFd(tempfd, "w")) == NULL) { - cgiStartHTML("Change Settings"); + cgiStartHTML(cgiText(_("Change Settings"))); + cgiSetVariable("MESSAGE", cgiText(_("Unable to change server settings:"))); cgiSetVariable("ERROR", strerror(errno)); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -2230,15 +2094,16 @@ do_config_server(http_t *http, /* I - HTTP connection */ if (status != HTTP_CREATED) { + cgiSetVariable("MESSAGE", cgiText(_("Unable to upload cupsd.conf file:"))); cgiSetVariable("ERROR", httpStatus(status)); - cgiStartHTML("Change Settings"); + cgiStartHTML(cgiText(_("Change Settings"))); cgiCopyTemplateLang("error.tmpl"); } else { - cgiSetVariable("refresh_page", "5;/admin?OP=redirect"); + cgiSetVariable("refresh_page", "5;/admin/?OP=redirect"); - cgiStartHTML("Change Settings"); + cgiStartHTML(cgiText(_("Change Settings"))); cgiCopyTemplateLang("restart.tmpl"); } @@ -2266,7 +2131,8 @@ do_config_server(http_t *http, /* I - HTTP connection */ if ((tempfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0) { - cgiStartHTML("Edit Configuration File"); + cgiStartHTML(cgiText(_("Edit Configuration File"))); + cgiSetVariable("MESSAGE", cgiText(_("Unable to create temporary file:"))); cgiSetVariable("ERROR", strerror(errno)); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -2277,7 +2143,8 @@ do_config_server(http_t *http, /* I - HTTP connection */ if ((temp = cupsFileOpenFd(tempfd, "w")) == NULL) { - cgiStartHTML("Edit Configuration File"); + cgiStartHTML(cgiText(_("Edit Configuration File"))); + cgiSetVariable("MESSAGE", cgiText(_("Unable to create temporary file:"))); cgiSetVariable("ERROR", strerror(errno)); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -2320,15 +2187,17 @@ do_config_server(http_t *http, /* I - HTTP connection */ if (status != HTTP_CREATED) { + cgiSetVariable("MESSAGE", cgiText(_("Unable to upload cupsd.conf file:"))); cgiSetVariable("ERROR", httpStatus(status)); - cgiStartHTML("Edit Configuration File"); + + cgiStartHTML(cgiText(_("Edit Configuration File"))); cgiCopyTemplateLang("error.tmpl"); } else { - cgiSetVariable("refresh_page", "5;/admin?OP=redirect"); + cgiSetVariable("refresh_page", "5;/admin/?OP=redirect"); - cgiStartHTML("Edit Configuration File"); + cgiStartHTML(cgiText(_("Edit Configuration File"))); cgiCopyTemplateLang("restart.tmpl"); } @@ -2360,7 +2229,8 @@ do_config_server(http_t *http, /* I - HTTP connection */ if (stat(filename, &info)) { - cgiStartHTML("Edit Configuration File"); + cgiStartHTML(cgiText(_("Edit Configuration File"))); + cgiSetVariable("MESSAGE", cgiText(_("Unable to access cupsd.conf file:"))); cgiSetVariable("ERROR", strerror(errno)); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -2371,8 +2241,11 @@ do_config_server(http_t *http, /* I - HTTP connection */ if (info.st_size > (1024 * 1024)) { - cgiStartHTML("Edit Configuration File"); - cgiSetVariable("ERROR", "Unable to edit cupsd.conf files larger than 1MB!"); + cgiStartHTML(cgiText(_("Edit Configuration File"))); + cgiSetVariable("MESSAGE", cgiText(_("Unable to access cupsd.conf file:"))); + cgiSetVariable("ERROR", + cgiText(_("Unable to edit cupsd.conf files larger than " + "1MB!"))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -2391,7 +2264,8 @@ do_config_server(http_t *http, /* I - HTTP connection */ * Unable to open - log an error... */ - cgiStartHTML("Edit Configuration File"); + cgiStartHTML(cgiText(_("Edit Configuration File"))); + cgiSetVariable("MESSAGE", cgiText(_("Unable to access cupsd.conf file:"))); cgiSetVariable("ERROR", strerror(errno)); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -2432,19 +2306,17 @@ do_config_server(http_t *http, /* I - HTTP connection */ */ static void -do_delete_class(http_t *http, /* I - HTTP connection */ - cups_lang_t *language) /* I - Client's language */ +do_delete_class(http_t *http) /* I - HTTP connection */ { - ipp_t *request, /* IPP request */ - *response; /* IPP response */ + ipp_t *request; /* IPP request */ char uri[HTTP_MAX_URI]; /* Job URI */ const char *pclass; /* Printer class name */ - ipp_status_t status; /* Operation status... */ + cgiStartHTML(cgiText(_("Delete Class"))); + if (cgiGetVariable("CONFIRM") == NULL) { - cgiStartHTML("Delete Class"); cgiCopyTemplateLang("class-confirm.tmpl"); cgiEndHTML(); return; @@ -2455,8 +2327,7 @@ do_delete_class(http_t *http, /* I - HTTP connection */ "/classes/%s", pclass); else { - cgiSetVariable("ERROR", ippErrorString(IPP_NOT_FOUND)); - cgiStartHTML("Delete Class"); + cgiSetVariable("ERROR", cgiText(_("Missing form variable!"))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); return; @@ -2471,16 +2342,7 @@ do_delete_class(http_t *http, /* I - HTTP connection */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = CUPS_DELETE_CLASS; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_DELETE_CLASS); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -2489,22 +2351,10 @@ do_delete_class(http_t *http, /* I - HTTP connection */ * Do the request and get back a response... */ - if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) - { - status = response->request.status.status_code; + ippDelete(cupsDoRequest(http, request, "/admin/")); - ippDelete(response); - } - else - status = cupsLastError(); - - cgiStartHTML("Delete Class"); - - if (status > IPP_OK_CONFLICT) - { - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); - } + if (cupsLastError() > IPP_OK_CONFLICT) + cgiShowIPPError(_("Unable to delete class:")); else cgiCopyTemplateLang("class-deleted.tmpl"); @@ -2517,19 +2367,17 @@ do_delete_class(http_t *http, /* I - HTTP connection */ */ static void -do_delete_printer(http_t *http, /* I - HTTP connection */ - cups_lang_t *language)/* I - Client's language */ +do_delete_printer(http_t *http) /* I - HTTP connection */ { - ipp_t *request, /* IPP request */ - *response; /* IPP response */ + ipp_t *request; /* IPP request */ char uri[HTTP_MAX_URI]; /* Job URI */ const char *printer; /* Printer printer name */ - ipp_status_t status; /* Operation status... */ + cgiStartHTML(cgiText(_("Delete Printer"))); + if (cgiGetVariable("CONFIRM") == NULL) { - cgiStartHTML("Delete Printer"); cgiCopyTemplateLang("printer-confirm.tmpl"); cgiEndHTML(); return; @@ -2540,8 +2388,7 @@ do_delete_printer(http_t *http, /* I - HTTP connection */ "/printers/%s", printer); else { - cgiSetVariable("ERROR", ippErrorString(IPP_NOT_FOUND)); - cgiStartHTML("Delete Printer"); + cgiSetVariable("ERROR", cgiText(_("Missing form variable!"))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); return; @@ -2556,16 +2403,7 @@ do_delete_printer(http_t *http, /* I - HTTP connection */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = CUPS_DELETE_PRINTER; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_DELETE_PRINTER); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -2574,25 +2412,251 @@ do_delete_printer(http_t *http, /* I - HTTP connection */ * Do the request and get back a response... */ - if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) + ippDelete(cupsDoRequest(http, request, "/admin/")); + + if (cupsLastError() > IPP_OK_CONFLICT) + cgiShowIPPError(_("Unable to delete printer:")); + else + cgiCopyTemplateLang("printer-deleted.tmpl"); + + cgiEndHTML(); +} + + +/* + * 'do_export()' - Export printers to Samba... + */ + +static void +do_export(http_t *http) /* I - HTTP connection */ +{ + int i, j; /* Looping vars */ + ipp_t *request, /* IPP request */ + *response; /* IPP response */ + const char *username, /* Samba username */ + *password, /* Samba password */ + *export_all; /* Export all printers? */ + int export_count, /* Number of printers to export */ + printer_count; /* Number of available printers */ + + + /* + * Show header... + */ + + cgiStartHTML(cgiText(_("Export Printers to Samba"))); + + /* + * Get form data... + */ + + username = cgiGetVariable("USERNAME"); + password = cgiGetVariable("PASSWORD"); + export_all = cgiGetVariable("EXPORT_ALL"); + export_count = cgiGetSize("EXPORT_NAME"); + + if (username && *username && password && *password && export_count <= 1000) { - status = response->request.status.status_code; + /* + * Do export... + */ - ippDelete(response); + char userpass[1024], /* Username%password */ + *argv[1005]; /* Arguments */ + int argc; /* Number of arguments */ + int pid; /* Process ID of child */ + int status; /* Status of command */ + + + fputs("DEBUG: Export printers...\n", stderr); + + /* + * Create the command-line for cupsaddsmb... + */ + + snprintf(userpass, sizeof(userpass), "%s%%%s", username, password); + + argv[0] = "cupsaddsmb"; + argv[1] = "-v"; + argv[2] = "-U"; + argv[3] = userpass; + argc = 4; + + if (export_all) + argv[argc ++] = "-a"; + else + { + for (i = 0; i < export_count; i ++) + argv[argc ++] = (char *)cgiGetArray("EXPORT_NAME", i); + } + + argv[argc] = NULL; + + /* + * Run the command... + */ + + if ((pid = fork()) == 0) + { + /* + * Child goes here... + */ + + close(0); + open("/dev/null", O_RDONLY); + close(1); + dup(2); + + execvp("cupsaddsmb", argv); + perror("ERROR: Unable to execute cupsaddsmb"); + exit(20); + } + else if (pid < 0) + cgiSetVariable("ERROR", cgiText(_("Unable to fork process!"))); + else + { + /* + * Parent goes here, wait for child to finish... + */ + + while (wait(&status) < 0); + + if (status) + { + char message[1024]; /* Error message */ + + + if (WIFEXITED(status)) + { + switch (WEXITSTATUS(status)) + { + case 1 : + cgiSetVariable("ERROR", cgiText(_("Unable to connect to server!"))); + break; + + case 2 : + cgiSetVariable("ERROR", cgiText(_("Unable to get printer " + "attributes!"))); + break; + + case 3 : + cgiSetVariable("ERROR", cgiText(_("Unable to convert PPD file!"))); + break; + + case 4 : + cgiSetVariable("ERROR", cgiText(_("Unable to copy Windows 2000 " + "printer driver files!"))); + break; + + case 5 : + cgiSetVariable("ERROR", cgiText(_("Unable to install Windows " + "2000 printer driver files!"))); + break; + + case 6 : + cgiSetVariable("ERROR", cgiText(_("Unable to copy Windows 9x " + "printer driver files!"))); + break; + + case 7 : + cgiSetVariable("ERROR", cgiText(_("Unable to install Windows " + "9x printer driver files!"))); + break; + + case 8 : + cgiSetVariable("ERROR", cgiText(_("Unable to set Windows " + "printer driver!"))); + break; + + case 9 : + cgiSetVariable("ERROR", cgiText(_("No printer drivers found!"))); + break; + + case 20 : + cgiSetVariable("ERROR", cgiText(_("Unable to execute " + "cupsaddsmb command!"))); + break; + + default : + snprintf(message, sizeof(message), + cgiText(_("cupsaddsmb failed with status %d")), + WEXITSTATUS(status)); + + cgiSetVariable("ERROR", message); + break; + } + } + else + { + snprintf(message, sizeof(message), + cgiText(_("cupsaddsmb crashed on signal %d")), + WTERMSIG(status)); + + cgiSetVariable("ERROR", message); + } + } + else + { + cgiCopyTemplateLang("samba-exported"); + cgiEndHTML(); + return; + } + } } - else - status = cupsLastError(); + else if (username && !*username) + cgiSetVariable("ERROR", + cgiText(_("A Samba username is required to export " + "printer drivers!"))); + else if (username && (!password || !*password)) + cgiSetVariable("ERROR", + cgiText(_("A Samba password is required to export " + "printer drivers!"))); + + /* + * Get list of available printers... + */ - cgiStartHTML("Delete Printer"); + cgiSetSize("PRINTER_NAME", 0); + cgiSetSize("PRINTER_EXPORT", 0); - if (status > IPP_OK_CONFLICT) + request = ippNewRequest(CUPS_GET_PRINTERS); + + ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, + "printer-type", 0); + + ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, + "printer-type-mask", CUPS_PRINTER_CLASS | CUPS_PRINTER_REMOTE | + CUPS_PRINTER_IMPLICIT); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, + "requested-attributes", NULL, "printer-name"); + + if ((response = cupsDoRequest(http, request, "/")) != NULL) { - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); + cgiSetIPPVars(response, NULL, NULL, NULL, 0); + ippDelete(response); + + if (!export_all) + { + printer_count = cgiGetSize("PRINTER_NAME"); + + for (i = 0; i < printer_count; i ++) + { + for (j = 0; j < export_count; j ++) + if (!strcasecmp(cgiGetArray("PRINTER_NAME", i), + cgiGetArray("EXPORT_NAME", j))) + break; + + cgiSetArray("PRINTER_EXPORT", i, j < export_count ? "Y" : ""); + } + } } - else - cgiCopyTemplateLang("printer-deleted.tmpl"); + /* + * Show form... + */ + + cgiCopyTemplateLang("samba-export.tmpl"); cgiEndHTML(); } @@ -2602,13 +2666,13 @@ do_delete_printer(http_t *http, /* I - HTTP connection */ */ static void -do_menu(http_t *http, /* I - HTTP connection */ - cups_lang_t *language) /* I - Client's language */ +do_menu(http_t *http) /* I - HTTP connection */ { cups_file_t *cupsd; /* cupsd.conf file */ char line[1024], /* Line from cupsd.conf file */ *value; /* Value on line */ const char *server_root; /* Location of config files */ + const char *datadir; /* Location of data files */ ipp_t *request, /* IPP request */ *response; /* IPP response */ ipp_attribute_t *attr; /* IPP attribute */ @@ -2623,7 +2687,7 @@ do_menu(http_t *http, /* I - HTTP connection */ snprintf(line, sizeof(line), "%s/cupsd.conf", server_root); - cgiStartHTML("Administration"); + cgiStartHTML(cgiText(_("Administration"))); printf("\n", line); @@ -2637,7 +2701,7 @@ do_menu(http_t *http, /* I - HTTP connection */ * Unable to open - log an error... */ - cgiStartHTML("Administration"); + cgiSetVariable("MESSAGE", cgiText(_("Unable to open cupsd.conf file:"))); cgiSetVariable("ERROR", strerror(errno)); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -2779,15 +2843,7 @@ do_menu(http_t *http, /* I - HTTP connection */ * Get the list of printers and their devices... */ - request = ippNew(); - request->request.op.operation_id = CUPS_GET_PRINTERS; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_GET_PRINTERS); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", NULL, "device-uri"); @@ -2804,45 +2860,22 @@ do_menu(http_t *http, /* I - HTTP connection */ */ int i; /* Looping var */ - int num_printer_devices; /* Number of devices for local printers */ - char **printer_devices; /* Printer devices for local printers */ + cups_array_t *printer_devices; /* Printer devices for local printers */ + char *printer_device; /* Current printer device */ /* - * Count the number of printers we have... + * Allocate an array and copy the device strings... */ - for (num_printer_devices = 0, - attr = ippFindAttribute(response, "device-uri", IPP_TAG_URI); - attr; - num_printer_devices ++, - attr = ippFindNextAttribute(response, "device-uri", IPP_TAG_URI)); + printer_devices = cupsArrayNew((cups_array_func_t)strcmp, NULL); - if (num_printer_devices > 0) + for (attr = ippFindAttribute(response, "device-uri", IPP_TAG_URI); + attr; + attr = ippFindNextAttribute(response, "device-uri", IPP_TAG_URI)) { - /* - * Allocate an array and copy the device strings... - */ - - printer_devices = calloc(num_printer_devices, sizeof(char *)); - - for (i = 0, attr = ippFindAttribute(response, "device-uri", IPP_TAG_URI); - attr; - i ++, attr = ippFindNextAttribute(response, "device-uri", IPP_TAG_URI)) - { - printer_devices[i] = strdup(attr->values[0].string.text); - } - - /* - * Sort the printer devices as needed... - */ - - if (num_printer_devices > 1) - qsort(printer_devices, num_printer_devices, sizeof(char *), - compare_printer_devices); + cupsArrayAdd(printer_devices, strdup(attr->values[0].string.text)); } - else - printer_devices = NULL; /* * Free the printer list and get the device list... @@ -2850,15 +2883,7 @@ do_menu(http_t *http, /* I - HTTP connection */ ippDelete(response); - request = ippNew(); - request->request.op.operation_id = CUPS_GET_DEVICES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_GET_DEVICES); if ((response = cupsDoRequest(http, request, "/")) != NULL) { @@ -2893,15 +2918,15 @@ do_menu(http_t *http, /* I - HTTP connection */ while (attr && attr->group_tag == IPP_TAG_PRINTER) { - if (strcmp(attr->name, "device-info") == 0 && + if (!strcmp(attr->name, "device-info") && attr->value_tag == IPP_TAG_TEXT) device_info = attr->values[0].string.text; - if (strcmp(attr->name, "device-make-and-model") == 0 && + if (!strcmp(attr->name, "device-make-and-model") && attr->value_tag == IPP_TAG_TEXT) device_make_and_model = attr->values[0].string.text; - if (strcmp(attr->name, "device-uri") == 0 && + if (!strcmp(attr->name, "device-uri") && attr->value_tag == IPP_TAG_URI) device_uri = attr->values[0].string.text; @@ -2921,8 +2946,7 @@ do_menu(http_t *http, /* I - HTTP connection */ * device... */ - if (!bsearch(&device_uri, printer_devices, num_printer_devices, - sizeof(char *), compare_printer_devices)) + if (!cupsArrayFind(printer_devices, (void *)device_uri)) { /* * Not found, so it must be a new printer... @@ -2984,7 +3008,7 @@ do_menu(http_t *http, /* I - HTTP connection */ options_ptr += strlen(options_ptr); cgiFormEncode(options_ptr, device_uri, - sizeof(options) - (options_ptr - options)); + sizeof(options) - (options_ptr - options)); options_ptr += strlen(options_ptr); if (options_ptr < (options + sizeof(options) - 1)) @@ -3010,17 +3034,51 @@ do_menu(http_t *http, /* I - HTTP connection */ break; } + ippDelete(response); + /* * Free the device list... */ - ippDelete(response); + for (printer_device = (char *)cupsArrayFirst(printer_devices); + printer_device; + printer_device = (char *)cupsArrayNext(printer_devices)) + free(printer_device); - if (num_printer_devices) - free(printer_devices); + cupsArrayDelete(printer_devices); } } + /* + * See if Samba and the Windows drivers are installed... + */ + + if ((datadir = getenv("CUPS_DATADIR")) == NULL) + datadir = CUPS_DATADIR; + + snprintf(line, sizeof(line), "%s/drivers/pscript5.dll", datadir); + if (!access(line, 0)) + { + /* + * Found Windows 2000 driver file, see if we have smbclient and + * rpcclient... + */ + + if (cupsFileFind("smbclient", getenv("PATH"), line, sizeof(line)) && + cupsFileFind("rpcclient", getenv("PATH"), line, sizeof(line))) + cgiSetVariable("HAVE_SAMBA", "Y"); + else + { + if (!cupsFileFind("smbclient", getenv("PATH"), line, sizeof(line))) + fputs("ERROR: smbclient not found!\n", stderr); + + if (!cupsFileFind("rpcclient", getenv("PATH"), line, sizeof(line))) + fputs("ERROR: rpcclient not found!\n", stderr); + } + } + else + perror(line); + /* * Finally, show the main menu template... */ @@ -3037,23 +3095,21 @@ do_menu(http_t *http, /* I - HTTP connection */ static void do_printer_op(http_t *http, /* I - HTTP connection */ - cups_lang_t *language, /* I - Client's language */ ipp_op_t op, /* I - Operation to perform */ const char *title) /* I - Title of page */ { - ipp_t *request, /* IPP request */ - *response; /* IPP response */ + ipp_t *request; /* IPP request */ char uri[HTTP_MAX_URI]; /* Printer URI */ - const char *printer; /* Printer name (purge-jobs) */ - ipp_status_t status; /* Operation status... */ + const char *printer, /* Printer name (purge-jobs) */ + *is_class; /* Is a class? */ - if ((printer = cgiGetVariable("PRINTER_NAME")) != NULL) - httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, - "/printers/%s", printer); - else + is_class = cgiGetVariable("IS_CLASS"); + printer = cgiGetVariable("PRINTER_NAME"); + + if (!printer) { - cgiSetVariable("ERROR", ippErrorString(IPP_NOT_FOUND)); + cgiSetVariable("ERROR", cgiText(_("Missing form variable!"))); cgiStartHTML(title); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); @@ -3069,17 +3125,10 @@ do_printer_op(http_t *http, /* I - HTTP connection */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = op; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(op); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, + is_class ? "/classes/%s" : "/printers/%s", printer); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -3087,20 +3136,12 @@ do_printer_op(http_t *http, /* I - HTTP connection */ * Do the request and get back a response... */ - if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) - { - status = response->request.status.status_code; + ippDelete(cupsDoRequest(http, request, "/admin/")); - ippDelete(response); - } - else - status = cupsLastError(); - - if (status > IPP_OK_CONFLICT) + if (cupsLastError() > IPP_OK_CONFLICT) { cgiStartHTML(title); - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); + cgiShowIPPError(_("Unable to change printer:")); } else { @@ -3108,11 +3149,13 @@ do_printer_op(http_t *http, /* I - HTTP connection */ * Redirect successful updates back to the printer page... */ - char refresh[1024]; /* Refresh URL */ + char url[1024], /* Printer/class URL */ + refresh[1024]; /* Refresh URL */ - cgiFormEncode(uri, printer, sizeof(uri)); - snprintf(refresh, sizeof(refresh), "5;/admin?OP=redirect&URL=/printers/%s", - uri); + + cgiRewriteURL(uri, url, sizeof(url), NULL); + cgiFormEncode(uri, url, sizeof(uri)); + snprintf(refresh, sizeof(refresh), "5;/admin/?OP=redirect&URL=%s", uri); cgiSetVariable("refresh_page", refresh); cgiStartHTML(title); @@ -3140,15 +3183,14 @@ do_printer_op(http_t *http, /* I - HTTP connection */ */ static void -do_set_allowed_users( - http_t *http, /* I - HTTP connection */ - cups_lang_t *language) /* I - Language */ +do_set_allowed_users(http_t *http) /* I - HTTP connection */ { int i; /* Looping var */ ipp_t *request, /* IPP request */ *response; /* IPP response */ char uri[HTTP_MAX_URI]; /* Printer URI */ const char *printer, /* Printer name (purge-jobs) */ + *is_class, /* Is a class? */ *users, /* List of users or groups */ *type; /* Allow/deny type */ int num_users; /* Number of users */ @@ -3156,7 +3198,6 @@ do_set_allowed_users( *end, /* Pointer to end of users string */ quote; /* Quote character */ ipp_attribute_t *attr; /* Attribute */ - ipp_status_t status; /* Operation status... */ static const char * const attrs[] = /* Requested attributes */ { "requesting-user-name-allowed", @@ -3164,13 +3205,13 @@ do_set_allowed_users( }; - if ((printer = cgiGetVariable("PRINTER_NAME")) != NULL) - httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, - "/printers/%s", printer); - else + is_class = cgiGetVariable("IS_CLASS"); + printer = cgiGetVariable("PRINTER_NAME"); + + if (!printer) { - cgiSetVariable("ERROR", ippErrorString(IPP_NOT_FOUND)); - cgiStartHTML("Set Allowed Users"); + cgiSetVariable("ERROR", cgiText(_("Missing form variable!"))); + cgiStartHTML(cgiText(_("Set Allowed Users"))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); return; @@ -3193,17 +3234,10 @@ do_set_allowed_users( * requested-attributes */ - request = ippNew(); - - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, + is_class ? "/classes/%s" : "/printers/%s", printer); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -3215,24 +3249,17 @@ do_set_allowed_users( * Do the request and get back a response... */ - if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) + if ((response = cupsDoRequest(http, request, "/")) != NULL) { - status = response->request.status.status_code; - cgiSetIPPVars(response, NULL, NULL, NULL, 0); ippDelete(response); } - else - status = cupsLastError(); - cgiStartHTML("Set Allowed Users"); + cgiStartHTML(cgiText(_("Set Allowed Users"))); - if (status > IPP_OK_CONFLICT) - { - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); - } + if (cupsLastError() > IPP_OK_CONFLICT) + cgiShowIPPError(_("Unable to get printer attributes:")); else cgiCopyTemplateLang("users.tmpl"); @@ -3284,7 +3311,7 @@ do_set_allowed_users( } /* - * Build a CUPS-Add-Printer request, which requires the following + * Build a CUPS-Add-Printer/Class request, which requires the following * attributes: * * attributes-charset @@ -3293,17 +3320,10 @@ do_set_allowed_users( * requesting-user-name-{allowed,denied} */ - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_PRINTER; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(is_class ? CUPS_ADD_CLASS : CUPS_ADD_PRINTER); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, + is_class ? "/classes/%s" : "/printers/%s", printer); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -3372,22 +3392,12 @@ do_set_allowed_users( * Do the request and get back a response... */ - if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) - { - status = response->request.status.status_code; - - cgiSetIPPVars(response, NULL, NULL, NULL, 0); - - ippDelete(response); - } - else - status = cupsLastError(); + ippDelete(cupsDoRequest(http, request, "/admin/")); - if (status > IPP_OK_CONFLICT) + if (cupsLastError() > IPP_OK_CONFLICT) { - cgiStartHTML("Set Allowed Users"); - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); + cgiStartHTML(cgiText(_("Set Allowed Users"))); + cgiShowIPPError(_("Unable to change printer:")); } else { @@ -3395,16 +3405,19 @@ do_set_allowed_users( * Redirect successful updates back to the printer page... */ - char refresh[1024]; /* Refresh URL */ + char url[1024], /* Printer/class URL */ + refresh[1024]; /* Refresh URL */ - cgiFormEncode(uri, printer, sizeof(uri)); - snprintf(refresh, sizeof(refresh), "5;/admin?OP=redirect&URL=/printers/%s", - uri); + + cgiRewriteURL(uri, url, sizeof(url), NULL); + cgiFormEncode(uri, url, sizeof(uri)); + snprintf(refresh, sizeof(refresh), "5;/admin/?OP=redirect&URL=%s", uri); cgiSetVariable("refresh_page", refresh); - cgiStartHTML("Set Allowed Users"); + cgiStartHTML(cgiText(_("Set Allowed Users"))); - cgiCopyTemplateLang("printer-modified.tmpl"); + cgiCopyTemplateLang(is_class ? "class-modified.tmpl" : + "printer-modified.tmpl"); } cgiEndHTML(); @@ -3417,41 +3430,32 @@ do_set_allowed_users( */ static void -do_set_sharing(http_t *http, /* I - HTTP connection */ - cups_lang_t *language) /* I - Language */ +do_set_sharing(http_t *http) /* I - HTTP connection */ { ipp_t *request, /* IPP request */ *response; /* IPP response */ char uri[HTTP_MAX_URI]; /* Printer URI */ const char *printer, /* Printer name */ + *is_class, /* Is a class? */ *shared; /* Sharing value */ - ipp_status_t status; /* Operation status... */ - if ((printer = cgiGetVariable("PRINTER_NAME")) != NULL) - httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, - "/printers/%s", printer); - else - { - cgiSetVariable("ERROR", ippErrorString(IPP_NOT_FOUND)); - cgiStartHTML("Set Publishing"); - cgiCopyTemplateLang("error.tmpl"); - cgiEndHTML(); - return; - } + is_class = cgiGetVariable("IS_CLASS"); + printer = cgiGetVariable("PRINTER_NAME"); + shared = cgiGetVariable("SHARED"); - if ((shared = cgiGetVariable("SHARED")) == NULL) + if (!printer || !shared) { - cgiSetVariable("ERROR", "Missing SHARED parameter"); - cgiStartHTML("Set Publishing"); + cgiSetVariable("ERROR", cgiText(_("Missing form variable!"))); + cgiStartHTML(cgiText(_("Set Publishing"))); cgiCopyTemplateLang("error.tmpl"); cgiEndHTML(); return; } /* - * Build a CUPS-Add-Printer request, which requires the following - * attributes: + * Build a CUPS-Add-Printer/CUPS-Add-Class request, which requires the + * following attributes: * * attributes-charset * attributes-natural-language @@ -3459,17 +3463,10 @@ do_set_sharing(http_t *http, /* I - HTTP connection */ * printer-is-shared */ - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_PRINTER; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(is_class ? CUPS_ADD_CLASS : CUPS_ADD_PRINTER); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, + is_class ? "/classes/%s" : "/printers/%s", printer); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -3481,20 +3478,15 @@ do_set_sharing(http_t *http, /* I - HTTP connection */ if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) { - status = response->request.status.status_code; - cgiSetIPPVars(response, NULL, NULL, NULL, 0); ippDelete(response); } - else - status = cupsLastError(); - if (status > IPP_OK_CONFLICT) + if (cupsLastError() > IPP_OK_CONFLICT) { - cgiStartHTML("Set Publishing"); - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); + cgiStartHTML(cgiText(_("Set Publishing"))); + cgiShowIPPError(_("Unable to change printer-is-shared attribute:")); } else { @@ -3502,16 +3494,18 @@ do_set_sharing(http_t *http, /* I - HTTP connection */ * Redirect successful updates back to the printer page... */ - char refresh[1024]; /* Refresh URL */ + char url[1024], /* Printer/class URL */ + refresh[1024]; /* Refresh URL */ - cgiFormEncode(uri, printer, sizeof(uri)); - snprintf(refresh, sizeof(refresh), "5;/admin?OP=redirect&URL=/printers/%s", - uri); - cgiSetVariable("refresh_page", refresh); - cgiStartHTML("Set Publishing"); + cgiRewriteURL(uri, url, sizeof(url), NULL); + cgiFormEncode(uri, url, sizeof(uri)); + snprintf(refresh, sizeof(refresh), "5;/admin/?OP=redirect&URL=%s", uri); + cgiSetVariable("refresh_page", refresh); - cgiCopyTemplateLang("printer-modified.tmpl"); + cgiStartHTML(cgiText(_("Set Publishing"))); + cgiCopyTemplateLang(is_class ? "class-modified.tmpl" : + "printer-modified.tmpl"); } cgiEndHTML(); @@ -3568,5 +3562,5 @@ match_string(const char *a, /* I - First string */ /* - * End of "$Id: admin.c 4921 2006-01-12 21:26:26Z mike $". + * End of "$Id: admin.c 4943 2006-01-18 20:30:42Z mike $". */ diff --git a/cgi-bin/cgi.h b/cgi-bin/cgi.h index ac63c45462..0ffe2950dc 100644 --- a/cgi-bin/cgi.h +++ b/cgi-bin/cgi.h @@ -1,5 +1,5 @@ /* - * "$Id: cgi.h 4921 2006-01-12 21:26:26Z mike $" + * "$Id: cgi.h 4931 2006-01-14 20:37:40Z mike $" * * CGI support library definitions. * @@ -80,6 +80,8 @@ extern char *cgiGetTemplateDir(void); extern const char *cgiGetVariable(const char *name); extern int cgiInitialize(void); extern int cgiIsPOST(void); +extern void cgiMoveJobs(http_t *http, const char *dest, int job_id); +extern void cgiPrintTestPage(http_t *http, const char *dest); extern char *cgiRewriteURL(const char *uri, char *url, int urlsize, const char *newresource); extern void cgiSetArray(const char *name, int element, @@ -95,12 +97,13 @@ extern int cgiSetIPPVars(ipp_t *response, const char *filter_name, extern void cgiSetServerVersion(void); extern void cgiSetSize(const char *name, int size); extern void cgiSetVariable(const char *name, const char *value); +extern void cgiShowIPPError(const char *message); extern void cgiShowJobs(http_t *http, const char *dest); extern void cgiStartHTML(const char *title); - +extern const char *cgiText(const char *message); #endif /* !_CUPS_CGI_H_ */ /* - * End of "$Id: cgi.h 4921 2006-01-12 21:26:26Z mike $". + * End of "$Id: cgi.h 4931 2006-01-14 20:37:40Z mike $". */ diff --git a/cgi-bin/classes.c b/cgi-bin/classes.c index 52c12efab1..355928af67 100644 --- a/cgi-bin/classes.c +++ b/cgi-bin/classes.c @@ -1,5 +1,5 @@ /* - * "$Id: classes.c 4921 2006-01-12 21:26:26Z mike $" + * "$Id: classes.c 4931 2006-01-14 20:37:40Z mike $" * * Class status CGI for the Common UNIX Printing System (CUPS). * @@ -23,7 +23,9 @@ * * Contents: * - * main() - Main entry for CGI. + * main() - Main entry for CGI. + * show_all_classes() - Show all classes... + * show_class() - Show a single class. */ /* @@ -33,6 +35,14 @@ #include "cgi-private.h" +/* + * Local functions... + */ + +void show_all_classes(http_t *http, const char *username); +void show_class(http_t *http, const char *printer); + + /* * 'main()' - Main entry for CGI. */ @@ -41,17 +51,14 @@ int /* O - Exit status */ main(int argc, /* I - Number of command-line arguments */ char *argv[]) /* I - Command-line arguments */ { - cups_lang_t *language; /* Language information */ - char *pclass; /* Printer class name */ + const char *pclass; /* Class name */ + const char *user; /* Username */ http_t *http; /* Connection to the server */ ipp_t *request, /* IPP request */ *response; /* IPP response */ ipp_attribute_t *attr; /* IPP attribute */ - ipp_status_t status; /* Operation status... */ - char uri[HTTP_MAX_URI]; /* Printer URI */ - const char *which_jobs; /* Which jobs to show */ const char *op; /* Operation to perform, if any */ - static const char *def_attrs[] = /* Attributes for default printer */ + static const char *def_attrs[] = /* Attributes for default printer */ { "printer-name", "printer-uri-supported" @@ -63,6 +70,7 @@ main(int argc, /* I - Number of command-line arguments */ */ cgiInitialize(); + op = cgiGetVariable("OP"); /* @@ -72,60 +80,38 @@ main(int argc, /* I - Number of command-line arguments */ cgiSetVariable("SECTION", "classes"); /* - * Get the request language... + * See if we are displaying a printer or all classes... */ - language = cupsLangDefault(); + if (!strcmp(argv[0], "/") || strstr(argv[0], "classes.cgi")) + pclass = NULL; + else + pclass = argv[0]; /* - * Connect to the HTTP server... + * See who is logged in... */ - http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption()); + if ((user = getenv("REMOTE_USER")) == NULL) + user = "guest"; /* - * Tell the client to expect UTF-8 encoded HTML... + * Connect to the HTTP server... */ - puts("Content-Type: text/html;charset=utf-8\n"); + http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption()); /* - * See if we need to show a list of printers or the status of a - * single printer... + * Get the default printer... */ - cgiSetServerVersion(); - - pclass = argv[0]; - if (strcmp(pclass, "/") == 0 || strcmp(pclass, "classes.cgi") == 0) - { - pclass = NULL; - cgiSetVariable("TITLE", _cupsLangString(language, _("Class"))); - } - else - cgiSetVariable("TITLE", pclass); - - if (op == NULL || strcasecmp(op, "print-test-page") != 0) + if (!op) { - /* - * Show the standard header... - */ - - cgiCopyTemplateLang("header.tmpl"); - /* * Get the default destination... */ - request = ippNew(); - request->request.op.operation_id = CUPS_GET_DEFAULT; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_GET_DEFAULT); ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", @@ -150,247 +136,328 @@ main(int argc, /* I - Number of command-line arguments */ } /* - * Get the class info... + * See if we need to show a list of classes or the status of a + * single printer... */ - request = ippNew(); + if (!pclass) + show_all_classes(http, user); + else + show_class(http, pclass); + } + else if (!strcasecmp(op, "print-test-page") && pclass) + cgiPrintTestPage(http, pclass); + else if (!strcasecmp(op, "move-jobs") && pclass) + cgiMoveJobs(http, pclass, 0); + else + { + /* + * Unknown/bad operation... + */ - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); + if (pclass) + cgiStartHTML(pclass); + else + cgiStartHTML(cgiText(_("Classes"))); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + cgiCopyTemplateLang("error-op.tmpl"); + cgiEndHTML(); + } - if (pclass == NULL) - { - /* - * Build a CUPS_GET_CLASSES request, which requires the following - * attributes: - * - * attributes-charset - * attributes-natural-language - */ + /* + * Close the HTTP server connection... + */ - request->request.op.operation_id = CUPS_GET_CLASSES; - request->request.op.request_id = 1; + httpClose(http); - if (getenv("REMOTE_USER") != NULL) - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, getenv("REMOTE_USER")); - } - else - { - /* - * Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following - * attributes: - * - * attributes-charset - * attributes-natural-language - * printer-uri - */ + /* + * Return with no errors... + */ - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; + return (0); +} - httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, - "/classes/%s", pclass); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, - uri); - } - cgiGetAttributes(request, "classes.tmpl"); +/* + * 'show_all_classes()' - Show all classes... + */ - /* - * Do the request and get back a response... - */ +void +show_all_classes(http_t *http, /* I - Connection to server */ + const char *user) /* I - Username */ +{ + int i; /* Looping var */ + ipp_t *request, /* IPP request */ + *response; /* IPP response */ + cups_array_t *classes; /* Array of class objects */ + ipp_attribute_t *pclass; /* Class object */ + int ascending, /* Order of classes (0 = descending) */ + first, /* First class to show */ + count; /* Number of classes */ + const char *var; /* Form variable */ + void *search; /* Search data */ + char url[1024], /* URL for prev/next/this */ + *urlptr, /* Position in URL */ + *urlend; /* End of URL */ - if ((response = cupsDoRequest(http, request, "/")) != NULL) - { - cgiSetIPPVars(response, NULL, NULL, NULL, 0); - ippDelete(response); - } + /* + * Show the standard header... + */ + + cgiStartHTML(cgiText(_("Classes"))); + + /* + * Build a CUPS_GET_CLASSES request, which requires the following + * attributes: + * + * attributes-charset + * attributes-natural-language + * requesting-user-name + */ + + request = ippNewRequest(CUPS_GET_CLASSES); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, user); + + cgiGetAttributes(request, "classes.tmpl"); + + /* + * Do the request and get back a response... + */ + + if ((response = cupsDoRequest(http, request, "/")) != NULL) + { /* - * Write the report... + * Get a list of matching job objects. */ - cgiCopyTemplateLang("classes.tmpl"); + if ((var = cgiGetVariable("QUERY")) != NULL) + search = cgiCompileSearch(var); + else + search = NULL; + + classes = cgiGetIPPObjects(response, search); + count = cupsArrayCount(classes); + + if (search) + cgiFreeSearch(search); /* - * Get jobs for the specified class if a class has been chosen... + * Figure out which classes to display... */ - if (pclass != NULL) - { - /* - * Build an IPP_GET_JOBS request, which requires the following - * attributes: - * - * attributes-charset - * attributes-natural-language - * printer-uri - */ + if ((var = cgiGetVariable("FIRST")) != NULL) + first = atoi(var); + else + first = 0; - request = ippNew(); + if (first >= count) + first = count - CUPS_PAGE_MAX; - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); + first = (first / CUPS_PAGE_MAX) * CUPS_PAGE_MAX; - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + if (first < 0) + first = 0; - request->request.op.operation_id = IPP_GET_JOBS; - request->request.op.request_id = 1; + sprintf(url, "%d", count); + cgiSetVariable("TOTAL", url); - httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, - "/classes/%s", pclass); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, - uri); + if ((var = cgiGetVariable("ORDER")) != NULL) + ascending = !strcasecmp(var, "asc"); + else + ascending = 1; - if ((which_jobs = cgiGetVariable("which_jobs")) != NULL) - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs", - NULL, which_jobs); + if (ascending) + { + for (i = 0, pclass = (ipp_attribute_t *)cupsArrayIndex(classes, first); + i < CUPS_PAGE_MAX && pclass; + i ++, pclass = (ipp_attribute_t *)cupsArrayNext(classes)) + cgiSetIPPObjectVars(pclass, NULL, i); + } + else + { + for (i = 0, pclass = (ipp_attribute_t *)cupsArrayIndex(classes, count - first - 1); + i < CUPS_PAGE_MAX && pclass; + i ++, pclass = (ipp_attribute_t *)cupsArrayPrev(classes)) + cgiSetIPPObjectVars(pclass, NULL, i); + } - if (getenv("REMOTE_USER") != NULL) - { - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, getenv("REMOTE_USER")); + /* + * Save navigation URLs... + */ - if (strcmp(getenv("REMOTE_USER"), "root")) - ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1); - } - else - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, "unknown"); + urlend = url + sizeof(url); - cgiGetAttributes(request, "jobs.tmpl"); + if ((var = cgiGetVariable("QUERY")) != NULL) + { + strlcpy(url, "/classes/?QUERY=", sizeof(url)); + urlptr = url + strlen(url); - /* - * Do the request and get back a response... - */ + cgiFormEncode(urlptr, var, urlend - urlptr); + urlptr += strlen(urlptr); - if ((response = cupsDoRequest(http, request, "/")) != NULL) - { - cgiSetIPPVars(response, NULL, NULL, NULL, 0); - ippDelete(response); + strlcpy(urlptr, "&", urlend - urlptr); + urlptr += strlen(urlptr); + } + else + { + strlcpy(url, "/classes/?", sizeof(url)); + urlptr = url + strlen(url); + } - cgiCopyTemplateLang("jobs.tmpl"); - } + snprintf(urlptr, urlend - urlptr, "FIRST=%d", first); + cgiSetVariable("THISURL", url); + + if (first > 0) + { + snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s", + first - CUPS_PAGE_MAX, ascending ? "asc" : "dec"); + cgiSetVariable("PREVURL", url); } - } - else - { + + if ((first + CUPS_PAGE_MAX) < count) + { + snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s", + first + CUPS_PAGE_MAX, ascending ? "asc" : "dec"); + cgiSetVariable("NEXTURL", url); + } + /* - * Print a test page... + * Then show everything... */ - char filename[1024]; /* Test page filename */ - const char *datadir; /* CUPS_DATADIR env var */ - char refresh[1024]; /* Refresh URL */ + cgiCopyTemplateLang("search.tmpl"); + cgiCopyTemplateLang("classes-header.tmpl"); - cgiFormEncode(uri, pclass, sizeof(uri)); - snprintf(refresh, sizeof(refresh), "2;/classes/%s", uri); - cgiSetVariable("refresh_page", refresh); + if (count > 0) + cgiCopyTemplateLang("pager.tmpl"); - if ((datadir = getenv("CUPS_DATADIR")) == NULL) - datadir = CUPS_DATADIR; + cgiCopyTemplateLang("classes.tmpl"); - snprintf(filename, sizeof(filename), "%s/data/testprint.ps", datadir); - httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, - "/classes/%s", pclass); + if (count > 0) + cgiCopyTemplateLang("pager.tmpl"); /* - * Build an IPP_PRINT_JOB request, which requires the following - * attributes: - * - * attributes-charset - * attributes-natural-language - * printer-uri - * requesting-user-name - * document-format + * Delete the response... */ - request = ippNew(); + ippDelete(response); + } + else + { + /* + * Show the error... + */ - request->request.op.operation_id = IPP_PRINT_JOB; - request->request.op.request_id = 1; + cgiShowIPPError(_("Unable to get class list:")); + } - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); + cgiEndHTML(); +} - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", - NULL, uri); +/* + * 'show_class()' - Show a single class. + */ - if (getenv("REMOTE_USER") != NULL) - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, getenv("REMOTE_USER")); - else - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, "root"); +void +show_class(http_t *http, /* I - Connection to server */ + const char *pclass) /* I - Name of class */ +{ + ipp_t *request, /* IPP request */ + *response; /* IPP response */ + ipp_attribute_t *attr; /* IPP attribute */ + char uri[HTTP_MAX_URI]; /* Printer URI */ + char refresh[1024]; /* Refresh URL */ + + + /* + * Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following + * attributes: + * + * attributes-charset + * attributes-natural-language + * printer-uri + */ - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", - NULL, "Test Page"); + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); - ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format", - NULL, "application/postscript"); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, + "/classes/%s", pclass); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, + uri); + cgiGetAttributes(request, "classes.tmpl"); + + /* + * Do the request and get back a response... + */ + + if ((response = cupsDoRequest(http, request, "/")) != NULL) + { /* - * Do the request and get back a response... + * Got the result; set the CGI variables and check the status of a + * single-queue request... */ - if ((response = cupsDoFileRequest(http, request, uri + 15, - filename)) != NULL) + cgiSetIPPVars(response, NULL, NULL, NULL, 0); + + if (pclass && (attr = ippFindAttribute(response, "printer-state", + IPP_TAG_ENUM)) != NULL && + attr->values[0].integer == IPP_PRINTER_PROCESSING) { - status = response->request.status.status_code; - cgiSetIPPVars(response, NULL, NULL, NULL, 0); + /* + * Class is processing - automatically refresh the page until we + * are done printing... + */ - ippDelete(response); + cgiFormEncode(uri, pclass, sizeof(uri)); + snprintf(refresh, sizeof(refresh), "10;/classes/%s", uri); + cgiSetVariable("refresh_page", refresh); } - else - status = cupsLastError(); - cgiSetVariable("PRINTER_NAME", pclass); + /* + * Delete the response... + */ + + ippDelete(response); /* * Show the standard header... */ - cgiCopyTemplateLang("header.tmpl"); + cgiStartHTML(pclass); /* - * Show the result... + * Show the class status... */ - if (status > IPP_OK_CONFLICT) - { - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); - } - else - cgiCopyTemplateLang("test-page.tmpl"); - } - - cgiCopyTemplateLang("trailer.tmpl"); + cgiCopyTemplateLang("classes.tmpl"); - /* - * Close the HTTP server connection... - */ + /* + * Show jobs for the specified class... + */ - httpClose(http); - cupsLangFree(language); + cgiCopyTemplateLang("class-jobs-header.tmpl"); + cgiShowJobs(http, pclass); + } + else + { + /* + * Show the IPP error... + */ - /* - * Return with no errors... - */ + cgiStartHTML(pclass); + cgiShowIPPError(_("Unable to get class status:")); + } - return (0); + cgiEndHTML(); } /* - * End of "$Id: classes.c 4921 2006-01-12 21:26:26Z mike $". + * End of "$Id: classes.c 4931 2006-01-14 20:37:40Z mike $". */ diff --git a/cgi-bin/ipp-var.c b/cgi-bin/ipp-var.c index 292cfea246..bc20e75d2b 100644 --- a/cgi-bin/ipp-var.c +++ b/cgi-bin/ipp-var.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp-var.c 4921 2006-01-12 21:26:26Z mike $" + * "$Id: ipp-var.c 4931 2006-01-14 20:37:40Z mike $" * * CGI <-> IPP variable routines for the Common UNIX Printing System (CUPS). * @@ -25,10 +25,15 @@ * * cgiGetAttributes() - Get the list of attributes that are needed * by the template file. - * cupsGetIPPObjects() - Get the objects in an IPP response. + * cgiGetIPPObjects() - Get the objects in an IPP response. + * cgiMoveJobs() - Move one or more jobs. + * cgiPrintTestPage() - Print a test page. * cgiRewriteURL() - Rewrite a printer URI into a web browser URL... * cgiSetIPPObjectVars() - Set CGI variables from an IPP object. * cgiSetIPPVars() - Set CGI variables from an IPP response. + * cgiShowIPPError() - Show the last IPP error message. + * cgiShowJobs() - Show print jobs. + * cgiText() - Return localized text. */ /* @@ -165,7 +170,7 @@ cgiGetAttributes(ipp_t *request, /* I - IPP request */ /* - * 'cupsGetIPPObjects()' - Get the objects in an IPP response. + * 'cgiGetIPPObjects()' - Get the objects in an IPP response. */ cups_array_t * /* O - Array of objects */ @@ -263,6 +268,353 @@ cgiGetIPPObjects(ipp_t *response, /* I - IPP response */ } +/* + * 'cgiMoveJobs()' - Move one or more jobs. + * + * At least one of dest or job_id must be non-zero/NULL. + */ + +void +cgiMoveJobs(http_t *http, /* I - Connection to server */ + const char *dest, /* I - Destination or NULL */ + int job_id) /* I - Job ID or 0 for all */ +{ + int i; /* Looping var */ + const char *user; /* Username */ + ipp_t *request, /* IPP request */ + *response; /* IPP response */ + ipp_attribute_t *attr; /* Current attribute */ + const char *name; /* Destination name */ + const char *job_printer_uri; /* JOB_PRINTER_URI form variable */ + char current_dest[1024]; /* Current destination */ + + + /* + * See who is logged in... + */ + + if ((user = getenv("REMOTE_USER")) == NULL) + user = "guest"; + + /* + * See if the user has already selected a new destination... + */ + + if ((job_printer_uri = cgiGetVariable("JOB_PRINTER_URI")) == NULL) + { + /* + * Make sure necessary form variables are set... + */ + + if (job_id) + { + char temp[255]; /* Temporary string */ + + + sprintf(temp, "%d", job_id); + cgiSetVariable("JOB_ID", temp); + } + + if (dest) + cgiSetVariable("PRINTER_NAME", dest); + + /* + * No new destination specified, show the user what the available + * printers/classes are... + */ + + if (!dest) + { + /* + * Get the current destination for job N... + */ + + char job_uri[1024]; /* Job URI */ + + + request = ippNewRequest(IPP_GET_JOB_ATTRIBUTES); + + snprintf(job_uri, sizeof(job_uri), "ipp://localhost/jobs/%d", job_id); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", + NULL, job_uri); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, + "requested-attributes", NULL, "job-printer-uri"); + + if ((response = cupsDoRequest(http, request, "/")) != NULL) + { + if ((attr = ippFindAttribute(response, "job-printer-uri", + IPP_TAG_URI)) != NULL) + { + /* + * Pull the name from the URI... + */ + + strlcpy(current_dest, strrchr(attr->values[0].string.text, '/') + 1, + sizeof(current_dest)); + dest = current_dest; + } + + ippDelete(response); + } + + if (!dest) + { + /* + * Couldn't get the current destination... + */ + + cgiStartHTML(cgiText(_("Move Job"))); + cgiShowIPPError(_("Unable to find destination for job!")); + cgiEndHTML(); + return; + } + } + + /* + * Get the list of available destinations... + */ + + request = ippNewRequest(CUPS_GET_PRINTERS); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, + "requested-attributes", NULL, "printer-uri-supported"); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, user); + + if ((response = cupsDoRequest(http, request, "/")) != NULL) + { + for (i = 0, attr = ippFindAttribute(response, "printer-uri-supported", + IPP_TAG_URI); + attr; + attr = ippFindNextAttribute(response, "printer-uri-supported", + IPP_TAG_URI)) + { + /* + * Pull the name from the URI... + */ + + name = strrchr(attr->values[0].string.text, '/') + 1; + + /* + * If the name is not the same as the current destination, add it! + */ + + if (strcasecmp(name, dest)) + { + cgiSetArray("JOB_PRINTER_URI", i, attr->values[0].string.text); + cgiSetArray("JOB_PRINTER_NAME", i, name); + i ++; + } + } + + ippDelete(response); + } + + /* + * Show the form... + */ + + if (job_id) + cgiStartHTML(cgiText(_("Move Job"))); + else + cgiStartHTML(cgiText(_("Move All Jobs"))); + + cgiCopyTemplateLang("job-move.tmpl"); + } + else + { + /* + * Try moving the job or jobs... + */ + + char uri[1024], /* Job/printer URI */ + resource[1024], /* Post resource */ + refresh[1024]; /* Refresh URL */ + const char *job_printer_name; /* New printer name */ + + + request = ippNewRequest(CUPS_MOVE_JOB); + + if (job_id) + { + /* + * Move 1 job... + */ + + snprintf(resource, sizeof(resource), "/jobs/%d", job_id); + + snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", + NULL, uri); + } + else + { + /* + * Move all active jobs on a destination... + */ + + snprintf(resource, sizeof(resource), "/%s/%s", + cgiGetVariable("SECTION"), dest); + + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", ippPort(), + "/%s/%s", cgiGetVariable("SECTION"), dest); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", + NULL, uri); + } + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-printer-uri", + NULL, job_printer_uri); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, user); + + ippDelete(cupsDoRequest(http, request, resource)); + + /* + * Show the results... + */ + + job_printer_name = strrchr(job_printer_uri, '/') + 1; + + if (cupsLastError() <= IPP_OK_CONFLICT) + { + cgiRewriteURL(job_printer_uri, resource, sizeof(resource), NULL); + cgiFormEncode(uri, resource, sizeof(uri)); + snprintf(refresh, sizeof(refresh), "2;%s", uri); + cgiSetVariable("refresh_page", refresh); + } + + if (job_id) + cgiStartHTML(cgiText(_("Move Job"))); + else + cgiStartHTML(cgiText(_("Move All Jobs"))); + + if (cupsLastError() > IPP_OK_CONFLICT) + { + if (job_id) + cgiShowIPPError(_("Unable to move job")); + else + cgiShowIPPError(_("Unable to move jobs")); + } + else + { + cgiSetVariable("JOB_PRINTER_NAME", job_printer_name); + cgiCopyTemplateLang("job-moved.tmpl"); + } + } + + cgiEndHTML(); +} + + +/* + * 'cgiPrintTestPage()' - Print a test page. + */ + +void +cgiPrintTestPage(http_t *http, /* I - Connection to server */ + const char *dest) /* I - Destination printer/class */ +{ + ipp_t *request, /* IPP request */ + *response; /* IPP response */ + char uri[HTTP_MAX_URI], /* Printer URI */ + resource[1024], /* POST resource path */ + refresh[1024], /* Refresh URL */ + filename[1024]; /* Test page filename */ + const char *datadir; /* CUPS_DATADIR env var */ + const char *user; /* Username */ + + + /* + * See who is logged in... + */ + + if ((user = getenv("REMOTE_USER")) == NULL) + user = "guest"; + + /* + * Locate the test page file... + */ + + if ((datadir = getenv("CUPS_DATADIR")) == NULL) + datadir = CUPS_DATADIR; + + snprintf(filename, sizeof(filename), "%s/data/testprint.ps", datadir); + + /* + * Point to the printer/class... + */ + + snprintf(resource, sizeof(resource), "/%s/%s", cgiGetVariable("SECTION"), + dest); + + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", ippPort(), + "/%s/%s", cgiGetVariable("SECTION"), dest); + + /* + * Build an IPP_PRINT_JOB request, which requires the following + * attributes: + * + * attributes-charset + * attributes-natural-language + * printer-uri + * requesting-user-name + * document-format + */ + + request = ippNewRequest(IPP_PRINT_JOB); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", + NULL, uri); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, user); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", + NULL, "Test Page"); + + ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format", + NULL, "application/postscript"); + + /* + * Do the request and get back a response... + */ + + if ((response = cupsDoFileRequest(http, request, resource, + filename)) != NULL) + { + cgiSetIPPVars(response, NULL, NULL, NULL, 0); + + ippDelete(response); + } + + if (cupsLastError() <= IPP_OK_CONFLICT) + { + /* + * Automatically reload the printer status page... + */ + + cgiFormEncode(uri, resource, sizeof(uri)); + snprintf(refresh, sizeof(refresh), "2;%s", uri); + cgiSetVariable("refresh_page", refresh); + } + + cgiStartHTML(cgiText(_("Print Test Page"))); + + if (cupsLastError() > IPP_OK_CONFLICT) + cgiShowIPPError(_("Unable to print test page:")); + else + { + cgiSetVariable("PRINTER_NAME", dest); + + cgiCopyTemplateLang("test-page.tmpl"); + } + + cgiEndHTML(); +} + + /* * 'cgiRewriteURL()' - Rewrite a printer URI into a web browser URL... */ @@ -686,6 +1038,21 @@ cgiSetIPPVars(ipp_t *response, /* I - Response data to be copied... */ } +/* + * 'cgiShowIPPError()' - Show the last IPP error message. + * + * The caller must still call cgiStartHTML() and cgiEndHTML(). + */ + +void +cgiShowIPPError(const char *message) /* I - Contextual message */ +{ + cgiSetVariable("MESSAGE", cgiText(message)); + cgiSetVariable("ERROR", cupsLastErrorString()); + cgiCopyTemplateLang("error.tmpl"); +} + + /* * 'cgiShowJobs()' - Show print jobs. */ @@ -708,7 +1075,6 @@ cgiShowJobs(http_t *http, /* I - Connection to server */ char url[1024], /* URL for prev/next/this */ *urlptr, /* Position in URL */ *urlend; /* End of URL */ - cups_lang_t *language; /* Language information */ /* @@ -720,18 +1086,7 @@ cgiShowJobs(http_t *http, /* I - Connection to server */ * printer-uri */ - request = ippNew(); - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - - request->request.op.operation_id = IPP_GET_JOBS; - request->request.op.request_id = 1; + request = ippNewRequest(IPP_GET_JOBS); if (dest) { @@ -760,7 +1115,7 @@ cgiShowJobs(http_t *http, /* I - Connection to server */ * Get a list of matching job objects. */ - if (!dest && (var = cgiGetVariable("QUERY")) != NULL) + if ((var = cgiGetVariable("QUERY")) != NULL) search = cgiCompileSearch(var); else search = NULL; @@ -817,14 +1172,14 @@ cgiShowJobs(http_t *http, /* I - Connection to server */ urlend = url + sizeof(url); - if (dest) + if ((var = cgiGetVariable("QUERY")) != NULL) { - snprintf(url, sizeof(url), "/%s/%s?", cgiGetVariable("SECTION"), dest); - urlptr = url + strlen(url); - } - else if ((var = cgiGetVariable("QUERY")) != NULL) - { - strlcpy(url, "/jobs/?QUERY=", sizeof(url)); + if (dest) + snprintf(url, sizeof(url), "/%s/%s?QUERY=", cgiGetVariable("SECTION"), + dest); + else + strlcpy(url, "/jobs/?QUERY=", sizeof(url)); + urlptr = url + strlen(url); cgiFormEncode(urlptr, var, urlend - urlptr); @@ -835,7 +1190,11 @@ cgiShowJobs(http_t *http, /* I - Connection to server */ } else { - strlcpy(url, "/jobs/?", sizeof(url)); + if (dest) + snprintf(url, sizeof(url), "/%s/%s?", cgiGetVariable("SECTION"), dest); + else + strlcpy(url, "/jobs/?", sizeof(url)); + urlptr = url + strlen(url); } @@ -872,25 +1231,44 @@ cgiShowJobs(http_t *http, /* I - Connection to server */ * Then show everything... */ - if (!dest) - cgiCopyTemplateLang("search.tmpl"); + if (dest) + cgiSetVariable("SEARCH_DEST", dest); + + cgiCopyTemplateLang("search.tmpl"); cgiCopyTemplateLang("jobs-header.tmpl"); - if (count > CUPS_PAGE_MAX) - cgiCopyTemplateLang("page.tmpl"); + if (count > 0) + cgiCopyTemplateLang("pager.tmpl"); cgiCopyTemplateLang("jobs.tmpl"); - if (count > CUPS_PAGE_MAX) - cgiCopyTemplateLang("page.tmpl"); + if (count > 0) + cgiCopyTemplateLang("pager.tmpl"); ippDelete(response); } } +/* + * 'cgiText()' - Return localized text. + */ + +const char * /* O - Localized message */ +cgiText(const char *message) /* I - Message */ +{ + static cups_lang_t *language = NULL; + /* Language */ + + + if (!language) + language = cupsLangDefault(); + + return (_cupsLangString(language, message)); +} + /* - * End of "$Id: ipp-var.c 4921 2006-01-12 21:26:26Z mike $". + * End of "$Id: ipp-var.c 4931 2006-01-14 20:37:40Z mike $". */ diff --git a/cgi-bin/jobs.c b/cgi-bin/jobs.c index 648d381502..a73c34f90e 100644 --- a/cgi-bin/jobs.c +++ b/cgi-bin/jobs.c @@ -1,5 +1,5 @@ /* - * "$Id: jobs.c 4921 2006-01-12 21:26:26Z mike $" + * "$Id: jobs.c 4931 2006-01-14 20:37:40Z mike $" * * Job status CGI for the Common UNIX Printing System (CUPS). * @@ -38,7 +38,7 @@ * Local functions... */ -static void do_job_op(http_t *http, cups_lang_t *language, ipp_op_t op); +static void do_job_op(http_t *http, int job_id, ipp_op_t op); /* @@ -49,10 +49,11 @@ int /* O - Exit status */ main(int argc, /* I - Number of command-line arguments */ char *argv[]) /* I - Command-line arguments */ { - cups_lang_t *language; /* Language information */ http_t *http; /* Connection to the server */ const char *op; /* Operation name */ - + const char *job_id_var; /* Job ID form variable */ + int job_id; /* Job ID */ + /* * Get any form variables... @@ -66,12 +67,6 @@ main(int argc, /* I - Number of command-line arguments */ cgiSetVariable("SECTION", "jobs"); - /* - * Get the request language... - */ - - language = cupsLangDefault(); - /* * Connect to the HTTP server... */ @@ -79,42 +74,43 @@ main(int argc, /* I - Number of command-line arguments */ http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption()); /* - * Tell the client to expect UTF-8 encoded HTML... + * Get the job ID, if any... */ - puts("Content-Type: text/html;charset=utf-8\n"); + if ((job_id_var = cgiGetVariable("JOB_ID")) != NULL) + job_id = atoi(job_id_var); + else + job_id = 0; /* - * Send a standard header... + * Do the operation... */ - cgiSetVariable("TITLE", _cupsLangString(language, _("Jobs"))); - - cgiSetServerVersion(); - - cgiCopyTemplateLang("header.tmpl"); - - if ((op = cgiGetVariable("OP")) != NULL) + if ((op = cgiGetVariable("OP")) != NULL && job_id > 0) { /* * Do the operation... */ if (!strcmp(op, "cancel-job")) - do_job_op(http, language, IPP_CANCEL_JOB); + do_job_op(http, job_id, IPP_CANCEL_JOB); else if (!strcmp(op, "hold-job")) - do_job_op(http, language, IPP_HOLD_JOB); + do_job_op(http, job_id, IPP_HOLD_JOB); + else if (!strcmp(op, "move-job")) + cgiMoveJobs(http, NULL, job_id); else if (!strcmp(op, "release-job")) - do_job_op(http, language, IPP_RELEASE_JOB); + do_job_op(http, job_id, IPP_RELEASE_JOB); else if (!strcmp(op, "restart-job")) - do_job_op(http, language, IPP_RESTART_JOB); + do_job_op(http, job_id, IPP_RESTART_JOB); else { /* * Bad operation code... Display an error... */ - cgiCopyTemplateLang("job-op.tmpl"); + cgiStartHTML(cgiText(_("Jobs"))); + cgiCopyTemplateLang("error-op.tmpl"); + cgiEndHTML(); } } else @@ -123,17 +119,16 @@ main(int argc, /* I - Number of command-line arguments */ * Show a list of jobs... */ + cgiStartHTML(cgiText(_("Jobs"))); cgiShowJobs(http, NULL); + cgiEndHTML(); } - cgiCopyTemplateLang("trailer.tmpl"); - /* * Close the HTTP server connection... */ httpClose(http); - cupsLangFree(language); /* * Return with no errors... @@ -149,24 +144,13 @@ main(int argc, /* I - Number of command-line arguments */ static void do_job_op(http_t *http, /* I - HTTP connection */ - cups_lang_t *language, /* I - Client's language */ + int job_id, /* I - Job ID */ ipp_op_t op) /* I - Operation to perform */ { - ipp_t *request, /* IPP request */ - *response; /* IPP response */ + ipp_t *request; /* IPP request */ char uri[HTTP_MAX_URI]; /* Job URI */ - const char *job; /* Job ID */ - ipp_status_t status; /* Operation status... */ - + const char *user; /* Username */ - if ((job = cgiGetVariable("JOB_ID")) != NULL) - snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%s", job); - else - { - cgiSetVariable("ERROR", ippErrorString(IPP_NOT_FOUND)); - cgiCopyTemplateLang("error.tmpl"); - return; - } /* * Build a job request, which requires the following @@ -178,50 +162,29 @@ do_job_op(http_t *http, /* I - HTTP connection */ * requesting-user-name */ - request = ippNew(); - - request->request.op.operation_id = op; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(op); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, uri); - if (getenv("REMOTE_USER") != NULL) - { - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, getenv("REMOTE_USER")); + snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", job_id); - if (strcmp(getenv("REMOTE_USER"), "root")) - ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1); - } - else - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, "unknown"); + if ((user = getenv("REMOTE_USER")) == NULL) + user = "guest"; + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, user); /* * Do the request and get back a response... */ - if ((response = cupsDoRequest(http, request, "/jobs")) != NULL) - { - status = response->request.status.status_code; + ippDelete(cupsDoRequest(http, request, "/jobs")); - ippDelete(response); - } - else - status = cupsLastError(); + cgiStartHTML(cgiText(_("Jobs"))); - if (status > IPP_OK_CONFLICT) - { - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); - } + if (cupsLastError() > IPP_OK_CONFLICT) + cgiShowIPPError(_("Job operation failed:")); else if (op == IPP_CANCEL_JOB) cgiCopyTemplateLang("job-cancel.tmpl"); else if (op == IPP_HOLD_JOB) @@ -230,9 +193,11 @@ do_job_op(http_t *http, /* I - HTTP connection */ cgiCopyTemplateLang("job-release.tmpl"); else if (op == IPP_RESTART_JOB) cgiCopyTemplateLang("job-restart.tmpl"); + + cgiEndHTML(); } /* - * End of "$Id: jobs.c 4921 2006-01-12 21:26:26Z mike $". + * End of "$Id: jobs.c 4931 2006-01-14 20:37:40Z mike $". */ diff --git a/cgi-bin/printers.c b/cgi-bin/printers.c index 25bb7ea70e..ddc027f51b 100644 --- a/cgi-bin/printers.c +++ b/cgi-bin/printers.c @@ -1,5 +1,5 @@ /* - * "$Id: printers.c 4921 2006-01-12 21:26:26Z mike $" + * "$Id: printers.c 4931 2006-01-14 20:37:40Z mike $" * * Printer status CGI for the Common UNIX Printing System (CUPS). * @@ -23,7 +23,9 @@ * * Contents: * - * main() - Main entry for CGI. + * main() - Main entry for CGI. + * show_all_printers() - Show all printers... + * show_printer() - Show a single printer. */ /* @@ -33,6 +35,14 @@ #include "cgi-private.h" +/* + * Local functions... + */ + +void show_all_printers(http_t *http, const char *username); +void show_printer(http_t *http, const char *printer); + + /* * 'main()' - Main entry for CGI. */ @@ -41,17 +51,13 @@ int /* O - Exit status */ main(int argc, /* I - Number of command-line arguments */ char *argv[]) /* I - Command-line arguments */ { - cups_lang_t *language; /* Language information */ - char *printer; /* Printer name */ + const char *printer; /* Printer name */ + const char *user; /* Username */ http_t *http; /* Connection to the server */ ipp_t *request, /* IPP request */ *response; /* IPP response */ ipp_attribute_t *attr; /* IPP attribute */ - ipp_status_t status; /* Operation status... */ - char uri[HTTP_MAX_URI]; /* Printer URI */ - const char *which_jobs; /* Which jobs to show */ const char *op; /* Operation to perform, if any */ - char refresh[1024]; /* Refresh URL */ static const char *def_attrs[] = /* Attributes for default printer */ { "printer-name", @@ -64,13 +70,8 @@ main(int argc, /* I - Number of command-line arguments */ */ cgiInitialize(); - op = cgiGetVariable("OP"); - - /* - * Get the request language... - */ - language = cupsLangDefault(); + op = cgiGetVariable("OP"); /* * Set the web interface section... @@ -79,48 +80,38 @@ main(int argc, /* I - Number of command-line arguments */ cgiSetVariable("SECTION", "printers"); /* - * Connect to the HTTP server... + * See if we are displaying a printer or all printers... */ - http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption()); + if (!strcmp(argv[0], "/") || strstr(argv[0], "printers.cgi")) + printer = NULL; + else + printer = argv[0]; /* - * Tell the client to expect UTF-8 encoded HTML... + * See who is logged in... */ - puts("Content-Type: text/html;charset=utf-8\n"); + if ((user = getenv("REMOTE_USER")) == NULL) + user = "guest"; /* - * See if we need to show a list of printers or the status of a - * single printer... + * Connect to the HTTP server... */ - cgiSetServerVersion(); + http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption()); - printer = argv[0]; - if (strcmp(printer, "/") == 0 || strstr(printer, "printers.cgi") != NULL) - { - printer = NULL; - cgiSetVariable("TITLE", _cupsLangString(language, _("Printer"))); - } - else - cgiSetVariable("TITLE", printer); + /* + * Get the default printer... + */ - if (op == NULL || strcasecmp(op, "print-test-page") != 0) + if (!op) { /* * Get the default destination... */ - request = ippNew(); - request->request.op.operation_id = CUPS_GET_DEFAULT; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_GET_DEFAULT); ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", @@ -145,290 +136,335 @@ main(int argc, /* I - Number of command-line arguments */ } /* - * Get the printer info... + * See if we need to show a list of printers or the status of a + * single printer... */ - request = ippNew(); + if (!printer) + show_all_printers(http, user); + else + show_printer(http, printer); + } + else if (!strcasecmp(op, "print-test-page") && printer) + cgiPrintTestPage(http, printer); + else if (!strcasecmp(op, "move-jobs") && printer) + cgiMoveJobs(http, printer, 0); + else + { + /* + * Unknown/bad operation... + */ - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); + if (printer) + cgiStartHTML(printer); + else + cgiStartHTML(cgiText(_("Printers"))); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + cgiCopyTemplateLang("error-op.tmpl"); + cgiEndHTML(); + } - if (printer == NULL) - { - /* - * Build a CUPS_GET_PRINTERS request, which requires the following - * attributes: - * - * attributes-charset - * attributes-natural-language - */ + /* + * Close the HTTP server connection... + */ + + httpClose(http); + + /* + * Return with no errors... + */ - request->request.op.operation_id = CUPS_GET_PRINTERS; - request->request.op.request_id = 1; + return (0); +} - ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, - "printer-type", 0); - ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, - "printer-type-mask", CUPS_PRINTER_CLASS); - if (getenv("REMOTE_USER") != NULL) - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, getenv("REMOTE_USER")); - } - else - { - /* - * Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following - * attributes: - * - * attributes-charset - * attributes-natural-language - * printer-uri - */ +/* + * 'show_all_printers()' - Show all printers... + */ - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; +void +show_all_printers(http_t *http, /* I - Connection to server */ + const char *user) /* I - Username */ +{ + int i; /* Looping var */ + ipp_t *request, /* IPP request */ + *response; /* IPP response */ + cups_array_t *printers; /* Array of printer objects */ + ipp_attribute_t *printer; /* Printer object */ + int ascending, /* Order of printers (0 = descending) */ + first, /* First printer to show */ + count; /* Number of printers */ + const char *var; /* Form variable */ + void *search; /* Search data */ + char url[1024], /* URL for prev/next/this */ + *urlptr, /* Position in URL */ + *urlend; /* End of URL */ - httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, - "/printers/%s", printer); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, - uri); - } - cgiGetAttributes(request, "printers.tmpl"); + /* + * Show the standard header... + */ - /* - * Do the request and get back a response... - */ + cgiStartHTML(cgiText(_("Printers"))); - if ((response = cupsDoRequest(http, request, "/")) != NULL) - { - /* - * Got the result; set the CGI variables and check the status of a - * single-queue request... - */ + /* + * Build a CUPS_GET_PRINTERS request, which requires the following + * attributes: + * + * attributes-charset + * attributes-natural-language + * printer-type + * printer-type-mask + * requesting-user-name + */ - cgiSetIPPVars(response, NULL, NULL, NULL, 0); + request = ippNewRequest(CUPS_GET_PRINTERS); - if (printer && (attr = ippFindAttribute(response, "printer-state", - IPP_TAG_ENUM)) != NULL && - attr->values[0].integer == IPP_PRINTER_PROCESSING) - { - /* - * Printer is processing - automatically refresh the page until we - * are done printing... - */ - - cgiFormEncode(uri, printer, sizeof(uri)); - snprintf(refresh, sizeof(refresh), "10;/printers/%s", uri); - cgiSetVariable("refresh_page", refresh); - } + ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, + "printer-type", 0); + ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_ENUM, + "printer-type-mask", CUPS_PRINTER_CLASS); - /* - * Delete the response... - */ + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, user); - ippDelete(response); - } - else if (printer) - fprintf(stderr, "ERROR: Get-Printer-Attributes request failed - %s (%x)\n", - ippErrorString(cupsLastError()), cupsLastError()); - else - fprintf(stderr, "ERROR: CUPS-Get-Printers request failed - %s (%x)\n", - ippErrorString(cupsLastError()), cupsLastError()); + cgiGetAttributes(request, "printers.tmpl"); + /* + * Do the request and get back a response... + */ + + if ((response = cupsDoRequest(http, request, "/")) != NULL) + { /* - * Show the standard header... + * Get a list of matching job objects. */ - cgiCopyTemplateLang("header.tmpl"); + if ((var = cgiGetVariable("QUERY")) != NULL) + search = cgiCompileSearch(var); + else + search = NULL; - /* - * Write the report... - */ + printers = cgiGetIPPObjects(response, search); + count = cupsArrayCount(printers); - cgiCopyTemplateLang("printers.tmpl"); + if (search) + cgiFreeSearch(search); /* - * Get jobs for the specified printer if a printer has been chosen... + * Figure out which printers to display... */ - if (printer != NULL) - { - /* - * Build an IPP_GET_JOBS request, which requires the following - * attributes: - * - * attributes-charset - * attributes-natural-language - * printer-uri - */ + if ((var = cgiGetVariable("FIRST")) != NULL) + first = atoi(var); + else + first = 0; - request = ippNew(); + if (first >= count) + first = count - CUPS_PAGE_MAX; - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); + first = (first / CUPS_PAGE_MAX) * CUPS_PAGE_MAX; - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + if (first < 0) + first = 0; - request->request.op.operation_id = IPP_GET_JOBS; - request->request.op.request_id = 1; + sprintf(url, "%d", count); + cgiSetVariable("TOTAL", url); - httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, - "/printers/%s", printer); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, - uri); + if ((var = cgiGetVariable("ORDER")) != NULL) + ascending = !strcasecmp(var, "asc"); + else + ascending = 1; - if ((which_jobs = cgiGetVariable("which_jobs")) != NULL) - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "which-jobs", - NULL, which_jobs); + if (ascending) + { + for (i = 0, printer = (ipp_attribute_t *)cupsArrayIndex(printers, first); + i < CUPS_PAGE_MAX && printer; + i ++, printer = (ipp_attribute_t *)cupsArrayNext(printers)) + cgiSetIPPObjectVars(printer, NULL, i); + } + else + { + for (i = 0, printer = (ipp_attribute_t *)cupsArrayIndex(printers, count - first - 1); + i < CUPS_PAGE_MAX && printer; + i ++, printer = (ipp_attribute_t *)cupsArrayPrev(printers)) + cgiSetIPPObjectVars(printer, NULL, i); + } - if (getenv("REMOTE_USER") != NULL) - { - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, getenv("REMOTE_USER")); + /* + * Save navigation URLs... + */ - if (strcmp(getenv("REMOTE_USER"), "root")) - ippAddBoolean(request, IPP_TAG_OPERATION, "my-jobs", 1); - } - else - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, "unknown"); + urlend = url + sizeof(url); - cgiGetAttributes(request, "jobs.tmpl"); + if ((var = cgiGetVariable("QUERY")) != NULL) + { + strlcpy(url, "/printers/?QUERY=", sizeof(url)); + urlptr = url + strlen(url); - /* - * Do the request and get back a response... - */ + cgiFormEncode(urlptr, var, urlend - urlptr); + urlptr += strlen(urlptr); - if ((response = cupsDoRequest(http, request, "/")) != NULL) - { - cgiSetIPPVars(response, NULL, NULL, NULL, 0); - ippDelete(response); + strlcpy(urlptr, "&", urlend - urlptr); + urlptr += strlen(urlptr); + } + else + { + strlcpy(url, "/printers/?", sizeof(url)); + urlptr = url + strlen(url); + } - cgiCopyTemplateLang("jobs.tmpl"); - } - else - fprintf(stderr, "ERROR: Get-Jobs request failed - %s (%x)\n", - ippErrorString(cupsLastError()), cupsLastError()); + snprintf(urlptr, urlend - urlptr, "FIRST=%d", first); + cgiSetVariable("THISURL", url); + + if (first > 0) + { + snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s", + first - CUPS_PAGE_MAX, ascending ? "asc" : "dec"); + cgiSetVariable("PREVURL", url); } - } - else - { + + if ((first + CUPS_PAGE_MAX) < count) + { + snprintf(urlptr, urlend - urlptr, "FIRST=%d&ORDER=%s", + first + CUPS_PAGE_MAX, ascending ? "asc" : "dec"); + cgiSetVariable("NEXTURL", url); + } + /* - * Print a test page... + * Then show everything... */ - char filename[1024]; /* Test page filename */ - const char *datadir; /* CUPS_DATADIR env var */ + cgiCopyTemplateLang("search.tmpl"); + cgiCopyTemplateLang("printers-header.tmpl"); - cgiFormEncode(uri, printer, sizeof(uri)); - snprintf(refresh, sizeof(refresh), "2;/printers/%s", uri); - cgiSetVariable("refresh_page", refresh); + if (count > 0) + cgiCopyTemplateLang("pager.tmpl"); - if ((datadir = getenv("CUPS_DATADIR")) == NULL) - datadir = CUPS_DATADIR; + cgiCopyTemplateLang("printers.tmpl"); - snprintf(filename, sizeof(filename), "%s/data/testprint.ps", datadir); - httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, - "/printers/%s", printer); + if (count > 0) + cgiCopyTemplateLang("pager.tmpl"); /* - * Build an IPP_PRINT_JOB request, which requires the following - * attributes: - * - * attributes-charset - * attributes-natural-language - * printer-uri - * requesting-user-name - * document-format + * Delete the response... */ - request = ippNew(); + ippDelete(response); + } + else + { + /* + * Show the error... + */ - request->request.op.operation_id = IPP_PRINT_JOB; - request->request.op.request_id = 1; + cgiShowIPPError(_("Unable to get printer list:")); + } - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); + cgiEndHTML(); +} - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", - NULL, uri); +/* + * 'show_printer()' - Show a single printer. + */ - if (getenv("REMOTE_USER") != NULL) - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, getenv("REMOTE_USER")); - else - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, "root"); +void +show_printer(http_t *http, /* I - Connection to server */ + const char *printer) /* I - Name of printer */ +{ + ipp_t *request, /* IPP request */ + *response; /* IPP response */ + ipp_attribute_t *attr; /* IPP attribute */ + char uri[HTTP_MAX_URI]; /* Printer URI */ + char refresh[1024]; /* Refresh URL */ - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", - NULL, "Test Page"); - ippAddString(request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format", - NULL, "application/postscript"); + /* + * Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following + * attributes: + * + * attributes-charset + * attributes-natural-language + * printer-uri + */ + + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); + + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, + "/printers/%s", printer); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, + uri); + + cgiGetAttributes(request, "printers.tmpl"); + + /* + * Do the request and get back a response... + */ + if ((response = cupsDoRequest(http, request, "/")) != NULL) + { /* - * Do the request and get back a response... + * Got the result; set the CGI variables and check the status of a + * single-queue request... */ - if ((response = cupsDoFileRequest(http, request, uri + 15, - filename)) != NULL) + cgiSetIPPVars(response, NULL, NULL, NULL, 0); + + if (printer && (attr = ippFindAttribute(response, "printer-state", + IPP_TAG_ENUM)) != NULL && + attr->values[0].integer == IPP_PRINTER_PROCESSING) { - status = response->request.status.status_code; - cgiSetIPPVars(response, NULL, NULL, NULL, 0); + /* + * Printer is processing - automatically refresh the page until we + * are done printing... + */ - ippDelete(response); + cgiFormEncode(uri, printer, sizeof(uri)); + snprintf(refresh, sizeof(refresh), "10;/printers/%s", uri); + cgiSetVariable("refresh_page", refresh); } - else - status = cupsLastError(); - cgiSetVariable("PRINTER_NAME", printer); + /* + * Delete the response... + */ + + ippDelete(response); /* * Show the standard header... */ - cgiCopyTemplateLang("header.tmpl"); + cgiStartHTML(printer); /* - * Show the result... + * Show the printer status... */ - if (status > IPP_OK_CONFLICT) - { - cgiSetVariable("ERROR", ippErrorString(status)); - cgiCopyTemplateLang("error.tmpl"); - } - else - cgiCopyTemplateLang("test-page.tmpl"); - } - - cgiCopyTemplateLang("trailer.tmpl"); + cgiCopyTemplateLang("printers.tmpl"); - /* - * Close the HTTP server connection... - */ + /* + * Show jobs for the specified printer... + */ - httpClose(http); - cupsLangFree(language); + cgiCopyTemplateLang("printer-jobs-header.tmpl"); + cgiShowJobs(http, printer); + } + else + { + /* + * Show the IPP error... + */ - /* - * Return with no errors... - */ + cgiStartHTML(printer); + cgiShowIPPError(_("Unable to get printer status:")); + } - return (0); + cgiEndHTML(); } /* - * End of "$Id: printers.c 4921 2006-01-12 21:26:26Z mike $". + * End of "$Id: printers.c 4931 2006-01-14 20:37:40Z mike $". */ diff --git a/conf/Makefile b/conf/Makefile index fe060d9c92..6846938069 100644 --- a/conf/Makefile +++ b/conf/Makefile @@ -1,9 +1,9 @@ # -# "$Id: Makefile 4664 2005-09-17 22:56:56Z mike $" +# "$Id: Makefile 4972 2006-01-24 14:48:12Z mike $" # # Configuration file makefile for the Common UNIX Printing System (CUPS). # -# Copyright 1993-2005 by Easy Software Products. +# Copyright 1993-2006 by Easy Software Products. # # These coded instructions, statements, and computer programs are the # property of Easy Software Products and are protected by Federal @@ -28,7 +28,7 @@ include ../Makedefs # Config files... # -KEEP = classes.conf client.conf cupsd.conf printers.conf +KEEP = client.conf cupsd.conf REPLACE = mime.convs mime.types @@ -50,7 +50,7 @@ clean: # Install files... # -install: +install: all $(INSTALL_DIR) $(SERVERROOT) for file in $(KEEP); do \ if test -r $(SERVERROOT)/$$file ; then \ @@ -59,6 +59,7 @@ install: $(INSTALL_DATA) $$file $(SERVERROOT) ; \ fi ; \ done + $(INSTALL_DATA) cupsd.conf $(SERVERROOT)/cupsd.conf.default for file in $(REPLACE); do \ if test -r $(SERVERROOT)/$$file ; then \ $(MV) $(SERVERROOT)/$$file $(SERVERROOT)/$$file.O ; \ @@ -76,5 +77,5 @@ install: # -# End of "$Id: Makefile 4664 2005-09-17 22:56:56Z mike $". +# End of "$Id: Makefile 4972 2006-01-24 14:48:12Z mike $". # diff --git a/conf/classes.conf b/conf/classes.conf deleted file mode 100644 index 4087968833..0000000000 --- a/conf/classes.conf +++ /dev/null @@ -1,89 +0,0 @@ -# -# "$Id: classes.conf 4494 2005-02-18 02:18:11Z mike $" -# -# Sample class configuration file for the Common UNIX Printing System -# (CUPS) scheduler. -# -# Copyright 1997-2005 by Easy Software Products, all rights reserved. -# -# These coded instructions, statements, and computer programs are the -# property of Easy Software Products 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 missing or damaged please contact Easy Software Products -# at: -# -# Attn: CUPS Licensing Information -# Easy Software Products -# 44141 Airport View Drive, Suite 204 -# Hollywood, Maryland 20636 USA -# -# Voice: (301) 373-9600 -# EMail: cups-info@cups.org -# WWW: http://www.cups.org -# - -######################################################################## -# # -# This is a sample class configuration file. This file is included # -# from the main configuration file (cups.conf) and lists all of the # -# printer classes known to the system. # -# # -######################################################################## - -# -# Each class starts with a definition. Class names -# can be up to 128 characters in length and are *not* case sensitive. -# -# One entry can appear in this file; if you don't -# define a default destination, the first printer or class becomes -# the default. -# - -# -# -# Info: the description for the class. -# - -#Info Acme LaserPrint 1000 Printers - -# -# Location: the location of the printer. -# - -#Location Room 101 in the activities building - -# -# State: sets the initial state of the class. Can be one of the -# following: -# -# Idle - Class is available to print new jobs. -# Stopped - Class is disabled but accepting new jobs. -# - -#State Idle - -# -# StateMessage: sets the printer-state-message attribute for the class. -# - -#StateMessage Class is idle. - -# -# Accepting: is the class accepting jobs? -# -#Accepting Yes -#Accepting No -# - -# -# Printer: adds a printer to the class. -# - -#Printer sample -#Printer sample@host2 -# - -# -# End of "$Id: classes.conf 4494 2005-02-18 02:18:11Z mike $". -# diff --git a/conf/printcap b/conf/printcap deleted file mode 100644 index 230c3017d6..0000000000 --- a/conf/printcap +++ /dev/null @@ -1,2 +0,0 @@ -# This is a dummy printcap file that is automatically generated by the -# CUPS software for old applications that rely on it. diff --git a/conf/printers.conf b/conf/printers.conf deleted file mode 100644 index 3848459c91..0000000000 --- a/conf/printers.conf +++ /dev/null @@ -1,96 +0,0 @@ -# -# "$Id: printers.conf 4494 2005-02-18 02:18:11Z mike $" -# -# Sample printer configuration file for the Common UNIX Printing System -# (CUPS) scheduler. -# -# Copyright 1997-2005 by Easy Software Products, all rights reserved. -# -# These coded instructions, statements, and computer programs are the -# property of Easy Software Products 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 missing or damaged please contact Easy Software Products -# at: -# -# Attn: CUPS Licensing Information -# Easy Software Products -# 44141 Airport View Drive, Suite 204 -# Hollywood, Maryland 20636 USA -# -# Voice: (301) 373-9600 -# EMail: cups-info@cups.org -# WWW: http://www.cups.org -# - -######################################################################## -# # -# This is a sample printer configuration file. This file is included # -# from the main configuration file (cups.conf) and lists all of the # -# printers known to the system. # -# # -######################################################################## - -# -# Each printer starts with a definition. Printer names -# can be up to 128 characters in length and are *not* case sensitive. -# -# One entry can appear in this file; if you don't -# define a default destination, the first printer or class becomes the -# default. -# - -# -# -# Info: the description for the printer. -# - -#Info Acme LaserPrint 1000 - -# -# Location: the location of the printer. -# - -#Location Room 101 in the activities building - -# -# DeviceURI: the device URI for this printer. -# - -#DeviceURI parallel:/dev/plp -#DeviceURI serial:/dev/ttyd1?baud=38400+size=8+parity=none+flow=soft -#DeviceURI scsi:/dev/scsi/sc1d6l0 -#DeviceURI socket://hostname:port -#DeviceURI tftp://hostname/path -#DeviceURI ftp://hostname/path -#DeviceURI http://hostname[:port]/path -#DeviceURI ipp://hostname/path -#DeviceURI smb://hostname/printer - -# -# State: sets the initial state of the printer. Can be one of the -# following: -# -# Idle - Printer is available to print new jobs. -# Stopped - Printer is disabled but accepting new jobs. -# - -#State Idle - -# -# StateMessage: sets the printer-state-message attribute for the printer. -# - -#StateMessage Printer is idle. - -# -# Accepting: is the printer accepting jobs? -# -#Accepting Yes -#Accepting No - -# - -# -# End of "$Id: printers.conf 4494 2005-02-18 02:18:11Z mike $". -# diff --git a/config-scripts/cups-common.m4 b/config-scripts/cups-common.m4 index 0459916763..28b45a3b72 100644 --- a/config-scripts/cups-common.m4 +++ b/config-scripts/cups-common.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-common.m4 4833 2005-11-12 21:46:52Z mike $" +dnl "$Id: cups-common.m4 4979 2006-01-25 17:47:43Z mike $" dnl dnl Common configuration stuff for the Common UNIX Printing System (CUPS). dnl @@ -159,6 +159,11 @@ AC_TRY_COMPILE([#include ],[struct tm t; AC_DEFINE(HAVE_TM_GMTOFF), AC_MSG_RESULT(no)) +dnl See if we have POSIX ACL support... +dnl TODO: Linux/Solaris/IRIX/etc. version + +AC_CHECK_FUNCS(acl_init) + dnl Flags for "ar" command... case $uname in Darwin* | *BSD*) @@ -176,6 +181,29 @@ case $uname in Darwin*) BACKLIBS="-framework IOKit" LIBS="-framework CoreFoundation $LIBS" + + dnl Check for CFLocaleCreateCanonicalLocaleIdentifierFromString... + AC_MSG_CHECKING(for CFLocaleCreateCanonicalLocaleIdentifierFromString) + if test "$uname" = "Darwin" -a $uversion -ge 70; then + AC_DEFINE(HAVE_CF_LOCALE_ID) + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi + + dnl Check for framework headers... + AC_CHECK_HEADER(CoreFoundation/CoreFoundation.h,AC_DEFINE(HAVE_COREFOUNDATION_H)) + AC_CHECK_HEADER(CoreFoundation/CFPriv.h,AC_DEFINE(HAVE_CFPRIV_H)) + AC_CHECK_HEADER(CoreFoundation/CFBundlePriv.h,AC_DEFINE(HAVE_CFBUNDLEPRIV_H)) + + dnl Check for the new membership functions in MacOSX 10.4 (Tiger)... + AC_CHECK_HEADER(membership.h,AC_DEFINE(HAVE_MEMBERSHIP_H)) + AC_CHECK_HEADER(membershipPriv.h,AC_DEFINE(HAVE_MEMBERSHIPPRIV_H)) + AC_CHECK_FUNCS(mbr_uid_to_uuid) + + dnl Check for notify_post support + AC_CHECK_HEADER(notify.h,AC_DEFINE(HAVE_NOTIFY_H)) + AC_CHECK_FUNCS(notify_post) ;; *) BACKLIBS="" @@ -193,5 +221,5 @@ AC_SUBST(DEFAULT_IPP_PORT) AC_DEFINE_UNQUOTED(CUPS_DEFAULT_IPP_PORT,$DEFAULT_IPP_PORT) dnl -dnl End of "$Id: cups-common.m4 4833 2005-11-12 21:46:52Z mike $". +dnl End of "$Id: cups-common.m4 4979 2006-01-25 17:47:43Z mike $". dnl diff --git a/config-scripts/cups-compiler.m4 b/config-scripts/cups-compiler.m4 index f597e27735..1bf262dbcf 100644 --- a/config-scripts/cups-compiler.m4 +++ b/config-scripts/cups-compiler.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-compiler.m4 4915 2006-01-11 15:57:53Z mike $" +dnl "$Id: cups-compiler.m4 4953 2006-01-19 20:30:48Z mike $" dnl dnl Compiler stuff for the Common UNIX Printing System (CUPS). dnl @@ -27,12 +27,14 @@ dnl for them... OPTIM="" AC_SUBST(OPTIM) +AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ]) + AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no], [if test x$enable_debug = xyes; then OPTIM="-g" fi]) -AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ]) +AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fpie option, default=no]) dnl Update compiler options... CXXLIBS="" @@ -64,16 +66,10 @@ if test -n "$GCC"; then ;; Linux*) - AC_MSG_CHECKING(if GCC supports -fpie) - - OLDCFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fpie" - AC_TRY_COMPILE(,, + if test x$enable_pie = xyes; then OPTIM="$OPTIM -fpie" LDFLAGS="$LDFLAGS -pie" - AC_MSG_RESULT(yes), - CFLAGS="$OLDCFLAGS" - AC_MSG_RESULT(no)) + fi ;; esac @@ -196,5 +192,5 @@ if test $uname = HP-UX; then fi dnl -dnl End of "$Id: cups-compiler.m4 4915 2006-01-11 15:57:53Z mike $". +dnl End of "$Id: cups-compiler.m4 4953 2006-01-19 20:30:48Z mike $". dnl diff --git a/config-scripts/cups-directories.m4 b/config-scripts/cups-directories.m4 index 9cbcc26aad..836ec6742f 100644 --- a/config-scripts/cups-directories.m4 +++ b/config-scripts/cups-directories.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-directories.m4 4873 2005-12-07 01:46:54Z mike $" +dnl "$Id: cups-directories.m4 4933 2006-01-16 00:26:57Z mike $" dnl dnl Directory stuff for the Common UNIX Printing System (CUPS). dnl @@ -43,11 +43,15 @@ if test "$bindir" = "\${exec_prefix}/bin"; then bindir="$exec_prefix/bin" fi +AC_DEFINE_UNQUOTED(CUPS_BINDIR, "$bindir") + dnl Fix "sbindir" variable... if test "$sbindir" = "\${exec_prefix}/sbin"; then sbindir="$exec_prefix/sbin" fi +AC_DEFINE_UNQUOTED(CUPS_SBINDIR, "$sbindir") + dnl Fix "sharedstatedir" variable if it hasn't been specified... if test "$sharedstatedir" = "\${prefix}/com" -a "$prefix" = "/"; then sharedstatedir="/usr/com" @@ -275,5 +279,5 @@ AC_DEFINE_UNQUOTED(CUPS_STATEDIR, "$localstatedir/run/cups") AC_SUBST(CUPS_STATEDIR) dnl -dnl End of "$Id: cups-directories.m4 4873 2005-12-07 01:46:54Z mike $". +dnl End of "$Id: cups-directories.m4 4933 2006-01-16 00:26:57Z mike $". dnl diff --git a/config-scripts/cups-opsys.m4 b/config-scripts/cups-opsys.m4 index 5b2b1502c8..b2b53126df 100644 --- a/config-scripts/cups-opsys.m4 +++ b/config-scripts/cups-opsys.m4 @@ -1,5 +1,5 @@ dnl -dnl "$Id: cups-opsys.m4 4833 2005-11-12 21:46:52Z mike $" +dnl "$Id: cups-opsys.m4 4960 2006-01-20 16:41:20Z mike $" dnl dnl Operating system stuff for the Common UNIX Printing System (CUPS). dnl @@ -24,7 +24,8 @@ dnl dnl Get the operating system and version number... uname=`uname` -uversion=`uname -r | sed -e '1,$s/[[^0-9]]//g'` +uversion=`uname -r | sed -e '1,$s/^[[^0-9]]*\([[0-9]]*\)\.\([[0-9]]*\).*/\1\2/'` + case "$uname" in GNU* | GNU/*) uname="GNU" @@ -95,5 +96,5 @@ AC_DEFINE_UNQUOTED(CUPS_DEFAULT_USER, "$CUPS_USER") AC_DEFINE_UNQUOTED(CUPS_DEFAULT_GROUP, "$CUPS_GROUP") dnl -dnl "$Id: cups-opsys.m4 4833 2005-11-12 21:46:52Z mike $" +dnl "$Id: cups-opsys.m4 4960 2006-01-20 16:41:20Z mike $" dnl diff --git a/config.h.in b/config.h.in index 9b853da17e..efc0e2f200 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,5 @@ /* - * "$Id: config.h.in 4760 2005-10-08 20:11:08Z mike $" + * "$Id: config.h.in 4979 2006-01-25 17:47:43Z mike $" * * Configuration file for the Common UNIX Printing System (CUPS). * @@ -71,6 +71,7 @@ * variables at run-time... */ +#define CUPS_BINDIR "/usr/bin" #define CUPS_CACHEDIR "/var/cache/cups" #define CUPS_DATADIR "/usr/share/cups" #define CUPS_DOCROOT "/usr/share/doc/cups" @@ -78,6 +79,7 @@ #define CUPS_LOCALEDIR "/usr/share/locale" #define CUPS_LOGDIR "/var/logs/cups" #define CUPS_REQUESTS "/var/spool/cups" +#define CUPS_SBINDIR "/usr/sbin" #define CUPS_SERVERBIN "/usr/lib/cups" #define CUPS_SERVERROOT "/etc/cups" #define CUPS_STATEDIR "/var/run/cups" @@ -207,6 +209,13 @@ #undef HAVE_MALLOC_H +/* + * Do we have the POSIX ACL functions? + */ + +#undef HAVE_ACL_INIT + + /* * Do we have the langinfo.h header file? */ @@ -336,8 +345,42 @@ #define CUPS_PYTHON "/usr/bin/python" +/* + * Do we have Darwin's CoreFoundation and SystemConfiguration frameworks? + */ + +#undef HAVE_COREFOUNDATION +#undef HAVE_SYSTEMCONFIGURATION + + +/* + * Do we have CoreFoundation public and private headers? + */ + +#undef HAVE_COREFOUNDATION_H +#undef HAVE_CFPRIV_H +#undef HAVE_CFBUNDLEPRIV_H + + +/* + * Do we have MacOSX 10.4's mbr_XXX functions()? + */ + +#undef HAVE_MEMBERSHIP_H +#undef HAVE_MEMBERSHIPPRIV_H +#undef HAVE_MBR_UID_TO_UUID + + +/* + * Do we have Darwin's notify_post() header and function? + */ + +#undef HAVE_NOTIFY_H +#undef HAVE_NOTIFY_POST + + #endif /* !_CUPS_CONFIG_H_ */ /* - * End of "$Id: config.h.in 4760 2005-10-08 20:11:08Z mike $". + * End of "$Id: config.h.in 4979 2006-01-25 17:47:43Z mike $". */ diff --git a/configure.in b/configure.in index 2057cd5f93..0135039a2b 100644 --- a/configure.in +++ b/configure.in @@ -1,9 +1,9 @@ dnl -dnl "$Id: configure.in 4873 2005-12-07 01:46:54Z mike $" +dnl "$Id: configure.in 4971 2006-01-24 14:33:18Z mike $" dnl dnl Configuration script for the Common UNIX Printing System (CUPS). dnl -dnl Copyright 1997-2005 by Easy Software Products, all rights reserved. +dnl Copyright 1997-2006 by Easy Software Products, all rights reserved. dnl dnl These coded instructions, statements, and computer programs are the dnl property of Easy Software Products and are protected by Federal @@ -46,12 +46,12 @@ AC_SUBST(MAKEDEFS) sinclude(config-scripts/cups-scripting.m4) -AC_OUTPUT(Makedefs packaging/cups.list cups.sh cups-config +AC_OUTPUT(Makedefs packaging/cups.list init/cups.sh cups-config conf/cupsd.conf conf/pam.std doc/index.html doc/help/standard.html templates/edit-config.tmpl) chmod +x cups-config dnl -dnl End of "$Id: configure.in 4873 2005-12-07 01:46:54Z mike $". +dnl End of "$Id: configure.in 4971 2006-01-24 14:33:18Z mike $". dnl diff --git a/cups/Dependencies b/cups/Dependencies index 8b3a122883..fa951c4ef2 100644 --- a/cups/Dependencies +++ b/cups/Dependencies @@ -1,66 +1,74 @@ # DO NOT DELETE array.o: array.h string.h ../config.h debug.h -attr.o: ppd.h file.h debug.h string.h ../config.h -auth.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h file.h -auth.o: i18n.h language.h array.h normalize.h transcode.h debug.h -backchannel.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h file.h -dest.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h file.h -dest.o: i18n.h language.h array.h normalize.h transcode.h +attr.o: ppd.h array.h file.h debug.h string.h ../config.h +auth.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h +auth.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h +backchannel.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h +backchannel.o: file.h +custom.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h +custom.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h +dest.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h +dest.o: array.h file.h i18n.h language.h normalize.h transcode.h dir.o: dir.h string.h ../config.h debug.h -emit.o: ppd.h file.h string.h ../config.h -encode.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h file.h debug.h +emit.o: ppd.h array.h file.h string.h ../config.h +encode.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h file.h +encode.o: debug.h file.o: http-private.h ../config.h http.h string.h md5.h ../cups/debug.h file.o: file.h -getputfile.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h file.h -getputfile.o: language.h array.h debug.h +getputfile.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h +getputfile.o: file.h language.h debug.h globals.o: http-private.h ../config.h http.h string.h md5.h globals.h cups.h -globals.o: ipp.h ppd.h file.h i18n.h language.h array.h normalize.h +globals.o: ipp.h ppd.h array.h file.h i18n.h language.h normalize.h globals.o: transcode.h http.o: http-private.h ../config.h http.h string.h md5.h globals.h cups.h -http.o: ipp.h ppd.h file.h i18n.h language.h array.h normalize.h transcode.h +http.o: ipp.h ppd.h array.h file.h i18n.h language.h normalize.h transcode.h http.o: debug.h http-addr.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h -http-addr.o: file.h i18n.h language.h array.h normalize.h transcode.h debug.h +http-addr.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h http-addrlist.o: http-private.h ../config.h http.h string.h md5.h globals.h -http-addrlist.o: cups.h ipp.h ppd.h file.h i18n.h language.h array.h +http-addrlist.o: cups.h ipp.h ppd.h array.h file.h i18n.h language.h http-addrlist.o: normalize.h transcode.h debug.h http-support.o: debug.h globals.h string.h ../config.h cups.h ipp.h http.h -http-support.o: md5.h ppd.h file.h i18n.h language.h array.h normalize.h +http-support.o: md5.h ppd.h array.h file.h i18n.h language.h normalize.h http-support.o: transcode.h ipp.o: http-private.h ../config.h http.h string.h md5.h globals.h cups.h -ipp.o: ipp.h ppd.h file.h i18n.h language.h array.h normalize.h transcode.h +ipp.o: ipp.h ppd.h array.h file.h i18n.h language.h normalize.h transcode.h ipp.o: debug.h ipp-support.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h -ipp-support.o: file.h i18n.h language.h array.h normalize.h transcode.h +ipp-support.o: array.h file.h i18n.h language.h normalize.h transcode.h ipp-support.o: debug.h -langprintf.o: string.h ../config.h i18n.h language.h array.h transcode.h +langprintf.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h +langprintf.o: array.h file.h i18n.h language.h normalize.h transcode.h language.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h -language.o: file.h i18n.h language.h array.h normalize.h transcode.h debug.h -mark.o: ppd.h file.h string.h ../config.h debug.h +language.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h +localize.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h +localize.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h +mark.o: ppd.h array.h file.h string.h ../config.h debug.h md5.o: md5.h string.h ../config.h md5passwd.o: http.h string.h ../config.h md5.h normalize.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h -normalize.o: file.h i18n.h language.h array.h normalize.h transcode.h debug.h -options.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h file.h -options.o: debug.h -page.o: ppd.h file.h string.h ../config.h -ppd.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h file.h -ppd.o: i18n.h language.h array.h normalize.h transcode.h debug.h +normalize.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h +options.o: cups.h ipp.h http.h string.h ../config.h md5.h ppd.h array.h +options.o: file.h debug.h +page.o: ppd.h array.h file.h string.h ../config.h +ppd.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h array.h +ppd.o: file.h i18n.h language.h normalize.h transcode.h debug.h snprintf.o: string.h ../config.h string.o: string.h ../config.h tempfile.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h -tempfile.o: file.h i18n.h language.h array.h normalize.h transcode.h debug.h +tempfile.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h transcode.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h -transcode.o: file.h i18n.h language.h array.h normalize.h transcode.h +transcode.o: array.h file.h i18n.h language.h normalize.h transcode.h usersys.o: http-private.h ../config.h http.h string.h md5.h globals.h cups.h -usersys.o: ipp.h ppd.h file.h i18n.h language.h array.h normalize.h +usersys.o: ipp.h ppd.h array.h file.h i18n.h language.h normalize.h usersys.o: transcode.h -util.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h file.h -util.o: i18n.h language.h array.h normalize.h transcode.h debug.h +util.o: globals.h string.h ../config.h cups.h ipp.h http.h md5.h ppd.h +util.o: array.h file.h i18n.h language.h normalize.h transcode.h debug.h testarray.o: ../cups/string.h ../config.h string.h array.h dir.h debug.h testfile.o: string.h ../config.h file.h debug.h testhttp.o: http.h string.h ../config.h md5.h testi18n.o: language.h array.h string.h ../config.h transcode.h normalize.h testipp.o: ../cups/string.h ../config.h string.h ipp.h http.h md5.h testlang.o: i18n.h language.h array.h +testppd.o: ../cups/string.h ../config.h string.h ppd.h array.h file.h diff --git a/cups/Makefile b/cups/Makefile index 1834c1312e..3393108c81 100644 --- a/cups/Makefile +++ b/cups/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 4918 2006-01-12 05:14:40Z mike $" +# "$Id: Makefile 4961 2006-01-20 22:19:13Z mike $" # # API library Makefile for the Common UNIX Printing System (CUPS). # @@ -35,6 +35,7 @@ LIBOBJS = \ attr.o \ auth.o \ backchannel.o \ + custom.o \ dest.o \ dir.o \ emit.o \ @@ -50,10 +51,12 @@ LIBOBJS = \ ipp-support.o \ langprintf.o \ language.o \ + localize.o \ mark.o \ md5.o \ md5passwd.o \ normalize.o \ + notify.o \ options.o \ page.o \ ppd.o \ @@ -71,6 +74,7 @@ OBJS = \ testi18n.o \ testipp.o \ testlang.o \ + testppd.o \ php_cups_wrap.o @@ -105,7 +109,8 @@ TARGETS = \ testhttp \ testi18n \ testipp \ - testlang + testlang \ + testppd # @@ -177,7 +182,7 @@ libcups.so.2 libcups.sl.2: $(LIBOBJS) libcups.2.dylib: $(LIBOBJS) echo Linking $@... $(DSO) $(DSOFLAGS) -o $@ \ - -install_name $(libdir)/libcups.dylib \ + -install_name $(libdir)/$@ \ -current_version 2.7.0 \ -compatibility_version 2.0.0 \ $(LIBOBJS) $(SSLLIBS) $(COMMONLIBS) $(LIBZ) @@ -298,6 +303,16 @@ testlang: testlang.o libcups.a $(SSLLIBS) $(COMMONLIBS) $(LIBZ) +# +# testppd (dependency on static CUPS library is intentional) +# + +testppd: testppd.o libcups.a + echo Linking $@... + $(CC) $(LDFLAGS) -o $@ testppd.o libcups.a \ + $(SSLLIBS) $(COMMONLIBS) $(LIBZ) + + # # Automatic API help files... # @@ -338,5 +353,5 @@ include Dependencies # -# End of "$Id: Makefile 4918 2006-01-12 05:14:40Z mike $". +# End of "$Id: Makefile 4961 2006-01-20 22:19:13Z mike $". # diff --git a/cups/array.c b/cups/array.c index 88f26cd72d..71d6498477 100644 --- a/cups/array.c +++ b/cups/array.c @@ -1,5 +1,5 @@ /* - * "$Id: array.c 4921 2006-01-12 21:26:26Z mike $" + * "$Id: array.c 4970 2006-01-24 14:05:45Z mike $" * * Sorted array routines for the Common UNIX Printing System (CUPS). * @@ -34,6 +34,7 @@ * cupsArrayFind() - Find an element in the array. * cupsArrayFirst() - Get the first element in the array. * cupsArrayIndex() - Get the N-th element in the array. + * cupsArrayInsert() - Insert an element in the array. * cupsArrayLast() - Get the last element in the array. * cupsArrayNew() - Create a new array. * cupsArrayNext() - Get the next element in the array. @@ -485,6 +486,111 @@ cupsArrayIndex(cups_array_t *a, /* I - Array */ } +/* + * 'cupsArrayInsert()' - Insert an element in the array. + * + * When inserting an element in a sorted array, this function works + * just like cupsArrayAdd(). For unsorted arrays, the element is + * inserted at the beginning of the array. + */ + +int /* O - 0 on failure, 1 on success */ +cupsArrayInsert(cups_array_t *a, /* I - Array */ + void *e) /* I - Element */ +{ + int i; /* Looping var */ + + + DEBUG_printf(("cupsArrayInsert(a=%p, e=%p)\n", a, e)); + + /* + * Range check input... + */ + + if (!a || !e) + { + DEBUG_puts("cupsArrayInsert: returning 0"); + return (0); + } + + /* + * Inserting into a sorted array is the same as adding... + */ + + if (a->compare) + return (cupsArrayAdd(a, e)); + + /* + * Verify we have room for the new element... + */ + + if (a->num_elements >= a->alloc_elements) + { + /* + * Allocate additional elements; start with 16 elements, then + * double the size until 1024 elements, then add 1024 elements + * thereafter... + */ + + void **temp; /* New array elements */ + int count; /* New allocation count */ + + + if (a->alloc_elements == 0) + { + count = 16; + temp = malloc(count * sizeof(void *)); + } + else + { + if (a->alloc_elements < 1024) + count = a->alloc_elements * 2; + else + count = a->alloc_elements + 1024; + + temp = realloc(a->elements, count * sizeof(void *)); + } + + DEBUG_printf(("cupsArrayInsert: count=%d\n", count)); + + if (!temp) + { + DEBUG_puts("cupsAddInsert: allocation failed, returning 0"); + return (0); + } + + a->alloc_elements = count; + a->elements = temp; + } + + /* + * Insert the element... + */ + + memmove(a->elements + 1, a->elements, a->num_elements * sizeof(void *)); + + if (a->current >= 0) + a->current ++; + + for (i = 0; i < a->num_saved; i ++) + if (a->saved[i] >= 0) + a->saved[i] ++; + + a->elements[0] = e; + a->num_elements ++; + a->insert = 0; + +#ifdef DEBUG + for (i = 0; i < a->num_elements; i ++) + printf("cupsArrayInsert: a->elements[%d]=%p\n", i, a->elements[i]); +#endif /* DEBUG */ + + DEBUG_puts("cupsArrayInsert: returning 1"); + + return (1); +} + + /* * 'cupsArrayLast()' - Get the last element in the array. */ @@ -824,5 +930,5 @@ cups_find(cups_array_t *a, /* I - Array */ /* - * End of "$Id: array.c 4921 2006-01-12 21:26:26Z mike $". + * End of "$Id: array.c 4970 2006-01-24 14:05:45Z mike $". */ diff --git a/cups/array.h b/cups/array.h index 1043121e21..3c7509237f 100644 --- a/cups/array.h +++ b/cups/array.h @@ -1,5 +1,5 @@ /* - * "$Id: array.h 4921 2006-01-12 21:26:26Z mike $" + * "$Id: array.h 4970 2006-01-24 14:05:45Z mike $" * * Sorted array definitions for the Common UNIX Printing System (CUPS). * @@ -65,6 +65,7 @@ extern cups_array_t *cupsArrayDup(cups_array_t *a); extern void *cupsArrayFind(cups_array_t *a, void *e); extern void *cupsArrayFirst(cups_array_t *a); extern void *cupsArrayIndex(cups_array_t *a, int n); +extern int cupsArrayInsert(cups_array_t *a, void *e); extern void *cupsArrayLast(cups_array_t *a); extern cups_array_t *cupsArrayNew(cups_array_func_t f, void *d); extern void *cupsArrayNext(cups_array_t *a); @@ -79,5 +80,5 @@ extern int cupsArraySave(cups_array_t *a); #endif /* !_CUPS_ARRAY_H_ */ /* - * End of "$Id: array.h 4921 2006-01-12 21:26:26Z mike $". + * End of "$Id: array.h 4970 2006-01-24 14:05:45Z mike $". */ diff --git a/cups/backend.h b/cups/backend.h index 199780a053..a816b2f07d 100644 --- a/cups/backend.h +++ b/cups/backend.h @@ -1,5 +1,5 @@ /* - * "$Id: backend.h 4703 2005-09-26 19:33:58Z mike $" + * "$Id: backend.h 4973 2006-01-25 02:36:02Z mike $" * * Backend definitions for the Common UNIX Printing System (CUPS). * @@ -36,15 +36,15 @@ typedef enum cups_backend_e /**** Backend exit codes ****/ { CUPS_BACKEND_OK = 0, /* Job completed successfully */ CUPS_BACKEND_FAILED = 1, /* Job failed, use error-policy */ - CUPS_BACKEND_CANCEL = 2, /* Job failed, cancel job */ + CUPS_BACKEND_AUTH_REQUIRED = 2, /* Job failed, authentication required */ CUPS_BACKEND_HOLD = 3, /* Job failed, hold job */ CUPS_BACKEND_STOP = 4, /* Job failed, stop queue */ - CUPS_BACKEND_AUTH_REQUIRED = 5 /* Job failed, authentication required */ + CUPS_BACKEND_CANCEL = 5 /* Job failed, cancel job */ } cups_backend_t; #endif /* !_CUPS_BACKEND_H_ */ /* - * End of "$Id: backend.h 4703 2005-09-26 19:33:58Z mike $". + * End of "$Id: backend.h 4973 2006-01-25 02:36:02Z mike $". */ diff --git a/cups/cups.h b/cups/cups.h index 84a0f3793f..6263b82e66 100644 --- a/cups/cups.h +++ b/cups/cups.h @@ -1,5 +1,5 @@ /* - * "$Id: cups.h 4918 2006-01-12 05:14:40Z mike $" + * "$Id: cups.h 4973 2006-01-25 02:36:02Z mike $" * * API definitions for the Common UNIX Printing System (CUPS). * @@ -33,10 +33,12 @@ # include "ipp.h" # include "ppd.h" +# include "language.h" + /* * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get - * an error at compile-time. + * a warning at compile-time. */ # if defined(__GNUC__) && __GNUC__ > 2 @@ -223,6 +225,8 @@ extern void cupsEncodeOptions2(ipp_t *ipp, int num_options, cups_option_t *options, ipp_tag_t group_tag); extern const char *cupsLastErrorString(void); +extern char *cupsNotifySubject(cups_lang_t *lang, ipp_t *event); +extern char *cupsNotifyText(cups_lang_t *lang, ipp_t *event); extern cups_file_t *cupsTempFile2(char *filename, int len); @@ -233,5 +237,5 @@ extern cups_file_t *cupsTempFile2(char *filename, int len); #endif /* !_CUPS_CUPS_H_ */ /* - * End of "$Id: cups.h 4918 2006-01-12 05:14:40Z mike $". + * End of "$Id: cups.h 4973 2006-01-25 02:36:02Z mike $". */ diff --git a/cups/custom.c b/cups/custom.c new file mode 100644 index 0000000000..1d44826654 --- /dev/null +++ b/cups/custom.c @@ -0,0 +1,115 @@ +/* + * "$Id: custom.c 4938 2006-01-17 15:11:15Z mike $" + * + * PPD custom option routines for the Common UNIX Printing System (CUPS). + * + * Copyright 1997-2006 by Easy Software Products, all rights reserved. + * + * These coded instructions, statements, and computer programs are the + * property of Easy Software Products 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 missing or damaged please contact Easy Software Products + * at: + * + * Attn: CUPS Licensing Information + * Easy Software Products + * 44141 Airport View Drive, Suite 204 + * Hollywood, Maryland 20636 USA + * + * Voice: (301) 373-9600 + * EMail: cups-info@cups.org + * WWW: http://www.cups.org + * + * PostScript is a trademark of Adobe Systems, Inc. + * + * This code and any derivative of it may be used and distributed + * freely under the terms of the GNU General Public License when + * used with GNU Ghostscript or its derivatives. Use of the code + * (or any derivative of it) with software other than GNU + * GhostScript (or its derivatives) is governed by the CUPS license + * agreement. + * + * This file is subject to the Apple OS-Developed Software exception. + * + * Contents: + * + */ + +/* + * Include necessary headers. + */ + +#include "globals.h" +#include "debug.h" + + +/* + * 'ppdFindCustomOption()' - Find a custom option. + */ + +ppd_coption_t * /* O - Custom option or NULL */ +ppdFindCustomOption(ppd_file_t *ppd, /* I - PPD file */ + const char *keyword)/* I - Custom option name */ +{ + ppd_coption_t key; /* Custom option search key */ + + + if (!ppd) + return (NULL); + + strlcpy(key.keyword, keyword, sizeof(key.keyword)); + return ((ppd_coption_t *)cupsArrayFind(ppd->coptions, &key)); +} + + +/* + * 'ppdFindCustomParam()' - Find a parameter for a custom option. + */ + +ppd_cparam_t * /* O - Custom parameter or NULL */ +ppdFindCustomParam(ppd_coption_t *opt, /* I - Custom option */ + const char *name) /* I - Parameter name */ +{ + ppd_cparam_t key; /* Custom parameter search key */ + + + if (!opt) + return (NULL); + + strlcpy(key.name, name, sizeof(key.name)); + return ((ppd_cparam_t *)cupsArrayFind(opt->params, &key)); +} + + +/* + * 'ppdFirstCustomParam()' - Return the first parameter for a custom option. + */ + +ppd_cparam_t * /* O - Custom parameter or NULL */ +ppdFirstCustomParam(ppd_coption_t *opt) /* I - Custom option */ +{ + if (!opt) + return (NULL); + + return ((ppd_cparam_t *)cupsArrayFirst(opt->params)); +} + + +/* + * 'ppdNextCustomParam()' - Return the next parameter for a custom option. + */ + +ppd_cparam_t * /* O - Custom parameter or NULL */ +ppdNextCustomParam(ppd_coption_t *opt) /* I - Custom option */ +{ + if (!opt) + return (NULL); + + return ((ppd_cparam_t *)cupsArrayNext(opt->params)); +} + + +/* + * End of "$Id: custom.c 4938 2006-01-17 15:11:15Z mike $". + */ diff --git a/cups/dest.c b/cups/dest.c index 042e7b54bf..96db76308e 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -1,5 +1,5 @@ /* - * "$Id: dest.c 4918 2006-01-12 05:14:40Z mike $" + * "$Id: dest.c 4979 2006-01-25 17:47:43Z mike $" * * User-defined destination (and option) support for the Common UNIX * Printing System (CUPS). @@ -45,6 +45,10 @@ #include #include +#ifdef HAVE_NOTIFY_H +# include +#endif /* HAVE_NOTIFY_H */ + /* * Local functions... @@ -562,16 +566,21 @@ cupsSetDests2(http_t *http, /* I - HTTP connection */ } /* - * Free the temporary destinations... + * Free the temporary destinations and close the file... */ cupsFreeDests(num_temps, temps); + fclose(fp); + +#ifdef HAVE_NOTIFY_POST /* - * Close the file and return... + * Send a notification so that MacOS X applications can know about the + * change, too. */ - fclose(fp); + notify_post("com.apple.printerListChange"); +#endif /* HAVE_NOTIFY_POST */ return (0); } @@ -739,17 +748,35 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */ int num_dests, /* I - Number of destinations */ cups_dest_t **dests) /* IO - Destinations */ { + int i; /* Looping var */ cups_dest_t *dest; /* Current destination */ ipp_t *request, /* IPP Request */ *response; /* IPP Response */ ipp_attribute_t *attr; /* Current attribute */ - cups_lang_t *language; /* Default language */ - const char *name; /* printer-name attribute */ - char job_sheets[1024]; /* job-sheets option */ + int accepting, /* printer-is-accepting-jobs attribute */ + shared, /* printer-is-shared attribute */ + state, /* printer-state attribute */ + change_time, /* printer-state-change-time attribute */ + type; /* printer-type attribute */ + const char *info, /* printer-info attribute */ + *make_model, /* printer-make-and-model attribute */ + *name; /* printer-name attribute */ + char job_sheets[1024], /* job-sheets option */ + reasons[1024], /* printer-state-reasons attribute */ + *rptr, /* Pointer into reasons string */ + temp[255]; /* Temporary string for numbers */ static const char * const pattrs[] = /* Attributes we're interested in */ { + "job-sheets-default", + "printer-info", + "printer-is-accepting-jobs", + "printer-is-shared", + "printer-make-and-model", "printer-name", - "job-sheets-default" + "printer-state", + "printer-state-change-time", + "printer-state-reasons", + "printer-type" }; @@ -759,27 +786,18 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */ * * attributes-charset * attributes-natural-language + * requesting-user-name */ - request = ippNew(); - - request->request.op.operation_id = op; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - - cupsLangFree(language); + request = ippNewRequest(op); ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]), NULL, pattrs); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser()); + /* * Do the request and get back a response... */ @@ -802,17 +820,21 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */ * Pull the needed attributes from this job... */ - name = NULL; + accepting = 0; + change_time = 0; + info = NULL; + make_model = NULL; + name = NULL; + shared = 1; + state = IPP_PRINTER_IDLE; + type = CUPS_PRINTER_LOCAL; strcpy(job_sheets, ""); + strcpy(reasons, ""); while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) { - if (strcmp(attr->name, "printer-name") == 0 && - attr->value_tag == IPP_TAG_NAME) - name = attr->values[0].string.text; - - if (strcmp(attr->name, "job-sheets-default") == 0 && + if (!strcmp(attr->name, "job-sheets-default") && (attr->value_tag == IPP_TAG_KEYWORD || attr->value_tag == IPP_TAG_NAME)) { @@ -820,8 +842,46 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */ snprintf(job_sheets, sizeof(job_sheets), "%s,%s", attr->values[0].string.text, attr->values[1].string.text); else - strcpy(job_sheets, attr->values[0].string.text); + strlcpy(job_sheets, attr->values[0].string.text, + sizeof(job_sheets)); } + else if (!strcmp(attr->name, "printer-info") && + attr->value_tag == IPP_TAG_TEXT) + info = attr->values[0].string.text; + else if (!strcmp(attr->name, "printer-is-accepting-jobs") && + attr->value_tag == IPP_TAG_BOOLEAN) + accepting = attr->values[0].boolean; + else if (!strcmp(attr->name, "printer-is-shared") && + attr->value_tag == IPP_TAG_BOOLEAN) + shared = attr->values[0].boolean; + else if (!strcmp(attr->name, "printer-make-and-model") && + attr->value_tag == IPP_TAG_TEXT) + make_model = attr->values[0].string.text; + else if (!strcmp(attr->name, "printer-name") && + attr->value_tag == IPP_TAG_NAME) + name = attr->values[0].string.text; + else if (!strcmp(attr->name, "printer-state") && + attr->value_tag == IPP_TAG_ENUM) + state = attr->values[0].integer; + else if (!strcmp(attr->name, "printer-state-change-time") && + attr->value_tag == IPP_TAG_INTEGER) + change_time = attr->values[0].integer; + else if (!strcmp(attr->name, "printer-state-reasons") && + attr->value_tag == IPP_TAG_KEYWORD) + { + strlcpy(reasons, attr->values[0].string.text, sizeof(reasons)); + for (i = 1, rptr = reasons + strlen(reasons); + i < attr->num_values; + i ++) + { + snprintf(rptr, sizeof(reasons) - (rptr - reasons), ",%s", + attr->values[i].string.text); + rptr += strlen(rptr); + } + } + else if (!strcmp(attr->name, "printer-type") && + attr->value_tag == IPP_TAG_ENUM) + type = attr->values[0].integer; attr = attr->next; } @@ -841,10 +901,56 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */ num_dests = cupsAddDest(name, NULL, num_dests, dests); if ((dest = cupsGetDest(name, NULL, num_dests, *dests)) != NULL) + { if (job_sheets[0]) - dest->num_options = cupsAddOption("job-sheets", job_sheets, 0, + dest->num_options = cupsAddOption("job-sheets", job_sheets, + dest->num_options, + &(dest->options)); + + if (info) + dest->num_options = cupsAddOption("printer-info", info, + dest->num_options, + &(dest->options)); + + sprintf(temp, "%d", accepting); + dest->num_options = cupsAddOption("printer-is-accepting-jobs", temp, + dest->num_options, + &(dest->options)); + + sprintf(temp, "%d", shared); + dest->num_options = cupsAddOption("printer-is-shared", temp, + dest->num_options, + &(dest->options)); + + if (make_model) + dest->num_options = cupsAddOption("printer-make-and-model", + make_model, dest->num_options, &(dest->options)); + sprintf(temp, "%d", state); + dest->num_options = cupsAddOption("printer-state", temp, + dest->num_options, + &(dest->options)); + + if (change_time) + { + sprintf(temp, "%d", change_time); + dest->num_options = cupsAddOption("printer-state-change-time", temp, + dest->num_options, + &(dest->options)); + } + + if (reasons[0]) + dest->num_options = cupsAddOption("printer-state-reasons", reasons, + dest->num_options, + &(dest->options)); + + sprintf(temp, "%d", type); + dest->num_options = cupsAddOption("printer-type", temp, + dest->num_options, + &(dest->options)); + } + if (attr == NULL) break; } @@ -861,5 +967,5 @@ cups_get_sdests(http_t *http, /* I - HTTP connection */ /* - * End of "$Id: dest.c 4918 2006-01-12 05:14:40Z mike $". + * End of "$Id: dest.c 4979 2006-01-25 17:47:43Z mike $". */ diff --git a/cups/emit.c b/cups/emit.c index 88ebc226c4..7fa67dd0f8 100644 --- a/cups/emit.c +++ b/cups/emit.c @@ -1,5 +1,5 @@ /* - * "$Id: emit.c 4785 2005-10-13 19:39:05Z mike $" + * "$Id: emit.c 4980 2006-01-25 19:57:45Z mike $" * * PPD code emission routines for the Common UNIX Printing System (CUPS). * @@ -27,14 +27,17 @@ * * Contents: * - * ppdCollect() - Collect all marked options that reside in the - * specified section. - * ppdEmit() - Emit code for marked options to a file. - * ppdEmitFd() - Emit code for marked options to a file. - * ppdEmitJCL() - Emit code for JCL options to a file. - * ppdEmitJCLEnd() - Emit JCLEnd code to a file. - * ppd_handle_media() - Handle media selection... - * ppd_sort() - Sort options by ordering numbers... + * ppdCollect() - Collect all marked options that reside in the + * specified section. + * ppdCollect2() - Collect all marked options that reside in the + * specified section and minimum order. + * ppdEmit() - Emit code for marked options to a file. + * ppdEmitAfterOrder() - Emit a subset of the code for marked options to a file. + * ppdEmitFd() - Emit code for marked options to a file. + * ppdEmitJCL() - Emit code for JCL options to a file. + * ppdEmitJCLEnd() - Emit JCLEnd code to a file. + * ppd_handle_media() - Handle media selection... + * ppd_sort() - Sort options by ordering numbers... */ /* @@ -78,6 +81,23 @@ int /* O - Number of options marked */ ppdCollect(ppd_file_t *ppd, /* I - PPD file data */ ppd_section_t section, /* I - Section to collect */ ppd_choice_t ***choices) /* O - Pointers to choices */ +{ + return (ppdCollect2(ppd, section, 0.0, choices)); +} + + +/* + * 'ppdCollect2()' - Collect all marked options that reside in the + * specified section and minimum order. + * + * @since CUPS 1.2@ + */ + +int /* O - Number of options marked */ +ppdCollect2(ppd_file_t *ppd, /* I - PPD file data */ + ppd_section_t section, /* I - Section to collect */ + float min_order, /* I - Minimum OrderDependency value */ + ppd_choice_t ***choices) /* O - Pointers to choices */ { int i, j, k, m; /* Looping vars */ ppd_group_t *g, /* Current group */ @@ -105,7 +125,7 @@ ppdCollect(ppd_file_t *ppd, /* I - PPD file data */ for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++) { for (j = g->num_options, o = g->options; j > 0; j --, o ++) - if (o->section == section) + if (o->section == section && o->order >= min_order) for (k = o->num_choices, c = o->choices; k > 0; k --, c ++) if (c->marked && count < 1000) { @@ -115,7 +135,7 @@ ppdCollect(ppd_file_t *ppd, /* I - PPD file data */ for (j = g->num_subgroups, sg = g->subgroups; j > 0; j --, sg ++) for (k = sg->num_options, o = sg->options; k > 0; k --, o ++) - if (o->section == section) + if (o->section == section && o->order >= min_order) for (m = o->num_choices, c = o->choices; m > 0; m --, c ++) if (c->marked && count < 1000) { @@ -159,6 +179,29 @@ int /* O - 0 on success, -1 on failure */ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */ FILE *fp, /* I - File to write to */ ppd_section_t section) /* I - Section to write */ +{ + return (ppdEmitAfterOrder(ppd, fp, section, 0, 0.0)); +} + + +/* + * 'ppdEmitAfterOrder()' - Emit a subset of the code for marked options to a file. + * + * When "limit" is non-zero, this function only emits options whose + * OrderDependency value is greater than or equal to "min_order". + * + * When "limit" is zero, this function is identical to ppdEmit(). + * + * @since CUPS 1.2@ + */ + +int /* O - 0 on success, -1 on failure */ +ppdEmitAfterOrder( + ppd_file_t *ppd, /* I - PPD file record */ + FILE *fp, /* I - File to write to */ + ppd_section_t section, /* I - Section to write */ + int limit, /* I - Non-zero to use min_order, 0 to include all */ + float min_order) /* I - Lowest order dependency to include */ { int i, /* Looping var */ count; /* Number of choices */ @@ -176,7 +219,7 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */ * Collect the options we need to emit and emit them! */ - if ((count = ppdCollect(ppd, section, &choices)) == 0) + if ((count = ppdCollect2(ppd, section, min_order, &choices)) == 0) return (0); for (i = 0; i < count; i ++) @@ -197,9 +240,9 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */ * Send DSC comments with option... */ - if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 || - strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) && - strcasecmp(choices[i]->choice, "Custom") == 0) + if ((!strcasecmp(choices[i]->option->keyword, "PageSize") || + !strcasecmp(choices[i]->option->keyword, "PageRegion")) && + !strcasecmp(choices[i]->choice, "Custom")) { /* * Variable size; write out standard size options, using the @@ -208,15 +251,16 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */ ppd_attr_t *attr; /* PPD attribute */ int pos, /* Position of custom value */ - values[5], /* Values for custom command */ orientation; /* Orientation to use */ - + float values[5]; /* Values for custom command */ + int isfloat[5]; /* Whether each value is float or int */ fputs("%%BeginFeature: *CustomPageSize True\n", fp); size = ppdPageSize(ppd, "Custom"); memset(values, 0, sizeof(values)); + memset(isfloat, 0, sizeof(isfloat)); if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Width")) != NULL) { @@ -228,7 +272,8 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */ else pos = 0; - values[pos] = (int)size->width; + values[pos] = size->width; + isfloat[pos] = 1; if ((attr = ppdFindAttr(ppd, "ParamCustomPageSize", "Height")) != NULL) { @@ -240,7 +285,8 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */ else pos = 1; - values[pos] = (int)size->length; + values[pos] = size->length; + isfloat[pos] = 1; /* * According to the Adobe PPD specification, an orientation of 1 @@ -292,8 +338,11 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */ values[pos] = orientation; - fprintf(fp, "%d %d %d %d %d\n", values[0], values[1], - values[2], values[3], values[4]); + for (pos = 0; pos < 5; pos ++) + if (isfloat[pos]) + fprintf(fp, "%.2f\n", values[pos]); + else + fprintf(fp, "%.0f\n", values[pos]); if (choices[i]->code == NULL) { @@ -306,8 +355,75 @@ ppdEmit(ppd_file_t *ppd, /* I - PPD file record */ fputs(ppd_custom_code, fp); } } + else if (!strcasecmp(choices[i]->choice, "Custom")) + { + /* + * Custom option... + */ + + ppd_coption_t *coption; /* Custom option */ + ppd_cparam_t *cparam; /* Custom parameter */ + const char *s; /* Pointer into string value */ + + + /* + * TODO: Support custom options with more than 1 parameter... + */ + + if ((coption = ppdFindCustomOption(ppd, choices[i]->option->keyword)) + != NULL && + (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params)) != NULL) + { + if (fprintf(fp, "%%%%BeginFeature: *Custom%s True\n", + coption->keyword) < 0) + { + free(choices); + return (-1); + } + + switch (cparam->type) + { + case PPD_CUSTOM_CURVE : + case PPD_CUSTOM_INVCURVE : + case PPD_CUSTOM_POINTS : + case PPD_CUSTOM_REAL : + if (fprintf(fp, "%f\n", cparam->current.custom_real) < 0) + { + free(choices); + return (-1); + } + break; + + case PPD_CUSTOM_INT : + if (fprintf(fp, "%d\n", cparam->current.custom_int) < 0) + { + free(choices); + return (-1); + } + break; + + case PPD_CUSTOM_PASSCODE : + case PPD_CUSTOM_PASSWORD : + case PPD_CUSTOM_STRING : + putc('(', fp); + + for (s = cparam->current.custom_string; *s; s ++) + if (*s < ' ' || *s == '(' || *s == ')' || *s >= 127) + fprintf(fp, "\\%03o", *s & 255); + else + putc(*s, fp); + + if (fputs(")\n", fp) < 0) + { + free(choices); + return (-1); + } + break; + } + } + } else if (fprintf(fp, "%%%%BeginFeature: *%s %s\n", - ((ppd_option_t *)choices[i]->option)->keyword, + choices[i]->option->keyword, choices[i]->choice) < 0) { free(choices); @@ -397,9 +513,9 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */ * Send DSC comments with option... */ - if ((strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageSize") == 0 || - strcasecmp(((ppd_option_t *)choices[i]->option)->keyword, "PageRegion") == 0) && - strcasecmp(choices[i]->choice, "Custom") == 0) + if ((!strcasecmp(choices[i]->option->keyword, "PageSize") || + !strcasecmp(choices[i]->option->keyword, "PageRegion")) && + !strcasecmp(choices[i]->choice, "Custom")) { custom_size = 1; @@ -410,8 +526,7 @@ ppdEmitFd(ppd_file_t *ppd, /* I - PPD file record */ custom_size = 0; snprintf(buf, sizeof(buf), "%%%%BeginFeature: *%s %s\n", - ((ppd_option_t *)choices[i]->option)->keyword, - choices[i]->choice); + choices[i]->option->keyword, choices[i]->choice); } if (write(fd, buf, strlen(buf)) < 1) @@ -748,10 +863,9 @@ ppd_handle_media(ppd_file_t *ppd) if (!rpr) rpr = ppdFindAttr(ppd, "RequiresPageRegion", "All"); - if (strcasecmp(size->name, "Custom") == 0 || - (manual_feed == NULL && input_slot == NULL) || - (manual_feed != NULL && strcasecmp(manual_feed->choice, "False") == 0) || - (input_slot != NULL && (input_slot->code == NULL || !input_slot->code[0]))) + if (!strcasecmp(size->name, "Custom") || (!manual_feed && !input_slot) || + !((manual_feed && !strcasecmp(manual_feed->choice, "True")) || + (input_slot && input_slot->code && input_slot->code[0]))) { /* * Manual feed was not selected and/or the input slot selection does @@ -802,9 +916,9 @@ static int /* O - -1 if c1 < c2, 0 if equal, 1 otherwise */ ppd_sort(ppd_choice_t **c1, /* I - First choice */ ppd_choice_t **c2) /* I - Second choice */ { - if (((ppd_option_t *)(*c1)->option)->order < ((ppd_option_t *)(*c2)->option)->order) + if ((*c1)->option->order < (*c2)->option->order) return (-1); - else if (((ppd_option_t *)(*c1)->option)->order > ((ppd_option_t *)(*c2)->option)->order) + else if ((*c1)->option->order > (*c2)->option->order) return (1); else return (0); @@ -812,5 +926,5 @@ ppd_sort(ppd_choice_t **c1, /* I - First choice */ /* - * End of "$Id: emit.c 4785 2005-10-13 19:39:05Z mike $". + * End of "$Id: emit.c 4980 2006-01-25 19:57:45Z mike $". */ diff --git a/cups/encode.c b/cups/encode.c index be1aab28de..af16f54816 100644 --- a/cups/encode.c +++ b/cups/encode.c @@ -1,9 +1,9 @@ /* - * "$Id: encode.c 4918 2006-01-12 05:14:40Z mike $" + * "$Id: encode.c 4977 2006-01-25 15:52:30Z mike $" * * Option encoding routines for the Common UNIX Printing System (CUPS). * - * Copyright 1997-2005 by Easy Software Products. + * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the * property of Easy Software Products and are protected by Federal @@ -25,9 +25,10 @@ * * Contents: * - * cupsEncodeOptions() - Encode printer options into IPP attributes. - * cupsEncodeOptions2() - Encode printer options into IPP attributes for - * a group. + * cupsEncodeOptions() - Encode printer options into IPP attributes. + * cupsEncodeOptions2() - Encode printer options into IPP attributes for + * a group. + * compare_ipp_options() - Compare two IPP options. */ /* @@ -35,6 +36,7 @@ */ #include "cups.h" +#include "ipp-private.h" #include #include #include "string.h" @@ -43,6 +45,8 @@ /* * Local list of option names and the value tags they should use... + * + * **** THIS LIST MUST BE SORTED **** */ typedef struct @@ -89,9 +93,19 @@ static const _ipp_option_t ipp_options[] = { "penwidth", IPP_TAG_INTEGER, IPP_TAG_JOB }, { "ppi", IPP_TAG_INTEGER, IPP_TAG_JOB }, { "prettyprint", IPP_TAG_BOOLEAN, IPP_TAG_JOB }, + { "printer-info", IPP_TAG_TEXT, IPP_TAG_PRINTER }, + { "printer-is-accepting-jobs",IPP_TAG_BOOLEAN, IPP_TAG_PRINTER }, + { "printer-is-shared", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER }, + { "printer-make-and-model", IPP_TAG_TEXT, IPP_TAG_PRINTER }, + { "printer-more-info", IPP_TAG_URI, IPP_TAG_PRINTER }, { "printer-resolution", IPP_TAG_RESOLUTION, IPP_TAG_JOB }, + { "printer-state", IPP_TAG_ENUM, IPP_TAG_PRINTER }, + { "printer-state-change-time",IPP_TAG_INTEGER, IPP_TAG_PRINTER }, + { "printer-state-reasons", IPP_TAG_KEYWORD, IPP_TAG_PRINTER }, + { "printer-type", IPP_TAG_ENUM, IPP_TAG_PRINTER }, { "printer-uri", IPP_TAG_URI, IPP_TAG_OPERATION }, { "print-quality", IPP_TAG_ENUM, IPP_TAG_JOB }, + { "queued-job-count", IPP_TAG_INTEGER, IPP_TAG_PRINTER }, { "raw", IPP_TAG_MIMETYPE, IPP_TAG_OPERATION }, { "saturation", IPP_TAG_INTEGER, IPP_TAG_JOB }, { "scaling", IPP_TAG_INTEGER, IPP_TAG_JOB }, @@ -100,6 +114,13 @@ static const _ipp_option_t ipp_options[] = }; +/* + * Local functions... + */ + +static int compare_ipp_options(_ipp_option_t *a, _ipp_option_t *b); + + /* * 'cupsEncodeOptions()' - Encode printer options into IPP attributes. * @@ -189,6 +210,10 @@ cupsEncodeOptions2( for (i = 0; i < num_options; i ++) { + _ipp_option_t key, /* Search key */ + *match; /* Matching attribute */ + + /* * Skip document format options that are handled above... */ @@ -202,16 +227,21 @@ cupsEncodeOptions2( * Figure out the proper value and group tags for this option... */ - for (j = 0; j < (int)(sizeof(ipp_options) / sizeof(ipp_options[0])); j ++) - if (!strcasecmp(options[i].name, ipp_options[j].name)) - break; + key.name = options[i].name; + match = (_ipp_option_t *)bsearch(&key, ipp_options, + sizeof(ipp_options) / + sizeof(ipp_options[0]), + sizeof(ipp_options[0]), + (int (*)(const void *, + const void *)) + compare_ipp_options); - if (j < (int)(sizeof(ipp_options) / sizeof(ipp_options[0]))) + if (match) { - if (ipp_options[j].group_tag != group_tag) + if (match->group_tag != group_tag) continue; - value_tag = ipp_options[j].value_tag; + value_tag = match->value_tag; } else if (group_tag != IPP_TAG_JOB) continue; @@ -467,5 +497,17 @@ cupsEncodeOptions2( /* - * End of "$Id: encode.c 4918 2006-01-12 05:14:40Z mike $". + * 'compare_ipp_options()' - Compare two IPP options. + */ + +static int /* O - Result of comparison */ +compare_ipp_options(_ipp_option_t *a, /* I - First option */ + _ipp_option_t *b) /* I - Second option */ +{ + return (strcmp(a->name, b->name)); +} + + +/* + * End of "$Id: encode.c 4977 2006-01-25 15:52:30Z mike $". */ diff --git a/cups/extended.c b/cups/extended.c deleted file mode 100644 index 6bc5cfae7d..0000000000 --- a/cups/extended.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * "$Id: extended.c 4494 2005-02-18 02:18:11Z mike $" - * - * Extended option routines for the Common UNIX Printing System (CUPS). - * - * Copyright 1997-2005 by Easy Software Products, all rights reserved. - * - * These coded instructions, statements, and computer programs are the - * property of Easy Software Products 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 missing or damaged please contact Easy Software Products - * at: - * - * Attn: CUPS Licensing Information - * Easy Software Products - * 44141 Airport View Drive, Suite 204 - * Hollywood, Maryland 20636 USA - * - * Voice: (301) 373-9600 - * EMail: cups-info@cups.org - * WWW: http://www.cups.org - * - * PostScript is a trademark of Adobe Systems, Inc. - * - * This file is subject to the Apple OS-Developed Software exception. - * - * Contents: - * - * ppdFindExtOption() - Return a pointer to the extended option. - * ppdMarkCurve() - Mark an extended curve option. - * ppdMarkGamma() - Mark an extended gamma option. - * ppdMarkInteger() - Mark an extended integer option. - * ppdMarkIntegerArray() - Mark an extended integer array option. - * ppdMarkReal() - Mark an extended real option. - * ppdMarkRealArray() - Mark an extended real array option. - * ppdMarkText() - Mark an extended text option. - */ - -/* - * Include necessary headers... - */ - -#include "ppd.h" -#include "string.h" -#include "debug.h" - - -/* - * Local functions... - */ - -static void ppd_unmark_choices(ppd_option_t *option); - - -/* - * 'ppdFindExtOption()' - Return a pointer to the extended option. - */ - -ppd_ext_option_t * /* O - Pointer to option or NULL */ -ppdFindExtOption(ppd_file_t *ppd, /* I - PPD file data */ - const char *option) /* I - Option/Keyword name */ -{ - int i; /* Looping var */ - ppd_ext_option_t **o; /* Pointer to option */ - - - if (ppd == NULL || option == NULL) - return (NULL); - - for (i = ppd->num_extended, o = ppd->extended; i > 0; i --, o ++) - if (strcasecmp(o[0]->keyword, option) == 0) - return (*o); - - return (NULL); -} - - -/* - * 'ppdFindExtParam()' - Find an extended parameter. - */ - -ppd_ext_param_t * /* O - Parameter or NULL */ -ppdFindExtParam(ppd_ext_option_t *opt, /* I - Option */ - const char *param)/* I - Parameter name */ -{ - int i; /* Looping var */ - ppd_ext_param_t **p; /* Pointer to parameter */ - - - if (opt == NULL || param == NULL) - return (NULL); - - for (i = opt->num_params, p = opt->params; i > 0; i --, p ++) - if (strcasecmp(p[0]->keyword, param) == 0) - return (*p); - - return (NULL); -} - - -/* - * 'ppdMarkCurve()' - Mark an extended curve option. - */ - -int /* O - Number of conflicts */ -ppdMarkCurve(ppd_file_t *ppd, /* I - PPD file */ - const char *keyword, /* I - Option name */ - const char *param, /* I - Parameter name */ - float low, /* I - Lower (start) value */ - float high, /* I - Upper (end) value */ - float gvalue) /* I - Gamma value for range */ -{ - ppd_ext_option_t *o; /* Extended option */ - ppd_ext_param_t *p; /* Extended parameter */ - - - if ((o = ppdFindExtOption(ppd, keyword)) == NULL) - return (-1); - - if ((p = ppdFindExtParam(o, param)) == NULL) - return (-1); - - ppd_unmark_choices(o->option); - - return (ppdConflicts(ppd)); -} - - -/* - * 'ppdMarkGamma()' - Mark an extended gamma option. - */ - -int /* O - Number of conflicts */ -ppdMarkGamma(ppd_file_t *ppd, /* I - PPD file */ - const char *keyword, /* I - Option name */ - const char *param, /* I - Parameter name */ - float gvalue) /* I - Gamma value */ -{ - ppd_ext_option_t *o; /* Extended option */ - ppd_ext_param_t *p; /* Extended parameter */ - - - if ((o = ppdFindExtOption(ppd, keyword)) == NULL) - return (-1); - - if ((p = ppdFindExtParam(o, param)) == NULL) - return (-1); - - ppd_unmark_choices(o->option); - - return (ppdConflicts(ppd)); -} - - -/* - * 'ppdMarkInteger()' - Mark an extended integer option. - */ - -int /* O - Number of conflicts */ -ppdMarkInteger(ppd_file_t *ppd, /* I - PPD file */ - const char *keyword, /* I - Option name */ - const char *param, /* I - Parameter name */ - int value) /* I - Option value */ -{ - ppd_ext_option_t *o; /* Extended option */ - ppd_ext_param_t *p; /* Extended parameter */ - - - if ((o = ppdFindExtOption(ppd, keyword)) == NULL) - return (-1); - - if ((p = ppdFindExtParam(o, param)) == NULL) - return (-1); - - ppd_unmark_choices(o->option); - - return (ppdConflicts(ppd)); -} - - -/* - * 'ppdMarkIntegerArray()' - Mark an extended integer array option. - */ - -int /* O - Number of conflicts */ -ppdMarkIntegerArray(ppd_file_t *ppd, /* I - PPD file */ - const char *keyword,/* I - Option name */ - const char *param, /* I - Parameter name */ - int num_values, - /* I - Number of values */ - const int *values) /* I - Values */ -{ - ppd_ext_option_t *o; /* Extended option */ - ppd_ext_param_t *p; /* Extended parameter */ - - - if ((o = ppdFindExtOption(ppd, keyword)) == NULL) - return (-1); - - if ((p = ppdFindExtParam(o, param)) == NULL) - return (-1); - - ppd_unmark_choices(o->option); - - return (ppdConflicts(ppd)); -} - - -/* - * 'ppdMarkReal()' - Mark an extended real option. - */ - -int /* O - Number of conflicts */ -ppdMarkReal(ppd_file_t *ppd, /* I - PPD file */ - const char *keyword, /* I - Option name */ - const char *param, /* I - Parameter name */ - float value) /* I - Option value */ -{ - ppd_ext_option_t *o; /* Extended option */ - ppd_ext_param_t *p; /* Extended parameter */ - - - if ((o = ppdFindExtOption(ppd, keyword)) == NULL) - return (-1); - - if ((p = ppdFindExtParam(o, param)) == NULL) - return (-1); - - ppd_unmark_choices(o->option); - - return (ppdConflicts(ppd)); -} - - -/* - * 'ppdMarkRealArray()' - Mark an extended real array option. - */ - -int /* O - Number of conflicts */ -ppdMarkRealArray(ppd_file_t *ppd, /* I - PPD file */ - const char *keyword, /* I - Option name */ - const char *param, /* I - Parameter name */ - int num_values,/* I - Number of values */ - const float *values) /* I - Values */ -{ - ppd_ext_option_t *o; /* Extended option */ - ppd_ext_param_t *p; /* Extended parameter */ - - - if ((o = ppdFindExtOption(ppd, keyword)) == NULL) - return (-1); - - if ((p = ppdFindExtParam(o, param)) == NULL) - return (-1); - - ppd_unmark_choices(o->option); - - return (ppdConflicts(ppd)); -} - - -/* - * 'ppdMarkText()' - Mark an extended text option. - */ - -int /* O - Number of conflicts */ -ppdMarkText(ppd_file_t *ppd, /* I - PPD file */ - const char *keyword, /* I - Option name */ - const char *param, /* I - Parameter name */ - const char *value) /* I - Option value */ -{ - ppd_ext_option_t *o; /* Extended option */ - ppd_ext_param_t *p; /* Extended parameter */ - - - if ((o = ppdFindExtOption(ppd, keyword)) == NULL) - return (-1); - - if ((p = ppdFindExtParam(o, param)) == NULL) - return (-1); - - ppd_unmark_choices(o->option); - - return (ppdConflicts(ppd)); -} - - -/* - * 'ppd_unmark_choices()' - Unmark all "canned" choices. - */ - -static void -ppd_unmark_choices(ppd_option_t *option)/* I - Option choice */ -{ - int i; /* Looping var */ - ppd_choice_t *c; /* Current choice */ - - - for (i = option->num_choices, c = option->choices; i > 0; i --, c++) - c->marked = 0; -} - - -/* - * End of "$Id: extended.c 4494 2005-02-18 02:18:11Z mike $". - */ diff --git a/cups/file.c b/cups/file.c index 05c5530317..daad1c3725 100644 --- a/cups/file.c +++ b/cups/file.c @@ -1,5 +1,5 @@ /* - * "$Id: file.c 4844 2005-11-21 17:37:57Z mike $" + * "$Id: file.c 4983 2006-01-25 21:53:43Z mike $" * * File functions for the Common UNIX Printing System (CUPS). * @@ -31,6 +31,7 @@ * cupsFileClose() - Close a CUPS file. * cupsFileCompression() - Return whether a file is compressed. * cupsFileEOF() - Return the end-of-file status. + * cupsFileFind() - Find a file using the specified path. * cupsFileFlush() - Flush pending output. * cupsFileGetChar() - Get a single character from a file. * cupsFileGetConf() - Get a line from a configuration file... @@ -99,14 +100,14 @@ struct _cups_file_s /**** CUPS file structure... ****/ char mode, /* Mode ('r' or 'w') */ compressed, /* Compression used? */ eof, /* End of file? */ - buf[2048], /* Buffer */ + buf[4096], /* Buffer */ *ptr, /* Pointer into buffer */ *end; /* End of buffer data */ off_t pos; /* File position for start of buffer */ #ifdef HAVE_LIBZ z_stream stream; /* (De)compression stream */ - Bytef cbuf[1024]; /* (De)compression buffer */ + Bytef cbuf[4096]; /* (De)compression buffer */ uLong crc; /* (De)compression CRC */ #endif /* HAVE_LIBZ */ }; @@ -271,6 +272,91 @@ cupsFileEOF(cups_file_t *fp) /* I - CUPS file */ } +/* + * 'cupsFileFind()' - Find a file using the specified path. + * + * This function allows the paths in the path string to be separated by + * colons (UNIX standard) or semicolons (Windows standard) and stores the + * result in the buffer supplied. If the file cannot be found in any of + * the supplied paths, NULL is returned. A NULL path only matches the + * current directory. + */ + +const char * /* O - Full path to file or NULL */ +cupsFileFind(const char *filename, /* I - File to find */ + const char *path, /* I - Colon/semicolon-separated path */ + char *buffer, /* I - Filename buffer */ + int bufsize) /* I - Size of filename buffer */ +{ + char *bufptr, /* Current position in buffer */ + *bufend; /* End of buffer */ + + + /* + * Range check input... + */ + + if (!filename || !buffer || bufsize < 2) + return (NULL); + + if (!path) + { + /* + * No path, so check current directory... + */ + + if (!access(filename, 0)) + { + strlcpy(buffer, filename, bufsize); + return (buffer); + } + else + return (NULL); + } + + /* + * Now check each path and return the first match... + */ + + bufend = buffer + bufsize - 1; + bufptr = buffer; + + while (*path) + { + if (*path == ';' || *path == ':') + { + if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend) + *bufptr++ = '/'; + + strlcpy(bufptr, filename, bufend - bufptr); + + if (!access(buffer, 0)) + return (buffer); + + bufptr = buffer; + } + else if (bufptr < bufend) + *bufptr++ = *path; + + path ++; + } + + /* + * Check the last path... + */ + + if (bufptr > buffer && bufptr[-1] != '/' && bufptr < bufend) + *bufptr++ = '/'; + + strlcpy(bufptr, filename, bufend - bufptr); + + if (!access(buffer, 0)) + return (buffer); + else + return (NULL); +} + + /* * 'cupsFileFlush()' - Flush pending output. */ @@ -1325,7 +1411,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */ * file... */ - if ((bytes = cups_read(fp, (char *)fp->cbuf, sizeof(fp->cbuf))) < 0) + if ((bytes = cups_read(fp, (char *)fp->buf, sizeof(fp->buf))) < 0) { /* * Can't read from file! @@ -1334,15 +1420,14 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */ return (-1); } - if (bytes < 10 || fp->cbuf[0] != 0x1f || fp->cbuf[1] != 0x8b || - fp->cbuf[2] != 8 || (fp->cbuf[3] & 0xe0) != 0) + if (bytes < 10 || fp->buf[0] != 0x1f || + (unsigned char)fp->buf[1] != 0x8b || + fp->buf[2] != 8 || (fp->buf[3] & 0xe0) != 0) { /* * Not a gzip'd file! */ - memcpy(fp->buf, fp->cbuf, bytes); - fp->ptr = fp->buf; fp->end = fp->buf + bytes; @@ -1353,10 +1438,10 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */ * Parse header junk: extra data, original name, and comment... */ - ptr = (unsigned char *)fp->cbuf + 10; - end = (unsigned char *)fp->cbuf + bytes; + ptr = (unsigned char *)fp->buf + 10; + end = (unsigned char *)fp->buf + bytes; - if (fp->cbuf[3] & 0x04) + if (fp->buf[3] & 0x04) { /* * Skip extra data... @@ -1384,7 +1469,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */ } } - if (fp->cbuf[3] & 0x08) + if (fp->buf[3] & 0x08) { /* * Skip original name data... @@ -1405,7 +1490,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */ } } - if (fp->cbuf[3] & 0x10) + if (fp->buf[3] & 0x10) { /* * Skip comment data... @@ -1426,7 +1511,7 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */ } } - if (fp->cbuf[3] & 0x02) + if (fp->buf[3] & 0x02) { /* * Skip header CRC data... @@ -1444,6 +1529,13 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */ } } + /* + * Copy the flate-compressed data to the compression buffer... + */ + + if ((bytes = end - ptr) > 0) + memcpy(fp->cbuf, ptr, bytes); + /* * Setup the decompressor data... */ @@ -1451,9 +1543,9 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */ fp->stream.zalloc = (alloc_func)0; fp->stream.zfree = (free_func)0; fp->stream.opaque = (voidpf)0; - fp->stream.next_in = (Bytef *)ptr; + fp->stream.next_in = (Bytef *)fp->cbuf; fp->stream.next_out = NULL; - fp->stream.avail_in = end - ptr; + fp->stream.avail_in = bytes; fp->stream.avail_out = 0; fp->crc = crc32(0L, Z_NULL, 0); @@ -1509,29 +1601,30 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */ */ fp->eof = 1; - return (-1); } + else + { + tcrc = (((((trailer[3] << 8) | trailer[2]) << 8) | trailer[1]) << 8) | + trailer[0]; - tcrc = (((((trailer[3] << 8) | trailer[2]) << 8) | trailer[1]) << 8) | - trailer[0]; + if (tcrc != fp->crc) + { + /* + * Bad CRC, mark end-of-file... + */ + + fp->eof = 1; + + return (-1); + } - if (tcrc != fp->crc) - { /* - * Bad CRC, mark end-of-file... + * Otherwise, reset the compressed flag so that we re-read the + * file header... */ - fp->eof = 1; - return (-1); + fp->compressed = 0; } - - /* - * Otherwise, reset the current pointer so that we re-read the - * file header... - */ - - fp->ptr = NULL; - continue; } bytes = sizeof(fp->buf) - fp->stream.avail_out; @@ -1543,7 +1636,8 @@ cups_fill(cups_file_t *fp) /* I - CUPS file */ fp->ptr = fp->buf; fp->end = fp->buf + bytes; - return (bytes); + if (bytes) + return (bytes); } } #endif /* HAVE_LIBZ */ @@ -1676,5 +1770,5 @@ cups_write(cups_file_t *fp, /* I - CUPS file */ /* - * End of "$Id: file.c 4844 2005-11-21 17:37:57Z mike $". + * End of "$Id: file.c 4983 2006-01-25 21:53:43Z mike $". */ diff --git a/cups/file.h b/cups/file.h index c7de9ef0f0..fa9088c15a 100644 --- a/cups/file.h +++ b/cups/file.h @@ -1,5 +1,5 @@ /* - * "$Id: file.h 4857 2005-11-30 19:25:17Z mike $" + * "$Id: file.h 4933 2006-01-16 00:26:57Z mike $" * * Public file definitions for the Common UNIX Printing System (CUPS). * @@ -74,6 +74,8 @@ typedef struct _cups_file_s cups_file_t;/**** CUPS file type ****/ extern int cupsFileClose(cups_file_t *fp); extern int cupsFileCompression(cups_file_t *fp); extern int cupsFileEOF(cups_file_t *fp); +extern const char *cupsFileFind(const char *filename, const char *path, + char *buffer, int bufsize); extern int cupsFileFlush(cups_file_t *fp); extern int cupsFileGetChar(cups_file_t *fp); extern char *cupsFileGetConf(cups_file_t *fp, char *buf, size_t buflen, @@ -101,5 +103,5 @@ extern ssize_t cupsFileWrite(cups_file_t *fp, const char *buf, size_t bytes); #endif /* !_CUPS_FILE_H_ */ /* - * End of "$Id: file.h 4857 2005-11-30 19:25:17Z mike $". + * End of "$Id: file.h 4933 2006-01-16 00:26:57Z mike $". */ diff --git a/cups/getputfile.c b/cups/getputfile.c index 8a5dc93309..82c9bdf289 100644 --- a/cups/getputfile.c +++ b/cups/getputfile.c @@ -1,5 +1,5 @@ /* - * "$Id: getputfile.c 4918 2006-01-12 05:14:40Z mike $" + * "$Id: getputfile.c 4984 2006-01-25 21:55:36Z mike $" * * Get/put file functions for the Common UNIX Printing System (CUPS). * @@ -125,7 +125,11 @@ cupsGetFd(http_t *http, /* I - HTTP connection to server */ if (cupsDoAuthentication(http, "GET", resource)) break; - httpReconnect(http); + if (httpReconnect(http)) + { + status = HTTP_ERROR; + break; + } continue; } @@ -136,7 +140,11 @@ cupsGetFd(http_t *http, /* I - HTTP connection to server */ httpFlush(http); /* Reconnect... */ - httpReconnect(http); + if (httpReconnect(http)) + { + status = HTTP_ERROR; + break; + } /* Upgrade with encryption... */ httpEncryption(http, HTTP_ENCRYPT_REQUIRED); @@ -340,7 +348,11 @@ cupsPutFd(http_t *http, /* I - HTTP connection to server */ if (cupsDoAuthentication(http, "PUT", resource)) break; - httpReconnect(http); + if (httpReconnect(http)) + { + status = HTTP_ERROR; + break; + } continue; } @@ -351,7 +363,11 @@ cupsPutFd(http_t *http, /* I - HTTP connection to server */ httpFlush(http); /* Reconnect... */ - httpReconnect(http); + if (httpReconnect(http)) + { + status = HTTP_ERROR; + break; + } /* Upgrade with encryption... */ httpEncryption(http, HTTP_ENCRYPT_REQUIRED); @@ -431,5 +447,5 @@ cupsPutFile(http_t *http, /* I - HTTP connection to server */ /* - * End of "$Id: getputfile.c 4918 2006-01-12 05:14:40Z mike $". + * End of "$Id: getputfile.c 4984 2006-01-25 21:55:36Z mike $". */ diff --git a/cups/globals.c b/cups/globals.c index d7c6ac293f..3335e5163c 100644 --- a/cups/globals.c +++ b/cups/globals.c @@ -1,5 +1,5 @@ /* - * "$Id: globals.c 4922 2006-01-12 22:05:06Z mike $" + * "$Id: globals.c 4967 2006-01-24 03:42:15Z mike $" * * Global variable access routines for the Common UNIX Printing System (CUPS). * @@ -152,6 +152,18 @@ globals_init() static void globals_destructor(void *value) /* I - Data to free */ { + _cups_globals_t *cg; /* Global data */ + + + cg = (_cups_globals_t *)value; + + if (cg->http) + httpClose(cg->http); + + _cupsLangFlush(cg); + _cupsCharmapFlush(cg); + _cupsNormalizeMapsFlush(cg); + free(value); } @@ -198,5 +210,5 @@ _cupsGlobals(void) /* - * End of "$Id: globals.c 4922 2006-01-12 22:05:06Z mike $". + * End of "$Id: globals.c 4967 2006-01-24 03:42:15Z mike $". */ diff --git a/cups/globals.h b/cups/globals.h index cff946a963..e1db6dc005 100644 --- a/cups/globals.h +++ b/cups/globals.h @@ -1,5 +1,5 @@ /* - * "$Id: globals.h 4918 2006-01-12 05:14:40Z mike $" + * "$Id: globals.h 4967 2006-01-24 03:42:15Z mike $" * * Global variable definitions for the Common UNIX Printing System (CUPS). * @@ -94,6 +94,7 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/ /* language.c */ cups_lang_t *lang_cache; /* Language string cache */ + cups_lang_t *lang_default; /* Default language */ # ifdef __APPLE__ # ifdef HAVE_CF_LOCALE_ID char language[32]; /* Cached language */ @@ -140,6 +141,9 @@ typedef struct _cups_globals_s /**** CUPS global state data ****/ extern const char *_cupsGetPassword(const char *prompt); extern _cups_globals_t *_cupsGlobals(void); +extern void _cupsLangFlush(_cups_globals_t *cg); +extern void _cupsCharmapFlush(_cups_globals_t *cg); +extern void _cupsNormalizeMapsFlush(_cups_globals_t *cg); /* @@ -152,5 +156,5 @@ extern _cups_globals_t *_cupsGlobals(void); #endif /* !_CUPS_GLOBALS_H_ */ /* - * End of "$Id: globals.h 4918 2006-01-12 05:14:40Z mike $". + * End of "$Id: globals.h 4967 2006-01-24 03:42:15Z mike $". */ diff --git a/cups/http-addr.c b/cups/http-addr.c index ac4763bd26..4363a86a5a 100644 --- a/cups/http-addr.c +++ b/cups/http-addr.c @@ -1,5 +1,5 @@ /* - * "$Id: http-addr.c 4806 2005-10-21 18:49:24Z mike $" + * "$Id: http-addr.c 4950 2006-01-19 16:07:57Z mike $" * * HTTP address routines for the Common UNIX Printing System (CUPS). * @@ -133,8 +133,7 @@ httpAddrLocalhost( { #ifdef AF_INET6 if (addr->addr.sa_family == AF_INET6 && - (IN6_IS_ADDR_LOOPBACK(&(addr->ipv6.sin6_addr)) || - IN6_IS_ADDR_UNSPECIFIED(&(addr->ipv6.sin6_addr)))) + IN6_IS_ADDR_LOOPBACK(&(addr->ipv6.sin6_addr))) return (1); #endif /* AF_INET6 */ @@ -541,5 +540,5 @@ httpGetHostname(char *s, /* I - String buffer for name */ /* - * End of "$Id: http-addr.c 4806 2005-10-21 18:49:24Z mike $". + * End of "$Id: http-addr.c 4950 2006-01-19 16:07:57Z mike $". */ diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c index ed61944714..0a77b7ea6c 100644 --- a/cups/http-addrlist.c +++ b/cups/http-addrlist.c @@ -1,9 +1,9 @@ /* - * "$Id: http-addrlist.c 4815 2005-10-31 20:40:17Z mike $" + * "$Id: http-addrlist.c 4976 2006-01-25 15:07:40Z mike $" * * HTTP address list routines for the Common UNIX Printing System (CUPS). * - * Copyright 1997-2005 by Easy Software Products, all rights reserved. + * Copyright 1997-2006 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the * property of Easy Software Products and are protected by Federal @@ -90,6 +90,11 @@ httpAddrConnect( setsockopt(*sock, SOL_SOCKET, SO_REUSEPORT, &val, sizeof(val)); #endif /* SO_REUSEPORT */ +#ifdef SO_NOSIGPIPE + val = 1; + setsockopt(*sock, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof(val)); +#endif /* SO_NOSIGPIPE */ + /* * Using TCP_NODELAY improves responsiveness, especially on systems * with a slow loopback interface... @@ -584,5 +589,5 @@ httpAddrGetList(const char *hostname, /* I - Hostname, IP address, or NULL for p /* - * End of "$Id: http-addrlist.c 4815 2005-10-31 20:40:17Z mike $". + * End of "$Id: http-addrlist.c 4976 2006-01-25 15:07:40Z mike $". */ diff --git a/cups/http-private.h b/cups/http-private.h index 5ecf57983f..dd6fb22569 100644 --- a/cups/http-private.h +++ b/cups/http-private.h @@ -1,5 +1,5 @@ /* - * "$Id: http-private.h 4800 2005-10-18 18:06:20Z mike $" + * "$Id: http-private.h 4973 2006-01-25 02:36:02Z mike $" * * Private HTTP definitions for the Common UNIX Printing System (CUPS). * @@ -64,6 +64,7 @@ typedef int socklen_t; # endif /* __sgi */ # include "http.h" +# include "ipp-private.h" # if defined HAVE_LIBSSL /* @@ -122,5 +123,5 @@ extern const char *hstrerror(int error); #endif /* !_CUPS_HTTP_PRIVATE_H_ */ /* - * End of "$Id: http-private.h 4800 2005-10-18 18:06:20Z mike $". + * End of "$Id: http-private.h 4973 2006-01-25 02:36:02Z mike $". */ diff --git a/cups/http-support.c b/cups/http-support.c index b62496a3ec..0770f138ae 100644 --- a/cups/http-support.c +++ b/cups/http-support.c @@ -1,5 +1,5 @@ /* - * "$Id: http-support.c 4903 2006-01-10 20:02:46Z mike $" + * "$Id: http-support.c 4961 2006-01-20 22:19:13Z mike $" * * HTTP support routines for the Common UNIX Printing System (CUPS) scheduler. * @@ -320,6 +320,9 @@ httpAssembleURIf(char *uri, /* I - URI buffer */ if (resourcef) { + char *query; /* Pointer to query string */ + + va_start(ap, resourcef); bytes = vsnprintf(resource, sizeof(resource), resourcef, ap); va_end(ap); @@ -327,9 +330,27 @@ httpAssembleURIf(char *uri, /* I - URI buffer */ if (bytes >= sizeof(resource)) goto assemble_overflow; + /* + * Temporarily remove query string if present... + */ + + if ((query = strchr(resource, '?')) != NULL) + *query = '\0'; + ptr = http_copy_encode(ptr, resource, end, NULL); if (!ptr) goto assemble_overflow; + + if (query) + { + /* + * Copy query string without encoding... + */ + + *query = '?'; + strlcpy(ptr, query, end - ptr); + ptr += strlen(ptr); + } } else if (ptr < end) *ptr++ = '/'; @@ -398,9 +419,17 @@ httpDecode64_2(char *out, /* I - String to write to */ * Range check input... */ - if (!out || !outlen || *outlen < 1 || !in || !*in) + if (!out || !outlen || *outlen < 1 || !in) return (NULL); + if (!*in) + { + *out = '\0'; + *outlen = 0; + + return (out); + } + /* * Convert from base-64 to bytes... */ @@ -991,10 +1020,33 @@ httpSeparateURI(const char *uri, /* I - Universal Resource Identifier */ status = HTTP_URI_MISSING_RESOURCE; *resource = '/'; - uri = http_copy_decode(resource + 1, uri, resourcelen - 1, ""); + + /* + * Copy any query string without decoding it... + */ + + if (*uri == '?') + { + strlcpy(resource + 1, uri, resourcelen - 1); + uri += strlen(uri); + } + else + resource[1] = '\0'; } else - uri = http_copy_decode(resource, uri, resourcelen, ""); + { + uri = http_copy_decode(resource, uri, resourcelen, "?"); + + if (uri && *uri == '?') + { + /* + * Concatenate any query string without decoding it... + */ + + strlcat(resource, uri, resourcelen); + uri += strlen(uri); + } + } if (!uri) { @@ -1191,5 +1243,5 @@ http_copy_encode(char *dst, /* O - Destination buffer */ /* - * End of "$Id: http-support.c 4903 2006-01-10 20:02:46Z mike $". + * End of "$Id: http-support.c 4961 2006-01-20 22:19:13Z mike $". */ diff --git a/cups/http.c b/cups/http.c index 2ef480b4a8..b094a5d497 100644 --- a/cups/http.c +++ b/cups/http.c @@ -1,9 +1,9 @@ /* - * "$Id: http.c 4914 2006-01-11 02:04:22Z mike $" + * "$Id: http.c 4995 2006-01-26 20:14:42Z mike $" * * HTTP routines for the Common UNIX Printing System (CUPS). * - * Copyright 1997-2005 by Easy Software Products, all rights reserved. + * Copyright 1997-2006 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the * property of Easy Software Products and are protected by Federal @@ -379,11 +379,52 @@ void httpFlush(http_t *http) /* I - HTTP data */ { char buffer[8192]; /* Junk buffer */ + int blocking; /* To block or not to block */ DEBUG_printf(("httpFlush(http=%p), state=%d\n", http, http->state)); + /* + * Temporarily set non-blocking mode so we don't get stuck in httpRead()... + */ + + blocking = http->blocking; + http->blocking = 0; + + /* + * Read any data we can... + */ + while (httpRead(http, buffer, sizeof(buffer)) > 0); + + /* + * Restore blocking and reset the connection if we didn't get all of + * the remaining data... + */ + + http->blocking = blocking; + + if (http->state != HTTP_WAITING && http->fd >= 0) + { + /* + * Didn't get the data back, so close the current connection. + */ + + http->state = HTTP_WAITING; + +#ifdef HAVE_SSL + if (http->tls) + http_shutdown_ssl(http); +#endif /* HAVE_SSL */ + +#ifdef WIN32 + closesocket(http->fd); +#else + close(http->fd); +#endif /* WIN32 */ + + http->fd = -1; + } } @@ -829,21 +870,23 @@ httpInitialize(void) if (!initialized) WSAStartup(MAKEWORD(1,1), &winsockdata); -#elif defined(HAVE_SIGSET) - sigset(SIGPIPE, SIG_IGN); -#elif defined(HAVE_SIGACTION) - struct sigaction action; /* POSIX sigaction data */ - - +#elif !defined(SO_NOSIGPIPE) /* * Ignore SIGPIPE signals... */ +# ifdef HAVE_SIGSET + sigset(SIGPIPE, SIG_IGN); +# elif defined(HAVE_SIGACTION) + struct sigaction action; /* POSIX sigaction data */ + + memset(&action, 0, sizeof(action)); action.sa_handler = SIG_IGN; sigaction(SIGPIPE, &action, NULL); -#else +# else signal(SIGPIPE, SIG_IGN); +# endif /* !SO_NOSIGPIPE */ #endif /* WIN32 */ #ifdef HAVE_GNUTLS @@ -1166,7 +1209,7 @@ httpRead(http_t *http, /* I - HTTP data */ { ch = buffer[i + j] & 255; - if (ch < ' ' || ch == 127) + if (ch < ' ' || ch >= 127) ch = '.'; putchar(ch); @@ -1191,17 +1234,34 @@ _httpReadCDSA( void *data, /* I - Data buffer */ size_t *dataLength) /* IO - Number of bytes */ { + OSStatus result; /* Return value */ ssize_t bytes; /* Number of bytes read */ - bytes = recv((int)connection, data, *dataLength, 0); - if (bytes >= 0) + for (;;) { - *dataLength = bytes; - return (0); + bytes = recv((int)connection, data, *dataLength, 0); + + if (bytes > 0) + { + result = (bytes == *dataLength); + *dataLength = bytes; + + return (result); + } + + if (bytes == 0) + return (errSSLClosedAbort); + + if (errno == EAGAIN) + return (errSSLWouldBlock); + + if (errno == EPIPE) + return (errSSLClosedAbort); + + if (errno != EINTR) + return (errSSLInternal); } - else - return (-1); } #endif /* HAVE_SSL && HAVE_CDSASSL */ @@ -1705,17 +1765,31 @@ _httpWriteCDSA( const void *data, /* I - Data buffer */ size_t *dataLength) /* IO - Number of bytes */ { - ssize_t bytes; /* Number of write written */ + OSStatus result; /* Return value */ + ssize_t bytes; /* Number of bytes read */ - bytes = write((int)connection, data, *dataLength); - if (bytes >= 0) + for (;;) { - *dataLength = bytes; - return (0); + bytes = write((int)connection, data, *dataLength); + + if (bytes >= 0) + { + result = (bytes == *dataLength) ? 0 : errSSLWouldBlock; + *dataLength = bytes; + + return (result); + } + + if (errno == EAGAIN) + return (errSSLWouldBlock); + + if (errno == EPIPE) + return (errSSLClosedAbort); + + if (errno != EINTR) + return (errSSLInternal); } - else - return (-1); } #endif /* HAVE_SSL && HAVE_CDSASSL */ @@ -1755,20 +1829,32 @@ http_read_ssl(http_t *http, /* I - HTTP data */ return (gnutls_record_recv(((http_tls_t *)(http->tls))->session, buf, len)); # elif defined(HAVE_CDSASSL) + int result; /* Return value */ OSStatus error; /* Error info */ size_t processed; /* Number of bytes processed */ error = SSLRead((SSLContextRef)http->tls, buf, len, &processed); - if (error == 0) - return (processed); - else + switch (error) { - http->error = error; - - return (-1); + case 0 : + result = (int)processed; + break; + case errSSLClosedGraceful : + result = 0; + break; + case errSSLWouldBlock : + errno = EAGAIN; + result = -1; + break; + default : + errno = EPIPE; + result = -1; + break; } + + return (result); # endif /* HAVE_LIBSSL */ } #endif /* HAVE_SSL */ @@ -1843,7 +1929,8 @@ http_send(http_t *http, /* I - HTTP data */ */ if (http->status == HTTP_ERROR || http->status >= HTTP_BAD_REQUEST) - httpReconnect(http); + if (httpReconnect(http)) + return (-1); /* * Send the request header... @@ -2186,6 +2273,9 @@ http_wait(http_t *http, /* I - HTTP data */ DEBUG_printf(("http_wait(http=%p, msec=%d)\n", http, msec)); + if (http->fd < 0) + return (0); + /* * Check the SSL/TLS buffers for data first... */ @@ -2413,24 +2503,37 @@ http_write_ssl(http_t *http, /* I - HTTP data */ # elif defined(HAVE_GNUTLS) return (gnutls_record_send(((http_tls_t *)(http->tls))->session, buf, len)); # elif defined(HAVE_CDSASSL) + int result; /* Return value */ OSStatus error; /* Error info */ size_t processed; /* Number of bytes processed */ error = SSLWrite((SSLContextRef)http->tls, buf, len, &processed); - if (error == 0) - return (processed); - else + switch (error) { - http->error = error; - return (-1); + case 0 : + result = (int)processed; + break; + case errSSLClosedGraceful : + result = 0; + break; + case errSSLWouldBlock : + errno = EAGAIN; + result = -1; + break; + default : + errno = EPIPE; + result = -1; + break; } + + return (result); # endif /* HAVE_LIBSSL */ } #endif /* HAVE_SSL */ /* - * End of "$Id: http.c 4914 2006-01-11 02:04:22Z mike $". + * End of "$Id: http.c 4995 2006-01-26 20:14:42Z mike $". */ diff --git a/cups/http.h b/cups/http.h index 2a2e645aee..1384e6d7db 100644 --- a/cups/http.h +++ b/cups/http.h @@ -1,5 +1,5 @@ /* - * "$Id: http.h 4906 2006-01-10 20:53:28Z mike $" + * "$Id: http.h 4973 2006-01-25 02:36:02Z mike $" * * Hyper-Text Transport Protocol definitions for the Common UNIX Printing * System (CUPS). @@ -59,7 +59,7 @@ /* * With GCC 3.0 and higher, we can mark old APIs "deprecated" so you get - * an error at compile-time. + * a warning at compile-time. */ # if defined(__GNUC__) && __GNUC__ > 2 @@ -113,7 +113,7 @@ extern "C" { # define HTTP_MAX_URI 1024 /* Max length of URI string */ # define HTTP_MAX_HOST 256 /* Max length of hostname string */ -# define HTTP_MAX_BUFFER 1024 /* Max length of data buffer */ +# define HTTP_MAX_BUFFER 2048 /* Max length of data buffer */ # define HTTP_MAX_VALUE 256 /* Max header field value length */ @@ -323,8 +323,6 @@ typedef struct http_s /**** HTTP connection structure. ****/ int used; /* Number of bytes used in buffer */ char buffer[HTTP_MAX_BUFFER]; /* Buffer for incoming data */ - char wbuffer[HTTP_MAX_BUFFER]; - /* Buffer for outgoing data */ int auth_type; /* Authentication in use */ _cups_md5_state_t md5_state; /* MD5 state */ char nonce[HTTP_MAX_VALUE]; @@ -343,10 +341,12 @@ typedef struct http_s /**** HTTP connection structure. ****/ /* Username:password string @since CUPS 1.1.20@ */ int digest_tries; /* Number of tries for digest auth @since CUPS 1.1.20@ */ /**** New in CUPS 1.2 ****/ + off_t data_remaining; /* Number of bytes left @since CUPS 1.2@ */ http_addr_t *hostaddr; /* Current host address and port @since CUPS 1.2@ */ http_addrlist_t *addrlist; /* List of valid addresses @since CUPS 1.2@ */ + char wbuffer[HTTP_MAX_BUFFER]; + /* Buffer for outgoing data */ int wused; /* Write buffer bytes used @since CUPS 1.2@ */ - off_t data_remaining; /* Number of bytes left @since CUPS 1.2@ */ } http_t; @@ -469,5 +469,5 @@ extern void httpSetLength(http_t *http, size_t length); #endif /* !_CUPS_HTTP_H_ */ /* - * End of "$Id: http.h 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: http.h 4973 2006-01-25 02:36:02Z mike $". */ diff --git a/cups/i18n.h b/cups/i18n.h index 00a597f950..c2f3f474e0 100644 --- a/cups/i18n.h +++ b/cups/i18n.h @@ -1,5 +1,5 @@ /* - * "$Id: i18n.h 4903 2006-01-10 20:02:46Z mike $" + * "$Id: i18n.h 4924 2006-01-13 01:55:20Z mike $" * * (Private) localization support for the Common UNIX Printing System (CUPS). * @@ -66,14 +66,12 @@ extern char *_cupsSaveLocale(int category, const char *locale); /**** New in CUPS 1.2 ****/ extern const char *_cupsEncodingName(cups_encoding_t encoding); -extern int _cupsLangPrintf(FILE *fp, cups_lang_t *lang, - const char *message, ...) +extern int _cupsLangPrintf(FILE *fp, const char *message, ...) # ifdef __GNUC__ -__attribute__ ((__format__ (__printf__, 3, 4))) +__attribute__ ((__format__ (__printf__, 2, 3))) # endif /* __GNUC__ */ ; -extern int _cupsLangPuts(FILE *fp, cups_lang_t *lang, - const char *message); +extern int _cupsLangPuts(FILE *fp, const char *message); extern const char *_cupsLangString(cups_lang_t *lang, const char *message); extern void _cupsMessageFree(cups_array_t *a); extern cups_array_t *_cupsMessageLoad(const char *filename); @@ -86,5 +84,5 @@ extern const char *_cupsMessageLookup(cups_array_t *a, const char *m); #endif /* !_CUPS_I18N_H_ */ /* - * End of "$Id: i18n.h 4903 2006-01-10 20:02:46Z mike $". + * End of "$Id: i18n.h 4924 2006-01-13 01:55:20Z mike $". */ diff --git a/cups/ipp-private.h b/cups/ipp-private.h new file mode 100644 index 0000000000..37473987f7 --- /dev/null +++ b/cups/ipp-private.h @@ -0,0 +1,65 @@ +/* + * "$Id: ipp-private.h 4973 2006-01-25 02:36:02Z mike $" + * + * Private IPP definitions for the Common UNIX Printing System (CUPS). + * + * Copyright 1997-2006 by Easy Software Products. + * + * These coded instructions, statements, and computer programs are the + * property of Easy Software Products 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 missing or damaged please contact Easy Software Products + * at: + * + * Attn: CUPS Licensing Information + * Easy Software Products + * 44141 Airport View Drive, Suite 204 + * Hollywood, Maryland 20636 USA + * + * Voice: (301) 373-9600 + * EMail: cups-info@cups.org + * WWW: http://www.cups.org + * + * This file is subject to the Apple OS-Developed Software exception. + */ + +#ifndef _CUPS_IPP_PRIVATE_H_ +# define _CUPS_IPP_PRIVATE_H_ + +/* + * Include necessary headers... + */ + +# include "ipp.h" + + +/* + * C++ magic... + */ + +# ifdef __cplusplus +extern "C" { +# endif /* __cplusplus */ + + +/* + * Prototypes for private functions... + */ + +extern ipp_attribute_t *_ipp_add_attr(ipp_t *, int); +extern void _ipp_free_attr(ipp_attribute_t *); + + +/* + * C++ magic... + */ + +# ifdef __cplusplus +} +# endif /* __cplusplus */ +#endif /* !_CUPS_IPP_H_ */ + +/* + * End of "$Id: ipp-private.h 4973 2006-01-25 02:36:02Z mike $". + */ diff --git a/cups/ipp-support.c b/cups/ipp-support.c index cceda0ff14..8c1a82daab 100644 --- a/cups/ipp-support.c +++ b/cups/ipp-support.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp-support.c 4785 2005-10-13 19:39:05Z mike $" + * "$Id: ipp-support.c 4987 2006-01-26 00:25:21Z mike $" * * Internet Printing Protocol support functions for the Common UNIX * Printing System (CUPS). @@ -321,12 +321,10 @@ ippPort(void) void ippSetPort(int p) /* I - Port number to use */ { - fprintf(stderr, "ippSetPort(p=%d)\n", p); - _cupsGlobals()->ipp_port = p; } /* - * End of "$Id: ipp-support.c 4785 2005-10-13 19:39:05Z mike $". + * End of "$Id: ipp-support.c 4987 2006-01-26 00:25:21Z mike $". */ diff --git a/cups/ipp.c b/cups/ipp.c index bc9045b22d..fbe7e39de5 100644 --- a/cups/ipp.c +++ b/cups/ipp.c @@ -1,5 +1,5 @@ /* - * "$Id: ipp.c 4922 2006-01-12 22:05:06Z mike $" + * "$Id: ipp.c 4995 2006-01-26 20:14:42Z mike $" * * Internet Printing Protocol support functions for the Common UNIX * Printing System (CUPS). @@ -1023,6 +1023,7 @@ ippReadIO(void *src, /* I - Data source */ *bufptr; /* Pointer into buffer */ ipp_attribute_t *attr; /* Current attribute */ ipp_tag_t tag; /* Current tag */ + ipp_tag_t value_tag; /* Current value tag */ ipp_value_t *value; /* Current value */ @@ -1163,14 +1164,15 @@ ippReadIO(void *src, /* I - Data source */ if (ipp->current == NULL) return (IPP_ERROR); - attr = ipp->current; + attr = ipp->current; + value_tag = (ipp_tag_t)(attr->value_tag & IPP_TAG_MASK); /* * Make sure we aren't adding a new value of a different * type... */ - if (attr->value_tag == IPP_TAG_ZERO) + if (value_tag == IPP_TAG_ZERO) { /* * Setting the value of a collection member... @@ -1178,9 +1180,9 @@ ippReadIO(void *src, /* I - Data source */ attr->value_tag = tag; } - else if (attr->value_tag == IPP_TAG_STRING || - (attr->value_tag >= IPP_TAG_TEXTLANG && - attr->value_tag <= IPP_TAG_MIMETYPE)) + else if (value_tag == IPP_TAG_STRING || + (value_tag >= IPP_TAG_TEXTLANG && + value_tag <= IPP_TAG_MIMETYPE)) { /* * String values can sometimes come across in different @@ -1191,7 +1193,7 @@ ippReadIO(void *src, /* I - Data source */ (tag < IPP_TAG_TEXTLANG || tag > IPP_TAG_MIMETYPE)) return (IPP_ERROR); } - else if (attr->value_tag != tag) + else if (value_tag != tag) return (IPP_ERROR); /* @@ -1709,6 +1711,8 @@ ippWriteIO(void *dst, /* I - Destination */ DEBUG_printf(("ippWrite: wrote group tag = %x\n", attr->group_tag)); *bufptr++ = attr->group_tag; } + else if (attr->group_tag == IPP_TAG_ZERO) + continue; /* * Write the attribute tag and name. The current implementation @@ -2402,10 +2406,10 @@ _ipp_add_attr(ipp_t *ipp, /* I - IPP message */ attr = calloc(sizeof(ipp_attribute_t) + (num_values - 1) * sizeof(ipp_value_t), 1); - attr->num_values = num_values; - if (attr != NULL) { + attr->num_values = num_values; + if (ipp->last == NULL) ipp->attrs = attr; else @@ -2466,7 +2470,7 @@ _ipp_free_attr(ipp_attribute_t *attr) /* I - Attribute to free */ break; /* anti-compiler-warning-code */ } - if (attr->name != NULL) + if (attr->name) free(attr->name); free(attr); @@ -2759,5 +2763,5 @@ ipp_write_file(int *fd, /* I - File descriptor */ /* - * End of "$Id: ipp.c 4922 2006-01-12 22:05:06Z mike $". + * End of "$Id: ipp.c 4995 2006-01-26 20:14:42Z mike $". */ diff --git a/cups/ipp.h b/cups/ipp.h index 24b64a1de5..f011a35e4a 100644 --- a/cups/ipp.h +++ b/cups/ipp.h @@ -1,5 +1,5 @@ /* - * "$Id: ipp.h 4922 2006-01-12 22:05:06Z mike $" + * "$Id: ipp.h 4995 2006-01-26 20:14:42Z mike $" * * Internet Printing Protocol definitions for the Common UNIX Printing * System (CUPS). @@ -72,7 +72,7 @@ extern "C" { * Types and structures... */ -typedef enum /**** Format tags for attribute formats... ****/ +typedef enum /**** Format tags for attribute formats... ****/ { IPP_TAG_ZERO = 0x00, IPP_TAG_OPERATION, @@ -109,17 +109,17 @@ typedef enum /**** Format tags for attribute formats... ****/ IPP_TAG_LANGUAGE, IPP_TAG_MIMETYPE, IPP_TAG_MEMBERNAME, - IPP_TAG_MASK = 0x7fffffff, /* Mask for copied attribute values */ - IPP_TAG_COPY = -0x7fffffff-1 /* Bitflag for copied attribute values */ + IPP_TAG_MASK = 0x7fffffff, /* Mask for copied attribute values */ + IPP_TAG_COPY = -0x7fffffff-1 /* Bitflag for copied attribute values */ } ipp_tag_t; -typedef enum /**** Resolution units... ****/ +typedef enum /**** Resolution units... ****/ { IPP_RES_PER_INCH = 3, IPP_RES_PER_CM } ipp_res_t; -typedef enum /**** Finishings... ****/ +typedef enum /**** Finishings... ****/ { IPP_FINISHINGS_NONE = 3, IPP_FINISHINGS_STAPLE, @@ -151,22 +151,22 @@ typedef enum /**** Finishings... ****/ IPP_FINISHINGS_BIND_BOTTOM } ipp_finish_t; -typedef enum /**** Orientation... ****/ +typedef enum /**** Orientation... ****/ { - IPP_PORTRAIT = 3, /* No rotation */ - IPP_LANDSCAPE, /* 90 degrees counter-clockwise */ - IPP_REVERSE_LANDSCAPE, /* 90 degrees clockwise */ - IPP_REVERSE_PORTRAIT /* 180 degrees */ + IPP_PORTRAIT = 3, /* No rotation */ + IPP_LANDSCAPE, /* 90 degrees counter-clockwise */ + IPP_REVERSE_LANDSCAPE, /* 90 degrees clockwise */ + IPP_REVERSE_PORTRAIT /* 180 degrees */ } ipp_orient_t; -typedef enum /**** Qualities... ****/ +typedef enum /**** Qualities... ****/ { IPP_QUALITY_DRAFT = 3, IPP_QUALITY_NORMAL, IPP_QUALITY_HIGH } ipp_quality_t; -typedef enum /**** Job States.... */ +typedef enum /**** Job States.... */ { IPP_JOB_PENDING = 3, IPP_JOB_HELD, @@ -177,23 +177,23 @@ typedef enum /**** Job States.... */ IPP_JOB_COMPLETED } ipp_jstate_t; -typedef enum /**** Printer States.... */ +typedef enum /**** Printer States.... */ { IPP_PRINTER_IDLE = 3, IPP_PRINTER_PROCESSING, IPP_PRINTER_STOPPED } ipp_pstate_t; -typedef enum /**** IPP states... ****/ +typedef enum /**** IPP states... ****/ { - IPP_ERROR = -1, /* An error occurred */ - IPP_IDLE, /* Nothing is happening/request completed */ - IPP_HEADER, /* The request header needs to be sent/received */ - IPP_ATTRIBUTE, /* One or more attributes need to be sent/received */ - IPP_DATA /* IPP request data needs to be sent/received */ + IPP_ERROR = -1, /* An error occurred */ + IPP_IDLE, /* Nothing is happening/request completed */ + IPP_HEADER, /* The request header needs to be sent/received */ + IPP_ATTRIBUTE, /* One or more attributes need to be sent/received */ + IPP_DATA /* IPP request data needs to be sent/received */ } ipp_state_t; -typedef enum /**** IPP operations... ****/ +typedef enum /**** IPP operations... ****/ { IPP_PRINT_JOB = 0x0002, IPP_PRINT_URI, @@ -242,10 +242,10 @@ typedef enum /**** IPP operations... ****/ IPP_PRIVATE = 0x4000, CUPS_GET_DEFAULT, CUPS_GET_PRINTERS, - CUPS_ADD_PRINTER, + CUPS_ADD_MODIFY_PRINTER, CUPS_DELETE_PRINTER, CUPS_GET_CLASSES, - CUPS_ADD_CLASS, + CUPS_ADD_MODIFY_CLASS, CUPS_DELETE_CLASS, CUPS_ACCEPT_JOBS, CUPS_REJECT_JOBS, @@ -256,7 +256,11 @@ typedef enum /**** IPP operations... ****/ CUPS_AUTHENTICATE_JOB } ipp_op_t; -typedef enum /**** IPP status codes... ****/ +/* Old names for the operations */ +#define CUPS_ADD_PRINTER CUPS_ADD_MODIFY_PRINTER +#define CUPS_ADD_CLASS CUPS_ADD_MODIFY_CLASS + +typedef enum /**** IPP status codes... ****/ { IPP_OK = 0x0000, IPP_OK_SUBST, @@ -304,105 +308,105 @@ typedef enum /**** IPP status codes... ****/ IPP_PRINTER_IS_DEACTIVATED } ipp_status_t; -typedef unsigned char ipp_uchar_t;/**** Unsigned 8-bit integer/character ****/ +typedef unsigned char ipp_uchar_t; /**** Unsigned 8-bit integer/character ****/ /**** New in CUPS 1.1.19 ****/ typedef int (*ipp_iocb_t)(void *, ipp_uchar_t *, int); - /**** IPP IO Callback Function ****/ + /**** IPP IO Callback Function ****/ -typedef union /**** Request Header ****/ +typedef union /**** Request Header ****/ { - struct /* Any Header */ + struct /* Any Header */ { - ipp_uchar_t version[2]; /* Protocol version number */ - int op_status; /* Operation ID or status code*/ - int request_id; /* Request ID */ + ipp_uchar_t version[2]; /* Protocol version number */ + int op_status; /* Operation ID or status code*/ + int request_id; /* Request ID */ } any; - struct /* Operation Header */ + struct /* Operation Header */ { - ipp_uchar_t version[2]; /* Protocol version number */ - ipp_op_t operation_id; /* Operation ID */ - int request_id; /* Request ID */ + ipp_uchar_t version[2]; /* Protocol version number */ + ipp_op_t operation_id; /* Operation ID */ + int request_id; /* Request ID */ } op; - struct /* Status Header */ + struct /* Status Header */ { - ipp_uchar_t version[2]; /* Protocol version number */ - ipp_status_t status_code; /* Status code */ - int request_id; /* Request ID */ + ipp_uchar_t version[2]; /* Protocol version number */ + ipp_status_t status_code; /* Status code */ + int request_id; /* Request ID */ } status; /**** New in CUPS 1.1.19 ****/ - struct /* Event Header */ + struct /* Event Header */ { - ipp_uchar_t version[2]; /* Protocol version number */ - ipp_status_t status_code; /* Status code */ - int request_id; /* Request ID */ + ipp_uchar_t version[2]; /* Protocol version number */ + ipp_status_t status_code; /* Status code */ + int request_id; /* Request ID */ } event; } ipp_request_t; /**** New in CUPS 1.1.19 ****/ typedef struct ipp_str ipp_t; -typedef union /**** Attribute Value ****/ +typedef union /**** Attribute Value ****/ { - int integer; /* Integer/enumerated value */ + int integer; /* Integer/enumerated value */ - char boolean; /* Boolean value */ + char boolean; /* Boolean value */ - ipp_uchar_t date[11]; /* Date/time value */ + ipp_uchar_t date[11]; /* Date/time value */ struct { - int xres, /* Horizontal resolution */ - yres; /* Vertical resolution */ - ipp_res_t units; /* Resolution units */ - } resolution; /* Resolution value */ + int xres, /* Horizontal resolution */ + yres; /* Vertical resolution */ + ipp_res_t units; /* Resolution units */ + } resolution; /* Resolution value */ struct { - int lower, /* Lower value */ - upper; /* Upper value */ - } range; /* Range of integers value */ + int lower, /* Lower value */ + upper; /* Upper value */ + } range; /* Range of integers value */ struct { - char *charset; /* Character set */ - char *text; /* String */ - } string; /* String with language value */ + char *charset; /* Character set */ + char *text; /* String */ + } string; /* String with language value */ struct { - int length; /* Length of attribute */ - void *data; /* Data in attribute */ - } unknown; /* Unknown attribute type */ + int length; /* Length of attribute */ + void *data; /* Data in attribute */ + } unknown; /* Unknown attribute type */ /**** New in CUPS 1.1.19 ****/ - ipp_t *collection; /* Collection value */ + ipp_t *collection; /* Collection value */ } ipp_value_t; -typedef struct ipp_attribute_s /**** Attribute ****/ +typedef struct ipp_attribute_s /**** Attribute ****/ { - struct ipp_attribute_s *next; /* Next attribute in list */ - ipp_tag_t group_tag, /* Job/Printer/Operation group tag */ - value_tag; /* What type of value is it? */ - char *name; /* Name of attribute */ - int num_values; /* Number of values */ - ipp_value_t values[1]; /* Values */ + struct ipp_attribute_s *next; /* Next attribute in list */ + ipp_tag_t group_tag, /* Job/Printer/Operation group tag */ + value_tag; /* What type of value is it? */ + char *name; /* Name of attribute */ + int num_values; /* Number of values */ + ipp_value_t values[1]; /* Values */ } ipp_attribute_t; -struct ipp_str /**** IPP Request/Response/Notification ****/ +struct ipp_str /**** IPP Request/Response/Notification ****/ { - ipp_state_t state; /* State of request */ - ipp_request_t request; /* Request header */ - ipp_attribute_t *attrs, /* Attributes */ - *last, /* Last attribute in list */ - *current; /* Current attribute (for read/write) */ - ipp_tag_t curtag; /* Current attribute group tag */ + ipp_state_t state; /* State of request */ + ipp_request_t request; /* Request header */ + ipp_attribute_t *attrs, /* Attributes */ + *last, /* Last attribute in list */ + *current; /* Current attribute (for read/write) */ + ipp_tag_t curtag; /* Current attribute group tag */ /**** New in CUPS 1.2 ****/ - ipp_attribute_t *prev; /* Previous attribute (for read) */ + ipp_attribute_t *prev; /* Previous attribute (for read) */ }; @@ -410,18 +414,39 @@ struct ipp_str /**** IPP Request/Response/Notification ****/ * Prototypes... */ -extern ipp_attribute_t *ippAddBoolean(ipp_t *ipp, ipp_tag_t group, const char *name, char value); -extern ipp_attribute_t *ippAddBooleans(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const char *values); -extern ipp_attribute_t *ippAddDate(ipp_t *ipp, ipp_tag_t group, const char *name, const ipp_uchar_t *value); -extern ipp_attribute_t *ippAddInteger(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int value); -extern ipp_attribute_t *ippAddIntegers(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int num_values, const int *values); -extern ipp_attribute_t *ippAddRange(ipp_t *ipp, ipp_tag_t group, const char *name, int lower, int upper); -extern ipp_attribute_t *ippAddRanges(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const int *lower, const int *upper); -extern ipp_attribute_t *ippAddResolution(ipp_t *ipp, ipp_tag_t group, const char *name, ipp_res_t units, int xres, int yres); -extern ipp_attribute_t *ippAddResolutions(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, ipp_res_t units, const int *xres, const int *yres); +extern ipp_attribute_t *ippAddBoolean(ipp_t *ipp, ipp_tag_t group, + const char *name, char value); +extern ipp_attribute_t *ippAddBooleans(ipp_t *ipp, ipp_tag_t group, + const char *name, int num_values, + const char *values); +extern ipp_attribute_t *ippAddDate(ipp_t *ipp, ipp_tag_t group, + const char *name, const ipp_uchar_t *value); +extern ipp_attribute_t *ippAddInteger(ipp_t *ipp, ipp_tag_t group, + ipp_tag_t type, const char *name, + int value); +extern ipp_attribute_t *ippAddIntegers(ipp_t *ipp, ipp_tag_t group, + ipp_tag_t type, const char *name, + int num_values, const int *values); +extern ipp_attribute_t *ippAddRange(ipp_t *ipp, ipp_tag_t group, + const char *name, int lower, int upper); +extern ipp_attribute_t *ippAddRanges(ipp_t *ipp, ipp_tag_t group, + const char *name, int num_values, + const int *lower, const int *upper); +extern ipp_attribute_t *ippAddResolution(ipp_t *ipp, ipp_tag_t group, + const char *name, ipp_res_t units, + int xres, int yres); +extern ipp_attribute_t *ippAddResolutions(ipp_t *ipp, ipp_tag_t group, + const char *name, int num_values, + ipp_res_t units, const int *xres, + const int *yres); extern ipp_attribute_t *ippAddSeparator(ipp_t *ipp); -extern ipp_attribute_t *ippAddString(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, const char *charset, const char *value); -extern ipp_attribute_t *ippAddStrings(ipp_t *ipp, ipp_tag_t group, ipp_tag_t type, const char *name, int num_values, const char *charset, const char * const *values); +extern ipp_attribute_t *ippAddString(ipp_t *ipp, ipp_tag_t group, + ipp_tag_t type, const char *name, + const char *charset, const char *value); +extern ipp_attribute_t *ippAddStrings(ipp_t *ipp, ipp_tag_t group, + ipp_tag_t type, const char *name, + int num_values, const char *charset, + const char * const *values); extern time_t ippDateToTime(const ipp_uchar_t *date); extern void ippDelete(ipp_t *ipp); extern const char *ippErrorString(ipp_status_t error); @@ -438,13 +463,18 @@ extern int ippPort(void); extern void ippSetPort(int p); /**** New in CUPS 1.1.19 ****/ -extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group, const char *name, ipp_t *value); -extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group, const char *name, int num_values, const ipp_t **values); +extern ipp_attribute_t *ippAddCollection(ipp_t *ipp, ipp_tag_t group, + const char *name, ipp_t *value); +extern ipp_attribute_t *ippAddCollections(ipp_t *ipp, ipp_tag_t group, + const char *name, int num_values, + const ipp_t **values); extern void ippDeleteAttribute(ipp_t *ipp, ipp_attribute_t *attr); extern ipp_state_t ippReadFile(int fd, ipp_t *ipp); -extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking, ipp_t *parent, ipp_t *ipp); +extern ipp_state_t ippReadIO(void *src, ipp_iocb_t cb, int blocking, + ipp_t *parent, ipp_t *ipp); extern ipp_state_t ippWriteFile(int fd, ipp_t *ipp); -extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking, ipp_t *parent, ipp_t *ipp); +extern ipp_state_t ippWriteIO(void *dst, ipp_iocb_t cb, int blocking, + ipp_t *parent, ipp_t *ipp); /**** New in CUPS 1.2 ****/ extern ipp_attribute_t *ippAddOctetString(ipp_t *ipp, ipp_tag_t group, @@ -455,13 +485,6 @@ extern ipp_t *ippNewRequest(ipp_op_t op); extern const char *ippOpString(ipp_op_t op); extern ipp_op_t ippOpValue(const char *name); -/* - * "Private" functions used internally by CUPS... - */ - -extern ipp_attribute_t *_ipp_add_attr(ipp_t *, int); -extern void _ipp_free_attr(ipp_attribute_t *); - /* * C++ magic... @@ -473,5 +496,5 @@ extern void _ipp_free_attr(ipp_attribute_t *); #endif /* !_CUPS_IPP_H_ */ /* - * End of "$Id: ipp.h 4922 2006-01-12 22:05:06Z mike $". + * End of "$Id: ipp.h 4995 2006-01-26 20:14:42Z mike $". */ diff --git a/cups/langprintf.c b/cups/langprintf.c index 5f0b40b84d..4430c6792d 100644 --- a/cups/langprintf.c +++ b/cups/langprintf.c @@ -1,10 +1,10 @@ /* - * "$Id: langprintf.c 4898 2006-01-08 23:13:20Z mike $" + * "$Id: langprintf.c 4924 2006-01-13 01:55:20Z mike $" * * Localized printf/puts functions for the Common UNIX Printing * System (CUPS). * - * Copyright 2002 by Easy Software Products. + * Copyright 2002-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the * property of Easy Software Products and are protected by Federal @@ -35,9 +35,7 @@ */ #include -#include "string.h" -#include "i18n.h" -#include "transcode.h" +#include "globals.h" /* @@ -46,7 +44,6 @@ int /* O - Number of bytes written */ _cupsLangPrintf(FILE *fp, /* I - File to write to */ - cups_lang_t *language, /* I - Language to use */ const char *message, /* I - Message string to use */ ...) /* I - Additional arguments as needed */ { @@ -54,6 +51,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */ char buffer[2048], /* Message buffer */ output[8192]; /* Output buffer */ va_list ap; /* Pointer to additional arguments */ + _cups_globals_t *cg; /* Global data */ /* @@ -63,8 +61,10 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */ if (!fp || !message) return (-1); - if (!language) - language = cupsLangDefault(); + cg = _cupsGlobals(); + + if (!cg->lang_default) + cg->lang_default = cupsLangDefault(); /* * Format the string... @@ -72,7 +72,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */ va_start(ap, message); bytes = vsnprintf(buffer, sizeof(buffer), - _cupsLangString(language, message), ap); + _cupsLangString(cg->lang_default, message), ap); va_end(ap); /* @@ -80,7 +80,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */ */ bytes = cupsUTF8ToCharset(output, (cups_utf8_t *)buffer, sizeof(output), - language->encoding); + cg->lang_default->encoding); /* * Write the string and return the number of bytes written... @@ -99,11 +99,11 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */ int /* O - Number of bytes written */ _cupsLangPuts(FILE *fp, /* I - File to write to */ - cups_lang_t *language, /* I - Language to use */ const char *message) /* I - Message string to use */ { int bytes; /* Number of bytes formatted */ char output[2048]; /* Message buffer */ + _cups_globals_t *cg; /* Global data */ /* @@ -113,16 +113,19 @@ _cupsLangPuts(FILE *fp, /* I - File to write to */ if (!fp || !message) return (-1); - if (!language) - language = cupsLangDefault(); + cg = _cupsGlobals(); + + if (!cg->lang_default) + cg->lang_default = cupsLangDefault(); /* * Transcode to the destination charset... */ bytes = cupsUTF8ToCharset(output, - (cups_utf8_t *)_cupsLangString(language, message), - sizeof(output), language->encoding); + (cups_utf8_t *)_cupsLangString(cg->lang_default, + message), + sizeof(output), cg->lang_default->encoding); /* * Write the string and return the number of bytes written... @@ -136,5 +139,5 @@ _cupsLangPuts(FILE *fp, /* I - File to write to */ /* - * End of "$Id: langprintf.c 4898 2006-01-08 23:13:20Z mike $". + * End of "$Id: langprintf.c 4924 2006-01-13 01:55:20Z mike $". */ diff --git a/cups/language.c b/cups/language.c index aa263878e5..3f8f2a8f9d 100644 --- a/cups/language.c +++ b/cups/language.c @@ -1,5 +1,5 @@ /* - * "$Id: language.c 4922 2006-01-12 22:05:06Z mike $" + * "$Id: language.c 4985 2006-01-25 21:57:18Z mike $" * * I18N/language support for the Common UNIX Printing System (CUPS). * @@ -31,6 +31,7 @@ * cupsLangEncoding() - Return the character encoding (us-ascii, etc.) * for the given language. * cupsLangFlush() - Flush all language data out of the cache. + * _cupsLangFlush() - Flush all language data out of the cache. * cupsLangFree() - Free language data. * cupsLangGet() - Get a language. * _cupsLangString() - Get a message string. @@ -60,6 +61,9 @@ #else # include #endif /* WIN32 */ +#ifdef HAVE_COREFOUNDATION_H +# include +#endif /* HAVE_COREFOUNDATION_H */ /* @@ -67,7 +71,6 @@ */ #ifdef __APPLE__ -# include static const char *appleLangDefault(void); #endif /* __APPLE__ */ static cups_lang_t *cups_cache_lookup(const char *name, @@ -201,10 +204,20 @@ cupsLangEncoding(cups_lang_t *lang) /* I - Language data */ void cupsLangFlush(void) +{ + _cupsLangFlush(_cupsGlobals()); +} + + +/* + * '_cupsLangFlush()' - Flush all language data out of the cache. + */ + +void +_cupsLangFlush(_cups_globals_t *cg) /* I - Global data */ { cups_lang_t *lang, /* Current language */ *next; /* Next language */ - _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ /* @@ -1236,5 +1249,5 @@ cups_unquote(char *d, /* O - Unquoted string */ /* - * End of "$Id: language.c 4922 2006-01-12 22:05:06Z mike $". + * End of "$Id: language.c 4985 2006-01-25 21:57:18Z mike $". */ diff --git a/cups/localize.c b/cups/localize.c new file mode 100644 index 0000000000..97662b7be3 --- /dev/null +++ b/cups/localize.c @@ -0,0 +1,187 @@ +/* + * "$Id: localize.c 4937 2006-01-17 04:03:22Z mike $" + * + * PPD custom option routines for the Common UNIX Printing System (CUPS). + * + * Copyright 1997-2006 by Easy Software Products, all rights reserved. + * + * These coded instructions, statements, and computer programs are the + * property of Easy Software Products 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 missing or damaged please contact Easy Software Products + * at: + * + * Attn: CUPS Licensing Information + * Easy Software Products + * 44141 Airport View Drive, Suite 204 + * Hollywood, Maryland 20636 USA + * + * Voice: (301) 373-9600 + * EMail: cups-info@cups.org + * WWW: http://www.cups.org + * + * PostScript is a trademark of Adobe Systems, Inc. + * + * This code and any derivative of it may be used and distributed + * freely under the terms of the GNU General Public License when + * used with GNU Ghostscript or its derivatives. Use of the code + * (or any derivative of it) with software other than GNU + * GhostScript (or its derivatives) is governed by the CUPS license + * agreement. + * + * This file is subject to the Apple OS-Developed Software exception. + * + * Contents: + * + * ppdLocalize() - Localize the PPD file to the current locale. + */ + +/* + * Include necessary headers. + */ + +#include "globals.h" +#include "debug.h" + + +/* + * Local functions... + */ + +static const char *ppd_text(ppd_file_t *ppd, const char *keyword, + const char *spec, const char *ll_CC, + const char *ll); + + +/* + * 'ppdLocalize()' - Localize the PPD file to the current locale. + */ + +int /* O - 0 on success, -1 on error */ +ppdLocalize(ppd_file_t *ppd) /* I - PPD file */ +{ + int i, j, k; /* Looping vars */ + ppd_group_t *group; /* Current group */ + ppd_option_t *option; /* Current option */ + ppd_choice_t *choice; /* Current choice */ + ppd_coption_t *coption; /* Current custom option */ + ppd_cparam_t *cparam; /* Current custom parameter */ + cups_lang_t *lang; /* Current language */ + char ckeyword[PPD_MAX_NAME], /* Custom keyword */ + ll_CC[6], /* Language + country locale */ + ll[3]; /* Language locale */ + const char *text; /* Localized text */ + + + /* + * Range check input... + */ + + if (!ppd) + return (-1); + + /* + * Get the default language... + */ + + if ((lang = cupsLangDefault()) == NULL) + return (-1); + + strlcpy(ll_CC, lang->language, sizeof(ll_CC)); + strlcpy(ll, lang->language, sizeof(ll)); + + /* + * Now lookup all of the groups, options, choices, etc. + */ + + for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++) + { + if ((text = ppd_text(ppd, "Translation", group->name, ll_CC, ll)) != NULL) + strlcpy(group->text, text, sizeof(group->text)); + + for (j = group->num_options, option = group->options; j > 0; j --, option ++) + { + if ((text = ppd_text(ppd, "Translation", option->keyword, ll_CC, + ll)) != NULL) + strlcpy(option->text, text, sizeof(option->text)); + + for (k = option->num_choices, choice = option->choices; + k > 0; + k --, choice ++) + { + if (strcmp(choice->choice, "Custom")) + text = ppd_text(ppd, option->keyword, choice->choice, ll_CC, ll); + else + { + snprintf(ckeyword, sizeof(ckeyword), "Custom%s", option->keyword); + + text = ppd_text(ppd, ckeyword, "True", ll_CC, ll); + } + + if (text) + strlcpy(choice->text, text, sizeof(choice->text)); + } + } + } + + /* + * Translate any custom parameters... + */ + + for (coption = (ppd_coption_t *)cupsArrayFirst(ppd->coptions); + coption; + coption = (ppd_coption_t *)cupsArrayNext(ppd->coptions)) + { + for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params); + cparam; + cparam = (ppd_cparam_t *)cupsArrayNext(coption->params)) + { + snprintf(ckeyword, sizeof(ckeyword), "ParamCustom%s", coption->keyword); + + if ((text = ppd_text(ppd, ckeyword, cparam->name, ll_CC, ll)) != NULL) + strlcpy(cparam->text, text, sizeof(cparam->text)); + } + } + + return (0); +} + + +/* + * 'ppd_text()' - Find the localized text as needed... + */ + +static const char * /* O - Localized text or NULL */ +ppd_text(ppd_file_t *ppd, /* I - PPD file */ + const char *keyword, /* I - Main keyword */ + const char *spec, /* I - Option keyword */ + const char *ll_CC, /* I - Language + country locale */ + const char *ll) /* I - Language locale */ +{ + char lkeyword[PPD_MAX_NAME]; /* Localization keyword */ + ppd_attr_t *attr; /* Current attribute */ + + + /* + * Look for Keyword.ll_CC, then Keyword.ll... + */ + + snprintf(lkeyword, sizeof(lkeyword), "%s.%s", keyword, ll_CC); + if ((attr = ppdFindAttr(ppd, lkeyword, spec)) == NULL) + { + snprintf(lkeyword, sizeof(lkeyword), "%s.%s", keyword, ll); + attr = ppdFindAttr(ppd, lkeyword, spec); + } + + /* + * Return text if we find it... + */ + + return (attr ? attr->text : NULL); +} + + +/* + * End of "$Id: localize.c 4937 2006-01-17 04:03:22Z mike $". + */ diff --git a/cups/mark.c b/cups/mark.c index cbeb54ff1c..33202bda9c 100644 --- a/cups/mark.c +++ b/cups/mark.c @@ -1,5 +1,5 @@ /* - * "$Id: mark.c 4494 2005-02-18 02:18:11Z mike $" + * "$Id: mark.c 4980 2006-01-25 19:57:45Z mike $" * * Option marking routines for the Common UNIX Printing System (CUPS). * @@ -239,28 +239,23 @@ ppd_option_t * /* O - Pointer to option or NULL */ ppdFindOption(ppd_file_t *ppd, /* I - PPD file data */ const char *option) /* I - Option/Keyword name */ { - int i, j, k; /* Looping vars */ - ppd_option_t *o; /* Pointer to option */ - ppd_group_t *g, /* Pointer to group */ - *sg; /* Pointer to subgroup */ + ppd_option_t key; /* Option search key */ + + /* + * Range check input... + */ - if (ppd == NULL || option == NULL) + if (!ppd || !option) return (NULL); - for (i = ppd->num_groups, g = ppd->groups; i > 0; i --, g ++) - { - for (j = g->num_options, o = g->options; j > 0; j --, o ++) - if (strcasecmp(o->keyword, option) == 0) - return (o); + /* + * Search... + */ - for (j = g->num_subgroups, sg = g->subgroups; j > 0; j --, sg ++) - for (k = sg->num_options, o = sg->options; k > 0; k --, o ++) - if (strcasecmp(o->keyword, option) == 0) - return (o); - } + strlcpy(key.keyword, option, sizeof(key.keyword)); - return (NULL); + return ((ppd_option_t *)cupsArrayFind(ppd->options, &key)); } @@ -323,92 +318,203 @@ ppdMarkOption(ppd_file_t *ppd, /* I - PPD file record */ const char *option, /* I - Keyword */ const char *choice) /* I - Option name */ { - int i; /* Looping var */ - ppd_option_t *o; /* Option pointer */ - ppd_choice_t *c; /* Choice pointer */ + int i, j; /* Looping vars */ + ppd_option_t *o; /* Option pointer */ + ppd_choice_t *c; /* Choice pointer */ - if (ppd == NULL) + /* + * Range check input... + */ + + if (!ppd || !option || !choice) return (0); - if (strcasecmp(option, "PageSize") == 0 && strncasecmp(choice, "Custom.", 7) == 0) - { - /* - * Handle variable page sizes... - */ + /* + * AP_D_InputSlot is the "default input slot" on MacOS X, and setting + * it clears the regular InputSlot choices... + */ - ppdPageSize(ppd, choice); - choice = "Custom"; + if (!strcasecmp(option, "AP_D_InputSlot")) + { + if ((o = ppdFindOption(ppd, "InputSlot")) != NULL) + for (i = 0; i < o->num_choices; i ++) + o->choices[i].marked = 0; } + /* + * Check for custom options... + */ + if ((o = ppdFindOption(ppd, option)) == NULL) return (0); - for (i = o->num_choices, c = o->choices; i > 0; i --, c ++) - if (strcasecmp(c->choice, choice) == 0) - break; - if (i) + if (!strncasecmp(choice, "Custom.", 7) /* TODO || strchr(choice, '=') */ ) { /* - * Option found; mark it and then handle unmarking any other options. + * Handle a custom option... */ - c->marked = 1; + if ((c = ppdFindChoice(o, "Custom")) == NULL) + return (0); - if (o->ui != PPD_UI_PICKMANY) - for (i = o->num_choices, c = o->choices; i > 0; i --, c ++) - if (strcasecmp(c->choice, choice) != 0) - c->marked = 0; + if (!strcasecmp(option, "PageSize")) + { + /* + * Handle custom page sizes... + */ - if (strcasecmp(option, "PageSize") == 0 || strcasecmp(option, "PageRegion") == 0) + ppdPageSize(ppd, choice); + } + else { /* - * Mark current page size... + * Handle other custom options... */ - for (i = 0; i < ppd->num_sizes; i ++) - ppd->sizes[i].marked = strcasecmp(ppd->sizes[i].name, choice) == 0; + ppd_coption_t *coption; /* Custom option */ + ppd_cparam_t *cparam; /* Custom parameter */ + char units[33]; /* Custom points units */ + /* - * Unmark the current PageSize or PageRegion setting, as appropriate... + * TODO: Detect and support custom option values using the + * collection format "{Name1=foo Name2=bar}". For now, just + * support Custom.value for single-valued custom options. */ - if (strcasecmp(option, "PageSize") == 0) + if ((coption = ppdFindCustomOption(ppd, option)) != NULL) { - if ((o = ppdFindOption(ppd, "PageRegion")) != NULL) - for (i = 0; i < o->num_choices; i ++) - o->choices[i].marked = 0; - } - else - { - if ((o = ppdFindOption(ppd, "PageSize")) != NULL) - for (i = 0; i < o->num_choices; i ++) - o->choices[i].marked = 0; + if ((cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params)) == NULL) + return (0); + + switch (cparam->type) + { + case PPD_CUSTOM_CURVE : + case PPD_CUSTOM_INVCURVE : + case PPD_CUSTOM_REAL : + cparam->current.custom_real = atof(choice + 7); + break; + + case PPD_CUSTOM_POINTS : + if (sscanf(choice + 7, "%f%s", &(cparam->current.custom_points), + units) < 2) + strcpy(units, "pt"); + + if (!strcasecmp(units, "cm")) + cparam->current.custom_points *= 72.0 / 2.54; + else if (!strcasecmp(units, "mm")) + cparam->current.custom_points *= 72.0 / 25.4; + else if (!strcasecmp(units, "m")) + cparam->current.custom_points *= 72.0 / 0.0254; + else if (!strcasecmp(units, "in")) + cparam->current.custom_points *= 72.0; + else if (!strcasecmp(units, "ft")) + cparam->current.custom_points *= 12 * 72.0; + break; + + case PPD_CUSTOM_INT : + cparam->current.custom_int = atoi(choice + 7); + break; + + case PPD_CUSTOM_PASSCODE : + case PPD_CUSTOM_PASSWORD : + case PPD_CUSTOM_STRING : + if (cparam->current.custom_string) + free(cparam->current.custom_string); + + cparam->current.custom_string = strdup(choice + 7); + break; + } } } - else if (strcasecmp(option, "InputSlot") == 0) - { - /* - * Unmark ManualFeed option... - */ + } + else + { + for (i = o->num_choices, c = o->choices; i > 0; i --, c ++) + if (!strcasecmp(c->choice, choice)) + break; - if ((o = ppdFindOption(ppd, "ManualFeed")) != NULL) - for (i = 0; i < o->num_choices; i ++) - o->choices[i].marked = 0; - } - else if (strcasecmp(option, "ManualFeed") == 0) - { - /* - * Unmark InputSlot option... - */ + if (!i) + return (0); + } - if ((o = ppdFindOption(ppd, "InputSlot")) != NULL) - for (i = 0; i < o->num_choices; i ++) - o->choices[i].marked = 0; - } + /* + * Option found; mark it and then handle unmarking any other options. + */ + + c->marked = 1; + + if (o->ui != PPD_UI_PICKMANY) + { + /* + * Unmark all other choices... + */ + + for (i = o->num_choices, c = o->choices; i > 0; i --, c ++) + if (strcasecmp(c->choice, choice)) + { + c->marked = 0; + + if (!strcasecmp(option, "PageSize") || + !strcasecmp(option, "PageRegion")) + { + /* + * Mark current page size... + */ + + for (j = 0; j < ppd->num_sizes; j ++) + ppd->sizes[i].marked = !strcasecmp(ppd->sizes[i].name, + choice); + + /* + * Unmark the current PageSize or PageRegion setting, as + * appropriate... + */ + + if (!strcasecmp(option, "PageSize")) + { + if ((o = ppdFindOption(ppd, "PageRegion")) != NULL) + for (j = 0; j < o->num_choices; j ++) + o->choices[i].marked = 0; + } + else + { + if ((o = ppdFindOption(ppd, "PageSize")) != NULL) + for (j = 0; j < o->num_choices; j ++) + o->choices[j].marked = 0; + } + } + else if (!strcasecmp(option, "InputSlot")) + { + /* + * Unmark ManualFeed True and possibly mark ManualFeed False + * option... + */ + + if ((o = ppdFindOption(ppd, "ManualFeed")) != NULL) + for (j = 0; j < o->num_choices; j ++) + o->choices[j].marked = !strcasecmp(o->choices[j].choice, "False"); + } + else if (!strcasecmp(option, "ManualFeed") && + !strcasecmp(choice, "True")) + { + /* + * Unmark InputSlot option... + */ + + if ((o = ppdFindOption(ppd, "InputSlot")) != NULL) + for (j = 0; j < o->num_choices; j ++) + o->choices[j].marked = 0; + } + } } + /* + * Return the number of conflicts... + */ + return (ppdConflicts(ppd)); } @@ -439,5 +545,5 @@ ppd_defaults(ppd_file_t *ppd, /* I - PPD file */ /* - * End of "$Id: mark.c 4494 2005-02-18 02:18:11Z mike $". + * End of "$Id: mark.c 4980 2006-01-25 19:57:45Z mike $". */ diff --git a/cups/normalize.c b/cups/normalize.c index cbeb3daaea..35e77304d6 100644 --- a/cups/normalize.c +++ b/cups/normalize.c @@ -1,5 +1,5 @@ /* - * "$Id: normalize.c 4903 2006-01-10 20:02:46Z mike $" + * "$Id: normalize.c 4967 2006-01-24 03:42:15Z mike $" * * Unicode normalization for the Common UNIX Printing System (CUPS). * @@ -26,6 +26,7 @@ * cupsNormalizeMapsGet() - Get all norm maps to cache. * cupsNormalizeMapsFree() - Free all norm maps in cache. * cupsNormalizeMapsFlush() - Flush all norm maps in cache. + * _cupsNormalizeMapsFlush() - Flush all normalization maps in cache. * cupsUTF8Normalize() - Normalize UTF-8 string. * cupsUTF32Normalize() - Normalize UTF-32 string. * cupsUTF8CaseFold() - Case fold UTF-8 string. @@ -314,13 +315,23 @@ cupsNormalizeMapsFree(void) void cupsNormalizeMapsFlush(void) +{ + _cupsNormalizeMapsFlush(_cupsGlobals()); +} + + +/* + * '_cupsNormalizeMapsFlush()' - Flush all normalization maps in cache. + */ + +void +_cupsNormalizeMapsFlush( + _cups_globals_t *cg) /* I - Global data */ { _cups_norm_map_t *nmap; /* Unicode Normalization Map */ _cups_norm_map_t *nextnorm; /* Next Unicode Normalization Map */ _cups_fold_map_t *fmap; /* Unicode Case Folding Map */ _cups_fold_map_t *nextfold; /* Next Unicode Case Folding Map */ - _cups_globals_t *cg = _cupsGlobals(); - /* Pointer to library globals */ /* @@ -2173,5 +2184,5 @@ compare_propchar(const void *k1, /* I - Key char */ /* - * End of "$Id: normalize.c 4903 2006-01-10 20:02:46Z mike $" + * End of "$Id: normalize.c 4967 2006-01-24 03:42:15Z mike $" */ diff --git a/cups/notify.c b/cups/notify.c new file mode 100644 index 0000000000..2a89aca3c6 --- /dev/null +++ b/cups/notify.c @@ -0,0 +1,211 @@ +/* + * "$Id: notify.c 4961 2006-01-20 22:19:13Z mike $" + * + * Notification routines for the Common UNIX Printing System (CUPS). + * + * Copyright 2005-2006 by Easy Software Products. + * + * These coded instructions, statements, and computer programs are the + * property of Easy Software Products 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 missing or damaged please contact Easy Software Products + * at: + * + * Attn: CUPS Licensing Information + * Easy Software Products + * 44141 Airport View Drive, Suite 204 + * Hollywood, Maryland 20636 USA + * + * Voice: (301) 373-9600 + * EMail: cups-info@cups.org + * WWW: http://www.cups.org + * + * This file is subject to the Apple OS-Developed Software exception. + * + * Contents: + * + * cupsNotifySubject() - Return the subject for the given notification + * message. + * cupsNotifyText() - Return the text for the given notification message. + */ + +/* + * Include necessary headers... + */ + +#include "globals.h" + + +/* + * 'cupsNotifySubject()' - Return the subject for the given notification message. + * + * The returned string must be freed by the caller using free(). + * + * @since CUPS 1.2@ + */ + +char * /* O - Subject string or NULL */ +cupsNotifySubject(cups_lang_t *lang, /* I - Language data */ + ipp_t *event) /* I - Event data */ +{ + char buffer[1024]; /* Subject buffer */ + const char *prefix, /* Prefix on subject */ + *state; /* Printer/job state string */ + ipp_attribute_t *job_id, /* notify-job-id */ + *job_name, /* job-name */ + *job_state, /* job-state */ + *printer_name, /* printer-name */ + *printer_state, /* printer-state */ + *printer_uri, /* notify-printer-uri */ + *subscribed; /* notify-subscribed-event */ + + + /* + * Range check input... + */ + + if (!event || !lang) + return (NULL); + + /* + * Get the required attributes... + */ + + job_id = ippFindAttribute(event, "notify-job-id", IPP_TAG_INTEGER); + job_name = ippFindAttribute(event, "job-name", IPP_TAG_NAME); + job_state = ippFindAttribute(event, "job-state", IPP_TAG_ENUM); + printer_name = ippFindAttribute(event, "printer-name", IPP_TAG_NAME); + printer_state = ippFindAttribute(event, "printer-state", IPP_TAG_ENUM); + printer_uri = ippFindAttribute(event, "notify-printer-uri", IPP_TAG_URI); + subscribed = ippFindAttribute(event, "notify-subscribed-event", + IPP_TAG_KEYWORD); + + + if (job_id && printer_name && printer_uri && job_state) + { + /* + * Job event... + */ + + prefix = _cupsLangString(lang, _("Print Job:")); + + switch (job_state->values[0].integer) + { + case IPP_JOB_PENDING : + state = _cupsLangString(lang, _("pending")); + break; + case IPP_JOB_HELD : + state = _cupsLangString(lang, _("held")); + break; + case IPP_JOB_PROCESSING : + state = _cupsLangString(lang, _("processing")); + break; + case IPP_JOB_STOPPED : + state = _cupsLangString(lang, _("stopped")); + break; + case IPP_JOB_CANCELLED : + state = _cupsLangString(lang, _("canceled")); + break; + case IPP_JOB_ABORTED : + state = _cupsLangString(lang, _("aborted")); + break; + case IPP_JOB_COMPLETED : + state = _cupsLangString(lang, _("completed")); + break; + default : + state = _cupsLangString(lang, _("unknown")); + break; + } + + snprintf(buffer, sizeof(buffer), "%s %s-%d (%s) %s", + prefix, + printer_name->values[0].string.text, + job_id->values[0].integer, + job_name ? job_name->values[0].string.text : + _cupsLangString(lang, _("untitled")), + state); + } + else if (printer_uri && printer_name && printer_state) + { + /* + * Printer event... + */ + + prefix = _cupsLangString(lang, _("Printer:")); + + switch (printer_state->values[0].integer) + { + case IPP_PRINTER_IDLE : + state = _cupsLangString(lang, _("idle")); + break; + case IPP_PRINTER_PROCESSING : + state = _cupsLangString(lang, _("processing")); + break; + case IPP_PRINTER_STOPPED : + state = _cupsLangString(lang, _("stopped")); + break; + default : + state = _cupsLangString(lang, _("unknown")); + break; + } + + snprintf(buffer, sizeof(buffer), "%s %s %s", + prefix, + printer_name->values[0].string.text, + state); + } + else if (subscribed) + strlcpy(buffer, subscribed->values[0].string.text, sizeof(buffer)); + else + return (NULL); + + /* + * Duplicate and return the subject string... + */ + + return (strdup(buffer)); +} + + +/* + * 'cupsNotifyText()' - Return the text for the given notification message. + * + * The returned string must be freed by the caller using free(). + * + * @since CUPS 1.2@ + */ + +char * /* O - Message text or NULL */ +cupsNotifyText(cups_lang_t *lang, /* I - Language data */ + ipp_t *event) /* I - Event data */ +{ + ipp_attribute_t *notify_text; /* notify-text */ + + + /* + * Range check input... + */ + + if (!event || !lang) + return (NULL); + + /* + * Get the notify-text attribute from the server... + */ + + if ((notify_text = ippFindAttribute(event, "notify-text", + IPP_TAG_TEXT)) == NULL) + return (NULL); + + /* + * Return a copy... + */ + + return (strdup(notify_text->values[0].string.text)); +} + + +/* + * End of "$Id: notify.c 4961 2006-01-20 22:19:13Z mike $". + */ diff --git a/cups/options.c b/cups/options.c index f6883d4b08..cbaa591906 100644 --- a/cups/options.c +++ b/cups/options.c @@ -1,5 +1,5 @@ /* - * "$Id: options.c 4918 2006-01-12 05:14:40Z mike $" + * "$Id: options.c 4980 2006-01-25 19:57:45Z mike $" * * Option routines for the Common UNIX Printing System (CUPS). * @@ -367,6 +367,7 @@ cupsMarkOptions( char *val, /* Pointer into value */ *ptr, /* Pointer into string */ s[255]; /* Temporary string */ + const char *page_size; /* PageSize option */ cups_option_t *optptr; /* Current option */ ppd_option_t *option; /* PPD option */ static const char * const duplex_options[] = @@ -407,16 +408,23 @@ cupsMarkOptions( * Mark options... */ - conflict = 0; + conflict = 0; for (i = num_options, optptr = options; i > 0; i --, optptr ++) if (!strcasecmp(optptr->name, "media")) { /* * Loop through the option string, separating it at commas and - * marking each individual option. + * marking each individual option as long as the corresponding + * PPD option (PageSize, InputSlot, etc.) is not also set. + * + * For PageSize, we also check for an empty option value since + * some versions of MacOS X use it to specify auto-selection + * of the media based solely on the size. */ + page_size = cupsGetOption("PageSize", num_options, options); + for (val = optptr->value; *val;) { /* @@ -434,7 +442,7 @@ cupsMarkOptions( * Mark it... */ - if (cupsGetOption("PageSize", num_options, options) == NULL) + if (!page_size || !page_size[0]) if (ppdMarkOption(ppd, "PageSize", s)) conflict = 1; @@ -569,5 +577,5 @@ cupsMarkOptions( /* - * End of "$Id: options.c 4918 2006-01-12 05:14:40Z mike $". + * End of "$Id: options.c 4980 2006-01-25 19:57:45Z mike $". */ diff --git a/cups/ppd.c b/cups/ppd.c index 91f0c5535d..672ee27d3f 100644 --- a/cups/ppd.c +++ b/cups/ppd.c @@ -1,5 +1,5 @@ /* - * "$Id: ppd.c 4910 2006-01-10 21:30:48Z mike $" + * "$Id: ppd.c 4990 2006-01-26 02:21:45Z mike $" * * PPD file routines for the Common UNIX Printing System (CUPS). * @@ -34,28 +34,29 @@ * * Contents: * - * _ppd_attr_compare() - Compare two attributes. - * ppdClose() - Free all memory used by the PPD file. - * ppdErrorString() - Returns the text assocated with a status. - * ppdLastError() - Return the status from the last ppdOpen*(). - * ppdOpen() - Read a PPD file into memory. - * ppdOpenFd() - Read a PPD file into memory. - * ppdOpenFile() - Read a PPD file into memory. - * ppdSetConformance() - Set the conformance level for PPD files. - * ppd_add_attr() - Add an attribute to the PPD data. - * ppd_add_choice() - Add a choice to an option. - * ppd_add_size() - Add a page size. - * ppd_compare_groups() - Compare two groups. - * ppd_compare_options() - Compare two options. - * ppd_decode() - Decode a string value... - * ppd_free_group() - Free a single UI group. - * ppd_free_option() - Free a single option. - * ppd_get_extoption() - Get an extended option record. - * ppd_get_extparam() - Get an extended parameter record. - * ppd_get_group() - Find or create the named group as needed. - * ppd_get_option() - Find or create the named option as needed. - * ppd_read() - Read a line from a PPD file, skipping comment - * lines as necessary. + * _ppd_attr_compare() - Compare two attributes. + * ppdClose() - Free all memory used by the PPD file. + * ppdErrorString() - Returns the text assocated with a status. + * ppdLastError() - Return the status from the last ppdOpen*(). + * ppdOpen() - Read a PPD file into memory. + * ppdOpenFd() - Read a PPD file into memory. + * ppdOpenFile() - Read a PPD file into memory. + * ppdSetConformance() - Set the conformance level for PPD files. + * ppd_add_attr() - Add an attribute to the PPD data. + * ppd_add_choice() - Add a choice to an option. + * ppd_add_size() - Add a page size. + * ppd_compare_coptions() - Compare two custom options. + * ppd_compare_cparams() - Compare two custom parameters. + * ppd_compare_options() - Compare two options. + * ppd_decode() - Decode a string value... + * ppd_free_group() - Free a single UI group. + * ppd_free_option() - Free a single option. + * ppd_get_coption() - Get a custom option record. + * ppd_get_cparam() - Get a custom parameter record. + * ppd_get_group() - Find or create the named group as needed. + * ppd_get_option() - Find or create the named option as needed. + * ppd_read() - Read a line from a PPD file, skipping comment + * lines as necessary. */ /* @@ -96,19 +97,16 @@ static ppd_attr_t *ppd_add_attr(ppd_file_t *ppd, const char *name, const char *value); static ppd_choice_t *ppd_add_choice(ppd_option_t *option, const char *name); static ppd_size_t *ppd_add_size(ppd_file_t *ppd, const char *name); -#ifndef __APPLE__ -static int ppd_compare_groups(ppd_group_t *g0, ppd_group_t *g1); -static int ppd_compare_options(ppd_option_t *o0, ppd_option_t *o1); -#endif /* !__APPLE__ */ +static int ppd_compare_coptions(ppd_coption_t *a, ppd_coption_t *b); +static int ppd_compare_cparams(ppd_cparam_t *a, ppd_cparam_t *b); +static int ppd_compare_options(ppd_option_t *a, ppd_option_t *b); static int ppd_decode(char *string); static void ppd_free_group(ppd_group_t *group); static void ppd_free_option(ppd_option_t *option); -#if 0 -static ppd_ext_option_t *ppd_get_extoption(ppd_file_t *ppd, const char *name); -static ppd_ext_param_t *ppd_get_extparam(ppd_ext_option_t *opt, - const char *param, - const char *text); -#endif /* 0 */ +static ppd_coption_t *ppd_get_coption(ppd_file_t *ppd, const char *name); +static ppd_cparam_t *ppd_get_cparam(ppd_coption_t *opt, + const char *param, + const char *text); static ppd_group_t *ppd_get_group(ppd_file_t *ppd, const char *name, const char *text, _cups_globals_t *cg); static ppd_option_t *ppd_get_option(ppd_group_t *group, const char *name); @@ -150,18 +148,15 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */ char **font; /* Current font */ char **filter; /* Current filter */ ppd_attr_t **attr; /* Current attribute */ -#if 0 - int j; /* Looping var */ - ppd_ext_option_t **opt; /* Current extended option */ - ppd_ext_param_t **param; /* Current extended parameter */ -#endif /* 0 */ + ppd_coption_t *coption; /* Current custom option */ + ppd_cparam_t *cparam; /* Current custom parameter */ /* - * Range check the PPD file record... + * Range check arguments... */ - if (ppd == NULL) + if (!ppd) return; /* @@ -200,23 +195,21 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */ ppd_free(ppd->groups); } + cupsArrayDelete(ppd->options); + /* * Free any page sizes... */ if (ppd->num_sizes > 0) - { ppd_free(ppd->sizes); - } /* * Free any constraints... */ if (ppd->num_consts > 0) - { ppd_free(ppd->consts); - } /* * Free any filters... @@ -251,9 +244,7 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */ */ if (ppd->num_profiles > 0) - { ppd_free(ppd->profiles); - } /* * Free any attributes... @@ -270,22 +261,41 @@ ppdClose(ppd_file_t *ppd) /* I - PPD file record */ ppd_free(ppd->attrs); } -#if 0 - if (ppd->num_extended) + /* + * Free custom options... + */ + + for (coption = (ppd_coption_t *)cupsArrayFirst(ppd->coptions); + coption; + coption = (ppd_coption_t *)cupsArrayNext(ppd->coptions)) { - for (i = ppd->num_extended, opt = ppd->extended; i > 0; i --, opt ++) + for (cparam = (ppd_cparam_t *)cupsArrayFirst(coption->params); + cparam; + cparam = (ppd_cparam_t *)cupsArrayNext(coption->params)) { - ppd_free((*opt)->code); + switch (cparam->type) + { + case PPD_CUSTOM_PASSCODE : + case PPD_CUSTOM_PASSWORD : + case PPD_CUSTOM_STRING : + ppd_free(cparam->current.custom_string); + ppd_free(cparam->minimum.custom_string); + ppd_free(cparam->maximum.custom_string); + break; - for (j = (*opt)->num_params, param = (*opt)->params; j > 0; j --, param ++) - ppd_free((*param)->value); + default : + break; + } - ppd_free((*opt)->params); + free(cparam); } - ppd_free(ppd->extended); + cupsArrayDelete(coption->params); + + free(coption); } -#endif /* 0 */ + + cupsArrayDelete(ppd->coptions); /* * Free the whole record... @@ -306,33 +316,34 @@ ppdErrorString(ppd_status_t status) /* I - PPD status */ { static const char * const messages[] =/* Status messages */ { - "OK", - "Unable to open PPD file", - "NULL PPD file pointer", - "Memory allocation error", - "Missing PPD-Adobe-4.x header", - "Missing value string", - "Internal error", - "Bad OpenGroup", - "OpenGroup without a CloseGroup first", - "Bad OpenUI/JCLOpenUI", - "OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first", - "Bad OrderDependency", - "Bad UIConstraints", - "Missing asterisk in column 1", - "Line longer than the maximum allowed (255 characters)", - "Illegal control character", - "Illegal main keyword string", - "Illegal option keyword string", - "Illegal translation string", - "Illegal whitespace character" + _("OK"), + _("Unable to open PPD file"), + _("NULL PPD file pointer"), + _("Memory allocation error"), + _("Missing PPD-Adobe-4.x header"), + _("Missing value string"), + _("Internal error"), + _("Bad OpenGroup"), + _("OpenGroup without a CloseGroup first"), + _("Bad OpenUI/JCLOpenUI"), + _("OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first"), + _("Bad OrderDependency"), + _("Bad UIConstraints"), + _("Missing asterisk in column 1"), + _("Line longer than the maximum allowed (255 characters)"), + _("Illegal control character"), + _("Illegal main keyword string"), + _("Illegal option keyword string"), + _("Illegal translation string"), + _("Illegal whitespace character"), + _("Bad custom parameter") }; if (status < PPD_OK || status > PPD_ILLEGAL_WHITESPACE) - return ("Unknown"); + return (_cupsLangString(cupsLangDefault(), _("Unknown"))); else - return (messages[status]); + return (_cupsLangString(cupsLangDefault(), messages[status])); } @@ -400,7 +411,7 @@ ppd_file_t * /* O - PPD file record */ ppdOpen2(cups_file_t *fp) /* I - File to read from */ { char *oldlocale; /* Old locale settings */ - int i, j, k, m; /* Looping vars */ + int i, j, k; /* Looping vars */ int count; /* Temporary count */ ppd_file_t *ppd; /* PPD file record */ ppd_group_t *group, /* Current group */ @@ -538,6 +549,8 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ ppd->color_device = 0; ppd->colorspace = PPD_CS_GRAY; ppd->landscape = -90; + ppd->coptions = cupsArrayNew((cups_array_func_t)ppd_compare_coptions, + NULL); /* * Get the default language for the user... @@ -832,6 +845,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ ppd->fonts[ppd->num_fonts] = strdup(name); ppd->num_fonts ++; } +#if 0 else if (!strcmp(keyword, "ParamCustomPageSize")) { if (!strcmp(name, "Width")) @@ -841,87 +855,202 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ sscanf(string, "%*s%*s%f%f", ppd->custom_min + 1, ppd->custom_max + 1); } - else if (!strcmp(keyword, "HWMargins")) - sscanf(string, "%f%f%f%f", ppd->custom_margins + 0, - ppd->custom_margins + 1, ppd->custom_margins + 2, - ppd->custom_margins + 3); - else if (!strcmp(keyword, "CustomPageSize") && - !strcmp(name, "True")) +#endif /* 0 */ + else if (!strncmp(keyword, "ParamCustom", 11)) { - DEBUG_puts("Processing CustomPageSize..."); + ppd_coption_t *coption; /* Custom option */ + ppd_cparam_t *cparam; /* Custom parameter */ + int corder; /* Order number */ + char ctype[33], /* Data type */ + cminimum[65], /* Minimum value */ + cmaximum[65]; /* Maximum value */ + + + /* + * Get the custom option and parameter... + */ - if (!ppd->variable_sizes) + if ((coption = ppd_get_coption(ppd, keyword + 11)) == NULL) { - ppd->variable_sizes = 1; + cg->ppd_status = PPD_ALLOC_ERROR; - /* - * Add a "Custom" page size entry... - */ + goto error; + } - ppd_add_size(ppd, "Custom"); + if ((cparam = ppd_get_cparam(coption, name, text)) == NULL) + { + cg->ppd_status = PPD_ALLOC_ERROR; - /* - * Add a "Custom" page size option... - */ + goto error; + } + + /* + * Get the parameter data... + */ + + if (sscanf(string, "%d%32s%64s%64s", &corder, ctype, cminimum, + cmaximum) != 4) + { + cg->ppd_status = PPD_BAD_CUSTOM_PARAM; + + goto error; + } + + cparam->order = corder; - if ((option = ppdFindOption(ppd, "PageSize")) == NULL) + if (!strcmp(ctype, "curve")) + { + cparam->type = PPD_CUSTOM_CURVE; + cparam->minimum.custom_curve = atof(cminimum); + cparam->maximum.custom_curve = atof(cmaximum); + } + else if (!strcmp(ctype, "int")) + { + cparam->type = PPD_CUSTOM_INT; + cparam->minimum.custom_int = atoi(cminimum); + cparam->maximum.custom_int = atoi(cmaximum); + } + else if (!strcmp(ctype, "invcurve")) + { + cparam->type = PPD_CUSTOM_INVCURVE; + cparam->minimum.custom_invcurve = atof(cminimum); + cparam->maximum.custom_invcurve = atof(cmaximum); + } + else if (!strcmp(ctype, "passcode")) + { + cparam->type = PPD_CUSTOM_PASSCODE; + cparam->minimum.custom_passcode = strdup(cminimum); + cparam->maximum.custom_passcode = strdup(cmaximum); + } + else if (!strcmp(ctype, "password")) + { + cparam->type = PPD_CUSTOM_PASSWORD; + cparam->minimum.custom_password = strdup(cminimum); + cparam->maximum.custom_password = strdup(cmaximum); + } + else if (!strcmp(ctype, "points")) + { + cparam->type = PPD_CUSTOM_POINTS; + cparam->minimum.custom_points = atof(cminimum); + cparam->maximum.custom_points = atof(cmaximum); + } + else if (!strcmp(ctype, "real")) + { + cparam->type = PPD_CUSTOM_REAL; + cparam->minimum.custom_real = atof(cminimum); + cparam->maximum.custom_real = atof(cmaximum); + } + else if (!strcmp(ctype, "string")) + { + cparam->type = PPD_CUSTOM_STRING; + cparam->minimum.custom_string = strdup(cminimum); + cparam->maximum.custom_string = strdup(cmaximum); + } + else + { + cg->ppd_status = PPD_BAD_CUSTOM_PARAM; + + goto error; + } + + /* + * Now special-case for CustomPageSize... + */ + + if (!strcmp(coption->keyword, "PageSize")) + { + if (!strcmp(name, "Width")) + { + ppd->custom_min[0] = cparam->minimum.custom_points; + ppd->custom_max[0] = cparam->maximum.custom_points; + } + else if (!strcmp(name, "Height")) { - ppd_group_t *gtemp; + ppd->custom_min[1] = cparam->minimum.custom_points; + ppd->custom_max[1] = cparam->maximum.custom_points; + } + } + } + else if (!strcmp(keyword, "HWMargins")) + sscanf(string, "%f%f%f%f", ppd->custom_margins + 0, + ppd->custom_margins + 1, ppd->custom_margins + 2, + ppd->custom_margins + 3); + else if (!strncmp(keyword, "Custom", 6) && !strcmp(name, "True")) + { + ppd_coption_t *coption; /* Custom option */ - DEBUG_puts("PageSize option not found for CustomPageSize..."); + DEBUG_puts("Processing Custom option..."); - if ((gtemp = ppd_get_group(ppd, "General", _("General"), cg)) == NULL) - { - DEBUG_puts("Unable to get general group!"); + /* + * Get the option and custom option... + */ - goto error; - } + if ((option = ppdFindOption(ppd, keyword + 6)) == NULL) + { + ppd_group_t *gtemp; /* Temporary group */ - if ((option = ppd_get_option(gtemp, "PageSize")) == NULL) - { - DEBUG_puts("Unable to get PageSize option!"); - cg->ppd_status = PPD_ALLOC_ERROR; + DEBUG_printf(("%s option not found for %s...\n", keyword + 6, keyword)); - goto error; - } - } + if ((gtemp = ppd_get_group(ppd, "General", _("General"), cg)) == NULL) + { + DEBUG_puts("Unable to get general group!"); - if ((choice = ppd_add_choice(option, "Custom")) == NULL) + goto error; + } + + if ((option = ppd_get_option(gtemp, keyword + 6)) == NULL) { - DEBUG_puts("Unable to add Custom choice!"); + DEBUG_printf(("Unable to get %s option!\n", keyword + 6)); cg->ppd_status = PPD_ALLOC_ERROR; goto error; } - - strlcpy(choice->text, _("Variable"), sizeof(choice->text)); - option = NULL; } - if ((option = ppdFindOption(ppd, "PageSize")) == NULL) + if ((coption = ppd_get_coption(ppd, keyword + 6)) == NULL) { - DEBUG_puts("Unable to find PageSize option!"); - - cg->ppd_status = PPD_INTERNAL_ERROR; + cg->ppd_status = PPD_ALLOC_ERROR; goto error; } - if ((choice = ppdFindChoice(option, "Custom")) == NULL) + /* + * Add the "custom" option... + */ + + if ((choice = ppd_add_choice(option, "Custom")) == NULL) { - DEBUG_puts("Unable to find Custom choice!"); + DEBUG_puts("Unable to add Custom choice!"); - cg->ppd_status = PPD_INTERNAL_ERROR; + cg->ppd_status = PPD_ALLOC_ERROR; goto error; } + strlcpy(choice->text, text[0] ? text : _("Custom"), + sizeof(choice->text)); + choice->code = string; - option = NULL; string = NULL; /* Don't add as an attribute below */ + option = NULL; + + /* + * Now process custom page sizes specially... + */ + + if (!strcmp(keyword, "CustomPageSize")) + { + ppd->variable_sizes = 1; + + /* + * Add a "Custom" page size entry... + */ + + ppd_add_size(ppd, "Custom"); + } } else if (!strcmp(keyword, "LandscapeOrientation")) { @@ -1127,7 +1256,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ * Find the JCL group, and add if needed... */ - group = ppd_get_group(ppd, "JCL", "JCL", cg); + group = ppd_get_group(ppd, "JCL", _("JCL"), cg); if (group == NULL) goto error; @@ -1530,220 +1659,6 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ choice->code = string; string = NULL; /* Don't add as an attribute below */ } -#if 0 - else if (strcmp(keyword, "cupsUIType") == 0 && - (mask & (PPD_KEYWORD | PPD_STRING)) == (PPD_KEYWORD | PPD_STRING) && - option != NULL) - { - /* - * Define an extended option value type... - */ - - extopt = ppd_get_extoption(ppd, name); - - if (strcmp(string, "Text") == 0) - option->ui = PPD_UI_CUPS_TEXT; - else if (strcmp(string, "Integer") == 0) - { - option->ui = PPD_UI_CUPS_INTEGER; - extopt->defval.integer = 0; - extopt->minval.integer = 0; - extopt->maxval.integer = 100; - } - else if (strcmp(string, "Real") == 0) - { - option->ui = PPD_UI_CUPS_REAL; - extopt->defval.real = 0.0; - extopt->minval.real = 0.0; - extopt->maxval.real = 1.0; - } - else if (strcmp(string, "Gamma") == 0) - { - option->ui = PPD_UI_CUPS_GAMMA; - extopt->defval.gamma = 1.0; - extopt->minval.gamma = 1.0; - extopt->maxval.gamma = 10.0; - } - else if (strcmp(string, "Curve") == 0) - { - option->ui = PPD_UI_CUPS_CURVE; - extopt->defval.curve.start = 0.0; - extopt->defval.curve.end = 0.0; - extopt->defval.curve.gamma = 1.0; - extopt->minval.curve.start = 0.0; - extopt->minval.curve.end = 0.0; - extopt->minval.curve.gamma = 1.0; - extopt->maxval.curve.start = 1.0; - extopt->maxval.curve.end = 1.0; - extopt->maxval.curve.gamma = 10.0; - } - else if (strcmp(string, "IntegerArray") == 0) - { - option->ui = PPD_UI_CUPS_INTEGER_ARRAY; - extopt->defval.integer_array.num_elements = 2; - extopt->minval.integer_array.num_elements = 2; - extopt->maxval.integer_array.num_elements = 16; - } - else if (strcmp(string, "RealArray") == 0) - { - option->ui = PPD_UI_CUPS_REAL_ARRAY; - extopt->defval.real_array.num_elements = 2; - extopt->minval.real_array.num_elements = 2; - extopt->maxval.real_array.num_elements = 16; - } - } - else if (strcmp(keyword, "cupsUIDefault") == 0 && - (mask & (PPD_KEYWORD | PPD_STRING)) == (PPD_KEYWORD | PPD_STRING) && - option != NULL) - { - /* - * Define an extended option minimum value... - */ - - extopt = ppd_get_extoption(ppd, name); - - switch (option->ui) - { - case PPD_UI_CUPS_INTEGER : - sscanf(string, "%d", &(extopt->defval.integer)); - break; - - case PPD_UI_CUPS_REAL : - sscanf(string, "%f", &(extopt->defval.real)); - break; - - case PPD_UI_CUPS_GAMMA : - sscanf(string, "%f", &(extopt->defval.gamma)); - break; - - case PPD_UI_CUPS_CURVE : - sscanf(string, "%f%f%f", &(extopt->defval.curve.start), - &(extopt->defval.curve.end), - &(extopt->defval.curve.gamma)); - break; - - case PPD_UI_CUPS_INTEGER_ARRAY : - extopt->defval.integer_array.elements = calloc(1, sizeof(int)); - sscanf(string, "%d%d", &(extopt->defval.integer_array.num_elements), - extopt->defval.integer_array.elements); - break; - - case PPD_UI_CUPS_REAL_ARRAY : - extopt->defval.real_array.elements = calloc(1, sizeof(float)); - sscanf(string, "%d%f", &(extopt->defval.real_array.num_elements), - extopt->defval.real_array.elements); - break; - - default : - break; - } - } - else if (strcmp(keyword, "cupsUIMinimum") == 0 && - (mask & (PPD_KEYWORD | PPD_STRING)) == (PPD_KEYWORD | PPD_STRING) && - option != NULL) - { - /* - * Define an extended option minimum value... - */ - - extopt = ppd_get_extoption(ppd, name); - - switch (option->ui) - { - case PPD_UI_CUPS_INTEGER : - sscanf(string, "%d", &(extopt->minval.integer)); - break; - - case PPD_UI_CUPS_REAL : - sscanf(string, "%f", &(extopt->minval.real)); - break; - - case PPD_UI_CUPS_GAMMA : - sscanf(string, "%f", &(extopt->minval.gamma)); - break; - - case PPD_UI_CUPS_CURVE : - sscanf(string, "%f%f%f", &(extopt->minval.curve.start), - &(extopt->minval.curve.end), - &(extopt->minval.curve.gamma)); - break; - - case PPD_UI_CUPS_INTEGER_ARRAY : - extopt->minval.integer_array.elements = calloc(1, sizeof(int)); - sscanf(string, "%d%d", &(extopt->minval.integer_array.num_elements), - extopt->minval.integer_array.elements); - break; - - case PPD_UI_CUPS_REAL_ARRAY : - extopt->minval.real_array.elements = calloc(1, sizeof(float)); - sscanf(string, "%d%f", &(extopt->minval.real_array.num_elements), - extopt->minval.real_array.elements); - break; - - default : - break; - } - } - else if (strcmp(keyword, "cupsUIMaximum") == 0 && - (mask & (PPD_KEYWORD | PPD_STRING)) == (PPD_KEYWORD | PPD_STRING) && - option != NULL) - { - /* - * Define an extended option maximum value... - */ - - extopt = ppd_get_extoption(ppd, name); - - switch (option->ui) - { - case PPD_UI_CUPS_INTEGER : - sscanf(string, "%d", &(extopt->maxval.integer)); - break; - - case PPD_UI_CUPS_REAL : - sscanf(string, "%f", &(extopt->maxval.real)); - break; - - case PPD_UI_CUPS_GAMMA : - sscanf(string, "%f", &(extopt->maxval.gamma)); - break; - - case PPD_UI_CUPS_CURVE : - sscanf(string, "%f%f%f", &(extopt->maxval.curve.start), - &(extopt->maxval.curve.end), - &(extopt->maxval.curve.gamma)); - break; - - case PPD_UI_CUPS_INTEGER_ARRAY : - extopt->maxval.integer_array.elements = calloc(1, sizeof(int)); - sscanf(string, "%d%d", &(extopt->maxval.integer_array.num_elements), - extopt->maxval.integer_array.elements); - break; - - case PPD_UI_CUPS_REAL_ARRAY : - extopt->maxval.real_array.elements = calloc(1, sizeof(float)); - sscanf(string, "%d%f", &(extopt->maxval.real_array.num_elements), - extopt->maxval.real_array.elements); - break; - - default : - break; - } - } - else if (strcmp(keyword, "cupsUICommand") == 0 && - (mask & (PPD_KEYWORD | PPD_STRING)) == (PPD_KEYWORD | PPD_STRING) && - option != NULL) - { - /* - * Define an extended option command... - */ - - extopt = ppd_get_extoption(ppd, name); - - extopt->command = string; - string = NULL; - } -#endif /* 0 */ /* * Add remaining lines with keywords and string values as attributes... @@ -1753,9 +1668,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ (mask & (PPD_KEYWORD | PPD_STRING)) == (PPD_KEYWORD | PPD_STRING)) ppd_add_attr(ppd, keyword, name, text, string); else - { ppd_free(string); - } } /* @@ -1786,91 +1699,33 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ return (NULL); } -#ifndef __APPLE__ /* - * Make sure that all PPD files with an InputSlot option have an - * "auto" choice that maps to no specific tray or media type. + * Create the sorted options array and set the option back-pointer for + * each choice and custom option... */ - if ((option = ppdFindOption(ppd, "InputSlot")) != NULL) - { - for (i = 0; i < option->num_choices; i ++) - if (option->choices[i].code == NULL || !option->choices[i].code[0] || - !strncasecmp(option->choices[i].choice, "Auto", 4)) - break; - - if (i >= option->num_choices) - { - /* - * No "auto" input slot, add one... - */ - - choice = ppd_add_choice(option, "Auto"); - - strlcpy(choice->text, _("Auto"), sizeof(choice->text)); - choice->code = NULL; - } - } -#endif /* !__APPLE__ */ - - /* - * Set the option back-pointer for each choice... - */ - -#ifndef __APPLE__ - qsort(ppd->groups, ppd->num_groups, sizeof(ppd_group_t), - (int (*)(const void *, const void *))ppd_compare_groups); -#endif /* !__APPLE__ */ + ppd->options = cupsArrayNew((cups_array_func_t)ppd_compare_options, NULL); for (i = ppd->num_groups, group = ppd->groups; i > 0; i --, group ++) { -#ifndef __APPLE__ - qsort(group->options, group->num_options, sizeof(ppd_option_t), - (int (*)(const void *, const void *))ppd_compare_options); -#endif /* !__APPLE__ */ - for (j = group->num_options, option = group->options; j > 0; j --, option ++) { - for (k = 0; k < option->num_choices; k ++) - option->choices[k].option = (void *)option; - } + ppd_coption_t *coption; /* Custom option */ -#ifndef __APPLE__ - qsort(group->subgroups, group->num_subgroups, sizeof(ppd_group_t), - (int (*)(const void *, const void *))ppd_compare_groups); -#endif /* !__APPLE__ */ - for (j = group->num_subgroups, subgroup = group->subgroups; - j > 0; - j --, subgroup ++) - { -#ifndef __APPLE__ - qsort(subgroup->options, subgroup->num_options, sizeof(ppd_option_t), - (int (*)(const void *, const void *))ppd_compare_options); -#endif /* !__APPLE__ */ - - for (k = group->num_options, option = group->options; - k > 0; - k --, option ++) - { - for (m = 0; m < option->num_choices; m ++) - option->choices[m].option = (void *)option; - } - } - } + cupsArrayAdd(ppd->options, option); -#if 0 - /* - * Set the option pointers for all extended options... - */ + for (k = 0; k < option->num_choices; k ++) + option->choices[k].option = option; - for (i = 0; i < ppd->num_extended; i ++) - ppd->extended[i]->option = ppdFindOption(ppd, ppd->extended[i]->keyword); -#endif /* 0 */ + if ((coption = ppdFindCustomOption(ppd, option->keyword)) != NULL) + coption->option = option; + } + } /* * Sort the attributes... @@ -1915,7 +1770,7 @@ ppdOpen2(cups_file_t *fp) /* I - File to read from */ ppd_file_t * /* O - PPD file record */ ppdOpenFd(int fd) /* I - File to read from */ { - FILE *fp; /* File pointer */ + cups_file_t *fp; /* CUPS file pointer */ ppd_file_t *ppd; /* PPD file record */ _cups_globals_t *cg = _cupsGlobals(); /* Global data */ @@ -1942,18 +1797,16 @@ ppdOpenFd(int fd) /* I - File to read from */ * Try to open the file and parse it... */ - if ((fp = fdopen(fd, "r")) != NULL) + if ((fp = cupsFileOpenFd(fd, "r")) != NULL) { - setbuf(fp, NULL); - - ppd = ppdOpen(fp); + ppd = ppdOpen2(fp); - fclose(fp); + cupsFileClose(fp); } else { cg->ppd_status = PPD_FILE_OPEN_ERROR; - ppd = NULL; + ppd = NULL; } return (ppd); @@ -2149,16 +2002,27 @@ ppd_add_size(ppd_file_t *ppd, /* I - PPD file */ } -#ifndef __APPLE__ /* - * 'ppd_compare_groups()' - Compare two groups. + * 'ppd_compare_coptions()' - Compare two custom options. */ static int /* O - Result of comparison */ -ppd_compare_groups(ppd_group_t *g0, /* I - First group */ - ppd_group_t *g1) /* I - Second group */ +ppd_compare_coptions(ppd_coption_t *a, /* I - First option */ + ppd_coption_t *b) /* I - Second option */ { - return (strcasecmp(g0->text, g1->text)); + return (strcasecmp(a->keyword, b->keyword)); +} + + +/* + * 'ppd_compare_cparams()' - Compare two custom parameters. + */ + +static int /* O - Result of comparison */ +ppd_compare_cparams(ppd_cparam_t *a, /* I - First parameter */ + ppd_cparam_t *b) /* I - Second parameter */ +{ + return (strcasecmp(a->name, b->name)); } @@ -2167,12 +2031,11 @@ ppd_compare_groups(ppd_group_t *g0, /* I - First group */ */ static int /* O - Result of comparison */ -ppd_compare_options(ppd_option_t *o0, /* I - First option */ - ppd_option_t *o1) /* I - Second option */ +ppd_compare_options(ppd_option_t *a, /* I - First option */ + ppd_option_t *b) /* I - Second option */ { - return (strcasecmp(o0->text, o1->text)); + return (strcasecmp(a->keyword, b->keyword)); } -#endif /* !__APPLE__ */ /* @@ -2291,132 +2154,86 @@ ppd_free_option(ppd_option_t *option) /* I - Option to free */ } -#if 0 /* - * 'ppd_get_extoption()' - Get an extended option record. + * 'ppd_get_coption()' - Get a custom option record. */ -static ppd_ext_option_t * /* O - Extended option... */ -ppd_get_extoption(ppd_file_t *ppd, /* I - PPD file */ - const char *name) /* I - Name of option */ +static ppd_coption_t * /* O - Custom option... */ +ppd_get_coption(ppd_file_t *ppd, /* I - PPD file */ + const char *name) /* I - Name of option */ { - ppd_ext_option_t **temp, /* New array pointer */ - *extopt; /* New extended option */ + ppd_coption_t *copt; /* New custom option */ /* * See if the option already exists... */ - if ((extopt = ppdFindExtOption(ppd, name)) != NULL) - return (extopt); + if ((copt = ppdFindCustomOption(ppd, name)) != NULL) + return (copt); /* - * Not found, so create the extended option record... + * Not found, so create the custom option record... */ - if ((extopt = calloc(1, sizeof(ppd_ext_option_t))) == NULL) + if ((copt = calloc(1, sizeof(ppd_coption_t))) == NULL) return (NULL); - strlcpy(extopt->keyword, name, sizeof(extopt->keyword)); - - /* - * Add this record to the end of the array... - */ - - if (ppd->num_extended == 0) - temp = malloc(sizeof(ppd_ext_option_t *)); - else - temp = realloc(ppd->extended, sizeof(ppd_ext_option_t *) * - (ppd->num_extended + 1)); - - if (temp == NULL) - { - free(extopt); - return (NULL); - } + strlcpy(copt->keyword, name, sizeof(copt->keyword)); - ppd->extended = temp; - temp[ppd->num_extended] = extopt; + copt->params = cupsArrayNew((cups_array_func_t)ppd_compare_cparams, NULL); - ppd->num_extended ++; + cupsArrayAdd(ppd->coptions, copt); /* * Return the new record... */ - return (extopt); + return (copt); } /* - * 'ppd_get_extparam()' - Get an extended parameter record. + * 'ppd_get_cparam()' - Get a custom parameter record. */ -static ppd_ext_param_t * /* O - Extended option... */ -ppd_get_extparam(ppd_ext_option_t *opt, /* I - PPD file */ - const char *param,/* I - Name of parameter */ - const char *text) /* I - Human-readable text */ +static ppd_cparam_t * /* O - Extended option... */ +ppd_get_cparam(ppd_coption_t *opt, /* I - PPD file */ + const char *param, /* I - Name of parameter */ + const char *text) /* I - Human-readable text */ { - ppd_ext_param_t **temp, /* New array pointer */ - *extparam; /* New extended parameter */ + ppd_cparam_t *cparam; /* New custom parameter */ /* * See if the parameter already exists... */ - if ((extparam = ppdFindExtParam(opt, param)) != NULL) - return (extparam); + if ((cparam = ppdFindCustomParam(opt, param)) != NULL) + return (cparam); /* - * Not found, so create the extended parameter record... + * Not found, so create the custom parameter record... */ - if ((extparam = calloc(1, sizeof(ppd_ext_param_t))) == NULL) + if ((cparam = calloc(1, sizeof(ppd_cparam_t))) == NULL) return (NULL); - if ((extparam->value = calloc(4, sizeof(ppd_ext_value_t))) == NULL) - { - ppd_free(extparam); - return (NULL); - } - - extparam->defval = extparam->value + 1; - extparam->minval = extparam->value + 2; - extparam->maxval = extparam->value + 3; - - strlcpy(extparam->keyword, param, sizeof(extparam->keyword)); - strlcpy(extparam->text, text, sizeof(extparam->text)); + strlcpy(cparam->name, param, sizeof(cparam->name)); + strlcpy(cparam->text, text, sizeof(cparam->text)); /* - * Add this record to the end of the array... + * Add this record to the array... */ - if (opt->num_params == 0) - temp = malloc(sizeof(ppd_ext_param_t *)); - else - temp = realloc(opt->params, sizeof(ppd_ext_param_t *) * - (opt->num_params + 1)); - - if (temp == NULL) - { - free(extparam); - return (NULL); - } - - opt->params = temp; - temp[opt->num_params] = extparam; - - opt->num_params ++; + cupsArrayAdd(opt->params, cparam); /* * Return the new record... */ - return (extparam); + return (cparam); } -#endif /* 0 */ /* @@ -2635,7 +2452,11 @@ ppd_read(cups_file_t *fp, /* I - File to read from */ */ if ((ch = cupsFilePeekChar(fp)) == EOF) + { + ch = '\n'; break; + } + if (ch == 0x0a) cupsFileGetChar(fp); } @@ -2871,13 +2692,6 @@ ppd_read(cups_file_t *fp, /* I - File to read from */ if (line[0] != '*') /* All lines start with an asterisk */ { - if (cg->ppd_conform == PPD_CONFORM_STRICT) - { - cg->ppd_status = PPD_MISSING_ASTERISK; - free(line); - return (0); - } - /* * Allow lines consisting of just whitespace... */ @@ -3066,5 +2880,5 @@ ppd_read(cups_file_t *fp, /* I - File to read from */ /* - * End of "$Id: ppd.c 4910 2006-01-10 21:30:48Z mike $". + * End of "$Id: ppd.c 4990 2006-01-26 02:21:45Z mike $". */ diff --git a/cups/ppd.h b/cups/ppd.h index 0edef2410e..0ac53fa281 100644 --- a/cups/ppd.h +++ b/cups/ppd.h @@ -1,10 +1,10 @@ /* - * "$Id: ppd.h 4785 2005-10-13 19:39:05Z mike $" + * "$Id: ppd.h 4980 2006-01-25 19:57:45Z mike $" * * PostScript Printer Description definitions for the Common UNIX Printing * System (CUPS). * - * Copyright 1997-2005 by Easy Software Products, all rights reserved. + * Copyright 1997-2006 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the * property of Easy Software Products and are protected by Federal @@ -42,6 +42,7 @@ */ # include +# include "array.h" # include "file.h" @@ -58,307 +59,265 @@ extern "C" { * PPD version... */ -# define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */ +# define PPD_VERSION 4.3 /* Kept in sync with Adobe version number */ /* * PPD size limits (defined in Adobe spec) */ -# define PPD_MAX_NAME 41 /* Maximum size of name + 1 for nul */ -# define PPD_MAX_TEXT 81 /* Maximum size of text + 1 for nul */ -# define PPD_MAX_LINE 256 /* Maximum size of line + 1 for nul */ +# define PPD_MAX_NAME 41 /* Maximum size of name + 1 for nul */ +# define PPD_MAX_TEXT 81 /* Maximum size of text + 1 for nul */ +# define PPD_MAX_LINE 256 /* Maximum size of line + 1 for nul */ /* * Types and structures... */ -typedef enum ppd_ui_e /**** UI Types ****/ +typedef enum ppd_ui_e /**** UI Types ****/ { - PPD_UI_BOOLEAN, /* True or False option */ - PPD_UI_PICKONE, /* Pick one from a list */ - PPD_UI_PICKMANY /* Pick zero or more from a list */ + PPD_UI_BOOLEAN, /* True or False option */ + PPD_UI_PICKONE, /* Pick one from a list */ + PPD_UI_PICKMANY /* Pick zero or more from a list */ } ppd_ui_t; -typedef enum ppd_section_e /**** Order dependency sections ****/ +typedef enum ppd_section_e /**** Order dependency sections ****/ { - PPD_ORDER_ANY, /* Option code can be anywhere in the file */ - PPD_ORDER_DOCUMENT, /* ... must be in the DocumentSetup section */ - PPD_ORDER_EXIT, /* ... must be sent prior to the document */ - PPD_ORDER_JCL, /* ... must be sent as a JCL command */ - PPD_ORDER_PAGE, /* ... must be in the PageSetup section */ - PPD_ORDER_PROLOG /* ... must be in the Prolog section */ + PPD_ORDER_ANY, /* Option code can be anywhere in the file */ + PPD_ORDER_DOCUMENT, /* ... must be in the DocumentSetup section */ + PPD_ORDER_EXIT, /* ... must be sent prior to the document */ + PPD_ORDER_JCL, /* ... must be sent as a JCL command */ + PPD_ORDER_PAGE, /* ... must be in the PageSetup section */ + PPD_ORDER_PROLOG /* ... must be in the Prolog section */ } ppd_section_t; -typedef enum ppd_cs_e /**** Colorspaces ****/ +typedef enum ppd_cs_e /**** Colorspaces ****/ { - PPD_CS_CMYK = -4, /* CMYK colorspace */ - PPD_CS_CMY, /* CMY colorspace */ - PPD_CS_GRAY = 1, /* Grayscale colorspace */ - PPD_CS_RGB = 3, /* RGB colorspace */ - PPD_CS_RGBK, /* RGBK (K = gray) colorspace */ - PPD_CS_N /* DeviceN colorspace */ + PPD_CS_CMYK = -4, /* CMYK colorspace */ + PPD_CS_CMY, /* CMY colorspace */ + PPD_CS_GRAY = 1, /* Grayscale colorspace */ + PPD_CS_RGB = 3, /* RGB colorspace */ + PPD_CS_RGBK, /* RGBK (K = gray) colorspace */ + PPD_CS_N /* DeviceN colorspace */ } ppd_cs_t; -typedef enum ppd_status_e /**** Status Codes @since CUPS 1.1.19@ ****/ +typedef enum ppd_status_e /**** Status Codes @since CUPS 1.1.19@ ****/ { - PPD_OK = 0, /* OK */ - PPD_FILE_OPEN_ERROR, /* Unable to open PPD file */ - PPD_NULL_FILE, /* NULL PPD file pointer */ - PPD_ALLOC_ERROR, /* Memory allocation error */ - PPD_MISSING_PPDADOBE4, /* Missing PPD-Adobe-4.x header */ - PPD_MISSING_VALUE, /* Missing value string */ - PPD_INTERNAL_ERROR, /* Internal error */ - PPD_BAD_OPEN_GROUP, /* Bad OpenGroup */ - PPD_NESTED_OPEN_GROUP, /* OpenGroup without a CloseGroup first */ - PPD_BAD_OPEN_UI, /* Bad OpenUI/JCLOpenUI */ - PPD_NESTED_OPEN_UI, /* OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first */ - PPD_BAD_ORDER_DEPENDENCY, /* Bad OrderDependency */ - PPD_BAD_UI_CONSTRAINTS, /* Bad UIConstraints */ - PPD_MISSING_ASTERISK, /* Missing asterisk in column 0 */ - PPD_LINE_TOO_LONG, /* Line longer than 255 chars */ - PPD_ILLEGAL_CHARACTER, /* Illegal control character */ - PPD_ILLEGAL_MAIN_KEYWORD, /* Illegal main keyword string */ - PPD_ILLEGAL_OPTION_KEYWORD, /* Illegal option keyword string */ - PPD_ILLEGAL_TRANSLATION, /* Illegal translation string */ - PPD_ILLEGAL_WHITESPACE /* Illegal whitespace character */ + PPD_OK = 0, /* OK */ + PPD_FILE_OPEN_ERROR, /* Unable to open PPD file */ + PPD_NULL_FILE, /* NULL PPD file pointer */ + PPD_ALLOC_ERROR, /* Memory allocation error */ + PPD_MISSING_PPDADOBE4, /* Missing PPD-Adobe-4.x header */ + PPD_MISSING_VALUE, /* Missing value string */ + PPD_INTERNAL_ERROR, /* Internal error */ + PPD_BAD_OPEN_GROUP, /* Bad OpenGroup */ + PPD_NESTED_OPEN_GROUP, /* OpenGroup without a CloseGroup first */ + PPD_BAD_OPEN_UI, /* Bad OpenUI/JCLOpenUI */ + PPD_NESTED_OPEN_UI, /* OpenUI/JCLOpenUI without a CloseUI/JCLCloseUI first */ + PPD_BAD_ORDER_DEPENDENCY, /* Bad OrderDependency */ + PPD_BAD_UI_CONSTRAINTS, /* Bad UIConstraints */ + PPD_MISSING_ASTERISK, /* Missing asterisk in column 0 */ + PPD_LINE_TOO_LONG, /* Line longer than 255 chars */ + PPD_ILLEGAL_CHARACTER, /* Illegal control character */ + PPD_ILLEGAL_MAIN_KEYWORD, /* Illegal main keyword string */ + PPD_ILLEGAL_OPTION_KEYWORD, /* Illegal option keyword string */ + PPD_ILLEGAL_TRANSLATION, /* Illegal translation string */ + PPD_ILLEGAL_WHITESPACE, /* Illegal whitespace character */ + PPD_BAD_CUSTOM_PARAM /* Bad custom parameter */ } ppd_status_t; -typedef enum ppd_conform_e /**** Conformance Levels ****/ +typedef enum ppd_conform_e /**** Conformance Levels ****/ { - PPD_CONFORM_RELAXED, /* Relax whitespace and control char */ - PPD_CONFORM_STRICT /* Require strict conformance */ + PPD_CONFORM_RELAXED, /* Relax whitespace and control char */ + PPD_CONFORM_STRICT /* Require strict conformance */ } ppd_conform_t; -typedef struct ppd_attr_str /**** PPD Attribute Structure @since CUPS 1.1.19@ ****/ +typedef struct ppd_attr_s /**** PPD Attribute Structure @since CUPS 1.1.19@ ****/ { - char name[PPD_MAX_NAME]; - /* Name of attribute (cupsXYZ) */ - char spec[PPD_MAX_NAME]; - /* Specifier string, if any */ - char text[PPD_MAX_TEXT]; - /* Human-readable text, if any */ - char *value; /* Value string */ + char name[PPD_MAX_NAME]; /* Name of attribute (cupsXYZ) */ + char spec[PPD_MAX_NAME]; /* Specifier string, if any */ + char text[PPD_MAX_TEXT]; /* Human-readable text, if any */ + char *value; /* Value string */ } ppd_attr_t; -typedef struct ppd_option_str ppd_option_t; - /**** Options ****/ +typedef struct ppd_option_s ppd_option_t; + /**** Options ****/ -typedef struct ppd_choice_str /**** Option choices ****/ +typedef struct ppd_choice_s /**** Option choices ****/ { - char marked; /* 0 if not selected, 1 otherwise */ - char choice[PPD_MAX_NAME]; - /* Computer-readable option name */ - char text[PPD_MAX_TEXT]; - /* Human-readable option name */ - char *code; /* Code to send for this option */ - ppd_option_t *option; /* Pointer to parent option structure */ + char marked; /* 0 if not selected, 1 otherwise */ + char choice[PPD_MAX_NAME]; /* Computer-readable option name */ + char text[PPD_MAX_TEXT]; /* Human-readable option name */ + char *code; /* Code to send for this option */ + ppd_option_t *option; /* Pointer to parent option structure */ } ppd_choice_t; -struct ppd_option_str /**** Options ****/ +struct ppd_option_s /**** Options ****/ { - char conflicted; /* 0 if no conflicts exist, 1 otherwise */ - char keyword[PPD_MAX_NAME]; - /* Option keyword name ("PageSize", etc.) */ - char defchoice[PPD_MAX_NAME]; - /* Default option choice */ - char text[PPD_MAX_TEXT]; - /* Human-readable text */ - ppd_ui_t ui; /* Type of UI option */ - ppd_section_t section; /* Section for command */ - float order; /* Order number */ - int num_choices; /* Number of option choices */ - ppd_choice_t *choices; /* Option choices */ + char conflicted; /* 0 if no conflicts exist, 1 otherwise */ + char keyword[PPD_MAX_NAME]; /* Option keyword name ("PageSize", etc.) */ + char defchoice[PPD_MAX_NAME];/* Default option choice */ + char text[PPD_MAX_TEXT]; /* Human-readable text */ + ppd_ui_t ui; /* Type of UI option */ + ppd_section_t section; /* Section for command */ + float order; /* Order number */ + int num_choices; /* Number of option choices */ + ppd_choice_t *choices; /* Option choices */ }; -typedef struct ppd_group_str /**** Groups ****/ +typedef struct ppd_group_s /**** Groups ****/ { /**** Group text strings are limited to 39 chars + nul in order to **** preserve binary compatibility and allow applications to get **** the group's keyword name. ****/ char text[PPD_MAX_TEXT - PPD_MAX_NAME]; - /* Human-readable group name */ - char name[PPD_MAX_NAME]; - /* Group name @since CUPS 1.1.18@ */ - int num_options; /* Number of options */ - ppd_option_t *options; /* Options */ - int num_subgroups; /* Number of sub-groups */ - struct ppd_group_str *subgroups; - /* Sub-groups (max depth = 1) */ + /* Human-readable group name */ + char name[PPD_MAX_NAME]; /* Group name @since CUPS 1.1.18@ */ + int num_options; /* Number of options */ + ppd_option_t *options; /* Options */ + int num_subgroups; /* Number of sub-groups */ + struct ppd_group_s *subgroups; /* Sub-groups (max depth = 1) */ } ppd_group_t; -typedef struct /**** Constraints ****/ +typedef struct /**** Constraints ****/ { - char option1[PPD_MAX_NAME]; - /* First keyword */ - char choice1[PPD_MAX_NAME]; - /* First option/choice (blank for all) */ - char option2[PPD_MAX_NAME]; - /* Second keyword */ - char choice2[PPD_MAX_NAME]; - /* Second option/choice (blank for all) */ + char option1[PPD_MAX_NAME]; /* First keyword */ + char choice1[PPD_MAX_NAME]; /* First option/choice (blank for all) */ + char option2[PPD_MAX_NAME]; /* Second keyword */ + char choice2[PPD_MAX_NAME]; /* Second option/choice (blank for all) */ } ppd_const_t; -typedef struct ppd_size_str /**** Page Sizes ****/ +typedef struct ppd_size_s /**** Page Sizes ****/ { - int marked; /* Page size selected? */ - char name[PPD_MAX_NAME]; - /* Media size option */ - float width; /* Width of media in points */ - float length; /* Length of media in points */ - float left; /* Left printable margin in points */ - float bottom; /* Bottom printable margin in points */ - float right; /* Right printable margin in points */ - float top; /* Top printable margin in points */ + int marked; /* Page size selected? */ + char name[PPD_MAX_NAME]; /* Media size option */ + float width; /* Width of media in points */ + float length; /* Length of media in points */ + float left; /* Left printable margin in points */ + float bottom; /* Bottom printable margin in points */ + float right; /* Right printable margin in points */ + float top; /* Top printable margin in points */ } ppd_size_t; -typedef struct ppd_emul_str /**** Emulators ****/ +typedef struct ppd_emul_s /**** Emulators ****/ { - char name[PPD_MAX_NAME]; - /* Emulator name */ - char *start; /* Code to switch to this emulation */ - char *stop; /* Code to stop this emulation */ + char name[PPD_MAX_NAME]; /* Emulator name */ + char *start; /* Code to switch to this emulation */ + char *stop; /* Code to stop this emulation */ } ppd_emul_t; -typedef struct ppd_profile_str /**** sRGB Color Profiles ****/ +typedef struct ppd_profile_s /**** sRGB Color Profiles ****/ { char resolution[PPD_MAX_NAME]; - /* Resolution or "-" */ + /* Resolution or "-" */ char media_type[PPD_MAX_NAME]; - /* Media type or "-" */ - float density; /* Ink density to use */ - float gamma; /* Gamma correction to use */ - float matrix[3][3]; /* Transform matrix */ + /* Media type or "-" */ + float density; /* Ink density to use */ + float gamma; /* Gamma correction to use */ + float matrix[3][3]; /* Transform matrix */ } ppd_profile_t; /**** New in CUPS 1.2 ****/ -# if 0 -typedef enum ppd_ext_ui_e /**** Extended UI Types @since CUPS 1.2@ ****/ +typedef enum ppd_cptype_e /**** Custom Parameter Type @since CUPS 1.2@ ****/ { - PPD_UI_CUPS_TEXT, /* Specify a string */ - PPD_UI_CUPS_INTEGER, /* Specify an integer number */ - PPD_UI_CUPS_REAL, /* Specify a real number */ - PPD_UI_CUPS_GAMMA, /* Specify a gamma number */ - PPD_UI_CUPS_CURVE, /* Specify start, end, and gamma numbers */ - PPD_UI_CUPS_INTEGER_ARRAY, /* Specify an array of integer numbers */ - PPD_UI_CUPS_REAL_ARRAY, /* Specify an array of real numbers */ - PPD_UI_CUPS_XY_ARRAY /* Specify an array of X/Y real numbers */ -} ppd_ext_ui_t; - -typedef union ppd_ext_value_u /**** Extended Values @since CUPS 1.2@ ****/ + PPD_CUSTOM_CURVE, /* Curve value for f(x) = x^value */ + PPD_CUSTOM_INT, /* Integer number value */ + PPD_CUSTOM_INVCURVE, /* Curve value for f(x) = x^(1/value) */ + PPD_CUSTOM_PASSCODE, /* String of (hidden) numbers */ + PPD_CUSTOM_PASSWORD, /* String of (hidden) characters */ + PPD_CUSTOM_POINTS, /* Measurement value in points */ + PPD_CUSTOM_REAL, /* Real number value */ + PPD_CUSTOM_STRING /* String of characters */ +} ppd_cptype_t; + +typedef union ppd_cpvalue_u /**** Custom Parameter Value @since CUPS 1.2@ ****/ { - char *text; /* Text value */ - int integer; /* Integer value */ - float real; /* Real value */ - float gamma; /* Gamma value */ - struct - { - float start; /* Linear (density) start value for curve */ - float end; /* Linear (density) end value for curve */ - float gamma; /* Gamma correction */ - } curve; /* Curve values */ - struct - { - int num_elements; /* Number of array elements */ - int *elements; /* Array of integer values */ - } integer_array; /* Integer array value */ - struct - { - int num_elements; /* Number of array elements */ - float *elements; /* Array of real values */ - } real_array; /* Real array value */ - struct - { - int num_elements; /* Number of array elements */ - float *elements; /* Array of XY values */ - } xy_array; /* XY array value */ -} ppd_ext_value_t; - -typedef struct ppd_ext_param_str/**** Extended Parameter @since CUPS 1.2@ ****/ + float custom_curve; /* Gamma value */ + int custom_int; /* Integer value */ + float custom_invcurve; /* Gamma value */ + char *custom_passcode; /* Passcode value */ + char *custom_password; /* Password value */ + float custom_points; /* Measurement value */ + float custom_real; /* Real value */ + char *custom_string; /* String value */ +} ppd_cpvalue_t; + +typedef struct ppd_cparam_s /**** Custom Parameter @since CUPS 1.2@ ****/ { - char keyword[PPD_MAX_NAME]; - /* Parameter name */ - char text[PPD_MAX_TEXT]; - /* Human-readable text */ - ppd_ext_value_t *value; /* Current values */ - ppd_ext_value_t *defval; /* Default values */ - ppd_ext_value_t *minval; /* Minimum numeric values */ - ppd_ext_value_t *maxval; /* Maximum numeric values */ -} ppd_ext_param_t; - -typedef struct ppd_ext_option_str - /**** Extended Options @since CUPS 1.2@ ****/ + char name[PPD_MAX_NAME]; /* Parameter name */ + char text[PPD_MAX_TEXT]; /* Human-readable text */ + int order; /* Order (0 to N) */ + ppd_cptype_t type; /* Parameter type */ + ppd_cpvalue_t minimum, /* Minimum value */ + maximum, /* Maximum value */ + current; /* Current value */ +} ppd_cparam_t; + +typedef struct ppd_coption_s /**** Custom Option @since CUPS 1.2@ ****/ { - char keyword[PPD_MAX_NAME]; - /* Name of option that is being extended... */ - ppd_option_t *option; /* Option that is being extended... */ - int marked; /* Extended option is marked */ - char *code; /* Generic PS code for extended options */ - int num_params; /* Number of parameters */ - ppd_ext_param_t **params; /* Parameters */ -} ppd_ext_option_t; -# endif /* 0 */ - -typedef struct ppd_file_str /**** Files ****/ + char keyword[PPD_MAX_NAME]; /* Name of option that is being extended... */ + ppd_option_t *option; /* Option that is being extended... */ + int marked; /* Extended option is marked */ + cups_array_t *params; /* Parameters */ +} ppd_coption_t; + +typedef struct ppd_file_s /**** PPD File ****/ { - int language_level; /* Language level of device */ - int color_device; /* 1 = color device, 0 = grayscale */ - int variable_sizes; /* 1 = supports variable sizes, 0 = doesn't */ - int accurate_screens; - /* 1 = supports accurate screens, 0 = not */ - int contone_only; /* 1 = continuous tone only, 0 = not */ - int landscape; /* -90 or 90 */ - int model_number; /* Device-specific model number */ - int manual_copies; /* 1 = Copies done manually, 0 = hardware */ - int throughput; /* Pages per minute */ - ppd_cs_t colorspace; /* Default colorspace */ - char *patches; /* Patch commands to be sent to printer */ - int num_emulations; /* Number of emulations supported */ - ppd_emul_t *emulations; /* Emulations and the code to invoke them */ - char *jcl_begin; /* Start JCL commands */ - char *jcl_ps; /* Enter PostScript interpreter */ - char *jcl_end; /* End JCL commands */ - char *lang_encoding; /* Language encoding */ - char *lang_version; /* Language version (English, Spanish, etc.) */ - char *modelname; /* Model name (general) */ - char *ttrasterizer; /* Truetype rasterizer */ - char *manufacturer; /* Manufacturer name */ - char *product; /* Product name (from PS RIP/interpreter) */ - char *nickname; /* Nickname (specific) */ - char *shortnickname; /* Short version of nickname */ - int num_groups; /* Number of UI groups */ - ppd_group_t *groups; /* UI groups */ - int num_sizes; /* Number of page sizes */ - ppd_size_t *sizes; /* Page sizes */ - float custom_min[2]; /* Minimum variable page size */ - float custom_max[2]; /* Maximum variable page size */ - float custom_margins[4];/* Margins around page */ - int num_consts; /* Number of UI/Non-UI constraints */ - ppd_const_t *consts; /* UI/Non-UI constraints */ - int num_fonts; /* Number of pre-loaded fonts */ - char **fonts; /* Pre-loaded fonts */ - int num_profiles; /* Number of sRGB color profiles */ - ppd_profile_t *profiles; /* sRGB color profiles */ - int num_filters; /* Number of filters */ - char **filters; /* Filter strings... */ + int language_level; /* Language level of device */ + int color_device; /* 1 = color device, 0 = grayscale */ + int variable_sizes; /* 1 = supports variable sizes, 0 = doesn't */ + int accurate_screens; /* 1 = supports accurate screens, 0 = not */ + int contone_only; /* 1 = continuous tone only, 0 = not */ + int landscape; /* -90 or 90 */ + int model_number; /* Device-specific model number */ + int manual_copies; /* 1 = Copies done manually, 0 = hardware */ + int throughput; /* Pages per minute */ + ppd_cs_t colorspace; /* Default colorspace */ + char *patches; /* Patch commands to be sent to printer */ + int num_emulations; /* Number of emulations supported */ + ppd_emul_t *emulations; /* Emulations and the code to invoke them */ + char *jcl_begin; /* Start JCL commands */ + char *jcl_ps; /* Enter PostScript interpreter */ + char *jcl_end; /* End JCL commands */ + char *lang_encoding; /* Language encoding */ + char *lang_version; /* Language version (English, Spanish, etc.) */ + char *modelname; /* Model name (general) */ + char *ttrasterizer; /* Truetype rasterizer */ + char *manufacturer; /* Manufacturer name */ + char *product; /* Product name (from PS RIP/interpreter) */ + char *nickname; /* Nickname (specific) */ + char *shortnickname; /* Short version of nickname */ + int num_groups; /* Number of UI groups */ + ppd_group_t *groups; /* UI groups */ + int num_sizes; /* Number of page sizes */ + ppd_size_t *sizes; /* Page sizes */ + float custom_min[2]; /* Minimum variable page size */ + float custom_max[2]; /* Maximum variable page size */ + float custom_margins[4]; /* Margins around page */ + int num_consts; /* Number of UI/Non-UI constraints */ + ppd_const_t *consts; /* UI/Non-UI constraints */ + int num_fonts; /* Number of pre-loaded fonts */ + char **fonts; /* Pre-loaded fonts */ + int num_profiles; /* Number of sRGB color profiles */ + ppd_profile_t *profiles; /* sRGB color profiles */ + int num_filters; /* Number of filters */ + char **filters; /* Filter strings... */ /**** New in CUPS 1.1 ****/ - int flip_duplex; /* 1 = Flip page for back sides @since CUPS 1.1@ */ + int flip_duplex; /* 1 = Flip page for back sides @since CUPS 1.1@ */ /**** New in CUPS 1.1.19 ****/ - char *protocols; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19@ */ - char *pcfilename; /* PCFileName string @since CUPS 1.1.19@ */ - int num_attrs; /* Number of attributes @since CUPS 1.1.19@ */ - int cur_attr; /* Current attribute @since CUPS 1.1.19@ */ - ppd_attr_t **attrs; /* Attributes @since CUPS 1.1.19@ */ + char *protocols; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19@ */ + char *pcfilename; /* PCFileName string @since CUPS 1.1.19@ */ + int num_attrs; /* Number of attributes @since CUPS 1.1.19@ */ + int cur_attr; /* Current attribute @since CUPS 1.1.19@ */ + ppd_attr_t **attrs; /* Attributes @since CUPS 1.1.19@ */ /**** New in CUPS 1.2 ****/ -# if 0 - int num_extended; /* Number of extended options @since CUPS 1.2@ */ - ppd_ext_option_t **extended; /* Extended options @since CUPS 1.2@ */ -# endif /* 0 */ + cups_array_t *options; /* Option lookup array @since CUPS 1.2@ */ + cups_array_t *coptions; /* Custom options array @since CUPS 1.2@ */ } ppd_file_t; @@ -403,7 +362,19 @@ extern ppd_status_t ppdLastError(int *line); extern void ppdSetConformance(ppd_conform_t c); /**** New in CUPS 1.2 ****/ +extern int ppdCollect2(ppd_file_t *ppd, ppd_section_t section, + float min_order, ppd_choice_t ***choices); +extern int ppdEmitAfterOrder(ppd_file_t *ppd, FILE *fp, + ppd_section_t section, int limit, + float min_order); extern int ppdEmitJCLEnd(ppd_file_t *ppd, FILE *fp); +extern ppd_coption_t *ppdFindCustomOption(ppd_file_t *ppd, + const char *keyword); +extern ppd_cparam_t *ppdFindCustomParam(ppd_coption_t *opt, + const char *name); +extern ppd_cparam_t *ppdFirstCustomParam(ppd_coption_t *opt); +extern ppd_cparam_t *ppdNextCustomParam(ppd_coption_t *opt); +extern int ppdLocalize(ppd_file_t *ppd); extern ppd_file_t *ppdOpen2(cups_file_t *fp); @@ -417,5 +388,5 @@ extern ppd_file_t *ppdOpen2(cups_file_t *fp); #endif /* !_CUPS_PPD_H_ */ /* - * End of "$Id: ppd.h 4785 2005-10-13 19:39:05Z mike $". + * End of "$Id: ppd.h 4980 2006-01-25 19:57:45Z mike $". */ diff --git a/cups/sample.ppd b/cups/sample.ppd deleted file mode 100644 index 87e56006c1..0000000000 --- a/cups/sample.ppd +++ /dev/null @@ -1,299 +0,0 @@ -*PPD-Adobe: "4.3" -*% -*% "$Id: sample.ppd 2620 2002-08-14 05:34:15Z mike $" -*% -*% Sample HP DeskJet driver PPD file for the Common UNIX Printing -*% System (CUPS). -*% -*% Copyright 1997-2002 by Easy Software Products. -*% -*% These coded instructions, statements, and computer programs are the -*% property of Easy Software Products 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 missing or damaged please contact Easy Software Products -*% at: -*% -*% Attn: CUPS Licensing Information -*% Easy Software Products -*% 44141 Airport View Drive, Suite 204 -*% Hollywood, Maryland 20636-3111 USA -*% -*% Voice: (301) 373-9603 -*% EMail: cups-info@cups.org -*% WWW: http://www.cups.org -*% -*FormatVersion: "4.3" -*FileVersion: "1.1" -*LanguageVersion: English -*LanguageEncoding: ISOLatin1 -*PCFileName: "DESKJET.PPD" -*Manufacturer: "ESP" -*Product: "(CUPS v1.1)" -*cupsVersion: 1.1 -*cupsManualCopies: True -*cupsFilter: "application/vnd.cups-raster 0 rastertohp" -*cupsModelNumber: 1 -*ModelName: "HP DeskJet Series" -*ShortNickName: "HP DeskJet Series" -*NickName: "HP DeskJet Series CUPS v1.1" -*PSVersion: "(3010.000) 550" -*LanguageLevel: "3" -*ColorDevice: True -*DefaultColorSpace: RGB -*FileSystem: False -*Throughput: "1" -*LandscapeOrientation: Plus90 -*VariablePaperSize: False -*TTRasterizer: Type42 - -*UIConstraints: *PageSize Executive *InputSlot Envelope -*UIConstraints: *PageSize Letter *InputSlot Envelope -*UIConstraints: *PageSize Legal *InputSlot Envelope -*UIConstraints: *PageSize Tabloid *InputSlot Envelope -*UIConstraints: *PageSize A3 *InputSlot Envelope -*UIConstraints: *PageSize A4 *InputSlot Envelope -*UIConstraints: *PageSize A5 *InputSlot Envelope -*UIConstraints: *PageSize B5 *InputSlot Envelope -*UIConstraints: *Resolution 600dpi *ColorModel CMYK - -*OpenUI *PageSize/Media Size: PickOne -*OrderDependency: 10 AnySetup *PageSize -*DefaultPageSize: Letter -*PageSize Letter/US Letter: "<>setpagedevice" -*PageSize Legal/US Legal: "<>setpagedevice" -*PageSize Executive/US Executive: "<>setpagedevice" -*PageSize Tabloid/US Tabloid: "<>setpagedevice" -*PageSize A3/A3: "<>setpagedevice" -*PageSize A4/A4: "<>setpagedevice" -*PageSize A5/A5: "<>setpagedevice" -*PageSize B5/B5 (JIS): "<>setpagedevice" -*PageSize EnvISOB5/Envelope B5: "<>setpagedevice" -*PageSize Env10/Envelope #10: "<>setpagedevice" -*PageSize EnvC5/Envelope C5: "<>setpagedevice" -*PageSize EnvDL/Envelope DL: "<>setpagedevice" -*PageSize EnvMonarch/Envelope Monarch: "<>setpagedevice" -*CloseUI: *PageSize - -*OpenUI *PageRegion: PickOne -*OrderDependency: 10 AnySetup *PageRegion -*DefaultPageRegion: Letter -*PageRegion Letter/US Letter: "<>setpagedevice" -*PageRegion Legal/US Legal: "<>setpagedevice" -*PageRegion Executive/US Executive: "<>setpagedevice" -*PageRegion Tabloid/US Tabloid: "<>setpagedevice" -*PageRegion A3/A3: "<>setpagedevice" -*PageRegion A4/A4: "<>setpagedevice" -*PageRegion A5/A5: "<>setpagedevice" -*PageRegion B5/B5 (JIS): "<>setpagedevice" -*PageRegion EnvISOB5/Envelope B5: "<>setpagedevice" -*PageRegion Env10/Envelope #10: "<>setpagedevice" -*PageRegion EnvC5/Envelope C5: "<>setpagedevice" -*PageRegion EnvDL/Envelope DL: "<>setpagedevice" -*PageRegion EnvMonarch/Envelope Monarch: "<>setpagedevice" -*CloseUI: *PageRegion - -*DefaultImageableArea: Letter -*ImageableArea Letter/US Letter: "18 36 594 756" -*ImageableArea Legal/US Legal: "18 36 594 972" -*ImageableArea Executive/US Executive: "18 36 504 684" -*ImageableArea Tabloid/US Tabloid: "18 36 774 1188" -*ImageableArea A3/A3: "18 36 824 1155" -*ImageableArea A4/A4: "18 36 577 806" -*ImageableArea A5/A5: "18 36 403 559" -*ImageableArea B5/JIS B5: "18 36 498 693" -*ImageableArea EnvISOB5/B5 (ISO): "18 36 463 673" -*ImageableArea Env10/Com-10: "18 36 279 648" -*ImageableArea EnvC5/EnvC5: "18 36 441 613" -*ImageableArea EnvDL/EnvDL: "18 36 294 588" -*ImageableArea EnvMonarch/Envelope Monarch: "18 36 261 504" - -*DefaultPaperDimension: Letter -*PaperDimension Letter/US Letter: "612 792" -*PaperDimension Legal/US Legal: "612 1008" -*PaperDimension Executive/US Executive: "522 756" -*PaperDimension Tabloid/US Tabloid: "792 1224" -*PaperDimension A3/A3: "842 1191" -*PaperDimension A4/A4: "595 842" -*PaperDimension A5/A5: "421 595" -*PaperDimension B5/B5 (JIS): "516 729" -*PaperDimension EnvISOB5/Envelope B5: "499 709" -*PaperDimension Env10/Envelope #10: "297 684" -*PaperDimension EnvC5/Envelope C5: "459 649" -*PaperDimension EnvDL/Envelope DL: "312 624" -*PaperDimension EnvMonarch/Envelope Monarch: "279 540" - -*OpenUI *MediaType/Media Type: PickOne -*OrderDependency: 10 AnySetup *MediaType -*DefaultMediaType: Plain -*MediaType Plain/Plain Paper: "<>setpagedevice" -*MediaType Bond/Bond Paper: "<>setpagedevice" -*MediaType Special/Special Paper: "<>setpagedevice" -*MediaType Transparency/Transparency: "<>setpagedevice" -*MediaType Glossy/Glossy Paper: "<>setpagedevice" -*CloseUI: *MediaType - -*OpenUI *InputSlot/Media Source: PickOne -*OrderDependency: 10 AnySetup *InputSlot -*DefaultInputSlot: Tray -*InputSlot Tray/Tray: "<>setpagedevice" -*InputSlot Manual/Manual Feed: "<>setpagedevice" -*InputSlot Envelope/Envelope Feed: "<>setpagedevice" -*CloseUI: *InputSlot - -*OpenUI *Resolution/Output Resolution: PickOne -*OrderDependency: 20 AnySetup *Resolution -*DefaultResolution: 300dpi -*Resolution 150dpi/150 DPI: "<>setpagedevice" -*Resolution 300dpi/300 DPI: "<>setpagedevice" -*Resolution 600dpi/600 DPI: "<>setpagedevice" -*CloseUI: *Resolution - -*OpenUI *ColorModel/Output Mode: PickOne -*OrderDependency: 10 AnySetup *ColorModel -*DefaultColorModel: CMYK -*ColorModel CMYK/CMYK Color: "<>setpagedevice" -*ColorModel RGB/CMY Color: "<>setpagedevice" -*ColorModel Gray/Grayscale: "<>setpagedevice" -*CloseUI: *ColorModel - -*OpenGroup Extended/Extended Options - -*OpenUI IntOption/Integer: PickOne -*OrderDependency: 10 AnySetup *IntOption -*DefaultIntOption: None -*IntOption None: "" -*IntOption 1: "<>setpagedevice" -*IntOption 2: "<>setpagedevice" -*IntOption 3: "<>setpagedevice" -*IntOption 4: "<>setpagedevice" -*IntOption 5: "<>setpagedevice" -*cupsUIType IntOption: Integer -*cupsUIMinimum IntOption: "1" -*cupsUIMaximum IntOption: "5" -*cupsUICommand IntOption: "<>setpagedevice>>" -*CloseUI: *IntOption - -*OpenUI RealOption/Real Number: PickOne -*OrderDependency: 10 AnySetup *RealOption -*DefaultRealOption: None -*RealOption None: "" -*RealOption 1: "<>setpagedevice" -*RealOption 2: "<>setpagedevice" -*RealOption 3: "<>setpagedevice" -*RealOption 4: "<>setpagedevice" -*RealOption 5: "<>setpagedevice" -*cupsUIType RealOption: Real -*cupsUIMinimum RealOption: "1" -*cupsUIMaximum RealOption: "5" -*cupsUICommand RealOption: "<>setpagedevice>>" -*CloseUI: *RealOption - -*OpenUI TextOption/Text: PickOne -*OrderDependency: 10 AnySetup *TextOption -*DefaultTextOption: None -*TextOption None: "" -*TextOption NOFORN: "<>setpagedevice" -*TextOption FOIA: "<>setpagedevice" -*TextOption FOUO: "<>setpagedevice" -*cupsUIType TextOption: Text -*cupsUICommand TextOption: "<>setpagedevice>>" -*CloseUI: *TextOption - -*OpenUI GammaOption/Gamma Curve: PickOne -*OrderDependency: 10 AnySetup *GammaOption -*DefaultGammaOption: None -*GammaOption None: "" -*GammaOption 1: "<>setpagedevice" -*GammaOption 1.5: "<>setpagedevice" -*GammaOption 2.0: "<>setpagedevice" -*GammaOption 2.5: "<>setpagedevice" -*GammaOption 3.0: "<>setpagedevice" -*cupsUIType GammaOption: Integer -*cupsUIMinimum GammaOption: "1" -*cupsUIMaximum GammaOption: "3" -*cupsUICommand GammaOption: "<>setpagedevice>>" -*CloseUI: *GammaOption - -*OpenUI CurveOption/Curve: PickOne -*OrderDependency: 10 AnySetup *CurveOption -*DefaultCurveOption: None -*CurveOption None: "" -*CurveOption 1: "<>setpagedevice" -*CurveOption 2: "<>setpagedevice" -*CurveOption 3: "<>setpagedevice" -*CurveOption 4: "<>setpagedevice" -*CurveOption 5: "<>setpagedevice" -*cupsUIType CurveOption: Curve -*cupsUIMinimum CurveOption: "0 0 1" -*cupsUIMaximum CurveOption: "1 1 5" -*cupsUICommand CurveOption: "<>setpagedevice pop pop pop>>" -*CloseUI: *CurveOption - -*OpenUI IntArrayOption/Integer Array: PickOne -*OrderDependency: 10 AnySetup *IntArrayOption -*DefaultIntArrayOption: None -*IntArrayOption None: "" -*IntArrayOption Linear: "<>setpagedevice" -*IntArrayOption Parametric: "<>setpagedevice" -*IntArrayOption Sine: "<>setpagedevice" -*cupsUIType IntArrayOption: IntegerArray -*cupsUIMinimum IntArrayOption: "2 0" -*cupsUIMaximum IntArrayOption: "16 255" -*cupsUICommand IntArrayOption: "<>setpagedevice>>" -*CloseUI: *IntArrayOption - -*OpenUI RealArrayOption/Real Array: PickOne -*OrderDependency: 10 AnySetup *RealArrayOption -*DefaultRealArrayOption: None -*RealArrayOption None: "" -*RealArrayOption Linear: "<>setpagedevice" -*RealArrayOption Parametric: "<>setpagedevice" -*RealArrayOption Sine: "<>setpagedevice" -*cupsUIType RealArrayOption: RealArray -*cupsUIMinimum RealArrayOption: "2 0" -*cupsUIMaximum RealArrayOption: "16 255" -*cupsUICommand RealArrayOption: "<>setpagedevice>>" -*CloseUI: *RealArrayOption - -*CloseGroup - -*DefaultFont: Courier -*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM -*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM -*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM -*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM -*Font Bookman-Demi: Standard "(001.004S)" Standard ROM -*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM -*Font Bookman-Light: Standard "(001.004S)" Standard ROM -*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM -*Font Courier: Standard "(002.004S)" Standard ROM -*Font Courier-Bold: Standard "(002.004S)" Standard ROM -*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM -*Font Courier-Oblique: Standard "(002.004S)" Standard ROM -*Font Helvetica: Standard "(001.006S)" Standard ROM -*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM -*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM -*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM -*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM -*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM -*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM -*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM -*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM -*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM -*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM -*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM -*Font Palatino-Bold: Standard "(001.005S)" Standard ROM -*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM -*Font Palatino-Italic: Standard "(001.005S)" Standard ROM -*Font Palatino-Roman: Standard "(001.005S)" Standard ROM -*Font Symbol: Special "(001.007S)" Special ROM -*Font Times-Bold: Standard "(001.007S)" Standard ROM -*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM -*Font Times-Italic: Standard "(001.007S)" Standard ROM -*Font Times-Roman: Standard "(001.007S)" Standard ROM -*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM -*Font ZapfDingbats: Special "(001.004S)" Standard ROM -*% -*% End of "$Id: sample.ppd 2620 2002-08-14 05:34:15Z mike $". -*% diff --git a/cups/test.ppd b/cups/test.ppd new file mode 100644 index 0000000000..5f1768cac3 --- /dev/null +++ b/cups/test.ppd @@ -0,0 +1,187 @@ +*PPD-Adobe: "4.3" +*% +*% "$Id: test.ppd 4939 2006-01-17 18:54:33Z mike $" +*% +*% Test PPD file for the Common UNIX Printing System (CUPS). +*% +*% This file is used to test the CUPS PPD API functions and cannot be +*% used with any known printers. Look at the PPD files in the "ppd" +*% subdirectory as well as the CUPS web site for working PPD files. +*% +*% If you are a PPD file developer, consider using the CUPS DDK to +*% create your PPD files - not only will it save you time, it produces +*% consistently high-quality files. +*% +*% Copyright 2002-2006 by Easy Software Products. +*% +*% These coded instructions, statements, and computer programs are the +*% property of Easy Software Products 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 missing or damaged please contact Easy Software Products +*% at: +*% +*% Attn: CUPS Licensing Information +*% Easy Software Products +*% 44141 Airport View Drive, Suite 204 +*% Hollywood, Maryland 20636-3111 USA +*% +*% Voice: (301) 373-9603 +*% EMail: cups-info@cups.org +*% WWW: http://www.cups.org +*% +*FormatVersion: "4.3" +*FileVersion: "1.2" +*LanguageVersion: English +*LanguageEncoding: ISOLatin1 +*PCFileName: "TEST.PPD" +*Manufacturer: "ESP" +*Product: "(ESP Ghostscript)" +*cupsVersion: 1.2 +*cupsManualCopies: True +*cupsFilter: "application/vnd.cups-raster 0 rastertotest" +*cupsModelNumber: 1 +*ModelName: "Test" +*ShortNickName: "Test" +*NickName: "Test for CUPS v1.2" +*PSVersion: "(3010.000) 81501" +*LanguageLevel: "3" +*ColorDevice: True +*DefaultColorSpace: RGB +*FileSystem: False +*Throughput: "1" +*LandscapeOrientation: Plus90 +*TTRasterizer: Type42 + +*% These constraints are used to test ppdConflicts() +*UIConstraints: *PageSize Letter *InputSlot Envelope +*UIConstraints: *InputSlot Envelope *PageSize Letter + +*% For PageSize, we have put all of the translations in-line... +*OpenUI *PageSize/Page Size: PickOne +*fr.Translation PageSize/French Page Size: "" +*fr_CA.Translation PageSize/French Canadian Page Size: "" +*OrderDependency: 10 AnySetup *PageSize +*DefaultPageSize: Letter +*PageSize Letter/US Letter: "PageSize=Letter" +*fr.PageSize Letter/French US Letter: "" +*fr_CA.PageSize Letter/French Canadian US Letter: "" +*PageSize A4/A4: "PageSize=A4" +*fr.PageSize A4/French A4: "" +*fr_CA.PageSize A4/French Canadian A4: "" +*PageSize Env10/#10 Envelope: "PageSize=Env10" +*fr.PageSize Env10/French #10 Envelope: "" +*fr_CA.PageSize Env10/French Canadian #10 Envelope: "" +*CloseUI: *PageSize + +*% For PageRegion, we have separated the translations... +*OpenUI *PageRegion/Page Region: PickOne +*OrderDependency: 10 AnySetup *PageRegion +*DefaultPageRegion: Letter +*PageRegion Letter/US Letter: "PageRegion=Letter" +*PageRegion A4/A4: "PageRegion=A4" +*PageRegion Env10/#10 Envelope: "PageRegion=Env10" +*CloseUI: *PageRegion + +*fr.Translation PageRegion/French Page Region: "" +*fr.PageRegion Letter/French US Letter: "" +*fr.PageRegion A4/French A4: "" +*fr.PageRegion Env10/French #10 Envelope: "" + +*fr_CA.Translation PageRegion/French Canadian Page Region: "" +*fr_CA.PageRegion Letter/French Canadian US Letter: "" +*fr_CA.PageRegion A4/French Canadian A4: "" +*fr_CA.PageRegion Env10/French Canadian #10 Envelope: "" + +*DefaultImageableArea: Letter +*ImageableArea Letter: "18 36 594 756" +*ImageableArea A4: "18 36 577 806" +*ImageableArea Env10: "18 36 279 648" + +*DefaultPaperDimension: Letter +*PaperDimension Letter: "612 792" +*PaperDimension A4: "595 842" +*PaperDimension Env10: "297 684" + +*% Custom page size support +*HWMargins: 0 0 0 0 +*CustomPageSize True/Custom Page Size: "PageSize=Custom" +*ParamCustomPageSize Width: 1 points 36 1080 +*ParamCustomPageSize Height: 2 points 36 86400 +*ParamCustomPageSize WidthOffset/Width Offset: 3 points 0 0 +*ParamCustomPageSize HeightOffset/Height Offset: 4 points 0 0 +*ParamCustomPageSize Orientation: 5 int 0 0 + +*OpenUI *InputSlot/Input Slot: PickOne +*OrderDependency: 10 AnySetup *InputSlot +*DefaultInputSlot: Tray +*InputSlot Tray/Tray: "InputSlot=Tray" +*InputSlot Manual/Manual Feed: "InputSlot=Manual" +*InputSlot Envelope/Envelope Feed: "InputSlot=Envelope" +*CloseUI: *InputSlot + +*% Custom options... +*OpenGroup: Extended/Extended Options + +*OpenUI IntOption/Integer: PickOne +*OrderDependency: 10 AnySetup *IntOption +*DefaultIntOption: None +*IntOption 1: "IntOption=1" +*IntOption 2: "IntOption=2" +*IntOption 3: "IntOption=3" +*CloseUI: *IntOption + +*CustomIntOption True/Custom Integer: "IntOption=Custom" +*ParamCustomIntOption Integer: 1 int -100 100 + +*OpenUI StringOption/String: PickOne +*OrderDependency: 10 AnySetup *StringOption +*DefaultStringOption: None +*StringOption foo: "StringOption=foo" +*StringOption bar: "StringOption=bar" +*CloseUI: *StringOption + +*CustomStringOption True/Custom Stringeger: "StringOption=Custom" +*ParamCustomStringOption String: 1 string * ********** + +*CloseGroup: Extended + +*DefaultFont: Courier +*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM +*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM +*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM +*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM +*Font Bookman-Demi: Standard "(001.004S)" Standard ROM +*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM +*Font Bookman-Light: Standard "(001.004S)" Standard ROM +*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM +*Font Courier: Standard "(002.004S)" Standard ROM +*Font Courier-Bold: Standard "(002.004S)" Standard ROM +*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM +*Font Courier-Oblique: Standard "(002.004S)" Standard ROM +*Font Helvetica: Standard "(001.006S)" Standard ROM +*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM +*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM +*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM +*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM +*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM +*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM +*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM +*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM +*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM +*Font Palatino-Bold: Standard "(001.005S)" Standard ROM +*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM +*Font Palatino-Italic: Standard "(001.005S)" Standard ROM +*Font Palatino-Roman: Standard "(001.005S)" Standard ROM +*Font Symbol: Special "(001.007S)" Special ROM +*Font Times-Bold: Standard "(001.007S)" Standard ROM +*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM +*Font Times-Italic: Standard "(001.007S)" Standard ROM +*Font Times-Roman: Standard "(001.007S)" Standard ROM +*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM +*Font ZapfDingbats: Special "(001.004S)" Standard ROM +*% +*% End of "$Id: test.ppd 4939 2006-01-17 18:54:33Z mike $". +*% diff --git a/cups/testfile.c b/cups/testfile.c index de50fc5e27..60822a2763 100644 --- a/cups/testfile.c +++ b/cups/testfile.c @@ -1,5 +1,5 @@ /* - * "$Id: testfile.c 4754 2005-10-08 04:01:46Z mike $" + * "$Id: testfile.c 4942 2006-01-18 19:49:15Z mike $" * * File test program for the Common UNIX Printing System (CUPS). * @@ -57,33 +57,79 @@ int /* O - Exit status */ main(int argc, /* I - Number of command-line arguments */ char *argv[]) /* I - Command-line arguments */ { - int status; /* Exit status */ + int status; /* Exit status */ + char filename[1024]; /* Filename buffer */ - /* - * Do uncompressed file tests... - */ + if (argc == 1) + { + /* + * Do uncompressed file tests... + */ - status = read_write_tests(0); + status = read_write_tests(0); #ifdef HAVE_LIBZ - /* - * Do compressed file tests... - */ + /* + * Do compressed file tests... + */ - putchar('\n'); + putchar('\n'); - status += read_write_tests(1); + status += read_write_tests(1); #endif /* HAVE_LIBZ */ - /* - * Summarize the results and return... - */ + /* + * Test path functions... + */ + + fputs("cupsFileFind: ", stdout); + if (cupsFileFind("cat", "/bin", filename, sizeof(filename)) && + cupsFileFind("cat", "/bin:/usr/bin", filename, sizeof(filename))) + printf("PASS (%s)\n", filename); + else + { + puts("FAIL"); + status ++; + } - if (!status) - puts("\nALL TESTS PASSED!"); + /* + * Summarize the results and return... + */ + + if (!status) + puts("\nALL TESTS PASSED!"); + else + printf("\n%d TEST(S) FAILED!\n", status); + } else - printf("\n%d TEST(S) FAILED!\n", status); + { + /* + * Cat the filename on the command-line... + */ + + cups_file_t *fp; /* File pointer */ + char line[1024]; /* Line from file */ + + + if ((fp = cupsFileOpen(argv[1], "r")) == NULL) + { + perror(argv[1]); + status = 1; + } + else + { + status = 0; + + while (cupsFileGets(fp, line, sizeof(line))) + puts(line); + + if (!cupsFileEOF(fp)) + perror(argv[1]); + + cupsFileClose(fp); + } + } return (status); } @@ -396,5 +442,5 @@ read_write_tests(int compression) /* I - Use compression? */ /* - * End of "$Id: testfile.c 4754 2005-10-08 04:01:46Z mike $". + * End of "$Id: testfile.c 4942 2006-01-18 19:49:15Z mike $". */ diff --git a/cups/testhttp.c b/cups/testhttp.c index 57e94c9003..69f9595418 100644 --- a/cups/testhttp.c +++ b/cups/testhttp.c @@ -1,5 +1,5 @@ /* - * "$Id: testhttp.c 4809 2005-10-21 19:43:55Z mike $" + * "$Id: testhttp.c 4943 2006-01-18 20:30:42Z mike $" * * HTTP test program for the Common UNIX Printing System (CUPS). * @@ -96,6 +96,8 @@ static uri_test_t uri_tests[] = /* URI test data */ "socket", "", "server", "/", 9100, 0 }, { HTTP_URI_OK, "ipp://username:password@[v1.fe80::200:1234:5678:9abc+eth0]:999/ipp", "ipp", "username:password", "fe80::200:1234:5678:9abc%eth0", "/ipp", 999, 999 }, + { HTTP_URI_OK, "http://server/admin?DEVICE_URI=usb://HP/Photosmart%25202600%2520series?serial=MY53OK70V10400", + "http", "", "server", "/admin?DEVICE_URI=usb://HP/Photosmart%25202600%2520series?serial=MY53OK70V10400", 80, 0 }, /* Missing scheme */ { HTTP_URI_MISSING_SCHEME, "/path/to/file/index.html", @@ -510,5 +512,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: testhttp.c 4809 2005-10-21 19:43:55Z mike $". + * End of "$Id: testhttp.c 4943 2006-01-18 20:30:42Z mike $". */ diff --git a/cups/testppd.c b/cups/testppd.c new file mode 100644 index 0000000000..5a66a3d4a8 --- /dev/null +++ b/cups/testppd.c @@ -0,0 +1,86 @@ +/* + * "$Id: testppd.c 4939 2006-01-17 18:54:33Z mike $" + * + * PPD test program for the Common UNIX Printing System (CUPS). + * + * Copyright 1997-2006 by Easy Software Products. + * + * These coded instructions, statements, and computer programs are the + * property of Easy Software Products 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 missing or damaged please contact Easy Software Products + * at: + * + * Attn: CUPS Licensing Information + * Easy Software Products + * 44141 Airport View Drive, Suite 204 + * Hollywood, Maryland 20636 USA + * + * Voice: (301) 373-9600 + * EMail: cups-info@cups.org + * WWW: http://www.cups.org + * + * This file is subject to the Apple OS-Developed Software exception. + * + * Contents: + * + * main() - Main entry. + */ + +/* + * Include necessary headers... + */ + +#include +#include +#include +#include +#include "ppd.h" +#ifdef WIN32 +# include +#else +# include +# include +#endif /* WIN32 */ + + +/* + * 'main()' - Main entry. + */ + +int /* O - Exit status */ +main(int argc, /* I - Number of command-line arguments */ + char *argv[]) /* I - Command-line arguments */ +{ + ppd_file_t *ppd; /* PPD file loaded from disk */ + int status; /* Status of tests (0 = success, 1 = fail) */ + + + status = 0; + + fputs("ppdOpenFile: ", stdout); + + if ((ppd = ppdOpenFile("test.ppd")) != NULL) + puts("PASS"); + else + { + ppd_status_t err; /* Last error in file */ + int line; /* Line number in file */ + + + status ++; + err = ppdLastError(&line); + + printf("FAIL (%s on line %d)\n", ppdErrorString(err), line); + } + + ppdClose(ppd); + + return (status); +} + + +/* + * End of "$Id: testppd.c 4939 2006-01-17 18:54:33Z mike $". + */ diff --git a/cups/transcode.c b/cups/transcode.c index b525b36f7e..989e28b3ea 100644 --- a/cups/transcode.c +++ b/cups/transcode.c @@ -1,5 +1,5 @@ /* - * "$Id: transcode.c 4903 2006-01-10 20:02:46Z mike $" + * "$Id: transcode.c 4967 2006-01-24 03:42:15Z mike $" * * Transcoding support for the Common UNIX Printing System (CUPS). * @@ -26,6 +26,7 @@ * cupsCharmapGet() - Get a character set map. * cupsCharmapFree() - Free a character set map. * cupsCharmapFlush() - Flush all character set maps out of cache. + * _cupsCharmapFlush() - Flush all character set maps out of cache. * cupsUTF8ToCharset() - Convert UTF-8 to legacy character set. * cupsCharsetToUTF8() - Convert legacy character set to UTF-8. * cupsUTF8ToUTF16() - Convert UTF-8 to UTF-16. @@ -171,22 +172,33 @@ cupsCharmapFree(const cups_encoding_t encoding) return; } + /* * 'cupsCharmapFlush()' - Flush all character set maps out of cache. */ void cupsCharmapFlush(void) { - int i; /* Looping variable */ - _cups_cmap_t *cmap; /* Legacy SBCS / Unicode Charset Map */ - _cups_vmap_t *vmap; /* Legacy VBCS / Unicode Charset Map */ - _cups_cmap_t *cnext; /* Next Legacy SBCS Charset Map */ - _cups_vmap_t *vnext; /* Next Legacy VBCS Charset Map */ - cups_ucs2_t *crow; /* Pointer to UCS-2 row in 'char2uni' */ - cups_sbcs_t *srow; /* Pointer to SBCS row in 'uni2char' */ - cups_vbcs_t *vrow; /* Pointer to VBCS row in 'uni2char' */ - _cups_globals_t *cg = _cupsGlobals(); - /* Pointer to library globals */ + _cupsCharmapFlush(_cupsGlobals()); +} + + +/* + * '_cupsCharmapFlush()' - Flush all character set maps out of cache. + */ + +void +_cupsCharmapFlush(_cups_globals_t *cg) /* I - Global data */ +{ + int i; /* Looping variable */ + _cups_cmap_t *cmap; /* Legacy SBCS / Unicode Charset Map */ + _cups_vmap_t *vmap; /* Legacy VBCS / Unicode Charset Map */ + _cups_cmap_t *cnext; /* Next Legacy SBCS Charset Map */ + _cups_vmap_t *vnext; /* Next Legacy VBCS Charset Map */ + cups_ucs2_t *crow; /* Pointer to UCS-2 row in 'char2uni' */ + cups_sbcs_t *srow; /* Pointer to SBCS row in 'uni2char' */ + cups_vbcs_t *vrow; /* Pointer to VBCS row in 'uni2char' */ + /* * Loop through SBCS charset map cache, free all memory... @@ -1664,5 +1676,5 @@ compare_wide(const void *k1, /* I - Key char */ /* - * End of "$Id: transcode.c 4903 2006-01-10 20:02:46Z mike $" + * End of "$Id: transcode.c 4967 2006-01-24 03:42:15Z mike $" */ diff --git a/cups/util.c b/cups/util.c index 7144ecec43..e26db23f29 100644 --- a/cups/util.c +++ b/cups/util.c @@ -1,5 +1,5 @@ /* - * "$Id: util.c 4918 2006-01-12 05:14:40Z mike $" + * "$Id: util.c 4987 2006-01-26 00:25:21Z mike $" * * Printing utilities for the Common UNIX Printing System (CUPS). * @@ -25,25 +25,36 @@ * * Contents: * - * cupsCancelJob() - Cancel a print job on the default server. - * cupsDoFileRequest() - Do an IPP request. - * cupsFreeJobs() - Free memory used by job data. - * cupsGetClasses() - Get a list of printer classes from the default server. - * cupsGetDefault() - Get the default printer or class from the default server. - * cupsGetDefault2() - Get the default printer or class from the specified server. - * cupsGetJobs() - Get the jobs from the default server. - * cupsGetJobs2() - Get the jobs from the specified server. - * cupsGetPPD() - Get the PPD file for a printer on the default server. - * cupsGetPPD2() - Get the PPD file for a printer on the specified server. - * cupsGetPrinters() - Get a list of printers from the default server. - * cupsLastError() - Return the last IPP status code. - * cupsLastErrorString() - Return the last IPP status-message. - * cupsPrintFile() - Print a file to a printer or class on the default server. - * cupsPrintFile2() - Print a file to a printer or class on the specified server. - * cupsPrintFiles() - Print one or more files to a printer or class on the default server. - * cupsPrintFiles2() - Print one or more files to a printer or class on the specified server. - * cups_connect() - Connect to the specified host... - * cups_set_error() - Set the last IPP status code and status-message. + * cupsCancelJob() - Cancel a print job on the default server. + * cupsDoFileRequest() - Do an IPP request. + * cupsFreeJobs() - Free memory used by job data. + * cupsGetClasses() - Get a list of printer classes from the default + * server. + * cupsGetDefault() - Get the default printer or class from the default + * server. + * cupsGetDefault2() - Get the default printer or class from the + * specified server. + * cupsGetJobs() - Get the jobs from the default server. + * cupsGetJobs2() - Get the jobs from the specified server. + * cupsGetPPD() - Get the PPD file for a printer on the default + * server. + * cupsGetPPD2() - Get the PPD file for a printer on the specified + * server. + * cupsGetPrinters() - Get a list of printers from the default server. + * cupsLastError() - Return the last IPP status code. + * cupsLastErrorString() - Return the last IPP status-message. + * cupsPrintFile() - Print a file to a printer or class on the default + * server. + * cupsPrintFile2() - Print a file to a printer or class on the + * specified server. + * cupsPrintFiles() - Print one or more files to a printer or class on + * the default server. + * cupsPrintFiles2() - Print one or more files to a printer or class on + * the specified server. + * cups_connect() - Connect to the specified host... + * cups_get_printer_uri() - Get the printer-uri-supported attribute for the + * first printer in a class. + * cups_set_error() - Set the last IPP status code and status-message. */ /* @@ -68,6 +79,10 @@ */ static char *cups_connect(const char *name, char *printer, char *hostname); +static int cups_get_printer_uri(http_t *http, const char *name, + char *host, int hostsize, int *port, + char *resource, int resourcesize, + int depth); static void cups_set_error(ipp_status_t status, const char *message); @@ -354,7 +369,11 @@ cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */ if (cupsDoAuthentication(http, "POST", resource)) break; - httpReconnect(http); + if (httpReconnect(http)) + { + status = HTTP_ERROR; + break; + } continue; } @@ -1121,29 +1140,15 @@ const char * /* O - Filename for PPD file */ cupsGetPPD2(http_t *http, /* I - HTTP connection */ const char *name) /* I - Printer name */ { - int i; /* Looping var */ int http_port; /* Port number */ http_t *http2; /* Alternate HTTP connection */ - ipp_t *request, /* IPP request */ - *response; /* IPP response */ - ipp_attribute_t *attr; /* Current attribute */ - cups_lang_t *language; /* Local language */ int fd; /* PPD file */ - char uri[HTTP_MAX_URI], /* Printer URI */ - printer[HTTP_MAX_URI], /* Printer name */ - method[HTTP_MAX_URI], /* Method/scheme name */ - username[HTTP_MAX_URI], /* Username:password */ + char localhost[HTTP_MAX_URI],/* Local hostname */ hostname[HTTP_MAX_URI], /* Hostname */ resource[HTTP_MAX_URI]; /* Resource name */ int port; /* Port number */ http_status_t status; /* HTTP status from server */ _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ - static const char * const requested_attrs[] = - { /* Requested attributes */ - "printer-uri-supported", - "printer-type", - "member-uris" - }; /* @@ -1161,19 +1166,24 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */ } /* - * Setup the printer URI... + * Try finding a printer URI for this printer... */ - if (httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, - "/printers/%s", name) != HTTP_URI_OK) - { - cups_set_error(IPP_INTERNAL_ERROR, NULL); - + if (!cups_get_printer_uri(http, name, hostname, sizeof(hostname), &port, + resource, sizeof(resource), 0)) return (NULL); - } /* - * Get the port number we are connect to... + * Remap local hostname to localhost... + */ + + httpGetHostname(localhost, sizeof(localhost)); + + if (!strcasecmp(localhost, hostname)) + strcpy(hostname, "localhost"); + + /* + * Get the port number we are connected to... */ #ifdef AF_INET6 @@ -1186,106 +1196,6 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */ else http_port = ippPort(); - port = http_port; - - /* - * Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following - * attributes: - * - * attributes-charset - * attributes-natural-language - * printer-uri - * requested-attributes - */ - - request = ippNew(); - - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - - cupsLangFree(language); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, - "printer-uri", NULL, uri); - - DEBUG_printf(("cupsGetPPD2: printer-uri=\"%s\"\n", uri)); - - ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_NAME, - "requested-attributes", - sizeof(requested_attrs) / sizeof(requested_attrs[0]), - NULL, requested_attrs); - - /* - * Do the request and get back a response... - */ - - if ((response = cupsDoRequest(http, request, "/")) != NULL) - { - printer[0] = '\0'; - hostname[0] = '\0'; - - if ((attr = ippFindAttribute(response, "member-uris", IPP_TAG_URI)) != NULL) - { - /* - * Get the first actual server and printer name in the class... - */ - - for (i = 0; i < attr->num_values; i ++) - { - httpSeparateURI(attr->values[i].string.text, method, sizeof(method), - username, sizeof(username), hostname, sizeof(hostname), - &port, resource, sizeof(resource)); - if (!strncmp(resource, "/printers/", 10)) - { - /* - * Found a printer! - */ - - strlcpy(printer, resource + 10, sizeof(printer)); - break; - } - } - } - else if ((attr = ippFindAttribute(response, "printer-uri-supported", - IPP_TAG_URI)) != NULL) - { - /* - * Get the actual server and printer names... - */ - - httpSeparateURI(attr->values[0].string.text, method, sizeof(method), - username, sizeof(username), hostname, sizeof(hostname), - &port, resource, sizeof(resource)); - - strlcpy(printer, strrchr(resource, '/') + 1, sizeof(printer)); - } - - ippDelete(response); - - /* - * Remap local hostname to localhost... - */ - - httpGetHostname(uri, sizeof(uri)); - - if (!strcasecmp(uri, hostname)) - strcpy(hostname, "localhost"); - } - - if (!printer[0]) - { - cups_set_error(IPP_NOT_FOUND, NULL); - return (NULL); - } - /* * Reconnect to the correct server as needed... */ @@ -1322,7 +1232,7 @@ cupsGetPPD2(http_t *http, /* I - HTTP connection */ * And send a request to the HTTP server... */ - snprintf(resource, sizeof(resource), "/printers/%s.ppd", printer); + strlcat(resource, ".ppd", sizeof(resource)); status = cupsGetFd(http2, resource, fd); @@ -1553,7 +1463,8 @@ cupsPrintFile2(http_t *http, /* I - HTTP connection */ /* - * 'cupsPrintFiles()' - Print one or more files to a printer or class on the default server. + * 'cupsPrintFiles()' - Print one or more files to a printer or class on the + * default server. */ int /* O - Job ID */ @@ -1596,7 +1507,8 @@ cupsPrintFiles(const char *name, /* I - Printer or class name */ /* - * 'cupsPrintFiles2()' - Print one or more files to a printer or class on the specified server. + * 'cupsPrintFiles2()' - Print one or more files to a printer or class on the + * specified server. * * @since CUPS 1.1.21@ */ @@ -1761,17 +1673,18 @@ cupsPrintFiles2(http_t *http, /* I - HTTP connection */ */ if (cupsGetOption("raw", num_options, options)) - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", - NULL, "application/vnd.cups-raw"); - else if ((val = cupsGetOption("document-format", num_options, options)) != NULL) - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", - NULL, val); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, + "document-format", NULL, "application/vnd.cups-raw"); + else if ((val = cupsGetOption("document-format", num_options, + options)) != NULL) + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, + "document-format", NULL, val); else - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", - NULL, "application/octet-stream"); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, + "document-format", NULL, "application/octet-stream"); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", - NULL, cupsUser()); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser()); /* * Is this the last document? @@ -1807,7 +1720,7 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */ char *hostname) /* O - Hostname [HTTP_MAX_URI] */ { char hostbuf[HTTP_MAX_URI]; /* Name of host */ - _cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */ + _cups_globals_t *cg = _cupsGlobals();/* Pointer to library globals */ DEBUG_printf(("cups_connect(\"%s\", %p, %p)\n", name, printer, hostname)); @@ -1848,7 +1761,7 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */ DEBUG_printf(("connecting to %s on port %d...\n", hostname, ippPort())); if ((cg->http = httpConnectEncrypt(hostname, ippPort(), - cupsEncryption())) == NULL) + cupsEncryption())) == NULL) { DEBUG_puts("Unable to connect to server!"); @@ -1861,6 +1774,195 @@ cups_connect(const char *name, /* I - Destination (printer[@host]) */ } +/* + * 'cups_get_printer_uri()' - Get the printer-uri-supported attribute for the first printer in a class. + */ + +static int /* O - 1 on success, 0 on failure */ +cups_get_printer_uri( + http_t *http, /* I - HTTP connection */ + const char *name, /* I - Name of printer or class */ + char *host, /* I - Hostname buffer */ + int hostsize, /* I - Size of hostname buffer */ + int *port, /* O - Port number */ + char *resource, /* I - Resource buffer */ + int resourcesize, /* I - Size of resource buffer */ + int depth) /* I - Depth of query */ +{ + int i; /* Looping var */ + int http_port; /* Port number */ + http_t *http2; /* Alternate HTTP connection */ + ipp_t *request, /* IPP request */ + *response; /* IPP response */ + ipp_attribute_t *attr; /* Current attribute */ + char uri[HTTP_MAX_URI], /* printer-uri attribute */ + scheme[HTTP_MAX_URI], /* Scheme name */ + username[HTTP_MAX_URI], /* Username:password */ + classname[255]; /* Temporary class name */ + static const char * const requested_attrs[] = + { /* Requested attributes */ + "printer-uri-supported", + "printer-type", + "member-uris" + }; + + + DEBUG_printf(("cups_get_printer_uri(http=%p, name=\"%s\", host=%p, " + "hostsize=%d, resource=%p, resourcesize=%d, depth=%d)\n", + http, name ? name : "(null)", host, hostsize, + resource, resourcesize, depth)); + + /* + * Setup the printer URI... + */ + + if (httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, + "/printers/%s", name) != HTTP_URI_OK) + { + cups_set_error(IPP_INTERNAL_ERROR, NULL); + + *host = '\0'; + *resource = '\0'; + + return (0); + } + + DEBUG_printf(("cups_get_printer_uri: printer-uri=\"%s\"\n", uri)); + + /* + * Get the port number we are connected to... + */ + +#ifdef AF_INET6 + if (http->hostaddr->addr.sa_family == AF_INET6) + http_port = ntohs(http->hostaddr->ipv6.sin6_port); + else +#endif /* AF_INET6 */ + if (http->hostaddr->addr.sa_family == AF_INET) + http_port = ntohs(http->hostaddr->ipv4.sin_port); + else + http_port = ippPort(); + + /* + * Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the following + * attributes: + * + * attributes-charset + * attributes-natural-language + * printer-uri + * requested-attributes + */ + + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); + + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", + NULL, uri); + + ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requested-attributes", + sizeof(requested_attrs) / sizeof(requested_attrs[0]), + NULL, requested_attrs); + + /* + * Do the request and get back a response... + */ + + if ((response = cupsDoRequest(http, request, "/")) != NULL) + { + if ((attr = ippFindAttribute(response, "member-uris", IPP_TAG_URI)) != NULL) + { + /* + * Get the first actual printer name in the class... + */ + + for (i = 0; i < attr->num_values; i ++) + { + httpSeparateURI(attr->values[i].string.text, scheme, sizeof(scheme), + username, sizeof(username), host, hostsize, + port, resource, resourcesize); + if (!strncmp(resource, "/printers/", 10)) + { + /* + * Found a printer! + */ + + ippDelete(response); + + return (1); + } + } + + /* + * No printers in this class - try recursively looking for a printer, + * but not more than 3 levels deep... + */ + + if (depth < 3) + { + for (i = 0; i < attr->num_values; i ++) + { + httpSeparateURI(attr->values[i].string.text, scheme, sizeof(scheme), + username, sizeof(username), host, hostsize, + port, resource, resourcesize); + if (!strncmp(resource, "/classes/", 9)) + { + /* + * Found a class! Connect to the right server... + */ + + if (!strcasecmp(http->hostname, host) && *port == http_port) + http2 = http; + else if ((http2 = httpConnectEncrypt(host, *port, + cupsEncryption())) == NULL) + { + DEBUG_puts("Unable to connect to server!"); + + continue; + } + + /* + * Look up printers on that server... + */ + + strlcpy(classname, resource + 9, sizeof(classname)); + + cups_get_printer_uri(http2, classname, host, hostsize, port, + resource, resourcesize, depth + 1); + + /* + * Close the connection as needed... + */ + + if (http2 != http) + httpClose(http2); + + if (*host) + return (1); + } + } + } + } + else if ((attr = ippFindAttribute(response, "printer-uri-supported", + IPP_TAG_URI)) != NULL) + { + httpSeparateURI(attr->values[0].string.text, scheme, sizeof(scheme), + username, sizeof(username), host, hostsize, + port, resource, resourcesize); + ippDelete(response); + + return (1); + } + + ippDelete(response); + } + + *host = '\0'; + *resource = '\0'; + + return (0); +} + + /* * 'cups_set_error()' - Set the last IPP status code and status-message. */ @@ -1888,5 +1990,5 @@ cups_set_error(ipp_status_t status, /* I - IPP status code */ /* - * End of "$Id: util.c 4918 2006-01-12 05:14:40Z mike $". + * End of "$Id: util.c 4987 2006-01-26 00:25:21Z mike $". */ diff --git a/data/Makefile b/data/Makefile index bf9e47d185..60383a9580 100644 --- a/data/Makefile +++ b/data/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 4494 2005-02-18 02:18:11Z mike $" +# "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $" # # Datafile makefile for the Common UNIX Printing System (CUPS). # @@ -136,7 +136,7 @@ clean: # Install files... # -install: +install: all $(INSTALL_DIR) $(DATADIR)/banners for file in $(BANNERS); do \ $(INSTALL_DATA) $$file $(DATADIR)/banners; \ @@ -153,8 +153,9 @@ install: for file in $(DATAFILES); do \ $(INSTALL_DATA) $$file $(DATADIR)/data; \ done + $(INSTALL_DIR) $(DATADIR)/profiles # -# End of "$Id: Makefile 4494 2005-02-18 02:18:11Z mike $". +# End of "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $". # diff --git a/data/testprint.ps b/data/testprint.ps index 69a2406e38..c437ae2125 100644 --- a/data/testprint.ps +++ b/data/testprint.ps @@ -6,7 +6,7 @@ %%DocumentSuppliedResources: procset testprint/1.2 %%DocumentNeededResources: font Helvetica Helvetica-Bold Times-Roman %%Creator: Michael Sweet, Easy Software Products -%%CreationDate: D:20051002193000+0500 +%%CreationDate: D:20060114093000+0500 %%Title: Test Page %%EndComments %%BeginProlog @@ -14,7 +14,7 @@ % % PostScript test page for the Common UNIX Printing System ("CUPS"). % -% Copyright 1993-2005 Easy Software Products +% Copyright 1993-2006 Easy Software Products % % These coded instructions, statements, and computer programs are the % property of Easy Software Products and are protected by Federal @@ -600,7 +600,7 @@ gsave pageHeight 8 mul % Move down... 2 copy moveto % Position text smallFont setfont % Font - (Copyright 1993-2005 Easy Software Products, All Rights Reserved.) CENTER + (Copyright 1993-2006 Easy Software Products, All Rights Reserved.) CENTER pageHeight sub % Move down... 2 copy moveto % Position text (CUPS, and the CUPS logo are the trademark property of Easy Software Products,) CENTER @@ -631,6 +631,6 @@ gsave grestore showpage % -% End of "$Id: testprint.ps 4743 2005-10-02 23:29:44Z mike $". +% End of "$Id: testprint.ps 4930 2006-01-14 16:54:03Z mike $". % %%EOF diff --git a/doc/Makefile b/doc/Makefile index ec0abad38e..a6aa8a3cda 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 4918 2006-01-12 05:14:40Z mike $" +# "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $" # # Documentation makefile for the Common UNIX Printing System (CUPS). # @@ -44,7 +44,6 @@ WEBIMAGES = \ images/continue.gif \ images/delete-class.gif \ images/delete-printer.gif \ - images/draft.gif \ images/edit-configuration-file.gif \ images/esp-logo.gif \ images/happy.gif \ @@ -57,6 +56,8 @@ WEBIMAGES = \ images/manage-server.gif \ images/modify-class.gif \ images/modify-printer.gif \ + images/move-job.gif \ + images/move-jobs.gif \ images/printer-idle.gif \ images/printer-processing.gif \ images/printer-stopped.gif \ @@ -71,7 +72,12 @@ WEBIMAGES = \ images/set-as-default.gif \ images/set-printer-options.gif \ images/show-active.gif \ + images/show-all.gif \ images/show-completed.gif \ + images/show-next.gif \ + images/show-previous.gif \ + images/sort-ascending.gif \ + images/sort-descending.gif \ images/start-class.gif \ images/start-printer.gif \ images/stop-class.gif \ @@ -124,6 +130,7 @@ HELPFILES = \ help/man-lpstat.html \ help/network.html \ help/overview.html \ + help/spec-ipp.html \ help/spec-ppd.html \ help/standard.html \ help/whatsnew.html @@ -147,7 +154,7 @@ clean: # Install all documentation files... # -install: +install: all $(INSTALL_DIR) $(DOCDIR) for file in $(WEBPAGES); do \ $(INSTALL_MAN) $$file $(DOCDIR); \ diff --git a/doc/cups.css b/doc/cups.css index c33a47c7bb..24c7f5ea4f 100644 --- a/doc/cups.css +++ b/doc/cups.css @@ -205,3 +205,19 @@ DIV.sidebar P.l2 { margin-top: 0; text-indent: -2em; } + +TABLE.pager { + background: #cccc99; + border: solid thin #999966; + margin-top: 10px; + padding: 2px; +} + +DT { + margin-left: 3em; + margin-top: 1em; +} + +DD { + margin-left: 5em; +} diff --git a/doc/help/spec-ipp.html b/doc/help/spec-ipp.html new file mode 100644 index 0000000000..24991a90d7 --- /dev/null +++ b/doc/help/spec-ipp.html @@ -0,0 +1,2183 @@ + + + + + CUPS Implementation of IPP + + + + + +

Introduction

+ +

CUPS 1.1 implements IPP/1.1 and the operations and attributes +defined in the "IPP: Job and Printer Set Operations", "IPP/1.1: +Output-bin Attribute Extension", and "IPP/1.1: finishings +'fold',' trim', and 'bale' attribute values extension" +specifications.

+ +

CUPS also provides 13 new operations and many new attributes +to support multiple IPP printers and printer classes on a single +host.

+ +

IPP URIs

+ +

CUPS supports the "http", "https", and "ipp" schemes. The +following resource names are used:

+ +
+ +
scheme://hostname:port/
+ +
Can be used for all "get" operations and for server + subscriptions.
+ +
scheme://hostname:port/admin/
+ +
Used for all administrative operations.
+ +
scheme://hostname:port/classes/name
+ +
Specifies a printer class.
+ +
scheme://hostname:port/jobs/id
+ +
Specifies a job.
+ +
scheme://hostname:port/printers/name
+ +
Specifies a printer.
+ +
+ +

So a typical printer URI would be +"ipp://foo.bar.com/printers/LaserJet". In addition, the CUPS +server also supports normal browser access via +"http://hostname:port/" and "https://hostname:port/".

+ +

CUPS IPP Operations

+ +

CUPS provides 14 extension operations in addition to most of the +standard IPP and registered extension operations: + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Operation NameCUPSCodeBrief Description
Print-Job1.00x0002Print a file.
Validate-Job1.00x0004Validate job attributes.
Create-Job1.10x0005Create a print job.
Send-Document1.10x0006Send a file for a print job.
Cancel-Job1.00x0008Cancel a print job.
Get-Job-Attributes1.00x0009Get job attributes.
Get-Jobs1.00x000AGet all jobs.
Get-Printer-Attributes1.00x000BGet printer attributes.
Hold-Job1.10x000CHold a job for printing.
Release-Job1.10x000DRelease a job for printing.
Restart-Job1.10x000ERestarts a print job.
Pause-Printer1.00x0010Pause printing on a printer.
Resume-Printer1.00x0011Resume printing on a printer.
Purge-Jobs1.00x0012Purge all jobs.
Set-Job-Attributes1.10x0014Set attributes for a pending or held job.
Create-Printer-Subscription1.20x0016Creates a subscription associated with a printer or the server.
Create-Job-Subscription1.20x0017Creates a subscription associated with a job.
Get-Subscription-Attributes1.20x0018Gets the attributes for a subscription.
Get-Subscriptions1.20x0019Gets the attributes for zero or more subscriptions.
Renew-Subscription1.20x001ARenews a subscription.
Cancel-Subscription1.20x001BCancels a subscription.
Get-Notifications1.20x001CGet notification events for ippget subscriptions.
Enable-Printer1.20x0022Accepts jobs on a printer.
Disable-Printer1.20x0023Rejects jobs on a printer.
CUPS-Get-Default1.00x4001Get the default destination.
CUPS-Get-Printers1.00x4002Get all of the available printers.
CUPS-Add-Modify-Printer1.00x4003Add or modify a printer.
CUPS-Delete-Printer1.00x4004Delete a printer.
CUPS-Get-Classes1.00x4005Get all of the available printer classes.
CUPS-Add-Modify-Class1.00x4006Add or modify a printer class.
CUPS-Delete-Class1.00x4007Delete a printer class.
CUPS-Accept-Jobs1.00x4008Accept jobs on a printer or printer class.
CUPS-Reject-Jobs1.00x4009Reject jobs on a printer or printer class.
CUPS-Set-Default1.00x400ASet the default destination.
CUPS-Get-Devices1.10x400BGet all of the available devices.
CUPS-Get-PPDs1.10x400CGet all of the available PPDs.
CUPS-Move-Job1.10x400DMove a job to a different printer.
CUPS-Authenticate-Job1.20x400EAuthenticate a job for printing.
+ +

Operations

+ +

The following sections describe the operations supported by CUPS. +In the interest of brevity, operations which use only the standard +IPP attributes are not described. + +

Print-Job Operation

+ +

The Print-Job operation (0x0002) prints a file. + +

Print-Job Request

+ +

The following groups of attributes are supplied as part of the +Print-Job request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri): + +
The client MUST supply a URI for the specified printer. + +
+ +

Group 2: Job Template Attributes + +

+ +
"job-billing" (text(MAX)):CUPS 1.1 + +
The client OPTIONALLY supplies a billing string that is logged + with the page accounting information. + +
"job-sheets" (1setof type3 keyword | name(MAX)):CUPS 1.1 + +
The client OPTIONALLY supplies one or two banner pages that + are printed before and after any files in the print job. The + name of "none" is reserved to indicate that no banner page + should be printed. If the client does not specify this + attribute then the value of the "job-sheets-default" printer + object attribute is used. + +
Note: Standard IPP only allows + specification of a single job-sheets attribute + value.
+ +
"media" (1setof type3 keyword | name(MAX)): + +
The client OPTIONALLY supplies one or more media attributes + specifying the size, type, source, and color of the output + media. If the client does not specify this attribute then the + value of the "media-default" printer object attribute is used. + +
Note: Standard IPP only allows + specification of a single media attribute + value.
+ +
Other Job Template Attributes + +
+ +

The Print-Job request is followed by a file to be printed. + +

Print-Job Response

+ +

The following groups of attributes are send as part of the Print-Job +Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

Group 2: Job Attributes + +

+ +
Standard Job Attributes + +
+ +

CUPS 1.1Create-Job Operation

+ +

The Create-Job operation (0x0005) creates a new, empty print job. + +

Create-Job Request

+ +

The following groups of attributes are supplied as part of the +Create-Job request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri): + +
The client MUST supply a URI for the specified printer. + +
+ +

Group 2: Job Template Attributes + +

+ +
"job-billing" (text(MAX)):CUPS 1.1 + +
The client OPTIONALLY supplies a billing string that is logged + with the page accounting information. + +
"job-sheets" (1setof type3 keyword | name(MAX)):CUPS 1.1 + +
The client OPTIONALLY supplies one or two banner pages that + are printed before and after any files in the print job. The + name of "none" is reserved to indicate that no banner page + should be printed. If the client does not specify this + attribute then the value of the "job-sheets-default" printer + object attribute is used. + +
Note: Standard IPP only allows + specification of a single job-sheets attribute + value.
+ +
"media" (1setof type3 keyword | name(MAX)): + +
The client OPTIONALLY supplies one or more media attributes + specifying the size, type, source, and color of the output + media. If the client does not specify this attribute then the + value of the "media-default" printer object attribute is used. + +
Note: Standard IPP only allows + specification of a single media attribute + value.
+ +
Standard Job Template Attributes + +
+ +

Create-Job Response

+ +

The following groups of attributes are send as part of the +Create-Job Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

Group 2: Job Attributes + +

+ +
Standard Job Attributes + +
+ +

CUPS 1.1Set-Job-Attributes Operation

+ +

The Set-Job-Attributes operation (0x0014) changes the attributes of +an active (not completed) job. + +

Set-Job-Attributes Request

+ +

The following groups of attributes are supplied as part of the +Set-Job-Attributes request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri) and "job-id" (integer) +
OR +
"job-uri": + +
The client MUST supply a URI for the specified printer and + a job ID number, or the job URI. + +
+ +

Group 2: Job Template Attributes + +

+ +
"job-sheets" (1setof type3 keyword | name(MAX)):CUPS 1.1 + +
The client OPTIONALLY supplies one or two banner pages that + are printed before and after any files in the print job. The + name of "none" is reserved to indicate that no banner page + should be printed. If the client does not specify this + attribute then the value of the "job-sheets-default" printer + object attribute is used. + +
Note: Standard IPP only allows + specification of a single job-sheets attribute + value.
+ +
"media" (1setof type3 keyword | name(MAX)): + +
The client OPTIONALLY supplies one or more media attributes + specifying the size, type, source, and color of the output + media. If the client does not specify this attribute then the + value of the "media-default" printer object attribute is used. + +
Note: Standard IPP only allows + specification of a single media attribute + value.
+ +
Other Job Template Attributes + +
+ +

Set-Job-Attributes Response

+ +

The following groups of attributes are send as part of the Set-Job-Attributes +Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

CUPS 1.2Create-Printer-Subscription

+ +

The Create-Printer-Subscription operation (0x0016) creates a +subscription for printer or server event notifications. CUPS +provides several additional events in addition to the standard +events in the IPP notifications specification.

+ +

Request

+ +

The following groups of attributes are supplied as part of the +request:

+ +

Group 1: Operation Attributes

+ +
+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri): + +
The printer + (ipp://server/printers/printername), class + (ipp://server/classes/classname), or server + (ipp://server/) URI for event notifications. + +
"notify-events" (1setOf keyword): + +
The events to monitor. In addition to the standard + events, CUPS adds the following keywords: +
    + +
  • printer-added - Get notified + whenever a printer or class is added
  • + +
  • printer-deleted - Get notified + whenever a printer or class is deleted
  • + +
  • printer-modified - Get notified + whenever a printer or class is modified
  • + +
  • server-audit - Get notified when a + security condition occurs
  • + +
  • server-restarted - Get notified when + the server is restarted
  • + +
  • server-started - Get notified when + the server is started
  • + +
  • server-stopped - Get notified when + the server is stopped
  • + +
+ +
+ +

Response

+ +

The following groups of attributes are send as part of the +response:

+ +

Group 1: Operation Attributes

+ +
+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

Group 2: Subscription Object Attributes

+ +
+ +
"subscription-id" (integer): + +
The subscription number. + +
+ +

CUPS-Get-Default Operation

+ +

The CUPS-Get-Default operation (0x4001) returns the default printer +URI and attributes. + +

CUPS-Get-Default Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Get-Default request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"requested-attributes" (1setOf keyword) : + +
The client OPTIONALLY supplies a set of attribute names + and/or attribute group names in whose values the requester is + interested. If the client omits this attribute, the server + responds as if this attribute had been supplied with a value of + 'all'. + +
+ +

CUPS-Get-Default Response

+ +

The following groups of attributes are send as part of the +CUPS-Get-Default Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

Group 2: Printer Object Attributes + +

+ +
The set of requested attributes and their current values. + +
+ +

CUPS-Get-Printers Operation

+ +

The CUPS-Get-Printers operation (0x4002) returns the printer +attributes for every printer known to the system. This may include +printers that are not served directly by the server. + +

CUPS-Get-Printers Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Get-Printers request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"limit" (integer (1:MAX)): + +
The client OPTIONALLY supplies this attribute limiting the + number of printers that are returned. + +
"printer-info" (text(127)):CUPS 1.1 + +
The client OPTIONALLY supplies this attribute to + select which printers are returned. + +
"printer-location" (text(127)): CUPS 1.1.7 + +
The client OPTIONALLY supplies this attribute to + select which printers are returned. + +
"printer-type" (type2 enum): CUPS 1.1.7 + +
The client OPTIONALLY supplies a printer type enumeration to + select which printers are returned. + +
"printer-type-mask" (type2 enum): CUPS 1.1.7 + +
The client OPTIONALLY supplies a printer type mask + enumeration to select which bits are used in the "printer-type" + attribute. + +
"requested-attributes" (1setOf keyword) : + +
The client OPTIONALLY supplies a set of attribute names + and/or attribute group names in whose values the requester is + interested. If the client omits this attribute, the server + responds as if this attribute had been supplied with a value of + 'all'. + +
+ +

CUPS-Get-Printers Response

+ +

The following groups of attributes are send as part of the +CUPS-Get-Printers Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

Group 2: Printer Object Attributes + +

+ +
The set of requested attributes and their current values for + each printer. + +
+ +

CUPS-Add-Modify-Printer Operation

+ +

The CUPS-Add-Modify-Printer operation (0x4003) adds a new printer or +modifies an existing printer on the system. + +

CUPS-Add-Modify-Printer Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Add-Modify-Printer request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri): + +
The client MUST supply a URI for the specified printer. + +
+ +

Group 2: Printer Object Attributes + +

+ +
"job-sheets-default" (1setOf name(127)): CUPS 1.1.7 + +
The client OPTIONALLY supplies one or two banner page + names that are printed before and after files in a job. + The reserved name "none" is used to specify that no + banner page should be printed. + +
"device-uri" (uri): + +
The client OPTIONALLY supplies a device URI for the + specified printer. + +
"ppd-name" (name(127)): + +
The client OPTIONALLY supplies a PPD name for the specified + printer. + +
"printer-is-accepting-jobs" (boolean): + +
The client OPTIONALLY supplies this boolean attribute + indicating whether or not the printer object should accept new jobs. + +
"printer-info" (text(127)): + +
The client OPTIONALLY supplies this attribute indicating the + printer information string. + +
"printer-location" (text(127)): + +
The client OPTIONALLY supplies this attribute indicating a + textual location of the printer. + +
"printer-more-info" (uri): + +
The client OPTIONALLY supplies this attribute indicating a + URI for additional printer information. + +
"printer-state" (type2 enum): + +
The client OPTIONALLY supplies this attribute indicating the + initial/current state of the printer. Only the "idle" and "stopped" + enumerations are recognized. + +
"printer-state-message" (text(MAX)): + +
The client OPTIONALLY supplies this attribute indicating a + textual reason for the current printer state. + +
"requesting-user-name-allowed" (1setof name(127) | delete) +
OR +
"requesting-user-name-denied" (1setof name(127) | delete): + +
The client OPTIONALLY supplies one of these attributes to + specify an access control list for incoming print jobs. To allow + all users access to a printer, use the delete tag for the + attribute value. + +
+ +

The CUPS-Add-Modify-Printer request can optionally be followed by a PPD +file or System V interface script to be used for the printer. The +"ppd-name" attribute overrides any file that is attached to the end of +the request with a local CUPS PPD file. + +

CUPS-Add-Modify-Printer Response

+ +

The following groups of attributes are send as part of the +CUPS-Add-Modify-Printer Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

CUPS-Delete-Printer Operation

+ +

The CUPS-Delete-Printer operation (0x4004) removes an existing +printer from the system. + +

CUPS-Delete-Printer Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Delete-Printer request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri): + +
The client MUST supply a URI for the specified printer. + +
+ +

CUPS-Delete-Printer Response

+ +

The following groups of attributes are send as part of the +CUPS-Delete-Printer Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

CUPS-Get-Classes Operation

+ +

The CUPS-Get-Classes operation (0x4005) returns the printer +attributes for every printer class known to the system. This may +include printer classes that are not served directly by the server. + +

CUPS-Get-Classes Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Get-Classes request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"limit" (integer (1:MAX)): + +
The client OPTIONALLY supplies this attribute limiting the + number of printer classes that are returned. + +
"printer-info" (text(127)): CUPS 1.1.7 +
The client OPTIONALLY supplies this attribute to + select which printer classes are returned. + +
"printer-location" (text(127)): CUPS 1.1.7 +
The client OPTIONALLY supplies this attribute to + select which printer classes are returned. + +
"printer-type" (type2 enum): CUPS 1.1.7 +
The client OPTIONALLY supplies a printer type enumeration to + select which printer classes are returned. + +
"printer-type-mask" (type2 enum): CUPS 1.1.7 +
The client OPTIONALLY supplies a printer type mask + enumeration to select which bits are used in the "printer-type" + attribute. + +
"requested-attributes" (1setOf keyword) : + +
The client OPTIONALLY supplies a set of attribute names + and/or attribute group names in whose values the requester is + interested. If the client omits this attribute, the server responds as + if this attribute had been supplied with a value of 'all'. + +
+ +

CUPS-Get-Classes Response

+ +

The following groups of attributes are send as part of the +CUPS-Get-Classes Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

Group 2: Printer Class Object Attributes + +

+ +
The set of requested attributes and their current values for + each printer class. + +
+ +

CUPS-Add-Modify-Class Operation

+ +

The CUPS-Add-Modify-Class operation (0x4006) adds a new printer class or +modifies and existing printer class on the system. + +

CUPS-Add-Modify-Class Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Add-Modify-Class request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri): + +
The client MUST supply a URI for the specified printer class. + +
+ +

Group 2: Printer Object Attributes + +

+ +
"member-uris" (1setof uri): + +
The client OPTIONALLY supplies the "member-uris" set + specifying the printers and printer classes that are part of the class. + +
"printer-is-accepting-jobs" (boolean): + +
The client OPTIONALLY supplies this boolean attribute + indicating whether or not the class object should accept new jobs. + +
"printer-info" (text(127)): + +
The client OPTIONALLY supplies this attribute indicating the + printer information string. + +
"printer-location" (text(127)): + +
The client OPTIONALLY supplies this attribute indicating a + textual location of the class. + +
"printer-more-info" (uri): + +
The client OPTIONALLY supplies this attribute indicating a + URI for additional class information. + +
"printer-state" (type2 enum): + +
The client OPTIONALLY supplies this attribute indicating the + initial/current state of the class. Only the "idle" and "stopped" + enumerations are recognized. + +
"printer-state-message" (text(MAX)): + +
The client OPTIONALLY supplies this attribute indicating a + textual reason for the current class state. + +
"requesting-user-name-allowed" (1setof name(127)) +
OR +
"requesting-user-name-denied" (1setof name(127)): + +
The client OPTIONALLY supplies one of these attributes to + specify an access control list for incoming print jobs. To allow + all users access to a class, use the delete tag for the + attribute value. + +
+ +

CUPS-Add-Modify-Class Response

+ +

The following groups of attributes are send as part of the CUPS-Add-Modify-Class Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

CUPS-Delete-Class Operation

+ +

The CUPS-Delete-Class operation (0x4007) removes an existing printer +class from the system. + +

CUPS-Delete-Class Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Delete-Class request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri): + +
The client MUST supply a URI for the specified printer class. + +
+ +

CUPS-Delete-Class Response

+ +

The following groups of attributes are send as part of the +CUPS-Delete-Class Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

CUPS-Accept-Jobs Operation

+ +

The CUPS-Accept-Jobs operation (0x4008) sets the +"printer-is-accepting-jobs" attribute to true for the specified printer +or printer class. + +

CUPS-Accept-Jobs Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Accept-Jobs request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri): + +
The client MUST supply a URI for the specified printer or printer class. + +
+ +

CUPS-Accept-Jobs Response

+ +

The following groups of attributes are send as part of the +CUPS-Accept-Jobs Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

CUPS-Reject-Jobs Operation

+ +

The CUPS-Reject-Jobs operation (0x4009) sets +the"printer-is-accepting-jobs" attribute to false for the specified +printer or printer class. + +

CUPS-Reject-Jobs Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Reject-Jobs request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri): + +
The client MUST supply a URI for the specified printer or printer class. + +
+ +

Group 2: Printer Object Attributes + +

+ +
"printer-state-message" (text(MAX)): + +
The client OPTIONALLY supplies this attribute indicating a + textual reason for the current printer state. + +
+ +

CUPS-Reject-Jobs Response

+ +

The following groups of attributes are send as part of the +CUPS-Reject-Jobs Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

CUPS-Set-Default Operation

+ +

The CUPS-Set-Default operation (0x400A) sets the default printer +destination for all clients when a resource name of "/printers" is +specified. + +

CUPS-Set-Default Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Set-Default request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri): + +
The client MUST supply a URI for the specified printer or + printer class. + +
+ +

CUPS-Set-Default Response

+ +

The following groups of attributes are send as part of the +CUPS-Set-Default Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

CUPS 1.1CUPS-Get-Devices Operation

+ +

The CUPS-Get-Devices operation (0x400B) returns all of the +supported device-uri's for the server.

+ +

CUPS-Get-Devices Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Get-Devices request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"device-class" (type1 keyword): + +
The client OPTIONALLY supplies a device class keyword to select + which devices are returned. + +
"limit" (integer (1:MAX)): + +
The client OPTIONALLY supplies this attribute limiting the number of + devices that are returned. + +
"requested-attributes" (1setOf keyword) : + +
The client OPTIONALLY supplies a set of attribute names and/or + attribute group names in whose values the requester is interested. If + the client omits this attribute, the server responds as if this + attribute had been supplied with a value of 'all'. + +
+ +

CUPS-Get-Devices Response

+ +

The following groups of attributes are send as part of the +CUPS-Get-Devices Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

Group 2: Device Object Attributes + +

+ +
The set of requested attributes and their current values for + each device. + +
+ +

CUPS 1.1CUPS-Get-PPDs Operation

+ +

The CUPS-Get-PPDs operation (0x400C) returns all of the +locally available PPD files on the system.

+ +

CUPS-Get-PPDs Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Get-PPDs request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"limit" (integer (1:MAX)): + +
The client OPTIONALLY supplies this attribute limiting the number of + PPDs that are returned. + +
"ppd-make" (text(127)): + +
The client OPTIONALLY supplies a printer manufacturer to select + which PPDs are returned. + +
"requested-attributes" (1setOf keyword) : + +
The client OPTIONALLY supplies a set of attribute names and/or + attribute group names in whose values the requester is interested. If + the client omits this attribute, the server responds as if this + attribute had been supplied with a value of 'all'. + +
+ +

CUPS-Get-PPDs Response

+ +

The following groups of attributes are send as part of the +CUPS-Get-PPDs Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

Group 2: PPD Attributes + +

+ +
The set of requested attributes and their current values for each + PPD file. + +
+ +

CUPS 1.1CUPS-Move-Job Operation

+ +

The CUPS-Move-Job operation (0x400D) moves an active print job +to a different printer.

+ +

CUPS-Move-Job Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Move-Job request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri) and "job-id" (integer) +
OR +
"job-uri": + +
The client MUST supply a URI for the specified printer and + a job ID number, or the job URI. + +
+ +

Group 2: Job Template Attributes + +

+ +
"job-printer-uri" (uri) + +
The client MUST supply a URI for a printer on the same server. + +
+ +

CUPS-Move-Job Response

+ +

The following groups of attributes are send as part of the +CUPS-Move-Job Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

CUPS 1.2CUPS-Authenticate-Job Operation

+ +

The CUPS-Authenticate-Job operation (0x400E) authenticate a +print job for printing. Typically this is used when printing to a +remote server. The authentication information is passed in the +HTTP request.

+ +

CUPS-Authenticate-Job Request

+ +

The following groups of attributes are supplied as part of the +CUPS-Authenticate-Job request: + +

Group 1: Operation Attributes + +

+ +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.1 of the IPP Model and + Semantics document. + +
"printer-uri" (uri) and "job-id" (integer) +
OR +
"job-uri": + +
The client MUST supply a URI for the specified printer and + a job ID number, or the job URI. + +
+ +

CUPS-Authenticate-Job Response

+ +

The following groups of attributes are send as part of the +CUPS-Authenticate-Job Response: + +

Group 1: Operation Attributes + +

+ +
Status Message: + +
The standard response status message. + +
Natural Language and Character Set: + +
The "attributes-charset" and "attributes-natural-language" + attributes as described in section 3.1.4.2 of the IPP Model and + Semantics document. + +
+ +

Attributes

+ +

CUPS provides many extension attributes to support multiple +devices, PPD files, standard job filters, printers, and printer +classes.

+ +

Device Attributes

+ +

Device attributes are returned by the CUPS-Get-Devices +operation and enumerate all of the available hardware devices and +network protocols that are supported by the server.

+ +

device-class (type2 keyword)

+ +

The device-class attribute specifies the class of device and can be +one of the following: + +

    + +
  • "file" - a disk file. + +
  • "direct" - a parallel or fixed-rate serial data port, + currently used for Centronics, IEEE-1284, and USB printer + ports. + +
  • "serial" - a variable-rate serial port. + +
  • "network" - a network connection, typically via AppSocket, + HTTP, IPP, LPD, or SMB/CIFS protocols. + +
+ +

device-id (text(127))

+ +

The device-id attribute specifies the IEEE-1284 device ID +string for the device.

+ +

device-info (text(127))

+ +

The device-info attribute specifies a human-readable string describing +the device, e.g. "Parallel Port #1". + +

device-make-and-model (text(127))

+ +

The device-makr-and-model attribute specifies a device +identification string provided by the printer connected to the device. +If the device or printer does not support identification then this +attribute contains the string "unknown". + +

device-uri (uri)

+ +

The device-uri attribute specifies a unique identifier for the +device. The actual format of the device-uri string depends on the value +of the device-class attribute: + +

    + +
  • "file" - The device-uri will be of the form + "file:///path/to/filename". + +
  • "direct" - The device-uri will be of the form + "scheme:/dev/filename" or "scheme://vendor/identifier", + where scheme may be "parallel" or "usb" in the current + implementation. + +
  • "serial" - The device-uri will be of the form + "serial:/dev/filename?baud=value+parity=value+flow=value". + The baud value is the data rate in bits per second; the + supported values depend on the underlying hardware. + The parity value can be one of "none", "even", or "odd". + The flow value can be one of "none", "soft" (XON/XOFF + handshaking), "hard" or "rts/cts" (RTS/CTS handshaking), + or "dtrdsr" (DTR/DSR handshaking). + +

    The URI returned by CUPS-Get-Devices will contain the + maximum baud rate supported by the device and the best + type of flow control available ("soft" or "hard"). + +

  • "network" - The device-uri will be of the form + "scheme://[username:password@]hostname[:port]/[resource]", + where scheme may be "http", "https", "ipp", "lpd", "smb", or + "socket" in the current implementation. + +

    The URI returned by CUPS-Get-Devices will only contain + the scheme name ("scheme"). It is up to the client + application to add the appropriate host and other + information when adding a new printer. + +

    The URI returned by Get-Printer-Attributes and + CUPS-Get-Printers has any username and password information + stripped; the information is still stored and used by the + server internally to perform any needed authentication. + +

+ +

Job Template Attributes

+ +

blackplot (boolean)

+ +

The blackplot attribute specifies whether HP-GL/2 plot files should be +rendered entirely in black ink (blackplot=true) or using the colors and shades +specified in the file (blackplot=false). The default value is false. + +

brightness (integer(0:200))

+ +

The brightness attribute specifies the overall brightness of the printed +output in percent. A brightness of 100 is normal, while 200 is twice as +bright and 50 is half as bright. The default value is 100. + +

Brightness is applied to the Cyan, Magenta, Yellow, and Black values using +the function "f(x) = brightness / 100 * x". + +

columns (integer(1:4))

+ +

The columns attribute specifies the number of columns to generate when +printing text files. The default value is 1. + +

cpi (type2 enum)

+ +

The cpi attribute specifies the number of characters per inch when +printing text files. Only the values 10, 12, and 17 are currently +supported. The default value is 10. + +

fitplot (boolean)

+ +

The fitplot attribute specifies whether to scale HP-GL/2 plot files to +fit on the selected media (fitplot=true) or use the physical scale specified +in the plot file (fitplot=false). The default value is false. + +

gamma (integer(1:10000))

+ +

The gamma attribute specifies the luminance correction for the output. +A value of 1000 specifies no correction, while values of 2000 and 500 will +generate lighter and darker output, respectively. The default value is +1000. + +

Gamma is applied to the Red, Green, and Blue values (or luminance for +grayscale output) using the function "f(x) = x(1000/gamma)". + +

hue (integer(-180:180))

+ +

The hue attribute specifies a color hue rotation when printing image +files. The default value is 0. + +

job-billing (text(MAX))CUPS 1.1

+ +

The job-billing attribute provides a text value to associate with a job +for billing purposes. + +

job-hold-until (keyword | name(MAX))CUPS 1.1

+ +

The job-hold-until attribute specifies a hold time. In addition to the +standard IPP/1.1 keyword names, CUPS supports name values of the form +"HH:MM" and "HH:MM:SS" that specify a hold time. The hold time is in +Greenwich Mean Time (GMT) and not in the local time zone. If the +specified time is less than the current time, the job is held until the +next day. + +

job-sheets (1setof type3 keyword | name(MAX))CUPS 1.1

+ +

The job-sheets attribute specifies one or two banner files that are printed +before and after a job. The reserved value of "none" disables banner printing. +The default value is stored in the job-sheets-default attribute. + +

If only one value is supplied, the banner file is printed before the job. +If two values are supplied, the first value is used as the starting banner +file and the second as the ending banner file. + +

job-originating-host-name (name(MAX))

+ +

(CUPS 1.1.5 and higher) + +

The job-originating-host-name attribute specifies the host +from which the job was queued. The value will be the hostname or +IP address of the client depending on whether hostname +resolution is enabled. The localhost address (127.0.0.1) is +always resolved to the name "localhost". + +

This attribute is read-only. + +

lpi (type2 enum)

+ +

The lpi attribute specifies the number of lines per inch when +printing text files. Only the values 6 and 8 are currently supported. +The default value is 6. + +

mirror (boolean)

+ +

The mirror attribute specifies whether pages are mirrored on +their X axis, which is useful for printing transfer images on +special media. The default value is false. + +

natural-scaling (integer(1:1000))CUPS 1.1.9

+

The natural-scaling attribute specifies the scaling of image files with +respect to the natural image size. A value of 100 specifies that the image +file should exactly the natural size, while 50 is half the natural size +and 200 is twice the natural size. The default value is 100. + +

The ppi option can be used to override the natural resolution of the +image, which controls the natural size. + +

number-up-layout (type2 keyword)CUPS 1.1.15

+

The number-up-layout attribute specifies the order each input +page is placed on each output page. The following keywords are +presently defined: + +

    + +
  • btlr - Bottom to top, left to right
  • + +
  • btrl - Bottom to top, right to left
  • + +
  • lrbt - Left to right, bottom to top
  • + +
  • lrtb - Left to right, top to bottom (default)
  • + +
  • rlbt - Right to left, bottom to top
  • + +
  • rltb - Right to left, top to bottom
  • + +
  • tblr - Top to bottom, left to right
  • + +
  • tbrl - Top to bottom, right to left
  • + +
+ +

page-border (type2 keyword)CUPS 1.1.15

+

The page-border attribute specifies whether a border is +draw around each page. The following keywords are presently +defined: + +

    + +
  • double - Two hairline borders are drawn
  • + +
  • double-thick - Two 1pt borders are drawn
  • + +
  • none - No border is drawn (default)
  • + +
  • single - A single hairline border is drawn
  • + +
  • single-thick - A single 1pt border is drawn
  • + +
+ +

page-bottom (integer(0:MAX))

+ +

The page-bottom attribute specifies the bottom margin in points (72 points +equals 1 inch). The default value is the device physical margin. + +

page-label (text(MAX))CUPS 1.1.7

+

The page-label attribute provides a text value to place in +the header and footer on each page. If a classification level is +set on the server, then this classification is printed before +the page label. + +

page-left (integer(0:MAX))

+ +

The page-left attribute specifies the left margin in points (72 points +equals 1 inch). The default value is the device physical margin. + +

page-right (integer(0:MAX))

+ +

The page-right attribute specifies the right margin in points (72 points +equals 1 inch). The default value is the device physical margin. + +

page-set (type2 keyword)

+ +

The page-set attribute specifies which pages to print in a file. The +supported keywords are "all", "even", and "odd". The default value is +"all". + +

page-top (integer(0:MAX))

+ +

The page-top attribute specifies the top margin in points (72 points +equals 1 inch). The default value is the device physical margin. + +

penwidth (integer(0:MAX))

+ +

The penwidth attribute specifies the default pen width in micrometers +when printing HP-GL/2 plot files. The default value is 1000 (1 millimeter). + +

position (type2 keyword)

+ +

The position attribute specifies the location of image files on the +media. The following keyword values are recognized: + +

    + +
  • center - Center the image on the page (default) + +
  • top - Print the image centered at the top of the page + +
  • left - Print the image centered on the left of page + +
  • right - Print the image centered on the right of the page + +
  • top-left - Print the image at the top left corner of + the page + +
  • top-right - Print the image at the top right corner of + the page + +
  • bottom - Print the image centered at the bottom of + the page + +
  • bottom-left - Print the image at the bottom left + corner of the page + +
  • bottom-right - Print the image at the bottom right + corner of the page + +
+ +

ppi (integer(1:MAX))

+ +

The ppi attribute specifies the resolution of an image file in pixels +per inch. The default value is the resolution included with the file or +128 if no resolution information is available. + +

prettyprint (boolean)

+ +

The prettyprint attribute specifies whether text files should be printed +with a shaded header and keyword highlighting (prettyprint=true) or without +additional formatting (prettyprint=false). The default value is false. + +

saturation (integer(0:200))

+ +

The saturation attribute specifies the color saturation when +printing image files. A saturation of 100 is normal, while values of 50 +and 200 will be half and twice as colorful, respectively. The default +value is 100. + +

scaling (integer(1:1000))

+ +

The scaling attribute specifies the scaling of image files with +respect to the selected media. A value of 100 specifies that the image +file should fit 100% of the page, or as much as possible given the +image dimensions. The default value is unspecified. + +

The scaling attribute overrides the ppi attribute if specified. + +

wrap (boolean)

+ +

The wrap attribute specifies whether long lines should be wrapped +(wrap=true) or not (wrap=false) when printing text files. The default +value is true. + +

PPD Attributes

+ +

ppd-device-id (text(127))

+ +

The ppd-device-id attribute specifies the IEEE-1284 device ID +string for the device described by the PPD file.

+ +

ppd-natural-language (naturalLanguage)

+ +

The ppd-natural-language attribute specifies the language encoding +of the PPD file (the LanguageVersion attribute in the PPD file). If the +language is unknown or undefined then "en" (English) is assumed. + +

ppd-make (text(127))

+ +

The ppd-make attribute specifies the manufacturer of the printer +(the Manufacturer attribute in the PPD file). If the manufacturer +is not specified in the PPD file then an educated guess is made using +the NickName attribute in the PPD file. + +

ppd-make-and-model (text(127))

+ +

The ppd-make-and-model attribute specifies the manufacturer and model +name of the PPD file (the NickName attribute in the PPD file). If the +make and model is not specified in the PPD file then the ModelName or +ShortNickName attributes are used instead. + +

ppd-name (name(255))

+ +

The ppd-name attribute specifies the PPD filename on the server +relative to the model directory. The forward slash (/) is used to +delineate directories. + +

Printer Attributes

+ +

job-k-limit (integer)CUPS 1.1

+ +

The job-k-limit attribute specifies the maximum number of kilobytes that +may be printed by a user, including banner files. The default value of 0 +specifies that there is no limit. + +

job-page-limit (integer)CUPS 1.1

+ +

The job-page-limit attribute specifies the maximum number of pages that +may be printed by a user, including banner files. The default value of 0 +specifies that there is no limit. + +

job-quota-period (integer)CUPS 1.1

+ +

The job-quota-period attribute specifies the time period used for quota +calculations, in seconds. The default value of 0 specifies that the limits +apply to all jobs that have been printed by a user that are still known to +the system. + +

job-sheets-supported (1setof type3 keyword | name(MAX))CUPS 1.1

+ +

The job-sheets-supported attribute specifies the available banner files. +There will always be at least one banner file available called "none". + +

printer-type (type2 enum)

+ +

The printer-type attribute specifies printer type and +capability bits for the printer or class. The default value is +computed from internal state information and the PPD file for the +printer. The following bits are defined:

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
BitDescription
0x00000001Is a printer class.
0x00000002Is a remote destination.
0x00000004Can print in black.
0x00000008Can print in color.
0x00000010Can print on both sides of the page in hardware.
0x00000020Can staple output.
0x00000040Can do fast copies in hardware.
0x00000080Can do fast copy collation in hardware.
0x00000100Can punch output.
0x00000200Can cover output.
0x00000400Can bind output.
0x00000800Can sort output.
0x00001000Can handle media up to US-Legal/A4.
0x00002000Can handle media from US-Legal/A4 to ISO-C/A2.
0x00004000Can handle media larger than ISO-C/A2.
0x00008000Can handle user-defined media sizes.
0x00010000Is an implicit (server-generated) class.
0x00020000Is the a default printer on the network.
0x00040000 + Is a facsimile device.
0x00080000Is rejecting jobs.
0x00100000Delete this queue.
0x00200000Queue is not shared.
0x00400000Queue requires authentication.
+ +

printer-type-mask (type2 enum)CUPS 1.1

+ +

The printer-type-mask attribute is used to choose printers or classes with +the CUPS-Get-Printers and CUPS-Get-Classes operations. The bits are defined +identically to the printer-type attribute and default to all 1's. + +

requesting-user-name-allowed (1setof name(127))CUPS 1.1

+ +

The requesting-user-name-allowed attribute lists all of the users that are +allowed to access a printer or class. Either this attribute or the +requesting-user-name-denied attribute will be defined, but not both. + +

requesting-user-name-denied (1setof name(127))CUPS 1.1

+ +

The requesting-user-name-denied attribute lists all of the users that are +not allowed to access a printer or class. Either this attribute or the +requesting-user-name-allowed attribute will be defined, but not both. + +

Printer Class Attributes

+ +

member-names (1setof name(127))

+ +

The member-names attribute specifies each of the printer-name attributes of +the member printers and classes. Each name corresponds to the same element of +the member-uris attribute. + +

member-uris (1setof uri)

+ +

The member-uris attribute specifies each of the printer-uri attributes of +the member printers and classes. Each URI corresponds to the same element of +the member-names attribute. + + + diff --git a/doc/help/spec-ppd.html b/doc/help/spec-ppd.html index a6aa4677e7..a6d70ba73f 100644 --- a/doc/help/spec-ppd.html +++ b/doc/help/spec-ppd.html @@ -7,7 +7,7 @@ # Printer # | - / \ +--------+ | # Object # | - | ########### | - +---------------+ - - - hosted printer: - +---------------+ - O +--------+ ########### | | - /|\ | client |--IPP--># Printer #-any->| output device | - / \ +--------+ # Object # | | - ########### +---------------+ - - - - +---------------+ - fan out: | | - +-->| output device | - any/ | | - O +--------+ ########### / +---------------+ - /|\ | client |-IPP-># Printer #--* - / \ +--------+ # Object # \ +---------------+ - ########### any\ | | - +-->| output device | - | | - +---------------+ - - - - - -deBry, et al. Experimental [Page 13] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -2.2 Job Object - - A Job object is used to model a print job. A Job object contains - documents. The information required to create a Job object is sent - in a create request from the end user via an IPP Client to the - Printer object. The Printer object validates the create request, and - if the Printer object accepts the request, the Printer object creates - the new Job object. Section 3 describes each of the Job operations - in detail. - - The characteristics and state of a Job object are described by its - attributes. Job attributes are grouped into two groups as follows: - - - "job-template" attributes: These attributes can be supplied by - the client or end user and include job processing instructions - which are intended to override any Printer object defaults and/or - instructions embedded within the document data. (See section 4.2) - - "job-description" attributes: These attributes describe the Job - object's identification, state, size, etc. The client supplies - some of these attributes, and the Printer object generates others. - (See section 4.3) - - An implementation MUST support at least one document per Job object. - An implementation MAY support multiple documents per Job object. A - document is either: - - - a stream of document data in a format supported by the Printer - object (typically a Page Description Language - PDL), or - - a reference to such a stream of document data - - In IPP/1.0, a document is not modeled as an IPP object, therefore it - has no object identifier or associated attributes. All job - processing instructions are modeled as Job object attributes. These - attributes are called Job Template attributes and they apply equally - to all documents within a Job object. - -2.3 Object Relationships - - IPP objects have relationships that are maintained persistently along - with the persistent storage of the object attributes. - - A Printer object can represent either one or more physical output - devices or a logical device which "processes" jobs but never actually - uses a physical output device to put marks on paper. Examples of - logical devices include a Web page publisher or a gateway into an - online document archive or repository. A Printer object contains - zero or more Job objects. - - - - -deBry, et al. Experimental [Page 14] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - A Job object is contained by exactly one Printer object, however the - identical document data associated with a Job object could be sent to - either the same or a different Printer object. In this case, a - second Job object would be created which would be almost identical to - the first Job object, however it would have new (different) Job - object identifiers (see section 2.4). - - A Job object is either empty (before any documents have been added) - or contains one or more documents. If the contained document is a - stream of document data, that stream can be contained in only one - document. However, there can be identical copies of the stream in - other documents in the same or different Job objects. If the - contained document is just a reference to a stream of document data, - other documents (in the same or different Job object(s)) may contain - the same reference. - -2.4 Object Identity - - All Printer and Job objects are identified by a Uniform Resource - Identifier (URI) [RFC2396] so that they can be persistently and - unambiguously referenced. The notion of a URI is a useful concept, - however, until the notion of URI is more stable (i.e., defined more - completely and deployed more widely), it is expected that the URIs - used for IPP objects will actually be URLs [RFC2396]. Since every - URL is a specialized form of a URI, even though the more generic term - URI is used throughout the rest of this document, its usage is - intended to cover the more specific notion of URL as well. - - An administrator configures Printer objects to either support or not - support authentication and/or message privacy using SSL3 [SSL] (the - mechanism for security configuration is outside the scope of - IPP/1.0). In some situations, both types of connections (both - authenticated and unauthenticated) can be established using a single - communication channel that has some sort of negotiation mechanism. - In other situations, multiple communication channels are used, one - for each type of security configuration. Section 8 provides a full - description of all security considerations and configurations. - - If a Printer object supports more than one communication channel, - some or all of those channels might support and/or require different - security mechanisms. In such cases, an administrator could expose - the simultaneous support for these multiple communication channels as - multiple URIs for a single Printer object where each URI represents - one of the communication channels to the Printer object. To support - this flexibility, the IPP Printer object type defines a multi-valued - identification attribute called the "printer-uri-supported" - attribute. It MUST contain at least one URI. It MAY contain more - than one URI. That is, every Printer object will have at least one - - - -deBry, et al. Experimental [Page 15] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - URI that identifies at least one communication channel to the Printer - object, but it may have more than one URI where each URI identifies a - different communication channel to the Printer object. The - "printer-uri-supported" attribute has a companion attribute, the - "uri-security-supported" attribute, that has the same cardinality as - "printer-uri-supported". The purpose of the "uri-security-supported" - attribute is to indicate the security mechanisms (if any) used for - each URI listed in "printer-uri-supported". These two attributes are - fully described in sections 4.4.1 and 4.4.2. - - When a job is submitted to the Printer object via a create request, - the client supplies only a single Printer object URI. The client - supplied Printer object URI MUST be one of the values in the - "printer-uri-supported" Printer attribute. - - Note: IPP/1.0 does not specify how the client obtains the client - supplied URI, but it is RECOMMENDED that a Printer object be - registered as an entry in a directory service. End-users and - programs can then interrogate the directory searching for Printers. - Section 16 defines a generic schema for Printer object entries in the - directory service and describes how the entry acts as a bridge to the - actual IPP Printer object. The entry in the directory that - represents the IPP Printer object includes the possibly many URIs for - that Printer object as values in one its attributes. - - When a client submits a create request to the Printer object, the - Printer object validates the request and creates a new Job object. - The Printer object assigns the new Job object a URI which is stored - in the "job-uri" Job attribute. This URI is then used by clients as - the target for subsequent Job operations. The Printer object - generates a Job URI based on its configured security policy and the - URI used by the client in the create request. - - For example, consider a Printer object that supports both a - communication channel secured by the use of SSL3 (using HTTP over - SSL3 with an "https" schemed URI) and another open communication - channel that is not secured with SSL3 (using a simple "http" schemed - URI). If a client were to submit a job using the secure URI, the - Printer object would assign the new Job object a secure URI as well. - If a client were to submit a job using the open-channel URI, the - Printer would assign the new Job object an open-channel URI. - - In addition, the Printer object also populates the Job object's - "job-printer-uri" attribute. This is a reference back to the Printer - object that created the Job object. If a client only has access to a - Job object's "job-uri" identifier, the client can query the Job's - "job-printer-uri" attribute in order to determine which Printer - object created the Job object. If the Printer object supports more - - - -deBry, et al. Experimental [Page 16] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - than one URI, the Printer object picks the one URI supplied by the - client when creating the job to build the value for and to populate - the Job's "job-printer-uri" attribute. - - Allowing Job objects to have URIs allows for flexibility and - scalability. For example, in some implementations, the Printer - object might create Jobs that are processed in the same local - environment as the Printer object itself. In this case, the Job URI - might just be a composition of the Printer's URI and some unique - component for the Job object, such as the unique 32-bit positive - integer mentioned later in this paragraph. In other implementations, - the Printer object might be a central clearing-house for validating - all Job object creation requests, but the Job object itself might be - created in some environment that is remote from the Printer object. - In this case, the Job object's URI may have no physical-location - relationship at all to the Printer object's URI. Again, the fact - that Job objects have URIs allows for flexibility and scalability, - however, many existing printing systems have local models or - interface constraints that force print jobs to be identified using - only a 32-bit positive integer rather than an independent URI. This - numeric Job ID is only unique within the context of the Printer - object to which the create request was originally submitted. - Therefore, in order to allow both types of client access to IPP Job - objects (either by Job URI or by numeric Job ID), when the Printer - object successfully processes a create request and creates a new Job - object, the Printer object MUST generate both a Job URI and a Job ID. - The Job ID (stored in the "job-id" attribute) only has meaning in the - context of the Printer object to which the create request was - originally submitted. This requirement to support both Job URIs and - Job IDs allows all types of clients to access Printer objects and Job - objects no matter the local constraints imposed on the client - implementation. - - In addition to identifiers, Printer objects and Job objects have - names ("printer-name" and "job-name"). An object name NEED NOT be - unique across all instances of all objects. A Printer object's name - is chosen and set by an administrator through some mechanism outside - the scope of IPP/1.0. A Job object's name is optionally chosen and - supplied by the IPP client submitting the job. If the client does - not supply a Job object name, the Printer object generates a name for - the new Job object. In all cases, the name only has local meaning. - - To summarize: - - - Each Printer object is identified with one or more URIs. The - Printer's "printer-uri-supported" attribute contains the URI(s). - - - - - -deBry, et al. Experimental [Page 17] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - - The Printer object's "uri-security-supported" attribute - identifies the communication channel security protocols that may - or may not have been configured for the various Printer object - URIs (e.g., 'ssl3' or 'none'). - - Each Job object is identified with a Job URI. The Job's "job-uri" - attribute contains the URI. - - Each Job object is also identified with Job ID which is a 32-bit, - positive integer. The Job's "job-id" attribute contains the Job - ID. The Job ID is only unique within the context of the Printer - object which created the Job object. - - Each Job object has a "job-printer-uri" attribute which contains - the URI of the Printer object that was used to create the Job - object. This attribute is used to determine the Printer object - that created a Job object when given only the URI for the Job - object. This linkage is necessary to determine the languages, - charsets, and operations which are supported on that Job (the - basis for such support comes from the creating Printer object). - - Each Printer object has a name (which is not necessarily unique). - The administrator chooses and sets this name through some - mechanism outside the scope of IPP/1.0 itself. The Printer - object's "printer-name" attribute contains the name. - - Each Job object has a name (which is not necessarily unique). The - client optionally supplies this name in the create request. If - the client does not supply this name, the Printer object generates - a name for the Job object. The Job object's "job-name" attribute - contains the name. - -3. IPP Operations - - IPP objects support operations. An operation consists of a request - and a response. When a client communicates with an IPP object, the - client issues an operation request to the URI for that object. - Operation requests and responses have parameters that identify the - operation. Operations also have attributes that affect the run-time - characteristics of the operation (the intended target, localization - information, etc.). These operation-specific attributes are called - operation attributes (as compared to object attributes such as - Printer object attributes or Job object attributes). Each request - carries along with it any operation attributes, object attributes, - and/or document data required to perform the operation. Each request - requires a response from the object. Each response indicates success - or failure of the operation with a status code as a response - parameter. The response contains any operation attributes, object - attributes, and/or status messages generated during the execution of - the operation request. - - - - - - -deBry, et al. Experimental [Page 18] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - This section describes the semantics of the IPP operations, both - requests and responses, in terms of the parameters, attributes, and - other data associated with each operation. - - The IPP/1.0 Printer operations are: - - Print-Job (section 3.2.1) - Print-URI (section 3.2.2) - Validate-Job (section 3.2.3) - Create-Job (section 3.2.4) - Get-Printer-Attributes (section 3.2.5) - Get-Jobs (section 3.2.6) - - The Job operations are: - - Send-Document (section 3.3.1) - Send-URI (section 3.3.2) - Cancel-Job (section 3.3.3) - Get-Job-Attributes (section 3.3.4) - - The Send-Document and Send-URI Job operations are used to add a new - document to an existing multi-document Job object created using the - Create-Job operation. - -3.1 Common Semantics - - All IPP operations require some common parameters and operation - attributes. These common elements and their semantic characteristics - are defined and described in more detail in the following sections. - -3.1.1 Required Parameters - - Every operation request contains the following REQUIRED parameters: - - - a "version-number", - - an "operation-id", - - a "request-id", and - - the attributes that are REQUIRED for that type of request. - - Every operation response contains the following REQUIRED parameters: - - - a "version-number", - - a "status-code", - - the "request-id" that was supplied in the corresponding request, - and - - the attributes that are REQUIRED for that type of response. - - - - - -deBry, et al. Experimental [Page 19] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - The encoding and transport document [RFC2565] defines special rules - for the encoding of these parameters. All other operation elements - are represented using the more generic encoding rules for attributes - and groups of attributes. - -3.1.2 Operation IDs and Request IDs - - Each IPP operation request includes an identifying "operation-id" - value. Valid values are defined in the "operations-supported" - Printer attribute section (see section 4.4.13). The client specifies - which operation is being requested by supplying the correct - "operation-id" value. - - In addition, every invocation of an operation is identified by a - "request-id" value. For each request, the client chooses the - "request-id" which MUST be an integer (possibly unique depending on - client requirements) in the range from 1 to 2**31 - 1 (inclusive). - This "request-id" allows clients to manage multiple outstanding - requests. The receiving IPP object copies all 32-bits of the client- - supplied "request-id" attribute into the response so that the client - can match the response with the correct outstanding request, even if - the "request-id" is out of range. If the request is terminated - before the complete "request-id" is received, the IPP object rejects - the request and returns a response with a "request-id" of 0. - - Note: In some cases, the transport protocol underneath IPP might be a - connection oriented protocol that would make it impossible for a - client to receive responses in any order other than the order in - which the corresponding requests were sent. In such cases, the - "request-id" attribute would not be essential for correct protocol - operation. However, in other mappings, the operation responses can - come back in any order. In these cases, the "request-id" would be - essential. - -3.1.3 Attributes - - Operation requests and responses are both composed of groups of - attributes and/or document data. The attributes groups are: - - - Operation Attributes: These attributes are passed in the - operation and affect the IPP object's behavior while processing - the operation request and may affect other attributes or groups - of attributes. Some operation attributes describe the document - data associated with the print job and are associated with new - Job objects, however most operation attributes do not persist - beyond the life of the operation. The description of each - operation attribute includes conformance statements indicating - which operation attributes are REQUIRED and which are OPTIONAL - - - -deBry, et al. Experimental [Page 20] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - for an IPP object to support and which attributes a client MUST - supply in a request and an IPP object MUST supply in a response. - - Job Template Attributes: These attributes affect the processing - of a job. A client OPTIONALLY supplies Job Template Attributes - in a create request, and the receiving object MUST be prepared to - receive all supported attributes. The Job object can later be - queried to find out what Job Template attributes were originally - requested in the create request, and such attributes are returned - in the response as Job Object Attributes. The Printer object can - be queried about its Job Template attributes to find out what - type of job processing capabilities are supported and/or what the - default job processing behaviors are, though such attributes are - returned in the response as Printer Object Attributes. The - "ipp-attribute-fidelity" operation attribute affects processing - of all client-supplied Job Template attributes (see section 15 - for a full description of "ipp-attribute-fidelity" and its - relationship to other attributes). - - Job Object Attributes: These attributes are returned in response - to a query operation directed at a Job object. - - Printer Object Attributes: These attributes are returned in - response to a query operation directed at a Printer object. - - Unsupported Attributes: In a create request, the client supplies - a set of Operation and Job Template attributes. If any of these - attributes or their values is unsupported by the Printer object, - the Printer object returns the set of unsupported attributes in - the response. Section 15 gives a full description of how Job - Template attributes supplied by the client in a create request - are processed by the Printer object and how unsupported - attributes are returned to the client. Because of extensibility, - any IPP object might receive a request that contains new or - unknown attributes or values for which it has no support. In such - cases, the IPP object processes what it can and returns the - unsupported attributes in the response. - - Later in this section, each operation is formally defined by - identifying the allowed and expected groups of attributes for each - request and response. The model identifies a specific order for each - group in each request or response, but the attributes within each - group may be in any order, unless specified otherwise. - - Each attribute specification includes the attribute's name followed - by the name of its attribute syntax(es) in parenthesizes. In - addition, each 'integer' attribute is followed by the allowed range - in parentheses, (m:n), for values of that attribute. Each 'text' or - 'name' attribute is followed by the maximum size in octets in - parentheses, (size), for values of that attribute. For more details - on attribute syntax notation, see the descriptions of these - attributes syntaxes in section 4.1. - - - -deBry, et al. Experimental [Page 21] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Note: Document data included in the operation is not strictly an - attribute, but it is treated as a special attribute group for - ordering purposes. The only operations that support supplying the - document data within an operation request are Print-Job and Send- - Document. There are no operation responses that include document - data. - - Note: Some operations are REQUIRED for IPP objects to support; the - others are OPTIONAL (see section 5.2.2). Therefore, before using an - OPTIONAL operation, a client SHOULD first use the REQUIRED Get- - Printer-Attributes operation to query the Printer's "operations- - supported" attribute in order to determine which OPTIONAL Printer and - Job operations are actually supported. The client SHOULD NOT use an - OPTIONAL operation that is not supported. When an IPP object - receives a request to perform an operation it does not support, it - returns the 'server-error-operation-not-supported' status code (see - section 13.1.5.2). An IPP object is non-conformant if it does not - support a REQUIRED operation. - -3.1.4 Character Set and Natural Language Operation Attributes - - Some Job and Printer attributes have values that are text strings and - names intended for human understanding rather than machine - understanding (see the 'text' and 'name' attribute syntax - descriptions in section 4.1). The following sections describe two - special Operation Attributes called "attributes-charset" and - "attributes-natural-language". These attributes are always part of - the Operation Attributes group. For most attribute groups, the order - of the attributes within the group is not important. However, for - these two attributes within the Operation Attributes group, the order - is critical. The "attributes-charset" attribute MUST be the first - attribute in the group and the "attributes-natural-language" - attribute MUST be the second attribute in the group. In other words, - these attributes MUST be supplied in every IPP request and response, - they MUST come first in the group, and MUST come in the specified - order. For job creation operations, the IPP Printer implementation - saves these two attributes with the new Job object as Job Description - attributes. For the sake of brevity in this document, these - operation attribute descriptions are not repeated with every - operation request and response, but have a reference back to this - section instead. - -3.1.4.1 Request Operation Attributes - - The client MUST supply and the Printer object MUST support the - following REQUIRED operation attributes in every IPP/1.0 operation - request: - - - - -deBry, et al. Experimental [Page 22] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - "attributes-charset" (charset): - This operation attribute identifies the charset (coded character - set and encoding method) used by any 'text' and 'name' - attributes that the client is supplying in this request. It - also identifies the charset that the Printer object MUST use (if - supported) for all 'text' and 'name' attributes and status - messages that the Printer object returns in the response to this - request. See Sections 4.1.1 and 4.1.2 for the specification of - the 'text' and 'name' attribute syntaxes. - - All clients and IPP objects MUST support the 'utf-8' charset - [RFC2279] and MAY support additional charsets provided that they - are registered with IANA [IANA-CS]. If the Printer object does - not support the client supplied charset value, the Printer - object MUST reject the request, set the "attributes-charset" to - 'utf-8' in the response, and return the 'client-error-charset- - not-supported' status code and any 'text' or 'name' attributes - using the 'utf-8' charset. The Printer object MUST indicate the - charset(s) supported as the values of the "charset-supported" - Printer attribute (see Section 4.4.15), so that the client can - query to determine which charset(s) are supported. - - Note to client implementers: Since IPP objects are only required - to support the 'utf-8' charset, in order to maximize - interoperability with multiple IPP object implementations, a - client may want to supply 'utf-8' in the "attributes-charset" - operation attribute, even though the client is only passing and - able to present a simpler charset, such as US-ASCII or ISO- - 8859-1. Then the client will have to filter out (or charset - convert) those characters that are returned in the response that - it cannot present to its user. On the other hand, if both the - client and the IPP objects also support a charset in common - besides utf-8, the client may want to use that charset in order - to avoid charset conversion or data loss. - - See the 'charset' attribute syntax description in Section 4.1.7 - for the syntax and semantic interpretation of the values of this - attribute and for example values. - - "attributes-natural-language" (naturalLanguage): - This operation attribute identifies the natural language used by - any 'text' and 'name' attributes that the client is supplying in - this request. This attribute also identifies the natural - language that the Printer object SHOULD use for all 'text' and ' - name' attributes and status messages that the Printer object - returns in the response to this request. - - - - - -deBry, et al. Experimental [Page 23] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - There are no REQUIRED natural languages required for the Printer - object to support. However, the Printer object's "generated- - natural-language-supported" attribute identifies the natural - languages supported by the Printer object and any contained Job - objects for all text strings generated by the IPP object. A - client MAY query this attribute to determine which natural - language(s) are supported for generated messages. - - For any of the attributes for which the Printer object generates - text, i.e., for the "job-state-message", "printer-state- - message", and status messages (see Section 3.1.6), the Printer - object MUST be able to generate these text strings in any of its - supported natural languages. If the client requests a natural - language that is not supported, the Printer object MUST return - these generated messages in the Printer's configured natural - language as specified by the Printer's "natural-language- - configured" attribute" (see Section 4.4.16). - - For other 'text' and 'name' attributes supplied by the client, - authentication system, operator, system administrator, or - manufacturer (i.e., for "job-originating-user-name", "printer- - name" (name), "printer-location" (text), "printer-info" (text), - and "printer-make-and-model" (text)), the Printer object is only - required to support the configured natural language of the - Printer identified by the Printer object's "natural-language- - configured" attribute, though support of additional natural - languages for these attributes is permitted. - - For any 'text' or 'name' attribute in the request that is in a - different natural language than the value supplied in the - "attributes-natural-language" operation attribute, the client - MUST use the Natural Language Override mechanism (see sections - 4.1.1.2 and 4.1.2.2) for each such attribute value supplied. - The client MAY use the Natural Language Override mechanism - redundantly, i.e., use it even when the value is in the same - natural language as the value supplied in the "attributes- - natural-language" operation attribute of the request. - - The IPP object MUST accept any natural language and any Natural - Language Override, whether the IPP object supports that natural - language or not (and independent of the value of the "ipp- - attribute-fidelity" Operation attribute). That is the IPP - object accepts all client supplied values no matter what the - values are in the Printer object's "generated-natural-language- - supported" attribute. That attribute, "generated-natural- - language-supported", only applies to generated messages, - - - - - -deBry, et al. Experimental [Page 24] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - not client supplied messages. The IPP object MUST remember that - natural language for all client-supplied attributes, and when - returning those attributes in response to a query, the IPP - object MUST indicate that natural language. - - Each value whose attribute syntax type is 'text' or 'name' (see - sections 4.1.1 and 4.1.2) has an Associated Natural-Language. - This document does not specify how this association is stored in - a Printer or Job object. When such a value is encoded in a - request or response, the natural language is either implicit or - explicit: - - - In the implicit case, the value contains only the - text/name value, and the language is specified by the - "attributes-natural-language" operation attribute in the - request or response (see sections 4.1.1.1 - textWithoutLanguage and 4.1.2.1 nameWithoutLanguage). - - - In the explicit case (also known as the Natural-Language - Override case), the value contains both the language and - the text/name value (see sections 4.1.1.2 - textWithLanguage and 4.1.2.2 nameWithLanguage). - - For example, the "job-name" attribute MAY be supplied by the - client in a create request. The text value for this attribute - will be in the natural language identified by the "attribute- - natural-language" attribute, or if different, as identified by - the Natural Language Override mechanism. If supplied, the IPP - object will use the value of the "job-name" attribute to - populate the Job object's "job-name" attribute. Whenever any - client queries the Job object's "job-name" attribute, the IPP - object returns the attribute as stored and uses the Natural - Language Override mechanism to specify the natural language, if - it is different from that reported in the "attributes-natural- - language" operation attribute of the response. The IPP object - MAY use the Natural Language Override mechanism redundantly, - i.e., use it even when the value is in the same natural language - as the value supplied in the "attributes-natural-language" - operation attribute of the response. - - An IPP object MUST NOT reject a request based on a supplied - natural language in an "attributes-natural-language" Operation - attribute or in any attribute that uses the Natural Language - Override. - - See the 'naturalLanguage' attribute syntax description in - section 4.1.8 for the syntax and semantic interpretation of the - values of this attribute and for example values. - - - -deBry, et al. Experimental [Page 25] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Clients SHOULD NOT supply 'text' or 'name' attributes that use an - illegal combination of natural language and charset. For example, - suppose a Printer object supports charsets 'utf-8', 'iso-8859-1', and - 'iso-8859-7'. Suppose also, that it supports natural languages 'en' - (English), 'fr' (French), and 'el' (Greek). Although the Printer - object supports the charset 'iso-8859-1' and natural language 'el', - it probably does not support the combination of Greek text strings - using the 'iso-8859-1' charset. The Printer object handles this - apparent incompatibility differently depending on the context in - which it occurs: - - - In a create request: If the client supplies a text or name - attribute (for example, the "job-name" operation attribute) that - uses an apparently incompatible combination, it is a client - choice that does not affect the Printer object or its correct - operation. Therefore, the Printer object simply accepts the - client supplied value, stores it with the Job object, and - responds back with the same combination whenever the client (or - any client) queries for that attribute. - - In a query-type operation, like Get-Printer-Attributes: If the - client requests an apparently incompatible combination, the - Printer object responds (as described in section 3.1.4.2) using - the Printer's configured natural language rather than the natural - language requested by the client. - - In either case, the Printer object does not reject the request - because of the apparent incompatibility. The potential incompatible - combination of charset and natural language can occur either at the - global operation level or at the Natural Language Override - attribute-by-attribute level. In addition, since the response always - includes explicit charset and natural language information, there is - never any question or ambiguity in how the client interprets the - response. - -3.1.4.2 Response Operation Attributes - - The Printer object MUST supply and the client MUST support the - following REQUIRED operation attributes in every IPP/1.0 operation - response: - - "attributes-charset" (charset): - This operation attribute identifies the charset used by any ' - text' and 'name' attributes that the Printer object is returning - in this response. The value in this response MUST be the same - value as the "attributes-charset" operation attribute supplied - by the client in the request. If this is not possible - - - - - -deBry, et al. Experimental [Page 26] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - (i.e., the charset requested is not supported), the request - would have been rejected. See "attributes-charset" described in - Section 3.1.4.1 above. - - If the Printer object supports more than just the 'utf-8' - charset, the Printer object MUST be able to code convert between - each of the charsets supported on a highest fidelity possible - basis in order to return the 'text' and 'name' attributes in the - charset requested by the client. However, some information loss - MAY occur during the charset conversion depending on the - charsets involved. For example, the Printer object may convert - from a UTF-8 'a' to a US-ASCII 'a' (with no loss of - information), from an ISO Latin 1 CAPITAL LETTER A WITH ACUTE - ACCENT to US-ASCII 'A' (losing the accent), or from a UTF-8 - Japanese Kanji character to some ISO Latin 1 error character - indication such as '?', decimal code equivalent, or to the - absence of a character, depending on implementation. - - Note: Whether an implementation that supports more than one - charset stores the data in the charset supplied by the client or - code converts to one of the other supported charsets, depends on - implementation. The strategy should try to minimize loss of - information during code conversion. On each response, such an - implementation converts from its internal charset to that - requested. - - "attributes-natural-language" (naturalLanguage): - This operation attribute identifies the natural language used by - any 'text' and 'name' attributes that the IPP object is - returning in this response. Unlike the "attributes-charset" - operation attribute, the IPP object NEED NOT return the same - value as that supplied by the client in the request. The IPP - object MAY return the natural language of the Job object or the - Printer's configured natural language as identified by the - Printer object's "natural-language-configured" attribute, rather - than the natural language supplied by the client. For any ' - text' or 'name' attribute or status message in the response that - is in a different natural language than the value returned in - the "attributes-natural-language" operation attribute, the IPP - object MUST use the Natural Language Override mechanism (see - sections 4.1.1.2 and 4.1.2.2) on each attribute value returned. - The IPP object MAY use the Natural Language Override mechanism - redundantly, i.e., use it even when the value is in the same - natural language as the value supplied in the "attributes- - natural-language" operation attribute of the response. - - - - - - -deBry, et al. Experimental [Page 27] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -3.1.5 Operation Targets - - All IPP operations are directed at IPP objects. For Printer - operations, the operation is always directed at a Printer object - using one of its URIs (i.e., one of the values in the Printer - object's "printer-uri-supported" attribute). Even if the Printer - object supports more than one URI, the client supplies only one URI - as the target of the operation. The client identifies the target - object by supplying the correct URI in the "printer-uri (uri)" - operation attribute. - - For Job operations, the operation is directed at either: - - - The Job object itself using the Job object's URI. In this case, - the client identifies the target object by supplying the correct - URI in the "job-uri (uri)" operation attribute. - - The Printer object that created the Job object using both the - Printer objects URI and the Job object's Job ID. Since the - Printer object that created the Job object generated the Job ID, - it MUST be able to correctly associate the client supplied Job ID - with the correct Job object. The client supplies the Printer - object's URI in the "printer-uri (uri)" operation attribute and - the Job object's Job ID in the "job-id (integer(1:MAX))" - operation attribute. - - If the operation is directed at the Job object directly using the Job - object's URI, the client MUST NOT include the redundant "job-id" - operation attribute. - - The operation target attributes are REQUIRED operation attributes - that MUST be included in every operation request. Like the charset - and natural language attributes (see section 3.1.4), the operation - target attributes are specially ordered operation attributes. In all - cases, the operation target attributes immediately follow the - "attributes-charset" and "attributes-natural-language" attributes - within the operation attribute group, however the specific ordering - rules are: - - - In the case where there is only one operation target attribute - (i.e., either only the "printer-uri" attribute or only the "job- - uri" attribute), that attribute MUST be the third attribute in - the operation attributes group. - - In the case where Job operations use two operation target - attributes (i.e., the "printer-uri" and "job-id" attributes), the - "printer-uri" attribute MUST be the third attribute and the - "job-id" attribute MUST be the fourth attribute. - - - - - -deBry, et al. Experimental [Page 28] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - In all cases, the target URIs contained within the body of IPP - operation requests and responses must be in absolute format rather - than relative format (a relative URL identifies a resource with the - scope of the HTTP server, but does not include scheme, host or port). - - The following rules apply to the use of port numbers in URIs that - identify IPP objects: - - 1. If the URI scheme allows the port number to be explicitly - included in the URI string, and a port number is specified - within the URI, then that port number MUST be used by the client - to contact the IPP object. - - 2. If the URI scheme allows the port number to be explicitly - included in the URI string, and a port number is not specified - within the URI, then default port number implied by that URI - scheme MUST be used by the client to contact the IPP object. - - 3. If the URI scheme does not allow an explicit port number to be - specified within the URI, then the default port number implied - by that URI MUST be used by the client to contact the IPP - object. - - Note: The IPP encoding and transport document [RFC2565] shows a - mapping of IPP onto HTTP/1.1 and defines a new default port number - for using IPP over HTTP/1.1. - -3.1.6 Operation Status Codes and Messages - - Every operation response includes a REQUIRED "status-code" parameter - and an OPTIONAL "status-message" operation attribute. The "status- - code" provides information on the processing of a request. A - "status-message" attribute provides a short textual description of - the status of the operation. The status code is intended for use by - automata, and the status message is intended for the human end user. - If a response does include a "status-message" attribute, an IPP - client NEED NOT examine or display the message, however it SHOULD do - so in some implementation specific manner. - - The "status-code" value is a numeric value that has semantic meaning. - The "status-code" syntax is similar to a "type2 enum" (see section - 4.1 on "Attribute Syntaxes") except that values can range only from - 0x0000 to 0x7FFF. Section 13 describes the status codes, assigns the - numeric values, and suggests a corresponding status message for each - status code. The "status-message" attribute's syntax is "text(255)". - A client implementation of IPP SHOULD convert status code values into - any localized message that has semantic meaning to the end user. - - - - -deBry, et al. Experimental [Page 29] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - If the Printer object supports the "status-message" operation - attribute, the Printer object MUST be able to generate this message - in any of the natural languages identified by the Printer object's - "generated-natural-language-supported" attribute (see the - "attributes-natural-language" operation attribute specified in - section 3.1.4.1). As described in section 3.1.4.1 for any returned ' - text' attribute, if there is a choice for generating this message, - the Printer object uses the natural language indicated by the value - of the "attributes-natural-language" in the client request if - supported, otherwise the Printer object uses the value in the Printer - object's own "natural-language-configured" attribute. If the Printer - object supports the "status-message" operation attribute, it SHOULD - use the REQUIRED 'utf-8' charset to return a status message for the - following error status codes (see section 13): 'client-error-bad- - request', 'client-error-charset-not-supported', 'server-error- - internal-error', 'server-error-operation-not-supported', and ' - server-error-version-not-supported'. In this case, it MUST set the - value of the "attributes-charset" operation attribute to 'utf-8' in - the error response. - -3.1.7 Versions - - Each operation request and response carries with it a "version- - number" parameter. Each value of the "version-number" is in the form - "X.Y" where X is the major version number and Y is the minor version - number. By including a version number in the client request, it - allows the client to identify which version of IPP it is interested - in using. If the IPP object does not support that version, the - object responds with a status code of 'server-error-version-not- - supported' along with the closest version number that is supported - (see section 13.1.5.4). - - There is no version negotiation per se. However, if after receiving - a 'server-error-version-not-supported' status code from an IPP - object, there is nothing that prevents a client from trying again - with a different version number. In order to conform to IPP/1.0, an - implementation MUST support at least version '1.0'. - - There is only one notion of "version number" that covers both IPP - Model and IPP Protocol changes. Thus the version number MUST change - when introducing a new version of the Model and Semantics document - [RFC2566] or a new version of the Encoding and Transport document - [RFC2565]. - - Changes to the major version number indicate structural or syntactic - changes that make it impossible for older version of IPP clients and - Printer objects to correctly parse and process the new or changed - attributes, operations and responses. If the major version number - - - -deBry, et al. Experimental [Page 30] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - changes, the minor version numbers is set to zero. As an example, - adding the "ipp-attribute-fidelity" attribute (if it had not been - part of version '1.0'), would have required a change to the major - version number. Items that might affect the changing of the major - version number include any changes to the Model and Semantics - document [RFC2566] or the Encoding and Transport [RFC2565] itself, - such as: - - - reordering of ordered attributes or attribute sets - - changes to the syntax of existing attributes - - changing Operation or Job Template attributes from OPTIONAL to - REQUIRED and vice versa - - adding REQUIRED (for an IPP object to support) operation - attributes - - adding REQUIRED (for an IPP object to support) operation - attribute groups - - adding values to existing operation attributes - - adding REQUIRED operations - - Changes to the minor version number indicate the addition of new - features, attributes and attribute values that may not be understood - by all IPP objects, but which can be ignored if not understood. - Items that might affect the changing of the minor version number - include any changes to the model objects and attributes but not the - encoding and transport rules [RFC2565] (except adding attribute - syntaxes). Examples of such changes are: - - - grouping all extensions not included in a previous version into - a new version - - adding new attribute values - - adding new object attributes - - adding OPTIONAL (for an IPP object to support) operation - attributes (i.e., those attributes that an IPP object can ignore - without confusing clients) - - adding OPTIONAL (for an IPP object to support) operation - attribute groups (i.e., those attributes that an IPP object can - ignore without confusing clients) - - adding new attribute syntaxes - - adding OPTIONAL operations - - changing Job Description attributes or Printer Description - attributes from OPTIONAL to REQUIRED or vice versa. - - The encoding of the "operation-id", the "version-number", the - "status-code", and the "request-id" MUST NOT change over any version - number (either major or minor). This rule guarantees that all future - versions will be backwards compatible with all previous versions (at - least for checking the "operation-id", the "version-number", and the - "request-id"). In addition, any protocol elements (attributes, error - - - -deBry, et al. Experimental [Page 31] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - codes, tags, etc.) that are not carried forward from one version to - the next are deprecated so that they can never be reused with new - semantics. - - Implementations that support a certain major version NEED NOT support - ALL previous versions. As each new major version is defined (through - the release of a new specification), that major version will specify - which previous major versions MUST be supported in compliant - implementations. - -3.1.8 Job Creation Operations - - In order to "submit a print job" and create a new Job object, a - client issues a create request. A create request is any one of - following three operation requests: - - - The Print-Job Request: A client that wants to submit a print job - with only a single document uses the Print-Job operation. The - operation allows for the client to "push" the document data to - the Printer object by including the document data in the request - itself. - - - The Print-URI Request: A client that wants to submit a print job - with only a single document (where the Printer object "pulls" the - document data instead of the client "pushing" the data to the - Printer object) uses the Print-URI operation. In this case, the - client includes in the request only a URI reference to the - document data (not the document data itself). - - - The Create-Job Request: A client that wants to submit a print job - with multiple documents uses the Create-Job operation. This - operation is followed by an arbitrary number of Send-Document - and/or Send-URI operations (each creating another document for - the newly create Job object). The Send-Document operation - includes the document data in the request (the client "pushes" - the document data to the printer), and the Send-URI operation - includes only a URI reference to the document data in the request - (the Printer "pulls" the document data from the referenced - location). The last Send-Document or Send-URI request for a - given Job object includes a "last-document" operation attribute - set to 'true' indicating that this is the last request. - - Throughout this model specification, the term "create request" is - used to refer to any of these three operation requests. - - A Create-Job operation followed by only one Send-Document operation - is semantically equivalent to a Print-Job operation, however, for - performance reasons, the client SHOULD use the Print-Job operation - - - -deBry, et al. Experimental [Page 32] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - for all single document jobs. Also, Print-Job is a REQUIRED - operation (all implementations MUST support it) whereas Create-Job is - an OPTIONAL operation, hence some implementations might not support - it. - - Job submission time is the point in time when a client issues a - create request. The initial state of every Job object is the ' - pending' or 'pending-held' state. Later, the Printer object begins - processing the print job. At this point in time, the Job object's - state moves to 'processing'. This is known as job processing time. - There are validation checks that must be done at job submission time - and others that must be performed at job processing time. - - At job submission time and at the time a Validate-Job operation is - received, the Printer MUST do the following: - - 1. Process the client supplied attributes and either accept or - reject the request - 2. Validate the syntax of and support for the scheme of any client - supplied URI - - At job submission time the Printer object MUST validate whether or - not the supplied attributes, attribute syntaxes, and values are - supported by matching them with the Printer object's corresponding - "xxx-supported" attributes. See section 3.2.1.2 for details. [ipp- - iig] presents suggested steps for an IPP object to either accept or - reject any request and additional steps for processing create - requests. - - At job submission time the Printer object NEED NOT perform the - validation checks reserved for job processing time such as: - - 1. Validating the document data - 2. Validating the actual contents of any client supplied URI - (resolve the reference and follow the link to the document data) - - At job submission time, these additional job processing time - validation checks are essentially useless, since they require - actually parsing and interpreting the document data, are not - guaranteed to be 100% accurate, and MUST be done, yet again, at job - processing time. Also, in the case of a URI, checking for - availability at job submission time does not guarantee availability - at job processing time. In addition, at job processing time, the - Printer object might discover any of the following conditions that - were not detectable at job submission time: - - - runtime errors in the document data, - - nested document data that is in an unsupported format, - - - -deBry, et al. Experimental [Page 33] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - - the URI reference is no longer valid (i.e., the server hosting - the document might be down), or - - any other job processing error - - At job processing time, since the Printer object has already - responded with a successful status code in the response to the create - request, if the Printer object detects an error, the Printer object - is unable to inform the end user of the error with an operation - status code. In this case, the Printer, depending on the error, can - set the "job-state", "job-state-reasons", or "job-state-message" - attributes to the appropriate value(s) so that later queries can - report the correct job status. - - Note: Asynchronous notification of events is outside the scope of - IPP/1.0. - -3.2 Printer Operations - - All Printer operations are directed at Printer objects. A client - MUST always supply the "printer-uri" operation attribute in order to - identify the correct target of the operation. - -3.2.1 Print-Job Operation - - This REQUIRED operation allows a client to submit a print job with - only one document and supply the document data (rather than just a - reference to the data). See Section 15 for the suggested steps for - processing create operations and their Operation and Job Template - attributes. - -3.2.1.1 Print-Job Request - - The following groups of attributes are supplied as part of the - Print-Job Request: - - Group 1: Operation Attributes - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.1. The Printer object - MUST copy these values to the corresponding Job Description - attributes described in sections 4.3.23 and 4.3.24. - - Target: - The "printer-uri" (uri) operation attribute which is the target - for this operation as described in section 3.1.5. - - - - - -deBry, et al. Experimental [Page 34] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Requesting User Name: - The "requesting-user-name" (name(MAX)) attribute SHOULD be - supplied by the client as described in section 8.3. - - "job-name" (name(MAX)): - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. It contains the client - supplied Job name. If this attribute is supplied by the client, - its value is used for the "job-name" attribute of the newly - created Job object. The client MAY automatically include any - information that will help the end-user distinguish amongst - his/her jobs, such as the name of the application program along - with information from the document, such as the document name, - document subject, or source file name. If this attribute is not - supplied by the client, the Printer generates a name to use in - the "job-name" attribute of the newly created Job object (see - Section 4.3.5). - - "ipp-attribute-fidelity" (boolean): - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. The value 'true' indicates - that total fidelity to client supplied Job Template attributes - and values is required, else the Printer object MUST reject the - Print-Job request. The value 'false' indicates that a - reasonable attempt to print the Job object is acceptable and the - Printer object MUST accept the Print-job request. If not - supplied, the Printer object assumes the value is 'false'. All - Printer objects MUST support both types of job processing. See - section 15 for a full description of "ipp-attribute-fidelity" - and its relationship to other attributes, especially the Printer - object's "pdl-override-supported" attribute. - - "document-name" (name(MAX)): - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. It contains the client - supplied document name. The document name MAY be different than - the Job name. Typically, the client software automatically - supplies the document name on behalf of the end user by using a - file name or an application generated name. If this attribute - is supplied, its value can be used in a manner defined by each - implementation. Examples include: printed along with the Job - (job start sheet, page adornments, etc.), used by accounting or - resource tracking management tools, or even stored along with - the document as a document level attribute. IPP/1.0 does not - support the concept of document level attributes. - - - - - - -deBry, et al. Experimental [Page 35] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - "document-format" (mimeMediaType) : - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. The value of this attribute - identifies the format of the supplied document data. If the - client does not supply this attribute, the Printer object - assumes that the document data is in the format defined by the - Printer object's "document-format-default" attribute. If the - client supplies this attribute, but the value is not supported - by the Printer object, i.e., the value is not one of the values - of the Printer object's "document-format-supported" attribute, - the Printer object MUST reject the request and return the ' - client-error-document-format-not-supported' status code. - - "document-natural-language" (naturalLanguage): - The client OPTIONALLY supplies this attribute. The Printer - object OPTIONALLY supports this attribute. This attribute - specifies the natural language of the document for those - document-formats that require a specification of the natural - language in order to image the document unambiguously. There are - no particular values required for the Printer object to support. - - "compression" (type3 keyword) - The client OPTIONALLY supplies this attribute. The Printer - object OPTIONALLY supports this attribute and the "compression- - supported" attribute (see section 4.4.29). The client supplied - "compression" operation attribute identifies the compression - algorithm used on the document data. If the client omits this - attribute, the Printer object MUST assume that the data is not - compressed. If the client supplies the attribute and the - Printer object supports the attribute, the Printer object uses - the corresponding decompression algorithm on the document data. - If the client supplies this attribute, but the value is not - supported by the Printer object, i.e., the value is not one of - the values of the Printer object's "compression-supported" - attribute, the Printer object MUST copy the attribute and its - value to the Unsupported Attributes response group, reject the - request, and return the 'client-error-attributes-or-values-not- - supported' status code. - - "job-k-octets" (integer(0:MAX)) - The client OPTIONALLY supplies this attribute. The Printer - object OPTIONALLY supports this attribute and the "job-k- - octets-supported" attribute (see section 4.4.30). The client - supplied "job-k-octets" operation attribute identifies the total - size of the document(s) in K octets being submitted (see section - 4.3.17 for the complete semantics). If the client supplies the - - - - - -deBry, et al. Experimental [Page 36] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - attribute and the Printer object supports the attribute, the - value of the attribute is used to populate the Job object's - "job-k-octets" Job Description attribute. - - Note: For this attribute and the following two attributes - ("job-impressions", and "job-media-sheets"), if the client - supplies the attribute, but the Printer object does not support - the attribute, the Printer object ignores the client-supplied - value. If the client supplies the attribute and the Printer - supports the attribute, and the value is within the range of the - corresponding Printer object's "xxx-supported" attribute, the - Printer object MUST use the value to populate the Job object's - "xxx" attribute. If the client supplies the attribute and the - Printer supports the attribute, but the value is outside the - range of the corresponding Printer object's "xxx-supported" - attribute, the Printer object MUST copy the attribute and its - value to the Unsupported Attributes response group, reject the - request, and return the 'client-error-attributes-or-values-not- - supported' status code. If the client does not supply the - attribute, the Printer object MAY choose to populate the - corresponding Job object attribute depending on whether the - Printer object supports the attribute and is able to calculate - or discern the correct value. - - "job-impressions" (integer(0:MAX)) - The client OPTIONALLY supplies this attribute. The Printer - object OPTIONALLY supports this attribute and the "job- - impressions-supported" attribute (see section 4.4.31). The - client supplied "job-impressions" operation attribute identifies - the total size in number of impressions of the document(s) being - submitted (see section 4.3.18 for the complete semantics). - - See note under "job-k-octets". - - "job-media-sheets" (integer(0:MAX)) - The client OPTIONALLY supplies this attribute. The Printer - object OPTIONALLY supports this attribute and the "job-media- - sheets-supported" attribute (see section 4.4.32). The client - supplied "job-media-sheets" operation attribute identifies the - total number of media sheets to be produced for this job (see - section 4.3.19 for the complete semantics). - - See note under "job-k-octets". - - - - - - - - -deBry, et al. Experimental [Page 37] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Group 2: Job Template Attributes - - The client OPTIONALLY supplies a set of Job Template attributes - as defined in section 4.2. If the client is not supplying any - Job Template attributes in the request, the client SHOULD omit - Group 2 rather than sending an empty group. However, a Printer - object MUST be able to accept an empty group. - - Group 3: Document Content - - The client MUST supply the document data to be processed. - - Note: In addition to the MANDATORY parameters required for every - operation request, the simplest Print-Job Request consists of just - the "attributes-charset" and "attributes-natural-language" operation - attributes; the "printer-uri" target operation attribute; the - Document Content and nothing else. In this simple case, the Printer - object: - - - creates a new Job object (the Job object contains a single - document), - - stores a generated Job name in the "job-name" attribute in the - natural language and charset requested (see Section 3.1.4.1) (if - those are supported, otherwise using the Printer object's default - natural language and charset), and - - at job processing time, uses its corresponding default value - attributes for the supported Job Template attributes that were - not supplied by the client as IPP attribute or embedded - instructions in the document data. - -3.2.1.2 Print-Job Response - - The Printer object MUST return to the client the following sets - of attributes as part of the Print-Job Response: - - Group 1: Operation Attributes - - Status Message: - In addition to the REQUIRED status code returned in every - response, the response OPTIONALLY includes a "status-message" - (text) operation attribute as described in sections 14 and - 3.1.6. If the client supplies unsupported or conflicting Job - Template attributes or values, the Printer object MUST reject or - accept the Print-Job request depending on the whether the client - supplied a 'true' or 'false' value for the "ipp-attribute- - fidelity" operation attribute. See the Implementer's Guide - [ipp-iig] for a complete description of the suggested steps for - processing a create request. - - - -deBry, et al. Experimental [Page 38] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.2. - - Group 2: Unsupported Attributes - - This is a set of Operation and Job Template attributes supplied - by the client (in the request) that are not supported by the - Printer object or that conflict with one another (see the - Implementer's Guide [ipp-iig]). If the Printer object is not - returning any Unsupported Attributes in the response, the - Printer object SHOULD omit Group 2 rather than sending an empty - group. However, a client MUST be able to accept an empty group. - - Unsupported attributes fall into three categories: - - 1. The Printer object does not support the supplied attribute - (no matter what the attribute syntax or value). - 2. The Printer object does support the attribute, but does not - support some or all of the particular attribute syntaxes or - values supplied by the client (i.e., the Printer object does - not have those attribute syntaxes or values in its - corresponding "xxx-supported" attribute). - 3. The Printer object does support the attributes and values - supplied, but the particular values are in conflict with one - another, because they violate a constraint, such as not being - able to staple transparencies. - - In the case of an unsupported attribute name, the Printer object - returns the client-supplied attribute with a substituted "out- - of-band" value of 'unsupported' indicating no support for the - attribute itself (see the beginning of section 4.1). - - In the case of a supported attribute with one or more - unsupported attribute syntaxes or values, the Printer object - simply returns the client-supplied attribute with the - unsupported attribute syntaxes or values as supplied by the - client. This indicates support for the attribute, but no - support for that particular attribute syntax or value. If the - client supplies a multi-valued attribute with more than one - value and the Printer object supports the attribute but only - supports a subset of the client-supplied attribute syntaxes or - values, the Printer object MUST return only those attribute - syntaxes or values that are unsupported. - - In the case of two (or more) supported attribute values that are - in conflict with one another (although each is supported - independently, the values conflict when requested together - - - -deBry, et al. Experimental [Page 39] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - within the same job), the Printer object MUST return all the - values that it ignores or substitutes to resolve the conflict, - but not any of the values that it is still using. The choice - for exactly how to resolve the conflict is implementation - dependent. See The Implementer's Guide [ipp-iig] for an - example. - - In these three cases, the value of the "ipp-attribute-fidelity" - supplied by the client does not affect what the Printer object - returns. The value of "ipp-attribute-fidelity" only affects - whether the Print-Job operation is accepted or rejected. If the - job is accepted, the client may query the job using the Get- - Job-Attributes operation requesting the unsupported attributes - that were returned in the create response to see which - attributes were ignored (not stored on the Job object) and which - attributes were stored with other (substituted) values. - - Group 3: Job Object Attributes - - "job-uri" (uri): - The Printer object MUST return the Job object's URI by returning - the contents of the REQUIRED "job-uri" Job object attribute. - The client uses the Job object's URI when directing operations - at the Job object. The Printer object always uses its - configured security policy when creating the new URI. However, - if the Printer object supports more than one URI, the Printer - object also uses information about which URI was used in the - Print-Job Request to generated the new URI so that the new URI - references the correct access channel. In other words, if the - Print-Job Request comes in over a secure channel, the Printer - object MUST generate a Job URI that uses the secure channel as - well. - - "job-id" (integer(1:MAX)): - The Printer object MUST return the Job object's Job ID by - returning the REQUIRED "job-id" Job object attribute. The - client uses this "job-id" attribute in conjunction with the - "printer-uri" attribute used in the Print-Job Request when - directing Job operations at the Printer object. - - "job-state": - The Printer object MUST return the Job object's REQUIRED "job- - state" attribute. The value of this attribute (along with the - value of the next attribute "job-state-reasons") is taken from a - "snapshot" of the new Job object at some meaningful point in - time (implementation defined) between when the Printer object - receives the Print-Job Request and when the Printer object - returns the response. - - - -deBry, et al. Experimental [Page 40] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - "job-state-reasons": - The Printer object OPTIONALLY returns the Job object's OPTIONAL - "job-state-reasons" attribute. If the Printer object supports - this attribute then it MUST be returned in the response. If - this attribute is not returned in the response, the client can - assume that the "job-state-reasons" attribute is not supported - and will not be returned in a subsequent Job object query. - - "job-state-message": - The Printer object OPTIONALLY returns the Job object's OPTIONAL - "job-state-message" attribute. If the Printer object supports - this attribute then it MUST be returned in the response. If - this attribute is not returned in the response, the client can - assume that the "job-state-message" attribute is not supported - and will not be returned in a subsequent Job object query. - - "number-of-intervening-jobs": - The Printer object OPTIONALLY returns the Job object's OPTIONAL - "number-of-intervening-jobs" attribute. If the Printer object - supports this attribute then it MUST be returned in the - response. If this attribute is not returned in the response, - the client can assume that the "number-of-intervening-jobs" - attribute is not supported and will not be returned in a - subsequent Job object query. - - Note: Since any printer state information which affects a job's - state is reflected in the "job-state" and "job-state-reasons" - attributes, it is sufficient to return only these attributes and - no specific printer status attributes. - - Note: In addition to the MANDATORY parameters required for every - operation response, the simplest response consists of the just the - "attributes-charset" and "attributes-natural-language" operation - attributes and the "job-uri", "job-id", and "job-state" Job Object - Attributes. In this simplest case, the status code is "successful- - ok" and there is no "status-message" operation attribute. - -3.2.2 Print-URI Operation - - This OPTIONAL operation is identical to the Print-Job operation - (section 3.2.1) except that a client supplies a URI reference to the - document data using the "document-uri" (uri) operation attribute (in - Group 1) rather than including the document data itself. Before - returning the response, the Printer MUST validate that the Printer - supports the retrieval method (e.g., http, ftp, etc.) implied by the - URI, and MUST check for valid URI syntax. If the client-supplied URI - scheme is not supported, i.e. the value is not in the Printer - object's "referenced-uri-scheme-supported" attribute, the Printer - - - -deBry, et al. Experimental [Page 41] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - object MUST reject the request and return the 'client-error-uri- - scheme-not-supported' status code. See The Implementer's Guide - [ipp-iig] for suggested additional checks. The Printer NEED NOT - follow the reference and validate the contents of the reference. - - If the Printer object supports this operation, it MUST support the - "reference-uri-schemes-supported" Printer attribute (see section - 4.4.24). - - It is up to the IPP object to interpret the URI and subsequently - "pull" the document from the source referenced by the URI string. - -3.2.3 Validate-Job Operation - - This REQUIRED operation is similar to the Print-Job operation - (section 3.2.1) except that a client supplies no document data and - the Printer allocates no resources (i.e., it does not create a new - Job object). This operation is used only to verify capabilities of a - printer object against whatever attributes are supplied by the client - in the Validate-Job request. By using the Validate-Job operation a - client can validate that an identical Print-Job operation (with the - document data) would be accepted. The Validate-Job operation also - performs the same security negotiation as the Print-Job operation - (see section 8), so that a client can check that the client and - Printer object security requirements can be met before performing a - Print-Job operation. - - Note: The Validate-Job operation does not accept a "document-uri" - attribute in order to allow a client to check that the same Print-URI - operation will be accepted, since the client doesn't send the data - with the Print-URI operation. The client SHOULD just issue the - Print-URI request. - - The Printer object returns the same status codes, Operation - Attributes (Group 1) and Unsupported Attributes (Group 2) as the - Print-Job operation. However, no Job Object Attributes (Group 3) are - returned, since no Job object is created. - -3.2.4 Create-Job Operation - - This OPTIONAL operation is similar to the Print-Job operation - (section 3.2.1) except that in the Create-Job request, a client does - not supply document data or any reference to document data. Also, - the client does not supply any of the "document-name", "document- - format", "compression", or "document-natural-language" operation - attributes. This operation is followed by one or more Send-Document - or Send-URI operations. In each of those operation requests, the - - - - -deBry, et al. Experimental [Page 42] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - client OPTIONALLY supplies the "document-name", "document-format", - and "document-natural-language" attributes for each document in the - multi-document Job object. - - If a Printer object supports the Create-Job operation, it MUST also - support the Send-Document operation and also MAY support the Send-URI - operation. - - If the Printer object supports this operation, it MUST support the - "multiple-operation-time-out" Printer attribute (see section 4.4.28). - - -3.2.5 Get-Printer-Attributes Operation - - This REQUIRED operation allows a client to request the values of the - attributes of a Printer object. In the request, the client supplies - the set of Printer attribute names and/or attribute group names in - which the requester is interested. In the response, the Printer - object returns a corresponding attribute set with the appropriate - attribute values filled in. - - For Printer objects, the possible names of attribute groups are: - - - 'job-template': all of the Job Template attributes that apply to - a Printer object (the last two columns of the table in Section - 4.2). - - 'printer-description': the attributes specified in Section 4.4. - - 'all': the special group 'all' that includes all supported - attributes. - - Since a client MAY request specific attributes or named groups, there - is a potential that there is some overlap. For example, if a client - requests, 'printer-name' and 'all', the client is actually requesting - the "printer-name" attribute twice: once by naming it explicitly, and - once by inclusion in the 'all' group. In such cases, the Printer - object NEED NOT return each attribute only once in the response even - if it is requested multiple times. The client SHOULD NOT request the - same attribute in multiple ways. - - It is NOT REQUIRED that a Printer object support all attributes - belonging to a group (since some attributes are OPTIONAL). However, - it is REQUIRED that each Printer object support all group names. - - - - - - - - - -deBry, et al. Experimental [Page 43] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -3.2.5.1 Get-Printer-Attributes Request - - The following sets of attributes are part of the Get-Printer- - Attributes Request: - - Group 1: Operation Attributes - - Natural Language and Character Set: - attributes-charset" and "attributes-natural-language" butes as - described in section 3.1.4.1. - - Target: - The "printer-uri" (uri) operation attribute which is the target - for this operation as described in section 3.1.5. - - Requesting User Name: - The "requesting-user-name" (name(MAX)) attribute SHOULD be - supplied by the client as described in section 8.3. - - "requested-attributes" (1setOf keyword) : - The client OPTIONALLY supplies a set of attribute names and/or - attribute group names in whose values the requester is - interested. The Printer object MUST support this attribute. If - the client omits this attribute, the Printer MUST respond as if - this attribute had been supplied with a value of 'all'. - - "document-format" (mimeMediaType) : - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. This attribute is useful - for a Printer object to determine the set of supported attribute - values that relate to the requested document format. The - Printer object MUST return the attributes and values that it - uses to validate a job on a create or Validate-Job operation in - which this document format is supplied. The Printer object - SHOULD return only (1) those attributes that are supported for - the specified format and (2) the attribute values that are - supported for the specified document format. By specifying the - document format, the client can get the Printer object to - eliminate the attributes and values that are not supported for a - specific document format. For example, a Printer object might - have multiple interpreters to support both ' - application/postscript' (for PostScript) and 'text/plain' (for - text) documents. However, for only one of those interpreters - might the Printer object be able to support "number-up" with - values of '1', '2', and '4'. For the other interpreter it might - be able to only support "number-up" with a value of '1'. Thus a - - - - - -deBry, et al. Experimental [Page 44] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - client can use the Get-Printer-Attributes operation to obtain - the attributes and values that will be used to accept/reject a - create job operation. - - If the Printer object does not distinguish between different - sets of supported values for each different document format when - validating jobs in the create and Validate-Job operations, it - MUST NOT distinguish between different document formats in the - Get-Printer-Attributes operation. If the Printer object does - distinguish between different sets of supported values for each - different document format specified by the client, this - specialization applies only to the following Printer object - attributes: - - - Printer attributes that are Job Template attributes ("xxx- - default" "xxx-supported", and "xxx-ready" in the Table in - Section 4.2), - - "pdl-override-supported", - - "compression-supported", - - "job-k-octets-supported", - - "job-impressions-supported, - - "job-media-sheets-supported" - - "printer-driver-installer", - - "color-supported", and - - "reference-uri-schemes-supported" - - The values of all other Printer object attributes (including - "document-format-supported") remain invariant with respect to - the client supplied document format (except for new Printer - description attribute as registered according to section 6.2). - - If the client omits this "document-format" operation attribute, - the Printer object MUST respond as if the attribute had been - supplied with the value of the Printer object's "document- - format-default" attribute. It is recommended that the client - always supply a value for "document-format", since the Printer - object's "document-format-default" may be 'application/octet- - stream', in which case the returned attributes and values are - for the union of the document formats that the Printer can - automatically sense. For more details, see the description of - the 'mimeMediaType' attribute syntax in section 4.1.9. - - If the client supplies a value for the "document-format" - Operation attribute that is not supported by the Printer, i.e., - is not among the values of the Printer object's "document- - format-supported" attribute, the Printer object MUST reject the - operation and return the 'client-error-document-format-not- - supported' status code. - - - -deBry, et al. Experimental [Page 45] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -3.2.5.2 Get-Printer-Attributes Response - - The Printer object returns the following sets of attributes as part - of the Get-Printer-Attributes Response: - - Group 1: Operation Attributes - - Status Message: - In addition to the REQUIRED status code returned in every - response, the response OPTIONALLY includes a "status-message" - (text) operation attribute as described in section 3.1.6. - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.2. - - Group 2: Unsupported Attributes - - This is a set of Operation attributes supplied by the client (in - the request) that are not supported by the Printer object or - that conflict with one another (see sections 3.2.1.2 and 16). - The response NEED NOT contain the "requested-attributes" - operation attribute with any supplied values (attribute - keywords) that were requested by the client but are not - supported by the IPP object. If the Printer object is not - returning any Unsupported Attributes in the response, the - Printer object SHOULD omit Group 2 rather than sending an empty - group. However, a client MUST be able to accept an empty group. - - Group 3: Printer Object Attributes - - This is the set of requested attributes and their current - values. The Printer object ignores (does not respond with) any - requested attribute which is not supported. The Printer object - MAY respond with a subset of the supported attributes and - values, depending on the security policy in force. However, the - Printer object MUST respond with the 'unknown' value for any - supported attribute (including all REQUIRED attributes) for - which the Printer object does not know the value. Also the - Printer object MUST respond with the 'no-value' for any - supported attribute (including all REQUIRED attributes) for - which the system administrator has not configured a value. See - the description of the "out-of-band" values in the beginning of - Section 4.1. - - - - - - - -deBry, et al. Experimental [Page 46] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -3.2.6 Get-Jobs Operation - - This REQUIRED operation allows a client to retrieve the list of Job - objects belonging to the target Printer object. The client may also - supply a list of Job attribute names and/or attribute group names. A - group of Job object attributes will be returned for each Job object - that is returned. - - This operation is similar to the Get-Job-Attributes operation, except - that this Get-Jobs operation returns attributes from possibly more - than one object (see the description of Job attribute group names in - section 3.3.4). - -3.2.6.1 Get-Jobs Request - - The client submits the Get-Jobs request to a Printer object. - - The following groups of attributes are part of the Get-Jobs Request: - - Group 1: Operation Attributes - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.1. - - Target: - The "printer-uri" (uri) operation attribute which is the target - for this operation as described in section 3.1.5. - - Requesting User Name: - The "requesting-user-name" (name(MAX)) attribute SHOULD be - supplied by the client as described in section 8.3. - - "limit" (integer(1:MAX)): - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. It is an integer value that - indicates a limit to the number of Job objects returned. The - limit is a "stateless limit" in that if the value supplied by - the client is 'N', then only the first 'N' jobs are returned in - the Get-Jobs Response. There is no mechanism to allow for the - next 'M' jobs after the first 'N' jobs. If the client does not - supply this attribute, the Printer object responds with all - applicable jobs. - - "requested-attributes" (1setOf keyword): - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. It is a set of Job - attribute names and/or attribute groups names in whose values - - - -deBry, et al. Experimental [Page 47] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - the requester is interested. This set of attributes is returned - for each Job object that is returned. The allowed attribute - group names are the same as those defined in the Get-Job- - Attributes operation in section 3.3.4. If the client does not - supply this attribute, the Printer MUST respond as if the client - had supplied this attribute with two values: 'job-uri' and ' - job-id'. - - "which-jobs" (type2 keyword): - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. It indicates which Job - objects MUST be returned by the Printer object. The values for - this attribute are: - - 'completed': This includes any Job object whose state is - 'completed', 'canceled', or 'aborted'. - 'not-completed': This includes any Job object whose state is ' - pending', 'processing', 'processing-stopped', or 'pending- - held'. - - A Printer object MUST support both values. However, if the - mentation does not keep jobs in the 'completed', 'canceled', ' - aborted' states, then it returns no jobs when the 'completed' - value is supplied. - - If a client supplies some other value, the Printer object MUST - copy the attribute and the unsupported value to the Unsupported - Attributes response group, reject the request, and return the ' - client-error-attributes-or-values-not-supported' status code. - - If the client does not supply this attribute, the Printer object - MUST respond as if the client had supplied the attribute with a - value of 'not-completed'. - - "my-jobs" (boolean): - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. It indicates whether all - jobs or just the jobs submitted by the requesting user of this - request MUST be returned by the Printer object. If the client - does not supply this attribute, the Printer object MUST respond - as if the client had supplied the attribute with a value of ' - false', i.e., all jobs. The means for authenticating the - requesting user and matching the jobs is described in section 8. - - - - - - - - -deBry, et al. Experimental [Page 48] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -3.2.6.2 Get-Jobs Response - - The Printer object returns all of the Job objects that match the - criteria as defined by the attribute values supplied by the client in - the request. It is possible that no Job objects are returned since - there may literally be no Job objects at the Printer, or there may be - no Job objects that match the criteria supplied by the client. If - the client requests any Job attributes at all, there is a set of Job - Object Attributes returned for each Job object. - - Group 1: Operation Attributes - - Status Message: - In addition to the REQUIRED status code returned in every - response, the response OPTIONALLY includes a "status-message" - (text) operation attribute as described in sections 14 and - 3.1.6. - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.2. - - Group 2: Unsupported Attributes - - This is a set of Operation attributes supplied by the client (in - the request) that are not supported by the Printer object or - that conflict with one another (see sections 3.2.1.2 and the - Implementer's Guide [ipp-iig]). The response NEED NOT contain - the "requested-attributes" operation attribute with any supplied - values (attribute keywords) that were requested by the client - but are not supported by the IPP object. If the Printer object - is not returning any Unsupported Attributes in the response, the - Printer object SHOULD omit Group 2 rather than sending an empty - group. However, a client MUST be able to accept an empty group. - - Groups 3 to N: Job Object Attributes - - The Printer object responds with one set of Job Object - Attributes for each returned Job object. The Printer object - ignores (does not respond with) any requested attribute or value - which is not supported or which is restricted by the security - policy in force, including whether the requesting user is the - user that submitted the job (job originating user) or not (see - section 8). However, the Printer object MUST respond with the ' - unknown' value for any supported attribute (including all - REQUIRED attributes) for which the Printer object does not know - - - - - -deBry, et al. Experimental [Page 49] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - the value, unless it would violate the security policy. See the - description of the "out-of-band" values in the beginning of - Section 4.1. - - Jobs are returned in the following order: - - - If the client requests all 'completed' Jobs (Jobs in the ' - completed', 'aborted', or 'canceled' states), then the Jobs - are returned newest to oldest (with respect to actual - completion time) - - If the client requests all 'not-completed' Jobs (Jobs in the - 'pending', 'processing', 'pending-held', and 'processing- - stopped' states), then Jobs are returned in relative - chronological order of expected time to complete (based on - whatever scheduling algorithm is configured for the Printer - object). - -3.3 Job Operations - - All Job operations are directed at Job objects. A client MUST always - supply some means of identifying the Job object in order to identify - the correct target of the operation. That job identification MAY - either be a single Job URI or a combination of a Printer URI with a - Job ID. The IPP object implementation MUST support both forms of - identification for every job. - -3.3.1 Send-Document Operation - - This OPTIONAL operation allows a client to create a multi-document - Job object that is initially "empty" (contains no documents). In the - Create-Job response, the Printer object returns the Job object's URI - (the "job-uri" attribute) and the Job object's 32-bit identifier (the - "job-id" attribute). For each new document that the client desires - to add, the client uses a Send-Document operation. Each Send- - Document Request contains the entire stream of document data for one - document. - - Since the Create-Job and the send operations (Send-Document or Send- - URI operations) that follow could occur over an arbitrarily long - period of time for a particular job, a client MUST send another send - operation within an IPP Printer defined minimum time interval after - the receipt of the previous request for the job. If a Printer object - supports multiple document jobs, the Printer object MUST support the - "multiple-operation-time-out" attribute (see section 4.4.28). This - attribute indicates the minimum number of seconds the Printer object - will wait for the next send operation before taking some recovery - action. - - - - -deBry, et al. Experimental [Page 50] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - An IPP object MUST recover from an errant client that does not supply - a send operation, sometime after the minimum time interval specified - by the Printer object's "multiple-operation-time-out" attribute. - Such recovery MAY include any of the following or other recovery - actions: - - 1. Assume that the Job is an invalid job, start the process of - changing the job state to 'aborted', add the 'aborted-by-system' - value to the job's "job-state-reasons" attribute (see section - 4.3.8), if supported, and clean up all resources associated with - the Job. In this case, if another send operation is finally - received, the Printer responds with an "client-error-not- - possible" or "client-error-not-found" depending on whether or - not the Job object is still around when the send operation - finally arrives. - 2. Assume that the last send operation received was in fact the - last document (as if the "last-document" flag had been set to ' - true'), close the Job object, and proceed to process it (i.e., - move the Job's state to 'pending'). - 3. Assume that the last send operation received was in fact the - last document, close the Job, but move it to the 'pending-held' - and add the 'submission-interrupted' value to the job's "job- - state-reasons" attribute (see section 4.3.8), if supported. - This action allows the user or an operator to determine whether - to continue processing the Job by moving it back to the ' - pending' state or to cancel the job. - - Each implementation is free to decide the "best" action to take - depending on local policy, whether any documents have been added, - whether the implementation spools jobs or not, and/or any other piece - of information available to it. If the choice is to abort the Job - object, it is possible that the Job object may already have been - processed to the point that some media sheet pages have been printed. - -3.3.1.1 Send-Document Request - - The following attribute sets are part of the Send-Document Request: - - Group 1: Operation Attributes - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.1. - - - - - - - - -deBry, et al. Experimental [Page 51] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Target: - Either (1) the "printer-uri" (uri) plus "job-id" - (integer(1:MAX))or (2) the "job-uri" (uri) operation - attribute(s) which define the target for this operation as - described in section 3.1.5. - - Requesting User Name: - "requesting-user-name" (name(MAX)) attribute SHOULD be supplied - by the client as described in section 8.3. - - "document-name" (name(MAX)): - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. It contains the client - supplied document name. The document name MAY be different than - the Job name. It might be helpful, but NEED NOT be unique - across multiple documents in the same Job. Typically, the - client software automatically supplies the document name on - behalf of the end user by using a file name or an application - generated name. See the description of the "document-name" - operation attribute in the Print-Job Request (section 3.2.1.1) - for more information about this attribute - - "document-format" (mimeMediaType): - The client OPTIONALLY supplies this attribute. The Printer - object MUST support this attribute. The value of this attribute - identifies the format of the supplied document data. If the - client does not supply this attribute, the Printer object - assumes that the document data is in the format defined by the - Printer object's "document-format-default" attribute. If the - client supplies this attribute, but the value is not supported - by the Printer object, i.e., the value is not one of the values - of the Printer object's "document-format-supported" attribute, - the Printer object MUST reject the request and return the ' - client-error-document-format-not-supported' status code. - - "document-natural-language" (naturalLanguage): - The client OPTIONALLY supplies this attribute. The Printer - object OPTIONALLY supports this attribute. This attribute - specifies the natural language of the document for those - document-formats that require a specification of the natural - language in order to image the document unambiguously. There - are no particular values required for the Printer object to - support. - - "compression" (type3 keyword) - The client OPTIONALLY supplies this attribute. The Printer - object OPTIONALLY supports this attribute and the "compression- - supported" attribute (see section 4.4.29). The client supplied - - - -deBry, et al. Experimental [Page 52] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - "compression" operation attribute identifies the compression - algorithm used on the document data. If the client omits this - attribute, the Printer object MUST assume that the data is not - compressed. If the client supplies the attribute and the - Printer object supports the attribute, the Printer object MUST - use the corresponding decompression algorithm on the document - data. If the client supplies this attribute, but the value is - not supported by the Printer object, i.e., the value is not one - of the values of the Printer object's "compression-supported" - attribute, the Printer object MUST copy the attribute and its - value to the Unsupported Attributes response group, reject the - request, and return the 'client-error-attributes-or-values-not- - supported' status code. - - "last-document" (boolean): - The client MUST supply this attribute. The Printer object MUST - support this attribute. It is a boolean flag that is set to ' - true' if this is the last document for the Job, 'false' - otherwise. - - Group 2: Document Content - - The client MUST supply the document data if the "last-document" - flag is set to 'false'. However, since a client might not know - that the previous document sent with a Send-Document (or Send- - URI) operation was the last document (i.e., the "last-document" - attribute was set to 'false'), it is legal to send a Send- - Document request with no document data where the "last-document" - flag is set to 'true'. Such a request MUST NOT increment the - value of the Job object's "number-of-documents" attribute, since - no real document was added to the job. - -3.3.1.2 Send-Document Response - - The following sets of attributes are part of the Send-Document - Response: - - Group 1: Operation Attributes - - Status Message: - In addition to the REQUIRED status code returned in every - response, the response OPTIONALLY includes a "status-message" - (text) operation attribute as described in sections 14 and - 3.1.6. - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.2. - - - -deBry, et al. Experimental [Page 53] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Group 2: Unsupported Attributes - - This is a set of Operation attributes supplied by the client (in - the request) that are not supported by the Printer object or - that conflict with one another (see sections 3.2.1.2 and the - Implementer's Guide [ipp-iig]). If the Printer object is not - returning any Unsupported Attributes in the response, the - Printer object SHOULD omit Group 2 rather than sending an empty - group. However, a client MUST be able to accept an empty group. - - Group 3: Job Object Attributes - - This is the same set of attributes as described in the Print-Job - response (see section 3.2.1.2). - -3.3.2 Send-URI Operation - - This OPTIONAL operation is identical to the Send-Document operation - (see section 3.3.1) except that a client MUST supply a URI reference - ("document-uri" operation attribute) rather than the document data - itself. If a Printer object supports this operation, clients can use - both Send-URI or Send-Document operations to add new documents to an - existing multi-document Job object. However, if a client needs to - indicate that the previous Send-URI or Send-Document was the last - document, the client MUST use the Send-Document operation with no - document data and the "last-document" flag set to 'true' (rather than - using a Send-URI operation with no "document-uri" operation - attribute). - - If a Printer object supports this operation, it MUST also support the - Print-URI operation (see section 3.2.2). - - The Printer object MUST validate the syntax and URI scheme of the - supplied URI before returning a response, just as in the Print-URI - operation. - -3.3.3 Cancel-Job Operation - - This REQUIRED operation allows a client to cancel a Print Job from - the time the job is created up to the time it is completed, canceled, - or aborted. Since a Job might already be printing by the time a - Cancel-Job is received, some media sheet pages might be printed - before the job is actually terminated. - -3.3.3.1 Cancel-Job Request - - The following groups of attributes are part of the Cancel-Job - Request: - - - -deBry, et al. Experimental [Page 54] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Group 1: Operation Attributes - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.1. - - Target: - Either (1) the "printer-uri" (uri) plus "job-id" - (integer(1:MAX))or (2) the "job-uri" (uri) operation - attribute(s) which define the target for this operation as - described in section 3.1.5. - - Requesting User Name: - The "requesting-user-name" (name(MAX)) attribute SHOULD be - supplied by the client as described in section 8.3. - - "message" (text(127)): - The client OPTIONALLY supplies this attribute. The Printer - object OPTIONALLY supports this attribute. It is a message to - the operator. This "message" attribute is not the same as the - "job-message-from-operator" attribute. That attribute is used - to report a message from the operator to the end user that - queries that attribute. This "message" operation attribute is - used to send a message from the client to the operator along - with the operation request. It is an implementation decision of - how or where to display this message to the operator (if at - all). - -3.3.3.2 Cancel-Job Response - - The following sets of attributes are part of the Cancel-Job Response: - - Group 1: Operation Attributes - - Status Message: - In addition to the REQUIRED status code returned in every - response, the response OPTIONALLY includes a "status-message" - (text) operation attribute as described in sections 14 and - 3.1.6. - - If the job is already in the 'completed', 'aborted', or ' - canceled' state, or the 'process-to-stop-point' value is set in - the Job's "job-state-reasons" attribute, the Printer object MUST - reject the request and return the 'client-error-not-possible' - error status code. - - - - - - -deBry, et al. Experimental [Page 55] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.2. - - Group 2: Unsupported Attributes - - This is a set of Operation attributes supplied by the client (in - the request) that are not supported by the Printer object or - that conflict with one another (see section 3.2.1.2 and the - Implementer's Guide [ipp-iig]). If the Printer object is not - returning any Unsupported Attributes in the response, the - Printer object SHOULD omit Group 2 rather than sending an empty - group. However, a client MUST be able to accept an empty group. - - Once a successful response has been sent, the implementation - guarantees that the Job will eventually end up in the 'canceled' - state. Between the time of the Cancel-Job operation is accepted and - when the job enters the 'canceled' job-state (see section 4.3.7), the - "job-state-reasons" attribute SHOULD contain the 'processing-to- - stop-point' value which indicates to later queries that although the - Job might still be 'processing', it will eventually end up in the ' - canceled' state, not the 'completed' state. - -3.3.4 Get-Job-Attributes Operation - - This REQUIRED operation allows a client to request the values of - attributes of a Job object and it is almost identical to the Get- - Printer-Attributes operation (see section 3.2.5). The only - differences are that the operation is directed at a Job object rather - than a Printer object, there is no "document-format" operation - attribute used when querying a Job object, and the returned attribute - group is a set of Job object attributes rather than a set of Printer - object attributes. - - For Jobs, the possible names of attribute groups are: - - - 'job-template': all of the Job Template attributes that apply to a - Job object (the first column of the table in Section 4.2). - - 'job-description': all of the Job Description attributes specified - in Section 4.3. - - 'all': the special group 'all' that includes all supported - attributes. - - Since a client MAY request specific attributes or named groups, there - is a potential that there is some overlap. For example, if a client - requests, 'job-name' and 'job-description', the client is actually - requesting the "job-name" attribute once by naming it explicitly, and - once by inclusion in the 'job-description' group. In such cases, the - - - -deBry, et al. Experimental [Page 56] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Printer object NEED NOT return the attribute only once in the - response even if it is requested multiple times. The client SHOULD - NOT request the same attribute in multiple ways. - - It is NOT REQUIRED that a Job object support all attributes belonging - to a group (since some attributes are OPTIONAL). However it is - REQUIRED that each Job object support all group names. - -3.3.4.1 Get-Job-Attributes Request - - The following groups of attributes are part of the Get-Job-Attributes - Request when the request is directed at a Job object: - - Group 1: Operation Attributes - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.1. - - Target: - Either (1) the "printer-uri" (uri) plus "job-id" - (integer(1:MAX)) or (2) the "job-uri" (uri) operation - attribute(s) which define the target for this operation as - described in section 3.1.5. - - Requesting User Name: - The "requesting-user-name" (name(MAX)) attribute SHOULD be - supplied by the client as described in section 8.3. - - "requested-attributes" (1setOf keyword) : - The client OPTIONALLY supplies this attribute. The IPP object - MUST support this attribute. It is a set of attribute names - and/or attribute group names in whose values the requester is - interested. If the client omits this attribute, the IPP object - MUST respond as if this attribute had been supplied with a value - of 'all'. - -3.3.4.2 Get-Job-Attributes Response - - The Printer object returns the following sets of attributes as part - of the Get-Job-Attributes Response: - - - - - - - - - - -deBry, et al. Experimental [Page 57] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Group 1: Operation Attributes - - Status Message: - In addition to the REQUIRED status code returned in every - response, the response OPTIONALLY includes a "status-message" - (text) operation attribute as described in sections 14 and - 3.1.6. - - Natural Language and Character Set: - The "attributes-charset" and "attributes-natural-language" - attributes as described in section 3.1.4.2. The "attributes- - natural-language" MAY be the natural language of the Job object, - rather than the one requested. - - Group 2: Unsupported Attributes - - This is a set of Operation attributes supplied by the client (in - the request) that are not supported by the Printer object or - that conflict with one another (see sections 3.2.1.2 and the - Implementer's Guide [ipp-iig]). The response NEED NOT contain - the "requested-attributes" operation attribute with any supplied - values (attribute keywords) that were requested by the client - but are not supported by the IPP object. If the Printer object - is not returning any Unsupported Attributes in the response, the - Printer object SHOULD omit Group 2 rather than sending an empty - group. However, a client MUST be able to accept an empty group. - - Group 3: Job Object Attributes - - This is the set of requested attributes and their current - values. The IPP object ignores (does not respond with) any - requested attribute or value which is not supported or which is - restricted by the security policy in force, including whether - the requesting user is the user that submitted the job (job - originating user) or not (see section 8). However, the IPP - object MUST respond with the 'unknown' value for any supported - attribute (including all RED butes) for which the IPP object - does not know the value, s it would violate the security policy. - See the description e "out-of-band" values in the beginning of - Section 4.1. - -4. Object Attributes - - This section describes the attributes with their corresponding - attribute syntaxes and values that are part of the IPP model. The - sections below show the objects and their associated attributes which - are included within the scope of this protocol. Many of these - attributes are derived from other relevant specifications: - - - -deBry, et al. Experimental [Page 58] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - - Document Printing Application (DPA) [ISO10175] - - RFC 1759 Printer MIB [RFC1759] - - Each attribute is uniquely identified in this document using a - "keyword" (see section 12.2.1) which is the name of the attribute. - The keyword is included in the section header describing that - attribute. - - Note: Not only are keywords used to identify attributes, but one of - the attribute syntaxes described below is "keyword" so that some - attributes have keyword values. Therefore, these attributes are - defined as having an attribute syntax that is a set of keywords. - -4.1 Attribute Syntaxes - - This section defines the basic attribute syntax types that all clients - and IPP objects MUST be able to accept in responses and accept in - requests, respectively. Each attribute description in sections 3 and - 4 includes the name of attribute syntax(es) in the heading (in - parentheses). A conforming implementation of an attribute MUST - include the semantics of the attribute syntax(es) so identified. - Section 6.3 describes how the protocol can be extended with new - attribute syntaxes. - - The attribute syntaxes are specified in the following sub-sections, - where the sub-section heading is the keyword name of the attribute - syntax inside the single quotes. In operation requests and responses - each attribute value MUST be represented as one of the attribute - syntaxes specified in the sub-section heading for the attribute. In - addition, the value of an attribute in a response (but not in a - request) MAY be one of the "out-of-band" values. Standard - "out-of-band" values are: - - 'unknown': The attribute is supported by the IPP object, but the - value is unknown to the IPP object for some reason. - 'unsupported': The attribute is unsupported by the IPP object. This - value MUST be returned only as the value of an attribute in the - Unsupported Attributes Group. - 'no-value': The attribute is supported by the Printer object, but - the system administrator has not yet configured a value. - - The Encoding and Transport specification [RFC2565] defines mechanisms - for passing "out-of-band" values. All attributes in a request MUST - have one or more values as defined in Sections 4.2 to 4.4. Thus - clients MUST NOT supply attributes with "out-of-band" values. All - attribute in a response MUST have one or more values as defined in - Sections 4.2 to 4.4 or a single "out-of-band" value. - - - - -deBry, et al. Experimental [Page 59] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Most attributes are defined to have a single attribute syntax. - However, a few attributes (e.g., "job-sheet", "media", "job-hold- - until") are defined to have several attribute syntaxes, depending on - the value. These multiple attribute syntaxes are separated by the - "|" character in the sub-section heading to indicate the choice. - Since each value MUST be tagged as to its attribute syntax in the - - protocol, a single-valued attribute instance may have any one of its - attribute syntaxes and a multi-valued attribute instance may have a - mixture of its defined attribute syntaxes. - -4.1.1 'text' - - A text attribute is an attribute whose value is a sequence of zero or - more characters encoded in a maximum of 1023 ('MAX') octets. MAX is - the maximum length for each value of any text attribute. However, if - an attribute will always contain values whose maximum length is much - less than MAX, the definition of that attribute will include a - qualifier that defines the maximum length for values of that - attribute. For example: the "printer-location" attribute is - specified as "printer-location (text(127))". In this case, text - values for "printer-location" MUST NOT exceed 127 octets; if supplied - with a longer text string via some external interface (other than the - protocol), implementations are free to truncate to this shorter - length limitation. - - In this specification, all text attributes are defined using the ' - text' syntax. However, 'text' is used only for brevity; the formal - interpretation of 'text' is: 'textWithoutLanguage | - textWithLanguage'. That is, for any attribute defined in this - specification using the 'text' attribute syntax, all IPP objects and - clients MUST support both the 'textWithoutLanguage' and ' - textWithLanguage' attribute syntaxes. However, in actual usage and - protocol execution, objects and clients accept and return only one of - the two syntax per attribute. The syntax 'text' never appears "on- - the-wire". - - Both 'textWithoutLanguage' and 'textWithLanguage' are needed to - support the real world needs of interoperability between sites and - systems that use different natural languages as the basis for human - communication. Generally, one natural language applies to all text - attributes in a given request or response. The language is indicated - by the "attributes-natural-language" operation attribute defined in - section 3.1.4 or "attributes-natural-language" job attribute defined - in section 4.3.24, and there is no need to identify the natural - language for each text string on a value-by-value basis. In these - cases, the attribute syntax 'textWithoutLanguage' is used for text - attributes. In other cases, the client needs to supply or the - - - -deBry, et al. Experimental [Page 60] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Printer object needs to return a text value in a natural language - that is different from the rest of the text values in the request or - response. In these cases, the client or Printer object uses the - attribute syntax 'textWithLanguage' for text attributes (this is the - Natural Language Override mechanism described in section 3.1.4). - - The 'textWithoutLanguage' and 'textWithLanguage' attribute syntaxes - are described in more detail in the following sections. - -4.1.1.1 'textWithoutLanguage' - - The 'textWithoutLanguage' syntax indicates a value that is sequence - of zero or more characters. Text strings are encoded using the rules - of some charset. The Printer object MUST support the UTF-8 charset - [RFC2279] and MAY support additional charsets to represent 'text' - values, provided that the charsets are registered with IANA [IANA- - CS]. See Section 4.1.7 for the specification of the 'charset' - attribute syntax, including restricted semantics and examples of - charsets. - -4.1.1.2 'textWithLanguage' - - The 'textWithLanguage' attribute syntax is a compound attribute - syntax consisting of two parts: a 'textWithoutLanguage' part plus an - additional 'naturalLanguage' (see section 4.1.8) part that overrides - the natural language in force. The 'naturalLanguage' part explicitly - identifies the natural language that applies to the text part of that - value and that value alone. For any give text attribute, the ' - textWithoutLanguage' part is limited to the maximum length defined - for that attribute, but the 'naturalLanguage' part is always limited - to 63 octets. Using the 'textWithLanguage' attribute syntax rather - than the normal 'textWithoutLanguage' syntax is the so-called Natural - Language Override mechanism and MUST be supported by all IPP objects - and clients. - - If the attribute is multi-valued (1setOf text), then the ' - textWithLanguage' attribute syntax MUST be used to explicitly specify - each attribute value whose natural language needs to be overridden. - Other values in a multi-valued 'text' attribute in a request or a - response revert to the natural language of the operation attribute. - - In a create request, the Printer object MUST accept and store with - the Job object any natural language in the "attributes-natural- - language" operation attribute, whether the Printer object supports - that natural language or not. Furthermore, the Printer object MUST - accept and store any 'textWithLanguage' attribute value, whether the - - - - - -deBry, et al. Experimental [Page 61] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Printer object supports that natural language or not. These - requirements are independent of the value of the "ipp-attribute- - fidelity" operation attribute that the client MAY supply. - - Example: If the client supplies the "attributes-natural-language" - operation attribute with the value: 'en' indicating English, but the - value of the "job-name" attribute is in French, the client MUST use - the 'textWithLanguage' attribute syntax with the following two - values: - - 'fr': Natural Language Override indicating French - 'Rapport Mensuel': the job name in French - - See the Encoding and Transport document [RFC2565] for a detailed - example of the 'textWithLanguage' attribute syntax. - -4.1.2 'name' - - This syntax type is used for user-friendly strings, such as a Printer - name, that, for humans, are more meaningful than identifiers. Names - are never translated from one natural language to another. The ' - name' attribute syntax is essentially the same as 'text', including - the REQUIRED support of UTF-8 except that the sequence of characters - is limited so that its encoded form MUST NOT exceed 255 (MAX) octets. - - Also like 'text', 'name' is really an abbreviated notation for either - 'nameWithoutLanguage' or 'nameWithLanguage'. That is, all IPP - objects and clients MUST support both the 'nameWithoutLanguage' and ' - nameWithLanguage' attribute syntaxes. However, in actual usage and - protocol execution, objects and clients accept and return only one of - the two syntax per attribute. The syntax 'name' never appears "on- - the-wire". - - Note: Only the 'text' and 'name' attribute syntaxes permit the - Natural Language Override mechanism. - - Some attributes are defined as 'type3 keyword | name'. These - attributes support values that are either type3 keywords or names. - This dual-syntax mechanism enables a site administrator to extend - these attributes to legally include values that are locally defined - by the site administrator. Such names are not registered with IANA. - -4.1.2.1 'nameWithoutLanguage' - - The 'nameWithoutLanguage' syntax indicates a value that is sequence - of zero or more characters so that its encoded form does not exceed - MAX octets. - - - - -deBry, et al. Experimental [Page 62] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.1.2.2 'nameWithLanguage' - - The 'nameWithLanguage' attribute syntax is a compound attribute - syntax consisting of two parts: a 'nameWithoutLanguage' part plus an - additional 'naturalLanguage' (see section 4.1.8) part that overrides - the natural language in force. The 'naturalLanguage' part explicitly - identifies the natural language that applies to that name value and - that name value alone. - - The 'nameWithLanguage' attribute syntax behaves the same as the ' - textWithLanguage' syntax. If a name is in a language that is - different than the rest of the object or operation, then this ' - nameWithLanguage' syntax is used rather than the generic ' - nameWithoutLanguage' syntax. - - Example: If the client supplies the "attributes-natural-language" - operation attribute with the value: 'en' indicating English, but the - "printer-name" attribute is in German, the client MUST use the ' - nameWithLanguage' attribute syntax as follows: - - 'de': Natural Language Override indicating German - 'Farbdrucker': the Printer name in German - -4.1.2.3 Matching 'name' attribute values - - For purposes of matching two 'name' attribute values for equality, - such as in job validation (where a client-supplied value for - attribute "xxx" is checked to see if the value is among the values of - the Printer object's corresponding "xxx-supported" attribute), the - following match rules apply: - - 1. 'keyword' values never match 'name' values. - - 2. 'name' (nameWithoutLanguage and nameWithLanguage) values - match if (1) the name parts match and (2) the Associated - Natural-Language parts (see section 3.1.4.1) match. The - matching rules are: - - a. the name parts match if the two names are identical - character by character, except it is RECOMMENDED that case - be ignored. For example: 'Ajax-letter-head-white' MUST - match 'Ajax-letter-head-white' and SHOULD match 'ajax- - letter-head-white' and 'AJAX-LETTER-HEAD-WHITE'. - - b. the Associated Natural-Language parts match if the - shorter of the two meets the syntactic requirements of RFC - 1766 [RFC1766] and matches byte for byte with the longer. - For example, 'en' matches 'en', 'en-us' and 'en-gb', but - - - -deBry, et al. Experimental [Page 63] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - matches neither 'fr' nor 'e'. - -4.1.3 'keyword' - - The 'keyword' attribute syntax is a sequence of characters, length: 1 - to 255, containing only the US-ASCII [ASCII] encoded values for - lowercase letters ("a" - "z"), digits ("0" - "9"), hyphen ("-"), dot - ("."), and underscore ("_"). The first character MUST be a lowercase - letter. Furthermore, keywords MUST be in U.S. English. - - This syntax type is used for enumerating semantic identifiers of - entities in the abstract protocol, i.e., entities identified in this - document. Keywords are used as attribute names or values of - attributes. Unlike 'text' and 'name' attribute values, 'keyword' - values MUST NOT use the Natural Language Override mechanism, since - they MUST always be US-ASCII and U.S. English. - - Keywords are for use in the protocol. A user interface will likely - provide a mapping between protocol keywords and displayable user- - friendly words and phrases which are localized to the natural - language of the user. While the keywords specified in this document - MAY be displayed to users whose natural language is U.S. English, - they MAY be mapped to other U.S. English words for U.S. English - users, since the user interface is outside the scope of this - document. - - In the definition for each attribute of this syntax type, the full - set of defined keyword values for that attribute are listed. - - When a keyword is used to represent an attribute (its name), it MUST - be unique within the full scope of all IPP objects and attributes. - When a keyword is used to represent a value of an attribute, it MUST - be unique just within the scope of that attribute. That is, the same - keyword MUST NOT be used for two different values within the same - attribute to mean two different semantic ideas. However, the same - keyword MAY be used across two or more attributes, representing - different semantic ideas for each attribute. Section 6.1 describes - how the protocol can be extended with new keyword values. Examples - of attribute name keywords: - - "job-name" - "attributes-charset" - - Note: This document uses "type1", "type2", and "type3" prefixes to - the "keyword" basic syntax to indicate different levels of review for - extensions (see section 6.1). - - - - - -deBry, et al. Experimental [Page 64] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.1.4 'enum' - - The 'enum' attribute syntax is an enumerated integer value that is in - the range from 1 to 2**31 - 1 (MAX). Each value has an associated ' - keyword' name. In the definition for each attribute of this syntax - type, the full set of possible values for that attribute are listed. - This syntax type is used for attributes for which there are enum - values assigned by other standards, such as SNMP MIBs. A number of - attribute enum values in this specification are also used for - corresponding attributes in other standards [RFC1759]. This syntax - type is not used for attributes to which the system administrator may - assign values. Section 6.1 describes how the protocol can be - extended with new enum values. - - Enum values are for use in the protocol. A user interface will - provide a mapping between protocol enum values and displayable user- - friendly words and phrases which are localized to the natural - language of the user. While the enum symbols specified in this - document MAY be displayed to users whose natural language is U.S. - English, they MAY be mapped to other U.S. English words for U.S. - English users, since the user interface is outside the scope of this - document. - - Note: SNMP MIBs use '2' for 'unknown' which corresponds to the IPP - "out-of-band" value 'unknown'. See the description of the "out-of- - band" values at the beginning of Section 4.1. Therefore, attributes - of type 'enum' start at '3'. - - Note: This document uses "type1", "type2", and "type3" prefixes to - the "enum" basic syntax to indicate different levels of review for - extensions (see section 6.1). - -4.1.5 'uri' - - The 'uri' attribute syntax is any valid Uniform Resource Identifier - or URI [RFC2396]. Most often, URIs are simply Uniform Resource - Locators or URLs. The maximum length of URIs used as values of IPP - attributes is 1023 octets. Although most other IPP attribute syntax - types allow for only lower-cased values, this attribute syntax type - conforms to the case-sensitive and case-insensitive rules specified - in [RFC2396]. - -4.1.6 'uriScheme' - - The 'uriScheme' attribute syntax is a sequence of characters - representing a URI scheme according to RFC 2396 [RFC2396]. Though - RFC 2396 requires that the values be case-insensitive, IPP requires - - - - -deBry, et al. Experimental [Page 65] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - all lower case values in IPP attributes to simplify comparing by IPP - clients and Printer objects. Standard values for this syntax type - are the following keywords: - - 'http': for HTTP schemed URIs (e.g., "http:...") - 'https': for use with HTTPS schemed URIs (e.g., "https:...") - (not on IETF standards track) - 'ftp': for FTP schemed URIs (e.g., "ftp:...") - 'mailto': for SMTP schemed URIs (e.g., "mailto:...") - 'file': for file schemed URIs (e.g., "file:...") - - A Printer object MAY support any URI 'scheme' that has been - registered with IANA [IANA-MT]. The maximum length of URI 'scheme' - values used to represent IPP attribute values is 63 octets. - -4.1.7 'charset' - - The 'charset' attribute syntax is a standard identifier for a - charset. A charset is a coded character set and encoding scheme. - Charsets are used for labeling certain document contents and 'text' - and 'name' attribute values. The syntax and semantics of this - attribute syntax are specified in RFC 2046 [RFC2046] and contained in - the IANA character-set Registry [IANA-CS] according to the IANA - procedures [RFC2278]. Though RFC 2046 requires that the values be - case-insensitive US-ASCII, IPP requires all lower case values in IPP - attributes to simplify comparing by IPP clients and Printer objects. - When a character-set in the IANA registry has more than one name - (alias), the name labeled as "(preferred MIME name)", if present, - MUST be used. - - The maximum length of 'charset' values used to represent IPP - attribute values is 63 octets. - - Some examples are: - - 'utf-8': ISO 10646 Universal Multiple-Octet Coded Character Set - (UCS) represented as the UTF-8 [RFC2279] transfer encoding - scheme in which US-ASCII is a subset charset. - 'us-ascii': 7-bit American Standard Code for Information - Interchange (ASCII), ANSI X3.4-1986 [ASCII]. That standard - defines US-ASCII, but RFC 2045 [RFC2045] eliminates most of the - control characters from conformant usage in MIME and IPP. - 'iso-8859-1': 8-bit One-Byte Coded Character Set, Latin Alphabet - Nr 1 [ISO8859-1]. That standard defines a coded character set - that is used by Latin languages in the Western Hemisphere and - Western Europe. US-ASCII is a subset charset. - - - - - -deBry, et al. Experimental [Page 66] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 'iso-10646-ucs-2': ISO 10646 Universal Multiple-Octet Coded - Character Set (UCS) represented as two octets (UCS-2), with the - high order octet of each pair coming first (so-called Big Endian - integer). - - Some attribute descriptions MAY place additional requirements on - charset values that may be used, such as REQUIRED values that MUST be - supported or additional restrictions, such as requiring that the - charset have US-ASCII as a subset charset. - -4.1.8 'naturalLanguage' - - The 'naturalLanguage' attribute syntax is a standard identifier for a - natural language and optionally a country. The values for this - syntax type are defined by RFC 1766 [RFC1766]. Though RFC 1766 - requires that the values be case-insensitive US-ASCII, IPP requires - all lower case to simplify comparing by IPP clients and Printer - objects. Examples include: - - 'en': for English - 'en-us': for US English - 'fr': for French - 'de': for German - - The maximum length of 'naturalLanguage' values used to represent IPP - attribute values is 63 octets. - -4.1.9 'mimeMediaType' - - The 'mimeMediaType' attribute syntax is the Internet Media Type - (sometimes called MIME type) as defined by RFC 2046 [RFC2046] and - registered according to the procedures of RFC 2048 [RFC2048] for - identifying a document format. The value MAY include a charset - parameter, depending on the specification of the Media Type in the - IANA Registry [IANA-MT]. Although most other IPP syntax types allow - for only lower-cased values, this syntax type allows for mixed-case - values which are case-insensitive. - - Examples are: - - 'text/html': An HTML document - 'text/plain': A plain text document in US-ASCII (RFC 2046 indicates - that in the absence of the charset parameter MUST mean US-ASCII - rather than simply unspecified) [RFC2046]. - 'text/plain; charset=US-ASCII': A plain text document in US-ASCII - [52, 56]. - 'text/plain; charset=ISO-8859-1': A plain text document in ISO - 8859-1 (Latin 1) [ISO8859-1]. - - - -deBry, et al. Experimental [Page 67] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 'text/plain; charset=utf-8': A plain text document in ISO 10646 - represented as UTF-8 [RFC2279] - 'text/plain, charset=iso-10646-ucs-2': A plain text document in - ISO 10646 represented in two octets (UCS-2) [ISO10646-1] - 'application/postscript': A PostScript document [RFC2046] - 'application/vnd.hp-PCL': A PCL document [IANA-MT] (charset escape - sequence embedded in the document data) - 'application/octet-stream': Auto-sense - see below - - One special type is 'application/octet-stream'. If the Printer - object supports this value, the Printer object MUST be capable of - auto-sensing the format of the document data. If the Printer - object's default value attribute "document-format-default" is set to - 'application/octet-stream', the Printer object not only supports - auto-sensing of the document format, but will depend on the result of - applying its auto-sensing when the client does not supply the - "document-format" attribute. If the client supplies a document - format value, the Printer MUST rely on the supplied attribute, rather - than trust its auto-sensing algorithm. To summarize: - - 1. If the client does not supply a document format value, the - Printer MUST rely on its default value setting (which may be ' - application/octet-stream' indicating an auto-sensing mechanism). - 2. If the client supplies a value other than 'application/octet- - stream', the client is supplying valid information about the - format of the document data and the Printer object MUST trust - the client supplied value more than the outcome of applying an - automatic format detection mechanism. For example, the client - may be requesting the printing of a PostScript file as a ' - text/plain' document. The Printer object MUST print a text - representation of the PostScript commands rather than interpret - the stream of PostScript commands and print the result. - 3. If the client supplies a value of 'application/octet-stream', - the client is indicating that the Printer object MUST use its - auto-sensing mechanism on the client supplied document data - whether auto-sensing is the Printer object's default or not. - - Note: Since the auto-sensing algorithm is probabilistic, if the - client requests both auto-sensing ("document-format" set to ' - application/octet-stream') and true fidelity ("ipp-attribute- - fidelity" set to 'true'), the Printer object might not be able to - guarantee exactly what the end user intended (the auto-sensing - algorithm might mistake one document format for another ), but it is - able to guarantee that its auto-sensing mechanism be used. - - The maximum length of a 'mimeMediaType' value to represent IPP - attribute values is 255 octets. - - - - -deBry, et al. Experimental [Page 68] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.1.10 'octetString' - - The 'octetString' attribute syntax is a sequence of octets encoded in - a maximum of 1023 octets which is indicated in sub-section headers - using the notation: octetString(MAX). This syntax type is used for - opaque data. - -4.1.11 'boolean' - - The 'boolean' attribute syntax has only two values: 'true' and ' - false'. - -4.1.12 'integer' - - The 'integer' attribute syntax is an integer value that is in the - range from -2**31 (MIN) to 2**31 - 1 (MAX). Each individual - attribute may specify the range constraint explicitly in sub-section - headers if the range is different from the full range of possible - integer values. For example: job-priority (integer(1:100)) for the - "job-priority" attribute. However, the enforcement of that - additional constraint is up to the IPP objects, not the protocol. - -4.1.13 'rangeOfInteger' - - The 'rangeOfInteger' attribute syntax is an ordered pair of integers - that defines an inclusive range of integer values. The first integer - specifies the lower bound and the second specifies the upper bound. - If a range constraint is specified in the header description for an - attribute in this document whose attribute syntax is 'rangeOfInteger' - (i.e., 'X:Y' indicating X as a minimum value and Y as a maximum - value), then the constraint applies to both integers. - -4.1.14 'dateTime' - - The 'dateTime' attribute syntax is a standard, fixed length, 11 octet - representation of the "DateAndTime" syntax as defined in RFC 2579 - [RFC2579]. RFC 2579 also identifies an 8 octet representation of a - "DateAndTime" value, but IPP objects MUST use the 11 octet - representation. A user interface will provide a mapping between - protocol dateTime values and displayable user-friendly words or - presentation values and phrases which are localized to the natural - language and date format of the user. - -4.1.15 'resolution' - - The 'resolution' attribute syntax specifies a two-dimensional - resolution in the indicated units. It consists of 3 values: a cross - feed direction resolution (positive integer value), a feed direction - - - -deBry, et al. Experimental [Page 69] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - resolution (positive integer value), and a units value. The - semantics of these three components are taken from the Printer MIB - [RFC1759] suggested values. That is, the cross feed direction - component resolution component is the same as the - prtMarkerAddressabilityXFeedDir object in the Printer MIB, the feed - direction component resolution component is the same as the - prtMarkerAddressabilityFeedDir in the Printer MIB, and the units - component is the same as the prtMarkerAddressabilityUnit object in - the Printer MIB (namely, '3' indicates dots per inch and '4' - indicates dots per centimeter). All three values MUST be present - even if the first two values are the same. Example: '300', '600', ' - 3' indicates a 300 dpi cross-feed direction resolution, a 600 dpi - feed direction resolution, since a '3' indicates dots per inch (dpi). - -4.1.16 '1setOf X' - - The '1setOf X' attribute syntax is 1 or more values of attribute - syntax type X. This syntax type is used for multi-valued attributes. - The syntax type is called '1setOf' rather than just 'setOf' as a - reminder that the set of values MUST NOT be empty (i.e., a set of - size 0). Sets are normally unordered. However each attribute - description of this type may specify that the values MUST be in a - certain order for that attribute. - -4.2 Job Template Attributes - - Job Template attributes describe job processing behavior. Support - for Job Template attributes by a Printer object is OPTIONAL (see - section 13.2.3 for a description of support for OPTIONAL attributes). - Also, clients OPTIONALLY supply Job Template attributes in create - requests. - - Job Template attributes conform to the following rules. For each Job - Template attribute called "xxx": - - 1. If the Printer object supports "xxx" then it MUST support both a - "xxx-default" attribute (unless there is a "No" in the table - below) and a "xxx-supported" attribute. If the Printer object - doesn't support "xxx", then it MUST support neither an "xxx- - default" attribute nor an "xxx-supported" attribute, and it MUST - treat an attribute "xxx" supplied by a client as unsupported. - An attribute "xxx" may be supported for some document formats - and not supported for other document formats. For example, it - is expected that a Printer object would only support - "orientation-requested" for some document formats (such as ' - text/plain' or 'text/html') but not others (such as ' - application/postscript'). - - - - -deBry, et al. Experimental [Page 70] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 2. "xxx" is OPTIONALLY supplied by the client in a create request. - If "xxx" is supplied, the client is indicating a desired job - processing behavior for this Job. When "xxx" is not supplied, - the client is indicating that the Printer object apply its - default job processing behavior at job processing time if the - document content does not contain an embedded instruction - indicating an xxx-related behavior. - - Note: Since an administrator MAY change the default value - attribute after a Job object has been submitted but before it - has been processed, the default value used by the Printer object - at job processing time may be different that the default value - in effect at job submission time. - - 3. The "xxx-supported" attribute is a Printer object attribute that - describes which job processing behaviors are supported by that - Printer object. A client can query the Printer object to find - out what xxx-related behaviors are supported by inspecting the - returned values of the "xxx-supported" attribute. - - Note: The "xxx" in each "xxx-supported" attribute name is - singular, even though an "xxx-supported" attribute usually has - more than one value, such as "job-sheet-supported", unless the - "xxx" Job Template attribute is plural, such as "finishings" or - "sides". In such cases the "xxx-supported" attribute names are: - "finishings-supported" and "sides-supported". - - 4. The "xxx-default" default value attribute describes what will be - done at job processing time when no other job processing - information is supplied by the client (either explicitly as an - IPP attribute in the create request or implicitly as an embedded - instruction within the document data). - - If an application wishes to present an end user with a list of - supported values from which to choose, the application SHOULD query - the Printer object for its supported value attributes. The - application SHOULD also query the default value attributes. If the - application then limits selectable values to only those value that - are supported, the application can guarantee that the values supplied - by the client in the create request all fall within the set of - supported values at the Printer. When querying the Printer, the - client MAY enumerate each attribute by name in the Get-Printer- - Attributes Request, or the client MAY just name the "job-template" - group in order to get the complete set of supported attributes (both - supported and default attributes). - - - - - - -deBry, et al. Experimental [Page 71] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - The "finishings" attribute is an example of a Job Template attribute. - It can take on a set of values such as 'staple', 'punch', and/or ' - cover'. A client can query the Printer object for the "finishings- - supported" attribute and the "finishings-default" attribute. The - supported attribute contains a set of supported values. The default - value attribute contains the finishing value(s) that will be used for - a new Job if the client does not supply a "finishings" attribute in - the create request and the document data does not contain any - corresponding finishing instructions. If the client does supply the - "finishings" attribute in the create request, the IPP object - validates the value or values to make sure that they are a subset of - the supported values identified in the Printer object's "finishings- - supported" attribute. See section 3.2.1.2. - - The table below summarizes the names and relationships for all Job - Template attributes. The first column of the table (labeled "Job - Attribute") shows the name and syntax for each Job Template attribute - in the Job object. These are the attributes that can optionally be - supplied by the client in a create request. The last two columns - (labeled "Printer: Default Value Attribute" and "Printer: Supported - Values Attribute") shows the name and syntax for each Job Template - attribute in the Printer object (the default value attribute and the - supported values attribute). A "No" in the table means the Printer - MUST NOT support the attribute (that is, the attribute is simply not - applicable). For brevity in the table, the 'text' and 'name' entries - do not show the maximum length for each attribute. - - +===================+======================+======================+ - | Job Attribute |Printer: Default Value| Printer: Supported | - | | Attribute | Values Attribute | - +===================+======================+======================+ - | job-priority | job-priority-default |job-priority-supported| - | (integer 1:100) | (integer 1:100) |(integer 1:100) | - +-------------------+----------------------+----------------------+ - | job-hold-until | job-hold-until- |job-hold-until- | - | (type3 keyword | | default | supported | - | name) | (type3 keyword | |(1setOf | - | | name) | type3 keyword | name)| - +-------------------+----------------------+----------------------+ - | job-sheets | job-sheets-default |job-sheets-supported | - | (type3 keyword | | (type3 keyword | |(1setOf | - | name) | name) | type3 keyword | name)| - +-------------------+----------------------+----------------------+ - |multiple-document- |multiple-document- |multiple-document- | - | handling | handling-default |handling-supported | - | (type2 keyword) | (type2 keyword) |(1setOf type2 keyword)| - +-------------------+----------------------+----------------------+ - - - - -deBry, et al. Experimental [Page 72] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - +===================+======================+======================+ - | Job Attribute |Printer: Default Value| Printer: Supported | - | | Attribute | Values Attribute | - +===================+======================+======================+ - | copies | copies-default | copies-supported | - | (integer (1:MAX)) | (integer (1:MAX)) | (rangeOfInteger | - | | | (1:MAX)) | - +-------------------+----------------------+----------------------+ - | finishings | finishings-default | finishings-supported | - |(1setOf type2 enum)|(1setOf type2 enum) |(1setOf type2 enum) | - +-------------------+----------------------+----------------------+ - | page-ranges | No | page-ranges- | - | (1setOf | | supported (boolean) | - | rangeOfInteger | | | - | (1:MAX)) | | | - +-------------------+----------------------+----------------------+ - | sides | sides-default | sides-supported | - | (type2 keyword) | (type2 keyword) |(1setOf type2 keyword)| - +-------------------+----------------------+----------------------+ - | number-up | number-up-default | number-up-supported | - | (integer (1:MAX)) | (integer (1:MAX)) |(1setOf integer | - | | | (1:MAX) | | - | | | rangeOfInteger | - | | | (1:MAX)) | - +-------------------+----------------------+----------------------+ - | orientation- |orientation-requested-|orientation-requested-| - | requested | default | supported | - | (type2 enum) | (type2 enum) | (1setOf type2 enum) | - +-------------------+----------------------+----------------------+ - | media | media-default | media-supported | - | (type3 keyword | | (type3 keyword | |(1setOf | - | name) | name) | type3 keyword | name)| - | | | | - | | | media-ready | - | | |(1setOf | - | | | type3 keyword | name)| - +-------------------+----------------------+----------------------+ - | printer-resolution| printer-resolution- | printer-resolution- | - | (resolution) | default | supported | - | | (resolution) |(1setOf resolution) | - +-------------------+----------------------+----------------------+ - | print-quality | print-quality-default| print-quality- | - | (type2 enum) | (type2 enum) | supported | - | | |(1setOf type2 enum) | - +-------------------+----------------------+----------------------+ - - - - - - -deBry, et al. Experimental [Page 73] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.2.1 job-priority (integer(1:100)) - - This attribute specifies a priority for scheduling the Job. A higher - value specifies a higher priority. The value 1 indicates the lowest - possible priority. The value 100 indicates the highest possible - priority. Among those jobs that are ready to print, a Printer MUST - print all jobs with a priority value of n before printing those with - a priority value of n-1 for all n. - - If the Printer object supports this attribute, it MUST always support - the full range from 1 to 100. No administrative restrictions are - permitted. This way an end-user can always make full use of the - entire range with any Printer object. If privileged jobs are - implemented outside IPP/1.0, they MUST have priorities higher than - 100, rather than restricting the range available to end-users. - - If the client does not supply this attribute and this attribute is - supported by the Printer object, the Printer object MUST use the - value of the Printer object's "job-priority-default" at job - submission time (unlike most Job Template attributes that are used if - necessary at job processing time). - - The syntax for the "job-priority-supported" is also integer(1:100). - This single integer value indicates the number of priority levels - supported. The Printer object MUST take the value supplied by the - client and map it to the closest integer in a sequence of n integers - values that are evenly distributed over the range from 1 to 100 using - the formula: - - roundToNearestInt((100x+50)/n) - - where n is the value of "job-priority-supported" and x ranges from 0 - through n-1. - - For example, if n=1 the sequence of values is 50; if n=2, the - sequence of values is: 25 and 75; if n = 3, the sequence of values - is: 17, 50 and 83; if n = 10, the sequence of values is: 5, 15, 25, - 35, 45, 55, 65, 75, 85, and 95; if n = 100, the sequence of values - is: 1, 2, 3, . 100. - - If the value of the Printer object's "job-priority-supported" is 10 - and the client supplies values in the range 1 to 10, the Printer - object maps them to 5, in the range 11 to 20, the Printer object maps - them to 15, etc. - - - - - - - -deBry, et al. Experimental [Page 74] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.2.2 job-hold-until (type3 keyword | name (MAX)) - - This attribute specifies the named time period during which the Job - MUST become a candidate for printing. - - Standard keyword values for named time periods are: - - 'no-hold': immediately, if there are not other reasons to hold the - job - 'day-time': during the day - 'evening': evening - 'night': night - 'weekend': weekend - 'second-shift': second-shift (after close of business) - 'third-shift': third-shift (after midnight) - - An administrator MUST associate allowable print times with a named - time period (by means outside IPP/1.0). An administrator is - encouraged to pick names that suggest the type of time period. An - administrator MAY define additional values using the 'name' or ' - keyword' attribute syntax, depending on implementation. - - If the value of this attribute specifies a time period that is in the - future, the Printer MUST add the 'job-hold-until-specified' value to - the job's "job-state-reasons" attribute, move the job to the ' - pending-held' state, and MUST NOT schedule the job for printing until - the specified time-period arrives. When the specified time period - arrives, the Printer MUST remove the 'job-hold-until-specified' value - from the job's "job-state-reason" attribute and, if there are no - other job state reasons that keep the job in the 'pending-held' - state, the Printer MUST consider the job as a candidate for - processing by moving the job to the 'pending' state. - - If this job attribute value is the named value 'no-hold', or the - specified time period has already started, the job MUST be a - candidate for processing immediately. - - If the client does not supply this attribute and this attribute is - supported by the Printer object, the Printer object MUST use the - value of the Printer object's "job-hold-until-default" at job - submission time (unlike most Job Template attributes that are used if - necessary at job processing time). - -4.2.3 job-sheets (type3 keyword | name(MAX)) - - This attribute determines which job start/end sheet(s), if any, MUST - be printed with a job. - - - - -deBry, et al. Experimental [Page 75] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Standard keyword values are: - - 'none': no job sheet is printed - 'standard': one or more site specific standard job sheets are - printed, e.g. a single start sheet or both start and end sheet - is printed - - An administrator MAY define additional values using the 'name' or ' - keyword' attribute syntax, depending on implementation. - - Note: The effect of this attribute on jobs with multiple documents - MAY be affected by the "multiple-document-handling" job attribute - (section 4.2.4), depending on the job sheet semantics. - -4.2.4 multiple-document-handling (type2 keyword) - - This attribute is relevant only if a job consists of two or more - documents. The attribute controls finishing operations and the - placement of one or more print-stream pages into impressions and onto - media sheets. When the value of the "copies" attribute exceeds 1, it - also controls the order in which the copies that result from - processing the documents are produced. For the purposes of this - explanations, if "a" represents an instance of document data, then - the result of processing the data in document "a" is a sequence of - media sheets represented by "a(*)". - - Standard keyword values are: - - 'single-document': If a Job object has multiple documents, say, the - document data is called a and b, then the result of processing - all the document data (a and then b) MUST be treated as a single - sequence of media sheets for finishing operations; that is, - finishing would be performed on the concatenation of the - sequences a(*),b(*). The Printer object MUST NOT force the data - in each document instance to be formatted onto a new print- - stream page, nor to start a new impression on a new media sheet. - If more than one copy is made, the ordering of the sets of media - sheets resulting from processing the document data MUST be a(*), - b(*), a(*), b(*), ..., and the Printer object MUST force each - copy (a(*),b(*)) to start on a new media sheet. - 'separate-documents-uncollated-copies': If a Job object has - multiple documents, say, the document data is called a and b, - then the result of processing the data in each document instance - MUST be treated as a single sequence of media sheets for - finishing operations; that is, the sets a(*) and b(*) would each - be finished separately. The Printer object MUST force each copy - of the result of processing the data in a single document to - start on a new media sheet. If more than one copy is made, the - - - -deBry, et al. Experimental [Page 76] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - ordering of the sets of media sheets resulting from processing - the document data MUST be a(*), a(*), ..., b(*), b(*) ... . - 'separate-documents-collated-copies': If a Job object has multiple - documents, say, the document data is called a and b, then the - result of processing the data in each document instance MUST be - treated as a single sequence of media sheets for finishing - operations; that is, the sets a(*) and b(*) would each be - finished separately. The Printer object MUST force each copy of - the result of processing the data in a single document to start - on a new media sheet. If more than one copy is made, the - ordering of the sets of media sheets resulting from processing - the document data MUST be a(*), b(*), a(*), b(*), ... . - 'single-document-new-sheet': Same as 'single-document', except - that the Printer object MUST ensure that the first impression of - each document instance in the job is placed on a new media - sheet. This value allows multiple documents to be stapled - together with a single staple where each document starts on a - new sheet. - - The 'single-document' value is the same as 'separate-documents- - collated-copies' with respect to ordering of print-stream pages, but - not media sheet generation, since 'single-document' will put the - first page of the next document on the back side of a sheet if an odd - number of pages have been produced so far for the job, while ' - separate-documents-collated-copies' always forces the next document - or document copy on to a new sheet. In addition, if the "finishings" - attribute specifies 'staple', then with 'single-document', documents - a and b are stapled together as a single document with no regard to - new sheets, with 'single-document-new-sheet', documents a and b are - stapled together as a single document, but document b starts on a new - sheet, but with 'separate-documents-uncollated-copies' and ' - separate-documents-collated-copies', documents a and b are stapled - separately. - - Note: None of these values provide means to produce uncollated sheets - within a document, i.e., where multiple copies of sheet n are - produced before sheet n+1 of the same document. - - The relationship of this attribute and the other attributes that - control document processing is described in section 15.3. - -4.2.5 copies (integer(1:MAX)) - - This attribute specifies the number of copies to be printed. - - On many devices the supported number of collated copies will be - limited by the number of physical output bins on the device, and may - be different from the number of uncollated copies which can be - - - -deBry, et al. Experimental [Page 77] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - supported. - - Note: The effect of this attribute on jobs with multiple documents is - controlled by the "multiple-document-handling" job attribute (section - 4.2.4) and the relationship of this attribute and the other - attributes that control document processing is described in section - 15.3. - -4.2.6 finishings (1setOf type2 enum) - - This attribute identifies the finishing operations that the Printer - uses for each copy of each printed document in the Job. For Jobs with - multiple documents, the "multiple-document-handling" attribute - determines what constitutes a "copy" for purposes of finishing. - - Standard enum values are: - - Value Symbolic Name and Description - - '3' 'none': Perform no finishing - '4' 'staple': Bind the document(s) with one or more staples. - The exact number and placement of the staples is - site-defined. - '5' 'punch': This value indicates that holes are required in - the finished document. The exact number and placement - of the holes is site-defined The punch specification - MAY be satisfied (in a site- and implementation- - specific manner) either by drilling/punching, or by - substituting pre-drilled media. - '6' 'cover': This value is specified when it is desired to - select a non-printed (or pre-printed) cover for the - document. This does not supplant the specification of - a printed cover (on cover stock medium) by the - document itself. - '7' 'bind': This value indicates that a binding is to be - applied to the document; the type and placement of the - binding is site-defined." - - Note: The effect of this attribute on jobs with multiple documents is - controlled by the "multiple-document-handling" job attribute (section - 4.2.4) and the relationship of this attribute and the other - attributes that control document processing is described in section - 15.3. - - If the client supplies a value of 'none' along with any other - combination of values, it is the same as if only that other - combination of values had been supplied (that is the 'none' value has - no effect). - - - -deBry, et al. Experimental [Page 78] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.2.7 page-ranges (1setOf rangeOfInteger (1:MAX)) - - This attribute identifies the range(s) of print-stream pages that the - Printer object uses for each copy of each document which are to be - printed. Nothing is printed for any pages identified that do not - exist in the document(s). Ranges MUST be in ascending order, for - example: 1-3, 5-7, 15-19 and MUST NOT overlap, so that a non-spooling - Printer object can process the job in a single pass. If the ranges - are not ascending or are overlapping, the IPP object MUST reject the - request and return the 'client-error-bad-request' status code. The - attribute is associated with print-stream pages not application- - numbered pages (for example, the page numbers found in the headers - and or footers for certain word processing applications). - - For Jobs with multiple documents, the "multiple-document-handling" - attribute determines what constitutes a "copy" for purposes of the - specified page range(s). When "multiple-document-handling" is ' - single-document', the Printer object MUST apply each supplied page - range once to the concatenation of the print-stream pages. For - example, if there are 8 documents of 10 pages each, the page-range ' - 41:60' prints the pages in the 5th and 6th documents as a single - document and none of the pages of the other documents are printed. - When "multiple-document-handling" is 'separate-documents-uncollated- - copies' or 'separate-documents-collated-copies', the Printer object - MUST apply each supplied page range repeatedly to each document copy. - For the same job, the page-range '1:3, 10:10' would print the first 3 - pages and the 10th page of each of the 8 documents in the Job, as 8 - separate documents. - - In most cases, the exact pages to be printed will be generated by a - device driver and this attribute would not be required. However, - when printing an archived document which has already been formatted, - the end user may elect to print just a subset of the pages contained - in the document. In this case, if page-range = n.m is specified, the - first page to be printed will be page n. All subsequent pages of the - document will be printed through and including page m. - - "page-ranges-supported" is a boolean value indicating whether or not - the printer is capable of supporting the printing of page ranges. - This capability may differ from one PDL to another. There is no - "page-ranges-default" attribute. If the "page-ranges" attribute is - not supplied by the client, all pages of the document will be - printed. - - - - - - - - -deBry, et al. Experimental [Page 79] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Note: The effect of this attribute on jobs with multiple documents is - controlled by the "multiple-document-handling" job attribute (section - 4.2.4) and the relationship of this attribute and the other - attributes that control document processing is described in section - 15.3. - -4.2.8 sides (type2 keyword) - - This attribute specifies how print-stream pages are to be imposed - upon the sides of an instance of a selected medium, i.e., an - impression. - - The standard keyword values are: - - 'one-sided': imposes each consecutive print-stream page upon the - same side of consecutive media sheets. - 'two-sided-long-edge': imposes each consecutive pair of print- - stream pages upon front and back sides of consecutive media - sheets, such that the orientation of each pair of print-stream - pages on the medium would be correct for the reader as if for - binding on the long edge. This imposition is sometimes called ' - duplex' or 'head-to-head'. - 'two-sided-short-edge': imposes each consecutive pair of print- - stream pages upon front and back sides of consecutive media - sheets, such that the orientation of each pair of print-stream - pages on the medium would be correct for the reader as if for - binding on the short edge. This imposition is sometimes called - 'tumble' or 'head-to-toe'. - - 'two-sided-long-edge', 'two-sided-short-edge', 'tumble', and 'duplex' - all work the same for portrait or landscape. However 'head-to-toe' - is 'tumble' in portrait but 'duplex' in landscape. 'head-to-head' - also switches between 'duplex' and 'tumble' when using portrait and - landscape modes. - - Note: The effect of this attribute on jobs with multiple documents is - controlled by the "multiple-document-handling" job attribute (section - 4.2.4) and the relationship of this attribute and the other - attributes that control document processing is described in section - 15.3. - -4.2.9 number-up (integer(1:MAX)) - - This attribute specifies the number of print-stream pages to impose - upon a single side of an instance of a selected medium. For example, - if the value is: - - - - - -deBry, et al. Experimental [Page 80] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Value Description - - '1' the Printer MUST place one print-stream page on a single - side of an instance of the selected medium (MAY add - some sort of translation, scaling, or rotation). - '2' the Printer MUST place two print-stream pages on a single - side of an instance of the selected medium (MAY add - some sort of translation, scaling, or rotation). - '4' the Printer MUST place four print-stream pages on a single - side of an instance of the selected medium (MAY add - some sort of translation, scaling, or rotation). - - This attribute primarily controls the translation, scaling and - rotation of print-stream pages. - - Note: The effect of this attribute on jobs with multiple documents is - controlled by the "multiple-document-handling" job attribute (section - 4.2.4) and the relationship of this attribute and the other - attributes that control document processing is described in section - 15.3. - -4.2.10 orientation-requested (type2 enum) - - This attribute indicates the desired orientation for printed print- - stream pages; it does not describe the orientation of the client- - supplied print-stream pages. - - For some document formats (such as 'application/postscript'), the - desired orientation of the print-stream pages is specified within the - document data. This information is generated by a device driver - prior to the submission of the print job. Other document formats - (such as 'text/plain') do not include the notion of desired - orientation within the document data. In the latter case it is - possible for the Printer object to bind the desired orientation to - the document data after it has been submitted. It is expected that a - Printer object would only support "orientations-requested" for some - document formats (e.g., 'text/plain' or 'text/html') but not others - (e.g., 'application/postscript'). This is no different than any - other Job Template attribute since section 4.2, item 1, points out - that a Printer object may support or not support any Job Template - attribute based on the document format supplied by the client. - However, a special mention is made here since it is very likely that - a Printer object will support "orientation-requested" for only a - subset of the supported document formats. - - - - - - - -deBry, et al. Experimental [Page 81] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Standard enum values are: - - Value Symbolic Name and Description - - '3' 'portrait': The content will be imaged across the short - edge of the medium. - '4' 'landscape': The content will be imaged across the long - edge of the medium. Landscape is defined to be a - rotation of the print-stream page to be imaged by +90 - degrees with respect to the medium (i.e. anti- - clockwise) from the portrait orientation. Note: The - +90 direction was chosen because simple finishing on - the long edge is the same edge whether portrait or - landscape - '5' 'reverse-landscape': The content will be imaged across the - long edge of the medium. Reverse-landscape is defined - to be a rotation of the print-stream page to be imaged - by - 90 degrees with respect to the medium (i.e. - clockwise) from the portrait orientation. Note: The ' - reverse-landscape' value was added because some - applications rotate landscape -90 degrees from - portrait, rather than +90 degrees. - '6' 'reverse-portrait': The content will be imaged across the - short edge of the medium. Reverse-portrait is defined - to be a rotation of the print-stream page to be imaged - by 180 degrees with respect to the medium from the - portrait orientation. Note: The 'reverse-portrait' - value was added for use with the "finishings" - attribute in cases where the opposite edge is desired - for finishing a portrait document on simple finishing - devices that have only one finishing position. Thus a - 'text'/plain' portrait document can be stapled "on the - right" by a simple finishing device as is common use - with some middle eastern languages such as Hebrew. - - Note: The effect of this attribute on jobs with multiple documents is - controlled by the "multiple-document-handling" job attribute (section - 4.2.4) and the relationship of this attribute and the other - attributes that control document processing is described in section - 15.3. - -4.2.11 media (type3 keyword | name(MAX)) - - This attribute identifies the medium that the Printer uses for all - impressions of the Job. - - The values for "media" include medium-names, medium-sizes, input- - trays and electronic forms so that one attribute specifies the media. - - - -deBry, et al. Experimental [Page 82] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - If a Printer object supports a medium name as a value of this - attribute, such a medium name implicitly selects an input-tray that - contains the specified medium. If a Printer object supports a medium - size as a value of this attribute, such a medium size implicitly - selects a medium name that in turn implicitly selects an input-tray - that contains the medium with the specified size. If a Printer - object supports an input-tray as the value of this attribute, such an - input-tray implicitly selects the medium that is in that input-tray - at the time the job prints. This case includes manual-feed input- - trays. If a Printer object supports an electronic form as the value - of this attribute, such an electronic form implicitly selects a - medium-name that in turn implicitly selects an input-tray that - contains the medium specified by the electronic form. The electronic - form also implicitly selects an image that the Printer MUST merge - with the document data as its prints each page. - - Standard keyword values are (taken from ISO DPA and the Printer MIB) - and are listed in section 14. An administrator MAY define additional - values using the 'name' or 'keyword' attribute syntax, depending on - implementation. - - There is also an additional Printer attribute named "media-ready" - which differs from "media-supported" in that legal values only - include the subset of "media-supported" values that are physically - loaded and ready for printing with no operator intervention required. - If an IPP object supports "media-supported", it NEED NOT support - "media-ready". - - The relationship of this attribute and the other attributes that - control document processing is described in section 15.3. - -4.2.12 printer-resolution (resolution) - - This attribute identifies the resolution that Printer uses for the - Job. - -4.2.13 print-quality (type2 enum) - - This attribute specifies the print quality that the Printer uses for - the Job. - - The standard enum values are: - - Value Symbolic Name and Description - - '3' 'draft': lowest quality available on the printer - '4' 'normal': normal or intermediate quality on the printer - '5' 'high': highest quality available on the printer - - - -deBry, et al. Experimental [Page 83] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.3 Job Description Attributes - - The attributes in this section form the attribute group called "job- - description". The following table summarizes these attributes. The - third column indicates whether the attribute is a REQUIRED attribute - that MUST be supported by Printer objects. If it is not indicated as - REQUIRED, then it is OPTIONAL. The maximum size in octets for 'text' - and 'name' attributes is indicated in parenthesizes. - - +----------------------------+----------------------+----------------+ - | Attribute | Syntax | REQUIRED? | - +----------------------------+----------------------+----------------+ - | job-uri | uri | REQUIRED | - +----------------------------+----------------------+----------------+ - | job-id | integer(1:MAX) | REQUIRED | - +----------------------------+----------------------+----------------+ - | job-printer-uri | uri | REQUIRED | - +----------------------------+----------------------+----------------+ - | job-more-info | uri | | - +----------------------------+----------------------+----------------+ - | job-name | name (MAX) | REQUIRED | - +----------------------------+----------------------+----------------+ - | job-originating-user-name | name (MAX) | REQUIRED | - +----------------------------+----------------------+----------------+ - | job-state | type1 enum | REQUIRED | - +----------------------------+----------------------+----------------+ - | job-state-reasons | 1setOf type2 keyword | | - +----------------------------+----------------------+----------------+ - | job-state-message | text (MAX) | | - +----------------------------+----------------------+----------------+ - | number-of-documents | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - | output-device-assigned | name (127) | | - +----------------------------+----------------------+----------------+ - | time-at-creation | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - | time-at-processing | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - | time-at-completed | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - | number-of-intervening-jobs | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - | job-message-from-operator | text (127) | | - +----------------------------+----------------------+----------------+ - | job-k-octets | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - | job-impressions | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - - - -deBry, et al. Experimental [Page 84] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - +----------------------------+----------------------+----------------+ - | Attribute | Syntax | REQUIRED? | - +----------------------------+----------------------+----------------+ - | job-media-sheets | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - | job-k-octets-processed | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - | job-impressions-completed | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - | job-media-sheets-completed | integer (0:MAX) | | - +----------------------------+----------------------+----------------+ - | attributes-charset | charset | REQUIRED | - +----------------------------+----------------------+----------------+ - | attributes-natural-language| naturalLanguage | REQUIRED | - +----------------------------+----------------------+----------------+ - - -4.3.1 job-uri (uri) - - This REQUIRED attribute contains the URI for the job. The Printer - object, on receipt of a new job, generates a URI which identifies the - new Job. The Printer object returns the value of the "job-uri" - attribute as part of the response to a create request. The precise - format of a Job URI is implementation dependent. If the Printer - object supports more than one URI and there is some relationship - between the newly formed Job URI and the Printer object's URI, the - Printer object uses the Printer URI supplied by the client in the - create request. For example, if the create request comes in over a - secure channel, the new Job URI MUST use the same secure channel. - This can be guaranteed because the Printer object is responsible for - generating the Job URI and the Printer object is aware of its - security configuration and policy as well as the Printer URI used in - the create request. - - For a description of this attribute and its relationship to "job-id" - and "job-printer-uri" attribute, see the discussion in section 2.4 on - "Object Identity". - -4.3.2 job-id (integer(1:MAX)) - - This REQUIRED attribute contains the ID of the job. The Printer, on - receipt of a new job, generates an ID which identifies the new Job on - that Printer. The Printer returns the value of the "job-id" - attribute as part of the response to a create request. The 0 value - is not included to allow for compatibility with SNMP index values - which also cannot be 0. - - - - - -deBry, et al. Experimental [Page 85] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - For a description of this attribute and its relationship to "job-uri" - and "job-printer-uri" attribute, see the discussion in section 2.4 on - "Object Identity". - -4.3.3 job-printer-uri (uri) - - This REQUIRED attribute identifies the Printer object that created - this Job object. When a Printer object creates a Job object, it - populates this attribute with the Printer object URI that was used in - the create request. This attribute permits a client to identify the - Printer object that created this Job object when only the Job - object's URI is available to the client. The client queries the - creating Printer object to determine which languages, charsets, - operations, are supported for this Job. - - For a description of this attribute and its relationship to "job-uri" - and "job-id" attribute, see the discussion in section 2.4 on "Object - Identity". - -4.3.4 job-more-info (uri) - - Similar to "printer-more-info", this attribute contains the URI - referencing some resource with more information about this Job - object, perhaps an HTML page containing information about the Job. - -4.3.5 job-name (name(MAX)) - - This REQUIRED attribute is the name of the job. It is a name that is - more user friendly than the "job-uri" attribute value. It does not - need to be unique between Jobs. The Job's "job-name" attribute is - set to the value supplied by the client in the "job-name" operation - attribute in the create request (see Section 3.2.1.1). If, however, - the "job-name" operation attribute is not supplied by the client in - the create request, the Printer object, on creation of the Job, MUST - generate a name. The printer SHOULD generate the value of the Job's - "job-name" attribute from the first of the following sources that - produces a value: 1) the "document-name" operation attribute of the - first (or only) document, 2) the "document-URI" attribute of the - first (or only) document, or 3) any other piece of Job specific - and/or Document Content information. - -4.3.6 job-originating-user-name (name(MAX)) - - This REQUIRED attribute contains the name of the end user that - submitted the print job. The Printer object sets this attribute to - the most authenticated printable name that it can obtain from the - authentication service over which the IPP operation was received. - - - - -deBry, et al. Experimental [Page 86] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Only if such is not available, does the Printer object use the value - supplied by the client in the "requesting-user-name" operation - attribute of the create operation (see Section 8). - - Note: The Printer object needs to keep an internal originating user - id of some form, typically as a credential of a principal, with the - Job object. Since such an internal attribute is implementation- - dependent and not of interest to clients, it is not specified as a - Job Description attribute. This originating user id is used for - authorization checks (if any) on all subsequent operation. - -4.3.7 job-state (type1 enum) - - This REQUIRED attribute identifies the current state of the job. - Even though the IPP protocol defines eight values for job states, - implementations only need to support those states which are - appropriate for the particular implementation. In other words, a - Printer supports only those job states implemented by the output - device and available to the Printer object implementation. - - Standard enum values are: - - Values Symbolic Name and Description - - '3' 'pending': The job is a candidate to start processing, but - is not yet processing. - - '4' 'pending-held': The job is not a candidate for processing - for any number of reasons but will return to the ' - pending' state as soon as the reasons are no longer - present. The job's "job-state-reason" attribute MUST - indicate why the job is no longer a candidate for - processing. - - '5' 'processing': One or more of: - - 1. the job is using, or is attempting to use, one or - more purely software processes that are analyzing, - creating, or interpreting a PDL, etc., - 2. the job is using, or is attempting to use, one or - more hardware devices that are interpreting a PDL, - making marks on a medium, and/or performing finishing, - such as stapling, etc., - 3. the Printer object has made the job ready for - printing, but the output device is not yet printing - it, either because the job hasn't reached the output - - - - - -deBry, et al. Experimental [Page 87] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - device or because the job is queued in the output - device or some other spooler, awaiting the output - device to print it. - - When the job is in the 'processing' state, the entire - job state includes the detailed status represented in - the printer's "printer-state", "printer-state- - reasons", and "printer-state-message" attributes. - - Implementations MAY, though they NEED NOT, include - additional values in the job's "job-state-reasons" - attribute to indicate the progress of the job, such as - adding the 'job-printing' value to indicate when the - output device is actually making marks on paper and/or - the 'processing-to-stop-point' value to indicate that - the IPP object is in the process of canceling or - aborting the job. Most implementations won't bother - with this nuance. - - '6' 'processing-stopped': The job has stopped while processing - for any number of reasons and will return to the ' - processing' state as soon as the reasons are no longer - present. - - The job's "job-state-reason" attribute MAY indicate - why the job has stopped processing. For example, if - the output device is stopped, the 'printer-stopped' - value MAY be included in the job's "job-state-reasons" - attribute. - - Note: When an output device is stopped, the device - usually indicates its condition in human readable form - locally at the device. A client can obtain more - complete device status remotely by querying the - Printer object's "printer-state", "printer-state- - reasons" and "printer-state-message" attributes. - - '7' 'canceled': The job has been canceled by a Cancel-Job - operation and the Printer object has completed - canceling the job and all job status attributes have - reached their final values for the job. While the - Printer object is canceling the job, the job remains - in its current state, but the job's "job-state- - reasons" attribute SHOULD contain the 'processing-to- - stop-point' value and one of the 'canceled-by-user', ' - canceled-by-operator', or 'canceled-at-device' value. - - - - - -deBry, et al. Experimental [Page 88] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - When the job moves to the 'canceled' state, the ' - processing-to-stop-point' value, if present, MUST be - removed, but the 'canceled-by-xxx', if present, MUST - remain. - - '8' 'aborted': The job has been aborted by the system, usually - while the job was in the 'processing' or 'processing- - stopped' state and the Printer has completed aborting - the job and all job status attributes have reached - their final values for the job. While the Printer - object is aborting the job, the job remains in its - current state, but the job's "job-state-reasons" - attribute SHOULD contain the 'processing-to-stop- - point' and 'aborted-by-system' values. When the job - moves to the 'aborted' state, the 'processing-to- - stop-point' value, if present, MUST be removed, but - the 'aborted-by-system' value, if present, MUST - remain. - - '9' 'completed': The job has completed successfully or with - warnings or errors after processing and all of the job - media sheets have been successfully stacked in the - appropriate output bin(s) and all job status - attributes have reached their final values for the - job. The job's "job-state-reasons" attribute SHOULD - contain one of: 'completed-successfully', ' - completed-with-warnings', or 'completed-with-errors' - values. - - The final value for this attribute MUST be one of: 'completed', ' - canceled', or 'aborted' before the Printer removes the job - altogether. The length of time that jobs remain in the 'canceled', ' - aborted', and 'completed' states depends on implementation. - - The following figure shows the normal job state transitions. - - +----> canceled - / - +----> pending --------> processing ---------+------> completed - | ^ ^ \ - --->+ | | +----> aborted - | v v / - +----> pending-held processing-stopped ---+ - - Normally a job progresses from left to right. Other state - transitions are unlikely, but are not forbidden. Not shown are the - transitions to the 'canceled' state from the 'pending', 'pending- - held', and 'processing-stopped' states. - - - -deBry, et al. Experimental [Page 89] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Jobs reach one of the three terminal states: 'completed', 'canceled', - or 'aborted', after the jobs have completed all activity, including - stacking output media, after the jobs have completed all activity, - and all job status attributes have reached their final values for the - job. - - Note: As with all other IPP attributes, if the implementation can not - determine the correct value for this attribute, it SHOULD respond - with the out-of-band value 'unknown' (see section 4.1) rather than - try to guess at some possibly incorrect value and give the end user - the wrong impression about the state of the Job object. For example, - if the implementation is just a gateway into some printing system - that does not provide detailed status about the print job, the IPP - Job object's state might literally be 'unknown'. - -4.3.8 job-state-reasons (1setOf type2 keyword) - - This attribute provides additional information about the job's - current state, i.e., information that augments the value of the job's - "job-state" attribute. - - Implementation of these values is OPTIONAL, i.e., a Printer NEED NOT - implement them, even if (1) the output device supports the - functionality represented by the reason and (2) is available to the - Printer object implementation. These values MAY be used with any job - state or states for which the reason makes sense. Furthermore, when - implemented, the Printer MUST return these values when the reason - applies and MUST NOT return them when the reason no longer applies - whether the value of the Job's "job-state" attribute changed or not. - When the Job does not have any reasons for being in its current - state, the value of the Job's "job-state-reasons" attribute MUST be ' - none'. - - Note: While values cannot be added to the 'job-state' attribute - without impacting deployed clients that take actions upon receiving - "job-state" values, it is the intent that additional "job-state- - reasons" values can be defined and registered without impacting such - deployed clients. In other words, the "job-state-reasons" attribute - is intended to be extensible. - - The following standard keyword values are defined. For ease of - understanding, the values are presented in the order in which the - reasons are likely to occur (if implemented), starting with the ' - job-incoming' value: - - 'none': There are no reasons for the job's current state. - 'job-incoming': The Create-Job operation has been accepted by the - Printer, but the Printer is expecting additional Send-Document - - - -deBry, et al. Experimental [Page 90] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - and/or Send-URI operations and/or is accessing/accepting - document data. - 'submission-interrupted': The job was not completely submitted for - some unforeseen reason, such as: (1) the Printer has crashed - before the job was closed by the client, (2) the Printer or the - document transfer method has crashed in some non-recoverable way - before the document data was entirely transferred to the - Printer, (3) the client crashed or failed to close the job - before the time-out period. See section 4.4.28. - 'job-outgoing': The Printer is transmitting the job to the output - device. - 'job-hold-until-specified': The value of the job's "job-hold- - until" attribute was specified with a time period that is still - in the future. The job MUST NOT be a candidate for processing - until this reason is removed and there are no other reasons to - hold the job. - 'resources-are-not-ready': At least one of the resources needed by - the job, such as media, fonts, resource objects, etc., is not - ready on any of the physical printer's for which the job is a - candidate. This condition MAY be detected when the job is - accepted, or subsequently while the job is pending or - processing, depending on implementation. The job may remain in - its current state or be moved to the 'pending-held' state, - depending on implementation and/or job scheduling policy. - 'printer-stopped-partly': The value of the Printer's "printer- - state-reasons" attribute contains the value 'stopped-partly'. - 'printer-stopped': The value of the Printer's "printer-state" - attribute is 'stopped'. - 'job-interpreting': Job is in the 'processing' state, but more - specifically, the Printer is interpreting the document data. - 'job-queued': Job is in the 'processing' state, but more - specifically, the Printer has queued the document data. - 'job-transforming': Job is in the 'processing' state, but more - specifically, the Printer is interpreting document data and - producing another electronic representation. - 'job-printing': The output device is marking media. This value is - useful for Printers which spend a great deal of time processing - (1) when no marking is happening and then want to show that - marking is now happening or (2) when the job is in the process - of being canceled or aborted while the job remains in the ' - processing' state, but the marking has not yet stopped so that - impression or sheet counts are still increasing for the job. - 'job-canceled-by-user': The job was canceled by the owner of the - job using the Cancel-Job request, i.e., by a user whose - authenticated identity is the same as the value of the - originating user that created the Job object, or by some other - authorized end-user, such as a member of the job owner's - security group. - - - -deBry, et al. Experimental [Page 91] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 'job-canceled-by-operator': The job was canceled by the operator - using the Cancel-Job request, i.e., by a user who has been - authenticated as having operator privileges (whether local or - remote). If the security policy is to allow anyone to cancel - anyone's job, then this value may be used when the job is - canceled by other than the owner of the job. For such a - security policy, in effect, everyone is an operator as far as - canceling jobs with IPP is concerned. - 'job-canceled-at-device': The job was canceled by an unidentified - local user, i.e., a user at a console at the device. - 'aborted-by-system': The job (1) is in the process of being - aborted, (2) has been aborted by the system and placed in the ' - aborted' state, or (3) has been aborted by the system and placed - in the 'pending-held' state, so that a user or operator can - manually try the job again. - 'processing-to-stop-point': The requester has issued a Cancel-Job - operation or the Printer object has aborted the job, but is - still performing some actions on the job until a specified stop - point occurs or job termination/cleanup is completed. - - This reason is recommended to be used in conjunction with the ' - processing' job state to indicate that the Printer object is - still performing some actions on the job while the job remains - in the 'processing' state. After all the job's job description - attributes have stopped incrementing, the Printer object moves - the job from the 'processing' state to the 'canceled' or ' - aborted' job states. - - 'service-off-line': The Printer is off-line and accepting no jobs. - All 'pending' jobs are put into the 'pending-held' state. This - situation could be true if the service's or document transform's - input is impaired or broken. - 'job-completed-successfully': The job completed successfully. - 'job-completed-with-warnings': The job completed with warnings. - 'job-completed-with-errors': The job completed with errors (and - possibly warnings too). - -4.3.9 job-state-message (text(MAX)) - - This attribute specifies information about the "job-state" and "job- - state-reasons" attributes in human readable text. If the Printer - object supports this attribute, the Printer object MUST be able to - generate this message in any of the natural languages identified by - the Printer's "generated-natural-language-supported" attribute (see - the "attributes-natural-language" operation attribute specified in - Section 3.1.4.1). - - - - - -deBry, et al. Experimental [Page 92] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Note: the value SHOULD NOT contain additional information not - contained in the values of the "job-state" and "job-states-reasons" - attributes, such as interpreter error information. Otherwise, - application programs might attempt to parse the (localized text). - For such additional information such as interpreter errors for - application program consumption, a new attribute with keyword values, - needs to be developed and registered. - -4.3.10 number-of-documents (integer(0:MAX)) - - This attribute indicates the number of documents in the job, i.e., - the number of Send-Document, Send-URI, Print-Job, or Print-URI - operations that the Printer has accepted for this job, regardless of - whether the document data has reached the Printer object or not. - - Implementations supporting the OPTIONAL Create-Job/Send- - Document/Send-URI operations SHOULD support this attribute so that - clients can query the number of documents in each job. - -4.3.11 output-device-assigned (name(127)) - - This attribute identifies the output device to which the Printer - object has assigned this job. If an output device implements an - embedded Printer object, the Printer object NEED NOT set this - attribute. If a print server implements a Printer object, the value - MAY be empty (zero-length string) or not returned until the Printer - object assigns an output device to the job. This attribute is - particularly useful when a single Printer object support multiple - devices (so called "fan-out"). - -4.3.12 time-at-creation (integer(0:MAX)) - - This attribute indicates the point in time at which the Job object - was created. In order to populate this attribute, the Printer object - uses the value in its "printer-up-time" attribute at the time the Job - object is created. - -4.3.13 time-at-processing (integer(0:MAX)) - - This attribute indicates the point in time at which the Job object - began processing. In order to populate this attribute, the Printer - object uses the value in its "printer-up-time" attribute at the time - the Job object is moved into the 'processing' state for the first - time. - - - - - - - -deBry, et al. Experimental [Page 93] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.3.14 time-at-completed (integer(0:MAX)) - - This attribute indicates the point in time at which the Job object - completed (or was cancelled or aborted). In order to populate this - attribute, the Printer object uses the value in its "printer-up-time" - attribute at the time the Job object is moved into the 'completed' or - 'canceled' or 'aborted' state. - -4.3.15 number-of-intervening-jobs (integer(0:MAX)) - - This attribute indicates the number of jobs that are "ahead" of this - job in the relative chronological order of expected time to complete - (i.e., the current scheduled order). For efficiency, it is only - necessary to calculate this value when an operation is performed that - requests this attribute. - -4.3.16 job-message-from-operator (text(127)) - - This attribute provides a message from an operator, system - administrator or "intelligent" process to indicate to the end user - the reasons for modification or other management action taken on a - job. - -4.3.17 job-k-octets (integer(0:MAX)) - - This attribute specifies the total size of the document(s) in K - octets, i.e., in units of 1024 octets requested to be processed in - the job. The value MUST be rounded up, so that a job between 1 and - 1024 octets MUST be indicated as being 1, 1025 to 2048 MUST be 2, - etc. - - This value MUST NOT include the multiplicative factors contributed by - the number of copies specified by the "copies" attribute, independent - of whether the device can process multiple copies without making - multiple passes over the job or document data and independent of - whether the output is collated or not. Thus the value is independent - of the implementation and indicates the size of the document(s) - measured in K octets independent of the number of copies. - - This value MUST also not include the multiplicative factor due to a - copies instruction embedded in the document data. If the document - data actually includes replications of the document data, this value - will include such replication. In other words, this value is always - the size of the source document data, rather than a measure of the - hardcopy output to be produced. - - - - - - -deBry, et al. Experimental [Page 94] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Note: This attribute and the following two attributes ("job- - impressions" and "job-media-sheets") are not intended to be counters; - they are intended to be useful routing and scheduling information if - known. For these three attributes, the Printer object may try to - compute the value if it is not supplied in the create request. Even - if the client does supply a value for these three attributes in the - create request, the Printer object MAY choose to change the value if - the Printer object is able to compute a value which is more accurate - than the client supplied value. The Printer object may be able to - determine the correct value for these three attributes either right - at job submission time or at any later point in time. - -4.3.18 job-impressions (integer(0:MAX)) - - This attribute specifies the total size in number of impressions of - the document(s) being submitted (see the definition of impression in - section 13.2.5). - - As with "job-k-octets", this value MUST NOT include the - multiplicative factors contributed by the number of copies specified - by the "copies" attribute, independent of whether the device can - process multiple copies without making multiple passes over the job - or document data and independent of whether the output is collated or - not. Thus the value is independent of the implementation and - reflects the size of the document(s) measured in impressions - independent of the number of copies. - - As with "job-k-octets", this value MUST also not include the - multiplicative factor due to a copies instruction embedded in the - document data. If the document data actually includes replications - of the document data, this value will include such replication. In - other words, this value is always the number of impressions in the - source document data, rather than a measure of the number of - impressions to be produced by the job. - - See the Note in the "job-k-octets" attribute that also applies to - this attribute. - -4.3.19 job-media-sheets (integer(0:MAX)) - - This attribute specifies the total number of media sheets to be - produced for this job. - - Unlike the "job-k-octets" and the "job-impressions" attributes, this - value MUST include the multiplicative factors contributed by the - number of copies specified by the "copies" attribute and a 'number of - copies' instruction embedded in the document data, if any. This - difference allows the system administrator to control the lower and - - - -deBry, et al. Experimental [Page 95] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - upper bounds of both (1) the size of the document(s) with "job-k- - octets-supported" and "job-impressions-supported" and (2) the size of - the job with "job-media-sheets-supported". - - See the Note in the "job-k-octets" attribute that also applies to - this attribute. - -4.3.20 job-k-octets-processed (integer(0:MAX)) - - This attribute specifies the total number of octets processed in K - octets, i.e., in units of 1024 octets so far. The value MUST be - rounded up, so that a job between 1 and 1024 octets inclusive MUST be - indicated as being 1, 1025 to 2048 inclusive MUST be 2, etc. - - For implementations where multiple copies are produced by the - interpreter with only a single pass over the data, the final value - MUST be equal to the value of the "job-k-octets" attribute. For - implementations where multiple copies are produced by the interpreter - by processing the data for each copy, the final value MUST be a - multiple of the value of the "job-k-octets" attribute. - - Note: This attribute and the following two attributes ("job- - impressions-completed" and "job-sheets-completed") are intended to be - counters. That is, the value for a job that has not started - processing MUST be 0. When the job's "job-state" is 'processing' or - 'processing-stopped', this value is intended to contain the amount of - the job that has been processed to the time at which the attributes - are requested. - -4.3.21 job-impressions-completed (integer(0:MAX)) - - This job attribute specifies the number of impressions completed for - the job so far. For printing devices, the impressions completed - includes interpreting, marking, and stacking the output. - - See the note in "job-k-octets-processed" which also applies to this - attribute. - -4.3.22 job-media-sheets-completed (integer(0:MAX)) - - This job attribute specifies the media-sheets completed marking and - stacking for the entire job so far whether those sheets have been - processed on one side or on both. - - See the note in "job-k-octets-processed" which also applies to this - attribute. - - - - - -deBry, et al. Experimental [Page 96] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.3.23 attributes-charset (charset) - - This REQUIRED attribute is populated using the value in the client - supplied "attributes-charset" attribute in the create request. It - identifies the charset (coded character set and encoding method) used - by any Job attributes with attribute syntax 'text' and 'name' that - were supplied by the client in the create request. See Section 3.1.4 - for a complete description of the "attributes-charset" operation - attribute. - - This attribute does not indicate the charset in which the 'text' and - 'name' values are stored internally in the Job object. The internal - charset is implementation-defined. The IPP object MUST convert from - whatever the internal charset is to that being requested in an - operation as specified in Section 3.1.4. - -4.3.24 attributes-natural-language (naturalLanguage) - - This REQUIRED attribute is populated using the value in the client - supplied "attributes-natural-language" attribute in the create - request. It identifies the natural language used for any Job - attributes with attribute syntax 'text' and 'name' that were supplied - by the client in the create request. See Section 3.1.4 for a - complete description of the "attributes-natural-language" operation - attribute. See Sections 4.1.1.2 and 4.1.2.2 for how a Natural - Language Override may be supplied explicitly for each 'text' and ' - name' attribute value that differs from the value identified by the - "attributes-natural-language" attribute. - -4.4 Printer Description Attributes - - These attributes form the attribute group called "printer- - description". The following table summarizes these attributes, their - syntax, and whether or not they are REQUIRED for a Printer object to - support. If they are not indicated as REQUIRED, they are OPTIONAL. - The maximum size in octets for 'text' and 'name' attributes is - indicated in parenthesizes. - - Note: How these attributes are set by an Administrator is outside the - scope of this specification. - - - - - - - - - - - -deBry, et al. Experimental [Page 97] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - +----------------------------+----------------------+----------------+ - | Attribute | Syntax | REQUIRED? | - +----------------------------+----------------------+----------------+ - | printer-uri-supported | 1setOf uri | REQUIRED | - +----------------------------+----------------------+----------------+ - | uri-security-supported | 1setOf type2 keyword | REQUIRED | - +----------------------------+----------------------+----------------+ - | printer-name | name (127) | REQUIRED | - +----------------------------+----------------------+----------------+ - | printer-location | text (127) | | - +----------------------------+----------------------+----------------+ - | printer-info | text (127) | | - +----------------------------+----------------------+----------------+ - | printer-more-info | uri | | - +----------------------------+----------------------+----------------+ - | printer-driver-installer | uri | | - +----------------------------+----------------------+----------------+ - | printer-make-and-model | text (127) | | - +----------------------------+----------------------+----------------+ - | printer-more-info- | uri | | - | manufacturer | | | - +----------------------------+----------------------+----------------+ - | printer-state | type1 enum | REQUIRED | - +----------------------------+----------------------+----------------+ - | printer-state-reasons | 1setOf type2 keyword | | - +----------------------------+----------------------+----------------+ - | printer-state-message | text (MAX) | | - +----------------------------+----------------------+----------------+ - | operations-supported | 1setOf type2 enum | REQUIRED | - +----------------------------+----------------------+----------------+ - | charset-configured | charset | REQUIRED | - +----------------------------+----------------------+----------------+ - | charset-supported | 1setOf charset | REQUIRED | - +----------------------------+----------------------+----------------+ - | natural-language-configured| naturalLanguage | REQUIRED | - +----------------------------+----------------------+----------------+ - | generated-natural-language-| 1setOf | REQUIRED | - | supported | naturalLanguage | | - +----------------------------+----------------------+----------------+ - | document-format-default | mimeMediaType | REQUIRED | - +----------------------------+----------------------+----------------+ - | document-format- | 1setOf | REQUIRED | - | supported | mimeMediaType | | - +----------------------------+----------------------+----------------+ - | printer-is-accepting-jobs | boolean | REQUIRED | - +----------------------------+----------------------+----------------+ - | queued-job-count | integer (0:MAX) | RECOMMENDED | - +----------------------------+----------------------+----------------+ - - - -deBry, et al. Experimental [Page 98] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - +----------------------------+----------------------+----------------+ - | Attribute | Syntax | REQUIRED? | - +----------------------------+----------------------+----------------+ - | printer-message-from- | text (127) | | - | operator | | | - +----------------------------+----------------------+----------------+ - | color-supported | boolean | | - +----------------------------+----------------------+----------------+ - | reference-uri-schemes- | 1setOf uriScheme | | - | supported | | | - +----------------------------+----------------------+----------------+ - | pdl-override-supported | type2 keyword | REQUIRED | - +----------------------------+----------------------+----------------+ - | printer-up-time | integer (1:MAX) | REQUIRED | - +----------------------------+----------------------+----------------+ - | printer-current-time | dateTime | | - +----------------------------+----------------------+----------------+ - | multiple-operation-time-out| integer (1:MAX) | | - +----------------------------+----------------------+----------------+ - | compression-supported | 1setOf type3 keyword | | - +----------------------------+----------------------+----------------+ - | job-k-octets-supported | rangeOfInteger | | - | | (0:MAX) | | - +----------------------------+----------------------+----------------+ - | job-impressions-supported | rangeOfInteger | | - | | (0:MAX) | | - +----------------------------+----------------------+----------------+ - | job-media-sheets-supported | rangeOfInteger | | - | | (0:MAX) | | - +----------------------------+----------------------+----------------+ - -4.4.1 printer-uri-supported (1setOf uri) - - This REQUIRED Printer attribute contains at least one URI for the - Printer object. It OPTIONALLY contains more than one URI for the - Printer object. An administrator determines a Printer object's - URI(s) and configures this attribute to contain those URIs by some - means outside the scope of IPP/1.0. The precise format of this URI - is implementation dependent and depends on the protocol. See the - next section for a description "uri-security-supported" which is the - REQUIRED companion attribute to this "printer-uri-supported" - attribute. See section 2.4 on Printer object identity and section - 8.2 on security and URIs for more information. - - - - - - - - -deBry, et al. Experimental [Page 99] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.4.2 uri-security-supported (1setOf type2 keyword) - - This REQUIRED Printer attribute MUST have the same cardinality - (contain the same number of values) as the "printer-uri-supported" - attribute. This attribute identifies the security mechanisms used - for each URI listed in the "printer-uri-supported" attribute. The "i - th" value in "uri-security-supported" corresponds to the "i th" value - in "printer-uri-supported" and it describes the security mechanisms - used for accessing the Printer object via that URI. The following - standard values are defined: - - 'none': There are no secure communication channel protocols in use - for the given URI. - - 'ssl3': SSL3 [SSL] is the secure communications channel protocol in - use for the given URI. - - Consider the following example. For a single Printer object, an - administrator configures the "printer-uri-supported" and "uri- - security-supported" attributes as follows: - - "printer-uri-supported": 'http://acme.com/open-use-printer', ' - http://acme.com/restricted-use-printer', ' - http://acme.com/private-printer' - "uri-security-supported": 'none', 'none', 'ssl3' - - In this case, one Printer object has three URIs. - - - For the first URI, 'http://acme.com/open-use-printer', the value - 'none' in "uri-security-supported" indicates that there is no - secure channel protocol configured to run under HTTP. The name - implies that there is no Basic or Digest authentication being - used, but it is up to the client to determine that while using - HTTP underneath the IPP application protocol. - - For the second URI, 'http://acme.com/restricted-use-printer', the - value 'none' in "uri-security-supported" indicates that there is - no secure channel protocol configured to run under HTTP. In - this case, although the name does imply that there is some sort - of Basic or Digest authentication being used within HTTP, it is - up to the client to determine that while using HTTP and by - processing any '401 Unauthorized' HTTP error messages. - - For the third URI, 'http://acme.com/private-printer', the value ' - ssl3' in "uri-security-supported" indicates that SSL3 is being - used to secure the channel. The client SHOULD be prepared to - use SSL3 framing to negotiate an acceptable ciphersuite to use - while communicating with the Printer object. In this case, the - name implies the use of a secure communications channel, but the - fact is made explicit by the presence of the 'ssl3' value in - - - -deBry, et al. Experimental [Page 100] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - "uri-security-supported". The client does not need to resort to - understanding which security it must use by following naming - conventions or by parsing the URI to determine which security - mechanisms are implied. - - It is expected that many IPP Printer objects will be configured to - support only one channel (either configured to use SSL3 access or - not), and will therefore only ever have one URI listed in the - "printer-uri-supported" attribute. No matter the configuration of - the Printer object (whether it has only one URI or more than one - URI), a client MUST supply only one URI in the target "printer-uri" - operation attribute. - -4.4.3 printer-name (name(127)) - - This REQUIRED Printer attribute contains the name of the Printer - object. It is a name that is more end-user friendly than a URI. An - administrator determines a printer's name and sets this attribute to - that name. This name may be the last part of the printer's URI or it - may be unrelated. In non-US-English locales, a name may contain - characters that are not allowed in a URI. - -4.4.4 printer-location (text(127)) - - This Printer attribute identifies the location of the device. This - could include things like: "in Room 123A, second floor of building - XYZ". - -4.4.5 printer-info (text(127)) - - This Printer attribute identifies the descriptive information about - this Printer object. This could include things like: "This printer - can be used for printing color transparencies for HR presentations", - or "Out of courtesy for others, please print only small (1-5 page) - jobs at this printer", or even "This printer is going away on July 1, - 1997, please find a new printer". - -4.4.6 printer-more-info (uri) - - This Printer attribute contains a URI used to obtain more information - about this specific Printer object. For example, this could be an - HTTP type URI referencing an HTML page accessible to a Web Browser. - The information obtained from this URI is intended for end user - consumption. Features outside the scope of IPP can be accessed from - this URI. The information is intended to be specific to this printer - instance and site specific services (e.g. job pricing, services - offered, end user assistance). The device manufacturer may initially - populate this attribute. - - - -deBry, et al. Experimental [Page 101] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -4.4.7 printer-driver-installer (uri) - - This Printer attribute contains a URI to use to locate the driver - installer for this Printer object. This attribute is intended for - consumption by automata. The mechanics of print driver installation - is outside the scope of IPP. The device manufacturer may initially - populate this attribute. - -4.4.8 printer-make-and-model (text(127)) - - This Printer attribute identifies the make and model of the device. - The device manufacturer may initially populate this attribute. - -4.4.9 printer-more-info-manufacturer (uri) - - This Printer attribute contains a URI used to obtain more information - about this type of device. The information obtained from this URI is - intended for end user consumption. Features outside the scope of IPP - can be accessed from this URI (e.g., latest firmware, upgrades, print - drivers, optional features available, details on color support). The - information is intended to be germane to this printer without regard - to site specific modifications or services. The device manufacturer - may initially populate this attribute. - -4.4.10 printer-state (type1 enum) - - This REQUIRED Printer attribute identifies the current state of the - device. The "printer-state reasons" attribute augments the - "printer-state" attribute to give more detailed information about the - Printer in the given printer state. - - A Printer object need only update this attribute before responding to - an operation which requests the attribute; the Printer object NEED - NOT update this attribute continually, since asynchronous event - notification is not part of IPP/1.0. A Printer NEED NOT implement - all values if they are not applicable to a given implementation. - - The following standard enum values are defined: - - Value Symbolic Name and Description - - '3' 'idle': If a Printer receives a job (whose required - resources are ready) while in this state, such a job - MUST transit into the 'processing' state immediately. - If the "printer-state-reasons" attribute contains any - reasons, they MUST be reasons that would not prevent a - job from transiting into the 'processing' state - immediately, e.g., 'toner-low'. Note: if a Printer - - - -deBry, et al. Experimental [Page 102] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - controls more than one output device, the above - definition implies that a Printer is 'idle' if at - least one output device is idle. - - '4' 'processing': If a Printer receives a job (whose required - resources are ready) while in this state, such a job - MUST transit into the 'pending' state immediately. - Such a job MUST transit into the 'processing' state - only after jobs ahead of it complete. If the - "printer-state-reasons" attribute contains any - reasons, they MUST be reasons that do not prevent the - current job from printing, e.g. 'toner-low'. Note: - if a Printer controls more than one output device, the - above definition implies that a Printer is ' - processing' if at least one output device is - processing, and none is idle. - - '5' 'stopped': If a Printer receives a job (whose required - resources are ready) while in this state, such a job - MUST transit into the 'pending' state immediately. - Such a job MUST transit into the 'processing' state - only after some human fixes the problem that stopped - the printer and after jobs ahead of it complete - processing. If supported, the "printer-state-reasons" - attribute MUST contain at least one reason, e.g. ' - media-jam', which prevents it from either processing - the current job or transitioning a 'pending' job to - the 'processing' state. - - Note: if a Printer controls more than one output - device, the above definition implies that a Printer is - 'stopped' only if all output devices are stopped. - Also, it is tempting to define 'stopped' as when a - sufficient number of output devices are stopped and - leave it to an implementation to define the sufficient - number. But such a rule complicates the definition of - 'stopped' and 'processing'. For example, with this - alternate definition of 'stopped', a job can move from - 'pending' to 'processing' without human intervention, - even though the Printer is stopped. - -4.4.11 printer-state-reasons (1setOf type2 keyword) - - This Printer attribute supplies additional detail about the device's - state. - - - - - - -deBry, et al. Experimental [Page 103] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Each keyword value MAY have a suffix to indicate its level of - severity. The three levels are: report (least severe), warning, and - error (most severe). - - - '-report': This suffix indicates that the reason is a "report". - An implementation may choose to omit some or all reports. Some - reports specify finer granularity about the printer state; - others serve as a precursor to a warning. A report MUST contain - nothing that could affect the printed output. - - '-warning': This suffix indicates that the reason is a "warning". - An implementation may choose to omit some or all warnings. - Warnings serve as a precursor to an error. A warning MUST - contain nothing that prevents a job from completing, though in - some cases the output may be of lower quality. - - '-error': This suffix indicates that the reason is an "error". - An implementation MUST include all errors. If this attribute - contains one or more errors, printer MUST be in the stopped - state. - - If the implementation does not add any one of the three suffixes, all - parties MUST assume that the reason is an "error". - - If a Printer object controls more than one output device, each value - of this attribute MAY apply to one or more of the output devices. An - error on one output device that does not stop the Printer object as a - whole MAY appear as a warning in the Printer's "printer-state-reasons - attribute". If the "printer-state" for such a Printer has a value of - 'stopped', then there MUST be an error reason among the values in the - "printer-state-reasons" attribute. - - The following standard keyword values are defined: - - 'other': The device has detected an error other than one listed in - this document. - 'none': There are not reasons. This state reason is semantically - equivalent to "printer-state-reasons" without any value. - 'media-needed': A tray has run out of media. - 'media-jam': The device has a media jam. - 'paused': Someone has paused the Printer object. In this state, a - Printer MUST NOT produce printed output, but it MUST perform - other operations requested by a client. If a Printer had been - printing a job when the Printer was paused, the Printer MUST - resume printing that job when the Printer is no longer paused - and leave no evidence in the printed output of such a pause. - 'shutdown': Someone has removed a Printer object from service, and - the device may be powered down or physically removed. In this - state, a Printer object MUST NOT produce printed output, and - unless the Printer object is realized by a print server that is - - - -deBry, et al. Experimental [Page 104] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - still active, the Printer object MUST perform no other - operations requested by a client, including returning this - value. If a Printer object had been printing a job when it was - shutdown, the Printer NEED NOT resume printing that job when the - Printer is no longer shutdown. If the Printer resumes printing - such a job, it may leave evidence in the printed output of such - a shutdown, e.g. the part printed before the shutdown may be - printed a second time after the shutdown. - 'connecting-to-device': The Printer object has scheduled a job on - the output device and is in the process of connecting to a - shared network output device (and might not be able to actually - start printing the job for an arbitrarily long time depending on - the usage of the output device by other servers on the network). - 'timed-out': The server was able to connect to the output device - (or is always connected), but was unable to get a response from - the output device. - 'stopping': The Printer object is in the process of stopping the - device and will be stopped in a while. When the device is - stopped, the Printer object will change the Printer object's - state to 'stopped'. The 'stopping-warning' reason is never an - error, even for a Printer with a single output device. When an - output-device ceases accepting jobs, the Printer will have this - reason while the output device completes printing. - 'stopped-partly': When a Printer object controls more than one - output device, this reason indicates that one or more output - devices are stopped. If the reason is a report, fewer than half - of the output devices are stopped. If the reason is a warning, - fewer than all of the output devices are stopped. - 'toner-low': The device is low on toner. - 'toner-empty': The device is out of toner. - 'spool-area-full': The limit of persistent storage allocated for - spooling has been reached. - 'cover-open': One or more covers on the device are open. - 'interlock-open': One or more interlock devices on the printer are - unlocked. - 'door-open': One or more doors on the device are open. - 'input-tray-missing': One or more input trays are not in the - device. - 'media-low': At least one input tray is low on media. - 'media-empty': At least one input tray is empty. - 'output-tray-missing': One or more output trays are not in the - device - 'output-area-almost-full': One or more output area is almost full - (e.g. tray, stacker, collator). - 'output-area-full': One or more output area is full. (e.g. tray, - stacker, collator) - 'marker-supply-low': The device is low on at least one marker - supply. (e.g. toner, ink, ribbon) - - - -deBry, et al. Experimental [Page 105] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 'marker-supply-empty: The device is out of at least one marker - supply. (e.g. toner, ink, ribbon) - 'marker-waste-almost-full': The device marker supply waste - receptacle is almost full. - 'marker-waste-full': The device marker supply waste receptacle is - full. - 'fuser-over-temp': The fuser temperature is above normal. - 'fuser-under-temp': The fuser temperature is below normal. - 'opc-near-eol': The optical photo conductor is near end of life. - 'opc-life-over': The optical photo conductor is no longer - functioning. - 'developer-low': The device is low on developer. - 'developer-empty: The device is out of developer. - 'interpreter-resource-unavailable': An interpreter resource is - unavailable (i.e. font, form) - -4.4.12 printer-state-message (text(MAX)) - - This Printer attribute specifies the additional information about the - printer state and printer state reasons in human readable text. If - the Printer object supports this attribute, the Printer object MUST - be able to generate this message in any of the natural languages - identified by the Printer's "generated-natural-language-supported" - attribute (see the "attributes-natural-language" operation attribute - specified in Section 3.1.4.1). - -4.4.13 operations-supported (1setOf type2 enum) - - This REQUIRED Printer attribute specifies the set of supported - operations for this Printer object and contained Job objects. All - 32-bit enum values for this attribute MUST NOT exceed 0x8FFF, since - these values are passed in two octets in each Protocol request - [RFC2565]. - - The following standard enum and "operation-id" (see section 3.1.2) - values are defined: - - Value Operation Name - ----------------- ------------------------------------- - - 0x0000 reserved, not used - 0x0001 reserved, not used - 0x0002 Print-Job - 0x0003 Print-URI - 0x0004 Validate-Job - 0x0005 Create-Job - 0x0006 Send-Document - 0x0007 Send-URI - - - -deBry, et al. Experimental [Page 106] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 0x0008 Cancel-Job - 0x0009 Get-Job-Attributes - 0x000A Get-Jobs - 0x000B Get-Printer-Attributes - 0x000C-0x3FFF reserved for future operations - 0x4000-0x8FFF reserved for private extensions - - This allows for certain vendors to implement private extensions that - are guaranteed to not conflict with future registered extensions. - However, there is no guarantee that two or more private extensions - will not conflict. - -4.4.14 charset-configured (charset) - - This REQUIRED Printer attribute identifies the charset that the - Printer object has been configured to represent 'text' and 'name' - Printer attributes that are set by the operator, system - administrator, or manufacturer, i.e., for "printer-name" (name), - "printer-location" (text), "printer-info" (text), and "printer-make- - and-model" (text). Therefore, the value of the Printer object's - "charset-configured" attribute MUST also be among the values of the - Printer object's "charset-supported" attribute. - -4.4.15 charset-supported (1setOf charset) - - This REQUIRED Printer attribute identifies the set of charsets that - the Printer and contained Job objects support in attributes with - attribute syntax 'text' and 'name'. At least the value 'utf-8' MUST - be present, since IPP objects MUST support the UTF-8 [RFC2279] - charset. If a Printer object supports a charset, it means that for - all attributes of syntax 'text' and 'name' the IPP object MUST (1) - accept the charset in requests and return the charset in responses as - needed. - - If more charsets than UTF-8 are supported, the IPP object MUST - perform charset conversion between the charsets as described in - Section 3.2.1.2. - -4.4.16 natural-language-configured (naturalLanguage) - - This REQUIRED Printer attribute identifies the natural language that - the Printer object has been configured to represent 'text' and 'name' - Printer attributes that are set by the operator, system - administrator, or manufacturer, i.e., for "printer-name" (name), - "printer-location" (text), "printer-info" (text), and "printer-make- - and-model" (text). When returning these Printer attributes, the - Printer object MAY return them in the configured natural language - specified by this attribute, instead of the natural language - - - -deBry, et al. Experimental [Page 107] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - requested by the client in the "attributes-natural-language" - operation attribute. See Section 3.1.4.1 for the specification of - the OPTIONAL multiple natural language support. Therefore, the value - of the Printer object's "natural-language-configured" attribute MUST - also be among the values of the Printer object's "generated-natural- - language-supported" attribute. - -4.4.17 generated-natural-language-supported (1setOf naturalLanguage) - - This REQUIRED Printer attribute identifies the natural language(s) - that the Printer object and contained Job objects support in - attributes with attribute syntax 'text' and 'name'. The natural - language(s) supported depends on implementation and/or configuration. - Unlike charsets, IPP objects MUST accept requests with any natural - language or any Natural Language Override whether the natural - language is supported or not. - - If a Printer object supports a natural language, it means that for - any of the attributes for which the Printer or Job object generates - messages, i.e., for the "job-state-message" and "printer-state- - message" attributes and Operation Messages (see Section 3.1.5) in - operation responses, the Printer and Job objects MUST be able to - generate messages in any of the Printer's supported natural - languages. See section 3.1.4 for the specification of 'text' and ' - name' attributes in operation requests and responses. - - Note: A Printer object that supports multiple natural languages, - often has separate catalogs of messages, one for each natural - language supported. - -4.4.18 document-format-default (mimeMediaType) - - This REQUIRED Printer attribute identifies the document format that - the Printer object has been configured to assume if the client does - not supply a "document-format" operation attribute in any of the - operation requests that supply document data. The standard values - for this attribute are Internet Media types (sometimes called MIME - types). For further details see the description of the ' - mimeMediaType' attribute syntax in Section 4.1.9. - -4.4.19 document-format-supported (1setOf mimeMediaType) - - This REQUIRED Printer attribute identifies the set of document - formats that the Printer object and contained Job objects can - support. For further details see the description of the ' - mimeMediaType' attribute syntax in Section 4.1.9. - -4.4.20 printer-is-accepting-jobs (boolean) - - - -deBry, et al. Experimental [Page 108] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - This REQUIRED Printer attribute indicates whether the printer is - currently able to accept jobs, i.e., is accepting Print-Job, Print- - URI, and Create-Job requests. If the value is 'true', the printer is - accepting jobs. If the value is 'false', the Printer object is - currently rejecting any jobs submitted to it. In this case, the - Printer object returns the 'server-error-not-accepting-jobs' status - code. - - Note: This value is independent of the "printer-state" and "printer- - state-reasons" attributes because its value does not affect the - current job; rather it affects future jobs. This attribute may cause - the Printer to reject jobs when the "printer-state" is 'idle' or it - may cause the Printer object to accepts jobs when the "printer-state" - is 'stopped'. - -4.4.21 queued-job-count (integer(0:MAX)) - - This RECOMMENDED Printer attribute contains a count of the number of - jobs that are either 'pending', 'processing', 'pending-held', or ' - processing-stopped' and is set by the Printer object. - -4.4.22 printer-message-from-operator (text(127)) - - This Printer attribute provides a message from an operator, system - administrator or "intelligent" process to indicate to the end user - information or status of the printer, such as why it is unavailable - or when it is expected to be available. - -4.4.23 color-supported (boolean) - - This Printer attribute identifies whether the device is capable of - any type of color printing at all, including highlight color. All - document instructions having to do with color are embedded within the - document PDL (none are external IPP attributes in IPP/1.0). - - Note: end-users are able to determine the nature and details of the - color support by querying the "printer-more-info-manufacturer" - Printer attribute. - -4.4.24 reference-uri-schemes-supported (1setOf uriScheme) - - This Printer attribute specifies which URI schemes are supported for - use in the "document-uri" operation attribute of the Print-URI or - Send-URI operation. If a Printer object supports these optional - operations, it MUST support the "reference-uri-schemes-supported" - Printer attribute with at least the following schemed URI value: - - 'ftp': The Printer object will use an FTP 'get' operation as - - - -deBry, et al. Experimental [Page 109] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - defined in RFC 2228 [RFC2228] using FTP URLs as defined by - [RFC2396] and[RFC2316]. - - The Printer object MAY OPTIONALLY support other URI schemes (see - section 4.1.6). - -4.4.25 pdl-override-supported (type2 keyword) - - This REQUIRED Printer attribute expresses the ability for a - particular Printer implementation to either attempt to override - document data instructions with IPP attributes or not. - - This attribute takes on the following values: - - - 'attempted': This value indicates that the Printer object - attempts to make the IPP attribute values take precedence over - embedded instructions in the document data, however there is no - guarantee. - - - 'not-attempted': This value indicates that the Printer object - makes no attempt to make the IPP attribute values take precedence - over embedded instructions in the document data. - - Section 15 contains a full description of how this attribute - interacts with and affects other IPP attributes, especially the - "ipp-attribute-fidelity" attribute. - -4.4.26 printer-up-time (integer(1:MAX)) - - This REQUIRED Printer attribute indicates the amount of time (in - seconds) that this instance of this Printer implementation has been - up and running. This value is used to populate the Job attributes - "time-at-creation", "time-at-processing", and "time-at-completed". - These time values are all measured in seconds and all have meaning - only relative to this attribute, "printer-up-time". The value is a - monotonically increasing value starting from 1 when the Printer - object is started-up (initialized, booted, etc.). - - If the Printer object goes down at some value 'n', and comes back up, - the implementation MAY: - - 1. Know how long it has been down, and resume at some value greater - than 'n', or - 2. Restart from 1. - - In the first case, the Printer SHOULD not tweak any existing related - Job attributes ("time-at-creation", "time-at-processing", and "time- - at-completed"). In the second case, the Printer object SHOULD reset - - - -deBry, et al. Experimental [Page 110] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - those attributes to 0. If a client queries a time-related Job - attribute and finds the value to be 0, the client MUST assume that - the Job was submitted in some life other than the Printer's current - life. - -4.4.27 printer-current-time (dateTime) - - This Printer attribute indicates the current absolute wall-clock - time. If an implementation supports this attribute, then a client - could calculate the absolute wall-clock time each Job's "time-at- - creation", "time-at-processing", and "time-at-completed" attributes - by using both "printer-up-time" and this attribute, "printer- - current-time". If an implementation does not support this attribute, - a client can only calculate the relative time of certain events based - on the REQUIRED "printer-up-time" attribute. - -4.4.28 multiple-operation-time-out (integer(1:MAX)) - - This Printer attributes identifies the minimum time (in seconds) that - the Printer object waits for additional Send-Document or Send-URI - operations to follow a still-open multi-document Job object before - taking any recovery actions, such as the ones indicated in section - 3.3.1. - - It is RECOMMENDED that vendors supply a value for this attribute that - is between 60 and 240 seconds. An implementation MAY allow a system - administrator to set this attribute. If so, the system administrator - MAY be able to set values outside this range. - -4.4.29 compression-supported (1setOf type3 keyword) - - This Printer attribute identifies the set of supported compression - algorithms for document data. Compression only applies to the - document data; compression does not apply to the encoding of the IPP - operation itself. The supported values are used to validate the - client supplied "compression" operation attributes in Print-Job, - Send-Document, and Send-URI requests. - - Standard values are : - - 'none': no compression is used. - 'deflate': ZIP public domain inflate/deflate) compression - technology - 'gzip' GNU zip compression technology described in RFC 1952 - [RFC1952]. - 'compress': UNIX compression technology - -4.4.30 job-k-octets-supported (rangeOfInteger(0:MAX)) - - - -deBry, et al. Experimental [Page 111] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - This Printer attribute specifies the upper and lower bounds of total - sizes of jobs in K octets, i.e., in units of 1024 octets. The - supported values are used to validate the client supplied "job-k- - octets" operation attributes in create requests. The corresponding - job description attribute "job-k-octets" is defined in section - 4.3.17. - - 4.4.31 job-impressions-supported (rangeOfInteger(0:MAX)) - - This Printer attribute specifies the upper and lower bounds for the - number of impressions per job. The supported values are used to - validate the client supplied "job-impressions" operation attributes - in create requests. The corresponding job description attribute - "job-impressions" is defined in section 4.3.18. - -4.4.32 job-media-sheets-supported (rangeOfInteger(0:MAX)) - - This Printer attribute specifies the upper and lower bounds for the - number of media sheets per job. The supported values are used to - validate the client supplied "job-media-sheets" operation attributes - in create requests. The corresponding Job attribute "job-media- - sheets" is defined in section 4.3.19. - -5. Conformance - - This section describes conformance issues and requirements. This - document introduces model entities such as objects, operations, - attributes, attribute syntaxes, and attribute values. These - conformance sections describe the conformance requirements which - apply to these model entities. - -5.1 Client Conformance Requirements - - A conforming client MUST support all REQUIRED operations as defined - in this document. For each attribute included in an operation - request, a conforming client MUST supply a value whose type and value - syntax conforms to the requirements of the Model document as - specified in Sections 3 and 4. A conforming client MAY supply any - registered extensions and/or private extensions in an operation - request, as long as they meet the requirements in Section 6. - - Otherwise, there are no conformance requirements placed on the user - interfaces provided by IPP clients or their applications. For - example, one application might not allow an end user to submit - multiple documents per job, while another does. One application - might first query a Printer object in order to supply a graphical - user interface (GUI) dialogue box with supported and default values - whereas a different implementation might not. - - - -deBry, et al. Experimental [Page 112] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - When sending a request, an IPP client NEED NOT supply any attributes - that are indicated as OPTIONALLY supplied by the client. - - A client MUST be able to accept any of the attribute syntaxes defined - in Section 4.1, including their full range, that may be returned to - it in a response from a Printer object. In particular for each - attribute that the client supports whose attribute syntax is 'text', - the client MUST accept and process both the 'textWithoutLanguage' and - 'textWithLanguage' forms. Similarly, for each attribute that the - client supports whose attribute syntax is 'name', the client MUST - accept and process both the 'nameWithoutLanguage' and ' - nameWithLanguage' forms. For presentation purposes, truncation of - long attribute values is not recommended. A recommended approach - would be for the client implementation to allow the user to scroll - through long attribute values. - - A query response may contain attribute groups, attributes, and values - that the client does not expect. Therefore, a client implementation - MUST gracefully handle such responses and not refuse to inter-operate - with a conforming Printer that is returning extended registered or - private attributes and/or attribute values that conform to Section 6. - Clients may choose to ignore any parameters, attributes, or values - that they do not understand. - -5.2 IPP Object Conformance Requirements - - This section specifies the conformance requirements for conforming - implementations with respect to objects, operations, and attributes. - -5.2.1 Objects - - Conforming implementations MUST implement all of the model objects as - defined in this specification in the indicated sections: - - Section 2.1 - Printer Object - Section 2.2 - Job Object - -5.2.2 Operations - - Conforming IPP object implementations MUST implement all of the - REQUIRED model operations, including REQUIRED responses, as defined - in this specification in the indicated sections: - - For a Printer object: - Print-Job (section 3.2.1) REQUIRED - Print-URI (section 3.2.2) OPTIONAL - Validate-Job (section 3.2.3) REQUIRED - Create-Job (section 3.2.4) OPTIONAL - - - -deBry, et al. Experimental [Page 113] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Get-Printer-Attributes (section 3.2.5) REQUIRED - Get-Jobs (section 3.2.6) REQUIRED - - For a Job object: - Send-Document (section 3.3.1) OPTIONAL - Send-URI (section 3.3.2) OPTIONAL - Cancel-Job (section 3.3.3) REQUIRED - Get-Job-Attributes (section 3.3.4) REQUIRED - - Conforming IPP objects MUST support all REQUIRED operation attributes - and all values of such attributes if so indicated in the description. - Conforming IPP objects MUST ignore all unsupported or unknown - operation attributes or operation attribute groups received in a - request, but MUST reject a request that contains a supported - operation attribute that contains an unsupported value. - - The following section on object attributes specifies the support - required for object attributes. - -5.2.3 IPP Object Attributes - - Conforming IPP objects MUST support all of the REQUIRED object - attributes, as defined in this specification in the indicated - sections. - - If an object supports an attribute, it MUST support only those values - specified in this document or through the extension mechanism - described in section 5.2.4. It MAY support any non-empty subset of - these values. That is, it MUST support at least one of the specified - values and at most all of them. - -5.2.4 Extensions - - A conforming IPP object MAY support registered extensions and private - extensions, as long as they meet the requirements specified in - Section 6. - - For each attribute included in an operation response, a conforming - IPP object MUST return a value whose type and value syntax conforms - to the requirement of the Model document as specified in Sections 3 - and 4. - - - - - - - - - - -deBry, et al. Experimental [Page 114] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -5.2.5 Attribute Syntaxes - - An IPP object MUST be able to accept any of the attribute syntaxes - defined in Section 4.1, including their full range, in any operation - in which a client may supply attributes or the system administrator - may configure attributes (by means outside the scope of IPP/1.0). In - particular for each attribute that the IPP object supports whose - attribute syntax is 'text', the IPP object MUST accept and process - both the 'textWithoutLanguage' and 'textWithLanguage' forms. - Similarly, for each attribute that the IPP object supports whose - attribute syntax is 'name', the IPP object MUST accept and process - both the 'nameWithoutLanguage' and 'nameWithLanguage' forms. - Furthermore, an IPP object MUST return attributes to the client in - operation responses that conform to the syntax specified in Section - 4.1, including their full range if supplied previously by a client. - -5.3 Charset and Natural Language Requirements - - All clients and IPP objects MUST support the 'utf-8' charset as - defined in section 4.1.7. - - IPP objects MUST be able to accept any client request which correctly - uses the "attributes-natural-language" operation attribute or the - Natural Language Override mechanism on any individual attribute - whether or not the natural language is supported by the IPP object. - If an IPP object supports a natural language, then it MUST be able to - translate (perhaps by table lookup) all generated 'text' or 'name' - attribute values into one of the supported languages (see section - 3.1.4). That is, the IPP object that supports a natural language - NEED NOT be a general purpose translator of any arbitrary 'text' or ' - name' value supplied by the client into that natural language. - However, the object MUST be able to translate (automatically - generate) any of its own attribute values and messages into that - natural language. - -5.4 Security Conformance Requirements - - Conforming IPP Printer objects MAY support Secure Socket Layer - Version 3 (SSL3) [SSL] access, support access without SSL3 or support - both means of access. - - Conforming IPP clients SHOULD support SSL3 access and non-SSL3 - access. Note: This client requirement to support both means that - conforming IPP clients will be able to inter-operate with any IPP - Printer object. - - - - - - -deBry, et al. Experimental [Page 115] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - For a detailed discussion of security considerations and the IPP - application security profile required for SSL3 support, see section - 8. - -6. IANA Considerations (registered and private extensions) - - This section describes how IPP can be extended to allow the following - registered and private extensions to IPP: - - 1. keyword attribute values - 2. enum attribute values - 3. attributes - 4. attribute syntaxes - 5. operations - 6. attribute groups - 7. status codes - - Extensions registered for use with IPP/1.0 are OPTIONAL for client - and IPP object conformance to the IPP/1.0 Model specification. - - These extension procedures are aligned with the guidelines as set - forth by the IESG [RFC2434]. Section 11 describes how to propose new - registrations for consideration. IANA will reject registration - proposals that leave out required information or do not follow the - appropriate format described in Section 11. IPP/1.0 may also be - extended by an appropriate RFC that specifies any of the above - extensions. - -6.1 Typed 'keyword' and 'enum' Extensions - - IPP allows for 'keyword' and 'enum' extensions (see sections 4.1.2.3 - and 4.1.4). This document uses prefixes to the 'keyword' and 'enum' - basic attribute syntax type in order to communicate extra information - to the reader through its name. This extra information is not - represented in the protocol because it is unimportant to a client or - Printer object. The list below describes the prefixes and their - meaning. - - "type1": The IPP specification must be revised to add a new - keyword or a new enum. No private keywords or enums are - allowed. - - "type2": Implementers can, at any time, add new keyword or enum - values by proposing the complete specification to IANA: - - iana@iana.org - - - - - -deBry, et al. Experimental [Page 116] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - IANA will forward the registration proposal to the IPP - Designated Expert who will review the proposal with a mailing - list that the Designated Expert keeps for this purpose. - Initially, that list will be the mailing list used by the IPP - WG: - - ipp@pwg.org - - even after the IPP WG is disbanded as permitted by [RFC2434]. - The IPP Designated Expert is appointed by the IESG Area Director - responsible for IPP, according to [RFC2434]. - - When a type2 keyword or enum is approved, the IPP Designated - Expert becomes the point of contact for any future maintenance - that might be required for that registration. - - "type3": Implementers can, at any time, add new keyword and enum - values by submitting the complete specification to IANA as for - type2 who will forward the proposal to the IPP Designated - Expert. While no additional technical review is required, the - IPP Designated Expert may, at his/her discretion, forward the - proposal to the same mailing list as for type2 registrations for - advice and comment. - - When a type3 keyword or enum is approved by the IPP Designated - Expert, the original proposer becomes the point of contact for - any future maintenance that might be required for that - registration. - - For type2 and type3 keywords, the proposer includes the name of the - keyword in the registration proposal and the name is part of the - technical review. - - After type2 and type3 enums specifications are approved, the IPP - Designated Expert in consultation with IANA assigns the next - available enum number for each enum value. - - IANA will publish approved type2 and type3 keyword and enum - attributes value registration specifications in: - - ftp.isi.edu/iana/assignments/ipp/attribute-values/xxx/yyy.txt - - where xxx is the attribute name that specifies the initial values and - yyy.txt is a descriptive file name that contains one or more enums or - keywords approved at the same time. For example, if several - additional enums for stapling are approved for use with the - - - - - -deBry, et al. Experimental [Page 117] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - "finishings" attribute (and "finishings-default" and "finishings- - supported" attributes), IANA will publish the additional values in - the file: - - ftp.isi.edu/iana/assignments/ipp/attribute- - values/finishings/stapling.txt - - Note: Some attributes are defined to be: 'type3 keywords' | 'name' - which allows for attribute values to be extended by a site - administrator with administrator defined names. Such names are not - registered with IANA. - - By definition, each of the three types above assert some sort of - registry or review process in order for extensions to be considered - valid. Each higher numbered level (1, 2, 3) tends to be decreasingly - less stringent than the previous level. Therefore, any typeN value - MAY be registered using a process for some typeM where M is less than - N, however such registration is NOT REQUIRED. For example, a type3 - value MAY be registered in a type 1 manner (by being included in a - future version of an IPP specification), however, it is NOT REQUIRED. - - This specification defines keyword and enum values for all of the - above types, including type3 keywords. - - For private (unregistered) keyword extensions, implementers SHOULD - use keywords with a suitable distinguishing prefix, such as "xxx-" - where xxx is the (lowercase) fully qualified company name registered - with IANA for use in domain names [RFC1035]. For example, if the - company XYZ Corp. had obtained the domain name "XYZ.com", then a - private keyword 'abc' would be: 'xyz.com-abc'. - - Note: RFC 1035 [RFC1035] indicates that while upper and lower case - letters are allowed in domain names, no significance is attached to - the case. That is, two names with the same spelling but different - case are to be treated as if identical. Also, the labels in a domain - name must follow the rules for ARPANET host names: They must start - with a letter, end with a letter or digit, and have as interior - characters only letters, digits, and hyphen. Labels must be 63 - characters or less. Labels are separated by the "." character. - - For private (unregistered) enum extension, implementers MUST use - values in the reserved integer range which is 2**30 to 2**31-1. - - - - - - - - - -deBry, et al. Experimental [Page 118] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -6.2 Attribute Extensibility - - Attribute names are type2 keywords. Therefore, new attributes may be - registered and have the same status as attributes in this document by - following the type2 extension rules. For private (unregistered) - attribute extensions, implementers SHOULD use keywords with a - suitable distinguishing prefix as described in Section 6.1. - - IANA will publish approved attribute registration specifications as - separate files: - - ftp.isi.edu/iana/assignments/ipp/attributes/xxx-yyy.txt - - where "xxx-yyy" is the new attribute name. - - If a new Printer object attribute is defined and its values can be - affected by a specific document format, its specification needs to - contain the following sentence: - - "The value of this attribute returned in a Get-Printer-Attributes - response MAY depend on the "document-format" attribute supplied - (see Section 3.2.5.1)." - - If the specification does not, then its value in the Get-Printer- - Attributes response MUST NOT depend on the "document-format" supplied - in the request. When a new Job Template attribute is registered, the - value of the Printer attributes MAY vary with "document-format" - supplied in the request without the specification having to indicate - so. - -6.3 Attribute Syntax Extensibility - - Attribute syntaxes are like type2 enums. Therefore, new attribute - syntaxes may be registered and have the same status as attribute - syntaxes in this document by following the type2 extension rules - described in Section 6.1. The value codes that identify each of the - attribute syntaxes are assigned in the Encoding and Transport - specification [RFC2565], including a designated range for private, - experimental use. - - For attribute syntaxes, the IPP Designated Expert in consultation - with IANA assigns the next attribute syntax code in the appropriate - range as specified in [RFC2565]. IANA will publish approved - attribute syntax registration specifications as separate files: - - ftp.isi.edu/iana/assignments/ipp/attribute-syntaxes/xxx-yyy.txt - - where 'xxx-yyy' is the new attribute syntax name. - - - -deBry, et al. Experimental [Page 119] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -6.4 Operation Extensibility - - Operations may also be registered following the type2 procedures - described in Section 6.1, though major new operations will usually be - done by a new standards track RFC that augments this document. For - private (unregistered) operation extensions, implementers MUST use - the range for the "operation-id" in requests specified in Section - 4.4.13 "operations-supported" Printer attribute. - - For operations, the IPP Designated Expert in consultation with IANA - assigns the next operation-id code as specified in Section 4.4.13. - IANA will publish approved operation registration specifications as - separate files: - - ftp.isi.edu/iana/assignments/ipp/operations/Xxx-Yyy.txt - - where "Xxx-Yyy" is the new operation name. - -6.5 Attribute Groups - - Attribute groups passed in requests and responses may be registered - following the type2 procedures described in Section 6.1. The tags - that identify each of the attribute groups are assigned in [RFC2565]. - - For attribute groups, the IPP Designated Expert in consultation with - IANA assigns the next attribute group tag code in the appropriate - range as specified in [RFC2565]. IANA will publish approved - attribute group registration specifications as separate files: - - ftp.isi.edu/iana/assignments/ipp/attribute-group-tags/xxx-yyy- - tag.txt - - where 'xxx-yyy-tag' is the new attribute group tag name. - -6.6 Status Code Extensibility - - Operation status codes may also be registered following the type2 - procedures described in Section 6.1. The values for status codes are - allocated in ranges as specified in Section 13 for each status code - class: - - "informational" - Request received, continuing process - "successful" - The action was successfully received, understood, - and accepted - "redirection" - Further action must be taken in order to complete - the request - "client-error" - The request contains bad syntax or cannot be - fulfilled - - - -deBry, et al. Experimental [Page 120] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - "server-error" - The IPP object failed to fulfill an apparently - valid request - - For private (unregistered) operation status code extensions, - implementers MUST use the top of each range as specified in Section - 13. - - For operation status codes, the IPP Designated Expert in consultation - with IANA assigns the next status code in the appropriate class range - as specified in Section 13. IANA will publish approved status code - registration specifications as separate files: - - ftp.isi.edu/iana/assignments/ipp/status-codes/xxx-yyy.txt - - where "xxx-yyy" is the new operation status code keyword. - -6.7 Registration of MIME types/sub-types for document-formats - - The "document-format" attribute's syntax is 'mimeMediaType'. This - means that valid values are Internet Media Types (see Section 4.1.9). - RFC 2045 [RFC2045] defines the syntax for valid Internet media types. - IANA is the registry for all Internet media types. - -6.8 Registration of charsets for use in 'charset' attribute values - - The "attributes-charset" attribute's syntax is 'charset'. This means - that valid values are charsets names. When a charset in the IANA - registry has more than one name (alias), the name labeled as - "(preferred MIME name)", if present, MUST be used (see Section - 4.1.7). IANA is the registry for charsets following the procedures - of [RFC2278]. - -7. Internationalization Considerations - - Some of the attributes have values that are text strings and names - which are intended for human understanding rather than machine - understanding (see the 'text' and 'name' attribute syntaxes in - Sections 4.1.1 and 4.1.2). - - In each operation request, the client - - - identifies the charset and natural language of the request which - affects each supplied 'text' and 'name' attribute value, and - - requests the charset and natural language for attributes returned - by the IPP object in operation responses (as described in Section - 3.1.4.1). - - - - - -deBry, et al. Experimental [Page 121] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - In addition, the client MAY separately and individually identify the - Natural Language Override of a supplied 'text' or 'name' attribute - using the 'textWithLanguage' and 'nameWithLanguage' technique - described section 4.1.1.2 and 4.1.2.2 respectively. - - All IPP objects MUST support the UTF-8 [RFC2279] charset in all ' - text' and 'name' attributes supported. If an IPP object supports - more than the UTF-8 charset, the object MUST convert between them in - order to return the requested charset to the client according to - Section 3.1.4.2. If an IPP object supports more than one natural - language, the object SHOULD return 'text' and 'name' values in the - natural language requested where those values are generated by the - Printer (see Section 3.1.4.1). - - For Printers that support multiple charsets and/or multiple natural - languages in 'text' and 'name' attributes, different jobs may have - been submitted in differing charsets and/or natural languages. All - responses MUST be returned in the charset requested by the client. - However, the Get-Jobs operation uses the 'textWithLanguage' and ' - nameWithLanguage' mechanism to identify the differing natural - languages with each job attribute returned. - - The Printer object also has configured charset and natural language - attributes. The client can query the Printer object to determine - the list of charsets and natural languages supported by the Printer - object and what the Printer object's configured values are. See the - "charset-configured", "charset-supported", "natural-language- - configured", and "generated-natural-language-supported" Printer - description attributes for more details. - - The "charset-supported" attributed identifies the supported charsets. - If a charset is supported, the IPP object MUST be capable of - converting to and from that charset into any other supported charset. - In many cases, an IPP object will support only one charset and it - MUST be the UTF-8 charset. - - The "charset-configured" attribute identifies the one supported - charset which is the native charset given the current configuration - of the IPP object (administrator defined). - - The "generated-natural-language-supported" attribute identifies the - set of supported natural languages for generated messages; it is not - related to the set of natural languages that must be accepted for - client supplied 'text' and 'name' attributes. For client supplied ' - text' and 'name' attributes, an IPP object MUST accept ALL supplied - natural languages. Just because a Printer object is currently - - - - - -deBry, et al. Experimental [Page 122] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - configured to support 'en-us' natural language does not mean that the - Printer object should reject a job if the client supplies a job name - that is in 'fr-ca'. - - The "natural-language-configured" attribute identifies the one - supported natural language for generated messages which is the native - natural language given the current configuration of the IPP object - (administrator defined). - - Attributes of type 'text' and 'name' are populated from different - sources. These attributes can be categorized into following groups - (depending on the source of the attribute): - - 1. Some attributes are supplied by the client (e.g., the client - supplied "job-name", "document-name", and "requesting-user-name" - operation attributes along with the corresponding Job object's - "job-name" and "job-originating-user-name" attributes). The IPP - object MUST accept these attributes in any natural language no - matter what the set of supported languages for generated - messages - 2. Some attributes are supplied by the system administrator (e.g., - the Printer object's "printer-name" and "printer-location" - attributes). These too can be in any natural language. If the - natural language for these attributes is different than what a - client requests, then they must be reported using the Natural - Language Override mechanism. - 3. Some attributes are supplied by the device manufacturer (e.g., - the Printer object's "printer-make-and-model" attribute). These - too can be in any natural language. If the natural language for - these attributes is different than what a client requests, then - they must be reported using the Natural Language Override - mechanism. - 4. Some attributes are supplied by the operator (e.g., the Job - object's "job-message-from-operator" attribute). These too can - be in any natural language. If the natural language for these - attributes is different than what a client requests, then they - must be reported using the Natural Language Override mechanism. - 5. Some attributes are generated by the IPP object (e.g., the Job - object's "job-state-message" attribute, the Printer object's - "printer-state-message" attribute, and the "status-message" - operation attribute). These attributes can only be in one of - the "generated-natural-language-supported" natural languages. - If a client requests some natural language for these attributes - other than one of the supported values, the IPP object SHOULD - respond using the value of the "natural-language-configured" - attribute (using the Natural Language Override mechanism if - needed). - - - - -deBry, et al. Experimental [Page 123] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - The 'text' and 'name' attributes specified in this version of this - document (additional ones will be registered according to the - procedures in Section 6) are: - - Attributes Source - -------------------------- ---------- - Operation Attributes - job-name (name) client - document-name (name) client - requesting-user-name (name) client - status-message Job or Printer object - - Job Template Attributes: - job-hold-until) client matches administrator-configured - (keyword | name - job-hold-until-default client matches administrator-configured - (keyword | name) - job-hold-until-supported client matches administrator-configured - (keyword | name) - job-sheets client matches administrator-configured - (keyword | name) - job-sheets-default client matches administrator-configured - (keyword | name) - job-sheets-supported client matches administrator-configured - (keyword | name) - media client matches administrator-configured - (keyword | name) - media-default client matches administrator-configured - (keyword | name) - media-supported client matches administrator-configured - (keyword | name) - media-ready client matches administrator-configured - (keyword | name) - - Job Description Attributes: - job-name (name) client or Printer object - job-originating-user-name (name) Printer object - job-state-message (text) Job or Printer object - output-device-assigned (name(127)) administrator - job-message-from-operator (text(127)) operator - - Printer Description Attributes: - printer-name (name(127)) administrator - printer-location (text(127)) administrator - printer-info (text(127)) administrator - printer-make-and-model (text(127)) administrator or manufacturer - printer-state-message (text) Printer object - printer-message-from-operator (text(127)) operator - - - -deBry, et al. Experimental [Page 124] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -8. Security Considerations - - Some IPP objects MAY be deployed over protocol stacks that support - Secure Socket Layer Version 3 (SSL3) [SSL]. Note: SSL3 is not an - IETF standards track specification. Other IPP objects MAY be - deployed over protocol stacks that do not support SSL3. Some IPP - objects MAY be deployed over both types of protocol stacks. Those - IPP objects that support SSL3, are capable of supporting mutual - authentication as well as privacy of messages via multiple encryption - schemes. An important point about security related information for - SSL3 access to an IPP object, is that the security-related parameters - (authentication, encryption keys, etc.) are "out-of-band" to the - actual IPP protocol. - - An IPP object that does not support SSL3 MAY elect to support a - transport layer that provides other security mechanisms. For - example, in a mapping of IPP over HTTP/1.1 [RFC2565], if the IPP - object does not support SSL3, HTTP still allows for client - authentication using Digest Access Authentication (DAA) [RFC2069]. - - It is difficult to anticipate the security risks that might exist in - any given IPP environment. For example, if IPP is used within a given - corporation over a private network, the risks of exposing document - data may be low enough that the corporation will choose not to use - encryption on that data. However, if the connection between the - client and the IPP object is over a public network, the client may - wish to protect the content of the information during transmission - through the network with encryption. - - Furthermore, the value of the information being printed may vary from - one IPP environment to the next. Printing payroll checks, for - example, would have a different value than printing public - information from a file. There is also the possibly of denial-of- - service attacks, but denial-of-service attacks against printing - resources are not well understood and there is no published - precedents regarding this scenario. - - Once the authenticated identity of the requester has been supplied to - the IPP object, the object uses that identity to enforce any - authorization policy that might be in place. For example, one site's - policy might be that only the job owner is allowed to cancel a job. - The details and mechanisms to set up a particular access control - policy are not part of IPP/1.0, and must be established via some - other type of administrative or access control framework. However, - there are operation status codes that allow an IPP server to return - information back to a client about any potential access control - violations for an IPP object. - - - - -deBry, et al. Experimental [Page 125] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - During a create operation, the client's identity is recorded in the - Job object in an implementation-defined attribute. This information - can be used to verify a client's identity for subsequent operations - on that Job object in order to enforce any access control policy that - might be in effect. See section 8.3 below for more details. - - Since the security levels or the specific threats that any given IPP - system administrator may be concerned with cannot be anticipated, IPP - MUST be capable of operating with different security mechanisms and - security policies as required by the individual installation. - Security policies might vary from very strong, to very weak, to none - at all, and corresponding security mechanisms will be required. SSL3 - supports the type of negotiated levels of security required by most, - if not all, potential IPP environments. IPP environments that require - no security can elect to deploy IPP objects that do not utilize the - optional SSL3 security mechanisms. - -8.1 Security Scenarios - - The following sections describe specific security attacks for IPP - environments. Where examples are provided they should be considered - illustrative of the environment and not an exhaustive set. Not all of - these environments will necessarily be addressed in initial - implementations of IPP. - -8.1.1 Client and Server in the Same Security Domain - - This environment is typical of internal networks where traditional - office workers print the output of personal productivity applications - on shared work-group printers, or where batch applications print - their output on large production printers. Although the identity of - the user may be trusted in this environment, a user might want to - protect the content of a document against such attacks as - eavesdropping, replaying or tampering. - -8.1.2 Client and Server in Different Security Domains - - Examples of this environment include printing a document created by - the client on a publicly available printer, such as at a commercial - print shop; or printing a document remotely on a business associate's - printer. This latter operation is functionally equivalent to sending - the document to the business associate as a facsimile. Printing - sensitive information on a Printer in a different security domain - requires strong security measures. In this environment authentication - of the printer is required as well as protection against unauthorized - use of print resources. Since the document crosses security domains, - - - - - -deBry, et al. Experimental [Page 126] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - protection against eavesdropping and document tampering are also - required. It will also be important in this environment to protect - Printers against "spamming" and malicious document content. - -8.1.3 Print by Reference - - When the document is not stored on the client, printing can be done - by reference. That is, the print request can contain a reference, or - pointer, to the document instead of the actual document itself. - Standard methods currently do not exist for remote entities to - "assume" the credentials of a client for forwarding requests to a 3rd - party. It is anticipated that Print-By-Reference will be used to - access "public" documents and that sophisticated methods for - authenticating "proxies" will not be specified for version 1 of IPP. - -8.2 URIs for SSL3 and non-SSL3 Access - - As described earlier, an IPP object can support SSL3 access, non-SSL3 - access, or both. The "printer-uri-supported" attribute contains the - Printer object's URI(s). Its companion attribute, "uri-security- - supported", identifies the security mechanism used for each URI - listed in the "printer-uri-supported" attribute. For each Printer - operation request, a client MUST supply only one URI in the - "printer-uri" operation attribute. In other words, even though the - Printer supports more than one URI, the client only interacts with - the Printer object using one if its URIs. This duality is not needed - for Job objects, since the Printer objects is the factory for Job - objects, and the Printer object will generate the correct URI for new - Job objects depending on the Printer object's security configuration. - -8.3 The "requesting-user-name" (name(MAX)) Operation Attribute - - Each operation MUST specify the user who is performing the operation - in both of the following two ways: - - 1) via the REQUIRED "requesting-user-name" operation attribute that - a client SHOULD supply in all operations. The client MUST obtain - the value for this attribute from an environmental or network - login name for the user, rather than allowing the user to supply - any value. If the client does not supply a value for - "requesting-user-name", the printer MUST assume that the client - is supplying some anonymous name, such as "anonymous". - 2) via an authentication mechanism of the underlying transport - which may be configured to give no authentication information. - - - - - - - -deBry, et al. Experimental [Page 127] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - There are six cases to consider: - - a) the authentication mechanism gives no information, and the - client doesn't specify "requesting-user-name". - b) the authentication mechanism gives no information, but the - client specifies "requesting-user-name". - c) the authentication mechanism specifies a user which has no human - readable representation, and the client doesn't specify - "requesting-user-name". - d) the authentication mechanism specifies a user which has no human - readable representation, but the client specifies "requesting- - user-name". - e) the authentication mechanism specifies a user which has a human - readable representation. The Printer object ignores the - "requesting-user-name". - f) the authentication mechanism specifies a user who is trusted and - whose name means that the value of the "requesting-user-name", - which MUST be present, is treated as the authenticated name. - - Note: Case "f" is intended for a tightly coupled gateway and server - to work together so that the "user" name is able to be that of the - gateway client and not that of the gateway. Because most, if not - all, system vendors will initially implement IPP via a gateway into - their existing print system, this mechanism is necessary unless the - authentication mechanism allows a gateway (client) to act on behalf - of some other client. - - The user-name has two forms: - - - one that is human readable: it is held in the REQUIRED "job- - originating-user-name" Job Description attribute which is set - during the job creation operations. It is used for presentation - only, such as returning in queries or printing on start sheets - - one for authorization: it is held in an undefined (by IPP) Job - object attribute which is set by the job creation operation. It - is used to authorize other operations, such as Send-Document, - Send-URI, Cancel-Job, to determine the user when the "my-jobs" - attribute is specified with Get-Jobs, and to limit what - attributes and values to return with Get-Job-Attributes and Get- - Jobs. - - The human readable user name: - - - is the value of the "requesting-user-name" for cases b, d and f. - - comes from the authentication mechanism for case e - - is some anonymous name, such as "anonymous" for cases a and c. - - The user name used for authorization: - - - -deBry, et al. Experimental [Page 128] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - - is the value of the "requesting-user-name" for cases b and f. - - comes from the authentication mechanism for cases c, d and e - - is some anonymous name, such as "anonymous" for case a. - - The essence of these rules for resolving conflicting sources of - user-names is that a printer implementation is free to pick either - source as long as it achieves consistent results. That is, if a user - uses the same path for a series of requests, the requests MUST appear - to come from the same user from the standpoint of both the human- - readable user name and the user name for authorization. This rule - MUST continue to apply even if a request could be authenticated by - two or more mechanisms. It doesn't matter which of several - authentication mechanisms a Printer uses as long as it achieves - consistent results. If a client uses more than one authentication - mechanism, it is recommended that an administrator make all - credentials resolve to the same user and user-name as much as - possible. - -8.4 Restricted Queries - - In many IPP operations, a client supplies a list of attributes to be - returned in the response. For security reasons, an IPP object may be - configured not to return all attributes (or all values) that a client - requests. The job attributes returned MAY depend on whether the - requesting user is the same as the user that submitted the job. The - IPP object MAY even return none of the requested attributes. In such - cases, the status returned is the same as if the object had returned - all requested attributes. The client cannot tell by such a response - whether the requested attribute was present or absent on the object. - -8.5 Queries on jobs submitted using non-IPP protocols - - If the device that an IPP Printer is representing is able to accept - jobs using other job submission protocols in addition to IPP, it is - RECOMMENDED that such an implementation at least allow such "foreign" - jobs to be queried using Get-Jobs returning "job-id" and "job-uri" as - 'unknown'. Such an implementation NEED NOT support all of the same - IPP job attributes as for IPP jobs. The IPP object returns the ' - unknown' out-of-band value for any requested attribute of a foreign - job that is supported for IPP jobs, but not for foreign jobs. - - It is further RECOMMENDED, that the IPP Printer generate "job-id" and - "job-uri" values for such "foreign jobs", if possible, so that they - may be targets of other IPP operations, such as Get-Job-Attributes - and Cancel-Job. Such an implementation also needs to deal with the - problem of authentication of such foreign jobs. One approach would - be to treat all such foreign jobs as belonging to users other than - the user of the IPP client. Another approach would be for the - - - -deBry, et al. Experimental [Page 129] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - foreign job to belong to 'anonymous'. Only if the IPP client has - been authenticated as an operator or administrator of the IPP Printer - object, could the foreign jobs be queried by an IPP request. - Alternatively, if the security policy is to allow users to query - other users' jobs, then the foreign jobs would also be visible to an - end-user IPP client using Get-Jobs and Get-Job-Attributes. - -8.6 IPP Security Application Profile for SSL3 - - The IPP application profile for SSL3 follows the "Secure Socket - Layer" requirement as documented in the SSL3 specification [SSL]. - For interoperability, the SSL3 cipher suites are: - - SSL_RSA_WITH_RC4_128_MD5 - SSL_RSA_WITH_3DES_EDE_CBC_SHA - SSL_RSA_WITH_DES_CBC_SHA - SSL_RSA_EXPORT_WITH_RC4_40_MD5 - SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5 - SSL_RSA_WITH_NULL_MD5 - - Client implementations MUST NOT assume any other cipher suites are - supported by an IPP Printer object. - - If a conforming IPP object supports SSL3, it MUST implement and - support the cipher suites listed above and MAY support additional - cipher suites. - - A conforming IPP client SHOULD support SSL3 including the cipher - suites listed above. A conforming IPP client MAY support additional - cipher suites. - - It is possible that due to certain government export restrictions - some non-compliant versions of this extension could be deployed. - Implementations wishing to inter-operate with such non-compliant - versions MAY offer the SSL_RSA_EXPORT_WITH_RC4_40_MD5 and - SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5 mechanisms. However, since 40 bit - ciphers are known to be vulnerable to attack by current technology, - any client which actives a 40 bit cipher MUST NOT indicate to the - user that the connection is completely secure from eavesdropping. - - - - - - - - - - - - -deBry, et al. Experimental [Page 130] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -9. References - - [ASCII] Coded Character Set - 7-bit American Standard Code for - Information Interchange (ASCII), ANSI X3.4-1986. This - standard is the specification of the US-ASCII charset. - - [HTPP] J. Barnett, K. Carter, R. DeBry, "Initial Draft - - Hypertext Printing Protocol - HTPP/1.0", October 1996. - ftp://ftp.pwg.org/pub/pwg/ipp/historic/htpp/ - overview.ps.gz - - [IANA-CS] IANA Registry of Coded Character Sets: - ftp://ftp.isi.edu/in-notes/iana/assignments/character- - sets - - [IANA-MT] IANA Registry of Media Types: ftp://ftp.isi.edu/in- - notes/iana/assignments/media-types/ - - [ipp-iig] Hastings, T. and C. Manros, "Internet Printing - Protocol/1.0: Implementer's Guide", Work in Progress. - - [ISO10646-1] ISO/IEC 10646-1:1993, "Information technology -- - Universal Multiple-Octet Coded Character Set (UCS) - - Part 1: Architecture and Basic Multilingual Plane, - JTC1/SC2." - - [ISO8859-1] ISO/IEC 8859-1:1987, "Information technology -- 8-bit - One-Byte Coded Character Set - Part 1: Latin Alphabet Nr - 1", 1987, JTC1/SC2. - - [ISO10175] ISO/IEC 10175 Document Printing Application (DPA), June - 1996. - - [LDPA] T. Hastings, S. Isaacson, M. MacKay, C. Manros, D. Taylor, P. - Zehler, "LDPA - Lightweight Document Printing - Application", October 1996, - ftp://ftp.pwg.org/pub/pwg/ipp/historic/ldpa/ldpa8.pdf.gz - - [P1387.4] Kirk, M. (Editor), POSIX System Administration - Part 4: - Printing Interfaces, POSIX 1387.4 D8, 1994. - - [PSIS] Herriot, R. (editor), X/Open A Printing System - Interoperability Specification (PSIS), August 1995. - - [PWG] Printer Working Group, http://www.pwg.org. - - [RFC1035] Mockapetris, P., "DOMAIN NAMES - IMPLEMENTATION AND - SPECIFICATION", STD 13, RFC 1035, November 1987. - - - -deBry, et al. Experimental [Page 131] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - [RFC1759] Smith, R., Wright, F., Hastings, T., Zilles, S. and J. - Gyllenskog, "Printer MIB", RFC 1759, March 1995. - - [RFC1766] Alvestrand, H., "Tags for the Identification of - Languages", RFC 1766, March 1995. - - [RFC1179] McLaughlin, L. (Editor), "Line Printer Daemon Protocol", - RFC 1179, August 1990. - - [RFC1952] Deutsch, P., "GZIP file format specification version - 4.3", RFC 1952, May 1996. - - [RFC2045] Freed, N. and N. Borenstein, " Multipurpose Internet - Mail Extensions (MIME) Part One: Format of Internet - Message Bodies", RFC 2045, November 1996. - - [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail - Extensions (MIME) Part Two: Media Types", RFC 2046, - November 1996. - - [RFC2048] Freed, N., Klensin, J. and J. Postel, "Multipurpose - Internet Mail Extension (MIME) Part Four: Registration - Procedures", RFC 2048, November 1996. - - [RFC2068] Fielding, R., Gettys, J., Mogul, J., Frystyk, H. AND T. - Berners-Lee, "Hypertext Transfer Protocol - HTTP/1.1", - RFC 2068, January 1997. - - [RFC2069] Franks, J., Hallam-Baker, P., Hostetler, J., Leach, P., - Luotonen, A., Sink, E. and L. Stewart, "An Extension to - HTTP: Digest Access Authentication", RFC 2069, January - 1997. - - [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate - Requirement Levels", BCP 14, RFC 2119, March 1997. - - [RFC2228] Horowitz, M. and S. Lunt, "FTP Security Extensions", RFC - 2228, October 1997. - - [RFC2277] Alvestrand, H., "IETF Policy on Character Sets and - Languages" RFC 2277, January 1998. - - [RFC2278] Freed, N. and J. Postel: "IANA Charset Registration - Procedures", BCP 19, RFC 2278, January 1998. - - [RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO - 10646", RFC 2279, January 1998. - - - - -deBry, et al. Experimental [Page 132] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - [RFC2316] Bellovin, S., "Report of the IAB Security Architecture - Workshop", RFC 2316, April 1998. - - [RFC2396] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform - Resource Identifiers (URI): Generic Syntax", RFC 2396, - August 1998. - - [RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an - IANA Considerations Section in RFCs", BCP 26, RFC 2434, - October 1998. - - [RFC2565] Herriot, R., Butler, S., Moore, P. and R. Tuner - "Internet Printing Protocol/1.0: Encoding and - Transport", RFC 2565, April 1999. - - [RFC2567] Wright, D., "Design Goals for an Internet Printing - Protocol", RFC 2567, April 1999. - - [RFC2568] Zilles, S., "Rationale for the Structure and Model and - Protocol for the Internet Printing Protocol", RFC 2568, - April 1999. - - [RFC2569] Herriot, R., Hastings, T., Jacobs, N. and J. Martin, - "Mapping between LPD and IPP Protocols", RFC 2569, April - 1999. - - [RFC2579] McCloghrie, K., Perkins, D. and J. Schoenwaelder, - "Textual Conventions for SMIv2", STD 58, RFC 2579, April - 1999. - - [SSL] Netscape, The SSL Protocol, Version 3, (Text version - 3.02), November 1996. - - [SWP] P. Moore, B. Jahromi, S. Butler, "Simple Web Printing - SWP/1.0", May 7, 1997, - ftp://ftp.pwg.org/pub/pwg/ipp/new_PRO/swp9705.pdf - - - - - - - - - - - - - - - -deBry, et al. Experimental [Page 133] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -10. Authors' Addresses - - Scott A. Isaacson (Editor) - Novell, Inc. - 122 E 1700 S - Provo, UT 84606 - - Phone: 801-861-7366 - Fax: 801-861-2517 - EMail: sisaacson@novell.com - - - Tom Hastings - Xerox Corporation - 737 Hawaii St. - El Segundo, CA 90245 - - Phone: 310-333-6413 - Fax: 310-333-5514 - EMail: hastings@cp10.es.xerox.com - - - Robert Herriot - Xerox Corporation - 3400 Hillview Ave., Bldg #1 - Palo Alto, CA 94304 - - Phone: 650-813-7696 - Fax: 650-813-6860 - EMail: robert.herriot@pahv.xerox.com - - - Roger deBry - Utah Valley State College - Orem, UT 84058 - - Phone: (801) 222-8000 - EMail: debryro@uvsc.edu - - - - - - - - - - - - - -deBry, et al. Experimental [Page 134] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Patrick Powell - Astart Technologies - 9475 Chesapeake Dr., Suite D - San Diego, CA 95123 - - Phone: (619) 874-6543 - Fax: (619) 279-8424 - EMail: papowell@astart.com - - IPP Mailing List: ipp@pwg.org - IPP Mailing List Subscription: ipp-request@pwg.org - IPP Web Page: http://www.pwg.org/ipp/ - - Implementers of this specification are encouraged to join IPP Mailing - List in order to participate in any discussions of clarification - issues and review of registration proposals for additional attributes - and values. - - Other Participants: - - Chuck Adams - Tektronix - Jeff Barnett - IBM - Ron Bergman - Dataproducts Corp. - Sylvan Butler - HP - Keith Carter - IBM Corporation - Jeff Copeland - QMS - Andy Davidson - Tektronix - Mabry Dozier - QMS - Lee Farrell - Canon Information Systems - Steve Gebert - IBM - Babek Jahromi - Microsoft - David Kellerman - Northlake Software - Rick Landau - Digital - Greg LeClair - Epson - Harry Lewis - IBM - Pete Loya - HP - Ray Lutz - Cognisys - Mike MacKay - Novell, Inc. - Daniel Manchala - Xerox - Carl-Uno Manros - Xerox - Jay Martin - Underscore - Larry Masinter - Xerox - Stan McConnell - Xerox - Ira McDonald - High North Inc. - Paul Moore - Microsoft - Tetsuya Morita - Ricoh - Yuichi Niwa - Ricoh - Pat Nogay - IBM - - - -deBry, et al. Experimental [Page 135] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Ron Norton - Printronics - Bob Pentecost - HP - Rob Rhoads - Intel - Xavier Riley - Xerox - David Roach - Unisys - Stuart Rowley - Kyocera - Hiroyuki Sato - Canon - Bob Setterbo - Adobe - Devon Taylor - Novell, Inc. - Mike Timperman - Lexmark - Randy Turner - Sharp - Atsushi Yuki - Kyocera - Rick Yardumian - Xerox - Lloyd Young - Lexmark - Bill Wagner - DPI - Jim Walker - DAZEL - Chris Wellens - Interworking Labs - Rob Whittle - Novell, Inc. - Don Wright - Lexmark - Peter Zehler - Xerox - Steve Zilles - Adobe - -11. Formats for IPP Registration Proposals - - In order to propose an IPP extension for registration, the proposer - must submit an application to IANA by email to "iana@iana.org" or by - filling out the appropriate form on the IANA web pages - (http://www.iana.org). This section specifies the required - information and the formats for proposing registrations of extensions - to IPP as provided in Section 6 for: - - 1. type2 'keyword' attribute values - 2. type3 'keyword' attribute values - 3. type2 'enum' attribute values - 4. type3 'enum' attribute values - 5. attributes - 6. attribute syntaxes - 7. operations - 8. status codes - -11.1 Type2 keyword attribute values registration - - Type of registration: type2 keyword attribute value - Name of attribute to which this keyword specification is to be added: - Proposed keyword name of this keyword value: - Specification of this keyword value (follow the style of IPP Model - Section 4.1.2.3): - Name of proposer: - - - -deBry, et al. Experimental [Page 136] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Address of proposer: - Email address of proposer: - - Note: For type2 keywords, the Designated Expert will be the point of - contact for the approved registration specification, if any - maintenance of the registration specification is needed. - -11.2 Type3 keyword attribute values registration - - Type of registration: type3 keyword attribute value - Name of attribute to which this keyword specification is to be added: - Proposed keyword name of this keyword value: - Specification of this keyword value (follow the style of IPP Model - Section 4.1.2.3): - Name of proposer: - Address of proposer: - Email address of proposer: - - Note: For type3 keywords, the proposer will be the point of contact - for the approved registration specification, if any maintenance of - the registration specification is needed. - -11.3 Type2 enum attribute values registration - - Type of registration: type2 enum attribute value - Name of attribute to which this enum specification is to be added: - Keyword symbolic name of this enum value: - Numeric value (to be assigned by the IPP Designated Expert in - consultation with IANA): - Specification of this enum value (follow the style of IPP Model - Section 4.1.4): - Name of proposer: - Address of proposer: - Email address of proposer: - - Note: For type2 enums, the Designated Expert will be the point of - contact for the approved registration specification, if any - maintenance of the registration specification is needed. - -11.4 Type3 enum attribute values registration - - Type of registration: type3 enum attribute value - Name of attribute to which this enum specification is to be added: - Keyword symbolic name of this enum value: - Numeric value (to be assigned by the IPP Designated Expert in - consultation with IANA): - Specification of this enum value (follow the style of IPP Model - Section 4.1.4): - - - -deBry, et al. Experimental [Page 137] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Name of proposer: - Address of proposer: - Email address of proposer: - - Note: For type3 enums, the proposer will be the point of contact for - the approved registration specification, if any maintenance of the - registration specification is needed. - -11.5 Attribute registration - - Type of registration: attribute - Proposed keyword name of this attribute: - Types of attribute (Operation, Job Template, Job Description, - Printer Description): - Operations to be used with if the attribute is an operation - attribute: - Object (Job, Printer, etc. if bound to an object): - Attribute syntax(es) (include 1setOf and range as in Section 4.2): - If attribute syntax is 'keyword' or 'enum', is it type2 or type3: - If this is a Printer attribute, MAY the value returned depend on - "document-format" (See Section 6.2): - If this is a Job Template attribute, how does its specification - depend on the value of the "multiple-document-handling" attribute: - Specification of this attribute (follow the style of IPP Model - Section 4.2): - Name of proposer: - Address of proposer: - Email address of proposer: - - Note: For attributes, the IPP Designated Expert will be the point of - contact for the approved registration specification, if any - maintenance of the registration specification is needed. - -11.6 Attribute Syntax registration - - Type of registration: attribute syntax - Proposed name of this attribute syntax: - Type of attribute syntax (integer, octetString, character-string, - see [RFC2565]): - Numeric value (to be assigned by the IPP Designated Expert in - consultation with IANA): - Specification of this attribute (follow the style of IPP Model - Section 4.1): - Name of proposer: - Address of proposer: - Email address of proposer: - - - - - -deBry, et al. Experimental [Page 138] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Note: For attribute syntaxes, the IPP Designated Expert will be the - point of contact for the approved registration specification, if any - maintenance of the registration specification is needed. - -11.7 Operation registration - - Type of registration: operation - Proposed name of this operation: - Numeric operation-id value (to be assigned by the IPP Designated - Expert in consultation with IANA): - Object Target (Job, Printer, etc. that operation is upon): - Specification of this attribute (follow the style of IPP Model - Section 3): - Name of proposer: - Address of proposer: - Email address of proposer: - - Note: For operations, the IPP Designated Expert will be the point of - contact for the approved registration specification, if any - maintenance of the registration specification is needed. - -11.8 Attribute Group registration - - Type of registration: attribute group - Proposed name of this attribute group: - Numeric tag according to [RFC2565] (to be assigned by the IPP - Designated Expert in consultation with IANA): - Operation requests and group number for each operation in which the - attribute group occurs: - Operation responses and group number for each operation in which the - attribute group occurs: - Specification of this attribute group (follow the style of IPP Model - Section 3): - Name of proposer: - Address of proposer: - Email address of proposer: - - Note: For attribute groups, the IPP Designated Expert will be the - point of contact for the approved registration specification, if any - maintenance of the registration specification is needed. - -11.9 Status code registration - - Type of registration: status code - Keyword symbolic name of this status code value: - Numeric value (to be assigned by the IPP Designated Expert in - consultation with IANA): - Operations that this status code may be used with: - - - -deBry, et al. Experimental [Page 139] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - Specification of this status code (follow the style of IPP Model - Section 14 APPENDIX B: Status Codes and Suggested Status Code - Messages): - Name of proposer: - Address of proposer: - Email address of proposer: - - Note: For status codes, the Designated Expert will be the point of - contact for the approved registration specification, if any - maintenance of the registration specification is needed. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -deBry, et al. Experimental [Page 140] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -12. APPENDIX A: Terminology - - This specification uses the terminology defined in this section. - -12.1 Conformance Terminology - - The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", - "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be - interpreted as described in RFC 2119 [RFC2119]. - -12.1.1 NEED NOT - - This term is not included in RFC 2119. The verb "NEED NOT" indicates - an action that the subject of the sentence does not have to implement - in order to claim conformance to the standard. The verb "NEED NOT" - is used instead of "MAY NOT" since "MAY NOT" sounds like a - prohibition. - -12.2 Model Terminology - -12.2.1 Keyword - - Keywords are used within this document as identifiers of semantic - entities within the abstract model (see section 4.1.2.3). Attribute - names, some attribute values, attribute syntaxes, and attribute group - names are represented as keywords. - -12.2.2 Attributes - - An attribute is an item of information that is associated with an - instance of an IPP object. An attribute consists of an attribute - name and one or more attribute values. Each attribute has a specific - attribute syntax. All object attributes are defined in section 4 and - all operation attributes are defined in section 3. - - Job Template Attributes are described in section 4.2. The client - optionally supplies Job Template attributes in a create request - (operation requests that create Job objects). The Printer object has - associated attributes which define supported and default values for - the Printer. - -12.2.2.1 Attribute Name - - Each attribute is uniquely identified in this document by its - attribute name. An attribute name is a keyword. The keyword - attribute name is given in the section header describing that - - - - - -deBry, et al. Experimental [Page 141] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - attribute. In running text in this document, attribute names are - indicated inside double quotation marks (") where the quotation marks - are not part of the keyword itself. - -12.2.2.2 Attribute Group Name - - Related attributes are grouped into named groups. The name of the - group is a keyword. The group name may be used in place of naming - all the attributes in the group explicitly. Attribute groups are - defined in section 3. - -12.2.2.3 Attribute Value - - Each attribute has one or more values. Attribute values are - represented in the syntax type specified for that attribute. In - running text in this document, attribute values are indicated inside - single quotation marks ('), whether their attribute syntax is - keyword, integer, text, etc. where the quotation marks are not part - of the value itself. - -12.2.2.4 Attribute Syntax - - Each attribute is defined using an explicit syntax type. In this - document, each syntax type is defined as a keyword with specific - meaning. The Encoding and Transport document [RFC2565] indicates the - actual "on-the-wire" encoding rules for each syntax type. Attribute - syntax types are defined in section 4.1. - -12.2.3 Supports - - By definition, a Printer object supports an attribute only if that - Printer object responds with the corresponding attribute populated - with some value(s) in a response to a query for that attribute. A - Printer object supports an attribute value if the value is one of the - Printer object's "supported values" attributes. The device behind a - Printer object may exhibit a behavior that corresponds to some IPP - attribute, but if the Printer object, when queried for that - attribute, doesn't respond with the attribute, then as far as IPP is - concerned, that implementation does not support that feature. If the - Printer object's "xxx-supported" attribute is not populated with a - particular value (even if that value is a legal value for that - attribute), then that Printer object does not support that particular - value. - - A conforming implementation MUST support all REQUIRED attributes. - However, even for REQUIRED attributes, conformance to IPP does not - mandate that all implementations support all possible values - representing all possible job processing behaviors and features. For - - - -deBry, et al. Experimental [Page 142] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - example, if a given instance of a Printer supports only certain - document formats, then that Printer responds with the "document- - format-supported" attribute populated with a set of values, possibly - only one, taken from the entire set of possible values defined for - that attribute. This limited set of values represents the Printer's - set of supported document formats. Supporting an attribute and some - set of values for that attribute enables IPP end users to be aware of - and make use of those features associated with that attribute and - those values. If an implementation chooses to not support an - attribute or some specific value, then IPP end users would have no - ability to make use of that feature within the context of IPP itself. - However, due to existing practice and legacy systems which are not - IPP aware, there might be some other mechanism outside the scope of - IPP to control or request the "unsupported" feature (such as embedded - instructions within the document data itself). - - For example, consider the "finishings-supported" attribute. - - 1) If a Printer object is not physically capable of stapling, the - "finishings-supported" attribute MUST NOT be populated with the - value of 'staple'. - 2) A Printer object is physically capable of stapling, however an - implementation chooses not to support stapling in the IPP - "finishings" attribute. In this case, 'staple' MUST NOT be a - value in the "finishings-supported" Printer object attribute. - Without support for the value 'staple', an IPP end user would - have no means within the protocol itself to request that a Job - be stapled. However, an existing document data formatter might - be able to request that the document be stapled directly with an - embedded instruction within the document data. In this case, - the IPP implementation does not "support" stapling, however the - end user is still able to have some control over the stapling of - the completed job. - 3) A Printer object is physically capable of stapling, and an - implementation chooses to support stapling in the IPP - "finishings" attribute. In this case, 'staple' MUST be a value - in the "finishings-supported" Printer object attribute. Doing - so, would enable end users to be aware of and make use of the - stapling feature using IPP attributes. - - Even though support for Job Template attributes by a Printer object - is OPTIONAL, it is RECOMMENDED that if the device behind a Printer - object is capable of realizing any feature or function that - corresponds to an IPP attribute and some associated value, then that - implementation SHOULD support that IPP attribute and value. - - - - - - -deBry, et al. Experimental [Page 143] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - The set of values in any of the supported value attributes is set - (populated) by some administrative process or automatic sensing - mechanism that is outside the scope of IPP. For administrative - policy and control reasons, an administrator may choose to make only - a subset of possible values visible to the end user. In this case, - the real output device behind the IPP Printer abstraction may be - capable of a certain feature, however an administrator is specifying - that access to that feature not be exposed to the end user through - the IPP protocol. Also, since a Printer object may represent a - logical print device (not just a physical device) the actual process - for supporting a value is undefined and left up to the - implementation. However, if a Printer object supports a value, some - manual human action may be needed to realize the semantic action - associated with the value, but no end user action is required. - - For example, if one of the values in the "finishings-supported" - attribute is 'staple', the actual process might be an automatic - staple action by a physical device controlled by some command sent to - the device. Or, the actual process of stapling might be a manual - action by an operator at an operator attended Printer object. - - For another example of how supported attributes function, consider a - system administrator who desires to control all print jobs so that no - job sheets are printed in order to conserve paper. To force no job - sheets, the system administrator sets the only supported value for - the "job-sheets-supported" attribute to 'none'. In this case, if a - client requests anything except 'none', the create request is - rejected or the "job-sheets" value is ignored (depending on the value - of "ipp-attribute-fidelity"). To force the use of job start/end - sheets on all jobs, the administrator does not include the value ' - none' in the "job-sheets-supported" attribute. In this case, if a - client requests 'none', the create request is rejected or the "job- - sheets" value is ignored (again depending on the value of "ipp- - attribute-fidelity"). - -12.2.4 print-stream page - - A "print-stream page" is a page according to the definition of pages - in the language used to express the document data. - -12.2.5 impression - - An "impression" is the image (possibly many print-stream pages in - different configurations) imposed onto a single media page. - - - - - - - -deBry, et al. Experimental [Page 144] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -13. APPENDIX B: Status Codes and Suggested Status Code Messages - - This section defines status code enum keywords and values that are - used to provide semantic information on the results of an operation - request. Each operation response MUST include a status code. The - response MAY also contain a status message that provides a short - textual description of the status. The status code is intended for - use by automata, and the status message is intended for the human end - user. Since the status message is an OPTIONAL component of the - operation response, an IPP application (i.e., a browser, GUI, print - driver or gateway) is NOT REQUIRED to examine or display the status - message, since it MAY not be returned to the application. - - The prefix of the status keyword defines the class of response as - follows: - - "informational" - Request received, continuing process - "successful" - The action was successfully received, understood, - and accepted - "redirection" - Further action must be taken in order to complete - the request - "client-error" - The request contains bad syntax or cannot be - fulfilled - "server-error" - The IPP object failed to fulfill an apparently - valid request - - As with type2 enums, IPP status codes are extensible. IPP clients - are NOT REQUIRED to understand the meaning of all registered status - codes, though such understanding is obviously desirable. However, - IPP clients MUST understand the class of any status code, as - indicated by the prefix, and treat any unrecognized response as being - equivalent to the first status code of that class, with the exception - that an unrecognized response MUST NOT be cached. For example, if an - unrecognized status code of "client-error-xxx-yyy" is received by the - client, it can safely assume that there was something wrong with its - request and treat the response as if it had received a "client- - error-bad-request" status code. In such cases, IPP applications - SHOULD present the OPTIONAL message (if present) to the end user - since the message is likely to contain human readable information - which will help to explain the unusual status. The name of the enum - is the suggested status message for US English. - - The status code values range from 0x0000 to 0x7FFF. The value ranges - for each status code class are as follows: - - "successful" - 0x0000 to 0x00FF - "informational" - 0x0100 to 0x01FF - "redirection" - 0x0200 to 0x02FF - - - -deBry, et al. Experimental [Page 145] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - "client-error" - 0x0400 to 0x04FF - "server-error" - 0x0500 to 0x05FF - - The top half (128 values) of each range (0x0n40 to 0x0nFF, for n = 0 - to 5) is reserved for private use within each status code class. - Values 0x0600 to 0x7FFF are reserved for future assignment and MUST - NOT be used. - -13.1 Status Codes - - Each status code is described below. Section 13.1.5.9 contains a - table that indicates which status codes apply to which operations. - The Implementer's Guide [ipp-iig] describe the suggested steps for - processing IPP attributes for all operations, including returning - status codes. - -13.1.1 Informational - - This class of status code indicates a provisional response and is to - be used for informational purposes only. - - There are no status codes defined in IPP/1.0 for this class of status - code. - -13.1.2 Successful Status Codes - - This class of status code indicates that the client's request was - successfully received, understood, and accepted. - -13.1.2.1 successful-ok (0x0000) - - The request has succeeded and no request attributes were substituted - or ignored. In the case of a response to a create request, the ' - successful-ok' status code indicates that the request was - successfully received and validated, and that the Job object has been - created; it does not indicate that the job has been processed. The - transition of the Job object into the 'completed' state is the only - indicator that the job has been printed. - -13.1.2.2 successful-ok-ignored-or-substituted-attributes (0x0001) - - The request has succeeded, but some supplied (1) attributes were - ignored or (2) unsupported values were substituted with supported - values or were ignored in order to perform the operation without - rejecting it. Unsupported attributes, attribute syntaxes, or values - MUST be returned in the Unsupported Attributes group of the response - for all operations. There is an exception to this rule for the query - operations: Get-Printer-Attributes, Get-Jobs, and Get-Job-Attributes - - - -deBry, et al. Experimental [Page 146] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - for the "requested-attributes" operation attribute only. When the - supplied values of the "requested-attributes" operation attribute are - requesting attributes that are not supported, the IPP object MAY, but - is NOT REQUIRED to, return the "requested-attributes" attribute in - the Unsupported Attribute response group (with the unsupported values - only). See section 3.2.1.2. - -13.1.2.3 successful-ok-conflicting-attributes (0x0002) - - The request has succeeded, but some supplied attribute values - conflicted with the values of other supplied attributes. These - conflicting values were either (1) substituted with (supported) - values or (2) the attributes were removed in order to process the job - without rejecting it. Attributes or values which conflict with other - attributes and have been substituted or ignored MUST be returned in - the Unsupported Attributes group of the response for all operations - as supplied by the client. See section 3.2.1.2. - -13.1.3 Redirection Status Codes - - This class of status code indicates that further action needs to be - taken to fulfill the request. - - There are no status codes defined in IPP/1.0 for this class of status - code. - -13.1.4 Client Error Status Codes - - This class of status code is intended for cases in which the client - seems to have erred. The IPP object SHOULD return a message - containing an explanation of the error situation and whether it is a - temporary or permanent condition. - -13.1.4.1 client-error-bad-request (0x0400) - - The request could not be understood by the IPP object due to - malformed syntax (such as the value of a fixed length attribute whose - length does not match the prescribed length for that attribute - see - the Implementer's Guide [ipp-iig] ). The IPP application SHOULD NOT - repeat the request without modifications. - -13.1.4.2 client-error-forbidden (0x0401) - - The IPP object understood the request, but is refusing to fulfill it. - Additional authentication information or authorization credentials - will not help and the request SHOULD NOT be repeated. This status - - - - - -deBry, et al. Experimental [Page 147] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - code is commonly used when the IPP object does not wish to reveal - exactly why the request has been refused or when no other response is - applicable. - -13.1.4.3 client-error-not-authenticated (0x0402) - - The request requires user authentication. The IPP client may repeat - the request with suitable authentication information. If the request - already included authentication information, then this status code - indicates that authorization has been refused for those credentials. - If this response contains the same challenge as the prior response, - and the user agent has already attempted authentication at least - once, then the response message may contain relevant diagnostic - information. This status codes reveals more information than - "client-error-forbidden". - -13.1.4.4 client-error-not-authorized (0x0403) - - The requester is not authorized to perform the request. Additional - authentication information or authorization credentials will not help - and the request SHOULD NOT be repeated. This status code is used - when the IPP object wishes to reveal that the authentication - information is understandable, however, the requester is explicitly - not authorized to perform the request. This status codes reveals - more information than "client-error-forbidden" and "client-error- - not-authenticated". - -13.1.4.5 client-error-not-possible (0x0404) - - This status code is used when the request is for something that can - not happen. For example, there might be a request to cancel a job - that has already been canceled or aborted by the system. The IPP - client SHOULD NOT repeat the request. - -13.1.4.6 client-error-timeout (0x0405) - - The client did not produce a request within the time that the IPP - object was prepared to wait. For example, a client issued a Create- - Job operation and then, after a long period of time, issued a Send- - Document operation and this error status code was returned in - response to the Send-Document request (see section 3.3.1). The IPP - object might have been forced to clean up resources that had been - held for the waiting additional Documents. The IPP object was forced - to close the Job since the client took too long. The client SHOULD - NOT repeat the request without modifications. - - - - - - -deBry, et al. Experimental [Page 148] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -13.1.4.7 client-error-not-found (0x0406) - - The IPP object has not found anything matching the request URI. No - indication is given of whether the condition is temporary or - permanent. For example, a client with an old reference to a Job (a - URI) tries to cancel the Job, however in the mean time the Job might - have been completed and all record of it at the Printer has been - deleted. This status code, 'client-error-not-found' is returned - indicating that the referenced Job can not be found. This error - status code is also used when a client supplies a URI as a reference - to the document data in either a Print-URI or Send-URI operation, but - the document can not be found. - - In practice, an IPP application should avoid a not found situation by - first querying and presenting a list of valid Printer URIs and Job - URIs to the end-user. - -13.1.4.8 client-error-gone (0x0407) - - The requested object is no longer available and no forwarding address - is known. This condition should be considered permanent. Clients - with link editing capabilities should delete references to the - request URI after user approval. If the IPP object does not know or - has no facility to determine, whether or not the condition is - permanent, the status code "client-error-not-found" should be used - instead. - - This response is primarily intended to assist the task of maintenance - by notifying the recipient that the resource is intentionally - unavailable and that the IPP object administrator desires that remote - links to that resource be removed. It is not necessary to mark all - permanently unavailable resources as "gone" or to keep the mark for - any length of time -- that is left to the discretion of the IPP - object administrator. - -13.1.4.9 client-error-request-entity-too-large (0x0408) - - The IPP object is refusing to process a request because the request - entity is larger than the IPP object is willing or able to process. - An IPP Printer returns this status code when it limits the size of - print jobs and it receives a print job that exceeds that limit or - when the attributes are so many that their encoding causes the - request entity to exceed IPP object capacity. - - - - - - - - -deBry, et al. Experimental [Page 149] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -13.1.4.10 client-error-request-value-too-long (0x0409) - - The IPP object is refusing to service the request because one or more - of the client-supplied attributes has a variable length value that is - longer than the maximum length specified for that attribute. The IPP - object might not have sufficient resources (memory, buffers, etc.) to - process (even temporarily), interpret, and/or ignore a value larger - than the maximum length. Another use of this error code is when the - IPP object supports the processing of a large value that is less than - the maximum length, but during the processing of the request as a - whole, the object may pass the value onto some other system component - which is not able to accept the large value. For more details, see - the Implementer's Guide [ipp-iig] . - - Note: For attribute values that are URIs, this rare condition is - only likely to occur when a client has improperly submitted a request - with long query information (e.g. an IPP application allows an end- - user to enter an invalid URI), when the client has descended into a - URI "black hole" of redirection (e.g., a redirected URI prefix that - points to a suffix of itself), or when the IPP object is under attack - by a client attempting to exploit security holes present in some IPP - objects using fixed-length buffers for reading or manipulating the - Request-URI. - -13.1.4.11 client-error-document-format-not-supported (0x040A) - - The IPP object is refusing to service the request because the - document data is in a format, as specified in the "document-format" - operation attribute, that is not supported by the Printer object. - This error is returned independent of the client-supplied "ipp- - attribute-fidelity". The Printer object MUST return this status - code, even if there are other attributes that are not supported as - well, since this error is a bigger problem than with Job Template - attributes. - -13.1.4.12 client-error-attributes-or-values-not-supported (0x040B) - - In a create request, if the Printer object does not support one or - more attributes, attribute syntaxes, or attribute values supplied in - the request and the client supplied the "ipp-attributes-fidelity" - operation attribute with the 'true' value, the Printer object MUST - return this status code. For example, if the request indicates ' - iso-a4' media, but that media type is not supported by the Printer - object. Or, if the client supplies an optional attribute and the - attribute itself is not even supported by the Printer. If the "ipp- - attribute-fidelity" attribute is 'false', the Printer MUST ignore or - substitute values for unsupported attributes and values rather than - reject the request and return this status code. - - - -deBry, et al. Experimental [Page 150] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - For any operation where a client requests attributes (such as a Get- - Jobs, Get-Printer-Attributes, or Get-Job-Attributes operation), if - the IPP object does not support one or more of the requested - attributes, the IPP object simply ignores the unsupported requested - attributes and processes the request as if they had not been - supplied, rather than returning this status code. In this case, the - IPP object MUST return the 'successful-ok-ignored-or-substituted- - attributes' status code and MAY return the unsupported attributes as - values of the "requested-attributes" in the Unsupported Attributes - Group (see section 13.1.2.2). - -13.1.4.13 client-error-uri-scheme-not-supported (0x040C) - - The type of the client supplied URI in a Print-URI or a Send-URI - operation is not supported. - -13.1.4.14 client-error-charset-not-supported (0x040D) - - For any operation, if the IPP Printer does not support the charset - supplied by the client in the "attributes-charset" operation - attribute, the Printer MUST reject the operation and return this - status and any 'text' or 'name' attributes using the 'utf-8' charset - (see Section 3.1.4.1). - -13.1.4.15 client-error-conflicting-attributes (0x040E) - - The request is rejected because some attribute values conflicted with - the values of other attributes which this specification does not - permit to be substituted or ignored. - -13.1.5 Server Error Status Codes - - This class of status codes indicates cases in which the IPP object is - aware that it has erred or is incapable of performing the request. - The IPP object SHOULD include a message containing an explanation of - the error situation, and whether it is a temporary or permanent - condition. - -13.1.5.1 server-error-internal-error (0x0500) - - The IPP object encountered an unexpected condition that prevented it - from fulfilling the request. This error status code differs from - "server-error-temporary-error" in that it implies a more permanent - type of internal error. It also differs from "server-error-device- - error" in that it implies an unexpected condition (unlike a paper-jam - or out-of-toner problem which is undesirable but expected). This - error status code indicates that probably some knowledgeable human - intervention is required. - - - -deBry, et al. Experimental [Page 151] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -13.1.5.2 server-error-operation-not-supported (0x0501) - - The IPP object does not support the functionality required to fulfill - the request. This is the appropriate response when the IPP object - does not recognize an operation or is not capable of supporting it. - -13.1.5.3 server-error-service-unavailable (0x0502) - - The IPP object is currently unable to handle the request due to a - temporary overloading or maintenance of the IPP object. The - implication is that this is a temporary condition which will be - alleviated after some delay. If known, the length of the delay may be - indicated in the message. If no delay is given, the IPP application - should handle the response as it would for a "server-error- - temporary-error" response. If the condition is more permanent, the - error status codes "client-error-gone" or "client-error-not-found" - could be used. - -13.1.5.4 server-error-version-not-supported (0x0503) - - The IPP object does not support, or refuses to support, the IPP - protocol version that was used in the request message. The IPP - object is indicating that it is unable or unwilling to complete the - request using the same version as supplied in the request other than - with this error message. The response should contain a Message - describing why that version is not supported and what other versions - are supported by that IPP object. - - A conforming IPP/1.0 client MUST specify the valid version ('1.0') on - each request. A conforming IPP/1.0 object MUST NOT return this - status code to a conforming IPP/1.0 client. An IPP object MUST - return this status code to a non-conforming IPP client. The response - MUST identify in the "version-number" operation attribute the closest - version number that the IPP object does support. - -13.1.5.5 server-error-device-error (0x0504) - - A printer error, such as a paper jam, occurs while the IPP object - processes a Print or Send operation. The response contains the true - Job Status (the values of the "job-state" and "job-state-reasons" - attributes). Additional information can be returned in the optional - "job-state-message" attribute value or in the OPTIONAL status message - that describes the error in more detail. This error status code is - only returned in situations where the Printer is unable to accept the - create request because of such a device error. For example, if the - Printer is unable to spool, and can only accept one job at a time, - the reason it might reject a create request is that the printer - currently has a paper jam. In many cases however, where the Printer - - - -deBry, et al. Experimental [Page 152] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - object can accept the request even though the Printer has some error - condition, the 'successful-ok' status code will be returned. In such - a case, the client would look at the returned Job Object Attributes - or later query the Printer to determine its state and state reasons. - -13.1.5.6 server-error-temporary-error (0x0505) - - A temporary error such as a buffer full write error, a memory - overflow (i.e. the document data exceeds the memory of the Printer), - or a disk full condition, occurs while the IPP Printer processes an - operation. The client MAY try the unmodified request again at some - later point in time with an expectation that the temporary internal - error condition may have been cleared. Alternatively, as an - implementation option, a Printer object MAY delay the response until - the temporary condition is cleared so that no error is returned. - -13.1.5.7 server-error-not-accepting-jobs (0x0506) - - A temporary error indicating that the Printer is not currently - accepting jobs, because the administrator has set the value of the - Printer's "printer-is-not-accepting-jobs" attribute to 'false' (by - means outside of IPP/1.0). - -13.1.5.8 server-error-busy (0x0507) - - A temporary error indicating that the Printer is too busy processing - jobs and/or other requests. The client SHOULD try the unmodified - request again at some later point in time with an expectation that - the temporary busy condition will have been cleared. - -13.1.5.9 server-error-job-canceled (0x0508) - - An error indicating that the job has been canceled by an operator or - the system while the client was transmitting the data to the IPP - Printer. If a job-id and job-uri had been created, then they are - returned in the Print-Job, Send-Document, or Send-URI response as - usual; otherwise, no job-id and job-uri are returned in the response. - -13.2 Status Codes for IPP Operations - - PJ = Print-Job, PU = Print-URI, CJ = Create-Job, SD = Send-Document - SU = Send-URI, V = Validate-Job, GA = Get-Job-Attributes and - Get-Printer-Attributes, GJ = Get-Jobs, C = Cancel-Job - - - - - - - - -deBry, et al. Experimental [Page 153] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - IPP Operations - IPP Status Keyword PJ PU CJ SD SU V GA GJ C - ------------------ -- -- -- -- -- - -- -- - - successful-ok x x x x x x x x x - successful-ok-ignored-or-substituted- x x x x x x x x x - attributes - successful-ok-conflicting-attributes x x x x x x x x x - client-error-bad-request x x x x x x x x x - client-error-forbidden x x x x x x x x x - client-error-not-authenticated x x x x x x x x x - client-error-not-authorized x x x x x x x x x - client-error-not-possible x x x x x x x x x - client-error-timeout x x - client-error-not-found x x x x x x x x x - client-error-gone x x x x x x x x x - client-error-request-entity-too-large x x x x x x x x x - client-error-request-value-too-long x x x x x x x x x - client-error-document-format-not- x x x x x x - supported - client-error-attributes-or-values-not- x x x x x x x x x - supported - client-error-uri-scheme-not-supported x x - client-error-charset-not-supported x x x x x x x x x - client-error-conflicting-attributes x x x x x x x x x - server-error-internal-error x x x x x x x x x - server-error-operation-not-supported x x x x - server-error-service-unavailable x x x x x x x x x - server-error-version-not-supported x x x x x x x x x - server-error-device-error x x x x x - server-error-temporary-error x x x x x - server-error-not-accepting-jobs x x x x - server-error-busy x x x x x x x x x - server-error-job-canceled x x - - - - - - - - - - - - - - - - - - -deBry, et al. Experimental [Page 154] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -14. APPENDIX C: "media" keyword values - - Standard keyword values are taken from several sources. - - Standard values are defined (taken from DPA[ISO10175] and the Printer - MIB[RFC1759]): - - 'default': The default medium for the output device - 'iso-a4-white': Specifies the ISO A4 white medium - 'iso-a4-colored': Specifies the ISO A4 colored medium - 'iso-a4-transparent' Specifies the ISO A4 transparent medium - 'iso-a3-white': Specifies the ISO A3 white medium - 'iso-a3-colored': Specifies the ISO A3 colored medium - 'iso-a5-white': Specifies the ISO A5 white medium - 'iso-a5-colored': Specifies the ISO A5 colored medium - 'iso-b4-white': Specifies the ISO B4 white medium - 'iso-b4-colored': Specifies the ISO B4 colored medium - 'iso-b5-white': Specifies the ISO B5 white medium - 'iso-b5-colored': Specifies the ISO B5 colored medium - 'jis-b4-white': Specifies the JIS B4 white medium - 'jis-b4-colored': Specifies the JIS B4 colored medium - 'jis-b5-white': Specifies the JIS B5 white medium - 'jis-b5-colored': Specifies the JIS B5 colored medium - - The following standard values are defined for North American media: - - 'na-letter-white': Specifies the North American letter white medium - 'na-letter-colored': Specifies the North American letter colored - medium - 'na-letter-transparent': Specifies the North American letter - transparent medium - 'na-legal-white': Specifies the North American legal white medium - 'na-legal-colored': Specifies the North American legal colored - medium - - The following standard values are defined for envelopes: - - 'iso-b4-envelope': Specifies the ISO B4 envelope medium - 'iso-b5-envelope': Specifies the ISO B5 envelope medium - 'iso-c3-envelope': Specifies the ISO C3 envelope medium - 'iso-c4-envelope': Specifies the ISO C4 envelope medium - 'iso-c5-envelope': Specifies the ISO C5 envelope medium - 'iso-c6-envelope': Specifies the ISO C6 envelope medium - 'iso-designated-long-envelope': Specifies the ISO Designated Long - envelope medium - 'na-10x13-envelope': Specifies the North American 10x13 envelope - medium - - - - -deBry, et al. Experimental [Page 155] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 'na-9x12-envelope': Specifies the North American 9x12 envelope - medium - 'monarch-envelope': Specifies the Monarch envelope - 'na-number-10-envelope': Specifies the North American number 10 - business envelope medium - 'na-7x9-envelope': Specifies the North American 7x9 inch envelope - 'na-9x11-envelope': Specifies the North American 9x11 inch envelope - 'na-10x14-envelope': Specifies the North American 10x14 inch - envelope - 'na-number-9-envelope': Specifies the North American number 9 - business envelope - 'na-6x9-envelope': Specifies the North American 6x9 inch envelope - 'na-10x15-envelope': Specifies the North American 10x15 inch - envelope - - The following standard values are defined for the less commonly used - media (white-only): - - 'executive-white': Specifies the white executive medium - 'folio-white': Specifies the folio white medium - 'invoice-white': Specifies the white invoice medium - 'ledger-white': Specifies the white ledger medium - 'quarto-white': Specified the white quarto medium - 'iso-a0-white': Specifies the ISO A0 white medium - 'iso-a1-white': Specifies the ISO A1 white medium - 'iso-a2-white': Specifies the ISO A2 white medium - 'iso-a6-white': Specifies the ISO A6 white medium - 'iso-a7-white': Specifies the ISO A7 white medium - 'iso-a8-white': Specifies the ISO A8 white medium - 'iso-a9-white': Specifies the ISO A9 white medium - 'iso-10-white': Specifies the ISO A10 white medium - 'iso-b0-white': Specifies the ISO B0 white medium - 'iso-b1-white': Specifies the ISO B1 white medium - 'iso-b2-white': Specifies the ISO B2 white medium - 'iso-b3-white': Specifies the ISO B3 white medium - 'iso-b6-white': Specifies the ISO B6 white medium - 'iso-b7-white': Specifies the ISO B7 white medium - 'iso-b8-white': Specifies the ISO B8 white medium - 'iso-b9-white': Specifies the ISO B9 white medium - 'iso-b10-white': Specifies the ISO B10 white medium - 'jis-b0-white': Specifies the JIS B0 white medium - 'jis-b1-white': Specifies the JIS B1 white medium - 'jis-b2-white': Specifies the JIS B2 white medium - 'jis-b3-white': Specifies the JIS B3 white medium - 'jis-b6-white': Specifies the JIS B6 white medium - 'jis-b7-white': Specifies the JIS B7 white medium - - - - - -deBry, et al. Experimental [Page 156] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 'jis-b8-white': Specifies the JIS B8 white medium - 'jis-b9-white': Specifies the JIS B9 white medium - 'jis-b10-white': Specifies the JIS B10 white medium - - - The following standard values are defined for engineering media: - - 'a': Specifies the engineering A size medium - 'b': Specifies the engineering B size medium - 'c': Specifies the engineering C size medium - 'd': Specifies the engineering D size medium - 'e': Specifies the engineering E size medium - - - The following standard values are defined for input-trays (from ISO - DPA and the Printer MIB): - - 'top': The top input tray in the printer. - 'middle': The middle input tray in the printer. - 'bottom': The bottom input tray in the printer. - 'envelope': The envelope input tray in the printer. - 'manual': The manual feed input tray in the printer. - 'large-capacity': The large capacity input tray in the printer. - 'main': The main input tray - 'side': The side input tray - - - The following standard values are defined for media sizes (from ISO - DPA): - - 'iso-a0': Specifies the ISO A0 size: 841 mm by 1189 mm as defined - in ISO 216 - 'iso-a1': Specifies the ISO A1 size: 594 mm by 841 mm as defined in - ISO 216 - 'iso-a2': Specifies the ISO A2 size: 420 mm by 594 mm as defined in - ISO 216 - 'iso-a3': Specifies the ISO A3 size: 297 mm by 420 mm as defined in - ISO 216 - 'iso-a4': Specifies the ISO A4 size: 210 mm by 297 mm as defined in - ISO 216 - 'iso-a5': Specifies the ISO A5 size: 148 mm by 210 mm as defined in - ISO 216 - 'iso-a6': Specifies the ISO A6 size: 105 mm by 148 mm as defined in - ISO 216 - 'iso-a7': Specifies the ISO A7 size: 74 mm by 105 mm as defined in - ISO 216 - 'iso-a8': Specifies the ISO A8 size: 52 mm by 74 mm as defined in - ISO 216 - - - -deBry, et al. Experimental [Page 157] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 'iso-a9': Specifies the ISO A9 size: 37 mm by 52 mm as defined in - ISO 216 - 'iso-a10': Specifies the ISO A10 size: 26 mm by 37 mm as defined in - ISO 216 - 'iso-b0': Specifies the ISO B0 size: 1000 mm by 1414 mm as defined - in ISO 216 - 'iso-b1': Specifies the ISO B1 size: 707 mm by 1000 mm as defined - in ISO 216 - 'iso-b2': Specifies the ISO B2 size: 500 mm by 707 mm as defined in - ISO 216 - 'iso-b3': Specifies the ISO B3 size: 353 mm by 500 mm as defined in - ISO 216 - 'iso-b4': Specifies the ISO B4 size: 250 mm by 353 mm as defined in - ISO 216 - 'iso-b5': Specifies the ISO B5 size: 176 mm by 250 mm as defined in - ISO 216 - 'iso-b6': Specifies the ISO B6 size: 125 mm by 176 mm as defined in - ISO 216 - 'iso-b7': Specifies the ISO B7 size: 88 mm by 125 mm as defined in - ISO 216 - 'iso-b8': Specifies the ISO B8 size: 62 mm by 88 mm as defined in - ISO 216 - 'iso-b9': Specifies the ISO B9 size: 44 mm by 62 mm as defined in - ISO 216 - 'iso-b10': Specifies the ISO B10 size: 31 mm by 44 mm as defined in - ISO 216 - 'na-letter': Specifies the North American letter size: 8.5 inches by - 11 inches - 'na-legal': Specifies the North American legal size: 8.5 inches by - 14 inches - 'executive': Specifies the executive size (7.25 X 10.5 in) - 'folio': Specifies the folio size (8.5 X 13 in) - 'invoice': Specifies the invoice size (5.5 X 8.5 in) - 'ledger': Specifies the ledger size (11 X 17 in) - 'quarto': Specifies the quarto size (8.5 X 10.83 in) - 'iso-c3': Specifies the ISO C3 size: 324 mm by 458 mm as defined in - ISO 269 - 'iso-c4': Specifies the ISO C4 size: 229 mm by 324 mm as defined in - ISO 269 - 'iso-c5': Specifies the ISO C5 size: 162 mm by 229 mm as defined in - ISO 269 - 'iso-c6': Specifies the ISO C6 size: 114 mm by 162 mm as defined in - ISO 269 - 'iso-designated-long': Specifies the ISO Designated Long size: 110 - mm by 220 mm as defined in ISO 269 - 'na-10x13-envelope': Specifies the North American 10x13 size: 10 - inches by 13 inches - - - - -deBry, et al. Experimental [Page 158] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 'na-9x12-envelope': Specifies the North American 9x12 size: 9 - inches by 12 inches - 'na-number-10-envelope': Specifies the North American number 10 - business envelope size: 4.125 inches by 9.5 inches - 'na-7x9-envelope': Specifies the North American 7x9 inch envelope - size - 'na-9x11-envelope': Specifies the North American 9x11 inch envelope - size - 'na-10x14-envelope': Specifies the North American 10x14 inch - envelope size - 'na-number-9-envelope': Specifies the North American number 9 - business envelope size - 'na-6x9-envelope': Specifies the North American 6x9 envelope size - 'na-10x15-envelope': Specifies the North American 10x15 envelope - size - 'monarch-envelope': Specifies the Monarch envelope size (3.87 x 7.5 - in) - 'jis-b0': Specifies the JIS B0 size: 1030mm x 1456mm - 'jis-b1': Specifies the JIS B1 size: 728mm x 1030mm - 'jis-b2': Specifies the JIS B2 size: 515mm x 728mm - 'jis-b3': Specifies the JIS B3 size: 364mm x 515mm - 'jis-b4': Specifies the JIS B4 size: 257mm x 364mm - 'jis-b5': Specifies the JIS B5 size: 182mm x 257mm - 'jis-b6': Specifies the JIS B6 size: 128mm x 182mm - 'jis-b7': Specifies the JIS B7 size: 91mm x 128mm - 'jis-b8': Specifies the JIS B8 size: 64mm x 91mm - 'jis-b9': Specifies the JIS B9 size: 45mm x 64mm - 'jis-b10': Specifies the JIS B10 size: 32mm x 45mm - - - - - - - - - - - - - - - - - - - - - - - -deBry, et al. Experimental [Page 159] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -15. APPENDIX D: Processing IPP Attributes - - When submitting a print job to a Printer object, the IPP model allows - a client to supply operation and Job Template attributes along with - the document data. These Job Template attributes in the create - request affect the rendering, production and finishing of the - documents in the job. Similar types of instructions may also be - contained in the document to be printed, that is, embedded within the - print data itself. In addition, the Printer has a set of attributes - that describe what rendering and finishing options which are - supported by that Printer. This model, which allows for flexibility - and power, also introduces the potential that at job submission time, - these client-supplied attributes may conflict with either: - - - what the implementation is capable of realizing (i.e., what the - Printer supports), as well as - - the instructions embedded within the print data itself. - - The following sections describe how these two types of conflicts are - handled in the IPP model. - -15.1 Fidelity - - If there is a conflict between what the client requests and what a - Printer object supports, the client may request one of two possible - conflict handling mechanisms: - - 1) either reject the job since the job can not be processed exactly - as specified, or - 2) allow the Printer to make any changes necessary to proceed with - processing the Job the best it can. - - In the first case the client is indicating to the Printer object: - "Print the job exactly as specified with no exceptions, and if that - can't be done, don't even bother printing the job at all." In the - second case, the client is indicating to the Printer object: "It is - more important to make sure the job is printed rather than be - processed exactly as specified; just make sure the job is printed - even if client supplied attributes need to be changed or ignored." - - The IPP model accounts for this situation by introducing an "ipp- - attribute-fidelity" attribute. - - In a create request, "ipp-attribute-fidelity" is a boolean operation - attribute that is OPTIONALLY supplied by the client. The value ' - true' indicates that total fidelity to client supplied Job Template - attributes and values is required. The client is requesting that the - Job be printed exactly as specified, and if that is not possible then - - - -deBry, et al. Experimental [Page 160] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - the job MUST be rejected rather than processed incorrectly. The - value 'false' indicates that a reasonable attempt to print the Job is - acceptable. If a Printer does not support some of the client - supplied Job Template attributes or values, the Printer MUST ignore - them or substitute any supported value for unsupported values, - respectively. The Printer may choose to substitute the default value - associated with that attribute, or use some other supported value - that is similar to the unsupported requested value. For example, if - a client supplies a "media" value of 'na-letter', the Printer may - choose to substitute 'iso-a4' rather than a default value of ' - envelope'. If the client does not supply the "ipp-attribute-fidelity" - attribute, the Printer assumes a value of 'false'. - - Each Printer implementation MUST support both types of "fidelity" - printing (that is whether the client supplies a value of 'true' or ' - false'): - - - If the client supplies 'false' or does not supply the attribute, - the Printer object MUST always accept the request by ignoring - unsupported Job Template attributes and by substituting - unsupported values of supported Job Template attributes with - supported values. - - If the client supplies 'true', the Printer object MUST reject the - request if the client supplies unsupported Job Template - attributes. - - Since a client can always query a Printer to find out exactly what is - and is not supported, "ipp-attribute-fidelity" set to 'false' is - useful when: - - 1) The End-User uses a command line interface to request attributes - that might not be supported. - 2) In a GUI context, if the End User expects the job might be moved - to another printer and prefers a sub-optimal result to nothing - at all. - 3) The End User just wants something reasonable in lieu of nothing - at all. - -15.2 Page Description Language (PDL) Override - - If there is a conflict between the value of an IPP Job Template - attribute and a corresponding instruction in the document data, the - value of the IPP attribute SHOULD take precedence over the document - instruction. Consider the case where a previously formatted file of - document data is sent to an IPP Printer. In this case, if the client - supplies any attributes at job submission time, the client desires - that those attributes override the embedded instructions. Consider - the case were a previously formatted document has embedded in it - - - -deBry, et al. Experimental [Page 161] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - commands to load 'iso-a4' media. However, the document is passed to - an end user that only has access to a printer with 'na-letter' media - loaded. That end user most likely wants to submit that document to - an IPP Printer with the "media" Job Template attribute set to 'na- - letter'. The job submission attribute should take precedence over - the embedded PDL instruction. However, until companies that supply - document data interpreters allow a way for external IPP attributes to - take precedence over embedded job production instructions, a Printer - might not be able to support the semantics that IPP attributes - override the embedded instructions. - - The IPP model accounts for this situation by introducing a "pdl- - override-supported" attribute that describes the Printer objects - capabilities to override instructions embedded in the PDL data - stream. The value of the "pdl-override-supported" attribute is - configured by means outside IPP/1.0. - - This REQUIRED Printer attribute takes on the following values: - - - 'attempted': This value indicates that the Printer object - attempts to make the IPP attribute values take precedence over - embedded instructions in the document data, however there is no - guarantee. - - 'not-attempted': This value indicates that the Printer object - makes no attempt to make the IPP attribute values take precedence - over embedded instructions in the document data. - - At job processing time, an implementation that supports the value of - 'attempted' might do one of several different actions: - - 1) Generate an output device specific command sequence to realize - the feature represented by the IPP attribute value. - 2) Parse the document data itself and replace the conflicting - embedded instruction with a new embedded instruction that - matches the intent of the IPP attribute value. - 3) Indicate to the Printer that external supplied attributes take - precedence over embedded instructions and then pass the external - IPP attribute values to the document data interpreter. - 4) Anything else that allows for the semantics that IPP attributes - override embedded document data instructions. - - Since 'attempted' does not offer any type of guarantee, even though a - given Printer object might not do a very "good" job of attempting to - ensure that IPP attributes take a higher precedence over instructions - embedded in the document data, it would still be a conforming - implementation. - - - - - -deBry, et al. Experimental [Page 162] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - At job processing time, an implementation that supports the value of - 'not-attempted' might do one of the following actions: - - 1) Simply pre-pend the document data with the PDL instruction that - corresponds to the client-supplied PDL attribute, such that if - the document data also has the same PDL instruction, it will - override what the Printer object pre-pended. In other words, - this implementation is using the same implementation semantics - for the client-supplied IPP attributes as for the Printer object - defaults. - 2) Parse the document data and replace the conflicting embedded - instruction with a new embedded instruction that approximates, - but does not match, the semantic intent of the IPP attribute - value. - - Note: The "ipp-attribute-fidelity" attribute applies to the - Printer's ability to either accept or reject other unsupported Job - Template attributes. In other words, if "ipp-attribute-fidelity" is - set to 'true', a Job is accepted if and only if the client supplied - Job Template attributes and values are supported by the Printer. - Whether these attributes actually affect the processing of the Job - when the document data contains embedded instructions depends on the - ability of the Printer to override the instructions embedded in the - document data with the semantics of the IPP attributes. If the - document data attributes can be overridden ("pdl-override-supported" - set to 'attempted'), the Printer makes an attempt to use the IPP - attributes when processing the Job. If the document data attributes - can not be overridden ("pdl-override-supported" set to 'not- - attempted'), the Printer makes no attempt to override the embedded - document data instructions with the IPP attributes when processing - the Job, and hence, the IPP attributes may fail to affect the Job - processing and output when the corresponding instruction is embedded - in the document data. - -15.3 Using Job Template Attributes During Document Processing. - - The Printer object uses some of the Job object's Job Template - attributes during the processing of the document data associated with - that job. These include, but are not limited to, "orientation", - "number-up", "sides", "media", and "copies". The processing of each - document in a Job Object MUST follow the steps below. These steps are - intended only to identify when and how attributes are to be used in - processing document data and any alternative steps that accomplishes - the same effect can be used to implement this specification. - - 1. Using the client supplied "document-format" attribute or some - form of document format detection algorithm (if the value of - "document- format" is not specific enough), determine whether or - - - -deBry, et al. Experimental [Page 163] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - not the document data has already been formatted for printing. - If the document data has been formatted, then go to step 2. - Otherwise, the document data MUST be formatted. The formatting - detection algorithm is implementation defined and is not - specified by this specification. The formatting of the document - data uses the "orientation-requested" attribute to determine how - the formatted print data should be placed on a print-stream - page, see section 4.2.10 for the details. - - 2. The document data is in the form of a print-stream in a known - media type. The "page-ranges" attribute is used to select, as - specified in section 4.2.7, a sub-sequence of the pages in the - print-stream that are to be processed and images. - - 3. The input to this step is a sequence of print-stream pages. This - step is controlled by the "number-up" attribute. If the value of - "number-up" is N, then during the processing of the print-stream - pages, each N print-stream pages are positioned, as specified in - section 4.2.9, to create a single impression. If a given - document does not have N more print-stream pages, then the - completion of the impression is controlled by the "multiple- - document-handling" attribute as described in section 4.2.4; when - the value of this attribute is 'single-document' or 'single- - document-new-sheet', the print-stream pages of document data - from subsequent documents is used to complete the impression. - - The size(scaling), position(translation) and rotation of the - print-stream pages on the impression is implementation defined. - Note that during this process the print-stream pages may be - rendered to a form suitable for placing on the impression; this - rendering is controlled by the values of the "printer- - resolution" and "print- quality" attributes as described in - sections 4.2.12 and 4.2.13. In the case N=1, the impression is - nearly the same as the print-stream page; the differences would - only be in the size, position and rotation of the print-stream - page and/or any decoration, such as a frame to the page, that is - added by the implementation. - - 4. The collection of impressions is placed, in sequence, onto sides - of the media sheets. This placement is controlled by the "sides" - attribute and the orientation of the print-stream page, as - described in section 4.2.8. The orientation of the print-stream - pages affects the orientation of the impression; for example, if - "number-up" equals 2, then, typically, two portrait print-stream - pages become one landscape impression. Note that the placement - of impressions onto media sheets is also controlled by the - "multiple-document-handling" attribute as described in section - 4.2.4. - - - -deBry, et al. Experimental [Page 164] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 5. The "copies" and "multiple-document-handling" attributes are - used to determine how many copies of each media instance are - created and in what order. See sections 4.2.5 and 4.2.4 for the - details. - - 6. When the correct number of copies are created, the media - instances are finished according to the values of the - "finishings" attribute as described in 4.2.6. Note that - sometimes finishing operations may require manual intervention - to perform the finishing operations on the copies, especially - uncollated copies. This specification allows any or all of the - processing steps to be performed automatically or manually at - the discretion of the Printer object. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -deBry, et al. Experimental [Page 165] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -16. APPENDIX E: Generic Directory Schema - - This section defines a generic schema for an entry in a directory - service. A directory service is a means by which service users can - locate service providers. In IPP environments, this means that IPP - Printers can be registered (either automatically or with the help of - an administrator) as entries of type printer in the directory using - an implementation specific mechanism such as entry attributes, entry - type fields, specific branches, etc. IPP clients can search or - browse for entries of type printer. Clients use the directory - service to find entries based on naming, organizational contexts, or - filtered searches on attribute values of entries. For example, a - client can find all printers in the "Local Department" context. - Authentication and authorization are also often part of a directory - service so that an administrator can place limits on end users so - that they are only allowed to find entries to which they have certain - access rights. IPP itself does not require any specific directory - service protocol or provider. - - Note: Some directory implementations allow for the notion of - "aliasing". That is, one directory entry object can appear as - multiple directory entry object with different names for each object. - In each case, each alias refers to the same directory entry object - which refers to a single IPP Printer object. - - The generic schema is a subset of IPP Printer Job Template and - Printer Description attributes (sections 4.2 and 4.4). These - attributes are identified as either RECOMMENDED or OPTIONAL for the - directory entry itself. This conformance labeling is NOT the same - conformance labeling applied to the attributes of IPP Printers - objects. The conformance labeling in this Appendix is intended to - apply to directory templates and to IPP Printer implementations that - subscribe by adding one or more entries to a directory. RECOMMENDED - attributes SHOULD be associated with each directory entry. OPTIONAL - attributes MAY be associated with the directory entry (if known or - supported). In addition, all directory entry attributes SHOULD - reflect the current attribute values for the corresponding Printer - object. - - The names of attributes in directory schema and entries SHOULD be the - same as the IPP Printer attribute names as shown. - - In order to bridge between the directory service and the IPP Printer - object, one of the RECOMMENDED directory entry attributes is the - Printer object's "printer-uri-supported" attribute. The IPP client - queries the "printer-uri-supported" attribute in the directory entry - - - - - -deBry, et al. Experimental [Page 166] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - and then addresses the IPP Printer object using one of its URIs. The - "uri-security-supported" attribute identifies the protocol (if any) - used to secure a channel. - - The following attributes define the generic schema for directory - entries of type PRINTER: - - printer-uri-supported RECOMMENDED Section 4.4.1 - uri-security-supported RECOMMENDED Section 4.4.2 - printer-name RECOMMENDED Section 4.4.3 - printer-location RECOMMENDED Section 4.4.4 - printer-info OPTIONAL Section 4.4.5 - printer-more-info OPTIONAL Section 4.4.6 - printer-make-and-model RECOMMENDED Section 4.4.8 - charset-supported OPTIONAL Section 4.4.15 - generated-natural-language- - supported OPTIONAL Section 4.4.17 - document-format-supported RECOMMENDED Section 4.4.19 - color-supported RECOMMENDED Section 4.4.23 - finishings-supported OPTIONAL Section 4.2.6 - number-up-supported OPTIONAL Section 4.2.7 - sides-supported RECOMMENDED Section 4.2.8 - media-supported RECOMMENDED Section 4.2.11 - printer-resolution-supported OPTIONAL Section 4.2.12 - print-quality-supported OPTIONAL Section 4.2.13 - - - - - - - - - - - - - - - - - - - - - - - - - - -deBry, et al. Experimental [Page 167] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -17. APPENDIX F: Change History for the IPP Model and Semantics document - - The following substantive changes and major clarifications have been - made to this document from the June 30, 1998 version based on the - interoperability testing that took place September 23-25 1998 and - subsequent mailing list and meeting discussions. They are listed in - the order of occurrence in the document. These changes are the ones - that might affect implementations. Clarifications that are unlikely - to affect implementations are not listed. The issue numbers refer to - the IPP Issues List which is available in the following directory: - - ftp://ftp.pwg.org/pub/pwg/ipp/approved-clarifications/ - - Section Description - - global Replaced TLS references with SSL3 references as agreed with - our Area Director on 11/12/1998. - - global Removed the indications that some of these IPP documents - are informational, since the intent is now to publish all - IPP/1.0 documents as informational as agreed with our Area - Director on 11/12/1998. - - 3.1.2, Clarify that the IPP object SHOULD NOT validate the - 16.3.3 range of the request-id being 1 to 2**31-1, but accepts - [now ipp- and returns any value. Clients MUST still keep in the - iig] range 1 to 2**31 though. If the request is terminated - before the complete "request-id" is received, the IPP - object rejects the request and returns a response with a - "request-id" of 0 (Issue 1.36). - - 3.1.4.1, Clarified that when a client submits a request in a - 13.1.4.14 charset that is not supported, the IPP object SHOULD - return any 'text' or 'name' attributes in the 'utf-8' - charset, if it returns any, since clients and IPP - objects MUST support 'utf-8'. (Issue 1.19) - - 3.1.4.1 Clarified Section 3.1.4.1 Request Operation Attributes - that a client MAY use the attribute level natural - language override (text/nameWithLanguage) redundantly in - a request. (Issue 1.46) - - 3.1.4.2 Clarified Section 3.1.4.2 Response Operation Attributes - that an IPP object MAY use the attribute level natural - language override (text/nameWithLanguage) redundantly in - a response. (Issue 1.46) - - - - - -deBry, et al. Experimental [Page 168] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 3.1.6 Clarified section 3.1.6: If the Printer object supports - the "status-message" operation attribute, it NEED NOT - return a status message for the following error status - codes: 'client-error-bad-request', 'client-error- - charset-not-supported', 'server-error-internal-error', - 'server-error-operation-not-supported', and 'server- - error-version-not-supported'. - - 3.2.1.1 Clarified that if a client is not supplying any Job - Template attributes in a request, the client SHOULD omit - Group 2 rather than sending an empty group. However, a - Printer object MUST be able to accept an empty group. - This makes [RFC2566] agree with [RFC2565]. (Issue 1.16) - - 3.2.1.2, Clarified that if an IPP object is not returning any - 3.2.5.2, Unsupported Attributes in a response, the IPP object - 3.2.6.2, SHOULD omit Group 2 rather than sending an empty group. - 3.3.1.2, However, a client MUST be able to accept an empty group. - 3.3.3.2, This makes [RFC2566] agree with [RFC2565]. (Issue 1.17) - 3.3.4.2 - - 3.2.1.2, Clarified that an IPP object MUST treat an unsupported - 13.1.2.2, attribute syntax supplied in a request in the same way - 13.1.4.12 as an unsupported value. The IPP object MUST return the - attribute, the attribute syntax, and the value in the - Unsupported Attributes group. (Issue 1.26) - - 3.2.5.2, Clarified for Get-Printer-Attributes, Get-Jobs, and Get- - 3.2.6.2, Job-Attributes that an IPP object MUST return - 3.3.4.2, 'successful-ok-ignored-or-substituted-attributes' (0x1), - - 13.1.2.1, rather than 'successful-ok' (0x0), when a client - 13.1.2.2, supplies unsupported attributes as values of the - 13.1.4.12 'requested-attributes' operation attribute. (Issue - 1.24) - Also clarified that the response NEED NOT contain the - "requested-attributes" operation attribute with any - supplied values (attribute keywords) that were requested - by the client but are not supported by the IPP object. - (Issue 1.18) - - 3.2.6.2 Deleted the job-level natural language override (NLO) - 4.1.1.2 from Section 3.2.6.2 Get-Jobs Response so that all - 4.3.24 operation responses are the same with respect to NLO. - (Issue 1.47) - - - - - - -deBry, et al. Experimental [Page 169] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 3.3.1 Clarified that an IPP Printer that supports the Create- - Job operation MUST handle the situation when a client - does not supply Send-Document or Send-URI operations - within a one- to four-minute time period. Also - clarified that a client MUST send documents in a multi- - document job without undue or unbounded delay. (Issue - 1.28) - - 3.3.3 Clarified that the IPP object MUST reject a Cancel-Job - request if the job is in 'completed', 'canceled', or - 'aborted' job states. (Issue 1.12) - - 4.1.2.3 Added this new sub-section: it specifies that - nameWithoutLanguage plus the implicit natural language - matches nameWithLanguage, if the values and natural - languages are the same. Also added that keyword never - matches nameWithLanguage or nameWithoutLanguage. - Clarified that if both have countries, that the - countries SHOULD match as well. If either do not, then - the country field SHOULD be ignored. (Issues 1.33 and - 1.34) - - 4.1.5 Clarified regarding the case-insensitivity of URLs to - refer only to the RFCs that define them. (Issue 1.10) - - 4.1.11 Clarified that 'boolean' is not a full-sized integer. - (Issue 1.38) - - 4.1.15 Clarified that 'resolution' is not three full-sized - integers. (Issue 1.20) - - 4.2.* Clarified that standard values are keywords or enums, - not names. (Issue 1.49). - - 4.2.4 Added the 'single-document-new-sheet' value to Section - 4.2.4 multiple-document-handling. (Issue 1.54) - - 4.4.18, Clarified that the "document-format-default" and - 4.4.19 "document-format-supported" Printer Description - attributes are REQUIRED to agree with the table. (Issue - 1.4) - - 4.4.21 Changed "queued-job-count" from OPTIONAL to RECOMMENDED. - (Issue 1.14) - - - - - - - -deBry, et al. Experimental [Page 170] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 4.4.28 Clarified that the implementation supplied value for the - "multiple-operation-time-out" attribute SHOULD be - between 30 and 240 seconds, though the implementation - MAY allow the administrator to set values, and MAY allow - values outside this range. (Issue 1.28) - - 5.1, Clarified Client Conformance that if a client supports - 5.2.5 an attribute of 'text' attribute syntax, that it MUST - support both the textWithoutLanguage and the - textWithLanguage forms. Same for 'name' attribute - syntax. Same for an IPP object (Issue 1.48) - - 6.5, Added new section to allow Attribute Groups to be - 12.8 registered as extensions for being passed in operation - requests and responses. (Issue 1.25) - - 7. Updated the table of text and name attributes to agree - with Section 4.2. - - 8.5 Added a new section RECOMMENDING that the Get-Jobs - SHOULD return non-IPP jobs whether or not assigning them - a job-id and job-uri. Also RECOMMENDED generating, if - possible, job-id and job-uri and supporting other IPP - operations on foreign jobs as an implementer option. - (Issue 1.32) - - 9. Updated document references. - - 13.1.4.14 Clarified 'client-error-charset-not-supported' that - 'utf-8' must be used for any 'text' or 'name' attributes - returned in the error response (Issue 1.19). - - 13.1.5.9 Added a new error code 'server-error-job-canceled' - (0x0508) to be returned if a job is canceled by another - client or aborted by the IPP object while the first - client is still sending the document data. (Issue 1.29) - - 15.3, Moved these sections recommending operation processing - 15.4 steps to the new Implementer's Guide (informational). - There indicated that all of the error checks are not - required, so an IPP object MAY be forgiving and accept - non-conforming requests. However, a conforming client - MUST supply requests that would pass all of the error - checks indicated. (Issue 1.21) - - - - - - - -deBry, et al. Experimental [Page 171] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - - 16 Changed directory schema attributes from REQUIRED to - RECOMMENDED. Changed some of the OPTIONAL to - RECOMMENDED to agree with the SLP template. Changed the - "charset-supported" and "natural-language-supported" - from REQUIRED to OPTIONAL. Recommended that the names - be the same in a directory entry as the IPP attribute - names. (Issue 1.53) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -deBry, et al. Experimental [Page 172] - -RFC 2566 IPP/1.0: Model and Semantics April 1999 - - -18. Full Copyright Statement - - Copyright (C) The Internet Society (1999). All Rights Reserved. - - This document and translations of it may be copied and furnished to - others, and derivative works that comment on or otherwise explain it - or assist in its implementation may be prepared, copied, published - and distributed, in whole or in part, without restriction of any - kind, provided that the above copyright notice and this paragraph are - included on all such copies and derivative works. However, this - document itself may not be modified in any way, such as by removing - the copyright notice or references to the Internet Society or other - Internet organizations, except as needed for the purpose of - developing Internet standards in which case the procedures for - copyrights defined in the Internet Standards process must be - followed, or as required to translate it into languages other than - English. - - The limited permissions granted above are perpetual and will not be - revoked by the Internet Society or its successors or assigns. - - This document and the information contained herein is provided on an - "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING - TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING - BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION - HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF - MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - - - - - - - - - - - - - - - - - - - - - - - - -deBry, et al. Experimental [Page 173] - diff --git a/standards/rfc2639.txt b/standards/rfc2639.txt deleted file mode 100644 index e3ab716843..0000000000 --- a/standards/rfc2639.txt +++ /dev/null @@ -1,3587 +0,0 @@ - - - - - - -Network Working Group T. Hastings -Request for Comments: 2639 C. Manros -Category: Informational Xerox Corporation - July 1999 - - - Internet Printing Protocol/1.0: Implementer's Guide - -Status of this Memo - - This memo provides information for the Internet community. It does - not specify an Internet standard of any kind. Distribution of this - memo is unlimited. - -Copyright Notice - - Copyright (C) The Internet Society (1999). All Rights Reserved. - -Abstract - - This document is one of a set of documents, which together describe - all aspects of a new Internet Printing Protocol (IPP). IPP is an - application level protocol that can be used for distributed printing - using Internet tools and technologies. This document contains - information that supplements the IPP Model and Semantics [RFC2566] - and the IPP Transport and Encoding [RFC2565] documents. It is - intended to help implementers understand IPP/1.0 and some of the - considerations that may assist them in the design of their client - and/or IPP object implementations. For example, a typical order of - processing requests is given, including error checking. Motivation - for some of the specification decisions is also included. - - The full set of IPP documents includes: - - Design Goals for an Internet Printing Protocol [RFC2567] - Rationale for the Structure and Model and Protocol for the Internet - Printing Protocol [RFC2568] - Internet Printing Protocol/1.0: Model and Semantics [RFC2566] - Internet Printing Protocol/1.0: Encoding and Transport [RFC2565] - Mapping between LPD and IPP Protocols [RFC2569] - - The document, "Design Goals for an Internet Printing Protocol", takes - a broad look at distributed printing functionality, and it enumerates - real-life scenarios that help to clarify the features that need to be - included in a printing protocol for the Internet. It identifies - requirements for three types of users: end users, operators, and - - - - - -Hastings & Manros Informational [Page 1] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - administrators. The design goals document calls out a subset of end - user requirements that are satisfied in IPP/1.0. Operator and - administrator requirements are out of scope for version 1.0. - - The document, "Rationale for the Structure and Model and Protocol for - the Internet Printing Protocol", describes IPP from a high level - view, defines a roadmap for the various documents that form the suite - of IPP specifications, and gives background and rationale for the - IETF working group's major decisions. - - The document, "Internet Printing Protocol/1.0: Model and Semantics", - describes a simplified model with abstract objects, their attributes, - and their operations. The model introduces a Printer and a Job. The - Job supports multiple documents per Job. The model document also - addresses how security, internationalization, and directory issues - are addressed. - - The document, "Internet Printing Protocol/1.0: Encoding and - Transport", is a formal mapping of the abstract operations and - attributes defined in the model document onto HTTP/1.1. It also - defines the encoding rules for a new Internet media type called - "application/ipp". - - The document, "Mapping between LPD and IPP Protocols", gives some - advice to implementers of gateways between IPP and LPD (Line Printer - Daemon) implementations. - -Table of Contents - - 1 Introduction......................................................4 - 1.1 Conformance language............................................4 - 1.2 Other terminology...............................................5 - 2 Model and Semantics...............................................5 - 2.1 Summary of Operation Attributes.................................5 - 2.2 Suggested Operation Processing Steps for IPP Objects ..........10 - 2.2.1 Suggested Operation Processing Steps for all Operations..11 - 2.2.1.1 Validate version number...............................11 - 2.2.1.2 Validate operation identifier.........................11 - 2.2.1.3 Validate the request identifier.......................11 - 2.2.1.4 Validate attribute group and attribute presence and - order.................................................12 - 2.2.1.5 Validate the values of the REQUIRED Operation - attributes............................................19 - 2.2.1.6 Validate the values of the OPTIONAL Operation - attributes............................................23 - 2.2.2 Suggested Additional Processing Steps for Operations that - Create/Validate Jobs and Add Documents.....................26 - 2.2.2.1 Default "ipp-attribute-fidelity" if not supplied......26 - - - -Hastings & Manros Informational [Page 2] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - 2.2.2.2 Check that the Printer object is accepting jobs.......26 - 2.2.2.3 Validate the values of the Job Template attributes....26 - 2.2.3 Algorithm for job validation...............................27 - 2.2.3.1 Check for conflicting Job Template attributes values..33 - 2.2.3.2 Decide whether to REJECT the request..................33 - 2.2.3.3 For the Validate-Job operation, RETURN one of the - success status codes..................................34 - 2.2.3.4 Create the Job object with attributes to support......34 - 2.2.3.5 Return one of the success status codes................36 - 2.2.3.6 Accept appended Document Content......................36 - 2.2.3.7 Scheduling and Starting to Process the Job............36 - 2.2.3.8 Completing the Job....................................37 - 2.2.3.9 Destroying the Job after completion...................37 - 2.2.3.10 Interaction with "ipp-attribute-fidelity".............37 - 2.3 Status codes returned by operation ............................37 - 2.3.1 Printer Operations.........................................38 - 2.3.1.1 Print-Job.............................................38 - 2.3.1.2 Print-URI.............................................40 - 2.3.1.3 Validate-Job..........................................40 - 2.3.1.4 Create-Job............................................41 - 2.3.1.5 Get-Printer-Attributes................................41 - 2.3.1.6 Get-Jobs..............................................42 - 2.3.2 Job Operations.............................................43 - 2.3.2.1 Send-Document.........................................43 - 2.3.2.2 Send-URI..............................................44 - 2.3.2.3 Cancel-Job............................................44 - 2.3.2.4 Get-Job-Attributes....................................45 - 2.4 Validate-Job...................................................46 - 2.5 Case Sensitivity in URIs ......................................46 - 2.6 Character Sets, natural languages, and internationalization....46 - 2.6.1 Character set code conversion support .....................46 - 2.6.2 What charset to return when an unsupported charset is - requested?.................................................48 - 2.6.3 Natural Language Override (NLO) ...........................48 - 2.7 The "queued-job-count" Printer Description attribute...........50 - 2.7.1 Why is "queued-job-count" RECOMMENDED?.....................50 - 2.7.2 Is "queued-job-count" a good measure of how busy a printer - is?........................................................50 - 2.8 Sending empty attribute groups ................................50 - 2.9 Returning unsupported attributes in Get-Xxxx responses ........51 - 2.10 Returning job-state in Print-Job response ....................51 - 2.11 Flow controlling the data portion of a Print-Job request .....52 - 2.12 Multi-valued attributes ......................................53 - 2.13 Querying jobs with IPP that were submitted using other job - submission protocols .........................................53 - 2.14 The 'none' value for empty sets ..............................54 - 2.15 Get-Jobs, my-jobs='true', and 'requesting-user-name'?.........54 - - - - -Hastings & Manros Informational [Page 3] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - 2.16 The "multiple-document-handling" Job Template attribute and - support of multiple document jobs.............................54 - 3 Encoding and Transport...........................................55 - 3.1 General Headers................................................56 - 3.2 Request Headers...............................................57 - 3.3 Response Headers...............................................58 - 3.4 Entity Headers................................................59 - 3.5 Optional support for HTTP/1.0..................................60 - 3.6 HTTP/1.1 Chunking..............................................60 - 3.6.1 Disabling IPP Server Response Chunking.....................60 - 3.6.2 Warning About the Support of Chunked Requests..............60 - 4 References.......................................................61 - 4.1 Authors' Addresses.............................................62 - 5 Security Considerations..........................................62 - 6 Notices..........................................................62 - Full Copyright Statement............................................65 - -1 Introduction - - This document contains information that supplements the IPP Model and - Semantics [RFC2566] and the IPP Transport and Encoding [RFC2565] - documents. As such this information is not part of the formal - specifications. Instead information is presented to help implementers - understand the specification, including some of the motivation for - decisions taken by the committee in developing the specification. - Some of the implementation considerations are intended to help - implementers design their client and/or IPP object implementations. - If there are any contradictions between this document and [RFC2566] or - [RFC2565], those documents take precedence over this document. - -1.1 Conformance language - - Usually, this document does not contain the terminology MUST, MUST - NOT, MAY, NEED NOT, SHOULD, SHOULD NOT, REQUIRED, and OPTIONAL. - However, when those terms do appear in this document, their intent is - to repeat what the [RFC2566] and [RFC2565] documents require and - allow, rather than specifying additional conformance requirements. - These terms are defined in section 13 on conformance terminology in - [RFC2566], most of which is taken from RFC 2119 [RFC2119]. - - Implementers should read section 13 in [RFC2566] in order to - understand these capitalized words. The words MUST, MUST NOT, and - REQUIRED indicate what implementations are required to support in a - client or IPP object in order to be conformant to [RFC2566] and - [RFC2565]. MAY, NEED NOT, and OPTIONAL indicate was is merely allowed - as an implementer option. The verbs SHOULD and SHOULD NOT indicate - suggested behavior, but which is not required or disallowed, - respectively, in order to conform to the specification. - - - -Hastings & Manros Informational [Page 4] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -1.2 Other terminology - - The term "sender" refers to the client that sends a request or an IPP - object that returns a response. The term "receiver" refers to the IPP - object that receives a request and to a client that receives a - response. - -2 Model and Semantics - - This section discusses various aspects of IPP/1.0 Model and Semantics - [RFC2566]. - -2.1 Summary of Operation Attributes - - Legend for the following table: - - R indicates a REQUIRED operation or attribute for an - implementation to support - - O indicates an OPTIONAL operation or attribute for an - implementation to support - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Hastings & Manros Informational [Page 5] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Table 1. Summary of operation attributes for Printer operations - - Printer Operations - - Requests Responses - - Operation Print- Pri Crea Get- Get- All - Attributes Job, nt- te- Printer- Jobs Opera- - Validate URI Job Attribut tions - -Job (O) (O) es - - Operation parameters--REQUIRED to be supplied by the sender - - operation-id R R R R R - - status-code R - - request-id R R R R R R - - version-number R R R R R R - - Operation attributes-REQUIRED to be supplied by the sender - - attributes-charset R R R R R R - - attributes- R R R R R R - natural-language - - document-uri R - - job-id* - - job-uri* - - last-document - - printer-uri R R R R R - - Operation attributes-RECOMMENDED to be supplied by the sender - - job-name R R R - - requesting-user- R R R R R - name - - - - - - - -Hastings & Manros Informational [Page 6] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Printer Operations - - Requests Responses - - Operation Print- Pri Crea Get- Get- All - Attributes Job, nt- te- Printer Jobs Opera- - Vali- URI Job Attri- tions - date-Job (O) (O) butes - - Operation attributes-OPTIONAL to be supplied by the sender - - status-message O - - compression O O - - document-format R R O - - document-name O O - - document-natural- O O - language - - ipp-attribute- R R R - fidelity - - job-impressions O O O - - job-k-octets O O O - - job-media-sheets O O O - - limit R - - message - - my-jobs R - - requested- R R - attributes - - which-jobs R - - * "job-id" is REQUIRED only if used together with - "printer-uri" to identify the target job; otherwise, "job- - uri" is REQUIRED. - - - - - - -Hastings & Manros Informational [Page 7] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Table 2. Summary of operation attributes for Job operations - - - Requests Responses - - Operation Send- Send- Cancel Get- All - Attributes Document URI -Job Job- Opera- - (O) (O) Attri- tions - butes - - Operation parameters--REQUIRED to be supplied by the sender - - operation-id R R R R - - status-code R - - request-id R R R R R - - version-number R R R R R - - Operation attributes-REQUIRED to be supplied by the sender - - attributes- R R R R R - charset - - attributes- R R R R R - natural-language - - document-uri R - - job-id* R R R R - - job-uri* R R R R - - last-document R R - - printer-uri R R R R - - Operation attributes-RECOMMENDED to be supplied by the - sender - - job-name - - requesting-user- R R R R - name - - - - - - -Hastings & Manros Informational [Page 8] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Job Operations - - Requests Responses - - Operation Attributes Send- Send- Cance Get- All - Document URI l-Job Job- Opera- - (O) (O) Attri- tions - butes - - Operation attributes.OPTIONAL to be supplied by the sender - - status-message O - - compression O O - - document-format R R - - document-name O O - - document-natural- O O - language - - ipp-attribute- - fidelity - - job-impressions - - job-k-octets - - job-media-sheets - - limit - - message O - - my-jobs - - requested-attributes R - - which-jobs - - * "job-id" is REQUIRED only if used together with "printer- - uri" to identify the target job; otherwise, "job-uri" is - REQUIRED. - - - - - - - -Hastings & Manros Informational [Page 9] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -2.2 Suggested Operation Processing Steps for IPP Objects - - This section suggests the steps and error checks that an IPP object - MAY perform when processing requests and returning responses. An IPP - object MAY perform some or all of the error checks. However, some - implementations MAY choose to be more forgiving than the error checks - shown here, in order to be able to accept requests from non- - conforming clients. Not performing all of these error checks is a - so-called "forgiving" implementation. On the other hand, clients - that successfully submit requests to IPP objects that do perform all - the error checks will be more likely to be able to interoperate with - other IPP object implementations. Thus an implementer of an IPP - object needs to decide whether to be a "forgiving" or a "strict" - implementation. Therefore, the error status codes returned may - differ between implementations. Consequentially, client SHOULD NOT - expect exactly the error code processing described in this section. - - When an IPP object receives a request, the IPP object either accepts - or rejects the request. In order to determine whether or not to - accept or reject the request, the IPP object SHOULD execute the - following steps. The order of the steps may be rearranged and/or - combined, including making one or multiple passes over the request. - - A client MUST supply requests that would pass all of the error checks - indicated here in order to be a conforming client. Therefore, a - client SHOULD supply requests that are conforming, in order to avoid - being rejected by some IPP object implementations and/or risking - different semantics by different implementations of forgiving - implementations. For example, a forgiving implementation that - accepts multiple occurrences of the same attribute, rather than - rejecting the request might use the first occurrences, while another - might use the last occurrence. Thus such a non-conforming client - would get different results from the two forgiving implementations. - - In the following, processing continues step by step until a "RETURNS - the xxx status code ." statement is encountered. Error returns are - indicated by the verb: "REJECTS". Since clients have difficulty - getting the status code before sending all of the document data in a - Print-Job request, clients SHOULD use the Validate-Job operation - before sending large documents to be printed, in order to validate - whether the IPP Printer will accept the job or not. - - It is assumed that security authentication and authorization has - already taken place at a lower layer. - - - - - - - -Hastings & Manros Informational [Page 10] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -2.2.1 Suggested Operation Processing Steps for all Operations - - This section is intended to apply to all operations. The next - section contains the additional steps for the Print-Job, Validate- - Job, Print-URI, Create-Job, Send-Document, and Send-URI operations - that create jobs, adds documents, and validates jobs. - -2.2.1.1 Validate version number - - Every request and every response contains the "version-number" - attribute. The value of this attribute is the major and minor - version number of the syntax and semantics that the client and IPP - object is using, respectively. The "version-number" attribute - remains in a fixed position across all future versions so that all - clients and IPP object that support future versions can determine - which version is being used. The IPP object checks to see if the - major version number supplied in the request is supported. If not, - the Printer object REJECTS the request and RETURNS the 'server- - error-version-not-supported' status code in the response. The IPP - object returns in the "version-number" response attribute the major - and minor version for the error response. Thus the client can learn - at least one major and minor version that the IPP object supports. - The IPP object is encouraged to return the closest version number to - the one supplied by the client. - - The checking of the minor version number is implementation dependent, - however if the client supplied minor version is explicitly supported, - the IPP object MUST respond using that identical minor version - number. If the requested minor version is not supported (the - requested minor version is either higher or lower) than a supported - minor version, the IPP object SHOULD return the closest supported - minor version. - -2.2.1.2 Validate operation identifier - - The Printer object checks to see if the "operation-id" attribute - supplied by the client is supported as indicated in the Printer - object's "operations-supported" attribute. If not, the Printer - REJECTS the request and returns the 'server-error-operation-not- - supported' status code in the response. - -2.2.1.3 Validate the request identifier - - The Printer object SHOULD NOT check to see if the "request-id" - attribute supplied by the client is in range: between 1 and 2**31 - 1 - (inclusive), but copies all 32 bits. - - - - - -Hastings & Manros Informational [Page 11] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Note: The "version-number", "operation-id", and the "request-id" - parameters are in fixed octet positions in the IPP/1.0 encoding. The - "version-number" parameter will be the same fixed octet position in - all versions of the protocol. These fields are validated before - proceeding with the rest of the validation. - -2.2.1.4 Validate attribute group and attribute presence and order - - The order of the following validation steps depends on - implementation. - -2.2.1.4.1 Validate the presence and order of attribute groups - - Client requests and IPP object responses contain attribute groups - that Section 3 requires to be present and in a specified order. An - IPP object verifies that the attribute groups are present and in the - correct order in requests supplied by clients (attribute groups - without an * in the following tables). - - If an IPP object receives a request with (1) required attribute - groups missing, or (2) the attributes groups are out of order, or (3) - the groups are repeated, the IPP object REJECTS the request and - RETURNS the 'client-error-bad-request' status code. For example, it - is an error for the Job Template Attributes group to occur before the - Operation Attributes group, for the Operation Attributes group to be - omitted, or for an attribute group to occur more than once, except in - the Get-Jobs response. - - Since this kind of attribute group error is most likely to be an - error detected by a client developer rather than by a customer, the - IPP object NEED NOT return an indication of which attribute group was - in error in either the Unsupported Attributes group or the Status - Message. Also, the IPP object NEED NOT find all attribute group - errors before returning this error. - -2.2.1.4.2 Ignore unknown attribute groups in the expected position - - Future attribute groups may be added to the specification at the end - of requests just before the Document Content and at the end of - response, except for the Get-Jobs response, where it maybe there or - before the first job attributes returned. If an IPP object receives - an unknown attribute group in these positions, it ignores the entire - group, rather than returning an error, since that group may be a new - group in a later minor version of the protocol that can be ignored. - (If the new attribute group cannot be ignored without confusing the - client, the major version number would have been increased in the - - - - - -Hastings & Manros Informational [Page 12] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - protocol document and in the request). If the unknown group occurs - in a different position, the IPP object REJECTS the request and - RETURNS the 'client-error-bad-request' status code. - - Clients also ignore unknown attribute groups returned in a response. - - Note: By validating that requests are in the proper form, IPP - objects force clients to use the proper form which, in turn, - increases the chances that customers will be able to use such clients - from multiple vendors with IPP objects from other vendors. - -2.2.1.4.3 Validate the presence of a single occurrence of required - Operation attributes - - Client requests and IPP object responses contain Operation attributes - that [RFC2566] Section 3 requires to be present. Attributes within a - group may be in any order, except for the ordering of target, - charset, and natural languages attributes. These attributes MUST be - first, and MUST be supplied in the following order: charset, natural - language, and then target. An IPP object verifies that the attributes - that Section 4 requires to be supplied by the client have been - supplied in the request (attributes without an * in the following - tables). An asterisk (*) indicates groups and Operation attributes - that the client may omit in a request or an IPP object may omit in a - response. - - If an IPP object receives a request with required attributes missing - or repeated from a group or in the wrong position, the behavior of - the IPP object is IMPLEMENTATION DEPENDENT. Some of the possible - implementations are: - - 1.REJECTS the request and RETURNS the 'client-error-bad-request' - status code - - 2.accepts the request and uses the first occurrence of the - attribute no matter where it is - - 3.accepts the request and uses the last occurrence of the - attribute no matter where it is - - 4.accept the request and assume some default value for the missing - attribute - - Therefore, client MUST send conforming requests, if they want to - receive the same behavior from all IPP object implementations. For - example, it is an error for the "attributes-charset" or "attributes- - natural-language" attribute to be omitted in any operation request, - or for an Operation attribute to be supplied in a Job Template group - - - -Hastings & Manros Informational [Page 13] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - or a Job Template attribute to be supplied in an Operation Attribute - group in a create request. It is also an error to supply the - "attributes-charset" attribute twice. - - Since these kinds of attribute errors are most likely to be detected - by a client developer rather than by a customer, the IPP object NEED - NOT return an indication of which attribute was in error in either - the Unsupported Attributes group or the Status Message. Also, the - IPP object NEED NOT find all attribute errors before returning this - error. - - The following tables list all the attributes for all the operations - by attribute group in each request and each response. The order of - the groups is the order that the client supplies the groups as - specified in [RFC2566] Section 3. The order of the attributes within - a group is arbitrary, except as noted for some of the special - operation attributes (charset, natural language, and target). The - tables below use the following notation: - - R indicates a REQUIRED attribute that an IPP object MUST support - O indicates an OPTIONAL attribute that an IPP object NEED NOT - support - * indicates that a client MAY omit the attribute in a request - and that an IPP object MAY omit the attribute in a - response. The absence of an * means that a client MUST - supply the attribute in a request and an IPP object MUST - supply the attribute in a response. - - Operation Requests - - The tables below show the attributes in their proper attribute groups - for operation requests: - - Note: All operation requests contain "version-number", "operation- - id", and "request-id" parameters. - - Print-Job Request: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - printer-uri (R) - requesting-user-name (R*) - job-name (R*) - ipp-attribute-fidelity (R*) - document-name (R*) - document-format (R*) - document-natural-language (O*) - compression (O*) - - - -Hastings & Manros Informational [Page 14] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - job-k-octets (O*) - job-impressions (O*) - job-media-sheets (O*) - Group 2: Job Template Attributes (R*) - (O*) - (see [RFC2566] Section 4.2) - Group 3: Document Content (R) - - - Validate-Job Request: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - printer-uri (R) - requesting-user-name (R*) - job-name (R*) - ipp-attribute-fidelity (R*) - document-name (R*) - document-format (R*) - document-natural-language (O*) - compression (O*) - job-k-octets (O*) - job-impressions (O*) - job-media-sheets (O*) - Group 2: Job Template Attributes (R*) - (O*) - (see [RFC2566] Section 4.2) - - Create-Job Request: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - printer-uri (R) - requesting-user-name (R*) - job-name (R*) - ipp-attribute-fidelity (R*) - job-k-octets (O*) - job-impressions (O*) - job-media-sheets (O*) - Group 2: Job Template Attributes (R*) - (O*) (see - (see [RFC2566] Section 4.2) - - Print-URI Request: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - printer-uri (R) - - - -Hastings & Manros Informational [Page 15] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - document-uri (R) - requesting-user-name (R*) - job-name (R*) - ipp-attribute-fidelity (R*) - document-name (R*) - document-format (R*) - document-natural-language (O*) - compression (O*) - job-k-octets (O*) - job-impressions (O*) - job-media-sheets (O*) - Group 2: Job Template Attributes (R*) - (O*) (see - (see [RFC2566] Section 4.2) - - Send-Document Request: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - (printer-uri & job-id) | job-uri (R) - last-document (R) - requesting-user-name (R*) - document-name (R*) - document-format (R*) - document-natural-language (O*) - compression (O*) - Group 2: Document Content (R*) - - - Send-URI Request: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - (printer-uri & job-id) | job-uri (R) - last-document (R) - document-uri (R) - requesting-user-name (R*) - document-name (R*) - document-format (R*) - document-natural-language (O*) - compression (O*) - - - - - - - - - - -Hastings & Manros Informational [Page 16] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Cancel-Job Request: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - (printer-uri & job-id) | job-uri (R) - requesting-user-name (R*) - message (O*) - - Get-Printer-Attributes Request: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - printer-uri (R) - requesting-user-name (R*) - requested-attributes (R*) - document-format (R*) - - Get-Job-Attributes Request: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - (printer-uri & job-id) | job-uri (R) - requesting-user-name (R*) - requested-attributes (R*) - - Get-Jobs Request: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - printer-uri (R) - requesting-user-name (R*) - limit (R*) - requested-attributes (R*) - which-jobs (R*) - my-jobs (R*) - - - Operation Responses - - The tables below show the response attributes in their proper - attribute groups for responses. - - Note: All operation responses contain "version-number", "status- - code", and "request-id" parameters. - - Print-Job Response: - Print-URI Response: - Create-Job Response: - - - -Hastings & Manros Informational [Page 17] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Send-Document Response: - Send-URI Response: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - status-message (O*) - Group 2: Unsupported Attributes (R*) (see Note 3) - (R*) - Group 3: Job Object Attributes(R*) (see Note 2) - job-uri (R) - job-id (R) - job-state (R) - job-state-reasons (O*) - job-state-message (O*) - number-of-intervening-jobs (O*) - - Validate-Job Response: - Cancel-Job Response: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - status-message (O*) - Group 2: Unsupported Attributes (R*) (see Note 3) - (R*) - - Note 2 - the Job Object Attributes and Printer Object Attributes are - returned only if the IPP object returns one of the success status - codes. - - Note 3 - the Unsupported Attributes Group is present only if the - client included some Operation and/or Job Template attributes or - values that the Printer doesn't support whether a success or an error - return. - - Get-Printer-Attributes Response: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - status-message (O*) - Group 2: Unsupported Attributes (R*) (see Note 4) - (R*) - Group 3: Printer Object Attributes(R*) (see Note 2) - (R*) - - Note 4 - the Unsupported Attributes Group is present only if the - client included some Operation attributes that the Printer doesn't - support whether a success or an error return. - - - - -Hastings & Manros Informational [Page 18] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Get-Job-Attributes Response: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - status-message (O*) - Group 2: Unsupported Attributes (R*) (see Note 4) - (R*) - Group 3: Job Object Attributes(R*) (see Note 2) - (R*) - - Get-Jobs Response: - Group 1: Operation Attributes (R) - attributes-charset (R) - attributes-natural-language (R) - status-message (O*) - Group 2: Unsupported Attributes (R*) (see Note 4) - (R*) - Group 3: Job Object Attributes(R*) (see Note 2, 5) - (R*) - - Note 5: for the Get-Jobs operation the response contains a separate - Job Object Attributes group 3 to N containing requested-attributes - for each job object in the response. - -2.2.1.5 Validate the values of the REQUIRED Operation attributes - - An IPP object validates the values supplied by the client of the - REQUIRED Operation attribute that the IPP object MUST support. The - next section specifies the validation of the values of the OPTIONAL - Operation attributes that IPP objects MAY support. - - The IPP object performs the following syntactic validation checks of - each Operation attribute value: - - a)that the length of each Operation attribute value is correct for - the attribute syntax tag supplied by the client according to - [RFC2566] Section 4.1, - - b)that the attribute syntax tag is correct for that Operation - attribute according to [RFC2566] Section 3, - - c)that the value is in the range specified for that Operation - attribute according to [RFC2566] Section 3, - - d)that multiple values are supplied by the client only for - operation attributes that are multi-valued, i.e., that are - 1setOf X according to [RFC2566] Section 3. - - - - -Hastings & Manros Informational [Page 19] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - If any of these checks fail, the IPP object REJECTS the request and - RETURNS the 'client-error-bad-request' or the 'client-error-request- - value-too-long' status code. Since such an error is most likely to - be an error detected by a client developer, rather than by an end- - user, the IPP object NEED NOT return an indication of which attribute - had the error in either the Unsupported Attributes Group or the - - Status Message. The description for each of these syntactic checks - is explicitly expressed in the first IF statement in the following - table. - - In addition, the IPP object checks each Operation attribute value - against some Printer object attribute or some hard-coded value if - there is no "xxx-supported" Printer object attribute defined. If its - value is not among those supported or is not in the range supported, - then the IPP object REJECTS the request and RETURNS the error status - code indicated in the table by the second IF statement. If the value - of the Printer object's "xxx-supported" attribute is 'no-value' - (because the system administrator hasn't configured a value), the - check always fails. - - attributes-charset (charset) - - IF NOT a single non-empty 'charset' value, REJECT/RETURN 'client- - error-bad-request'. - - IF the value length is greater than 63 octets, REJECT/RETURN ' - client-error-request-value-too-long'. - IF NOT in the Printer object's "charset-supported" attribute, - REJECT/RETURN "client-error-charset-not-supported". - - - attributes-natural-language(naturalLanguage) - - IF NOT a single non-empty 'naturalLanguage' value, REJECT/RETURN - 'client-error-bad-request'. - IF the value length is greater than 63 octets, REJECT/RETURN ' - client-error-request-value-too-long'. - ACCEPT the request even if not a member of the set in the Printer - object's "generated-natural-language-supported" attribute. If - the supplied value is not a member of the Printer object's - "generated-natural-language-supported" attribute, use the - Printer object's "natural-language-configured" value. - - - - - - - - -Hastings & Manros Informational [Page 20] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - requesting-user-name - - IF NOT a single 'name' value, REJECT/RETURN 'client-error-bad- - request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - IF the IPP object can obtain a better authenticated name, use it - instead. - - - job-name(name) - - IF NOT a single 'name' value, REJECT/RETURN 'client-error-bad- - request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - IF NOT supplied by the client, the Printer object creates a name - from the document-name or document-uri. - - - document-name (name) - - IF NOT a single 'name' value, REJECT/RETURN 'client-error-bad- - request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - - - ipp-attribute-fidelity (boolean) - - IF NEITHER a single 'true' NOR a single 'false' 'boolean' value, - REJECT/RETURN 'client-error-bad-request'. - IF the value length is NOT equal to 1 octet, REJECT/RETURN ' - client-error-request-value-too-long' - IF NOT supplied by the client, the IPP object assumes the value - 'false'. - - - document-format (mimeMediaType) - - IF NOT a single non-empty 'mimeMediaType' value, REJECT/RETURN - 'client-error-bad-request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - IF NOT in the Printer object's "document-format-supported" - attribute, REJECT/RETURN 'client-error-document-format-not- - supported' - - - - -Hastings & Manros Informational [Page 21] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - IF NOT supplied by the client, the IPP object assumes the value of - the Printer object's "document-format-default" attribute. - - - document-uri (uri) - - IF NOT a single non-empty 'uri' value, REJECT/RETURN 'client- - error-bad-request'. - IF the value length is greater than 1023 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - IF the URI syntax is not valid, REJECT/RETURN 'client-error-bad- - request'. - IF scheme is NOT in the Printer object's "reference-uri-schemes- - supported" attribute, REJECT/RETURN 'client-error-uri-scheme- - not-supported'. - The Printer object MAY check to see if the document exists and is - accessible. If the document is not found or is not accessible, - REJECT/RETURN 'client-error-not found'. - - - last-document (boolean) - - IF NEITHER a single 'true' NOR a single 'false' 'boolean' value, - REJECT/RETURN 'client-error-bad-request'. - IF the value length is NOT equal to 1 octet, REJECT/RETURN ' - client-error-request-value-too-long' - - - job-id (integer(1:MAX)) - - IF NOT an single 'integer' value equal to 4 octets AND in the - range 1 to MAX, REJECT/RETURN 'client-error-bad-request'. - - IF NOT a job-id of an existing Job object, REJECT/RETURN 'client- - error-not-found' or 'client-error-gone' status code, if keep - track of recently deleted jobs. - - - requested-attributes (1setOf keyword) - - IF NOT one or more 'keyword' values, REJECT/RETURN 'client-error- - bad-request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - Ignore unsupported values which are the keyword names of - unsupported attributes. Don't bother to copy such requested - (unsupported) attributes to the Unsupported Attribute response - group since the response will not return them. - - - -Hastings & Manros Informational [Page 22] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - which-jobs (type2 keyword) - - IF NOT a single 'keyword' value, REJECT/RETURN 'client-error-bad- - request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - IF NEITHER 'completed' NOR 'not-completed', copy the attribute and - the unsupported value to the Unsupported Attributes response - group and REJECT/RETURN 'client-error-attributes-or-values- - not-supported'. - Note: a Printer still supports the 'completed' value even if it - keeps no completed/canceled/aborted jobs: by returning no jobs - when so queried. - IF NOT supplied by the client, the IPP object assumes the 'not- - completed' value. - - - my-jobs (boolean) - - IF NEITHER a single 'true' NOR a single 'false' 'boolean' value, - REJECT/RETURN 'client-error-bad-request'. - IF the value length is NOT equal to 1 octet, REJECT/RETURN ' - client-error-request-value-too-long' - IF NOT supplied by the client, the IPP object assumes the 'false' - value. - - - limit (integer(1:MAX)) - - IF NOT a single 'integer' value equal to 4 octets AND in the range - 1 to MAX, REJECT/RETURN 'client-error-bad-request'. - IF NOT supplied by the client, the IPP object returns all jobs, no - matter how many. - -2.2.1.6 Validate the values of the OPTIONAL Operation attributes - - OPTIONAL Operation attributes are those that an IPP object MAY or MAY - NOT support. An IPP object validates the values of the OPTIONAL - attributes supplied by the client. The IPP object performs the same - syntactic validation checks for each OPTIONAL attribute value as in - Section 2.2.1.5. As in Section 2.2.1.5, if any fail, the IPP object - REJECTS the request and RETURNS the 'client-error-bad-request' or the - 'client-error-request-value-too-long' status code. - - In addition, the IPP object checks each Operation attribute value - against some Printer attribute or some hard-coded value if there is - no "xxx-supported" Printer attribute defined. If its value is not - among those supported or is not in the range supported, then the IPP - - - -Hastings & Manros Informational [Page 23] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - object REJECTS the request and RETURNS the error status code - indicated in the table. If the value of the Printer object's "xxx- - supported" attribute is 'no-value' (because the system administrator - hasn't configured a value), the check always fails. - - If the IPP object doesn't recognize/support an attribute, the IPP - object treats the attribute as an unknown or unsupported attribute - (see the last row in the table below). - - document-natural-language (naturalLanguage) - - IF NOT a single non-empty 'naturalLanguage' value, REJECT/RETURN ' - client-error-bad-request'. - IF the value length is greater than 63 octets, REJECT/RETURN ' - client-error-request-value-too-long'. - IF NOT a value that the Printer object supports in document - formats, (no corresponding "xxx-supported" Printer attribute), - REJECT/RETURN 'client-error-natural-language-not-supported'. - - - compression (type3 keyword) - - IF NOT a single 'keyword' value, REJECT/RETURN 'client-error-bad- - request'. - IF the value length is greater than 255 octets, REJECT/RETURN ' - client-error-request-value-too-long'. - IF NOT in the Printer object's "compression-supported" attribute, - copy the attribute and the unsupported value to the Unsupported - Attributes response group and REJECT/RETURN 'client-error- - attributes-or-values-not-supported'. - - - job-k-octets (integer(0:MAX)) - - IF NOT a single 'integer' value equal to 4 octets, - REJECT/RETURN 'client-error-bad-request'. - IF NOT in the range of the Printer object's "job-k-octets- - supported" attribute, copy the attribute and the unsupported - value to the Unsupported Attributes response group and - REJECT/RETURN 'client-error-attributes-or-values-not- - supported'. - - - job-impressions (integer(0:MAX)) - - IF NOT a single 'integer' value equal to 4 octets, - REJECT/RETURN 'client-error-bad-request'. - - - - -Hastings & Manros Informational [Page 24] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - IF NOT in the range of the Printer object's "job-impressions- - supported" attribute, copy the attribute and the unsupported - value to the Unsupported Attributes response group and - REJECT/RETURN 'client-error-attributes-or-values-not- - supported'. - - - job-media-sheets (integer(0:MAX)) - - IF NOT a single 'integer' value equal to 4 octets, - REJECT/RETURN 'client-error-bad-request'. - IF NOT in the range of the Printer object's "job-media-sheets- - supported" attribute, copy the attribute and the unsupported - value to the Unsupported Attributes response group and - REJECT/RETURN 'client-error-attributes-or-values-not- - supported'. - - - message (text(127)) - - IF NOT a single 'text' value, REJECT/RETURN 'client-error-bad- - request'. - IF the value length is greater than 127 octets, - REJECT/RETURN 'client-error-request-value-too-long'. - - - unknown or unsupported attribute - - IF the attribute syntax supplied by the client is supported but - the length is not legal for that attribute syntax, - REJECT/RETURN 'client-error-request-value-too-long'. - ELSE copy the attribute and value to the Unsupported Attributes - response group and change the attribute value to the "out-of- - band" 'unsupported' value, but otherwise ignore the attribute. - - Note: Future Operation attributes may be added to the protocol - specification that may occur anywhere in the specified group. - When the operation is otherwise successful, the IPP object returns - the 'successful-ok-ignored-or-substituted-attributes' status code. - Ignoring unsupported Operation attributes in all operations is - analogous to the handling of unsupported Job Template attributes - in the create and Validate-Job operations when the client supplies - the "ipp-attribute-fidelity" Operation attribute with the 'false' - value. This last rule is so that we can add OPTIONAL Operation - attributes to future versions of IPP so that older clients can - inter-work with new IPP objects and newer clients can inter-work - with older IPP objects. (If the new attribute cannot be ignored - without performing unexpectedly, the major version number would - - - -Hastings & Manros Informational [Page 25] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - have been increased in the protocol document and in the request). - This rule for Operation attributes is independent of the value of - the "ipp-attribute-fidelity" attribute. For example, if an IPP - object doesn't support the OPTIONAL "job-k-octets" attribute', the - IPP object treats "job-k-octets" as an unknown attribute and only - checks the length for the 'integer' attribute syntax supplied by - the client. If it is not four octets, the IPP object REJECTS the - request and RETURNS the 'client-error-bad-request' status code, - else the IPP object copies the attribute to the Unsupported - Attribute response group, setting the value to the "out-of-band" ' - unsupported' value, but otherwise ignores the attribute. - -2.2.2 Suggested Additional Processing Steps for Operations that - Create/Validate Jobs and Add Documents - - This section in combination with the previous section recommends the - processing steps for the Print-Job, Validate-Job, Print-URI, Create- - Job, Send-Document, and Send-URI operations that IPP objects SHOULD - use. These are the operations that create jobs, validate a Print-Job - request, and add documents to a job. - -2.2.2.1 Default "ipp-attribute-fidelity" if not supplied - - The Printer object checks to see if the client supplied an "ipp- - attribute-fidelity" Operation attribute. If the attribute is not - supplied by the client, the IPP object assumes that the value is - 'false'. - -2.2.2.2 Check that the Printer object is accepting jobs - - If the value of the Printer object's "printer-is-accepting-jobs" is - 'false', the Printer object REJECTS the request and RETURNS the - 'server-error-not-accepting-jobs' status code. - -2.2.2.3 Validate the values of the Job Template attributes - - An IPP object validates the values of all Job Template attribute - supplied by the client. The IPP object performs the analogous - syntactic validation checks of each Job Template attribute value that - it performs for Operation attributes (see Section 2.2.1.5.): - - a)that the length of each value is correct for the attribute - syntax tag supplied by the client according to [RFC2566] Section - 4.1. - - b)that the attribute syntax tag is correct for that attribute - according to [RFC2566] Sections 4.2 to 4.4. - - - - -Hastings & Manros Informational [Page 26] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - c)that multiple values are supplied only for multi-valued - attributes, i.e., that are 1setOf X according to [RFC2566] - Sections 4.2 to 4.4. - - As in Section 2.2.1.5, if any of these syntactic checks fail, the IPP - object REJECTS the request and RETURNS the 'client-error-bad-request' - or 'client-error-request-value-too-long' status code as appropriate, - independent of the value of the "ipp-attribute-fidelity". Since such - an error is most likely to be an error detected by a client - developer, rather than by an end-user, the IPP object NEED NOT return - an indication of which attribute had the error in either the - Unsupported Attributes Group or the Status Message. The description - for each of these syntactic checks is explicitly expressed in the - first IF statement in the following table. - - Each Job Template attribute MUST occur no more than once. If an IPP - Printer receives a create request with multiple occurrences of a Job - Template attribute, it MAY: - - 1.reject the operation and return the 'client-error-bad syntax' - error status code - - 2.accept the operation and use the first occurrence of the - attribute - - 3.accept the operation and use the last occurrence of the - attribute - - depending on implementation. Therefore, clients MUST NOT supply - multiple occurrences of the same Job Template attribute in the Job - Attributes group in the request. - -2.2.3 Algorithm for job validation - - The process of validating a Job-Template attribute "xxx" against a - Printer attribute "xxx-supported" can use the following validation - algorithm (see section 3.2.1.2 in [RFC2566]). - - To validate the value U of Job-Template attribute "xxx" against the - value V of Printer "xxx-supported", perform the following algorithm: - - 1.If U is multi-valued, validate each value X of U by performing - the algorithm in Table 3 with each value X. Each validation is - separate from the standpoint of returning unsupported values. - - Example: If U is "finishings" that the client supplies with - 'staple', 'bind' values, then X takes on the successive values: - 'staple', then 'bind' - - - -Hastings & Manros Informational [Page 27] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - 2.If V is multi-valued, validate X against each Z of V by - performing the algorithm in Table 3 with each value Z. If a - value Z validates, the validation for the attribute value X - succeeds. If it fails, the algorithm is applied to the next - value Z of V. If there are no more values Z of V, validation - fails. - - Example: If V is "sides-supported" with values: 'one-sided', - 'two-sided-long', and 'two-sided-short', then Z takes on the - successive values: 'one-sided', 'two-sided-long', and - 'two-sided-short'. If the client supplies "sides" with 'two- - sided-long', the first comparison fails ('one-sided' is not - equal to 'two-sided-long'), the second comparison succeeds - ('two-sided-long' is equal to 'two-sided-long"), and the third - comparison ('two-sided-short' with 'two-sided-long') is not even - performed. - - 3.If both U and V are single-valued, let X be U and Z be V and use - the validation rules in Table 3. - - Table 3 - Rules for validating single values X against Z - - attribute attribute validated if: - syntax of X syntax of Z - - integer rangeOfInteger X is within the range of - Z - - uri uriScheme the uri scheme in X is - equal to Z - - any boolean the value of Z is TRUE - - any any X and Z are of the same - type and are equal. - - If the value of the Printer object's "xxx-supported" attribute is ' - no-value' (because the system administrator hasn't configured a - value), the check always fails. If the check fails, the IPP object - copies the attribute to the Unsupported Attributes response group - with its unsupported value. If the attribute contains more than one - value, each value is checked and each unsupported value is separately - copied, while supported values are not copied. If an IPP object - doesn't recognize/support a Job Template attribute, i.e., there is no - corresponding Printer object "xxx-supported" attribute, the IPP - object treats the attribute as an unknown or unsupported attribute - (see the last row in the table below). - - - - -Hastings & Manros Informational [Page 28] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - If some Job Template attributes are supported for some document - formats and not for others or the values are different for different - document formats, the IPP object SHOULD take that into account in - this validation using the value of the "document-format" supplied by - the client (or defaulted to the value of the Printer's "document- - format-default" attribute, if not supplied by the client). For - example, if "number-up" is supported for the 'text/plain' document - format, but not for the 'application/postscript' document format, the - check SHOULD (though it NEED NOT) depend on the value of the - "document-format" operation attribute. See "document-format" in - [RFC2566] section 3.2.1.1 and 3.2.5.1. - - Note: whether the request is accepted or rejected is determined by - the value of the "ipp-attribute-fidelity" attribute in a subsequent - step, so that all Job Template attribute supplied are examined and - all unsupported attributes and/or values are copied to the - Unsupported Attributes response group. - - job-priority (integer(1:100)) - - IF NOT a single 'integer' value with a length equal to 4 octets, - REJECT/RETURN 'client-error-bad-request'. - IF NOT supplied by the client, use the value of the Printer - object's "job-priority-default" attribute at job submission - time. - IF NOT in the range 1 to 100, inclusive, copy the attribute and - the unsupported value to the Unsupported Attributes response - group. - Map the value to the nearest supported value in the range 1:100 as - specified by the number of discrete values indicated by the - value of the Printer's "job-priority-supported" attribute. See - the formula in [RFC2566] Section 4.2.1. - - job-hold-until (type3 keyword | name) - - IF NOT a single 'keyword' or 'name' value, REJECT/RETURN 'client- - error-bad-request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - IF NOT supplied by the client, use the value of the Printer - object's "job-hold-until" attribute at job submission time. - IF NOT in the Printer object's "job-hold-until-supported" - attribute, copy the attribute and the unsupported value to the - Unsupported Attributes response group. - - - - - - - -Hastings & Manros Informational [Page 29] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - job-sheets (type3 keyword | name) - - IF NOT a single 'keyword' or 'name' value, REJECT/RETURN 'client- - error-bad-request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - IF NOT in the Printer object's "job-sheets-supported" attribute, - copy the attribute and the unsupported value to the Unsupported - Attributes response group. - - multiple-document-handling (type2 keyword) - - IF NOT a single 'keyword' value, REJECT/RETURN 'client-error-bad- - request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - IF NOT in the Printer object's "multiple-document-handling- - supported" attribute, copy the attribute and the unsupported - value to the Unsupported Attributes response group. - - copies (integer(1:MAX)) - - IF NOT a single 'integer' value with a length equal to 4 octets, - REJECT/RETURN 'client-error-bad-request'. - IF NOT in range of the Printer object's "copies-supported" - attribute copy the attribute and the unsupported value to the - Unsupported - Attributes response group. - - finishings (1setOf type2 enum) - - IF NOT an 'enum' value(s) each with a length equal to 4 octets, - REJECT/RETURN 'client-error-bad-request'. - IF NOT in the Printer object's "finishings-supported" attribute, - copy the attribute and the unsupported value(s), but not any - supported values, to the Unsupported Attributes response group. - - page-ranges (1setOf rangeOfInteger(1:MAX)) - - IF NOT a 'rangeOfInteger' value(s) each with a length equal to 8 - octets, REJECT/RETURN 'client-error-bad-request'. - IF first value is greater than second value in any range, the - ranges are not in ascending order, or ranges overlap, - REJECT/RETURN 'client-error-bad-request'. - IF the value of the Printer object's "page-ranges-supported" - attribute is 'false', copy the attribute to the Unsupported - Attributes response group and set the value to the "out-of- - band" 'unsupported' value. - - - -Hastings & Manros Informational [Page 30] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - sides (type2 keyword) - - IF NOT a single 'keyword' value, REJECT/RETURN 'client-error-bad- - request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - IF NOT in the Printer object's "sides-supported" attribute, copy - the attribute and the unsupported value to the Unsupported - Attributes response group. - - number-up (integer(1:MAX)) - - IF NOT a single 'integer' value with a length equal to 4 octets, - REJECT/RETURN 'client-error-bad-request'. - IF NOT a value or in the range of one of the values of the Printer - object's "number-up-supported" attribute, copy the attribute - and value to the Unsupported Attribute response group. - - orientation-requested (type2 enum) - - IF NOT a single 'enum' value with a length equal to 4 octets, - REJECT/RETURN 'client-error-bad-request'. - IF NOT in the Printer object's "orientation-requested-supported" - attribute, copy the attribute and the unsupported value to the - Unsupported Attributes response group. - - media (type3 keyword | name) - - IF NOT a single 'keyword' or 'name' value, REJECT/RETURN 'client- - error-bad-request'. - IF the value length is greater than 255 octets, REJECT/RETURN - 'client-error-request-value-too-long'. - IF NOT in the Printer object's "media-supported" attribute, copy - the attribute and the unsupported value to the Unsupported - Attributes response group. - - printer-resolution (resolution) - - IF NOT a single 'resolution' value with a length equal to 9 - octets, - REJECT/RETURN 'client-error-bad-request'. - IF NOT in the Printer object's "printer-resolution-supported" - attribute, copy the attribute and the unsupported value to the - Unsupported Attributes response group. - - - - - - - -Hastings & Manros Informational [Page 31] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - print-quality (type2 enum) - - IF NOT a single 'enum' value with a length equal to 4 octets, - REJECT/RETURN 'client-error-bad-request'. - IF NOT in the Printer object's "print-quality-supported" - attribute, copy the attribute and the unsupported value to the - Unsupported Attributes response group. - - unknown or unsupported attribute (i.e., there is no corresponding - Printer object "xxx-supported" attribute) - - IF the attribute syntax supplied by the client is supported but - the length is not legal for that attribute syntax, - REJECT/RETURN 'client-error-bad-request' if the length of the - attribute syntax is fixed or 'client-error-request-value-too- - long' if the length of the attribute syntax is variable. - ELSE copy the attribute and value to the Unsupported Attributes - response group and change the attribute value to the "out-of- - band" 'unsupported' value. Any remaining Job Template - Attributes are either unknown or unsupported Job Template - attributes and are validated algorithmically according to their - attribute syntax for proper length (see below). - - If the attribute syntax is supported AND the length check - fails, the IPP object REJECTS the request and RETURNS the ' - client-error-bad-request' if the length of the attribute syntax - is fixed or the 'client-error-request-value-too-long' status - code if the length of the attribute syntax is variable. - Otherwise, the IPP object copies the unsupported Job Template - attribute to the Unsupported Attributes response group and - changes the attribute value to the "out-of-band" 'unsupported' - value. The following table shows the length checks for all - attribute syntaxes. In the following table: "<=" means less - than or equal, "=" means equal to: - - Name Octet length check for read-write attributes - ----------- -------------------------------------------- - 'textWithLanguage <= 1023 AND 'naturalLanguage' <= 63 - 'textWithoutLanguage' <= 1023 - 'nameWithLanguage' <= 255 AND 'naturalLanguage' <= 63 - 'nameWithoutLanguage' <= 255 - 'keyword' <= 255 - 'enum' = 4 - 'uri' <= 1023 - 'uriScheme' <= 63 - 'charset' <= 63 - 'naturalLanguage' <= 63 - 'mimeMediaType' <= 255 - - - -Hastings & Manros Informational [Page 32] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - 'octetString' <= 1023 - 'boolean' = 1 - 'integer' = 4 - 'rangeOfInteger' = 8 - 'dateTime' = 11 - 'resolution' = 9 - '1setOf X' - -2.2.3.1 Check for conflicting Job Template attributes values - - Once all the Operation and Job Template attributes have been checked - individually, the Printer object SHOULD check for any conflicting - values among all the supported values supplied by the client. For - example, a Printer object might be able to staple and to print on - transparencies, however due to physical stapling constraints, the - Printer object might not be able to staple transparencies. The IPP - object copies the supported attributes and their conflicting - attribute values to the Unsupported Attributes response group. The - Printer object only copies over those attributes that the Printer - object either ignores or substitutes in order to resolve the - conflict, and it returns the original values which were supplied by - the client. For example suppose the client supplies "finishings" - equals 'staple' and "media" equals 'transparency', but the Printer - object does not support stapling transparencies. If the Printer - chooses to ignore the stapling request in order to resolve the - conflict, the Printer objects returns "finishings" equal to 'staple' - in the Unsupported Attributes response group. If any attributes are - multi-valued, only the conflicting values of the attributes are - copied. - - Note: The decisions made to resolve the conflict (if there is a - choice) is implementation dependent. - -2.2.3.2 Decide whether to REJECT the request - - If there were any unsupported Job Template attributes or - unsupported/conflicting Job Template attribute values and the client - supplied the "ipp-attribute-fidelity" attribute with the 'true' - value, the Printer object REJECTS the request and return the status - code: - - (1) 'client-error-conflicting-attributes' status code, if there - were any conflicts between attributes supplied by the client. - (2) 'client-error-attributes-or-values-not-supported' status code, - otherwise. - - - - - - -Hastings & Manros Informational [Page 33] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Note: Unsupported Operation attributes or values that are returned - do not affect the status returned in this step. If the unsupported - Operation attribute was a serious error, the above already rejected - the request in a previous step. If control gets to this step with - unsupported Operation attributes being returned, they are not serious - errors. - -2.2.3.3 For the Validate-Job operation, RETURN one of the success - status codes - - If the requested operation is the Validate-Job operation, the Printer - object returns: - - (1) the "successful-ok" status code, if there are no unsupported - or conflicting Job Template attributes or values. - (2) the "successful-ok-conflicting-attributes, if there are any - conflicting Job Template attribute or values. - (3) the "successful-ok-ignored-or-substituted-attributes, if there - are only unsupported Job Template attributes or values. - - Note: Unsupported Operation attributes or values that are returned - do not affect the status returned in this step. If the unsupported - Operation attribute was a serious error, the above already rejected - the request in a previous step. If control gets to this step with - unsupported Operation attributes being returned, they are not serious - errors. - -2.2.3.4 Create the Job object with attributes to support - - If "ipp-attribute-fidelity" is set to 'false' (or it was not supplied - by the client), the Printer object: - - (1) creates a Job object, assigns a unique value to the job's - "job-uri" and "job-id" attributes, and initializes all of the - job's other supported Job Description attributes. - (2) removes all unsupported attributes from the Job object. - (3) for each unsupported value, removes either the unsupported - value or substitutes the unsupported attribute value with some - supported value. If an attribute has no values after removing - unsupported values from it, the attribute is removed from the - Job object (so that the normal default behavior at job - processing time will take place for that attribute). - (4) for each conflicting value, removes either the conflicting - value or substitutes the conflicting attribute value with some - other supported value. If an attribute has no values after - removing conflicting values from it, the attribute is removed - from the Job object (so that the normal default behavior at - job processing time will take place for that attribute). - - - -Hastings & Manros Informational [Page 34] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - If there were no attributes or values flagged as unsupported, or the - value of 'ipp-attribute-fidelity" was 'false', the Printer object is - able to accept the create request and create a new Job object. If - the "ipp-attribute-fidelity" attribute is set to 'true', the Job - Template attributes that populate the new Job object are necessarily - all the Job Template attributes supplied in the create request. If - the "ipp-attribute-fidelity" attribute is set to 'false', the Job - Template attributes that populate the new Job object are all the - client supplied Job Template attributes that are supported or that - have value substitution. Thus, some of the requested Job Template - attributes may not appear in the Job object because the Printer - object did not support those attributes. The attributes that - populate the Job object are persistently stored with the Job object - for that Job. A Get-Job-Attributes operation on that Job object will - return only those attributes that are persistently stored with the - Job object. - - Note: All Job Template attributes that are persistently stored with - the Job object are intended to be "override values"; that is, they - that take precedence over whatever other embedded instructions might - be in the document data itself. However, it is not possible for all - Printer objects to realize the semantics of "override". End users - may query the Printer's "pdl-override-supported" attribute to - determine if the Printer either attempts or does not attempt to - override document data instructions with IPP attributes. - - There are some cases, where a Printer supports a Job Template - attribute and has an associated default value set for that attribute. - In the case where a client does not supply the corresponding - attribute, the Printer does not use its default values to populate - Job attributes when creating the new Job object; only Job Template - attributes actually in the create request are used to populate the - Job object. The Printer's default values are only used later at Job - processing time if no other IPP attribute or instruction embedded in - the document data is present. - - Note: If the default values associated with Job Template attributes - that the client did not supply were to be used to populate the Job - object, then these values would become "override values" rather than - defaults. If the Printer supports the 'attempted' value of the - "pdl-override-supported" attribute, then these override values could - replace values specified within the document data. This is not the - intent of the default value mechanism. A default value for an - attribute is used only if the create request did not specify that - attribute (or it was ignored when allowed by "ipp-attribute-fidelity" - being 'false') and no value was provided within the content of the - document data. - - - - -Hastings & Manros Informational [Page 35] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - If the client does not supply a value for some Job Template - attribute, and the Printer does not support that attribute, as far as - IPP is concerned, the result of processing that Job (with respect to - the missing attribute) is undefined. - -2.2.3.5 Return one of the success status codes - - Once the Job object has been created, the Printer object accepts the - request and returns to the client: - - (1) the 'successful-ok' status code, if there are no unsupported - or conflicting Job Template attributes or values. - (2) the 'successful-ok-conflicting-attributes' status code, if - there are any conflicting Job Template attribute or values. - (3) the 'successful-ok-ignored-or-substituted-attributes' status - code, if there are only unsupported Job Template attributes or - values. - - Note: Unsupported Operation attributes or values that are returned - do not affect the status returned in this step. If the unsupported - Operation attribute was a serious error, the above already rejected - the request in a previous step. If control gets to this step with - unsupported Operation attributes being returned, they are not serious - errors. - - The Printer object also returns Job status attributes that indicate - the initial state of the Job ('pending', 'pending-held', ' - processing', etc.), etc. See Print-Job Response, [RFC2566] section - 3.2.1.2. - -2.2.3.6 Accept appended Document Content - - The Printer object accepts the appended Document Content data and - either starts it printing, or spools it for later processing. - -2.2.3.7 Scheduling and Starting to Process the Job - - The Printer object uses its own configuration and implementation - specific algorithms for scheduling the Job in the correct processing - order. Once the Printer object begins processing the Job, the - Printer changes the Job's state to 'processing'. If the Printer - object supports PDL override (the "pdl-override-supported" attribute - set to 'attempted'), the implementation does its best to see that IPP - attributes take precedence over embedded instructions in the document - data. - - - - - - -Hastings & Manros Informational [Page 36] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -2.2.3.8 Completing the Job - - The Printer object continues to process the Job until it can move the - Job into the 'completed' state. If an Cancel-Job operation is - received, the implementation eventually moves the Job into the ' - canceled' state. If the system encounters errors during processing - that do not allow it to progress the Job into a completed state, the - implementation halts all processing, cleans up any resources, and - moves the Job into the 'aborted' state. - -2.2.3.9 Destroying the Job after completion - - Once the Job moves to the 'completed', 'aborted', or 'canceled' - state, it is an implementation decision as to when to destroy the Job - object and release all associated resources. Once the Job has been - destroyed, the Printer would return either the "client-error-not- - found" or "client-error-gone" status codes for operations directed at - that Job. - - Note: the Printer object SHOULD NOT re-use a "job-uri" or "job-id" - value for a sufficiently long time after a job has been destroyed, so - that stale references kept by clients are less likely to access the - wrong (newer) job. - -2.2.3.10 Interaction with "ipp-attribute-fidelity" - - Some Printer object implementations may support "ipp-attribute- - fidelity" set to 'true' and "pdl-override-supported" set to ' - attempted' and yet still not be able to realize exactly what the - client specifies in the create request. This is due to legacy - decisions and assumptions that have been made about the role of job - instructions embedded within the document data and external job - instructions that accompany the document data and how to handle - conflicts between such instructions. The inability to be 100% - precise about how a given implementation will behave is also - compounded by the fact that the two special attributes, "ipp- - attribute-fidelity" and "pdl-override-supported", apply to the whole - job rather than specific values for each attribute. For example, some - implementations may be able to override almost all Job Template - attributes except for "number-up". - -2.3 Status codes returned by operation - - This section lists all status codes once in the first operation - (Print-Job). Then it lists the status codes that are different or - specialized for subsequent operations under each operation. - - - - - -Hastings & Manros Informational [Page 37] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -2.3.1 Printer Operations - -2.3.1.1 Print-Job - - The Printer object MUST return one of the following "status-code" - values for the indicated reason. Whether all of the document data - has been accepted or not before returning the success or error - response depends on implementation. See Section 14 for a more - complete description of each status code. - - For the following success status codes, the Job object has been - created and the "job-id", and "job-uri" assigned and returned in the - response: - - successful-ok: no request attributes were substituted or ignored. - successful-ok-ignored-or-substituted-attributes: some supplied - (1) attributes were ignored or (2) unsupported attribute - syntaxes or values were substituted with supported values or - were ignored. Unsupported attributes, attribute syntaxes, or - values MUST be returned in the Unsupported Attributes group of - the response. - successful-ok-conflicting-attributes: some supplied attribute - values conflicted with the values of other supplied attributes - and were either substituted or ignored. Attributes or values - which conflict with other attributes and have been substituted - or ignored MUST be returned in the Unsupported Attributes group - of the response as supplied by the client. - - [RFC2566] section 3.1.6 Operation Status Codes and Messages states: - - If the Printer object supports the "status-message" operation - attribute, it SHOULD use the REQUIRED 'utf-8' charset to return - a status message for the following error status codes (see - section 14): 'client-error-bad-request', 'client-error- - charset-not-supported', 'server-error-internal-error', ' - server-error-operation-not-supported', and 'server-error- - version-not-supported'. In this case, it MUST set the value of - the "attributes-charset" operation attribute to 'utf-8' in the - error response. - - For the following error status codes, no job is created and no "job- - id" or "job-uri" is returned: - - client-error-bad-request: The request syntax does not conform to - the specification. - - - - - - -Hastings & Manros Informational [Page 38] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - client-error-forbidden: The request is being refused for - authorization or authentication reasons. The implementation - security policy is to not reveal whether the failure is one of - authentication or authorization. - client-error-not-authenticated: Either the request requires - authentication information to be supplied or the authentication - information is not sufficient for authorization. - client-error-not-authorized: The requester is not authorized to - perform the request on the target object. - client-error-not-possible: The request cannot be carried out - because of the state of the system. See also 'server-error- - not-accepting-jobs' status code which MUST take precedence if - the Printer object's "printer-accepting-jobs" attribute is ' - false'. - client-error-timeout: not applicable. - client-error-not-found: the target object does not exist. - client-error-gone: the target object no longer exists and no - forwarding address is known. - client-error-request-entity-too-large: the size of the request - and/or print data exceeds the capacity of the IPP Printer to - process it. - client-error-request-value-too-long: the size of request variable - length attribute values, such as 'text' and 'name' attribute - syntaxes, exceed the maximum length specified in [RFC2566] for - the attribute and MUST be returned in the Unsupported - Attributes Group. - client-error-document-format-not-supported: the document format - supplied is not supported. The "document-format" attribute - with the unsupported value MUST be returned in the Unsupported - Attributes Group. This error SHOULD take precedence over any - other 'xxx-not-supported' error, except 'client-error-charset- - not-supported'. - client-error-attributes-or-values-not-supported: one or more - supplied attributes, attribute syntaxes, or values are not - supported and the client supplied the "ipp-attributes-fidelity" - operation attribute with a 'true' value. They MUST be returned - in the Unsupported Attributes Group as explained below. - client-error-uri-scheme-not-supported: not applicable. - client-error-charset-not-supported: the charset supplied in the - "attributes-charset" operation attribute is not supported. The - Printer's "configured-charset" MUST be returned in the response - as the value of the "attributes-charset" operation attribute - and used for any 'text' and 'name' attributes returned in the - error response. This error SHOULD take precedence over any - other error, unless the request syntax is so bad that the - client's supplied "attributes-charset" cannot be determined. - - - - - -Hastings & Manros Informational [Page 39] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - client-error-conflicting-attributes: one or more supplied - attribute va attribute values conflicted with each other and - the client supplied the "ipp-attributes-fidelity" operation - attribute with a 'true' value. They MUST be returned in the - Unsupported Attributes Group as explained below. - server-error-internal-error: an unexpected condition prevents the - request from being fulfilled. - server-error-operation-not-supported: not applicable (since - Print-Job is REQUIRED). - server-error-service-unavailable: the service is temporarily - overloaded. - server-error-version-not-supported: the version in the request is - not supported. The "closest" version number supported MUST be - returned in the response. - server-error-device-error: a device error occurred while - receiving or spooling the request or document data or the IPP - Printer object can only accept one job at a time. - server-error-temporary-error: a temporary error such as a buffer - full write error, a memory overflow, or a disk full condition - occurred while receiving the request and/or the document data. - server-error-not-accepting-jobs: the Printer object's "printer- - is-not-accepting-jobs" attribute is 'false'. - server-error-busy: the Printer is too busy processing jobs to - accept another job at this time. - server-error-job-canceled: the job has been canceled by an - operator or the system while the client was transmitting the - document data. - -2.3.1.2 Print-URI - - All of the Print-Job status codes described in Section 3.2.1.2 - Print-Job Response are applicable to Print-URI with the following - specializations and differences. See Section 14 for a more complete - description of each status code. - - server-error-uri-scheme-not-supported: the URI scheme supplied in - the "document-uri" operation attribute is not supported and is - returned in the Unsupported Attributes group. - -2.3.1.3 Validate-Job - - All of the Print-Job status codes described in Section 3.2.1.2 - Print-Job Response are applicable to Validate-Job. See Section 14 - for a more complete description of each status code. - - - - - - - -Hastings & Manros Informational [Page 40] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -2.3.1.4 Create-Job - - All of the Print-Job status codes described in Section 3.2.1.2 - Print-Job Response are applicable to Create-Job with the following - specializations and differences. See Section 14 for a more complete - description of each status code. - - server-error-operation-not-supported: the Create-Job operation is - not supported. - -2.3.1.5 Get-Printer-Attributes - - All of the Print-Job status codes described in Section 3.2.1.2 - Print-Job Response are applicable to the Get-Printer-Attributes - operation with the following specializations and differences. See - Section 14 for a more complete description of each status code. - - For the following success status codes, the requested attributes are - returned in Group 3 in the response: - - successful-ok: no request attributes were substituted or ignored - (same as Print-Job) and no requested attributes were - unsupported. - successful-ok-ignored-or-substituted-attributes: same as Print- - Job, except the "requested-attributes" operation attribute MAY, - but NEED NOT, be returned with the unsupported values. - successful-ok-conflicting-attributes: same as Print-Job. - - For the error status codes, Group 3 is returned containing no - attributes or is not returned at all: - - client-error-not-possible: Same as Print-Job, in addition the - Printer object is not accepting any requests. - client-error-request-entity-too-large: same as Print-job, except - that no print data is involved. - client-error-attributes-or-values-not-supported: not applicable, - since unsupported operation attributes MUST be ignored and ' - successful-ok-ignored-or-substituted-attributes' returned. - client-error-conflicting-attributes: same as Print-Job, except - that "ipp-attribute-fidelity" is not involved. - server-error-operation-not-supported: not applicable (since Get- - Printer-Attributes is REQUIRED). - server-error-device-error: same as Print-Job, except that no - document data is involved. - server-error-temporary-error: same as Print-Job, except that no - document data is involved. - server-error-not-accepting-jobs: not applicable. - - - - -Hastings & Manros Informational [Page 41] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - server-error-busy: same as Print-Job, except the IPP object is - too busy to accept even query requests. - server-error-job-canceled: not applicable. - -2.3.1.6 Get-Jobs - - All of the Print-Job status codes described in Section 3.2.1.2 - Print-Job Response are applicable to the Get-Jobs operation with the - following specializations and differences. See Section 14 for a - more complete description of each status code. - - For the following success status codes, the requested attributes are - returned in Group 3 in the response: - - successful-ok: no request attributes were substituted or ignored - (same as Print-Job) and no requested attributes were - unsupported. - successful-ok-ignored-or-substituted-attributes: same as Print- - Job, except the "requested-attributes" operation attribute MAY, - but NEED NOT, be returned with the unsupported values. - successful-ok-conflicting-attributes: same as Print-Job. - - For any error status codes, Group 3 is returned containing no - attributes or is not returned at all. The following brief error - status code descriptions contain unique information for use with - Get-Jobs operation. See section 14 for the other error status codes - that apply uniformly to all operations: - - client-error-not-possible: Same as Print-Job, in addition the - Printer object is not accepting any requests. - client-error-request-entity-too-large: same as Print-job, except - that no print data is involved. - client-error-document-format-not-supported: not applicable. - client-error-attributes-or-values-not-supported: not applicable, - since unsupported operation attributes MUST be ignored and ' - successful-ok-ignored-or-substituted-attributes' returned. - client-error-conflicting-attributes: same as Print-Job, except - that "ipp-attribute-fidelity" is not involved. - server-error-operation-not-supported: not applicable (since Get- - Jobs is REQUIRED). - server-error-device-error: same as Print-Job, except that no - document data is involved. - server-error-temporary-error: same as Print-Job, except that no - document data is involved. - server-error-not-accepting-jobs: not applicable. - server-error-job-canceled: not applicable. - - - - - -Hastings & Manros Informational [Page 42] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -2.3.2 Job Operations - -2.3.2.1 Send-Document - - All of the Print-Job status codes described in Section 3.2.1.2 - Print-Job Response are applicable to the Get-Printer-Attributes - operation with the following specializations and differences. See - Section 14 for a more complete description of each status code. - - For the following success status codes, the document has been added - to the specified Job object and the job's "number-of-documents" - attribute has been incremented: - - successful-ok: no request attributes were substituted or ignored - (same as Print-Job). - successful-ok-ignored-or-substituted-attributes: same as Print- - Job. - successful-ok-conflicting-attributes: same as Print-Job. - - For the error status codes, no document has been added to the Job - object and the job's "number-of-documents" attribute has not been - incremented: - - client-error-not-possible: Same as Print-Job, except that the - Printer's "printer-is-accepting-jobs" attribute is not - involved, so that the client is able to finish submitting a - multi-document job after this attribute has been set to 'true'. - Another condition is that the state of the job precludes Send- - Document, i.e., the job has already been closed out by the - client. However, if the IPP Printer closed out the job due to - timeout, the 'client-error-timeout' error status SHOULD be - returned instead. - client-error-timeout: This request was sent after the Printer - closed the job, because it has not received a Send-Document or - Send-URI operation within the Printer's "multiple-operation- - time-out" period. - client-error-request-entity-too-large: same as Print-Job. - client-error-conflicting-attributes: same as Print-Job, except - that "ipp-attributes-fidelity" operation attribute is not - involved. - server-error-operation-not-supported: the Send-Document request - is not supported. - server-error-not-accepting-jobs: not applicable. - server-error-job-canceled: the job has been canceled by an - operator or the system while the client was transmitting the - data. - - - - - -Hastings & Manros Informational [Page 43] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -2.3.2.2 Send-URI - - All of the Print-Job status code descriptions in Section 3.2.1.2 - Print-Job Response with the specializations described for Send- - Document are applicable to Send-URI. See Section 14 for a more - complete description of each status code. - - server-error-uri-scheme-not-supported: the URI scheme supplied in - the "document-uri" operation attribute is not supported and the - "document-uri" attribute MUST be returned in the Unsupported - Attributes group. - -2.3.2.3 Cancel-Job - - All of the Print-Job status codes described in Section 3.2.1.2 - Print-Job Response are applicable to Cancel-Job with the following - specializations and differences. See Section 14 for a more complete - description of each status code. - - For the following success status codes, the Job object is being - canceled or has been canceled: - - successful-ok: no request attributes were substituted or ignored - (same as Print-Job). - successful-ok-ignored-or-substituted-attributes: same as Print- - Job. - successful-ok-conflicting-attributes: same as Print-Job. - - For any of the error status codes, the Job object has not been - canceled or was previously canceled. - - client-error-not-possible: The request cannot be carried out - because of the state of the Job object ('completed', ' - canceled', or 'aborted') or the state of the system. - client-error-not-found: the target Printer and/or Job object does - not exist. - client-error-gone: the target Printer and/or Job object no longer - exists and no forwarding address is known. - client-error-request-entity-too-large: same as Print-Job, except - no document data is involved. - client-error-document-format-not-supported: not applicable. - client-error-attributes-or-values-not-supported: not applicable, - since unsupported operation attributes and values MUST be - ignored. - client-error-conflicting-attributes: same as Print-Job, except - that the Printer's "printer-is-accepting-jobs" attribute is not - involved. - - - - -Hastings & Manros Informational [Page 44] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - server-error-operation-not-supported: not applicable (Cancel-Job - is REQUIRED). - server-error-device-error: same as Print-Job, except no document - data is involved. - server-error-temporary-error: same as Print-Job, except no - document data is involved. - server-error-not-accepting-jobs: not applicable. - server-error-job-canceled: not applicable. - -2.3.2.4 Get-Job-Attributes - - All of the Print-Job status codes described in Section 3.2.1.2 - Print-Job Response are applicable to Get-Job-Attributes with the - following specializations and differences. See Section 14 for a more - complete description of each status code. - - For the following success status codes, the requested attributes are - returned in Group 3 in the response: - - successful-ok: no request attributes were substituted or ignored - (same as Print-Job) and no requested attributes were - unsupported. - successful-ok-ignored-or-substituted-attributes: same as Print- - Job, except the "requested-attributes" operation attribute MAY, - but NEED NOT, be returned with the unsupported values. - successful-ok-conflicting-attributes: same as Print-Job. - - For the error status codes, Group 3 is returned containing no - attributes or is not returned at all. - - client-error-not-possible: Same as Print-Job, in addition the - Printer object is not accepting any requests. - client-error-document-format-not-supported: not applicable. - client-error-attributes-or-values-not-supported: not applicable. - client-error-uri-scheme-not-supported: not applicable. - client-error-conflicting-attributes: not applicable - server-error-operation-not-supported: not applicable (since Get- - Job-Attributes is REQUIRED). - server-error-device-error: same as Print-Job, except no document - data is involved. - server-error-temporary-error: sane as Print-Job, except no - document data is involved. - server-error-not-accepting-jobs: not applicable. server-error- - job-canceled: not applicable. - - - - - - - -Hastings & Manros Informational [Page 45] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -2.4 Validate-Job - - The Validate-Job operation has been designed so that its - implementation may be a part of the Print-Job operation. Therefore, - requiring Validate-Job is not a burden on implementers. Also it is - useful for client's to be able to count on its presence in all - conformance implementations, so that the client can determine before - sending a long document, whether the job will be accepted by the IPP - Printer or not. - -2.5 Case Sensitivity in URIs - - IPP client and server implementations must be aware of the diverse - uppercase/lowercase nature of URIs. RFC 2396 defines URL schemes and - Host names as case insensitive but reminds us that the rest of the - URL may well demonstrate case sensitivity. When creating URL's for - fields where the choice is completely arbitrary, it is probably best - to select lower case. However, this cannot be guaranteed and - implementations MUST NOT rely on any fields being case-sensitive or - case-insensitive in the URL beyond the URL scheme and host name - fields. - - The reason that the IPP specification does not make any restrictions - on URIs, is so that implementations of IPP may use off-the-shelf - components that conform to the standards that define URIs, such as - RFC 2396 and the HTTP/1.1 specifications [RFC2068]. See these - specifications for rules of matching, comparison, and case- - sensitivity. - - It is also recommended that System Administrators and implementations - avoid creating URLs for different printers that differ only in their - case. For example, don't have Printer1 and printer1 as two different - IPP Printers. - - The HTTP/1.1 specification [RFC2068] contains more details on - comparing URLs. - -2.6 Character Sets, natural languages, and internationalization - - This section discusses character set support, natural language - support and internationalization. - -2.6.1 Character set code conversion support - - IPP clients and IPP objects are REQUIRED to support UTF-8. They MAY - support additional charsets. It is RECOMMENDED that an IPP object - also support US-ASCII, since many clients support US-ASCII, and - indicate that UTF-8 and US-ASCII are supported by populating the - - - -Hastings & Manros Informational [Page 46] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Printer's "charset-supported" with 'utf-8' and 'us-ascii' values. An - IPP object is required to code covert with as little loss as possible - between the charsets that it supports, as indicated in the Printer's - "charsets-supported" attribute. - - How should the server handle the situation where the "attributes- - charset" of the response itself is "us-ascii", but one or more - attributes in that response is in the "utf-8" format? - - Example: Consider a case where a client sends a Print-Job request - with "utf-8" as the value of "attributes-charset" and with the "job- - name" attribute supplied. Later another client submits a Get-Job- - Attribute or Get-Jobs request. This second request contains the - "attributes-charset" with value "us-ascii" and "requested-attributes" - attribute with exactly one value "job-name". - - According to the RFC2566 document (section 3.1.4.2), the value of the - "attributes-charset" for the response of the second request must be - "us-ascii" since that is the charset specified in the request. The - "job-name" value, however, is in "utf-8" format. Should the request - be rejected even though both "utf-8" and "us-ascii" charsets are - supported by the server? or should the "job-name" value be converted - to "us-ascii" and return "successful-ok-conflicting-attributes" - (0x0002) as the status code? - - Answer: An IPP object that supports both utf-8 (REQUIRED) and us- - ascii, the second paragraph of section 3.1.4.2 applies so that the - IPP object MUST accept the request, perform code set conversion - between these two charsets with "the highest fidelity possible" and - return 'successful-ok', rather than a warning 'successful-ok- - conflicting-attributes, or an error. The printer will do the best it - can to convert between each of the character sets that it supports-- - even if that means providing a string of question marks because none - of the characters are representable in US ASCII. If it can't perform - such conversion, it MUST NOT advertise us-ascii as a value of its - "attributes-charset-supported" and MUST reject any request that - requests 'us-ascii'. - - One IPP object implementation strategy is to convert all request text - and name values to a Unicode internal representation. This is 16-bit - and virtually universal. Then convert to the specified operation - attributes-charset on output. - - Also it would be smarter for a client to ask for 'utf-8', rather than - 'us-ascii' and throw away characters that it doesn't understand, - rather than depending on the code conversion of the IPP object. - - - - - -Hastings & Manros Informational [Page 47] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -2.6.2 What charset to return when an unsupported charset is requested? - - Section 3.1.4.1 Request Operation attributes was clarified in - November 1998 as follows: - - All clients and IPP objects MUST support the 'utf-8' charset - [RFC2044] and MAY support additional charsets provided that they - are registered with IANA [IANA-CS]. If the Printer object does - not support the client supplied charset value, the Printer object - MUST reject the request, set the "attributes-charset" to 'utf-8' - in the response, and return the 'client-error-charset-not- - supported' status code and any 'text' or 'name' attributes using - the 'utf-8' charset. - - Since the client and IPP object MUST support UTF-8, returning any - text or name attributes in UTF-8 when the client requests a charset - that is not supported should allow the client to display the text or - name. - - Since such an error is a client error, rather than a user error, the - client should check the status code first so that it can avoid - displaying any other returned 'text' and 'name' attributes that are - not in the charset requested. - - Furthermore, [RFC2566] section 14.1.4.14 client-error-charset-not- - supported (0x040D) was clarified in November 1998 as follows: - - For any operation, if the IPP Printer does not support the charset - supplied by the client in the "attributes-charset" operation - attribute, the Printer MUST reject the operation and return this - status and any 'text' or 'name' attributes using the 'utf-8' - charset (see Section 3.1.4.1). - -2.6.3 Natural Language Override (NLO) - - The 'text' and 'name' attributes each have two forms. One has an - implicit natural language, and the other has an explicit natural - language. The 'textWithoutLanguage' and 'textWithoutLanguage' are - the two 'text' forms. The 'nameWithoutLanguage" and ' - nameWithLanguage are the two 'name' forms. If a receiver (IPP object - or IPP client) supports an attribute with attribute syntax 'text', it - MUST support both forms in a request and a response. A sender (IPP - client or IPP object) MAY send either form for any such attribute. - When a sender sends a WithoutLanguage form, the implicit natural - language is specified in the "attributes-natural-language" operation - attribute which all senders MUST include in every request and - response. - - - - -Hastings & Manros Informational [Page 48] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - When a sender sends a WithLanguage form, it MAY be different from the - implicit natural language supplied by the sender or it MAY be the - same. The receiver MUST treat either form equivalently. - - There is an implementation decision for senders, whether to always - send the WithLanguage forms or use the WithoutLanguage form when the - attribute's natural language is the same as the request or response. - The former approach makes the sender implementation simpler. The - latter approach is more efficient on the wire and allows inter- - working with non-conforming receivers that fail to support the - WithLanguage forms. As each approach have advantages, the choice is - completely up to the implementer of the sender. - - Furthermore, when a client receives a 'text' or 'name' job attribute - that it had previously supplied, that client MUST NOT expect to see - the attribute in the same form, i.e., in the same WithoutLanguage or - WithLanguage form as the client supplied when it created the job. - The IPP object is free to transform the attribute from the - WithLanguage form to the WithoutLanguage form and vice versa, as long - as the natural language is preserved. However, in order to meet this - latter requirement, it is usually simpler for the IPP object - implementation to store the natural language explicitly with the - attribute value, i.e., to store using an internal representation that - resembles the WithLanguage form. - - The IPP Printer MUST copy the natural language of a job, i.e., the - value of the "attributes-natural-language" operation attribute - supplied by the client in the create operation, to the Job object as - a Job Description attribute, so that a client is able to query it. - In returning a Get-Job-Attributes response, the IPP object MAY return - one of three natural language values in the response's "attributes- - natural-language" operation attribute: (1) that requested by the - requester, (2) the natural language of the job, or (3) the configured - natural language of the IPP Printer, if the requested language is not - supported by the IPP Printer. - - This "attributes-natural-language" Job Description attribute is - useful for an IPP object implementation that prints start sheets in - the language of the user who submitted the job. This same Job - Description attribute is useful to a multi-lingual operator who has - to communicate with different job submitters in different natural - languages. This same Job Description attribute is expected to be - used in the future to generate notification messages in the natural - language of the job submitter. - - Early drafts of [RFC2566] contained a job-level natural language - override (NLO) for the Get-Jobs response. A job-level (NLO) is an - (unrequested) Job Attribute which then specified the implicit natural - - - -Hastings & Manros Informational [Page 49] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - language for any other WithoutLanguage job attributes returned in the - response for that job. Interoperability testing of early - implementations showed that no one was implementing the job-level NLO - in Get-Job responses. So the job-level NLO was eliminated from the - Get- Jobs response. This simplification makes all requests and - responses consistent in that the implicit natural language for any - WithoutLanguage 'text' or 'name' form is always supplied in the - request's or response's "attributes-natural-language" operation - attribute. - -2.7 The "queued-job-count" Printer Description attribute - -2.7.1 Why is "queued-job-count" RECOMMENDED? - - The reason that "queued-job-count" is RECOMMENDED, is that some - clients look at that attribute alone when summarizing the status of a - list of printers, instead of doing a Get-Jobs to determine the number - of jobs in the queue. Implementations that fail to support the - "queued-job-count" will cause that client to display 0 jobs when - there are actually queued jobs. - - We would have made it a REQUIRED Printer attribute, but some - implementations had already been completed before the issue was - raised, so making it a SHOULD was a compromise. - -2.7.2 Is "queued-job-count" a good measure of how busy a printer is? - - The "queued-job-count" is not a good measure of how busy the printer - is when there are held jobs. A future registration could be to add a - "held-job-count" (or an "active-job-count") Printer Description - attribute if experience shows that such an attribute (combination) is - needed to quickly indicate how busy a printer really is. - -2.8 Sending empty attribute groups - - The [RFC2566] and [RFC2565] specifications RECOMMEND that a sender - not send an empty attribute group in a request or a response. - However, they REQUIRE a receiver to accept an empty attribute group - as equivalent to the omission of that group. So a client SHOULD omit - the Job Template Attributes group entirely in a create operation that - is not supplying any Job Template attributes. Similarly, an IPP - object SHOULD omit an empty Unsupported Attributes group if there are - no unsupported attributes to be returned in a response. - - - - - - - - -Hastings & Manros Informational [Page 50] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - The [RFC2565] specification REQUIRES a receiver to be able to receive - either an empty attribute group or an omitted attribute group and - treat them equivalently. The term "receiver" means an IPP object for - a request and a client for a response. The term "sender' means a - client for a request and an IPP object for a response. - - There is an exception to the rule for Get-Jobs when there are no - attributes to be returned. [RFC2565] contains the following - paragraph: - - The syntax allows an xxx-attributes-tag to be present when the - xxx-attribute-sequence that follows is empty. The syntax is - defined this way to allow for the response of Get-Jobs where no - attributes are returned for some job-objects. Although it is - RECOMMENDED that the sender not send an xxx-attributes-tag if - there are no attributes (except in the Get-Jobs response just - mentioned), the receiver MUST be able to decode such syntax. - -2.9 Returning unsupported attributes in Get-Xxxx responses - - In the Get-Printer-Attributes, Get-Jobs, or Get-Job-Attributes - responses, the client cannot depend on getting unsupported attributes - returned in the Unsupported Attributes group that the client - requested, but are not supported by the IPP object. However, such - unsupported requested attributes will not be returned in the Job - Attributes or Printer Attributes group (since they are unsupported). - Furthermore, the IPP object is REQUIRED to return the 'successful- - ok-ignored-or-substituted-attributes' status code, so that the client - knows that not all that was requested has been returned. - -2.10 Returning job-state in Print-Job response - - An IPP client submits a small job via Print-Job. By the time the IPP - printer/print server is putting together a response to the operation, - the job has finished printing and been removed as an object from the - print system. What should the job-state be in the response? - - The Model suggests that the Printer return a response before it even - accepts the document content. The Job Object Attributes are returned - only if the IPP object returns one of the success status codes. Then - the job-state would always be "pending" or "pending-held". - - This issue comes up for the implementation of an IPP Printer object - as a server that forwards jobs to devices that do not provide job - status back to the server. If the server is reasonably certain that - the job completed successfully, then it should return the job-state - as 'completed'. Also the server can keep the job in its "job - history" long after the job is no longer in the device. Then a user - - - -Hastings & Manros Informational [Page 51] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - could query the server and see that the job was in the 'completed' - state and completed as specified by the job's "time-at-completed" - time which would be the same as the server submitted the job to the - device. - - An alternative is for the server to respond to the client before or - while sending the job to the device, instead of waiting until the - server has finished sending the job to the device. In this case, the - server can return the job's state as 'pending' with the 'job- - outgoing' value in the job's "job-state-reasons" attribute. - - If the server doesn't know for sure whether the job completed - successfully (or at all), it could return the (out-of-band) 'unknown' - value. - - On the other hand, if the server is able to query the device and/or - setup some sort of event notification that the device initiates when - the job makes state transitions, then the server can return the - current job state in the Print-Job response and in subsequent queries - because the server knows what the job state is in the device (or can - query the device). - - All of these alternatives depend on implementation of the server and - the device. - -2.11 Flow controlling the data portion of a Print-Job request - - A paused printer (or one that is stopped due to paper out or jam or - spool space full or buffer space full, may flow control the data of a - Print-Job operation (at the TCP/IP layer), so that the client is not - able to send all the document data. Consequently, the Printer will - not return a response until the condition is changed. - - The Printer should not return a Print-Job response with an error code - in any of these conditions, since either the printer will be resumed - and/or the condition will be freed either by human intervention or as - jobs print. - - In writing test scripts to test IPP Printers, the script must also be - written not to expect a response, if the printer has been paused, - until the printer is resumed, in order to work with all possible - implementations. - -2.12 Multi-valued attributes - - What is the attribute syntax for a multi-valued attribute? Since - some attributes support values in more than one data type, such as - "media", "job-hold-until", and "job-sheets", IPP semantics associate - - - -Hastings & Manros Informational [Page 52] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - the attribute syntax with each value, not with the attribute as a - whole. The protocol associates the attribute syntax tag with each - value. Don't be fooled, just because the attribute syntax tag comes - before the attribute keyword. All attribute values after the first - have a zero length attribute keyword as the indication of a - subsequent value of the same attribute. - -2.13 Querying jobs with IPP that were submitted using other job - submission protocols - - The following clarification was added to [RFC2566] section 8.5: - - 8.5 Queries on jobs submitted using non-IPP protocols - - If the device that an IPP Printer is representing is able to - accept jobs using other job submission protocols in addition to - IPP, it is RECOMMEND that such an implementation at least allow - such "foreign" jobs to be queried using Get-Jobs returning "job- - id" and "job-uri" as 'unknown'. Such an implementation NEED NOT - support all of the same IPP job attributes as for IPP jobs. The - IPP object returns the 'unknown' out-of-band value for any - requested attribute of a foreign job that is supported for IPP - jobs, but not for foreign jobs. - - It is further RECOMMENDED, that the IPP Printer generate "job-id" - and "job-uri" values for such "foreign jobs", if possible, so that - they may be targets of other IPP operations, such as Get-Job- - Attributes and Cancel-Job. Such an implementation also needs to - deal with the problem of authentication of such foreign jobs. One - approach would be to treat all such foreign jobs as belonging to - users other than the user of the IPP client. Another approach - would be for the foreign job to belong to 'anonymous'. Only if - the IPP client has been authenticated as an operator or - administrator of the IPP Printer object, could the foreign jobs be - queried by an IPP request. Alternatively, if the security policy - is to allow users to query other users' jobs, then the foreign - jobs would also be visible to an end-user IPP client using Get- - Jobs and Get-Job-Attributes. - - Thus IPP MAY be implemented as a "universal" protocol that provides - access to jobs submitted with any job submission protocol. As IPP - becomes widely implemented, providing a more universal access makes - sense. - - - - - - - - -Hastings & Manros Informational [Page 53] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -2.14 The 'none' value for empty sets - - [RFC2566] states that the 'none' value should be used as the value of - a 1SetOf when the set is empty. In most cases, sets that are - potentially empty contain keywords so the keyword 'none' is used, but - for the 3 finishings attributes, the values are enums and thus the - empty set is represented by the enum 3. Currently there are no other - attributes with 1SetOf values which can be empty and can contain - values that are not keywords. This exception requires special code - and is a potential place for bugs. It would have been better if we - had chosen an out-of-band value, either "no-value" or some new value, - such as 'none'. Since we didn't, implementations have to deal with - the different representations of 'none', depending on the attribute - syntax. - -2.15 Get-Jobs, my-jobs='true', and 'requesting-user-name'? - - In [RFC2566] section 3.2.6.1 'Get-Jobs Request', if the attribute ' - my-jobs' is present and set to TRUE, MUST the 'requesting-user-name' - attribute be there to, and if it's not present what should the IPP - printer do? - - [RFC2566] Section 8.3 describes the various cases of "requesting- - user-name" being present or not for any operation. If the client - does not supply a value for "requesting-user-name", the printer MUST - assume that the client is supplying some anonymous name, such as - "anonymous". - -2.16 The "multiple-document-handling" Job Template attribute and support - of multiple document jobs - - ISSUE: IPP/1.0 is silent on which of the four effects an - implementation would perform if it supports Create-Job, but does not - support "multiple-document-handling". - - A fix to IPP/1.0 would be to require implementing all four values of - "multiple-document-handling" if Create-Job is supported at all. Or - at least 'single-document-new-sheet' and 'separate-documents- - uncollated-copies'. In any case, an implementation that supports - Create-Job SHOULD also support "multiple-document-handling". Support - for all four values is RECOMMENDED, but at least the 'single- - document-new-sheet' and 'separate-documents-uncollated-copies' - values, along with the "multiple-document-handling-default" - indicating the default behavior and "multiple-document-handling- - supported" values. If an implementation spools the data, it should - also support the 'separate-documents-collated-copies' value as well. - - - - - -Hastings & Manros Informational [Page 54] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -3 Encoding and Transport - - This section discusses various aspects of IPP/1.0 Encoding and - Transport [RFC2565]. - - A server is not required to send a response until after it has - received the client.s entire request. Hence, a client must not - expect a response until after it has sent the entire request. - However, we recommend that the server return a response as soon as - possible if an error is detected while the client is still sending - the data, rather than waiting until all of the data is received. - Therefore, we also recommend that a client listen for an error - response that an IPP server MAY send before it receives all the data. - In this case a client, if chunking the data, can send a premature - zero-length chunk to end the request before sending all the data (and - so the client can keep the connection open for other requests, rather - than closing it). If the request is blocked for some reason, a client - MAY determine the reason by opening another connection to query the - server using Get-Printer-Attributes. - - In the following sections, there are a tables of all HTTP headers - which describe their use in an IPP client or server. The following - is an explanation of each column in these tables. - - - the .header. column contains the name of a header. - - the .request/client. column indicates whether a client sends the - header. - - the .request/ server. column indicates whether a server supports - the header when received. - - the .response/ server. column indicates whether a server sends - the header. - - the .response /client. column indicates whether a client - supports the header when received. - - the .values and conditions. column specifies the allowed header - values and the conditions for the header to be present in a - request/response. - - The table for .request headers. does not have columns for responses, - and the table for .response headers. does not have columns for - requests. - - The following is an explanation of the values in the .request/client. - and .response/ server. columns. - - - must: the client or server MUST send the header, - - must-if: the client or server MUST send the header when the - condition described in the .values and conditions. column is - met, - - - -Hastings & Manros Informational [Page 55] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - - may: the client or server MAY send the header - - not: the client or server SHOULD NOT send the header. It is not - relevant to an IPP implementation. - - The following is an explanation of the values in the - .response/client. and .request/ server. columns. - - - must: the client or server MUST support the header, - - may: the client or server MAY support the header - - not: the client or server SHOULD NOT support the header. It is - not relevant to an IPP implementation. - -3.1 General Headers - - - The following is a table for the general headers. - - - General- Request Response Values and Conditions - Header - - Client Server Server Client - - Cache- must not must not .no-cache. only - Control - - Connection must-if must must- must .close. only. Both - if client and server - SHOULD keep a - connection for the - duration of a sequence - of operations. The - client and server MUST - include this header - for the last operation - in such a sequence. - - Date may may must may per RFC 1123 [RFC1123] - from RFC 2068 - [RFC2068] - - Pragma must not must not .no-cache. only - - Transfer- must-if must must- must .chunked. only . - Encoding if Header MUST be present - if Content-Length is - absent. - - - - -Hastings & Manros Informational [Page 56] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Upgrade not not not not - - Via not not not not - -3.2 Request Headers - - - The following is a table for the request headers. - - - Request-Header Client Server Request Values and Conditions - - Accept may must .application/ipp. only. This - value is the default if the - - Request-Header Client Server Request Values and Conditions - - client omits it - - Accept-Charset not not Charset information is within - the application/ipp entity - - Accept-Encoding may must empty and per RFC 2068 [RFC2068] - and IANA registry for content- - codings - - Accept-Language not not language information is within - the application/ipp entity - - Authorization must-if must per RFC 2068. A client MUST send - this header when it receives a - 401 .Unauthorized. response and - does not receive a .Proxy- - Authenticate. header. - - From not not per RFC 2068. Because RFC - recommends sending this header - only with the user.s approval, it - is not very useful - - Host must must per RFC 2068 - - If-Match not not - - If-Modified- not not - Since - - If-None-Match not not - - - -Hastings & Manros Informational [Page 57] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - If-Range not not - - If-Unmodified- not not - Since - - Max-Forwards not not - - Proxy- must-if not per RFC 2068. A client MUST send - Authorization this header when it receives a - 401 .Unauthorized. response and a - .Proxy-Authenticate. header. - - Range not not - - Referer not not - - User-Agent not not - - -3.3 Response Headers - - - The following is a table for the request headers. - - - Response- Server Client Response Values and Conditions - Header - - Accept-Ranges not not - - Age not not - - Location must-if may per RFC 2068. When URI needs - redirection. - - Proxy- not must per RFC 2068 - Authenticate - - Public may may per RFC 2068 - - Retry-After may may per RFC 2068 - - Server not not - - Vary not not - - Warning may may per RFC 2068 - - - - -Hastings & Manros Informational [Page 58] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - WWW- must-if must per RFC 2068. When a server needs to - Authenticate authenticate a client. - -3.4 Entity Headers - - - The following is a table for the entity headers. - - - Entity-Header Request Response Values and Conditions - - Client Server Server Client - - Allow not not not not - - Content-Base not not not not - - Content- may must must must per RFC 2068 and IANA - Encoding registry for content - codings. - - Content- not not not not Application/ipp - Language handles language - - Content- must-if must must-if must the length of the - Length message-body per RFC - 2068. Header MUST be - present if Transfer- - - Entity-Header Request Response Values and Conditions - - Client Server Server Client - - Encoding is absent. - - Content- not not not not - Location - - Content-MD5 may may may may per RFC 2068 - - Content-Range not not not not - - Content-Type must must must must .application/ipp. - only - - ETag not not not not - - Expires not not not not - - - -Hastings & Manros Informational [Page 59] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Last-Modified not not not not - - -3.5 Optional support for HTTP/1.0 - - IPP implementations consist of an HTTP layer and an IPP layer. In - the following discussion, the term "client" refers to the HTTP client - layer and the term "server" refers to the HTTP server layer. The - Encoding and Transport document [RFC2565] requires that HTTP 1.1 MUST - be supported by all clients and all servers. However, a client - and/or a server implementation may choose to also support HTTP 1.0. - - - This option means that a server may choose to communicate with a - (non-conforming) client that only supports HTTP 1.0. In such cases - the server should not use any HTTP 1.1 specific parameters or - features and should respond using HTTP version number 1.0. - - - This option also means that a client may choose to communicate with - a (non-conforming) server that only supports HTTP 1.0. In such - cases, if the server responds with an HTTP .unsupported version - number. to an HTTP 1.1 request, the client should retry using HTTP - version number 1.0. - -3.6 HTTP/1.1 Chunking - -3.6.1 Disabling IPP Server Response Chunking - - Clients MUST anticipate that the HTTP/1.1 server may chunk responses - and MUST accept them in responses. However, a (non-conforming) HTTP - client that is unable to accept chunked responses may attempt to - request an HTTP 1.1 server not to use chunking in its response to an - operation by using the following HTTP header: - - TE: identity - - This mechanism should not be used by a server to disable a client - from chunking a request, since chunking of document data is an - important feature for clients to send long documents. - -3.6.2 Warning About the Support of Chunked Requests - - This section describes some problems with the use of chunked requests - and HTTP/1.1 servers. - - The HTTP/1.1 standard [HTTP] requires that conforming servers support - chunked requests for any method. However, in spite of this - requirement, some HTTP/1.1 implementations support chunked responses - in the GET method, but do not support chunked POST method requests. - - - -Hastings & Manros Informational [Page 60] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - Some HTTP/1.1 implementations that support CGI scripts [CGI] and/or - servlets [Servlet] require that the client supply a Content-Length. - These implementations might reject a chunked POST method and return a - 411 status code (Length Required), might attempt to buffer the - request and run out of room returning a 413 status code (Request - Entity Too Large), or might successfully accept the chunked request. - - Because of this lack of conformance of HTTP servers to the HTTP/1.1 - standard, the IPP standard [RFC2565] REQUIRES that a conforming IPP - Printer object implementation support chunked requests and that - conforming clients accept chunked responses. Therefore, IPP object - implementers are warned to seek HTTP server implementations that - support chunked POST requests in order to conform to the IPP standard - and/or use implementation techniques that support chunked POST - requests. - -4 References - - [CGI] Coar, K. and D. Robinson, "The WWW Common Gateway Interface - Version 1.1 (CGI/1.1)", Work in Progress. - - [HTTP] Fielding, R., Gettys,J., Mogul, J., Frystyk,, H., Masinter, - L., Leach, P. and T. Berners-Lee, "Hypertext Transfer - Protocol -- HTTP/1.1", RFC 2616, June 1999. - - [RFC2569] Herriot, R., Hastings, T., Jacobs, N. and J. Martin, - "Mapping between LPD and IPP Protocols", RFC 2569, April - 1999. - - [RFC2566] deBry, R., Hastings, T., Herriot, R., Isaacson, S. and P. - Powell, "Internet Printing Protocol/1.0: Model and - Semantics", RFC 2566, April 1999. - - [RFC2565] Herriot, R., Butler, S., Moore, P. and R. Tuner, "Internet - Printing Protocol/1.0: Encoding and Transport", RFC 2565, - April 1999. - - [RFC2568] Zilles, S., "Rationale for the Structure and Model and - Protocol for the Internet Printing Protocol", RFC 2568, - April 1999. - - [RFC2567] Wright, D., "Design Goals for an Internet Printing - Protocol", RFC 2567, April 1999. - - [RFC1123] Braden, S., "Requirements for Internet Hosts - Application - and Support", STD 3, RFC 1123, October 1989. - - - - - -Hastings & Manros Informational [Page 61] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - [RFC2026] Bradner, S., "The Internet Standards Process -- Revision - 3", BCP 9, RFC 2026, October 1996. - - [RFC2068] Fielding, R., Gettys, J., Mogul, J., Frystyk, H. and T. - Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC - 2068, January 1997. - - [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate - Requirement Levels", BCP 14, RFC 2119, March 1997. - - [RFC2396] Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform - Resource Identifiers (URI): Generic Syntax", RFC 2396, - August 1998. - - [Servlet] Servlet Specification Version 2.1 - (http://java.sun.com/products/servlet/2.1/index.html). - - [SSL] Netscape, The SSL Protocol, Version 3, (Text version 3.02), - November 1996. - -4.1 Authors' Addresses - - Thomas N. Hastings - Xerox Corporation - 701 Aviation Blvd. - El Segundo, CA 90245 - - EMail: hastings@cp10.es.xerox.com - - - Carl-Uno Manros - Xerox Corporation - 701 Aviation Blvd. - El Segundo, CA 90245 - - EMail: manros@cp10.es.xerox.com - -5 Security Considerations - - Security issues are discussed in sections 2.2, 2.3.1, and 8.5. - -6 Notices - - The IETF takes no position regarding the validity or scope of any - intellectual property or other rights that might be claimed to - pertain to the implementation or use of the technology described in - this document or the extent to which any license under such rights - might or might not be available; neither does it represent that it - - - -Hastings & Manros Informational [Page 62] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - - has made any effort to identify any such rights. Information on the - IETF's procedures with respect to rights in standards-track and - standards-related documentation can be found in BCP-11 [BCP-11]. - Copies of claims of rights made available for publication and any - assurances of licenses to be made available, or the result of an - attempt made to obtain a general license or permission for the use of - such proprietary rights by implementers or users of this - specification can be obtained from the IETF Secretariat. - - The IETF invites any interested party to bring to its attention any - copyrights, patents or patent applications, or other proprietary - rights which may cover technology that may be required to practice - this standard. Please address the information to the IETF Executive - Director. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Hastings & Manros Informational [Page 63] - -RFC 2639 IPP/1.0: Implementer's Guide July 1999 - - -Full Copyright Statement - - Copyright (C) The Internet Society (1999). All Rights Reserved. - - This document and translations of it may be copied and furnished to - others, and derivative works that comment on or otherwise explain it - or assist in its implementation may be prepared, copied, published - and distributed, in whole or in part, without restriction of any - kind, provided that the above copyright notice and this paragraph are - included on all such copies and derivative works. However, this - document itself may not be modified in any way, such as by removing - the copyright notice or references to the Internet Society or other - Internet organizations, except as needed for the purpose of - developing Internet standards in which case the procedures for - copyrights defined in the Internet Standards process must be - followed, or as required to translate it into languages other than - English. - - The limited permissions granted above are perpetual and will not be - revoked by the Internet Society or its successors or assigns. - - This document and the information contained herein is provided on an - "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING - TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING - BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION - HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF - MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - -Acknowledgement - - Funding for the RFC Editor function is currently provided by the - Internet Society. - - - - - - - - - - - - - - - - - - - -Hastings & Manros Informational [Page 64] - diff --git a/standards/rfc3196.txt b/standards/rfc3196.txt new file mode 100644 index 0000000000..50b7c2d974 --- /dev/null +++ b/standards/rfc3196.txt @@ -0,0 +1,5379 @@ + + + + + + +Network Working Group T. Hastings +Request for Comments: 3196 C. Manros +Obsoletes: 2639 P. Zehler +Category: Informational Xerox Corporation + C. Kugler + IBM Printing Systems Co + H. Holst + i-data Printing Systems + November 2001 + + + Internet Printing Protocol/1.1: Implementor's Guide + +Status of this Memo + + This memo provides information for the Internet community. It does + not specify an Internet standard of any kind. Distribution of this + memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (2001). All Rights Reserved. + +Abstract + + This document is one of a set of documents, which together describe + all aspects of a new Internet Printing Protocol (IPP). + +Table of Contents + + 1 Introduction................................................... 4 + 1.1 Conformance language........................................ 5 + 1.2 Other terminology........................................... 6 + 1.3 Issues Raised from Interoperability Testing Events.......... 6 + 2 IPP Objects.................................................... 6 + 3 IPP Operations................................................. 7 + 3.1 Common Semantics............................................ 7 + 3.1.1 Summary of Operation Attributes............................ 8 + 3.1.2 Suggested Operation Processing Steps for IPP Objects....... 16 + 3.1.2.1 Suggested Operation Processing Steps for all Operations. 17 + 3.1.2.1.1 Validate version number............................... 18 + 3.1.2.1.2 Validate operation identifier......................... 20 + 3.1.2.1.3 Validate the request identifier....................... 20 + 3.1.2.1.4 Validate attribute group and attribute presence and + order................................................. 20 + 3.1.2.1.4.1 Validate the presence and order of attribute groups. 20 + 3.1.2.1.4.2 Ignore unknown attribute groups in the expected + position............................................ 21 + + + +Hastings, et al. Informational [Page 1] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + 3.1.2.1.4.3 Validate the presence of a single occurrence of + required Operation attributes....................... 21 + 3.1.2.1.5 Validate the values of the REQUIRED Operation + attributes............................................ 29 + 3.1.2.1.6 Validate the values of the OPTIONAL Operation + attributes............................................ 33 + 3.1.2.2 Suggested Additional Processing Steps for Operations + that Create/Validate Jobs and Add Documents............. 37 + 3.1.2.2.1 Default "ipp-attribute-fidelity" if not supplied...... 37 + 3.1.2.2.2 Check that the Printer object is accepting jobs....... 38 + 3.1.2.2.3 Validate the values of the Job Template attributes.... 38 + 3.1.2.3 Algorithm for job validation............................ 39 + 3.1.2.3.1 Check for conflicting Job Template attributes values.. 45 + 3.1.2.3.2 Decide whether to REJECT the request.................. 46 + 3.1.2.3.3 For the Validate-Job operation, RETURN one of the + success status codes.................................. 48 + 3.1.2.3.4 Create the Job object with attributes to support...... 48 + 3.1.2.3.5 Return one of the success status codes................ 50 + 3.1.2.3.6 Accept appended Document Content...................... 50 + 3.1.2.3.7 Scheduling and Starting to Process the Job............ 50 + 3.1.2.3.8 Completing the Job.................................... 50 + 3.1.2.3.9 Destroying the Job after completion................... 51 + 3.1.2.3.10 Interaction with "ipp-attribute-fidelity"............. 51 + 3.1.2.3.11 Character set code conversion support................. 51 + 3.1.2.3.12 What charset to return when an unsupported charset is + requested (Issue 1.19)?....... ....................... 52 + 3.1.2.3.13 Natural Language Override (NLO)....................... 53 + 3.1.3 Status codes returned by operation......................... 55 + 3.1.3.1 Printer Operations...................................... 55 + 3.1.3.1.1 Print-Job............................................. 55 + 3.1.3.1.2 Print-URI............................................. 58 + 3.1.3.1.3 Validate-Job.......................................... 58 + 3.1.3.1.4 Create-Job............................................ 58 + 3.1.3.1.5 Get-Printer-Attributes................................ 59 + 3.1.3.1.6 Get-Jobs.............................................. 60 + 3.1.3.1.7 Pause-Printer......................................... 61 + 3.1.3.1.8 Resume-Printer........................................ 62 + 3.1.3.1.8.1 What about Printers unable to change state due to + an error condition?................................. 63 + 3.1.3.1.8.2 How is "printer-state" handled on Resume-Printer?... 63 + 3.1.3.1.9 Purge-Printer......................................... 63 + 3.1.3.2 Job Operations.......................................... 64 + 3.1.3.2.1 Send-Document......................................... 64 + 3.1.3.2.2 Send-URI.............................................. 65 + 3.1.3.2.3 Cancel-Job............................................ 65 + 3.1.3.2.4 Get-Job-Attributes.................................... 67 + 3.1.3.2.5 Hold-Job.............................................. 68 + 3.1.3.2.6 Release-Job........................................... 69 + + + +Hastings, et al. Informational [Page 2] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + 3.1.3.2.7 Restart-Job........................................... 69 + 3.1.3.2.7.1 Can documents be added to a restarted job?.......... 69 + 3.1.4 Returning unsupported attributes in Get-Xxxx responses + (Issue 1.18)............................................... 70 + 3.1.5 Sending empty attribute groups............................. 70 + 3.2 Printer Operations.......................................... 71 + 3.2.1 Print-Job operation........................................ 71 + 3.2.1.1 Flow controlling the data portion of a Print-Job + request (Issue 1.22).................................... 71 + 3.2.1.2 Returning job-state in Print-Job response (Issue 1.30).. 71 + 3.2.2 Get-Printer-Attributes operation........................... 72 + 3.2.3 Get-Jobs operation......................................... 72 + 3.2.3.1 Get-Jobs, my-jobs='true', and 'requesting-user-name' + (Issue 1.39)?.......................................... 72 + 3.2.3.2 Why is there a "limit" attribute in the Get-Jobs + operation?.............................................. 73 + 3.2.4 Create-Job operation....................................... 73 + 3.3 Job Operations.............................................. 74 + 3.3.1 Validate-Job............................................... 74 + 3.3.2 Restart-Job................................................ 74 + 4 Object Attributes.............................................. 74 + 4.1 Attribute Syntax's.......................................... 74 + 4.1.1 The 'none' value for empty sets (Issue 1.37)............... 74 + 4.1.2 Multi-valued attributes (Issue 1.31)....................... 75 + 4.1.3 Case Sensitivity in URIs (issue 1.6)....................... 75 + 4.1.4 Maximum length for xxxWithLanguage and xxxWithoutLanguage.. 76 + 4.2 Job Template Attributes..................................... 76 + 4.2.1 multiple-document-handling(type2 keyword).................. 76 + 4.2.1.1 Support of multiple document jobs....................... 76 + 4.3 Job Description Attributes.................................. 76 + 4.3.1 Getting the date and time of day........................... 76 + 4.4 Printer Description Attributes.............................. 77 + 4.4.1 queued-job-count (integer(0:MAX)).......................... 77 + 4.4.1.1 Why is "queued-job-count" RECOMMENDED (Issue 1.14)?..... 77 + 4.4.1.2 Is "queued-job-count" a good measure of how busy a + printer is (Issue 1.15)?................................ 77 + 4.4.2 printer-current-time (dateTime)............................ 78 + 4.4.3 Printer-uri................................................ 78 + 4.5 Empty Jobs.................................................. 79 + 5 Directory Considerations....................................... 79 + 5.1 General Directory Schema Considerations..................... 79 + 5.2 IPP Printer with a DNS name................................. 79 + 6 Security Considerations........................................ 80 + 6.1 Querying jobs with IPP that were submitted using other job + submission protocols (Issue 1.32)........................... 80 + 7 Encoding and Transport......................................... 81 + 7.1 General Headers............................................. 83 + 7.2 Request Headers............................................ 84 + + + +Hastings, et al. Informational [Page 3] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + 7.3 Response Headers............................................ 86 + 7.4 Entity Headers............................................. 87 + 7.5 Optional support for HTTP/1.0............................... 88 + 7.6 HTTP/1.1 Chunking........................................... 88 + 7.6.1 Disabling IPP Server Response Chunking..................... 88 + 7.6.2 Warning About the Support of Chunked Requests.............. 88 + 8 References..................................................... 89 + 9 Authors' Addresses............................................. 91 + 10 Description of the Base IPP Documents.......................... 94 + 11 Full Copyright Statement....................................... 96 + +Tables + + Table 1 - Summary of Printer operation attributes that sender MUST + supply ................................................. 8 + Table 2 - Summary of Printer operation attributes that sender MAY + supply ................................................. 10 + Table 3 - Summary of Job operation attributes that sender MUST + supply.................................................. 12 + Table 4 - Summary of Job operation attributes that sender MAY + supply.................................................. 14 + Table 5 - Printer operation response attributes................... 16 + Table 6 - Examples of validating IPP version...................... 19 + Table 7 - Rules for validating single values X against Z.......... 40 + +1. Introduction + + IPP is an application level protocol that can be used for distributed + printing using Internet tools and technologies. This document + contains information that supplements the IPP Model and Semantics + [RFC2911] and the IPP Transport and Encoding [RFC2910] documents. It + is intended to help implementers understand IPP/1.1, as well as + IPP/1.0 [RFC2565, RFC2566], and some of the considerations that may + assist them in the design of their client and/or IPP object + implementation. For example, a typical order of processing requests + is given, including error checking. Motivation for some of the + specification decisions is also included. + + This document obsoletes RFC 2639 which was the Implementor's Guide + for IPP/1.0. The IPP Implementor's Guide (IIG) (this document) + contains information that supplements the IPP Model and Semantics + [RFC2911] and the IPP Transport and Encoding [RFC2910] documents. + This document is just one of a suite of documents that fully define + IPP. The base set of IPP documents includes: + + Design Goals for an Internet Printing Protocol [RFC2567] + Rationale for the Structure and Model and Protocol for the + Internet Printing Protocol [RFC2568] + + + +Hastings, et al. Informational [Page 4] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Internet Printing Protocol/1.1: Model and Semantics [RFC2911] + Internet Printing Protocol/1.1: Encoding and Transport [RFC2910] + Internet Printing Protocol/1.1: Implementor's Guide (this + document) + Mapping between LPD and IPP Protocols [RFC2569] + + See section 10 for a description of these base IPP documents. Anyone + reading these documents for the first time is strongly encouraged to + read the IPP documents in the above order. + + As such the information in this document is not part of the formal + specification of IPP/1.1. Instead information is presented to help + implementers understand IPP/1.1, as well as IPP/1.0 [RFC2565, + RFC2566], including some of the motivation for decisions taken by the + committee in developing the specification. Some of the + implementation considerations are intended to help implementers + design their client and/or IPP object implementations. If there are + any contradictions between this document and [RFC2911] or [RFC2910], + those documents take precedence over this document. + + Platform-specific implementation considerations will be included in + this guide as they become known. + + Note: In order to help the reader of the IIG and the IPP Model and + Semantics document, the sections in this document parallel the + corresponding sections in the Model document and are numbered the + same for ease of cross reference. The sections that correspond to + the IPP Transport and Encoding are correspondingly offset. + +1.1 Conformance language + + Usually, this document does not contain the terminology MUST, MUST + NOT, MAY, NEED NOT, SHOULD, SHOULD NOT, REQUIRED, and OPTIONAL. + However, when those terms do appear in this document, their intent is + to repeat what the [RFC2911] and [RFC2910] documents require and + allow, rather than specifying additional conformance requirements. + These terms are defined in section 12 on conformance terminology in + [RFC2911], most of which is taken from RFC 2119 [RFC2119]. + + Implementers should read section 12 (APPENDIX A) in [RFC2911] in + order to understand these capitalized words. The words MUST, MUST + NOT, and REQUIRED indicate what implementations are required to + support in a client or IPP object in order to be conformant to + [RFC2911] and [RFC2910]. MAY, NEED NOT, and OPTIONAL indicate was is + merely allowed as an implementer option. The verbs SHOULD and SHOULD + NOT indicate suggested behavior, but which is not required or + disallowed, respectively, in order to conform to the specification. + + + + +Hastings, et al. Informational [Page 5] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +1.2 Other terminology + + This document uses other terms, such as "attributes", "operation", + and "Printer" as defined in [RFC2911] section 12. In addition, the + term "sender" refers to the client that sends a request or an IPP + object that returns a response. The term "receiver" refers to the + IPP object that receives a request and to a client that receives a + response. + +1.3 Issues Raised from Interoperability Testing Events + + The IPP WG has conducted three open Interoperability Testing Events. + The first one was held in September 1998, the second one was held in + March 1999, and the third one was held in October 2000. See the + summary reports in: + + ftp://ftp.pwg.org/pub/pwg/ipp/new_TES/ + + The issues raised from the first Interoperability Testing Event are + numbered 1.n in this document and have been incorporated into + "IPP/1.0 Model and Semantics" [RFC2566] and the "IPP/1.0 Encoding and + Transport" [RFC2565] documents. However, some of the discussion is + left here in the Implementor's Guide to help understanding. + + The issues raised from the second Interoperability Testing Event are + numbered 2.n in this document have been incorporated into "IPP/1.1 + Model and Semantics" [RFC2911] and the "IPP/1.1 Encoding and + Transport" [RFC2910] documents. However, some of the discussion is + left here in the Implementor's Guide to help understanding. + + The issues raised from the third Interoperability Testing Event are + numbered 3.n in this document and are described in: + + ftp://ftp.pwg.org/pub/pwg/ipp/Issues/Issues-raised-at-Bake- + Off3.pdf + + ftp://ftp.pwg.org/pub/pwg/ipp/Issues/Issues-raised-at-Bake- + Off3.doc + + ftp://ftp.pwg.org/pub/pwg/ipp/Issues/Issues-raised-at-Bake- + Off3.txt + + + + + + + + + + +Hastings, et al. Informational [Page 6] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +2. IPP Objects + + The term "client" in IPP is intended to mean any client that issues + IPP operation requests and accepts IPP operation responses, whether + it be a desktop or a server. In other words, the term "client" does + not just mean end-user clients, such as those associated with + desktops. + + The term "IPP Printer" in IPP is intended to mean an object that + accepts IPP operation requests and returns IPP operation responses, + whether implemented in a server or a device. An IPP Printer object + MAY, if implemented in a server, turn around and forward received + jobs (and other requests) to other devices and print + servers/services, either using IPP or some other protocol. + +3 IPP Operations + + This section corresponds to Section 3 "IPP Operations" in the + IPP/1.1 Model and Semantics document [RFC2911]. + +3.1 Common Semantics + + This section discusses semantics common to all operations. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 7] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.1.1 Summary of Operation Attributes + + Table 1 - Summary of Printer operation attributes that sender MUST + supply + +Printer Operations + + Requests Responses + Operation PJ, PU CJ GPA GJ PP, All + Attributes VJ (O) (O) (R) (R) RP, Operations + (R) PP + (O+) + + Operation parameters--REQUIRED to be supplied by the sender: + + operation-id R R R R R R + + status-code R + + request-id R R R R R R R + + version-number R R R R R R R + + Operation attributes--REQUIRED to be supplied by the sender: + + attributes- R R R R R R R + charset + + attributes- R R R R R R R + natural- + language + + document-uri R + + job-id* + + job-uri* + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 8] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +Printer Operations + + Requests Responses + + Operation PJ, PU CJ GPA GJ PP, All + Attributes VJ (O) (O) (R) (R) RP, Operations + (R) PP + (O+) + last-document + + printer-uri R R R R R R + + Operation attributes--RECOMMENDED to be supplied by the + sender: + + job-name R R R + + requesting-user- R R R R R R + name + + Legend: + + PJ, VJ: Print-Job, Validate-Job + PU: Print-URI + CJ: Create-Job + GPA: Get-Printer-Attributes + GJ: Get-Jobs + PP, RP, PP: Pause-Printer, Resume-Printer, Purge-Printer + R indicates a REQUIRED operation that MUST be supported by the IPP + object (Printer or Job). For attributes, R indicates that the + attribute MUST be supported by the IPP object that supports the + associated operation. + O indicates an OPTIONAL operation or attribute that MAY be supported + by the IPP object (Printer or Job). + + indicates that this is not an IPP/1.0 feature, but is only a part + of IPP/1.1 and future versions of IPP. + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 9] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Table 2 - Summary of Printer operation attributes that sender MAY + supply + +Printer Operations + + Requests Respon- + ses + Operation Attributes PJ, PU CJ GPA GJ PP, All + VJ (O) (O) (R) (R) RP, Opera + (R) PP tions + (O+) + + Operation attributes--OPTIONAL to be supplied by the sender: + + status-message O + + detailed-status- O + message + + document-access- O** + error + + compression R R + + document-format R R R + + document-name O O + + document-natural- O O + language + + ipp-attribute- R R R + fidelity + + job-impressions O O O + + job-k-octets O O O + + job-media-sheets O O O + + + + + + + + + + + + +Hastings, et al. Informational [Page 10] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +Printer Operations + + Requests Respon- + ses + Operation Attributes PJ, PU CJ GPA GJ PP, All + VJ (O) (O) (R) (R) RP, Opera + (R) PP tions + (O+) + + limit R + + message + + my-jobs R + + requested-attributes R R + + which-jobs R + + Legend: + + PJ, VJ: Print-Job, Validate-Job + PU: Print-URI + CJ: Create-Job + GPA: Get-Printer-Attributes + GJ: Get-Jobs + PP, RP, PP: Pause-Printer, Resume-Printer, Purge-Printer + R indicates a REQUIRED operation that MUST be supported by the IPP + object (Printer or Job). For attributes, R indicates that the + attribute MUST be supported by the IPP object that supports the + associated operation. + O indicates an OPTIONAL operation or attribute that MAY be supported + by the IPP object (Printer or Job). + + indicates that this is not an IPP/1.0 feature, but is only a part + of IPP/1.1 and future versions of IPP. + * "job-id" is REQUIRED only if used together with "printer-uri" to + identify the target job; otherwise, "job-uri" is REQUIRED. + ** "document-access-error" applies to the Print-URI response only. + + + + + + + + + + + + + +Hastings, et al. Informational [Page 11] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Table 3 - Summary of Job operation attributes that sender MUST supply + +Job Operations + + Requests Responses + Operation SD SU CJ GJA HJ All + Attributes (O) (O) (R) (R) RJ, RJ Opera- + (O+) tions + + Operation parameters--REQUIRED to be supplied by the sender: + + operation-id R R R R R + + status-code R + + request-id R R R R R R + + version-number R R R R R R + + Operation attributes--REQUIRED to be supplied by the sender: + + attributes-charset R R R R R R + + attributes-natural- R R R R R R + language + + document-uri R + + job-id* R R R R R + + job-uri* R R R R R + + last-document R R + + printer-uri R R R R R + + Operation attributes--RECOMMENDED to be supplied by the sender: + + job-name + + + + + + + + + + + + +Hastings, et al. Informational [Page 12] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +Job Operations + + Requests Responses + + Operation SD SU CJ GJA HJ All + Attributes (O) (O) (R) (R) RJ, RJ Opera- + (O+) tions + + requesting-user- R R R R R + name + + Legend: + + SD: Send-Document + SU: Send-URI + CJ: Cancel-Job + GJA: Get-Job-Attributes + HJ, RJ, RJ: Hold-Job, Release-Job, Restart-Job + R indicates a REQUIRED operation that MUST be supported by the IPP + object (Printer or Job). For attributes, R indicates that the + attribute MUST be supported by the IPP object that supports the + associated operation. + O indicates an OPTIONAL operation or attribute that MAY be supported + by the IPP object (Printer or Job). + + indicates that this is not an IPP/1.0 feature, but is only a part + of IPP/1.1 and future versions of IPP. + * "job-id" is REQUIRED only if used together with "printer-uri" to + identify the target job; otherwise, "job-uri" is REQUIRED. + + + + + + + + + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 13] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Table 4 - Summary of Job operation attributes that sender MAY supply + +Job Operations + + Requests Responses + + Operation SD SU CJ GJA HJ, SD All + Attributes (O) (O) (R) (R) RJ, (O) Opera- + RJ tions + (O+) + + Operation attributes--OPTIONAL to be supplied by the sender: + + status-message O + + detailed-status- O + message + + document-access- O** + error + + compression R R + + document-format R R + + document-name O O + + document-natural- O O + language + + ipp-attribute- + fidelity + + job-impressions + + job-k-octets + + job-media-sheets + + + + + + + + + + + + + +Hastings, et al. Informational [Page 14] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +Job Operations + + Requests Responses + + Operation SD SU CJ GJA HJ, SD All + Attributes (O) (O) (R) (R) RJ, (O) Opera- + RJ tions + (O+) + + limit + + message O O O + + job-hold-until R + + my-jobs + + requested- R + attributes + + which-jobs + + Legend: + + SD: Send-Document + SU: Send-URI + CJ: Cancel-Job + GJA: Get-Job-Attributes + HJ, RJ, RJ: Hold-Job, Release-Job, Restart-Job + R indicates a REQUIRED operation that MUST be supported by the IPP + object (Printer or Job). For attributes, R indicates that the + attribute MUST be supported by the IPP object that supports the + associated operation. + O indicates an OPTIONAL operation or attribute that MAY be supported + by the IPP object (Printer or Job). + + indicates that this is not an IPP/1.0 feature, but is only a part + of IPP/1.1 and future versions of IPP. + * "job-id" is REQUIRED only if used together with "printer-uri" to + identify the target job; otherwise, "job-uri" is REQUIRED. + ** "document-access-error" applies to the Send-URI operation only + + + + + + + + + + + +Hastings, et al. Informational [Page 15] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Table 5 - Printer operation response attributes + +Printer Operations + + Response + + Operation PJ (R) VJ (R) PU (O) CJ (O) GPA GJ (R) PP, + Attributes SD (O) SU (O) (R) RP, PP + (O+) + + job-uri R R R + + job-id R R R + + job-state R R R + + job-state- R+ R+ R+ + reasons + + number-of- O O O + intervening- + jobs + + document- O + access- + error+ + + Legend: + + PJ, SJ: Print-Job, Send-Document + VJ: Validate-Job + PU, SU: Print-URI, Send-URI + CJ: Create-Job + GPA: Get-Printer-Attributes + GJ: Get-Jobs + PP, RP, PP: Pause-Printer, Resume-Printer, Purge-Printer + R indicates a REQUIRED operation that MUST be supported by the IPP + object (Printer or Job). For attributes, R indicates that the + attribute MUST be supported by the IPP object that supports the + associated operation. + O indicates an OPTIONAL operation or attribute that MAY be supported + by the IPP object (Printer or Job). + +3.1.2 Suggested Operation Processing Steps for IPP Objects + + This section suggests the steps and error checks that an IPP object + MAY perform when processing requests and returning responses. An IPP + object MAY perform some or all of the error checks. However, some + + + +Hastings, et al. Informational [Page 16] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + implementations MAY choose to be more forgiving than the error checks + shown here, in order to be able to accept requests from non- + conforming clients. Not performing all of these error checks is a + so-called "forgiving" implementation. On the other hand, clients + that successfully submit requests to IPP objects that do perform all + the error checks will be more likely to be able to interoperate with + other IPP object implementations. Thus an implementer of an IPP + object needs to decide whether to be a "forgiving" or a "strict" + implementation. Therefore, the error status codes returned may + differ between implementations. Consequentially, client SHOULD NOT + expect exactly the error code processing described in this section. + + When an IPP object receives a request, the IPP object either accepts + or rejects the request. In order to determine whether or not to + accept or reject the request, the IPP object SHOULD execute the + following steps. The order of the steps may be rearranged and/or + combined, including making one or multiple passes over the request. + + A client MUST supply requests that would pass all of the error checks + indicated here in order to be a conforming client. Therefore, a + client SHOULD supply requests that are conforming, in order to avoid + being rejected by some IPP object implementations and/or risking + different semantics by different implementations of forgiving + implementations. For example, a forgiving implementation that + accepts multiple occurrences of the same attribute, rather than + rejecting the request might use the first occurrences, while another + might use the last occurrence. Thus such a non-conforming client + would get different results from the two forgiving implementations. + + In the following, processing continues step by step until a "RETURNS + the xxx status code ..." statement is encountered. Error returns are + indicated by the verb: "REJECTS". Since clients have difficulty + getting the status code before sending all of the document data in a + Print-Job request, clients SHOULD use the Validate-Job operation + before sending large documents to be printed, in order to validate + whether the IPP Printer will accept the job or not. + + It is assumed that security authentication and authorization has + already taken place at a lower layer. + +3.1.2.1 Suggested Operation Processing Steps for all Operations + + This section is intended to apply to all operations. The next + section contains the additional steps for the Print-Job, Validate- + Job, Print-URI, Create-Job, Send-Document, and Send-URI operations + that create jobs, adds documents, and validates jobs. + + + + + +Hastings, et al. Informational [Page 17] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + IIG Sect # Flow IPP error status codes + ---------- ---- ---------------------- + | + v err + 3.1.2.1.1 --> server-error-version-not- + supported + ok| + v err + 3.1.2.1.2 --> server-error-operation-not- + supported + ok| + v err + 3.1.2.1.4.1- --> client-error-bad-request + 3.1.2.1.4.2 + ok| + v err + 3.1.2.1.4.3 --> client-error-bad-request + + ok| + v err + 3.1.2.1.5 --> client-error-bad-request + client-error-request-value- + too-long + <(length, tag, range,> + + ok| + v err + 3.1.2.1.5 --> client-error-bad-request + client-error-charset-not- + supported + ok| client-error-attributes-or- + values- + | not-supported + v err + 3.1.2.1.6 --> client-error-bad-request + client-error-natural-language- + not-supported + | client-error-request-value- + too-long + | client-error-attributes-or- + values-not-supported + +3.1.2.1.1 Validate version number + + Every request and every response contains the "version-number" + attribute. The value of this attribute is the major and minor + version number of the syntax and semantics that the client and IPP + object is using, respectively. The "version-number" attribute + + + +Hastings, et al. Informational [Page 18] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + remains in a fixed position across all future versions so that all + clients and IPP object that support future versions can determine + which version is being used. The IPP object checks to see if the + major version number supplied in the request is supported. If not, + the Printer object REJECTS the request and RETURNS the 'server- + error-version-not-supported' status code in the response. The IPP + object returns in the "version-number" response attribute the major + and minor version for the error response. Thus the client can learn + at least one major and minor version that the IPP object supports. + The IPP object is encouraged to return the closest version number to + the one supplied by the client. + + The checking of the minor version number is implementation dependent, + however if the client-supplied minor version is explicitly supported, + the IPP object MUST respond using that identical minor version + number. If the major version number matches, but the minor version + number does not, the Printer SHOULD accept and attempt to process the + request, or MAY reject the request and return the 'server-error- + version-not-supported' status code. In all cases, the Printer MUST + return the nearest version number that it supports. For example, + suppose that an IPP/1.2 Printer supports versions '1.1' and '1.2'. + The following responses are conforming: + + Table 6 - Examples of validating IPP version + + Client supplies Printer Accept Request? Printer returns + + + 1.0 yes (SHOULD) 1.1 + + 1.0 no (SHOULD NOT) 1.1 + + 1.1 yes (MUST) 1.1 + + 1.2 yes (MUST) 1.2 + + 1.3 yes (SHOULD) 1.2 + + 1.3 no (SHOULD NOT) 1.2 + + It is advantageous for Printers to support both IPP/1.1 and IPP/1.0, + so that they can interoperate with either client implementations. + Some implementations may allow an Administrator to explicitly disable + support for one or the other by setting the "ipp-versions-supported" + Printer description attribute. + + + + + + +Hastings, et al. Informational [Page 19] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Likewise, it is advantageous for clients to support both versions to + allow interoperability with new and legacy Printers. + +3.1.2.1.2 Validate operation identifier + + The Printer object checks to see if the "operation-id" attribute + supplied by the client is supported as indicated in the Printer + object's "operations-supported" attribute. If not, the Printer + REJECTS the request and returns the 'server-error-operation-not- + supported' status code in the response. + +3.1.2.1.3 Validate the request identifier + + The Printer object SHOULD NOT check to see if the "request-id" + attribute supplied by the client is in range: between 1 and 2**31 - 1 + (inclusive), but copies all 32 bits. + + Note: The "version-number", "operation-id", and the "request-id" + parameters are in fixed octet positions in the IPP/1.1 encoding. The + "version-number" parameter will be the same fixed octet position in + all versions of the protocol. These fields are validated before + proceeding with the rest of the validation. + +3.1.2.1.4 Validate attribute group and attribute presence and order + + The order of the following validation steps depends on + implementation. + +3.1.2.1.4.1 Validate the presence and order of attribute groups + + Client requests and IPP object responses contain attribute groups + that Section 3 requires to be present and in a specified order. An + IPP object verifies that the attribute groups are present and in the + correct order in requests supplied by clients (attribute groups + without an * in the following tables). + + If an IPP object receives a request with (1) required attribute + groups missing, or (2) the attributes groups are out of order, or (3) + the groups are repeated, the IPP object REJECTS the request and + RETURNS the 'client-error-bad-request' status code. For example, it + is an error for the Job Template Attributes group to occur before the + Operation Attributes group, for the Operation Attributes group to be + omitted, or for an attribute group to occur more than once, except in + the Get-Jobs response. + + Since this kind of attribute group error is most likely to be an + error detected by a client developer rather than by a customer, the + IPP object NEED NOT return an indication of which attribute group was + + + +Hastings, et al. Informational [Page 20] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + in error in either the Unsupported Attributes group or the Status + Message. Also, the IPP object NEED NOT find all attribute group + errors before returning this error. + +3.1.2.1.4.2 Ignore unknown attribute groups in the expected position + + Future attribute groups may be added to the specification at the end + of requests just before the Document Content and at the end of + response, except for the Get-Jobs response, where it maybe there or + before the first job attributes returned. If an IPP object receives + an unknown attribute group in these positions, it ignores the entire + group, rather than returning an error, since that group may be a new + group in a later minor version of the protocol that can be ignored. + (If the new attribute group cannot be ignored without confusing the + client, the major version number would have been increased in the + protocol document and in the request). If the unknown group occurs + in a different position, the IPP object REJECTS the request and + RETURNS the 'client-error-bad-request' status code. + + Clients also ignore unknown attribute groups returned in a response. + + Note: By validating that requests are in the proper form, IPP + objects force clients to use the proper form which, in turn, + increases the chances that customers will be able to use such clients + from multiple vendors with IPP objects from other vendors. + +3.1.2.1.4.3 Validate the presence of a single occurrence of required + Operation attributes + + Client requests and IPP object responses contain Operation attributes + that [RFC2911] Section 3 requires to be present. Attributes within a + group may be in any order, except for the ordering of target, + charset, and natural languages attributes. These attributes MUST be + first, and MUST be supplied in the following order: charset, natural + language, and then target. An IPP object verifies that the + attributes that Section 4 requires to be supplied by the client have + been supplied in the request (attributes without an * in the + following tables). An asterisk (*) indicates groups and Operation + attributes that the client may omit in a request or an IPP object may + omit in a response. + + If an IPP object receives a request with required attributes missing + or repeated from a group or in the wrong position, the behavior of + the IPP object is IMPLEMENTATION DEPENDENT. Some of the possible + implementations are: + + REJECTS the request and RETURNS the 'client-error-bad-request' + status code + + + +Hastings, et al. Informational [Page 21] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + accepts the request and uses the first occurrence of the attribute + no matter where it is + + accepts the request and uses the last occurrence of the attribute + no matter where it is + + accept the request and assume some default value for the missing + attribute + + Therefore, client MUST send conforming requests, if they want to + receive the same behavior from all IPP object implementations. For + example, it is an error for the "attributes-charset" or "attributes- + natural-language" attribute to be omitted in any operation request, + or for an Operation attribute to be supplied in a Job Template group + or a Job Template attribute to be supplied in an Operation Attribute + group in a create request. It is also an error to supply the + "attributes-charset" attribute twice. + + Since these kinds of attribute errors are most likely to be detected + by a client developer rather than by a customer, the IPP object NEED + NOT return an indication of which attribute was in error in either + the Unsupported Attributes group or the Status Message. Also, the + IPP object NEED NOT find all attribute errors before returning this + error. + + The following tables list all the attributes for all the operations + by attribute group in each request and each response. The order of + the groups is the order that the client supplies the groups as + specified in [RFC2911] Section 3. The order of the attributes within + a group is arbitrary, except as noted for some of the special + operation attributes (charset, natural language, and target). The + tables below use the following notation: + + R indicates a REQUIRED attribute or operation that an IPP + object MUST support + O indicates an OPTIONAL attribute or operation that an IPP + object NEED NOT support + * indicates that a client MAY omit the attribute in a request + and that an IPP object MAY omit the attribute in a response. + The absence of an * means that a client MUST supply the + attribute in a request and an IPP object MUST supply the + attribute in a response. + + indicates that this is not a IPP/1.0 operation, but is only + a part of IPP/1.1 and future versions of IPP. + + + + + + + +Hastings, et al. Informational [Page 22] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Operation Requests + + The tables below show the attributes in their proper attribute groups + for operation requests: + + Note: All operation requests contain "version-number", "operation- + id", and "request-id" parameters. + + Print-Job Request (R): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + printer-uri (R) + requesting-user-name (R*) + job-name (R*) + ipp-attribute-fidelity (R*) + document-name (R*) + document-format (R*) + document-natural-language (O*) + compression (R*) + job-k-octets (O*) + job-impressions (O*) + job-media-sheets (O*) + Group 2: Job Template Attributes (R*) + (O*) + (see [RFC2911] Section 4.2) + Group 3: Document Content (R) + + + Validate-Job Request (R): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + printer-uri (R) + requesting-user-name (R*) + job-name (R*) + ipp-attribute-fidelity (R*) + document-name (R*) + document-format (R*) + document-natural-language (O*) + compression (R*) + job-k-octets (O*) + job-impressions (O*) + job-media-sheets (O*) + Group 2: Job Template Attributes (R*) + (O*) + (see [RFC2911] Section 4.2) + + + + +Hastings, et al. Informational [Page 23] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Print-URI Request (O): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + printer-uri (R) + document-uri (R) + requesting-user-name (R*) + job-name (R*) + ipp-attribute-fidelity (R*) + document-name (R*) + document-format (R*) + document-natural-language (O*) + compression (R*) + job-k-octets (O*) + job-impressions (O*) + job-media-sheets (O*) + Group 2: Job Template Attributes (R*) + (O*) (see + (see [RFC2911] Section 4.2) + + Create-Job Request (O): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + printer-uri (R) + requesting-user-name (R*) + job-name (R*) + ipp-attribute-fidelity (R*) + job-k-octets (O*) + job-impressions (O*) + job-media-sheets (O*) + Group 2: Job Template Attributes (R*) + (O*) (see + (see [RFC2911] Section 4.2) + + Get-Printer-Attributes Request (R): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + printer-uri (R) + requesting-user-name (R*) + requested-attributes (R*) + document-format (R*) + + Get-Jobs Request (R): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + + + +Hastings, et al. Informational [Page 24] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + printer-uri (R) + requesting-user-name (R*) + limit (R*) + requested-attributes (R*) + which-jobs (R*) + my-jobs (R*) + + Send-Document Request (O): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + (printer-uri & job-id) | job-uri (R) + last-document (R) + requesting-user-name (R*) + document-name (R*) + document-format (R*) + document-natural-language (O*) + compression (R*) + Group 2: Document Content (R*) + + + Send-URI Request (O): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + (printer-uri & job-id) | job-uri (R) + last-document (R) + document-uri (R) + requesting-user-name (R*) + document-name (R*) + document-format (R*) + document-natural-language (O*) + compression (R*) + + Cancel-Job Request (R): + Release-Job Request (O+): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + (printer-uri & job-id) | job-uri (R) + requesting-user-name (R*) + message (O*) + + + + + + + + + +Hastings, et al. Informational [Page 25] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Get-Job-Attributes Request (R): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + (printer-uri & job-id) | job-uri (R) + requesting-user-name (R*) + requested-attributes (R*) + + Pause-Printer Request (O+): + Resume-Printer Request (O+): + Purge-Printer Request (O+): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + printer-uri (R) + requesting-user-name (R*) + + Hold-Job Request (O+): + Restart-Job Request (O+): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + (printer-uri & job-id) | job-uri (R) + requesting-user-name (R*) + job-hold-until (R*) + message (O*) + + Operation Responses + + The tables below show the response attributes in their proper + attribute groups for responses. + + Note: All operation responses contain "version-number", "status- + code", and "request-id" parameters. + + Print-Job Response (R): + Create-Job Response (O): + Send-Document Response (O): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + status-message (O*) + detailed-status-message (O*) + Group 2: Unsupported Attributes (R*) (see Note 3) + n (R*) + Group 3: Job Object Attributes(R*) (see Note 2) + job-uri (R) + job-id (R) + + + +Hastings, et al. Informational [Page 26] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + job-state (R) + job-state-reasons (O* | R+) + job-state-message (O*) + number-of-intervening-jobs (O*) + + Validate-Job Response (R): + Cancel-Job Response (R): + Hold-Job Response (O+): + Release-Job Response (O+): + Restart-Job Response (O+): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + status-message (O*) + detailed-status-message (O*) + Group 2: Unsupported Attributes (R*) (see Note 3) + (R*) + + Print-URI Response (O): + Send-URI Response (O): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + status-message (O*) + detailed-status-message (O*) + document-access-error (O*) + Group 2: Unsupported Attributes (R*) (see Note 3) + (R*) + Group 3: Job Object Attributes(R*) (see Note 2) + job-uri (R) + job-id (R) + job-state (R) + job-state-reasons (O* | R+) + job-state-message (O*) + number-of-intervening-jobs (O*) + + Get-Printer-Attributes Response (R): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + status-message (O*) + detailed-status-message (O*) + Group 2: Unsupported Attributes (R*) (see Note 4) + (R*) + Group 3: Printer Object Attributes(R*) (see Note 2) + (R*) + + + + + +Hastings, et al. Informational [Page 27] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Get-Jobs Response (R): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + status-message (O*) + detailed-status-message (O*) + Group 2: Unsupported Attributes (R*) (see Note 4) + (R*) + Group 3: Job Object Attributes(R*) (see Note 2, 5) + (R*) + + Get-Job-Attributes Response (R): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + status-message (O*) + detailed-status-message (O*) + Group 2: Unsupported Attributes (R*) (see Note 4) + (R*) + Group 3: Job Object Attributes(R*) (see Note 2) + (R*) + + Pause-Printer Response (O+): + Resume-Printer Response (O+): + Purge-Printer Response (O+): + Group 1: Operation Attributes (R) + attributes-charset (R) + attributes-natural-language (R) + status-message (O*) + detailed-status-message (O*) + Group 2: Unsupported Attributes (R*) (see Note 4) + (R*) + + Note 2 - the Job Object Attributes and Printer Object Attributes are + returned only if the IPP object returns one of the success status + codes. + + Note 3 - the Unsupported Attributes Group is present only if the + client included some Operation and/or Job Template attributes or + values that the Printer doesn't support whether a success or an error + return. + + Note 4 - the Unsupported Attributes Group is present only if the + client included some Operation attributes that the Printer doesn't + support whether a success or an error return. + + + + + + +Hastings, et al. Informational [Page 28] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Note 5: for the Get-Jobs operation the response contains a separate + Job Object Attributes group 3 to N containing requested-attributes + for each job object in the response. + +3.1.2.1.5 Validate the values of the REQUIRED Operation attributes + + An IPP object validates the values supplied by the client of the + REQUIRED Operation attribute that the IPP object MUST support. The + next section specifies the validation of the values of the OPTIONAL + Operation attributes that IPP objects MAY support. + + The IPP object performs the following syntactic validation checks of + each Operation attribute value: + + a) that the length of each Operation attribute value is correct + for the attribute syntax tag supplied by the client according + to [RFC2911] Section 4.1, + + b) that the attribute syntax tag is correct for that Operation + attribute according to [RFC2911] Section 3, + + c) that the value is in the range specified for that Operation + attribute according to [RFC2911] Section 3, + + d) that multiple values are supplied by the client only for + operation attributes that are multi-valued, i.e., that are + 1setOf X according to [RFC2911] Section 3. + + If any of these checks fail, the IPP object REJECTS the request and + RETURNS the 'client-error-bad-request' or the 'client-error-request- + value-too-long' status code. Since such an error is most likely to + be an error detected by a client developer, rather than by an end- + user, the IPP object NEED NOT return an indication of which attribute + had the error in either the Unsupported Attributes Group or the + Status Message. The description for each of these syntactic checks + is explicitly expressed in the first IF statement in the following + table. + + In addition, the IPP object checks each Operation attribute value + against some Printer object attribute or some hard-coded value if + there is no "xxx-supported" Printer object attribute defined. If its + value is not among those supported or is not in the range supported, + then the IPP object REJECTS the request and RETURNS the error status + code indicated in the table by the second IF statement. If the value + of the Printer object's "xxx-supported" attribute is 'no-value' + (because the system administrator hasn't configured a value), the + check always fails. + + + + +Hastings, et al. Informational [Page 29] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + ----------------------------------------------- + + attributes-charset (charset) + + IF NOT a single non-empty 'charset' value, REJECT/RETURN 'client- + error-bad-request'. + + IF the value length is greater than 63 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF NOT in the Printer object's "charset-supported" attribute, + REJECT/RETURN "client-error-charset-not-supported". + + attributes-natural-language(naturalLanguage) + + IF NOT a single non-empty 'naturalLanguage' value, REJECT/RETURN + 'client-error-bad-request'. + + IF the value length is greater than 63 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + ACCEPT the request even if not a member of the set in the Printer + object's "generated-natural-language-supported" attribute. If the + supplied value is not a member of the Printer object's + "generated-natural-language-supported" attribute, use the Printer + object's "natural-language- configured" value. + + requesting-user-name + + IF NOT a single 'name' value, REJECT/RETURN 'client-error-bad- + request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF the IPP object can obtain a better-authenticated name, use it + instead. + + job-name(name) + + IF NOT a single 'name' value, REJECT/RETURN 'client-error-bad- + request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF NOT supplied by the client, the Printer object creates a name + from the document-name or document-uri. + + + +Hastings, et al. Informational [Page 30] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + document-name (name) + + IF NOT a single 'name' value, REJECT/RETURN 'client-error-bad- + request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + ipp-attribute-fidelity (boolean) + + IF NEITHER a single 'true' NOR a single 'false' 'boolean' value, + REJECT/RETURN 'client-error-bad-request'. + + IF the value length is NOT equal to 1 octet, REJECT/RETURN + 'client-error-request-value-too-long' + + IF NOT supplied by the client, the IPP object assumes the value + 'false'. + + document-format (mimeMediaType) + + IF NOT a single non-empty 'mimeMediaType' value, REJECT/RETURN + 'client-error-bad-request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF NOT in the Printer object's "document-format-supported" + attribute, REJECT/RETURN 'client-error-document-format-not- + supported' + + IF NOT supplied by the client, the IPP object assumes the value of + the Printer object's "document-format-default" attribute. + + document-uri (uri) + + IF NOT a single non-empty 'uri' value, REJECT/RETURN 'client- + error-bad-request'. + + IF the value length is greater than 1023 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF the URI syntax is not valid, REJECT/RETURN 'client-error-bad- + request'. + + If the client-supplied URI scheme is not supported, i.e., the + value is not in the Printer object's referenced-uri-scheme- + supported" attribute, the Printer object MUST reject the request + + + +Hastings, et al. Informational [Page 31] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + and return the 'client-error-uri-scheme-not-supported' status + code. The Printer object MAY check to see if the document exists + and is accessible. If the document is not found or is not + accessible, REJECT/RETURN 'client-error-not found'. + + last-document (boolean) + + IF NEITHER a single 'true' NOR a single 'false' 'boolean' value, + REJECT/RETURN 'client-error-bad-request'. + + IF the value length is NOT equal to 1 octet, REJECT/RETURN + 'client-error-request-value-too-long' + + job-id (integer(1:MAX)) + + IF NOT an single 'integer' value equal to 4 octets AND in the + range 1 to MAX, REJECT/RETURN 'client-error-bad-request'. + + IF NOT a job-id of an existing Job object, REJECT/RETURN 'client- + error-not-found' or 'client-error-gone' status code, if keep track + of recently deleted jobs. + + requested-attributes (1setOf keyword) + + IF NOT one or more 'keyword' values, REJECT/RETURN 'client- + error-bad-request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + Ignore unsupported values, which are the keyword names of + unsupported attributes. Don't bother to copy such requested + (unsupported) attributes to the Unsupported Attribute response + group since the response will not return them. + + which-jobs (type2 keyword) + + IF NOT a single 'keyword' value, REJECT/RETURN 'client-error-bad- + request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF NEITHER 'completed' NOR 'not-completed', copy the attribute and + the unsupported value to the Unsupported Attributes response group + and REJECT/RETURN 'client-error-attributes-or-values-not- + supported'. + + + + +Hastings, et al. Informational [Page 32] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Note: a Printer still supports the 'completed' value even if it + keeps no completed/canceled/aborted jobs: by returning no jobs + when so queried. + + IF NOT supplied by the client, the IPP object assumes the 'not- + completed' value. + + my-jobs (boolean) + + IF NEITHER a single 'true' NOR a single 'false' 'boolean' value, + REJECT/RETURN 'client-error-bad-request'. + + IF the value length is NOT equal to 1 octet, REJECT/RETURN + 'client-error-request-value-too-long' + + IF NOT supplied by the client, the IPP object assumes the 'false' + value. + + limit (integer(1:MAX)) + + IF NOT a single 'integer' value equal to 4 octets AND in the range + 1 to MAX, REJECT/RETURN 'client-error-bad-request'. + + IF NOT supplied by the client, the IPP object returns all jobs, no + matter how many. + + ----------------------------------------------- + +3.1.2.1.6 Validate the values of the OPTIONAL Operation attributes + + OPTIONAL Operation attributes are those that an IPP object MAY + support. An IPP object validates the values of the OPTIONAL + attributes supplied by the client. The IPP object performs the same + syntactic validation checks for each OPTIONAL attribute value as in + Section 3.1.2.1.5. As in Section 3.1.2.1.5, if any fail, the IPP + object REJECTS the request and RETURNS the 'client-error-bad-request' + or the 'client-error-request-value-too-long' status code. + + In addition, the IPP object checks each Operation attribute value + against some Printer attribute or some hard-coded value if there is + no "xxx-supported" Printer attribute defined. If its value is not + among those supported or is not in the range supported, then the IPP + object REJECTS the request and RETURNS the error status code + indicated in the table. If the value of the Printer object's "xxx- + supported" attribute is 'no-value' (because the system administrator + hasn't configured a value), the check always fails. + + + + + +Hastings, et al. Informational [Page 33] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + If the IPP object doesn't recognize/support an attribute, the IPP + object treats the attribute as an unknown or unsupported attribute + (see the last row in the table below). + + ----------------------------------------------- + + document-natural-language (naturalLanguage) + + IF NOT a single non-empty 'naturalLanguage' value, REJECT/RETURN + 'client-error-bad-request'. + + IF the value length is greater than 63 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF NOT a value that the Printer object supports in document + formats, (no corresponding "xxx-supported" Printer attribute), + REJECT/RETURN 'client-error-natural-language-not-supported'. + + compression (type3 keyword) + + IF NOT a single 'keyword' value, REJECT/RETURN 'client-error-bad- + request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF NOT in the Printer object's "compression-supported" attribute, + REJECT/RETURN 'client-error-compression-not-supported'. + + Note to IPP/1.0 implementers: Support for the "compression" + attribute was optional in IPP/1.0 and was changed to REQUIRED in + IPP/1.1. However, an IPP/1.0 object SHOULD at least check for the + "compression" attribute being present and reject the create + request, if they don't support "compression". Not checking is a + bug, since the data will be unintelligible. + + job-k-octets (integer(0:MAX)) + + IF NOT a single 'integer' value equal to 4 octets, REJECT/RETURN + 'client-error-bad-request'. + + IF NOT in the range of the Printer object's "job-k-octets- + supported" attribute, copy the attribute and the unsupported value + to the Unsupported Attributes response group and REJECT/RETURN + 'client-error-attributes-or-values-not-supported'. + + + + + + +Hastings, et al. Informational [Page 34] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + job-impressions (integer(0:MAX)) + + IF NOT a single 'integer' value equal to 4 octets, REJECT/RETURN + 'client-error-bad-request'. + + IF NOT in the range of the Printer object's "job-impressions- + supported" attribute, copy the attribute and the unsupported value + to the Unsupported Attributes response group and REJECT/RETURN + 'client-error-attributes-or-values-not-supported'. + + job-media-sheets (integer(0:MAX)) + + IF NOT a single 'integer' value equal to 4 octets, REJECT/RETURN + 'client-error-bad-request'. + + IF NOT in the range of the Printer object's "job-media-sheets- + supported" attribute, copy the attribute and the unsupported value + to the Unsupported Attributes response group and REJECT/RETURN + 'client-error-attributes-or-values-not-supported'. + + message (text(127)) + + IF NOT a single 'text' value, REJECT/RETURN 'client-error-bad- + request'. + + IF the value length is greater than 127 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + unknown or unsupported attribute + + IF the attribute syntax supplied by the client is supported but + the length is not legal for that attribute syntax, REJECT/RETURN + 'client-error-request-value-too-long'. + + ELSE copy the attribute and value to the Unsupported Attributes + response group and change the attribute value to the "out-of-band" + 'unsupported' value, but otherwise ignore the attribute. + + Note: Future Operation attributes may be added to the protocol + specification that may occur anywhere in the specified group. When + the operation is otherwise successful, the IPP object returns the + 'successful-ok-ignored-or-substituted-attributes' status code. + Ignoring unsupported Operation attributes in all operations is + analogous to the handling of unsupported Job Template attributes in + the create and Validate-Job operations when the client supplies the + "ipp-attribute-fidelity" Operation attribute with the 'false' value. + This last rule is so that we can add OPTIONAL Operation attributes to + future versions of IPP so that older clients can inter-work with new + + + +Hastings, et al. Informational [Page 35] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + IPP objects and newer clients can inter-work with older IPP objects. + (If the new attribute cannot be ignored without performing + unexpectedly, the major version number would have been increased in + the protocol document and in the request). This rule for Operation + attributes is independent of the value of the "ipp-attribute- + fidelity" attribute. For example, if an IPP object doesn't support + the OPTIONAL "job-k-octets" attribute', the IPP object treats "job- + k-octets" as an unknown attribute and only checks the length for the + 'integer' attribute syntax supplied by the client. If it is not four + octets, the IPP object REJECTS the request and RETURNS the 'client- + error-bad-request' status code, else the IPP object copies the + attribute to the Unsupported Attribute response group, setting the + value to the "out-of-band" 'unsupported' value, but otherwise ignores + the attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 36] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.1.2.2 Suggested Additional Processing Steps for Operations that + Create/Validate Jobs and Add Documents + + This section in combination with the previous section recommends the + processing steps for the Print-Job, Validate-Job, Print-URI, Create- + Job, Send-Document, and Send-URI operations that IPP objects SHOULD + use. These are the operations that create jobs, validate a Print-Job + request, and add documents to a job. + + IIG Sect # Flow IPP error status codes + ---------- ---- ---------------------- + | + v No + 3.1.2.2.1 ------------------+ + | + Yes| | + | ipp-attribute-fidelity = no | + |<------------------------------+ + v No + 3.1.2.2.2 --> server-error-not-accepting-jobs + + Yes| + v err + 3.1.2.3 --> client-error-bad-request + client-error-request-value-too- + long + <(length, tag, range,> + + ok| + v err + 3.1.2.3 --> client-error-bad-request + client-error-attributes-or- + | values-not-supported + v err + 3.1.2.3.1 --> client-error-conflicting- + attributes + client-error-attributes-or- + values-not-supported + v + +3.1.2.2.1 Default "ipp-attribute-fidelity" if not supplied + + The Printer object checks to see if the client supplied an "ipp- + attribute-fidelity" Operation attribute. If the attribute is not + supplied by the client, the IPP object assumes that the value is + 'false'. + + + + + +Hastings, et al. Informational [Page 37] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.1.2.2.2 Check that the Printer object is accepting jobs + + If the value of the Printer objects "printer-is-accepting-jobs" is + 'false', the Printer object REJECTS the request and RETURNS the + 'server-error-not-accepting-jobs' status code. + +3.1.2.2.3 Validate the values of the Job Template attributes + + An IPP object validates the values of all Job Template attribute + supplied by the client. The IPP object performs the analogous + syntactic validation checks of each Job Template attribute value that + it performs for Operation attributes (see Section 3.1.2.1.5.): + + a) that the length of each value is correct for the attribute + syntax tag supplied by the client according to [RFC2911] + Section 4.1. + + b) that the attribute syntax tag is correct for that attribute + according to [RFC2911] Sections 4.2 to 4.4. + + c) that multiple values are supplied only for multi-valued + attributes, i.e., that are 1setOf X according to [RFC2911] + Sections 4.2 to 4.4. + + As in Section 3.1.2.1.5, if any of these syntactic checks fail, the + IPP object REJECTS the request and RETURNS the 'client-error-bad- + request' or 'client-error-request-value-too-long' status code as + appropriate, independent of the value of the "ipp-attribute- + fidelity". Since such an error is most likely to be an error + detected by a client developer, rather than by an end-user, the IPP + object NEED NOT return an indication of which attribute had the error + in either the Unsupported Attributes Group or the Status Message. + The description for each of these syntactic checks is explicitly + expressed in the first IF statement in the following table. + + Each Job Template attribute MUST occur no more than once. If an IPP + Printer receives a create request with multiple occurrences of a Job + Template attribute, it MAY: + + 1. reject the operation and return the 'client-error-bad-request' + error status code + + 2. accept the operation and use the first occurrence of the + attribute + + 3. accept the operation and use the last occurrence of the + attribute + + + + +Hastings, et al. Informational [Page 38] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + depending on implementation. Therefore, clients MUST NOT supply + multiple occurrences of the same Job Template attribute in the Job + Attributes group in the request. + +3.1.2.3 Algorithm for job validation + + The process of validating a Job-Template attribute "xxx" against a + Printer attribute "xxx-supported" can use the following validation + algorithm (see section 3.2.1.2 in [RFC2911]). + + To validate the value U of Job-Template attribute "xxx" against the + value V of Printer "xxx-supported", perform the following algorithm: + + 1. If U is multi-valued, validate each value X of U by performing the + algorithm in Table 7 with each value X. Each validation is + separate from the standpoint of returning unsupported values. + Example: If U is "finishings" that the client supplies with + 'staple', 'bind' values, then X takes on the successive values: + 'staple', then 'bind' + + 2. If V is multi-valued, validate X against each Z of V by performing + the algorithm in Table 7 with each value Z. If a value Z + validates, the validation for the attribute value X succeeds. If + it fails, the algorithm is applied to the next value Z of V. If + there are no more values Z of V, validation fails. Example" If V + is "sides-supported" with values: 'one- sided', 'two-sided-long', + and 'two-sided-short', then Z takes on the successive values: + 'one-sided', 'two-sided-long', and 'two-sided-short'. If the + client supplies "sides" with 'two-sided- long', the first + comparison fails ('one-sided' is not equal to 'two-sided-long'), + the second comparison succeeds ('two-sided-long' is equal to + 'two-sided-long"), and the third comparison ('two-sided-short' + with 'two-sided-long') is not even performed. + + 3. If both U and V are single-valued, let X be U and Z be V and use + the validation rules in Table 7. + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 39] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Table 7 - Rules for validating single values X against Z + + Attribute syntax attribute syntax validated if: + of X of Z + + integer rangeOfInteger X is within the range of Z + + uri uriScheme the uri scheme in X is equal to + Z + + any boolean the value of Z is TRUE + + any any X and Z are of the same type + and are equal. + + If the value of the Printer object's "xxx-supported" attribute is + 'no-value' (because the system administrator hasn't configured a + value), the check always fails. If the check fails, the IPP object + copies the attribute to the Unsupported Attributes response group + with its unsupported value. If the attribute contains more than one + value, each value is checked and each unsupported value is separately + copied, while supported values are not copied. If an IPP object + doesn't recognize/support a Job Template attribute, i.e., there is no + corresponding Printer object "xxx-supported" attribute, the IPP + object treats the attribute as an unknown or unsupported attribute + (see the last row in the table below). + + If some Job Template attributes are supported for some document + formats and not for others or the values are different for different + document formats, the IPP object SHOULD take that into account in + this validation using the value of the "document-format" supplied by + the client (or defaulted to the value of the Printer's "document- + format-default" attribute, if not supplied by the client). For + example, if "number-up" is supported for the 'text/plain' document + format, but not for the 'application/postscript' document format, the + check SHOULD (though it NEED NOT) depend on the value of the + "document-format" operation attribute. See "document-format" in + [RFC2911] section 3.2.1.1 and 3.2.5.1. + + Note: whether the request is accepted or rejected is determined by + the value of the "ipp-attribute-fidelity" attribute in a subsequent + step, so that all Job Template attribute supplied are examined and + all unsupported attributes and/or values are copied to the + Unsupported Attributes response group. + + ----------------------------------------------- + + + + + +Hastings, et al. Informational [Page 40] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + job-priority (integer(1:100)) + + IF NOT a single 'integer' value with a length equal to 4 octets, + REJECT/RETURN 'client-error-bad-request'. + + IF NOT supplied by the client, use the value of the Printer + object's "job-priority-default" attribute at job submission time. + + IF NOT in the range 1 to 100, inclusive, copy the attribute and + the unsupported value to the Unsupported Attributes response + group. + + Map the value to the nearest supported value in the range 1:100 as + specified by the number of discrete values indicated by the value + of the Printer's "job-priority-supported" attribute. See the + formula in [RFC2911] Section 4.2.1. + + job-hold-until (type3 keyword | name) + + IF NOT a single 'keyword' or 'name' value, REJECT/RETURN 'client- + error-bad-request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF NOT supplied by the client, use the value of the Printer + object's "job-hold-until" attribute at job submission time. + + IF NOT in the Printer object's "job-hold-until-supported" + attribute, copy the attribute and the unsupported value to the + Unsupported Attributes response group. + + job-sheets (type3 keyword | name) + + IF NOT a single 'keyword' or 'name' value, REJECT/RETURN 'client- + error-bad-request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF NOT in the Printer object's "job-sheets-supported" attribute, + copy the attribute and the unsupported value to the Unsupported + Attributes response group. + + multiple-document-handling (type2 keyword) + + IF NOT a single 'keyword' value, REJECT/RETURN 'client-error-bad- + request'. + + + +Hastings, et al. Informational [Page 41] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF NOT in the Printer object's "multiple-document-handling- + supported" attribute, copy the attribute and the unsupported value + to the Unsupported Attributes response group. + + copies (integer(1:MAX)) + + IF NOT a single 'integer' value with a length equal to 4 octets, + REJECT/RETURN 'client-error-bad-request'. + + IF NOT in range of the Printer object's "copies-supported" + attribute + + copy the attribute and the unsupported value to the Unsupported + Attributes response group. + + finishings (1setOf type2 enum) + + IF NOT an 'enum' value(s) each with a length equal to 4 octets, + REJECT/RETURN 'client-error-bad-request'. + + IF NOT in the Printer object's "finishings-supported" attribute, + copy the attribute and the unsupported value(s), but not any + supported values, to the Unsupported Attributes response group. + + page-ranges (1setOf rangeOfInteger(1:MAX)) + + IF NOT a 'rangeOfInteger' value(s) each with a length equal to 8 + octets, REJECT/RETURN 'client-error-bad-request'. + + IF first value is greater than second value in any range, the + ranges are not in ascending order, or ranges overlap, + REJECT/RETURN 'client-error-bad-request'. + + IF the value of the Printer object's "page-ranges-supported" + attribute is 'false', copy the attribute to the Unsupported + Attributes response group and set the value to the "out-of-band" + 'unsupported' value. + + sides (type2 keyword) + + IF NOT a single 'keyword' value, REJECT/RETURN 'client-error-bad- + request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + + +Hastings, et al. Informational [Page 42] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + IF NOT in the Printer object's "sides-supported" attribute, copy + the attribute and the unsupported value to the Unsupported + Attributes response group. + + number-up (integer(1:MAX)) + + IF NOT a single 'integer' value with a length equal to 4 octets, + REJECT/RETURN 'client-error-bad-request'. + + IF NOT a value or in the range of one of the values of the Printer + object's "number-up-supported" attribute, copy the attribute and + value to the Unsupported Attribute response group. + + orientation-requested (type2 enum) + + IF NOT a single 'enum' value with a length equal to 4 octets, + REJECT/RETURN 'client-error-bad-request'. + + IF NOT in the Printer object's "orientation-requested-supported" + attribute, copy the attribute and the unsupported value to the + Unsupported Attributes response group. + + media (type3 keyword | name) + + IF NOT a single 'keyword' or 'name' value, REJECT/RETURN 'client- + error-bad-request'. + + IF the value length is greater than 255 octets, REJECT/RETURN + 'client-error-request-value-too-long'. + + IF NOT in the Printer object's "media-supported" attribute, copy + the attribute and the unsupported value to the Unsupported + Attributes response group. + + printer-resolution (resolution) + + IF NOT a single 'resolution' value with a length equal to 9 + octets, REJECT/RETURN 'client-error-bad-request'. + + IF NOT in the Printer object's "printer-resolution-supported" + attribute, copy the attribute and the unsupported value to the + Unsupported Attributes response group. + + print-quality (type2 enum) + + IF NOT a single 'enum' value with a length equal to 4 octets, + REJECT/RETURN 'client-error-bad-request'. + + + + +Hastings, et al. Informational [Page 43] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + IF NOT in the Printer object's "print-quality-supported" + attribute, copy the attribute and the unsupported value to the + Unsupported Attributes response group. + + unknown or unsupported attribute (i.e., there is no corresponding + Printer object "xxx-supported" attribute) + + IF the attribute syntax supplied by the client is supported but + the length is not legal for that attribute syntax, + + REJECT/RETURN 'client-error-bad-request' if the length of the + attribute syntax is fixed or 'client-error-request-value-too-long' + if the length of the attribute syntax is variable. + + ELSE copy the attribute and value to the Unsupported Attributes + response group and change the attribute value to the "out-of-band" + 'unsupported' value. Any remaining Job Template Attributes are + either unknown or unsupported Job Template attributes and are + validated algorithmically according to their attribute syntax for + proper length (see below). + + ----------------------------------------------- + + If the attribute syntax is supported AND the length check fails, + the IPP object REJECTS the request and RETURNS the 'client-error- + bad-request' if the length of the attribute syntax is fixed or the + 'client-error-request-value-too-long' status code if the length of + the attribute syntax is variable. Otherwise, the IPP object copies + the unsupported Job Template attribute to the Unsupported + Attributes response group and changes the attribute value to the + "out-of-band" 'unsupported' value. The following table shows the + length checks for all attribute syntaxes. In the following table: + "<=" means less than or equal, "=" means equal to: + + + + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 44] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Name Octet length check for read-write attributes + ---------- --------------------------------------------- + + 'textWithLanguage <= 1023 AND 'naturalLanguage' <= 63 + 'textWithoutLanguage' <= 1023 + 'nameWithLanguage' <= 255 AND 'naturalLanguage' <= 63 + 'nameWithoutLanguage' <= 255 + 'keyword' <= 255 + 'enum' = 4 + 'uri' <= 1023 + 'uriScheme' <= 63 + 'charset' <= 63 + 'naturalLanguage' <= 63 + 'mimeMediaType' <= 255 + 'octetString' <= 1023 + 'boolean' = 1 + 'integer' = 4 + 'rangeOfInteger' = 8 + 'dateTime' = 11 + 'resolution' = 9 + '1setOf X' + + Note: It's possible for a Printer to receive a zero length keyword + in a request. Since this is a keyword, its value needs to be + compared with the supported values. Assuming that the printer + doesn't have any values in its corresponding "xxx-supported" + attribute that are keywords of zero length, the comparison will fail. + Then the request will be accepted or rejected depending on the value + of "ipp-attributes-fidelity" being 'false' or 'true', respectively. + No special handling is required for + +3.1.2.3.1 Check for conflicting Job Template attributes values + + Once all the Operation and Job Template attributes have been checked + individually, the Printer object SHOULD check for any conflicting + values among all the supported values supplied by the client. For + example, a Printer object might be able to staple and to print on + transparencies, however due to physical stapling constraints, the + Printer object might not be able to staple transparencies. The IPP + object copies the supported attributes and their conflicting + attribute values to the Unsupported Attributes response group. The + Printer object only copies over those attributes that the Printer + object either ignores or substitutes in order to resolve the + conflict, and it returns the original values which were supplied by + the client. For example suppose the client supplies "finishings" + equals 'staple' and "media" equals 'transparency', but the Printer + object does not support stapling transparencies. If the Printer + chooses to ignore the stapling request in order to resolve the + + + +Hastings, et al. Informational [Page 45] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + conflict, the Printer objects returns "finishings" equal to 'staple' + in the Unsupported Attributes response group. If any attributes are + multi-valued, only the conflicting values of the attributes are + copied. + + Note: The decisions made to resolve the conflict (if there is a + choice) is implementation dependent. + +3.1.2.3.2 Decide whether to REJECT the request + + If there were any unsupported Job Template attributes or + unsupported/conflicting Job Template attribute values and the client + supplied the "ipp-attribute-fidelity" attribute with the 'true' + value, the Printer object REJECTS the request and return the status + code: + + 1.'client-error-conflicting-attributes' status code, if there were + any conflicts between attributes supplied by the client. + + 2.'client-error-attributes-or-values-not-supported' status code, + otherwise. + + Note: Unsupported Operation attributes or values that are returned + do not affect the status returned in this step. If the unsupported + Operation attribute was a serious error, the above already rejected + the request in a previous step. If control gets to this step with + unsupported Operation attributes being returned, they are not serious + errors. + + In general, the final results of Job processing are unknown at Job + submission time. The client has to rely on notifications or polling + to find out what happens at Job processing time. However, there are + cases in which some Printers can determine at Job submission time + that Job processing is going to fail. As an optimization, we'd like + to have the Printer reject the Job in these cases. + + There are three types of "processing" errors that might be detectable + at Job submission time: + + 1. 'client-error-document-format-not-supported' : For the Print- + Job, Send-Document, Print-URI, and Send-URI operations, if all these + conditions are true: + + - the Printer supports auto-sensing, + - the request "document-format" operation attribute is + 'application/octet-stream', + - the Printer receives document data before responding, + - the Printer auto-senses the document format before responding, + + + +Hastings, et al. Informational [Page 46] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + - the sensed document format is not supported by the Printer + + then the Printer should respond with 'client-error-document-format- + not-supported' status. + + 2. 'client-error-compression-error': For the Print-Job, Send- + Document, Print-URI, and Send-URI operations, if all these + conditions are true: + + - the client supplies a supported value for the "compression" + operation attribute in the request + - the Printer receives document data before responding, + - the Printer attempts to decompress the document data before + responding, + - the document data cannot be decompressed using the algorithm + specified by the "compression" operation attribute + + then the Printer should respond with 'client-error-compression-error' + status. + + 3. 'client-error-document-access-error': For the Print-URI, and + Send-URI operations, if the Printer attempts and fails to pull the + referenced document data before responding, it should respond with + 'client-error-document-access-error' status. + + Some Printers are not able to detect these errors until Job + processing time. In that case, the errors are recorded in the + corresponding job-state and job-state reason attributes. (There is + no standard way for a client to determine whether a Printer can + detect these errors at Job submission time.) For example, if auto- + sensing happens AFTER the job is accepted (as opposed to auto-sensing + at submit time before returning the response), the implementation + aborts the job, puts the job in the 'aborted' state and sets the + 'unsupported-document-format' value in the job's "job-state-reasons". + + A client should always provide a valid "document-format" operation + attribute whenever practical. In the absence of other information, a + client itself may sniff the document data to determine document + format. + + Auto sensing at Job submission time may be more difficult for the + Printer when combined with compression. For auto-sensed Jobs, a + client may be better off deferring compression to the transfer + protocol layer, e.g.; by using the HTTP Content-Encoding header. + + + + + + + +Hastings, et al. Informational [Page 47] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.1.2.3.3 For the Validate-Job operation, RETURN one of the success + status codes + + If the requested operation is the Validate-Job operation, the Printer + object returns: + + 1. the "successful-ok" status code, if there are no unsupported or + conflicting Job Template attributes or values. + 2. the "successful-ok-conflicting-attributes, if there are any + conflicting Job Template attribute or values. + 3. the "successful-ok-ignored-or-substituted-attributes, if there + are only unsupported Job Template attributes or values. + + Note: Unsupported Operation attributes or values that are returned + do not affect the status returned in this step. If the unsupported + Operation attribute was a serious error, the above already rejected + the request in a previous step. If control gets to this step with + unsupported Operation attributes being returned, they are not serious + errors. + +3.1.2.3.4 Create the Job object with attributes to support + + If "ipp-attribute-fidelity" is set to 'false' (or it was not supplied + by the client), the Printer object: + + 1. creates a Job object, assigns a unique value to the job's + "job-uri" and "job-id" attributes, and initializes all of the + job's other supported Job Description attributes. + 2. removes all unsupported attributes from the Job object. + 3. for each unsupported value, removes either the unsupported + value or substitutes the unsupported attribute value with some + supported value. If an attribute has no values after removing + unsupported values from it, the attribute is removed from the + Job object (so that the normal default behavior at job + processing time will take place for that attribute). + 4. for each conflicting value, removes either the conflicting + value or substitutes the conflicting attribute value with some + other supported value. If an attribute has no values after + removing conflicting values from it, the attribute is removed + from the Job object (so that the normal default behavior at job + processing time will take place for that attribute). + + If there were no attributes or values flagged as unsupported, or the + value of 'ipp-attribute-fidelity" was 'false', the Printer object is + able to accept the create request and create a new Job object. If + the "ipp-attribute-fidelity" attribute is set to 'true', the Job + Template attributes that populate the new Job object are necessarily + all the Job Template attributes supplied in the create request. If + + + +Hastings, et al. Informational [Page 48] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + the "ipp-attribute-fidelity" attribute is set to 'false', the Job + Template attributes that populate the new Job object are all the + client supplied Job Template attributes that are supported or that + have value substitution. Thus, some of the requested Job Template + attributes will not appear in the Job object because the Printer + object did not support those attributes. The attributes that + populate the Job object are persistently stored with the Job object + for that Job. A Get-Job-Attributes operation on that Job object will + return only those attributes that are persistently stored with the + Job object. + + Note: All Job Template attributes that are persistently stored with + the Job object are intended to be "override values"; that is, they + that take precedence over whatever other embedded instructions might + be in the document data itself. However, it is not possible for all + Printer objects to realize the semantics of "override". End users + may query the Printer's "pdl-override-supported" attribute to + determine if the Printer either attempts or does not attempt to + override document data instructions with IPP attributes. + + There are some cases, where a Printer supports a Job Template + attribute and has an associated default value set for that attribute. + In the case where a client does not supply the corresponding + attribute, the Printer does not use its default values to populate + Job attributes when creating the new Job object; only Job Template + attributes actually in the create request are used to populate the + Job object. The Printer's default values are only used later at Job + processing time if no other IPP attribute or instruction embedded in + the document data is present. + + Note: If the default values associated with Job Template attributes + that the client did not supply were to be used to populate the Job + object, then these values would become "override values" rather than + defaults. If the Printer supports the 'attempted' value of the + "pdl-override-supported" attribute, then these override values could + replace values specified within the document data. This is not the + intent of the default value mechanism. A default value for an + attribute is used only if the create request did not specify that + attribute (or it was ignored when allowed by "ipp-attribute-fidelity" + being 'false') and no value was provided within the content of the + document data. + + If the client does not supply a value for some Job Template + attribute, and the Printer does not support that attribute, as far as + IPP is concerned, the result of processing that Job (with respect to + the missing attribute) is undefined. + + + + + +Hastings, et al. Informational [Page 49] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.1.2.3.5 Return one of the success status codes + + Once the Job object has been created, the Printer object accepts the + request and returns to the client: + + 1. the 'successful-ok' status code, if there are no unsupported or + conflicting Job Template attributes or values. + 2. the 'successful-ok-conflicting-attributes' status code, if + there are any conflicting Job Template attribute or values. + 3. the 'successful-ok-ignored-or-substituted-attributes' status + code, if there are only unsupported Job Template attributes or + values. + + Note: Unsupported Operation attributes or values that are returned + do not affect the status returned in this step. If the unsupported + Operation attribute was a serious error, the above already rejected + the request in a previous step. If control gets to this step with + unsupported Operation attributes being returned, they are not serious + errors. + + The Printer object also returns Job status attributes that indicate + the initial state of the Job ('pending', 'pending-held', + 'processing', etc.), etc. See Print-Job Response, [RFC2911] section + 3.2.1.2. + +3.1.2.3.6 Accept appended Document Content + + The Printer object accepts the appended Document Content data and + either starts it printing, or spools it for later processing. + +3.1.2.3.7 Scheduling and Starting to Process the Job + + The Printer object uses its own configuration and implementation + specific algorithms for scheduling the Job in the correct processing + order. Once the Printer object begins processing the Job, the + Printer changes the Job's state to 'processing'. If the Printer + object supports PDL override (the "pdl-override-supported" attribute + set to 'attempted'), the implementation does its best to see that IPP + attributes take precedence over embedded instructions in the document + data. + +3.1.2.3.8 Completing the Job + + The Printer object continues to process the Job until it can move the + Job into the 'completed' state. If an Cancel-Job operation is + received, the implementation eventually moves the Job into the + 'canceled' state. If the system encounters errors during processing + that do not allow it to progress the Job into a completed state, the + + + +Hastings, et al. Informational [Page 50] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + implementation halts all processing, cleans up any resources, and + moves the Job into the 'aborted' state. + +3.1.2.3.9 Destroying the Job after completion + + Once the Job moves to the 'completed', 'aborted', or 'canceled' + state, it is an implementation decision as to when to destroy the Job + object and release all associated resources. Once the Job has been + destroyed, the Printer would return either the "client-error-not- + found" or "client-error-gone" status codes for operations directed at + that Job. + + Note: the Printer object SHOULD NOT re-use a "job-uri" or "job-id" + value for a sufficiently long time after a job has been destroyed, so + that stale references kept by clients are less likely to access the + wrong (newer) job. + +3.1.2.3.10 Interaction with "ipp-attribute-fidelity" + + Some Printer object implementations may support "ipp-attribute- + fidelity" set to 'true' and "pdl-override-supported" set to + 'attempted' and yet still not be able to realize exactly what the + client specifies in the create request. This is due to legacy + decisions and assumptions that have been made about the role of job + instructions embedded within the document data and external job + instructions that accompany the document data and how to handle + conflicts between such instructions. The inability to be 100% + precise about how a given implementation will behave is also + compounded by the fact that the two special attributes, "ipp- + attribute-fidelity" and "pdl-"override-supported", apply to the whole + job rather than specific values for each attribute. For example, some + implementations may be able to override almost all Job Template + attributes except for "number-up". Character Sets, natural + languages, and internationalization + + This section discusses character set support, natural language + support and internationalization. + +3.1.2.3.11 Character set code conversion support + + IPP clients and IPP objects are REQUIRED to support UTF-8. They MAY + support additional charsets. It is RECOMMENDED that an IPP object + also support US-ASCII, since many clients support US-ASCII, and + indicate that UTF-8 and US-ASCII are supported by populating the + Printer's "charset-supported" with 'utf-8' and 'us-ascii' values. An + IPP object is required to code covert with as little loss as possible + between the charsets that it supports, as indicated in the Printer's + "charsets-supported" attribute. + + + +Hastings, et al. Informational [Page 51] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + How should the server handle the situation where the "attributes- + charset" of the response itself is "us-ascii", but one or more + attributes in that response is in the "utf-8" format? + + Example: Consider a case where a client sends a Print-Job request + with "utf-8" as the value of "attributes-charset" and with the "job- + name" attribute supplied. Later another client submits a Get-Job- + Attribute or Get-Jobs request. This second request contains the + "attributes-charset" with value "us-ascii" and "requested-attributes" + attribute with exactly one value "job-name". + + According to the RFC2911 document (section 3.1.4.2), the value of the + "attributes-charset" for the response of the second request must be + "us-ascii" since that is the charset specified in the request. The + "job-name" value, however, is in "utf-8" format. Should the request + be rejected even though both "utf-8" and "us-ascii" charsets are + supported by the server? or should the "job-name" value be converted + to "us-ascii" and return "successful-ok-conflicting-attributes" + (0x0002) as the status code? + + Answer: An IPP object that supports both utf-8 (REQUIRED) and us- + ascii, the second paragraph of section 3.1.4.2 applies so that the + IPP object MUST accept the request, perform code set conversion + between these two charsets with "the highest fidelity possible" and + return 'successful-ok', rather than a warning 'successful-ok- + conflicting-attributes, or an error. The printer will do the best it + can to convert between each of the character sets that it supports -- + even if that means providing a string of question marks because none + of the characters are representable in US ASCII. If it can't perform + such conversion, it MUST NOT advertise us-ascii as a value of its + "attributes-charset-supported" and MUST reject any request that + requests 'us-ascii'. + + One IPP object implementation strategy is to convert all request text + and name values to a Unicode internal representation. This is 16-bit + and virtually universal. Then convert to the specified operation + attributes-charset on output. + + Also it would be smarter for a client to ask for 'utf-8', rather than + 'us-ascii' and throw away characters that it doesn't understand, + rather than depending on the code conversion of the IPP object. + +3.1.2.3.12 What charset to return when an unsupported charset is + requested (Issue 1.19)? + + Section 3.1.4.1 Request Operation attributes was clarified in + November 1998 as follows: + + + + +Hastings, et al. Informational [Page 52] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + All clients and IPP objects MUST support the 'utf-8' charset + [RFC2044] and MAY support additional charsets provided that they are + registered with IANA [IANA-CS]. If the Printer object does not + support the client supplied charset value, the Printer object MUST + reject the request, set the "attributes-charset" to 'utf-8' in the + response, and return the 'client-error-charset-not-supported' status + code and any 'text' or 'name' attributes using the 'utf-8' charset. + + Since the client and IPP object MUST support UTF-8, returning any + text or name attributes in UTF-8 when the client requests a charset + that is not supported should allow the client to display the text or + name. + + Since such an error is a client error, rather than a user error, the + client should check the status code first so that it can avoid + displaying any other returned 'text' and 'name' attributes that are + not in the charset requested. + + Furthermore, [RFC2911] section 14.1.4.14 client-error-charset-not- + supported (0x040D) was clarified in November 1998 as follows: + + For any operation, if the IPP Printer does not support the charset + supplied by the client in the "attributes-charset" operation + attribute, the Printer MUST reject the operation and return this + status and any 'text' or 'name' attributes using the 'utf-8' charset + (see Section 3.1.4.1). + +3.1.2.3.13 Natural Language Override (NLO) + + The 'text' and 'name' attributes each have two forms. One has an + implicit natural language, and the other has an explicit natural + language. The 'textWithoutLanguage' and 'textWithLanguage' are the + two 'text' forms. The 'nameWithoutLanguage" and 'nameWithLanguage + are the two 'name' forms. If a receiver (IPP object or IPP client) + supports an attribute with attribute syntax 'text', it MUST support + both forms in a request and a response. A sender (IPP client or IPP + object) MAY send either form for any such attribute. When a sender + sends a WithoutLanguage form, the implicit natural language is + specified in the "attributes-natural-language" operation attribute, + which all senders MUST include in every request and response. + + When a sender sends a WithLanguage form, it MAY be different from the + implicit natural language supplied by the sender or it MAY be the + same. The receiver MUST treat either form equivalently. + + There is an implementation decision for senders, whether to always + send the WithLanguage forms or use the WithoutLanguage form when the + attribute's natural language is the same as the request or response. + + + +Hastings, et al. Informational [Page 53] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + The former approach makes the sender implementation simpler. The + latter approach is more efficient on the wire and allows inter- + working with non-conforming receivers that fail to support the + WithLanguage forms. As each approach have advantages, the choice is + completely up to the implementer of the sender. + + Furthermore, when a client receives a 'text' or 'name' job attribute + that it had previously supplied, that client MUST NOT expect to see + the attribute in the same form, i.e., in the same WithoutLanguage or + WithLanguage form as the client supplied when it created the job. + The IPP object is free to transform the attribute from the + WithLanguage form to the WithoutLanguage form and vice versa, as long + as the natural language is preserved. However, in order to meet this + latter requirement, it is usually simpler for the IPP object + implementation to store the natural language explicitly with the + attribute value, i.e., to store using an internal representation that + resembles the WithLanguage form. + + The IPP Printer MUST copy the natural language of a job, i.e., the + value of the "attributes-natural-language" operation attribute + supplied by the client in the create operation, to the Job object as + a Job Description attribute, so that a client is able to query it. + In returning a Get-Job-Attributes response, the IPP object MAY return + one of three natural language values in the responses "attributes- + natural-language" operation attribute: (1) that requested by the + requester, (2) the natural language of the job, or (3) the configured + natural language of the IPP Printer, if the requested language is not + supported by the IPP Printer. + + This "attributes-natural-language" Job Description attribute is + useful for an IPP object implementation that prints start sheets in + the language of the user who submitted the job. This same Job + Description attribute is useful to a multi-lingual operator who has + to communicate with different job submitters in different natural + languages. This same Job Description attribute is expected to be + used in the future to generate notification messages in the natural + language of the job submitter. + + Early drafts of [RFC2911] contained a job-level natural language + override (NLO) for the Get-Jobs response. A job-level (NLO) is an + (unrequested) Job Attribute which then specified the implicit natural + language for any other WithoutLanguage job attributes returned in the + response for that job. Interoperability testing of early + implementations showed that no one was implementing the job-level NLO + in Get-Job responses. So the job-level NLO was eliminated from the + Get-Jobs response. This simplification makes all requests and + responses consistent in that the implicit natural language for any + + + + +Hastings, et al. Informational [Page 54] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + WithoutLanguage 'text' or 'name' form is always supplied in the + request's or response's "attributes-natural-language" operation + attribute. + +3.1.3 Status codes returned by operation + + This section corresponds to [RFC2911] section 3.1.6 "Operation + Response Status Codes and Status Messages". This section lists all + status codes once in the first operation (Print-Job). Then it lists + the status codes that are different or specialized for subsequent + operations under each operation. + +3.1.3.1 Printer Operations + +3.1.3.1.1 Print-Job + + The Printer object MUST return one of the following "status-code" + values for the indicated reason. Whether all of the document data + has been accepted or not before returning the success or error + response depends on implementation. See Section 13 in [RFC2911] for + a more complete description of each status code. + + For the following success status codes, the Job object has been + created and the "job-id", and "job-uri" assigned and returned in the + response: + + successful-ok: no request attributes were substituted or ignored. + + successful-ok-ignored-or-substituted-attributes: some supplied + (1) attributes were ignored or (2) unsupported attribute syntaxes + or values were substituted with supported values or were ignored. + Unsupported attributes, attribute syntax's, or values MUST be + returned in the Unsupported Attributes group of the response. + + successful-ok-conflicting-attributes: some supplied attribute + values conflicted with the values of other supplied attributes and + were either substituted or ignored. Attributes or values which + conflict with other attributes and have been substituted or + ignored MUST be returned in the Unsupported Attributes group of + the response as supplied by the client. + + [RFC2911] section 3.1.6 Operation Status Codes and Messages states: + + If the Printer object supports the "status-message" operation + attribute, it SHOULD use the REQUIRED 'utf-8' charset to return a + status message for the following error status codes (see section + 13 in [RFC2911]): 'client-error-bad-request', 'client-error- + charset-not-supported', 'server-error-internal-error', 'server- + + + +Hastings, et al. Informational [Page 55] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + error-operation-not-supported', and 'server-error-version-not- + supported'. In this case, it MUST set the value of the + "attributes-charset" operation attribute to 'utf-8' in the error + response. + + For the following error status codes, no job is created and no + "job-id" or "job-uri" is returned: + + client-error-bad-request: The request syntax does not conform + to the specification. + + client-error-forbidden: The request is being refused for + authorization or authentication reasons. The implementation + security policy is to not reveal whether the failure is one of + authentication or authorization. + + client-error-not-authenticated: Either the request requires + authentication information to be supplied or the authentication + information is not sufficient for authorization. + + client-error-not-authorized: The requester is not authorized + to perform the request on the target object. + + client-error-not-possible: The request cannot be carried out + because of the state of the system. See also 'server-error- + not-accepting-jobs' status code, which MUST take precedence if + the Printer object's "printer-accepting-jobs" attribute is + 'false'. + + client-error-timeout: not applicable. + + client-error-not-found: the target object does not exist. + + client-error-gone: the target object no longer exists and no + forwarding address is known. + + client-error-request-entity-too-large: the size of the request + and/or print data exceeds the capacity of the IPP Printer to + process it. + + client-error-request-value-too-long: the size of request + variable length attribute values, such as 'text' and 'name' + attribute syntax's, exceed the maximum length specified in + [RFC2911] for the attribute and MUST be returned in the + Unsupported Attributes Group. + + + + + + +Hastings, et al. Informational [Page 56] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + supplied is not supported. The "document-format" attribute + with the unsupported value MUST be returned in the Unsupported + Attributes Group. This error SHOULD take precedence over any + other 'xxx-not-supported' error, except 'client-error-charset- + not-supported'. + + client-error-attributes-or-values-not-supported: one or more + supplied attributes, attribute syntax's, or values are not + supported and the client supplied the "ipp-attributes- + fidelity" operation attribute with a 'true' value. They MUST + be returned in the Unsupported Attributes Group as explained + below. + + client-error-uri-scheme-not-supported: not applicable. + + client-error-charset-not-supported: the charset supplied in + the "attributes-charset" operation attribute is not supported. + The Printer's "configured-charset" MUST be returned in the + response as the value of the "attributes-charset" operation + attribute and used for any 'text' and 'name' attributes + returned in the error response. This error SHOULD take + precedence over any other error, unless the request syntax is + so bad that the client's supplied "attributes-charset" cannot + be determined. + + client-error-conflicting-attributes: one or more supplied + attribute values conflicted with each other and the client + supplied the "ipp-attributes-fidelity" operation attribute with + a 'true' value. They MUST be returned in the Unsupported + Attributes Group as explained below. + + server-error-internal-error: an unexpected condition prevents + the request from being fulfilled. + + server-error-operation-not-supported: not applicable (since + Print-Job is REQUIRED). + + server-error-service-unavailable: the service is temporarily + overloaded. + + server-error-version-not-supported: the version in the request + is not supported. The "closest" version number supported MUST + be returned in the response. + + server-error-device-error: a device error occurred while + receiving or spooling the request or document data or the IPP + Printer object can only accept one job at a time. + + + + +Hastings, et al. Informational [Page 57] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + server-error-temporary-error: a temporary error such as a + buffer full write error, a memory overflow, or a disk full + condition occurred while receiving the request and/or the + document data. + + server-error-not-accepting-jobs: the Printer object's + "printer-is-not-accepting-jobs" attribute is 'false'. + + server-error-busy: the Printer is too busy processing jobs to + accept another job at this time. + + server-error-job-canceled: the job has been canceled by an + operator or the system while the client was transmitting the + document data. + +3.1.3.1.2 Print-URI + + All of the Print-Job status codes described in Section 3.1.3.1.1 + Print-Job Response are applicable to Print-URI with the following + specializations and differences. See Section 14 for a more complete + description of each status code. + + client-error-uri-scheme-not-supported: the URI scheme supplied + in the "document-uri" operation attribute is not supported and + is returned in the Unsupported Attributes group. + + server-error-operation-not-supported: the Print-URI operation + is not supported. + +3.1.3.1.3 Validate-Job + + All of the Print-Job status codes described in Section 3.1.3.1.1 + Print-Job Response are applicable to Validate-Job. See Section 13 in + [RFC2911] for a more complete description of each status code. + +3.1.3.1.4 Create-Job + + All of the Print-Job status codes described in Section 3.1.3.1.1 + Print-Job Response are applicable to Create-Job with the following + specializations and differences. See Section 13 in [RFC2911] for a + more complete description of each status code. + + server-error-operation-not-supported: the Create-Job operation + is not supported. + + + + + + + +Hastings, et al. Informational [Page 58] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + client-error-multiple-document-jobs-not-supported: while the + Create-Job and Send-Document operations are supported, this + implementation doesn't support more than one document with + data. + +3.1.3.1.5 Get-Printer-Attributes + + All of the Print-Job status codes described in Section + 3.1.3.1.1 Print-Job Response are applicable to the Get- + Printer-Attributes operation with the following + specialization's and differences. See Section 13 in [RFC2911] + for a more complete description of each status code. + + For the following success status codes, the requested + attributes are returned in Group 3 in the response: + + successful-ok: no operation attributes or values were + substituted or ignored (same as Print-Job) and no requested + attributes were unsupported. + + successful-ok-ignored-or-substituted-attributes: The + "requested-attributes" operation attribute MAY, but NEED NOT, + be returned with the unsupported values. + + successful-ok-conflicting-attributes: same as Print-Job. + + For the error status codes, Group 3 is returned containing no + attributes or is not returned at all: + + client-error-not-possible: Same as Print-Job, in addition the + Printer object is not accepting any requests. + + client-error-request-entity-too-large: same as Print-job, + except that no print data is involved. + + client-error-attributes-or-values-not-supported: not + applicable, since unsupported operation attributes and/or + values MUST be ignored and an appropriate success code returned + (see above). + + client-error-conflicting-attributes: same as Print-Job, except + that "ipp-attribute-fidelity" is not involved. + + server-error-operation-not-supported: not applicable (since + Get-Printer-Attributes is REQUIRED). + + server-error-device-error: same as Print-Job, except that no + document data is involved. + + + +Hastings, et al. Informational [Page 59] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + server-error-temporary-error: same as Print-Job, except that + no document data is involved. + + server-error-not-accepting-jobs: not applicable. + + server-error-busy: same as Print-Job, except the IPP object is + too busy to accept even query requests. + + server-error-job-canceled: not applicable. + +3.1.3.1.6 Get-Jobs + + All of the Print-Job status codes described in Section 3.1.3.1.1 + Print-Job Response are applicable to the Get-Jobs operation with the + following specialization's and differences. See Section 13 in + [RFC2911] for a more complete description of each status code. + + For the following success status codes, the requested attributes are + returned in Group 3 in the response: + + successful-ok: same as Get-Printer-Attributes (see section + 3.1.3.1.5). + + successful-ok-ignored-or-substituted-attributes: same as Get- + Printer-Attributes (see section 3.1.3.1.5). + + successful-ok-conflicting-attributes: same as Get-Printer- + Attributes (see section 3.1.3.1.5). + + For any error status codes, Group 3 is returned containing no + attributes or is not returned at all. The following brief error + status code descriptions contain unique information for use with + Get-Jobs operation. See section 14 for the other error status codes + that apply uniformly to all operations: + + client-error-not-possible: Same as Print-Job, in addition the + Printer object is not accepting any requests. + + client-error-request-entity-too-large: same as Print-job, + except that no print data is involved. + + client-error-document-format-not-supported: not applicable. + + client-error-attributes-or-values-not-supported: not + applicable, since unsupported operation attributes and/or + values MUST be ignored and an appropriate success code returned + (see above). + + + + +Hastings, et al. Informational [Page 60] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + client-error-conflicting-attributes: same as Print-Job, except + that "ipp-attribute-fidelity" is not involved. + + server-error-operation-not-supported: not applicable (since + Get-Jobs is REQUIRED). + + server-error-device-error: same as Print-Job, except that no + document data is involved. + + server-error-temporary-error: same as Print-Job, except that + no document data is involved. + + server-error-not-accepting-jobs: not applicable. + + server-error-job-canceled: not applicable. + +3.1.3.1.7 Pause-Printer + + All of the Print-Job status codes described in Section 3.1.3.1.1 + Print-Job Response are applicable to Pause-Printer with the following + specializations and differences. See Section 13 in [RFC2911] for a + more complete description of each status code. + + For the following success status codes, the Printer object is being + stopped from scheduling jobs on all its devices. + + successful-ok: no request attributes were substituted or + ignored (same as Print-Job). + + successful-ok-ignored-or-substituted-attributes: same as + Print-Job. + + successful-ok-conflicting-attributes: same as Print-Job. + + For any of the error status codes, the Printer object has not been + stopped from scheduling jobs on all its devices. + + client-error-not-possible: not applicable. + + client-error-not-found: the target Printer object does not + exist. + + client-error-gone: the target Printer object no longer exists + and no forwarding address is known. + + client-error-request-entity-too-large: same as Print-Job, + except no document data is involved. + + + + +Hastings, et al. Informational [Page 61] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + client-error-document-format-not-supported: not applicable. + + client-error-conflicting-attributes: same as Print-Job, except + that the Printer's "printer-is-accepting-jobs" attribute is not + involved. + + server-error-operation-not-supported: the Pause-Printer + operation is not supported. + + server-error-device-error: not applicable. + + server-error-temporary-error: same as Print-Job, except no + document data is involved. + + server-error-not-accepting-jobs: not applicable. + + server-error-job-canceled: not applicable. + +3.1.3.1.8 Resume-Printer + + All of the Print-Job status code descriptions in Section 3.1.3.1.1 + Print-Job Response with the specialization's described for Pause- + Printer are applicable to Resume-Printer. See Section 13 in + [RFC2911] for a more complete description of each status code. + + For the following success status codes, the Printer object resumes + scheduling jobs on all its devices. + + successful-ok: no request attributes were substituted or + ignored (same as Print-Job). + + successful-ok-ignored-or-substituted-attributes: same as + Print-Job. + + successful-ok-conflicting-attributes: same as Print-Job. + + For any of the error status codes, the Printer object does not resume + scheduling jobs. + + server-error-operation-not-supported: the Resume-Printer + operation is not supported. + + + + + + + + + + +Hastings, et al. Informational [Page 62] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.1.3.1.8.1 What about Printers unable to change state due to an error + condition? + + If, in case, the IPP printer is unable to change its state due to + some problem with the actual printer device (say, it is shut down or + there is a media-jam as indicated in [RFC2911]), what should be the + result of the "Resume-Printer" operation? Should it still change the + 'printer-state-reasons' and return success or should it fail ? + + The Resume-Printer operation must clear the 'paused' or 'moving-to- + paused' 'printer-state-message'. The operation must return a + 'successful-ok' status code. + +3.1.3.1.8.2 How is "printer-state" handled on Resume-Printer? + + If the Resume-Printer operation succeeds, what should be the value of + "printer-state" and who should take care of the "printer-state" + attribute value later on ? + + The Resume-Printer operation may change the "printer-state-reasons" + value. + + The "printer-state" will change to one of three states: + + 1. 'idle' - no additional jobs and no error conditions present + + 2. 'processing' - job available and no error conditions present + + 3. current state (i.e. no change) an error condition is present + (e.g. media jam) + + In the third case the "printer-state-reason" will be cleared by + automata when it detects the error condition no longer exists. The + "printer-state" will move to 'idle' or 'processing' when conditions + permit. (i.e. no more error conditions) + +3.1.3.1.9 Purge-Printer + + All of the Print-Job status code descriptions in Section 3.1.3.1.1 + Print-Job Response with the specialization's described for Pause- + Printer are applicable to Purge-Printer. See Section 13 in [RFC2911] + for a more complete description of each status code. + + For the following success status codes, the Printer object purges all + it's jobs. + + successful-ok: no request attributes were substituted or + ignored (same as Print-Job). + + + +Hastings, et al. Informational [Page 63] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + successful-ok-ignored-or-substituted-attributes: same as + Print-Job. + + successful-ok-conflicting-attributes: same as Print-Job. + + For any of the error status codes, the Printer object does not purge + any jobs. + + server-error-operation-not-supported: the Purge-Printer + operation is not supported. + +3.1.3.2 Job Operations + +3.1.3.2.1 Send-Document + + All of the Print-Job status codes described in Section 3.1.3.1.1 + Print-Job Response are applicable to the Get-Printer-Attributes + operation with the following specialization's and differences. See + Section 13 in [RFC2911] for a more complete description of each + status code. + + For the following success status codes, the document has been added + to the specified Job object and the job's "number-of-documents" + attribute has been incremented: + + successful-ok: no request attributes were substituted or + ignored (same as Print-Job). + + successful-ok-ignored-or-substituted-attributes: same as + Print-Job. + + successful-ok-conflicting-attributes: same as Print-Job. + + For the error status codes, no document has been added to the Job + object and the job's "number-of-documents" attribute has not been + incremented: + + client-error-not-possible: Same as Print-Job, except that the + Printer's "printer-is-accepting-jobs" attribute is not + involved, so that the client is able to finish submitting a job + that was created with a Create-Job operation after this + attribute has been set to 'true'. Another condition is that + the state of the job precludes Send-Document, i.e., the job has + + + + + + + + +Hastings, et al. Informational [Page 64] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + already been closed out by the client. However, if the IPP + Printer closed out the job due to timeout, the 'client-error- + timeout' error status SHOULD be returned instead. + + client-error-timeout: This request was sent after the Printer + closed the job, because it has not received a Send-Document or + Send-URI operation within the Printer's "multiple-operation- + time-out" period . + + client-error-request-entity-too-large: same as Print-Job. + + client-error-conflicting-attributes: same as Print-Job, except + that "ipp-attributes-fidelity" operation attribute is not + involved.. + + server-error-operation-not-supported: the Send-Document + request is not supported. + + server-error-not-accepting-jobs: not applicable. + + server-error-job-canceled: the job has been canceled by an + operator or the system while the client was transmitting the + data. + +3.1.3.2.2 Send-URI + + All of the Print-Job status code descriptions in Section 3.1.3.1.1 + Print-Job Response with the specialization's described for Send- + Document are applicable to Send-URI. See Section 13 in [RFC2911] for + a more complete description of each status code. + + client-error-uri-scheme-not-supported: the URI scheme supplied + in the "document-uri" operation attribute is not supported and + the "document-uri" attribute MUST be returned in the + Unsupported Attributes group. + + server-error-operation-not-supported: the Send-URI operation is + not supported. + +3.1.3.2.3 Cancel-Job + + All of the Print-Job status codes described in Section 3.1.3.1.1 + Print-Job Response are applicable to Cancel-Job with the following + specializations and differences. See Section 13 in [RFC2911] for a + more complete description of each status code. + + For the following success status codes, the Job object is being + canceled or has been canceled: + + + +Hastings, et al. Informational [Page 65] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + successful-ok: no request attributes were substituted or + ignored (same as Print-Job). + + successful-ok-ignored-or-substituted-attributes: same as + Print-Job. + + successful-ok-conflicting-attributes: same as Print-Job. + + For any of the error status codes, the Job object has not been + canceled or was previously canceled. + + client-error-not-possible: The request cannot be carried out + because of the state of the Job object ('completed', + 'canceled', or 'aborted') or the state of the system. + + client-error-not-found: the target Printer and/or Job object + does not exist. + + client-error-gone: the target Printer and/or Job object no + longer exists and no forwarding address is known. + + client-error-request-entity-too-large: same as Print-Job, + except no document data is involved. + + client-error-document-format-not-supported: not applicable. + + client-error-attributes-or-values-not-supported: not + applicable, since unsupported operation attributes and values + MUST be ignored. + + client-error-conflicting-attributes: same as Print-Job, except + that the Printer's "printer-is-accepting-jobs" attribute is not + involved. + + server-error-operation-not-supported: not applicable (Cancel- + Job is REQUIRED). + + server-error-device-error: same as Print-Job, except no + document data is involved. + + server-error-temporary-error: same as Print-Job, except no + document data is involved. + + server-error-not-accepting-jobs: not applicable. + + server-error-job-canceled: not applicable. + + + + + +Hastings, et al. Informational [Page 66] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.1.3.2.4 Get-Job-Attributes + + All of the Print-Job status codes described in Section 3.1.3.1.1 + Print-Job Response are applicable to Get-Job-Attributes with the + following specializations and differences. See Section 13 in + [RFC2911] for a more complete description of each status code. + + For the following success status codes, the requested attributes are + returned in Group 3 in the response: + + successful-ok: same as Get-Printer-Attributes (see section + 3.1.3.1.5). + + successful-ok-ignored-or-substituted-attributes: same as Get- + Printer-Attributes (see section 3.1.3.1.5). + + successful-ok-conflicting-attributes: same as Get-Printer- + Attributes (see section 3.1.3.1.5). + + For the error status codes, Group 3 is returned containing no + attributes or is not returned at all. + + client-error-not-possible: Same as Print-Job, in addition the + Printer object is not accepting any requests. + + client-error-document-format-not-supported: not applicable. + + client-error-attributes-or-values-not-supported: not + applicable. + + client-error-uri-scheme-not-supported: not applicable. + + client-error-attributes-or-values-not-supported: not + applicable, since unsupported operation attributes and/or + values MUST be ignored and an appropriate success code returned + (see above). + + client-error-conflicting-attributes: not applicable + + server-error-operation-not-supported: not applicable (since + Get-Job-Attributes is REQUIRED). + + server-error-device-error: same as Print-Job, except no + document data is involved. + + server-error-temporary-error: sane as Print-Job, except no + document data is involved.. + + + + +Hastings, et al. Informational [Page 67] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + server-error-not-accepting-jobs: not applicable. + + server-error-job-canceled: not applicable. + +3.1.3.2.5 Hold-Job + + All of the Print-Job status codes described in Section 3.1.3.1.1 + Print-Job Response are applicable to Hold-Job with the following + specializations and differences. See Section 13 in [RFC2911] for a + more complete description of each status code. + + For the following success status codes, the Job object is being held + or has been held: + + successful-ok: no request attributes were substituted or + ignored (same as Print-Job). + + successful-ok-ignored-or-substituted-attributes: same as + Print-Job. + + successful-ok-conflicting-attributes: same as Print-Job. + + For any of the error status codes, the Job object has not been held + or was previously held. + + client-error-not-possible: The request cannot be carried out + because of the state of the Job object ('completed', + 'canceled', or 'aborted') or the state of the system. + + client-error-not-found: the target Printer and/or Job object + does not exist. + + client-error-gone: the target Printer and/or Job object no + longer exists and no forwarding address is known. + + client-error-request-entity-too-large: same as Print-Job, + except no document data is involved. + + client-error-document-format-not-supported: not applicable. + + client-error-conflicting-attributes: same as Print-Job, except + that the Printer's "printer-is-accepting-jobs" attribute is not + involved. + + server-error-operation-not-supported: the Hold-Job operation is + not supported. + + server-error-device-error: not applicable. + + + +Hastings, et al. Informational [Page 68] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + server-error-temporary-error: same as Print-Job, except no + document data is involved. + + server-error-not-accepting-jobs: not applicable. + + server-error-job-canceled: not applicable. + +3.1.3.2.6 Release-Job + + All of the Print-Job status code descriptions in Section 3.1.3.1.1 + Print-Job Response with the specialization's described for Hold-Job + are applicable to Release-Job. See Section 13 in [RFC2911] for a + more complete description of each status code. + + server-error-operation-not-supported: the Release-Job operation + is not supported. + +3.1.3.2.7 Restart-Job + + All of the Print-Job status code descriptions in Section 3.1.3.1.1 + Print-Job Response with the specialization's described for Hold-Job + are applicable to Restart-Job. See Section 13 in [RFC2911] for a + more complete description of each status code. + + server-error-operation-not-supported: the Restart-Job operation + is not supported. + +3.1.3.2.7.1 Can documents be added to a restarted job? + + Assume I give a Create-Job request along with a set of 5 documents. + All the documents get printed and the job state is moved to + completed. I issue a Restart-Job request on the job. Now the issue + is that, if I try to add new documents to the restarted job, will the + IPP Server permit me to do so or return "client-error-not-possible " + and again print those 5 jobs? + + A job can not move to the 'completed' state until all the documents + have been processed. The 'last-document' flag indicates when the + last document for a job is being sent from the client. This is the + semantic equivalent of closing a job. No documents may be added once + a job is closed. Section 3.3.7 of the IPP/1.1 model states "The job + is moved to the 'pending' job state and restarts the beginning on the + same IPP Printer object with the same attribute values." 'number- + of-documents' is a job attribute. + + + + + + + +Hastings, et al. Informational [Page 69] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.1.4 Returning unsupported attributes in Get-Xxxx responses (Issue + 1.18) + + In the Get-Printer-Attributes, Get-Jobs, or Get-Job-Attributes + responses, the client cannot depend on getting unsupported attributes + returned in the Unsupported Attributes group that the client + requested, but are not supported by the IPP object. However, such + unsupported requested attributes will not be returned in the Job + Attributes or Printer Attributes group (since they are unsupported). + Furthermore, the IPP object is REQUIRED to return the 'successful- + ok-ignored-or-substituted-attributes' status code, so that the client + knows that not all that was requested has been returned. + +3.1.5 Sending empty attribute groups + + The [RFC2911] and [RFC2910] specifications RECOMMEND that a sender + not send an empty attribute group in a request or a response. + However, they REQUIRE a receiver to accept an empty attribute group + as equivalent to the omission of that group. So a client SHOULD omit + the Job Template Attributes group entirely in a create operation that + is not supplying any Job Template attributes. Similarly, an IPP + object SHOULD omit an empty Unsupported Attributes group if there are + no unsupported attributes to be returned in a response. + + The [RFC2910] specification REQUIRES a receiver to be able to receive + either an empty attribute group or an omitted attribute group and + treat them equivalently. The term "receiver" means an IPP object for + a request and a client for a response. The term "sender' means a + client for a request and an IPP object for a response. + + There is an exception to the rule for Get-Jobs when there are no + attributes to be returned. [RFC2910] contains the following + paragraph: + + The syntax allows an xxx-attributes-tag to be present when the xxx- + attribute-sequence that follows is empty. The syntax is defined this + way to allow for the response of Get-Jobs where no attributes are + returned for some job-objects. Although it is RECOMMENDED that the + sender not send an xxx-attributes-tag if there are no attributes + (except in the Get-Jobs response just mentioned), the receiver MUST + be able to decode such syntax. + + + + + + + + + + +Hastings, et al. Informational [Page 70] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.2 Printer Operations + +3.2.1 Print-Job operation + +3.2.1.1 Flow controlling the data portion of a Print-Job request (Issue + 1.22) + + A paused printer, or one that is stopped due to paper out or jam or + spool space full or buffer space full, may flow control the data of a + Print-Job operation (at the TCP/IP layer), so that the client is not + able to send all the document data. Consequently, the Printer will + not return a response until the condition is changed. + + The Printer should not return a Print-Job response with an error code + in any of these conditions, since either the printer will be resumed + and/or the condition will be freed either by human intervention or as + jobs print. + + In writing test scripts to test IPP Printers, the script must also be + written not to expect a response, if the printer has been paused, + until the printer is resumed, in order to work with all possible + implementations. + +3.2.1.2 Returning job-state in Print-Job response (Issue 1.30) + + An IPP client submits a small job via Print-Job. By the time the IPP + printer/print server is putting together a response to the operation, + the job has finished printing and been removed as an object from the + print system. What should the job-state be in the response? + + The Model suggests that the Printer return a response before it even + accepts the document content. The Job Object Attributes are returned + only if the IPP object returns one of the success status codes. Then + the job-state would always be "pending" or "pending-held". + + This issue comes up for the implementation of an IPP Printer object + as a server that forwards jobs to devices that do not provide job + status back to the server. If the server is reasonably certain that + the job completed successfully, then it should return the job-state + as 'completed'. Also the server can keep the job in its "job + history" long after the job is no longer in the device. Then a user + could query the server and see that the job was in the 'completed' + state and completed as specified by the jobs "time-at-completed" + time, which would be the same as the server submitted the job to the + device. + + + + + + +Hastings, et al. Informational [Page 71] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + An alternative is for the server to respond to the client before or + while sending the job to the device, instead of waiting until the + server has finished sending the job to the device. In this case, the + server can return the job's state as 'pending' with the 'job- + outgoing' value in the job's "job-state-reasons" attribute. + + If the server doesn't know for sure whether the job completed + successfully (or at all), it could return the (out-of-band) 'unknown' + value. + + On the other hand, if the server is able to query the device and/or + setup some sort of event notification that the device initiates when + the job makes state transitions, then the server can return the + current job state in the Print-Job response and in subsequent queries + because the server knows what the job state is in the device (or can + query the device). + + All of these alternatives depend on implementation of the server and + the device. + +3.2.2 Get-Printer-Attributes operation + + If a Printer supports the "printer-make-and-model" attribute and + returns the .INF file model name of the printer in that attribute, + the Microsoft client will automatically install the correct driver + (if available). + + Clients which poll periodically for printer status or queued-job- + count should use the "requested-attributes" operation attribute to + limit the scope of the query in order to save Printer and network + resources. + +3.2.3 Get-Jobs operation + +3.2.3.1 Get-Jobs, my-jobs='true', and 'requesting-user-name' (Issue + 1.39)? + + In [RFC2911] section 3.2.6.1 'Get-Jobs Request', if the attribute + 'my-jobs' is present and set to TRUE, MUST the 'requesting-user-name' + attribute be there too, and if it's not present what should the IPP + printer do? + + [RFC2911] Section 8.3 describes the various cases of "requesting- + user-name" being present or not for any operation. If the client + does not supply a value for "requesting-user-name", the printer MUST + assume that the client is supplying some anonymous name, such as + "anonymous". + + + + +Hastings, et al. Informational [Page 72] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.2.3.2 Why is there a "limit" attribute in the Get-Jobs operation? + + When using the Get-Jobs operation a client implementer might choose + to limit the number of jobs that the client shows on the first + screenful. For example, if its UI can only display 50 jobs, it can + defend itself against a printer that would otherwise return 500 jobs, + perhaps taking a long time on a slow dial-up line. The client can + then go and ask for a larger number of jobs in the background, while + showing the user the first 50 jobs. Since the job history is returned + in reverse order, namely the most recently completed jobs are + returned first, the user is most likely interested in the first jobs + that are returned. Limiting the number of jobs may be especially + useful for a client that is requesting 'completed' jobs from a + printer that keeps a long job history. Clients that don't mind + sometimes getting very large responses, can omit the "limit" + attribute in their Get-Jobs requests. + +3.2.4 Create-Job operation + + A Printer may respond to a Create-Job operation with "job-state" + 'pending' or 'pending-held' and " job-state-reason" 'job-data- + insufficient' to indicate that operation has been accepted by the + Printer, but the Printer is expecting additional document data before + it can move the job into the 'processing' state. Alternatively, it + may respond with "job-state" 'processing' and "job-state-reason" + 'job-incoming' to indicate that the Create-Job operation has been + accepted by the Printer, but the Printer is expecting additional + Send-Document and/or Send-URI operations and/or is + accessing/accepting document data. The second alternative is for + non-spooling Printers that don't implement the 'pending' state. + + Should the server wait for the "last-document" operation attribute + set to 'true' before starting to "process" the job? + + It depends on implementation. Some servers spool the entire job, + including all document data, before starting to process, so such an + implementation would wait for the "last-document" before starting to + process the job. If the time-out occurs without the "last-document", + then the server takes one of the indicated actions in section 3.3.1 + in the [RFC2911] document. Other servers will start to process + document data as soon as they have some. These are the so-called + "non-spooling" printers. Currently, there isn't a way for a client to + determine whether the Printer will spool all the data or will start + to process (and print) as soon as it has some data. + + + + + + + +Hastings, et al. Informational [Page 73] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +3.3 Job Operations + +3.3.1 Validate-Job + + The Validate-Job operation has been designed so that its + implementation may be a part of the Print-Job operation. Therefore, + requiring Validate-Job is not a burden on implementers. Also it is + useful for client's to be able to count on its presence in all + conformance implementations, so that the client can determine before + sending a long document, whether the job will be accepted by the IPP + Printer or not. + +3.3.2 Restart-Job + + The Restart-Job operation allows the reprocessing of a completed job. + Some jobs store the document data on the printer. Jobs created using + the Print-Job operation are an example. It is required that the + printer retains the job data after the job has moved to a 'completed + state' in order for the Restart-Job operation to succeed. + + Some jobs contain only a reference to the job data. A job created + using the Print-URI is an example of such a job. When the Restart- + Job operation is issued the job is reprocessed. The job data MUST be + retrieved again to print the job. + + It is possible that a job fails while attempting to access the print + data. When such a job is the target of a Restart-Job the Printer + SHALL attempt to retrieve the job data again. + +4 Object Attributes + +4.1 Attribute Syntax's + +4.1.1 The 'none' value for empty sets (Issue 1.37) + + [RFC2911] states that the 'none' value should be used as the value of + a 1setOf when the set is empty. In most cases, sets that are + potentially empty contain keywords so the keyword 'none' is used, but + for the 3 finishings attributes, the values are enums and thus the + empty set is represented by the enum 3. Currently there are no other + attributes with 1setOf values, which can be empty and can contain + values that are not keywords. This exception requires special code + and is a potential place for bugs. It would have been better if we + had chosen an out-of-band value, either "no-value" or some new value, + such as 'none'. Since we didn't, implementations have to deal with + the different representations of 'none', depending on the attribute + syntax. + + + + +Hastings, et al. Informational [Page 74] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +4.1.2 Multi-valued attributes (Issue 1.31) + + What is the attribute syntax for a multi-valued attribute? Since + some attributes support values in more than one data type, such as + "media", "job-hold-until", and "job-sheets", IPP semantics associate + the attribute syntax with each value, not with the attribute as a + whole. The protocol associates the attribute syntax tag with each + value. Don't be fooled, just because the attribute syntax tag comes + before the attribute keyword. All attribute values after the first + have a zero length attribute keyword as the indication of a + subsequent value of the same attribute. + +4.1.3 Case Sensitivity in URIs (issue 1.6) + + IPP client and server implementations must be aware of the diverse + uppercase/lowercase nature of URIs. RFC 2396 defines URL schemes and + Host names as case insensitive but reminds us that the rest of the + URL may well demonstrate case sensitivity. When creating URL's for + fields where the choice is completely arbitrary, it is probably best + to select lower case. However, this cannot be guaranteed and + implementations MUST NOT rely on any fields being case-sensitive or + case-insensitive in the URL beyond the URL scheme and host name + fields. + + The reason that the IPP specification does not make any restrictions + on URIs, is so that implementations of IPP may use off-the-shelf + components that conform to the standards that define URIs, such as + RFC 2396 and the HTTP/1.1 specifications [RFC2616]. See these + specifications for rules of matching, comparison, and case- + sensitivity. + + It is also recommended that System Administrators and implementations + avoid creating URLs for different printers that differ only in their + case. For example, don't have Printer1 and printer1 as two different + IPP Printers. + + Example of equivalent URI's + + http://abc.com:80/~smith/home.html + + http://ABC.com/%7Esmith/home.html + + http:/ABC.com:/%7esmith/home.html + + Example of equivalent URI's using the IPP scheme + + ipp://abc.com:631/~smith/home.html + + + + +Hastings, et al. Informational [Page 75] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + ipp://ABC.com/%7Esmith/home.html + + http:/ABC.com:631/%7esmith/home.html + + The HTTP/1.1 specification [RFC2616] contains more details on + comparing URLs. + +4.1.4 Maximum length for xxxWithLanguage and xxxWithoutLanguage + + The 'textWithLanguage' and 'nameWithLanguage' are compound syntaxes + that have two components. The first component is the 'language' + component that can contain up to 63 octets. The second component is + the 'text' or 'name' component. The maximum length of these are 1023 + octets and 255 octets respectively. The definition of attributes + with either syntax may further restrict the length (e.g., printer- + name (name(127))). + + The length of the 'language' component has no effect on the allowable + length of 'text' in 'textWithLanguage' or the length of 'name' in + 'nameWithLanguage' + +4.2 Job Template Attributes + +4.2.1 multiple-document-handling(type2 keyword) + +4.2.1.1 Support of multiple document jobs + + IPP/1.0 is silent on which of the four effects an implementation + would perform if it supports Create-Job, but does not support + "multiple-document-handling" or multiple documents per job. IPP/1.1 + was changed so that a Printer could support Create-Job without having + to support multiple document jobs. The "multiple-document-jobs- + supported" (boolean) Printer description attribute was added to + IPP/1.1 along with the 'server-error-multiple-document-jobs-not- + supported' status code for a Printer to indicate whether or not it + supports multiple document jobs, when it supports the Create-Job + operation. Also IPP/1.1 was clarified that the Printer MUST support + the "multiple-document-handling" (type2 keyword) Job Template + attribute with at least one value if the Printer supports multiple + documents per job. + +4.3 Job Description Attributes + +4.3.1 Getting the date and time of day + + The "date-time-at-creation", "date-time-at-processing", and "date- + time-at-completed" attributes are returned as dateTime syntax. These + attributes are OPTIONAL for a Printer to support. However, there are + + + +Hastings, et al. Informational [Page 76] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + various ways for a Printer to get the date and time of day. Some + suggestions: + + 1. A Printer can get time from an NTP timeserver if there's one + reachable on the network . See RFC 1305. Also DHCP option 32 + in RFC 2132 returns the IP address of the NTP server. + + 2. Get the date and time at startup from a human operator + + 3. Have an operator set the date and time using a web + administrative interface + + 4. Get the date and time from incoming HTTP requests, though the + problems of spoofing need to be considered. Perhaps comparing + several HTTP requests could reduce the chances of spoofing. + + 5. Internal date time clock battery driven. + + 6. Query "http://tycho.usno.navy.mil/cgi-bin/timer.pl" + +4.4 Printer Description Attributes + +4.4.1 queued-job-count (integer(0:MAX)) + +4.4.1.1 Why is "queued-job-count" RECOMMENDED (Issue 1.14)? + + The reason that "queued-job-count" is RECOMMENDED, is that some + clients look at that attribute alone when summarizing the status of a + list of printers, instead of doing a Get-Jobs to determine the number + of jobs in the queue. Implementations that fail to support the + "queued-job-count" will cause that client to display 0 jobs when + there are actually queued jobs. + + We would have made it a REQUIRED Printer attribute, but some + implementations had already been completed before the issue was + raised, so making it a SHOULD was a compromise. + +4.4.1.2 Is "queued-job-count" a good measure of how busy a printer is + (Issue 1.15)? + + The "queued-job-count" is not a good measure of how busy the printer + is when there are held jobs. A future registration could be to add a + "held-job-count" (or an "active-job-count") Printer Description + attribute if experience shows that such an attribute (combination) is + needed to quickly indicate how busy a printer really is. + + + + + + +Hastings, et al. Informational [Page 77] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +4.4.2 printer-current-time (dateTime) + + A Printer implementation MAY support this attribute by obtaining the + date and time by any number of implementation-dependent means at + startup or subsequently. Examples include: + + 1. an internal date time clock, + + 2. from the operator at startup using the console, + + 3. from an operator using an administrative web page, + + 4. from HTTP headers supplied in client requests, + + 5. use HTTP to query "http://tycho.usno.navy.mil/cgi-bin/timer.pl" + + 6. from the network, using NTP [RFC1305] or DHCP option 32 + [RFC2132] that returns the IP address of the NTP server. + + If an implementation supports this attribute by obtaining the current + time from the network (at startup or later), but the time is not + available, then the implementation MUST return the value of this + attribute using the out-of-band 'no-value' meaning not configured. + See the beginning of section 4.1. + + Since the new "date-and-time-at-xxx" Job Description attributes refer + to the "printer-current-time", they will be covered also. + +4.4.3 Printer-uri + + Must the operational attribute for printer-uri match one of the + values in "printer-uri-supported"? + + A forgiving printer implementation would not reject the operation. + But the implementation has its rights to reject a printer or job + operation if the operational attribute printer-uri is not a value of + the printer-uri-supported. The printer might not be improperly + configured. The request obviously reached the printer. The printer + could treat the printer-uri as the logical equivalent of a value in + the printer-uri-supported. It would be implementation dependent for + which value, and associated security policy, would apply. This does + also apply to a job object specified with a printer-uri and job-id, + or with a job-uri. See section 4.1.3 for how to compare URI's. + + + + + + + + +Hastings, et al. Informational [Page 78] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +4.5 Empty Jobs + + The IPP object model does not prohibit a job that contains no + documents. Such a job may be created in a number of ways including a + 'create-job' followed by an 'add-document' that contains no data and + has the 'last-document' flag set. + + An empty job is processed just as any other job. The operation that + "closes" an empty job is not rejected because the job is empty. If + no other conditions exist, other than the job is empty, the response + to the operation will indicate success. After the job is scheduled + and processed, the job state SHALL be 'completed'. + + There will be some variation in the value(s) of the "job-state- + reasons" attribute. It is required that if no conditions, other than + the job being empty, exist the "job-state-reasons" SHALL include the + + 'completed-successfully'. If other conditions existed, the + 'completed-with-warnings' or 'completed-with-errors' values may be + used. + +5 Directory Considerations + +5.1 General Directory Schema Considerations + + The [RFC2911] document lists RECOMMENDED and OPTIONAL Printer object + attributes for directory schemas. See [RFC2911] APPENDIX E: Generic + Directory Schema. + + The SLP printer template is defined in the "Definition of the Printer + Abstract Service Type v2.0" document [svrloc-printer]. The LDAP + printer template is defined in the "Internet Printing Protocol (IPP): + LDAP Schema for Printer Services" document [ldap-printer]. Both + documents systematically add "printer-" to any attribute that doesn't + already start with "printer-" in order to keep the printer directory + attributes distinct from other directory attributes. Also, instead + of using "printer-uri-supported", "uri-authentication-supported", and + "uri-security-supported", they use a "printer-xri-supported" + attribute with special syntax to contain all of the same information + in a single attribute. + +5.2 IPP Printer with a DNS name + + If the IPP printer has a DNS name should there be at least two values + for the printer-uri-supported attribute. One URL with the fully + qualified DNS name the other with the IP address in the URL? + + + + + +Hastings, et al. Informational [Page 79] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + The printer may contain one or the other or both. It's up to the + administrator to configure this attribute. + +6 Security Considerations + + The security considerations given in [RFC2911] Section 8 "Security + Considerations" all apply to this document. In addition, the + following sub-sections describes security consideration that have + arisen as a result of implementation testing. + +6.1 Querying jobs with IPP that were submitted using other job + submission protocols (Issue 1.32) + + The following clarification was added to [RFC2911] section 8.5: + + 8.5 Queries on jobs submitted using non-IPP protocols If the + device that an IPP Printer is representing is able to accept jobs + using other job submission protocols in addition to IPP, it is + RECOMMEND that such an implementation at least allow such + "foreign" jobs to be queried using Get-Jobs returning "job-id" and + "job-uri" as 'unknown'. Such an implementation NEED NOT support + all of the same IPP job attributes as for IPP jobs. The IPP + object returns the 'unknown' out-of-band value for any requested + attribute of a foreign job that is supported for IPP jobs, but not + for foreign jobs. + + It is further RECOMMENDED, that the IPP Printer generate "job-id" + and "job-uri" values for such "foreign jobs", if possible, so that + they may be targets of other IPP operations, such as Get-Job- + Attributes and Cancel-Job. Such an implementation also needs to + deal with the problem of authentication of such foreign jobs. One + approach would be to treat all such foreign jobs as belonging to + users other than the user of the IPP client. Another approach + would be for the foreign job to belong to 'anonymous'. Only if + the IPP client has been authenticated as an operator or + administrator of the IPP Printer object, could the foreign jobs be + queried by an IPP request. Alternatively, if the security policy + were to allow users to query other users' jobs, then the foreign + jobs would also be visible to an end-user IPP client using Get- + Jobs and Get-Job- Attributes. + + Thus IPP MAY be implemented as a "universal" protocol that + provides access to jobs submitted with any job submission + protocol. As IPP becomes widely implemented, providing a more + universal access makes sense. + + + + + + +Hastings, et al. Informational [Page 80] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +7 Encoding and Transport + + This section discusses various aspects of IPP/1.1 Encoding and + Transport [RFC2910]. + + A server is not required to send a response until after it has + received the client's entire request. Hence, a client must not + expect a response until after it has sent the entire request. + However, we recommend that the server return a response as soon as + possible if an error is detected while the client is still sending + the data, rather than waiting until all of the data is received. + Therefore, we also recommend that a client listen for an error + response that an IPP server MAY send before it receives all the data. + In this case a client, if chunking the data, can send a premature + zero-length chunk to end the request before sending all the data (and + so the client can keep the connection open for other requests, rather + than closing it). If the request is blocked for some reason, a + client MAY determine the reason by opening another connection to + query the server using Get-Printer-Attributes. + + IPP, by design, uses TCP's built-in flow control mechanisms [RFC 793] + to throttle clients when Printers are busy. Therefore, it is + perfectly normal for an IPP client transmitting a Job to be blocked + for a really long time. Accordingly, socket timeouts must be + avoided. Some socket implementations have a timeout option, which + specifies how long a write operation on a socket can be blocked + before it times out and the blocking ends. A client should set this + option for infinite timeout when transmitting Job submissions. + + Some IPP client applications might be able to perform other useful + work while a Job transmission is blocked. For example, the client + may have other jobs that it could transmit to other Printers + simultaneously. A client may have a GUI, which must remain + responsive to the user while the Job transmission is blocked. These + clients should be designed to spawn a thread to handle the Job + transmission at its own pace, leaving the main application free to do + other work. Alternatively, single-threaded applications could use + non-blocking I/O. + + Some Printer conditions, such as jam or lack of paper, could cause a + client to be blocked indefinitely. Clients may open additional + connections to the Printer to Get-Printer-Attributes, determine the + state of the device, alert a user if the printer is stopped, and let + a user decide whether to abort the job transmission or not. + + In the following sections, there are tables of all HTTP headers, + which describe their use in an IPP client or server. The following + is an explanation of each column in these tables. + + + +Hastings, et al. Informational [Page 81] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + - the "header" column contains the name of a header + - the "request/client" column indicates whether a client sends the + header. + - the "request/ server" column indicates whether a server supports + the header when received. + - the "response/ server" column indicates whether a server sends + the header. + - the "response /client" column indicates whether a client + supports the header when received. + - the "values and conditions" column specifies the allowed header + values and the conditions for the header to be present in a + request/response. + + The table for "request headers" does not have columns for responses, + and the table for "response headers" does not have columns for + requests. + + The following is an explanation of the values in the "request/client" + and "response/ server" columns. + + - must: the client or server MUST send the header, + - must-if: the client or server MUST send the header when the + condition described in the "values and conditions" column is + met, + - may: the client or server MAY send the header + - not: the client or server SHOULD NOT send the header. It is not + relevant to an IPP implementation. + + The following is an explanation of the values in the + "response/client" and "request/ server" columns. + + - must: the client or server MUST support the header, + - may: the client or server MAY support the header + - not: the client or server SHOULD NOT support the header. It is + not relevant to an IPP implementation. + + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 82] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +7.1 General Headers + + The following is a table for the general headers. + + General- Request Response Values and Conditions + Header + + Client Server Server Client + + + Cache- not must not "no-cache" only + Control must + + Connection must- must must- must "close" only. Both + if if client and server + SHOULD keep a + connection for the + duration of a sequence + of operations. The + client and server MUST + include this header + for the last operation + in such a sequence. + + Date may may must may per RFC 1123 [RFC1123] + from RFC 2616 + [RFC2616] + + Pragma must not must not "no-cache" only + + Transfer- must- must must- must "chunked" only. Header + Encoding if if MUST be present if + Content-Length is + absent. + + Upgrade not not not not + + Via not not not not + + + + + + + + + + + + + +Hastings, et al. Informational [Page 83] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +7.2 Request Headers + + The following is a table for the request headers. + + Request- Client Server Request Values and Conditions + Header + + Accept may must "application/ipp" only. This + value is the default if the + client omits it + + Accept- not not Charset information is within the + Charset application/ipp entity + + Accept- may must empty and per RFC 2616 [RFC2616] + Encoding and IANA registry for content- + codings + + Accept- not not language information is within the + Language application/ipp entity + + Authorization must- must per RFC 2616. A client MUST send + if this header when it receives a + 401 "Unauthorized" response and + does not receive a "Proxy- + Authenticate" header. + + From not not per RFC 2616. Because RFC + recommends sending this header + only with the user's approval, + it is not very useful + + Host must must per RFC 2616 + + If-Match not not + + If-Modified- not not + Since + + If-None-Match not not + + If-Range not not + + If- not not + Unmodified- + Since + + + + + +Hastings, et al. Informational [Page 84] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Request- Client Server Request Values and Conditions + Header + + Max-Forwards not not + + Proxy- must- not per RFC 2616. A client MUST send + Authorizati if this header when it receives a + on 401 "Unauthorized" response and + a "Proxy-Authenticate" header. + + Range not not + + Referrer not not + + User-Agent not not + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 85] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +7.3 Response Headers + + The following is a table for the request headers. + + Response- Server Client Response Values and Conditions + Header + + + Accept-Ranges not not + + Age not not + + Location must- may per RFC 2616. When URI needs + if redirection. + + Proxy- must per RFC 2616 + Authenticat + e not + + Public may may per RFC 2616 + + Retry-After may may per RFC 2616 + + Server not not + + Vary not not + + Warning may may per RFC 2616 + + WWW- must- must per RFC 2616. When a server needs + Authenticate if to authenticate a client. + + + + + + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 86] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +7.4 Entity Headers + + The following is a table for the entity headers. + + Entity-Header Request Response Values and + Conditions + + Client Server Server Client + + Allow not not not not + + Content-Base not not not not + + Content- may must must must per RFC 2616 and + Encoding IANA registry for + content codings. + + Content- not not not not Application/ipp + Language handles language + + Content- must- must must- must the length of the + Length if if message-body per + RFC 2616. Header + MUST be present + if Transfer- + Encoding is + absent.. + + Content- not not not not + Location + + Content-MD5 may may may may per RFC 2616 + + Content-Range not not not not + + Content-Type must must must must "application/ipp" + only + + ETag not not not not + + Expires not not not not + + Last-Modified not not not not + + + + + + + + +Hastings, et al. Informational [Page 87] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +7.5 Optional support for HTTP/1.0 + + IPP implementations consist of an HTTP layer and an IPP layer. In + the following discussion, the term "client" refers to the HTTP client + layer and the term "server" refers to the HTTP server layer. The + Encoding and Transport document [RFC2910] requires that HTTP 1.1 MUST + be supported by all clients and all servers. However, a client + and/or a server implementation may choose to also support HTTP 1.0. + + This option means that a server may choose to communicate with a + (non-conforming) client that only supports HTTP 1.0. In such cases + the server should not use any HTTP 1.1 specific parameters or + features and should respond using HTTP version number 1.0. + + This option also means that a client may choose to communicate with a + (non-conforming) server that only supports HTTP 1.0. In such cases, + if the server responds with an HTTP 'unsupported version number' to + an HTTP 1.1 request, the client should retry using HTTP version + number 1.0. + +7.6 HTTP/1.1 Chunking + +7.6.1 Disabling IPP Server Response Chunking + + Clients MUST anticipate that the HTTP/1.1 server may chunk responses + and MUST accept them in responses. However, a (non-conforming) HTTP + client that is unable to accept chunked responses may attempt to + request an HTTP 1.1 server not to use chunking in its response to an + operation by using the following HTTP header: + + TE: identity + + This mechanism should not be used by a server to disable a client + from chunking a request, since chunking of document data is an + important feature for clients to send long documents. + +7.6.2 Warning About the Support of Chunked Requests + + This section describes some problems with the use of chunked requests + and HTTP/1.1 servers. + + The HTTP/1.1 standard [RFC2616] requires that conforming servers + support chunked requests for any method. However, in spite of this + requirement, some HTTP/1.1 implementations support chunked responses + in the GET method, but do not support chunked POST method requests. + Some HTTP/1.1 implementations that support CGI scripts [CGI] and/or + servlets [Servlet] require that the client supply a Content-Length. + These implementations might reject a chunked POST method and return a + + + +Hastings, et al. Informational [Page 88] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + 411 status code (Length Required), might attempt to buffer the + request and run out of room returning a 413 status code (Request + Entity Too Large), or might successfully accept the chunked request. + + Because of this lack of conformance of HTTP servers to the HTTP/1.1 + standard, the IPP standard [RFC2910] REQUIRES that a conforming IPP + Printer object implementation support chunked requests and that + conforming clients accept chunked responses. Therefore, IPP object + implementers are warned to seek HTTP server implementations that + support chunked POST requests in order to conform to the IPP standard + and/or use implementation techniques that support chunked POST + requests. + +8 References + + [CGI] CGI/1.1 (http://www.w3.org/CGI/). + + [IANA-CS] IANA Registry of Coded Character Sets: + http://www.iana.org/assignments/character-sets + + [ldap-printer] Fleming, P., Jones, K., Lewis, H. and I. McDonald, + "Internet Printing Protocol (IPP): LDAP Schema for + Printer Services", Work in Progress. + + [RFC793] Postel, J., "Transmission Control Protocol", STD 7, + RFC 793, September 1981. + + [RFC1123] Braden, R., "Requirements for Internet Hosts - + Application and Support", RFC 1123, October, 1989. + + [RFC2026] Bradner, S., "The Internet Standards Process -- + Revision 3", BCP 9, RFC 2026, October 1996. + + [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", BCP 14, RFC 2119 , March 1997. + + [RFC2396] Berners-Lee, T., Fielding, R. and L. Masinter, + "Uniform Resource Identifiers (URI): Generic + Syntax", RFC 2396, August 1998. + + [RFC2565] DeBry, R., Hastings, T., Herriot, R., Isaacson, S. + and P. Powell, "Internet Printing Protocol/1.0: + Model and Semantics", RFC 2566, April 1999. + + + + + + + + +Hastings, et al. Informational [Page 89] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + [RFC2566] Herriot, R., Butler, S., Moore, P. and R. Turner, + "Internet Printing Protocol/1.0: Encoding and + Transport", RFC 2565, April 1999. + + [RFC2567] Wright, D., "Design Goals for an Internet Printing + Protocol", RFC 2567, April 1999. + + [RFC2568] Zilles, S., "Rationale for the Structure and Model + and Protocol for the Internet Printing Protocol", + RFC 2568, April 1999. + + [RFC2569] Herriot, R., Hastings, T., Jacobs, N. and J. + Martin, "Mapping between LPD and IPP Protocols", + RFC 2569, April 1999. + + [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., + Masinter, L., Leach, P. and T. Berners-Lee, + "Hypertext Transfer Protocol - HTTP/1.1", RFC 2616, + June 1999. + + [RFC2910] Herriot, R., Butler, S., Moore, P. and R. Turner, + "Internet Printing Protocol/1.0: Encoding and + Transport", RFC 2910, September, 2000. + + [RFC2911] DeBry, R., Hastings, T., Herriot, R., Isaacson, S. + and P. Powell, "Internet Printing Protocol/1.0: + Model and Semantics", RFC 2911, September, 2000. + + [Servlet] Servlet Specification Version 2.1 + (http://java.sun.com/products/servlet/2.1/ + index.html). + + [svrloc-printer] St. Pierre, P., Isaacson, S., McDonald, I., + "Definition of the Printer Abstract Service Type + v2.0", http://www.isi.edu/in- + notes/iana/assignments/svrloc- + templates/printer.2.0.en (IANA Registered, May 27, + 2000). + + [SSL] Netscape, The SSL Protocol, Version 3, (Text + version 3.02), November 1996. + + + + + + + + + + +Hastings, et al. Informational [Page 90] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +9. Authors' Addresses + + Thomas N. Hastings + Xerox Corporation + 701 Aviation Blvd. + El Segundo, CA 90245 + + EMail: hastings@cp10.es.xerox.com + + + Carl-Uno Manros + Independent Consultant + 1601 N. Sepulveda Blvd. #505 + Manhattan Beach, CA 90266 + + Email: carl@manros.com + + + Carl Kugler + Mail Stop 003G + IBM Printing Systems Co + 6300 Diagonal Hwy + Boulder CO 80301 + + EMail: Kugler@us.ibm.com + + + Henrik Holst + i-data Printing Systems + Vadstrupvej 35-43 + 2880 Bagsvaerd, Denmark + + EMail: hh@I-data.com + + + Peter Zehler + Xerox Corporation + 800 Philips Road + Webster, NY 14580 + + EMail: PZehler@crt.xerox.com + + + + + + + + + + +Hastings, et al. Informational [Page 91] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + IPP Web Page: http://www.pwg.org/ipp/ + IPP Mailing List: ipp@pwg.org + + To subscribe to the ipp mailing list, send the following email: + + 1) send it to majordomo@pwg.org + 2) leave the subject line blank + 3) put the following two lines in the message body: + subscribe ipp + end + + Implementers of this specification document are encouraged to join + the IPP Mailing List in order to participate in any discussions of + clarification issues and review of registration proposals for + additional attributes and values. In order to reduce spam the + mailing list rejects mail from non-subscribers, so you must subscribe + to the mailing list in order to send a question or comment to the + mailing list. + + Other Participants: + + Chuck Adams - Tektronix Shivaun Albright - HP + + Stefan Andersson - Axis Jeff Barnett - IBM + + Ron Bergman - Hitachi Koki Dennis Carney - IBM + Imaging Systems + + Keith Carter - IBM Angelo Caruso - Xerox + + Rajesh Chawla - TR Computing Nancy Chen - Okidata + Solutions + + Josh Cohen - Microsoft Jeff Copeland - QMS + + Andy Davidson - Tektronix Roger deBry - IBM + + Maulik Desai - Auco Mabry Dozier - QMS + + Lee Farrell - Canon Information Satoshi Fujitami - Ricoh + Systems + + Steve Gebert - IBM Sue Gleeson - Digital + + Charles Gordon - Osicom Brian Grimshaw - Apple + + Jerry Hadsell - IBM Richard Hart - Digital + + + + +Hastings, et al. Informational [Page 92] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Tom Hastings - Xerox Henrik Holst - I-data + + Stephen Holmstead Zhi-Hong Huang - Zenographics + + Scott Isaacson - Novell Babek Jahromi - Microsoft + + Swen Johnson - Xerox David Kellerman - Northlake + Software + + Robert Kline - TrueSpectra Charles Kong - Panasonic + + Carl Kugler - IBM Dave Kuntz - Hewlett-Packard + + Takami Kurono - Brother Rick Landau - Digital + + Scott Lawrence - Agranot Systems Greg LeClair - Epson + + Dwight Lewis - Lexmark Harry Lewis - IBM + + Tony Liao - Vivid Image Roy Lomicka - Digital + + Pete Loya - HP Ray Lutz - Cognisys + + Mike MacKay - Novell, Inc. David Manchala - Xerox + + Carl-Uno Manros - Xerox Jay Martin - Underscore + + Stan McConnell - Xerox Larry Masinter - Xerox + + Sandra Matts - Hewlett Packard Peter Michalek - Shinesoft + + Ira McDonald - High North Inc. Mike Moldovan - G3 Nova + + Tetsuya Morita - Ricoh Yuichi Niwa - Ricoh + + Pat Nogay - IBM Ron Norton - Printronics + + Hugo Parra, Novell Bob Pentecost - Hewlett-Packard + + Patrick Powell - Astart Jeff Rackowitz - Intermec + Technologies + + Eric Random - Peerless Rob Rhoads - Intel + + Xavier Riley - Xerox Gary Roberts - Ricoh + + David Roach - Unisys Stuart Rowley - Kyocera + + + + +Hastings, et al. Informational [Page 93] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + Yuji Sasaki - Japan Computer Richard Schneider - Epson + Industry + + Kris Schoff - HP Katsuaki Sekiguchi - Canon + + Bob Setterbo - Adobe Gail Songer - Peerless + + Hideki Tanaka - Canon Devon Taylor - Novell, Inc. + + Mike Timperman - Lexmark Atsushi Uchino - Epson + + Shigeru Ueda - Canon Bob Von Andel - Allegro Software + + William Wagner - NetSilicon/DPI Jim Walker - DAZEL + + Chris Wellens - Interworking Labs Trevor Wells - Hewlett Packard + + Craig Whittle - Sharp Labs Rob Whittle - Novell, Inc. + + Jasper Wong - Xionics Don Wright - Lexmark + + Michael Wu - Heidelberg Digital Rick Yardumian - Xerox + + Michael Yeung - Toshiba Lloyd Young - Lexmark + + Atsushi Yuki - Kyocera Peter Zehler - Xerox + + William Zhang- Canon Information Frank Zhao - Panasonic + Systems + + Steve Zilles - Adobe Rob Zirnstein - Canon + Information Systems + +10. Description of the Base IPP Documents + + In addition to this document, the base set of IPP documents includes: + + Design Goals for an Internet Printing Protocol [RFC2567] + Rationale for the Structure and Model and Protocol for the + Internet + Printing Protocol [RFC2568] + Internet Printing Protocol/1.1: Model and Semantics [RFC2911] + Internet Printing Protocol/1.1: Encoding and Transport [RFC2910] + Mapping between LPD and IPP Protocols [RFC2569] + + The "Design Goals for an Internet Printing Protocol" document takes a + broad look at distributed printing functionality, and it enumerates + real-life scenarios that help to clarify the features that need to be + + + +Hastings, et al. Informational [Page 94] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + + included in a printing protocol for the Internet. It identifies + requirements for three types of users: end users, operators, and + administrators. It calls out a subset of end user requirements that + are satisfied in IPP/1.0 [RFC2566, RFC2565]. A few OPTIONAL operator + operations have been added to IPP/1.1 [RFC2911, RFC2910]. + + The "Rationale for the Structure and Model and Protocol for the + Internet Printing Protocol" document describes IPP from a high level + view, defines a roadmap for the various documents that form the suite + of IPP specification documents, and gives background and rationale + for the IETF IPP working group's major decisions. + + The "Internet Printing Protocol/1.1: Model and Semantics" document + describes a simplified model with abstract objects, their attributes, + and their operations. The model introduces a Printer and a Job. The + Job supports multiple documents per Job. The model document also + addresses how security, internationalization, and directory issues + are addressed. + + The "Internet Printing Protocol/1.1: Encoding and Transport" document + is a formal mapping of the abstract operations and attributes defined + in the model document onto HTTP/1.1 [RFC2616]. It also defines the + encoding rules for a new Internet MIME media type called + "application/ipp". This document also defines the rules for + transporting a message body over HTTP whose Content-Type is + "application/ipp". This document defines the 'ipp' scheme for + identifying IPP printers and jobs. + + The "Mapping between LPD and IPP Protocols" document gives some + advice to implementers of gateways between IPP and LPD (Line Printer + Daemon) implementations. + + + + + + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 95] + +RFC 3196 Internet Printing Protocol/1.1 November 2001 + + +11 Full Copyright Statement + + Copyright (C) The Internet Society (2001). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +Acknowledgement + + Funding for the RFC Editor function is currently provided by the + Internet Society. + + + + + + + + + + + + + + + + + + + +Hastings, et al. Informational [Page 96] + diff --git a/standards/rfc3391.txt b/standards/rfc3391.txt new file mode 100644 index 0000000000..00f43d5873 --- /dev/null +++ b/standards/rfc3391.txt @@ -0,0 +1,1403 @@ + + + + + + +Network Working Group R. Herriot +Request for Comments: 3391 December 2002 +Category: Informational + + + The MIME Application/Vnd.pwg-multiplexed Content-Type + +Status of this Memo + + This memo provides information for the Internet community. It does + not specify an Internet standard of any kind. Distribution of this + memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (2002). All Rights Reserved. + +IESG Note + + The IESG believes use of this media type is only appropriate in + situations where the producer is fully aware of the capabilities and + limitations of the consumer. In particular, this mechanism is very + dependent on the producer knowing when the consumer will need a + particular component of a multipart object. But consumers + potentially work in many different ways and different consumers may + need different things at different times. This mechanism provides no + means for a producer to determine the needs of a particular consumer + and how they are to be accommodated. + + Alternative mechanisms, such as a protocol based on BEEP which is + capable of bidirectional communication between the producer and + consumer, should be considered when the capabilities of the consumer + are not known by the producer. + +Abstract + + The Application/Vnd.pwg-multiplexed content-type, like the + Multipart/Related content-type, provides a mechanism for representing + objects that consist of multiple components. An + Application/Vnd.pwg-multiplexed entity contains a sequence of chunks. + Each chunk contains a MIME message or a part of a MIME message. Each + MIME message represents a component of the compound object, just as a + body part of a Multipart/Related entity represents a component. With + a Multipart/Related entity, a body part and its reference in some + other body part may be separated by many octets. With an + Application/Vnd.pwg-multiplexed entity, a message and its reference + in some other message can be made quite close by chunking the message + containing the reference. For example, if a long message contains + + + +Herriot Informational [Page 1] + +RFC 3391 Application/Multiplexed December 2002 + + + references to images and the producer does not know of the need for + each image until it generates the reference, then + Application/Vnd.pwg-multiplexed allows the consumer to process the + reference to the image and the image before it consumes the entire + long message. This ability is important in printing and scanning + applications. This document defines the Application/Vnd.pwg- + multiplexed content-type. It also provides examples of its use. + +Table of Contents + + 1. Introduction....................................................2 + 2. Terminology.....................................................7 + 3. Details.........................................................9 + 3.1 Syntax of Application/Vnd.pwg-multiplexed Contents...........10 + 3.2 Parameters for Application/Vnd.pwg-multiplexed...............12 + 3.2.1 The "type" Parameter.......................................12 + 3.2.2 Syntax.....................................................12 + 4. Handling Application/Vnd.pwg-multiplexed Entities..............12 + 5. Examples.......................................................13 + 5.1 Example With Multipart/Related...............................14 + 5.2 Examples with Application/Vnd.pwg-multiplexed................15 + 5.2.1 Example Where Each Chunk Has a Complete Message............15 + 5.2.2 Example of Chunking the Root Message.......................17 + 5.2.3 Example of Chunking the Several Messages...................18 + 5.2.4 Example of Chunks with Empty Payloads......................20 + 6. Security Considerations........................................22 + 7. Registration Information for Application/Vnd.pwg-multiplexed...22 + 8. Acknowledgments................................................23 + 9. References.....................................................23 + 10. Author's Address..............................................24 + 11. Full Copyright Statement......................................25 + +1. Introduction + + The simple MIME content-types, such as "text/plain" provide a + mechanism for representing a simple object, such as a text document. + The Multipart/Related [RFC2387] content-type provides a mechanism for + representing a compound object, such as a text document with two gif + images. + + A compound object consists of multiple components. One such + component is the root component, which contains references to other + components of the compound object. These components may, in turn, + contain references to other components of the compound object. For + example, a compound object could consist of a root html text + component and two gif image components -- each referenced by the root + component. + + + + +Herriot Informational [Page 2] + +RFC 3391 Application/Multiplexed December 2002 + + + A compound object and a component are both abstractions. For + transmission over the wire or writing to storage, each needs a + representation. A "Multipart/Related entity" is one possible + representation of a compound object, and a "body part" is one + possible representation of a component. + + However, the Multipart/Related content-type is not a good solution + for applications that require each component to be close to its + corresponding reference in the root component. This document defines + a new MIME content-type Application/Vnd.pwg-multiplexed that provides + a better solution for some applications. The Application/Vnd.pwg- + multiplexed content-type, like the Multipart/Related content-type, + provides a common mechanism for representing a compound object. A + Multipart/Related entity consists of a sequence of body parts + separated by boundary strings. Each body part represents a component + of the compound object. An Application/Vnd.pwg-multiplexed entity + consists of a sequence of chunks, each of whose length is specified + in the chunk header. Each chunk contains a message or a part of a + message. Each message represents a component of the compound object. + Chunks from different messages can be interleaved. HTTP is the + typical transport for an Application/Vnd.pwg-multiplexed entity over + the wire. An Application/Vnd.pwg-multiplexed entity could be stored + in a Microsoft HTML (message/rfc822) file whose suffix is .mht. + + The following paragraphs contain three examples of applications. For + each application, there is a discussion of its solution with the + Application/Vnd.pwg-multiplexed content-type, the Multipart/Related + content-type and BEEP [RFC3080]. + + Example 1: a printing application. A Producer creates a print stream + that consists of a very long series of page descriptions, each of + which references one or more images. The root component is the long + series of page descriptions. An image may be referenced from + multiple pages descriptions, and there is a mechanism to indicate + when there are no additional references to an image (i.e., the image + is out of scope). The Producer does not know what images to include + with a page until it generates that page. The Consumer is presumed + to have enough storage to hold all in-scope images and enough of the + root component to process at least one page. The Producer doesn't + need any knowledge of the Consumer's storage capabilities in order to + create an entity that the Consumer can successfully process. + However, the Producer needs to be prudent about the number of images + that are in-scope at any time. Of course, a malicious Producer may + try to exceed the storage capabilities of the Consumer, and the + Consumer must guard against such entities (see section 6). Here are + ways to represent this compound object. + + + + + +Herriot Informational [Page 3] + +RFC 3391 Application/Multiplexed December 2002 + + + With the Application/Vnd.pwg-multiplexed content-type, each image + is a message and the root component is a message. The Producer + breaks the root component message into chunks with each image + message occurring shortly before its first reference. When the + Consumer encounters a reference, it can assume that it has already + received the referenced image in an earlier chunk. + + With the Multipart/Related content-type, each image must either + precede or follow the root component. + + If images follow the root component, the Consumer must read all + remaining pages of the root component before it can print the + first page that references such images. The Consumer must wait + to print such a page until it has received the entire root + component, and the Consumer may not have the space to hold the + remaining pages. + + If images precede the root component, the Producer must + determine and send all such images before it sends the root + component. The Consumer must, in the best case, wait some + additional time before it receives the first page of the root + component. In the worse case, the Consumer may not have enough + storage for all the images. + + The Multipart/Related solution is not a good solution because + of the wait time and because, in some cases, the Consumer may + not have sufficient storage for all of the images. + + With BEEP, the images and root component can be sent in separate + channels. The Producer can push each image when it encounters the + first reference or the Consumer can request it when it encounters + the first reference. The over-the-wire stream of octets is + similar to an Application/Vnd.pwg-multiplexed entity. However, + there is a substantial difference in behavior for a printing + application. With the Application/Vnd.pwg-multiplexed content- + type, the Producer puts each image message before its first + reference so that when the Consumer encounters a reference, the + image is guaranteed to be present on the printer. With BEEP, if + the Consumer pulls the image, the Consumer has to wait while the + image comes over the network. If the Producer pushes the image, + BEEP may put the image message after its first reference and the + Consumer may still have to wait for the image. A high-speed + printer should not have to risk waiting for images; otherwise it + cannot run at full speed. + + Example 2: a scanning (fax-like) application. The Producer is a + scanner, which scans pages and sends them along with a vnd.pwg- + xhtml-print+xml root component that contains references to each page + + + +Herriot Informational [Page 4] + +RFC 3391 Application/Multiplexed December 2002 + + + image. Each page is referenced exactly once in the root-component. + The Consumer is a printer that consumes vnd.pwg-xhtml-print+xml + entities and their attachments. That is, the Consumer is not limited + to print jobs that come from scanners. A Producer and Consumer are + each presumed to have enough storage to hold a few page images and + most if not all of the root component. The Producer doesn't need any + additional knowledge of the Consumer's storage capabilities in order + to create an entity that the Consumer can successfully process. Of + course, a malicious Producer may try to exceed the storage + capabilities of the Consumer and the Consumer must guard against such + entities (see section 6). Here are ways to represent this compound + object. + + With the Application/Vnd.pwg-multiplexed content-type, each page + image is a message and the root component is a message. The + Producer breaks the root component message into chunks with each + image message just before or just after its reference. + + With the Multipart/Related content-type, the images cannot precede + the root component because the Consumer might not have enough + space to store them until the root component arrived. In this + case, the printer could fail to print the job correctly and the + Producer might not know. Therefore the images must follow the + root component, and the Producer must scan all pages before it can + send the first page. At the very least, this solution delays the + printing of the pages until all have been scanned. In the worst + case, the Producer does not have sufficient memory to buffer the + images, and the job fails. + + With BEEP, the issues are the same as in the previous example, + except that speed is not as important in this case. So BEEP is a + viable alternative for this example. + + Example 3: a printing application. A Producer creates a print stream + that consists of a series of pages, each of which references zero or + more images. Each image is referenced exactly once. The Producer + does not know what images to include with a page until it generates + that page, and the Producer doesn't know the layout details; the + Consumer handles layout. The Producer has enough storage to send the + root component and all images. However, it may not have enough + storage to hold the entire root component or all octets of any of the + images. The Consumer is presumed to have enough storage to render + the root component and to render each image. It may not have enough + storage to hold the entire root component or all octets of any of the + images. The Producer doesn't determine the Consumer's storage + capabilities. Rather it arranges the components so that the Consumer + is mostly likely to succeed. Of course, a malicious Producer may try + + + + +Herriot Informational [Page 5] + +RFC 3391 Application/Multiplexed December 2002 + + + to exceed the storage capabilities of the Consumer, and the Consumer + must guard against such entities (see section 6). Here are ways to + represent this compound object. + + With the Application/Vnd.pwg-multiplexed content-type, each image + is a message and the root component is a message. The Producer + breaks the root component message into chunks with each image + message just after its reference. The references appear first so + that the Consumer knows the location of each image before it + processes the image. This strategy minimizes storage needs for + Producer and Consumer and provides a good strategy in case of + failure. Here are the cases to consider. + + a) When the document consists of vertically aligned blocks where + each block contains either lines of text or a single image, the + sequence of chunks is the same as the sequence of printable + blocks, thus minimizing Consumer buffering needs. + + b) When a block can contain N side-by-side images, the Consumer + must buffer N-1 images unless the Producer interleaves the + images. If the Producer doesn't interleave the images, and the + Consumer runs out of storage before it has received N-1, + images, it can print what it has and print the remaining images + below; not what the Producer intended, but better than nothing. + If the Producer interleaves images, and the Consumer runs out + of storage before it has received the bands of N images, the + Consumer would print portions of images interleaved with + portions of other images. So, a Producer should not interleave + images. + + c) When a block contains text and image side-by-side (i.e., run- + around text), there are additional buffering requirements. + When the Consumer processes the text that follows the + reference, it will place some of it next to the image (run- + around text) and will place the remaining text after the image. + The Producer doesn't know where the run-around ends, and thus + doesn't know where to end the text chunk and start the image + chunk. If the Producer ends the text too soon, then the + Consumer either has to process the entire image (if it has + enough storage) in order to get the remaining run-around text, + or it ends the run-around text prematurely. If the Producer + ends the text too late, then the Consumer may have to store too + much text and possibly put the image later than the Producer + requested. Because text data requires significantly less + storage than image data, a good strategy for Producer is to err + on the side of sending too much rather than too little text + before the image data. + + + + +Herriot Informational [Page 6] + +RFC 3391 Application/Multiplexed December 2002 + + + d) When a block contains text and multiple side-by-side images, + the problem becomes a combination of items b) and c) above. + + The Application/Vnd.pwg-multiplexed content-type can be made to + work in this example, but a Consumer must have failure strategies + and the result may not be quite what the producer intended. With + the Multipart/Related content-type, the images cannot precede the + root component because the Consumer might not have enough space to + store them until the root component arrived. Also, the images + cannot follow the root component because the Consumer might not + have enough storage for the root component before the first image + arrives. So the Multipart/Related content-type is not an + acceptable solution for this example. + + With BEEP, the Producer can send the root component on channel 1 + and the Consumer can request images on even numbered channels when + it encounters a reference. This solution allows more flexibility + than the Application/Vnd.pwg-multiplexed content-type. If there + are side-by-side images and/or run-around text, the Consumer can + request bands of each image or run-around text over separate + channels. + + In all of these examples, the Application/Vnd.pwg-multiplexed + content-type provides a much better solution than Multipart/Related. + However, it is evenly matched with BEEP. For applications where + speed is important and ordering of the chunks is important in order + to avoid printing delays, the Application/Vnd.pwg-multiplexed + content-type is best. For applications, where the Consumer needs + more control over the ordering of received octets, BEEP is best. + +2. Terminology + + This document uses some of the MIME terms that are defined in + [RFC2045]. The following are the terms used in this document: + + Entity: the headers and the content. In this document, the term + "entity" describes all the octets that represent a compound + object. + + Message: an entity as in [RFC2045]. In this document, the term + "message" describes all octets that represent one component of a + compound object. That is, it has MIME headers and content. + + Body Part: an entity inside a multipart. That is, a body part is + the headers and content (i.e., octets) between the multipart + boundary strings not including the CRLF at the beginning and end. + This document never uses "entity" to mean "body part". + + + + +Herriot Informational [Page 7] + +RFC 3391 Application/Multiplexed December 2002 + + + Headers: the initial lines of an entity, message or body part. An + empty line (i.e., two adjacent CRLFs) terminates the headers. + Sometimes the term "MIME header" is used instead of just "header". + + Content: the part of an entity, message or body part that follows + the headers (i.e., follows the two adjacent CRLFs). The content + of a body part ends at the octet preceding the CRLF before the + multipart boundary string. The content of a message ends at the + octets specified by the length field in the Chunk Header. + + This document uses the following additional terms. + + Chunk: a chunk of data, consisting of a chunk header, a chunk + payload and a CRLF. + + Chunk Header: the first line of a chunk. The line consists of the + "CHK" keyword, the message number, the length and the continuation + indicator, each separated by a single space character (ASCII 32). + A CRLF terminates the line. Each message in an + Application/Vnd.pwg-multiplexed entity has a message number that + normally differs from the message numbers of all other messages in + the Application/Vnd.pwg-multiplexed entity. The message number 0 + is reserved for final Chunk Header in the Application/Vnd.pwg- + multiplexed entity. + + Chunk Payload: the octets between the Chunk Header and the Chunk + Header of the next chunk. The length field in the header's length + field specifies the number of octets in the Chunk Payload. The + Chunk Payload is either a complete message or a part of a message. + The continuation field in the header specifies whether the chunk + is the last chunk of the message. + + CRLF: the sequence of octets corresponding to the two US-ASCII + characters CR (decimal value 13) and LF (decimal value 10) which, + taken together, in this order, denote a line break. A CRLF + terminates each chunk in order to provide visual separation from + the next chunk header. + + Consumer: the software that receives and processes a MIME entity, + e.g., software in a printer or software that reads a file. + + Producer: the software that creates and sends a MIME entity, e.g., + software in a scanner or software that writes a file. + + + + + + + + +Herriot Informational [Page 8] + +RFC 3391 Application/Multiplexed December 2002 + + +3. Details + + The Application/Vnd.pwg-multiplexed content-type, like + Multipart/Related, is intended to represent a compound object + consisting of several inter-related components. This document does + not specify the representation of these relationships, but [RFC2557] + contains examples of Multipart/Related entities that use the + Content-ID and Content-Location headers to identify body parts and + URLs (including the "cid" URL) to reference body parts. It is + expected that Application/Vnd.pwg-multiplexed entities would use the + patterns described in [RFC2557]. + + For an Application/Vnd.pwg-multiplexed entity, there is one parameter + for the Content-Type header. It is a "type" parameter, and it is + like the "type" parameter for the Multipart/Related content-type. + The value of the "type" parameter must be the content-type of the + root message and it effectively specifies the type of the compound + object. + + An Application/Vnd.pwg-multiplexed entity contains a sequence of + chunks. Each chunk consists of a chunk header, a chunk payload and a + CRLF. + + - The chunk header consists of a "CHK" keyword followed by the + message number, the chunk payload length, whether the chunk is + the last chunk of a message and, finally, a CRLF. The length + field removes the need for boundary strings that Multipart uses. + (See section 3.1 for the syntax of a chunk header). + + - The chunk payload is a sequence of octets that is either a + complete message or a part of a message. + + - The CRLF provides visual separation from the following chunk. + + Each message represents a component of the compound object, and a + message is intended to have exactly the same representation, octet + for octet, as a body part of a Multipart/Related entity that + represents the same component. When a message is split across + multiple chunks, the chunks need not be contiguous. + + The contents of an Application/Vnd.pwg-multiplexed entity have the + following properties: + + 1) The first chunk contains a complete or partial message that (in + either case) represents the root component of the compound + object. + + + + + +Herriot Informational [Page 9] + +RFC 3391 Application/Multiplexed December 2002 + + + 2) Additional chunks contain messages or partial messages that + represent some component of the compound object. + + 3) The final chunk's header contains a message number of 0, a + length of 0 and a last-chunk-of-message mark (i.e., the chunk + header line is "CHK 0 0 LAST"). The final chunk contains no + chunk payload. + + 4) A message can be broken into multiple parts and each break can + occur anywhere within the message. Each part of the message is + zero or more bytes in length and each part of the message is + the contents of its own chunk. The order of the chunks within + the Application/Vnd.pwg-multiplexed entity must be the same as + the order of the parts within the message. + + 5) A message represents a component of a compound object, and it + is intended that it have exactly the same representation, octet + for octet, as a body part of a Multipart/Related entity that + represents the same component. In particular, the message may + contain a Content-Type header to specify the content-type of + the message content. Also, the message may contain a Content- + ID header and/or Content-Location header to identify a message + that is referenced from within another message. If a message + contains no Content-Type header, then the message has an + implicit content-type of "text/plain; charset=us-ascii", cf. + [RFC2045]. + + See section 4 for a discussion displaying an Application/Vnd.pwg- + multiplexed entity. + +3.1 Syntax of Application/Vnd.pwg-multiplexed Contents + + The ABNF [RFC2234] for the contents of an Application/Vnd.pwg- + multiplexed entity is: + + contents = *chunk finalChunk + chunk = header payload CRLF + header = "CHK" SP messageNumber SP length SP isMore CRLF + messageNumber = 1..2147483647 + length = 0..2147483647 + isMore = "MORE" / "LAST" + payload = *OCTET + finalChunk = finalHeader CRLF + finalHeader = "CHK" SP "0" SP "0" SP "LAST" CRLF + + + + + + + +Herriot Informational [Page 10] + +RFC 3391 Application/Multiplexed December 2002 + + + The messageNumber field specifies the message that the chunk is + associated with. See the end of this section for more details. + + The length field specifies the number of octets in the chunk payload + (represented in ABNF as "payload"). The first octet of the chunk + payload is the one immediately following the LF (i.e., final octet) + of the chunk header. The last octet of the chunk payload is the one + immediately preceding the two octets CRLF that end the chunk. + + The isMore field has a value of "LAST" for the last chunk of a + message and "MORE" for all other chunks of a message. + + Normally each message in an Application/Vnd.pwg-multiplexed entity + has a unique message number, and a message consists of the + concatenation of all the octets from the one or more chunks with the + same message number. The isMore field of the chunk header of the + last chunk of each message must have a value of "LAST" and the isMore + field of the chunk header of all other chunks must have a value of + "MORE". + + Two or more messages may have the same message number, though such + reuse of message numbers is not recommended. The chunks with the + same message number represent a sequence of one or more messages + where the isMore field of the chunk header of the last chunk of each + message has a value of "LAST". All chunks whose isMore field of the + chunk header has the value of "MORE" belong to the same message as + the next chunk (in sequence) whose isMore field of the chunk header + has the value of "LAST". In other words, if two messages have the + same message number, the last chunk of the first message must occur + before the first chunk of the second message. + + The behavior of the Consumer is undefined if the final Chunk (i.e., + the Chunk whose chunk header is "CHK 0 0 LAST") occurs before the + last chunk of every message occurs. + + Two adjacent chunks usually have different message numbers. However, + they may have the same message number. If two adjacent chunks have + the same message number, the two chunks could be combined into a + single chunk, but they need not be combined. + + The number of octets in a chunk payload may be zero, and an + Application/Vnd.pwg-multiplexed entity may contain any number of + chunks with zero octets of chunk payload. For example, the last + chunk of each message may contain zero octets for programming + convenience. As another example, suppose that a particular compound + object format requires that referenced messages occur before the root + message. This document requires that the first chunk of an + Application/Vnd.pwg-multiplexed entity contain the root message or a + + + +Herriot Informational [Page 11] + +RFC 3391 Application/Multiplexed December 2002 + + + part of it. So, the first chunk contains a chunk payload of zero + octets with the first octet of the root message in the second chunk. + That is, all of the message headers of the root message are in the + second chunk. As an extreme but unlikely example, it would be + possible to have a message broken into ten chunks with zero octet + chunk payloads in all chunks except for chunks 4 and 7. + +3.2 Parameters for Application/Vnd.pwg-multiplexed + + This section defines additional parameters for Application/Vnd.pwg- + multiplexed. + +3.2.1 The "type" Parameter + + The type parameter must be specified. Its value is the content-type + of the "root" message. It permits a Consumer to determine the + content-type without reference to the enclosed message. If the value + of the type parameter differs from the content-type of the root + message, the Consumer's behavior is undefined. + +3.2.2 Syntax + + The syntax for "parameter" is: + + parameter := "type" "=" type "/" subtype ; cf. [RFC2045] + +4. Handling Application/Vnd.pwg-multiplexed Entities + + The application that handles the Application/Vnd.pwg-multiplexed + entity has the responsibility for displaying the entity. However, + Application/Vnd.pwg-multiplexed messages may contain Content- + Disposition headers that provide suggestions for the display and + storage of a message, and in some cases the application may pay + attention to such headers. + + As a reminder, Content-Disposition headers [RFC1806] allow the sender + to suggest presentation styles for MIME messages. There are two + presentation styles, 'inline' and 'attachment'. Content-Disposition + headers have a parameter for specifying a suggested file name for + storage. + + There are three cases to consider for handling Application/Vnd.pwg- + multiplexed entities: + + a) The Consumer recognizes Application/Vnd.pwg-multiplexed and the + content-type of the root. The Consumer determines the + presentation style for the compound object; it handles the + display of the components of the compound object in the context + + + +Herriot Informational [Page 12] + +RFC 3391 Application/Multiplexed December 2002 + + + of the compound object. In this case, the Content-Disposition + header information is redundant or even misleading, and the + Consumer shall ignore them for purposes of display. The + Consumer may use the suggested file name if the entity is + stored. + + b) The Consumer recognizes Application/Vnd.pwg-multiplexed, but + not the content-type of the root. The Consumer will give the + user the choice of suppressing the entire Application/Vnd.pwg- + multiplexed entity or treating the Application/Vnd.pwg- + multiplexed entity as a Multipart/Mixed entity where each + message is a body part of the Multipart/Mixed entity. In this + case (where the entity is not suppressed), the Consumer may + find the Content-Disposition information useful for displaying + each body part of the resulting Multipart/Mixed entity. If a + body part has no Content-Disposition header, the Consumer + should display the body part as an attachment. + + c) The Consumer does not recognize Application/Vnd.pwg- + multiplexed. The Consumer treats the Application/Vnd.pwg- + multiplexed entity as opaque and can do nothing with it. + +5. Examples + + This section contains five examples. Each example is a different + representation of the same compound object. The compound object has + four components: an XHTML text component and three image components. + The images are encoded in binary. The string "<>" and + "<>" in each example represents all or part of + the binary data of each image. Two of the images are potentially + side by side and the third image is displayed later in the document. + All of the images are identified by Content-Id and two of the images + are also identified by a Content-Location. One of the images + references the Content-Location. + + The first example shows a Multipart/Related representation of the + compound object in order to provide a representation that the reader + is familiar with. The remaining examples show Application/Vnd.pwg- + multiplexed representations of the same compound object. In the + second example, each chunk contains a whole message. In the third + example, the XHTML message is split across 3 chunks, and these chunks + are interleaved among the three image messages. In the fourth + example, the XHTML message is split across 4 chunks, and the two + side-by-side images are each split across two chunks. The XHTML + chunks are interleaved among the image chunks. In the fifth example, + there are chunks with empty payloads and adjacent chunks with the + same message number. + + + + +Herriot Informational [Page 13] + +RFC 3391 Application/Multiplexed December 2002 + + + The last example may seem to address useless cases, but sometimes it + is easier to write software if these cases are allowed. For example, + when a buffer fills, it may be easiest to write a chunk and not worry + if the previous chunk had the same message number. Likewise, it may + be easiest to end a message with an empty chunk. Finally, the + Application/Vnd.pwg-multiplexed content-type requires that the first + chunk be part of the root message. Sometimes, it is more convenient + for the Producer if the root message starts after the occurrence of + some attachments. Since a chunk can be empty, the first chunk of the + root message can be empty, i.e., it doesn't even contain any headers. + Then the first chunk contains a part of the root message, but the + Producer doesn't generate any octets for that chunk. + + Each body part of the Multipart/Related entity and each message of + the Application/Vnd.pwg-multiplexed entity contain a content- + disposition, which the Consumer uses according to the rules in + section 4. Note the location of the content-disposition headers in + the examples. + +5.1 Example With Multipart/Related + + In this example, the compound object is represented as a + Multipart/Related entity so that the reader can compare it with the + Application/Vnd.pwg-multiplexed entities. + + Content-Type: multipart/related; boundary="boundary-example"; + type="text/xhtml+xml" + + --boundary-example + Content-ID: <49568.44343xxx@foo.com> + Content-Type: application/vnd.pwg-xhtml-print+xml + Content-Disposition: inline + + + + + +

some text + + + some more text after the images +

+

some more text without images +

+

some more text + +

+ + + +Herriot Informational [Page 14] + +RFC 3391 Application/Multiplexed December 2002 + + +

some final text +

+ + + --boundary-example + Content-ID: <49568.45876xxx@foo.com> + Content-Location: http://foo.com/images/image1.gif + Content-Type: image/gif + Content-Disposition: attachment + + <> + --boundary-example + Content-ID: <49568.46000xxx@foo.com> + Content-Location: http://foo.com/images/image2.gif + Content-Type: image/gif + Content-Disposition: attachment + + <> + --boundary-example + Content-ID: <49568.47333xxx@foo.com> + Content-Type: image/gif + Content-Disposition: attachment + + <> + --boundary-example-- + +5.2 Examples with Application/Vnd.pwg-multiplexed + + The four examples in this section show Application/Vnd.pwg- + multiplexed representations of the same compound object. Note that + each CRLF is represented by a visual line break. + +5.2.1 Example Where Each Chunk Has a Complete Message + + In this example, the compound object is represented as an + Application/Vnd.pwg-multiplexed entity. Each chunk contains an + entire message, i.e., none of the messages are split across multiple + chunks. Each message in this example is identical to the + corresponding body part in the preceding Multipart/Relate example. + + Content-Type: application/vnd.pwg-multiplexed; + type="application/vnd.pwg-xhtml-print+xml" + + CHK 1 550 LAST + Content-ID: <49568.44343xxx@foo.com> + Content-Type: application/vnd.pwg-xhtml-print+xml + Content-Disposition: inline + + + + +Herriot Informational [Page 15] + +RFC 3391 Application/Multiplexed December 2002 + + + + + + +

some text + + + some more text after the images +

+

some more text without images +

+

some more text + +

+

some final text +

+ + + + CHK 2 6346 LAST + Content-ID: <49568.45876xxx@foo.com> + Content-Location: http://foo.com/images/image1.gif + Content-Type: image/gif + Content-Disposition: attachment + + <> + CHK 3 6401 LAST + Content-ID: <49568.46000xxx@foo.com> + Content-Location: http://foo.com/images/image2.gif + Content-Type: image/gif + Content-Disposition: attachment + + <> + CHK 4 7603 LAST + Content-ID: <49568.47333xxx@foo.com> + Content-Type: image/gif + Content-Disposition: attachment + + <> + CHK 0 0 LAST + + + + + + + + + + +Herriot Informational [Page 16] + +RFC 3391 Application/Multiplexed December 2002 + + +5.2.2 Example of Chunking the Root Message + + In this example, the compound object is represented as an + Application/Vnd.pwg-multiplexed entity. The message containing the + XHTML component is split into 3 pieces so that the reference to an + image is as close as possible to the beginning of the chunk. The + chunk containing the referenced image message occurs just before the + chunk with the reference. This minimizes the distance between + reference and referenced message. + + Note that there are other possible arrangements (see the third + example in section 5.2.3). For example, a sender could split the + XHTML message so that the reference to an image is as close as + possible to the end of the chunk. Then the chunk containing the + referenced image message should occur just after the chunk with the + reference. The sender could mix this strategy with the one used in + this example. + + Content-Type: application/vnd.pwg-multiplexed; + type=" application/vnd.pwg-xhtml-print+xml" + + CHK 1 267 MORE + Content-ID: <49568.44343xxx@foo.com> + Content-Type: application/vnd.pwg-xhtml-print+xml + Content-Disposition: inline + + + + + +

some text + + CHK 2 6346 LAST + Content-ID: <49568.45876xxx@foo.com> + Content-Location: http://foo.com/images/image1.gif + Content-Type: image/gif + Content-Disposition: attachment + + <> + CHK 3 6401 LAST + Content-ID: <49568.46000xxx@foo.com> + Content-Location: http://foo.com/images/image2.gif + Content-Type: image/gif + Content-Disposition: attachment + + + + + + +Herriot Informational [Page 17] + +RFC 3391 Application/Multiplexed December 2002 + + + <> + CHK 1 166 MORE + + + some more text after the images +

+

some more text without images +

+

some more text + + CHK 4 7603 LAST + Content-ID: <49568.47333xxx@foo.com> + Content-Type: image/gif + Content-Disposition: attachment + + <> + CHK 1 80 LAST + +

+

some final text +

+ + + + CHK 0 0 LAST + +5.2.3 Example of Chunking the Several Messages + + In this example, the compound object is represented as an + Application/Vnd.pwg-multiplexed entity. The message containing the + XHTML component is split into 4 pieces so that the reference to an + image is as close as possible to either the beginning or the end of + the chunk. The references to the first and second images closely + follow the referenced images. The reference to the third image + closely precedes the referenced image. This minimizes the distance + between reference and referenced message. In addition, the first two + image messages are split into two chunks each. + + Content-Type: application/vnd.pwg-multiplexed; + type=" application/vnd.pwg-xhtml-print+xml" + + CHK 1 303 MORE + Content-ID: <49568.44343xxx@foo.com> + Content-Type: application/vnd.pwg-xhtml-print+xml + Content-Disposition: inline + + + + + + +Herriot Informational [Page 18] + +RFC 3391 Application/Multiplexed December 2002 + + + + + + +

some text + + CHK 2 184 MORE + Content-ID: <49568.45876xxx@foo.com> + Content-Location: http://foo.com/images/image1.gif + Content-Type: image/gif + Content-Disposition: attachment + + <> + CHK 3 200 MORE + Content-ID: <49568.46000xxx@foo.com> + Content-Location: http://foo.com/images/image2.gif + Content-Type: image/gif + Content-Disposition: attachment + + <> + CHK 1 78 MORE + + + + CHK 2 6162 LAST + <> + CHK 3 6201 LAST + <> + CHK 1 127 MORE + some more text after the images +

+

some more text without images +

+

some more text + + + CHK 4 7603 LAST + Content-ID: <49568.47333xxx@foo.com> + Content-Type: image/gif + Content-Disposition: attachment + + + + + + + + + + +Herriot Informational [Page 19] + +RFC 3391 Application/Multiplexed December 2002 + + + <> + CHK 1 41 LAST +

+

some final text +

+ + + + CHK 0 0 LAST + +5.2.4 Example of Chunks with Empty Payloads + + This example is identical to the previous one, except that some + chunks have a chunk payload of zero octets. The root message starts + with a chunk whose payload is empty and every message ends with a + chunk whose payload is empty. This example also shows two adjacent + chunks that are from the same message. These two chunks could be + coalesced into a single chunk, but they might be kept separate for + programming convenience. + + Content-Type: application/vnd.pwg-multiplexed; + type=" application/vnd.pwg-xhtml-print+xml" + + CHK 1 0 MORE + + CHK 2 184 MORE + Content-ID: <49568.45876xxx@foo.com> + Content-Location: http://foo.com/images/image1.gif + Content-Type: image/gif + Content-Disposition: attachment + + <> + CHK 3 200 MORE + Content-ID: <49568.46000xxx@foo.com> + Content-Location: http://foo.com/images/image2.gif + Content-Type: image/gif + Content-Disposition: attachment + + <> + CHK 1 303 MORE + Content-ID: <49568.44343xxx@foo.com> + Content-Type: application/vnd.pwg-xhtml-print+xml + Content-Disposition: inline + + + + + + + + +Herriot Informational [Page 20] + +RFC 3391 Application/Multiplexed December 2002 + + + + + + +

some text + + CHK 2 6162 MORE + <> + CHK 3 6201 MORE + <> + CHK 2 0 LAST + + CHK 3 0 LAST + + CHK 1 78 MORE + + + + CHK 4 7603 MORE + Content-ID: <49568.47333xxx@foo.com> + Content-Type: image/gif + Content-Disposition: attachment + + <> + CHK 4 0 LAST + + CHK 1 127 MORE + some more text after the images +

+

some more text without images +

+

some more text + + + CHK 1 41 MORE +

+

some final text +

+ + + + CHK 1 0 LAST + + CHK 0 0 LAST + + + + + + +Herriot Informational [Page 21] + +RFC 3391 Application/Multiplexed December 2002 + + +6. Security Considerations + + There are security considerations that pertain to each message of an + Application/Vnd.pwg-multiplexed entity. Those security + considerations are described by the document that defines the + content-type of the message. They are not addressed in this + document. + + There are also security considerations that pertain to the + Application/Vnd.pwg-multiplexed entity as a whole. A Producer that + is buggy or malicious may send an Application/Vnd.pwg-multiplexed + entity that could cause a Consumer to request more storage than it + has, even if it has a large amount of storage. A Consumer must be + able to deal gracefully with the following scenarios and combinations + of them: + + - The chunks of one or more messages are separated by a very large + number of octets. In the extreme case some or all of the + messages don't terminate, i.e., they don't contain a closing + chunk. + - A very large number of messages are started and interleaved + before their final chunk occurs. + - A message contains one or more references to other messages that + never occur or don't occur for a large number of octets. + - A very large number of referenced messages occur before the + Consumer knows that it can discard them. + +7. Registration Information for Application/Vnd.pwg-multiplexed + + The following form is copied from RFC 1590, Appendix A. + + To: iana@iana.org + + Subject: Registration of new Media Type + application/Vnd.pwg-multiplexed + Media Type name: Application + Media subtype name: Vendor Tree - vnd.pwg-multiplexed + Required parameters: Type, a media type/subtype. + Optional parameters: No optional parameters + Encoding considerations: Each message of an + Application/Vnd.pwg-multiplexed entity can be + encoded in any manner allowed by the Content- + Type of the message. However, using the + reasoning of Multipart, the + Application/Vnd.pwg-multiplexed entity cannot + be encoded. Otherwise, a message would be + + + + + +Herriot Informational [Page 22] + +RFC 3391 Application/Multiplexed December 2002 + + + encoded twice, once at the message level and + once at the Application/Vnd.pwg-multiplexed + level. + Security considerations: See section 6 (Security + Considerations) of RFC 3391. + Published specification: RFC 3391. + Person & email address to contact for further information: + + Robert Herriot + 706 Colorado Ave. + Palo Alto, CA 94303 + USA + Phone: 1-650-327-4466 + Fax: 1-650-327-4466 + EMail: bob@herriot.com + +8. Acknowledgments + + The author gratefully acknowledges the contributions of: Ugo Corda, + Dave Crocker, Melinda Sue Grant, Graham Klyne, Carl-Uno Manros, Larry + Masinter, Ira McDonald, Chris Newman, Henrik Frystyk Nielsen and Dale + R. Worley. In particular, Chris Newman provided invaluable help. + +9. References + + [RFC1806] Troost, R. and S. Dorner, "Communicating Presentation + Information in Internet Messages: The Content-Disposition + Header", RFC 1806, June 1995. + + [RFC1873] Levinson, E. and J. Clark, "Message/External-Body Content- + ID Access Type", RFC 1873, December 1995. + Levinson, E., "Message/External-Body Content-ID Access + Type", Work in Progress. + + [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part One: Format of Internet Message + Bodies", RFC 2045, November 1996. + + [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part Two: Media Types", RFC 2046, + November 1996. + + [RFC2234] Crocker, D. and P. Overell, "Augmented BNF for + SyntaxSpecifications: ABNF", RFC 2234, November 1997. + + [RFC2387] Levinson, E., "The MIME Multipart/Related Content-type", + RFC 2387, August 1998. + + + + +Herriot Informational [Page 23] + +RFC 3391 Application/Multiplexed December 2002 + + + [RFC2392] Levinson, E., "Content-ID and Message-ID Uniform Resource + Locators", RFC 2392, August 1998. + + [RFC2557] Palme, J., "MIME Encapsulation of Aggregate Documents, such + as HTML (MHTML", RFC 2557, March 1999. + + [RFC2822] Resnick, P., Editor, "Internet Message Format", RFC 2822, + April 2001. + + [RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core", + RFC 3080, March 2001. + +10. Author's Address + + Robert Herriot + 706 Colorado Ave. + Palo Alto, CA 94303 + USA + + Phone: 1-650-327-4466 + Fax: 1-650-327-4466 + EMail: bob@herriot.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Herriot Informational [Page 24] + +RFC 3391 Application/Multiplexed December 2002 + + +11. Full Copyright Statement + + Copyright (C) The Internet Society (2002). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +Acknowledgement + + Funding for the RFC Editor function is currently provided by the + Internet Society. + + + + + + + + + + + + + + + + + + + +Herriot Informational [Page 25] + diff --git a/standards/rfc3712.txt b/standards/rfc3712.txt new file mode 100644 index 0000000000..f5bb966ea2 --- /dev/null +++ b/standards/rfc3712.txt @@ -0,0 +1,1851 @@ + + + + + + +Network Working Group P. Fleming +Request for Comments: 3712 IBM +Category: Informational I. McDonald + High North + February 2004 + + + Lightweight Directory Access Protocol (LDAP): + Schema for Printer Services + +Status of this Memo + + This memo provides information for the Internet community. It does + not specify an Internet standard of any kind. Distribution of this + memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (2004). All Rights Reserved. + +Abstract + + This document defines a schema, object classes and attributes, for + printers and printer services, for use with directories that support + Lightweight Directory Access Protocol v3 (LDAP-TS). This document is + based on the printer attributes listed in Appendix E of Internet + Printing Protocol/1.1 (IPP) (RFC 2911). A few additional printer + attributes are based on definitions in the Printer MIB (RFC 1759). + +Table of Contents + + 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 + 1.1. Rationale for using DirectoryString Syntax . . . . . . . 3 + 1.2. Rationale for using caseIgnoreMatch. . . . . . . . . . . 4 + 1.3. Rationale for using caseIgnoreSubstringsMatch. . . . . . 5 + 2. Terminology and Conventions. . . . . . . . . . . . . . . . . . 5 + 3. Definition of Object Classes . . . . . . . . . . . . . . . . . 6 + 3.1. slpServicePrinter. . . . . . . . . . . . . . . . . . . . 6 + 3.2. printerAbstract. . . . . . . . . . . . . . . . . . . . . 7 + 3.3. printerService . . . . . . . . . . . . . . . . . . . . . 8 + 3.4. printerServiceAuxClass . . . . . . . . . . . . . . . . . 8 + 3.5. printerIPP . . . . . . . . . . . . . . . . . . . . . . . 8 + 3.6. printerLPR . . . . . . . . . . . . . . . . . . . . . . . 9 + 4. Definition of Attribute Types. . . . . . . . . . . . . . . . . 9 + 4.1. printer-uri. . . . . . . . . . . . . . . . . . . . . . . 11 + 4.2. printer-xri-supported. . . . . . . . . . . . . . . . . . 11 + 4.3. printer-name . . . . . . . . . . . . . . . . . . . . . . 13 + 4.4. printer-natural-language-configured. . . . . . . . . . . 13 + + + +Fleming & McDonald Informational [Page 1] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + 4.5. printer-location . . . . . . . . . . . . . . . . . . . . 14 + 4.6. printer-info . . . . . . . . . . . . . . . . . . . . . . 14 + 4.7. printer-more-info. . . . . . . . . . . . . . . . . . . . 14 + 4.8. printer-make-and-model . . . . . . . . . . . . . . . . . 15 + 4.9. printer-ipp-versions-supported . . . . . . . . . . . . . 15 + 4.10. printer-multiple-document-jobs-supported . . . . . . . . 16 + 4.11. printer-charset-configured . . . . . . . . . . . . . . . 16 + 4.12. printer-charset-supported. . . . . . . . . . . . . . . . 16 + 4.13. printer-generated-natural-language-supported . . . . . . 17 + 4.14. printer-document-format-supported. . . . . . . . . . . . 17 + 4.15. printer-color-supported. . . . . . . . . . . . . . . . . 18 + 4.16. printer-compression-supported. . . . . . . . . . . . . . 18 + 4.17. printer-pages-per-minute . . . . . . . . . . . . . . . . 18 + 4.18. printer-pages-per-minute-color . . . . . . . . . . . . . 19 + 4.19. printer-finishings-supported . . . . . . . . . . . . . . 19 + 4.20. printer-number-up-supported. . . . . . . . . . . . . . . 19 + 4.21. printer-sides-supported. . . . . . . . . . . . . . . . . 20 + 4.22. printer-media-supported. . . . . . . . . . . . . . . . . 20 + 4.23. printer-media-local-supported. . . . . . . . . . . . . . 20 + 4.24. printer-resolution-supported . . . . . . . . . . . . . . 21 + 4.25. printer-print-quality-supported. . . . . . . . . . . . . 22 + 4.26. printer-job-priority-supported . . . . . . . . . . . . . 22 + 4.27. printer-copies-supported . . . . . . . . . . . . . . . . 22 + 4.28. printer-job-k-octets-supported . . . . . . . . . . . . . 23 + 4.29. printer-current-operator . . . . . . . . . . . . . . . . 23 + 4.30. printer-service-person . . . . . . . . . . . . . . . . . 24 + 4.31. printer-delivery-orientation-supported . . . . . . . . . 24 + 4.32. printer-stacking-order-supported . . . . . . . . . . . . 24 + 4.33. printer-output-features-supported. . . . . . . . . . . . 25 + 4.34. printer-aliases. . . . . . . . . . . . . . . . . . . . . 25 + 5. Definition of Syntaxes . . . . . . . . . . . . . . . . . . . . 26 + 6. Definition of Matching Rules . . . . . . . . . . . . . . . . . 26 + 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 + 7.1. Registration of Object Classes . . . . . . . . . . . . . 26 + 7.2. Registration of Attribute Types. . . . . . . . . . . . . 27 + 8. Internationalization Considerations. . . . . . . . . . . . . . 28 + 9. Security Considerations. . . . . . . . . . . . . . . . . . . . 29 + 10. References . . . . . . . . . . . . . . . . . . . . . . . . . . 29 + 10.1. Normative References . . . . . . . . . . . . . . . . . . 29 + 10.2. Informative References . . . . . . . . . . . . . . . . . 30 + 11. Acknowledgments. . . . . . . . . . . . . . . . . . . . . . . . 32 + 12. Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . 32 + 13. Full Copyright Statement . . . . . . . . . . . . . . . . . . . 33 + + + + + + + + +Fleming & McDonald Informational [Page 2] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +1. Introduction + + This document defines several object classes to provide Lightweight + Directory Access Protocol v3 [LDAP-TS] applications with flexible + options in defining printer information using LDAP schema. Classes + are provided for defining directory entries with common printer + information as well as for extending existing directory entries with + SLPv2 [RFC2608], IPP/1.1 [RFC2911], and LPR [RFC1179] specific + information. + + The schema defined in this document is based on the printer + attributes listed in Appendix E 'Generic Directory Schema' of + Internet Printing Protocol/1.1 (IPP) [RFC2911]. A few additional + printer attributes are based on definitions in the Printer MIB + [RFC1759]. + + The schema defined in this document is technically aligned with the + stable IANA-registered 'service:printer:' v2.0 template [SLP-PRT], + for compatibility with already deployed Service Location Protocol + (SLPv2) [RFC2608] service advertising and discovery infrastructure. + The attribute syntaxes are technically aligned with the + 'service:printer:' v2.0 template - therefore simpler types are + sometimes used (for example, 'DirectoryString' [RFC2252] rather than + 'labeledURI' [RFC2079] for the 'printer-uri' attribute). + + Please send comments directly to the authors at the addresses listed + in Section 13 "Authors' Addresses". + +1.1. Rationale for using DirectoryString Syntax + + The attribute syntax 'DirectoryString' (UTF-8 [RFC2279]) defined in + [RFC2252] is specified for several groups of string attributes that + are defined in this document: + + 1) URI + - printer-uri, printer-xri-supported, printer-more-info + + The UTF-8 encoding is forward compatible with any future + deployment of (UTF-8 based) IRI (Internationalized Resource + Identifiers) [W3C-IRI] currently being developed by the W3C + Internationalization Working Group. + + 2) Description + - printer-name, printer-location, printer-info, + printer-make-and-model + + + + + + +Fleming & McDonald Informational [Page 3] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + The UTF-8 encoding supports descriptions in any language, + conformant with the "IETF Policy on Character Sets and Languages" + [RFC2277]. + + Note: The printer-natural-language-configured attribute contains + a language tag [RFC3066] for these description attributes (for + example, to support text-to-speech conversions). + + 3) Keyword + - printer-compression-supported, printer-finishings-supported, + printer-media-supported, printer-media-local-supported, + printer-print-quality-supported + + The UTF-8 encoding is compatible with the current IPP/1.1 + [RFC2911] definition of the equivalent attributes, most of which + have the IPP/1.1 union syntax 'keyword or name'. The keyword + attributes defined in this document are extensible by + site-specific or vendor-specific 'names' which behave like new + 'keywords' + + Note: In IPP/1.1, each value is strongly typed over-the-wire as + either 'keyword' or 'name'. This union selector is not preserved + in the definitions of these equivalent LDAP attributes. + +1.2. Rationale for using caseIgnoreMatch + + The EQUALITY matching rule 'caseIgnoreMatch' defined in [RFC2252] is + specified for several groups of string attributes that are defined in + this document: + + 1) URI + + These URI attributes specify EQUALITY matching with + 'caseIgnoreMatch' (rather than with 'caseExactMatch') in order to + conform to the spirit of [RFC2396], which requires case + insensitive matching on the host part of a URI versus case + sensitive matching on the remainder of a URI. + + These URI attributes follow existing practice of supporting case + insensitive equality matching for host names in the + associatedDomain attribute defined in [RFC1274]. + + Either equality matching rule choice would be a compromise: + a) case sensitive whole URI matching may lead to false negative + matches and has been shown to be fragile (given deployed client + applications that 'pretty up' host names displayed and + transferred in URI); + + + + +Fleming & McDonald Informational [Page 4] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + b) case insensitive whole URI matching may lead to false positive + matches, although it is a dangerous practice to publish URI that + differ only by case (for example, in the path elements). + + 2) Description + + Case insensitive equality matching is more user-friendly for + description attributes. + + 3) Keyword + + Case insensitive equality matching is more user-friendly for + keyword attributes. + +1.3. Rationale for using caseIgnoreSubstringsMatch + + The SUBSTR matching rule 'caseIgnoreSubstringsMatch' defined in + [RFC2252] is specified for several groups of string attributes that + are defined in this document: + + 1) URI + + These URI attributes follow existing practice of supporting case + insensitive equality matching for host names in the + associatedDomain attribute defined in [RFC1274]. + + 2) Description + + Support for case insensitive substring matching is more + user-friendly for description attributes. + + 3) Keyword + + Support for case insensitive substring matching is more + user-friendly for keyword attributes. + +2. Terminology and Conventions + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in BCP 14 [RFC2119]. + + Schema definitions are provided using LDAPv3 [LDAP-TS] description + formats. Definitions provided here are formatted (line wrapped) for + readability. + + + + + + +Fleming & McDonald Informational [Page 5] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +3. Definition of Object Classes + + We define the following LDAP object classes for use with both generic + printer related information and services specific to SLPv2 [RFC2608], + IPP/1.1 [RFC2911], and LPR [RFC1179]. + + slpServicePrinter - auxiliary class for SLP registered printers + printerAbstract - abstract class for all printer classes + printerService - structural class for printers + printerServiceAuxClass - auxiliary class for printers + printerIPP - auxiliary class for IPP printers + printerLPR - auxiliary class for LPR printers + + The following are some examples of how applications may choose to use + these classes when creating directory entries: + + 1) Use printerService for directory entries containing common + printer information. + + 2) Use both printerService and slpServicePrinter for directory + entries containing common printer information for SLP registered + printers. + + 3) Use printerService, printerLPR and printerIPP for directory + entries containing common printer information for printers that + support both LPR and IPP. + + 4) Use printerServiceAuxClass and object classes not defined by this + document for directory entries containing common printer + information. In this example, printerServiceAuxClass is used for + extending other structural classes defining printer information + with common printer information defined in this document. + + Refer to Section 4 for definition of attribute types referenced by + these object classes. We use attribute names instead of OIDs in + object class definitions for clarity. Some attribute names described + in [RFC2911] have been prefixed with 'printer-' as recommended in + [RFC2926] and [SLP-PRT]. + +3.1. slpServicePrinter + + ( 1.3.18.0.2.6.254 + NAME 'slpServicePrinter' + DESC 'Service Location Protocol (SLP) information.' + AUXILIARY + SUP slpService + ) + + + + +Fleming & McDonald Informational [Page 6] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + This auxiliary class defines Service Location Protocol (SLPv2) + [RFC2608] specific information. It should be used with a structural + class such as printerService. It may be used to create new or extend + existing directory entries with SLP 'service:printer' abstract + service type information as defined in [SLP-PRT]. This object class + is derived from 'slpService', the parent class for all SLP services, + defined in [RFC2926]. + +3.2. printerAbstract + + ( 1.3.18.0.2.6.258 + NAME 'printerAbstract' + DESC 'Printer related information.' + ABSTRACT + SUP top + MAY ( printer-name $ + printer-natural-language-configured $ + printer-location $ printer-info $ printer-more-info $ + printer-make-and-model $ + printer-multiple-document-jobs-supported $ + printer-charset-configured $ printer-charset-supported $ + printer-generated-natural-language-supported $ + printer-document-format-supported $ printer-color-supported $ + printer-compression-supported $ printer-pages-per-minute $ + printer-pages-per-minute-color $ + printer-finishings-supported $ printer-number-up-supported $ + printer-sides-supported $ printer-media-supported $ + printer-media-local-supported $ + printer-resolution-supported $ + printer-print-quality-supported $ + printer-job-priority-supported $ printer-copies-supported $ + printer-job-k-octets-supported $ printer-current-operator $ + printer-service-person $ + printer-delivery-orientation-supported $ + printer-stacking-order-supported $ + printer-output-features-supported ) + ) + + This abstract class defines printer information. It is a base class + for deriving other printer related classes, such as, but not limited + to, classes defined in this document. It defines a common set of + printer attributes that are not specific to any one type of service, + protocol or operating system. + + + + + + + + +Fleming & McDonald Informational [Page 7] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +3.3. printerService + + ( 1.3.18.0.2.6.255 + NAME 'printerService' + DESC 'Printer information.' + STRUCTURAL + SUP printerAbstract + MAY ( printer-uri $ printer-xri-supported ) + ) + + This structural class defines printer information. It is derived + from class printerAbstract and thus inherits common printer + attributes. This class can be used with or without auxiliary classes + to define printer information. Auxiliary classes can be used to + extend the common printer information with protocol, service or + operating system specific information. + + Note: When extending other structural classes with auxiliary + classes, printerService should not be used. + +3.4. printerServiceAuxClass + + ( 1.3.18.0.2.6.257 + NAME 'printerServiceAuxClass' + DESC 'Printer information.' + AUXILIARY + SUP printerAbstract + MAY ( printer-uri $ printer-xri-supported ) + ) + + This auxiliary class defines printer information. It is derived from + class printerAbstract and thus inherits common printer attributes. + This class should be used with a structural class. + +3.5. printerIPP + + ( 1.3.18.0.2.6.256 + NAME 'printerIPP' + DESC 'Internet Printing Protocol (IPP) information.' + AUXILIARY + SUP top + MAY ( printer-ipp-versions-supported $ + printer-multiple-document-jobs-supported ) + ) + + + + + + + +Fleming & McDonald Informational [Page 8] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + This auxiliary class defines Internet Printing Protocol (IPP/1.1) + [RFC2911] information. It should be used with a structural class + such as printerService. It is used to extend structural classes with + IPP specific printer information. + +3.6. printerLPR + + ( 1.3.18.0.2.6.253 + NAME 'printerLPR' + DESC 'LPR information.' + AUXILIARY + SUP top + MUST ( printer-name ) + MAY ( printer-aliases) + ) + + This auxiliary class defines LPR [RFC1179] information. It should be + used with a structural class such as printerService. It is used to + identify directory entries that support LPR. + +4. Definition of Attribute Types + + The following attribute types are referenced by the object classes + defined in Section 3. + + The following attribute types reference syntax OIDs defined in + Section 6 of [RFC2252] (see Section 5 'Definition of Syntaxes' + below). + + The following attribute types reference matching rule names (instead + of OIDs) for clarity (see Section 6 below). For optional attributes, + if the printer information is not known, the attribute value should + not be set. In the following definitions, referenced matching rules + are defined in Section 8 of [RFC2252] and/or Section 2 of [RFC3698] + (see Section 6 'Definition of Matching Rules' below). + + The following table is a summary of the attribute names defined by + this document and their corresponding names from [RFC2911]. Some + attribute names described in [RFC2911] have been prefixed with + 'printer-' as recommended in [RFC2926], to address the flat namespace + for LDAP identifiers. + + + + + + + + + + +Fleming & McDonald Informational [Page 9] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + LDAP & SLP Printer Schema IPP Model [RFC2911] + ------------------------------ ------------------------------------- + printer-uri + printer-xri-supported + [IPP printer-uri-supported] + [IPP uri-authentication-supported] + [IPP uri-security-supported] + printer-name printer-name + printer-natural-language-configured + natural-language-configured + printer-location printer-location + printer-info printer-info + printer-more-info printer-more-info + printer-make-and-model printer-make-and-model + printer-ipp-versions-supported ipp-versions-supported + printer-multiple-document-jobs-supported + multiple-document-jobs-supported + printer-charset-configured charset-configured + printer-charset-supported charset-supported + printer-generated-natural-language-supported + generated-natural-language-supported + printer-document-format-supported + document-format-supported + printer-color-supported color-supported + printer-compression-supported compression-supported + printer-pages-per-minute pages-per-minute + printer-pages-per-minute-color pages-per-minute-color + printer-finishings-supported finishings-supported + printer-number-up-supported number-up-supported + printer-sides-supported sides-supported + printer-media-supported media-supported + printer-media-local-supported [site names from IPP media-supported] + printer-resolution-supported printer-resolution-supported + printer-print-quality-supported print-quality-supported + printer-job-priority-supported job-priority-supported + printer-copies-supported copies-supported + printer-job-k-octets-supported job-k-octets-supported + printer-current-operator + printer-service-person + printer-delivery-orientation-supported + printer-stacking-order-supported + printer-output-features-supported + printer-aliases + + + + + + + + +Fleming & McDonald Informational [Page 10] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +4.1. printer-uri + + ( 1.3.18.0.2.4.1140 + NAME 'printer-uri' + DESC 'A URI supported by this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 + SINGLE-VALUE + ) + + If the printer-xri-supported LDAP attribute is implemented, then this + printer-uri value should be listed in printer-xri-supported. + + Values of URI should conform to [RFC2396], although URI schemes may + be defined which do not conform to [RFC2396] (see [RFC2717] and + [RFC2718]). + + Note: LDAP application clients should not attempt to use malformed + URI values read from this attribute. LDAP administrative clients + should not write malformed URI values into this attribute. + + Note: For SLP registered printers, the LDAP printer-uri attribute + should be set to the value of the SLP-registered URL of the printer, + for interworking with SLPv2 [RFC2608] service discovery. + + Note: See Sections 1.1, 1.2, and 1.3 for rationale for design + choices. + +4.2. printer-xri-supported + + ( 1.3.18.0.2.4.1107 + NAME 'printer-xri-supported' + DESC 'The unordered list of XRI (extended resource identifiers) + supported by this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 + ) + + A list of XRI (extended resource identifiers) supported by this + printer. Each value of this list should consist of a URI (uniform + resource identifier) followed by (optional) authentication and + security fields. + + Values of URI should conform to [RFC2396], although URI schemes may + be defined which do not conform to [RFC2396] (see [RFC2717] and + [RFC2718]). + + + +Fleming & McDonald Informational [Page 11] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + Note: LDAP application clients should not attempt to use malformed + URI values read from this attribute. LDAP administrative clients + should not write malformed URI values into this attribute. + + Note: This attribute is based on 'printer-uri-supported', 'uri- + authentication-supported', and `'uri-security-supported' (called the + 'Three Musketeers' because they are parallel ordered attributes) + defined in IPP/1.1 [RFC2911]. This attribute unfolds those IPP/1.1 + attributes and thus avoids the ordering (and same number of values) + constraints of the IPP/1.1 separate attributes. + + Defined keywords for fields include: + + 'uri' (IPP 'printer-uri-supported') + 'auth' (IPP 'uri-authentication-supported') + 'sec' (IPP 'uri-security-supported') + + A missing 'auth' field should be interpreted to mean 'none'. Per + IPP/1.1 [RFC2911], defined values of the 'auth' field include: + + 'none' (no authentication for this URI) + 'requesting-user-name' (from operation request) + 'basic' (HTTP/1.1 Basic [RFC2617]) + 'digest' (HTTP/1.1 Basic, [RFC2617]) + 'certificate' (from certificate) + + A missing 'sec' field should be interpreted to mean 'none'. Per + IPP/1.1 [RFC2911], defined values of the 'sec' field include: + + 'none' (no security for this URI) + 'ssl3' (Netscape SSL3) + 'tls' (IETF TLS/1.0, [RFC2246]) + + Each XRI field should be delimited by '<'. For example: + + 'uri=ipp://foo.com< auth=digest< sec=tls<' + 'uri=lpr://bar.com< auth=none< sec=none<' + 'uri=mailto:printer@foobar.com< auth=none< sec=none<' + + Note: The syntax and delimiter for this attribute are aligned with + the equivalent attribute in the 'service:printer:' v2.0 template + [SLP-PRT]. Whitespace is permitted after (but not before) the + delimiter '<'. Note that this delimiter differs from printer- + resolution-supported. + + Note: See Sections 1.1, 1.2, and 1.3 for rationale for design + choices. + + + + +Fleming & McDonald Informational [Page 12] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +4.3. printer-name + + ( 1.3.18.0.2.4.1135 + NAME 'printer-name' + DESC 'The site-specific administrative name of this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + SINGLE-VALUE + ) + + Values of this attribute should be specified in the language + specified in printer-natural-language-configured (for example, to + support text-to-speech conversions), although the printer's name may + be specified in any language. This name may be the last part of the + printer's URI or it may be completely unrelated. This name may + contain characters that are not allowed in a conventional URI (see + [RFC2396]). + +4.4. printer-natural-language-configured + + ( 1.3.18.0.2.4.1119 + NAME 'printer-natural-language-configured' + DESC 'The configured natural language in which error and status + messages will be generated (by default) by this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + SINGLE-VALUE + ) + + Also, a possible natural language for printer string attributes set + by operator, system administrator, or manufacturer. Also, the + (declared) natural language of the printer-name, printer-location, + printer-info, and printer-make-and-model attributes of this printer. + + Values of language tags should conform to "Tags for the + Identification of Languages" [RFC3066]. For example: + + 'en-us' (English as spoken in the US) + 'fr-fr' (French as spoken in France) + + For consistency with IPP/1.1 [RFC2911], language tags in this + attribute should be lowercase normalized. + + + + + + + +Fleming & McDonald Informational [Page 13] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +4.5. printer-location + + ( 1.3.18.0.2.4.1136 + NAME 'printer-location' + DESC 'The physical location of this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + SINGLE-VALUE + ) + + For example: + + 'Room 123A' + 'Second floor of building XYZ' + +4.6. printer-info + + ( 1.3.18.0.2.4.1139 + NAME 'printer-info' + DESC 'Descriptive information about this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + SINGLE-VALUE + ) + + For example: + + 'This printer can be used for printing color transparencies for + HR presentations' + 'Out of courtesy for others, please print only small (1-5 page) + jobs at this printer' + 'This printer is going away on July 1, 1997, please find a new + printer' + +4.7. printer-more-info + + ( 1.3.18.0.2.4.1134 + NAME 'printer-more-info' + DESC 'A URI for more information about this specific printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 + SINGLE-VALUE + ) + + + + + +Fleming & McDonald Informational [Page 14] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + For example, this could be an HTTP type URI referencing an HTML page + accessible to a Web Browser. The information obtained from this URI + is intended for end user consumption. + + Values of URI should conform to [RFC2396], although URI schemes may + be defined which do not conform to [RFC2396] (see [RFC2717] and + [RFC2718]). + + Note: LDAP application clients should not attempt to use malformed + URI values read from this attribute. LDAP administrative clients + should not write malformed URI values into this attribute. + + Note: See Sections 1.1, 1.2, and 1.3 for rationale for design + choices. + +4.8. printer-make-and-model + + ( 1.3.18.0.2.4.1138 + NAME 'printer-make-and-model' + DESC 'Make and model of this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + SINGLE-VALUE + ) + + Note: The printer manufacturer may initially populate this + attribute. + +4.9. printer-ipp-versions-supported + + ( 1.3.18.0.2.4.1133 + NAME 'printer-ipp-versions-supported' + DESC 'IPP protocol version(s) that this printer supports.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + ) + + The IPP protocol version(s) should include major and minor versions, + i.e., the exact version numbers for which this Printer implementation + meets the IPP version-specific conformance requirements. + + + + + + + + + +Fleming & McDonald Informational [Page 15] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +4.10. printer-multiple-document-jobs-supported + + ( 1.3.18.0.2.4.1132 + NAME 'printer-multiple-document-jobs-supported' + DESC 'Indicates whether or not this printer supports more than one + document per job.' + EQUALITY booleanMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 + SINGLE-VALUE + ) + +4.11. printer-charset-configured + + ( 1.3.18.0.2.4.1109 + NAME 'printer-charset-configured' + DESC 'The configured charset in which error and status messages will + be generated (by default) by this printer.' + EQUALITY caseIgnoreMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{63} + SINGLE-VALUE + ) + + Also, a possible charset for printer string attributes set by + operator, system administrator, or manufacturer. For example: + + 'utf-8' (ISO 10646/Unicode in UTF-8 transform [RFC2279]) + 'iso-8859-1' (Latin1) + + Values of charset tags should be defined in the IANA Registry of + Coded Character Sets [IANA-CHAR] (see also [RFC2978]) and the + '(preferred MIME name)' should be used as the charset tag in this + attribute. + + For consistency with IPP/1.1 [RFC2911], charset tags in this + attribute should be lowercase normalized. + +4.12. printer-charset-supported + + ( 1.3.18.0.2.4.1131 + NAME 'printer-charset-supported' + DESC 'Set of charsets supported for the attribute values of syntax + DirectoryString for this directory entry.' + EQUALITY caseIgnoreMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{63} + ) + + + + + + +Fleming & McDonald Informational [Page 16] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + For example: + + 'utf-8' (ISO 10646/Unicode in UTF-8 transform [RFC2279]) + 'iso-8859-1' (Latin1) + + Values of charset tags should be defined in the IANA Registry of + Coded Character Sets [IANA-CHAR] (see also [RFC2978]) and the + '(preferred MIME name)' should be used as the charset tag in this + attribute. + + For consistency with IPP/1.1 [RFC2911], charset tags in this + attribute should be lowercase normalized. + +4.13. printer-generated-natural-language-supported + + ( 1.3.18.0.2.4.1137 + NAME 'printer-generated-natural-language-supported' + DESC 'Natural language(s) supported for this directory entry.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{63} + ) + + Values of language tags should conform to "Tags for the + Identification of Languages" [RFC3066]. For example: + + 'en-us' (English as spoken in the US) + 'fr-fr' (French as spoken in France) + + For consistency with IPP/1.1 [RFC2911], language tags in this + attribute should be lowercase normalized. + +4.14. printer-document-format-supported + + ( 1.3.18.0.2.4.1130 + NAME 'printer-document-format-supported' + DESC 'The possible source document formats which may be interpreted + and printed by this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + ) + + Values of document formats should be MIME media types defined in the + IANA Registry of MIME Media Types [IANA-MIME] (see also [RFC2048]). + + + + + + +Fleming & McDonald Informational [Page 17] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +4.15. printer-color-supported + + ( 1.3.18.0.2.4.1129 + NAME 'printer-color-supported' + DESC 'Indicates whether this printer is capable of any type of color + printing at all, including highlight color.' + EQUALITY booleanMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 + SINGLE-VALUE + ) + +4.16. printer-compression-supported + + ( 1.3.18.0.2.4.1128 + NAME 'printer-compression-supported' + DESC 'Compression algorithms supported by this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} + ) + + Values defined in IPP/1.1 [RFC2911] include: + + 'none' (no compression is used) + 'deflate' (public domain ZIP described in [RFC1951]) + 'gzip' (GNU ZIP described in [RFC1952]) + 'compress' (UNIX compression described in [RFC1977]) + +4.17. printer-pages-per-minute + + ( 1.3.18.0.2.4.1127 + NAME 'printer-pages-per-minute' + DESC 'The nominal number of pages per minute which may be output by + this printer.' + EQUALITY integerMatch + ORDERING integerOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 + SINGLE-VALUE + ) + + This attribute is informative, not a service guarantee. Typically, + it is the value used in marketing literature to describe this + printer. For example, the value for a simplex or black-and-white + print mode. + + + + + + + +Fleming & McDonald Informational [Page 18] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +4.18. printer-pages-per-minute-color + + ( 1.3.18.0.2.4.1126 + NAME 'printer-pages-per-minute-color' + DESC 'The nominal number of color pages per minute which may be + output by this printer.' + EQUALITY integerMatch + ORDERING integerOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 + SINGLE-VALUE + ) + + This attribute is informative, not a service guarantee. Typically, + it is the value used in marketing literature to describe this + printer. + + +4.19. printer-finishings-supported + + ( 1.3.18.0.2.4.1125 + NAME 'printer-finishings-supported' + DESC 'The possible finishing operations supported by this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} + ) + + Values defined in IPP/1.1 [RFC2911] include: 'none', 'staple', + 'punch', 'cover', 'bind', 'saddle-stitch', 'edge-stitch', + 'staple-top-left', 'staple-bottom-left', 'staple-top-right', + 'staple-bottom-right', 'edge-stitch-left', 'edge-stitch-top', + 'edge-stitch-right', 'edge-stitch-bottom', 'staple-dual-left', + 'staple-dual-top', 'staple-dual-right', 'staple-dual-bottom'. + + Note: Implementations may support other values. + +4.20. printer-number-up-supported + + ( 1.3.18.0.2.4.1124 + NAME 'printer-number-up-supported' + DESC 'The possible numbers of print-stream pages to impose upon a + single side of an instance of a selected medium.' + EQUALITY integerMatch + ORDERING integerOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 + ) + + + + + +Fleming & McDonald Informational [Page 19] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + Values defined in IPP/1.1 [RFC2911] include: '1', '2', and '4'. + + Note: Implementations may support other values. + +4.21. printer-sides-supported + + ( 1.3.18.0.2.4.1123 + NAME 'printer-sides-supported' + DESC 'The number of impression sides (one or two) and the two-sided + impression rotations supported by this printer.' + EQUALITY caseIgnoreMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + ) + + Values defined in IPP/1.1 [RFC2911] include: 'one-sided', 'two- + sided-long-edge', 'two-sided-short-edge'.' + +4.22. printer-media-supported + + ( 1.3.18.0.2.4.1122 + NAME 'printer-media-supported' + DESC 'The standard names/types/sizes (and optional color suffixes) of + the media supported by this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} + ) + + Values are defined in IPP/1.1 [RFC2911] or any IANA registered + extensions. For example: + + 'iso-a4' + 'envelope' + 'na-letter-white' + +4.23. printer-media-local-supported + + ( 1.3.18.0.2.4.1117 + NAME 'printer-media-local-supported' + DESC 'Site-specific names of media supported by this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} + ) + + Values should be in the natural language specified by printer- + natural-language-configured. + + + + +Fleming & McDonald Informational [Page 20] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + For example: + + 'purchasing-form' (site-specific name) + + as opposed to 'na-letter' (standard keyword from IPP/1.1 [RFC2911]) + in the printer-media-supported attribute. + +4.24. printer-resolution-supported + + ( 1.3.18.0.2.4.1121 + NAME 'printer-resolution-supported' + DESC 'List of resolutions supported for printing documents by this + printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} + ) + + Each resolution value should be a string containing 3 fields: + 1) Cross feed direction resolution (positive integer); + 2) Feed direction resolution (positive integer); + 3) Unit - 'dpi' (dots per inch) or 'dpcm' (dots per centimeter). + + Each resolution field should be delimited by '>'. For example: + + '300> 300> dpi>' + '600> 600> dpi>' + + Note: This attribute is based on 'printer-resolution-supported' + defined in IPP/1.1 [RFC2911] (which has a binary complex encoding) + derived from 'prtMarkerAddressabilityFeedDir', + 'prtMarkerAddressabilityXFeedDir', and 'prtMarkerAddressabilityUnit' + defined in the Printer MIB [RFC1759] (which have integer encodings). + + Note: The syntax and delimiter for this attribute are aligned with + the equivalent attribute in the 'service:printer:' v2.0 template + [SLP-PRT]. Whitespace is permitted after (but not before) the + delimiter '>'. Note that this delimiter differs from printer-xri- + supported. + + + + + + + + + + + + +Fleming & McDonald Informational [Page 21] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +4.25. printer-print-quality-supported + + ( 1.3.18.0.2.4.1120 + NAME 'printer-print-quality-supported' + DESC 'List of print qualities supported for printing documents on + this printer.' + EQUALITY caseIgnoreMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + ) + + Values defined in IPP/1.1 [RFC2911] include: + + 'unknown' + 'draft' + 'normal' + 'high' + +4.26. printer-job-priority-supported + + ( 1.3.18.0.2.4.1110 + NAME 'printer-job-priority-supported' + DESC 'Indicates the number of job priority levels supported by this + printer.' + EQUALITY integerMatch + ORDERING integerOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 + SINGLE-VALUE + ) + + An IPP/1.1 [RFC2911] conformant Printer, which supports job priority, + always supports a full range of priorities from '1' to '100' (to + ensure consistent behavior), therefore this attribute describes the + 'granularity' of priority supported. Values of this attribute are + from '1' to '100'. + +4.27. printer-copies-supported + + ( 1.3.18.0.2.4.1118 + NAME 'printer-copies-supported' + DESC 'The maximum number of copies of a document that may be printed + as a single job on this printer.' + EQUALITY integerMatch + ORDERING integerOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 + SINGLE-VALUE + ) + + + + + +Fleming & McDonald Informational [Page 22] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + A positive value indicates the maximum supported copies. A value of + '0' indicates no maximum limit. A value of '-1' indicates 'unknown'. + + Note: The syntax and values for this attribute are aligned with the + equivalent attribute in the 'service:printer:' v2.0 template [SLP- + PRT]. + +4.28. printer-job-k-octets-supported + + ( 1.3.18.0.2.4.1111 + NAME 'printer-job-k-octets-supported' + DESC 'The maximum size in kilobytes (1,024 octets actually) incoming + print job that this printer will accept.' + EQUALITY integerMatch + ORDERING integerOrderingMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 + SINGLE-VALUE + ) + + A positive value indicates the maximum supported job size. A value + of '0' indicates no maximum limit. A value of '-1' indicates + 'unknown'. + + Note: The syntax and values for this attribute are aligned with the + equivalent attribute in the 'service:printer:' v2.0 template [SLP- + PRT]. + +4.29. printer-current-operator + + ( 1.3.18.0.2.4.1112 + NAME 'printer-current-operator' + DESC 'The identity of the current human operator responsible for + operating this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + SINGLE-VALUE + ) + + The value of this attribute should include information that would + enable other humans to reach the operator, such as a telephone + number. + + + + + + + + + +Fleming & McDonald Informational [Page 23] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +4.30. printer-service-person + + ( 1.3.18.0.2.4.1113 + NAME 'printer-service-person' + DESC 'The identity of the current human service person responsible + for servicing this printer.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + SINGLE-VALUE + ) + + The value of this attribute should include information that would + enable other humans to reach the service person, such as a telephone + number. + +4.31. printer-delivery-orientation-supported + + ( 1.3.18.0.2.4.1114 + NAME 'printer-delivery-orientation-supported' + DESC 'The possible delivery orientations of pages as they are printed + and ejected from this printer.' + EQUALITY caseIgnoreMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + ) + + Values defined include: + + 'unknown' + 'face-up' + 'face-down' + + Note: The syntax and values for this attribute are aligned with the + equivalent attribute in the 'service:printer:' v2.0 template [SLP- + PRT]. + +4.32. printer-stacking-order-supported + + ( 1.3.18.0.2.4.1115 + NAME 'printer-stacking-order-supported' + DESC 'The possible stacking order of pages as they are printed and + ejected from this printer.' + EQUALITY caseIgnoreMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + ) + + + + + + +Fleming & McDonald Informational [Page 24] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + Values defined include: + + 'unknown' + 'first-to-last' + 'last-to-first' + + Note: The syntax and values for this attribute are aligned with the + equivalent attribute in the 'service:printer:' v2.0 template [SLP- + PRT]. + +4.33. printer-output-features-supported + + ( 1.3.18.0.2.4.1116 + NAME 'printer-output-features-supported' + DESC 'The possible output features supported by this printer.' + EQUALITY caseIgnoreMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + ) + + Values defined include: + + 'unknown' + 'bursting' + 'decollating' + 'page-collating' + 'offset-stacking' + + Note: The syntax and values for this attribute are aligned with the + equivalent attribute in the 'service:printer:' v2.0 template [SLP- + PRT]. + + Note: Implementations may support other values. + +4.34. printer-aliases + + ( 1.3.18.0.2.4.1108 + NAME 'printer-aliases' + DESC 'List of site-specific administrative names of this printer in + addition to the value specified for printer-name.' + EQUALITY caseIgnoreMatch + SUBSTR caseIgnoreSubstringsMatch + SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{127} + ) + + Values of this attribute should be specified in the language + specified in printer-natural-language-configured (for example, to + support text-to-speech conversions), although the printer's alias may + be specified in any language. + + + +Fleming & McDonald Informational [Page 25] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +5. Definition of Syntaxes + + No new attribute syntaxes are defined by this document. + + The attribute types defined in Section 4 of this document reference + syntax OIDs defined in Section 6 of [RFC2252], which are summarized + below: + + Syntax OID Syntax Description + ------------------------------ ------------------ + 1.3.6.1.4.1.1466.115.121.1.7 Boolean + 1.3.6.1.4.1.1466.115.121.1.15 DirectoryString (UTF-8 [RFC2279]) + 1.3.6.1.4.1.1466.115.121.1.27 Integer + +6. Definition of Matching Rules + + No new matching rules are defined by this document. + + The attribute types defined in Section 4 of this document reference + matching rules defined in Section 8 of [RFC2252] and/or Section 2 of + [RFC3698], which are summarized below: + + Matching Rule OID Matching Rule Name Usage + ------------------------------ ------------------ ----- + 2.5.13.13 booleanMatch EQUALITY + 2.5.13.2 caseIgnoreMatch EQUALITY + 2.5.13.14 integerMatch EQUALITY + 2.5.13.15 integerOrderingMatch ORDERING + 2.5.13.4 caseIgnoreSubstringsMatch SUBSTR + +7. IANA Considerations + + This document does not define any new syntaxes or matching rules. + + This document does define the following Object Identifier + Descriptors. They have been registered by the IANA: + +7.1. Registration of Object Classes + + Subject: Request for LDAP Descriptor Registration + + Descriptor (short name): see table below + + Object Identifier: see table below + + Person & email address to contact for further information: see below + + Usage: object class + + + +Fleming & McDonald Informational [Page 26] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + Specification: RFC3712 + + Author/Change Controller: + + Pat Fleming + IBM + Highway 52 N + Rochester, MN 55901 + USA + Phone: +1 507-253-7583 + EMail: flemingp@us.ibm.com + + Comments: + + Object Class OID + ------------------------------------ --------------------- + slpServicePrinter 1.3.18.0.2.6.254 + printerAbstract 1.3.18.0.2.6.258 + printerService 1.3.18.0.2.6.255 + printerServiceAuxClass 1.3.18.0.2.6.257 + printerIPP 1.3.18.0.2.6.256 + printerLPR 1.3.18.0.2.6.253 + +7.2. Registration of Attribute Types + + Subject: Request for LDAP Descriptor Registration + + Descriptor (short name): see table below + + Object Identifier: see table below + + Person & email address to contact for further information: see below + + Usage: attribute type + + Specification: RFC3712 + + Author/Change Controller: + + Pat Fleming + IBM + Highway 52 N + Rochester, MN 55901 + USA + Phone: +1 507-253-7583 + EMail: flemingp@us.ibm.com + + + + + +Fleming & McDonald Informational [Page 27] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + Comments: + + Attribute Type OID + ------------------------------------ --------------------- + printer-uri 1.3.18.0.2.4.1140 + printer-xri-supported 1.3.18.0.2.4.1107 + printer-name 1.3.18.0.2.4.1135 + printer-natural-language-configured 1.3.18.0.2.4.1119 + printer-location 1.3.18.0.2.4.1136 + printer-info 1.3.18.0.2.4.1139 + printer-more-info 1.3.18.0.2.4.1134 + printer-make-and-model 1.3.18.0.2.4.1138 + printer-ipp-versions-supported 1.3.18.0.2.4.1133 + printer-multiple-document-jobs-supported 1.3.18.0.2.4.1132 + printer-charset-configured 1.3.18.0.2.4.1109 + printer-charset-supported 1.3.18.0.2.4.1131 + printer-generated-natural-language-supported 1.3.18.0.2.4.1137 + printer-document-format-supported 1.3.18.0.2.4.1130 + printer-color-supported 1.3.18.0.2.4.1129 + printer-compression-supported 1.3.18.0.2.4.1128 + printer-pages-per-minute 1.3.18.0.2.4.1127 + printer-pages-per-minute-color 1.3.18.0.2.4.1126 + printer-finishings-supported 1.3.18.0.2.4.1125 + printer-number-up-supported 1.3.18.0.2.4.1124 + printer-sides-supported 1.3.18.0.2.4.1123 + printer-media-supported 1.3.18.0.2.4.1122 + printer-media-local-supported 1.3.18.0.2.4.1117 + printer-resolution-supported 1.3.18.0.2.4.1121 + printer-print-quality-supported 1.3.18.0.2.4.1120 + printer-job-priority-supported 1.3.18.0.2.4.1110 + printer-copies-supported 1.3.18.0.2.4.1118 + printer-job-k-octets-supported 1.3.18.0.2.4.1111 + printer-current-operator 1.3.18.0.2.4.1112 + printer-service-person 1.3.18.0.2.4.1113 + printer-delivery-orientation-supported 1.3.18.0.2.4.1114 + printer-stacking-order-supported 1.3.18.0.2.4.1115 + printer-output-features-supported 1.3.18.0.2.4.1116 + printer-aliases 1.3.18.0.2.4.1108 + +8. Internationalization Considerations + + All text string attributes defined in this document of syntax + [RFC2279], as required by [RFC2252]. + + A language tag [RFC3066] for all of the text string attributes + defined in this document is contained in the printer-natural- + language-configured attribute. + + + + +Fleming & McDonald Informational [Page 28] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + Therefore, all object classes defined in this document conform to the + "IETF Policy on Character Sets and Languages" [RFC2277]. + +9. Security Considerations + + See [RFC2829] for detailed guidance on authentication methods for + LDAP. See [RFC2830] for detailed guidance of using TLS/1.0 [RFC2246] + to supply connection confidentiality and data integrity for LDAP + sessions. + + As with any LDAP schema, it is important to protect specific entries + and attributes with the appropriate access control. It is + particularly important that only administrators can modify entries + defined in this LDAP printer schema. Otherwise, an LDAP client might + be fooled into diverting print service requests from the original + printer (or spooler) to a malicious intruder's host system, thus + exposing the information in printed documents. + + For additional security considerations of deploying printers in an + IPP environment, see Section 8 of [RFC2911]. + +10. References + +10.1. Normative References + + [IANA-CHAR] IANA Registry of Character Sets + http://www.iana.org/assignments/charset-reg/... + + [IANA-MIME] IANA Registry of MIME Media Types + http://www.iana.org/assignments/media-types/... + + [LDAP-TS] Hodges, J. and R. Morgan, "Lightweight Directory Access + Protocol (v3): Technical Specification", RFC 3377, + September 2002. + + [RFC1274] Barker, P. and S. Kille, "The COSINE and Internet X.500 + Schema", RFC 1274, November 1991. + + [RFC1759] Smith, R., Wright, F., Hastings, T., Zilles, S. and J. + Gyllenskog, "Printer MIB", RFC 1759, March 1995. + + [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", BCP 14, RFC 2119, March 1997. + + [RFC2252] Wahl, M., Coulbeck, T., Howes, T. and S. Kille, + "Lightweight Directory Access Protocol (v3): Attribute + Syntax Definitions", RFC 2252, December 1997. + + + + +Fleming & McDonald Informational [Page 29] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + [RFC2396] Berners-Lee. T., Fielding, R. and L. Masinter, "URI + Generic Syntax", RFC 2396, August 1998. + + [RFC2829] Wahl, M., Alvestrand, H., Hodges, J. and R. Morgan, + "Authentication Methods for LDAP", RFC 2829, May 2000. + + [RFC2830] Hodges, J., Morgan, R. and M. Wahl, "Lightweight + Directory Access Protocol (v3): Extension for Transport + Layer Security", RFC 2830, May 2000. + + [RFC2911] Hastings, T., Ed.., Herrito, R., deBry, R., Isaacson, S. + and P. Powell, "Internet Printing Protocol/1.1: Model and + Semantics", RFC 2911, September 2000. + + [RFC2926] Kempf, J., Moats, R. and P. St. Pierre, "Conversion of + LDAP Schemas to and from SLP Templates", RFC 2926, + September 2000. + + [RFC3066] Alvestrand, H., "Tags for the Identification of + Languages", BCP 47, RFC 3066, January 2001. + + [RFC3698] Zeilenga, K., Ed., "Lightweight Directory Access Protocol + (LDAP): Additional Matching Rules", RFC 3698, February + 2004. + +10.2. Informative References + + [IANA-SLPT] IANA Registry of SLP Templates + http://www.iana.org/assignments/svrloc-templates/... + + [RFC1179] McLaughlin, L., "Line Printer Daemon Protocol", RFC 1179, + August 1990. + + [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format + Specification Version 1.3", RFC 1951, May 1996. + + [RFC1952] Deutsch, P., "GZIP File Format Specification Version + 4.3", RFC 1952, May 1996. + + [RFC1977] Schryver, V., "PPP BSD Compression Protocol", RFC 1977, + August 1996. + + [RFC2048] Freed, N., Klensin, J. and J. Postel, "Multipurpose + Internet Mail Extensions (MIME) Part Four: Registration + Procedures", BCP 13, RFC 2048, November 1996. + + + + + + +Fleming & McDonald Informational [Page 30] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + + [RFC2079] Smith, M., "Definition of an X.500 Attribute Type and an + Object Class to Hold Uniform Resource Identifiers + (URIs)", RFC 2079, January 1997. + + [RFC2246] Dierks, T. and C. Allen, "TLS Protocol Version 1.0", RFC + 2246, January 1999. + + [RFC2277] Alvestrand, H., "IETF Policy on Character Sets and + Languages", RFC 2277, January 1998. + + [RFC2279] Yergeau, F., "UTF-8, a Transformation Format of ISO + 10646", RFC 2279, January 1998. + + [RFC2608] Guttman, E., Perkins, C., Veizades, J. and M. Day, + "Service Location Protocol v2", RFC 2608, June 1999. + + [RFC2609] Guttman, E., Perkins, C. and J. Kempf, "Service Templates + and Service: Schemes", RFC 2609, June 1999. + + [RFC2617] Franks, J., Hallam-Baker, P., Hostetler, J., Lawrence, + S., Leach, P., Luotonen, A. and L. Stewart, "HTTP + Authentication: Basic and Digest Access Authentication", + RFC 2617, June 1999. + + [RFC2717] Petke, R. and I. King, "Registration Procedures for URL + Scheme Names", RFC 2717, November 1999. + + [RFC2718] Masinter, L., Alvestrand, H., Zigmond, D. and R. Petke, + "Guidelines for new URL Schemes", BCP 19, RFC 2718, + November 1999. + + [RFC2978] Freed, N. and J.Postel, "IANA Charset Registration + Procedures", RFC2978, October 2000. + + [SLP-PRT] St. Pierre, Isaacson, McDonald. Definition of the + Printer Abstract Service Type v2.0, , + May 2000. Reviewed and approved by IETF SLP Designated + Expert, according to Section 5 'IANA Considerations' in + [RFC2609]. + + Archived in the IANA Registry of SLP Templates [IANA- + SLPT] at: http://www.iana.org/assignments/svrloc- + templates/printer.2.0.en + + [W3C-IRI] Duerst, Suignard, "Internationalized Resource Identifiers + (IRI), Work in Progress. + + + + + +Fleming & McDonald Informational [Page 31] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +11. Acknowledgments + + The editors wish to acknowledge the very significant contributions of + Ken Jones (Bytemobile) and Harry Lewis (IBM) during the development + of this document. + + Thanks to Patrik Faltstrom (Cisco), Ryan Moats (Lemur Networks), + Robert Moore (IBM), Lee Rafalow (IBM), Kimberly Reger (IBM), Kurt + Zeilenga (OpenLDAP), and the members of the IETF IPP Working Group, + for review comments and help in preparing this document. + +12. Authors' Addresses + + Please send comments to the authors at the addresses listed below. + + Pat Fleming + IBM + Highway 52 N + Rochester, MN 55901 + USA + + Phone: +1 507-253-7583 + EMail: flemingp@us.ibm.com + + + Ira McDonald + High North Inc + 221 Ridge Ave + Grand Marais, MI 49839 + USA + + Phone: +1 906-494-2434 + Email: imcdonald@sharplabs.com + + + + + + + + + + + + + + + + + + +Fleming & McDonald Informational [Page 32] + +RFC 3712 LDAP Schema for Printer Services February 2004 + + +13. Full Copyright Statement + + Copyright (C) The Internet Society (2004). This document is subject + to the rights, licenses and restrictions contained in BCP 78 and + except as set forth therein, the authors retain all their rights. + + This document and the information contained herein are provided on an + "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE + REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE + INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF + THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED + WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +Intellectual Property + + The IETF takes no position regarding the validity or scope of any + Intellectual Property Rights or other rights that might be claimed + to pertain to the implementation or use of the technology + described in this document or the extent to which any license + under such rights might or might not be available; nor does it + represent that it has made any independent effort to identify any + such rights. Information on the procedures with respect to + rights in RFC documents can be found in BCP 78 and BCP 79. + + Copies of IPR disclosures made to the IETF Secretariat and any + assurances of licenses to be made available, or the result of an + attempt made to obtain a general license or permission for the use + of such proprietary rights by implementers or users of this + specification can be obtained from the IETF on-line IPR repository + at http://www.ietf.org/ipr. + + The IETF invites any interested party to bring to its attention + any copyrights, patents or patent applications, or other + proprietary rights that may cover technology that may be required + to implement this standard. Please address the information to the + IETF at ietf-ipr@ietf.org. + +Acknowledgement + + Funding for the RFC Editor function is currently provided by the + Internet Society. + + + + + + + + + +Fleming & McDonald Informational [Page 33] + diff --git a/standards/rfctohtml.c b/standards/rfctohtml.c new file mode 100644 index 0000000000..a13c1e9227 --- /dev/null +++ b/standards/rfctohtml.c @@ -0,0 +1,497 @@ +/* + * "$Id: rfctohtml.c 4966 2006-01-23 00:41:22Z mike $" + * + * RFC file to HTML conversion program. + * + * Copyright 2006 by Easy Software Products. + * + * These coded instructions, statements, and computer programs are the + * property of Easy Software Products 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 missing or damaged please contact Easy Software Products + * at: + * + * Attn: CUPS Licensing Information + * Easy Software Products + * 44141 Airport View Drive, Suite 204 + * Hollywood, Maryland 20636 USA + * + * Voice: (301) 373-9600 + * EMail: cups-info@cups.org + * WWW: http://www.cups.org + * + * Contents: + * + */ + +/* + * Include necessary headers. + */ + +#include +#include +#include + + +/* + * Local functions... + */ + +void put_entity(cups_file_t *fp, int ch); +void put_line(cups_file_t *fp, const char *line); + + +/* + * 'main()' - Convert a man page to HTML. + */ + +int /* O - Exit status */ +main(int argc, /* I - Number of command-line args */ + char *argv[]) /* I - Command-line arguments */ +{ + cups_file_t *infile, /* Input file */ + *outfile; /* Output file */ + char line[1024], /* Line from file */ + *lineptr, /* Pointer into line */ + name[1024], /* Heading anchor name */ + *nameptr; /* Pointer into anchor name */ + int inheading, /* Inside a heading? */ + inpre, /* Inside preformatted text? */ + intoc, /* Inside table-of-contents? */ + toclevel, /* Current table-of-contents level */ + linenum; /* Current line on page */ + + + /* + * Check arguments... + */ + + if (argc > 3) + { + fputs("Usage: rfctohtml [rfcNNNN.txt [rfcNNNN.html]]\n", stderr); + return (1); + } + + /* + * Open files as needed... + */ + + if (argc > 1) + { + if ((infile = cupsFileOpen(argv[1], "r")) == NULL) + { + perror(argv[1]); + return (1); + } + } + else + infile = cupsFileOpenFd(0, "r"); + + if (argc > 2) + { + if ((outfile = cupsFileOpen(argv[2], "w")) == NULL) + { + perror(argv[2]); + cupsFileClose(infile); + return (1); + } + } + else + outfile = cupsFileOpenFd(1, "w"); + + /* + * Read from input and write the output... + */ + + cupsFilePuts(outfile, + "\n" + "\n" + "\n" + "\n" + "\t\n"); + + /* + * Skip the initial header stuff (working group ID, RFC #, authors, and + * copyright... + */ + + linenum = 0; + + while (cupsFileGets(infile, line, sizeof(line))) + { + linenum ++; + + if (line[0]) + break; + } + + while (cupsFileGets(infile, line, sizeof(line))) + { + linenum ++; + + if (!line[0]) + break; + } + + /* + * Read the document title... + */ + + while (cupsFileGets(infile, line, sizeof(line))) + { + linenum ++; + + if (line[0]) + break; + } + + for (lineptr = line; isspace(*lineptr & 255); lineptr ++); + + cupsFilePrintf(outfile, "%s", lineptr); + + while (cupsFileGets(infile, line, sizeof(line))) + { + linenum ++; + + if (!line[0]) + break; + else + { + for (lineptr = line; isspace(*lineptr & 255); lineptr ++); + cupsFilePrintf(outfile, " %s", lineptr); + } + } + + cupsFilePuts(outfile, "\n" + "\n" + "\n"); + + /* + * Read the rest of the file... + */ + + inheading = 0; + inpre = 0; + intoc = 0; + toclevel = 0; + + while (cupsFileGets(infile, line, sizeof(line))) + { + linenum ++; + + if (!line[0]) + { + if (linenum > 50) + continue; + + if (inpre) + { + cupsFilePuts(outfile, "\n"); + inpre = 0; + } + + if (inheading) + { + if (inheading < 0) + cupsFilePuts(outfile, "\n"); + else + cupsFilePrintf(outfile, "\n", inheading); + + inheading = 0; + } + } + else if ((line[0] == ' ' || + (!isupper(line[0] & 255) && !isdigit(line[0] & 255) && + !strstr(line, "[Page "))) && !inheading) + { + if (inheading) + { + if (inheading < 0) + cupsFilePuts(outfile, "\n"); + else + cupsFilePrintf(outfile, "\n", inheading); + + inheading = 0; + } + + for (lineptr = line; *lineptr == ' '; lineptr ++); + + if (intoc) + { + char *temp; /* Temporary pointer into line */ + int level; /* Heading level */ + + + if (isdigit(*lineptr & 255)) + { + strlcpy(name, lineptr, sizeof(name)); + + for (nameptr = name, level = -1; *nameptr;) + if (isdigit(*nameptr & 255)) + { + while (isdigit(*nameptr & 255)) + nameptr ++; + + level ++; + } + else if (*nameptr == ' ') + { + *nameptr = '\0'; + break; + } + else + nameptr ++; + + while (toclevel > level) + { + cupsFilePuts(outfile, "\n"); + toclevel --; + } + + while (toclevel < level) + { + cupsFilePuts(outfile, "\n"); + toclevel --; + } + + cupsFilePutChar(outfile, '\n'); + intoc = 0; + } + + if (inpre) + { + cupsFilePuts(outfile, "\n"); + inpre = 0; + } + + strlcpy(name, line, sizeof(name)); + for (nameptr = name, level = 0; *nameptr;) + if (isdigit(*nameptr & 255)) + { + while (isdigit(*nameptr & 255)) + nameptr ++; + + level ++; + } + else if (*nameptr == ' ') + { + *nameptr = '\0'; + break; + } + else + nameptr ++; + + cupsFilePrintf(outfile, "\n", level, name); + put_line(outfile, line); + + intoc = 0; + inheading = level; + } + else + { + if (intoc) + { + while (toclevel > 0) + { + cupsFilePuts(outfile, "\n"); + toclevel --; + } + + cupsFilePutChar(outfile, '\n'); + intoc = 0; + } + + if (!inheading) + { + cupsFilePuts(outfile, "\n

"); + inheading = -1; + } + + put_line(outfile, line); + + intoc = !strcasecmp(line, "Table of Contents"); + toclevel = 0; + } + } + + if (inpre) + cupsFilePuts(outfile, "\n"); + + if (inheading) + { + if (inheading < 0) + cupsFilePuts(outfile, "

\n"); + else + cupsFilePrintf(outfile, "
\n", inheading); + } + + cupsFilePuts(outfile, "\n" + "\n"); + + /* + * Close files... + */ + + cupsFileClose(infile); + cupsFileClose(outfile); + + /* + * Return with no errors... + */ + + return (0); +} + + +/* + * 'put_entity()' - Put a single character, using entities as needed. + */ + +void +put_entity(cups_file_t *fp, /* I - File */ + int ch) /* I - Character */ +{ + if (ch == '&') + cupsFilePuts(fp, "&"); + else if (ch == '<') + cupsFilePuts(fp, "<"); + else + cupsFilePutChar(fp, ch); +} + + +/* + * 'put_line()' - Put a whole string for a line. + */ + +void +put_line(cups_file_t *fp, /* I - File */ + const char *s) /* I - String */ +{ + int whitespace, /* Saw whitespace */ + i, /* Looping var */ + len; /* Length of keyword */ + static const char * const keywords[] =/* Special keywords to boldface */ + { + "MAY", + "MUST", + "NOT", + "SHALL", + "SHOULD" + }; + + + whitespace = 1; + + while (*s) + { + if (*s == ' ') + whitespace = 1; + + if (whitespace && isupper(*s & 255)) + { + whitespace = 0; + + for (i = 0; i < (int)(sizeof(keywords) / sizeof(sizeof(keywords[0]))); i ++) + { + len = strlen(keywords[i]); + if (!strncmp(s, keywords[i], len) && (isspace(s[len] & 255) || !*s)) + { + cupsFilePrintf(fp, "%s", keywords[i]); + s += len; + break; + } + } + + if (i >= (int)(sizeof(keywords) / sizeof(sizeof(keywords[0])))) + put_entity(fp, *s++); + } + else + { + if (*s != ' ') + whitespace = 0; + + put_entity(fp, *s++); + } + } +} + + +/* + * End of "$Id: rfctohtml.c 4966 2006-01-23 00:41:22Z mike $". + */ diff --git a/systemv/Dependencies b/systemv/Dependencies index c9b548b962..0d7585b86d 100644 --- a/systemv/Dependencies +++ b/systemv/Dependencies @@ -9,6 +9,7 @@ cancel.o: ../cups/i18n.h ../cups/language.h ../cups/array.h cupsaddsmb.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h cupsaddsmb.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/file.h cupsaddsmb.o: ../cups/i18n.h ../cups/language.h ../cups/array.h +cupsaddsmb.o: ../cups/debug.h cupstestppd.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h cupstestppd.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/file.h cupstestppd.o: ../cups/i18n.h ../cups/language.h ../cups/array.h @@ -30,6 +31,6 @@ lpoptions.o: ../cups/i18n.h ../cups/language.h ../cups/array.h lppasswd.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h lppasswd.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/file.h lppasswd.o: ../cups/i18n.h ../cups/language.h ../cups/array.h ../cups/md5.h -lpstat.o: ../cups/cups.h ../cups/ipp.h ../cups/http.h ../cups/md5.h -lpstat.o: ../cups/ppd.h ../cups/file.h ../cups/i18n.h ../cups/language.h -lpstat.o: ../cups/array.h ../cups/debug.h ../cups/string.h ../config.h +lpstat.o: ../cups/string.h ../config.h ../cups/cups.h ../cups/ipp.h +lpstat.o: ../cups/http.h ../cups/md5.h ../cups/ppd.h ../cups/file.h +lpstat.o: ../cups/i18n.h ../cups/language.h ../cups/array.h ../cups/debug.h diff --git a/systemv/accept.c b/systemv/accept.c index ba65ca1911..e0cc817d1d 100644 --- a/systemv/accept.c +++ b/systemv/accept.c @@ -1,5 +1,5 @@ /* - * "$Id: accept.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: accept.c 4990 2006-01-26 02:21:45Z mike $" * * "accept", "disable", "enable", and "reject" commands for the Common * UNIX Printing System (CUPS). @@ -55,7 +55,6 @@ main(int argc, /* I - Number of command-line arguments */ ipp_t *request; /* IPP request */ ipp_t *response; /* IPP response */ ipp_op_t op; /* Operation */ - cups_lang_t *language; /* Language */ int cancel; /* Cancel jobs? */ @@ -68,8 +67,7 @@ main(int argc, /* I - Number of command-line arguments */ else command = argv[0]; - cancel = 0; - language = cupsLangDefault(); + cancel = 0; if (!strcmp(command, "accept")) op = CUPS_ACCEPT_JOBS; @@ -81,7 +79,7 @@ main(int argc, /* I - Number of command-line arguments */ op = IPP_RESUME_PRINTER; else { - _cupsLangPrintf(stderr, language, _("%s: Don't know what to do!\n"), + _cupsLangPrintf(stderr, _("%s: Don't know what to do!\n"), command); return (1); } @@ -104,12 +102,31 @@ main(int argc, /* I - Number of command-line arguments */ if (http) httpEncryption(http, HTTP_ENCRYPT_REQUIRED); #else - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), command); #endif /* HAVE_SSL */ break; + case 'U' : /* Username */ + if (argv[i][2] != '\0') + cupsSetUser(argv[i] + 2); + else + { + i ++; + if (i >= argc) + { + _cupsLangPrintf(stderr, + _("%s: Error - expected username after " + "\'-U\' option!\n"), + command); + return (1); + } + + cupsSetUser(argv[i]); + } + break; + case 'c' : /* Cancel jobs */ cancel = 1; break; @@ -125,8 +142,9 @@ main(int argc, /* I - Number of command-line arguments */ i ++; if (i >= argc) { - _cupsLangPrintf(stderr, language, - _("%s: Expected server name after -h!\n"), + _cupsLangPrintf(stderr, + _("%s: Error - expected hostname after " + "\'-h\' option!\n"), command); return (1); } @@ -143,8 +161,9 @@ main(int argc, /* I - Number of command-line arguments */ i ++; if (i >= argc) { - _cupsLangPrintf(stderr, language, - _("%s: Expected reason text after -r!\n"), + _cupsLangPrintf(stderr, + _("%s: Error - expected reason text after " + "\'-r\' option!\n"), command); return (1); } @@ -154,7 +173,7 @@ main(int argc, /* I - Number of command-line arguments */ break; default : - _cupsLangPrintf(stderr, language, _("%s: Unknown option \'%c\'!\n"), + _cupsLangPrintf(stderr, _("%s: Error - unknown option \'%c\'!\n"), command, argv[i][1]); return (1); } @@ -169,7 +188,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("%s: Unable to connect to server: %s\n"), command, strerror(errno)); return (1); @@ -185,22 +204,16 @@ main(int argc, /* I - Number of command-line arguments */ * printer-state-message [optional] */ - request = ippNew(); - - request->request.op.operation_id = op; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(op); httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", argv[i]); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, + "requesting-user-name", NULL, cupsUser()); + if (reason != NULL) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_TEXT, "printer-state-message", NULL, reason); @@ -213,7 +226,7 @@ main(int argc, /* I - Number of command-line arguments */ { if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("%s: Operation failed: %s\n"), command, ippErrorString(cupsLastError())); return (1); @@ -223,9 +236,7 @@ main(int argc, /* I - Number of command-line arguments */ } else { - _cupsLangPrintf(stderr, language, - _("%s: Operation failed: %s\n"), - command, ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString()); return (1); } @@ -244,18 +255,7 @@ main(int argc, /* I - Number of command-line arguments */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = IPP_PURGE_JOBS; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(IPP_PURGE_JOBS); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -264,9 +264,7 @@ main(int argc, /* I - Number of command-line arguments */ { if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, language, - _("%s: Operation failed: %s\n"), - command, ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString()); return (1); } @@ -274,9 +272,7 @@ main(int argc, /* I - Number of command-line arguments */ } else { - _cupsLangPrintf(stderr, language, - _("%s: Operation failed: %s\n"), - command, ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString()); return (1); } } @@ -290,5 +286,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: accept.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: accept.c 4990 2006-01-26 02:21:45Z mike $". */ diff --git a/systemv/cancel.c b/systemv/cancel.c index 06c6075c1e..66394b9a38 100644 --- a/systemv/cancel.c +++ b/systemv/cancel.c @@ -1,5 +1,5 @@ /* - * "$Id: cancel.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: cancel.c 4948 2006-01-19 03:23:41Z mike $" * * "cancel" command for the Common UNIX Printing System (CUPS). * @@ -58,22 +58,20 @@ main(int argc, /* I - Number of command-line arguments */ ipp_t *request; /* IPP request */ ipp_t *response; /* IPP response */ ipp_op_t op; /* Operation */ - cups_lang_t *language; /* Language */ /* * Setup to cancel individual print jobs... */ - op = IPP_CANCEL_JOB; - purge = 0; - job_id = 0; - dest = NULL; - user = NULL; - http = NULL; - num_dests = 0; - dests = NULL; - language = cupsLangDefault(); + op = IPP_CANCEL_JOB; + purge = 0; + job_id = 0; + dest = NULL; + user = NULL; + http = NULL; + num_dests = 0; + dests = NULL; /* @@ -91,12 +89,31 @@ main(int argc, /* I - Number of command-line arguments */ if (http) httpEncryption(http, HTTP_ENCRYPT_REQUIRED); #else - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), argv[0]); #endif /* HAVE_SSL */ break; + case 'U' : /* Username */ + if (argv[i][2] != '\0') + cupsSetUser(argv[i] + 2); + else + { + i ++; + if (i >= argc) + { + _cupsLangPrintf(stderr, + _("%s: Error - expected username after " + "\'-U\' option!\n"), + argv[0]); + return (1); + } + + cupsSetUser(argv[i]); + } + break; + case 'a' : /* Cancel all jobs */ purge = 1; op = IPP_PURGE_JOBS; @@ -114,9 +131,10 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, language, - _("cancel: Error - expected hostname after " - "\'-h\' option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected hostname after " + "\'-h\' option!\n"), + argv[0]); return (1); } else @@ -135,9 +153,10 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, language, - _("cancel: Error - expected username after " - "\'-u\' option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected username after " + "\'-u\' option!\n"), + argv[0]); return (1); } else @@ -146,8 +165,9 @@ main(int argc, /* I - Number of command-line arguments */ break; default : - _cupsLangPrintf(stderr, language, - _("cancel: Unknown option \'%c\'!\n"), argv[i][1]); + _cupsLangPrintf(stderr, + _("%s: Error - unknown option \'%c\'!\n"), + argv[0], argv[i][1]); return (1); } else @@ -203,8 +223,9 @@ main(int argc, /* I - Number of command-line arguments */ * Bad printer name! */ - _cupsLangPrintf(stderr, language, - _("cancel: Unknown destination \"%s\"!\n"), argv[i]); + _cupsLangPrintf(stderr, + _("%s: Error - unknown destination \"%s\"!\n"), + argv[0], argv[i]); return (1); } @@ -225,8 +246,9 @@ main(int argc, /* I - Number of command-line arguments */ if ((http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption())) == NULL) { - _cupsLangPuts(stderr, language, - _("cancel: Unable to contact server!\n")); + _cupsLangPrintf(stderr, + _("%s: Unable to contact server!\n"), + argv[0]); return (1); } @@ -240,16 +262,7 @@ main(int argc, /* I - Number of command-line arguments */ * [requesting-user-name] */ - request = ippNew(); - - request->request.op.operation_id = op; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(op); if (dest) { @@ -292,7 +305,7 @@ main(int argc, /* I - Number of command-line arguments */ if (response == NULL || response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, language, _("cancel: %s failed: %s\n"), + _cupsLangPrintf(stderr, _("%s: %s failed: %s\n"), argv[0], op == IPP_PURGE_JOBS ? "purge-jobs" : "cancel-job", response ? ippErrorString(response->request.status.status_code) : ippErrorString(cupsLastError())); @@ -316,7 +329,8 @@ main(int argc, /* I - Number of command-line arguments */ if ((http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption())) == NULL) { - _cupsLangPuts(stderr, language, _("cancel: Unable to contact server!\n")); + _cupsLangPrintf(stderr, _("%s: Unable to contact server!\n"), + argv[0]); return (1); } @@ -330,18 +344,7 @@ main(int argc, /* I - Number of command-line arguments */ * [requesting-user-name] */ - request = ippNew(); - - request->request.op.operation_id = op; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(op); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, "ipp://localhost/printers/"); @@ -367,10 +370,9 @@ main(int argc, /* I - Number of command-line arguments */ if (response == NULL || response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, language, _("cancel: %s failed: %s\n"), + _cupsLangPrintf(stderr, _("%s: %s failed: %s\n"), argv[0], op == IPP_PURGE_JOBS ? "purge-jobs" : "cancel-job", - response ? ippErrorString(response->request.status.status_code) : - ippErrorString(cupsLastError())); + cupsLastErrorString()); if (response) ippDelete(response); @@ -386,5 +388,5 @@ main(int argc, /* I - Number of command-line arguments */ /* - * End of "$Id: cancel.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: cancel.c 4948 2006-01-19 03:23:41Z mike $". */ diff --git a/systemv/cupsaddsmb.c b/systemv/cupsaddsmb.c index 1ed9d26d60..77aa46c3f4 100644 --- a/systemv/cupsaddsmb.c +++ b/systemv/cupsaddsmb.c @@ -1,5 +1,5 @@ /* - * "$Id: cupsaddsmb.c 4916 2006-01-11 21:42:55Z mike $" + * "$Id: cupsaddsmb.c 4933 2006-01-16 00:26:57Z mike $" * * "cupsaddsmb" command for the Common UNIX Printing System (CUPS). * @@ -307,7 +307,7 @@ convert_ppd(const char *src, /* I - Source (original) PPD */ { if ((ptr = strchr(line, ':')) == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("cupsaddsmb: Missing value on line %d!\n"), linenum); fclose(srcfp); fclose(dstfp); @@ -318,7 +318,7 @@ convert_ppd(const char *src, /* I - Source (original) PPD */ if ((ptr = strchr(ptr, '\"')) == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("cupsaddsmb: Missing double quote on line %d!\n"), linenum); fclose(srcfp); @@ -330,7 +330,7 @@ convert_ppd(const char *src, /* I - Source (original) PPD */ if (sscanf(line, "*%40s%*[ \t]%40[^/]", option, choice) != 2) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("cupsaddsmb: Bad option + choice on line %d!\n"), linenum); fclose(srcfp); @@ -447,7 +447,7 @@ do_samba_command(const char *command, /* I - Command to run */ snprintf(temp, sizeof(temp), "%s%%%s", SAMBAUser, SAMBAPassword); if (Verbosity) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("Running command: %s %s -N -U \'%s%%%s\' -c \'%s\'\n"), command, address, SAMBAUser, SAMBAPassword, subcmd); @@ -476,7 +476,7 @@ do_samba_command(const char *command, /* I - Command to run */ { status = -1; - _cupsLangPrintf(stderr, NULL, _("cupsaddsmb: Unable to run \"%s\": %s\n"), + _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to run \"%s\": %s\n"), command, strerror(errno)); } else @@ -491,7 +491,7 @@ do_samba_command(const char *command, /* I - Command to run */ DEBUG_printf(("status=%d\n", status)); if (Verbosity) - _cupsLangPuts(stdout, NULL, "\n"); + _cupsLangPuts(stdout, "\n"); if (status) { @@ -514,6 +514,7 @@ int /* O - 0 on success, non-zero on error */ export_dest(const char *dest) /* I - Destination to export */ { int status; /* Status of smbclient/rpcclient commands */ + int have_drivers; /* Have drivers? */ const char *ppdfile; /* PPD file for printer drivers */ char newppd[1024], /* New PPD file for printer drivers */ file[1024], /* File to test for */ @@ -522,7 +523,6 @@ export_dest(const char *dest) /* I - Destination to export */ subcmd[1024]; /* Sub-command */ const char *datadir; /* CUPS_DATADIR */ http_t *http; /* Connection to server */ - cups_lang_t *language; /* Default language */ ipp_t *request, /* IPP request */ *response; /* IPP response */ static const char *pattrs[] = /* Printer attributes we want */ @@ -543,15 +543,13 @@ export_dest(const char *dest) /* I - Destination to export */ if ((datadir = getenv("CUPS_DATADIR")) == NULL) datadir = CUPS_DATADIR; - language = cupsLangDefault(); - /* * Open a connection to the scheduler... */ if ((http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption())) == NULL) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to connect to server \"%s\" for " "%s - %s\n"), cupsServer(), dest, strerror(errno)); @@ -564,7 +562,7 @@ export_dest(const char *dest) /* I - Destination to export */ if ((ppdfile = cupsGetPPD2(http, dest)) == NULL) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("cupsaddsmb: No PPD file for printer \"%s\" - " "skipping!\n"), dest); @@ -576,15 +574,7 @@ export_dest(const char *dest) /* I - Destination to export */ * Append the supported banner pages to the PPD file... */ - request = ippNew(); - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", dest); @@ -603,13 +593,9 @@ export_dest(const char *dest) /* I - Destination to export */ { if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, language, - _("cupsaddsmb: get-printer-attributes failed for " - "\"%s\": %s\n"), - dest, - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "cupsaddsmb: %s - %s\n", dest, + cupsLastErrorString()); ippDelete(response); - cupsLangFree(language); httpClose(http); unlink(ppdfile); return (2); @@ -617,11 +603,8 @@ export_dest(const char *dest) /* I - Destination to export */ } else { - _cupsLangPrintf(stderr, language, - _("cupsaddsmb: get-printer-attributes failed for " - "\"%s\": %s\n"), - dest, ippErrorString(cupsLastError())); - cupsLangFree(language); + _cupsLangPrintf(stderr, "cupsaddsmb: %s - %s\n", dest, + cupsLastErrorString()); httpClose(http); unlink(ppdfile); return (2); @@ -633,18 +616,16 @@ export_dest(const char *dest) /* I - Destination to export */ if (convert_ppd(ppdfile, newppd, sizeof(newppd), response)) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to convert PPD file for %s - %s\n"), dest, strerror(errno)); ippDelete(response); - cupsLangFree(language); httpClose(http); unlink(ppdfile); return (3); } ippDelete(response); - cupsLangFree(language); httpClose(http); /* @@ -667,9 +648,13 @@ export_dest(const char *dest) /* I - Destination to export */ * pscript5.dll */ + have_drivers = 0; + snprintf(file, sizeof(file), "%s/drivers/pscript5.dll", datadir); if (!access(file, 0)) { + have_drivers |= 1; + /* * Windows 2k driver is installed; do the smbclient commands needed * to copy the Win2k drivers over... @@ -688,7 +673,7 @@ export_dest(const char *dest) /* I - Destination to export */ if ((status = do_samba_command("smbclient", address, subcmd)) != 0) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to copy Windows 2000 printer " "driver files (%d)!\n"), status); @@ -715,7 +700,7 @@ export_dest(const char *dest) /* I - Destination to export */ if ((status = do_samba_command("smbclient", address, subcmd)) != 0) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to copy CUPS printer driver " "files (%d)!\n"), status); @@ -750,7 +735,7 @@ export_dest(const char *dest) /* I - Destination to export */ if ((status = do_samba_command("rpcclient", SAMBAServer, subcmd)) != 0) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to install Windows 2000 printer " "driver files (%d)!\n"), status); @@ -762,6 +747,8 @@ export_dest(const char *dest) /* I - Destination to export */ snprintf(file, sizeof(file), "%s/drivers/ADOBEPS4.DRV", datadir); if (!access(file, 0)) { + have_drivers |= 2; + /* * Do the smbclient commands needed for the Adobe Win9x drivers... */ @@ -780,7 +767,7 @@ export_dest(const char *dest) /* I - Destination to export */ if ((status = do_samba_command("smbclient", address, subcmd)) != 0) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to copy Windows 9x printer " "driver files (%d)!\n"), status); @@ -801,7 +788,7 @@ export_dest(const char *dest) /* I - Destination to export */ if ((status = do_samba_command("rpcclient", SAMBAServer, subcmd)) != 0) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to install Windows 9x printer " "driver files (%d)!\n"), status); @@ -812,6 +799,17 @@ export_dest(const char *dest) /* I - Destination to export */ unlink(ppdfile); + if (have_drivers == 0) + { + _cupsLangPuts(stderr, + _("cupsaddsmb: No Windows printer drivers are installed!\n")); + return (9); + } + else if (have_drivers == 2) + _cupsLangPuts(stderr, + _("cupsaddsmb: Warning, no Windows 2000 printer drivers " + "are installed!\n")); + /* * Finally, associate the drivers we just added with the queue... */ @@ -820,7 +818,7 @@ export_dest(const char *dest) /* I - Destination to export */ if ((status = do_samba_command("rpcclient", SAMBAServer, subcmd)) != 0) { - _cupsLangPrintf(stderr, language, + _cupsLangPrintf(stderr, _("cupsaddsmb: Unable to set Windows printer driver (%d)!\n"), status); return (8); @@ -903,7 +901,7 @@ ppd_gets(FILE *fp, /* I - File to read from*/ void usage(void) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _("Usage: cupsaddsmb [options] printer1 ... printerN\n" " cupsaddsmb [options] -a\n" "\n" @@ -1028,5 +1026,5 @@ write_option(FILE *dstfp, /* I - PPD file */ /* - * End of "$Id: cupsaddsmb.c 4916 2006-01-11 21:42:55Z mike $". + * End of "$Id: cupsaddsmb.c 4933 2006-01-16 00:26:57Z mike $". */ diff --git a/systemv/cupstestppd.c b/systemv/cupstestppd.c index cb16ec5b28..09f45d5ae0 100644 --- a/systemv/cupstestppd.c +++ b/systemv/cupstestppd.c @@ -1,5 +1,5 @@ /* - * "$Id: cupstestppd.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: cupstestppd.c 4990 2006-01-26 02:21:45Z mike $" * * PPD test program for the Common UNIX Printing System (CUPS). * @@ -47,17 +47,34 @@ * Error codes... */ -#define ERROR_NONE 0 -#define ERROR_USAGE 1 -#define ERROR_FILE_OPEN 2 -#define ERROR_PPD_FORMAT 3 -#define ERROR_CONFORMANCE 4 +enum +{ + ERROR_NONE = 0, + ERROR_USAGE, + ERROR_FILE_OPEN, + ERROR_PPD_FORMAT, + ERROR_CONFORMANCE +}; + + +/* + * Line endings... + */ + +enum +{ + EOL_NONE = 0, + EOL_CR, + EOL_LF, + EOL_CRLF +}; /* * Local functions... */ +void check_basics(const char *filename); void show_conflicts(ppd_file_t *ppd); void usage(void); @@ -116,7 +133,7 @@ main(int argc, /* I - Number of command-line arguments */ case 'q' : /* Quiet mode */ if (verbose > 0) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("cupstestppd: The -q option is incompatible " "with the -v option.\n")); return (1); @@ -132,7 +149,7 @@ main(int argc, /* I - Number of command-line arguments */ case 'v' : /* Verbose mode */ if (verbose < 0) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("cupstestppd: The -v option is incompatible " "with the -q option.\n")); return (1); @@ -153,7 +170,7 @@ main(int argc, /* I - Number of command-line arguments */ */ if (files && verbose >= 0) - _cupsLangPuts(stdout, NULL, "\n"); + _cupsLangPuts(stdout, "\n"); files ++; @@ -189,7 +206,7 @@ main(int argc, /* I - Number of command-line arguments */ status = ERROR_FILE_OPEN; if (verbose >= 0) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" FAIL\n" " **FAIL** Unable to open PPD file - %s\n"), strerror(errno)); @@ -200,7 +217,7 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" FAIL\n" " **FAIL** Unable to open PPD file - " "%s on line %d.\n"), @@ -209,58 +226,60 @@ main(int argc, /* I - Number of command-line arguments */ switch (error) { case PPD_MISSING_PPDADOBE4 : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Page 42, section 5.2.\n")); break; case PPD_MISSING_VALUE : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Page 20, section 3.4.\n")); break; case PPD_BAD_OPEN_GROUP : case PPD_NESTED_OPEN_GROUP : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Pages 45-46, section 5.2.\n")); break; case PPD_BAD_OPEN_UI : case PPD_NESTED_OPEN_UI : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Pages 42-45, section 5.2.\n")); break; case PPD_BAD_ORDER_DEPENDENCY : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Pages 48-49, section 5.2.\n")); break; case PPD_BAD_UI_CONSTRAINTS : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Pages 52-54, section 5.2.\n")); break; case PPD_MISSING_ASTERISK : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Page 15, section 3.2.\n")); break; case PPD_LINE_TOO_LONG : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Page 15, section 3.1.\n")); break; case PPD_ILLEGAL_CHARACTER : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Page 15, section 3.1.\n")); break; case PPD_ILLEGAL_MAIN_KEYWORD : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Pages 16-17, section 3.2.\n")); break; case PPD_ILLEGAL_OPTION_KEYWORD : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Page 19, section 3.3.\n")); break; case PPD_ILLEGAL_TRANSLATION : - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" REF: Page 27, section 3.5.\n")); break; default : break; } + + check_basics(argv[i]); } } @@ -276,7 +295,7 @@ main(int argc, /* I - Number of command-line arguments */ ppdversion = 43; if (verbose > 0) - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _("\n DETAILED CONFORMANCE TEST RESULTS\n")); if ((attr = ppdFindAttr(ppd, "FormatVersion", NULL)) != NULL && @@ -303,7 +322,7 @@ main(int argc, /* I - Number of command-line arguments */ if (!strncmp(attr->name, "Default", 7) && !ppdFindOption(ppd, attr->name + 7)) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" WARN %s has no corresponding " "options!\n"), attr->name); @@ -315,9 +334,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED DefaultImageableArea\n" " REF: Page 102, section 5.15.\n")); } @@ -330,9 +349,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" **FAIL** BAD DefaultImageableArea %s!\n" " REF: Page 102, section 5.15.\n"), attr->value); @@ -343,7 +362,7 @@ main(int argc, /* I - Number of command-line arguments */ else { if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS DefaultImageableArea\n")); + _cupsLangPuts(stdout, _(" PASS DefaultImageableArea\n")); } if ((attr = ppdFindAttr(ppd, "DefaultPaperDimension", NULL)) == NULL) @@ -351,9 +370,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED DefaultPaperDimension\n" " REF: Page 103, section 5.15.\n")); } @@ -366,9 +385,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" **FAIL** BAD DefaultPaperDimension %s!\n" " REF: Page 103, section 5.15.\n"), attr->value); @@ -377,7 +396,7 @@ main(int argc, /* I - Number of command-line arguments */ errors ++; } else if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS DefaultPaperDimension\n")); + _cupsLangPuts(stdout, _(" PASS DefaultPaperDimension\n")); for (j = 0, group = ppd->groups; j < ppd->num_groups; j ++, group ++) for (k = 0, option = group->options; k < group->num_options; k ++, option ++) @@ -394,9 +413,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" **FAIL** BAD Default%s %s\n" " REF: Page 40, section 4.5.\n"), option->keyword, option->defchoice); @@ -405,7 +424,7 @@ main(int argc, /* I - Number of command-line arguments */ errors ++; } else if (verbose > 0) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" PASS Default%s\n"), option->keyword); } @@ -414,9 +433,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" **FAIL** REQUIRED Default%s\n" " REF: Page 40, section 4.5.\n"), option->keyword); @@ -429,16 +448,16 @@ main(int argc, /* I - Number of command-line arguments */ if (ppdFindAttr(ppd, "FileVersion", NULL) != NULL) { if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS FileVersion\n")); + _cupsLangPuts(stdout, _(" PASS FileVersion\n")); } else { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED FileVersion\n" " REF: Page 56, section 5.3.\n")); } @@ -449,16 +468,16 @@ main(int argc, /* I - Number of command-line arguments */ if (ppdFindAttr(ppd, "FormatVersion", NULL) != NULL) { if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS FormatVersion\n")); + _cupsLangPuts(stdout, _(" PASS FormatVersion\n")); } else { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED FormatVersion\n" " REF: Page 56, section 5.3.\n")); } @@ -469,16 +488,16 @@ main(int argc, /* I - Number of command-line arguments */ if (ppd->lang_encoding != NULL) { if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS LanguageEncoding\n")); + _cupsLangPuts(stdout, _(" PASS LanguageEncoding\n")); } else if (ppdversion > 40) { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED LanguageEncoding\n" " REF: Pages 56-57, section 5.3.\n")); } @@ -489,16 +508,16 @@ main(int argc, /* I - Number of command-line arguments */ if (ppd->lang_version != NULL) { if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS LanguageVersion\n")); + _cupsLangPuts(stdout, _(" PASS LanguageVersion\n")); } else { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED LanguageVersion\n" " REF: Pages 57-58, section 5.3.\n")); } @@ -514,9 +533,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** BAD Manufacturer (should be " "\"HP\")\n" " REF: Page 211, table D.1.\n")); @@ -525,16 +544,16 @@ main(int argc, /* I - Number of command-line arguments */ errors ++; } else if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS Manufacturer\n")); + _cupsLangPuts(stdout, _(" PASS Manufacturer\n")); } else if (ppdversion >= 43) { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED Manufacturer\n" " REF: Pages 58-59, section 5.3.\n")); } @@ -553,9 +572,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" **FAIL** BAD ModelName - \"%c\" not " "allowed in string.\n" " REF: Pages 59-60, section 5.3.\n"), @@ -565,16 +584,16 @@ main(int argc, /* I - Number of command-line arguments */ errors ++; } else if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS ModelName\n")); + _cupsLangPuts(stdout, _(" PASS ModelName\n")); } else { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED ModelName\n" " REF: Pages 59-60, section 5.3.\n")); } @@ -585,16 +604,16 @@ main(int argc, /* I - Number of command-line arguments */ if (ppd->nickname != NULL) { if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS NickName\n")); + _cupsLangPuts(stdout, _(" PASS NickName\n")); } else { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED NickName\n" " REF: Page 60, section 5.3.\n")); } @@ -605,16 +624,16 @@ main(int argc, /* I - Number of command-line arguments */ if (ppdFindOption(ppd, "PageSize") != NULL) { if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS PageSize\n")); + _cupsLangPuts(stdout, _(" PASS PageSize\n")); } else { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED PageSize\n" " REF: Pages 99-100, section 5.14.\n")); } @@ -625,16 +644,16 @@ main(int argc, /* I - Number of command-line arguments */ if (ppdFindOption(ppd, "PageRegion") != NULL) { if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS PageRegion\n")); + _cupsLangPuts(stdout, _(" PASS PageRegion\n")); } else { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED PageRegion\n" " REF: Page 100, section 5.14.\n")); } @@ -645,16 +664,16 @@ main(int argc, /* I - Number of command-line arguments */ if (ppd->pcfilename != NULL) { if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS PCFileName\n")); + _cupsLangPuts(stdout, _(" PASS PCFileName\n")); } else { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED PCFileName\n" " REF: Pages 61-62, section 5.3.\n")); } @@ -670,9 +689,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** BAD Product - not \"(string)\".\n" " REF: Page 62, section 5.3.\n")); } @@ -680,16 +699,16 @@ main(int argc, /* I - Number of command-line arguments */ errors ++; } else if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS Product\n")); + _cupsLangPuts(stdout, _(" PASS Product\n")); } else { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED Product\n" " REF: Page 62, section 5.3.\n")); } @@ -709,9 +728,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** BAD PSVersion - not \"(string) " "int\".\n" " REF: Pages 62-64, section 5.3.\n")); @@ -720,16 +739,16 @@ main(int argc, /* I - Number of command-line arguments */ errors ++; } else if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS PSVersion\n")); + _cupsLangPuts(stdout, _(" PASS PSVersion\n")); } else { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED PSVersion\n" " REF: Pages 62-64, section 5.3.\n")); } @@ -744,9 +763,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** BAD ShortNickName - longer " "than 31 chars.\n" " REF: Pages 64-65, section 5.3.\n")); @@ -755,16 +774,16 @@ main(int argc, /* I - Number of command-line arguments */ errors ++; } else if (verbose > 0) - _cupsLangPuts(stdout, NULL, _(" PASS ShortNickName\n")); + _cupsLangPuts(stdout, _(" PASS ShortNickName\n")); } else if (ppdversion >= 43) { if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED ShortNickName\n" " REF: Page 64-65, section 5.3.\n")); } @@ -778,9 +797,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** BAD JobPatchFile attribute in file\n" " REF: Page 24, section 3.4.\n")); } @@ -798,9 +817,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" **FAIL** REQUIRED PageSize\n" " REF: Page 41, section 5.\n" " REF: Page 99, section 5.14.\n")); @@ -829,9 +848,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" **FAIL** REQUIRED ImageableArea for " "PageSize %s\n" " REF: Page 41, section 5.\n" @@ -851,9 +870,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" **FAIL** REQUIRED PaperDimension " "for PageSize %s\n" " REF: Page 41, section 5.\n" @@ -899,9 +918,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" **FAIL** Bad %s choice %s!\n" " REF: Page 84, section 5.9\n"), option->keyword, choice->choice); @@ -928,9 +947,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" **FAIL** REQUIRED %s does not define " "choice None!\n" " REF: Page 122, section 5.17\n"), @@ -949,9 +968,9 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose >= 0) { if (!errors && !verbose) - _cupsLangPuts(stdout, NULL, _(" FAIL\n")); + _cupsLangPuts(stdout, _(" FAIL\n")); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" **FAIL** Bad %s choice %s!\n" " REF: Page 122, section 5.17\n"), option->keyword, choice->choice); @@ -964,15 +983,17 @@ main(int argc, /* I - Number of command-line arguments */ if (errors) status = ERROR_CONFORMANCE; else if (!verbose) - _cupsLangPuts(stdout, NULL, _(" PASS\n")); + _cupsLangPuts(stdout, _(" PASS\n")); if (verbose >= 0) { + check_basics(argv[i]); + if (option && strcmp(option->keyword, "Duplex") && strcmp(option->keyword, "JCLDuplex")) { - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" WARN Duplex option keyword %s " "should be named Duplex or JCLDuplex!\n" " REF: Page 122, section 5.17\n"), @@ -982,7 +1003,7 @@ main(int argc, /* I - Number of command-line arguments */ ppdMarkDefaults(ppd); if (ppdConflicts(ppd)) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" WARN Default choices conflicting!\n")); show_conflicts(ppd); @@ -990,7 +1011,7 @@ main(int argc, /* I - Number of command-line arguments */ if (ppdversion < 43) { - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" WARN Obsolete PPD version %.1f!\n" " REF: Page 42, section 5.2.\n"), 0.1f * ppdversion); @@ -998,7 +1019,7 @@ main(int argc, /* I - Number of command-line arguments */ if (!ppd->lang_encoding && ppdversion < 41) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" WARN LanguageEncoding required by PPD " "4.3 spec.\n" " REF: Pages 56-57, section 5.3.\n")); @@ -1006,7 +1027,7 @@ main(int argc, /* I - Number of command-line arguments */ if (!ppd->manufacturer && ppdversion < 43) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" WARN Manufacturer required by PPD " "4.3 spec.\n" " REF: Pages 58-59, section 5.3.\n")); @@ -1019,7 +1040,7 @@ main(int argc, /* I - Number of command-line arguments */ if (ppd->pcfilename && strlen(ppd->pcfilename) > 12) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" WARN PCFileName longer than 8.3 in " "violation of PPD spec.\n" " REF: Pages 61-62, section 5.3.\n")); @@ -1027,7 +1048,7 @@ main(int argc, /* I - Number of command-line arguments */ if (!ppd->shortnickname && ppdversion < 43) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" WARN ShortNickName required by PPD " "4.3 spec.\n" " REF: Pages 64-65, section 5.3.\n")); @@ -1044,7 +1065,7 @@ main(int argc, /* I - Number of command-line arguments */ strstr(ppd->protocols, "BCP") && !strstr(ppd->protocols, "TBCP")) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" WARN Protocols contains both PJL " "and BCP; expected TBCP.\n" " REF: Pages 78-79, section 5.7.\n")); @@ -1053,7 +1074,7 @@ main(int argc, /* I - Number of command-line arguments */ if (strstr(ppd->protocols, "PJL") && (!ppd->jcl_begin || !ppd->jcl_end || !ppd->jcl_ps)) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _(" WARN Protocols contains PJL but JCL " "attributes are not set.\n" " REF: Pages 78-79, section 5.7.\n")); @@ -1081,7 +1102,7 @@ main(int argc, /* I - Number of command-line arguments */ len < strlen(option2->keyword) && !strncmp(option->keyword, option2->keyword, len)) { - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" WARN %s shares a common " "prefix with %s\n" " REF: Page 15, section " @@ -1094,20 +1115,19 @@ main(int argc, /* I - Number of command-line arguments */ if (verbose > 0) { if (errors) - _cupsLangPrintf(stdout, NULL, _(" %d ERROR%s FOUND\n"), + _cupsLangPrintf(stdout, _(" %d ERROR%s FOUND\n"), errors, errors == 1 ? "" : "S"); else - _cupsLangPuts(stdout, NULL, _(" NO ERRORS FOUND\n")); + _cupsLangPuts(stdout, _(" NO ERRORS FOUND\n")); } - /* * Then list the options, if "-v" was provided... */ if (verbose > 1) { - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, "\n" " language_level = %d\n" " color_device = %s\n" @@ -1121,53 +1141,53 @@ main(int argc, /* I - Number of command-line arguments */ switch (ppd->colorspace) { case PPD_CS_CMYK : - _cupsLangPuts(stdout, NULL, " colorspace = PPD_CS_CMYK\n"); + _cupsLangPuts(stdout, " colorspace = PPD_CS_CMYK\n"); break; case PPD_CS_CMY : - _cupsLangPuts(stdout, NULL, " colorspace = PPD_CS_CMY\n"); + _cupsLangPuts(stdout, " colorspace = PPD_CS_CMY\n"); break; case PPD_CS_GRAY : - _cupsLangPuts(stdout, NULL, " colorspace = PPD_CS_GRAY\n"); + _cupsLangPuts(stdout, " colorspace = PPD_CS_GRAY\n"); break; case PPD_CS_RGB : - _cupsLangPuts(stdout, NULL, " colorspace = PPD_CS_RGB\n"); + _cupsLangPuts(stdout, " colorspace = PPD_CS_RGB\n"); break; default : - _cupsLangPuts(stdout, NULL, " colorspace = \n"); + _cupsLangPuts(stdout, " colorspace = \n"); break; } - _cupsLangPrintf(stdout, NULL, " num_emulations = %d\n", + _cupsLangPrintf(stdout, " num_emulations = %d\n", ppd->num_emulations); for (j = 0; j < ppd->num_emulations; j ++) - _cupsLangPrintf(stdout, NULL, " emulations[%d] = %s\n", + _cupsLangPrintf(stdout, " emulations[%d] = %s\n", j, ppd->emulations[j].name); - _cupsLangPrintf(stdout, NULL, " lang_encoding = %s\n", + _cupsLangPrintf(stdout, " lang_encoding = %s\n", ppd->lang_encoding); - _cupsLangPrintf(stdout, NULL, " lang_version = %s\n", + _cupsLangPrintf(stdout, " lang_version = %s\n", ppd->lang_version); - _cupsLangPrintf(stdout, NULL, " modelname = %s\n", ppd->modelname); - _cupsLangPrintf(stdout, NULL, " ttrasterizer = %s\n", + _cupsLangPrintf(stdout, " modelname = %s\n", ppd->modelname); + _cupsLangPrintf(stdout, " ttrasterizer = %s\n", ppd->ttrasterizer == NULL ? "None" : ppd->ttrasterizer); - _cupsLangPrintf(stdout, NULL, " manufacturer = %s\n", + _cupsLangPrintf(stdout, " manufacturer = %s\n", ppd->manufacturer); - _cupsLangPrintf(stdout, NULL, " product = %s\n", ppd->product); - _cupsLangPrintf(stdout, NULL, " nickname = %s\n", ppd->nickname); - _cupsLangPrintf(stdout, NULL, " shortnickname = %s\n", + _cupsLangPrintf(stdout, " product = %s\n", ppd->product); + _cupsLangPrintf(stdout, " nickname = %s\n", ppd->nickname); + _cupsLangPrintf(stdout, " shortnickname = %s\n", ppd->shortnickname); - _cupsLangPrintf(stdout, NULL, " patches = %d bytes\n", + _cupsLangPrintf(stdout, " patches = %d bytes\n", ppd->patches == NULL ? 0 : (int)strlen(ppd->patches)); - _cupsLangPrintf(stdout, NULL, " num_groups = %d\n", ppd->num_groups); + _cupsLangPrintf(stdout, " num_groups = %d\n", ppd->num_groups); for (j = 0, group = ppd->groups; j < ppd->num_groups; j ++, group ++) { - _cupsLangPrintf(stdout, NULL, " group[%d] = %s\n", + _cupsLangPrintf(stdout, " group[%d] = %s\n", j, group->text); for (k = 0, option = group->options; k < group->num_options; k ++, option ++) { - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, " options[%d] = %s (%s) %s %s %.0f " "(%d choices)\n", k, option->keyword, option->text, uis[option->ui], @@ -1184,11 +1204,11 @@ main(int argc, /* I - Number of command-line arguments */ size = ppdPageSize(ppd, choice->choice); if (size == NULL) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, " %s (%s) = ERROR", choice->choice, choice->text); else - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, " %s (%s) = %.2fx%.2fin " "(%.1f,%.1f,%.1f,%.1f)", choice->choice, choice->text, @@ -1197,9 +1217,9 @@ main(int argc, /* I - Number of command-line arguments */ size->right / 72.0, size->top / 72.0); if (!strcmp(option->defchoice, choice->choice)) - _cupsLangPuts(stdout, NULL, " *\n"); + _cupsLangPuts(stdout, " *\n"); else - _cupsLangPuts(stdout, NULL, "\n"); + _cupsLangPuts(stdout, "\n"); } } else @@ -1208,22 +1228,22 @@ main(int argc, /* I - Number of command-line arguments */ m > 0; m --, choice ++) { - _cupsLangPrintf(stdout, NULL, " %s (%s)", + _cupsLangPrintf(stdout, " %s (%s)", choice->choice, choice->text); if (!strcmp(option->defchoice, choice->choice)) - _cupsLangPuts(stdout, NULL, " *\n"); + _cupsLangPuts(stdout, " *\n"); else - _cupsLangPuts(stdout, NULL, "\n"); + _cupsLangPuts(stdout, "\n"); } } } } - _cupsLangPrintf(stdout, NULL, " num_profiles = %d\n", + _cupsLangPrintf(stdout, " num_profiles = %d\n", ppd->num_profiles); for (j = 0; j < ppd->num_profiles; j ++) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, " profiles[%d] = %s/%s %.3f %.3f " "[ %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f %.3f ]\n", j, ppd->profiles[j].resolution, @@ -1239,14 +1259,14 @@ main(int argc, /* I - Number of command-line arguments */ ppd->profiles[j].matrix[2][1], ppd->profiles[j].matrix[2][2]); - _cupsLangPrintf(stdout, NULL, " num_fonts = %d\n", ppd->num_fonts); + _cupsLangPrintf(stdout, " num_fonts = %d\n", ppd->num_fonts); for (j = 0; j < ppd->num_fonts; j ++) - _cupsLangPrintf(stdout, NULL, " fonts[%d] = %s\n", + _cupsLangPrintf(stdout, " fonts[%d] = %s\n", j, ppd->fonts[j]); - _cupsLangPrintf(stdout, NULL, " num_attrs = %d\n", ppd->num_attrs); + _cupsLangPrintf(stdout, " num_attrs = %d\n", ppd->num_attrs); for (j = 0; j < ppd->num_attrs; j ++) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, " attrs[%d] = %s %s%s%s: \"%s\"\n", j, ppd->attrs[j]->name, ppd->attrs[j]->spec, ppd->attrs[j]->text[0] ? "/" : "", @@ -1265,6 +1285,91 @@ main(int argc, /* I - Number of command-line arguments */ } +/* + * 'check_basics()' - Check for CR LF, mixed line endings, and blank lines. + */ + +void +check_basics(const char *filename) /* I - PPD file to check */ +{ + cups_file_t *fp; /* File pointer */ + int ch; /* Current character */ + int col, /* Current column */ + whitespace; /* Only seen whitespace? */ + int eol; /* Line endings */ + int linenum; /* Line number */ + int mixed; /* Mixed line endings? */ + + + if ((fp = cupsFileOpen(filename, "r")) == NULL) + return; + + linenum = 1; + col = 0; + eol = EOL_NONE; + mixed = 0; + whitespace = 1; + + while ((ch = cupsFileGetChar(fp)) != EOF) + { + if (ch == '\r' || ch == '\n') + { + if (ch == '\n') + { + if (eol == EOL_NONE) + eol = EOL_LF; + else if (eol != EOL_LF) + mixed = 1; + } + else if (ch == '\r') + { + if (cupsFilePeekChar(fp) == '\n') + { + cupsFileGetChar(fp); + + if (eol == EOL_NONE) + eol = EOL_CRLF; + else + mixed = 1; + } + else if (eol == EOL_NONE) + eol = EOL_CR; + else + mixed = 1; + } + + if (col > 0 && whitespace) + _cupsLangPrintf(stdout, + _(" WARN Line %d only contains whitespace!\n"), + linenum); + + linenum ++; + col = 0; + whitespace = 1; + } + else + { + if (ch != ' ' && ch != '\t') + whitespace = 0; + + col ++; + } + } + + if (mixed) + _cupsLangPuts(stdout, + _(" WARN File contains a mix of CR, LF, and " + "CR LF line endings!\n")); + + if (eol == EOL_CRLF) + _cupsLangPuts(stdout, + _(" WARN Non-Windows PPD files should use lines " + "ending with only LF, not CR LF!\n")); + + cupsFileClose(fp); +} + + /* * 'show_conflicts()' - Show option conflicts in a PPD file. */ @@ -1356,7 +1461,7 @@ show_conflicts(ppd_file_t *ppd) /* I - PPD to check */ */ if (c1 != NULL && c1->marked && c2 != NULL && c2->marked) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _(" WARN \"%s %s\" conflicts with \"%s %s\"\n" " (constraint=\"%s %s %s %s\")\n"), o1->keyword, c1->choice, o2->keyword, c2->choice, @@ -1372,7 +1477,7 @@ show_conflicts(ppd_file_t *ppd) /* I - PPD to check */ void usage(void) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _("Usage: cupstestppd [-q] [-r] [-v[v]] filename1.ppd[.gz] " "[... filenameN.ppd[.gz]]\n" " program | cupstestppd [-q] [-r] [-v[v]] -\n")); @@ -1382,5 +1487,5 @@ usage(void) /* - * End of "$Id: cupstestppd.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: cupstestppd.c 4990 2006-01-26 02:21:45Z mike $". */ diff --git a/systemv/lp.c b/systemv/lp.c index 13acd16761..6946280ae1 100644 --- a/systemv/lp.c +++ b/systemv/lp.c @@ -1,5 +1,5 @@ /* - * "$Id: lp.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lp.c 4974 2006-01-25 07:04:33Z mike $" * * "lp" command for the Common UNIX Printing System (CUPS). * @@ -52,8 +52,9 @@ void sighandler(int); #endif /* !WIN32 */ -int restart_job(int job_id); -int set_job_attrs(int job_id, int num_options, cups_option_t *options); +int restart_job(const char *command, int job_id); +int set_job_attrs(const char *command, int job_id, int num_options, + cups_option_t *options); /* @@ -86,8 +87,11 @@ main(int argc, /* I - Number of command-line arguments */ *dest; /* Selected destination */ int num_options; /* Number of options */ cups_option_t *options; /* Options */ + int end_options; /* No more options? */ int silent; /* Silent or verbose output? */ char buffer[8192]; /* Copy buffer */ + ssize_t bytes; /* Bytes copied */ + off_t filesize; /* Size of temp file */ int temp; /* Temporary file descriptor */ #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET) struct sigaction action; /* Signal action */ @@ -122,21 +126,41 @@ main(int argc, /* I - Number of command-line arguments */ num_files = 0; title = NULL; job_id = 0; + end_options = 0; for (i = 1; i < argc; i ++) - if (argv[i][0] == '-' && argv[i][1]) + if (argv[i][0] == '-' && argv[i][1] && !end_options) switch (argv[i][1]) { case 'E' : /* Encrypt */ #ifdef HAVE_SSL cupsSetEncryption(HTTP_ENCRYPT_REQUIRED); #else - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), argv[0]); #endif /* HAVE_SSL */ break; + case 'U' : /* Username */ + if (argv[i][2] != '\0') + cupsSetUser(argv[i] + 2); + else + { + i ++; + if (i >= argc) + { + _cupsLangPrintf(stderr, + _("%s: Error - expected username after " + "\'-U\' option!\n"), + argv[0]); + return (1); + } + + cupsSetUser(argv[i]); + } + break; + case 'c' : /* Copy to spool dir (always enabled) */ break; @@ -149,8 +173,10 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected destination after -d option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected destination after " + "\'-d\' option!\n"), + argv[0]); return (1); } @@ -180,13 +206,16 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected form after -f option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected form after \'-f\' " + "option!\n"), + argv[0]); return (1); } } - fputs("lp: Warning - form option ignored!\n", stderr); + _cupsLangPrintf(stderr, _("%s: Warning - form option ignored!\n"), + argv[0]); break; case 'h' : /* Destination host */ @@ -198,8 +227,10 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected hostname after -h option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected hostname after " + "\'-h\' option!\n"), + argv[0]); return (1); } @@ -216,8 +247,9 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected job ID after -i option!\n")); + _cupsLangPrintf(stderr, + _("%s: Expected job ID after \'-i\' option!\n"), + argv[0]); return (1); } @@ -226,9 +258,10 @@ main(int argc, /* I - Number of command-line arguments */ if (num_files > 0) { - _cupsLangPuts(stderr, NULL, - _("lp: Error - cannot print files and alter " - "jobs simultaneously!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - cannot print files and alter " + "jobs simultaneously!\n"), + argv[0]); return (1); } @@ -239,7 +272,7 @@ main(int argc, /* I - Number of command-line arguments */ if (job_id < 0) { - _cupsLangPuts(stderr, NULL, _("lp: Error - bad job ID!\n")); + _cupsLangPrintf(stderr, _("%s: Error - bad job ID!\n"), argv[0]); break; } break; @@ -249,6 +282,17 @@ main(int argc, /* I - Number of command-line arguments */ case 'p' : /* Notify on completion */ #endif /* __sun */ case 'w' : /* Write to console or email */ + { + char email[1024]; /* EMail address */ + + + snprintf(email, sizeof(email), "mailto:%s@%s", cupsUser(), + httpGetHostname(buffer, sizeof(buffer))); + num_options = cupsAddOption("notify-recipient", email, + num_options, &options); + } + + silent = 1; break; case 'n' : /* Number of copies */ @@ -260,8 +304,10 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected copies after -n option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected copies after " + "\'-n\' option!\n"), + argv[0]); return (1); } @@ -281,8 +327,10 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected option string after -o option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected option string after " + "\'-o\' option!\n"), + argv[0]); return (1); } @@ -300,9 +348,10 @@ main(int argc, /* I - Number of command-line arguments */ { if ((i + 1) >= argc) { - _cupsLangPrintf(stderr, NULL, - _("lp: Expected priority after -%c option!\n"), - argv[i][1]); + _cupsLangPrintf(stderr, + _("%s: Error - expected priority after " + "\'-%c\' option!\n"), + argv[0], argv[i][1]); return (1); } @@ -322,8 +371,10 @@ main(int argc, /* I - Number of command-line arguments */ if (priority < 1 || priority > 100) { - _cupsLangPuts(stderr, NULL, - _("lp: Priority must be between 1 and 100.\n")); + _cupsLangPrintf(stderr, + _("%s: Error - priority must be between 1 and " + "100.\n"), + argv[0]); return (1); } @@ -344,8 +395,10 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected title after -t option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected title after " + "\'-t\' option!\n"), + argv[0]); return (1); } @@ -360,14 +413,17 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected mode list after -y option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected mode list after " + "\'-y\' option!\n"), + argv[0]); return (1); } } - _cupsLangPuts(stderr, NULL, - _("lp: Warning - mode option ignored!\n")); + _cupsLangPrintf(stderr, + _("%s: Warning - mode option ignored!\n"), + argv[0]); break; case 'H' : /* Hold job */ @@ -379,8 +435,10 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected hold name after -H option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected hold name after " + "\'-H\' option!\n"), + argv[0]); return (1); } @@ -401,12 +459,14 @@ main(int argc, /* I - Number of command-line arguments */ { if (job_id < 1) { - _cupsLangPuts(stderr, NULL, - _("lp: Need job ID (-i) before \"-H restart\"!\n")); + _cupsLangPrintf(stderr, + _("%s: Need job ID (\'-i jobid\') before " + "\'-H restart\'!\n"), + argv[0]); return (1); } - if (restart_job(job_id)) + if (restart_job(argv[0], job_id)) return (1); } else @@ -423,8 +483,10 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected page list after -P option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected page list after " + "\'-P\' option!\n"), + argv[0]); return (1); } @@ -442,14 +504,17 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected character set after -S option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected character set after " + "\'-S\' option!\n"), + argv[0]); return (1); } } - _cupsLangPuts(stderr, NULL, - _("lp: Warning - character set option ignored!\n")); + _cupsLangPrintf(stderr, + _("%s: Warning - character set option ignored!\n"), + argv[0]); break; case 'T' : /* Content-Type */ @@ -459,28 +524,36 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lp: Expected content type after -T option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected content type after " + "\'-T\' option!\n"), + argv[0]); return (1); } } - _cupsLangPuts(stderr, NULL, - _("lp: Warning - content type option ignored!\n")); + _cupsLangPrintf(stderr, + _("%s: Warning - content type option ignored!\n"), + argv[0]); + break; + + case '-' : /* Stop processing options */ + end_options = 1; break; default : - _cupsLangPrintf(stderr, NULL, _("lp: Unknown option \'%c\'!\n"), - argv[i][1]); + _cupsLangPrintf(stderr, _("%s: Error - unknown option \'%c\'!\n"), + argv[0], argv[i][1]); return (1); } else if (!strcmp(argv[i], "-")) { if (num_files || job_id) { - _cupsLangPuts(stderr, NULL, - _("lp: Error - cannot print from stdin if files or a " - "job ID are provided!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - cannot print from stdin if files or a " + "job ID are provided!\n"), + argv[0]); return (1); } @@ -494,8 +567,8 @@ main(int argc, /* I - Number of command-line arguments */ if (access(argv[i], R_OK) != 0) { - _cupsLangPrintf(stderr, NULL, _("lp: Unable to access \"%s\" - %s\n"), - argv[i], strerror(errno)); + _cupsLangPrintf(stderr, _("%s: Error - unable to access \"%s\" - %s\n"), + argv[0], argv[i], strerror(errno)); return (1); } @@ -511,15 +584,15 @@ main(int argc, /* I - Number of command-line arguments */ } } else - _cupsLangPrintf(stderr, NULL, _("lp: Too many files - \"%s\"\n"), - argv[i]); + _cupsLangPrintf(stderr, _("%s: Error - too many files - \"%s\"\n"), + argv[0], argv[i]); /* * See if we are altering an existing job... */ if (job_id) - return (set_job_attrs(job_id, num_options, options)); + return (set_job_attrs(argv[0], job_id, num_options, options)); /* * See if we have any files to print; if not, print from stdin... @@ -560,16 +633,18 @@ main(int argc, /* I - Number of command-line arguments */ val = "LPDEST"; if (printer && !cupsGetDest(printer, NULL, num_dests, dests)) - _cupsLangPrintf(stderr, NULL, - _("lp: error - %s environment variable names " + _cupsLangPrintf(stderr, + _("%s: Error - %s environment variable names " "non-existent destination \"%s\"!\n"), - val, printer); + argv[0], val, printer); else if (cupsLastError() == IPP_NOT_FOUND) - _cupsLangPuts(stderr, NULL, - _("lp: error - no default destination available.\n")); + _cupsLangPrintf(stderr, + _("%s: Error - no default destination available.\n"), + argv[0]); else - _cupsLangPuts(stderr, NULL, - _("lp: error - scheduler not responding!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - scheduler not responding!\n"), + argv[0]); return (1); } @@ -607,31 +682,32 @@ main(int argc, /* I - Number of command-line arguments */ if (temp < 0) { - _cupsLangPrintf(stderr, NULL, - _("lp: unable to create temporary file \"%s\" - %s\n"), - tempfile, strerror(errno)); + _cupsLangPrintf(stderr, + _("%s: Error - unable to create temporary file \"%s\" - %s\n"), + argv[0], tempfile, strerror(errno)); return (1); } - while ((i = read(0, buffer, sizeof(buffer))) > 0) - if (write(temp, buffer, i) < 0) + while ((bytes = read(0, buffer, sizeof(buffer))) > 0) + if (write(temp, buffer, bytes) < 0) { - _cupsLangPrintf(stderr, NULL, - _("lp: error - unable to write to temporary file " + _cupsLangPrintf(stderr, + _("%s: Error - unable to write to temporary file " "\"%s\" - %s\n"), - tempfile, strerror(errno)); + argv[0], tempfile, strerror(errno)); close(temp); unlink(tempfile); return (1); } - i = lseek(temp, 0, SEEK_CUR); + filesize = lseek(temp, 0, SEEK_CUR); close(temp); - if (i == 0) + if (filesize <= 0) { - _cupsLangPuts(stderr, NULL, - _("lp: stdin is empty, so no job has been sent.\n")); + _cupsLangPrintf(stderr, + _("%s: Error - stdin is empty, so no job has been sent.\n"), + argv[0]); unlink(tempfile); return (1); } @@ -646,14 +722,11 @@ main(int argc, /* I - Number of command-line arguments */ if (job_id < 1) { - _cupsLangPrintf(stderr, NULL, - _("lp: unable to print file: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "%s: %s\n", argv[0], cupsLastErrorString()); return (1); } else if (!silent) - _cupsLangPrintf(stdout, NULL, - _("request id is %s-%d (%d file(s))\n"), + _cupsLangPrintf(stdout, _("request id is %s-%d (%d file(s))\n"), printer, job_id, num_files); return (0); @@ -665,28 +738,17 @@ main(int argc, /* I - Number of command-line arguments */ */ int /* O - Exit status */ -restart_job(int job_id) /* I - Job ID */ +restart_job(const char *command, /* I - Command name */ + int job_id) /* I - Job ID */ { http_t *http; /* HTTP connection to server */ - ipp_t *request, /* IPP request */ - *response; /* IPP response */ - cups_lang_t *language; /* Language for request */ + ipp_t *request; /* IPP request */ char uri[HTTP_MAX_URI]; /* URI for job */ http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption()); - language = cupsLangDefault(); - - request = ippNew(); - request->request.op.operation_id = IPP_RESTART_JOB; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(IPP_RESTART_JOB); sprintf(uri, "ipp://localhost/jobs/%d", job_id); @@ -696,22 +758,11 @@ restart_job(int job_id) /* I - Job ID */ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser()); - if ((response = cupsDoRequest(http, request, "/jobs")) != NULL) - { - if (response->request.status.status_code > IPP_OK_CONFLICT) - { - _cupsLangPrintf(stderr, NULL, _("lp: restart-job failed: %s\n"), - ippErrorString(response->request.status.status_code)); - ippDelete(response); - return (1); - } + ippDelete(cupsDoRequest(http, request, "/jobs")); - ippDelete(response); - } - else + if (cupsLastError() > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, _("lp: restart-job failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString()); return (1); } @@ -724,14 +775,13 @@ restart_job(int job_id) /* I - Job ID */ */ int /* O - Exit status */ -set_job_attrs(int job_id, /* I - Job ID */ +set_job_attrs(const char *command, /* I - Command name */ + int job_id, /* I - Job ID */ int num_options,/* I - Number of options */ cups_option_t *options) /* I - Options */ { http_t *http; /* HTTP connection to server */ - ipp_t *request, /* IPP request */ - *response; /* IPP response */ - cups_lang_t *language; /* Language for request */ + ipp_t *request; /* IPP request */ char uri[HTTP_MAX_URI]; /* URI for job */ @@ -740,17 +790,7 @@ set_job_attrs(int job_id, /* I - Job ID */ http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption()); - language = cupsLangDefault(); - - request = ippNew(); - request->request.op.operation_id = IPP_SET_JOB_ATTRIBUTES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(IPP_SET_JOB_ATTRIBUTES); sprintf(uri, "ipp://localhost/jobs/%d", job_id); @@ -762,22 +802,11 @@ set_job_attrs(int job_id, /* I - Job ID */ cupsEncodeOptions(request, num_options, options); - if ((response = cupsDoRequest(http, request, "/jobs")) != NULL) - { - if (response->request.status.status_code > IPP_OK_CONFLICT) - { - _cupsLangPrintf(stderr, NULL, _("lp: set-job-attributes failed: %s\n"), - ippErrorString(response->request.status.status_code)); - ippDelete(response); - return (1); - } + ippDelete(cupsDoRequest(http, request, "/jobs")); - ippDelete(response); - } - else + if (cupsLastError() > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, _("lp: set-job-attributes failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "%s: %s\n", command, cupsLastErrorString()); return (1); } @@ -791,7 +820,7 @@ set_job_attrs(int job_id, /* I - Job ID */ */ void -sighandler(int s) /* I - Signal number */ +sighandler(int s) /* I - Signal number */ { /* * Remove the temporary file we're using to print from stdin... @@ -809,5 +838,5 @@ sighandler(int s) /* I - Signal number */ /* - * End of "$Id: lp.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lp.c 4974 2006-01-25 07:04:33Z mike $". */ diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c index 4f12b43e4e..02b441f43d 100644 --- a/systemv/lpadmin.c +++ b/systemv/lpadmin.c @@ -1,5 +1,5 @@ /* - * "$Id: lpadmin.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lpadmin.c 4925 2006-01-13 02:52:47Z mike $" * * "lpadmin" command for the Common UNIX Printing System (CUPS). * @@ -109,7 +109,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -118,7 +118,7 @@ main(int argc, /* I - Number of command-line arguments */ if (printer == NULL) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Unable to add a printer to the class:\n" " You must specify a printer name " "first!\n")); @@ -133,7 +133,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected class name after \'-c\' " "option!\n")); return (1); @@ -144,7 +144,7 @@ main(int argc, /* I - Number of command-line arguments */ if (!validate_name(pclass)) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Class name can only contain printable " "characters!\n")); return (1); @@ -162,7 +162,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -177,7 +177,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected printer name after \'-d\' " "option!\n")); return (1); @@ -188,7 +188,7 @@ main(int argc, /* I - Number of command-line arguments */ if (!validate_name(printer)) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Printer name can only contain " "printable characters!\n")); return (1); @@ -215,7 +215,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected hostname after \'-h\' " "option!\n")); return (1); @@ -233,7 +233,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -242,7 +242,7 @@ main(int argc, /* I - Number of command-line arguments */ if (printer == NULL) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Unable to set the interface script:\n" " You must specify a printer name " "first!\n")); @@ -260,7 +260,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected interface after \'-i\' " "option!\n")); return (1); @@ -280,7 +280,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http) httpEncryption(http, HTTP_ENCRYPT_REQUIRED); #else - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), argv[0]); #endif /* HAVE_SSL */ @@ -294,7 +294,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -313,7 +313,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -322,7 +322,7 @@ main(int argc, /* I - Number of command-line arguments */ if (printer == NULL) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Unable to set the interface script or " "PPD file:\n" " You must specify a printer name " @@ -341,7 +341,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected model after \'-m\' " "option!\n")); return (1); @@ -361,7 +361,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected name=value after \'-o\' " "option!\n")); return (1); @@ -379,7 +379,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -394,7 +394,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected printer after \'-p\' " "option!\n")); return (1); @@ -405,7 +405,7 @@ main(int argc, /* I - Number of command-line arguments */ if (!validate_name(printer)) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Printer name can only contain " "printable characters!\n")); return (1); @@ -420,7 +420,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -429,7 +429,7 @@ main(int argc, /* I - Number of command-line arguments */ if (printer == NULL) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Unable to remove a printer from the " "class:\n" " You must specify a printer name " @@ -445,7 +445,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected class after \'-r\' " "option!\n")); return (1); @@ -456,7 +456,7 @@ main(int argc, /* I - Number of command-line arguments */ if (!validate_name(pclass)) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Class name can only contain printable " "characters!\n")); return (1); @@ -475,7 +475,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected allow/deny:userlist after " "\'-u\' option!\n")); return (1); @@ -492,7 +492,7 @@ main(int argc, /* I - Number of command-line arguments */ val + 5, num_options, &options); else { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unknown allow/deny option \"%s\"!\n"), val); return (1); @@ -507,7 +507,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -516,7 +516,7 @@ main(int argc, /* I - Number of command-line arguments */ if (printer == NULL) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Unable to set the device URI:\n" " You must specify a printer name " "first!\n")); @@ -534,7 +534,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected device URI after \'-v\' " "option!\n")); return (1); @@ -553,7 +553,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -568,7 +568,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected printer or class after " "\'-x\' option!\n")); return (1); @@ -579,7 +579,7 @@ main(int argc, /* I - Number of command-line arguments */ if (!validate_name(printer)) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Printer name can only contain " "printable characters!\n")); return (1); @@ -599,7 +599,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -608,7 +608,7 @@ main(int argc, /* I - Number of command-line arguments */ if (printer == NULL) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Unable to set the printer " "description:\n" " You must specify a printer name " @@ -627,7 +627,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected description after " "\'-D\' option!\n")); return (1); @@ -643,13 +643,13 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected file type(s) after \'-I\' " "option!\n")); return (1); } - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Warning - content type list ignored!\n")); break; @@ -661,7 +661,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -670,7 +670,7 @@ main(int argc, /* I - Number of command-line arguments */ if (printer == NULL) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Unable to set the printer location:\n" " You must specify a printer name " "first!\n")); @@ -688,7 +688,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected location after \'-L\' " "option!\n")); return (1); @@ -707,7 +707,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -716,7 +716,7 @@ main(int argc, /* I - Number of command-line arguments */ if (printer == NULL) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Unable to set the PPD file:\n" " You must specify a printer name " "first!\n")); @@ -734,7 +734,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Expected PPD after \'-P\' option!\n")); return (1); } @@ -745,13 +745,13 @@ main(int argc, /* I - Number of command-line arguments */ break; default : - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unknown option \'%c\'!\n"), argv[i][1]); return (1); } else { - _cupsLangPrintf(stderr, NULL, _("lpadmin: Unknown argument \'%s\'!\n"), + _cupsLangPrintf(stderr, _("lpadmin: Unknown argument \'%s\'!\n"), argv[i]); return (1); } @@ -768,7 +768,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -777,7 +777,7 @@ main(int argc, /* I - Number of command-line arguments */ if (printer == NULL) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpadmin: Unable to set the printer options:\n" " You must specify a printer name first!\n")); return (1); @@ -789,7 +789,7 @@ main(int argc, /* I - Number of command-line arguments */ if (printer == NULL) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _("Usage:\n" "\n" " lpadmin [-h server] -d destination\n" @@ -825,7 +825,6 @@ add_printer_to_class(http_t *http, /* I - Server connection */ *response; /* IPP Response */ ipp_attribute_t *attr, /* Current attribute */ *members; /* Members in class */ - cups_lang_t *language; /* Default language */ char uri[HTTP_MAX_URI]; /* URI for printer/class */ @@ -841,22 +840,10 @@ add_printer_to_class(http_t *http, /* I - Server connection */ * printer-uri */ + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/classes/%s", pclass); - - request = ippNew(); - - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -876,18 +863,7 @@ add_printer_to_class(http_t *http, /* I - Server connection */ * member-uris */ - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_CLASS; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_ADD_CLASS); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -901,8 +877,9 @@ add_printer_to_class(http_t *http, /* I - Server connection */ for (i = 0; i < members->num_values; i ++) if (strcasecmp(printer, members->values[i].string.text) == 0) { - fprintf(stderr, "lpadmin: Printer %s is already a member of class %s.\n", - printer, pclass); + _cupsLangPrintf(stderr, + _("lpadmin: Printer %s is already a member of class %s.\n"), + printer, pclass); ippDelete(request); ippDelete(response); return (0); @@ -940,15 +917,13 @@ add_printer_to_class(http_t *http, /* I - Server connection */ if ((response = cupsDoRequest(http, request, "/admin/")) == NULL) { - fprintf(stderr, "lpadmin: add-class failed: %s\n", - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); return (1); } else if (response->request.status.status_code > IPP_OK_CONFLICT) { - fprintf(stderr, "lpadmin: add-class failed: %s\n", - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); ippDelete(response); @@ -973,7 +948,6 @@ default_printer(http_t *http, /* I - Server connection */ { ipp_t *request, /* IPP Request */ *response; /* IPP Response */ - cups_lang_t *language; /* Default language */ char uri[HTTP_MAX_URI]; /* URI for printer/class */ @@ -991,18 +965,7 @@ default_printer(http_t *http, /* I - Server connection */ httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); - request = ippNew(); - - request->request.op.operation_id = CUPS_SET_DEFAULT; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_SET_DEFAULT); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1013,15 +976,13 @@ default_printer(http_t *http, /* I - Server connection */ if ((response = cupsDoRequest(http, request, "/admin/")) == NULL) { - fprintf(stderr, "lpadmin: set-default failed: %s\n", - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); return (1); } else if (response->request.status.status_code > IPP_OK_CONFLICT) { - fprintf(stderr, "lpadmin: set-default failed: %s\n", - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); ippDelete(response); @@ -1046,7 +1007,6 @@ delete_printer(http_t *http, /* I - Server connection */ { ipp_t *request, /* IPP Request */ *response; /* IPP Response */ - cups_lang_t *language; /* Default language */ char uri[HTTP_MAX_URI]; /* URI for printer/class */ @@ -1061,22 +1021,10 @@ delete_printer(http_t *http, /* I - Server connection */ * printer-uri */ + request = ippNewRequest(CUPS_DELETE_PRINTER); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); - - request = ippNew(); - - request->request.op.operation_id = CUPS_DELETE_PRINTER; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1086,15 +1034,13 @@ delete_printer(http_t *http, /* I - Server connection */ if ((response = cupsDoRequest(http, request, "/admin/")) == NULL) { - fprintf(stderr, "lpadmin: delete-printer failed: %s\n", - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); return (1); } else if (response->request.status.status_code > IPP_OK_CONFLICT) { - fprintf(stderr, "lpadmin: delete-printer failed: %s\n", - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); ippDelete(response); @@ -1114,18 +1060,16 @@ delete_printer(http_t *http, /* I - Server connection */ */ static int /* O - 0 on success, 1 on fail */ -delete_printer_from_class(http_t *http, /* I - Server connection */ - char *printer, - /* I - Printer to remove */ - char *pclass) - /* I - Class to remove from */ +delete_printer_from_class( + http_t *http, /* I - Server connection */ + char *printer, /* I - Printer to remove */ + char *pclass) /* I - Class to remove from */ { int i, j, k; /* Looping vars */ ipp_t *request, /* IPP Request */ *response; /* IPP Response */ ipp_attribute_t *attr, /* Current attribute */ *members; /* Members in class */ - cups_lang_t *language; /* Default language */ char uri[HTTP_MAX_URI]; /* URI for printer/class */ @@ -1141,22 +1085,10 @@ delete_printer_from_class(http_t *http, /* I - Server connection */ * printer-uri */ + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/classes/%s", pclass); - - request = ippNew(); - - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1167,8 +1099,10 @@ delete_printer_from_class(http_t *http, /* I - Server connection */ if ((response = cupsDoRequest(http, request, "/classes/")) == NULL || response->request.status.status_code == IPP_NOT_FOUND) { + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); + ippDelete(response); - fprintf(stderr, "lpadmin: Class %s does not exist!\n", pclass); + return (1); } @@ -1178,20 +1112,25 @@ delete_printer_from_class(http_t *http, /* I - Server connection */ if ((members = ippFindAttribute(response, "member-names", IPP_TAG_NAME)) == NULL) { + _cupsLangPuts(stderr, _("lpadmin: No member names were seen!\n")); + ippDelete(response); - fputs("lpadmin: No member names were seen!\n", stderr); + return (1); } for (i = 0; i < members->num_values; i ++) - if (strcasecmp(printer, members->values[i].string.text) == 0) + if (!strcasecmp(printer, members->values[i].string.text)) break; if (i >= members->num_values) { - fprintf(stderr, "lpadmin: Printer %s is not a member of class %s.\n", - printer, pclass); + _cupsLangPrintf(stderr, + _("lpadmin: Printer %s is not a member of class %s.\n"), + printer, pclass); + ippDelete(response); + return (1); } @@ -1206,18 +1145,7 @@ delete_printer_from_class(http_t *http, /* I - Server connection */ * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = CUPS_DELETE_CLASS; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_DELETE_CLASS); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1234,18 +1162,7 @@ delete_printer_from_class(http_t *http, /* I - Server connection */ * member-uris */ - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_CLASS; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_ADD_CLASS); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1271,14 +1188,13 @@ delete_printer_from_class(http_t *http, /* I - Server connection */ if ((response = cupsDoRequest(http, request, "/admin/")) == NULL) { - fprintf(stderr, "lpadmin: add/delete-class failed: %s\n", - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); + return (1); } else if (response->request.status.status_code > IPP_OK_CONFLICT) { - fprintf(stderr, "lpadmin: add/delete-class failed: %s\n", - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); ippDelete(response); @@ -1303,7 +1219,6 @@ enable_printer(http_t *http, /* I - Server connection */ { ipp_t *request, /* IPP Request */ *response; /* IPP Response */ - cups_lang_t *language; /* Default language */ char uri[HTTP_MAX_URI]; /* URI for printer/class */ @@ -1320,22 +1235,10 @@ enable_printer(http_t *http, /* I - Server connection */ * printer-is-accepting-jobs */ + request = ippNewRequest(CUPS_ADD_PRINTER); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); - - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_PRINTER; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1350,14 +1253,13 @@ enable_printer(http_t *http, /* I - Server connection */ if ((response = cupsDoRequest(http, request, "/admin/")) == NULL) { - fprintf(stderr, "lpadmin: add-printer (enable) failed: %s\n", - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); + return (1); } else if (response->request.status.status_code > IPP_OK_CONFLICT) { - fprintf(stderr, "lpadmin: add-printer (enable) failed: %s\n", - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); ippDelete(response); @@ -1431,7 +1333,6 @@ set_printer_device(http_t *http, /* I - Server connection */ { ipp_t *request, /* IPP Request */ *response; /* IPP Response */ - cups_lang_t *language; /* Default language */ char uri[HTTP_MAX_URI]; /* URI for printer/class */ @@ -1447,22 +1348,10 @@ set_printer_device(http_t *http, /* I - Server connection */ * printer-uri */ + request = ippNewRequest(CUPS_ADD_PRINTER); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); - - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_PRINTER; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1476,7 +1365,7 @@ set_printer_device(http_t *http, /* I - Server connection */ * Convert filename to URI... */ - snprintf(uri, sizeof(uri), "file:%s", device); + snprintf(uri, sizeof(uri), "file://%s", device); ippAddString(request, IPP_TAG_PRINTER, IPP_TAG_URI, "device-uri", NULL, uri); } @@ -1490,14 +1379,13 @@ set_printer_device(http_t *http, /* I - Server connection */ if ((response = cupsDoRequest(http, request, "/admin/")) == NULL) { - fprintf(stderr, "lpadmin: add-printer (set device) failed: %s\n", - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); + return (1); } else if (response->request.status.status_code > IPP_OK_CONFLICT) { - fprintf(stderr, "lpadmin: add-printer (set device) failed: %s\n", - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); ippDelete(response); @@ -1521,10 +1409,8 @@ set_printer_file(http_t *http, /* I - Server connection */ char *printer, /* I - Printer */ char *file) /* I - PPD file or interface script */ { - ipp_status_t status; /* IPP status code */ ipp_t *request, /* IPP Request */ *response; /* IPP Response */ - cups_lang_t *language; /* Default language */ char uri[HTTP_MAX_URI]; /* URI for printer/class */ #ifdef HAVE_LIBZ char tempfile[1024]; /* Temporary filename */ @@ -1550,7 +1436,7 @@ set_printer_file(http_t *http, /* I - Server connection */ if ((fd = cupsTempFd(tempfile, sizeof(tempfile))) < 0) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to create temporary file: %s\n"), strerror(errno)); return (1); @@ -1558,7 +1444,7 @@ set_printer_file(http_t *http, /* I - Server connection */ if ((gz = gzopen(file, "rb")) == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to open file \"%s\": %s\n"), file, strerror(errno)); close(fd); @@ -1585,22 +1471,10 @@ set_printer_file(http_t *http, /* I - Server connection */ * printer-uri */ + request = ippNewRequest(CUPS_ADD_PRINTER); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); - - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_PRINTER; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1608,13 +1482,8 @@ set_printer_file(http_t *http, /* I - Server connection */ * Do the request and get back a response... */ - if ((response = cupsDoFileRequest(http, request, "/admin/", file)) == NULL) - status = cupsLastError(); - else - { - status = response->request.status.status_code; - ippDelete(response); - } + response = cupsDoFileRequest(http, request, "/admin/", file); + ippDelete(response); #ifdef HAVE_LIBZ /* @@ -1625,11 +1494,9 @@ set_printer_file(http_t *http, /* I - Server connection */ unlink(tempfile); #endif /* HAVE_LIBZ */ - if (status > IPP_OK_CONFLICT) + if (cupsLastError() > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, - _("lpadmin: add-printer (set model) failed: %s\n"), - ippErrorString(status)); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); return (1); } @@ -1649,7 +1516,6 @@ set_printer_info(http_t *http, /* I - Server connection */ { ipp_t *request, /* IPP Request */ *response; /* IPP Response */ - cups_lang_t *language; /* Default language */ char uri[HTTP_MAX_URI]; /* URI for printer/class */ @@ -1665,22 +1531,10 @@ set_printer_info(http_t *http, /* I - Server connection */ * printer-uri */ + request = ippNewRequest(CUPS_ADD_PRINTER); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); - - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_PRINTER; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1697,16 +1551,12 @@ set_printer_info(http_t *http, /* I - Server connection */ if ((response = cupsDoRequest(http, request, "/admin/")) == NULL) { - _cupsLangPrintf(stderr, NULL, - _("lpadmin: add-printer (set description) failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); return (1); } else if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, - _("lpadmin: add-printer (set description) failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); ippDelete(response); @@ -1732,7 +1582,6 @@ set_printer_location(http_t *http, /* I - Server connection */ { ipp_t *request, /* IPP Request */ *response; /* IPP Response */ - cups_lang_t *language; /* Default language */ char uri[HTTP_MAX_URI]; /* URI for printer/class */ @@ -1748,22 +1597,10 @@ set_printer_location(http_t *http, /* I - Server connection */ * printer-uri */ + request = ippNewRequest(CUPS_ADD_PRINTER); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); - - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_PRINTER; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1780,17 +1617,13 @@ set_printer_location(http_t *http, /* I - Server connection */ if ((response = cupsDoRequest(http, request, "/admin/")) == NULL) { - _cupsLangPrintf(stderr, NULL, - _("lpadmin: add-printer (set location) failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); return (1); } else if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, - _("lpadmin: add-printer (set location) failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); ippDelete(response); @@ -1816,7 +1649,6 @@ set_printer_model(http_t *http, /* I - Server connection */ { ipp_t *request, /* IPP Request */ *response; /* IPP Response */ - cups_lang_t *language; /* Default language */ char uri[HTTP_MAX_URI]; /* URI for printer/class */ @@ -1830,22 +1662,10 @@ set_printer_model(http_t *http, /* I - Server connection */ * ppd-name */ + request = ippNewRequest(CUPS_ADD_PRINTER); + httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); - - request = ippNew(); - - request->request.op.operation_id = CUPS_ADD_PRINTER; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1858,17 +1678,13 @@ set_printer_model(http_t *http, /* I - Server connection */ if ((response = cupsDoRequest(http, request, "/admin/")) == NULL) { - _cupsLangPrintf(stderr, NULL, - _("lpadmin: add-printer (set model) failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); return (1); } else if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, - _("lpadmin: add-printer (set model) failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); ippDelete(response); @@ -1888,18 +1704,15 @@ set_printer_model(http_t *http, /* I - Server connection */ */ static int /* O - 0 on success, 1 on fail */ -set_printer_options(http_t *http,/* I - Server connection */ - char *printer, - /* I - Printer */ - int num_options, - /* I - Number of options */ - cups_option_t *options) - /* I - Options */ +set_printer_options( + http_t *http, /* I - Server connection */ + char *printer, /* I - Printer */ + int num_options, /* I - Number of options */ + cups_option_t *options) /* I - Options */ { ipp_t *request, /* IPP Request */ *response; /* IPP Response */ ipp_attribute_t *attr; /* IPP attribute */ - cups_lang_t *language; /* Default language */ ipp_op_t op; /* Operation to perform */ const char *val, /* Option value */ *ppdfile; /* PPD filename */ @@ -1917,8 +1730,6 @@ set_printer_options(http_t *http,/* I - Server connection */ DEBUG_printf(("set_printer_options(%p, \"%s\", %d, %p)\n", http, printer, num_options, options)); - language = cupsLangDefault(); - httpAssembleURIf(uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer); @@ -1932,16 +1743,7 @@ set_printer_options(http_t *http,/* I - Server connection */ * requested-attributes */ - request = ippNew(); - - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -1984,16 +1786,7 @@ set_printer_options(http_t *http,/* I - Server connection */ * other options */ - request = ippNew(); - - request->request.op.operation_id = op; - request->request.op.request_id = 1; - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(op); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); @@ -2017,7 +1810,7 @@ set_printer_options(http_t *http,/* I - Server connection */ if ((outfd = cupsTempFd(tempfile, sizeof(tempfile))) < 0) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to create temporary file - %s\n"), strerror(errno)); ippDelete(request); @@ -2027,7 +1820,7 @@ set_printer_options(http_t *http,/* I - Server connection */ if ((in = fopen(ppdfile, "rb")) == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpadmin: Unable to open PPD file \"%s\" - %s\n"), ppdfile, strerror(errno)); ippDelete(request); @@ -2066,7 +1859,7 @@ set_printer_options(http_t *http,/* I - Server connection */ *keyptr = '\0'; - if (strcmp(keyword, "PageRegion") == 0) + if (!strcmp(keyword, "PageRegion")) val = cupsGetOption("PageSize", num_options, options); else val = cupsGetOption(keyword, num_options, options); @@ -2112,30 +1905,15 @@ set_printer_options(http_t *http,/* I - Server connection */ * Check the response... */ - if (response == NULL) - { - _cupsLangPrintf(stderr, NULL, _("lpadmin: %s failed: %s\n"), - op == CUPS_ADD_PRINTER ? "add-printer" : "add-class", - ippErrorString(cupsLastError())); - - return (1); - } - else if (response->request.status.status_code > IPP_OK_CONFLICT) + ippDelete(response); + if (cupsLastError() > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, _("lpadmin: %s failed: %s\n"), - op == CUPS_ADD_PRINTER ? "add-printer" : "add-class", - ippErrorString(response->request.status.status_code)); - - ippDelete(response); + _cupsLangPrintf(stderr, "lpadmin: %s\n", cupsLastErrorString()); return (1); } else - { - ippDelete(response); - return (0); - } } @@ -2143,10 +1921,10 @@ set_printer_options(http_t *http,/* I - Server connection */ * 'validate_name()' - Make sure the printer name only contains valid chars. */ -static int /* O - 0 if name is no good, 1 if name is good */ -validate_name(const char *name) /* I - Name to check */ +static int /* O - 0 if name is no good, 1 if name is good */ +validate_name(const char *name) /* I - Name to check */ { - const char *ptr; /* Pointer into name */ + const char *ptr; /* Pointer into name */ /* @@ -2169,5 +1947,5 @@ validate_name(const char *name) /* I - Name to check */ /* - * End of "$Id: lpadmin.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lpadmin.c 4925 2006-01-13 02:52:47Z mike $". */ diff --git a/systemv/lpinfo.c b/systemv/lpinfo.c index 41ffad2063..df8bef1aa9 100644 --- a/systemv/lpinfo.c +++ b/systemv/lpinfo.c @@ -1,5 +1,5 @@ /* - * "$Id: lpinfo.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lpinfo.c 4925 2006-01-13 02:52:47Z mike $" * * "lpinfo" command for the Common UNIX Printing System (CUPS). * @@ -76,7 +76,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http) httpEncryption(http, HTTP_ENCRYPT_REQUIRED); #else - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), argv[0]); #endif /* HAVE_SSL */ @@ -94,7 +94,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpinfo: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -113,7 +113,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpinfo: Unable to connect to server: %s\n"), strerror(errno)); return (1); @@ -139,7 +139,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("Error: need hostname after \'-h\' option!\n")); return (1); } @@ -149,13 +149,13 @@ main(int argc, /* I - Number of command-line arguments */ break; default : - _cupsLangPrintf(stderr, NULL, _("lpinfo: Unknown option \'%c\'!\n"), + _cupsLangPrintf(stderr, _("lpinfo: Unknown option \'%c\'!\n"), argv[i][1]); return (1); } else { - _cupsLangPrintf(stderr, NULL, _("lpinfo: Unknown argument \'%s\'!\n"), + _cupsLangPrintf(stderr, _("lpinfo: Unknown argument \'%s\'!\n"), argv[i]); return (1); } @@ -175,11 +175,11 @@ show_devices(http_t *http, /* I - HTTP connection to server */ ipp_t *request, /* IPP Request */ *response; /* IPP Response */ ipp_attribute_t *attr; /* Current attribute */ - cups_lang_t *language; /* Default language */ - const char *device_class, /* Pointer into device-class */ - *device_info, /* Pointer into device-info */ - *device_make, /* Pointer into device-make-and-model */ - *device_uri; /* Pointer into device-uri */ + const char *device_class, /* Pointer to device-class */ + *device_id, /* Pointer to device-id */ + *device_info, /* Pointer to device-info */ + *device_make, /* Pointer to device-make-and-model */ + *device_uri; /* Pointer to device-uri */ if (http == NULL) @@ -191,24 +191,9 @@ show_devices(http_t *http, /* I - HTTP connection to server */ * * attributes-charset * attributes-natural-language - * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = CUPS_GET_DEVICES; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", - NULL, "ipp://localhost/printers/"); + request = ippNewRequest(CUPS_GET_DEVICES); /* * Do the request and get back a response... @@ -222,8 +207,7 @@ show_devices(http_t *http, /* I - HTTP connection to server */ if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, _("lpinfo: cups-get-devices failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpinfo: %s\n", cupsLastErrorString()); ippDelete(response); return (1); } @@ -248,24 +232,25 @@ show_devices(http_t *http, /* I - HTTP connection to server */ device_info = NULL; device_make = NULL; device_uri = NULL; + device_id = "NONE"; while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) { if (!strcmp(attr->name, "device-class") && attr->value_tag == IPP_TAG_KEYWORD) device_class = attr->values[0].string.text; - - if (!strcmp(attr->name, "device-info") && - attr->value_tag == IPP_TAG_TEXT) + else if (!strcmp(attr->name, "device-info") && + attr->value_tag == IPP_TAG_TEXT) device_info = attr->values[0].string.text; - - if (!strcmp(attr->name, "device-make-and-model") && - attr->value_tag == IPP_TAG_TEXT) + else if (!strcmp(attr->name, "device-make-and-model") && + attr->value_tag == IPP_TAG_TEXT) device_make = attr->values[0].string.text; - - if (!strcmp(attr->name, "device-uri") && - attr->value_tag == IPP_TAG_URI) + else if (!strcmp(attr->name, "device-uri") && + attr->value_tag == IPP_TAG_URI) device_uri = attr->values[0].string.text; + else if (!strcmp(attr->name, "device-id") && + attr->value_tag == IPP_TAG_TEXT) + device_id = attr->values[0].string.text; attr = attr->next; } @@ -289,15 +274,17 @@ show_devices(http_t *http, /* I - HTTP connection to server */ if (long_status) { - _cupsLangPrintf(stdout, language, + _cupsLangPrintf(stdout, _("Device: uri = %s\n" " class = %s\n" " info = %s\n" - " make-and-model = %s\n"), - device_uri, device_class, device_info, device_make); + " make-and-model = %s\n" + " device-id = %s\n"), + device_uri, device_class, device_info, device_make, + device_id); } else - _cupsLangPrintf(stdout, language, "%s %s\n", device_class, device_uri); + _cupsLangPrintf(stdout, "%s %s\n", device_class, device_uri); if (attr == NULL) break; @@ -307,8 +294,7 @@ show_devices(http_t *http, /* I - HTTP connection to server */ } else { - _cupsLangPrintf(stderr, NULL, _("lpinfo: cups-get-devices failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpinfo: %s\n", cupsLastErrorString()); return (1); } @@ -327,10 +313,10 @@ show_models(http_t *http, /* I - HTTP connection to server */ ipp_t *request, /* IPP Request */ *response; /* IPP Response */ ipp_attribute_t *attr; /* Current attribute */ - cups_lang_t *language; /* Default language */ - const char *ppd_language, /* Pointer into ppd-natural-language */ - *ppd_make, /* Pointer into ppd-make-and-model */ - *ppd_name; /* Pointer into ppd-name */ + const char *ppd_device_id, /* Pointer to ppd-device-id */ + *ppd_language, /* Pointer to ppd-natural-language */ + *ppd_make, /* Pointer to ppd-make-and-model */ + *ppd_name; /* Pointer to ppd-name */ if (http == NULL) @@ -342,24 +328,9 @@ show_models(http_t *http, /* I - HTTP connection to server */ * * attributes-charset * attributes-natural-language - * printer-uri */ - request = ippNew(); - - request->request.op.operation_id = CUPS_GET_PPDS; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", - NULL, "ipp://localhost/printers/"); + request = ippNewRequest(CUPS_GET_PPDS); /* * Do the request and get back a response... @@ -373,8 +344,7 @@ show_models(http_t *http, /* I - HTTP connection to server */ if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, _("lpinfo: cups-get-ppds failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpinfo: %s\n", cupsLastErrorString()); ippDelete(response); return (1); } @@ -395,22 +365,24 @@ show_models(http_t *http, /* I - HTTP connection to server */ * Pull the needed attributes from this PPD... */ - ppd_language = NULL; - ppd_make = NULL; - ppd_name = NULL; + ppd_device_id = "NONE"; + ppd_language = NULL; + ppd_make = NULL; + ppd_name = NULL; while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) { - if (!strcmp(attr->name, "ppd-natural-language") && - attr->value_tag == IPP_TAG_LANGUAGE) - ppd_language = attr->values[0].string.text; - - if (!strcmp(attr->name, "ppd-make-and-model") && + if (!strcmp(attr->name, "ppd-device-id") && attr->value_tag == IPP_TAG_TEXT) + ppd_device_id = attr->values[0].string.text; + else if (!strcmp(attr->name, "ppd-natural-language") && + attr->value_tag == IPP_TAG_LANGUAGE) + ppd_language = attr->values[0].string.text; + else if (!strcmp(attr->name, "ppd-make-and-model") && + attr->value_tag == IPP_TAG_TEXT) ppd_make = attr->values[0].string.text; - - if (!strcmp(attr->name, "ppd-name") && - attr->value_tag == IPP_TAG_NAME) + else if (!strcmp(attr->name, "ppd-name") && + attr->value_tag == IPP_TAG_NAME) ppd_name = attr->values[0].string.text; attr = attr->next; @@ -434,14 +406,15 @@ show_models(http_t *http, /* I - HTTP connection to server */ if (long_status) { - _cupsLangPrintf(stdout, language, + _cupsLangPrintf(stdout, _("Model: name = %s\n" " natural_language = %s\n" - " make-and-model = %s\n"), - ppd_name, ppd_language, ppd_make); + " make-and-model = %s\n" + " device-id = %s\n"), + ppd_name, ppd_language, ppd_make, ppd_device_id); } else - _cupsLangPrintf(stdout, language, "%s %s\n", ppd_name, ppd_make); + _cupsLangPrintf(stdout, "%s %s\n", ppd_name, ppd_make); if (attr == NULL) break; @@ -451,8 +424,7 @@ show_models(http_t *http, /* I - HTTP connection to server */ } else { - _cupsLangPrintf(stderr, NULL, _("lpinfo: cups-get-ppds failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpinfo: %s\n", cupsLastErrorString()); return (1); } @@ -462,5 +434,5 @@ show_models(http_t *http, /* I - HTTP connection to server */ /* - * End of "$Id: lpinfo.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lpinfo.c 4925 2006-01-13 02:52:47Z mike $". */ diff --git a/systemv/lpmove.c b/systemv/lpmove.c index 5980a972d5..27889fbd0b 100644 --- a/systemv/lpmove.c +++ b/systemv/lpmove.c @@ -1,5 +1,5 @@ /* - * "$Id: lpmove.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lpmove.c 4945 2006-01-18 21:41:17Z mike $" * * "lpmove" command for the Common UNIX Printing System (CUPS). * @@ -44,7 +44,8 @@ * Local functions... */ -static void move_job(http_t *, int, const char *); +static int move_job(http_t *http, const char *src, int jobid, + const char *dest); /* @@ -58,16 +59,20 @@ main(int argc, /* I - Number of command-line arguments */ int i; /* Looping var */ http_t *http; /* Connection to server */ const char *job; /* Job name */ + int jobid; /* Job ID */ int num_dests; /* Number of destinations */ cups_dest_t *dests; /* Destinations */ - const char *dest; /* New destination */ + const char *src, /* Original queue */ + *dest; /* New destination */ + dest = NULL; + dests = NULL; http = NULL; job = NULL; - dest = NULL; + jobid = 0; num_dests = 0; - dests = NULL; + src = NULL; for (i = 1; i < argc; i ++) if (argv[i][0] == '-') @@ -80,7 +85,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http) httpEncryption(http, HTTP_ENCRYPT_REQUIRED); #else - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), argv[0]); #endif /* HAVE_SSL */ @@ -101,7 +106,7 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("Error: need hostname after \'-h\' option!\n")); return (1); } @@ -111,33 +116,33 @@ main(int argc, /* I - Number of command-line arguments */ break; default : - _cupsLangPrintf(stderr, NULL, _("lpmove: Unknown option \'%c\'!\n"), + _cupsLangPrintf(stderr, _("lpmove: Unknown option \'%c\'!\n"), argv[i][1]); return (1); } - else if (job == NULL) + else if (!jobid && !src) { if (num_dests == 0) num_dests = cupsGetDests(&dests); if ((job = strrchr(argv[i], '-')) != NULL && cupsGetDest(argv[i], NULL, num_dests, dests) == NULL) - job ++; + jobid = atoi(job + 1); else - job = argv[i]; + src = argv[i]; } else if (dest == NULL) dest = argv[i]; else { - _cupsLangPrintf(stderr, NULL, _("lpmove: Unknown argument \'%s\'!\n"), + _cupsLangPrintf(stderr, _("lpmove: Unknown argument \'%s\'!\n"), argv[i]); return (1); } - if (job == NULL || dest == NULL) + if ((!jobid && !src) || !dest) { - _cupsLangPuts(stdout, NULL, _("Usage: lpmove job dest\n")); + _cupsLangPuts(stdout, _("Usage: lpmove job/src dest\n")); return (1); } @@ -147,16 +152,14 @@ main(int argc, /* I - Number of command-line arguments */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpmove: Unable to connect to server: %s\n"), strerror(errno)); return (1); } } - move_job(http, atoi(job), dest); - - return (0); + return (move_job(http, src, jobid, dest)); } @@ -164,21 +167,19 @@ main(int argc, /* I - Number of command-line arguments */ * 'move_job()' - Move a job. */ -static void +static int /* O - 0 on success, 1 on error */ move_job(http_t *http, /* I - HTTP connection to server */ + const char *src, /* I - Source queue */ int jobid, /* I - Job ID */ - const char *dest) /* I - Destination */ + const char *dest) /* I - Destination queue */ { - ipp_t *request, /* IPP Request */ - *response; /* IPP Response */ - cups_lang_t *language; /* Default language */ - char job_uri[HTTP_MAX_URI], /* job-uri */ - printer_uri[HTTP_MAX_URI]; - /* job-printer-uri */ + ipp_t *request; /* IPP Request */ + char job_uri[HTTP_MAX_URI], /* job-uri */ + printer_uri[HTTP_MAX_URI]; /* job-printer-uri */ - if (http == NULL) - return; + if (!http) + return (1); /* * Build a CUPS_MOVE_JOB request, which requires the following @@ -186,25 +187,26 @@ move_job(http_t *http, /* I - HTTP connection to server */ * * attributes-charset * attributes-natural-language - * job-uri + * job-uri/printer-uri * job-printer-uri + * requesting-user-name */ - request = ippNew(); - - request->request.op.operation_id = CUPS_MOVE_JOB; - request->request.op.request_id = 1; - - language = cupsLangDefault(); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, cupsLangEncoding(language)); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, - "attributes-natural-language", NULL, language->language); + request = ippNewRequest(CUPS_MOVE_JOB); - snprintf(job_uri, sizeof(job_uri), "ipp://localhost/jobs/%d", jobid); - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, job_uri); + if (jobid) + { + snprintf(job_uri, sizeof(job_uri), "ipp://localhost/jobs/%d", jobid); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, + job_uri); + } + else + { + httpAssembleURIf(job_uri, sizeof(job_uri), "ipp", NULL, "localhost", 0, + "/printers/%s", src); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, + job_uri); + } ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser()); @@ -218,24 +220,18 @@ move_job(http_t *http, /* I - HTTP connection to server */ * Do the request and get back a response... */ - if ((response = cupsDoRequest(http, request, "/jobs")) != NULL) - { - if (response->request.status.status_code > IPP_OK_CONFLICT) - { - _cupsLangPrintf(stderr, NULL, _("lpmove: move-job failed: %s\n"), - ippErrorString(response->request.status.status_code)); - ippDelete(response); - return; - } + ippDelete(cupsDoRequest(http, request, "/jobs")); - ippDelete(response); + if (cupsLastError() > IPP_OK_CONFLICT) + { + _cupsLangPrintf(stderr, "lpmove: %s\n", cupsLastErrorString()); + return (1); } else - _cupsLangPrintf(stderr, NULL, _("lpmove: move-job failed: %s\n"), - ippErrorString(cupsLastError())); + return (0); } /* - * End of "$Id: lpmove.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lpmove.c 4945 2006-01-18 21:41:17Z mike $". */ diff --git a/systemv/lpoptions.c b/systemv/lpoptions.c index 3792ab499b..8e6441d8a5 100644 --- a/systemv/lpoptions.c +++ b/systemv/lpoptions.c @@ -1,5 +1,5 @@ /* - * "$Id: lpoptions.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lpoptions.c 4924 2006-01-13 01:55:20Z mike $" * * Printer option program for the Common UNIX Printing System (CUPS). * @@ -105,7 +105,7 @@ main(int argc, /* I - Number of command-line arguments */ if ((dest = cupsGetDest(printer, instance, num_dests, dests)) == NULL) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lpoptions: Unknown printer or class!\n")); return (1); } @@ -156,7 +156,7 @@ main(int argc, /* I - Number of command-line arguments */ } if (dest == NULL) - _cupsLangPuts(stderr, NULL, _("lpoptions: No printers!?!\n")); + _cupsLangPuts(stderr, _("lpoptions: No printers!?!\n")); else list_options(dest); @@ -203,7 +203,7 @@ main(int argc, /* I - Number of command-line arguments */ if (dest == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpoptions: Unable to add printer or " "instance: %s\n"), strerror(errno)); @@ -342,20 +342,20 @@ main(int argc, /* I - Number of command-line arguments */ for (i = 0; i < num_options; i ++) { if (i) - _cupsLangPuts(stdout, NULL, " "); + _cupsLangPuts(stdout, " "); if (!options[i].value[0]) - _cupsLangPrintf(stdout, NULL, "%s", options[i].name); + _cupsLangPrintf(stdout, "%s", options[i].name); else if (strchr(options[i].value, ' ') != NULL || strchr(options[i].value, '\t') != NULL) - _cupsLangPrintf(stdout, NULL, "%s=\'%s\'", options[i].name, + _cupsLangPrintf(stdout, "%s=\'%s\'", options[i].name, options[i].value); else - _cupsLangPrintf(stdout, NULL, "%s=%s", options[i].name, + _cupsLangPrintf(stdout, "%s=%s", options[i].name, options[i].value); } - _cupsLangPuts(stdout, NULL, "\n"); + _cupsLangPuts(stdout, "\n"); } return (0); @@ -376,15 +376,15 @@ list_group(ppd_group_t *group) /* I - Group to show */ for (i = group->num_options, option = group->options; i > 0; i --, option ++) { - _cupsLangPrintf(stdout, NULL, "%s/%s:", option->keyword, option->text); + _cupsLangPrintf(stdout, "%s/%s:", option->keyword, option->text); for (j = option->num_choices, choice = option->choices; j > 0; j --, choice ++) if (choice->marked) - _cupsLangPrintf(stdout, NULL, " *%s", choice->choice); + _cupsLangPrintf(stdout, " *%s", choice->choice); else - _cupsLangPrintf(stdout, NULL, " %s", choice->choice); + _cupsLangPrintf(stdout, " %s", choice->choice); - _cupsLangPuts(stdout, NULL, "\n"); + _cupsLangPuts(stdout, "\n"); } for (i = group->num_subgroups, subgroup = group->subgroups; i > 0; i --, subgroup ++) @@ -407,7 +407,7 @@ list_options(cups_dest_t *dest) /* I - Destination to list */ if ((filename = cupsGetPPD(dest->name)) == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpoptions: Destination %s has no PPD file!\n"), dest->name); return; @@ -416,7 +416,7 @@ list_options(cups_dest_t *dest) /* I - Destination to list */ if ((ppd = ppdOpenFile(filename)) == NULL) { unlink(filename); - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lpoptions: Unable to open PPD file for %s!\n"), dest->name); return; @@ -440,7 +440,7 @@ list_options(cups_dest_t *dest) /* I - Destination to list */ void usage(void) { - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _("Usage: lpoptions [-h server] [-E] -d printer\n" " lpoptions [-h server] [-E] [-p printer] -l\n" " lpoptions [-h server] [-E] -p printer -o " @@ -452,5 +452,5 @@ usage(void) /* - * End of "$Id: lpoptions.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lpoptions.c 4924 2006-01-13 01:55:20Z mike $". */ diff --git a/systemv/lppasswd.c b/systemv/lppasswd.c index 306d29ff51..d9822a07e1 100644 --- a/systemv/lppasswd.c +++ b/systemv/lppasswd.c @@ -1,5 +1,5 @@ /* - * "$Id: lppasswd.c 4906 2006-01-10 20:53:28Z mike $" + * "$Id: lppasswd.c 4924 2006-01-13 01:55:20Z mike $" * * MD5 password program for the Common UNIX Printing System (CUPS). * @@ -188,7 +188,7 @@ main(int argc, /* I - Number of command-line arguments */ if (getuid() && getuid() != geteuid() && (op != CHANGE || username)) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lppasswd: Only root can add or delete passwords!\n")); return (1); } @@ -214,7 +214,7 @@ main(int argc, /* I - Number of command-line arguments */ if ((oldpass = strdup(passwd)) == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: Unable to copy password string: %s\n"), strerror(errno)); return (1); @@ -232,7 +232,7 @@ main(int argc, /* I - Number of command-line arguments */ if ((newpass = strdup(passwd)) == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: Unable to copy password string: %s\n"), strerror(errno)); return (1); @@ -243,7 +243,7 @@ main(int argc, /* I - Number of command-line arguments */ if (strcmp(passwd, newpass) != 0) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lppasswd: Sorry, passwords don't match!\n")); return (1); } @@ -267,7 +267,7 @@ main(int argc, /* I - Number of command-line arguments */ if (strlen(newpass) < 6 || strstr(newpass, username) != NULL || flag != 3) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lppasswd: Sorry, password rejected.\n" "Your password must be at least 6 characters long, " "cannot contain\n" @@ -318,9 +318,9 @@ main(int argc, /* I - Number of command-line arguments */ if ((fd = open(passwdnew, O_WRONLY | O_CREAT | O_EXCL, 0400)) < 0) { if (errno == EEXIST) - _cupsLangPuts(stderr, NULL, _("lppasswd: Password file busy!\n")); + _cupsLangPuts(stderr, _("lppasswd: Password file busy!\n")); else - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: Unable to open password file: %s\n"), strerror(errno)); @@ -329,7 +329,7 @@ main(int argc, /* I - Number of command-line arguments */ if ((outfile = fdopen(fd, "w")) == NULL) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: Unable to open password file: %s\n"), strerror(errno)); @@ -347,7 +347,7 @@ main(int argc, /* I - Number of command-line arguments */ infile = fopen(passwdmd5, "r"); if (infile == NULL && errno != ENOENT && op != ADD) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: Unable to open password file: %s\n"), strerror(errno)); @@ -382,7 +382,7 @@ main(int argc, /* I - Number of command-line arguments */ if (fputs(line, outfile) == EOF) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: Unable to write to password file: %s\n"), strerror(errno)); error = 1; @@ -395,7 +395,7 @@ main(int argc, /* I - Number of command-line arguments */ while (fgets(line, sizeof(line), infile) != NULL) if (fputs(line, outfile) == EOF) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: Unable to write to password file: %s\n"), strerror(errno)); error = 1; @@ -407,7 +407,7 @@ main(int argc, /* I - Number of command-line arguments */ if (op == CHANGE && (strcmp(username, userline) || strcmp(groupname, groupline))) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: user \"%s\" and group \"%s\" do not exist.\n"), username, groupname); error = 1; @@ -417,7 +417,7 @@ main(int argc, /* I - Number of command-line arguments */ if (oldpass && strcmp(httpMD5(username, "CUPS", oldpass, md5new), md5line) != 0) { - _cupsLangPuts(stderr, NULL, + _cupsLangPuts(stderr, _("lppasswd: Sorry, password doesn't match!\n")); error = 1; } @@ -427,7 +427,7 @@ main(int argc, /* I - Number of command-line arguments */ httpMD5(username, "CUPS", newpass, md5new)); if (fputs(line, outfile) == EOF) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: Unable to write to password file: %s\n"), strerror(errno)); error = 1; @@ -451,7 +451,7 @@ main(int argc, /* I - Number of command-line arguments */ if (error) { - _cupsLangPuts(stderr, NULL, _("lppasswd: Password file not updated!\n")); + _cupsLangPuts(stderr, _("lppasswd: Password file not updated!\n")); unlink(passwdnew); @@ -465,7 +465,7 @@ main(int argc, /* I - Number of command-line arguments */ unlink(passwdold); if (link(passwdmd5, passwdold) && errno != ENOENT) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: failed to backup old password file: %s\n"), strerror(errno)); unlink(passwdnew); @@ -478,7 +478,7 @@ main(int argc, /* I - Number of command-line arguments */ if (rename(passwdnew, passwdmd5) < 0) { - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("lppasswd: failed to rename password file: %s\n"), strerror(errno)); unlink(passwdnew); @@ -497,21 +497,17 @@ static void usage(FILE *fp) /* I - File to send usage to */ { if (getuid()) - { - _cupsLangPuts(fp, NULL, _("Usage: lppasswd [-g groupname]\n")); - } + _cupsLangPuts(fp, _("Usage: lppasswd [-g groupname]\n")); else - { - _cupsLangPuts(fp, NULL, + _cupsLangPuts(fp, _("Usage: lppasswd [-g groupname] [username]\n" " lppasswd [-g groupname] -a [username]\n" " lppasswd [-g groupname] -x [username]\n")); - } exit(1); } /* - * End of "$Id: lppasswd.c 4906 2006-01-10 20:53:28Z mike $". + * End of "$Id: lppasswd.c 4924 2006-01-13 01:55:20Z mike $". */ diff --git a/systemv/lpstat.c b/systemv/lpstat.c index d789f04e72..ca02571eb4 100644 --- a/systemv/lpstat.c +++ b/systemv/lpstat.c @@ -1,5 +1,5 @@ /* - * "$Id: lpstat.c 4922 2006-01-12 22:05:06Z mike $" + * "$Id: lpstat.c 4948 2006-01-19 03:23:41Z mike $" * * "lpstat" command for the Common UNIX Printing System (CUPS). * @@ -52,8 +52,9 @@ * Local functions... */ -static void check_dest(http_t *, const char *, int *, cups_dest_t **); -static http_t *connect_server(http_t *); +static void check_dest(const char *, http_t *, const char *, int *, + cups_dest_t **); +static http_t *connect_server(const char *, http_t *); static int show_accepting(http_t *, const char *, int, cups_dest_t *); static int show_classes(http_t *, const char *); static void show_default(int, cups_dest_t *); @@ -111,7 +112,7 @@ main(int argc, /* I - Number of command-line arguments */ if (http) httpEncryption(http, HTTP_ENCRYPT_REQUIRED); #else - _cupsLangPrintf(stderr, NULL, + _cupsLangPrintf(stderr, _("%s: Sorry, no encryption support compiled in!\n"), argv[0]); #endif /* HAVE_SSL */ @@ -131,6 +132,25 @@ main(int argc, /* I - Number of command-line arguments */ i ++; break; + case 'U' : /* Username */ + if (argv[i][2] != '\0') + cupsSetUser(argv[i] + 2); + else + { + i ++; + if (i >= argc) + { + _cupsLangPrintf(stderr, + _("%s: Error - expected username after " + "\'-U\' option!\n"), + argv[0]); + return (1); + } + + cupsSetUser(argv[i]); + } + break; + case 'W' : /* Show which jobs? */ if (argv[i][2]) which = argv[i] + 2; @@ -140,31 +160,36 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("lpstat: Need \"completed\" or " - "\"not-completed\" after -W!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - need \"completed\", " + "\"not-completed\", or \"all\" after " + "\'-W\' option!\n"), + argv[0]); return (1); } which = argv[i]; } - if (strcmp(which, "completed") && strcmp(which, "not-completed")) + if (strcmp(which, "completed") && strcmp(which, "not-completed") && + strcmp(which, "all")) { - _cupsLangPuts(stderr, NULL, - _("lpstat: Need \"completed\" or " - "\"not-completed\" after -W!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - need \"completed\", " + "\"not-completed\", or \"all\" after " + "\'-W\' option!\n"), + argv[0]); return (1); } break; case 'a' : /* Show acceptance status */ op = 'a'; - http = connect_server(http); + http = connect_server(argv[0], http); if (argv[i][2] != '\0') { - check_dest(http, argv[i] + 2, &num_dests, &dests); + check_dest(argv[0], http, argv[i] + 2, &num_dests, &dests); status |= show_accepting(http, argv[i] + 2, num_dests, dests); } @@ -172,7 +197,7 @@ main(int argc, /* I - Number of command-line arguments */ { i ++; - check_dest(http, argv[i], &num_dests, &dests); + check_dest(argv[0], http, argv[i], &num_dests, &dests); status |= show_accepting(http, argv[i], num_dests, dests); } @@ -188,7 +213,7 @@ main(int argc, /* I - Number of command-line arguments */ #ifdef __sgi case 'b' : /* Show both the local and remote status */ op = 'b'; - http = connect_server(http); + http = connect_server(argv[0], http); if (argv[i][2] != '\0') { @@ -201,16 +226,17 @@ main(int argc, /* I - Number of command-line arguments */ * happy... */ - check_dest(http, argv[i] + 2, &num_dests, &dests); + check_dest(argv[0], http, argv[i] + 2, &num_dests, &dests); puts(""); status |= show_jobs(http, argv[i] + 2, NULL, 3, ranking, which); } else { - _cupsLangPuts(stderr, NULL, - _("lpstat: The -b option requires a destination " - "argument.\n")); + _cupsLangPuts(stderr, + _("%s: Error - expected destination after " + "\'-b\' option!\n"), + argv[0]); return (1); } @@ -219,11 +245,11 @@ main(int argc, /* I - Number of command-line arguments */ case 'c' : /* Show classes and members */ op = 'c'; - http = connect_server(http); + http = connect_server(argv[0], http); if (argv[i][2] != '\0') { - check_dest(http, argv[i] + 2, &num_dests, &dests); + check_dest(argv[0], http, argv[i] + 2, &num_dests, &dests); status |= show_classes(http, argv[i] + 2); } @@ -231,7 +257,7 @@ main(int argc, /* I - Number of command-line arguments */ { i ++; - check_dest(http, argv[i], &num_dests, &dests); + check_dest(argv[0], http, argv[i], &num_dests, &dests); status |= show_classes(http, argv[i]); } @@ -241,7 +267,7 @@ main(int argc, /* I - Number of command-line arguments */ case 'd' : /* Show default destination */ op = 'd'; - http = connect_server(http); + http = connect_server(argv[0], http); if (num_dests == 0) num_dests = cupsGetDests2(http, &dests); @@ -270,8 +296,10 @@ main(int argc, /* I - Number of command-line arguments */ if (i >= argc) { - _cupsLangPuts(stderr, NULL, - _("Error: need hostname after \'-h\' option!\n")); + _cupsLangPrintf(stderr, + _("%s: Error - expected hostname after " + "\'-h\' option!\n"), + argv[0]); return (1); } @@ -282,11 +310,11 @@ main(int argc, /* I - Number of command-line arguments */ case 'l' : /* Long status or long job status */ #ifdef __sgi op = 'l'; - http = connect_server(http); + http = connect_server(argv[0], http); if (argv[i][2] != '\0') { - check_dest(http, argv[i] + 2, &num_dests, &dests); + check_dest(argv[0], http, argv[i] + 2, &num_dests, &dests); status |= show_jobs(http, argv[i] + 2, NULL, 3, ranking, which); } @@ -297,11 +325,11 @@ main(int argc, /* I - Number of command-line arguments */ case 'o' : /* Show jobs by destination */ op = 'o'; - http = connect_server(http); + http = connect_server(argv[0], http); if (argv[i][2] != '\0') { - check_dest(http, argv[i] + 2, &num_dests, &dests); + check_dest(argv[0], http, argv[i] + 2, &num_dests, &dests); status |= show_jobs(http, argv[i] + 2, NULL, long_status, ranking, which); @@ -310,7 +338,7 @@ main(int argc, /* I - Number of command-line arguments */ { i ++; - check_dest(http, argv[i], &num_dests, &dests); + check_dest(argv[0], http, argv[i], &num_dests, &dests); status |= show_jobs(http, argv[i], NULL, long_status, ranking, which); @@ -322,11 +350,11 @@ main(int argc, /* I - Number of command-line arguments */ case 'p' : /* Show printers */ op = 'p'; - http = connect_server(http); + http = connect_server(argv[0], http); if (argv[i][2] != '\0') { - check_dest(http, argv[i] + 2, &num_dests, &dests); + check_dest(argv[0], http, argv[i] + 2, &num_dests, &dests); status |= show_printers(http, argv[i] + 2, num_dests, dests, long_status); } @@ -334,7 +362,7 @@ main(int argc, /* I - Number of command-line arguments */ { i ++; - check_dest(http, argv[i], &num_dests, &dests); + check_dest(argv[0], http, argv[i], &num_dests, &dests); status |= show_printers(http, argv[i], num_dests, dests, long_status); } @@ -349,14 +377,14 @@ main(int argc, /* I - Number of command-line arguments */ case 'r' : /* Show scheduler status */ op = 'r'; - http = connect_server(http); + http = connect_server(argv[0], http); show_scheduler(http); break; case 's' : /* Show summary */ op = 's'; - http = connect_server(http); + http = connect_server(argv[0], http); if (num_dests == 0) num_dests = cupsGetDests2(http, &dests); @@ -368,7 +396,7 @@ main(int argc, /* I - Number of command-line arguments */ case 't' : /* Show all info */ op = 't'; - http = connect_server(http); + http = connect_server(argv[0], http); if (num_dests == 0) num_dests = cupsGetDests2(http, &dests); @@ -384,7 +412,7 @@ main(int argc, /* I - Number of command-line arguments */ case 'u' : /* Show jobs by user */ op = 'u'; - http = connect_server(http); + http = connect_server(argv[0], http); if (argv[i][2] != '\0') status |= show_jobs(http, NULL, argv[i] + 2, long_status, @@ -402,11 +430,11 @@ main(int argc, /* I - Number of command-line arguments */ case 'v' : /* Show printer devices */ op = 'v'; - http = connect_server(http); + http = connect_server(argv[0], http); if (argv[i][2] != '\0') { - check_dest(http, argv[i] + 2, &num_dests, &dests); + check_dest(argv[0], http, argv[i] + 2, &num_dests, &dests); status |= show_devices(http, argv[i] + 2, num_dests, dests); } @@ -414,7 +442,7 @@ main(int argc, /* I - Number of command-line arguments */ { i ++; - check_dest(http, argv[i], &num_dests, &dests); + check_dest(argv[0], http, argv[i], &num_dests, &dests); status |= show_devices(http, argv[i], num_dests, dests); } @@ -429,13 +457,14 @@ main(int argc, /* I - Number of command-line arguments */ default : - _cupsLangPrintf(stderr, NULL, - _("lpstat: Unknown option \'%c\'!\n"), argv[i][1]); + _cupsLangPrintf(stderr, + _("%s: Error - unknown option \'%c\'!\n"), + argv[0], argv[i][1]); return (1); } else { - http = connect_server(http); + http = connect_server(argv[0], http); status |= show_jobs(http, argv[i], NULL, long_status, ranking, which); op = 'o'; @@ -443,7 +472,7 @@ main(int argc, /* I - Number of command-line arguments */ if (!op) { - http = connect_server(http); + http = connect_server(argv[0], http); status |= show_jobs(http, NULL, cupsUser(), long_status, ranking, which); } @@ -457,7 +486,8 @@ main(int argc, /* I - Number of command-line arguments */ */ static void -check_dest(http_t *http, /* I - HTTP connection */ +check_dest(const char *command, /* I - Command name */ + http_t *http, /* I - HTTP connection */ const char *name, /* I - Name of printer/class(es) */ int *num_dests, /* IO - Number of destinations */ cups_dest_t **dests) /* IO - Destinations */ @@ -500,9 +530,9 @@ check_dest(http_t *http, /* I - HTTP connection */ *pptr++ = *dptr++; else { - _cupsLangPrintf(stderr, NULL, - _("lpstat: Invalid destination name in list \"%s\"!\n"), - name); + _cupsLangPrintf(stderr, + _("%s: Invalid destination name in list \"%s\"!\n"), + command, name); exit(1); } } @@ -515,8 +545,8 @@ check_dest(http_t *http, /* I - HTTP connection */ if (cupsGetDest(printer, NULL, *num_dests, *dests) == NULL) { - _cupsLangPrintf(stderr, NULL, - _("lpstat: Unknown destination \"%s\"!\n"), printer); + _cupsLangPrintf(stderr, + _("%s: Unknown destination \"%s\"!\n"), command, printer); exit(1); } } @@ -528,7 +558,8 @@ check_dest(http_t *http, /* I - HTTP connection */ */ static http_t * /* O - New HTTP connection */ -connect_server(http_t *http) /* I - Current HTTP connection */ +connect_server(const char *command, /* I - Command name */ + http_t *http) /* I - Current HTTP connection */ { if (!http) { @@ -537,9 +568,7 @@ connect_server(http_t *http) /* I - Current HTTP connection */ if (http == NULL) { - _cupsLangPrintf(stderr, NULL, - _("lpstat: Unable to connect to server %s on port %d: %s\n"), - cupsServer(), ippPort(), strerror(errno)); + _cupsLangPrintf(stderr, _("%s: Unable to connect to server\n"), command); exit(1); } } @@ -565,12 +594,16 @@ show_accepting(http_t *http, /* I - HTTP connection to server */ const char *printer, /* Printer name */ *message; /* Printer device URI */ int accepting; /* Accepting requests? */ + time_t ptime; /* Printer state time */ + struct tm *pdate; /* Printer state date & time */ + char printer_state_time[255];/* Printer state time */ const char *dptr, /* Pointer into destination list */ *ptr; /* Pointer into printer name */ int match; /* Non-zero if this job matches */ static const char *pattrs[] = /* Attributes we need for printers... */ { "printer-name", + "printer-state-change-time", "printer-state-message", "printer-is-accepting-jobs" }; @@ -581,7 +614,7 @@ show_accepting(http_t *http, /* I - HTTP connection to server */ if (http == NULL) return (1); - if (printers != NULL && strcmp(printers, "all") == 0) + if (printers != NULL && !strcmp(printers, "all")) printers = NULL; /* @@ -591,6 +624,7 @@ show_accepting(http_t *http, /* I - HTTP connection to server */ * attributes-charset * attributes-natural-language * requested-attributes + * requesting-user-name */ request = ippNewRequest(CUPS_GET_PRINTERS); @@ -599,6 +633,9 @@ show_accepting(http_t *http, /* I - HTTP connection to server */ "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]), NULL, pattrs); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", + NULL, cupsUser()); + /* * Do the request and get back a response... */ @@ -609,9 +646,7 @@ show_accepting(http_t *http, /* I - HTTP connection to server */ if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, - _("lpstat: get-printers failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString()); ippDelete(response); return (1); } @@ -640,19 +675,21 @@ show_accepting(http_t *http, /* I - HTTP connection to server */ printer = NULL; message = NULL; accepting = 1; + ptime = 0; while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) { if (!strcmp(attr->name, "printer-name") && attr->value_tag == IPP_TAG_NAME) printer = attr->values[0].string.text; - - if (!strcmp(attr->name, "printer-state-message") && - attr->value_tag == IPP_TAG_TEXT) + else if (!strcmp(attr->name, "printer-state-change-time") && + attr->value_tag == IPP_TAG_INTEGER) + ptime = (time_t)attr->values[0].integer; + else if (!strcmp(attr->name, "printer-state-message") && + attr->value_tag == IPP_TAG_TEXT) message = attr->values[0].string.text; - - if (!strcmp(attr->name, "printer-is-accepting-jobs") && - attr->value_tag == IPP_TAG_BOOLEAN) + else if (!strcmp(attr->name, "printer-is-accepting-jobs") && + attr->value_tag == IPP_TAG_BOOLEAN) accepting = attr->values[0].boolean; attr = attr->next; @@ -724,28 +761,28 @@ show_accepting(http_t *http, /* I - HTTP connection to server */ if (match) { + pdate = localtime(&ptime); + strftime(printer_state_time, sizeof(printer_state_time), "%c", pdate); + if (accepting) - _cupsLangPrintf(stdout, NULL, - _("%s accepting requests since Jan 01 00:00\n"), - printer); + _cupsLangPrintf(stdout, _("%s accepting requests since %s\n"), + printer, printer_state_time); else - _cupsLangPrintf(stdout, NULL, - _("%s not accepting requests since Jan 01 00:00 -\n" - "\t%s\n"), - printer, message == NULL ? "reason unknown" : message); + _cupsLangPrintf(stdout, _("%s not accepting requests since %s -\n" + "\t%s\n"), + printer, printer_state_time, + message == NULL ? "reason unknown" : message); for (i = 0; i < num_dests; i ++) if (!strcasecmp(dests[i].name, printer) && dests[i].instance) { if (accepting) - _cupsLangPrintf(stdout, NULL, - _("%s/%s accepting requests since Jan 01 00:00\n"), - printer, dests[i].instance); + _cupsLangPrintf(stdout, _("%s/%s accepting requests since %s\n"), + printer, dests[i].instance, printer_state_time); else - _cupsLangPrintf(stdout, NULL, - _("%s/%s not accepting requests since " - "Jan 01 00:00 -\n\t%s\n"), - printer, dests[i].instance, + _cupsLangPrintf(stdout, _("%s/%s not accepting requests since " + "%s -\n\t%s\n"), + printer, dests[i].instance, printer_state_time, message == NULL ? "reason unknown" : message); } } @@ -758,8 +795,7 @@ show_accepting(http_t *http, /* I - HTTP connection to server */ } else { - _cupsLangPrintf(stderr, NULL, _("lpstat: get-printers failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString()); return (1); } @@ -805,7 +841,7 @@ show_classes(http_t *http, /* I - HTTP connection to server */ if (http == NULL) return (1); - if (dests != NULL && strcmp(dests, "all") == 0) + if (dests != NULL && !strcmp(dests, "all")) dests = NULL; /* @@ -815,6 +851,7 @@ show_classes(http_t *http, /* I - HTTP connection to server */ * attributes-charset * attributes-natural-language * requested-attributes + * requesting-user-name */ request = ippNewRequest(CUPS_GET_CLASSES); @@ -823,6 +860,9 @@ show_classes(http_t *http, /* I - HTTP connection to server */ "requested-attributes", sizeof(cattrs) / sizeof(cattrs[0]), NULL, cattrs); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", + NULL, cupsUser()); + /* * Do the request and get back a response... */ @@ -833,9 +873,7 @@ show_classes(http_t *http, /* I - HTTP connection to server */ if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, - _("lpstat: get-classes failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString()); ippDelete(response); return (1); } @@ -917,7 +955,8 @@ show_classes(http_t *http, /* I - HTTP connection to server */ "printer-uri", NULL, printer_uri); ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD, - "requested-attributes", sizeof(cattrs) / sizeof(cattrs[0]), + "requested-attributes", + sizeof(cattrs) / sizeof(cattrs[0]), NULL, cattrs); if ((response2 = cupsDoRequest(http2, request, "/")) != NULL) @@ -997,16 +1036,16 @@ show_classes(http_t *http, /* I - HTTP connection to server */ if (match) { - _cupsLangPrintf(stdout, NULL, _("members of class %s:\n"), printer); + _cupsLangPrintf(stdout, _("members of class %s:\n"), printer); if (members) { for (i = 0; i < members->num_values; i ++) - _cupsLangPrintf(stdout, NULL, "\t%s\n", + _cupsLangPrintf(stdout, "\t%s\n", members->values[i].string.text); } else - _cupsLangPuts(stdout, NULL, "\tunknown\n"); + _cupsLangPuts(stdout, "\tunknown\n"); } if (response2) @@ -1020,8 +1059,7 @@ show_classes(http_t *http, /* I - HTTP connection to server */ } else { - _cupsLangPrintf(stderr, NULL, _("lpstat: get-classes failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString()); return (1); } @@ -1044,10 +1082,10 @@ show_default(int num_dests, /* I - Number of user-defined dests */ if ((dest = cupsGetDest(NULL, NULL, num_dests, dests)) != NULL) { if (dest->instance) - _cupsLangPrintf(stdout, NULL, _("system default destination: %s/%s\n"), + _cupsLangPrintf(stdout, _("system default destination: %s/%s\n"), dest->name, dest->instance); else - _cupsLangPrintf(stdout, NULL, _("system default destination: %s\n"), + _cupsLangPrintf(stdout, _("system default destination: %s\n"), dest->name); } else @@ -1068,12 +1106,12 @@ show_default(int num_dests, /* I - Number of user-defined dests */ val = "LPDEST"; if (printer && !cupsGetDest(printer, NULL, num_dests, dests)) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("lpstat: error - %s environment variable names " "non-existent destination \"%s\"!\n"), val, printer); else - _cupsLangPuts(stdout, NULL, _("no system default destination\n")); + _cupsLangPuts(stdout, _("no system default destination\n")); } } @@ -1111,7 +1149,7 @@ show_devices(http_t *http, /* I - HTTP connection to server */ if (http == NULL) return (1); - if (printers != NULL && strcmp(printers, "all") == 0) + if (printers != NULL && !strcmp(printers, "all")) printers = NULL; /* @@ -1121,6 +1159,7 @@ show_devices(http_t *http, /* I - HTTP connection to server */ * attributes-charset * attributes-natural-language * requested-attributes + * requesting-user-name */ request = ippNewRequest(CUPS_GET_PRINTERS); @@ -1129,6 +1168,9 @@ show_devices(http_t *http, /* I - HTTP connection to server */ "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]), NULL, pattrs); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", + NULL, cupsUser()); + /* * Do the request and get back a response... */ @@ -1139,8 +1181,7 @@ show_devices(http_t *http, /* I - HTTP connection to server */ if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, _("lpstat: get-printers failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString()); ippDelete(response); return (1); } @@ -1264,17 +1305,17 @@ show_devices(http_t *http, /* I - HTTP connection to server */ if (device == NULL) { httpSeparate(uri, method, username, hostname, &port, resource); - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("Output for printer %s is sent to remote " "printer %s on %s\n"), printer, strrchr(resource, '/') + 1, hostname); } - else if (strncmp(device, "file:", 5) == 0) - _cupsLangPrintf(stdout, NULL, + else if (!strncmp(device, "file:", 5)) + _cupsLangPrintf(stdout, _("Output for printer %s is sent to %s\n"), printer, device + 5); else - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("Output for printer %s is sent to %s\n"), printer, device); @@ -1282,42 +1323,42 @@ show_devices(http_t *http, /* I - HTTP connection to server */ if (!strcasecmp(printer, dests[i].name) && dests[i].instance) { if (device == NULL) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("Output for printer %s/%s is sent to " "remote printer %s on %s\n"), printer, dests[i].instance, strrchr(resource, '/') + 1, hostname); else if (!strncmp(device, "file:", 5)) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("Output for printer %s/%s is sent to %s\n"), printer, dests[i].instance, device + 5); else - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("Output for printer %s/%s is sent to %s\n"), printer, dests[i].instance, device); } #else if (device == NULL) - _cupsLangPrintf(stdout, NULL, _("device for %s: %s\n"), + _cupsLangPrintf(stdout, _("device for %s: %s\n"), printer, uri); else if (!strncmp(device, "file:", 5)) - _cupsLangPrintf(stdout, NULL, _("device for %s: %s\n"), + _cupsLangPrintf(stdout, _("device for %s: %s\n"), printer, device + 5); else - _cupsLangPrintf(stdout, NULL, _("device for %s: %s\n"), + _cupsLangPrintf(stdout, _("device for %s: %s\n"), printer, device); for (i = 0; i < num_dests; i ++) if (!strcasecmp(printer, dests[i].name) && dests[i].instance) { if (device == NULL) - _cupsLangPrintf(stdout, NULL, _("device for %s/%s: %s\n"), + _cupsLangPrintf(stdout, _("device for %s/%s: %s\n"), printer, dests[i].instance, uri); else if (!strncmp(device, "file:", 5)) - _cupsLangPrintf(stdout, NULL, _("device for %s/%s: %s\n"), + _cupsLangPrintf(stdout, _("device for %s/%s: %s\n"), printer, dests[i].instance, device + 5); else - _cupsLangPrintf(stdout, NULL, _("device for %s/%s: %s\n"), + _cupsLangPrintf(stdout, _("device for %s/%s: %s\n"), printer, dests[i].instance, device); } #endif /* __osf__ */ @@ -1331,8 +1372,7 @@ show_devices(http_t *http, /* I - HTTP connection to server */ } else { - _cupsLangPrintf(stderr, NULL, _("lpstat: get-printers failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString()); return (1); } @@ -1384,7 +1424,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ if (http == NULL) return (1); - if (dests != NULL && strcmp(dests, "all") == 0) + if (dests != NULL && !strcmp(dests, "all")) dests = NULL; /* @@ -1421,8 +1461,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, _("lpstat: get-jobs failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString()); ippDelete(response); return (1); } @@ -1454,28 +1493,28 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ while (attr != NULL && attr->group_tag == IPP_TAG_JOB) { - if (strcmp(attr->name, "job-id") == 0 && + if (!strcmp(attr->name, "job-id") && attr->value_tag == IPP_TAG_INTEGER) jobid = attr->values[0].integer; - if (strcmp(attr->name, "job-k-octets") == 0 && + if (!strcmp(attr->name, "job-k-octets") && attr->value_tag == IPP_TAG_INTEGER) size = attr->values[0].integer; - if (strcmp(attr->name, "time-at-creation") == 0 && + if (!strcmp(attr->name, "time-at-creation") && attr->value_tag == IPP_TAG_INTEGER) jobtime = attr->values[0].integer; - if (strcmp(attr->name, "job-printer-uri") == 0 && + if (!strcmp(attr->name, "job-printer-uri") && attr->value_tag == IPP_TAG_URI) if ((dest = strrchr(attr->values[0].string.text, '/')) != NULL) dest ++; - if (strcmp(attr->name, "job-originating-user-name") == 0 && + if (!strcmp(attr->name, "job-originating-user-name") && attr->value_tag == IPP_TAG_NAME) username = attr->values[0].string.text; - if (strcmp(attr->name, "job-name") == 0 && + if (!strcmp(attr->name, "job-name") && attr->value_tag == IPP_TAG_NAME) title = attr->values[0].string.text; @@ -1603,7 +1642,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ if (!strftime(date, sizeof(date), "%b %d %H:%M", jobdate)) strcpy(date, "Unknown"); - _cupsLangPrintf(stdout, NULL, "%s;%s;%d;%s;%s\n", + _cupsLangPrintf(stdout, "%s;%s;%d;%s;%s\n", temp, username ? username : "unknown", size, title ? title : "unknown", date); } @@ -1613,15 +1652,15 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ strcpy(date, "Unknown"); if (ranking) - _cupsLangPrintf(stdout, NULL, "%3d %-21s %-13s %8.0f %s\n", + _cupsLangPrintf(stdout, "%3d %-21s %-13s %8.0f %s\n", rank, temp, username ? username : "unknown", 1024.0 * size, date); else - _cupsLangPrintf(stdout, NULL, "%-23s %-13s %8.0f %s\n", + _cupsLangPrintf(stdout, "%-23s %-13s %8.0f %s\n", temp, username ? username : "unknown", 1024.0 * size, date); if (long_status) - _cupsLangPrintf(stdout, NULL, _("\tqueued for %s\n"), dest); + _cupsLangPrintf(stdout, _("\tqueued for %s\n"), dest); } } @@ -1633,8 +1672,7 @@ show_jobs(http_t *http, /* I - HTTP connection to server */ } else { - _cupsLangPrintf(stderr, NULL, _("lpstat: get-jobs failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString()); return (1); } @@ -1709,7 +1747,7 @@ show_printers(http_t *http, /* I - HTTP connection to server */ if ((root = getenv("CUPS_SERVERROOT")) == NULL) root = CUPS_SERVERROOT; - if (printers != NULL && strcmp(printers, "all") == 0) + if (printers != NULL && !strcmp(printers, "all")) printers = NULL; /* @@ -1719,6 +1757,7 @@ show_printers(http_t *http, /* I - HTTP connection to server */ * attributes-charset * attributes-natural-language * requested-attributes + * requesting-user-name */ request = ippNewRequest(CUPS_GET_PRINTERS); @@ -1727,6 +1766,9 @@ show_printers(http_t *http, /* I - HTTP connection to server */ "requested-attributes", sizeof(pattrs) / sizeof(pattrs[0]), NULL, pattrs); + ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", + NULL, cupsUser()); + /* * Do the request and get back a response... */ @@ -1737,8 +1779,7 @@ show_printers(http_t *http, /* I - HTTP connection to server */ if (response->request.status.status_code > IPP_OK_CONFLICT) { - _cupsLangPrintf(stderr, NULL, _("lpstat: get-printers failed: %s\n"), - ippErrorString(response->request.status.status_code)); + _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString()); ippDelete(response); return (1); } @@ -1954,18 +1995,18 @@ show_printers(http_t *http, /* I - HTTP connection to server */ switch (pstate) { case IPP_PRINTER_IDLE : - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("printer %s is idle. enabled since %s\n"), printer, printer_state_time); break; case IPP_PRINTER_PROCESSING : - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("printer %s now printing %s-%d. " "enabled since %s\n"), printer, printer, jobid, printer_state_time); break; case IPP_PRINTER_STOPPED : - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("printer %s disabled since %s -\n"), printer, printer_state_time); break; @@ -1974,87 +2015,87 @@ show_printers(http_t *http, /* I - HTTP connection to server */ if ((message && *message) || pstate == IPP_PRINTER_STOPPED) { if (!message || !*message) - _cupsLangPuts(stdout, NULL, _("\treason unknown\n")); + _cupsLangPuts(stdout, _("\treason unknown\n")); else - _cupsLangPrintf(stdout, NULL, "\t%s\n", message); + _cupsLangPrintf(stdout, "\t%s\n", message); } if (long_status > 1) - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _("\tForm mounted:\n" "\tContent types: any\n" "\tPrinter types: unknown\n")); if (long_status) { - _cupsLangPrintf(stdout, NULL, _("\tDescription: %s\n"), + _cupsLangPrintf(stdout, _("\tDescription: %s\n"), description ? description : ""); if (reasons) { - _cupsLangPuts(stdout, NULL, _("\tAlerts:")); + _cupsLangPuts(stdout, _("\tAlerts:")); for (i = 0; i < reasons->num_values; i ++) - _cupsLangPrintf(stdout, NULL, " %s", + _cupsLangPrintf(stdout, " %s", reasons->values[i].string.text); - _cupsLangPuts(stdout, NULL, "\n"); + _cupsLangPuts(stdout, "\n"); } } if (long_status > 1) { - _cupsLangPrintf(stdout, NULL, _("\tLocation: %s\n"), + _cupsLangPrintf(stdout, _("\tLocation: %s\n"), location ? location : ""); if (ptype & CUPS_PRINTER_REMOTE) { - _cupsLangPuts(stdout, NULL, _("\tConnection: remote\n")); + _cupsLangPuts(stdout, _("\tConnection: remote\n")); if (make_model && !strstr(make_model, "System V Printer") && !strstr(make_model, "Raw Printer") && uri) - _cupsLangPrintf(stdout, NULL, _("\tInterface: %s.ppd\n"), + _cupsLangPrintf(stdout, _("\tInterface: %s.ppd\n"), uri); } else { - _cupsLangPuts(stdout, NULL, _("\tConnection: direct\n")); + _cupsLangPuts(stdout, _("\tConnection: direct\n")); if (make_model && strstr(make_model, "System V Printer")) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("\tInterface: %s/interfaces/%s\n"), root, printer); else if (make_model && !strstr(make_model, "Raw Printer")) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("\tInterface: %s/ppd/%s.ppd\n"), root, printer); } - _cupsLangPuts(stdout, NULL, _("\tOn fault: no alert\n")); - _cupsLangPuts(stdout, NULL, _("\tAfter fault: continue\n")); + _cupsLangPuts(stdout, _("\tOn fault: no alert\n")); + _cupsLangPuts(stdout, _("\tAfter fault: continue\n")); // TODO update to use printer-error-policy if (allowed) { - _cupsLangPuts(stdout, NULL, _("\tUsers allowed:\n")); + _cupsLangPuts(stdout, _("\tUsers allowed:\n")); for (i = 0; i < allowed->num_values; i ++) - _cupsLangPrintf(stdout, NULL, "\t\t%s\n", + _cupsLangPrintf(stdout, "\t\t%s\n", allowed->values[i].string.text); } else if (denied) { - _cupsLangPuts(stdout, NULL, _("\tUsers denied:\n")); + _cupsLangPuts(stdout, _("\tUsers denied:\n")); for (i = 0; i < denied->num_values; i ++) - _cupsLangPrintf(stdout, NULL, "\t\t%s\n", + _cupsLangPrintf(stdout, "\t\t%s\n", denied->values[i].string.text); } else { - _cupsLangPuts(stdout, NULL, _("\tUsers allowed:\n")); - _cupsLangPuts(stdout, NULL, _("\t\t(all)\n")); + _cupsLangPuts(stdout, _("\tUsers allowed:\n")); + _cupsLangPuts(stdout, _("\t\t(all)\n")); } - _cupsLangPuts(stdout, NULL, _("\tForms allowed:\n")); - _cupsLangPuts(stdout, NULL, _("\t\t(none)\n")); - _cupsLangPuts(stdout, NULL, _("\tBanner required\n")); - _cupsLangPuts(stdout, NULL, _("\tCharset sets:\n")); - _cupsLangPuts(stdout, NULL, _("\t\t(none)\n")); - _cupsLangPuts(stdout, NULL, _("\tDefault pitch:\n")); - _cupsLangPuts(stdout, NULL, _("\tDefault page size:\n")); - _cupsLangPuts(stdout, NULL, _("\tDefault port settings:\n")); + _cupsLangPuts(stdout, _("\tForms allowed:\n")); + _cupsLangPuts(stdout, _("\t\t(none)\n")); + _cupsLangPuts(stdout, _("\tBanner required\n")); + _cupsLangPuts(stdout, _("\tCharset sets:\n")); + _cupsLangPuts(stdout, _("\t\t(none)\n")); + _cupsLangPuts(stdout, _("\tDefault pitch:\n")); + _cupsLangPuts(stdout, _("\tDefault page size:\n")); + _cupsLangPuts(stdout, _("\tDefault port settings:\n")); } for (i = 0; i < num_dests; i ++) @@ -2063,21 +2104,21 @@ show_printers(http_t *http, /* I - HTTP connection to server */ switch (pstate) { case IPP_PRINTER_IDLE : - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("printer %s/%s is idle. " "enabled since %s\n"), printer, dests[i].instance, printer_state_time); break; case IPP_PRINTER_PROCESSING : - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("printer %s/%s now printing %s-%d. " "enabled since %s\n"), printer, dests[i].instance, printer, jobid, printer_state_time); break; case IPP_PRINTER_STOPPED : - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("printer %s/%s disabled since %s -\n"), printer, dests[i].instance, printer_state_time); @@ -2087,87 +2128,87 @@ show_printers(http_t *http, /* I - HTTP connection to server */ if ((message && *message) || pstate == IPP_PRINTER_STOPPED) { if (!message || !*message) - _cupsLangPuts(stdout, NULL, _("\treason unknown\n")); + _cupsLangPuts(stdout, _("\treason unknown\n")); else - _cupsLangPrintf(stdout, NULL, "\t%s\n", message); + _cupsLangPrintf(stdout, "\t%s\n", message); } if (long_status > 1) - _cupsLangPuts(stdout, NULL, + _cupsLangPuts(stdout, _("\tForm mounted:\n" "\tContent types: any\n" "\tPrinter types: unknown\n")); if (long_status) { - _cupsLangPrintf(stdout, NULL, _("\tDescription: %s\n"), + _cupsLangPrintf(stdout, _("\tDescription: %s\n"), description ? description : ""); if (reasons) { - _cupsLangPuts(stdout, NULL, _("\tAlerts:")); + _cupsLangPuts(stdout, _("\tAlerts:")); for (i = 0; i < reasons->num_values; i ++) - _cupsLangPrintf(stdout, NULL, " %s", + _cupsLangPrintf(stdout, " %s", reasons->values[i].string.text); - _cupsLangPuts(stdout, NULL, "\n"); + _cupsLangPuts(stdout, "\n"); } } if (long_status > 1) { - _cupsLangPrintf(stdout, NULL, _("\tLocation: %s\n"), + _cupsLangPrintf(stdout, _("\tLocation: %s\n"), location ? location : ""); if (ptype & CUPS_PRINTER_REMOTE) { - _cupsLangPuts(stdout, NULL, _("\tConnection: remote\n")); + _cupsLangPuts(stdout, _("\tConnection: remote\n")); if (make_model && !strstr(make_model, "System V Printer") && !strstr(make_model, "Raw Printer") && uri) - _cupsLangPrintf(stdout, NULL, _("\tInterface: %s.ppd\n"), + _cupsLangPrintf(stdout, _("\tInterface: %s.ppd\n"), uri); } else { - _cupsLangPuts(stdout, NULL, _("\tConnection: direct\n")); + _cupsLangPuts(stdout, _("\tConnection: direct\n")); if (make_model && strstr(make_model, "System V Printer")) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("\tInterface: %s/interfaces/%s\n"), root, printer); else if (make_model && !strstr(make_model, "Raw Printer")) - _cupsLangPrintf(stdout, NULL, + _cupsLangPrintf(stdout, _("\tInterface: %s/ppd/%s.ppd\n"), root, printer); } - _cupsLangPuts(stdout, NULL, _("\tOn fault: no alert\n")); - _cupsLangPuts(stdout, NULL, _("\tAfter fault: continue\n")); + _cupsLangPuts(stdout, _("\tOn fault: no alert\n")); + _cupsLangPuts(stdout, _("\tAfter fault: continue\n")); // TODO update to use printer-error-policy if (allowed) { - _cupsLangPuts(stdout, NULL, _("\tUsers allowed:\n")); + _cupsLangPuts(stdout, _("\tUsers allowed:\n")); for (i = 0; i < allowed->num_values; i ++) - _cupsLangPrintf(stdout, NULL, "\t\t%s\n", + _cupsLangPrintf(stdout, "\t\t%s\n", allowed->values[i].string.text); } else if (denied) { - _cupsLangPuts(stdout, NULL, _("\tUsers denied:\n")); + _cupsLangPuts(stdout, _("\tUsers denied:\n")); for (i = 0; i < denied->num_values; i ++) - _cupsLangPrintf(stdout, NULL, "\t\t%s\n", + _cupsLangPrintf(stdout, "\t\t%s\n", denied->values[i].string.text); } else { - _cupsLangPuts(stdout, NULL, _("\tUsers allowed:\n")); - _cupsLangPuts(stdout, NULL, _("\t\t(all)\n")); + _cupsLangPuts(stdout, _("\tUsers allowed:\n")); + _cupsLangPuts(stdout, _("\t\t(all)\n")); } - _cupsLangPuts(stdout, NULL, _("\tForms allowed:\n")); - _cupsLangPuts(stdout, NULL, _("\t\t(none)\n")); - _cupsLangPuts(stdout, NULL, _("\tBanner required\n")); - _cupsLangPuts(stdout, NULL, _("\tCharset sets:\n")); - _cupsLangPuts(stdout, NULL, _("\t\t(none)\n")); - _cupsLangPuts(stdout, NULL, _("\tDefault pitch:\n")); - _cupsLangPuts(stdout, NULL, _("\tDefault page size:\n")); - _cupsLangPuts(stdout, NULL, _("\tDefault port settings:\n")); + _cupsLangPuts(stdout, _("\tForms allowed:\n")); + _cupsLangPuts(stdout, _("\t\t(none)\n")); + _cupsLangPuts(stdout, _("\tBanner required\n")); + _cupsLangPuts(stdout, _("\tCharset sets:\n")); + _cupsLangPuts(stdout, _("\t\t(none)\n")); + _cupsLangPuts(stdout, _("\tDefault pitch:\n")); + _cupsLangPuts(stdout, _("\tDefault page size:\n")); + _cupsLangPuts(stdout, _("\tDefault port settings:\n")); } } } @@ -2180,8 +2221,7 @@ show_printers(http_t *http, /* I - HTTP connection to server */ } else { - _cupsLangPrintf(stderr, NULL, _("lpstat: get-printers failed: %s\n"), - ippErrorString(cupsLastError())); + _cupsLangPrintf(stderr, "lpstat: %s\n", cupsLastErrorString()); return (1); } @@ -2197,12 +2237,12 @@ static void show_scheduler(http_t *http) /* I - HTTP connection to server */ { if (http) - _cupsLangPuts(stdout, NULL, _("scheduler is running\n")); + _cupsLangPuts(stdout, _("scheduler is running\n")); else - _cupsLangPuts(stdout, NULL, _("scheduler is not running\n")); + _cupsLangPuts(stdout, _("scheduler is not running\n")); } /* - * End of "$Id: lpstat.c 4922 2006-01-12 22:05:06Z mike $". + * End of "$Id: lpstat.c 4948 2006-01-19 03:23:41Z mike $". */ diff --git a/templates/Makefile b/templates/Makefile index 4225d336c0..31f7d7dce1 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 4881 2005-12-15 22:03:40Z mike $" +# "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $" # # Template makefile for the Common UNIX Printing System (CUPS). # @@ -28,9 +28,9 @@ include ../Makedefs # Template files... # -FILES = add-class.tmpl \ +FILES = \ + add-class.tmpl \ add-printer.tmpl \ - admin-op.tmpl \ admin.tmpl \ choose-device.tmpl \ choose-make.tmpl \ @@ -40,18 +40,23 @@ FILES = add-class.tmpl \ class-added.tmpl \ class-confirm.tmpl \ class-deleted.tmpl \ - classes.tmpl \ + class-jobs-header.tmpl \ class-modified.tmpl \ + classes.tmpl \ + classes-header.tmpl \ edit-config.tmpl \ error.tmpl \ + error-op.tmpl \ header.tmpl \ help-header.tmpl \ job-cancel.tmpl \ job-hold.tmpl \ - job-op.tmpl \ + job-move.tmpl \ + job-moved.tmpl \ job-release.tmpl \ job-restart.tmpl \ jobs.tmpl \ + jobs-header.tmpl \ modify-class.tmpl \ modify-printer.tmpl \ option-boolean.tmpl \ @@ -60,19 +65,23 @@ FILES = add-class.tmpl \ option-pickmany.tmpl \ option-pickone.tmpl \ option-trailer.tmpl \ + pager.tmpl \ printer-accept.tmpl \ printer-added.tmpl \ printer-configured.tmpl \ printer-confirm.tmpl \ printer-default.tmpl \ printer-deleted.tmpl \ + printer-jobs-header.tmpl \ printer-modified.tmpl \ printer-purge.tmpl \ printer-reject.tmpl \ printer-start.tmpl \ - printers.tmpl \ printer-stop.tmpl \ + printers.tmpl \ + printers-header.tmpl \ restart.tmpl \ + search.tmpl \ set-printer-options-header.tmpl \ set-printer-options-trailer.tmpl \ test-page.tmpl \ @@ -98,7 +107,7 @@ clean: # Install files... # -install: +install: all $(INSTALL_DIR) $(DATADIR)/templates for file in $(FILES); do \ $(INSTALL_DATA) $$file $(DATADIR)/templates; \ @@ -106,5 +115,5 @@ install: # -# End of "$Id: Makefile 4881 2005-12-15 22:03:40Z mike $". +# End of "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $". # diff --git a/templates/add-class.tmpl b/templates/add-class.tmpl index ec13434e99..a1b1689ee9 100644 --- a/templates/add-class.tmpl +++ b/templates/add-class.tmpl @@ -26,7 +26,7 @@ - + diff --git a/templates/admin-op.tmpl b/templates/admin-op.tmpl deleted file mode 100644 index 16699f8153..0000000000 --- a/templates/admin-op.tmpl +++ /dev/null @@ -1 +0,0 @@ -

Unsupported administration operation "{op}". diff --git a/templates/admin.tmpl b/templates/admin.tmpl index af88e33b30..989c46be23 100644 --- a/templates/admin.tmpl +++ b/templates/admin.tmpl @@ -1,22 +1,6 @@ -
-

Classes

- -

- - -

- -

Jobs

- -

-Manage
-Jobs -

-

Printers

@@ -24,6 +8,9 @@ Jobs" CLASS="button"> SRC="/images/add-printer.gif" ALT="Add Printer" CLASS="button"> Manage Printers +{have_samba?Export Printers to Samba:}

{#device_uri=0?:

New Printers Found:

    {[device_uri] @@ -33,6 +20,22 @@ SRC="/images/add-this-printer.gif" ALT="Add This Printer" CLASS="button" ALIGN="MIDDLE"> }
} +

Classes

+ +

+ + +

+ +

Jobs

+ +

+Manage
+Jobs +

+
     

Server

diff --git a/templates/class-jobs-header.tmpl b/templates/class-jobs-header.tmpl new file mode 100644 index 0000000000..61e5151d24 --- /dev/null +++ b/templates/class-jobs-header.tmpl @@ -0,0 +1 @@ +

Jobs

diff --git a/templates/classes-header.tmpl b/templates/classes-header.tmpl new file mode 100644 index 0000000000..7ac98fbddc --- /dev/null +++ b/templates/classes-header.tmpl @@ -0,0 +1 @@ +

{total=0?No classes:Showing {#printer_name} of {total} class{total=1?:es}}.

diff --git a/templates/classes.tmpl b/templates/classes.tmpl index 2f582ea230..4a5a92f04d 100644 --- a/templates/classes.tmpl +++ b/templates/classes.tmpl @@ -1,9 +1,4 @@ -

Add Class

- -{#printer_name=0?No classes: -

Server Default Destination: {default_name?{default_name}:none}

+{#printer_name=0?: {[printer_name]

{printer_name}{default_name={printer_name}? (Default Printer):}

@@ -11,9 +6,9 @@ CLASS="button">

Description: {printer_info}
-Location: {printer_location}
-Class State: {printer_state=3?idle:{printer_state=4?processing:stopped}}, +
Description: {printer_info}
+Location: {printer_location}
+Class State: {printer_state=3?idle:{printer_state=4?processing:stopped}}, {printer_is_accepting_jobs=0?rejecting jobs:accepting jobs}, {printer_is_shared=0?not:} published. {?printer_state_message=?:
"{printer_state_message}"} {?member_uris=?:
Members: {member_uris}} @@ -22,39 +17,38 @@ Class State: {printer_state=3?idle:{printer_state=4?processing:stopped}}, Print Test Page {printer_state=5? - + Start Class : - + Stop Class } {printer_is_accepting_jobs=0? - + Accept Jobs : - + Reject Jobs } - + Cancel All Jobs {printer_is_shared=0? - + Publish Printer : - + Unpublish Printer } Modify Class Delete Class - + Set As Default - + Set Allowed Users

- }} diff --git a/templates/error-op.tmpl b/templates/error-op.tmpl new file mode 100644 index 0000000000..6950831a01 --- /dev/null +++ b/templates/error-op.tmpl @@ -0,0 +1,3 @@ +

Error:

+ +
Unknown operation "{op}"!
diff --git a/templates/error.tmpl b/templates/error.tmpl index eb15a06ff9..bf0530cbd0 100644 --- a/templates/error.tmpl +++ b/templates/error.tmpl @@ -1,3 +1,3 @@ -

Error: +

{?message?{message}:Error:}

{error}
diff --git a/templates/job-move.tmpl b/templates/job-move.tmpl new file mode 100644 index 0000000000..65d8e98211 --- /dev/null +++ b/templates/job-move.tmpl @@ -0,0 +1,22 @@ +
+ +{job_id?:} + +

{job_id?Move Job {job_id}:Move All Jobs}

+ + + + + + + + + + +
New Destination: + +
+ +
diff --git a/templates/job-moved.tmpl b/templates/job-moved.tmpl new file mode 100644 index 0000000000..df7ea1d34d --- /dev/null +++ b/templates/job-moved.tmpl @@ -0,0 +1,2 @@ +

{job_id?Job {job_id}:All jobs} moved to +{job_printer_name}.

diff --git a/templates/job-op.tmpl b/templates/job-op.tmpl deleted file mode 100644 index 19520367f7..0000000000 --- a/templates/job-op.tmpl +++ /dev/null @@ -1 +0,0 @@ -

Unsupported job operation "{op}". diff --git a/templates/jobs-header.tmpl b/templates/jobs-header.tmpl index fef904715c..45743a18af 100644 --- a/templates/jobs-header.tmpl +++ b/templates/jobs-header.tmpl @@ -1,5 +1,3 @@ -{?printer_name=?:

Jobs

} -

{?which_jobs=?Show Completed Jobs @@ -14,4 +12,4 @@ SRC="/images/show-active.gif" CLASS="button" ALT="Show Active Jobs"> Show All Jobs}}

-

Showing {#job_id} of {total} {?which_jobs=?active:{which_jobs=all?:completed}} job{total=1?:s}.

+

{total=0?No jobs:Showing {#job_id} of {total} {?which_jobs=?active:{which_jobs=all?:completed}} job{total=1?:s}}.

diff --git a/templates/jobs.tmpl b/templates/jobs.tmpl index aeac2002c9..76d8ac8773 100644 --- a/templates/jobs.tmpl +++ b/templates/jobs.tmpl @@ -21,22 +21,20 @@ {job_state=5?processing since
{time_at_processing}:{job_state=6?stopped at
{time_at_completed}: {job_state=7?cancelled at
{time_at_completed}:{job_state=8?aborted:completed at
{time_at_completed}}}}}}}  -{job_state>5? -{job_k_octets>0? +{job_preserved>0? -Reprint Job -:}:} -{job_state>6?: +Reprint Job:} {job_state=4? -Release Job -: +Release Job:} +{job_state=3? -Hold Job -} +Hold Job:} +{job_state<7? Cancel Job -} +Move Job:}   } diff --git a/templates/modify-class.tmpl b/templates/modify-class.tmpl index 6a35cce94f..4cacc26544 100644 --- a/templates/modify-class.tmpl +++ b/templates/modify-class.tmpl @@ -27,7 +27,7 @@ - + diff --git a/templates/page.tmpl b/templates/pager.tmpl similarity index 73% rename from templates/page.tmpl rename to templates/pager.tmpl index a949fe8c59..c95f0c5592 100644 --- a/templates/page.tmpl +++ b/templates/pager.tmpl @@ -1,7 +1,7 @@ - +
- +
{PREVURL?Show Previous: }{ORDER=dec?Show Ascending:Show Descending}{ORDER=dec?Sort Ascending:Sort Descending} {NEXTURL?Show Next: }
diff --git a/templates/printer-accept.tmpl b/templates/printer-accept.tmpl index 3a269eb0df..15e8b15ff8 100644 --- a/templates/printer-accept.tmpl +++ b/templates/printer-accept.tmpl @@ -1 +1,3 @@ -

Printer {printer_name} is now accepting jobs. +

{is_class?Class:Printer} {printer_name} +is now accepting jobs.

diff --git a/templates/printer-default.tmpl b/templates/printer-default.tmpl index e5dd0b08c5..7bb6bc41d9 100644 --- a/templates/printer-default.tmpl +++ b/templates/printer-default.tmpl @@ -1,4 +1,7 @@ -

Printer {printer_name} has been -made the default printer on the server. Please note that any user default -that has been set via the lpoptions command will override this -default setting. +

{is_class?Class:Printer} {printer_name} +has been made the default printer on the server.

+ +
Note: Any user default that has been set via +the lpoptions command will override this default +setting.
diff --git a/templates/printer-jobs-header.tmpl b/templates/printer-jobs-header.tmpl new file mode 100644 index 0000000000..61e5151d24 --- /dev/null +++ b/templates/printer-jobs-header.tmpl @@ -0,0 +1 @@ +

Jobs

diff --git a/templates/printer-purge.tmpl b/templates/printer-purge.tmpl index 863d33916b..8226d60408 100644 --- a/templates/printer-purge.tmpl +++ b/templates/printer-purge.tmpl @@ -1 +1,3 @@ -

Printer {printer_name} has been purged of all jobs. +

{is_class?Class:Printer} {printer_name} +has been purged of all jobs.

diff --git a/templates/printer-reject.tmpl b/templates/printer-reject.tmpl index e73d87380d..aca24a5769 100644 --- a/templates/printer-reject.tmpl +++ b/templates/printer-reject.tmpl @@ -1 +1,3 @@ -

Printer {printer_name} is no longer accepting jobs. +

{is_class?Class:Printer} {printer_name} +is no longer accepting jobs.

diff --git a/templates/printer-start.tmpl b/templates/printer-start.tmpl index e8d9f497fe..d3b95d3df2 100644 --- a/templates/printer-start.tmpl +++ b/templates/printer-start.tmpl @@ -1,2 +1,3 @@ -

Printer {printer_name} has been -started. +

{is_class?Class:Printer} {printer_name} +has been started.

diff --git a/templates/printer-stop.tmpl b/templates/printer-stop.tmpl index e01b826776..bdccd88f8b 100644 --- a/templates/printer-stop.tmpl +++ b/templates/printer-stop.tmpl @@ -1,2 +1,3 @@ -

Printer {printer_name} has been -stopped. +

{is_class?Class:Printer} {printer_name} +has been stopped.

diff --git a/templates/printers-header.tmpl b/templates/printers-header.tmpl new file mode 100644 index 0000000000..5196be1d87 --- /dev/null +++ b/templates/printers-header.tmpl @@ -0,0 +1 @@ +

{total=0?No printers:Showing {#printer_name} of {total} printer{total=1?:s}}.

diff --git a/templates/printers.tmpl b/templates/printers.tmpl index 44d28dfb33..d13997f482 100644 --- a/templates/printers.tmpl +++ b/templates/printers.tmpl @@ -1,9 +1,4 @@ -

Add Printer

- -{#printer_name=0?No printers: -

Server Default Destination: {default_name?{default_name}:none}

+{#printer_name=0?: {[printer_name]

{printer_name}{default_name={printer_name}? (Default Printer):}

@@ -12,17 +7,17 @@ CLASS="button">

-Description: {printer_info}
-Location: {printer_location}
-Make and Model: {printer_make_and_model}
-Printer State: {printer_state=3?idle:{printer_state=4?processing:stopped}}, +Description: {printer_info}
+Location: {printer_location}
+Make and Model: {printer_make_and_model}
+Printer State: {printer_state=3?idle:{printer_state=4?processing:stopped}}, {printer_is_accepting_jobs=0?rejecting jobs:accepting jobs}, {printer_is_shared=0?not:} published. {?printer_state_message=?:
"{printer_state_message}"} {?printer_state_history2.printer_state_message=?:
"{printer_state_history2.printer_state_message}"} {?printer_state_history3.printer_state_message=?:
"{printer_state_history3.printer_state_message}"} {?printer_state_history4.printer_state_message=?:
"{printer_state_history4.printer_state_message}"} {?printer_state_history5.printer_state_message=?:
"{printer_state_history5.printer_state_message}"} -{?device_uri=?:
Device URI: {device_uri}} +{?device_uri=?:
Device URI: {device_uri}}

@@ -41,6 +36,8 @@ Printer State: {printer_state=3?idle:{printer_state=4?processing:stopped}}, Reject Jobs } + +Move All Jobs Cancel All Jobs {printer_is_shared=0? @@ -64,5 +61,4 @@ Printer State: {printer_state=3?idle:{printer_state=4?processing:stopped}}, - }} diff --git a/templates/search.tmpl b/templates/search.tmpl index ee4e48c00b..8fc2ac7c65 100644 --- a/templates/search.tmpl +++ b/templates/search.tmpl @@ -1,9 +1,9 @@ -

+ {WHICH_JOBS?:} {ORDER?:}

Search in -{SECTION=classes?Classes:{SECTION=jobs?Jobs:Printers}}: +{SEARCH_DEST?{SEARCH_DEST}:{SECTION=classes?Classes:{SECTION=jobs?Jobs:Printers}}}:

diff --git a/templates/test-page.tmpl b/templates/test-page.tmpl index 5c5005438d..bbca2dcc9b 100644 --- a/templates/test-page.tmpl +++ b/templates/test-page.tmpl @@ -1,2 +1,2 @@ -

Test page sent; job ID is +

Test page sent; job ID is {printer_name}-{job_id}. diff --git a/templates/users.tmpl b/templates/users.tmpl index a5734416aa..61c6e474b7 100644 --- a/templates/users.tmpl +++ b/templates/users.tmpl @@ -1,6 +1,7 @@ +{IS_CLASS?:}

Allowed Users For {printer_name}

@@ -17,7 +18,7 @@ - + diff --git a/test/Makefile b/test/Makefile index 14b8ab5bc3..86d3ad2dd1 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,5 +1,5 @@ # -# "$Id: Makefile 4837 2005-11-14 04:13:13Z mike $" +# "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $" # # IPP test makefile for the Common UNIX Printing System (CUPS). # @@ -52,7 +52,7 @@ depend: # Install all targets... # -install: +install: all # @@ -73,5 +73,5 @@ include Dependencies # -# End of "$Id: Makefile 4837 2005-11-14 04:13:13Z mike $". +# End of "$Id: Makefile 4950 2006-01-19 16:07:57Z mike $". # diff --git a/test/ipptest.c b/test/ipptest.c index 14d26e055e..4bddc10ac9 100644 --- a/test/ipptest.c +++ b/test/ipptest.c @@ -1,9 +1,9 @@ /* - * "$Id: ipptest.c 4837 2005-11-14 04:13:13Z mike $" + * "$Id: ipptest.c 4973 2006-01-25 02:36:02Z mike $" * * IPP test command for the Common UNIX Printing System (CUPS). * - * Copyright 1997-2005 by Easy Software Products. + * Copyright 1997-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the * property of Easy Software Products and are protected by Federal @@ -151,7 +151,8 @@ do_tests(const char *uri, /* I - URI to connect on */ * Connect to the server... */ - httpSeparate(uri, method, userpass, server, &port, resource); + httpSeparateURI(uri, method, sizeof(method), userpass, sizeof(userpass), + server, sizeof(server), &port, resource, sizeof(resource)); if ((http = httpConnect(server, port)) == NULL) { printf("Unable to connect to %s on port %d - %s\n", server, port, @@ -188,7 +189,8 @@ do_tests(const char *uri, /* I - URI to connect on */ * Initialize things... */ - httpSeparate(uri, method, userpass, server, &port, resource); + httpSeparateURI(uri, method, sizeof(method), userpass, sizeof(userpass), + server, sizeof(server), &port, resource, sizeof(resource)); request = ippNew(); op = (ipp_op_t)0; @@ -782,5 +784,5 @@ print_attr(ipp_attribute_t *attr) /* I - Attribute to print */ /* - * End of "$Id: ipptest.c 4837 2005-11-14 04:13:13Z mike $". + * End of "$Id: ipptest.c 4973 2006-01-25 02:36:02Z mike $". */