| 741 | */ |
| 742 | |
| 743 | void |
| 744 | cupsEncodeOptions2( |
| 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 |