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

Function cupsEncodeOptions2

cups/encode.c:743–788  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

741 */
742
743void
744cupsEncodeOptions2(
745 ipp_t *ipp, /* I - IPP request/response */
746 int num_options, /* I - Number of options */
747 cups_option_t *options, /* I - Options */
748 ipp_tag_t group_tag) /* I - Group to encode */
749{
750 char *val; /* Pointer to option value */
751 ipp_op_t op; /* Operation for this request */
752
753
754 DEBUG_printf(("cupsEncodeOptions2(ipp=%p(%s), num_options=%d, options=%p, group_tag=%x)", (void *)ipp, ipp ? ippOpString(ippGetOperation(ipp)) : "", num_options, (void *)options, group_tag));
755
756 /*
757 * Range check input...
758 */
759
760 if (!ipp || num_options < 1 || !options)
761 return;
762
763 /*
764 * Do special handling for the document-format/raw options...
765 */
766
767 op = ippGetOperation(ipp);
768
769 if (group_tag == IPP_TAG_OPERATION && (op == IPP_OP_PRINT_JOB || op == IPP_OP_PRINT_URI || op == IPP_OP_SEND_DOCUMENT || op == IPP_OP_SEND_URI) && !ippFindAttribute(ipp, "document-format", IPP_TAG_ZERO))
770 {
771 /*
772 * Handle the document format stuff first...
773 */
774
775 if ((val = (char *)cupsGetOption("document-format", num_options, options)) != NULL)
776 ippAddString(ipp, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", NULL, val);
777 else if (cupsGetOption("raw", num_options, options))
778 ippAddString(ipp, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", NULL, "application/vnd.cups-raw");
779 else
780 ippAddString(ipp, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", NULL, "application/octet-stream");
781 }
782
783 /*
784 * Then encode the options...
785 */
786
787 encode_options(ipp, num_options, options, group_tag, /*depth*/0);
788}
789
790
791#ifdef DEBUG

Callers 10

apply_printer_defaultsFunction · 0.85
add_printer_defaultsFunction · 0.85
new_requestFunction · 0.85
set_printer_optionsFunction · 0.85
show_modelsFunction · 0.85
cupsCreateDestJobFunction · 0.85
cupsStartDestDocumentFunction · 0.85
cupsEncodeOptionsFunction · 0.85
cupsGetDevicesFunction · 0.85
mainFunction · 0.85

Calls 6

ippOpStringFunction · 0.85
ippGetOperationFunction · 0.85
ippFindAttributeFunction · 0.85
cupsGetOptionFunction · 0.85
ippAddStringFunction · 0.85
encode_optionsFunction · 0.85

Tested by 1

mainFunction · 0.68