diff options
| author | David M. Syzdek <david@syzdek.net> | 2019-10-23 20:36:57 -0800 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2019-10-23 20:36:57 -0800 |
| commit | d95cad512274d499e044008226d8c032c1a15a16 (patch) | |
| tree | b1f39ad31242f75c4cb98f97b76bbf2ecda4c31e /include/ldapschema.h | |
| parent | 2e72f01b448b04d831baddcf9fe2d6e610cdf715 (diff) | |
| download | ldap-utils-d95cad512274d499e044008226d8c032c1a15a16.tar.gz ldap-utils-d95cad512274d499e044008226d8c032c1a15a16.tar.bz2 ldap-utils-d95cad512274d499e044008226d8c032c1a15a16.tar.xz ldap-utils-d95cad512274d499e044008226d8c032c1a15a16.zip | |
libldapschema: expanding libldapschema framework
Diffstat (limited to 'include/ldapschema.h')
| -rw-r--r-- | include/ldapschema.h | 66 |
1 files changed, 57 insertions, 9 deletions
diff --git a/include/ldapschema.h b/include/ldapschema.h index c636f97..fac2d19 100644 --- a/include/ldapschema.h +++ b/include/ldapschema.h | |||
| @@ -112,6 +112,7 @@ | |||
| 112 | // result codes | 112 | // result codes |
| 113 | #define LDAPSCHEMA_SUCCESS 0x00 ///< operation was successful | 113 | #define LDAPSCHEMA_SUCCESS 0x00 ///< operation was successful |
| 114 | #define LDAPSCHEMA_INVALID_DEFINITION 0x7001 ///< invalid defintion | 114 | #define LDAPSCHEMA_INVALID_DEFINITION 0x7001 ///< invalid defintion |
| 115 | #define LDAPSCHEMA_DUPLICATE 0x7002 ///< duplicate defintion | ||
| 115 | #define LDAPSCHEMA_NO_MEMORY (-10) ///< an memory allocation failed | 116 | #define LDAPSCHEMA_NO_MEMORY (-10) ///< an memory allocation failed |
| 116 | 117 | ||
| 117 | // model flags | 118 | // model flags |
| @@ -135,10 +136,16 @@ | |||
| 135 | #define LDAPSCHEMA_DSA_OP 0x0003 ///< AttributeType usage DSA Operation | 136 | #define LDAPSCHEMA_DSA_OP 0x0003 ///< AttributeType usage DSA Operation |
| 136 | 137 | ||
| 137 | // LDAP schema data type | 138 | // LDAP schema data type |
| 138 | #define LDAPSCHEMA_SYNTAX 0x0001 | 139 | #define LDAPSCHEMA_TYPE_MASK 0xF000 |
| 139 | #define LDAPSCHEMA_MATCHINGRULE 0x0002 | 140 | #define LDAPSCHEMA_SUBTYPE_MASK 0x000F |
| 140 | #define LDAPSCHEMA_ATTRIBUTETYPE 0x0003 | 141 | #define LDAPSCHEMA_SYNTAX 0x1000 |
| 141 | #define LDAPSCHEMA_OBJECTCLASS 0x0004 | 142 | #define LDAPSCHEMA_MATCHINGRULE 0x2000 |
| 143 | #define LDAPSCHEMA_ATTRIBUTETYPE 0x3000 | ||
| 144 | #define LDAPSCHEMA_OBJECTCLASS 0x4000 | ||
| 145 | #define LDAPSCHEMA_TYPE( val ) (val & LDAPSCHEMA_TYPE_MASK ) | ||
| 146 | #define LDAPSCHEMA_SUBTYPE( val ) (val & LDAPSCHEMA_SUBTYPE_MASK ) | ||
| 147 | #define LDAPSCHEMA_IS_TYPE( val, type ) ( LDAPSCHEMA_TYPE(val) == type ) | ||
| 148 | #define LDAPSCHEMA_IS_SUBTYPE( val, type ) ( LDAPSCHEMA_SUBTYPE_MASK(val) == type ) | ||
| 142 | 149 | ||
| 143 | 150 | ||
| 144 | ///////////////// | 151 | ///////////////// |
| @@ -163,6 +170,9 @@ typedef struct ldap_schema_attributetype LDAPSchemaAttributeType; | |||
| 163 | 170 | ||
| 164 | typedef struct ldap_schema_matchingrule LDAPSchemaMatchingRule; | 171 | typedef struct ldap_schema_matchingrule LDAPSchemaMatchingRule; |
| 165 | 172 | ||
| 173 | typedef struct ldap_schema_extension LDAPSchemaExtension; | ||
| 174 | |||
| 175 | |||
| 166 | enum ldap_schema_syntax_class | 176 | enum ldap_schema_syntax_class |
| 167 | { | 177 | { |
| 168 | LDAPSchemaSyntaxUnknown = 0, | 178 | LDAPSchemaSyntaxUnknown = 0, |
| @@ -178,15 +188,26 @@ enum ldap_schema_syntax_class | |||
| 178 | }; | 188 | }; |
| 179 | typedef enum ldap_schema_syntax_class LDAPSchemaSyntaxClass; | 189 | typedef enum ldap_schema_syntax_class LDAPSchemaSyntaxClass; |
| 180 | 190 | ||
| 191 | /// LDAP schema extension | ||
| 192 | struct ldap_schema_extension | ||
| 193 | { | ||
| 194 | char * extension; | ||
| 195 | char ** values; | ||
| 196 | size_t values_len; | ||
| 197 | }; | ||
| 198 | |||
| 199 | |||
| 181 | /// LDAP schema base data model | 200 | /// LDAP schema base data model |
| 182 | struct ldap_schema_model | 201 | struct ldap_schema_model |
| 183 | { | 202 | { |
| 203 | size_t size; ///< size of data struct | ||
| 204 | uint32_t type; ///< LDAP schema data type | ||
| 205 | uint32_t flags; | ||
| 184 | char * definition; ///< defintion of object | 206 | char * definition; ///< defintion of object |
| 185 | char * oid; ///< oid of object | 207 | char * oid; ///< oid of object |
| 186 | char * desc; ///< description of object | 208 | char * desc; ///< description of object; |
| 187 | int type; ///< LDAP schema data type | 209 | LDAPSchemaExtension ** extensions; |
| 188 | int pad0; | 210 | size_t extensions_len; |
| 189 | size_t size; ///< size of data struct | ||
| 190 | }; | 211 | }; |
| 191 | 212 | ||
| 192 | /// LDAP schema syntax | 213 | /// LDAP schema syntax |
| @@ -266,6 +287,17 @@ ldapschema_errno( | |||
| 266 | 287 | ||
| 267 | 288 | ||
| 268 | //-----------------// | 289 | //-----------------// |
| 290 | // LDAP functions // | ||
| 291 | //-----------------// | ||
| 292 | #pragma mark LDAP functions | ||
| 293 | |||
| 294 | int | ||
| 295 | ldapschema_fetch( | ||
| 296 | LDAPSchema * lsd, | ||
| 297 | LDAP * ld ); | ||
| 298 | |||
| 299 | |||
| 300 | //-----------------// | ||
| 269 | // lexer functions // | 301 | // lexer functions // |
| 270 | //-----------------// | 302 | //-----------------// |
| 271 | #pragma mark lexer functions | 303 | #pragma mark lexer functions |
| @@ -283,7 +315,7 @@ ldapschema_parse_syntax( | |||
| 283 | 315 | ||
| 284 | //------------------// | 316 | //------------------// |
| 285 | // memory functions // | 317 | // memory functions // |
| 286 | //-------=----------// | 318 | //------------------// |
| 287 | #pragma mark memory functions | 319 | #pragma mark memory functions |
| 288 | 320 | ||
| 289 | _LDAPSCHEMA_F int | 321 | _LDAPSCHEMA_F int |
| @@ -311,5 +343,21 @@ ldapschema_value_free_len( | |||
| 311 | struct berval ** vals ); | 343 | struct berval ** vals ); |
| 312 | 344 | ||
| 313 | 345 | ||
| 346 | //----------------// | ||
| 347 | // sort functions // | ||
| 348 | //----------------// | ||
| 349 | #pragma mark sort functions | ||
| 350 | |||
| 351 | _LDAPSCHEMA_F int | ||
| 352 | ldapschema_model_cmp( | ||
| 353 | const void * m1, | ||
| 354 | const void * m2 ); | ||
| 355 | |||
| 356 | _LDAPSCHEMA_F int | ||
| 357 | ldapschema_syntax_cmp( | ||
| 358 | const LDAPSchemaSyntax * s1, | ||
| 359 | const LDAPSchemaSyntax * s2 ); | ||
| 360 | |||
| 361 | |||
| 314 | LDAPSCHEMA_END_C_DECLS | 362 | LDAPSCHEMA_END_C_DECLS |
| 315 | #endif /* end of header */ | 363 | #endif /* end of header */ |
