/*
- * "$Id$"
- *
* Destination job support for CUPS.
*
- * Copyright 2012-2014 by Apple Inc.
+ * Copyright 2012-2016 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* law. Distribution and use rights are outlined in the file "LICENSE.txt"
* which should have been included with this file. If this file is
- * file is missing or damaged, see the license at "http://www.cups.org/".
+ * missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*/
*
* The "job_id" is the number returned by cupsCreateDestJob.
*
- * Returns IPP_STATUS_OK on success and IPP_NOT_AUTHORIZED or IPP_FORBIDDEN on
- * failure.
+ * Returns @code IPP_STATUS_OK@ on success and
+ * @code IPP_STATUS_ERRPR_NOT_AUTHORIZED@ or
+ * @code IPP_STATUS_ERROR_FORBIDDEN@ on failure.
*
- * @since CUPS 1.6/OS X 10.8@
+ * @since CUPS 1.6/macOS 10.8@
*/
ipp_status_t
cups_dest_t *dest, /* I - Destination */
int job_id) /* I - Job ID */
{
- /* TODO: Needs to be implemented! */
- /* Probably also needs to be revved to accept cups_dinfo_t... */
- (void)http;
- (void)dest;
- (void)job_id;
+ cups_dinfo_t *info; /* Destination information */
+
+
+ if ((info = cupsCopyDestInfo(http, dest)) != NULL)
+ {
+ ipp_t *request; /* Cancel-Job request */
+
+ request = ippNewRequest(IPP_OP_CANCEL_JOB);
+
+ ippSetVersion(request, info->version / 10, info->version % 10);
+
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, info->uri);
+ ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "job-id", job_id);
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name", NULL, cupsUser());
- return (IPP_STATUS_ERROR_NOT_FOUND);
+ ippDelete(cupsDoRequest(http, request, info->resource));
+ cupsFreeDestInfo(info);
+ }
+
+ return (cupsLastError());
}
* "job_id" is the job ID returned by cupsCreateDestJob. Returns @code IPP_STATUS_OK@
* on success.
*
- * @since CUPS 1.6/OS X 10.8@
+ * @since CUPS 1.6/macOS 10.8@
*/
ipp_status_t /* O - IPP status code */
ipp_attribute_t *attr; /* operations-supported attribute */
- DEBUG_printf(("cupsCloseDestJob(http=%p, dest=%p(%s/%s), info=%p, job_id=%d)",
- http, dest, dest ? dest->name : NULL,
- dest ? dest->instance : NULL, info, job_id));
+ DEBUG_printf(("cupsCloseDestJob(http=%p, dest=%p(%s/%s), info=%p, job_id=%d)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info, job_id));
/*
* Range check input...
* Returns @code IPP_STATUS_OK@ or @code IPP_STATUS_OK_SUBST@ on success, saving the job ID
* in the variable pointed to by "job_id".
*
- * @since CUPS 1.6/OS X 10.8@
+ * @since CUPS 1.6/macOS 10.8@
*/
ipp_status_t /* O - IPP status code */
DEBUG_printf(("cupsCreateDestJob(http=%p, dest=%p(%s/%s), info=%p, "
- "job_id=%p, title=\"%s\", num_options=%d, options=%p)",
- http, dest, dest ? dest->name : NULL,
- dest ? dest->instance : NULL, info, job_id, title, num_options,
- options));
+ "job_id=%p, title=\"%s\", num_options=%d, options=%p)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info, (void *)job_id, title, num_options, (void *)options));
/*
* Range check input...
*
* Returns @code IPP_STATUS_OK@ or @code IPP_STATUS_OK_SUBST@ on success.
*
- * @since CUPS 1.6/OS X 10.8@
+ * @since CUPS 1.6/macOS 10.8@
*/
ipp_status_t /* O - Status of document submission */
cups_dest_t *dest, /* I - Destination */
cups_dinfo_t *info) /* I - Destination information */
{
- DEBUG_printf(("cupsFinishDestDocument(http=%p, dest=%p(%s/%s), info=%p)",
- http, dest, dest ? dest->name : NULL,
- dest ? dest->instance : NULL, info));
+ DEBUG_printf(("cupsFinishDestDocument(http=%p, dest=%p(%s/%s), info=%p)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info));
/*
* Range check input...
* if this is the last document to be submitted in the job. Returns
* @code HTTP_CONTINUE@ on success.
*
- * @since CUPS 1.6/OS X 10.8@
+ * @since CUPS 1.6/macOS 10.8@
*/
http_status_t /* O - Status of document creation */
http_status_t status; /* HTTP status */
- DEBUG_printf(("cupsStartDestDocument(http=%p, dest=%p(%s/%s), info=%p, "
- "job_id=%d, docname=\"%s\", format=\"%s\", num_options=%d, "
- "options=%p, last_document=%d)",
- http, dest, dest ? dest->name : NULL,
- dest ? dest->instance : NULL, info, job_id, docname, format,
- num_options, options, last_document));
+ DEBUG_printf(("cupsStartDestDocument(http=%p, dest=%p(%s/%s), info=%p, job_id=%d, docname=\"%s\", format=\"%s\", num_options=%d, options=%p, last_document=%d)", (void *)http, (void *)dest, dest ? dest->name : NULL, dest ? dest->instance : NULL, (void *)info, job_id, docname, format, num_options, (void *)options, last_document));
/*
* Range check input...
return (status);
}
-
-
-/*
- * End of "$Id$".
- */