xref: /illumos-gate/usr/src/lib/libnisdb/ldap_structs.h (revision 8b80e8cb6855118d46f605e91b5ed4ce83417395)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2001, 2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_LDAP_STRUCTS_H
28 #define	_LDAP_STRUCTS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/time.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * Some functions accept a pointer to either a __nis_mapping_item_t, or
40  * a __nis_value_t. This enum tells us which it is.
41  */
42 typedef enum {fa_any, fa_item, fa_value} __nis_format_arg_t;
43 
44 /*
45  * A __nis_value_t contains either string (vt_string) or non-string
46  * (vt_ber) values.
47  */
48 typedef enum {vt_any, vt_string, vt_ber} __nis_value_type_t;
49 
50 /* A single value. If the value is a (char *), the length includes the NUL */
51 typedef struct {
52 	int			length;
53 	void			*value;
54 } __nis_single_value_t;
55 
56 /*
57  * Holds multiple values of the specified type.
58  */
59 typedef struct {
60 	__nis_value_type_t	type;
61 	int			repeat;		/* Should value be repeated ? */
62 	int			numVals;
63 	__nis_single_value_t	*val;
64 } __nis_value_t;
65 
66 /* Structure used to build rule values */
67 typedef struct {
68 	int			numColumns;	/* Number of col names/vals */
69 	char			**colName;	/* Column names */
70 	__nis_value_t		*colVal;	/* Column values */
71 	int			numAttrs;	/* Number of attr names vals */
72 	char			**attrName;	/* Attribute names */
73 	__nis_value_t		*attrVal;	/* Attribute values */
74 } __nis_rule_value_t;
75 
76 /* Structure containing information that ldap_search_s() wants */
77 typedef struct {
78 	unsigned char	useCon;	/* Should we use existing connection ? */
79 	char		*base;
80 	int		scope;
81 	int		numFilterComps;
82 	char		**filterComp;
83 	char		*filter;
84 	int		numAttrs;
85 	char		**attrs;
86 	int		attrsonly;
87 	int		isDN;
88 	struct timeval	timeout;
89 } __nis_ldap_search_t;
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif	/* _LDAP_STRUCTS_H */
96