[cups-devel] _IPP_PRIVATE_STRUCTURES and direct access to fields

Olivier Guillion - Myriad olivier at myriad-online.com
Tue May 13 04:02:11 PDT 2014


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 ?

This function doesn't seem useable at all. Here is what I inderstood :

In the "private" structures, the attribute list contains attributes for all 
printers.
They are organised in blocks, one for each printer, separated by a NULL (empty) 
 attribute.

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.

Therefore, if I want to search for the "xyz" attribute for printer "abcd", I 
have to call :

-  ippFindNextAttribute(response,"printer-name", IPP_TAG_NAME)
until the resulting string is "abcd"

- Then, hoping that the "xyz" attribute for this printer is located *after* 
printer-name, call ippFindNextAttribute(response,"xyz", IPP_TAG_ZERO)

This could work(ish) but if this printer doesn't have an xyz attribute while 
the next printer in the list does, it will return the attribute for the wrong 
printer, without letting me know about it.

So, what I have missed? Are there other functions than ippFindNextAttribute 
that would let me browse and retrieve attributes properly, like I do with the 
direct access to private structure fields?

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

Best Regards,
Olivier Guillion
Myriad



More information about the cups-devel mailing list