1// $OpenLDAP$ 2/* 3 * Copyright 2003-2011 The OpenLDAP Foundation, All Rights Reserved. 4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file 5 */ 6 7#ifndef LDAP_SCHEMA_H 8#define LDAP_SCHEMA_H 9 10#include <string> 11#include <map> 12 13#include "LDAPObjClass.h" 14#include "LDAPAttrType.h" 15 16/** 17 * Represents the LDAP schema 18 */ 19class LDAPSchema{ 20 private : 21 /** 22 * map of object classes: index is name, value is LDAPObjClass object 23 */ 24 map <string, LDAPObjClass> object_classes; 25 26 /** 27 * map of attribute types: index is name, value is LDAPAttrType object 28 */ 29 map <string, LDAPAttrType> attr_types; 30 31 public : 32 33 /** 34 * Constructs an empty object 35 */ 36 LDAPSchema(); 37 38 /** 39 * Destructor 40 */ 41 virtual ~LDAPSchema(); 42 43 /** 44 * Fill the object_classes map 45 * @param oc description of one objectclass (string returned by search 46 * command), in form: 47 * "( 1.2.3.4.5 NAME '<name>' SUP <supname> STRUCTURAL 48 * DESC '<description>' MUST ( <attrtype> ) MAY ( <attrtype> ))" 49 */ 50 void setObjectClasses (const StringList &oc); 51 52 /** 53 * Fill the attr_types map 54 * @param at description of one attribute type 55 * (string returned by search command), in form: 56 * "( 1.2.3.4.6 NAME ( '<name>' ) DESC '<desc>' 57 * EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )" 58 */ 59 void setAttributeTypes (const StringList &at); 60 61 /** 62 * Returns object class object with given name 63 */ 64 LDAPObjClass getObjectClassByName (std::string name); 65 66 /** 67 * Returns attribute type object with given name 68 */ 69 LDAPAttrType getAttributeTypeByName (string name); 70 71}; 72 73#endif // LDAP_SCHEMA_H 74