summaryrefslogtreecommitdiffstats
path: root/contrib/ldapc++/src/LDAPSchema.h
blob: c55c9afc3c384a5b37615f3b475a7e552fec1f4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// $OpenLDAP$
/*
 * Copyright 2003-2022 The OpenLDAP Foundation, All Rights Reserved.
 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
 */

#ifndef LDAP_SCHEMA_H
#define LDAP_SCHEMA_H

#include <string>
#include <map>

#include "LDAPObjClass.h"
#include "LDAPAttrType.h"

/**
 * Represents the LDAP schema
 */
class LDAPSchema{
    private :
	/**
	 * map of object classes: index is name, value is LDAPObjClass object
	 */
	map <string, LDAPObjClass> object_classes;
	
	/**
	 * map of attribute types: index is name, value is LDAPAttrType object
	 */
	map <string, LDAPAttrType> attr_types;

    public :

        /**
         * Constructs an empty object
         */   
        LDAPSchema();

        /**
         * Destructor
         */
        virtual ~LDAPSchema();
	
        /**
         * Fill the object_classes map
	 * @param oc description of one objectclass (string returned by search
	 * command), in form:
	 * "( 1.2.3.4.5 NAME '<name>' SUP <supname> STRUCTURAL
	 *    DESC '<description>' MUST ( <attrtype> ) MAY ( <attrtype> ))"
         */
	void setObjectClasses (const StringList &oc);

	 /**
         * Fill the attr_types map
	 * @param at description of one attribute type
	 *  (string returned by search command), in form:
	 * "( 1.2.3.4.6 NAME ( '<name>' ) DESC '<desc>'
	 *    EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )"
         */
	void setAttributeTypes (const StringList &at);

	/**
	 * Returns object class object with given name
	 */
	LDAPObjClass getObjectClassByName (std::string name);
	
	/**
	 * Returns attribute type object with given name
	 */
	LDAPAttrType getAttributeTypeByName (string name);

};

#endif // LDAP_SCHEMA_H