1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright (c) 2001 by Sun Microsystems, Inc.
3*7c478bd9Sstevel@tonic-gate  * All rights reserved.
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  * The contents of this file are subject to the Netscape Public
10*7c478bd9Sstevel@tonic-gate  * License Version 1.1 (the "License"); you may not use this file
11*7c478bd9Sstevel@tonic-gate  * except in compliance with the License. You may obtain a copy of
12*7c478bd9Sstevel@tonic-gate  * the License at http://www.mozilla.org/NPL/
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * Software distributed under the License is distributed on an "AS
15*7c478bd9Sstevel@tonic-gate  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
16*7c478bd9Sstevel@tonic-gate  * implied. See the License for the specific language governing
17*7c478bd9Sstevel@tonic-gate  * rights and limitations under the License.
18*7c478bd9Sstevel@tonic-gate  *
19*7c478bd9Sstevel@tonic-gate  * The Original Code is Mozilla Communicator client code, released
20*7c478bd9Sstevel@tonic-gate  * March 31, 1998.
21*7c478bd9Sstevel@tonic-gate  *
22*7c478bd9Sstevel@tonic-gate  * The Initial Developer of the Original Code is Netscape
23*7c478bd9Sstevel@tonic-gate  * Communications Corporation. Portions created by Netscape are
24*7c478bd9Sstevel@tonic-gate  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
25*7c478bd9Sstevel@tonic-gate  * Rights Reserved.
26*7c478bd9Sstevel@tonic-gate  *
27*7c478bd9Sstevel@tonic-gate  * Contributor(s):
28*7c478bd9Sstevel@tonic-gate  */
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate  * Copyright (c) 1993, 1994 Regents of the University of Michigan.
32*7c478bd9Sstevel@tonic-gate  * All rights reserved.
33*7c478bd9Sstevel@tonic-gate  *
34*7c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms are permitted
35*7c478bd9Sstevel@tonic-gate  * provided that this notice is preserved and that due credit is given
36*7c478bd9Sstevel@tonic-gate  * to the University of Michigan at Ann Arbor. The name of the University
37*7c478bd9Sstevel@tonic-gate  * may not be used to endorse or promote products derived from this
38*7c478bd9Sstevel@tonic-gate  * software without specific prior written permission. This software
39*7c478bd9Sstevel@tonic-gate  * is provided ``as is'' without express or implied warranty.
40*7c478bd9Sstevel@tonic-gate  *
41*7c478bd9Sstevel@tonic-gate  * searchpref.h:  display template library defines
42*7c478bd9Sstevel@tonic-gate  */
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate #ifndef _SRCHPREF_H
46*7c478bd9Sstevel@tonic-gate #define _SRCHPREF_H
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
49*7c478bd9Sstevel@tonic-gate extern "C" {
50*7c478bd9Sstevel@tonic-gate #endif
51*7c478bd9Sstevel@tonic-gate 
52*7c478bd9Sstevel@tonic-gate /* calling conventions used by library */
53*7c478bd9Sstevel@tonic-gate #ifndef LDAP_CALL
54*7c478bd9Sstevel@tonic-gate #if defined( _WINDOWS ) || defined( _WIN32 )
55*7c478bd9Sstevel@tonic-gate #define LDAP_C __cdecl
56*7c478bd9Sstevel@tonic-gate #ifndef _WIN32
57*7c478bd9Sstevel@tonic-gate #define __stdcall _far _pascal
58*7c478bd9Sstevel@tonic-gate #define LDAP_CALLBACK _loadds
59*7c478bd9Sstevel@tonic-gate #else
60*7c478bd9Sstevel@tonic-gate #define LDAP_CALLBACK
61*7c478bd9Sstevel@tonic-gate #endif /* _WIN32 */
62*7c478bd9Sstevel@tonic-gate #define LDAP_PASCAL __stdcall
63*7c478bd9Sstevel@tonic-gate #define LDAP_CALL LDAP_PASCAL
64*7c478bd9Sstevel@tonic-gate #else /* _WINDOWS */
65*7c478bd9Sstevel@tonic-gate #define LDAP_C
66*7c478bd9Sstevel@tonic-gate #define LDAP_CALLBACK
67*7c478bd9Sstevel@tonic-gate #define LDAP_PASCAL
68*7c478bd9Sstevel@tonic-gate #define LDAP_CALL
69*7c478bd9Sstevel@tonic-gate #endif /* _WINDOWS */
70*7c478bd9Sstevel@tonic-gate #endif /* LDAP_CALL */
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate #ifndef _SOLARIS_SDK
73*7c478bd9Sstevel@tonic-gate 
74*7c478bd9Sstevel@tonic-gate struct ldap_searchattr {
75*7c478bd9Sstevel@tonic-gate 	char				*sa_attrlabel;
76*7c478bd9Sstevel@tonic-gate 	char				*sa_attr;
77*7c478bd9Sstevel@tonic-gate 					/* max 32 matchtypes for now */
78*7c478bd9Sstevel@tonic-gate 	unsigned long			sa_matchtypebitmap;
79*7c478bd9Sstevel@tonic-gate 	char				*sa_selectattr;
80*7c478bd9Sstevel@tonic-gate 	char				*sa_selecttext;
81*7c478bd9Sstevel@tonic-gate 	struct ldap_searchattr		*sa_next;
82*7c478bd9Sstevel@tonic-gate };
83*7c478bd9Sstevel@tonic-gate 
84*7c478bd9Sstevel@tonic-gate struct ldap_searchmatch {
85*7c478bd9Sstevel@tonic-gate 	char				*sm_matchprompt;
86*7c478bd9Sstevel@tonic-gate 	char				*sm_filter;
87*7c478bd9Sstevel@tonic-gate 	struct ldap_searchmatch		*sm_next;
88*7c478bd9Sstevel@tonic-gate };
89*7c478bd9Sstevel@tonic-gate 
90*7c478bd9Sstevel@tonic-gate struct ldap_searchobj {
91*7c478bd9Sstevel@tonic-gate 	char				*so_objtypeprompt;
92*7c478bd9Sstevel@tonic-gate 	unsigned long			so_options;
93*7c478bd9Sstevel@tonic-gate 	char				*so_prompt;
94*7c478bd9Sstevel@tonic-gate 	short				so_defaultscope;
95*7c478bd9Sstevel@tonic-gate 	char				*so_filterprefix;
96*7c478bd9Sstevel@tonic-gate 	char				*so_filtertag;
97*7c478bd9Sstevel@tonic-gate 	char				*so_defaultselectattr;
98*7c478bd9Sstevel@tonic-gate 	char				*so_defaultselecttext;
99*7c478bd9Sstevel@tonic-gate 	struct ldap_searchattr		*so_salist;
100*7c478bd9Sstevel@tonic-gate 	struct ldap_searchmatch		*so_smlist;
101*7c478bd9Sstevel@tonic-gate 	struct ldap_searchobj		*so_next;
102*7c478bd9Sstevel@tonic-gate };
103*7c478bd9Sstevel@tonic-gate 
104*7c478bd9Sstevel@tonic-gate #define NULLSEARCHOBJ			((struct ldap_searchobj *)0)
105*7c478bd9Sstevel@tonic-gate 
106*7c478bd9Sstevel@tonic-gate /*
107*7c478bd9Sstevel@tonic-gate  * global search object options
108*7c478bd9Sstevel@tonic-gate  */
109*7c478bd9Sstevel@tonic-gate #define LDAP_SEARCHOBJ_OPT_INTERNAL	0x00000001
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate #define LDAP_IS_SEARCHOBJ_OPTION_SET( so, option )	\
112*7c478bd9Sstevel@tonic-gate 	(((so)->so_options & option ) != 0 )
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_VERSION_ZERO	0
115*7c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_VERSION		1
116*7c478bd9Sstevel@tonic-gate 
117*7c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_ERR_VERSION	1
118*7c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_ERR_MEM		2
119*7c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_ERR_SYNTAX	3
120*7c478bd9Sstevel@tonic-gate #define LDAP_SEARCHPREF_ERR_FILE	4
121*7c478bd9Sstevel@tonic-gate 
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate LDAP_API(int)
124*7c478bd9Sstevel@tonic-gate LDAP_CALL
125*7c478bd9Sstevel@tonic-gate ldap_init_searchprefs( char *file, struct ldap_searchobj **solistp );
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate LDAP_API(int)
128*7c478bd9Sstevel@tonic-gate LDAP_CALL
129*7c478bd9Sstevel@tonic-gate ldap_init_searchprefs_buf( char *buf, long buflen,
130*7c478bd9Sstevel@tonic-gate 	struct ldap_searchobj **solistp );
131*7c478bd9Sstevel@tonic-gate 
132*7c478bd9Sstevel@tonic-gate LDAP_API(void)
133*7c478bd9Sstevel@tonic-gate LDAP_CALL
134*7c478bd9Sstevel@tonic-gate ldap_free_searchprefs( struct ldap_searchobj *solist );
135*7c478bd9Sstevel@tonic-gate 
136*7c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_searchobj *)
137*7c478bd9Sstevel@tonic-gate LDAP_CALL
138*7c478bd9Sstevel@tonic-gate ldap_first_searchobj( struct ldap_searchobj *solist );
139*7c478bd9Sstevel@tonic-gate 
140*7c478bd9Sstevel@tonic-gate LDAP_API(struct ldap_searchobj *)
141*7c478bd9Sstevel@tonic-gate LDAP_CALL
142*7c478bd9Sstevel@tonic-gate ldap_next_searchobj( struct ldap_searchobj *sollist,
143*7c478bd9Sstevel@tonic-gate 	struct ldap_searchobj *so );
144*7c478bd9Sstevel@tonic-gate 
145*7c478bd9Sstevel@tonic-gate #endif /* _SOLARIS_SDK */
146*7c478bd9Sstevel@tonic-gate 
147*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
148*7c478bd9Sstevel@tonic-gate }
149*7c478bd9Sstevel@tonic-gate #endif
150*7c478bd9Sstevel@tonic-gate #endif /* _SRCHPREF_H */
151