LBERTYPES(3) LBERTYPES(3)
NAME
berintt, beruintt, berlent, berslent, bertagt, struct berval,
BerValue, BerVarray, BerElement, berbvfree, berbvecfree, berbvecadd,
berbvarrayfree, berbvarrayadd, berbvdup, berdupbv, berbvstr,
berbvstrdup, berstr2bv, berfree - LBER types and allocation func-
tions
LIBRARY
OpenLDAP LBER (liblber, -llber)
SYNOPSIS
##include <>
typedef impltagt bertagt;;
typedef implintt berintt;;
typedef impluintt beruintt;;
typedef impllent berlent;;
typedef implslent berslent;;
typedef struct berval {{
berlent bvlen;;
char **bvval;;
}} BerValue,, **BerVarray;;
typedef struct berelement BerElement;;
void berbvfree(struct berval **bv);;
void berbvecfree(struct berval ****bvec);;
void berbvecadd(struct berval ******bvec,, struct berval **bv);;
void berbvarrayfree(struct berval **bvarray);;
void berbvarrayadd(BerVarray **bvarray,, BerValue **bv);;
struct berval **berbvdup(const struct berval **bv);;
struct berval **berdupbv(const struct berval **dst,, struct berval **src);;
struct berval **berbvstr(const char **str);;
struct berval **berbvstrdup(const char **str);;
struct berval **berstr2bv(const char **str,, berlent len,, int dup,,
struct berval **bv);;
void berfree(BerElement **ber,, int freebuf);;
DESCRIPTION
The following are the basic types and structures defined for use with
the Lightweight BER library.
berintt is a signed integer of at least 32 bits. It is commonly
equivalent to int. beruintt is the unsigned variant of berintt.
berlent is an unsigned integer of at least 32 bits used to represent
a length. It is commonly equivalent to a sizet. berslent is the
signed variant to berlent.
bertagt 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 implTYPEt types are platform
specific.
BerValue, commonly used as struct berval, is used to hold an arbitrary
sequence of octets. bvval points to bvlen octets. bvval is not
necessarly terminated by a NUL (zero) octet. berbvfree() frees a
BerValue, pointed to by bv, returned from this API. If bv is NUL, the
routine does nothing.
berbvecfree() frees an array of BerValues (and the array), pointed to
by bvec, returned from this API. If bvec is NUL, the routine does
nothing. berbvecadd() appends the bv pointer to the bvec array.
Space for the array is allocated as needed. The end of the array is
marked by a NUL pointer.
berbvarrayfree() frees an array of BerValues (and the array), pointed
to by bvarray, returned from this API. If bvarray is NUL, the routine
does nothing. berbvarrayadd() appends the contents of the BerValue
pointed to by bv to the bvarray array. Space for the new element is
allocated as needed. The end of the array is marked by a BerValue with
a NUL bvval field.
berbvdup() returns a copy of a BerValue. The routine returns NUL
upon error (e.g. out of memory). The caller should use berbvfree() to
deallocate the resulting BerValue. berdupbv() copies a BerValue from
src to dst. If dst is NUL a new BerValue will be allocated to hold
the copy. The routine returns NUL upon error, otherwise it returns a
pointer to the copy. If dst is NUL the caller should use berbvfree()
to deallocate the resulting BerValue, otherwise bermemfree() should be
used to deallocate the dst->bvval. (The berbvdup() function is
internally implemented as berdupbv(NUL, bv). berbvdup() is provided
only for compatibility with an expired draft of the LDAP C API;
berdupbv() is the preferred interface.)
berbvstr() returns a BerValue containing the string pointed to by str.
berbvstrdup() returns a BerValue containing a copy of the string
pointed to by str. berstr2bv() returns a BerValue containing the
string pointed to by str, whose length may be optionally specified in
len. If dup is non-zero, the BerValue will contain a copy of str. If
len is zero, the number of bytes to copy will be determined by
strlen(3), otherwise len bytes will be copied. If bv is non-NUL, the
result will be stored in the given BerValue, otherwise a new BerValue
will be allocated to store the result. NOTE: Both berbvstr() and
berbvstrdup() are implemented as macros using berstr2bv() in this
version of the library.
BerElement is an opaque structure used to maintain state information
used in encoding and decoding. BerElement structures are created using
beralloct(3) and berinit(3). berfree() frees a BerElement pointed
to by ber. If ber is NUL, the routine does nothing. If freebuf is
zero, the internal buffer is not freed.
SEE ALSO
lber-encode(3), lber-decode(3), lber-memory(3)
ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project
(http:/www.openldap.org/). OpenLDAP is derived from University of
Michigan LDAP 3.3 Release.
OpenLDAP 2.2.19 2004/11/26 LBERTYPES(3)
|