]> git.sur5r.net Git - openldap/commitdiff
Move INDEX_ macros from back-ldbm.h to slap.h and prefix with SLAP_
authorKurt Zeilenga <kurt@openldap.org>
Fri, 28 Jan 2000 20:38:00 +0000 (20:38 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 28 Jan 2000 20:38:00 +0000 (20:38 +0000)
Move AttrInfo from back-ldbm.h to attr.c

servers/slapd/back-ldbm/attr.c
servers/slapd/back-ldbm/back-ldbm.h
servers/slapd/back-ldbm/filterindex.c
servers/slapd/back-ldbm/index.c
servers/slapd/slap.h

index c8cd6b5cc76bb497c2a63dcc8b2709a87ba5e4c8..107203f4bb393d4c3f94c6788bf0d7cf51b807be 100644 (file)
 #include "slap.h"
 #include "back-ldbm.h"
 
+/* for the cache of attribute information (which are indexed, etc.) */
+typedef struct ldbm_attrinfo {
+       char    *ai_type;       /* type name (cn, sn, ...)      */
+       int     ai_indexmask;   /* how the attr is indexed      */
+       int     ai_syntaxmask;  /* what kind of syntax          */
+} AttrInfo;
+
 static int
 ainfo_type_cmp(
     char               *type,
@@ -50,7 +57,7 @@ ainfo_dup(
         * if the duplicate definition is because we initialized the attr,
         * just add what came from the config file. otherwise, complain.
         */
-       if ( a->ai_indexmask & INDEX_FROMINIT ) {
+       if ( a->ai_indexmask & SLAP_INDEX_FROMINIT ) {
                a->ai_indexmask |= b->ai_indexmask;
 
                return( 1 );
@@ -114,23 +121,24 @@ attr_index_config(
                a->ai_syntaxmask = attr_syntax( a->ai_type );
 #endif
                if ( argc == 1 ) {
-                       a->ai_indexmask = (INDEX_PRESENCE | INDEX_EQUALITY |
-                           INDEX_APPROX | INDEX_SUB);
+                       a->ai_indexmask = (
+                               SLAP_INDEX_PRESENCE | SLAP_INDEX_EQUALITY |
+                           SLAP_INDEX_APPROX | SLAP_INDEX_SUB);
                } else {
                        a->ai_indexmask = 0;
                        for ( j = 0; indexes[j] != NULL; j++ ) {
                                if ( strncasecmp( indexes[j], "pres", 4 )
                                    == 0 ) {
-                                       a->ai_indexmask |= INDEX_PRESENCE;
+                                       a->ai_indexmask |= SLAP_INDEX_PRESENCE;
                                } else if ( strncasecmp( indexes[j], "eq", 2 )
                                    == 0 ) {
-                                       a->ai_indexmask |= INDEX_EQUALITY;
+                                       a->ai_indexmask |= SLAP_INDEX_EQUALITY;
                                } else if ( strncasecmp( indexes[j], "approx",
                                    6 ) == 0 ) {
-                                       a->ai_indexmask |= INDEX_APPROX;
+                                       a->ai_indexmask |= SLAP_INDEX_APPROX;
                                } else if ( strncasecmp( indexes[j], "sub", 3 )
                                    == 0 ) {
-                                       a->ai_indexmask |= INDEX_SUB;
+                                       a->ai_indexmask |= SLAP_INDEX_SUB;
                                } else if ( strncasecmp( indexes[j], "none", 4 )
                                    == 0 ) {
                                        if ( a->ai_indexmask != 0 ) {
@@ -149,7 +157,7 @@ attr_index_config(
                        }
                }
                if ( init ) {
-                       a->ai_indexmask |= INDEX_FROMINIT;
+                       a->ai_indexmask |= SLAP_INDEX_FROMINIT;
                }
 
                switch (avl_insert( &li->li_attrs, (caddr_t) a,
index 1c1154ec3727fc00d5412e6d39b69c871f2b36e1..2692137d4cd1fdc8a0a491a2b5d9c481db845c29 100644 (file)
@@ -108,25 +108,6 @@ typedef struct ldbm_dbcache {
        LDBM    dbc_db;
 } DBCache;
 
-/* for the cache of attribute information (which are indexed, etc.) */
-typedef struct ldbm_attrinfo {
-       char    *ai_type;       /* type name (cn, sn, ...)      */
-       int     ai_indexmask;   /* how the attr is indexed      */
-#define INDEX_PRESENCE         0x0001
-#define INDEX_EQUALITY         0x0002
-#define INDEX_APPROX           0x0004
-#define INDEX_SUB                      0x0008
-#define INDEX_UNKNOWN          0x0010
-#define INDEX_FROMINIT         0x1000
-       int     ai_syntaxmask;  /* what kind of syntax          */
-/* ...from slap.h...
-#define SYNTAX_CIS      0x01
-#define SYNTAX_CES      0x02
-#define SYNTAX_BIN      0x04
-   ... etc. ...
-*/
-} AttrInfo;
-
 #define MAXDBCACHE     16
 
 struct ldbminfo {
index c3c92a3954d7e2c3dd44ff535f6aba4b9fb9b798..55f73cc398c3d02812069582ba7444e9df110be3 100644 (file)
@@ -120,7 +120,7 @@ ava_candidates(
 
        switch ( type ) {
        case LDAP_FILTER_EQUALITY:
-               idl = index_read( be, ava->ava_type, INDEX_EQUALITY,
+               idl = index_read( be, ava->ava_type, SLAP_INDEX_EQUALITY,
                    ava->ava_value.bv_val );
                break;
 
@@ -148,7 +148,7 @@ presence_candidates(
 
        Debug( LDAP_DEBUG_TRACE, "=> presence_candidates\n", 0, 0, 0 );
 
-       idl = index_read( be, type, INDEX_PRESENCE, "*" );
+       idl = index_read( be, type, SLAP_INDEX_PRESENCE, "*" );
 
        Debug( LDAP_DEBUG_TRACE, "<= presence_candidates %ld\n",
            idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
@@ -170,7 +170,7 @@ approx_candidates(
        for ( w = first_word( ava->ava_value.bv_val ); w != NULL;
            w = next_word( w ) ) {
                c = phonetic( w );
-               if ( (tmp = index_read( be, ava->ava_type, INDEX_APPROX, c ))
+               if ( (tmp = index_read( be, ava->ava_type, SLAP_INDEX_APPROX, c ))
                    == NULL ) {
                        free( c );
                        idl_free( idl );
@@ -330,7 +330,7 @@ substring_comp_candidates(
                }
                buf[SUBLEN] = '\0';
 
-               if ( (idl = index_read( be, type, INDEX_SUB, buf )) == NULL ) {
+               if ( (idl = index_read( be, type, SLAP_INDEX_SUB, buf )) == NULL ) {
                        return( NULL );
                }
        } else if ( prepost == '$' ) {
@@ -341,7 +341,7 @@ substring_comp_candidates(
                buf[SUBLEN - 1] = '$';
                buf[SUBLEN] = '\0';
 
-               if ( (idl = index_read( be, type, INDEX_SUB, buf )) == NULL ) {
+               if ( (idl = index_read( be, type, SLAP_INDEX_SUB, buf )) == NULL ) {
                        return( NULL );
                }
        }
@@ -352,7 +352,7 @@ substring_comp_candidates(
                }
                buf[SUBLEN] = '\0';
 
-               if ( (tmp = index_read( be, type, INDEX_SUB, buf )) == NULL ) {
+               if ( (tmp = index_read( be, type, SLAP_INDEX_SUB, buf )) == NULL ) {
                        idl_free( idl );
                        return( NULL );
                }
index 0769a4bac8e306f340639e4f731702425ed54ede..055a2b407a678b1a7ec04ab23a9dc4f9d34f7963 100644 (file)
@@ -344,9 +344,9 @@ index_change_values(
                /*
                 * presence index entry
                 */
-               if ( indexmask & INDEX_PRESENCE ) {
+               if ( indexmask & SLAP_INDEX_PRESENCE ) {
 
-                       change_value( be, db, at_cn, INDEX_PRESENCE,
+                       change_value( be, db, at_cn, SLAP_INDEX_PRESENCE,
                                      "*", id, idl_funct );
 
                }
@@ -383,9 +383,9 @@ index_change_values(
                /*
                 * equality index entry
                 */
-               if ( indexmask & INDEX_EQUALITY ) {
+               if ( indexmask & SLAP_INDEX_EQUALITY ) {
                    
-                       change_value( be, db, at_cn, INDEX_EQUALITY,
+                       change_value( be, db, at_cn, SLAP_INDEX_EQUALITY,
                                      val, id, idl_funct);
 
                }
@@ -393,14 +393,14 @@ index_change_values(
                /*
                 * approximate index entry
                 */
-               if ( indexmask & INDEX_APPROX ) {
+               if ( indexmask & SLAP_INDEX_APPROX ) {
                        for ( w = first_word( val ); w != NULL;
                            w = next_word( w ) ) {
                                if ( (code = phonetic( w )) != NULL ) {
                                        change_value( be,
                                                      db,
                                                      at_cn,
-                                                     INDEX_APPROX,
+                                                     SLAP_INDEX_APPROX,
                                                      code,
                                                      id,
                                                      idl_funct );
@@ -412,7 +412,7 @@ index_change_values(
                /*
                 * substrings index entry
                 */
-               if ( indexmask & INDEX_SUB ) {
+               if ( indexmask & SLAP_INDEX_SUB ) {
                        /* leading and trailing */
                        if ( len > SUBLEN - 2 ) {
                                buf[0] = '^';
@@ -421,7 +421,7 @@ index_change_values(
                                }
                                buf[SUBLEN] = '\0';
 
-                               change_value( be, db, at_cn, INDEX_SUB,
+                               change_value( be, db, at_cn, SLAP_INDEX_SUB,
                                              buf, id, idl_funct );
 
                                p = val + len - SUBLEN + 1;
@@ -431,7 +431,7 @@ index_change_values(
                                buf[SUBLEN - 1] = '$';
                                buf[SUBLEN] = '\0';
 
-                               change_value( be, db, at_cn, INDEX_SUB,
+                               change_value( be, db, at_cn, SLAP_INDEX_SUB,
                                              buf, id, idl_funct );
                        }
 
@@ -442,7 +442,7 @@ index_change_values(
                                }
                                buf[SUBLEN] = '\0';
 
-                               change_value( be, db, at_cn, INDEX_SUB,
+                               change_value( be, db, at_cn, SLAP_INDEX_SUB,
                                              buf, id, idl_funct );
                        }
                }
@@ -465,13 +465,13 @@ index2prefix( int indextype )
        int     prefix;
 
        switch ( indextype ) {
-       case INDEX_EQUALITY:
+       case SLAP_INDEX_EQUALITY:
                prefix = EQ_PREFIX;
                break;
-       case INDEX_APPROX:
+       case SLAP_INDEX_APPROX:
                prefix = APPROX_PREFIX;
                break;
-       case INDEX_SUB:
+       case SLAP_INDEX_SUB:
                prefix = SUB_PREFIX;
                break;
        default:
index a5815cd1f6898478a05ea36ec633dd9381128292..18faa0ea39be6bb6aaa40a7206c4783f0f32c4dc 100644 (file)
@@ -96,6 +96,16 @@ LDAP_BEGIN_DECL
 
 LIBSLAPD_F (int) slap_debug;
 
+/*
+ * Index types
+ */
+#define SLAP_INDEX_PRESENCE      0x0001U
+#define SLAP_INDEX_EQUALITY      0x0002U
+#define SLAP_INDEX_APPROX        0x0004U
+#define SLAP_INDEX_SUB           0x0008U
+#define SLAP_INDEX_UNKNOWN       0x0010U
+#define SLAP_INDEX_FROMINIT      0x8000U       /* psuedo type */
+
 
 /*
  * represents schema information for a database