/*
- * "$Id: adminutil.c 7850 2008-08-20 00:07:25Z mike $"
+ * "$Id$"
*
* Administration utility API definitions for CUPS.
*
- * Copyright 2007-2011 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
/*
* 'cupsAdminCreateWindowsPPD()' - Create the Windows PPD file for a printer.
*
- * @since CUPS 1.2/Mac OS X 10.5@
+ * @deprecated@
*/
char * /* O - PPD file or NULL */
* 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);
/*
* 'cupsAdminExportSamba()' - Export a printer to Samba.
*
- * @since CUPS 1.2/Mac OS X 10.5@
+ * @deprecated@
*/
int /* O - 1 on success, 0 on failure */
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);
* The returned settings should be freed with cupsFreeOptions() when
* you are done with them.
*
- * @since CUPS 1.3/Mac OS X 10.5@
+ * @since CUPS 1.3/OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
*/
if (strcmp(cg->http->hostname, cg->server) ||
- cg->ipp_port != _httpAddrPort(cg->http->hostaddr) ||
+ 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 = _httpCreate(cupsServer(), ippPort(), NULL,
- cupsEncryption(), AF_UNSPEC)) == NULL)
+ if ((cg->http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC,
+ 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);
/*
/*
* 'cupsAdminSetServerSettings()' - Set settings on the server.
*
- * @since CUPS 1.3/Mac OS X 10.5@
+ * @since CUPS 1.3/OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
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';
/*
- * End of "$Id: adminutil.c 7850 2008-08-20 00:07:25Z mike $".
+ * End of "$Id$".
*/