Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions
ldappr-int.h File Reference
#include "ldap.h"
#include "nspr.h"
#include "ldappr.h"
#include <errno.h>
#include <string.h>
#include <stdarg.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  lextiof_session_private
struct  lextiof_socket_private

Defines

#define PRLDAP_DEFAULT_ADDRESS_FAMILY   PR_AF_INET6
#define PRLDAP_SET_PORT(myaddr, myport)   ((myaddr)->raw.family == PR_AF_INET6 ? ((myaddr)->ipv6.port = PR_htons(myport)) : ((myaddr)->inet.port = PR_htons(myport)))

Typedefs

typedef struct
lextiof_session_private 
PRLDAPIOSessionArg
typedef struct
lextiof_socket_private 
PRLDAPIOSocketArg

Functions

int prldap_install_io_functions (LDAP *ld, int shared)
int prldap_session_arg_from_ld (LDAP *ld, PRLDAPIOSessionArg **sessargpp)
int prldap_set_io_max_timeout (PRLDAPIOSessionArg *prsessp, int io_max_timeout)
int prldap_get_io_max_timeout (PRLDAPIOSessionArg *prsessp, int *io_max_timeoutp)
int prldap_install_thread_functions (LDAP *ld, int shared)
int prldap_thread_new_handle (LDAP *ld, void *sessionarg)
void prldap_thread_dispose_handle (LDAP *ld, void *sessionarg)
int prldap_install_dns_functions (LDAP *ld)
void prldap_set_system_errno (int e)
int prldap_get_system_errno (void)
int prldap_prerr2errno (void)

Class Documentation

struct lextiof_session_private

Definition at line 79 of file ldappr-int.h.

Collaboration diagram for lextiof_session_private:
Class Members
void * prsess_appdata
int prsess_io_max_timeout
PRPollDesc * prsess_pollds
int prsess_pollds_count
struct lextiof_socket_private

Definition at line 87 of file ldappr-int.h.

Collaboration diagram for lextiof_socket_private:
Class Members
void * prsock_appdata
int prsock_io_max_timeout
PRFileDesc * prsock_prfd

Define Documentation

Definition at line 62 of file ldappr-int.h.

#define PRLDAP_SET_PORT (   myaddr,
  myport 
)    ((myaddr)->raw.family == PR_AF_INET6 ? ((myaddr)->ipv6.port = PR_htons(myport)) : ((myaddr)->inet.port = PR_htons(myport)))

Definition at line 71 of file ldappr-int.h.


Typedef Documentation


Function Documentation

int prldap_get_io_max_timeout ( PRLDAPIOSessionArg prsessp,
int io_max_timeoutp 
)

Definition at line 649 of file ldappr-io.c.

{
    int       rc = LDAP_SUCCESS;   /* optimistic */

    if ( NULL == io_max_timeoutp ) {
       rc = LDAP_PARAM_ERROR;
    } else if ( NULL == prsessp ) {
       *io_max_timeoutp = prldap_default_io_max_timeout;
    } else {
       *io_max_timeoutp = prsessp->prsess_io_max_timeout;
    }

    return( rc );
}

Here is the caller graph for this function:

Definition at line 55 of file ldappr-error.c.

{
    return( PR_GetOSError());
}

Here is the caller graph for this function:

Definition at line 63 of file ldappr-dns.c.

