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