*/
#define _IPP_PRIVATE_STRUCTURES 0 /* Disable private IPP stuff */
-//#define _CUPS_NO_DEPRECATED 1 /* Disable deprecated stuff */
+#define _CUPS_NO_DEPRECATED 1 /* Disable deprecated stuff */
/*
enum _ipp_preasons_e /* printer-state-reasons bit values */
{
- _IPP_PRINTER_NONE = 0x0000, /* none */
- _IPP_PRINTER_OTHER = 0x0001, /* other */
- _IPP_PRINTER_COVER_OPEN = 0x0002, /* cover-open */
- _IPP_PRINTER_INPUT_TRAY_MISSING = 0x0004,
+ _IPP_PSTATE_NONE = 0x0000, /* none */
+ _IPP_PSTATE_OTHER = 0x0001, /* other */
+ _IPP_PSTATE_COVER_OPEN = 0x0002, /* cover-open */
+ _IPP_PSTATE_INPUT_TRAY_MISSING = 0x0004,
/* input-tray-missing */
- _IPP_PRINTER_MARKER_SUPPLY_EMPTY = 0x0008,
+ _IPP_PSTATE_MARKER_SUPPLY_EMPTY = 0x0008,
/* marker-supply-empty */
- _IPP_PRINTER_MARKER_SUPPLY_LOW = 0x0010,
+ _IPP_PSTATE_MARKER_SUPPLY_LOW = 0x0010,
/* marker-suply-low */
- _IPP_PRINTER_MARKER_WASTE_ALMOST_FULL = 0x0020,
+ _IPP_PSTATE_MARKER_WASTE_ALMOST_FULL = 0x0020,
/* marker-waste-almost-full */
- _IPP_PRINTER_MARKER_WASTE_FULL = 0x0040,
+ _IPP_PSTATE_MARKER_WASTE_FULL = 0x0040,
/* marker-waste-full */
- _IPP_PRINTER_MEDIA_EMPTY = 0x0080, /* media-empty */
- _IPP_PRINTER_MEDIA_JAM = 0x0100, /* media-jam */
- _IPP_PRINTER_MEDIA_LOW = 0x0200, /* media-low */
- _IPP_PRINTER_MEDIA_NEEDED = 0x0400, /* media-needed */
- _IPP_PRINTER_MOVING_TO_PAUSED = 0x0800,
+ _IPP_PSTATE_MEDIA_EMPTY = 0x0080, /* media-empty */
+ _IPP_PSTATE_MEDIA_JAM = 0x0100, /* media-jam */
+ _IPP_PSTATE_MEDIA_LOW = 0x0200, /* media-low */
+ _IPP_PSTATE_MEDIA_NEEDED = 0x0400, /* media-needed */
+ _IPP_PSTATE_MOVING_TO_PAUSED = 0x0800,
/* moving-to-paused */
- _IPP_PRINTER_PAUSED = 0x1000, /* paused */
- _IPP_PRINTER_SPOOL_AREA_FULL = 0x2000,/* spool-area-full */
- _IPP_PRINTER_TONER_EMPTY = 0x4000, /* toner-empty */
- _IPP_PRINTER_TONER_LOW = 0x8000 /* toner-low */
+ _IPP_PSTATE_PAUSED = 0x1000, /* paused */
+ _IPP_PSTATE_SPOOL_AREA_FULL = 0x2000,/* spool-area-full */
+ _IPP_PSTATE_TONER_EMPTY = 0x4000, /* toner-empty */
+ _IPP_PSTATE_TONER_LOW = 0x8000 /* toner-low */
};
typedef unsigned int _ipp_preasons_t; /* Bitfield for printer-state-reasons */
{
switch (job->state)
{
- case IPP_JOB_PENDING :
+ case IPP_JSTATE_PENDING :
ippAddString(client->response, IPP_TAG_JOB,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "job-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "job-state-reasons",
NULL, "none");
break;
- case IPP_JOB_HELD :
+ case IPP_JSTATE_HELD :
if (job->fd >= 0)
ippAddString(client->response, IPP_TAG_JOB,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "job-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "job-state-reasons",
NULL, "job-incoming");
else if (ippFindAttribute(job->attrs, "job-hold-until", IPP_TAG_ZERO))
ippAddString(client->response, IPP_TAG_JOB,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "job-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "job-state-reasons",
NULL, "job-hold-until-specified");
else
ippAddString(client->response, IPP_TAG_JOB,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "job-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "job-state-reasons",
NULL, "job-data-insufficient");
break;
- case IPP_JOB_PROCESSING :
+ case IPP_JSTATE_PROCESSING :
if (job->cancel)
ippAddString(client->response, IPP_TAG_JOB,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "job-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "job-state-reasons",
NULL, "processing-to-stop-point");
else
ippAddString(client->response, IPP_TAG_JOB,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "job-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "job-state-reasons",
NULL, "job-printing");
break;
- case IPP_JOB_STOPPED :
+ case IPP_JSTATE_STOPPED :
ippAddString(client->response, IPP_TAG_JOB,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "job-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "job-state-reasons",
NULL, "job-stopped");
break;
- case IPP_JOB_CANCELED :
+ case IPP_JSTATE_CANCELED :
ippAddString(client->response, IPP_TAG_JOB,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "job-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "job-state-reasons",
NULL, "job-canceled-by-user");
break;
- case IPP_JOB_ABORTED :
+ case IPP_JSTATE_ABORTED :
ippAddString(client->response, IPP_TAG_JOB,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "job-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "job-state-reasons",
NULL, "aborted-by-system");
break;
- case IPP_JOB_COMPLETED :
+ case IPP_JSTATE_COMPLETED :
ippAddString(client->response, IPP_TAG_JOB,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "job-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "job-state-reasons",
NULL, "job-completed-successfully");
break;
}
_cupsRWLockWrite(&(client->printer->rwlock));
if (client->printer->active_job &&
- client->printer->active_job->state < IPP_JOB_CANCELED)
+ client->printer->active_job->state < IPP_JSTATE_CANCELED)
{
/*
* Only accept a single job at a time...
job->printer = client->printer;
job->attrs = client->request;
- job->state = IPP_JOB_HELD;
+ job->state = IPP_JSTATE_HELD;
job->fd = -1;
client->request = NULL;
IPP_TAG_NAME)) != NULL)
ippSetName(job->attrs, &attr, "job-originating-user-name");
else
- attr = ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME | IPP_TAG_COPY,
+ attr = ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME | IPP_TAG_CUPS_COPY,
"job-originating-user-name", NULL, "anonymous");
if (attr)
#endif /* HAVE_STATVFS */
static const int orients[4] = /* orientation-requested-supported values */
{
- IPP_PORTRAIT,
- IPP_LANDSCAPE,
- IPP_REVERSE_LANDSCAPE,
- IPP_REVERSE_PORTRAIT
+ IPP_ORIENT_PORTRAIT,
+ IPP_ORIENT_LANDSCAPE,
+ IPP_ORIENT_REVERSE_LANDSCAPE,
+ IPP_ORIENT_REVERSE_PORTRAIT
};
static const char * const versions[] =/* ipp-versions-supported values */
{
};
static const int ops[] = /* operations-supported values */
{
- IPP_PRINT_JOB,
- IPP_PRINT_URI,
- IPP_VALIDATE_JOB,
- IPP_CREATE_JOB,
- IPP_SEND_DOCUMENT,
- IPP_SEND_URI,
- IPP_CANCEL_JOB,
- IPP_GET_JOB_ATTRIBUTES,
- IPP_GET_JOBS,
- IPP_GET_PRINTER_ATTRIBUTES
+ IPP_OP_PRINT_JOB,
+ IPP_OP_PRINT_URI,
+ IPP_OP_VALIDATE_JOB,
+ IPP_OP_CREATE_JOB,
+ IPP_OP_SEND_DOCUMENT,
+ IPP_OP_SEND_URI,
+ IPP_OP_CANCEL_JOB,
+ IPP_OP_GET_JOB_ATTRIBUTES,
+ IPP_OP_GET_JOBS,
+ IPP_OP_GET_PRINTER_ATTRIBUTES
};
static const char * const charsets[] =/* charset-supported values */
{
httpGetHostname(NULL, hostname,
sizeof(hostname)));
printer->port = port;
- printer->state = IPP_PRINTER_IDLE;
- printer->state_reasons = _IPP_PRINTER_NONE;
+ printer->state = IPP_PSTATE_IDLE;
+ printer->state_reasons = _IPP_PSTATE_NONE;
printer->jobs = cupsArrayNew((cups_array_func_t)compare_jobs, NULL);
printer->next_job_id = 1;
printer->attrs = ippNew();
/* charset-configured */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_CHARSET | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_CHARSET | IPP_TAG_CUPS_COPY,
"charset-configured", NULL, "utf-8");
/* charset-supported */
- ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_CHARSET | IPP_TAG_COPY,
+ ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_CHARSET | IPP_TAG_CUPS_COPY,
"charset-supported", sizeof(charsets) / sizeof(charsets[0]),
NULL, charsets);
ppm_color > 0);
/* compression-supported */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"compression-supported", NULL, "none");
/* copies-default */
"finishings-supported", IPP_FINISHINGS_NONE);
/* generated-natural-language-supported */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE | IPP_TAG_CUPS_COPY,
"generated-natural-language-supported", NULL, "en");
/* ipp-versions-supported */
- ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"ipp-versions-supported",
sizeof(versions) / sizeof(versions[0]), NULL, versions);
"job-accounting-user-id-supported", 1);
/* job-creation-attributes-supported */
- ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"job-creation-attributes-supported",
sizeof(job_creation) / sizeof(job_creation[0]),
NULL, job_creation);
"job-priority-supported", 100);
/* job-sheets-default */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME | IPP_TAG_CUPS_COPY,
"job-sheets-default", NULL, "none");
/* job-sheets-supported */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_NAME | IPP_TAG_CUPS_COPY,
"job-sheets-supported", NULL, "none");
/* media-bottom-margin-supported */
ippDelete(media_col_default);
/* media-col-supported */
- ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"media-col-supported",
(int)(sizeof(media_col_supported) /
sizeof(media_col_supported[0])), NULL,
media_col_supported);
/* media-default */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"media-default", NULL, media_supported[0]);
/* media-left-margin-supported */
media_xxx_margin_supported);
/* media-supported */
- ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"media-supported",
(int)(sizeof(media_supported) / sizeof(media_supported[0])),
NULL, media_supported);
media_xxx_margin_supported);
/* media-type-supported */
- ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"media-type-supported",
(int)(sizeof(media_type_supported) /
sizeof(media_type_supported[0])),
NULL, media_type_supported);
/* multiple-document-handling-supported */
- ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"multiple-document-handling-supported",
sizeof(multiple_document_handling) /
sizeof(multiple_document_handling[0]), NULL,
"multiple-document-jobs-supported", 0);
/* natural-language-configured */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_LANGUAGE | IPP_TAG_CUPS_COPY,
"natural-language-configured", NULL, "en");
/* number-up-default */
"orientation-requested-supported", 4, orients);
/* output-bin-default */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"output-bin-default", NULL, "face-down");
/* output-bin-supported */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"output-bin-supported", NULL, "face-down");
/* pages-per-minute */
"pages-per-minute-color", ppm_color);
/* pdl-override-supported */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"pdl-override-supported", NULL, "attempted");
/* print-quality-default */
/* reference-uri-scheme-supported */
ippAddStrings(printer->attrs, IPP_TAG_PRINTER,
- IPP_TAG_URISCHEME | IPP_TAG_COPY,
+ IPP_TAG_URISCHEME | IPP_TAG_CUPS_COPY,
"reference-uri-schemes-supported",
(int)(sizeof(reference_uri_schemes_supported) /
sizeof(reference_uri_schemes_supported[0])),
NULL, reference_uri_schemes_supported);
/* sides-default */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"sides-default", NULL, "one-sided");
/* sides-supported */
- ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"sides-supported", duplex ? 3 : 1, NULL, sides_supported);
/* uri-authentication-supported */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"uri-authentication-supported", NULL, "none");
/* uri-security-supported */
- ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddString(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"uri-security-supported", NULL, "none");
/* which-jobs-supported */
- ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_COPY,
+ ippAddStrings(printer->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY,
"which-jobs-supported",
sizeof(which_jobs) / sizeof(which_jobs[0]), NULL, which_jobs);
if ((job = find_job(client)) == NULL)
{
- respond_ipp(client, IPP_NOT_FOUND, "Job does not exist.");
+ respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "Job does not exist.");
return;
}
switch (job->state)
{
- case IPP_JOB_CANCELED :
- respond_ipp(client, IPP_NOT_POSSIBLE,
+ case IPP_JSTATE_CANCELED :
+ respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE,
"Job #%d is already canceled - can\'t cancel.", job->id);
break;
- case IPP_JOB_ABORTED :
- respond_ipp(client, IPP_NOT_POSSIBLE,
+ case IPP_JSTATE_ABORTED :
+ respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE,
"Job #%d is already aborted - can\'t cancel.", job->id);
break;
- case IPP_JOB_COMPLETED :
- respond_ipp(client, IPP_NOT_POSSIBLE,
+ case IPP_JSTATE_COMPLETED :
+ respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE,
"Job #%d is already completed - can\'t cancel.", job->id);
break;
_cupsRWLockWrite(&(client->printer->rwlock));
- if (job->state == IPP_JOB_PROCESSING ||
- (job->state == IPP_JOB_HELD && job->fd >= 0))
+ if (job->state == IPP_JSTATE_PROCESSING ||
+ (job->state == IPP_JSTATE_HELD && job->fd >= 0))
job->cancel = 1;
else
{
- job->state = IPP_JOB_CANCELED;
+ job->state = IPP_JSTATE_CANCELED;
job->completed = time(NULL);
}
_cupsRWUnlock(&(client->printer->rwlock));
- respond_ipp(client, IPP_OK, NULL);
+ respond_ipp(client, IPP_STATUS_OK, NULL);
break;
}
}
if ((job = create_job(client)) == NULL)
{
- respond_ipp(client, IPP_PRINTER_BUSY, "Currently printing another job.");
+ respond_ipp(client, IPP_STATUS_ERROR_BUSY, "Currently printing another job.");
return;
}
* Return the job info...
*/
- respond_ipp(client, IPP_OK, NULL);
+ respond_ipp(client, IPP_STATUS_OK, NULL);
ra = cupsArrayNew((cups_array_func_t)strcmp, NULL);
cupsArrayAdd(ra, "job-id");
if ((job = find_job(client)) == NULL)
{
- respond_ipp(client, IPP_NOT_FOUND, "Job not found.");
+ respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "Job not found.");
return;
}
- respond_ipp(client, IPP_OK, NULL);
+ respond_ipp(client, IPP_STATUS_OK, NULL);
ra = create_requested_array(client);
copy_job_attributes(client, job, ra);
if (!which_jobs || !strcmp(which_jobs, "not-completed"))
{
job_comparison = -1;
- job_state = IPP_JOB_STOPPED;
+ job_state = IPP_JSTATE_STOPPED;
}
else if (!strcmp(which_jobs, "completed"))
{
job_comparison = 1;
- job_state = IPP_JOB_CANCELED;
+ job_state = IPP_JSTATE_CANCELED;
}
else if (!strcmp(which_jobs, "aborted"))
{
job_comparison = 0;
- job_state = IPP_JOB_ABORTED;
+ job_state = IPP_JSTATE_ABORTED;
}
else if (!strcmp(which_jobs, "all"))
{
job_comparison = 1;
- job_state = IPP_JOB_PENDING;
+ job_state = IPP_JSTATE_PENDING;
}
else if (!strcmp(which_jobs, "canceled"))
{
job_comparison = 0;
- job_state = IPP_JOB_CANCELED;
+ job_state = IPP_JSTATE_CANCELED;
}
else if (!strcmp(which_jobs, "pending"))
{
job_comparison = 0;
- job_state = IPP_JOB_PENDING;
+ job_state = IPP_JSTATE_PENDING;
}
else if (!strcmp(which_jobs, "pending-held"))
{
job_comparison = 0;
- job_state = IPP_JOB_HELD;
+ job_state = IPP_JSTATE_HELD;
}
else if (!strcmp(which_jobs, "processing"))
{
job_comparison = 0;
- job_state = IPP_JOB_PROCESSING;
+ job_state = IPP_JSTATE_PROCESSING;
}
else if (!strcmp(which_jobs, "processing-stopped"))
{
job_comparison = 0;
- job_state = IPP_JOB_STOPPED;
+ job_state = IPP_JSTATE_STOPPED;
}
else
{
- respond_ipp(client, IPP_ATTRIBUTES,
+ respond_ipp(client, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES,
"The which-jobs value \"%s\" is not supported.", which_jobs);
ippAddString(client->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD,
"which-jobs", NULL, which_jobs);
if ((attr = ippFindAttribute(client->request, "requesting-user-name",
IPP_TAG_NAME)) == NULL)
{
- respond_ipp(client, IPP_BAD_REQUEST,
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST,
"Need requesting-user-name with my-jobs.");
return;
}
cupsArrayAdd(ra, "job-uri");
}
- respond_ipp(client, IPP_OK, NULL);
+ respond_ipp(client, IPP_STATUS_OK, NULL);
_cupsRWLockRead(&(client->printer->rwlock));
ra = create_requested_array(client);
printer = client->printer;
- respond_ipp(client, IPP_OK, NULL);
+ respond_ipp(client, IPP_STATUS_OK, NULL);
_cupsRWLockRead(&(printer->rwlock));
copy_attributes(client->response, printer->attrs, ra, IPP_TAG_ZERO,
- IPP_TAG_COPY);
+ IPP_TAG_CUPS_COPY);
if (!ra || cupsArrayFind(ra, "printer-state"))
ippAddInteger(client->response, IPP_TAG_PRINTER, IPP_TAG_ENUM,
if (!ra || cupsArrayFind(ra, "printer-state-reasons"))
{
- if (printer->state_reasons == _IPP_PRINTER_NONE)
+ if (printer->state_reasons == _IPP_PSTATE_NONE)
ippAddString(client->response, IPP_TAG_PRINTER,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "printer-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "printer-state-reasons",
NULL, "none");
else
{
int num_reasons = 0;/* Number of reasons */
const char *reasons[32]; /* Reason strings */
- if (printer->state_reasons & _IPP_PRINTER_OTHER)
+ if (printer->state_reasons & _IPP_PSTATE_OTHER)
reasons[num_reasons ++] = "other";
- if (printer->state_reasons & _IPP_PRINTER_COVER_OPEN)
+ if (printer->state_reasons & _IPP_PSTATE_COVER_OPEN)
reasons[num_reasons ++] = "cover-open";
- if (printer->state_reasons & _IPP_PRINTER_INPUT_TRAY_MISSING)
+ if (printer->state_reasons & _IPP_PSTATE_INPUT_TRAY_MISSING)
reasons[num_reasons ++] = "input-tray-missing";
- if (printer->state_reasons & _IPP_PRINTER_MARKER_SUPPLY_EMPTY)
+ if (printer->state_reasons & _IPP_PSTATE_MARKER_SUPPLY_EMPTY)
reasons[num_reasons ++] = "marker-supply-empty-warning";
- if (printer->state_reasons & _IPP_PRINTER_MARKER_SUPPLY_LOW)
+ if (printer->state_reasons & _IPP_PSTATE_MARKER_SUPPLY_LOW)
reasons[num_reasons ++] = "marker-supply-low-report";
- if (printer->state_reasons & _IPP_PRINTER_MARKER_WASTE_ALMOST_FULL)
+ if (printer->state_reasons & _IPP_PSTATE_MARKER_WASTE_ALMOST_FULL)
reasons[num_reasons ++] = "marker-waste-almost-full-report";
- if (printer->state_reasons & _IPP_PRINTER_MARKER_WASTE_FULL)
+ if (printer->state_reasons & _IPP_PSTATE_MARKER_WASTE_FULL)
reasons[num_reasons ++] = "marker-waste-full-warning";
- if (printer->state_reasons & _IPP_PRINTER_MEDIA_EMPTY)
+ if (printer->state_reasons & _IPP_PSTATE_MEDIA_EMPTY)
reasons[num_reasons ++] = "media-empty-warning";
- if (printer->state_reasons & _IPP_PRINTER_MEDIA_JAM)
+ if (printer->state_reasons & _IPP_PSTATE_MEDIA_JAM)
reasons[num_reasons ++] = "media-jam-warning";
- if (printer->state_reasons & _IPP_PRINTER_MEDIA_LOW)
+ if (printer->state_reasons & _IPP_PSTATE_MEDIA_LOW)
reasons[num_reasons ++] = "media-low-report";
- if (printer->state_reasons & _IPP_PRINTER_MEDIA_NEEDED)
+ if (printer->state_reasons & _IPP_PSTATE_MEDIA_NEEDED)
reasons[num_reasons ++] = "media-needed-report";
- if (printer->state_reasons & _IPP_PRINTER_MOVING_TO_PAUSED)
+ if (printer->state_reasons & _IPP_PSTATE_MOVING_TO_PAUSED)
reasons[num_reasons ++] = "moving-to-paused";
- if (printer->state_reasons & _IPP_PRINTER_PAUSED)
+ if (printer->state_reasons & _IPP_PSTATE_PAUSED)
reasons[num_reasons ++] = "paused";
- if (printer->state_reasons & _IPP_PRINTER_SPOOL_AREA_FULL)
+ if (printer->state_reasons & _IPP_PSTATE_SPOOL_AREA_FULL)
reasons[num_reasons ++] = "spool-area-full";
- if (printer->state_reasons & _IPP_PRINTER_TONER_EMPTY)
+ if (printer->state_reasons & _IPP_PSTATE_TONER_EMPTY)
reasons[num_reasons ++] = "toner-empty-warning";
- if (printer->state_reasons & _IPP_PRINTER_TONER_LOW)
+ if (printer->state_reasons & _IPP_PSTATE_TONER_LOW)
reasons[num_reasons ++] = "toner-low-report";
ippAddStrings(client->response, IPP_TAG_PRINTER,
- IPP_TAG_KEYWORD | IPP_TAG_COPY, "printer-state-reasons",
+ IPP_TAG_KEYWORD | IPP_TAG_CUPS_COPY, "printer-state-reasons",
num_reasons, NULL, reasons);
}
}
ippAddInteger(client->response, IPP_TAG_PRINTER, IPP_TAG_INTEGER,
"queued-job-count",
printer->active_job &&
- printer->active_job->state < IPP_JOB_CANCELED);
+ printer->active_job->state < IPP_JSTATE_CANCELED);
_cupsRWUnlock(&(printer->rwlock));
if (httpGetState(client->http) == HTTP_STATE_POST_SEND)
{
- respond_ipp(client, IPP_BAD_REQUEST, "No file in request.");
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "No file in request.");
return;
}
if ((job = create_job(client)) == NULL)
{
- respond_ipp(client, IPP_PRINTER_BUSY, "Currently printing another job.");
+ respond_ipp(client, IPP_STATUS_ERROR_BUSY, "Currently printing another job.");
return;
}
if ((job->fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0)
{
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
- respond_ipp(client, IPP_INTERNAL_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL,
"Unable to create print file: %s", strerror(errno));
return;
}
{
int error = errno; /* Write error */
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
unlink(filename);
- respond_ipp(client, IPP_INTERNAL_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL,
"Unable to write print file: %s", strerror(error));
return;
}
* Got an error while reading the print data, so abort this job.
*/
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
unlink(filename);
- respond_ipp(client, IPP_INTERNAL_ERROR, "Unable to read print file.");
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to read print file.");
return;
}
{
int error = errno; /* Write error */
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
job->fd = -1;
unlink(filename);
- respond_ipp(client, IPP_INTERNAL_ERROR, "Unable to write print file: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to write print file: %s",
strerror(error));
return;
}
job->fd = -1;
job->filename = strdup(filename);
- job->state = IPP_JOB_PENDING;
+ job->state = IPP_JSTATE_PENDING;
/*
* Process the job...
#if 0
if (!_cupsThreadCreate((_cups_thread_func_t)process_job, job))
{
- job->state = IPP_JOB_ABORTED;
- respond_ipp(client, IPP_INTERNAL_ERROR, "Unable to process job.");
+ job->state = IPP_JSTATE_ABORTED;
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to process job.");
return;
}
* Return the job info...
*/
- respond_ipp(client, IPP_OK, NULL);
+ respond_ipp(client, IPP_STATUS_OK, NULL);
ra = cupsArrayNew((cups_array_func_t)strcmp, NULL);
cupsArrayAdd(ra, "job-id");
* Do we have a file to print?
*/
- if (httpGetState(client->http) == HTTP_POST_RECV)
+ if (httpGetState(client->http) == HTTP_STATE_POST_RECV)
{
- respond_ipp(client, IPP_BAD_REQUEST,
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST,
"Unexpected document data following request.");
return;
}
if ((uri = ippFindAttribute(client->request, "document-uri",
IPP_TAG_URI)) == NULL)
{
- respond_ipp(client, IPP_BAD_REQUEST, "Missing document-uri.");
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Missing document-uri.");
return;
}
if (ippGetCount(uri) != 1)
{
- respond_ipp(client, IPP_BAD_REQUEST, "Too many document-uri values.");
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Too many document-uri values.");
return;
}
scheme, sizeof(scheme), userpass,
sizeof(userpass), hostname, sizeof(hostname),
&port, resource, sizeof(resource));
- if (uri_status < HTTP_URI_OK)
+ if (uri_status < HTTP_URI_STATUS_OK)
{
- respond_ipp(client, IPP_BAD_REQUEST, "Bad document-uri: %s",
- uri_status_strings[uri_status - HTTP_URI_OVERFLOW]);
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Bad document-uri: %s",
+ uri_status_strings[uri_status - HTTP_URI_STATUS_OVERFLOW]);
return;
}
#endif /* HAVE_SSL */
strcmp(scheme, "http"))
{
- respond_ipp(client, IPP_URI_SCHEME, "URI scheme \"%s\" not supported.",
+ respond_ipp(client, IPP_STATUS_ERROR_URI_SCHEME, "URI scheme \"%s\" not supported.",
scheme);
return;
}
if (!strcmp(scheme, "file") && access(resource, R_OK))
{
- respond_ipp(client, IPP_DOCUMENT_ACCESS_ERROR, "Unable to access URI: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to access URI: %s",
strerror(errno));
return;
}
if ((job = create_job(client)) == NULL)
{
- respond_ipp(client, IPP_PRINTER_BUSY, "Currently printing another job.");
+ respond_ipp(client, IPP_STATUS_ERROR_BUSY, "Currently printing another job.");
return;
}
if ((job->fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0600)) < 0)
{
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
- respond_ipp(client, IPP_INTERNAL_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL,
"Unable to create print file: %s", strerror(errno));
return;
}
{
if ((infile = open(resource, O_RDONLY)) < 0)
{
- respond_ipp(client, IPP_DOCUMENT_ACCESS_ERROR, "Unable to access URI: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to access URI: %s",
strerror(errno));
return;
}
{
int error = errno; /* Write error */
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
unlink(filename);
close(infile);
- respond_ipp(client, IPP_INTERNAL_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL,
"Unable to write print file: %s", strerror(error));
return;
}
{
#ifdef HAVE_SSL
if (port == 443 || !strcmp(scheme, "https"))
- encryption = HTTP_ENCRYPT_ALWAYS;
+ encryption = HTTP_ENCRYPTION_ALWAYS;
else
#endif /* HAVE_SSL */
- encryption = HTTP_ENCRYPT_IF_REQUESTED;
+ encryption = HTTP_ENCRYPTION_IF_REQUESTED;
if ((http = httpConnectEncrypt(hostname, port, encryption)) == NULL)
{
- respond_ipp(client, IPP_DOCUMENT_ACCESS_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS,
"Unable to connect to %s: %s", hostname,
cupsLastErrorString());
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
httpSetField(http, HTTP_FIELD_ACCEPT_LANGUAGE, "en");
if (httpGet(http, resource))
{
- respond_ipp(client, IPP_DOCUMENT_ACCESS_ERROR, "Unable to GET URI: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to GET URI: %s",
strerror(errno));
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
return;
}
- while ((status = httpUpdate(http)) == HTTP_CONTINUE);
+ while ((status = httpUpdate(http)) == HTTP_STATUS_CONTINUE);
- if (status != HTTP_OK)
+ if (status != HTTP_STATUS_OK)
{
- respond_ipp(client, IPP_DOCUMENT_ACCESS_ERROR, "Unable to GET URI: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to GET URI: %s",
httpStatus(status));
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
{
int error = errno; /* Write error */
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
unlink(filename);
httpClose(http);
- respond_ipp(client, IPP_INTERNAL_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL,
"Unable to write print file: %s", strerror(error));
return;
}
{
int error = errno; /* Write error */
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
job->fd = -1;
unlink(filename);
- respond_ipp(client, IPP_INTERNAL_ERROR, "Unable to write print file: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to write print file: %s",
strerror(error));
return;
}
job->fd = -1;
job->filename = strdup(filename);
- job->state = IPP_JOB_PENDING;
+ job->state = IPP_JSTATE_PENDING;
/*
* Process the job...
#if 0
if (!_cupsThreadCreate((_cups_thread_func_t)process_job, job))
{
- job->state = IPP_JOB_ABORTED;
- respond_ipp(client, IPP_INTERNAL_ERROR, "Unable to process job.");
+ job->state = IPP_JSTATE_ABORTED;
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to process job.");
return;
}
* Return the job info...
*/
- respond_ipp(client, IPP_OK, NULL);
+ respond_ipp(client, IPP_STATUS_OK, NULL);
ra = cupsArrayNew((cups_array_func_t)strcmp, NULL);
cupsArrayAdd(ra, "job-id");
if ((job = find_job(client)) == NULL)
{
- respond_ipp(client, IPP_NOT_FOUND, "Job does not exist.");
+ respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "Job does not exist.");
httpFlush(client->http);
return;
}
* in a non-pending state...
*/
- if (job->state > IPP_JOB_HELD)
+ if (job->state > IPP_JSTATE_HELD)
{
- respond_ipp(client, IPP_NOT_POSSIBLE, "Job is not in a pending state.");
+ respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, "Job is not in a pending state.");
httpFlush(client->http);
return;
}
else if (job->filename || job->fd >= 0)
{
- respond_ipp(client, IPP_MULTIPLE_JOBS_NOT_SUPPORTED,
+ respond_ipp(client, IPP_STATUS_ERROR_MULTIPLE_JOBS_NOT_SUPPORTED,
"Multiple document jobs are not supported.");
httpFlush(client->http);
return;
if ((attr = ippFindAttribute(client->request, "last-document",
IPP_TAG_ZERO)) == NULL)
{
- respond_ipp(client, IPP_BAD_REQUEST,
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST,
"Missing required last-document attribute.");
httpFlush(client->http);
return;
if (job->fd < 0)
{
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
- respond_ipp(client, IPP_INTERNAL_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL,
"Unable to create print file: %s", strerror(errno));
return;
}
{
int error = errno; /* Write error */
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
unlink(filename);
- respond_ipp(client, IPP_INTERNAL_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL,
"Unable to write print file: %s", strerror(error));
return;
}
* Got an error while reading the print data, so abort this job.
*/
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
unlink(filename);
- respond_ipp(client, IPP_INTERNAL_ERROR, "Unable to read print file.");
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to read print file.");
return;
}
{
int error = errno; /* Write error */
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
job->fd = -1;
unlink(filename);
- respond_ipp(client, IPP_INTERNAL_ERROR, "Unable to write print file: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to write print file: %s",
strerror(error));
return;
}
job->fd = -1;
job->filename = strdup(filename);
- job->state = IPP_JOB_PENDING;
+ job->state = IPP_JSTATE_PENDING;
_cupsRWUnlock(&(client->printer->rwlock));
#if 0
if (!_cupsThreadCreate((_cups_thread_func_t)process_job, job))
{
- job->state = IPP_JOB_ABORTED;
- respond_ipp(client, IPP_INTERNAL_ERROR, "Unable to process job.");
+ job->state = IPP_JSTATE_ABORTED;
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to process job.");
return;
}
* Return the job info...
*/
- respond_ipp(client, IPP_OK, NULL);
+ respond_ipp(client, IPP_STATUS_OK, NULL);
ra = cupsArrayNew((cups_array_func_t)strcmp, NULL);
cupsArrayAdd(ra, "job-id");
if ((job = find_job(client)) == NULL)
{
- respond_ipp(client, IPP_NOT_FOUND, "Job does not exist.");
+ respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "Job does not exist.");
httpFlush(client->http);
return;
}
* in a non-pending state...
*/
- if (job->state > IPP_JOB_HELD)
+ if (job->state > IPP_JSTATE_HELD)
{
- respond_ipp(client, IPP_NOT_POSSIBLE, "Job is not in a pending state.");
+ respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, "Job is not in a pending state.");
httpFlush(client->http);
return;
}
else if (job->filename || job->fd >= 0)
{
- respond_ipp(client, IPP_MULTIPLE_JOBS_NOT_SUPPORTED,
+ respond_ipp(client, IPP_STATUS_ERROR_MULTIPLE_JOBS_NOT_SUPPORTED,
"Multiple document jobs are not supported.");
httpFlush(client->http);
return;
if ((attr = ippFindAttribute(client->request, "last-document",
IPP_TAG_ZERO)) == NULL)
{
- respond_ipp(client, IPP_BAD_REQUEST,
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST,
"Missing required last-document attribute.");
httpFlush(client->http);
return;
* Do we have a file to print?
*/
- if (httpGetState(client->http) == HTTP_POST_RECV)
+ if (httpGetState(client->http) == HTTP_STATE_POST_RECV)
{
- respond_ipp(client, IPP_BAD_REQUEST,
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST,
"Unexpected document data following request.");
return;
}
if ((uri = ippFindAttribute(client->request, "document-uri",
IPP_TAG_URI)) == NULL)
{
- respond_ipp(client, IPP_BAD_REQUEST, "Missing document-uri.");
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Missing document-uri.");
return;
}
if (ippGetCount(uri) != 1)
{
- respond_ipp(client, IPP_BAD_REQUEST, "Too many document-uri values.");
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Too many document-uri values.");
return;
}
scheme, sizeof(scheme), userpass,
sizeof(userpass), hostname, sizeof(hostname),
&port, resource, sizeof(resource));
- if (uri_status < HTTP_URI_OK)
+ if (uri_status < HTTP_URI_STATUS_OK)
{
- respond_ipp(client, IPP_BAD_REQUEST, "Bad document-uri: %s",
- uri_status_strings[uri_status - HTTP_URI_OVERFLOW]);
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Bad document-uri: %s",
+ uri_status_strings[uri_status - HTTP_URI_STATUS_OVERFLOW]);
return;
}
#endif /* HAVE_SSL */
strcmp(scheme, "http"))
{
- respond_ipp(client, IPP_URI_SCHEME, "URI scheme \"%s\" not supported.",
+ respond_ipp(client, IPP_STATUS_ERROR_URI_SCHEME, "URI scheme \"%s\" not supported.",
scheme);
return;
}
if (!strcmp(scheme, "file") && access(resource, R_OK))
{
- respond_ipp(client, IPP_DOCUMENT_ACCESS_ERROR, "Unable to access URI: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to access URI: %s",
strerror(errno));
return;
}
if (job->fd < 0)
{
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
- respond_ipp(client, IPP_INTERNAL_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL,
"Unable to create print file: %s", strerror(errno));
return;
}
{
if ((infile = open(resource, O_RDONLY)) < 0)
{
- respond_ipp(client, IPP_DOCUMENT_ACCESS_ERROR, "Unable to access URI: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to access URI: %s",
strerror(errno));
return;
}
{
int error = errno; /* Write error */
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
unlink(filename);
close(infile);
- respond_ipp(client, IPP_INTERNAL_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL,
"Unable to write print file: %s", strerror(error));
return;
}
{
#ifdef HAVE_SSL
if (port == 443 || !strcmp(scheme, "https"))
- encryption = HTTP_ENCRYPT_ALWAYS;
+ encryption = HTTP_ENCRYPTION_ALWAYS;
else
#endif /* HAVE_SSL */
- encryption = HTTP_ENCRYPT_IF_REQUESTED;
+ encryption = HTTP_ENCRYPTION_IF_REQUESTED;
if ((http = httpConnectEncrypt(hostname, port, encryption)) == NULL)
{
- respond_ipp(client, IPP_DOCUMENT_ACCESS_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS,
"Unable to connect to %s: %s", hostname,
cupsLastErrorString());
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
httpSetField(http, HTTP_FIELD_ACCEPT_LANGUAGE, "en");
if (httpGet(http, resource))
{
- respond_ipp(client, IPP_DOCUMENT_ACCESS_ERROR, "Unable to GET URI: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to GET URI: %s",
strerror(errno));
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
return;
}
- while ((status = httpUpdate(http)) == HTTP_CONTINUE);
+ while ((status = httpUpdate(http)) == HTTP_STATUS_CONTINUE);
- if (status != HTTP_OK)
+ if (status != HTTP_STATUS_OK)
{
- respond_ipp(client, IPP_DOCUMENT_ACCESS_ERROR, "Unable to GET URI: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to GET URI: %s",
httpStatus(status));
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
{
int error = errno; /* Write error */
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
close(job->fd);
job->fd = -1;
unlink(filename);
httpClose(http);
- respond_ipp(client, IPP_INTERNAL_ERROR,
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL,
"Unable to write print file: %s", strerror(error));
return;
}
{
int error = errno; /* Write error */
- job->state = IPP_JOB_ABORTED;
+ job->state = IPP_JSTATE_ABORTED;
job->fd = -1;
unlink(filename);
- respond_ipp(client, IPP_INTERNAL_ERROR, "Unable to write print file: %s",
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to write print file: %s",
strerror(error));
return;
}
job->fd = -1;
job->filename = strdup(filename);
- job->state = IPP_JOB_PENDING;
+ job->state = IPP_JSTATE_PENDING;
_cupsRWUnlock(&(client->printer->rwlock));
#if 0
if (!_cupsThreadCreate((_cups_thread_func_t)process_job, job))
{
- job->state = IPP_JOB_ABORTED;
- respond_ipp(client, IPP_INTERNAL_ERROR, "Unable to process job.");
+ job->state = IPP_JSTATE_ABORTED;
+ respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to process job.");
return;
}
* Return the job info...
*/
- respond_ipp(client, IPP_OK, NULL);
+ respond_ipp(client, IPP_STATUS_OK, NULL);
ra = cupsArrayNew((cups_array_func_t)strcmp, NULL);
cupsArrayAdd(ra, "job-id");
ipp_validate_job(_ipp_client_t *client) /* I - Client */
{
if (valid_job_attributes(client))
- respond_ipp(client, IPP_OK, NULL);
+ respond_ipp(client, IPP_STATUS_OK, NULL);
}
if (http_state == HTTP_STATE_ERROR)
{
fprintf(stderr, "%s Bad request line.\n", client->hostname);
- respond_http(client, HTTP_BAD_REQUEST, NULL, 0);
+ respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, 0);
return (0);
}
else if (http_state == HTTP_STATE_UNKNOWN_METHOD)
{
fprintf(stderr, "%s Bad/unknown operation.\n", client->hostname);
- respond_http(client, HTTP_BAD_REQUEST, NULL, 0);
+ respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, 0);
return (0);
}
else if (http_state == HTTP_STATE_UNKNOWN_VERSION)
{
fprintf(stderr, "%s Bad HTTP version.\n", client->hostname);
- respond_http(client, HTTP_BAD_REQUEST, NULL, 0);
+ respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, 0);
return (0);
}
if (httpSeparateURI(HTTP_URI_CODING_MOST, uri, scheme, sizeof(scheme),
userpass, sizeof(userpass),
hostname, sizeof(hostname), &port,
- client->uri, sizeof(client->uri)) < HTTP_URI_OK)
+ client->uri, sizeof(client->uri)) < HTTP_URI_STATUS_OK)
{
fprintf(stderr, "%s Bad URI \"%s\".\n", client->hostname, uri);
- respond_http(client, HTTP_BAD_REQUEST, NULL, 0);
+ respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, 0);
return (0);
}
if (http_status != HTTP_STATUS_OK)
{
- respond_http(client, HTTP_BAD_REQUEST, NULL, 0);
+ respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, 0);
return (0);
}
* HTTP/1.1 and higher require the "Host:" field...
*/
- respond_http(client, HTTP_BAD_REQUEST, NULL, 0);
+ respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, 0);
return (0);
}
if (!_cups_strcasecmp(httpGetField(client->http, HTTP_FIELD_CONNECTION),
"Upgrade"))
{
- if (!respond_http(client, HTTP_NOT_IMPLEMENTED, NULL, 0))
+ if (!respond_http(client, HTTP_STATUS_NOT_IMPLEMENTED, NULL, 0))
return (0);
}
switch (client->operation)
{
- case HTTP_OPTIONS :
+ case HTTP_STATE_OPTIONS :
/*
* Do HEAD/OPTIONS command...
*/
- return (respond_http(client, HTTP_OK, NULL, 0));
+ return (respond_http(client, HTTP_STATUS_OK, NULL, 0));
- case HTTP_HEAD :
+ case HTTP_STATE_HEAD :
if (!strcmp(client->uri, "/icon.png"))
- return (respond_http(client, HTTP_OK, "image/png", 0));
+ return (respond_http(client, HTTP_STATUS_OK, "image/png", 0));
else if (!strcmp(client->uri, "/"))
- return (respond_http(client, HTTP_OK, "text/html", 0));
+ return (respond_http(client, HTTP_STATUS_OK, "text/html", 0));
else
- return (respond_http(client, HTTP_NOT_FOUND, NULL, 0));
+ return (respond_http(client, HTTP_STATUS_NOT_FOUND, NULL, 0));
break;
- case HTTP_GET :
+ case HTTP_STATE_GET :
if (!strcmp(client->uri, "/icon.png"))
{
/*
if (!stat(client->printer->icon, &fileinfo) &&
(fd = open(client->printer->icon, O_RDONLY)) >= 0)
{
- if (!respond_http(client, HTTP_OK, "image/png", fileinfo.st_size))
+ if (!respond_http(client, HTTP_STATUS_OK, "image/png", fileinfo.st_size))
{
close(fd);
return (0);
close(fd);
}
else
- return (respond_http(client, HTTP_NOT_FOUND, NULL, 0));
+ return (respond_http(client, HTTP_STATUS_NOT_FOUND, NULL, 0));
}
else if (!strcmp(client->uri, "/"))
{
* Show web status page...
*/
- if (!respond_http(client, HTTP_OK, "text/html", 0))
+ if (!respond_http(client, HTTP_STATUS_OK, "text/html", 0))
return (0);
html_printf(client,
"</body>\n"
"</html>\n",
client->printer->name, client->printer->name,
- client->printer->state == IPP_PRINTER_IDLE ? "Idle" :
- client->printer->state == IPP_PRINTER_PROCESSING ?
+ client->printer->state == IPP_PSTATE_IDLE ? "Idle" :
+ client->printer->state == IPP_PSTATE_PROCESSING ?
"Printing" : "Stopped",
cupsArrayCount(client->printer->jobs));
httpWrite2(client->http, "", 0);
return (1);
}
else
- return (respond_http(client, HTTP_NOT_FOUND, NULL, 0));
+ return (respond_http(client, HTTP_STATUS_NOT_FOUND, NULL, 0));
break;
- case HTTP_POST :
+ case HTTP_STATE_POST :
if (strcmp(httpGetField(client->http, HTTP_FIELD_CONTENT_TYPE),
"application/ipp"))
{
* Not an IPP request...
*/
- return (respond_http(client, HTTP_BAD_REQUEST, NULL, 0));
+ return (respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, 0));
}
/*
* Return an error, since we only support IPP 1.x and 2.x.
*/
- respond_ipp(client, IPP_VERSION_NOT_SUPPORTED,
+ respond_ipp(client, IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED,
"Bad request version number %d.%d.", major, minor);
}
else if (ippGetRequestId(client->request) <= 0)
- respond_ipp(client, IPP_BAD_REQUEST, "Bad request-id %d.",
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Bad request-id %d.",
ippGetRequestId(client->request));
else if (!ippFirstAttribute(client->request))
- respond_ipp(client, IPP_BAD_REQUEST, "No attributes in request.");
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "No attributes in request.");
else
{
/*
* Out of order; return an error...
*/
- respond_ipp(client, IPP_BAD_REQUEST,
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST,
"Attribute groups are out of order (%x < %x).",
ippGetGroupTag(attr), group);
break;
* Bad character set...
*/
- respond_ipp(client, IPP_BAD_REQUEST,
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST,
"Unsupported character set \"%s\".",
ippGetString(charset, 0, NULL));
}
* for all operations.
*/
- respond_ipp(client, IPP_BAD_REQUEST, "Missing required attributes.");
+ respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Missing required attributes.");
}
else if (strcmp(ippGetString(uri, 0, NULL), client->printer->uri) &&
strncmp(ippGetString(uri, 0, NULL), client->printer->uri,
client->printer->urilen))
{
- respond_ipp(client, IPP_NOT_FOUND, "%s %s not found.", ippGetName(uri),
+ respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "%s %s not found.", ippGetName(uri),
ippGetString(uri, 0, NULL));
}
else
* Try processing the operation...
*/
- if (httpGetExpect(client->http) == HTTP_CONTINUE)
+ if (httpGetExpect(client->http) == HTTP_STATUS_CONTINUE)
{
/*
* Send 100-continue header...
*/
- if (!respond_http(client, HTTP_CONTINUE, NULL, 0))
+ if (!respond_http(client, HTTP_STATUS_CONTINUE, NULL, 0))
return (0);
}
switch (ippGetOperation(client->request))
{
- case IPP_PRINT_JOB :
+ case IPP_OP_PRINT_JOB :
ipp_print_job(client);
break;
- case IPP_PRINT_URI :
+ case IPP_OP_PRINT_URI :
ipp_print_uri(client);
break;
- case IPP_VALIDATE_JOB :
+ case IPP_OP_VALIDATE_JOB :
ipp_validate_job(client);
break;
- case IPP_CREATE_JOB :
+ case IPP_OP_CREATE_JOB :
ipp_create_job(client);
break;
- case IPP_SEND_DOCUMENT :
+ case IPP_OP_SEND_DOCUMENT :
ipp_send_document(client);
break;
- case IPP_SEND_URI :
+ case IPP_OP_SEND_URI :
ipp_send_uri(client);
break;
- case IPP_CANCEL_JOB :
+ case IPP_OP_CANCEL_JOB :
ipp_cancel_job(client);
break;
- case IPP_GET_JOB_ATTRIBUTES :
+ case IPP_OP_GET_JOB_ATTRIBUTES :
ipp_get_job_attributes(client);
break;
- case IPP_GET_JOBS :
+ case IPP_OP_GET_JOBS :
ipp_get_jobs(client);
break;
- case IPP_GET_PRINTER_ATTRIBUTES :
+ case IPP_OP_GET_PRINTER_ATTRIBUTES :
ipp_get_printer_attributes(client);
break;
default :
- respond_ipp(client, IPP_OPERATION_NOT_SUPPORTED,
+ respond_ipp(client, IPP_STATUS_ERROR_OPERATION_NOT_SUPPORTED,
"Operation not supported.");
break;
}
* Send the HTTP header and return...
*/
- if (httpGetState(client->http) != HTTP_POST_SEND)
+ if (httpGetState(client->http) != HTTP_STATE_POST_SEND)
httpFlush(client->http); /* Flush trailing (junk) data */
- return (respond_http(client, HTTP_OK, "application/ipp",
+ return (respond_http(client, HTTP_STATUS_OK, "application/ipp",
ippLength(client->response)));
}
static void * /* O - Thread exit status */
process_job(_ipp_job_t *job) /* I - Job */
{
- job->state = IPP_JOB_PROCESSING;
- job->printer->state = IPP_PRINTER_PROCESSING;
+ job->state = IPP_JSTATE_PROCESSING;
+ job->printer->state = IPP_PSTATE_PROCESSING;
sleep(5);
if (job->cancel)
- job->state = IPP_JOB_CANCELED;
+ job->state = IPP_JSTATE_CANCELED;
else
- job->state = IPP_JOB_COMPLETED;
+ job->state = IPP_JSTATE_COMPLETED;
job->completed = time(NULL);
- job->printer->state = IPP_PRINTER_IDLE;
+ job->printer->state = IPP_PSTATE_IDLE;
job->printer->active_job = NULL;
return (NULL);
httpClearFields(client->http);
- if (code == HTTP_METHOD_NOT_ALLOWED || client->operation == HTTP_OPTIONS)
+ if (code == HTTP_STATUS_METHOD_NOT_ALLOWED || client->operation == HTTP_STATE_OPTIONS)
httpSetField(client->http, HTTP_FIELD_ALLOW, "GET, HEAD, OPTIONS, POST");
if (type)
ipp_attribute_t *temp; /* Copy of attribute */
- respond_ipp(client, IPP_ATTRIBUTES, "Unsupported %s %s%s value.",
+ respond_ipp(client, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, "Unsupported %s %s%s value.",
ippGetName(attr), ippGetCount(attr) > 1 ? "1setOf " : "",
ippTagString(ippGetValueTag(attr)));
format = "application/octet-stream";
if (!strcmp(format, "application/octet-stream") &&
- (ippGetOperation(client->request) == IPP_PRINT_JOB ||
- ippGetOperation(client->request) == IPP_SEND_DOCUMENT))
+ (ippGetOperation(client->request) == IPP_OP_PRINT_JOB ||
+ ippGetOperation(client->request) == IPP_OP_SEND_DOCUMENT))
{
/*
* Auto-type the file using the first 4 bytes of the file...
ippSetString(client->request, &attr, 0, format);
}
- if (ippGetOperation(client->request) != IPP_CREATE_JOB &&
+ if (ippGetOperation(client->request) != IPP_OP_CREATE_JOB &&
(supported = ippFindAttribute(client->printer->attrs,
"document-format-supported",
IPP_TAG_MIMETYPE)) != NULL)
IPP_TAG_ZERO)) != NULL)
{
if (ippGetCount(attr) != 1 || ippGetValueTag(attr) != IPP_TAG_ENUM ||
- ippGetInteger(attr, 0) < IPP_PORTRAIT ||
- ippGetInteger(attr, 0) > IPP_REVERSE_PORTRAIT)
+ ippGetInteger(attr, 0) < IPP_ORIENT_PORTRAIT ||
+ ippGetInteger(attr, 0) > IPP_ORIENT_REVERSE_PORTRAIT)
{
respond_unsupported(client, attr);
valid = 0;