Merge the two attribute syntax tables.
[samba.git] / source4 / dsdb / schema / schema.h
1 /* 
2    Unix SMB/CIFS mplementation.
3    DSDB schema header
4    
5    Copyright (C) Stefan Metzmacher <metze@samba.org> 2006
6     
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19    
20 */
21
22 #ifndef _DSDB_SCHEMA_H
23 #define _DSDB_SCHEMA_H
24
25 struct dsdb_attribute;
26 struct dsdb_class;
27 struct dsdb_schema;
28
29 struct dsdb_syntax {
30         const char *name;
31         const char *ldap_oid;
32         uint32_t oMSyntax;
33         struct ldb_val oMObjectClass;
34         const char *attributeSyntax_oid;
35         const char *equality;
36         const char *substring;
37         const char *comment;
38
39         WERROR (*drsuapi_to_ldb)(const struct dsdb_schema *schema,
40                                  const struct dsdb_attribute *attr,
41                                  const struct drsuapi_DsReplicaAttribute *in,
42                                  TALLOC_CTX *mem_ctx,
43                                  struct ldb_message_element *out);
44         WERROR (*ldb_to_drsuapi)(const struct dsdb_schema *schema,
45                                  const struct dsdb_attribute *attr,
46                                  const struct ldb_message_element *in,
47                                  TALLOC_CTX *mem_ctx,
48                                  struct drsuapi_DsReplicaAttribute *out);
49 };
50
51 struct dsdb_attribute {
52         struct dsdb_attribute *prev, *next;
53
54         const char *cn;
55         const char *lDAPDisplayName;
56         const char *attributeID_oid;
57         uint32_t attributeID_id;
58         struct GUID schemaIDGUID;
59         uint32_t mAPIID;
60
61         struct GUID attributeSecurityGUID;
62
63         uint32_t searchFlags;
64         uint32_t systemFlags;
65         bool isMemberOfPartialAttributeSet;
66         uint32_t linkID;
67
68         const char *attributeSyntax_oid;
69         uint32_t attributeSyntax_id;
70         uint32_t oMSyntax;
71         struct ldb_val oMObjectClass;
72
73         bool isSingleValued;
74         uint32_t rangeLower;
75         uint32_t rangeUpper;
76         bool extendedCharsAllowed;
77
78         uint32_t schemaFlagsEx;
79         struct ldb_val msDs_Schema_Extensions;
80
81         bool showInAdvancedViewOnly;
82         const char *adminDisplayName;
83         const char *adminDescription;
84         const char *classDisplayName;
85         bool isEphemeral;
86         bool isDefunct;
87         bool systemOnly;
88
89         /* internal stuff */
90         const struct dsdb_syntax *syntax;
91 };
92
93 struct dsdb_class {
94         struct dsdb_class *prev, *next;
95
96         const char *cn;
97         const char *lDAPDisplayName;
98         const char *governsID_oid;
99         uint32_t governsID_id;
100         struct GUID schemaIDGUID;
101
102         uint32_t objectClassCategory;
103         const char *rDNAttID;
104         const char *defaultObjectCategory;
105
106         const char *subClassOf;
107
108         const char **systemAuxiliaryClass;
109         const char **systemPossSuperiors;
110         const char **systemMustContain;
111         const char **systemMayContain;
112
113         const char **auxiliaryClass;
114         const char **possSuperiors;
115         const char **mustContain;
116         const char **mayContain;
117         const char **possibleInferiors;
118
119         const char *defaultSecurityDescriptor;
120
121         uint32_t schemaFlagsEx;
122         struct ldb_val msDs_Schema_Extensions;
123
124         bool showInAdvancedViewOnly;
125         const char *adminDisplayName;
126         const char *adminDescription;
127         const char *classDisplayName;
128         bool defaultHidingValue;
129         bool isDefunct;
130         bool systemOnly;
131 };
132
133 struct dsdb_schema_oid_prefix {
134         uint32_t id;
135         const char *oid;
136         size_t oid_len;
137 };
138
139 struct dsdb_schema {
140         uint32_t num_prefixes;
141         struct dsdb_schema_oid_prefix *prefixes;
142
143         /* 
144          * the last element of the prefix mapping table isn't a oid,
145          * it starts with 0xFF and has 21 bytes and is maybe a schema
146          * version number
147          *
148          * this is the content of the schemaInfo attribute of the
149          * Schema-Partition head object.
150          */
151         const char *schema_info;
152
153         struct dsdb_attribute *attributes;
154         struct dsdb_class *classes;
155
156         struct {
157                 bool we_are_master;
158                 struct ldb_dn *master_dn;
159         } fsmo;
160
161         struct smb_iconv_convenience *iconv_convenience;
162 };
163
164 enum dsdb_attr_list_query {
165         DSDB_SCHEMA_ALL_MAY,
166         DSDB_SCHEMA_ALL_MUST,
167         DSDB_SCHEMA_SYS_MAY,
168         DSDB_SCHEMA_SYS_MUST,
169         DSDB_SCHEMA_MAY,
170         DSDB_SCHEMA_MUST,
171         DSDB_SCHEMA_ALL
172 };
173
174 enum dsdb_schema_convert_target {
175         TARGET_OPENLDAP,
176         TARGET_FEDORA_DS,
177         TARGET_AD_SCHEMA_SUBENTRY
178 };
179
180 #include "dsdb/schema/proto.h"
181
182 #endif /* _DSDB_SCHEMA_H */