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

Function ippAddOctetString

cups/ipp.c:505–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

503 */
504
505ipp_attribute_t * /* O - New attribute */
506ippAddOctetString(ipp_t *ipp, /* I - IPP message */
507 ipp_tag_t group, /* I - IPP group */
508 const char *name, /* I - Name of attribute */
509 const void *data, /* I - octetString data */
510 int datalen) /* I - Length of data in bytes */
511{
512 ipp_attribute_t *attr; /* New attribute */
513
514
515 if (!ipp || !name || group < IPP_TAG_ZERO ||
516 group == IPP_TAG_END || group >= IPP_TAG_UNSUPPORTED_VALUE ||
517 datalen < 0 || datalen > IPP_MAX_LENGTH)
518 return (NULL);
519
520 if ((attr = ipp_add_attr(ipp, name, group, IPP_TAG_STRING, 1)) == NULL)
521 return (NULL);
522
523 /*
524 * Initialize the attribute data...
525 */
526
527 attr->values[0].unknown.length = datalen;
528
529 if (data)
530 {
531 if ((attr->values[0].unknown.data = malloc((size_t)datalen)) == NULL)
532 {
533 ippDeleteAttribute(ipp, attr);
534 return (NULL);
535 }
536
537 memcpy(attr->values[0].unknown.data, data, (size_t)datalen);
538 }
539
540 /*
541 * Return the new attribute...
542 */
543
544 return (attr);
545}
546
547
548/*

Callers 9

load_legacy_attributesFunction · 0.85
load_ppd_attributesFunction · 0.85
show_suppliesFunction · 0.85
cupsdAddEventFunction · 0.85
copy_printer_attrsFunction · 0.85
copy_subscription_attrsFunction · 0.85
cupsdSetPrinterAttrFunction · 0.85
_cupsConvertOptionsFunction · 0.85
mainFunction · 0.85

Calls 2

ipp_add_attrFunction · 0.85
ippDeleteAttributeFunction · 0.85

Tested by

no test coverage detected