1 /*
2  * Copyright 2001-2002 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * The contents of this file are subject to the Netscape Public
8  * License Version 1.1 (the "License"); you may not use this file
9  * except in compliance with the License. You may obtain a copy of
10  * the License at http://www.mozilla.org/NPL/
11  *
12  * Software distributed under the License is distributed on an "AS
13  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14  * implied. See the License for the specific language governing
15  * rights and limitations under the License.
16  *
17  * The Original Code is Mozilla Communicator client code, released
18  * March 31, 1998.
19  *
20  * The Initial Developer of the Original Code is Netscape
21  * Communications Corporation. Portions created by Netscape are
22  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
23  * Rights Reserved.
24  *
25  * Contributor(s):
26  */
27 
28 /*
29  * Internal header for libprldap -- glue NSPR (Netscape Portable Runtime)
30  * to libldap.
31  *
32  */
33 
34 #include <ldap.h>
35 #include <nspr.h>
36 #include <ldappr.h>
37 
38 #include <errno.h>
39 #include <string.h>
40 
41 #ifdef _SOLARIS_SDK
42 #include "solaris-int.h"
43 #endif
44 
45 /*
46  * All of the sockets we use are IPv6 capable.
47  * Change the following #define to PR_AF_INET to support IPv4 only.
48  */
49 #define PRLDAP_DEFAULT_ADDRESS_FAMILY   PR_AF_INET6
50 
51 /*
52  * Data structures:
53  */
54 
55 /* data structure that populates the I/O callback session arg. */
56 typedef struct lextiof_session_private {
57 	PRPollDesc	*prsess_pollds;		/* for poll callback */
58 	int		prsess_pollds_count;	/* # of elements in pollds */
59 	int             prsess_io_max_timeout;  /* in milliseconds */
60 	void		*prsess_appdata;	/* application specific data */
61 } PRLDAPIOSessionArg;
62 
63 /* data structure that populates the I/O callback socket-specific arg. */
64 typedef struct lextiof_socket_private {
65 	PRFileDesc	*prsock_prfd;		/* associated NSPR file desc. */
66 	int             prsock_io_max_timeout;  /* in milliseconds */
67 	void		*prsock_appdata;	/* application specific data */
68 } PRLDAPIOSocketArg;
69 
70 
71 /*
72  * Function prototypes:
73  */
74 
75 /*
76  * From ldapprio.c:
77  */
78 int prldap_install_io_functions( LDAP *ld, int shared );
79 int prldap_session_arg_from_ld( LDAP *ld, PRLDAPIOSessionArg **sessargpp );
80 int prldap_set_io_max_timeout( PRLDAPIOSessionArg *prsessp,
81         int io_max_timeout );
82 int prldap_get_io_max_timeout( PRLDAPIOSessionArg *prsessp,
83         int *io_max_timeoutp );
84 int prldap_socket_arg_from_ld( LDAP *ld, PRLDAPIOSocketArg **sockargpp );
85 
86 
87 /*
88  * From ldapprthreads.c:
89  */
90 int prldap_install_thread_functions( LDAP *ld, int shared );
91 int prldap_thread_new_handle( LDAP *ld, void *sessionarg );
92 void prldap_thread_dispose_handle( LDAP *ld, void *sessionarg );
93 
94 
95 /*
96  * From ldapprdns.c:
97  */
98 int prldap_install_dns_functions( LDAP *ld );
99 #ifdef _SOLARIS_SDK
100 int prldap_x_install_dns_skipdb( LDAP *ld, const char *skip );
101 #endif
102 
103 
104 
105 /*
106  * From ldapprerror.c:
107  */
108 void prldap_set_system_errno( int e );
109 int prldap_get_system_errno( void );
110 int prldap_prerr2errno( void );
111