s3-talloc Change TALLOC_ZERO_P() to talloc_zero()
[nivanova/samba-autobuild/.git] / source3 / lib / ldb_compat.h
1 /* 
2    ldb database library
3
4    Copyright (C) Andrew Tridgell  2004
5
6      ** NOTE! The following LGPL license applies to the ldb
7      ** library. This does NOT imply that all of Samba is released
8      ** under the LGPL
9    
10    This library is free software; you can redistribute it and/or
11    modify it under the terms of the GNU Lesser General Public
12    License as published by the Free Software Foundation; either
13    version 3 of the License, or (at your option) any later version.
14
15    This library is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    Lesser General Public License for more details.
19
20    You should have received a copy of the GNU Lesser General Public
21    License along with this library; if not, see <http://www.gnu.org/licenses/>.
22 */
23
24 #ifndef __LDB_COMPAT_H__
25 #define __LDB_COMPAT_H__
26
27 char *ldb_binary_encode(void *mem_ctx, struct ldb_val val);
28 struct ldb_parse_tree *ldb_parse_tree(void *mem_ctx, const char *s);
29
30 /*
31    structures for ldb_parse_tree handling code
32 */
33 enum ldb_parse_op { LDB_OP_AND=1, LDB_OP_OR=2, LDB_OP_NOT=3,
34                     LDB_OP_EQUALITY=4, LDB_OP_SUBSTRING=5,
35                     LDB_OP_GREATER=6, LDB_OP_LESS=7, LDB_OP_PRESENT=8,
36                     LDB_OP_APPROX=9, LDB_OP_EXTENDED=10 };
37
38 struct ldb_parse_tree {
39         enum ldb_parse_op operation;
40         union {
41                 struct {
42                         struct ldb_parse_tree *child;
43                 } isnot;
44                 struct {
45                         const char *attr;
46                         struct ldb_val value;
47                 } equality;
48                 struct {
49                         const char *attr;
50                         int start_with_wildcard;
51                         int end_with_wildcard;
52                         struct ldb_val **chunks;
53                 } substring;
54                 struct {
55                         const char *attr;
56                 } present;
57                 struct {
58                         const char *attr;
59                         struct ldb_val value;
60                 } comparison;
61                 struct {
62                         const char *attr;
63                         int dnAttributes;
64                         char *rule_id;
65                         struct ldb_val value;
66                 } extended;
67                 struct {
68                         unsigned int num_elements;
69                         struct ldb_parse_tree **elements;
70                 } list;
71         } u;
72 };
73
74 struct ldb_message_element {
75         unsigned int flags;
76         const char *name;
77         unsigned int num_values;
78         struct ldb_val *values;
79 };
80
81 struct ldb_control {
82         const char *oid;
83         int critical;
84         void *data;
85 };
86
87 #endif