[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: LDAP C API: Data Types and Legacy Implementations
"Kurt D. Zeilenga" wrote:
>
> I support the addition of ber_len_t and ber_tag_t types as it
> does allow source and binary compatibility to be maintained
> between existing applications and implementations of this API
> specification. However, I believe much more can and should
> be done in this area.
>
> Another legacy compatibility issue is the use of 'int' in
> ber_printf boolean, enum, and integer arguments and 'int *' in
> ber_scanf boolean, enum, and integer arguments. Many legacy
> implementations currently use 'long' and 'long *', respectifully.
> Changing these implementations to comply with the specification
> would cause significant source and binary compatibility problems.
> Due to the vararg prototypes of ber_printf/ber_scanf, mismatched
> types would not be detected in most C environments. (Secondly,
> the currently required 'long' to 'int' may be non-trivial
> change to existing implementations).
>
> To provide a mechanism which allows implementors to provide
> compatibility with existing applications, I suggest that a
> new type be introduced:
>
> typedef impl-specific-int ber_int_t; /* at least 32-bits */
>
> This type would be would be used for booleans, enums,
> and integers values passed to ber_printf and, by pointer, from
> ber_scanf.
>
> This change would have minimal impact upon API implementors as
> they may simply select the currently used type when defining
> this typedef and allow implementors to provide source and
> binary compatibility with existing applications.
The situation is worse than you describe. At present, the U-M LDAP
implementation (and most implementations based on it) requires callers
to pass int's when encoding integers and enumerations (with ber_printf)
but long *'s when decoding (ber_scanf). Still, it seems like a good
idea to me to define a ber_int_t and try to eliminate most of the bare
long's from the API.
--
Mark Smith
Netscape Communications Corp. / Directory Server Engineering
"Got LDAP?"