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