VMS Help LDAP, Encoded ASN.1 *Conan The Librarian |
LDAP contains functions that may be used to encode and decode BER-encoded ASN.1 values, which are often used inside of control and extension values. The following additional integral types are defined for use in manipulation of BER encoded ASN.1 values: typedef unsigned long ber_tag_t; /* for BER tags */ typedef long ber_int_t; /* for BER ints, enums, and Booleans */ With the exceptions of two new functions, ber_flatten() and ber_ init(), these functions are compatible with the University of Michigan LDAP 3.3 implementation of BER. typedef struct berval { ber_len_t bv_len; char *bv_val; } BerValue; A struct berval contains a sequence of bytes and an indication of its length. The bv_val is not null terminated. A bv_len must always be a nonnegative number. Applications may allocate their own berval structures. typedef struct berelement { /* opaque */ } BerElement; The BerElement structure contains not only a copy of the encoded value, but also state information used in encoding or decoding. Applications cannot allocate their own BerElement structures. The internal state is neither thread-specific nor locked, so two threads should not manipulate the same BerElement value simultaneously. A single BerElement value cannot be used for both encoding and decoding. void ber_bvfree( struct berval *bv ); The ber_bvfree() function frees a berval returned from this API. Both the bv->bv_val string and the berval itself are freed. Applications should not use ber_bvfree() with bervals which the application has allocated. void ber_bvecfree ( struct berval **bv ); The ber_bvecfree() function frees an array of bervals returned from this API. Each of the bervals in the array are freed using ber_bvfree(), then the array itself is freed. struct berval *ber_bvdup (struct berval *bv ); The ber_bvdup() function returns a copy of a berval. The bv_val field in the returned berval points to a different area of memory as the bv_val field in the argument berval. The null pointer is returned on error (for example, out of memory). void ber_free ( BerElement *ber, int fbuf ); The ber_free() function frees a BerElement which is returned from the API calls ber_alloc_t() or ber_init(). Each BerElement must be freed by the caller. The second argument fbuf should always be set to 1 to ensure that the internal buffer used by the BER functions is freed as well as the BerElement container itself.
Additional Information (explode) :
|