1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * The Original Code is Mozilla Communicator client code, released
15  * March 31, 1998.
16  *
17  * The Initial Developer of the Original Code is
18  * Netscape Communications Corporation.
19  * Portions created by the Initial Developer are Copyright (C) 1998-1999
20  * the Initial Developer. All Rights Reserved.
21  *
22  * Contributor(s):
23  *
24  * Alternatively, the contents of this file may be used under the terms of
25  * either of the GNU General Public License Version 2 or later (the "GPL"),
26  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27  * in which case the provisions of the GPL or the LGPL are applicable instead
28  * of those above. If you wish to allow use of your version of this file only
29  * under the terms of either the GPL or the LGPL, and not to allow others to
30  * use your version of this file under the terms of the MPL, indicate your
31  * decision by deleting the provisions above and replace them with the notice
32  * and other provisions required by the GPL or the LGPL. If you do not delete
33  * the provisions above, a recipient may use your version of this file under
34  * the terms of any one of the MPL, the GPL or the LGPL.
35  *
36  * ***** END LICENSE BLOCK ***** */
37 
38 /* ldap-to-be-deprecated.h - functions and declaration which will be
39  * deprecated in a future release.
40  *
41  * A deprecated API is an API that we recommend you no longer use,
42  * due to improvements in the LDAP C SDK. While deprecated APIs are
43  * currently still implemented, they may be removed in future
44  * implementations, and we recommend using other APIs.
45  *
46  * This header file will act as a first warning before moving functions
47  * into an unsupported/deprecated state.  If your favorite application
48  * depend on any declaration and defines, and there is a good reason
49  * for not porting to new functions, Speak up now or they may disappear
50  * in a future release
51  */
52 
53 #ifndef _LDAP_TOBE_DEPRECATED_H
54 #define _LDAP_TOBE_DEPRECATED_H
55 
56 #ifdef __cplusplus
57 extern "C" {
58 #endif
59 
60 /*
61  * I/O function callbacks option (an API extension --
62  * LDAP_API_FEATURE_X_IO_FUNCTIONS).
63  * Use of the extended I/O functions instead is recommended
64  */
65 #define LDAP_OPT_IO_FN_PTRS		0x0B	/* 11 - API extension */
66 
67 /*
68  * I/O callback functions (note that types for the read and write callbacks
69  * are actually in lber.h):
70  */
71 typedef int	(LDAP_C LDAP_CALLBACK LDAP_IOF_SELECT_CALLBACK)( int nfds,
72 	fd_set *readfds, fd_set *writefds, fd_set *errorfds,
73 	struct timeval *timeout );
74 typedef LBER_SOCKET (LDAP_C LDAP_CALLBACK LDAP_IOF_SOCKET_CALLBACK)(
75 	int domain, int type, int protocol );
76 typedef int	(LDAP_C LDAP_CALLBACK LDAP_IOF_IOCTL_CALLBACK)( LBER_SOCKET s,
77 	int option, ... );
78 typedef int	(LDAP_C LDAP_CALLBACK LDAP_IOF_CONNECT_CALLBACK )(
79 	LBER_SOCKET s, struct sockaddr *name, int namelen );
80 typedef int	(LDAP_C LDAP_CALLBACK LDAP_IOF_CLOSE_CALLBACK )(
81 	LBER_SOCKET s );
82 typedef int	(LDAP_C LDAP_CALLBACK LDAP_IOF_SSL_ENABLE_CALLBACK )(
83 	LBER_SOCKET s );
84 
85 /*
86  * Structure to hold I/O function pointers:
87  */
88 struct ldap_io_fns {
89 	LDAP_IOF_READ_CALLBACK *liof_read;
90 	LDAP_IOF_WRITE_CALLBACK *liof_write;
91 	LDAP_IOF_SELECT_CALLBACK *liof_select;
92 	LDAP_IOF_SOCKET_CALLBACK *liof_socket;
93 	LDAP_IOF_IOCTL_CALLBACK *liof_ioctl;
94 	LDAP_IOF_CONNECT_CALLBACK *liof_connect;
95 	LDAP_IOF_CLOSE_CALLBACK *liof_close;
96 	LDAP_IOF_SSL_ENABLE_CALLBACK *liof_ssl_enable;
97 };
98 
99 /*
100  * DNS resolver callbacks (an API extension --LDAP_API_FEATURE_X_DNS_FUNCTIONS).
101  * Note that gethostbyaddr() is not currently used.
102  */
103 #define LDAP_OPT_DNS_FN_PTRS            0x60    /* 96 - API extension */
104 
105 typedef struct LDAPHostEnt {
106     char        *ldaphe_name;           /* official name of host */
107     char        **ldaphe_aliases;       /* alias list */
108     int         ldaphe_addrtype;        /* host address type */
109     int         ldaphe_length;          /* length of address */
110     char        **ldaphe_addr_list;     /* list of addresses from name server */
111 } LDAPHostEnt;
112 
113 typedef LDAPHostEnt * (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETHOSTBYNAME)(
114         const char *name, LDAPHostEnt *result, char *buffer,
115         int buflen, int *statusp, void *extradata );
116 typedef LDAPHostEnt * (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETHOSTBYADDR)(
117         const char *addr, int length, int type, LDAPHostEnt *result,
118         char *buffer, int buflen, int *statusp, void *extradata );
119 typedef int (LDAP_C LDAP_CALLBACK LDAP_DNSFN_GETPEERNAME)(
120         LDAP *ld, struct sockaddr *netaddr, char *buffer, int buflen);
121 
122 struct ldap_dns_fns {
123         void                            *lddnsfn_extradata;
124         int                             lddnsfn_bufsize;
125         LDAP_DNSFN_GETHOSTBYNAME        *lddnsfn_gethostbyname;
126         LDAP_DNSFN_GETHOSTBYADDR        *lddnsfn_gethostbyaddr;
127 	LDAP_DNSFN_GETPEERNAME          *lddnsfn_getpeername;
128 };
129 
130 /*
131  * experimental DN format support
132  */
133 LDAP_API(char **) LDAP_CALL ldap_explode_dns( const char *dn );
134 LDAP_API(int) LDAP_CALL ldap_is_dns_dn( const char *dn );
135 
136 
137 /*
138  * user friendly naming/searching routines
139  */
140 typedef int (LDAP_C LDAP_CALLBACK LDAP_CANCELPROC_CALLBACK)( void *cl );
141 LDAP_API(int) LDAP_CALL ldap_ufn_search_c( LDAP *ld, char *ufn,
142         char **attrs, int attrsonly, LDAPMessage **res,
143         LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm );
144 LDAP_API(int) LDAP_CALL ldap_ufn_search_ct( LDAP *ld, char *ufn,
145         char **attrs, int attrsonly, LDAPMessage **res,
146         LDAP_CANCELPROC_CALLBACK *cancelproc, void *cancelparm,
147         char *tag1, char *tag2, char *tag3 );
148 LDAP_API(int) LDAP_CALL ldap_ufn_search_s( LDAP *ld, char *ufn,
149         char **attrs, int attrsonly, LDAPMessage **res );
150 LDAP_API(LDAPFiltDesc *) LDAP_CALL ldap_ufn_setfilter( LDAP *ld, char *fname );
151 LDAP_API(void) LDAP_CALL ldap_ufn_setprefix( LDAP *ld, char *prefix );
152 LDAP_API(int) LDAP_C ldap_ufn_timeout( void *tvparam );
153 
154 /*
155  * utility routines
156  */
157 LDAP_API(int) LDAP_CALL ldap_charray_add( char ***a, char *s );
158 LDAP_API(int) LDAP_CALL ldap_charray_merge( char ***a, char **s );
159 LDAP_API(void) LDAP_CALL ldap_charray_free( char **array );
160 LDAP_API(int) LDAP_CALL ldap_charray_inlist( char **a, char *s );
161 LDAP_API(char **) LDAP_CALL ldap_charray_dup( char **a );
162 LDAP_API(char **) LDAP_CALL ldap_str2charray( char *str, char *brkstr );
163 LDAP_API(int) LDAP_CALL ldap_charray_position( char **a, char *s );
164 
165 /* from ldap_ssl.h - the pkcs function and declaration */
166 typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_TOKEN_CALLBACK)(void *context, char **tokenname);
167 typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_PIN_CALLBACK)(void *context, const char *tokenname, char **tokenpin);
168 typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTPATH_CALLBACK)(void *context, char **certpath);
169 typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_KEYPATH_CALLBACK)(void *context,char **keypath);
170 typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_MODPATH_CALLBACK)(void *context, char **modulepath);
171 typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_CERTNAME_CALLBACK)(void *context, char **certname);
172 typedef int (LDAP_C LDAP_CALLBACK LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK)(void *context, char **filename);
173 
174 #define PKCS_STRUCTURE_ID 1
175 struct ldapssl_pkcs_fns {
176     int local_structure_id;
177     void *local_data;
178     LDAP_PKCS_GET_CERTPATH_CALLBACK *pkcs_getcertpath;
179     LDAP_PKCS_GET_CERTNAME_CALLBACK *pkcs_getcertname;
180     LDAP_PKCS_GET_KEYPATH_CALLBACK *pkcs_getkeypath;
181     LDAP_PKCS_GET_MODPATH_CALLBACK *pkcs_getmodpath;
182     LDAP_PKCS_GET_PIN_CALLBACK *pkcs_getpin;
183     LDAP_PKCS_GET_TOKEN_CALLBACK *pkcs_gettokenname;
184     LDAP_PKCS_GET_DONGLEFILENAME_CALLBACK *pkcs_getdonglefilename;
185 
186 };
187 
188 LDAP_API(int) LDAP_CALL ldapssl_pkcs_init( const struct ldapssl_pkcs_fns *pfns);
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 #endif /* _LDAP_TOBE_DEPRECATED_H */
194