1LBER_TYPES(3) Library Functions Manual LBER_TYPES(3)
2
3
4
6 ber_int_t, ber_uint_t, ber_len_t, ber_slen_t, ber_tag_t, struct berval,
7 BerValue, BerVarray, BerElement, ber_bvfree, ber_bvecfree, ber_bvecadd,
8 ber_bvarray_free, ber_bvarray_add, ber_bvdup, ber_dupbv, ber_bvstr,
9 ber_bvstrdup, ber_str2bv, ber_free - LBER types and allocation func‐
10 tions
11
13 OpenLDAP LBER (liblber, -llber)
14
16 #include <lber.h>
17
18 typedef impl_tag_t ber_tag_t;
19 typedef impl_int_t ber_int_t;
20 typedef impl_uint_t ber_uint_t;
21 typedef impl_len_t ber_len_t;
22 typedef impl_slen_t ber_slen_t;
23
24 typedef struct berval {
25 ber_len_t bv_len;
26 char *bv_val;
27 } BerValue, *BerVarray;
28
29 typedef struct berelement BerElement;
30
31 void ber_bvfree(struct berval *bv);
32
33 void ber_bvecfree(struct berval **bvec);
34
35 void ber_bvecadd(struct berval ***bvec, struct berval *bv);
36
37 void ber_bvarray_free(struct berval *bvarray);
38
39 void ber_bvarray_add(BerVarray *bvarray, BerValue *bv);
40
41 struct berval *ber_bvdup(const struct berval *bv);
42
43 struct berval *ber_dupbv(const struct berval *dst, struct berval *src);
44
45 struct berval *ber_bvstr(const char *str);
46
47 struct berval *ber_bvstrdup(const char *str);
48
49 struct berval *ber_str2bv(const char *str, ber_len_t len, int dup,
50 struct berval *bv);
51
52 void ber_free(BerElement *ber, int freebuf);
53
55 The following are the basic types and structures defined for use with
56 the Lightweight BER library.
57
58 ber_int_t is a signed integer of at least 32 bits. It is commonly
59 equivalent to int. ber_uint_t is the unsigned variant of ber_int_t.
60
61 ber_len_t is an unsigned integer of at least 32 bits used to represent
62 a length. It is commonly equivalent to a size_t. ber_slen_t is the
63 signed variant to ber_len_t.
64
65 ber_tag_t is an unsigned integer of at least 32 bits used to represent
66 a BER tag. It is commonly equivalent to a unsigned long.
67
68 The actual definitions of the integral impl_TYPE_t types are platform
69 specific.
70
71 BerValue, commonly used as struct berval, is used to hold an arbitrary
72 sequence of octets. bv_val points to bv_len octets. bv_val is not
73 necessarily terminated by a NUL (zero) octet. ber_bvfree() frees a
74 BerValue, pointed to by bv, returned from this API. If bv is NULL, the
75 routine does nothing.
76
77 ber_bvecfree() frees an array of BerValues (and the array), pointed to
78 by bvec, returned from this API. If bvec is NULL, the routine does
79 nothing. ber_bvecadd() appends the bv pointer to the bvec array.
80 Space for the array is allocated as needed. The end of the array is
81 marked by a NULL pointer.
82
83 ber_bvarray_free() frees an array of BerValues (and the array), pointed
84 to by bvarray, returned from this API. If bvarray is NULL, the routine
85 does nothing. ber_bvarray_add() appends the contents of the BerValue
86 pointed to by bv to the bvarray array. Space for the new element is
87 allocated as needed. The end of the array is marked by a BerValue with
88 a NULL bv_val field.
89
90 ber_bvdup() returns a copy of a BerValue. The routine returns NULL
91 upon error (e.g. out of memory). The c