[cups-devel] _IPP_PRIVATE_STRUCTURES and direct access to fields

Michael Sweet msweet at apple.com
Tue May 20 06:09:49 PDT 2014


Olivier,

On May 13, 2014, at 7:02 AM, Olivier Guillion - Myriad <olivier at myriad-online.com> wrote:
> Hi,
> 
> I'm trying to retrieve some printer attributes through IPP.
> In order to be able to do so, I had to define  _IPP_PRIVATE_STRUCTURES and 
> access directly to the structure fields instead of dealing with opaque 
> structures.
> 
> I presume that this way of programming is not recommended (otherwise the 
> structure wouldn't have been changed to opaque), and that these structures 
> could change size or field location in future versions of the lib?
> 
> In this case, how can I manage to retrieve attributes using 
> ippFindNextAttribute ?

The ippFindNextAttribute function returns the next matching attribute in the ipp_t structure.  The "current" pointer in that structure is reset with ippFindAttribute and updated by ippFindNextAttribute.

> ...
> The ippFindNextAttribute can only search for a named attribute, regardless of 
> which printer (block) it refers to, and it's impossible to search for the empty 
> attribute.

Correct.  Which is why there is ippFirstAttribute and ippNextAttribute to iterate over all attributes in an ipp_t, and ippGetName to get the name (which will be full for the separator between groups with the same tag).

> ...
> Or am I allowed to define _IPP_PRIVATE_STRUCTURES and use this direct access to 
> fields in my programs?

You can, just keep in mind we plan on pulling the plug after 2.0 for that sort of usage and with the existing APIs there is no longer a need to have direct access.

_________________________________________________________
Michael Sweet, Senior Printing System Engineer, PWG Chair




More information about the cups mailing list