Lines Matching refs:client
256 static http_status_t authenticate_request(ippeve_client_t *client);
260 static void copy_job_attributes(ippeve_client_t *client, ippeve_job_t *job, cups_array_t *ra);
262 static ippeve_job_t *create_job(ippeve_client_t *client);
269 static void delete_client(ippeve_client_t *client);
280 static ippeve_job_t *find_job(ippeve_client_t *client);
281 static void finish_document_data(ippeve_client_t *client, ippeve_job_t *job);
282 static void finish_document_uri(ippeve_client_t *client, ippeve_job_t *job);
283 static void html_escape(ippeve_client_t *client, const char *s, size_t slen);
284 static void html_footer(ippeve_client_t *client);
285 static void html_header(ippeve_client_t *client, const char *title, int refresh);
286 static void html_printf(ippeve_client_t *client, const char *format, ...) _CUPS_FORMAT(2, 3);
287 static void ipp_cancel_job(ippeve_client_t *client);
288 static void ipp_close_job(ippeve_client_t *client);
289 static void ipp_create_job(ippeve_client_t *client);
290 static void ipp_get_job_attributes(ippeve_client_t *client);
291 static void ipp_get_jobs(ippeve_client_t *client);
292 static void ipp_get_printer_attributes(ippeve_client_t *client);
293 static void ipp_identify_printer(ippeve_client_t *client);
294 static void ipp_print_job(ippeve_client_t *client);
295 static void ipp_print_uri(ippeve_client_t *client);
296 static void ipp_send_document(ippeve_client_t *client);
297 static void ipp_send_uri(ippeve_client_t *client);
298 static void ipp_validate_job(ippeve_client_t *client);
307 static int parse_options(ippeve_client_t *client, cups_option_t **options);
309 static void *process_client(ippeve_client_t *client);
310 static int process_http(ippeve_client_t *client);
311 static int process_ipp(ippeve_client_t *client);
315 static int respond_http(ippeve_client_t *client, http_status_t code, const char *content_coding, c…
316 static void respond_ipp(ippeve_client_t *client, ipp_status_t status, const char *message, ...) _C…
317 static void respond_unsupported(ippeve_client_t *client, ipp_attribute_t *attr);
319 static int show_media(ippeve_client_t *client);
320 static int show_status(ippeve_client_t *client);
321 static int show_supplies(ippeve_client_t *client);
324 static int valid_doc_attributes(ippeve_client_t *client);
325 static int valid_job_attributes(ippeve_client_t *client);
738 ippeve_client_t *client) /* I - Client */ in authenticate_request() argument
760 authorization = httpGetField(client->http, HTTP_FIELD_AUTHORIZATION); in authenticate_request()
815 strlcpy(client->username, data.username, sizeof(client->username)); in authenticate_request()
901 ippeve_client_t *client, /* I - Client */ in copy_job_attributes() argument
905 copy_attributes(client->response, job->attrs, ra, IPP_TAG_JOB, 0); in copy_job_attributes()
910 …ippAddDate(client->response, IPP_TAG_JOB, "date-time-at-completed", ippTimeToDate(job->completed)); in copy_job_attributes()
912 ippAddOutOfBand(client->response, IPP_TAG_JOB, IPP_TAG_NOVALUE, "date-time-at-completed"); in copy_job_attributes()
918 …ippAddDate(client->response, IPP_TAG_JOB, "date-time-at-processing", ippTimeToDate(job->processing… in copy_job_attributes()
920 ippAddOutOfBand(client->response, IPP_TAG_JOB, IPP_TAG_NOVALUE, "date-time-at-processing"); in copy_job_attributes()
924 …ippAddInteger(client->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-impressions", job->impressions); in copy_job_attributes()
927 …ippAddInteger(client->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-impressions-completed", job->im… in copy_job_attributes()
930 …ippAddInteger(client->response, IPP_TAG_JOB, IPP_TAG_INTEGER, "job-printer-up-time", (int)(time(NU… in copy_job_attributes()
933 ippAddInteger(client->response, IPP_TAG_JOB, IPP_TAG_ENUM, "job-state", (int)job->state); in copy_job_attributes()
939 …ippAddString(client->response, IPP_TAG_JOB, IPP_TAG_TEXT, "job-state-message", NULL, job->message); in copy_job_attributes()
946 …ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL… in copy_job_attributes()
951 …ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL… in copy_job_attributes()
953 …ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL… in copy_job_attributes()
955 …ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL… in copy_job_attributes()
960 …ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL… in copy_job_attributes()
962 …ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL… in copy_job_attributes()
966 …ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL… in copy_job_attributes()
970 …ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL… in copy_job_attributes()
974 …ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL… in copy_job_attributes()
978 …ippAddString(client->response, IPP_TAG_JOB, IPP_CONST_TAG(IPP_TAG_TEXT), "job-state-message", NULL… in copy_job_attributes()
989 ippAddString(client->response, IPP_TAG_JOB, in copy_job_attributes()
996 ippAddString(client->response, IPP_TAG_JOB, in copy_job_attributes()
1000 ippAddString(client->response, IPP_TAG_JOB, in copy_job_attributes()
1004 ippAddString(client->response, IPP_TAG_JOB, in copy_job_attributes()
1011 ippAddString(client->response, IPP_TAG_JOB, in copy_job_attributes()
1015 ippAddString(client->response, IPP_TAG_JOB, in copy_job_attributes()
1021 ippAddString(client->response, IPP_TAG_JOB, in copy_job_attributes()
1027 ippAddString(client->response, IPP_TAG_JOB, in copy_job_attributes()
1033 ippAddString(client->response, IPP_TAG_JOB, in copy_job_attributes()
1039 ippAddString(client->response, IPP_TAG_JOB, in copy_job_attributes()
1047 ippAddInteger(client->response, IPP_TAG_JOB, in copy_job_attributes()
1049 "time-at-completed", (int)(job->completed - client->printer->start_time)); in copy_job_attributes()
1052 ippAddInteger(client->response, IPP_TAG_JOB, in copy_job_attributes()
1054 "time-at-processing", (int)(job->processing - client->printer->start_time)); in copy_job_attributes()
1067 ippeve_client_t *client; /* Client */ in create_client() local
1070 if ((client = calloc(1, sizeof(ippeve_client_t))) == NULL) in create_client()
1076 client->printer = printer; in create_client()
1082 if ((client->http = httpAcceptConnection(sock, 1)) == NULL) in create_client()
1086 free(client); in create_client()
1091 httpGetHostname(client->http, client->hostname, sizeof(client->hostname)); in create_client()
1094 fprintf(stderr, "Accepted connection from %s\n", client->hostname); in create_client()
1096 return (client); in create_client()
1106 create_job(ippeve_client_t *client) /* I - Client */ in create_job() argument
1114 _cupsRWLockWrite(&(client->printer->rwlock)); in create_job()
1115 if (client->printer->active_job && in create_job()
1116 client->printer->active_job->state < IPP_JSTATE_CANCELED) in create_job()
1122 _cupsRWUnlock(&(client->printer->rwlock)); in create_job()
1136 job->printer = client->printer; in create_job()
1145 copy_attributes(job->attrs, client->request, NULL, IPP_TAG_JOB, 0); in create_job()
1151 if ((attr = ippFindAttribute(client->request, "requesting-user-name", IPP_TAG_NAME)) != NULL) in create_job()
1158 if (ippGetOperation(client->request) != IPP_OP_CREATE_JOB) in create_job()
1168 if ((attr = ippFindAttribute(client->request, "job-impressions", IPP_TAG_INTEGER)) != NULL) in create_job()
1171 if ((attr = ippFindAttribute(client->request, "job-name", IPP_TAG_NAME)) != NULL) in create_job()
1178 job->id = client->printer->next_job_id ++; in create_job()
1180 snprintf(uri, sizeof(uri), "%s/%d", client->printer->uri, job->id); in create_job()
1181 …httpAssembleUUID(client->printer->hostname, client->printer->port, client->printer->name, job->id,… in create_job()
1187 if ((attr = ippFindAttribute(client->request, "printer-uri", IPP_TAG_URI)) != NULL) in create_job()
1190 … ippAddString(job->attrs, IPP_TAG_JOB, IPP_TAG_URI, "job-printer-uri", NULL, client->printer->uri); in create_job()
1191 …, IPP_TAG_JOB, IPP_TAG_INTEGER, "time-at-creation", (int)(job->created - client->printer->start_ti… in create_job()
1193 cupsArrayAdd(client->printer->jobs, job); in create_job()
1194 client->printer->active_job = job; in create_job()
1196 _cupsRWUnlock(&(client->printer->rwlock)); in create_job()
2013 delete_client(ippeve_client_t *client) /* I - Client */ in delete_client() argument
2016 fprintf(stderr, "Closing connection from %s\n", client->hostname); in delete_client()
2022 httpFlushWrite(client->http); in delete_client()
2028 httpClose(client->http); in delete_client()
2030 ippDelete(client->request); in delete_client()
2031 ippDelete(client->response); in delete_client()
2033 free(client); in delete_client()
2285 find_job(ippeve_client_t *client) /* I - Client */ in find_job() argument
2292 if ((attr = ippFindAttribute(client->request, "job-uri", IPP_TAG_URI)) != NULL) in find_job()
2296 if (!strncmp(uri, client->printer->uri, client->printer->urilen) && in find_job()
2297 uri[client->printer->urilen] == '/') in find_job()
2298 key.id = atoi(uri + client->printer->urilen + 1); in find_job()
2302 else if ((attr = ippFindAttribute(client->request, "job-id", IPP_TAG_INTEGER)) != NULL) in find_job()
2305 _cupsRWLockRead(&(client->printer->rwlock)); in find_job()
2306 job = (ippeve_job_t *)cupsArrayFind(client->printer->jobs, &key); in find_job()
2307 _cupsRWUnlock(&(client->printer->rwlock)); in find_job()
2319 ippeve_client_t *client, /* I - Client */ in finish_document_data() argument
2335 …if ((job->fd = create_job_file(job, filename, sizeof(filename), client->printer->directory, NULL))… in finish_document_data()
2337 …respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to create print file: %s", strerror(errno)); in finish_document_data()
2345 while ((bytes = httpRead2(client->http, buffer, sizeof(buffer))) > 0) in finish_document_data()
2356 … respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to write print file: %s", strerror(error)); in finish_document_data()
2373 respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to read print file."); in finish_document_data()
2386 … respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to write print file: %s", strerror(error)); in finish_document_data()
2407 respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to process job."); in finish_document_data()
2415 respond_ipp(client, IPP_STATUS_OK, NULL); in finish_document_data()
2424 copy_job_attributes(client, job, ra); in finish_document_data()
2443 copy_job_attributes(client, job, ra); in finish_document_data()
2454 ippeve_client_t *client, /* I - Client */ in finish_document_uri() argument
2479 if (httpGetState(client->http) == HTTP_STATE_POST_RECV) in finish_document_uri()
2481 … respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Unexpected document data following request."); in finish_document_uri()
2490 if ((uri = ippFindAttribute(client->request, "document-uri", IPP_TAG_URI)) == NULL) in finish_document_uri()
2492 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Missing document-uri."); in finish_document_uri()
2499 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Too many document-uri values."); in finish_document_uri()
2510 …respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Bad document-uri: %s", httpURIStatusString(uri_… in finish_document_uri()
2521 respond_ipp(client, IPP_STATUS_ERROR_URI_SCHEME, "URI scheme \"%s\" not supported.", scheme); in finish_document_uri()
2528 …respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to access URI: %s", strerror(errno)); in finish_document_uri()
2537 _cupsRWLockWrite(&(client->printer->rwlock)); in finish_document_uri()
2548 …if ((job->fd = create_job_file(job, filename, sizeof(filename), client->printer->directory, NULL))… in finish_document_uri()
2550 _cupsRWUnlock(&(client->printer->rwlock)); in finish_document_uri()
2552 …respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to create print file: %s", strerror(errno)); in finish_document_uri()
2557 _cupsRWUnlock(&(client->printer->rwlock)); in finish_document_uri()
2563 …respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to access URI: %s", strerror(errno)); in finish_document_uri()
2585 respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to write print file: %s", strerror(error)); in finish_document_uri()
2605 …respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to connect to %s: %s", hostname, cup… in finish_document_uri()
2619 … respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to GET URI: %s", strerror(errno)); in finish_document_uri()
2634 …respond_ipp(client, IPP_STATUS_ERROR_DOCUMENT_ACCESS, "Unable to GET URI: %s", httpStatus(status)); in finish_document_uri()
2657 respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, in finish_document_uri()
2675 … respond_ipp(client, IPP_STATUS_ERROR_INTERNAL, "Unable to write print file: %s", strerror(error)); in finish_document_uri()
2680 _cupsRWLockWrite(&(client->printer->rwlock)); in finish_document_uri()
2686 _cupsRWUnlock(&(client->printer->rwlock)); in finish_document_uri()
2698 respond_ipp(client, IPP_STATUS_OK, NULL); in finish_document_uri()
2706 copy_job_attributes(client, job, ra); in finish_document_uri()
2725 copy_job_attributes(client, job, ra); in finish_document_uri()
2735 html_escape(ippeve_client_t *client, /* I - Client */ in html_escape() argument
2751 httpWrite2(client->http, start, (size_t)(s - start)); in html_escape()
2754 httpWrite2(client->http, "&", 5); in html_escape()
2756 httpWrite2(client->http, "<", 4); in html_escape()
2765 httpWrite2(client->http, start, (size_t)(s - start)); in html_escape()
2776 html_footer(ippeve_client_t *client) /* I - Client */ in html_footer() argument
2778 html_printf(client, in html_footer()
2782 httpWrite2(client->http, "", 0); in html_footer()
2791 html_header(ippeve_client_t *client, /* I - Client */ in html_header() argument
2795 html_printf(client, in html_header()
2804 html_printf(client, "<meta http-equiv=\"refresh\" content=\"%d\">\n", refresh); in html_header()
2805 html_printf(client, in html_header()
2836 …class=\"body\">\n", !strcmp(client->uri, "/") ? " sel" : "", !strcmp(client->uri, "/supplies") ? "… in html_header()
2845 html_printf(ippeve_client_t *client, /* I - Client */ in html_printf() argument
2873 httpWrite2(client->http, start, (size_t)(format - start)); in html_printf()
2880 httpWrite2(client->http, "%", 1); in html_printf()
2994 httpWrite2(client->http, temp, strlen(temp)); in html_printf()
3018 httpWrite2(client->http, temp, strlen(temp)); in html_printf()
3027 httpWrite2(client->http, temp, strlen(temp)); in html_printf()
3035 html_escape(client, temp, 1); in html_printf()
3038 html_escape(client, va_arg(ap, char *), (size_t)width); in html_printf()
3045 html_escape(client, s, strlen(s)); in html_printf()
3054 httpWrite2(client->http, start, (size_t)(format - start)); in html_printf()
3065 ipp_cancel_job(ippeve_client_t *client) /* I - Client */ in ipp_cancel_job() argument
3074 if ((job = find_job(client)) == NULL) in ipp_cancel_job()
3076 respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "Job does not exist."); in ipp_cancel_job()
3088 respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, in ipp_cancel_job()
3093 respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, in ipp_cancel_job()
3098 respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, in ipp_cancel_job()
3107 _cupsRWLockWrite(&(client->printer->rwlock)); in ipp_cancel_job()
3118 _cupsRWUnlock(&(client->printer->rwlock)); in ipp_cancel_job()
3120 respond_ipp(client, IPP_STATUS_OK, NULL); in ipp_cancel_job()
3131 ipp_close_job(ippeve_client_t *client) /* I - Client */ in ipp_close_job() argument
3140 if ((job = find_job(client)) == NULL) in ipp_close_job()
3142 respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "Job does not exist."); in ipp_close_job()
3154 respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, in ipp_close_job()
3159 respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, in ipp_close_job()
3164 respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, in ipp_close_job()
3170 respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, in ipp_close_job()
3175 respond_ipp(client, IPP_STATUS_OK, NULL); in ipp_close_job()
3186 ipp_create_job(ippeve_client_t *client) /* I - Client */ in ipp_create_job() argument
3196 if (!valid_job_attributes(client)) in ipp_create_job()
3198 httpFlush(client->http); in ipp_create_job()
3206 if (httpGetState(client->http) == HTTP_STATE_POST_RECV) in ipp_create_job()
3208 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, in ipp_create_job()
3217 if ((job = create_job(client)) == NULL) in ipp_create_job()
3219 respond_ipp(client, IPP_STATUS_ERROR_BUSY, in ipp_create_job()
3228 respond_ipp(client, IPP_STATUS_OK, NULL); in ipp_create_job()
3237 copy_job_attributes(client, job, ra); in ipp_create_job()
3248 ippeve_client_t *client) /* I - Client */ in ipp_get_job_attributes() argument
3254 if ((job = find_job(client)) == NULL) in ipp_get_job_attributes()
3256 respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "Job not found."); in ipp_get_job_attributes()
3260 respond_ipp(client, IPP_STATUS_OK, NULL); in ipp_get_job_attributes()
3262 ra = ippCreateRequestedArray(client->request); in ipp_get_job_attributes()
3263 copy_job_attributes(client, job, ra); in ipp_get_job_attributes()
3273 ipp_get_jobs(ippeve_client_t *client) /* I - Client */ in ipp_get_jobs() argument
3292 if ((attr = ippFindAttribute(client->request, "which-jobs", in ipp_get_jobs()
3296 fprintf(stderr, "%s Get-Jobs which-jobs=%s", client->hostname, which_jobs); in ipp_get_jobs()
3346 respond_ipp(client, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, in ipp_get_jobs()
3348 ippAddString(client->response, IPP_TAG_UNSUPPORTED_GROUP, IPP_TAG_KEYWORD, in ipp_get_jobs()
3357 if ((attr = ippFindAttribute(client->request, "limit", in ipp_get_jobs()
3362 fprintf(stderr, "%s Get-Jobs limit=%d", client->hostname, limit); in ipp_get_jobs()
3367 if ((attr = ippFindAttribute(client->request, "first-job-id", in ipp_get_jobs()
3372 fprintf(stderr, "%s Get-Jobs first-job-id=%d", client->hostname, first_job_id); in ipp_get_jobs()
3383 if ((attr = ippFindAttribute(client->request, "my-jobs", in ipp_get_jobs()
3388 fprintf(stderr, "%s Get-Jobs my-jobs=%s\n", client->hostname, my_jobs ? "true" : "false"); in ipp_get_jobs()
3392 if ((attr = ippFindAttribute(client->request, "requesting-user-name", in ipp_get_jobs()
3395 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, in ipp_get_jobs()
3402 fprintf(stderr, "%s Get-Jobs requesting-user-name=\"%s\"\n", client->hostname, username); in ipp_get_jobs()
3410 ra = ippCreateRequestedArray(client->request); in ipp_get_jobs()
3412 respond_ipp(client, IPP_STATUS_OK, NULL); in ipp_get_jobs()
3414 _cupsRWLockRead(&(client->printer->rwlock)); in ipp_get_jobs()
3416 for (count = 0, job = (ippeve_job_t *)cupsArrayFirst(client->printer->jobs); in ipp_get_jobs()
3418 job = (ippeve_job_t *)cupsArrayNext(client->printer->jobs)) in ipp_get_jobs()
3433 ippAddSeparator(client->response); in ipp_get_jobs()
3436 copy_job_attributes(client, job, ra); in ipp_get_jobs()
3441 _cupsRWUnlock(&(client->printer->rwlock)); in ipp_get_jobs()
3451 ippeve_client_t *client) /* I - Client */ in ipp_get_printer_attributes() argument
3461 ra = ippCreateRequestedArray(client->request); in ipp_get_printer_attributes()
3462 printer = client->printer; in ipp_get_printer_attributes()
3464 respond_ipp(client, IPP_STATUS_OK, NULL); in ipp_get_printer_attributes()
3468 copy_attributes(client->response, printer->attrs, ra, IPP_TAG_ZERO, in ipp_get_printer_attributes()
3472 …ippAddDate(client->response, IPP_TAG_PRINTER, "printer-config-change-date-time", ippTimeToDate(pri… in ipp_get_printer_attributes()
3475 …ippAddInteger(client->response, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "printer-config-change-time", (i… in ipp_get_printer_attributes()
3478 … ippAddDate(client->response, IPP_TAG_PRINTER, "printer-current-time", ippTimeToDate(time(NULL))); in ipp_get_printer_attributes()
3482 …ippAddInteger(client->response, IPP_TAG_PRINTER, IPP_TAG_ENUM, "printer-state", (int)printer->stat… in ipp_get_printer_attributes()
3485 …ippAddDate(client->response, IPP_TAG_PRINTER, "printer-state-change-date-time", ippTimeToDate(prin… in ipp_get_printer_attributes()
3488 …ippAddInteger(client->response, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "printer-state-change-time", (in… in ipp_get_printer_attributes()
3494 …ippAddString(client->response, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_TEXT), "printer-state-messag… in ipp_get_printer_attributes()
3501 …ippAddString(client->response, IPP_TAG_PRINTER, IPP_CONST_TAG(IPP_TAG_KEYWORD), "printer-state-rea… in ipp_get_printer_attributes()
3516 ippSetString(client->response, &attr, ippGetCount(attr), reason); in ipp_get_printer_attributes()
3518 …attr = ippAddString(client->response, IPP_TAG_PRINTER, IPP_TAG_KEYWORD, "printer-state-reasons", N… in ipp_get_printer_attributes()
3525 …ippAddInteger(client->response, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "printer-up-time", (int)(time(NU… in ipp_get_printer_attributes()
3528 …ippAddInteger(client->response, IPP_TAG_PRINTER, IPP_TAG_INTEGER, "queued-job-count", printer->act… in ipp_get_printer_attributes()
3542 ippeve_client_t *client) /* I - Client */ in ipp_identify_printer() argument
3548 actions = ippFindAttribute(client->request, "identify-actions", IPP_TAG_KEYWORD); in ipp_identify_printer()
3549 message = ippFindAttribute(client->request, "message", IPP_TAG_TEXT); in ipp_identify_printer()
3558 …printf("IDENTIFY from %s: %s\n", client->hostname, message ? ippGetString(message, 0, NULL) : "No … in ipp_identify_printer()
3560 respond_ipp(client, IPP_STATUS_OK, NULL); in ipp_identify_printer()
3569 ipp_print_job(ippeve_client_t *client) /* I - Client */ in ipp_print_job() argument
3578 if (!valid_job_attributes(client)) in ipp_print_job()
3580 httpFlush(client->http); in ipp_print_job()
3588 if (httpGetState(client->http) == HTTP_STATE_POST_SEND) in ipp_print_job()
3590 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "No file in request."); in ipp_print_job()
3598 if ((job = create_job(client)) == NULL) in ipp_print_job()
3600 respond_ipp(client, IPP_STATUS_ERROR_BUSY, "Currently printing another job."); in ipp_print_job()
3608 finish_document_data(client, job); in ipp_print_job()
3617 ipp_print_uri(ippeve_client_t *client) /* I - Client */ in ipp_print_uri() argument
3626 if (!valid_job_attributes(client)) in ipp_print_uri()
3628 httpFlush(client->http); in ipp_print_uri()
3636 if ((job = create_job(client)) == NULL) in ipp_print_uri()
3638 respond_ipp(client, IPP_STATUS_ERROR_BUSY, "Currently printing another job."); in ipp_print_uri()
3646 finish_document_uri(client, job); in ipp_print_uri()
3657 ippeve_client_t *client) /* I - Client */ in ipp_send_document() argument
3667 if ((job = find_job(client)) == NULL) in ipp_send_document()
3669 respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "Job does not exist."); in ipp_send_document()
3670 httpFlush(client->http); in ipp_send_document()
3681 respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, "Job is not in a pending state."); in ipp_send_document()
3682 httpFlush(client->http); in ipp_send_document()
3687 …respond_ipp(client, IPP_STATUS_ERROR_MULTIPLE_JOBS_NOT_SUPPORTED, "Multiple document jobs are not … in ipp_send_document()
3688 httpFlush(client->http); in ipp_send_document()
3696 if ((attr = ippFindAttribute(client->request, "last-document", IPP_TAG_ZERO)) == NULL) in ipp_send_document()
3698 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Missing required last-document attribute."); in ipp_send_document()
3699 httpFlush(client->http); in ipp_send_document()
3704 …respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "The last-document attribute is not in the opera… in ipp_send_document()
3705 httpFlush(client->http); in ipp_send_document()
3710 respond_unsupported(client, attr); in ipp_send_document()
3711 httpFlush(client->http); in ipp_send_document()
3719 if (!valid_doc_attributes(client)) in ipp_send_document()
3721 httpFlush(client->http); in ipp_send_document()
3729 _cupsRWLockWrite(&(client->printer->rwlock)); in ipp_send_document()
3731 copy_attributes(job->attrs, client->request, NULL, IPP_TAG_JOB, 0); in ipp_send_document()
3740 _cupsRWUnlock(&(client->printer->rwlock)); in ipp_send_document()
3742 finish_document_data(client, job); in ipp_send_document()
3752 ipp_send_uri(ippeve_client_t *client) /* I - Client */ in ipp_send_uri() argument
3762 if ((job = find_job(client)) == NULL) in ipp_send_uri()
3764 respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "Job does not exist."); in ipp_send_uri()
3765 httpFlush(client->http); in ipp_send_uri()
3776 respond_ipp(client, IPP_STATUS_ERROR_NOT_POSSIBLE, "Job is not in a pending state."); in ipp_send_uri()
3777 httpFlush(client->http); in ipp_send_uri()
3782 …respond_ipp(client, IPP_STATUS_ERROR_MULTIPLE_JOBS_NOT_SUPPORTED, "Multiple document jobs are not … in ipp_send_uri()
3783 httpFlush(client->http); in ipp_send_uri()
3787 if ((attr = ippFindAttribute(client->request, "last-document", IPP_TAG_ZERO)) == NULL) in ipp_send_uri()
3789 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Missing required last-document attribute."); in ipp_send_uri()
3790 httpFlush(client->http); in ipp_send_uri()
3795 …respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "The last-document attribute is not in the opera… in ipp_send_uri()
3796 httpFlush(client->http); in ipp_send_uri()
3801 respond_unsupported(client, attr); in ipp_send_uri()
3802 httpFlush(client->http); in ipp_send_uri()
3810 if (!valid_doc_attributes(client)) in ipp_send_uri()
3812 httpFlush(client->http); in ipp_send_uri()
3820 _cupsRWLockWrite(&(client->printer->rwlock)); in ipp_send_uri()
3822 copy_attributes(job->attrs, client->request, NULL, IPP_TAG_JOB, 0); in ipp_send_uri()
3831 _cupsRWUnlock(&(client->printer->rwlock)); in ipp_send_uri()
3833 finish_document_uri(client, job); in ipp_send_uri()
3842 ipp_validate_job(ippeve_client_t *client) /* I - Client */ in ipp_validate_job() argument
3844 if (valid_job_attributes(client)) in ipp_validate_job()
3845 respond_ipp(client, IPP_STATUS_OK, NULL); in ipp_validate_job()
5456 parse_options(ippeve_client_t *client, /* I - Client */ in parse_options() argument
5467 for (name = client->options; name && *name; name = next) in parse_options()
5561 process_client(ippeve_client_t *client) /* I - Client */ in process_client() argument
5571 while (httpWait(client->http, 30000)) in process_client()
5582 …if (recv(httpGetFd(client->http), buf, 1, MSG_PEEK) == 1 && (!buf[0] || !strchr("DGHOPT", buf[0]))) in process_client()
5584 fprintf(stderr, "%s Starting HTTPS session.\n", client->hostname); in process_client()
5586 if (httpEncryption(client->http, HTTP_ENCRYPTION_ALWAYS)) in process_client()
5588 … fprintf(stderr, "%s Unable to encrypt connection: %s\n", client->hostname, cupsLastErrorString()); in process_client()
5592 fprintf(stderr, "%s Connection now encrypted.\n", client->hostname); in process_client()
5599 if (!process_http(client)) in process_client()
5607 delete_client(client); in process_client()
5618 process_http(ippeve_client_t *client) /* I - Client connection */ in process_http() argument
5654 client->username[0] = '\0'; in process_http()
5656 ippDelete(client->request); in process_http()
5657 ippDelete(client->response); in process_http()
5659 client->request = NULL; in process_http()
5660 client->response = NULL; in process_http()
5661 client->operation = HTTP_STATE_WAITING; in process_http()
5667 while ((http_state = httpReadRequest(client->http, uri, in process_http()
5677 if (httpError(client->http) == EPIPE) in process_http()
5678 fprintf(stderr, "%s Client closed connection.\n", client->hostname); in process_http()
5680 …fprintf(stderr, "%s Bad request line (%s).\n", client->hostname, strerror(httpError(client->http))… in process_http()
5686 fprintf(stderr, "%s Bad/unknown operation.\n", client->hostname); in process_http()
5687 respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0); in process_http()
5692 fprintf(stderr, "%s Bad HTTP version.\n", client->hostname); in process_http()
5693 respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0); in process_http()
5697 fprintf(stderr, "%s %s %s\n", client->hostname, http_states[http_state], uri); in process_http()
5706 client->uri, sizeof(client->uri)) < HTTP_URI_STATUS_OK && in process_http()
5709 fprintf(stderr, "%s Bad URI \"%s\".\n", client->hostname, uri); in process_http()
5710 respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0); in process_http()
5714 if ((client->options = strchr(client->uri, '?')) != NULL) in process_http()
5715 *(client->options)++ = '\0'; in process_http()
5721 client->start = time(NULL); in process_http()
5722 client->operation = httpGetState(client->http); in process_http()
5728 while ((http_status = httpUpdate(client->http)) == HTTP_STATUS_CONTINUE); in process_http()
5732 respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0); in process_http()
5736 if (!httpGetField(client->http, HTTP_FIELD_HOST)[0] && in process_http()
5737 httpGetVersion(client->http) >= HTTP_VERSION_1_1) in process_http()
5743 respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0); in process_http()
5751 if (!strcasecmp(httpGetField(client->http, HTTP_FIELD_CONNECTION), "Upgrade")) in process_http()
5754 …if (strstr(httpGetField(client->http, HTTP_FIELD_UPGRADE), "TLS/") != NULL && !httpIsEncrypted(cli… in process_http()
5756 if (!respond_http(client, HTTP_STATUS_SWITCHING_PROTOCOLS, NULL, NULL, 0)) in process_http()
5759 fprintf(stderr, "%s Upgrading to encrypted connection.\n", client->hostname); in process_http()
5761 if (httpEncryption(client->http, HTTP_ENCRYPTION_REQUIRED)) in process_http()
5763 … fprintf(stderr, "%s Unable to encrypt connection: %s\n", client->hostname, cupsLastErrorString()); in process_http()
5767 fprintf(stderr, "%s Connection now encrypted.\n", client->hostname); in process_http()
5772 if (!respond_http(client, HTTP_STATUS_NOT_IMPLEMENTED, NULL, NULL, 0)) in process_http()
5780 switch (client->operation) in process_http()
5787 return (respond_http(client, HTTP_STATUS_OK, NULL, NULL, 0)); in process_http()
5790 if (!strcmp(client->uri, "/icon.png")) in process_http()
5791 return (respond_http(client, HTTP_STATUS_OK, NULL, "image/png", 0)); in process_http()
5792 …else if (!strcmp(client->uri, "/") || !strcmp(client->uri, "/media") || !strcmp(client->uri, "/sup… in process_http()
5793 return (respond_http(client, HTTP_STATUS_OK, NULL, "text/html", 0)); in process_http()
5795 return (respond_http(client, HTTP_STATUS_NOT_FOUND, NULL, NULL, 0)); in process_http()
5798 if (!strcmp(client->uri, "/icon.png")) in process_http()
5804 if (client->printer->icon) in process_http()
5811 fprintf(stderr, "Icon file is \"%s\".\n", client->printer->icon); in process_http()
5813 … if (!stat(client->printer->icon, &fileinfo) && (fd = open(client->printer->icon, O_RDONLY)) >= 0) in process_http()
5815 if (!respond_http(client, HTTP_STATUS_OK, NULL, "image/png", (size_t)fileinfo.st_size)) in process_http()
5822 httpWrite2(client->http, buffer, (size_t)bytes); in process_http()
5824 httpFlushWrite(client->http); in process_http()
5829 return (respond_http(client, HTTP_STATUS_NOT_FOUND, NULL, NULL, 0)); in process_http()
5835 if (!respond_http(client, HTTP_STATUS_OK, NULL, "image/png", sizeof(printer_png))) in process_http()
5838 httpWrite2(client->http, (const char *)printer_png, sizeof(printer_png)); in process_http()
5839 httpFlushWrite(client->http); in process_http()
5848 if ((http_status = authenticate_request(client)) != HTTP_STATUS_CONTINUE) in process_http()
5850 return (respond_http(client, http_status, NULL, NULL, 0)); in process_http()
5853 if (!strcmp(client->uri, "/")) in process_http()
5859 return (show_status(client)); in process_http()
5861 else if (!strcmp(client->uri, "/media")) in process_http()
5867 return (show_media(client)); in process_http()
5869 else if (!strcmp(client->uri, "/supplies")) in process_http()
5875 return (show_supplies(client)); in process_http()
5878 return (respond_http(client, HTTP_STATUS_NOT_FOUND, NULL, NULL, 0)); in process_http()
5883 if (strcmp(httpGetField(client->http, HTTP_FIELD_CONTENT_TYPE), in process_http()
5890 return (respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0)); in process_http()
5897 client->request = ippNew(); in process_http()
5899 while ((ipp_state = ippRead(client->http, in process_http()
5900 client->request)) != IPP_STATE_DATA) in process_http()
5904 fprintf(stderr, "%s IPP read error (%s).\n", client->hostname, cupsLastErrorString()); in process_http()
5905 respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0); in process_http()
5914 return (process_ipp(client)); in process_http()
5929 process_ipp(ippeve_client_t *client) /* I - Client */ in process_ipp() argument
5941 debug_attributes("Request", client->request, 1); in process_ipp()
5947 client->operation_id = ippGetOperation(client->request); in process_ipp()
5948 client->response = ippNewResponse(client->request); in process_ipp()
5954 major = ippGetVersion(client->request, &minor); in process_ipp()
5962 …respond_ipp(client, IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED, "Bad request version number %d.%d.", m… in process_ipp()
5966 if (httpGetState(client->http) != HTTP_STATE_POST_SEND) in process_ipp()
5967 httpFlush(client->http); /* Flush trailing (junk) data */ in process_ipp()
5969 respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0); in process_ipp()
5972 else if (ippGetRequestId(client->request) <= 0) in process_ipp()
5974 …respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Bad request-id %d.", ippGetRequestId(client->re… in process_ipp()
5976 else if (!ippFirstAttribute(client->request)) in process_ipp()
5978 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "No attributes in request."); in process_ipp()
5987 for (attr = ippFirstAttribute(client->request), in process_ipp()
5990 attr = ippNextAttribute(client->request)) in process_ipp()
5998 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, in process_ipp()
6017 attr = ippFirstAttribute(client->request); in process_ipp()
6025 attr = ippNextAttribute(client->request); in process_ipp()
6034 if ((attr = ippFindAttribute(client->request, "printer-uri", in process_ipp()
6037 else if ((attr = ippFindAttribute(client->request, "job-uri", in process_ipp()
6051 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, in process_ipp()
6063 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, in process_ipp()
6081 respond_ipp(client, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, in process_ipp()
6087 respond_ipp(client, IPP_STATUS_ERROR_NOT_FOUND, "%s %s not found.", in process_ipp()
6089 …else if (client->operation_id != IPP_OP_GET_PRINTER_ATTRIBUTES && (status = authenticate_request(c… in process_ipp()
6091 httpFlush(client->http); in process_ipp()
6093 return (respond_http(client, status, NULL, NULL, 0)); in process_ipp()
6101 if (httpGetExpect(client->http)) in process_ipp()
6103 if (httpGetExpect(client->http) == HTTP_STATUS_CONTINUE) in process_ipp()
6109 if (!respond_http(client, HTTP_STATUS_CONTINUE, NULL, NULL, 0)) in process_ipp()
6118 if (!respond_http(client, HTTP_STATUS_EXPECTATION_FAILED, NULL, NULL, 0)) in process_ipp()
6121 httpFlush(client->http); in process_ipp()
6130 switch (client->operation_id) in process_ipp()
6133 ipp_print_job(client); in process_ipp()
6137 ipp_print_uri(client); in process_ipp()
6141 ipp_validate_job(client); in process_ipp()
6145 ipp_create_job(client); in process_ipp()
6149 ipp_send_document(client); in process_ipp()
6153 ipp_send_uri(client); in process_ipp()
6157 ipp_cancel_job(client); in process_ipp()
6161 ipp_get_job_attributes(client); in process_ipp()
6165 ipp_get_jobs(client); in process_ipp()
6169 ipp_get_printer_attributes(client); in process_ipp()
6173 ipp_close_job(client); in process_ipp()
6177 ipp_identify_printer(client); in process_ipp()
6181 respond_ipp(client, IPP_STATUS_ERROR_OPERATION_NOT_SUPPORTED, in process_ipp()
6194 if (httpGetState(client->http) != HTTP_STATE_POST_SEND) in process_ipp()
6195 httpFlush(client->http); /* Flush trailing (junk) data */ in process_ipp()
6197 return (respond_http(client, HTTP_STATUS_OK, NULL, "application/ipp", in process_ipp()
6198 ippLength(client->response))); in process_ipp()
7031 ippeve_client_t *client, /* I - Client */ in respond_http() argument
7040 fprintf(stderr, "%s %s\n", client->hostname, httpStatus(code)); in respond_http()
7048 return (httpWriteResponse(client->http, HTTP_STATUS_CONTINUE) == 0); in respond_http()
7069 httpClearFields(client->http); in respond_http()
7072 client->operation == HTTP_STATE_OPTIONS) in respond_http()
7073 httpSetField(client->http, HTTP_FIELD_ALLOW, "GET, HEAD, OPTIONS, POST"); in respond_http()
7080 httpSetField(client->http, HTTP_FIELD_WWW_AUTHENTICATE, value); in respond_http()
7086 httpSetField(client->http, HTTP_FIELD_CONTENT_TYPE, in respond_http()
7089 httpSetField(client->http, HTTP_FIELD_CONTENT_TYPE, type); in respond_http()
7092 httpSetField(client->http, HTTP_FIELD_CONTENT_ENCODING, content_encoding); in respond_http()
7095 httpSetLength(client->http, length); in respond_http()
7097 if (httpWriteResponse(client->http, code) < 0) in respond_http()
7110 if (httpPrintf(client->http, "%s", message) < 0) in respond_http()
7113 if (httpWrite2(client->http, "", 0) < 0) in respond_http()
7116 else if (client->response) in respond_http()
7122 debug_attributes("Response", client->response, 2); in respond_http()
7124 ippSetState(client->response, IPP_STATE_IDLE); in respond_http()
7126 if (ippWrite(client->http, client->response) != IPP_STATE_DATA) in respond_http()
7139 respond_ipp(ippeve_client_t *client, /* I - Client */ in respond_ipp() argument
7147 ippSetStatusCode(client->response, status); in respond_ipp()
7155 if ((attr = ippFindAttribute(client->response, "status-message", IPP_TAG_TEXT)) != NULL) in respond_ipp()
7156 ippSetStringfv(client->response, &attr, 0, message, ap); in respond_ipp()
7158 …attr = ippAddStringfv(client->response, IPP_TAG_OPERATION, IPP_TAG_TEXT, "status-message", NULL, m… in respond_ipp()
7165 …fprintf(stderr, "%s %s %s (%s)\n", client->hostname, ippOpString(client->operation_id), ippErrorSt… in respond_ipp()
7167 …fprintf(stderr, "%s %s %s\n", client->hostname, ippOpString(client->operation_id), ippErrorString(… in respond_ipp()
7177 ippeve_client_t *client, /* I - Client */ in respond_unsupported() argument
7183 …respond_ipp(client, IPP_STATUS_ERROR_ATTRIBUTES_OR_VALUES, "Unsupported %s %s%s value.", ippGetNam… in respond_unsupported()
7185 temp = ippCopyAttribute(client->response, attr, 0); in respond_unsupported()
7186 ippSetGroupTag(client->response, &temp, IPP_TAG_UNSUPPORTED_GROUP); in respond_unsupported()
7200 ippeve_client_t *client; /* New client */ in run_printer() local
7239 if ((client = create_client(printer, printer->ipv4)) != NULL) in run_printer()
7241 _cups_thread_t t = _cupsThreadCreate((_cups_thread_func_t)process_client, client); in run_printer()
7250 delete_client(client); in run_printer()
7257 if ((client = create_client(printer, printer->ipv6)) != NULL) in run_printer()
7259 _cups_thread_t t = _cupsThreadCreate((_cups_thread_func_t)process_client, client); in run_printer()
7268 delete_client(client); in run_printer()
7292 show_media(ippeve_client_t *client) /* I - Client connection */ in show_media() argument
7294 ippeve_printer_t *printer = client->printer; in show_media()
7333 if (!respond_http(client, HTTP_STATUS_OK, NULL, "text/html", 0)) in show_media()
7336 html_header(client, printer->name, 0); in show_media()
7340 html_printf(client, "<p>Error: No media-col-ready defined for printer.</p>\n"); in show_media()
7341 html_footer(client); in show_media()
7349 html_printf(client, "<p>Error: No media-supported defined for printer.</p>\n"); in show_media()
7350 html_footer(client); in show_media()
7356 html_printf(client, "<p>Error: No media-source-supported defined for printer.</p>\n"); in show_media()
7357 html_footer(client); in show_media()
7363 html_printf(client, "<p>Error: No media-type-supported defined for printer.</p>\n"); in show_media()
7364 html_footer(client); in show_media()
7370 html_printf(client, "<p>Error: No printer-input-tray defined for printer.</p>\n"); in show_media()
7371 html_footer(client); in show_media()
7382 …html_printf(client, "<p>Error: Different number of trays in media-source-supported and printer-inp… in show_media()
7383 html_footer(client); in show_media()
7392 num_options = parse_options(client, &options); in show_media()
7481 html_printf(client, "<form method=\"GET\" action=\"/media\">\n"); in show_media()
7483 html_printf(client, "<table class=\"form\" summary=\"Media\">\n"); in show_media()
7506 html_printf(client, "<tr><th>%s:</th>", media_source); in show_media()
7514 html_printf(client, "<td><select name=\"size%d\"><option value=\"\">None</option>", i); in show_media()
7519 …html_printf(client, "<option%s>%s</option>", (ready_size && !strcmp(ready_size, media_size)) ? " s… in show_media()
7521 html_printf(client, "</select>"); in show_media()
7524 html_printf(client, "<td>%s", ready_size); in show_media()
7532 html_printf(client, " <select name=\"type%d\"><option value=\"\">None</option>", i); in show_media()
7537 …html_printf(client, "<option%s>%s</option>", (ready_type && !strcmp(ready_type, media_type)) ? " s… in show_media()
7539 html_printf(client, "</select>"); in show_media()
7542 html_printf(client, ", %s", ready_type); in show_media()
7565 html_printf(client, " <select name=\"level%d\">", i); in show_media()
7572 …html_printf(client, "<option value=\"%d\"%s>Unknown</option>", sheets[j], sheets[j] == ready_sheet… in show_media()
7574 …html_printf(client, "<option value=\"%d\"%s>%d sheets</option>", sheets[j], sheets[j] == ready_she… in show_media()
7576 html_printf(client, "</select></td></tr>\n"); in show_media()
7579 html_printf(client, ", 1 sheet</td></tr>\n"); in show_media()
7581 html_printf(client, ", %d sheets</td></tr>\n", ready_sheets); in show_media()
7583 html_printf(client, "</td></tr>\n"); in show_media()
7588 html_printf(client, "<tr><td></td><td><input type=\"submit\" value=\"Update Media\">"); in show_media()
7590 html_printf(client, " <span class=\"badge\" id=\"status\">Media updated.</span>\n"); in show_media()
7591 html_printf(client, "</td></tr></table></form>\n"); in show_media()
7594 html_printf(client, "<script>\n" in show_media()
7603 html_printf(client, "</table>\n"); in show_media()
7605 html_footer(client); in show_media()
7616 show_status(ippeve_client_t *client) /* I - Client connection */ in show_status() argument
7618 ippeve_printer_t *printer = client->printer; in show_status()
7650 if (!respond_http(client, HTTP_STATUS_OK, NULL, "text/html", 0)) in show_status()
7653 html_header(client, printer->name, printer->state == IPP_PSTATE_PROCESSING ? 5 : 15); in show_status()
7654 …html_printf(client, "<h1><img style=\"background: %s; border-radius: 10px; float: left; margin-rig… in show_status()
7655 …html_printf(client, "<p>%s, %d job(s).", printer->state == IPP_PSTATE_IDLE ? "Idle" : printer->sta… in show_status()
7658 html_printf(client, "\n<br> %s", reasons[i]); in show_status()
7659 html_printf(client, "</p>\n"); in show_status()
7665 …html_printf(client, "<table class=\"striped\" summary=\"Jobs\"><thead><tr><th>Job #</th><th>Name</… in show_status()
7692 …html_printf(client, "<tr><td>%d</td><td>%s</td><td>%s</td><td>%s</td></tr>\n", job->id, job->name,… in show_status()
7694 html_printf(client, "</tbody></table>\n"); in show_status()
7699 html_footer(client); in show_status()
7711 ippeve_client_t *client) /* I - Client connection */ in show_supplies() argument
7713 ippeve_printer_t *printer = client->printer; in show_supplies()
7757 if (!respond_http(client, HTTP_STATUS_OK, NULL, "text/html", 0)) in show_supplies()
7760 html_header(client, printer->name, 0); in show_supplies()
7764 html_printf(client, "<p>Error: No printer-supply defined for printer.</p>\n"); in show_supplies()
7765 html_footer(client); in show_supplies()
7773 html_printf(client, "<p>Error: No printer-supply-description defined for printer.</p>\n"); in show_supplies()
7774 html_footer(client); in show_supplies()
7780 …html_printf(client, "<p>Error: Different number of values for printer-supply and printer-supply-de… in show_supplies()
7781 html_footer(client); in show_supplies()
7786 num_options = parse_options(client, &options); in show_supplies()
7842 html_printf(client, "<form method=\"GET\" action=\"/supplies\">\n"); in show_supplies()
7844 html_printf(client, "<table class=\"form\" summary=\"Supplies\">\n"); in show_supplies()
7860 …html_printf(client, "<tr><th>%s:</th><td><input name=\"supply%d\" size=\"3\" value=\"%d\"></td>", … in show_supplies()
7862 html_printf(client, "<tr><th>%s:</th>", ippGetString(supply_desc, i, NULL)); in show_supplies()
7865 …html_printf(client, "<td class=\"meter\"><span class=\"bar\" style=\"background: %s; padding: 5px … in show_supplies()
7867 …html_printf(client, "<td class=\"meter\"><span class=\"bar\" style=\"background: %s; color: %s; pa… in show_supplies()
7872 …html_printf(client, "<tr><td></td><td colspan=\"2\"><input type=\"submit\" value=\"Update Supplies… in show_supplies()
7874 html_printf(client, " <span class=\"badge\" id=\"status\">Supplies updated.</span>\n"); in show_supplies()
7875 html_printf(client, "</td></tr>\n</table>\n</form>\n"); in show_supplies()
7878 html_printf(client, "<script>\n" in show_supplies()
7887 html_printf(client, "</table>\n"); in show_supplies()
7889 html_footer(client); in show_supplies()
7965 ippeve_client_t *client) /* I - Client */ in valid_doc_attributes() argument
7968 ipp_op_t op = ippGetOperation(client->request); in valid_doc_attributes()
7983 if ((attr = ippFindAttribute(client->request, "compression", IPP_TAG_ZERO)) != NULL) in valid_doc_attributes()
7991 supported = ippFindAttribute(client->printer->attrs, in valid_doc_attributes()
8000 respond_unsupported(client, attr); in valid_doc_attributes()
8005 fprintf(stderr, "%s %s compression=\"%s\"\n", client->hostname, op_name, compression); in valid_doc_attributes()
8007 …ippAddString(client->request, IPP_TAG_JOB, IPP_TAG_KEYWORD, "compression-supplied", NULL, compress… in valid_doc_attributes()
8013 httpSetField(client->http, HTTP_FIELD_CONTENT_ENCODING, compression); in valid_doc_attributes()
8022 if ((attr = ippFindAttribute(client->request, "document-format", IPP_TAG_ZERO)) != NULL) in valid_doc_attributes()
8027 respond_unsupported(client, attr); in valid_doc_attributes()
8034 fprintf(stderr, "%s %s document-format=\"%s\"\n", client->hostname, op_name, format); in valid_doc_attributes()
8036 …ippAddString(client->request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format-supplied", NULL, for… in valid_doc_attributes()
8041 …format = ippGetString(ippFindAttribute(client->printer->attrs, "document-format-default", IPP_TAG_… in valid_doc_attributes()
8045 …attr = ippAddString(client->request, IPP_TAG_OPERATION, IPP_TAG_MIMETYPE, "document-format", NULL,… in valid_doc_attributes()
8048 …plication/octet-stream") && (ippGetOperation(client->request) == IPP_OP_PRINT_JOB || ippGetOperati… in valid_doc_attributes()
8057 httpPeek(client->http, (char *)header, sizeof(header)); in valid_doc_attributes()
8076 … fprintf(stderr, "%s %s Auto-typed document-format=\"%s\"\n", client->hostname, op_name, format); in valid_doc_attributes()
8078 …ippAddString(client->request, IPP_TAG_JOB, IPP_TAG_MIMETYPE, "document-format-detected", NULL, for… in valid_doc_attributes()
8082 …if (op != IPP_OP_CREATE_JOB && (supported = ippFindAttribute(client->printer->attrs, "document-for… in valid_doc_attributes()
8084 respond_unsupported(client, attr); in valid_doc_attributes()
8092 if ((attr = ippFindAttribute(client->request, "document-name", IPP_TAG_NAME)) != NULL) in valid_doc_attributes()
8093 …ippAddString(client->request, IPP_TAG_JOB, IPP_TAG_NAME, "document-name-supplied", NULL, ippGetStr… in valid_doc_attributes()
8108 ippeve_client_t *client) /* I - Client */ in valid_job_attributes() argument
8121 valid = valid_doc_attributes(client); in valid_job_attributes()
8127 if ((attr = ippFindAttribute(client->request, "copies", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8132 respond_unsupported(client, attr); in valid_job_attributes()
8137 if ((attr = ippFindAttribute(client->request, "ipp-attribute-fidelity", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8141 respond_unsupported(client, attr); in valid_job_attributes()
8146 if ((attr = ippFindAttribute(client->request, "job-hold-until", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8154 respond_unsupported(client, attr); in valid_job_attributes()
8159 if ((attr = ippFindAttribute(client->request, "job-impressions", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8163 respond_unsupported(client, attr); in valid_job_attributes()
8168 if ((attr = ippFindAttribute(client->request, "job-name", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8174 respond_unsupported(client, attr); in valid_job_attributes()
8178 ippSetGroupTag(client->request, &attr, IPP_TAG_JOB); in valid_job_attributes()
8181 ippAddString(client->request, IPP_TAG_JOB, IPP_TAG_NAME, "job-name", NULL, "Untitled"); in valid_job_attributes()
8183 if ((attr = ippFindAttribute(client->request, "job-priority", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8188 respond_unsupported(client, attr); in valid_job_attributes()
8193 if ((attr = ippFindAttribute(client->request, "job-sheets", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8201 respond_unsupported(client, attr); in valid_job_attributes()
8206 if ((attr = ippFindAttribute(client->request, "media", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8213 respond_unsupported(client, attr); in valid_job_attributes()
8218 supported = ippFindAttribute(client->printer->attrs, "media-supported", IPP_TAG_KEYWORD); in valid_job_attributes()
8222 respond_unsupported(client, attr); in valid_job_attributes()
8228 if ((attr = ippFindAttribute(client->request, "media-col", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8241 respond_unsupported(client, attr); in valid_job_attributes()
8254 respond_unsupported(client, attr); in valid_job_attributes()
8259 supported = ippFindAttribute(client->printer->attrs, "media-supported", IPP_TAG_KEYWORD); in valid_job_attributes()
8263 respond_unsupported(client, attr); in valid_job_attributes()
8272 respond_unsupported(client, attr); in valid_job_attributes()
8282 respond_unsupported(client, attr); in valid_job_attributes()
8289 …supported = ippFindAttribute(client->printer->attrs, "media-size-supported", IPP_TAG_BEGIN_COLLECT… in valid_job_attributes()
8304 respond_unsupported(client, attr); in valid_job_attributes()
8312 …if ((attr = ippFindAttribute(client->request, "multiple-document-handling", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8320 respond_unsupported(client, attr); in valid_job_attributes()
8325 if ((attr = ippFindAttribute(client->request, "orientation-requested", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8331 respond_unsupported(client, attr); in valid_job_attributes()
8336 if ((attr = ippFindAttribute(client->request, "page-ranges", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8340 respond_unsupported(client, attr); in valid_job_attributes()
8345 if ((attr = ippFindAttribute(client->request, "print-quality", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8351 respond_unsupported(client, attr); in valid_job_attributes()
8356 if ((attr = ippFindAttribute(client->request, "printer-resolution", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8358 …supported = ippFindAttribute(client->printer->attrs, "printer-resolution-supported", IPP_TAG_RESOL… in valid_job_attributes()
8363 respond_unsupported(client, attr); in valid_job_attributes()
8385 respond_unsupported(client, attr); in valid_job_attributes()
8391 if ((attr = ippFindAttribute(client->request, "sides", IPP_TAG_ZERO)) != NULL) in valid_job_attributes()
8398 respond_unsupported(client, attr); in valid_job_attributes()
8401 …else if ((supported = ippFindAttribute(client->printer->attrs, "sides-supported", IPP_TAG_KEYWORD)… in valid_job_attributes()
8405 respond_unsupported(client, attr); in valid_job_attributes()
8411 respond_unsupported(client, attr); in valid_job_attributes()