]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add public cupsEncodeOption API
authorMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 22 Feb 2018 19:16:46 +0000 (14:16 -0500)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 22 Feb 2018 19:16:46 +0000 (14:16 -0500)
CHANGES.md
cups/cups.h
cups/encode.c

index 94ec6a5b45d478d1a54c7cb83500251e394d957d..0b440ab46e7b88951d784332d804be9bba9f0033 100644 (file)
@@ -14,6 +14,8 @@ Changes in CUPS v2.3rc1
   (rdar://37789645)
 - The ipptool `--ippserver` option did not encode out-of-band attributes
   correctly.
+- Added public `cupsEncodeOption` API for encoding a single option as an IPP
+  attribute.
 - Documentation fixes (Issue #5252)
 
 
index 225e6ca74710cbe058d2c5e207458d9e2d9453e2..1a0b34a3d10c220af46e7e3a677d425cdf011b6a 100644 (file)
@@ -601,7 +601,8 @@ extern int          cupsAddIntegerOption(const char *name, int value, int num_options, c
 extern int             cupsGetIntegerOption(const char *name, int num_options, cups_option_t *options) _CUPS_API_2_2_4;
 
 /* New in CUPS 2.3 */
-extern int             cupsAddDestMediaOptions(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, unsigned flags, cups_size_t *size, int num_options, cups_option_t **options);
+extern int             cupsAddDestMediaOptions(http_t *http, cups_dest_t *dest, cups_dinfo_t *dinfo, unsigned flags, cups_size_t *size, int num_options, cups_option_t **options) _CUPS_API_2_3;
+extern ipp_attribute_t *cupsEncodeOption(ipp_t *ipp, ipp_tag_t group_tag, const char *name, const char *value) _CUPS_API_2_3;
 extern const char      *cupsHashString(const unsigned char *hash, size_t hashsize, char *buffer, size_t bufsize) _CUPS_API_2_3;
 
 #  ifdef __cplusplus
index 927b4a2ed575c95a748cc99cd0ce55ae5d1e4990..316ff249077542f41e5aaf611df33241b9c0fad7 100644 (file)
@@ -1,10 +1,11 @@
 /*
  * Option encoding routines for CUPS.
  *
- * Copyright 2007-2017 by Apple Inc.
- * Copyright 1997-2007 by Easy Software Products.
+ * Copyright © 2007-2018 by Apple Inc.
+ * Copyright © 1997-2007 by Easy Software Products.
  *
- * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more
+ * information.
  */
 
 /*
@@ -626,6 +627,22 @@ _cupsEncodeOption(
 }
 
 
+/*
+ * 'cupsEncodeOption()' - Encode a single option into an IPP attribute.
+ *
+ * @since CUPS 2.3@
+ */
+
+ipp_attribute_t        *                       /* O - New attribute or @code NULL@ on error */
+cupsEncodeOption(ipp_t      *ipp,      /* I - IPP request/response */
+                 ipp_tag_t  group_tag, /* I - Attribute group */
+                 const char *name,     /* I - Option name */
+                 const char *value)    /* I - Option string value */
+{
+  return (_cupsEncodeOption(ipp, group_tag, _ippFindOption(name), name, value));
+}
+
+
 /*
  * 'cupsEncodeOptions()' - Encode printer options into IPP attributes.
  *
@@ -635,7 +652,7 @@ _cupsEncodeOption(
  */
 
 void
-cupsEncodeOptions(ipp_t         *ipp,          /* I - Request to add to */
+cupsEncodeOptions(ipp_t         *ipp,          /* I - IPP request/response */
                  int           num_options,    /* I - Number of options */
                  cups_option_t *options)       /* I - Options */
 {
@@ -663,7 +680,7 @@ cupsEncodeOptions(ipp_t         *ipp,               /* I - Request to add to */
 
 void
 cupsEncodeOptions2(
-    ipp_t         *ipp,                        /* I - Request to add to */
+    ipp_t         *ipp,                        /* I - IPP request/response */
     int           num_options,         /* I - Number of options */
     cups_option_t *options,            /* I - Options */
     ipp_tag_t     group_tag)           /* I - Group to encode */