MCPcopy Create free account
hub / github.com/OpenPrinting/cups / valid_doc_attributes

Function valid_doc_attributes

tools/ippeveprinter.c:8497–8631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8495 */
8496
8497static int /* O - 1 if valid, 0 if not */
8498valid_doc_attributes(
8499 ippeve_client_t *client) /* I - Client */
8500{
8501 int valid = 1; /* Valid attributes? */
8502 ipp_op_t op = ippGetOperation(client->request);
8503 /* IPP operation */
8504 const char *op_name = ippOpString(op);
8505 /* IPP operation name */
8506 ipp_attribute_t *attr, /* Current attribute */
8507 *supported; /* xxx-supported attribute */
8508 const char *compression = NULL,
8509 /* compression value */
8510 *format = NULL; /* document-format value */
8511
8512
8513 /*
8514 * Check operation attributes...
8515 */
8516
8517 if ((attr = ippFindAttribute(client->request, "compression", IPP_TAG_ZERO)) != NULL)
8518 {
8519 /*
8520 * If compression is specified, only accept a supported value in a Print-Job
8521 * or Send-Document request...
8522 */
8523
8524 compression = ippGetString(attr, 0, NULL);
8525 supported = ippFindAttribute(client->printer->attrs,
8526 "compression-supported", IPP_TAG_KEYWORD);
8527
8528 if (ippGetCount(attr) != 1 || ippGetValueTag(attr) != IPP_TAG_KEYWORD ||
8529 ippGetGroupTag(attr) != IPP_TAG_OPERATION ||
8530 (op != IPP_OP_PRINT_JOB && op != IPP_OP_SEND_DOCUMENT &&
8531 op != IPP_OP_VALIDATE_JOB) ||
8532 !ippContainsString(supported, compression))
8533 {
8534 respond_unsupported(client, attr);
8535 valid = 0;
8536 }
8537 else
8538 {
8539 fprintf(stderr, "%s %s compression=\"%s\"\n", client->hostname, op_name, compression);
8540
8541 ippAddString(client->request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "compression-supplied", NULL, compression);
8542
8543 if (strcmp(compression, "none"))
8544 {
8545 if (Verbosity)
8546 fprintf(stderr, "Receiving job file with \"%s\" compression.\n", compression);
8547 httpSetField(client->http, HTTP_FIELD_CONTENT_ENCODING, compression);
8548 }
8549 }
8550 }
8551
8552 /*
8553 * Is it a format we support?
8554 */

Callers 3

ipp_send_documentFunction · 0.85
ipp_send_uriFunction · 0.85
valid_job_attributesFunction · 0.85

Calls 12

ippGetOperationFunction · 0.85
ippOpStringFunction · 0.85
ippFindAttributeFunction · 0.85
ippGetStringFunction · 0.85
ippGetCountFunction · 0.85
ippGetValueTagFunction · 0.85
ippGetGroupTagFunction · 0.85
ippContainsStringFunction · 0.85
respond_unsupportedFunction · 0.85
ippAddStringFunction · 0.85
httpSetFieldFunction · 0.85
httpPeekFunction · 0.85

Tested by

no test coverage detected