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