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

Function process_ipp

tools/ippeveprinter.c:6349–6625  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6347 */
6348
6349static int /* O - 1 on success, 0 on error */
6350process_ipp(ippeve_client_t *client) /* I - Client */
6351{
6352 ipp_tag_t group; /* Current group tag */
6353 ipp_attribute_t *attr; /* Current attribute */
6354 ipp_attribute_t *charset; /* Character set attribute */
6355 ipp_attribute_t *language; /* Language attribute */
6356 ipp_attribute_t *uri; /* Printer URI attribute */
6357 int major, minor; /* Version number */
6358 const char *name; /* Name of attribute */
6359 http_status_t status; /* Authentication status */
6360
6361
6362 debug_attributes("Request", client->request, 1);
6363
6364 /*
6365 * First build an empty response message for this request...
6366 */
6367
6368 client->operation_id = ippGetOperation(client->request);
6369 client->response = ippNewResponse(client->request);
6370
6371 /*
6372 * Then validate the request header and required attributes...
6373 */
6374
6375 major = ippGetVersion(client->request, &minor);
6376
6377 if (major < 1 || major > 2)
6378 {
6379 /*
6380 * Return an error, since we only support IPP 1.x and 2.x.
6381 */
6382
6383 respond_ipp(client, IPP_STATUS_ERROR_VERSION_NOT_SUPPORTED, "Bad request version number %d.%d.", major, minor);
6384 }
6385 else if ((major * 10 + minor) > MaxVersion)
6386 {
6387 if (httpGetState(client->http) != HTTP_STATE_POST_SEND)
6388 httpFlush(client->http); /* Flush trailing (junk) data */
6389
6390 respond_http(client, HTTP_STATUS_BAD_REQUEST, NULL, NULL, 0);
6391 return (0);
6392 }
6393 else if (ippGetRequestId(client->request) <= 0)
6394 {
6395 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "Bad request-id %d.", ippGetRequestId(client->request));
6396 }
6397 else if (!ippFirstAttribute(client->request))
6398 {
6399 respond_ipp(client, IPP_STATUS_ERROR_BAD_REQUEST, "No attributes in request.");
6400 }
6401 else
6402 {
6403 /*
6404 * Make sure that the attributes are provided in the correct order and
6405 * don't repeat groups...
6406 */

Callers 1

process_httpFunction · 0.85

Calls 15

ippGetOperationFunction · 0.85
ippNewResponseFunction · 0.85
ippGetVersionFunction · 0.85
respond_ippFunction · 0.85
httpGetStateFunction · 0.85
httpFlushFunction · 0.85
respond_httpFunction · 0.85
ippGetRequestIdFunction · 0.85
ippFirstAttributeFunction · 0.85
ippGetGroupTagFunction · 0.85
ippNextAttributeFunction · 0.85
ippGetNameFunction · 0.85

Tested by

no test coverage detected