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

Function encode_options

cups/encode.c:851–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

849 */
850
851void
852encode_options(
853 ipp_t *ipp, /* I - IPP request/response */
854 int num_options, /* I - Number of options */
855 cups_option_t *options, /* I - Options */
856 ipp_tag_t group_tag, /* I - Group to encode */
857 int depth) /* I - Depth of options/collections */
858{
859 int i; /* Looping var */
860 cups_option_t *option; /* Current option */
861 ipp_op_t op = ippGetOperation(ipp);
862 /* Operation for this request */
863 const ipp_op_t *ops; /* List of allowed operations */
864
865
866 DEBUG_printf(("4encode_options(ipp=%p(%s), num_options=%d, options=%p, group_tag=%x, depth=%d)", (void *)ipp, ipp ? ippOpString(ippGetOperation(ipp)) : "", num_options, (void *)options, group_tag, depth));
867
868 /*
869 * Loop through the options...
870 */
871
872 for (i = num_options, option = options; i > 0; i --, option ++)
873 {
874 _ipp_option_t *match; /* Matching attribute */
875
876 /*
877 * Skip document format options that are handled in cupsEncodeOptions2...
878 */
879
880 if (!_cups_strcasecmp(option->name, "raw") || !_cups_strcasecmp(option->name, "document-format") || !option->name[0])
881 continue;
882
883 /*
884 * Figure out the proper value and group tags for this option...
885 */
886
887 if ((match = _ippFindOption(option->name)) != NULL)
888 {
889 if (match->group_tag != group_tag && match->alt_group_tag != group_tag)
890 continue;
891
892 if (match->operations)
893 ops = match->operations;
894 else if (group_tag == IPP_TAG_JOB)
895 ops = ipp_job_creation;
896 else if (group_tag == IPP_TAG_DOCUMENT)
897 ops = ipp_doc_creation;
898 else if (group_tag == IPP_TAG_SUBSCRIPTION)
899 ops = ipp_sub_creation;
900 else if (group_tag == IPP_TAG_PRINTER)
901 ops = ipp_set_printer;
902 else
903 {
904 DEBUG_printf(("5encode_options: Skipping \"%s\".", option->name));
905 continue;
906 }
907 }
908 else

Callers 2

_cupsEncodeOptionFunction · 0.85
cupsEncodeOptions2Function · 0.85

Calls 5

ippGetOperationFunction · 0.85
ippOpStringFunction · 0.85
_cups_strcasecmpFunction · 0.85
_ippFindOptionFunction · 0.85
_cupsEncodeOptionFunction · 0.85

Tested by

no test coverage detected