static void process_state_message(ippeve_job_t *job, char *message);
static int register_printer(ippeve_printer_t *printer);
static int respond_http(ippeve_client_t *client, http_status_t code, const char *content_coding, const char *type, size_t length);
+static void respond_ignored(ippeve_client_t *client, ipp_attribute_t *attr);
static void respond_ipp(ippeve_client_t *client, ipp_status_t status, const char *message, ...) _CUPS_FORMAT(3, 4);
static void respond_unsupported(ippeve_client_t *client, ipp_attribute_t *attr);
static void run_printer(ippeve_printer_t *printer);
}
+/*
+ * 'respond_ignored()' - Respond with an ignored attribute.
+ */
+
+static void
+respond_ignored(
+ ippeve_client_t *client, /* I - Client */
+ ipp_attribute_t *attr) /* I - Attribute */
+{
+ ipp_attribute_t *temp; /* Copy of attribute */
+
+
+ if (!ippGetStatusCode(client->response))
+ respond_ipp(client, IPP_STATUS_OK_IGNORED_OR_SUBSTITUTED, "Unsupported %s %s%s value.", ippGetName(attr), ippGetCount(attr) > 1 ? "1setOf " : "", ippTagString(ippGetValueTag(attr)));
+
+ temp = ippCopyAttribute(client->response, attr, 0);
+ ippSetGroupTag(client->response, &temp, IPP_TAG_UNSUPPORTED_GROUP);
+}
+
+
/*
* 'respond_ipp()' - Send an IPP response.
*/
static void
respond_unsupported(
- ippeve_client_t *client, /* I - Client */
+ ippeve_client_t *client, /* I - Client */
ipp_attribute_t *attr) /* I - Attribute */
{
ipp_attribute_t *temp; /* Copy of attribute */
{
int i, /* Looping var */
count, /* Number of values */
+ fidelity, /* "ipp-attribute-fidelity" value */
valid = 1; /* Valid attributes? */
ipp_attribute_t *attr, /* Current attribute */
*supported; /* xxx-supported attribute */
* Check the various job template attributes...
*/
- if ((attr = ippFindAttribute(client->request, "copies", IPP_TAG_ZERO)) != NULL)
+ if ((attr = ippFindAttribute(client->request, "ipp-attribute-fidelity", IPP_TAG_ZERO)) != NULL)
{
- if (ippGetCount(attr) != 1 || ippGetValueTag(attr) != IPP_TAG_INTEGER ||
- ippGetInteger(attr, 0) < 1 || ippGetInteger(attr, 0) > 999)
+ if (ippGetCount(attr) != 1 || ippGetValueTag(attr) != IPP_TAG_BOOLEAN)
{
respond_unsupported(client, attr);
valid = 0;
}
}
- if ((attr = ippFindAttribute(client->request, "ipp-attribute-fidelity", IPP_TAG_ZERO)) != NULL)
+ fidelity = ippGetBoolean(attr, 0);
+
+ if ((attr = ippFindAttribute(client->request, "copies", IPP_TAG_ZERO)) != NULL)
{
- if (ippGetCount(attr) != 1 || ippGetValueTag(attr) != IPP_TAG_BOOLEAN)
+ if (ippGetCount(attr) != 1 || ippGetValueTag(attr) != IPP_TAG_INTEGER ||
+ ippGetInteger(attr, 0) < 1 || ippGetInteger(attr, 0) > 999)
{
- respond_unsupported(client, attr);
- valid = 0;
+ if (fidelity)
+ {
+ respond_unsupported(client, attr);
+ valid = 0;
+ }
+ else
+ {
+ respond_ignored(client, attr);
+ ippDeleteAttribute(client->request, attr);
+ }
}
}
ippSetGroupTag(client->request, &attr, IPP_TAG_JOB);
}
else
+ {
ippAddString(client->request, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL, "Untitled");
+ }
if ((attr = ippFindAttribute(client->request, "job-priority", IPP_TAG_ZERO)) != NULL)
{
if (!ippContainsString(supported, ippGetString(attr, 0, NULL)))
{
- respond_unsupported(client, attr);
- valid = 0;
+ if (fidelity)
+ {
+ respond_unsupported(client, attr);
+ valid = 0;
+ }
+ else
+ {
+ respond_ignored(client, attr);
+ ippDeleteAttribute(client->request, attr);
+ }
}
}
}
if (!ippContainsString(supported, ippGetString(member, 0, NULL)))
{
- respond_unsupported(client, attr);
- valid = 0;
+ if (fidelity)
+ {
+ respond_unsupported(client, attr);
+ valid = 0;
+ }
+ else
+ {
+ respond_ignored(client, attr);
+ ippDeleteAttribute(client->request, attr);
+ }
}
}
}
if (i >= count)
{
- respond_unsupported(client, attr);
- valid = 0;
+ if (fidelity)
+ {
+ respond_unsupported(client, attr);
+ valid = 0;
+ }
+ else
+ {
+ respond_ignored(client, attr);
+ ippDeleteAttribute(client->request, attr);
+ }
}
}
}
if (i >= count)
{
- respond_unsupported(client, attr);
- valid = 0;
+ if (fidelity)
+ {
+ respond_unsupported(client, attr);
+ valid = 0;
+ }
+ else
+ {
+ respond_ignored(client, attr);
+ ippDeleteAttribute(client->request, attr);
+ }
}
}
}
{
if (!ippContainsString(supported, sides))
{
- respond_unsupported(client, attr);
- valid = 0;
+ if (fidelity)
+ {
+ respond_unsupported(client, attr);
+ valid = 0;
+ }
+ else
+ {
+ respond_ignored(client, attr);
+ ippDeleteAttribute(client->request, attr);
+ }
}
}
else if (strcmp(sides, "one-sided"))
{
- respond_unsupported(client, attr);
- valid = 0;
+ if (fidelity)
+ {
+ respond_unsupported(client, attr);
+ valid = 0;
+ }
+ else
+ {
+ respond_ignored(client, attr);
+ ippDeleteAttribute(client->request, attr);
+ }
}
}