[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: LDAP C API: Data Types and Legacy Implementations



Hallvard B Furuseth wrote:
> 
> Kurt D. Zeilenga wrote:
> > I suggest that a new type be introduced:
> >
> >         typedef impl-specific-int ber_int_t; /* at least 32-bits */
> 
> Add ber_uint_t as well with the same size; it's common to convert
> between signed and unsigned for a type.  Or use
>         #define ber_int_t impl-specific-int
> so we can use the type `unsigned ber_int_t'.

I amk not convinced we need to add ber_uint_t as it won't be used in any
of the API calls defined by the draft.  Can you provide an example that
shows why it is needed?


> ...
> We need a way to printf() and sscanf() these types.
> ...

I disagree.  Why?  Presumably applications will convert between
ber_int_t and another type of sufficient size if they need to use
printf() of scanf().  Or will that approach cause problems?


> ...
> I don't quite see what the new type ber_tag_t gives us when we don't
> know the mapping between (class,encoding,tag-value) tuples and ber_tag_t
> values.  (Well, we know that CLASS and ENCODING must always be in the
> low octet, otherwise most code which tests them will fail).
> 
> So I suggest to either add:
>         unsigned long lber_tag_t_to_value(ber_tag_t)
>     and
>         ber_tag_t     lber_value_to_tag_t(unsigned long)
> 
> or: that the mapping between ber_tag_t and (class,encoding,tag-value) is
> defined in the draft -- I suggest to read it as a raw integer from the
> network with the least significant byte first; that way the bitmask
> 0xe0 will extract the encoding and class even for multi-octet tags.

I don't think we need to add new functions to address this issue, but
some clarifying text might be useful.  Maybe I misunderstand what you
suggest, but it would strike me as very odd to interpret a ber_tag_t
"least significant byte first."  I need to think about this some more. 
In all implementations of the ber...() functions I know of, the tag
values are simple integers where leading zero bits are essentially
ignored.

-- 
Mark Smith
Directory Architect / Sun-Netscape Alliance
My words are my own, not my employer's.  Got LDAP?