Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
srchpref.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ldap_searchattr
struct  ldap_searchmatch
struct  ldap_searchobj

Defines

#define LDAP_C
#define LDAP_CALLBACK
#define LDAP_PASCAL
#define LDAP_CALL
#define NULLSEARCHOBJ   ((struct ldap_searchobj *)0)
#define LDAP_SEARCHOBJ_OPT_INTERNAL   0x00000001
#define LDAP_IS_SEARCHOBJ_OPTION_SET(so, option)   (((so)->so_options & option ) != 0 )
#define LDAP_SEARCHPREF_VERSION_ZERO   0
#define LDAP_SEARCHPREF_VERSION   1
#define LDAP_SEARCHPREF_ERR_VERSION   1
#define LDAP_SEARCHPREF_ERR_MEM   2
#define LDAP_SEARCHPREF_ERR_SYNTAX   3
#define LDAP_SEARCHPREF_ERR_FILE   4

Functions

LDAP_CALL ldap_init_searchprefs (char *file, struct ldap_searchobj **solistp)
LDAP_CALL ldap_init_searchprefs_buf (char *buf, long buflen, struct ldap_searchobj **solistp)
LDAP_CALL ldap_free_searchprefs (struct ldap_searchobj *solist)
LDAP_CALL ldap_first_searchobj (struct ldap_searchobj *solist)
LDAP_CALL ldap_next_searchobj (struct ldap_searchobj *sollist, struct ldap_searchobj *so)

Class Documentation

struct ldap_searchattr

Definition at line 80 of file srchpref.h.

Collaboration diagram for ldap_searchattr:
Class Members
char * sa_attr
char * sa_attrlabel
unsigned long sa_matchtypebitmap
struct ldap_searchattr * sa_next
char * sa_selectattr
char * sa_selecttext
struct ldap_searchmatch

Definition at line 90 of file srchpref.h.

Collaboration diagram for ldap_searchmatch:
Class Members
char * sm_filter
char * sm_matchprompt
struct ldap_searchmatch * sm_next
struct ldap_searchobj

Definition at line 96 of file srchpref.h.

Collaboration diagram for ldap_searchobj:
Class Members
short so_defaultscope
char * so_defaultselectattr
char * so_defaultselecttext
char * so_filterprefix
char * so_filtertag
struct ldap_searchobj * so_next
char * so_objtypeprompt
unsigned long so_options
char * so_prompt
struct ldap_searchattr * so_salist
struct ldap_searchmatch * so_smlist

Define Documentation

Definition at line 73 of file srchpref.h.

Definition at line 76 of file srchpref.h.

Definition at line 74 of file srchpref.h.

#define LDAP_IS_SEARCHOBJ_OPTION_SET (   so,
  option 
)    (((so)->so_options & option ) != 0 )

Definition at line 117 of file srchpref.h.

Definition at line 75 of file srchpref.h.

Definition at line 115 of file srchpref.h.

Definition at line 126 of file srchpref.h.

Definition at line 124 of file srchpref.h.

Definition at line 125 of file srchpref.h.

Definition at line 123 of file srchpref.h.

Definition at line 121 of file srchpref.h.

Definition at line 120 of file srchpref.h.

#define NULLSEARCHOBJ   ((struct ldap_searchobj *)0)

Definition at line 110 of file srchpref.h.


Function Documentation

LDAP_CALL ldap_first_searchobj ( struct ldap_searchobj solist) [read]

Definition at line 240 of file srchpref.c.

{
    return( solist );
}

Here is the caller graph for this function:

Definition at line 164 of file srchpref.c.

{
    struct ldap_searchobj   *so, *nextso;

    if ( solist != NULL ) {
       for ( so = solist; so != NULL; so = nextso ) {
           nextso = so->so_next;
           free_searchobj( so );
       }
    }
    /* XXX XXX need to do some work here */
}

Here is the call graph for this function:

Here is the caller graph for this function:

LDAP_CALL ldap_init_searchprefs ( char *  file,
struct ldap_searchobj **  solistp 
)

Definition at line 76 of file srchpref.c.

{
    FILE      *fp;
    char      *buf;
    long      rlen, len;
    int              rc, eof;

    if (( fp = fopen( file, "r" )) == NULL ) {
       return( LDAP_SEARCHPREF_ERR_FILE );
    }

    if ( fseek( fp, 0L, SEEK_END ) != 0 ) {      /* move to end to get len */
       fclose( fp );
       return( LDAP_SEARCHPREF_ERR_FILE );
    }

    len = ftell( fp );

    if ( fseek( fp, 0L, SEEK_SET ) != 0 ) {      /* back to start of file */
       fclose( fp );
       return( LDAP_SEARCHPREF_ERR_FILE );
    }

    if (( buf = NSLDAPI_MALLOC( (size_t)len )) == NULL ) {
       fclose( fp );
       return( LDAP_SEARCHPREF_ERR_MEM );
    }

    rlen = fread( buf, 1, (size_t)len, fp );
    eof = feof( fp );
    fclose( fp );

    if ( rlen != len && !eof ) {   /* error:  didn't get the whole file */
       NSLDAPI_FREE( buf );
       return( LDAP_SEARCHPREF_ERR_FILE );
    }

    rc = ldap_init_searchprefs_buf( buf, rlen, solistp );
    NSLDAPI_FREE( buf );

    return( rc );
}

Here is the call graph for this function:

Here is the caller graph for this function:

LDAP_CALL ldap_init_searchprefs_buf ( char *  buf,
long  buflen,
struct ldap_searchobj **  solistp 
)

Definition at line 122 of file srchpref.c.

{
    int                            rc = 0, version;
    char                    **toks;
    struct ldap_searchobj   *prevso, *so;

    *solistp = prevso = NULLSEARCHOBJ;

    if ( nsldapi_next_line_tokens( &buf, &buflen, &toks ) != 2 ||
           strcasecmp( toks[ 0 ], "version" ) != 0 ) {
       nsldapi_free_strarray( toks );
       return( LDAP_SEARCHPREF_ERR_SYNTAX );
    }
    version = atoi( toks[ 1 ] );
    nsldapi_free_strarray( toks );
    if ( version != LDAP_SEARCHPREF_VERSION &&
           version != LDAP_SEARCHPREF_VERSION_ZERO ) {
       return( LDAP_SEARCHPREF_ERR_VERSION );
    }

    while ( buflen > 0 && ( rc = read_next_searchobj( &buf, &buflen, &so,
           version )) == 0 && so != NULLSEARCHOBJ ) {
       if ( prevso == NULLSEARCHOBJ ) {
           *solistp = so;
       } else {
           prevso->so_next = so;
       }
       prevso = so;
    }

    if ( rc != 0 ) {
       ldap_free_searchprefs( *solistp );
    }

    return( rc );
}

Here is the call graph for this function:

Here is the caller graph for this function:

LDAP_CALL ldap_next_searchobj ( struct ldap_searchobj sollist,
struct ldap_searchobj so 
) [read]

Definition at line 248 of file srchpref.c.

{
    return( so == NULLSEARCHOBJ ? so : so->so_next );
}

Here is the caller graph for this function: