/*
- * "$Id: cups-lpd.c 12611 2015-05-06 15:30:36Z msweet $"
- *
* Line Printer Daemon interface for CUPS.
*
- * Copyright 2007-2015 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* Include necessary headers...
*/
+#define _CUPS_NO_DEPRECATED
#include <cups/cups-private.h>
#include <syslog.h>
#include <unistd.h>
* Setup the Create-Job request...
*/
- request = ippNewRequest(IPP_CREATE_JOB);
+ request = ippNewRequest(IPP_OP_CREATE_JOB);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/printers/%s", dest);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name",
NULL, title);
- if (docname[0])
- ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "document-name",
- NULL, docname);
-
cupsEncodeOptions(request, num_options, options);
/*
response = cupsDoRequest(http, request, uri);
- if (!response || cupsLastError() > IPP_OK_CONFLICT)
+ if (!response || cupsLastError() > IPP_STATUS_OK_CONFLICTING)
{
syslog(LOG_ERR, "Unable to create job - %s", cupsLastErrorString());
if (shared)
*shared = 0;
if (state)
- *state = IPP_PRINTER_STOPPED;
+ *state = IPP_PSTATE_STOPPED;
if (options)
*options = NULL;
* Setup the Get-Printer-Attributes request...
*/
- request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
+ request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/printers/%s", dest);
response = cupsDoRequest(http, request, "/");
- if (!response || cupsLastError() > IPP_OK_CONFLICT)
+ if (!response || cupsLastError() > IPP_STATUS_OK_CONFLICTING)
{
/*
* If we can't find the printer by name, look up the printer-name
* Setup the CUPS-Get-Printers request...
*/
- request = ippNewRequest(CUPS_GET_PRINTERS);
+ request = ippNewRequest(IPP_OP_CUPS_GET_PRINTERS);
ippAddStrings(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes",
response = cupsDoRequest(http, request, "/");
- if (!response || cupsLastError() > IPP_OK_CONFLICT)
+ if (!response || cupsLastError() > IPP_STATUS_OK_CONFLICTING)
{
syslog(LOG_ERR, "Unable to get list of printers - %s",
cupsLastErrorString());
* Setup the Send-Document request...
*/
- request = ippNewRequest(IPP_SEND_DOCUMENT);
+ request = ippNewRequest(IPP_OP_SEND_DOCUMENT);
snprintf(uri, sizeof(uri), "ipp://localhost/jobs/%d", id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, uri);
ippDelete(cupsDoFileRequest(http, request, uri, filename));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
{
syslog(LOG_ERR, "Unable to send document - %s", cupsLastErrorString());
* Connect to the server...
*/
- http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
+ http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC, cupsEncryption(), 1, 30000, NULL);
if (!http)
{
syslog(LOG_ERR, "Unable to connect to server: %s", strerror(errno));
* Try connecting to the local server...
*/
- if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
- cupsEncryption())) == NULL)
+ if ((http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC, cupsEncryption(), 1, 30000, NULL)) == NULL)
{
syslog(LOG_ERR, "Unable to connect to server %s: %s", cupsServer(),
strerror(errno));
list ++;
/*
- * Build an IPP_CANCEL_JOB request, which requires the following
+ * Build an IPP_OP_CANCEL_JOB request, which requires the following
* attributes:
*
* attributes-charset
* requesting-user-name
*/
- request = ippNewRequest(IPP_CANCEL_JOB);
+ request = ippNewRequest(IPP_OP_CANCEL_JOB);
sprintf(uri, "ipp://localhost/jobs/%d", id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "job-uri", NULL, uri);
ippDelete(cupsDoRequest(http, request, "/jobs"));
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
{
syslog(LOG_WARNING, "Cancel of job ID %d failed: %s\n", id,
cupsLastErrorString());
* Try connecting to the local server...
*/
- if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
- cupsEncryption())) == NULL)
+ if ((http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC, cupsEncryption(), 1, 30000, NULL)) == NULL)
{
syslog(LOG_ERR, "Unable to connect to server %s: %s", cupsServer(),
strerror(errno));
switch (state)
{
- case IPP_PRINTER_IDLE :
+ case IPP_PSTATE_IDLE :
printf("%s is ready\n", dest);
break;
- case IPP_PRINTER_PROCESSING :
+ case IPP_PSTATE_PROCESSING :
printf("%s is ready and printing\n", dest);
break;
- case IPP_PRINTER_STOPPED :
+ case IPP_PSTATE_STOPPED :
printf("%s is not ready\n", dest);
break;
}
/*
- * Build an IPP_GET_JOBS or IPP_GET_JOB_ATTRIBUTES request, which requires
+ * Build an IPP_OP_GET_JOBS or IPP_OP_GET_JOB_ATTRIBUTES request, which requires
* the following attributes:
*
* attributes-charset
id = atoi(list);
- request = ippNewRequest(id ? IPP_GET_JOB_ATTRIBUTES : IPP_GET_JOBS);
+ request = ippNewRequest(id ? IPP_OP_GET_JOB_ATTRIBUTES : IPP_OP_GET_JOBS);
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", 0, "/printers/%s", dest);
jobcount = 0;
response = cupsDoRequest(http, request, "/");
- if (cupsLastError() > IPP_OK_CONFLICT)
+ if (cupsLastError() > IPP_STATUS_OK_CONFLICTING)
{
printf("get-jobs failed: %s\n", cupsLastErrorString());
ippDelete(response);
jobid = 0;
jobsize = 0;
- jobstate = IPP_JOB_PENDING;
+ jobstate = IPP_JSTATE_PENDING;
jobname = "untitled";
jobuser = NULL;
jobdest = NULL;
* Display the job...
*/
- if (jobstate == IPP_JOB_PROCESSING)
+ if (jobstate == IPP_JSTATE_PROCESSING)
strlcpy(rankstr, "active", sizeof(rankstr));
else
{
else
return (s);
}
-
-
-/*
- * End of "$Id: cups-lpd.c 12611 2015-05-06 15:30:36Z msweet $".
- */