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