#
# API library Makefile for CUPS.
#
-# Copyright 2007-2012 by Apple Inc.
+# Copyright 2007-2013 by Apple Inc.
# Copyright 1997-2006 by Easy Software Products, all rights reserved.
#
# These coded instructions, statements, and computer programs are the
include ../Makedefs
+
+#
+# Options to build libcups without the use of deprecated APIs...
+#
+
+OPTIONS = -D_CUPS_NO_DEPRECATED=1 -D_PPD_DEPRECATED=""
+
+
#
# Object files...
#
*
* Administration utility API definitions for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* Get the supported banner pages, etc. for the printer...
*/
- 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)
{
unlink(src);
return (NULL);
snprintf(line, sizeof(line),
_cupsLangString(language, _("Missing value on line %d.")),
linenum);
- _cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line, 0);
+ _cupsSetError(IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR, line, 0);
cupsFileClose(srcfp);
cupsFileClose(dstfp);
_cupsLangString(language,
_("Missing double quote on line %d.")),
linenum);
- _cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line, 0);
+ _cupsSetError(IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR, line, 0);
cupsFileClose(srcfp);
cupsFileClose(dstfp);
_cupsLangString(language,
_("Bad option + choice on line %d.")),
linenum);
- _cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, line, 0);
+ _cupsSetError(IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR, line, 0);
cupsFileClose(srcfp);
cupsFileClose(dstfp);
if (linenum == 0)
{
- _cupsSetError(IPP_DOCUMENT_FORMAT_ERROR, _("Empty PPD file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_DOCUMENT_FORMAT_ERROR, _("Empty PPD file."), 1);
cupsFileClose(dstfp);
unlink(buffer);
if (!dest || !ppd || !samba_server || !samba_user || !samba_password)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (0);
}
if ((fp = cupsTempFile2(authfile, sizeof(authfile))) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
return (0);
}
_("Unable to copy Windows 2000 printer "
"driver files (%d).")), status);
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
if (logfile)
_cupsLangPuts(logfile, message);
_("Unable to copy CUPS printer driver "
"files (%d).")), status);
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
if (logfile)
_cupsLangPuts(logfile, message);
_("Unable to install Windows 2000 printer "
"driver files (%d).")), status);
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
if (logfile)
_cupsLangPuts(logfile, message);
_("Unable to copy Windows 9x printer "
"driver files (%d).")), status);
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
if (logfile)
_cupsLangPuts(logfile, message);
_("Unable to install Windows 9x printer "
"driver files (%d).")), status);
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
if (logfile)
_cupsLangPuts(logfile, message);
_("Unable to copy 64-bit Windows printer "
"driver files (%d).")), status);
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
if (logfile)
_cupsLangPuts(logfile, message);
_("Unable to copy 64-bit CUPS printer driver "
"files (%d).")), status);
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
if (logfile)
_cupsLangPuts(logfile, message);
_("Unable to install Windows 2000 printer "
"driver files (%d).")), status);
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
if (logfile)
_cupsLangPuts(logfile, message);
"are installed.")),
sizeof(message));
- _cupsSetError(IPP_NOT_FOUND, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, message, 0);
_cupsLangPuts(logfile, message);
}
if (have_drivers == 0)
{
- _cupsSetError(IPP_NOT_FOUND, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, message, 0);
unlink(authfile);
_("Unable to set Windows printer driver (%d).")),
status);
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
if (logfile)
_cupsLangPuts(logfile, message);
if (strcmp(cg->http->hostname, cg->server) ||
cg->ipp_port != httpAddrPort(cg->http->hostaddr) ||
(cg->http->encryption != cg->encryption &&
- cg->http->encryption == HTTP_ENCRYPT_NEVER))
+ cg->http->encryption == HTTP_ENCRYPTION_NEVER))
{
/*
* Need to close the current connection because something has changed...
cupsEncryption(), 1, 0, NULL)) == NULL)
{
if (errno)
- _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, NULL, 0);
else
- _cupsSetError(IPP_SERVICE_UNAVAILABLE,
+ _cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE,
_("Unable to connect to host."), 1);
if (num_settings)
if (!http || !num_settings || !settings)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
if (num_settings)
*num_settings = 0;
*/
if ((status = get_cupsd_conf(http, cg, cg->cupsd_update, cupsdconf,
- sizeof(cupsdconf), &remote)) == HTTP_OK)
+ sizeof(cupsdconf), &remote)) == HTTP_STATUS_OK)
{
if ((cupsd = cupsFileOpen(cupsdconf, "r")) == NULL)
{
snprintf(message, sizeof(message),
_cupsLangString(cupsLangDefault(), _("Open of %s failed: %s")),
cupsdconf, strerror(errno));
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
}
}
else
cg->cupsd_num_settings,
&(cg->cupsd_settings));
}
- else if (status != HTTP_NOT_MODIFIED)
+ else if (status != HTTP_STATUS_NOT_MODIFIED)
invalidate_cupsd_cache(cg);
/*
if (!http || !num_settings || !settings)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (0);
}
*/
if (get_cupsd_conf(http, cg, 0, cupsdconf, sizeof(cupsdconf),
- &remote) == HTTP_OK)
+ &remote) == HTTP_STATUS_OK)
{
if ((cupsd = cupsFileOpen(cupsdconf, "r")) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
return (0);
}
}
if (remote)
unlink(cupsdconf);
- _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
return (0);
}
status = cupsPutFile(http, "/admin/conf/cupsd.conf", tempfile);
- if (status == HTTP_CREATED)
+ if (status == HTTP_STATUS_CREATED)
{
/*
* Updated OK, add the basic settings...
unlink(tempfile);
- return (status == HTTP_CREATED);
+ return (status == HTTP_STATUS_CREATED);
}
snprintf(message, sizeof(message),
_cupsLangString(cupsLangDefault(), _("stat of %s failed: %s")),
name, strerror(errno));
- _cupsSetError(IPP_INTERNAL_ERROR, message, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, message, 0);
*name = '\0';
- return (HTTP_SERVER_ERROR);
+ return (HTTP_STATUS_SERVER_ERROR);
}
else if (last_update && info.st_mtime <= last_update)
- status = HTTP_NOT_MODIFIED;
+ status = HTTP_STATUS_NOT_MODIFIED;
else
- status = HTTP_OK;
+ status = HTTP_STATUS_OK;
}
else
#endif /* !WIN32 */
{
*name = '\0';
- _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
invalidate_cupsd_cache(cg);
- return (HTTP_SERVER_ERROR);
+ return (HTTP_STATUS_SERVER_ERROR);
}
*remote = 1;
close(fd);
- if (status != HTTP_OK)
+ if (status != HTTP_STATUS_OK)
{
unlink(name);
*name = '\0';
*
* Authentication functions for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* This file contains Kerberos support code, copyright 2006 by
/*
* 'cupsDoAuthentication()' - Authenticate a request.
*
- * This function should be called in response to a @code HTTP_UNAUTHORIZED@
+ * This function should be called in response to a @code HTTP_STATUS_UNAUTHORIZED@
* status, prior to resubmitting your request.
*
* @since CUPS 1.1.20/OS X 10.4@
DEBUG_printf(("2cupsDoAuthentication: authstring=\"%s\"",
http->authstring));
- if (http->status == HTTP_UNAUTHORIZED)
+ if (http->status == HTTP_STATUS_UNAUTHORIZED)
http->digest_tries ++;
return (0);
}
else if (localauth == -1)
{
- http->status = HTTP_AUTHORIZATION_CANCELED;
+ http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
return (-1); /* Error or canceled */
}
}
if ((password = cupsGetPassword2(prompt, http, method, resource)) == NULL)
{
- http->status = HTTP_AUTHORIZATION_CANCELED;
+ http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
return (-1);
}
snprintf(http->userpass, sizeof(http->userpass), "%s:%s", cupsUser(),
password);
}
- else if (http->status == HTTP_UNAUTHORIZED)
+ else if (http->status == HTTP_STATUS_UNAUTHORIZED)
http->digest_tries ++;
- if (http->status == HTTP_UNAUTHORIZED && http->digest_tries >= 3)
+ if (http->status == HTTP_STATUS_UNAUTHORIZED && http->digest_tries >= 3)
{
DEBUG_printf(("1cupsDoAuthentication: Too many authentication tries (%d)",
http->digest_tries));
- http->status = HTTP_AUTHORIZATION_CANCELED;
+ http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
return (-1);
}
if (_cupsSetNegotiateAuthString(http, method, resource))
{
- http->status = HTTP_AUTHORIZATION_CANCELED;
+ http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
return (-1);
}
}
{
DEBUG_printf(("1cupsDoAuthentication: Unknown auth type: \"%s\"",
www_auth));
- http->status = HTTP_AUTHORIZATION_CANCELED;
+ http->status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
return (-1);
}
*
* Destination job support for CUPS.
*
- * Copyright 2012 by Apple Inc.
+ * Copyright 2012-2013 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
*
* The "job_id" is the number returned by cupsCreateDestJob.
*
- * Returns IPP_OK on success and IPP_NOT_AUTHORIZED or IPP_FORBIDDEN on
+ * Returns IPP_STATUS_OK on success and IPP_NOT_AUTHORIZED or IPP_FORBIDDEN on
* failure.
*
* @since CUPS 1.6/OS X 10.8@
cups_dest_t *dest, /* I - Destination */
int job_id) /* I - Job ID */
{
- return (IPP_NOT_FOUND);
+ return (IPP_STATUS_ERROR_NOT_FOUND);
}
* 'cupsCloseDestJob()' - Close a job and start printing.
*
* Use when the last call to cupsStartDocument passed 0 for "last_document".
- * "job_id" is the job ID returned by cupsCreateDestJob. Returns @code IPP_OK@
+ * "job_id" is the job ID returned by cupsCreateDestJob. Returns @code IPP_STATUS_OK@
* on success.
*
* @since CUPS 1.6/OS X 10.8@
if (!http || !dest || !info || job_id <= 0)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
DEBUG_puts("1cupsCloseDestJob: Bad arguments.");
- return (IPP_INTERNAL_ERROR);
+ return (IPP_STATUS_ERROR_INTERNAL);
}
/*
IPP_TAG_ENUM)) != NULL)
{
for (i = 0; i < attr->num_values; i ++)
- if (attr->values[i].integer == IPP_CLOSE_JOB)
+ if (attr->values[i].integer == IPP_OP_CLOSE_JOB)
{
- request = ippNewRequest(IPP_CLOSE_JOB);
+ request = ippNewRequest(IPP_OP_CLOSE_JOB);
break;
}
}
if (!request)
- request = ippNewRequest(IPP_SEND_DOCUMENT);
+ request = ippNewRequest(IPP_OP_SEND_DOCUMENT);
if (!request)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOMEM), 0);
DEBUG_puts("1cupsCloseDestJob: Unable to create Close-Job/Send-Document "
"request.");
- return (IPP_INTERNAL_ERROR);
+ return (IPP_STATUS_ERROR_INTERNAL);
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
job_id);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
NULL, cupsUser());
- if (ippGetOperation(request) == IPP_SEND_DOCUMENT)
+ if (ippGetOperation(request) == IPP_OP_SEND_DOCUMENT)
ippAddBoolean(request, IPP_TAG_OPERATION, "last-document", 1);
/*
/*
* 'cupsCreateDestJob()' - Create a job on a destination.
*
- * Returns @code IPP_OK@ or @code IPP_OK_SUBST@ on success, saving the job ID
+ * 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@
if (!http || !dest || !info || !job_id)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
DEBUG_puts("1cupsCreateDestJob: Bad arguments.");
- return (IPP_INTERNAL_ERROR);
+ return (IPP_STATUS_ERROR_INTERNAL);
}
/*
* Build a Create-Job request...
*/
- if ((request = ippNewRequest(IPP_CREATE_JOB)) == NULL)
+ if ((request = ippNewRequest(IPP_OP_CREATE_JOB)) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOMEM), 0);
DEBUG_puts("1cupsCreateDestJob: Unable to create Create-Job request.");
- return (IPP_INTERNAL_ERROR);
+ return (IPP_STATUS_ERROR_INTERNAL);
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
/*
* 'cupsFinishDestDocument()' - Finish the current document.
*
- * Returns @code IPP_OK@ or @code IPP_OK_SUBST@ on success.
+ * Returns @code IPP_STATUS_OK@ or @code IPP_STATUS_OK_SUBST@ on success.
*
* @since CUPS 1.6/OS X 10.8@
*/
if (!http || !dest || !info)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
DEBUG_puts("1cupsFinishDestDocument: Bad arguments.");
- return (IPP_INTERNAL_ERROR);
+ return (IPP_STATUS_ERROR_INTERNAL);
}
/*
if (!http || !dest || !info || job_id <= 0)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
DEBUG_puts("1cupsStartDestDocument: Bad arguments.");
- return (HTTP_ERROR);
+ return (HTTP_STATUS_ERROR);
}
/*
* Create a Send-Document request...
*/
- if ((request = ippNewRequest(IPP_SEND_DOCUMENT)) == NULL)
+ if ((request = ippNewRequest(IPP_OP_SEND_DOCUMENT)) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOMEM), 0);
DEBUG_puts("1cupsStartDestDocument: Unable to create Send-Document "
"request.");
- return (HTTP_ERROR);
+ return (HTTP_STATUS_ERROR);
}
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
*
* Destination localization support for CUPS.
*
- * Copyright 2012 by Apple Inc.
+ * Copyright 2012-2013 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
if (httpSeparateURI(HTTP_URI_CODING_ALL, attr->values[0].string.text,
scheme, sizeof(scheme), userpass, sizeof(userpass),
hostname, sizeof(hostname), &port, resource,
- sizeof(resource)) < HTTP_URI_OK)
+ sizeof(resource)) < HTTP_URI_STATUS_OK)
{
DEBUG_printf(("4cups_create_localizations: Bad printer-strings-uri value "
"\"%s\".", attr->values[0].string.text));
*/
if (!strcmp(scheme, "https"))
- encryption = HTTP_ENCRYPT_ALWAYS;
+ encryption = HTTP_ENCRYPTION_ALWAYS;
else
- encryption = HTTP_ENCRYPT_IF_REQUESTED;
+ encryption = HTTP_ENCRYPTION_IF_REQUESTED;
- if ((http2 = httpConnectEncrypt(hostname, port, encryption)) == NULL)
+ if ((http2 = httpConnect2(hostname, port, NULL, AF_UNSPEC, encryption, 1,
+ 30000, NULL)) == NULL)
{
DEBUG_printf(("4cups_create_localizations: Unable to connect to "
"%s:%d: %s", hostname, port, cupsLastErrorString()));
DEBUG_printf(("4cups_create_localizations: GET %s = %s", resource,
httpStatus(status)));
- if (status == HTTP_OK)
+ if (status == HTTP_STATUS_OK)
{
/*
* Got the file, read it...
*
* Destination option/media support for CUPS.
*
- * Copyright 2012 by Apple Inc.
+ * Copyright 2012-2013 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
* Send a Get-Printer-Attributes request...
*/
- request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
+ request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL,
uri);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
response = cupsDoRequest(http, request, resource);
status = cupsLastError();
- if (status > IPP_OK_SUBST)
+ if (status > IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED)
{
DEBUG_printf(("cupsCopyDestSupported: Get-Printer-Attributes for '%s' "
"returned %s (%s)", dest->name, ippErrorString(status),
ippDelete(response);
response = NULL;
- if (status == IPP_VERSION_NOT_SUPPORTED && version > 11)
+ if (status == IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED && version > 11)
version = 11;
- else if (status == IPP_PRINTER_BUSY)
+ else if (status == IPP_STATUS_ERROR_BUSY)
{
sleep(delay);
if ((dinfo = calloc(1, sizeof(cups_dinfo_t))) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
ippDelete(response);
return (NULL);
}
if (!http || !dest || !dinfo || !media || !size)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (0);
}
if ((pwg = _pwgMediaForLegacy(media)) == NULL)
{
DEBUG_printf(("1cupsGetDestMediaByName: Unknown size '%s'.", media));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Unknown media size name."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unknown media size name."), 1);
return (0);
}
if (!http || !dest || !dinfo || width <= 0 || length <= 0 || !size)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (0);
}
{
DEBUG_printf(("1cupsGetDestMediaBySize: Invalid size %dx%d.", width,
length));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Invalid media size."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Invalid media size."), 1);
return (0);
}
if (resource)
*resource = '\0';
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (NULL);
}
if ((uri = cupsGetOption("printer-uri-supported", dest->num_options,
dest->options)) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOENT), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOENT), 0);
if (cb)
(*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_ERROR,
if (httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme),
userpass, sizeof(userpass), hostname, sizeof(hostname),
- &port, resource, resourcesize) < HTTP_URI_OK)
+ &port, resource, resourcesize) < HTTP_URI_STATUS_OK)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad printer URI."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad printer URI."), 1);
if (cb)
(*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_ERROR,
*/
if (!strcmp(scheme, "ipps") || port == 443)
- encryption = HTTP_ENCRYPT_ALWAYS;
+ encryption = HTTP_ENCRYPTION_ALWAYS;
else
- encryption = HTTP_ENCRYPT_IF_REQUESTED;
+ encryption = HTTP_ENCRYPTION_IF_REQUESTED;
http = httpConnect2(hostname, port, addrlist, AF_UNSPEC, encryption, 1, 0,
NULL);
* Get the list of local printers and pass them to the callback function...
*/
- num_dests = _cupsGetDests(CUPS_HTTP_DEFAULT, CUPS_GET_PRINTERS, NULL, &dests,
+ num_dests = _cupsGetDests(CUPS_HTTP_DEFAULT, IPP_OP_CUPS_GET_PRINTERS, NULL, &dests,
type, mask);
for (i = num_dests, dest = dests;
if (resource)
*resource = '\0';
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (NULL);
}
if (resource)
*resource = '\0';
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOENT), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOENT), 0);
return (NULL);
}
if (httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme, sizeof(scheme),
userpass, sizeof(userpass), hostname, sizeof(hostname),
- &port, resource, resourcesize) < HTTP_URI_OK)
+ &port, resource, resourcesize) < HTTP_URI_STATUS_OK)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad printer URI."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad printer URI."), 1);
return (NULL);
}
/*
* '_cupsGetDests()' - Get destinations from a server.
*
- * "op" is CUPS_GET_PRINTERS to get a full list, CUPS_GET_DEFAULT to get the
- * system-wide default printer, or IPP_GET_PRINTER_ATTRIBUTES for a known
+ * "op" is IPP_OP_CUPS_GET_PRINTERS to get a full list, IPP_OP_CUPS_GET_DEFAULT to get the
+ * system-wide default printer, or IPP_OP_GET_PRINTER_ATTRIBUTES for a known
* printer.
*
* "name" is the name of an existing printer and is only used when "op" is
- * IPP_GET_PRINTER_ATTRIBUTES.
+ * IPP_OP_GET_PRINTER_ATTRIBUTES.
*
* "dest" is initialized to point to the array of destinations.
*
#endif /* __APPLE__ */
/*
- * Build a CUPS_GET_PRINTERS or IPP_GET_PRINTER_ATTRIBUTES request, which
+ * Build a IPP_OP_CUPS_GET_PRINTERS or IPP_OP_GET_PRINTER_ATTRIBUTES request, which
* require the following attributes:
*
* attributes-charset
* attributes-natural-language
* requesting-user-name
- * printer-uri [for IPP_GET_PRINTER_ATTRIBUTES]
+ * printer-uri [for IPP_OP_GET_PRINTER_ATTRIBUTES]
*/
request = ippNewRequest(op);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
"requesting-user-name", NULL, cupsUser());
- if (name && op != CUPS_GET_DEFAULT)
+ if (name && op != IPP_OP_CUPS_GET_DEFAULT)
{
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
"localhost", ippPort(), "/printers/%s", name);
if (!dests)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad NULL dests pointer"), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad NULL dests pointer"), 1);
return (0);
}
*/
*dests = (cups_dest_t *)0;
- num_dests = _cupsGetDests(http, CUPS_GET_PRINTERS, NULL, dests, 0, 0);
+ num_dests = _cupsGetDests(http, IPP_OP_CUPS_GET_PRINTERS, NULL, dests, 0, 0);
- if (cupsLastError() >= IPP_REDIRECTION_OTHER_SITE)
+ if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
{
cupsFreeDests(num_dests, *dests);
*dests = (cups_dest_t *)0;
*/
if (num_dests > 0)
- _cupsSetError(IPP_OK, NULL, 0);
+ _cupsSetError(IPP_STATUS_OK, NULL, 0);
return (num_dests);
}
defname[256]; /* Default printer name */
const char *home = getenv("HOME"); /* Home directory */
int set_as_default = 0; /* Set returned destination as default */
- ipp_op_t op = IPP_GET_PRINTER_ATTRIBUTES;
+ ipp_op_t op = IPP_OP_GET_PRINTER_ATTRIBUTES;
/* IPP operation to get server ops */
_cups_globals_t *cg = _cupsGlobals(); /* Pointer to library globals */
* No locally-set default destination, ask the server...
*/
- op = CUPS_GET_DEFAULT;
+ op = IPP_OP_CUPS_GET_DEFAULT;
}
}
if (!_cupsGetDests(http, op, name, &dest, 0, 0))
{
- if (op == CUPS_GET_DEFAULT || (name && !set_as_default))
+ if (op == IPP_OP_CUPS_GET_DEFAULT || (name && !set_as_default))
return (NULL);
/*
* configuration file does not exist. Find out the real default.
*/
- if (!_cupsGetDests(http, CUPS_GET_DEFAULT, NULL, &dest, 0, 0))
+ if (!_cupsGetDests(http, IPP_OP_CUPS_GET_DEFAULT, NULL, &dest, 0, 0))
return (NULL);
}
* Get the server destinations...
*/
- num_temps = _cupsGetDests(http, CUPS_GET_PRINTERS, NULL, &temps, 0, 0);
+ num_temps = _cupsGetDests(http, IPP_OP_CUPS_GET_PRINTERS, NULL, &temps, 0, 0);
- if (cupsLastError() >= IPP_REDIRECTION_OTHER_SITE)
+ if (cupsLastError() >= IPP_STATUS_REDIRECTION_OTHER_SITE)
{
cupsFreeDests(num_temps, temps);
return (-1);
_HTTP_RESOLVE_FQDN, cups_dnssd_resolve_cb,
&resolve)) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Unable to resolve printer URI."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unable to resolve printer URI."), 1);
if (cb)
(*cb)(user_data, CUPS_DEST_FLAGS_UNCONNECTED | CUPS_DEST_FLAGS_ERROR,
*
* Option encoding routines for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
static const ipp_op_t ipp_job_creation[] =
{
- IPP_PRINT_JOB,
- IPP_PRINT_URI,
- IPP_CREATE_JOB,
+ IPP_OP_PRINT_JOB,
+ IPP_OP_PRINT_URI,
+ IPP_OP_CREATE_JOB,
IPP_OP_CUPS_NONE
};
static const ipp_op_t ipp_doc_creation[] =
{
- IPP_PRINT_JOB,
- IPP_PRINT_URI,
- IPP_SEND_DOCUMENT,
- IPP_SEND_URI,
+ IPP_OP_PRINT_JOB,
+ IPP_OP_PRINT_URI,
+ IPP_OP_SEND_DOCUMENT,
+ IPP_OP_SEND_URI,
IPP_OP_CUPS_NONE
};
static const ipp_op_t ipp_sub_creation[] =
{
- IPP_PRINT_JOB,
- IPP_PRINT_URI,
- IPP_CREATE_JOB,
- IPP_CREATE_PRINTER_SUBSCRIPTION,
- IPP_CREATE_JOB_SUBSCRIPTION,
+ IPP_OP_PRINT_JOB,
+ IPP_OP_PRINT_URI,
+ IPP_OP_CREATE_JOB,
+ IPP_OP_CREATE_PRINTER_SUBSCRIPTION,
+ IPP_OP_CREATE_JOB_SUBSCRIPTION,
IPP_OP_CUPS_NONE
};
static const ipp_op_t ipp_all_print[] =
{
- IPP_PRINT_JOB,
- IPP_PRINT_URI,
- IPP_CREATE_JOB,
- IPP_SEND_DOCUMENT,
- IPP_SEND_URI,
+ IPP_OP_PRINT_JOB,
+ IPP_OP_PRINT_URI,
+ IPP_OP_CREATE_JOB,
+ IPP_OP_SEND_DOCUMENT,
+ IPP_OP_SEND_URI,
IPP_OP_CUPS_NONE
};
static const ipp_op_t ipp_all_limit[] =
{
- IPP_GET_JOBS,
- IPP_GET_PRINTER_ATTRIBUTES,
- CUPS_GET_PRINTERS,
- CUPS_GET_CLASSES,
- CUPS_GET_DEVICES,
- CUPS_GET_PPDS,
+ IPP_OP_GET_JOBS,
+ IPP_OP_GET_PRINTER_ATTRIBUTES,
+ IPP_OP_CUPS_GET_PRINTERS,
+ IPP_OP_CUPS_GET_CLASSES,
+ IPP_OP_CUPS_GET_DEVICES,
+ IPP_OP_CUPS_GET_PPDS,
IPP_OP_CUPS_NONE
};
static const ipp_op_t ipp_set_printer[] =
{
- IPP_SET_PRINTER_ATTRIBUTES,
- CUPS_ADD_MODIFY_PRINTER,
- CUPS_ADD_MODIFY_CLASS,
+ IPP_OP_SET_PRINTER_ATTRIBUTES,
+ IPP_OP_CUPS_ADD_MODIFY_PRINTER,
+ IPP_OP_CUPS_ADD_MODIFY_CLASS,
IPP_OP_CUPS_NONE
};
static const ipp_op_t cups_am_class[] =
{
- CUPS_ADD_MODIFY_CLASS,
+ IPP_OP_CUPS_ADD_MODIFY_CLASS,
IPP_OP_CUPS_NONE
};
static const ipp_op_t cups_am_printer[] =
{
- CUPS_ADD_MODIFY_PRINTER,
+ IPP_OP_CUPS_ADD_MODIFY_PRINTER,
IPP_OP_CUPS_NONE
};
static const ipp_op_t cups_schemes[] =
{
- CUPS_GET_DEVICES,
- CUPS_GET_PPDS,
+ IPP_OP_CUPS_GET_DEVICES,
+ IPP_OP_CUPS_GET_PPDS,
IPP_OP_CUPS_NONE
};
static const ipp_op_t cups_get_ppds[] =
{
- CUPS_GET_PPDS,
+ IPP_OP_CUPS_GET_PPDS,
IPP_OP_CUPS_NONE
};
static const ipp_op_t cups_ppd_name[] =
{
- CUPS_ADD_MODIFY_PRINTER,
- CUPS_GET_PPD,
+ IPP_OP_CUPS_ADD_MODIFY_PRINTER,
+ IPP_OP_CUPS_GET_PPD,
IPP_OP_CUPS_NONE
};
op = ippGetOperation(ipp);
if (group_tag == IPP_TAG_OPERATION &&
- (op == IPP_PRINT_JOB || op == IPP_PRINT_URI ||
- op == IPP_SEND_DOCUMENT || op == IPP_SEND_URI))
+ (op == IPP_OP_PRINT_JOB || op == IPP_OP_PRINT_URI ||
+ op == IPP_OP_SEND_DOCUMENT || op == IPP_OP_SEND_URI))
{
/*
* Handle the document format stuff first...
*
* cupsGetDevices implementation for CUPS.
*
- * Copyright 2008-2012 by Apple Inc.
+ * Copyright 2008-2013 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
user_data));
if (!callback)
- return (IPP_INTERNAL_ERROR);
+ return (IPP_STATUS_ERROR_INTERNAL);
if (!http)
http = _cupsConnect();
if (!http)
- return (IPP_SERVICE_UNAVAILABLE);
+ return (IPP_STATUS_ERROR_SERVICE_UNAVAILABLE);
/*
* Create a CUPS-Get-Devices request...
*/
- request = ippNewRequest(CUPS_GET_DEVICES);
+ request = ippNewRequest(IPP_OP_CUPS_GET_DEVICES);
if (timeout > 0)
ippAddInteger(request, IPP_TAG_OPERATION, IPP_TAG_INTEGER, "timeout",
status = cupsSendRequest(http, request, "/", ippLength(request));
DEBUG_puts("2cupsGetDevices: Waiting for response status...");
- while (status == HTTP_CONTINUE)
+ while (status == HTTP_STATUS_CONTINUE)
status = httpUpdate(http);
- if (status != HTTP_OK)
+ if (status != HTTP_STATUS_OK)
{
httpFlush(http);
- if (status == HTTP_UNAUTHORIZED)
+ if (status == HTTP_STATUS_UNAUTHORIZED)
{
/*
* See if we can do authentication...
DEBUG_puts("2cupsGetDevices: Need authorization...");
if (!cupsDoAuthentication(http, "POST", "/"))
- httpReconnect(http);
+ httpReconnect2(http, 30000, NULL);
else
{
- status = HTTP_AUTHORIZATION_CANCELED;
+ status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
break;
}
}
#ifdef HAVE_SSL
- else if (status == HTTP_UPGRADE_REQUIRED)
+ else if (status == HTTP_STATUS_UPGRADE_REQUIRED)
{
/*
* Force a reconnect with encryption...
DEBUG_puts("2cupsGetDevices: Need encryption...");
- if (!httpReconnect(http))
- httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
+ if (!httpReconnect2(http, 30000, NULL))
+ httpEncryption(http, HTTP_ENCRYPTION_REQUIRED);
}
#endif /* HAVE_SSL */
}
}
- while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
+ while (status == HTTP_STATUS_UNAUTHORIZED ||
+ status == HTTP_STATUS_UPGRADE_REQUIRED);
DEBUG_printf(("2cupsGetDevices: status=%d", status));
ippDelete(request);
- if (status != HTTP_OK)
+ if (status != HTTP_STATUS_OK)
{
_cupsSetHTTPError(status);
return (cupsLastError());
do
{
- if ((state = ippRead(http, response)) == IPP_ERROR)
+ if ((state = ippRead(http, response)) == IPP_STATE_ERROR)
break;
DEBUG_printf(("2cupsGetDevices: state=%d, response->last=%p", state,
device_uri = attr->values[0].string.text;
}
}
- while (state != IPP_DATA);
+ while (state != IPP_STATE_DATA);
DEBUG_printf(("2cupsGetDevices: state=%d, response->last=%p", state,
response->last));
httpBlocking(http, blocking);
httpFlush(http);
- if (status == HTTP_ERROR)
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(http->error), 0);
+ if (status == HTTP_STATUS_ERROR)
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(http->error), 0);
else
{
attr = ippFindAttribute(response, "status-message", IPP_TAG_TEXT);
*
* Get/put file functions for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
/*
* 'cupsGetFd()' - Get a file from the server.
*
- * This function returns @code HTTP_OK@ when the file is successfully retrieved.
+ * This function returns @code HTTP_STATUS_OK@ when the file is successfully retrieved.
*
* @since CUPS 1.1.20/OS X 10.4@
*/
if (http)
http->error = EINVAL;
- return (HTTP_ERROR);
+ return (HTTP_STATUS_ERROR);
}
if (!http)
if ((http = _cupsConnect()) == NULL)
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
/*
* Then send GET requests to the HTTP server...
if (httpGet(http, resource))
{
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
- status = HTTP_ERROR;
+ status = HTTP_STATUS_ERROR;
break;
}
else
{
- status = HTTP_UNAUTHORIZED;
+ status = HTTP_STATUS_UNAUTHORIZED;
continue;
}
}
- while ((status = httpUpdate(http)) == HTTP_CONTINUE);
+ while ((status = httpUpdate(http)) == HTTP_STATUS_CONTINUE);
- if (status == HTTP_UNAUTHORIZED)
+ if (status == HTTP_STATUS_UNAUTHORIZED)
{
/*
* Flush any error message...
if (cupsDoAuthentication(http, "GET", resource))
{
- status = HTTP_AUTHORIZATION_CANCELED;
+ status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
break;
}
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
- status = HTTP_ERROR;
+ status = HTTP_STATUS_ERROR;
break;
}
continue;
}
#ifdef HAVE_SSL
- else if (status == HTTP_UPGRADE_REQUIRED)
+ else if (status == HTTP_STATUS_UPGRADE_REQUIRED)
{
/* Flush any error message... */
httpFlush(http);
/* Reconnect... */
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
- status = HTTP_ERROR;
+ status = HTTP_STATUS_ERROR;
break;
}
/* Upgrade with encryption... */
- httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
+ httpEncryption(http, HTTP_ENCRYPTION_REQUIRED);
/* Try again, this time with encryption enabled... */
continue;
}
#endif /* HAVE_SSL */
}
- while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED);
+ while (status == HTTP_STATUS_UNAUTHORIZED || status == HTTP_STATUS_UPGRADE_REQUIRED);
/*
* See if we actually got the file or an error...
*/
- if (status == HTTP_OK)
+ if (status == HTTP_STATUS_OK)
{
/*
* Yes, copy the file...
/*
* 'cupsGetFile()' - Get a file from the server.
*
- * This function returns @code HTTP_OK@ when the file is successfully retrieved.
+ * This function returns @code HTTP_STATUS_OK@ when the file is successfully retrieved.
*
* @since CUPS 1.1.20/OS X 10.4@
*/
if (http)
http->error = EINVAL;
- return (HTTP_ERROR);
+ return (HTTP_STATUS_ERROR);
}
/*
http->error = errno;
- return (HTTP_ERROR);
+ return (HTTP_STATUS_ERROR);
}
/*
close(fd);
- if (status != HTTP_OK)
+ if (status != HTTP_STATUS_OK)
unlink(filename);
/*
/*
* 'cupsPutFd()' - Put a file on the server.
*
- * This function returns @code HTTP_CREATED@ when the file is stored
+ * This function returns @code HTTP_STATUS_CREATED@ when the file is stored
* successfully.
*
* @since CUPS 1.1.20/OS X 10.4@
if (http)
http->error = EINVAL;
- return (HTTP_ERROR);
+ return (HTTP_STATUS_ERROR);
}
if (!http)
if ((http = _cupsConnect()) == NULL)
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
/*
* Then send PUT requests to the HTTP server...
httpClearFields(http);
httpSetField(http, HTTP_FIELD_AUTHORIZATION, http->authstring);
httpSetField(http, HTTP_FIELD_TRANSFER_ENCODING, "chunked");
- httpSetExpect(http, HTTP_CONTINUE);
+ httpSetExpect(http, HTTP_STATUS_CONTINUE);
if (httpPut(http, resource))
{
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
- status = HTTP_ERROR;
+ status = HTTP_STATUS_ERROR;
break;
}
else
{
- status = HTTP_UNAUTHORIZED;
+ status = HTTP_STATUS_UNAUTHORIZED;
continue;
}
}
if (httpWait(http, 1000))
status = httpUpdate(http);
else
- status = HTTP_CONTINUE;
+ status = HTTP_STATUS_CONTINUE;
- if (status == HTTP_CONTINUE)
+ if (status == HTTP_STATUS_CONTINUE)
{
/*
* Copy the file...
while ((bytes = read(fd, buffer, sizeof(buffer))) > 0)
if (httpCheck(http))
{
- if ((status = httpUpdate(http)) != HTTP_CONTINUE)
+ if ((status = httpUpdate(http)) != HTTP_STATUS_CONTINUE)
break;
}
else
httpWrite2(http, buffer, bytes);
}
- if (status == HTTP_CONTINUE)
+ if (status == HTTP_STATUS_CONTINUE)
{
httpWrite2(http, buffer, 0);
- while ((status = httpUpdate(http)) == HTTP_CONTINUE);
+ while ((status = httpUpdate(http)) == HTTP_STATUS_CONTINUE);
}
- if (status == HTTP_ERROR && !retries)
+ if (status == HTTP_STATUS_ERROR && !retries)
{
DEBUG_printf(("2cupsPutFd: retry on status %d", status));
httpFlush(http);
/* Reconnect... */
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
- status = HTTP_ERROR;
+ status = HTTP_STATUS_ERROR;
break;
}
DEBUG_printf(("2cupsPutFd: status=%d", status));
- if (status == HTTP_UNAUTHORIZED)
+ if (status == HTTP_STATUS_UNAUTHORIZED)
{
/*
* Flush any error message...
if (cupsDoAuthentication(http, "PUT", resource))
{
- status = HTTP_AUTHORIZATION_CANCELED;
+ status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
break;
}
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
- status = HTTP_ERROR;
+ status = HTTP_STATUS_ERROR;
break;
}
continue;
}
#ifdef HAVE_SSL
- else if (status == HTTP_UPGRADE_REQUIRED)
+ else if (status == HTTP_STATUS_UPGRADE_REQUIRED)
{
/* Flush any error message... */
httpFlush(http);
/* Reconnect... */
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
- status = HTTP_ERROR;
+ status = HTTP_STATUS_ERROR;
break;
}
/* Upgrade with encryption... */
- httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
+ httpEncryption(http, HTTP_ENCRYPTION_REQUIRED);
/* Try again, this time with encryption enabled... */
continue;
}
#endif /* HAVE_SSL */
}
- while (status == HTTP_UNAUTHORIZED || status == HTTP_UPGRADE_REQUIRED ||
- (status == HTTP_ERROR && retries < 2));
+ while (status == HTTP_STATUS_UNAUTHORIZED || status == HTTP_STATUS_UPGRADE_REQUIRED ||
+ (status == HTTP_STATUS_ERROR && retries < 2));
/*
* See if we actually put the file or an error...
*/
- if (status != HTTP_CREATED)
+ if (status != HTTP_STATUS_CREATED)
{
_cupsSetHTTPError(status);
httpFlush(http);
if (http)
http->error = EINVAL;
- return (HTTP_ERROR);
+ return (HTTP_STATUS_ERROR);
}
/*
http->error = errno;
- return (HTTP_ERROR);
+ return (HTTP_STATUS_ERROR);
}
/*
*
* HTTP address list routines for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
if (!sock)
{
errno = EINVAL;
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
return (NULL);
}
if (!addrlist)
#ifdef WIN32
- _cupsSetError(IPP_SERVICE_UNAVAILABLE, "Connection failed", 0);
+ _cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, "Connection failed", 0);
#else
- _cupsSetError(IPP_SERVICE_UNAVAILABLE, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, strerror(errno), 0);
#endif /* WIN32 */
return (addrlist);
if (!temp)
{
httpAddrFreeList(first);
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
return (NULL);
}
if (error == EAI_FAIL)
cg->need_res_init = 1;
- _cupsSetError(IPP_INTERNAL_ERROR, gai_strerror(error), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, gai_strerror(error), 0);
}
#else
if (h_errno == NO_RECOVERY)
cg->need_res_init = 1;
- _cupsSetError(IPP_INTERNAL_ERROR, hstrerror(h_errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, hstrerror(h_errno), 0);
}
}
#endif /* HAVE_GETADDRINFO */
{
httpAddrFreeList(first);
- _cupsSetError(IPP_INTERNAL_ERROR, _("Unknown service name."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unknown service name."), 1);
return (NULL);
}
temp = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t));
if (!temp)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
httpAddrFreeList(first);
return (NULL);
}
temp = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t));
if (!temp)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
httpAddrFreeList(first);
return (NULL);
}
temp = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t));
if (!temp)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
httpAddrFreeList(first);
return (NULL);
}
temp = (http_addrlist_t *)calloc(1, sizeof(http_addrlist_t));
if (!temp)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
httpAddrFreeList(first);
return (NULL);
}
if (uri)
*uri = '\0';
- return (HTTP_URI_BAD_ARGUMENTS);
+ return (HTTP_URI_STATUS_BAD_ARGUMENTS);
}
/*
*ptr = '\0';
- return (HTTP_URI_OK);
+ return (HTTP_URI_STATUS_OK);
/*
* Clear the URI string and return an overflow error; I don't usually
assemble_overflow:
*uri = '\0';
- return (HTTP_URI_OVERFLOW);
+ return (HTTP_URI_STATUS_OVERFLOW);
}
if (uri)
*uri = '\0';
- return (HTTP_URI_BAD_ARGUMENTS);
+ return (HTTP_URI_STATUS_BAD_ARGUMENTS);
}
/*
if (bytes >= sizeof(resource))
{
*uri = '\0';
- return (HTTP_URI_OVERFLOW);
+ return (HTTP_URI_STATUS_OVERFLOW);
}
else
return (httpAssembleURI(encoding, uri, urilen, scheme, username, host,
if (!uri || !port || !scheme || schemelen <= 0 || !username ||
usernamelen <= 0 || !host || hostlen <= 0 || !resource ||
resourcelen <= 0)
- return (HTTP_URI_BAD_ARGUMENTS);
+ return (HTTP_URI_STATUS_BAD_ARGUMENTS);
if (!*uri)
- return (HTTP_URI_BAD_URI);
+ return (HTTP_URI_STATUS_BAD_URI);
/*
* Grab the scheme portion of the URI...
*/
- status = HTTP_URI_OK;
+ status = HTTP_URI_STATUS_OK;
if (!strncmp(uri, "//", 2))
{
*/
strlcpy(scheme, "ipp", schemelen);
- status = HTTP_URI_MISSING_SCHEME;
+ status = HTTP_URI_STATUS_MISSING_SCHEME;
}
else if (*uri == '/')
{
*/
strlcpy(scheme, "file", schemelen);
- status = HTTP_URI_MISSING_SCHEME;
+ status = HTTP_URI_STATUS_MISSING_SCHEME;
}
else
{
if (*uri != ':')
{
*scheme = '\0';
- return (HTTP_URI_BAD_SCHEME);
+ return (HTTP_URI_STATUS_BAD_SCHEME);
}
uri ++;
else if (!strcmp(scheme, "socket")) /* Not yet registered with IANA... */
*port = 9100;
else if (strcmp(scheme, "file") && strcmp(scheme, "mailto"))
- status = HTTP_URI_UNKNOWN_SCHEME;
+ status = HTTP_URI_STATUS_UNKNOWN_SCHEME;
/*
* Now see if we have a hostname...
if (!uri)
{
*username = '\0';
- return (HTTP_URI_BAD_USERNAME);
+ return (HTTP_URI_STATUS_BAD_USERNAME);
}
uri ++;
if (!uri)
{
*host = '\0';
- return (HTTP_URI_BAD_HOSTNAME);
+ return (HTTP_URI_STATUS_BAD_HOSTNAME);
}
/*
if (*uri != ']')
{
*host = '\0';
- return (HTTP_URI_BAD_HOSTNAME);
+ return (HTTP_URI_STATUS_BAD_HOSTNAME);
}
uri ++;
else if (*ptr != ':' && *ptr != '.' && !isxdigit(*ptr & 255))
{
*host = '\0';
- return (HTTP_URI_BAD_HOSTNAME);
+ return (HTTP_URI_STATUS_BAD_HOSTNAME);
}
}
else
"!$&'()*+,;=\\", *ptr))
{
*host = '\0';
- return (HTTP_URI_BAD_HOSTNAME);
+ return (HTTP_URI_STATUS_BAD_HOSTNAME);
}
/*
if (!uri)
{
*host = '\0';
- return (HTTP_URI_BAD_HOSTNAME);
+ return (HTTP_URI_STATUS_BAD_HOSTNAME);
}
}
if (!strcmp(scheme, "file") && strcmp(host, "localhost") && host[0])
{
*host = '\0';
- return (HTTP_URI_BAD_HOSTNAME);
+ return (HTTP_URI_STATUS_BAD_HOSTNAME);
}
/*
if (!isdigit(uri[1] & 255))
{
*port = 0;
- return (HTTP_URI_BAD_PORT);
+ return (HTTP_URI_STATUS_BAD_PORT);
}
*port = strtol(uri + 1, (char **)&uri, 10);
if (*uri != '/' && *uri)
{
*port = 0;
- return (HTTP_URI_BAD_PORT);
+ return (HTTP_URI_STATUS_BAD_PORT);
}
}
}
* Hostname but no path...
*/
- status = HTTP_URI_MISSING_RESOURCE;
+ status = HTTP_URI_STATUS_MISSING_RESOURCE;
*resource = '/';
/*
if (!uri)
{
*resource = '\0';
- return (HTTP_URI_BAD_RESOURCE);
+ return (HTTP_URI_STATUS_BAD_RESOURCE);
}
/*
switch (status)
{
- case HTTP_CONTINUE :
+ case HTTP_STATUS_CONTINUE :
s = _("Continue");
break;
- case HTTP_SWITCHING_PROTOCOLS :
+ case HTTP_STATUS_SWITCHING_PROTOCOLS :
s = _("Switching Protocols");
break;
- case HTTP_OK :
+ case HTTP_STATUS_OK :
s = _("OK");
break;
- case HTTP_CREATED :
+ case HTTP_STATUS_CREATED :
s = _("Created");
break;
- case HTTP_ACCEPTED :
+ case HTTP_STATUS_ACCEPTED :
s = _("Accepted");
break;
- case HTTP_NO_CONTENT :
+ case HTTP_STATUS_NO_CONTENT :
s = _("No Content");
break;
- case HTTP_MOVED_PERMANENTLY :
+ case HTTP_STATUS_MOVED_PERMANENTLY :
s = _("Moved Permanently");
break;
- case HTTP_SEE_OTHER :
+ case HTTP_STATUS_SEE_OTHER :
s = _("See Other");
break;
- case HTTP_NOT_MODIFIED :
+ case HTTP_STATUS_NOT_MODIFIED :
s = _("Not Modified");
break;
- case HTTP_BAD_REQUEST :
+ case HTTP_STATUS_BAD_REQUEST :
s = _("Bad Request");
break;
- case HTTP_UNAUTHORIZED :
- case HTTP_AUTHORIZATION_CANCELED :
+ case HTTP_STATUS_UNAUTHORIZED :
+ case HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED :
s = _("Unauthorized");
break;
- case HTTP_FORBIDDEN :
+ case HTTP_STATUS_FORBIDDEN :
s = _("Forbidden");
break;
- case HTTP_NOT_FOUND :
+ case HTTP_STATUS_NOT_FOUND :
s = _("Not Found");
break;
- case HTTP_REQUEST_TOO_LARGE :
+ case HTTP_STATUS_REQUEST_TOO_LARGE :
s = _("Request Entity Too Large");
break;
- case HTTP_URI_TOO_LONG :
+ case HTTP_STATUS_URI_TOO_LONG :
s = _("URI Too Long");
break;
- case HTTP_UPGRADE_REQUIRED :
+ case HTTP_STATUS_UPGRADE_REQUIRED :
s = _("Upgrade Required");
break;
- case HTTP_NOT_IMPLEMENTED :
+ case HTTP_STATUS_NOT_IMPLEMENTED :
s = _("Not Implemented");
break;
- case HTTP_NOT_SUPPORTED :
+ case HTTP_STATUS_NOT_SUPPORTED :
s = _("Not Supported");
break;
- case HTTP_EXPECTATION_FAILED :
+ case HTTP_STATUS_EXPECTATION_FAILED :
s = _("Expectation Failed");
break;
- case HTTP_SERVICE_UNAVAILABLE :
+ case HTTP_STATUS_SERVICE_UNAVAILABLE :
s = _("Service Unavailable");
break;
- case HTTP_SERVER_ERROR :
+ case HTTP_STATUS_SERVER_ERROR :
s = _("Internal Server Error");
break;
- case HTTP_PKI_ERROR :
+ case HTTP_STATUS_CUPS_PKI_ERROR :
s = _("SSL/TLS Negotiation Error");
break;
- case HTTP_WEBIF_DISABLED :
+ case HTTP_STATUS_CUPS_WEBIF_DISABLED :
s = _("Web Interface is Disabled");
break;
if ((status = httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme,
sizeof(scheme), userpass, sizeof(userpass),
hostname, sizeof(hostname), &port, resource,
- sizeof(resource))) < HTTP_URI_OK)
+ sizeof(resource))) < HTTP_URI_STATUS_OK)
#else
if (httpSeparateURI(HTTP_URI_CODING_ALL, uri, scheme,
sizeof(scheme), userpass, sizeof(userpass),
hostname, sizeof(hostname), &port, resource,
- sizeof(resource)) < HTTP_URI_OK)
+ sizeof(resource)) < HTTP_URI_STATUS_OK)
#endif /* DEBUG */
{
if (options & _HTTP_RESOLVE_STDERR)
httpConnect(const char *host, /* I - Host to connect to */
int port) /* I - Port number */
{
- return (httpConnect2(host, port, NULL, AF_UNSPEC, HTTP_ENCRYPT_IF_REQUESTED,
+ return (httpConnect2(host, port, NULL, AF_UNSPEC, HTTP_ENCRYPTION_IF_REQUESTED,
1, 30000, NULL));
}
httpDelete(http_t *http, /* I - Connection to server */
const char *uri) /* I - URI to delete */
{
- return (http_send(http, HTTP_DELETE, uri));
+ return (http_send(http, HTTP_STATE_DELETE, uri));
}
http->encryption = e;
- if ((http->encryption == HTTP_ENCRYPT_ALWAYS && !http->tls) ||
- (http->encryption == HTTP_ENCRYPT_NEVER && http->tls))
- return (httpReconnect(http));
- else if (http->encryption == HTTP_ENCRYPT_REQUIRED && !http->tls)
+ if ((http->encryption == HTTP_ENCRYPTION_ALWAYS && !http->tls) ||
+ (http->encryption == HTTP_ENCRYPTION_NEVER && http->tls))
+ return (httpReconnect2(http, 30000, NULL));
+ else if (http->encryption == HTTP_ENCRYPTION_REQUIRED && !http->tls)
return (http_upgrade(http));
else
return (0);
#else
- if (e == HTTP_ENCRYPT_ALWAYS || e == HTTP_ENCRYPT_REQUIRED)
+ if (e == HTTP_ENCRYPTION_ALWAYS || e == HTTP_ENCRYPTION_REQUIRED)
return (-1);
else
return (0);
httpGet(http_t *http, /* I - Connection to server */
const char *uri) /* I - URI to get */
{
- return (http_send(http, HTTP_GET, uri));
+ return (http_send(http, HTTP_STATE_GET, uri));
}
* and 2^31-1 for other successful requests...
*/
- if (http->status >= HTTP_MULTIPLE_CHOICES ||
+ if (http->status >= HTTP_STATUS_MULTIPLE_CHOICES ||
http->state == HTTP_STATE_OPTIONS ||
(http->state == HTTP_STATE_GET && http->mode == _HTTP_MODE_SERVER) ||
http->state == HTTP_STATE_HEAD ||
const char *uri) /* I - URI for head */
{
DEBUG_printf(("httpHead(http=%p, uri=\"%s\")", http, uri));
- return (http_send(http, HTTP_HEAD, uri));
+ return (http_send(http, HTTP_STATE_HEAD, uri));
}
httpOptions(http_t *http, /* I - Connection to server */
const char *uri) /* I - URI for options */
{
- return (http_send(http, HTTP_OPTIONS, uri));
+ return (http_send(http, HTTP_STATE_OPTIONS, uri));
}
httpPost(http_t *http, /* I - Connection to server */
const char *uri) /* I - URI for post */
{
- return (http_send(http, HTTP_POST, uri));
+ return (http_send(http, HTTP_STATE_POST, uri));
}
const char *uri) /* I - URI to put */
{
DEBUG_printf(("httpPut(http=%p, uri=\"%s\")", http, uri));
- return (http_send(http, HTTP_PUT, uri));
+ return (http_send(http, HTTP_STATE_PUT, uri));
}
if (!http)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (-1);
}
http->error = 0;
#ifdef HAVE_SSL
- if (http->encryption == HTTP_ENCRYPT_ALWAYS)
+ if (http->encryption == HTTP_ENCRYPTION_ALWAYS)
{
/*
* Always do encryption via SSL.
return (-1);
}
}
- else if (http->encryption == HTTP_ENCRYPT_REQUIRED)
+ else if (http->encryption == HTTP_ENCRYPTION_REQUIRED)
return (http_upgrade(http));
#endif /* HAVE_SSL */
httpTrace(http_t *http, /* I - Connection to server */
const char *uri) /* I - URI for trace */
{
- return (http_send(http, HTTP_TRACE, uri));
+ return (http_send(http, HTTP_STATE_TRACE, uri));
}
return (0);
}
- if (http->status < HTTP_BAD_REQUEST)
+ if (http->status < HTTP_STATUS_BAD_REQUEST)
http->digest_tries = 0;
#ifdef HAVE_SSL
- if (http->status == HTTP_SWITCHING_PROTOCOLS && !http->tls)
+ if (http->status == HTTP_STATUS_SWITCHING_PROTOCOLS && !http->tls)
{
if (http_setup_ssl(http) != 0)
{
if (!http->fields[HTTP_FIELD_DATE][0])
httpSetField(http, HTTP_FIELD_DATE, httpGetDateString(time(NULL)));
- if (status >= HTTP_BAD_REQUEST && http->keep_alive)
+ if (status >= HTTP_STATUS_BAD_REQUEST && http->keep_alive)
{
http->keep_alive = 0;
httpSetField(http, HTTP_FIELD_KEEP_ALIVE, "");
}
else if (!strcmp(value, "x-gzip") || !strcmp(value, "gzip"))
{
- if (http->state == HTTP_GET_SEND || http->state == HTTP_POST_SEND)
+ if (http->state == HTTP_STATE_GET_SEND ||
+ http->state == HTTP_STATE_POST_SEND)
coding = http->mode == _HTTP_MODE_SERVER ? _HTTP_CODING_GZIP :
_HTTP_CODING_GUNZIP;
- else if (http->state == HTTP_STATE_POST_RECV || http->state == HTTP_PUT_RECV)
+ else if (http->state == HTTP_STATE_POST_RECV ||
+ http->state == HTTP_STATE_PUT_RECV)
coding = http->mode == _HTTP_MODE_CLIENT ? _HTTP_CODING_GZIP :
_HTTP_CODING_GUNZIP;
else
}
else if (!strcmp(value, "x-deflate") || !strcmp(value, "deflate"))
{
- if (http->state == HTTP_GET_SEND || http->state == HTTP_POST_SEND)
+ if (http->state == HTTP_STATE_GET_SEND ||
+ http->state == HTTP_STATE_POST_SEND)
coding = http->mode == _HTTP_MODE_SERVER ? _HTTP_CODING_DEFLATE :
_HTTP_CODING_INFLATE;
- else if (http->state == HTTP_STATE_POST_RECV || http->state == HTTP_PUT_RECV)
+ else if (http->state == HTTP_STATE_POST_RECV ||
+ http->state == HTTP_STATE_PUT_RECV)
coding = http->mode == _HTTP_MODE_CLIENT ? _HTTP_CODING_DEFLATE :
_HTTP_CODING_INFLATE;
else
if ((http = calloc(sizeof(http_t), 1)) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
httpAddrFreeList(addrlist);
return (NULL);
}
*/
if (http->fd < 0 || http->status == HTTP_STATUS_ERROR ||
- http->status >= HTTP_BAD_REQUEST)
- if (httpReconnect(http))
+ http->status >= HTTP_STATUS_BAD_REQUEST)
+ if (httpReconnect2(http, 30000, NULL))
return (-1);
/*
if (http->wused)
{
if (httpFlushWrite(http) < 0)
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
return (-1);
}
http->state = request;
http->data_encoding = HTTP_ENCODING_FIELDS;
- if (request == HTTP_POST || request == HTTP_PUT)
+ if (request == HTTP_STATE_POST || request == HTTP_STATE_PUT)
http->state ++;
http->status = HTTP_STATUS_CONTINUE;
#ifdef HAVE_SSL
- if (http->encryption == HTTP_ENCRYPT_REQUIRED && !http->tls)
+ if (http->encryption == HTTP_ENCRYPTION_REQUIRED && !http->tls)
{
httpSetField(http, HTTP_FIELD_CONNECTION, "Upgrade");
httpSetField(http, HTTP_FIELD_UPGRADE, "TLS/1.2,TLS/1.1,TLS/1.0");
message = _("Unable to establish a secure connection to host.");
#endif /* HAVE_CSSMERRORSTRING */
- _cupsSetError(IPP_PKI_ERROR, message, 1);
+ _cupsSetError(IPP_STATUS_ERROR_CUPS_PKI, message, 1);
return (-1);
}
HTTP_STATUS_GATEWAY_TIMEOUT, /* Gateway connection timed out */
HTTP_STATUS_NOT_SUPPORTED, /* HTTP version not supported */
- CUPS_STATUS_AUTHORIZATION_CANCELED = 1000,
+ HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED = 1000,
/* User canceled authorization @since CUPS 1.4@ */
- CUPS_STATUS_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/OS X 10.7@ */
- CUPS_STATUS_WEBIF_DISABLED /* Web interface is disabled @private@ */
+ HTTP_STATUS_CUPS_PKI_ERROR, /* Error negotiating a secure connection @since CUPS 1.5/OS X 10.7@ */
+ HTTP_STATUS_CUPS_WEBIF_DISABLED /* Web interface is disabled @private@ */
# ifndef _CUPS_NO_DEPRECATED
/* Old names for this enumeration */
# define HTTP_GATEWAY_TIMEOUT HTTP_STATUS_GATEWAY_TIMEOUT
# define HTTP_NOT_SUPPORTED HTTP_STATUS_NOT_SUPPORTED
-# define HTTP_AUTHORIZATION_CANCELED CUPS_STATUS_AUTHORIZATION_CANCELED
-# define HTTP_PKI_ERROR CUPS_STATUS_PKI_ERROR
-# define HTTP_WEBIF_DISABLED CUPS_STATUS_WEBIF_DISABLED
+# define HTTP_AUTHORIZATION_CANCELED HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED
+# define HTTP_PKI_ERROR HTTP_STATUS_CUPS_PKI_ERROR
+# define HTTP_WEBIF_DISABLED HTTP_STATUS_CUPS_WEBIF_DISABLED
# endif /* !_CUPS_NO_DEPRECATED */
} http_status_t;
bufptr ++;
}
- switch (attr->value_tag & ~IPP_TAG_COPY)
+ switch (attr->value_tag & ~IPP_TAG_CUPS_CONST)
{
case IPP_TAG_ENUM :
ptr = ippEnumString(attr->name, val->integer);
* default to "all"...
*/
- if (ippGetOperation(request) == IPP_GET_JOBS)
+ if (ippGetOperation(request) == IPP_OP_GET_JOBS)
{
ra = cupsArrayNew((cups_array_func_t)strcmp, NULL);
cupsArrayAdd(ra, "job-id");
sizeof(ipp_job_collation_types[0]))))
return (ipp_job_collation_types[enumvalue - 3]);
else if (!strcmp(attrname, "job-state") &&
- enumvalue >= IPP_JOB_PENDING && enumvalue <= IPP_JOB_COMPLETED)
- return (ipp_job_states[enumvalue - IPP_JOB_PENDING]);
+ enumvalue >= IPP_JSTATE_PENDING && enumvalue <= IPP_JSTATE_COMPLETED)
+ return (ipp_job_states[enumvalue - IPP_JSTATE_PENDING]);
else if (!strcmp(attrname, "operations-supported"))
return (ippOpString((ipp_op_t)enumvalue));
else if ((!strcmp(attrname, "orientation-requested") ||
sizeof(ipp_print_qualities[0]))))
return (ipp_print_qualities[enumvalue - 3]);
else if (!strcmp(attrname, "printer-state") &&
- enumvalue >= IPP_PRINTER_IDLE && enumvalue <= IPP_PRINTER_STOPPED)
- return (ipp_printer_states[enumvalue - IPP_PRINTER_IDLE]);
+ enumvalue >= IPP_PSTATE_IDLE && enumvalue <= IPP_PSTATE_STOPPED)
+ return (ipp_printer_states[enumvalue - IPP_PSTATE_IDLE]);
/*
* Not a standard enum value, just return the decimal equivalent...
else if (op == IPP_OP_PRIVATE)
return ("windows-ext");
else if (op >= IPP_OP_CUPS_GET_DEFAULT && op <= IPP_OP_CUPS_GET_PPD)
- return (ipp_cups_ops[op - CUPS_GET_DEFAULT]);
+ return (ipp_cups_ops[op - IPP_OP_CUPS_GET_DEFAULT]);
else if (op == IPP_OP_CUPS_GET_DOCUMENT)
return (ipp_cups_ops2[0]);
const char * /* O - Tag name */
ippTagString(ipp_tag_t tag) /* I - Tag value */
{
- tag &= IPP_TAG_MASK;
+ tag &= IPP_TAG_CUPS_MASK;
if (tag < (ipp_tag_t)(sizeof(ipp_tag_names) / sizeof(ipp_tag_names[0])))
return (ipp_tag_names[tag]);
"name=\"%s\", value=%d)", ipp, group, ippTagString(group),
value_tag, ippTagString(value_tag), name, value));
- value_tag &= IPP_TAG_MASK;
+ value_tag &= IPP_TAG_CUPS_MASK;
/*
* Special-case for legacy usage: map out-of-band attributes to new ippAddOutOfBand
group, ippTagString(group), value_tag, ippTagString(value_tag), name,
num_values, values));
- value_tag &= IPP_TAG_MASK;
+ value_tag &= IPP_TAG_CUPS_MASK;
/*
* Range check input...
"name=\"%s\")", ipp, group, ippTagString(group), value_tag,
ippTagString(value_tag), name));
- value_tag &= IPP_TAG_MASK;
+ value_tag &= IPP_TAG_CUPS_MASK;
/*
* Range check input...
* Range check input...
*/
- temp_tag = (ipp_tag_t)((int)value_tag & IPP_TAG_MASK);
+ temp_tag = (ipp_tag_t)((int)value_tag & IPP_TAG_CUPS_MASK);
#if 0
if (!ipp || !name || group < IPP_TAG_ZERO ||
* See if we need to map charset, language, or locale values...
*/
- if (language && ((int)value_tag & IPP_TAG_COPY) &&
+ if (language && ((int)value_tag & IPP_TAG_CUPS_CONST) &&
strcmp(language, ipp_lang_code(language, code, sizeof(code))))
value_tag = temp_tag; /* Don't do a fast copy */
- else if (value && value_tag == (ipp_tag_t)(IPP_TAG_CHARSET | IPP_TAG_COPY) &&
+ else if (value && value_tag == (ipp_tag_t)(IPP_TAG_CHARSET | IPP_TAG_CUPS_CONST) &&
strcmp(value, ipp_get_code(value, code, sizeof(code))))
value_tag = temp_tag; /* Don't do a fast copy */
- else if (value && value_tag == (ipp_tag_t)(IPP_TAG_LANGUAGE | IPP_TAG_COPY) &&
+ else if (value && value_tag == (ipp_tag_t)(IPP_TAG_LANGUAGE | IPP_TAG_CUPS_CONST) &&
strcmp(value, ipp_lang_code(value, code, sizeof(code))))
value_tag = temp_tag; /* Don't do a fast copy */
* Initialize the attribute data...
*/
- if ((int)value_tag & IPP_TAG_COPY)
+ if ((int)value_tag & IPP_TAG_CUPS_CONST)
{
attr->values[0].string.language = (char *)language;
attr->values[0].string.text = (char *)value;
* Range check input...
*/
- temp_tag = (ipp_tag_t)((int)value_tag & IPP_TAG_MASK);
+ temp_tag = (ipp_tag_t)((int)value_tag & IPP_TAG_CUPS_MASK);
#if 0
if (!ipp || !name || group < IPP_TAG_ZERO ||
* See if we need to map charset, language, or locale values...
*/
- if (language && ((int)value_tag & IPP_TAG_COPY) &&
+ if (language && ((int)value_tag & IPP_TAG_CUPS_CONST) &&
strcmp(language, ipp_lang_code(language, code, sizeof(code))))
value_tag = temp_tag; /* Don't do a fast copy */
- else if (values && value_tag == (ipp_tag_t)(IPP_TAG_CHARSET | IPP_TAG_COPY))
+ else if (values && value_tag == (ipp_tag_t)(IPP_TAG_CHARSET | IPP_TAG_CUPS_CONST))
{
for (i = 0; i < num_values; i ++)
if (strcmp(values[i], ipp_get_code(values[i], code, sizeof(code))))
break;
}
}
- else if (values && value_tag == (ipp_tag_t)(IPP_TAG_LANGUAGE | IPP_TAG_COPY))
+ else if (values && value_tag == (ipp_tag_t)(IPP_TAG_LANGUAGE | IPP_TAG_CUPS_CONST))
{
for (i = 0; i < num_values; i ++)
if (strcmp(values[i], ipp_lang_code(values[i], code, sizeof(code))))
{
if (value == attr->values)
{
- if ((int)value_tag & IPP_TAG_COPY)
+ if ((int)value_tag & IPP_TAG_CUPS_CONST)
value->string.language = (char *)language;
else
value->string.language = _cupsStrAlloc(ipp_lang_code(language, code,
if (values)
{
- if ((int)value_tag & IPP_TAG_COPY)
+ if ((int)value_tag & IPP_TAG_CUPS_CONST)
value->string.text = (char *)*values++;
else if (value_tag == IPP_TAG_CHARSET)
value->string.text = _cupsStrAlloc(ipp_get_code(*values++, code, sizeof(code)));
* Copy it...
*/
- quickcopy = quickcopy ? IPP_TAG_COPY : 0;
+ quickcopy = quickcopy ? IPP_TAG_CUPS_CONST : 0;
- switch (srcattr->value_tag & ~IPP_TAG_COPY)
+ switch (srcattr->value_tag & ~IPP_TAG_CUPS_CONST)
{
case IPP_TAG_ZERO :
dstattr = ippAddSeparator(dst);
i --, srcval ++, dstval ++)
dstval->string.text = srcval->string.text;
}
- else if (srcattr->value_tag & IPP_TAG_COPY)
+ else if (srcattr->value_tag & IPP_TAG_CUPS_CONST)
{
for (i = srcattr->num_values, srcval = srcattr->values,
dstval = dstattr->values;
dstval->string.text = srcval->string.text;
}
}
- else if (srcattr->value_tag & IPP_TAG_COPY)
+ else if (srcattr->value_tag & IPP_TAG_CUPS_CONST)
{
for (i = srcattr->num_values, srcval = srcattr->values,
dstval = dstattr->values;
DEBUG_printf(("4ippFindAttribute: attr=%p, name=\"%s\"", attr,
attr->name));
- value_tag = (ipp_tag_t)(attr->value_tag & IPP_TAG_MASK);
+ value_tag = (ipp_tag_t)(attr->value_tag & IPP_TAG_CUPS_MASK);
if (attr->name != NULL && _cups_strcasecmp(attr->name, name) == 0 &&
(value_tag == type || type == IPP_TAG_ZERO ||
*/
if (!ipp)
- return (IPP_IDLE);
+ return (IPP_STATE_IDLE);
/*
* Return the value...
*/
if (!ipp)
- return (IPP_INTERNAL_ERROR);
+ return (IPP_STATUS_ERROR_INTERNAL);
/*
* Return the value...
* Return the value...
*/
- return (attr->value_tag & IPP_TAG_MASK);
+ return (attr->value_tag & IPP_TAG_CUPS_MASK);
}
http, ipp, CUPS_LLCAST (http ? http->data_remaining : -1)));
if (!http)
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
DEBUG_printf(("2ippRead: http->state=%d, http->used=%d", http->state,
http->used));
DEBUG_printf(("ippReadIO(src=%p, cb=%p, blocking=%d, parent=%p, ipp=%p)",
src, cb, blocking, parent, ipp));
- DEBUG_printf(("2ippReadIO: ipp->state=%d", ipp ? ipp->state : IPP_ERROR));
+ DEBUG_printf(("2ippReadIO: ipp->state=%d", ipp ? ipp->state : IPP_STATE_ERROR));
if (!src || !ipp)
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
if ((buffer = (unsigned char *)_cupsBufferGet(IPP_BUF_SIZE)) == NULL)
{
DEBUG_puts("1ippReadIO: Unable to get read buffer.");
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
switch (ipp->state)
{
- case IPP_IDLE :
+ case IPP_STATE_IDLE :
ipp->state ++; /* Avoid common problem... */
- case IPP_HEADER :
+ case IPP_STATE_HEADER :
if (parent == NULL)
{
/*
{
DEBUG_puts("1ippReadIO: Unable to read header.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
/*
ipp->request.any.request_id));
}
- ipp->state = IPP_ATTRIBUTE;
+ ipp->state = IPP_STATE_ATTRIBUTE;
ipp->current = NULL;
ipp->curtag = IPP_TAG_ZERO;
ipp->prev = ipp->last;
if (!blocking)
break;
- case IPP_ATTRIBUTE :
+ case IPP_STATE_ATTRIBUTE :
for (;;)
{
if ((*cb)(src, buffer, 1) < 1)
{
DEBUG_puts("1ippReadIO: Callback returned EOF/error");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
DEBUG_printf(("2ippReadIO: ipp->current=%p, ipp->prev=%p",
{
DEBUG_puts("1ippReadIO: Callback returned EOF/error");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
tag = (ipp_tag_t)((((((buffer[0] << 8) | buffer[1]) << 8) |
buffer[2]) << 8) | buffer[3]);
- if (tag & IPP_TAG_COPY)
+ if (tag & IPP_TAG_CUPS_CONST)
{
/*
* Fail if the high bit is set in the tag...
*/
- _cupsSetError(IPP_INTERNAL_ERROR, _("IPP extension tag larger than 0x7FFFFFFF."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("IPP extension tag larger than 0x7FFFFFFF."), 1);
DEBUG_printf(("1ippReadIO: bad tag 0x%x.", tag));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
}
DEBUG_puts("2ippReadIO: IPP_TAG_END.");
- ipp->state = IPP_DATA;
+ ipp->state = IPP_STATE_DATA;
break;
}
else if (tag < IPP_TAG_UNSUPPORTED_VALUE)
{
DEBUG_puts("1ippReadIO: unable to read name length.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
n = (buffer[0] << 8) | buffer[1];
if (n >= IPP_BUF_SIZE)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("IPP name larger than 32767 bytes."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("IPP name larger than 32767 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad name length %d.", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
DEBUG_printf(("2ippReadIO: name length=%d", n));
if (ipp->current == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("IPP attribute has no name."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("IPP attribute has no name."), 1);
DEBUG_puts("1ippReadIO: Attribute without name and no current.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
attr = ipp->current;
- value_tag = (ipp_tag_t)(attr->value_tag & IPP_TAG_MASK);
+ value_tag = (ipp_tag_t)(attr->value_tag & IPP_TAG_CUPS_MASK);
/*
* Make sure we aren't adding a new value of a different
(tag < IPP_TAG_TEXT || tag > IPP_TAG_MIMETYPE) &&
tag != IPP_TAG_NOVALUE)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP 1setOf attribute with incompatible value "
"tags."), 1);
DEBUG_printf(("1ippReadIO: 1setOf value tag %x(%s) != %x(%s)",
value_tag, ippTagString(value_tag), tag,
ippTagString(tag)));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if (value_tag != tag)
if (tag != IPP_TAG_INTEGER && tag != IPP_TAG_RANGE)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP 1setOf attribute with incompatible value "
"tags."), 1);
DEBUG_printf(("1ippReadIO: 1setOf value tag %x(%s) != %x(%s)",
value_tag, ippTagString(value_tag), tag,
ippTagString(tag)));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if (value_tag == IPP_TAG_INTEGER && tag == IPP_TAG_RANGE)
}
else if (value_tag != tag)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP 1setOf attribute with incompatible value "
"tags."), 1);
DEBUG_printf(("1ippReadIO: value tag %x(%s) != %x(%s)",
value_tag, ippTagString(value_tag), tag,
ippTagString(tag)));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
/*
if ((value = ipp_set_value(ipp, &attr, attr->num_values)) == NULL)
{
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
}
else if (tag == IPP_TAG_MEMBERNAME)
if (n)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("IPP member name is not empty."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("IPP member name is not empty."), 1);
DEBUG_puts("1ippReadIO: member name not empty.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if (ipp->current)
attr = ipp->current = ipp_add_attr(ipp, NULL, ipp->curtag, IPP_TAG_ZERO, 1);
if (!attr)
{
- _cupsSetHTTPError(HTTP_ERROR);
+ _cupsSetHTTPError(HTTP_STATUS_ERROR);
DEBUG_puts("1ippReadIO: unable to allocate attribute.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
DEBUG_printf(("2ippReadIO: membername, ipp->current=%p, ipp->prev=%p",
{
DEBUG_puts("1ippReadIO: unable to read name.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
buffer[n] = '\0';
if ((attr = ipp->current = ipp_add_attr(ipp, (char *)buffer, ipp->curtag, tag,
1)) == NULL)
{
- _cupsSetHTTPError(HTTP_ERROR);
+ _cupsSetHTTPError(HTTP_STATUS_ERROR);
DEBUG_puts("1ippReadIO: unable to allocate attribute.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
DEBUG_printf(("2ippReadIO: name=\"%s\", ipp->current=%p, "
{
DEBUG_puts("1ippReadIO: unable to read value length.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
n = (buffer[0] << 8) | buffer[1];
if (n >= IPP_BUF_SIZE)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP value larger than 32767 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad value length %d.", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
switch (tag)
if (n != 4)
{
if (tag == IPP_TAG_INTEGER)
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP integer value not 4 bytes."), 1);
else
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP enum value not 4 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad integer value length %d.", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if ((*cb)(src, buffer, 4) < 4)
{
DEBUG_puts("1ippReadIO: Unable to read integer value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
n = (((((buffer[0] << 8) | buffer[1]) << 8) | buffer[2]) << 8) |
case IPP_TAG_BOOLEAN :
if (n != 1)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("IPP boolean value not 1 byte."),
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("IPP boolean value not 1 byte."),
1);
DEBUG_printf(("1ippReadIO: bad boolean value length %d.", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if ((*cb)(src, buffer, 1) < 1)
{
DEBUG_puts("1ippReadIO: Unable to read boolean value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
value->boolean = buffer[0];
{
DEBUG_puts("1ippReadIO: unable to read string value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
}
case IPP_TAG_DATE :
if (n != 11)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("IPP date value not 11 bytes."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("IPP date value not 11 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad date value length %d.", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if ((*cb)(src, value->date, 11) < 11)
{
DEBUG_puts("1ippReadIO: Unable to read date value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
break;
case IPP_TAG_RESOLUTION :
if (n != 9)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP resolution value not 9 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad resolution value length %d.", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if ((*cb)(src, buffer, 9) < 9)
{
DEBUG_puts("1ippReadIO: Unable to read resolution value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
value->resolution.xres =
case IPP_TAG_RANGE :
if (n != 8)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP rangeOfInteger value not 8 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad rangeOfInteger value length "
"%d.", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if ((*cb)(src, buffer, 8) < 8)
{
DEBUG_puts("1ippReadIO: Unable to read range value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
value->range.lower =
if (n < 4)
{
if (tag == IPP_TAG_TEXTLANG)
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP textWithLanguage value less than "
"minimum 4 bytes."), 1);
else
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP nameWithLanguage value less than "
"minimum 4 bytes."), 1);
DEBUG_printf(("1ippReadIO: bad stringWithLanguage value "
"length %d.", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if ((*cb)(src, buffer, n) < n)
DEBUG_puts("1ippReadIO: Unable to read string w/language "
"value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
if ((bufptr + 2 + n) >= (buffer + IPP_BUF_SIZE) ||
n >= sizeof(string))
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP language length overflows value."), 1);
DEBUG_printf(("1ippReadIO: bad language value length %d.",
n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
else if (n >= IPP_MAX_LANGUAGE)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP language length too large."), 1);
DEBUG_printf(("1ippReadIO: bad language value length %d.",
n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
memcpy(string, bufptr + 2, n);
if ((bufptr + 2 + n) >= (buffer + IPP_BUF_SIZE))
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP string length overflows value."), 1);
DEBUG_printf(("1ippReadIO: bad string value length %d.", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr[2 + n] = '\0';
if (n > 0)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP begCollection value not 0 bytes."), 1);
DEBUG_puts("1ippReadIO: begCollection tag with value length "
"> 0.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
- if (ippReadIO(src, cb, 1, ipp, value->collection) == IPP_ERROR)
+ if (ippReadIO(src, cb, 1, ipp, value->collection) == IPP_STATE_ERROR)
{
DEBUG_puts("1ippReadIO: Unable to read collection value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
break;
if (n > 0)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP endCollection value not 0 bytes."), 1);
DEBUG_puts("1ippReadIO: endCollection tag with value length "
"> 0.");
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
DEBUG_puts("1ippReadIO: endCollection tag...");
- return (ipp->state = IPP_DATA);
+ return (ipp->state = IPP_STATE_DATA);
case IPP_TAG_MEMBERNAME :
/*
if (!attr)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP memberName with no attribute."), 1);
DEBUG_puts("1ippReadIO: Member name without attribute.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
else if (n == 0)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP memberName value is empty."), 1);
DEBUG_puts("1ippReadIO: Empty member name value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
else if ((*cb)(src, buffer, n) < n)
{
DEBUG_puts("1ippReadIO: Unable to read member name value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
buffer[n] = '\0';
default : /* Other unsupported values */
if (tag == IPP_TAG_STRING && n > IPP_MAX_LENGTH)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP octetString length too large."), 1);
DEBUG_printf(("1ippReadIO: bad octetString value length %d.",
n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
value->unknown.length = n;
{
if ((value->unknown.data = malloc(n)) == NULL)
{
- _cupsSetHTTPError(HTTP_ERROR);
+ _cupsSetHTTPError(HTTP_STATUS_ERROR);
DEBUG_puts("1ippReadIO: Unable to allocate value");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if ((*cb)(src, value->unknown.data, n) < n)
{
DEBUG_puts("1ippReadIO: Unable to read unsupported value.");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
}
else
}
break;
- case IPP_DATA :
+ case IPP_STATE_DATA :
break;
default :
if (element > 0)
value->string.language = (*attr)->values[0].string.language;
- if ((int)((*attr)->value_tag) & IPP_TAG_COPY)
+ if ((int)((*attr)->value_tag) & IPP_TAG_CUPS_CONST)
value->string.text = (char *)strvalue;
else if ((temp = _cupsStrAlloc(strvalue)) != NULL)
{
* Otherwise implement changes as needed...
*/
- temp_tag = (ipp_tag_t)((int)((*attr)->value_tag) & IPP_TAG_MASK);
+ temp_tag = (ipp_tag_t)((int)((*attr)->value_tag) & IPP_TAG_CUPS_MASK);
switch (value_tag)
{
temp_tag != IPP_TAG_MIMETYPE)
return (0);
- (*attr)->value_tag = (ipp_tag_t)(IPP_TAG_NAME | ((*attr)->value_tag & IPP_TAG_COPY));
+ (*attr)->value_tag = (ipp_tag_t)(IPP_TAG_NAME | ((*attr)->value_tag & IPP_TAG_CUPS_CONST));
break;
case IPP_TAG_NAMELANG :
i --, value ++)
value->string.language = (*attr)->values[0].string.language;
- if ((int)(*attr)->value_tag & IPP_TAG_COPY)
+ if ((int)(*attr)->value_tag & IPP_TAG_CUPS_CONST)
{
/*
* Make copies of all values...
hostname, sizeof(hostname),
&port, resource, sizeof(resource));
- if (uri_status < HTTP_URI_OK)
+ if (uri_status < HTTP_URI_STATUS_OK)
{
ipp_set_error(IPP_STATUS_ERROR_BAD_REQUEST,
_("\"%s\": Bad URI value \"%s\" - %s "
"(RFC 2911 section 4.1.5)."), attr->name,
attr->values[i].string.text,
uri_status_strings[uri_status -
- HTTP_URI_OVERFLOW]);
+ HTTP_URI_STATUS_OVERFLOW]);
return (0);
}
DEBUG_printf(("ippWrite(http=%p, ipp=%p)", http, ipp));
if (!http)
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
return (ippWriteIO(http, (ipp_iocb_t)httpWrite2, http->blocking, NULL, ipp));
}
{
DEBUG_printf(("ippWriteFile(fd=%d, ipp=%p)", fd, ipp));
- ipp->state = IPP_IDLE;
+ ipp->state = IPP_STATE_IDLE;
return (ippWriteIO(&fd, (ipp_iocb_t)ipp_write_file, 1, NULL, ipp));
}
dst, cb, blocking, parent, ipp));
if (!dst || !ipp)
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
if ((buffer = (unsigned char *)_cupsBufferGet(IPP_BUF_SIZE)) == NULL)
{
DEBUG_puts("1ippWriteIO: Unable to get write buffer");
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
switch (ipp->state)
{
- case IPP_IDLE :
+ case IPP_STATE_IDLE :
ipp->state ++; /* Avoid common problem... */
- case IPP_HEADER :
+ case IPP_STATE_HEADER :
if (parent == NULL)
{
/*
{
DEBUG_puts("1ippWriteIO: Could not write IPP header...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
}
* in the request/response, with no current group.
*/
- ipp->state = IPP_ATTRIBUTE;
+ ipp->state = IPP_STATE_ATTRIBUTE;
ipp->current = ipp->attrs;
ipp->curtag = IPP_TAG_ZERO;
if (!blocking)
break;
- case IPP_ATTRIBUTE :
+ case IPP_STATE_ATTRIBUTE :
while (ipp->current != NULL)
{
/*
{
DEBUG_printf(("1ippWriteIO: Attribute name too long (%d)", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
/*
{
DEBUG_printf(("1ippWriteIO: Attribute name too long (%d)", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
/*
* Now write the attribute value(s)...
*/
- switch (attr->value_tag & ~IPP_TAG_COPY)
+ switch (attr->value_tag & ~IPP_TAG_CUPS_CONST)
{
case IPP_TAG_UNSUPPORTED_VALUE :
case IPP_TAG_DEFAULT :
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
{
DEBUG_printf(("1ippWriteIO: String too long (%d)", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
DEBUG_printf(("2ippWriteIO: writing string=%d,\"%s\"", n,
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
DEBUG_printf(("1ippWriteIO: text/nameWithLanguage value "
"too long (%d)", n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if ((int)(IPP_BUF_SIZE - (bufptr - buffer)) < (n + 2))
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
* Then write the collection attribute...
*/
- value->collection->state = IPP_IDLE;
+ value->collection->state = IPP_STATE_IDLE;
if (ippWriteIO(dst, cb, 1, ipp,
- value->collection) == IPP_ERROR)
+ value->collection) == IPP_STATE_ERROR)
{
DEBUG_puts("1ippWriteIO: Unable to write collection value");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
}
break;
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
DEBUG_printf(("1ippWriteIO: Data length too long (%d)",
n));
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
if ((int)(IPP_BUF_SIZE - (bufptr - buffer)) < (n + 2))
DEBUG_puts("1ippWriteIO: Could not write IPP "
"attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
bufptr = buffer;
{
DEBUG_puts("1ippWriteIO: Could not write IPP attribute...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
DEBUG_printf(("2ippWriteIO: wrote %d bytes",
{
DEBUG_puts("1ippWriteIO: Could not write IPP end-tag...");
_cupsBufferRelease((char *)buffer);
- return (IPP_ERROR);
+ return (IPP_STATE_ERROR);
}
- ipp->state = IPP_DATA;
+ ipp->state = IPP_STATE_DATA;
}
break;
- case IPP_DATA :
+ case IPP_STATE_DATA :
break;
default :
DEBUG_printf(("4ipp_free_values(attr=%p, element=%d, count=%d)", attr,
element, count));
- if (!(attr->value_tag & IPP_TAG_COPY))
+ if (!(attr->value_tag & IPP_TAG_CUPS_CONST))
{
/*
* Free values as needed...
if (collection)
bytes += 5; /* Add membername overhead */
- switch (attr->value_tag & ~IPP_TAG_COPY)
+ switch (attr->value_tag & ~IPP_TAG_CUPS_CONST)
{
case IPP_TAG_UNSUPPORTED_VALUE :
case IPP_TAG_DEFAULT :
DEBUG_printf(("9ipp_read_http: tbytes=%d, http->state=%d", tbytes,
http->state));
- if (http->state == HTTP_WAITING)
+ if (http->state == HTTP_STATE_WAITING)
break;
if (http->used == 0 && !http->blocking)
if ((temp = realloc(temp, sizeof(ipp_attribute_t) +
(alloc_values - 1) * sizeof(_ipp_value_t))) == NULL)
{
- _cupsSetHTTPError(HTTP_ERROR);
+ _cupsSetHTTPError(HTTP_STATUS_ERROR);
DEBUG_puts("4ipp_set_value: Unable to resize attribute.");
return (NULL);
}
*/
*attr = temp;
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("IPP attribute is not a member of the message."), 1);
DEBUG_puts("4ipp_set_value: Unable to find attribute in message.");
return (NULL);
*
* Notification routines for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 2005-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
switch (job_state->values[0].integer)
{
- case IPP_JOB_PENDING :
+ case IPP_JSTATE_PENDING :
state = _cupsLangString(lang, _("pending"));
break;
- case IPP_JOB_HELD :
+ case IPP_JSTATE_HELD :
state = _cupsLangString(lang, _("held"));
break;
- case IPP_JOB_PROCESSING :
+ case IPP_JSTATE_PROCESSING :
state = _cupsLangString(lang, _("processing"));
break;
- case IPP_JOB_STOPPED :
+ case IPP_JSTATE_STOPPED :
state = _cupsLangString(lang, _("stopped"));
break;
- case IPP_JOB_CANCELED :
+ case IPP_JSTATE_CANCELED :
state = _cupsLangString(lang, _("canceled"));
break;
- case IPP_JOB_ABORTED :
+ case IPP_JSTATE_ABORTED :
state = _cupsLangString(lang, _("aborted"));
break;
- case IPP_JOB_COMPLETED :
+ case IPP_JSTATE_COMPLETED :
state = _cupsLangString(lang, _("completed"));
break;
default :
switch (printer_state->values[0].integer)
{
- case IPP_PRINTER_IDLE :
+ case IPP_PSTATE_IDLE :
state = _cupsLangString(lang, _("idle"));
break;
- case IPP_PRINTER_PROCESSING :
+ case IPP_PSTATE_PROCESSING :
state = _cupsLangString(lang, _("processing"));
break;
- case IPP_PRINTER_STOPPED :
+ case IPP_PSTATE_STOPPED :
state = _cupsLangString(lang, _("stopped"));
break;
default :
*
* PPD cache implementation for CUPS.
*
- * Copyright 2010-2012 by Apple Inc.
+ * Copyright 2010-2013 by Apple Inc.
*
* These coded instructions, statements, and computer programs are the
* property of Apple Inc. and are protected by Federal copyright
if (!filename)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (NULL);
}
if ((fp = cupsFileOpen(filename, "r")) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
return (NULL);
}
if (!cupsFileGets(fp, line, sizeof(line)))
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
DEBUG_puts("_ppdCacheCreateWithFile: Unable to read first line.");
cupsFileClose(fp);
return (NULL);
if (strncmp(line, "#CUPS-PPD-CACHE-", 16))
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
DEBUG_printf(("_ppdCacheCreateWithFile: Wrong first line \"%s\".", line));
cupsFileClose(fp);
return (NULL);
if (atoi(line + 16) != _PPD_CACHE_VERSION)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Out of date PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Out of date PPD cache file."), 1);
DEBUG_printf(("_ppdCacheCreateWithFile: Cache file has version %s, "
"expected %d.", line + 16, _PPD_CACHE_VERSION));
cupsFileClose(fp);
if ((pc = calloc(1, sizeof(_ppd_cache_t))) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
DEBUG_puts("_ppdCacheCreateWithFile: Unable to allocate _ppd_cache_t.");
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Missing value on line %d.",
linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
else if (!_cups_strcasecmp(line, "Filter"))
if (attrs && *attrs)
{
DEBUG_puts("_ppdCacheCreateWithFile: IPP listed multiple times.");
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
else if (length <= 0)
{
DEBUG_puts("_ppdCacheCreateWithFile: Bad IPP length.");
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
*attrs = ippNew();
if (ippReadIO(fp, (ipp_iocb_t)cupsFileRead, 1, NULL,
- *attrs) != IPP_DATA)
+ *attrs) != IPP_STATE_DATA)
{
DEBUG_puts("_ppdCacheCreateWithFile: Bad IPP data.");
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
}
if (cupsFileTell(fp) != (pos + length))
{
DEBUG_puts("_ppdCacheCreateWithFile: Bad IPP data.");
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
}
if (num_bins > 0)
{
DEBUG_puts("_ppdCacheCreateWithFile: NumBins listed multiple times.");
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Bad NumBins value %d on line "
"%d.", num_sizes, linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Unable to allocate %d bins.",
num_sizes));
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
goto create_error;
}
}
if (sscanf(value, "%127s%40s", pwg_keyword, ppd_keyword) != 2)
{
DEBUG_printf(("_ppdCacheCreateWithFile: Bad Bin on line %d.", linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Too many Bin's on line %d.",
linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
if (num_sizes > 0)
{
DEBUG_puts("_ppdCacheCreateWithFile: NumSizes listed multiple times.");
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Bad NumSizes value %d on line "
"%d.", num_sizes, linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Unable to allocate %d sizes.",
num_sizes));
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
goto create_error;
}
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Too many Size's on line %d.",
linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Bad Size on line %d.",
linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Too many CustomSize's on line "
"%d.", linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Bad CustomSize on line %d.",
linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_puts("_ppdCacheCreateWithFile: NumSources listed multiple "
"times.");
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Bad NumSources value %d on "
"line %d.", num_sources, linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Unable to allocate %d sources.",
num_sources));
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
goto create_error;
}
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Bad Source on line %d.",
linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Too many Source's on line %d.",
linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
if (num_types > 0)
{
DEBUG_puts("_ppdCacheCreateWithFile: NumTypes listed multiple times.");
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Bad NumTypes value %d on "
"line %d.", num_types, linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Unable to allocate %d types.",
num_types));
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
goto create_error;
}
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Bad Type on line %d.",
linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Too many Type's on line %d.",
linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Bad Preset on line %d.",
linenum));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Not enough sizes (%d < %d).",
pc->num_sizes, num_sizes));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Not enough sources (%d < %d).",
pc->num_sources, num_sources));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
{
DEBUG_printf(("_ppdCacheCreateWithFile: Not enough types (%d < %d).",
pc->num_types, num_types));
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad PPD cache file."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad PPD cache file."), 1);
goto create_error;
}
create_error:
- _cupsSetError(IPP_INTERNAL_ERROR, _("Out of memory."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Out of memory."), 1);
_ppdCacheDestroy(pc);
return (NULL);
int /* O - New number of options */
_ppdCacheGetFinishingOptions(
- _ppd_cache_t *pc, /* I - PPD cache and mapping data */
- ipp_t *job, /* I - Job attributes or NULL */
- ipp_finish_t value, /* I - IPP finishings value of IPP_FINISHINGS_NONE */
- int num_options, /* I - Number of options */
- cups_option_t **options) /* IO - Options */
+ _ppd_cache_t *pc, /* I - PPD cache and mapping data */
+ ipp_t *job, /* I - Job attributes or NULL */
+ ipp_finishings_t value, /* I - IPP finishings value of IPP_FINISHINGS_NONE */
+ int num_options, /* I - Number of options */
+ cups_option_t **options) /* IO - Options */
{
int i; /* Looping var */
_pwg_finishings_t *f, /* PWG finishings options */
if (!pc || !filename)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (0);
}
snprintf(newfile, sizeof(newfile), "%s.N", filename);
if ((fp = cupsFileOpen(newfile, "w9")) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
return (0);
}
{
cupsFilePrintf(fp, "IPP " CUPS_LLFMT "\n", CUPS_LLCAST ippLength(attrs));
- attrs->state = IPP_IDLE;
+ attrs->state = IPP_STATE_IDLE;
ippWriteIO(fp, (ipp_iocb_t)cupsFileWrite, 1, NULL, attrs);
}
typedef struct _pwg_finishings_s /**** PWG finishings mapping data ****/
{
- ipp_finish_t value; /* finishings value */
- int num_options; /* Number of options to apply */
- cups_option_t *options; /* Options to apply */
+ ipp_finishings_t value; /* finishings value */
+ int num_options; /* Number of options to apply */
+ cups_option_t *options; /* Options to apply */
} _pwg_finishings_t;
struct _ppd_cache_s /**** PPD cache and PWG conversion data ****/
extern void _ppdCacheDestroy(_ppd_cache_t *pc);
extern const char *_ppdCacheGetBin(_ppd_cache_t *pc,
const char *output_bin);
-extern int _ppdCacheGetFinishingOptions(_ppd_cache_t *pc, ipp_t *job,
- ipp_finish_t value, int num_options,
+extern int _ppdCacheGetFinishingOptions(_ppd_cache_t *pc,
+ ipp_t *job,
+ ipp_finishings_t value,
+ int num_options,
cups_option_t **options);
-extern int _ppdCacheGetFinishingValues(_ppd_cache_t *pc, int num_options,
+extern int _ppdCacheGetFinishingValues(_ppd_cache_t *pc,
+ int num_options,
cups_option_t *options,
- int max_values, int *values);
+ int max_values,
+ int *values);
extern const char *_ppdCacheGetInputSlot(_ppd_cache_t *pc, ipp_t *job,
const char *keyword);
extern const char *_ppdCacheGetMediaType(_ppd_cache_t *pc, ipp_t *job,
}
else if (!x_dimension)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("Missing x-dimension in media-size."), 1);
return (0);
}
else if (!y_dimension)
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("Missing y-dimension in media-size."), 1);
return (0);
}
}
else
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Missing media-size in media-col."),
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Missing media-size in media-col."),
1);
return (0);
}
}
else
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Unsupported media value."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unsupported media value."), 1);
return (0);
}
}
else
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Missing media or media-col."), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Missing media or media-col."), 1);
return (0);
}
}
* Can't get file information!
*/
- _cupsSetError(errno == ENOENT ? IPP_NOT_FOUND : IPP_NOT_AUTHORIZED,
+ _cupsSetError(errno == ENOENT ? IPP_STATUS_ERROR_NOT_FOUND : IPP_STATUS_ERROR_NOT_AUTHORIZED,
NULL, 0);
ippDelete(request);
{
ippDelete(request);
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (NULL);
}
* Can't get file information!
*/
- _cupsSetError(errno == EBADF ? IPP_NOT_FOUND : IPP_NOT_AUTHORIZED,
+ _cupsSetError(errno == EBADF ? IPP_STATUS_ERROR_NOT_FOUND : IPP_STATUS_ERROR_NOT_AUTHORIZED,
NULL, 0);
ippDelete(request);
ippDelete(request);
- _cupsSetError(IPP_NOT_POSSIBLE, strerror(EISDIR), 0);
+ _cupsSetError(IPP_STATUS_ERROR_NOT_POSSIBLE, strerror(EISDIR), 0);
return (NULL);
}
DEBUG_printf(("2cupsDoIORequest: status=%d", status));
- if (status == HTTP_CONTINUE && request->state == IPP_DATA && infile >= 0)
+ if (status == HTTP_STATUS_CONTINUE && request->state == IPP_STATE_DATA && infile >= 0)
{
DEBUG_puts("2cupsDoIORequest: file write...");
while ((bytes = (int)read(infile, buffer, sizeof(buffer))) > 0)
{
if ((status = cupsWriteRequestData(http, buffer, bytes))
- != HTTP_CONTINUE)
+ != HTTP_STATUS_CONTINUE)
break;
}
}
* Get the server's response...
*/
- if (status != HTTP_ERROR)
+ if (status != HTTP_STATUS_ERROR)
{
response = cupsGetResponse(http, resource);
status = httpGetStatus(http);
DEBUG_printf(("2cupsDoIORequest: status=%d", status));
- if (status == HTTP_ERROR ||
- (status >= HTTP_BAD_REQUEST && status != HTTP_UNAUTHORIZED &&
- status != HTTP_UPGRADE_REQUIRED))
+ if (status == HTTP_STATUS_ERROR ||
+ (status >= HTTP_STATUS_BAD_REQUEST && status != HTTP_STATUS_UNAUTHORIZED &&
+ status != HTTP_STATUS_UPGRADE_REQUIRED))
{
_cupsSetHTTPError(status);
break;
break;
}
- if (http->state != HTTP_WAITING)
+ if (http->state != HTTP_STATE_WAITING)
{
/*
* Flush any remaining data...
if (!http)
http = _cupsConnect();
- if (!http || (http->state != HTTP_POST_RECV && http->state != HTTP_POST_SEND))
+ if (!http || (http->state != HTTP_STATE_POST_RECV && http->state != HTTP_STATE_POST_SEND))
return (NULL);
/*
* Check for an unfinished chunked request...
*/
- if (http->data_encoding == HTTP_ENCODE_CHUNKED)
+ if (http->data_encoding == HTTP_ENCODING_CHUNKED)
{
/*
* Send a 0-length chunk to finish off the request...
DEBUG_printf(("2cupsGetResponse: status=%d", status));
- if (status == HTTP_OK)
+ if (status == HTTP_STATUS_OK)
{
/*
* Get the IPP response...
response = ippNew();
- while ((state = ippRead(http, response)) != IPP_DATA)
- if (state == IPP_ERROR)
+ while ((state = ippRead(http, response)) != IPP_STATE_DATA)
+ if (state == IPP_STATE_ERROR)
break;
- if (state == IPP_ERROR)
+ if (state == IPP_STATE_ERROR)
{
/*
* Flush remaining data and delete the response...
ippDelete(response);
response = NULL;
- http->status = status = HTTP_ERROR;
+ http->status = status = HTTP_STATUS_ERROR;
http->error = EINVAL;
}
}
- else if (status != HTTP_ERROR)
+ else if (status != HTTP_STATUS_ERROR)
{
/*
* Flush any error message...
* Then handle encryption and authentication...
*/
- if (status == HTTP_UNAUTHORIZED)
+ if (status == HTTP_STATUS_UNAUTHORIZED)
{
/*
* See if we can do authentication...
DEBUG_puts("2cupsGetResponse: Need authorization...");
if (!cupsDoAuthentication(http, "POST", resource))
- httpReconnect(http);
+ httpReconnect2(http, 30000, NULL);
else
- http->status = status = HTTP_AUTHORIZATION_CANCELED;
+ http->status = status = HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED;
}
#ifdef HAVE_SSL
- else if (status == HTTP_UPGRADE_REQUIRED)
+ else if (status == HTTP_STATUS_UPGRADE_REQUIRED)
{
/*
* Force a reconnect with encryption...
DEBUG_puts("2cupsGetResponse: Need encryption...");
- if (!httpReconnect(http))
- httpEncryption(http, HTTP_ENCRYPT_REQUIRED);
+ if (!httpReconnect2(http, 30000, NULL))
+ httpEncryption(http, HTTP_ENCRYPTION_REQUIRED);
}
#endif /* HAVE_SSL */
}
if ((http = cg->http) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("No active connection"), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No active connection"), 1);
return (-1);
}
}
* response. Only one request can be sent/queued at a time per @code http_t@
* connection.
*
- * Returns the initial HTTP status code, which will be @code HTTP_CONTINUE@
+ * Returns the initial HTTP status code, which will be @code HTTP_STATUS_CONTINUE@
* on a successful send of the request.
*
* Note: Unlike @link cupsDoFileRequest@, @link cupsDoIORequest@, and
if (!request || !resource)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
- return (HTTP_ERROR);
+ return (HTTP_STATUS_ERROR);
}
/*
if (!http)
if ((http = _cupsConnect()) == NULL)
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
/*
* If the prior request was not flushed out, do so now...
*/
- if (http->state == HTTP_GET_SEND ||
- http->state == HTTP_POST_SEND)
+ if (http->state == HTTP_STATE_GET_SEND ||
+ http->state == HTTP_STATE_POST_SEND)
{
DEBUG_puts("2cupsSendRequest: Flush prior response.");
httpFlush(http);
}
- else if (http->state != HTTP_WAITING)
+ else if (http->state != HTTP_STATE_WAITING)
{
DEBUG_printf(("1cupsSendRequest: Unknown HTTP state (%d), "
"reconnecting.", http->state));
- if (httpReconnect(http))
- return (HTTP_ERROR);
+ if (httpReconnect2(http, 30000, NULL))
+ return (HTTP_STATUS_ERROR);
}
#ifdef HAVE_SSL
if (ippFindAttribute(request, "auth-info", IPP_TAG_TEXT) &&
!httpAddrLocalhost(http->hostaddr) && !http->tls &&
- httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
+ httpEncryption(http, HTTP_ENCRYPTION_REQUIRED))
{
DEBUG_puts("1cupsSendRequest: Unable to encrypt connection.");
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
}
#endif /* HAVE_SSL */
{
DEBUG_puts("2cupsSendRequest: Connection: close");
httpClearFields(http);
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
}
}
* Loop until we can send the request without authorization problems.
*/
- expect = HTTP_CONTINUE;
+ expect = HTTP_STATUS_CONTINUE;
for (;;)
{
if (httpPost(http, resource))
{
DEBUG_puts("2cupsSendRequest: POST failed, reconnecting.");
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
}
else
continue;
DEBUG_puts("2cupsSendRequest: Writing IPP request...");
- request->state = IPP_IDLE;
- status = HTTP_CONTINUE;
+ request->state = IPP_STATE_IDLE;
+ status = HTTP_STATUS_CONTINUE;
got_status = 0;
- while ((state = ippWrite(http, request)) != IPP_DATA)
- if (state == IPP_ERROR)
+ while ((state = ippWrite(http, request)) != IPP_STATE_DATA)
+ if (state == IPP_STATE_ERROR)
break;
else if (httpCheck(http))
{
got_status = 1;
_httpUpdate(http, &status);
- if (status >= HTTP_MULTIPLE_CHOICES)
+ if (status >= HTTP_STATUS_MULTIPLE_CHOICES)
break;
}
- if (state == IPP_ERROR)
+ if (state == IPP_STATE_ERROR)
{
DEBUG_puts("1cupsSendRequest: Unable to send IPP request.");
- http->status = HTTP_ERROR;
- http->state = HTTP_WAITING;
+ http->status = HTTP_STATUS_ERROR;
+ http->state = HTTP_STATE_WAITING;
- return (HTTP_ERROR);
+ return (HTTP_STATUS_ERROR);
}
/*
if (!got_status)
{
- if (expect == HTTP_CONTINUE)
+ if (expect == HTTP_STATUS_CONTINUE)
{
DEBUG_puts("2cupsSendRequest: Waiting for 100-continue...");
case HTTP_STATUS_UNAUTHORIZED :
if (cupsDoAuthentication(http, "POST", resource))
{
- DEBUG_puts("1cupsSendRequest: Returning HTTP_AUTHORIZATION_CANCELED.");
- return (HTTP_AUTHORIZATION_CANCELED);
+ DEBUG_puts("1cupsSendRequest: Returning HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED.");
+ return (HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED);
}
- DEBUG_puts("2cupsSendRequest: Reconnecting after HTTP_UNAUTHORIZED.");
+ DEBUG_puts("2cupsSendRequest: Reconnecting after HTTP_STATUS_UNAUTHORIZED.");
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
}
break;
*/
DEBUG_puts("2cupsSendRequest: Reconnecting after "
- "HTTP_UPGRADE_REQUIRED.");
+ "HTTP_STATUS_UPGRADE_REQUIRED.");
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
}
DEBUG_puts("2cupsSendRequest: Upgrading to TLS.");
- if (httpEncryption(http, HTTP_ENCRYPT_REQUIRED))
+ if (httpEncryption(http, HTTP_ENCRYPTION_REQUIRED))
{
DEBUG_puts("1cupsSendRequest: Unable to encrypt connection.");
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
}
break;
#endif /* HAVE_SSL */
DEBUG_puts("2cupsSendRequest: Reconnecting after "
"HTTP_EXPECTATION_FAILED.");
- if (httpReconnect(http))
+ if (httpReconnect2(http, 30000, NULL))
{
DEBUG_puts("1cupsSendRequest: Unable to reconnect.");
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
}
break;
* @since CUPS 1.4/OS X 10.6@
*/
-http_status_t /* O - @code HTTP_CONTINUE@ if OK or HTTP status on error */
+http_status_t /* O - @code HTTP_STATUS_CONTINUE@ if OK or HTTP status on error */
cupsWriteRequestData(
http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
const char *buffer, /* I - Bytes to write */
if ((http = cg->http) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("No active connection"), 1);
- DEBUG_puts("1cupsWriteRequestData: Returning HTTP_ERROR.");
- return (HTTP_ERROR);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No active connection"), 1);
+ DEBUG_puts("1cupsWriteRequestData: Returning HTTP_STATUS_ERROR.");
+ return (HTTP_STATUS_ERROR);
}
}
if (httpWrite2(http, buffer, length) < 0)
{
- DEBUG_puts("1cupsWriteRequestData: Returning HTTP_ERROR.");
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(http->error), 0);
- return (HTTP_ERROR);
+ DEBUG_puts("1cupsWriteRequestData: Returning HTTP_STATUS_ERROR.");
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(http->error), 0);
+ return (HTTP_STATUS_ERROR);
}
/*
http_status_t status; /* Status from _httpUpdate */
_httpUpdate(http, &status);
- if (status >= HTTP_MULTIPLE_CHOICES)
+ if (status >= HTTP_STATUS_MULTIPLE_CHOICES)
{
_cupsSetHTTPError(status);
{
status = httpUpdate(http);
}
- while (status != HTTP_ERROR && http->state == HTTP_POST_RECV);
+ while (status != HTTP_STATUS_ERROR && http->state == HTTP_STATE_POST_RECV);
httpFlush(http);
}
}
}
- DEBUG_puts("1cupsWriteRequestData: Returning HTTP_CONTINUE.");
- return (HTTP_CONTINUE);
+ DEBUG_puts("1cupsWriteRequestData: Returning HTTP_STATUS_CONTINUE.");
+ return (HTTP_STATUS_CONTINUE);
}
if (strcmp(cg->http->hostname, cg->server) ||
cg->ipp_port != httpAddrPort(cg->http->hostaddr) ||
(cg->http->encryption != cg->encryption &&
- cg->http->encryption == HTTP_ENCRYPT_NEVER))
+ cg->http->encryption == HTTP_ENCRYPTION_NEVER))
{
/*
* Need to close the current connection because something has changed...
if (!cg->http)
{
- if ((cg->http = httpConnectEncrypt(cupsServer(), ippPort(),
- cupsEncryption())) == NULL)
+ if ((cg->http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC,
+ cupsEncryption(), 1, 30000, NULL)) == NULL)
{
if (errno)
- _cupsSetError(IPP_SERVICE_UNAVAILABLE, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, NULL, 0);
else
- _cupsSetError(IPP_SERVICE_UNAVAILABLE,
+ _cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE,
_("Unable to connect to host."), 1);
}
}
{
switch (status)
{
- case HTTP_NOT_FOUND :
- _cupsSetError(IPP_NOT_FOUND, httpStatus(status), 0);
+ case HTTP_STATUS_NOT_FOUND :
+ _cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, httpStatus(status), 0);
break;
- case HTTP_UNAUTHORIZED :
- _cupsSetError(IPP_NOT_AUTHENTICATED, httpStatus(status), 0);
+ case HTTP_STATUS_UNAUTHORIZED :
+ _cupsSetError(IPP_STATUS_ERROR_NOT_AUTHENTICATED, httpStatus(status), 0);
break;
- case HTTP_AUTHORIZATION_CANCELED :
- _cupsSetError(IPP_AUTHENTICATION_CANCELED, httpStatus(status), 0);
+ case HTTP_STATUS_CUPS_AUTHORIZATION_CANCELED :
+ _cupsSetError(IPP_STATUS_ERROR_CUPS_AUTHENTICATION_CANCELED, httpStatus(status), 0);
break;
- case HTTP_FORBIDDEN :
- _cupsSetError(IPP_FORBIDDEN, httpStatus(status), 0);
+ case HTTP_STATUS_FORBIDDEN :
+ _cupsSetError(IPP_STATUS_ERROR_FORBIDDEN, httpStatus(status), 0);
break;
- case HTTP_BAD_REQUEST :
- _cupsSetError(IPP_BAD_REQUEST, httpStatus(status), 0);
+ case HTTP_STATUS_BAD_REQUEST :
+ _cupsSetError(IPP_STATUS_ERROR_BAD_REQUEST, httpStatus(status), 0);
break;
- case HTTP_REQUEST_TOO_LARGE :
- _cupsSetError(IPP_REQUEST_VALUE, httpStatus(status), 0);
+ case HTTP_STATUS_REQUEST_TOO_LARGE :
+ _cupsSetError(IPP_STATUS_ERROR_REQUEST_VALUE, httpStatus(status), 0);
break;
- case HTTP_NOT_IMPLEMENTED :
- _cupsSetError(IPP_OPERATION_NOT_SUPPORTED, httpStatus(status), 0);
+ case HTTP_STATUS_NOT_IMPLEMENTED :
+ _cupsSetError(IPP_STATUS_ERROR_OPERATION_NOT_SUPPORTED, httpStatus(status), 0);
break;
- case HTTP_NOT_SUPPORTED :
- _cupsSetError(IPP_VERSION_NOT_SUPPORTED, httpStatus(status), 0);
+ case HTTP_STATUS_NOT_SUPPORTED :
+ _cupsSetError(IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED, httpStatus(status), 0);
break;
- case HTTP_UPGRADE_REQUIRED :
- _cupsSetError(IPP_UPGRADE_REQUIRED, httpStatus(status), 0);
+ case HTTP_STATUS_UPGRADE_REQUIRED :
+ _cupsSetError(IPP_STATUS_ERROR_CUPS_UPGRADE_REQUIRED, httpStatus(status), 0);
break;
- case HTTP_PKI_ERROR :
- _cupsSetError(IPP_PKI_ERROR, httpStatus(status), 0);
+ case HTTP_STATUS_CUPS_PKI_ERROR :
+ _cupsSetError(IPP_STATUS_ERROR_CUPS_PKI, httpStatus(status), 0);
break;
- case HTTP_ERROR :
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(errno), 0);
+ case HTTP_STATUS_ERROR :
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(errno), 0);
break;
default :
DEBUG_printf(("4_cupsSetHTTPError: HTTP error %d mapped to "
- "IPP_SERVICE_UNAVAILABLE!", status));
- _cupsSetError(IPP_SERVICE_UNAVAILABLE, httpStatus(status), 0);
+ "IPP_STATUS_ERROR_SERVICE_UNAVAILABLE!", status));
+ _cupsSetError(IPP_STATUS_ERROR_SERVICE_UNAVAILABLE, httpStatus(status), 0);
break;
}
}
*
* Admin function test program for CUPS.
*
- * Copyright 2007-2010 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* Connect to the server using the defaults...
*/
- http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
+ http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC,
+ cupsEncryption(), 1, 30000, NULL);
/*
* Set the current configuration if we have anything on the command-line...
*
* CUPS API test program for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
interval = atoi(argv[4]);
if (cupsStartDocument(CUPS_HTTP_DEFAULT, argv[1], job_id, argv[2],
- CUPS_FORMAT_AUTO, 1) != HTTP_CONTINUE)
+ CUPS_FORMAT_AUTO, 1) != HTTP_STATUS_CONTINUE)
{
puts("Unable to start document!");
return (1);
printf("Writing %d bytes...\n", (int)bytes);
if (cupsWriteRequestData(CUPS_HTTP_DEFAULT, buffer,
- bytes) != HTTP_CONTINUE)
+ bytes) != HTTP_STATUS_CONTINUE)
{
puts("Unable to write bytes!");
return (1);
cupsFileClose(fp);
- if (cupsFinishDocument(CUPS_HTTP_DEFAULT, argv[1]) > IPP_OK_SUBST)
+ if (cupsFinishDocument(CUPS_HTTP_DEFAULT,
+ argv[1]) > IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED)
{
puts("Unable to finish document!");
return (1);
*
* HTTP test program for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
static uri_test_t uri_tests[] = /* URI test data */
{
/* Start with valid URIs */
- { HTTP_URI_OK, "file:/filename",
+ { HTTP_URI_STATUS_OK, "file:/filename",
"file", "", "", "/filename", 0, 0 },
- { HTTP_URI_OK, "file:/filename%20with%20spaces",
+ { HTTP_URI_STATUS_OK, "file:/filename%20with%20spaces",
"file", "", "", "/filename with spaces", 0, 0 },
- { HTTP_URI_OK, "file:///filename",
+ { HTTP_URI_STATUS_OK, "file:///filename",
"file", "", "", "/filename", 0, 0 },
- { HTTP_URI_OK, "file:///filename%20with%20spaces",
+ { HTTP_URI_STATUS_OK, "file:///filename%20with%20spaces",
"file", "", "", "/filename with spaces", 0, 0 },
- { HTTP_URI_OK, "file://localhost/filename",
+ { HTTP_URI_STATUS_OK, "file://localhost/filename",
"file", "", "localhost", "/filename", 0, 0 },
- { HTTP_URI_OK, "file://localhost/filename%20with%20spaces",
+ { HTTP_URI_STATUS_OK, "file://localhost/filename%20with%20spaces",
"file", "", "localhost", "/filename with spaces", 0, 0 },
- { HTTP_URI_OK, "http://server/",
+ { HTTP_URI_STATUS_OK, "http://server/",
"http", "", "server", "/", 80, 0 },
- { HTTP_URI_OK, "http://username@server/",
+ { HTTP_URI_STATUS_OK, "http://username@server/",
"http", "username", "server", "/", 80, 0 },
- { HTTP_URI_OK, "http://username:passwor%64@server/",
+ { HTTP_URI_STATUS_OK, "http://username:passwor%64@server/",
"http", "username:password", "server", "/", 80, 0 },
- { HTTP_URI_OK, "http://username:passwor%64@server:8080/",
+ { HTTP_URI_STATUS_OK, "http://username:passwor%64@server:8080/",
"http", "username:password", "server", "/", 8080, 8080 },
- { HTTP_URI_OK, "http://username:passwor%64@server:8080/directory/filename",
+ { HTTP_URI_STATUS_OK, "http://username:passwor%64@server:8080/directory/filename",
"http", "username:password", "server", "/directory/filename", 8080, 8080 },
- { HTTP_URI_OK, "http://[2000::10:100]:631/ipp",
+ { HTTP_URI_STATUS_OK, "http://[2000::10:100]:631/ipp",
"http", "", "2000::10:100", "/ipp", 631, 631 },
- { HTTP_URI_OK, "https://username:passwor%64@server/directory/filename",
+ { HTTP_URI_STATUS_OK, "https://username:passwor%64@server/directory/filename",
"https", "username:password", "server", "/directory/filename", 443, 0 },
- { HTTP_URI_OK, "ipp://username:passwor%64@[::1]/ipp",
+ { HTTP_URI_STATUS_OK, "ipp://username:passwor%64@[::1]/ipp",
"ipp", "username:password", "::1", "/ipp", 631, 0 },
- { HTTP_URI_OK, "lpd://server/queue?reserve=yes",
+ { HTTP_URI_STATUS_OK, "lpd://server/queue?reserve=yes",
"lpd", "", "server", "/queue?reserve=yes", 515, 0 },
- { HTTP_URI_OK, "mailto:user@domain.com",
+ { HTTP_URI_STATUS_OK, "mailto:user@domain.com",
"mailto", "", "", "user@domain.com", 0, 0 },
- { HTTP_URI_OK, "socket://server/",
+ { HTTP_URI_STATUS_OK, "socket://server/",
"socket", "", "server", "/", 9100, 0 },
- { HTTP_URI_OK, "socket://192.168.1.1:9101/",
+ { HTTP_URI_STATUS_OK, "socket://192.168.1.1:9101/",
"socket", "", "192.168.1.1", "/", 9101, 9101 },
- { HTTP_URI_OK, "ipp://username:password@[v1.fe80::200:1234:5678:9abc+eth0]:999/ipp",
+ { HTTP_URI_STATUS_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_URI_STATUS_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 },
- { HTTP_URI_OK, "lpd://Acme%20Laser%20(01%3A23%3A45).local._tcp._printer/",
+ { HTTP_URI_STATUS_OK, "lpd://Acme%20Laser%20(01%3A23%3A45).local._tcp._printer/",
"lpd", "", "Acme Laser (01:23:45).local._tcp._printer", "/", 515, 0 },
- { HTTP_URI_OK, "ipp://HP%20Officejet%204500%20G510n-z%20%40%20Will's%20MacBook%20Pro%2015%22._ipp._tcp.local./",
+ { HTTP_URI_STATUS_OK, "ipp://HP%20Officejet%204500%20G510n-z%20%40%20Will's%20MacBook%20Pro%2015%22._ipp._tcp.local./",
"ipp", "", "HP Officejet 4500 G510n-z @ Will's MacBook Pro 15\"._ipp._tcp.local.", "/", 631, 0 },
/* Missing scheme */
- { HTTP_URI_MISSING_SCHEME, "/path/to/file/index.html",
+ { HTTP_URI_STATUS_MISSING_SCHEME, "/path/to/file/index.html",
"file", "", "", "/path/to/file/index.html", 0, 0 },
- { HTTP_URI_MISSING_SCHEME, "//server/ipp",
+ { HTTP_URI_STATUS_MISSING_SCHEME, "//server/ipp",
"ipp", "", "server", "/ipp", 631, 0 },
/* Unknown scheme */
- { HTTP_URI_UNKNOWN_SCHEME, "vendor://server/resource",
+ { HTTP_URI_STATUS_UNKNOWN_SCHEME, "vendor://server/resource",
"vendor", "", "server", "/resource", 0, 0 },
/* Missing resource */
- { HTTP_URI_MISSING_RESOURCE, "socket://[::192.168.2.1]",
+ { HTTP_URI_STATUS_MISSING_RESOURCE, "socket://[::192.168.2.1]",
"socket", "", "::192.168.2.1", "/", 9100, 0 },
- { HTTP_URI_MISSING_RESOURCE, "socket://192.168.1.1:9101",
+ { HTTP_URI_STATUS_MISSING_RESOURCE, "socket://192.168.1.1:9101",
"socket", "", "192.168.1.1", "/", 9101 },
/* Bad URI */
- { HTTP_URI_BAD_URI, "",
+ { HTTP_URI_STATUS_BAD_URI, "",
"", "", "", "", 0, 0 },
/* Bad scheme */
- { HTTP_URI_BAD_SCHEME, "bad_scheme://server/resource",
+ { HTTP_URI_STATUS_BAD_SCHEME, "bad_scheme://server/resource",
"", "", "", "", 0, 0 },
/* Bad username */
- { HTTP_URI_BAD_USERNAME, "http://username:passwor%6@server/resource",
+ { HTTP_URI_STATUS_BAD_USERNAME, "http://username:passwor%6@server/resource",
"http", "", "", "", 80, 0 },
/* Bad hostname */
- { HTTP_URI_BAD_HOSTNAME, "http://[/::1]/index.html",
+ { HTTP_URI_STATUS_BAD_HOSTNAME, "http://[/::1]/index.html",
"http", "", "", "", 80, 0 },
- { HTTP_URI_BAD_HOSTNAME, "http://[",
+ { HTTP_URI_STATUS_BAD_HOSTNAME, "http://[",
"http", "", "", "", 80, 0 },
- { HTTP_URI_BAD_HOSTNAME, "http://serve%7/index.html",
+ { HTTP_URI_STATUS_BAD_HOSTNAME, "http://serve%7/index.html",
"http", "", "", "", 80, 0 },
/* Bad port number */
- { HTTP_URI_BAD_PORT, "http://127.0.0.1:9999a/index.html",
+ { HTTP_URI_STATUS_BAD_PORT, "http://127.0.0.1:9999a/index.html",
"http", "", "127.0.0.1", "", 0, 0 },
/* Bad resource */
- { HTTP_URI_BAD_RESOURCE, "http://server/index.html%",
+ { HTTP_URI_STATUS_BAD_RESOURCE, "http://server/index.html%",
"http", "", "server", "", 80, 0 }
};
static const char * const base64_tests[][2] =
const char *encoding; /* Negotiated Content-Encoding */
static const char * const uri_status_strings[] =
{
- "HTTP_URI_OVERFLOW",
- "HTTP_URI_BAD_ARGUMENTS",
- "HTTP_URI_BAD_RESOURCE",
- "HTTP_URI_BAD_PORT",
- "HTTP_URI_BAD_HOSTNAME",
- "HTTP_URI_BAD_USERNAME",
- "HTTP_URI_BAD_SCHEME",
- "HTTP_URI_BAD_URI",
- "HTTP_URI_OK",
- "HTTP_URI_MISSING_SCHEME",
- "HTTP_URI_UNKNOWN_SCHEME",
- "HTTP_URI_MISSING_RESOURCE"
+ "HTTP_URI_STATUS_OVERFLOW",
+ "HTTP_URI_STATUS_BAD_ARGUMENTS",
+ "HTTP_URI_STATUS_BAD_RESOURCE",
+ "HTTP_URI_STATUS_BAD_PORT",
+ "HTTP_URI_STATUS_BAD_HOSTNAME",
+ "HTTP_URI_STATUS_BAD_USERNAME",
+ "HTTP_URI_STATUS_BAD_SCHEME",
+ "HTTP_URI_STATUS_BAD_URI",
+ "HTTP_URI_STATUS_OK",
+ "HTTP_URI_STATUS_MISSING_SCHEME",
+ "HTTP_URI_STATUS_UNKNOWN_SCHEME",
+ "HTTP_URI_STATUS_MISSING_RESOURCE"
};
for (i = 0, j = 0, k = 0;
i < (int)(sizeof(uri_tests) / sizeof(uri_tests[0]));
i ++)
- if (uri_tests[i].result == HTTP_URI_OK &&
+ if (uri_tests[i].result == HTTP_URI_STATUS_OK &&
!strstr(uri_tests[i].uri, "%64") &&
strstr(uri_tests[i].uri, "//"))
{
uri_tests[i].assemble_port,
uri_tests[i].resource);
- if (uri_status != HTTP_URI_OK)
+ if (uri_status != HTTP_URI_STATUS_OK)
{
failures ++;
if (!_cups_strcasecmp(scheme, "https") || !_cups_strcasecmp(scheme, "ipps") ||
port == 443)
- encryption = HTTP_ENCRYPT_ALWAYS;
+ encryption = HTTP_ENCRYPTION_ALWAYS;
else
- encryption = HTTP_ENCRYPT_IF_REQUESTED;
+ encryption = HTTP_ENCRYPTION_IF_REQUESTED;
- http = httpConnectEncrypt(hostname, port, encryption);
+ http = httpConnect2(hostname, port, NULL, AF_UNSPEC, encryption, 1, 30000,
+ NULL);
if (http == NULL)
{
perror(hostname);
httpClearFields(http);
httpSetField(http, HTTP_FIELD_ACCEPT_LANGUAGE, "en");
httpHead(http, resource);
- while ((status = httpUpdate(http)) == HTTP_CONTINUE);
+ while ((status = httpUpdate(http)) == HTTP_STATUS_CONTINUE);
- if (status == HTTP_OK)
+ if (status == HTTP_STATUS_OK)
puts("HEAD OK:");
else
printf("HEAD failed with status %d...\n", status);
httpSetField(http, HTTP_FIELD_ACCEPT_LANGUAGE, "en");
httpSetField(http, HTTP_FIELD_ACCEPT_ENCODING, encoding);
httpGet(http, resource);
- while ((status = httpUpdate(http)) == HTTP_CONTINUE);
+ while ((status = httpUpdate(http)) == HTTP_STATUS_CONTINUE);
- if (status == HTTP_OK)
+ if (status == HTTP_STATUS_OK)
puts("GET OK:");
else
printf("GET failed with status %d...\n", status);
*
* IPP test program for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2005 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
request = ippNew();
request->request.op.version[0] = 0x01;
request->request.op.version[1] = 0x01;
- request->request.op.operation_id = IPP_PRINT_JOB;
+ request->request.op.operation_id = IPP_OP_PRINT_JOB;
request->request.op.request_id = 1;
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
data.wbuffer = buffer;
while ((state = ippWriteIO(&data, (ipp_iocb_t)write_cb, 1, NULL,
- request)) != IPP_DATA)
- if (state == IPP_ERROR)
+ request)) != IPP_STATE_DATA)
+ if (state == IPP_STATE_ERROR)
break;
- if (state != IPP_DATA)
+ if (state != IPP_STATE_DATA)
{
printf("FAIL - %d bytes written.\n", (int)data.wused);
status = 1;
data.rpos = 0;
while ((state = ippReadIO(&data, (ipp_iocb_t)read_cb, 1, NULL,
- request)) != IPP_DATA)
- if (state == IPP_ERROR)
+ request)) != IPP_STATE_DATA)
+ if (state == IPP_STATE_ERROR)
break;
length = ippLength(request);
- if (state != IPP_DATA)
+ if (state != IPP_STATE_DATA)
{
printf("FAIL - %d bytes read.\n", (int)data.rpos);
status = 1;
data.wbuffer = mixed;
while ((state = ippReadIO(&data, (ipp_iocb_t)read_cb, 1, NULL,
- request)) != IPP_DATA)
- if (state == IPP_ERROR)
+ request)) != IPP_STATE_DATA)
+ if (state == IPP_STATE_ERROR)
break;
length = ippLength(request);
- if (state != IPP_DATA)
+ if (state != IPP_STATE_DATA)
{
printf("FAIL - %d bytes read.\n", (int)data.rpos);
status = 1;
request = ippNew();
while ((state = ippReadIO(fp, (ipp_iocb_t)cupsFileRead, 1, NULL,
- request)) == IPP_ATTRIBUTE);
+ request)) == IPP_STATE_ATTRIBUTE);
- if (state != IPP_DATA)
+ if (state != IPP_STATE_DATA)
{
printf("Error reading IPP message from \"%s\"!\n", argv[i]);
status = 1;
* The default encryption setting comes from the CUPS_ENCRYPTION
* environment variable, then the ~/.cups/client.conf file, and finally the
* /etc/cups/client.conf file. If not set, the default is
- * @code HTTP_ENCRYPT_IF_REQUESTED@.
+ * @code HTTP_ENCRYPTION_IF_REQUESTED@.
*
* Note: The current encryption setting is tracked separately for each thread
* in a program. Multi-threaded programs that override the setting via the
* The default encryption setting comes from the CUPS_ENCRYPTION
* environment variable, then the ~/.cups/client.conf file, and finally the
* /etc/cups/client.conf file. If not set, the default is
- * @code HTTP_ENCRYPT_IF_REQUESTED@.
+ * @code HTTP_ENCRYPTION_IF_REQUESTED@.
*
* Note: The current encryption setting is tracked separately for each thread
* in a program. Multi-threaded programs that override the setting need to do
if (cg->encryption == (http_encryption_t)-1 && cups_encryption)
{
if (!_cups_strcasecmp(cups_encryption, "never"))
- cg->encryption = HTTP_ENCRYPT_NEVER;
+ cg->encryption = HTTP_ENCRYPTION_NEVER;
else if (!_cups_strcasecmp(cups_encryption, "always"))
- cg->encryption = HTTP_ENCRYPT_ALWAYS;
+ cg->encryption = HTTP_ENCRYPTION_ALWAYS;
else if (!_cups_strcasecmp(cups_encryption, "required"))
- cg->encryption = HTTP_ENCRYPT_REQUIRED;
+ cg->encryption = HTTP_ENCRYPTION_REQUIRED;
else
- cg->encryption = HTTP_ENCRYPT_IF_REQUESTED;
+ cg->encryption = HTTP_ENCRYPTION_IF_REQUESTED;
}
if ((!cg->server[0] || !cg->ipp_port) && cups_server)
*
* Printing utilities for CUPS.
*
- * Copyright 2007-2012 by Apple Inc.
+ * Copyright 2007-2013 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
int job_id) /* I - Job ID, @code CUPS_JOBID_CURRENT@ for the current job, or @code CUPS_JOBID_ALL@ for all jobs */
{
return (cupsCancelJob2(CUPS_HTTP_DEFAULT, name, job_id, 0)
- < IPP_REDIRECTION_OTHER_SITE);
+ < IPP_STATUS_REDIRECTION_OTHER_SITE);
}
if (job_id < -1 || (!name && job_id == 0))
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (0);
}
if (!http)
if ((http = _cupsConnect()) == NULL)
- return (IPP_SERVICE_UNAVAILABLE);
+ return (IPP_STATUS_ERROR_SERVICE_UNAVAILABLE);
/*
* Build an IPP_CANCEL_JOB or IPP_PURGE_JOBS request, which requires the following
* [purge-job] or [purge-jobs]
*/
- request = ippNewRequest(job_id < 0 ? IPP_PURGE_JOBS : IPP_CANCEL_JOB);
+ request = ippNewRequest(job_id < 0 ? IPP_OP_PURGE_JOBS : IPP_OP_CANCEL_JOB);
if (name)
{
if (!name)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (0);
}
* Build a Create-Job request...
*/
- if ((request = ippNewRequest(IPP_CREATE_JOB)) == NULL)
+ if ((request = ippNewRequest(IPP_OP_CREATE_JOB)) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOMEM), 0);
return (0);
}
if (!classes)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (0);
}
* requested-attributes
*/
- request = ippNewRequest(CUPS_GET_CLASSES);
+ request = ippNewRequest(IPP_OP_CUPS_GET_CLASSES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "printer-name");
* attributes-natural-language
*/
- request = ippNewRequest(CUPS_GET_DEFAULT);
+ request = ippNewRequest(IPP_OP_CUPS_GET_DEFAULT);
/*
* Do the request and get back a response...
if (!jobs)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (-1);
}
if (name)
{
if (httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
- "localhost", 0, "/printers/%s", name) != HTTP_URI_OK)
+ "localhost", 0, "/printers/%s",
+ name) < HTTP_URI_STATUS_OK)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Unable to create printer-uri"), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
+ _("Unable to create printer-uri"), 1);
return (-1);
}
* requested-attributes
*/
- request = ippNewRequest(IPP_GET_JOBS);
+ request = ippNewRequest(IPP_OP_GET_JOBS);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
id = 0;
size = 0;
priority = 50;
- state = IPP_JOB_PENDING;
+ state = IPP_JSTATE_PENDING;
user = "unknown";
dest = NULL;
format = "application/octet-stream";
* Ran out of memory!
*/
- _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
cupsFreeJobs(n, *jobs);
*jobs = NULL;
ippDelete(response);
}
- if (n == 0 && cg->last_error >= IPP_BAD_REQUEST)
+ if (n == 0 && cg->last_error >= IPP_STATUS_ERROR_BAD_REQUEST)
return (-1);
else
return (n);
cg->ppd_filename[0] = '\0';
if (cupsGetPPD3(CUPS_HTTP_DEFAULT, name, &modtime, cg->ppd_filename,
- sizeof(cg->ppd_filename)) == HTTP_OK)
+ sizeof(cg->ppd_filename)) == HTTP_STATUS_OK)
return (cg->ppd_filename);
else
return (NULL);
cg->ppd_filename[0] = '\0';
if (cupsGetPPD3(http, name, &modtime, cg->ppd_filename,
- sizeof(cg->ppd_filename)) == HTTP_OK)
+ sizeof(cg->ppd_filename)) == HTTP_STATUS_OK)
return (cg->ppd_filename);
else
return (NULL);
* file will be overwritten as needed. The caller "owns" the file that is
* created and must @code unlink@ the returned filename.
*
- * On success, @code HTTP_OK@ is returned for a new PPD file and
- * @code HTTP_NOT_MODIFIED@ if the existing PPD file is up-to-date. Any other
+ * On success, @code HTTP_STATUS_OK@ is returned for a new PPD file and
+ * @code HTTP_STATUS_NOT_MODIFIED@ if the existing PPD file is up-to-date. Any other
* status is an error.
*
* For classes, @code cupsGetPPD3@ returns the PPD file for the first printer
if (!name)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("No printer name"), 1);
- return (HTTP_NOT_ACCEPTABLE);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No printer name"), 1);
+ return (HTTP_STATUS_NOT_ACCEPTABLE);
}
if (!modtime)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("No modification time"), 1);
- return (HTTP_NOT_ACCEPTABLE);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No modification time"), 1);
+ return (HTTP_STATUS_NOT_ACCEPTABLE);
}
if (!buffer || bufsize <= 1)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Bad filename buffer"), 1);
- return (HTTP_NOT_ACCEPTABLE);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Bad filename buffer"), 1);
+ return (HTTP_STATUS_NOT_ACCEPTABLE);
}
#ifndef WIN32
if (symlink(ppdname, buffer) && errno != EEXIST)
{
- _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
- return (HTTP_SERVER_ERROR);
+ return (HTTP_STATUS_SERVER_ERROR);
}
}
else
if (tries >= 1000)
{
- _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
- return (HTTP_SERVER_ERROR);
+ return (HTTP_STATUS_SERVER_ERROR);
}
}
if (*modtime >= ppdinfo.st_mtime)
- return (HTTP_NOT_MODIFIED);
+ return (HTTP_STATUS_NOT_MODIFIED);
else
{
*modtime = ppdinfo.st_mtime;
- return (HTTP_OK);
+ return (HTTP_STATUS_OK);
}
}
}
if (!http)
if ((http = _cupsConnect()) == NULL)
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
if (!cups_get_printer_uri(http, name, hostname, sizeof(hostname), &port,
resource, sizeof(resource), 0))
- return (HTTP_NOT_FOUND);
+ return (HTTP_STATUS_NOT_FOUND);
DEBUG_printf(("2cupsGetPPD3: Printer hostname=\"%s\", port=%d", hostname,
port));
if (!_cups_strcasecmp(http_hostname, hostname) && port == http_port)
http2 = http;
- else if ((http2 = httpConnectEncrypt(hostname, port,
- cupsEncryption())) == NULL)
+ else if ((http2 = httpConnect2(hostname, port, NULL, AF_UNSPEC,
+ cupsEncryption(), 1, 30000, NULL)) == NULL)
{
DEBUG_puts("1cupsGetPPD3: Unable to connect to server");
- return (HTTP_SERVICE_UNAVAILABLE);
+ return (HTTP_STATUS_SERVICE_UNAVAILABLE);
}
/*
* Can't open file; close the server connection and return NULL...
*/
- _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
if (http2 != http)
httpClose(http2);
- return (HTTP_SERVER_ERROR);
+ return (HTTP_STATUS_SERVER_ERROR);
}
/*
* See if we actually got the file or an error...
*/
- if (status == HTTP_OK)
+ if (status == HTTP_STATUS_OK)
{
*modtime = httpGetDateTime(httpGetField(http2, HTTP_FIELD_DATE));
if (tempfile[0])
strlcpy(buffer, tempfile, bufsize);
}
- else if (status != HTTP_NOT_MODIFIED)
+ else if (status != HTTP_STATUS_NOT_MODIFIED)
{
_cupsSetHTTPError(status);
if (!printers)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (0);
}
* requested-attributes
*/
- request = ippNewRequest(CUPS_GET_PRINTERS);
+ request = ippNewRequest(IPP_OP_CUPS_GET_PRINTERS);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
"requested-attributes", NULL, "printer-name");
if (!name)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("No PPD name"), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No PPD name"), 1);
return (NULL);
}
* Can't open file; close the server connection and return NULL...
*/
- _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, NULL, 0);
return (NULL);
}
* Get the PPD file...
*/
- request = ippNewRequest(CUPS_GET_PPD);
+ request = ippNewRequest(IPP_OP_CUPS_GET_PPD);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "ppd-name", NULL,
name);
close(fd);
- if (cupsLastError() != IPP_OK)
+ if (cupsLastError() != IPP_STATUS_OK)
{
unlink(cg->ppd_filename);
return (NULL);
if (!name || num_files < 1 || !files)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(EINVAL), 0);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(EINVAL), 0);
return (0);
}
* Unable to open print file, cancel the job and return...
*/
- _cupsSetError(IPP_DOCUMENT_ACCESS_ERROR, NULL, 0);
+ _cupsSetError(IPP_STATUS_ERROR_DOCUMENT_ACCESS, NULL, 0);
goto cancel_job;
}
status = cupsStartDocument(http, name, job_id, docname, format,
i == (num_files - 1));
- while (status == HTTP_CONTINUE &&
+ while (status == HTTP_STATUS_CONTINUE &&
(bytes = cupsFileRead(fp, buffer, sizeof(buffer))) > 0)
status = cupsWriteRequestData(http, buffer, bytes);
cupsFileClose(fp);
- if (status != HTTP_CONTINUE || cupsFinishDocument(http, name) != IPP_OK)
+ if (status != HTTP_STATUS_CONTINUE || cupsFinishDocument(http, name) != IPP_STATUS_OK)
{
/*
* Unable to queue, cancel the job and return...
* Create a Send-Document request...
*/
- if ((request = ippNewRequest(IPP_SEND_DOCUMENT)) == NULL)
+ if ((request = ippNewRequest(IPP_OP_SEND_DOCUMENT)) == NULL)
{
- _cupsSetError(IPP_INTERNAL_ERROR, strerror(ENOMEM), 0);
- return (HTTP_ERROR);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, strerror(ENOMEM), 0);
+ return (HTTP_STATUS_ERROR);
}
httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri), "ipp",
*/
if (httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL,
- "localhost", 0, "/printers/%s", name) != HTTP_URI_OK)
+ "localhost", 0, "/printers/%s",
+ name) < HTTP_URI_STATUS_OK)
{
- _cupsSetError(IPP_INTERNAL_ERROR, _("Unable to create printer-uri"), 1);
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("Unable to create printer-uri"),
+ 1);
*host = '\0';
*resource = '\0';
* requested-attributes
*/
- request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES);
+ request = ippNewRequest(IPP_OP_GET_PRINTER_ATTRIBUTES);
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri",
NULL, uri);
if (!_cups_strcasecmp(http_hostname, host) && *port == http_port)
http2 = http;
- else if ((http2 = httpConnectEncrypt(host, *port,
- cupsEncryption())) == NULL)
+ else if ((http2 = httpConnect2(host, *port, NULL, AF_UNSPEC,
+ cupsEncryption(), 1, 30000,
+ NULL)) == NULL)
{
DEBUG_puts("8cups_get_printer_uri: Unable to connect to server");
if (!strncmp(resource, "/classes/", 9))
{
- _cupsSetError(IPP_INTERNAL_ERROR,
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL,
_("No printer-uri found for class"), 1);
*host = '\0';
ippDelete(response);
}
- if (cupsLastError() != IPP_NOT_FOUND)
- _cupsSetError(IPP_INTERNAL_ERROR, _("No printer-uri found"), 1);
+ if (cupsLastError() != IPP_STATUS_ERROR_NOT_FOUND)
+ _cupsSetError(IPP_STATUS_ERROR_INTERNAL, _("No printer-uri found"), 1);
*host = '\0';
*resource = '\0';