+ fputs("DEBUG: Adding standard IPP operation/job attributes.\n", stderr);
+
+ if (pc->password &&
+ (keyword = cupsGetOption("job-password", num_options,
+ options)) != NULL)
+ {
+ ippAddOctetString(request, IPP_TAG_OPERATION, "job-password",
+ keyword, strlen(keyword));
+
+ if ((keyword = cupsGetOption("job-password-encryption", num_options,
+ options)) == NULL)
+ keyword = "none";
+
+ ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+ "job-password-encryption", NULL, keyword);
+ }
+
+ if (pc->account_id &&
+ (keyword = cupsGetOption("job-account-id", num_options,
+ options)) != NULL)
+ ippAddString(request, IPP_TAG_JOB, IPP_TAG_NAME, "job-account-id",
+ NULL, keyword);
+
+ if (pc->account_id &&
+ (keyword = cupsGetOption("job-accounting-user-id", num_options,
+ options)) != NULL)
+ ippAddString(request, IPP_TAG_JOB, IPP_TAG_NAME,
+ "job-accounting-user-id", NULL, keyword);
+
+ for (mandatory = (char *)cupsArrayFirst(pc->mandatory);
+ mandatory;
+ mandatory = (char *)cupsArrayNext(pc->mandatory))
+ {
+ if (strcmp(mandatory, "copies") &&
+ strcmp(mandatory, "destination-uris") &&
+ strcmp(mandatory, "finishings") &&
+ strcmp(mandatory, "job-account-id") &&
+ strcmp(mandatory, "job-accounting-user-id") &&
+ strcmp(mandatory, "job-password") &&
+ strcmp(mandatory, "job-password-encryption") &&
+ strcmp(mandatory, "media") &&
+ strncmp(mandatory, "media-col", 9) &&
+ strcmp(mandatory, "multiple-document-handling") &&
+ strcmp(mandatory, "output-bin") &&
+ strcmp(mandatory, "print-color-mode") &&
+ strcmp(mandatory, "print-quality") &&
+ strcmp(mandatory, "sides") &&
+ (keyword = cupsGetOption(mandatory, num_options, options)) != NULL)
+ {
+ _ipp_option_t *opt = _ippFindOption(mandatory);
+ /* Option type */
+ ipp_tag_t value_tag = opt ? opt->value_tag : IPP_TAG_NAME;
+ /* Value type */
+
+ switch (value_tag)
+ {
+ case IPP_TAG_INTEGER :
+ case IPP_TAG_ENUM :
+ ippAddInteger(request, IPP_TAG_JOB, value_tag, mandatory,
+ atoi(keyword));
+ break;
+ case IPP_TAG_BOOLEAN :
+ ippAddBoolean(request, IPP_TAG_JOB, mandatory,
+ !_cups_strcasecmp(keyword, "true"));
+ break;
+ case IPP_TAG_RANGE :
+ {
+ int lower, upper; /* Range */
+
+ if (sscanf(keyword, "%d-%d", &lower, &upper) != 2)
+ lower = upper = atoi(keyword);
+
+ ippAddRange(request, IPP_TAG_JOB, mandatory, lower, upper);
+ }
+ break;
+ case IPP_TAG_STRING :
+ ippAddOctetString(request, IPP_TAG_JOB, mandatory, keyword,
+ strlen(keyword));
+ break;
+ default :
+ ippAddString(request, IPP_TAG_JOB, value_tag, mandatory,
+ NULL, keyword);
+ break;
+ }
+ }
+ }
+