~james-page/ubuntu/maverick/openldap/fix-666028

« back to all changes in this revision

Viewing changes to include/lber.h

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2010-02-18 00:58:13 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100218005813-8230cn0y207m8wzy
Tags: 2.4.21-0ubuntu1
* New upstream release.
* debian/rules, debian/schema/extra/: 
  Fix get-orig-source rule to supports extra schemas shipped as part of the
  debian/schema/ directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $OpenLDAP: pkg/ldap/include/lber.h,v 1.99.2.8 2009/08/13 00:56:58 quanah Exp $ */
 
1
/* $OpenLDAP: pkg/ldap/include/lber.h,v 1.99.2.11 2009/12/02 16:54:36 quanah Exp $ */
2
2
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3
3
 *
4
4
 * Copyright 1998-2009 The OpenLDAP Foundation.
31
31
 
32
32
LDAP_BEGIN_DECL
33
33
 
34
 
/* Overview of LBER tag construction
35
 
 *
36
 
 *      Bits
 
34
/*
 
35
 * ber_tag_t represents the identifier octets at the beginning of BER
 
36
 * elements.  OpenLDAP treats them as mere big-endian unsigned integers.
 
37
 *
 
38
 * Actually the BER identifier octets look like this:
 
39
 *
 
40
 *      Bits of 1st octet:
37
41
 *      ______
38
42
 *      8 7 | CLASS
39
43
 *      0 0 = UNIVERSAL
46
50
 *                1 = CONSTRUCTED
47
51
 *                      ___________
48
52
 *                      | 5 ... 1 | TAG-NUMBER
 
53
 *
 
54
 *  For ASN.1 tag numbers >= 0x1F, TAG-NUMBER above is 0x1F and the next
 
55
 *  BER octets contain the actual ASN.1 tag number:  Big-endian, base
 
56
 *  128, 8.bit = 1 in all but the last octet, minimum number of octets.
49
57
 */
50
58
 
51
 
/* BER classes and mask */
 
59
/* BER classes and mask (in 1st identifier octet) */
52
60
#define LBER_CLASS_UNIVERSAL    ((ber_tag_t) 0x00U)
53
61
#define LBER_CLASS_APPLICATION  ((ber_tag_t) 0x40U)
54
62
#define LBER_CLASS_CONTEXT              ((ber_tag_t) 0x80U)
55
63
#define LBER_CLASS_PRIVATE              ((ber_tag_t) 0xc0U)
56
64
#define LBER_CLASS_MASK                 ((ber_tag_t) 0xc0U)
57
65
 
58
 
/* BER encoding type and mask */
 
66
/* BER encoding type and mask (in 1st identifier octet) */
59
67
#define LBER_PRIMITIVE                  ((ber_tag_t) 0x00U)
60
68
#define LBER_CONSTRUCTED                ((ber_tag_t) 0x20U)
61
69
#define LBER_ENCODING_MASK              ((ber_tag_t) 0x20U)
64
72
#define LBER_MORE_TAG_MASK              ((ber_tag_t) 0x80U)
65
73
 
66
74
/*
67
 
 * Note that LBER_ERROR and LBER_DEFAULT are values that can never appear
68
 
 * as valid BER tags, and so it is safe to use them to report errors.  In
69
 
 * fact, any tag for which the following is true is invalid:
 
75
 * LBER_ERROR and LBER_DEFAULT are values that can never appear
 
76
 * as valid BER tags, so it is safe to use them to report errors.
 
77
 * Valid tags have (tag & (ber_tag_t) 0xFF) != 0xFF.
70
78
 */
71
 
#define LBER_INVALID(t)     (((t) & (ber_tag_t) 0x080UL) \
72
 
        && (((t) & (ber_tag_t) ~ 0x0FF))
73
 
 
74
79
#define LBER_ERROR                      ((ber_tag_t) -1)
75
80
#define LBER_DEFAULT            ((ber_tag_t) -1)
76
81
 
278
283
 
279
284
#define LBER_BV_ALLOC   0x01    /* allocate/copy result, otherwise in-place */
280
285
#define LBER_BV_NOTERM  0x02    /* omit NUL-terminator if parsing in-place */
 
286
#define LBER_BV_STRING  0x04    /* fail if berval contains embedded \0 */
 
287
/* LBER_BV_STRING currently accepts a terminating \0 in the berval, because
 
288
 * Active Directory sends that in at least the diagonsticMessage field.
 
289
 */
281
290
 
282
291
LBER_F( ber_tag_t )
283
292
ber_get_stringbv LDAP_P((