/*
- * "$Id: encode.c,v 1.12 2003/01/24 20:39:40 mike Exp $"
+ * "$Id: encode.c,v 1.13 2003/02/10 17:58:11 mike Exp $"
*
* Option encoding routines for the Common UNIX Printing System (CUPS).
*
{ "job-priority", IPP_TAG_INTEGER },
{ "job-quota-period", IPP_TAG_INTEGER },
{ "landscape", IPP_TAG_BOOLEAN },
+ { "media", IPP_TAG_KEYWORD },
{ "mirror", IPP_TAG_BOOLEAN },
{ "natural-scaling", IPP_TAG_INTEGER },
{ "number-up", IPP_TAG_INTEGER },
{ "print-quality", IPP_TAG_ENUM },
{ "saturation", IPP_TAG_INTEGER },
{ "scaling", IPP_TAG_INTEGER },
+ { "sides", IPP_TAG_KEYWORD },
{ "wrap", IPP_TAG_BOOLEAN }
};
/*
- * End of "$Id: encode.c,v 1.12 2003/01/24 20:39:40 mike Exp $".
+ * End of "$Id: encode.c,v 1.13 2003/02/10 17:58:11 mike Exp $".
*/
/*
- * "$Id: ipp.c,v 1.187 2003/02/05 21:10:16 mike Exp $"
+ * "$Id: ipp.c,v 1.188 2003/02/10 17:58:12 mike Exp $"
*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
int port; /* Port portion of URI */
printer_t *printer; /* Printer data */
int kbytes; /* Size of print file */
+ int i; /* Looping var */
+ int lowerpagerange; /* Page range bound */
LogMessage(L_DEBUG2, "create_job(%p[%d], %s)\n", con, con->http.fd,
}
/*
- * Validate job template attributes; for now just copies...
+ * Validate job template attributes; for now just copies and page-ranges...
*/
if ((attr = ippFindAttribute(con->request, "copies", IPP_TAG_INTEGER)) != NULL)
{
LogMessage(L_INFO, "create_job: bad copies value %d.",
attr->values[0].integer);
- send_ipp_error(con, IPP_ATTRIBUTES);
+ send_ipp_error(con, IPP_BAD_REQUEST);
return;
}
}
+ if ((attr = ippFindAttribute(con->request, "page-ranges", IPP_TAG_RANGE)) != NULL)
+ {
+ for (i = 0, lowerpagerange = 1; i < attr->num_values; i ++)
+ {
+ if (attr->values[i].range.lower < lowerpagerange ||
+ attr->values[i].range.lower > attr->values[i].range.upper)
+ {
+ LogMessage(L_ERROR, "create_job: bad page-ranges values %d-%d.",
+ attr->values[i].range.lower, attr->values[i].range.upper);
+ send_ipp_error(con, IPP_BAD_REQUEST);
+ return;
+ }
+
+ lowerpagerange = attr->values[i].range.upper + 1;
+ }
+ }
+
/*
* Make sure we aren't over our limit...
*/
printer_t *printer; /* Printer data */
struct stat fileinfo; /* File information */
int kbytes; /* Size of file */
+ int i; /* Looping var */
+ int lowerpagerange; /* Page range bound */
LogMessage(L_DEBUG2, "print_job(%p[%d], %s)\n", con, con->http.fd,
}
/*
- * Validate job template attributes; for now just copies...
+ * Validate job template attributes; for now just copies and page-ranges...
*/
if ((attr = ippFindAttribute(con->request, "copies", IPP_TAG_INTEGER)) != NULL)
{
LogMessage(L_INFO, "print_job: bad copies value %d.",
attr->values[0].integer);
- send_ipp_error(con, IPP_ATTRIBUTES);
+ send_ipp_error(con, IPP_BAD_REQUEST);
return;
}
}
+ if ((attr = ippFindAttribute(con->request, "page-ranges", IPP_TAG_RANGE)) != NULL)
+ {
+ for (i = 0, lowerpagerange = 1; i < attr->num_values; i ++)
+ {
+ if (attr->values[i].range.lower < lowerpagerange ||
+ attr->values[i].range.lower > attr->values[i].range.upper)
+ {
+ LogMessage(L_ERROR, "print_job: bad page-ranges values %d-%d.",
+ attr->values[i].range.lower, attr->values[i].range.upper);
+ send_ipp_error(con, IPP_BAD_REQUEST);
+ return;
+ }
+
+ lowerpagerange = attr->values[i].range.upper + 1;
+ }
+ }
+
/*
* OK, see if the client is sending the document compressed - CUPS
* doesn't support compression yet...
/*
- * End of "$Id: ipp.c,v 1.187 2003/02/05 21:10:16 mike Exp $".
+ * End of "$Id: ipp.c,v 1.188 2003/02/10 17:58:12 mike Exp $".
*/