{
    struct ldap_dns_fns                   dnsfns;

    memset( &dnsfns, '\0', sizeof(struct ldap_dns_fns) );
    dnsfns.lddnsfn_bufsize = PR_NETDB_BUF_SIZE;
    dnsfns.lddnsfn_gethostbyname = prldap_gethostbyname;
    dnsfns.lddnsfn_gethostbyaddr = prldap_gethostbyaddr;
    if ( ldap_set_option( ld, LDAP_OPT_DNS_FN_PTRS, (void *)&dnsfns ) != 0 ) {
       return( -1 );
    }

    return( 0 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

int prldap_install_io_functions ( LDAP *  ld,
int  shared 
)

Definition at line 104 of file ldappr-io.c.

{
    struct ldap_x_ext_io_fns       iofns;

    memset( &iofns, 0, sizeof(iofns));
    iofns.lextiof_size = LDAP_X_EXTIO_FNS_SIZE;
    iofns.lextiof_read = prldap_read;
    iofns.lextiof_write = prldap_write;
    iofns.lextiof_poll = prldap_poll;
    iofns.lextiof_connect = prldap_connect;
    iofns.lextiof_close = prldap_close;
    if ( shared ) {
       iofns.lextiof_newhandle = prldap_shared_newhandle;
       iofns.lextiof_disposehandle = prldap_shared_disposehandle;
    } else {
       iofns.lextiof_newhandle = prldap_newhandle;
       iofns.lextiof_disposehandle = prldap_disposehandle;
    }
    if ( NULL != ld ) {
       /*
        * If we are dealing with a real ld, we allocate the session specific
        * data structure now.  If not allocated here, it will be allocated
        * inside prldap_newhandle() or prldap_shared_newhandle().
        */
       if ( NULL ==
              ( iofns.lextiof_session_arg = prldap_session_arg_alloc())) {
           ldap_set_lderrno( ld, LDAP_NO_MEMORY, NULL, NULL );
           return( -1 );
       }
    } else {
       iofns.lextiof_session_arg = NULL;
    }

    if ( ldap_set_option( ld, LDAP_X_OPT_EXTIO_FN_PTRS, &iofns ) != 0 ) {
       prldap_session_arg_free(
              (PRLDAPIOSessionArg **) &iofns.lextiof_session_arg );
       return( -1 );
    }

    return( 0 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

int prldap_install_thread_functions ( LDAP *  ld,
int  shared 
)

Definition at line 155 of file ldappr-threads.c.

{
    struct ldap_thread_fns         tfns;
    struct ldap_extra_thread_fns   xtfns;

    if ( PR_CallOnce( &prldap_callonce_init_tpd, prldap_init_tpd )
              != PR_SUCCESS ) {
       ldap_set_lderrno( ld, LDAP_LOCAL_ERROR, NULL, NULL );
       return( -1 );
    }

    /* set thread function pointers */
    memset( &tfns, '\0', sizeof(struct ldap_thread_fns) );
    tfns.ltf_get_errno = prldap_get_system_errno;
    tfns.ltf_set_errno = prldap_set_system_errno;
    if ( shared ) {
       tfns.ltf_mutex_alloc = prldap_mutex_alloc;
       tfns.ltf_mutex_free = prldap_mutex_free;
       tfns.ltf_mutex_lock = prldap_mutex_lock;
       tfns.ltf_mutex_unlock = prldap_mutex_unlock;
       tfns.ltf_get_lderrno = prldap_get_ld_error;
       tfns.ltf_set_lderrno = prldap_set_ld_error;
       if ( ld != NULL ) {
           /*
            * If this is a real ld (i.e., we are not setting the global
            * defaults) allocate thread private data for error information.
            * If ld is NULL we do not do this here but it is done in
            * prldap_thread_new_handle().
            */
           if (( tfns.ltf_lderrno_arg = (void *)prldap_allocate_map( ld ))
                  == NULL ) {
              return( -1 );
           }
       }
    }

    if ( ldap_set_option( ld, LDAP_OPT_THREAD_FN_PTRS,
           (void *)&tfns ) != 0 ) {
       prldap_return_map( (PRLDAP_TPDMap *)tfns.ltf_lderrno_arg );
       return( -1 );
    }

    /* set extended thread function pointers */
    memset( &xtfns, '\0', sizeof(struct ldap_extra_thread_fns) );
    xtfns.ltf_threadid_fn = prldap_get_thread_id;
    if ( ldap_set_option( ld, LDAP_OPT_EXTRA_THREAD_FN_PTRS,
           (void *)&xtfns ) != 0 ) {
       return( -1 );
    }

    return( 0 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 321 of file ldappr-error.c.

{
    int              oserr, i;
    PRInt32   nsprerr;

    nsprerr = PR_GetError();

    oserr = -1;             /* unknown */
    for ( i = 0; prldap_errormap[i].erm_nspr != PR_MAX_ERROR; ++i ) {
       if ( prldap_errormap[i].erm_nspr == nsprerr ) {
           oserr = prldap_errormap[i].erm_system;
           break;
       }
    }

    return( oserr );
}

Here is the caller graph for this function:

int prldap_session_arg_from_ld ( LDAP *  ld,
PRLDAPIOSessionArg **  sessargpp 
)

Definition at line 560 of file ldappr-io.c.

{
    struct ldap_x_ext_io_fns       iofns;

    if ( NULL == ld || NULL == sessargpp ) {
       /* XXXmcs: NULL ld's are not supported */
       ldap_set_lderrno( ld, LDAP_PARAM_ERROR, NULL, NULL );
       return( LDAP_PARAM_ERROR );
    }

    memset( &iofns, 0, sizeof(iofns));
    iofns.lextiof_size = LDAP_X_EXTIO_FNS_SIZE;
    if ( ldap_get_option( ld, LDAP_X_OPT_EXTIO_FN_PTRS, (void *)&iofns ) < 0 ) {
       return( ldap_get_lderrno( ld, NULL, NULL ));
    }

    if ( NULL == iofns.lextiof_session_arg ) {
       ldap_set_lderrno( ld, LDAP_LOCAL_ERROR, NULL, NULL );
       return( LDAP_LOCAL_ERROR );
    }

    *sessargpp = iofns.lextiof_session_arg;
    return( LDAP_SUCCESS );
}

Here is the call graph for this function:

Here is the caller graph for this function:

int prldap_set_io_max_timeout ( PRLDAPIOSessionArg prsessp,
int  io_max_timeout 
)

Definition at line 633 of file ldappr-io.c.

{
    int       rc = LDAP_SUCCESS;   /* optimistic */

    if ( NULL == prsessp ) {
       prldap_default_io_max_timeout = io_max_timeout;
    } else {
       prsessp->prsess_io_max_timeout = io_max_timeout;
    }

    return( rc );
}

Here is the caller graph for this function:

Definition at line 48 of file ldappr-error.c.

{
    PR_SetError( PR_UNKNOWN_ERROR, oserrno );
}

Here is the caller graph for this function:

void prldap_thread_dispose_handle ( LDAP *  ld,
void sessionarg 
)

Definition at line 351 of file ldappr-threads.c.

{
    struct ldap_thread_fns  tfns;

    if ( ldap_get_option( ld, LDAP_OPT_THREAD_FN_PTRS,
           (void *)&tfns ) == 0 &&
           tfns.ltf_lderrno_arg != NULL ) {
       prldap_return_map( (PRLDAP_TPDMap *)tfns.ltf_lderrno_arg );
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int prldap_thread_new_handle ( LDAP *  ld,
void sessionarg 
)

Definition at line 326 of file ldappr-threads.c.

{
    struct ldap_thread_fns  tfns;

    if ( ldap_get_option( ld, LDAP_OPT_THREAD_FN_PTRS, (void *)&tfns ) != 0 ) {
       return( LDAP_LOCAL_ERROR );
    }

    if ( tfns.ltf_lderrno_arg == NULL && tfns.ltf_get_lderrno != NULL ) {
       if (( tfns.ltf_lderrno_arg = (void *)prldap_allocate_map( ld )) == NULL
              || ldap_set_option( ld, LDAP_OPT_THREAD_FN_PTRS,
              (void *)&tfns ) != 0 ) {
           return( LDAP_LOCAL_ERROR );
       }
    }

    return( LDAP_SUCCESS );
}

Here is the call graph for this function:

Here is the caller graph for this function: