Back to index

lightning-sunbird  0.9+nobinonly
ldappr-int.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is Mozilla Communicator client code, released
00015  * March 31, 1998.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998-1999
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 /*
00039  * Internal header for libprldap -- glue NSPR (Netscape Portable Runtime)
00040  * to libldap.
00041  *
00042  */
00043 
00044 #include "ldap.h"
00045 #include "nspr.h"
00046 #include "ldappr.h"
00047 
00048 #include <errno.h>
00049 #include <string.h>
00050 #include <stdarg.h>
00051 
00052 /*
00053  * Macros:
00054  */
00055 
00056 /* #define PRLDAP_DEBUG     1      */     /* uncomment to enable debugging printfs */
00057 
00058 /*
00059  * All of the sockets we use are IPv6 capable.
00060  * Change the following #define to PR_AF_INET to support IPv4 only.
00061  */
00062 #define PRLDAP_DEFAULT_ADDRESS_FAMILY     PR_AF_INET6
00063 
00064 /*
00065  * Macro to set port to the 'port' field of a NSPR PRNetAddr union.
00066  ** INPUTS:
00067  ** PRNetAddr *addr   A network address.
00068  ** PRUint16          port to set to the 'port' field of 'addr'.
00069  ** RETURN: none
00070  */
00071 #define PRLDAP_SET_PORT(myaddr,myport) \
00072     ((myaddr)->raw.family == PR_AF_INET6 ? ((myaddr)->ipv6.port = PR_htons(myport)) : ((myaddr)->inet.port = PR_htons(myport)))
00073 
00074 /*
00075  * Data structures:
00076  */
00077 
00078 /* data structure that populates the I/O callback session arg. */
00079 typedef struct lextiof_session_private {
00080        PRPollDesc    *prsess_pollds;             /* for poll callback */
00081        int           prsess_pollds_count; /* # of elements in pollds */
00082        int           prsess_io_max_timeout;      /* in milliseconds */
00083        void          *prsess_appdata;     /* application specific data */
00084 } PRLDAPIOSessionArg;
00085 
00086 /* data structure that populates the I/O callback socket-specific arg. */
00087 typedef struct lextiof_socket_private {
00088        PRFileDesc    *prsock_prfd;        /* associated NSPR file desc. */
00089        int           prsock_io_max_timeout;      /* in milliseconds */
00090        void          *prsock_appdata;     /* application specific data */
00091 } PRLDAPIOSocketArg;
00092 
00093 
00094 /*
00095  * Function prototypes:
00096  */
00097 
00098 /*
00099  * From ldapprio.c:
00100  */
00101 int prldap_install_io_functions( LDAP *ld, int shared );
00102 int prldap_session_arg_from_ld( LDAP *ld, PRLDAPIOSessionArg **sessargpp );
00103 int prldap_set_io_max_timeout( PRLDAPIOSessionArg *prsessp,
00104        int io_max_timeout );
00105 int prldap_get_io_max_timeout( PRLDAPIOSessionArg *prsessp,
00106        int *io_max_timeoutp );
00107 
00108 
00109 /*
00110  * From ldapprthreads.c:
00111  */
00112 int prldap_install_thread_functions( LDAP *ld, int shared );
00113 int prldap_thread_new_handle( LDAP *ld, void *sessionarg );
00114 void prldap_thread_dispose_handle( LDAP *ld, void *sessionarg );
00115 
00116 
00117 /*
00118  * From ldapprdns.c:
00119  */
00120 int prldap_install_dns_functions( LDAP *ld );
00121 
00122 
00123 /*
00124  * From ldapprerror.c:
00125  */
00126 void prldap_set_system_errno( int e );
00127 int prldap_get_system_errno( void );
00128 int prldap_prerr2errno( void );