Back to index

openldap  2.4.31
Functions | Variables
index.c File Reference
#include "portable.h"
#include <stdio.h>
#include <ac/string.h>
#include <lutil.h>
#include "slap.h"

Go to the source code of this file.

Functions

int slap_str2index (const char *str, slap_mask_t *idx)
void slap_index2bvlen (slap_mask_t idx, struct berval *bv)
void slap_index2bv (slap_mask_t idx, struct berval *bv)

Variables

static slap_verbmasks idxstr []

Function Documentation

void slap_index2bv ( slap_mask_t  idx,
struct berval bv 
)

Definition at line 73 of file index.c.

{
       int i;
       char *ptr;

       if ( !bv->bv_len ) return;

       ptr = bv->bv_val;
       for ( i=0; !BER_BVISNULL( &idxstr[i].word ); i++ ) {
              if ( !idxstr[i].mask ) continue;
              if ( IS_SLAP_INDEX( idx, idxstr[i].mask )) {
                     if ( (idxstr[i].mask & SLAP_INDEX_SUBSTR) &&
                            ((idx & SLAP_INDEX_SUBSTR_DEFAULT) != idxstr[i].mask))
                            continue;
                     if ( ptr != bv->bv_val ) *ptr++ = ',';
                     ptr = lutil_strcopy( ptr, idxstr[i].word.bv_val );
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void slap_index2bvlen ( slap_mask_t  idx,
struct berval bv 
)

Definition at line 54 of file index.c.

{
       int i;

       bv->bv_len = 0;

       for ( i=0; !BER_BVISNULL( &idxstr[i].word ); i++ ) {
              if ( !idxstr[i].mask ) continue;
              if ( IS_SLAP_INDEX( idx, idxstr[i].mask )) {
                     if ( (idxstr[i].mask & SLAP_INDEX_SUBSTR) &&
                            ((idx & SLAP_INDEX_SUBSTR_DEFAULT) != idxstr[i].mask))
                            continue;
                     if ( bv->bv_len ) bv->bv_len++;
                     bv->bv_len += idxstr[i].word.bv_len;
              }
       }
}

Here is the caller graph for this function:

int slap_str2index ( const char *  str,
slap_mask_t idx 
)

Definition at line 41 of file index.c.

{
       int i;

       i = verb_to_mask( str, idxstr );
       if ( BER_BVISNULL(&idxstr[i].word) ) return LDAP_OTHER;
       while ( !idxstr[i].mask ) i--;
       *idx = idxstr[i].mask;


       return LDAP_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

slap_verbmasks idxstr[] [static]
Initial value:
 {
       { BER_BVC("pres"), SLAP_INDEX_PRESENT },
       { BER_BVC("eq"), SLAP_INDEX_EQUALITY },
       { BER_BVC("approx"), SLAP_INDEX_APPROX },
       { BER_BVC("subinitial"), SLAP_INDEX_SUBSTR_INITIAL },
       { BER_BVC("subany"), SLAP_INDEX_SUBSTR_ANY },
       { BER_BVC("subfinal"), SLAP_INDEX_SUBSTR_FINAL },
       { BER_BVC("sub"), SLAP_INDEX_SUBSTR_DEFAULT },
       { BER_BVC("substr"), 0 },
       { BER_BVC("notags"), SLAP_INDEX_NOTAGS },
       { BER_BVC("nolang"), 0 },   
       { BER_BVC("nosubtypes"), SLAP_INDEX_NOSUBTYPES },
       { BER_BVNULL, 0 }
}

Definition at line 25 of file index.c.