Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   ber_first_element    ( 3 )

OpenLDAP LBER библиотечные подпрограммы базовых правил декодирования (OpenLDAP LBER simplified Basic Encoding Rules library routines for decoding)

  Name  |  Library  |  Synopsis  |  Description  |    Examples    |  Error  |  Note  |  See also  |

Примеры (Examples)

Assume the variable ber contains a lightweight BER encoding of
       the following ASN.1 object:

AlmostASearchRequest := SEQUENCE { baseObject DistinguishedName, scope ENUMERATED { baseObject (0), singleLevel (1), wholeSubtree (2) }, derefAliases ENUMERATED { neverDerefaliases (0), derefInSearching (1), derefFindingBaseObj (2), alwaysDerefAliases (3) }, sizelimit INTEGER (0 .. 65535), timelimit INTEGER (0 .. 65535), attrsOnly BOOLEAN, attributes SEQUENCE OF AttributeType }

The element can be decoded using ber_scanf() as follows.

ber_int_t scope, deref, size, time, attrsonly; char *dn, **attrs; ber_tag_t tag;

tag = ber_scanf( ber, "{aeeiib{v}}", &dn, &scope, &deref, &size, &time, &attrsonly, &attrs );

if( tag == LBER_ERROR ) { /* error */ } else { /* success */ }

ber_memfree( dn ); ber_memvfree( attrs );