r20420: create infrastructure to convert attribute values from drsuapi to ldb
[amitay/samba.git] / source4 / dsdb / schema / schema.h
1 /* 
2    Unix SMB/CIFS mplementation.
3    DSDB schema header
4    
5    Copyright (C) Stefan Metzmacher 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 2 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, write to the Free Software
19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20    
21 */
22
23 #ifndef _DSDB_SCHEMA_H
24 #define _DSDB_SCHEMA_H
25
26 struct dsdb_attribute;
27 struct dsdb_class;
28 struct dsdb_schema;
29
30 struct dsdb_syntax {
31         const char *name;
32         const char *ldap_oid;
33         uint32_t oMSyntax;
34         struct ldb_val oMObjectClass;
35         const char *attributeSyntax_oid;
36
37         WERROR (*drsuapi_to_ldb)(const struct dsdb_schema *schema,
38                                  const struct dsdb_attribute *attr,
39                                  const struct drsuapi_DsReplicaAttribute *in,
40                                  TALLOC_CTX *mem_ctx,
41                                  struct ldb_message_element *out);
42         WERROR (*ldb_to_drsuapi)(const struct dsdb_schema *schema,
43                                  const struct dsdb_attribute *attr,
44                                  const struct ldb_message_element *in,
45                                  TALLOC_CTX *mem_ctx,
46                                  struct drsuapi_DsReplicaAttribute *out);
47 };
48
49 struct dsdb_attribute {
50         struct dsdb_attribute *prev, *next;
51
52         const char *cn;
53         const char *lDAPDisplayName;
54         const char *attributeID_oid;
55         uint32_t attributeID_id;
56         struct GUID schemaIDGUID;
57         uint32_t mAPIID;
58
59         struct GUID attributeSecurityGUID;
60
61         uint32_t searchFlags;
62         uint32_t systemFlags;
63         BOOL isMemberOfPartialAttributeSet;
64         uint32_t linkID;
65
66         const char *attributeSyntax_oid;
67         uint32_t attributeSyntax_id;
68         uint32_t oMSyntax;
69         struct ldb_val oMObjectClass;
70
71         BOOL isSingleValued;
72         uint32_t rangeLower;
73         uint32_t rangeUpper;
74         BOOL extendedCharsAllowed;
75
76         uint32_t schemaFlagsEx;
77         struct ldb_val msDs_Schema_Extensions;
78
79         BOOL showInAdvancedViewOnly;
80         const char *adminDisplayName;
81         const char *adminDescription;
82         const char *classDisplayName;
83         BOOL isEphemeral;
84         BOOL isDefunct;
85         BOOL systemOnly;
86
87         /* internal stuff */
88         const struct dsdb_syntax *syntax;
89 };
90
91 struct dsdb_class {
92         struct dsdb_class *prev, *next;
93
94         const char *cn;
95         const char *lDAPDisplayName;
96         const char *governsID_oid;
97         uint32_t governsID_id;
98         struct GUID schemaIDGUID;
99
100         uint32_t objectClassCategory;
101         const char *rDNAttID;
102         const char *defaultObjectCategory;
103
104         const char *subClassOf;
105
106         const char **systemAuxiliaryClass;
107         const char **systemPossSuperiors;
108         const char **systemMustContain;
109         const char **systemMayContain;
110
111         const char **auxiliaryClass;
112         const char **possSuperiors;
113         const char **mustContain;
114         const char **mayContain;
115
116         const char *defaultSecurityDescriptor;
117
118         uint32_t schemaFlagsEx;
119         struct ldb_val msDs_Schema_Extensions;
120
121         BOOL showInAdvancedViewOnly;
122         const char *adminDisplayName;
123         const char *adminDescription;
124         const char *classDisplayName;
125         BOOL defaultHidingValue;
126         BOOL isDefunct;
127         BOOL systemOnly;
128 };
129
130 struct dsdb_schema_oid_prefix {
131         uint32_t id;
132         const char *oid;
133         size_t oid_len;
134 };
135
136 struct dsdb_schema {
137         uint32_t num_prefixes;
138         struct dsdb_schema_oid_prefix *prefixes;
139
140         /* 
141          * the last element of the prefix mapping table isn't a oid,
142          * it starts with 0xFF and has 21 bytes and is maybe a schema
143          * version number
144          *
145          * this is the content of the schemaInfo attribute of the
146          * Schema-Partition head object.
147          */
148         const char *schema_info;
149
150         struct dsdb_attribute *attributes;
151         struct dsdb_class *classes;
152 };
153
154 #endif /* _DSDB_SCHEMA_H */