ttyyppeeddeeff iimmppll__ttaagg__tt bbeerr__ttaagg__tt;;
ttyyppeeddeeff iimmppll__iinntt__tt bbeerr__iinntt__tt;;
ttyyppeeddeeff iimmppll__uuiinntt__tt bbeerr__uuiinntt__tt;;
ttyyppeeddeeff iimmppll__lleenn__tt bbeerr__lleenn__tt;;
ttyyppeeddeeff iimmppll__sslleenn__tt bbeerr__sslleenn__tt;;
</pprree>>
<>
ttyyppeeddeeff ssttrruucctt bbeerrvvaall {{
bbeerr__lleenn__tt bbvv__lleenn;;
cchhaarr **bbvv__vvaall;;
}} BBeerrVVaalluuee,, **BBeerrVVaarrrraayy;;
<
>
ttyyppeeddeeff ssttrruucctt bbeerreelleemmeenntt BBeerrEElleemmeenntt;;
void ber_bvfree(struct berval *bv);
void ber_bvecfree(struct berval **bvec);
void ber_bvecadd(struct berval ***bvec, struct berval *bv);
void ber_bvarray_free(struct berval *bvarray);
void ber_bvarray_add(BerVarray *bvarray, BerValue *bv);
struct berval *ber_bvdup(const struct berval *bv);
struct berval *ber_dupbv(const struct berval *dst, struct berval *src);
struct berval *ber_bvstr(const char *str);
struct berval *ber_bvstrdup(const char *str);
struct berval *ber_str2bv(const char *str, ber_len_t len, int dup, struct berval *bv);
BerElement *ber_alloc_t(int options);
BerElement *ber_init(struct berval *bv);
void ber_init2(BerElement *ber, struct berval *bv, int options);
void ber_free(BerElement *ber, int freebuf);
DESCRIPTION
The following are the basic types and structures defined for use
with the Lightweight BER library.
ber_int_t
is a signed integer of at least 32 bits. It is commonly equivalent to
int.
ber_uint_t
is the unsigned variant of
ber_int_t.
ber_len_t
is an unsigned integer of at least 32 bits used to represent a length.
It is commonly equivalent to a
size_t.
ber_slen_t
is the signed variant to
ber_len_t.
ber_tag_t
is an unsigned integer of at least 32 bits used to represent a
BER tag. It is commonly equivalent to a
unsigned long.
The actual definitions of the integral impl_TYPE_t types are platform
specific.
BerValue,
commonly used as
struct berval,
is used to hold an arbitrary sequence of octets.
bv_val
points to
bv_len
octets.
bv_val
is not necessarily terminated by a NULL (zero) octet.
ber_bvfree()
frees a BerValue, pointed to by _b_v, returned from this API. If _b_v
is NULL, the routine does nothing.
ber_bvecfree()
frees an array of BerValues (and the array), pointed to by _b_v_e_c,
returned from this API. If _b_v_e_c is NULL, the routine does nothing.
ber_bvecadd()
appends the _b_v pointer to the _b_v_e_c array. Space for the array
is allocated as needed. The end of the array is marked by a NULL pointer.
ber_bvarray_free()
frees an array of BerValues (and the array), pointed to by _b_v_a_r_r_a_y,
returned from this API. If _b_v_a_r_r_a_y is NULL, the routine does nothing.
ber_bvarray_add()
appends the contents of the BerValue pointed to by _b_v to the
_b_v_a_r_r_a_y array. Space for the new element is allocated as needed.
The end of the array is marked by a BerValue with a NULL bv_val field.
ber_bvdup()
returns a copy of a BerValue. The routine returns NULL upon error
(e.g. out of memory). The caller should use
ber_bvfree()
to deallocate the resulting BerValue.
ber_dupbv()
copies a BerValue from _s_r_c to _d_s_t. If _d_s_t is NULL a
new BerValue will be allocated to hold the copy. The routine returns NULL
upon error, otherwise it returns a pointer to the copy. If _d_s_t is
NULL the caller should use
ber_bvfree()
to deallocate the resulting BerValue, otherwise
ber_memfree()
should be used to deallocate the _d_s_t_-_>_b_v___v_a_l. (The
ber_bvdup()
function is internally implemented as ber_dupbv(NULL, bv).
ber_bvdup()
is provided only for compatibility with an expired draft of the LDAP C API;
ber_dupbv()
is the preferred interface.)
ber_bvstr()
returns a BerValue containing the string pointed to by _s_t_r.
ber_bvstrdup()
returns a BerValue containing a copy of the string pointed to by _s_t_r.
ber_str2bv()
returns a BerValue containing the string pointed to by _s_t_r, whose
length may be optionally specified in _l_e_n. If _d_u_p is non-zero,
the BerValue will contain a copy of _s_t_r. If _l_e_n is zero, the
number of bytes to copy will be determined by
strlen(3)
otherwise _l_e_n bytes will be copied. If _b_v is non-NULL, the result
will be stored in the given BerValue, otherwise a new BerValue will be
allocated to store the result. NOTE: Both
ber_bvstr()
and
ber_bvstrdup()
are implemented as macros using
ber_str2bv()
in this version of the library.
BerElement
is an opaque structure used to maintain state information used in
encoding and decoding.
ber_alloc_t()
is used to create an empty BerElement structure. If
LBER_USE_DER
is specified for the
options
parameter then data lengths for data written to the BerElement will be
encoded in the minimal number of octets required, otherwise they will
always be written as four byte values.
ber_init()
creates a BerElement structure that is initialized with a copy of the
data in its
bv
parameter.
ber_init2()
initializes an existing BerElement
ber
using the data in the
bv
parameter. The data is referenced directly, not copied. The
options
parameter is the same as for
ber_alloc_t().
ber_free()
frees a BerElement pointed to by _b_e_r. If _b_e_r is NULL, the routine
does nothing. If _f_r_e_e_b_u_f is zero, the internal buffer is not freed.
SEE ALSO
lber-encode(3)
lber-decode(3)
lber-memory(3)
ACKNOWLEDGEMENTS
OpenLDAP Software
is developed and maintained by The OpenLDAP Project .
OpenLDAP Software
is derived from University of Michigan LDAP 3.3 Release.