2 ldb database library - map backend
4 Copyright (C) Jelmer Vernooij 2005
6 ** NOTE! The following LGPL license applies to the ldb
7 ** library. This does NOT imply that all of Samba is released
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 2 of the License, or (at your option) any later version.
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.
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 /* ldb_map is a skeleton LDB module that can be used for any other modules
29 * that need to map attributes.
31 * The term 'remote' in this header refers to the connection where the
32 * original schema is used on while 'local' means the local connection
33 * that any upper layers will use.
35 * All local attributes will have to have a definition. Not all remote
36 * attributes need a definition as LDB is a lot less stricter then LDAP
37 * (in other words, sending unknown attributes to an LDAP server hurts us,
38 * returning too much attributes in ldb_search() doesn't)
41 struct ldb_map_attribute
43 const char *local_name; /* local name */
46 MAP_IGNORE, /* Ignore this local attribute. Doesn't exist remotely. */
47 MAP_KEEP, /* Keep as is */
48 MAP_RENAME, /* Simply rename the attribute. Name changes, data is the same */
49 MAP_CONVERT, /* Rename + convert data */
50 MAP_GENERATE /* Use generate function for generating new name/data.
51 Used for generating attributes based on
52 multiple remote attributes. */
55 /* if set, will be called for expressions that contain this attribute */
56 struct ldb_parse_tree *(*convert_operator) (TALLOC_CTX *ctx, const struct ldb_parse_tree *);
60 const char *remote_name;
64 const char *remote_name;
66 struct ldb_message_element *(*convert_local) (
68 const char *remote_attr,
69 const struct ldb_message_element *);
71 struct ldb_message_element *(*convert_remote) (
73 const char *local_attr,
74 const struct ldb_message_element *);
78 /* Generate the local attribute from remote message */
79 struct ldb_message_element *(*generate_local) (
82 const struct ldb_message *remote);
84 /* Update remote message with information from local message */
85 void (*generate_remote) (
86 const char *local_attr,
87 const struct ldb_message *local,
88 struct ldb_message *remote);
90 /* Name(s) for this attribute on the remote server. This is an array since
91 * one local attribute's data can be split up into several attributes
93 #define LDB_MAP_MAX_REMOTE_NAMES 10
94 const char *remote_names[LDB_MAP_MAX_REMOTE_NAMES];
99 struct ldb_map_objectclass
101 const char *local_name;
102 const char *remote_name;
105 #endif /* __LDB_MAP_H__ */