2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2008-2017 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
11 * A copy of this license is available in the file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
16 * This work was initially developed by Howard Chu for inclusion
17 * in OpenLDAP Software. This work was sponsored by MySQL.
30 /* The general design is to use one relational table per objectclass. This is
31 * complicated by objectclass inheritance and auxiliary classes though.
33 * Attributes must only occur in a single table. For objectclasses that inherit
34 * from other classes, attributes defined in the superior class are only stored
35 * in the superior class' table. When multiple unrelated classes define the same
36 * attributes, an attributeSet should be defined instead, containing all of the
39 * The no_set table lists which other attributeSets apply to the current
40 * objectClass. The no_attrs table lists all of the non-inherited attributes of
41 * the class, including those residing in an attributeSet.
43 * Usually the table is named identically to the objectClass, but it can also
44 * be explicitly named something else if needed.
46 #define NDB_MAX_OCSETS 8
50 typedef struct ndb_ocinfo {
51 struct berval no_name; /* objectclass cname */
52 struct berval no_table;
54 struct ndb_ocinfo *no_sets[NDB_MAX_OCSETS];
55 struct ndb_attrinfo **no_attrs;
61 #define NDB_INFO_ATLEN 0x01
62 #define NDB_INFO_ATSET 0x02
63 #define NDB_INFO_INDEX 0x04
64 #define NDB_INFO_ATBLOB 0x08
66 typedef struct ndb_attrinfo {
67 struct berval na_name; /* attribute cname */
68 AttributeDescription *na_desc;
69 AttributeType *na_attr;
77 typedef struct ListNode {
78 struct ListNode *ln_next;
82 #define NDB_IS_OPEN(ni) (ni->ni_cluster != NULL)
88 Ndb_cluster_connection **ni_cluster;
90 /* MySQL connection parameters */
96 unsigned long ni_clflag;
99 /* Search filter processing */
100 int ni_search_stack_depth;
101 void *ni_search_stack;
103 #define DEFAULT_SEARCH_STACK_DEPTH 16
104 #define MINIMUM_SEARCH_STACK_DEPTH 8
107 NdbOcInfo *ni_opattrs;
108 ListNode *ni_attridxs;
109 ListNode *ni_attrlens;
110 ListNode *ni_attrsets;
111 ListNode *ni_attrblobs;
112 ldap_pvt_thread_rdwr_t ni_ai_rwlock;
114 ldap_pvt_thread_rdwr_t ni_oc_rwlock;
116 int ni_nconns; /* number of connections to open */
117 int ni_nextconn; /* next conn to use */
118 ldap_pvt_thread_mutex_t ni_conn_mutex;
121 #define NDB_MAX_RDNS 16
122 #define NDB_RDN_LEN 128
123 #define NDB_MAX_OCS 64
125 #define DN2ID_TABLE "OL_dn2id"
126 #define EID_COLUMN 0U
127 #define VID_COLUMN 1U
128 #define OCS_COLUMN 1U
129 #define RDN_COLUMN 2U
130 #define IDX_COLUMN (2U+NDB_MAX_RDNS)
132 #define NEXTID_TABLE "OL_nextid"
134 #define NDB_OC_BUFLEN 1026 /* 1024 data plus 2 len bytes */
136 #define INDEX_NAME "OL_index"
138 typedef struct NdbRdns {
140 char nr_buf[NDB_MAX_RDNS][NDB_RDN_LEN+1];
143 typedef struct NdbOcs {
146 int no_nitext; /* number of implicit classes */
147 NdbOcInfo *no_info[NDB_MAX_OCS];
148 struct berval no_text[NDB_MAX_OCS];
149 struct berval no_itext[NDB_MAX_OCS]; /* implicit classes */
152 typedef struct NdbArgs {
161 #define NDB_NO_SUCH_OBJECT 626
162 #define NDB_ALREADY_EXISTS 630
166 #include "proto-ndb.h"